6da81a12aa0ac883c42e5c92d93ad13ce1186313
[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 Mon Jan 17 10:22:31 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtold=''
533 d_strtoll=''
534 d_strtoul=''
535 d_strtoull=''
536 d_strtouq=''
537 d_strxfrm=''
538 d_symlink=''
539 d_syscall=''
540 d_sysconf=''
541 d_system=''
542 d_tcgetpgrp=''
543 d_tcsetpgrp=''
544 d_telldirproto=''
545 d_time=''
546 timetype=''
547 clocktype=''
548 d_times=''
549 d_truncate=''
550 d_tzname=''
551 d_umask=''
552 d_semctl_semid_ds=''
553 d_semctl_semun=''
554 d_union_semun=''
555 d_ustat=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 dlext=''
568 cccdlflags=''
569 ccdlflags=''
570 dlsrc=''
571 ld=''
572 lddlflags=''
573 usedl=''
574 doublesize=''
575 ebcdic=''
576 fflushNULL=''
577 fflushall=''
578 fpossize=''
579 fpostype=''
580 gidformat=''
581 gidsign=''
582 gidsize=''
583 gidtype=''
584 groupstype=''
585 h_fcntl=''
586 h_sysfile=''
587 i_arpainet=''
588 db_hashtype=''
589 db_prefixtype=''
590 i_db=''
591 i_dbm=''
592 i_rpcsvcdbm=''
593 d_dirnamlen=''
594 direntrytype=''
595 i_dirent=''
596 i_dld=''
597 i_dlfcn=''
598 i_fcntl=''
599 i_float=''
600 i_gdbm=''
601 d_grpasswd=''
602 i_grp=''
603 i_inttypes=''
604 i_limits=''
605 i_locale=''
606 i_machcthr=''
607 i_malloc=''
608 i_math=''
609 i_memory=''
610 i_mntent=''
611 i_ndbm=''
612 i_netdb=''
613 i_neterrno=''
614 i_netinettcp=''
615 i_niin=''
616 i_sysin=''
617 i_poll=''
618 i_pthread=''
619 d_pwage=''
620 d_pwchange=''
621 d_pwclass=''
622 d_pwcomment=''
623 d_pwexpire=''
624 d_pwgecos=''
625 d_pwpasswd=''
626 d_pwquota=''
627 i_pwd=''
628 i_sfio=''
629 i_shadow=''
630 i_socks=''
631 i_stddef=''
632 i_stdlib=''
633 i_string=''
634 strings=''
635 i_sysaccess=''
636 i_sysdir=''
637 i_sysfile=''
638 d_voidtty=''
639 i_bsdioctl=''
640 i_sysfilio=''
641 i_sysioctl=''
642 i_syssockio=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatfs=''
651 i_sysstatvfs=''
652 i_systimes=''
653 i_systypes=''
654 i_sysuio=''
655 i_sysun=''
656 i_sysvfs=''
657 i_syswait=''
658 i_sgtty=''
659 i_termio=''
660 i_termios=''
661 i_systime=''
662 i_systimek=''
663 i_time=''
664 timeincl=''
665 i_unistd=''
666 i_ustat=''
667 i_utime=''
668 i_values=''
669 i_stdarg=''
670 i_varargs=''
671 i_varhdr=''
672 i_vfork=''
673 inc_version_list=''
674 installprefix=''
675 installprefixexp=''
676 installstyle=''
677 installusrbinperl=''
678 intsize=''
679 longsize=''
680 shortsize=''
681 d_fpos64_t=''
682 d_off64_t=''
683 libc=''
684 ldlibpthname=''
685 libperl=''
686 shrpenv=''
687 useshrplib=''
688 glibpth=''
689 libpth=''
690 loclibpth=''
691 plibpth=''
692 xlibpth=''
693 ignore_versioned_solibs=''
694 libs=''
695 lns=''
696 d_PRIEldbl=''
697 d_PRIFldbl=''
698 d_PRIGldbl=''
699 d_PRIeldbl=''
700 d_PRIfldbl=''
701 d_PRIgldbl=''
702 sPRIEldbl=''
703 sPRIFldbl=''
704 sPRIGldbl=''
705 sPRIeldbl=''
706 sPRIfldbl=''
707 sPRIgldbl=''
708 lseeksize=''
709 lseektype=''
710 make_set_make=''
711 d_mymalloc=''
712 freetype=''
713 mallocobj=''
714 mallocsrc=''
715 malloctype=''
716 usemymalloc=''
717 installman1dir=''
718 man1dir=''
719 man1direxp=''
720 man1ext=''
721 installman3dir=''
722 man3dir=''
723 man3direxp=''
724 man3ext=''
725 huge=''
726 large=''
727 medium=''
728 models=''
729 small=''
730 split=''
731 modetype=''
732 multiarch=''
733 mydomain=''
734 myhostname=''
735 phostname=''
736 c=''
737 n=''
738 d_eofnblk=''
739 eagain=''
740 o_nonblock=''
741 rd_nodata=''
742 netdb_hlen_type=''
743 netdb_host_type=''
744 netdb_name_type=''
745 netdb_net_type=''
746 groupcat=''
747 hostcat=''
748 passcat=''
749 orderlib=''
750 ranlib=''
751 package=''
752 spackage=''
753 pager=''
754 api_revision=''
755 api_subversion=''
756 api_version=''
757 api_versionstring=''
758 patchlevel=''
759 subversion=''
760 version=''
761 perladmin=''
762 perlpath=''
763 i16size=''
764 i16type=''
765 i32size=''
766 i32type=''
767 i64size=''
768 i64type=''
769 i8size=''
770 i8type=''
771 ivsize=''
772 ivtype=''
773 nvsize=''
774 nvtype=''
775 u16size=''
776 u16type=''
777 u32size=''
778 u32type=''
779 u64size=''
780 u64type=''
781 u8size=''
782 u8type=''
783 uvsize=''
784 uvtype=''
785 ivdformat=''
786 uvoformat=''
787 uvuformat=''
788 uvxformat=''
789 pidtype=''
790 prefix=''
791 prefixexp=''
792 installprivlib=''
793 privlib=''
794 privlibexp=''
795 prototype=''
796 ptrsize=''
797 d_PRIX64=''
798 d_PRId64=''
799 d_PRIi64=''
800 d_PRIo64=''
801 d_PRIu64=''
802 d_PRIx64=''
803 sPRIX64=''
804 sPRId64=''
805 sPRIi64=''
806 sPRIo64=''
807 sPRIu64=''
808 sPRIx64=''
809 d_quad=''
810 quadkind=''
811 quadtype=''
812 uquadtype=''
813 drand01=''
814 randbits=''
815 randfunc=''
816 randseedtype=''
817 seedfunc=''
818 installscript=''
819 scriptdir=''
820 scriptdirexp=''
821 selectminbits=''
822 selecttype=''
823 sh=''
824 sig_count=''
825 sig_name=''
826 sig_name_init=''
827 sig_num=''
828 sig_num_init=''
829 installsitearch=''
830 sitearch=''
831 sitearchexp=''
832 installsitebin=''
833 sitebin=''
834 sitebinexp=''
835 installsitelib=''
836 sitelib=''
837 sitelibexp=''
838 siteprefix=''
839 siteprefixexp=''
840 sizetype=''
841 so=''
842 sharpbang=''
843 shsharp=''
844 spitshell=''
845 src=''
846 ssizetype=''
847 startperl=''
848 startsh=''
849 stdchar=''
850 d_stdio_stream_array=''
851 stdio_stream_array=''
852 sysman=''
853 trnl=''
854 uidformat=''
855 uidsign=''
856 uidsize=''
857 uidtype=''
858 archname64=''
859 use64bits=''
860 uselargefiles=''
861 uselongdouble=''
862 uselonglong=''
863 usemorebits=''
864 usemultiplicity=''
865 nm_opt=''
866 nm_so_opt=''
867 runnm=''
868 usenm=''
869 useperlio=''
870 usesocks=''
871 d_oldpthreads=''
872 use5005threads=''
873 useithreads=''
874 usethreads=''
875 incpath=''
876 mips_type=''
877 usrinc=''
878 d_vendorbin=''
879 installvendorbin=''
880 vendorbin=''
881 vendorbinexp=''
882 d_vendorlib=''
883 installvendorlib=''
884 vendorlib=''
885 vendorlibexp=''
886 usevendorprefix=''
887 vendorprefix=''
888 vendorprefixexp=''
889 defvoidused=''
890 voidflags=''
891 CONFIG=''
892
893 define='define'
894 undef='undef'
895 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
896 rmlist=''
897
898 : We must find out about Eunice early
899 eunicefix=':'
900 if test -f /etc/unixtovms; then
901         eunicefix=/etc/unixtovms
902 fi
903 if test -f /etc/unixtovms.exe; then
904         eunicefix=/etc/unixtovms.exe
905 fi
906
907 i_whoami=''
908 : list of known cpp symbols, sorted alphabetically
909 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
910 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
911 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
912 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
913 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
914 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
915 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
916 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
917 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
918 al="$al VMS Xenix286"
919 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
920 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
921 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
922 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
923 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
924 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
925 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
926 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
927 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
928 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
929 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
930 al="$al __SVR4_2__ __UMAXV__"
931 al="$al ____386BSD____ __alpha __alpha__ __amiga"
932 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
933 al="$al __host_mips__"
934 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
935 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
936 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
937 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
938 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
939 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
940 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
941 al="$al __mc88100 __mc88100__ __mips __mips__"
942 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
943 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
944 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
945 al="$al _host_mips _mips _unix"
946 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
947 al="$al apollo ardent att386 att3b"
948 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
949 al="$al cadmus clipper concurrent convex cray ctix"
950 al="$al dmert encore gcos gcx gimpel gould"
951 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
952 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
953 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
954 al="$al i186 i286 i386 i486 i8086"
955 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
956 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
957 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
958 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
959 al="$al mc88000 mc88100 merlin mert mips mvs n16"
960 al="$al ncl_el ncl_mr"
961 al="$al news1500 news1700 news1800 news1900 news3700"
962 al="$al news700 news800 news900 ns16000 ns32000"
963 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
964 al="$al parisc pc532 pdp11 plexus posix pyr"
965 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
966 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
967 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
968 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
969 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
970 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
971 al="$al xenix z8000"
972
973 : set useposix=false in your hint file to disable the POSIX extension.
974 useposix=true
975 : set useopcode=false in your hint file to disable the Opcode extension.
976 useopcode=true
977 : Trailing extension.  Override this in a hint file, if needed.
978 _exe=''
979 : Extra object files, if any, needed on this platform.
980 archobjs=''
981 : Possible local include directories to search.
982 : Set locincpth to "" in a hint file to defeat local include searches.
983 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
984 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
985 :
986 : no include file wanted by default
987 inclwanted=''
988
989 groupstype=''
990 : change the next line if compiling for Xenix/286 on Xenix/386
991 xlibpth='/usr/lib/386 /lib/386'
992
993 : Possible local library directories to search.
994 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
995 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
996
997 : general looking path for locating libraries
998 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
999 glibpth="$glibpth /lib /usr/lib $xlibpth"
1000 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
1001 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1002
1003 : Private path used by Configure to find libraries.  Its value
1004 : is prepended to libpth. This variable takes care of special
1005 : machines, like the mips.  Usually, it should be empty.
1006 plibpth=''
1007
1008 : default library list
1009 libswanted=''
1010 : some systems want to use only the non-versioned libso:s
1011 ignore_versioned_solibs=''
1012 : set usemultiplicity on the Configure command line to enable multiplicity.
1013 : set usesocks on the Configure command line to enable socks.
1014 : set usethreads on the Configure command line to enable threads.
1015 : full support for void wanted by default
1016 defvoidused=15
1017
1018 : List of libraries we want.
1019 : If anyone needs -lnet, put it in a hint file.
1020 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1021 libswanted="$libswanted dld ld sun m c cposix posix"
1022 libswanted="$libswanted ndir dir crypt sec"
1023 libswanted="$libswanted ucb bsd BSD PW x"
1024 : We probably want to search /usr/shlib before most other libraries.
1025 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1026 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1027 glibpth="/usr/shlib $glibpth"
1028 : Do not use vfork unless overridden by a hint file.
1029 usevfork=false
1030
1031 : Find the basic shell for Bourne shell scripts
1032 case "$sh" in
1033 '')
1034         case "$SYSTYPE" in
1035         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1036         *) xxx='/bin/sh';;
1037         esac
1038         if test -f "$xxx"; then
1039                 sh="$xxx"
1040         else
1041                 : Build up a list and do a single loop so we can 'break' out.
1042                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1043                 for xxx in sh bash ksh pdksh ash; do
1044                         for p in $pth; do
1045                                 try="$try ${p}/${xxx}"
1046                         done
1047                 done
1048                 for xxx in $try; do
1049                         if test -f "$xxx"; then
1050                                 sh="$xxx";
1051                                 break
1052                         elif test -f "$xxx.exe"; then
1053                                 sh="$xxx";
1054                                 break
1055                         fi
1056                 done
1057         fi
1058         ;;
1059 esac
1060
1061 case "$sh" in
1062 '')     cat <<EOM >&2
1063 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1064
1065 Usually it's in /bin/sh.  How did you even get this far?
1066 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1067 we'll try to straighten this all out.
1068 EOM
1069         exit 1
1070         ;;
1071 esac
1072
1073 : see if sh knows # comments
1074 if `$sh -c '#' >/dev/null 2>&1`; then
1075         shsharp=true
1076         spitshell=cat
1077         xcat=/bin/cat
1078         test -f $xcat || xcat=/usr/bin/cat
1079         echo "#!$xcat" >try
1080         $eunicefix try
1081         chmod +x try
1082         ./try > today
1083         if test -s today; then
1084                 sharpbang='#!'
1085         else
1086                 echo "#! $xcat" > try
1087                 $eunicefix try
1088                 chmod +x try
1089                 ./try > today
1090                 if test -s today; then
1091                         sharpbang='#! '
1092                 else
1093                         sharpbang=': use '
1094                 fi
1095         fi
1096 else
1097         echo " "
1098         echo "Your $sh doesn't grok # comments--I will strip them later on."
1099         shsharp=false
1100         cd ..
1101         echo "exec grep -v '^[  ]*#'" >spitshell
1102         chmod +x spitshell
1103         $eunicefix spitshell
1104         spitshell=`pwd`/spitshell
1105         cd UU
1106         echo "I presume that if # doesn't work, #! won't work either!"
1107         sharpbang=': use '
1108 fi
1109 rm -f try today
1110
1111 : figure out how to guarantee sh startup
1112 case "$startsh" in
1113 '') startsh=${sharpbang}${sh} ;;
1114 *)
1115 esac
1116 cat >try <<EOSS
1117 $startsh
1118 set abc
1119 test "$?abc" != 1
1120 EOSS
1121
1122 chmod +x try
1123 $eunicefix try
1124 if ./try; then
1125         : echo "Yup, it does."
1126 else
1127         echo "Hmm... '$startsh' does not guarantee sh startup..."
1128         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1129 fi
1130 rm -f try
1131
1132
1133 : Save command line options in file UU/cmdline.opt for later use in
1134 : generating config.sh.
1135 cat > cmdline.opt <<EOSH
1136 # Configure command line arguments.
1137 config_arg0='$0'
1138 config_args='$*'
1139 config_argc=$#
1140 EOSH
1141 argn=1
1142 for arg in "$@"; do
1143         cat >>cmdline.opt <<EOSH
1144 config_arg$argn='$arg'
1145 EOSH
1146         argn=`expr $argn + 1`
1147 done
1148
1149 : produce awk script to parse command line options
1150 cat >options.awk <<'EOF'
1151 BEGIN {
1152         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1153
1154         len = length(optstr);
1155         for (i = 1; i <= len; i++) {
1156                 c = substr(optstr, i, 1);
1157                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1158                 if (a == ":") {
1159                         arg[c] = 1;
1160                         i++;
1161                 }
1162                 opt[c] = 1;
1163         }
1164 }
1165 {
1166         expect = 0;
1167         str = $0;
1168         if (substr(str, 1, 1) != "-") {
1169                 printf("'%s'\n", str);
1170                 next;
1171         }
1172         len = length($0);
1173         for (i = 2; i <= len; i++) {
1174                 c = substr(str, i, 1);
1175                 if (!opt[c]) {
1176                         printf("-%s\n", substr(str, i));
1177                         next;
1178                 }
1179                 printf("-%s\n", c);
1180                 if (arg[c]) {
1181                         if (i < len)
1182                                 printf("'%s'\n", substr(str, i + 1));
1183                         else
1184                                 expect = 1;
1185                         next;
1186                 }
1187         }
1188 }
1189 END {
1190         if (expect)
1191                 print "?";
1192 }
1193 EOF
1194
1195 : process the command line options
1196 set X `for arg in "$@"; do echo "X$arg"; done |
1197         sed -e s/X// | awk -f options.awk`
1198 eval "set $*"
1199 shift
1200 rm -f options.awk
1201
1202 : set up default values
1203 fastread=''
1204 reuseval=false
1205 config_sh=''
1206 alldone=''
1207 error=''
1208 silent=''
1209 extractsh=''
1210 override=''
1211 knowitall=''
1212 rm -f optdef.sh posthint.sh
1213 cat >optdef.sh <<EOS
1214 $startsh
1215 EOS
1216
1217
1218 : option parsing
1219 while test $# -gt 0; do
1220         case "$1" in
1221         -d) shift; fastread=yes;;
1222         -e) shift; alldone=cont;;
1223         -f)
1224                 shift
1225                 cd ..
1226                 if test -r "$1"; then
1227                         config_sh="$1"
1228                 else
1229                         echo "$me: cannot read config file $1." >&2
1230                         error=true
1231                 fi
1232                 cd UU
1233                 shift;;
1234         -h) shift; error=true;;
1235         -r) shift; reuseval=true;;
1236         -s) shift; silent=true; realsilent=true;;
1237         -E) shift; alldone=exit;;
1238         -K) shift; knowitall=true;;
1239         -O) shift; override=true;;
1240         -S) shift; silent=true; extractsh=true;;
1241         -D)
1242                 shift
1243                 case "$1" in
1244                 *=)
1245                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1246                         echo "$me: ignoring -D $1" >&2
1247                         ;;
1248                 *=*) echo "$1" | \
1249                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1250                 *) echo "$1='define'" >> optdef.sh;;
1251                 esac
1252                 shift
1253                 ;;
1254         -U)
1255                 shift
1256                 case "$1" in
1257                 *=) echo "$1" >> optdef.sh;;
1258                 *=*)
1259                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1260                         echo "$me: ignoring -U $1" >&2
1261                         ;;
1262                 *) echo "$1='undef'" >> optdef.sh;;
1263                 esac
1264                 shift
1265                 ;;
1266         -A)
1267             shift
1268             xxx=''
1269             yyy="$1"
1270             zzz=''
1271             uuu=undef
1272             case "$yyy" in
1273             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1274                  case "$zzz" in
1275                  *:*) zzz='' ;;
1276                  *)   xxx=append
1277                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1278                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1279                  esac
1280                  ;;
1281             esac
1282             case "$xxx" in
1283             '')  case "$yyy" in
1284                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1285                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1286                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1287                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1288                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1289                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1290                  esac
1291                  ;;       
1292             esac
1293             case "$xxx" in
1294             append)
1295                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1296             clear)
1297                 echo "$yyy=''"                  >> posthint.sh ;;
1298             define)
1299                 case "$zzz" in
1300                 '') zzz=define ;;
1301                 esac
1302                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1303             eval)
1304                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1305             prepend)
1306                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1307             undef)
1308                 case "$zzz" in
1309                 '') zzz="$uuu" ;;
1310                 esac
1311                 echo "$yyy=$zzz"                >> posthint.sh ;;
1312             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1313             esac
1314             ;;
1315         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1316             exit 0;;
1317         --) break;;
1318         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1319         *) break;;
1320         esac
1321 done
1322
1323 case "$error" in
1324 true)
1325         cat >&2 <<EOM
1326 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1327                  [-U symbol] [-U symbol=] [-A command:symbol...]
1328   -d : use defaults for all answers.
1329   -e : go on without questioning past the production of config.sh.
1330   -f : specify an alternate default configuration file.
1331   -h : print this help message and exit (with an error status).
1332   -r : reuse C symbols value if possible (skips costly nm extraction).
1333   -s : silent mode, only echoes questions and essential information.
1334   -D : define symbol to have some value:
1335          -D symbol         symbol gets the value 'define'
1336          -D symbol=value   symbol gets the value 'value'
1337   -E : stop at the end of questions, after having produced config.sh.
1338   -K : do not use unless you know what you are doing.
1339   -O : let -D and -U override definitions from loaded configuration file.
1340   -S : perform variable substitutions on all .SH files (can mix with -f)
1341   -U : undefine symbol:
1342          -U symbol    symbol gets the value 'undef'
1343          -U symbol=   symbol gets completely empty
1344   -A : manipulate symbol after the platform specific hints have been applied:
1345          -A symbol=value                append " "value to symbol
1346          -A append:symbol=value         append value to symbol
1347          -A define:symbol=value         define symbol to have value
1348          -A clear:symbol                define symbol to be ''
1349          -A define:symbol               define symbol to be 'define'
1350          -A eval:symbol=value           define symbol to be eval of value
1351          -A prepend:symbol=value        prepend value to symbol
1352          -A undef:symbol                define symbol to be 'undef'
1353          -A undef:symbol=               define symbol to be ''
1354   -V : print version number and exit (with a zero status).
1355 EOM
1356         exit 1
1357         ;;
1358 esac
1359
1360 : Sanity checks
1361 case "$fastread$alldone" in
1362 yescont|yesexit) ;;
1363 *)
1364         if test ! -t 0; then
1365                 echo "Say 'sh Configure', not 'sh <Configure'"
1366                 exit 1
1367         fi
1368         ;;
1369 esac
1370
1371 exec 4>&1
1372 case "$silent" in
1373 true) exec 1>/dev/null;;
1374 esac
1375
1376 : run the defines and the undefines, if any, but leave the file out there...
1377 touch optdef.sh
1378 . ./optdef.sh
1379 : create the posthint manipulation script and leave the file out there...
1380 touch posthint.sh
1381
1382 : set package name
1383 package=perl5
1384 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1385 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1386 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1387 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1388 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1389 esac
1390
1391 : Some greps do not return status, grrr.
1392 echo "grimblepritz" >grimble
1393 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1394         contains=contains
1395 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1396         contains=grep
1397 else
1398         contains=contains
1399 fi
1400 rm -f grimble
1401 : the following should work in any shell
1402 case "$contains" in
1403 contains*)
1404         echo " "
1405         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1406         cat >contains <<'EOSS'
1407 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1408 EOSS
1409 chmod +x contains
1410 esac
1411
1412 : Find the path to the source tree
1413 case "$src" in
1414 '') case "$0" in
1415     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1416          case "$src" in
1417          /*)    ;;
1418          *)     src=`cd ../$src && pwd` ;;
1419          esac
1420          ;;
1421     *)   src='.';;
1422     esac;;
1423 esac
1424 case "$src" in
1425 '')     src=/
1426         rsrc=/
1427         ;;
1428 /*) rsrc="$src";;
1429 *) rsrc="../$src";;
1430 esac
1431 if test -f $rsrc/Configure && \
1432         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1433 then
1434    : found it, so we are ok.
1435 else
1436         rsrc=''
1437         for src in . .. ../.. ../../.. ../../../..; do
1438                 if test -f ../$src/Configure && \
1439                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1440                 then
1441                         rsrc=../$src
1442                         break
1443                 fi
1444         done
1445 fi
1446 case "$rsrc" in
1447 '')
1448         cat <<EOM >&4
1449
1450 Sorry, I can't seem to locate the source dir for $package.  Please start
1451 Configure with an explicit path -- i.e. /some/path/Configure.
1452
1453 EOM
1454         exit 1
1455         ;;
1456 ../.)   rsrc='..';;
1457 *)
1458         echo " "
1459         echo "Sources for $package found in \"$src\"." >&4
1460         ;;
1461 esac
1462
1463 : script used to extract .SH files with variable substitutions
1464 cat >extract <<'EOS'
1465 CONFIGDOTSH=true
1466 echo "Doing variable substitutions on .SH files..."
1467 if test -f $src/MANIFEST; then
1468         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1469 else
1470         echo "(Looking for .SH files under the source directory.)"
1471         set x `(cd $src; find . -name "*.SH" -print)`
1472 fi
1473 shift
1474 case $# in
1475 0) set x `(cd $src; echo *.SH)`; shift;;
1476 esac
1477 if test ! -f $src/$1; then
1478         shift
1479 fi
1480 mkdir_p='
1481 name=$1;
1482 create="";
1483 while test $name; do
1484         if test ! -d "$name"; then
1485                 create="$name $create";
1486                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1487                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1488         else
1489                 name="";
1490         fi;
1491 done;
1492 for file in $create; do
1493         mkdir $file;
1494 done
1495 '
1496 for file in $*; do
1497         case "$src" in
1498         ".")
1499                 case "$file" in
1500                 */*)
1501                         dir=`expr X$file : 'X\(.*\)/'`
1502                         file=`expr X$file : 'X.*/\(.*\)'`
1503                         (cd $dir && . ./$file)
1504                         ;;
1505                 *)
1506                         . ./$file
1507                         ;;
1508                 esac
1509                 ;;
1510         *)
1511                 case "$file" in
1512                 */*)
1513                         dir=`expr X$file : 'X\(.*\)/'`
1514                         file=`expr X$file : 'X.*/\(.*\)'`
1515                         (set x $dir; shift; eval $mkdir_p)
1516                         sh <$src/$dir/$file
1517                         ;;
1518                 *)
1519                         sh <$src/$file
1520                         ;;
1521                 esac
1522                 ;;
1523         esac
1524 done
1525 if test -f $src/config_h.SH; then
1526         if test ! -f config.h; then
1527         : oops, they left it out of MANIFEST, probably, so do it anyway.
1528         . $src/config_h.SH
1529         fi
1530 fi
1531 EOS
1532
1533 : extract files and exit if asked to do so
1534 case "$extractsh" in
1535 true)
1536         case "$realsilent" in
1537         true) ;;
1538         *) exec 1>&4;;
1539         esac
1540         case "$config_sh" in
1541         '') config_sh='config.sh';;
1542         esac
1543         echo " "
1544         echo "Fetching answers from $config_sh..."
1545         cd ..
1546         . $config_sh
1547         test "$override" && . ./optdef.sh
1548         echo " "
1549         . UU/extract
1550         rm -rf UU
1551         echo "Done."
1552         exit 0
1553         ;;
1554 esac
1555
1556 : Eunice requires " " instead of "", can you believe it
1557 echo " "
1558 : Here we go...
1559 echo "Beginning of configuration questions for $package."
1560
1561 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1562
1563 : first determine how to suppress newline on echo command
1564 echo " "
1565 echo "Checking echo to see how to suppress newlines..."
1566 (echo "hi there\c" ; echo " ") >.echotmp
1567 if $contains c .echotmp >/dev/null 2>&1 ; then
1568         echo "...using -n."
1569         n='-n'
1570         c=''
1571 else
1572         cat <<'EOM'
1573 ...using \c
1574 EOM
1575         n=''
1576         c='\c'
1577 fi
1578 echo $n "The star should be here-->$c"
1579 echo '*'
1580 rm -f .echotmp
1581
1582 : Now test for existence of everything in MANIFEST
1583 echo " "
1584 if test -f $rsrc/MANIFEST; then
1585         echo "First let's make sure your kit is complete.  Checking..." >&4
1586         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1587         rm -f missing
1588         tmppwd=`pwd`
1589         for filelist in x??; do
1590                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1591         done
1592         if test -s missing; then
1593                 cat missing >&4
1594                 cat >&4 <<'EOM'
1595
1596 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1597
1598 You have the option of continuing the configuration process, despite the
1599 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1600 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1601 and contact the author (perlbug@perl.com).
1602
1603 EOM
1604                 echo $n "Continue? [n] $c" >&4
1605                 read ans
1606                 case "$ans" in
1607                 y*)
1608                         echo "Continuing..." >&4
1609                         rm -f missing
1610                         ;;
1611                 *)
1612                         echo "ABORTING..." >&4
1613                         kill $$
1614                         ;;
1615                 esac
1616         else
1617                 echo "Looks good..."
1618         fi
1619 else
1620         echo "There is no MANIFEST file.  I hope your kit is complete !"
1621 fi
1622 rm -f missing x??
1623
1624 echo " "
1625 : Find the appropriate value for a newline for tr
1626 if test -n "$DJGPP"; then
1627        trnl='\012'
1628 fi
1629 if test X"$trnl" = X; then
1630         case "`echo foo|tr '\n' x 2>/dev/null`" in
1631         foox) trnl='\n' ;;
1632         esac
1633 fi
1634 if test X"$trnl" = X; then
1635         case "`echo foo|tr '\012' x 2>/dev/null`" in
1636         foox) trnl='\012' ;;
1637         esac
1638 fi
1639 if test X"$trnl" = X; then
1640         cat <<EOM >&2
1641
1642 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1643
1644 EOM
1645         exit 1
1646 fi
1647
1648 : compute the number of columns on the terminal for proper question formatting
1649 case "$COLUMNS" in
1650 '') COLUMNS='80';;
1651 esac
1652
1653 : set up the echo used in my read
1654 myecho="case \"\$xxxm\" in
1655 '') echo $n \"\$rp $c\" >&4;;
1656 *) case \"\$rp\" in
1657         '') echo $n \"[\$xxxm] $c\";;
1658         *)
1659                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1660                         echo \"\$rp\" >&4
1661                         echo $n \"[\$xxxm] $c\" >&4
1662                 else
1663                         echo $n \"\$rp [\$xxxm] $c\" >&4
1664                 fi
1665                 ;;
1666         esac;;
1667 esac"
1668
1669 : now set up to do reads with possible shell escape and default assignment
1670 cat <<EOSC >myread
1671 $startsh
1672 xxxm=\$dflt
1673 $myecho
1674 ans='!'
1675 case "\$fastread" in
1676 yes) case "\$dflt" in
1677         '') ;;
1678         *) ans='';
1679                 case "\$silent-\$rp" in
1680                 true-) ;;
1681                 *) echo " " >&4;;
1682                 esac;;
1683         esac;;
1684 *) case "\$silent" in
1685         true) case "\$rp" in
1686                 '') ans='';;
1687                 esac;;
1688         esac;;
1689 esac
1690 while expr "X\$ans" : "X!" >/dev/null; do
1691         read answ
1692         set x \$xxxm
1693         shift
1694         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1695         case  "\$answ" in
1696         "!")
1697                 sh 1>&4
1698                 echo " "
1699                 $myecho
1700                 ;;
1701         !*)
1702                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1703                 shift
1704                 sh 1>&4 -c "\$*"
1705                 echo " "
1706                 $myecho
1707                 ;;
1708         "\$ans")
1709                 case "\$ans" in
1710                 \\&*)
1711                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1712                         shift
1713                         case "\$1" in
1714                         -d)
1715                                 fastread=yes
1716                                 echo "(OK, I'll run with -d after this question.)" >&4
1717                                 ;;
1718                         -*)
1719                                 echo "*** Sorry, \$1 not supported yet." >&4
1720                                 ;;
1721                         esac
1722                         $myecho
1723                         ans=!
1724                         ;;
1725                 esac;;
1726         *)
1727                 case "\$aok" in
1728                 y)
1729                         echo "*** Substitution done -- please confirm."
1730                         xxxm="\$ans"
1731                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1732                         xxxm="\$ans"
1733                         ans=!
1734                         ;;
1735                 *)
1736                         echo "*** Error -- try again."
1737                         ans=!
1738                         ;;
1739                 esac
1740                 $myecho
1741                 ;;
1742         esac
1743         case "\$ans\$xxxm\$nostick" in
1744         '')
1745                 ans=!
1746                 $myecho
1747                 ;;
1748         esac
1749 done
1750 case "\$ans" in
1751 '') ans="\$xxxm";;
1752 esac
1753 EOSC
1754
1755 : create .config dir to save info across Configure sessions
1756 test -d ../.config || mkdir ../.config
1757 cat >../.config/README <<EOF
1758 This directory created by Configure to save information that should
1759 persist across sessions for $package.
1760
1761 You may safely delete it if you wish.
1762 EOF
1763
1764 : general instructions
1765 needman=true
1766 firsttime=true
1767 user=`(logname) 2>/dev/null`
1768 case "$user" in
1769 '') user=`whoami 2>&1`;;
1770 esac
1771 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1772         firsttime=false
1773         echo " "
1774         rp='Would you like to see the instructions?'
1775         dflt=n
1776         . ./myread
1777         case "$ans" in
1778         [yY]*) ;;
1779         *) needman=false;;
1780         esac
1781 fi
1782 if $needman; then
1783         cat <<EOH
1784
1785 This installation shell script will examine your system and ask you questions
1786 to determine how the perl5 package should be installed. If you get
1787 stuck on a question, you may use a ! shell escape to start a subshell or
1788 execute a command.  Many of the questions will have default answers in square
1789 brackets; typing carriage return will give you the default.
1790
1791 On some of the questions which ask for file or directory names you are allowed
1792 to use the ~name construct to specify the login directory belonging to "name",
1793 even if you don't have a shell which knows about that.  Questions where this is
1794 allowed will be marked "(~name ok)".
1795
1796 EOH
1797         rp=''
1798         dflt='Type carriage return to continue'
1799         . ./myread
1800         cat <<'EOH'
1801
1802 The prompter used in this script allows you to use shell variables and
1803 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1804 in the default answer, as if the default line was a set of arguments given to a
1805 script shell.  This means you may also use $* to repeat the whole default line,
1806 so you do not have to re-type everything to add something to the default.
1807
1808 Everytime there is a substitution, you will have to confirm.  If there is an
1809 error (e.g. an unmatched backtick), the default answer will remain unchanged
1810 and you will be prompted again.
1811
1812 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1813 the questions and use the computed defaults (or the previous answers if there
1814 was already a config.sh file). Type 'Configure -h' for a list of options.
1815 You may also start interactively and then answer '& -d' at any prompt to turn
1816 on the non-interactive behaviour for the remainder of the execution.
1817
1818 EOH
1819         . ./myread
1820         cat <<EOH
1821
1822 Much effort has been expended to ensure that this shell script will run on any
1823 Unix system.  If despite that it blows up on yours, your best bet is to edit
1824 Configure and run it again.  If you can't run Configure for some reason,
1825 you'll have to generate a config.sh file by hand.  Whatever problems you
1826 have, let me (perlbug@perl.com) know how I blew it.
1827
1828 This installation script affects things in two ways:
1829
1830 1) it may do direct variable substitutions on some of the files included
1831    in this kit.
1832 2) it builds a config.h file for inclusion in C programs.  You may edit
1833    any of these files as the need arises after running this script.
1834
1835 If you make a mistake on a question, there is no easy way to back up to it
1836 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1837 files.  Configure will offer to let you do this before it runs the SH files.
1838
1839 EOH
1840         dflt='Type carriage return to continue'
1841         . ./myread
1842         case "$firsttime" in
1843         true) echo $user >>../.config/instruct;;
1844         esac
1845 fi
1846
1847 : find out where common programs are
1848 echo " "
1849 echo "Locating common programs..." >&4
1850 cat <<EOSC >loc
1851 $startsh
1852 case \$# in
1853 0) exit 1;;
1854 esac
1855 thing=\$1
1856 shift
1857 dflt=\$1
1858 shift
1859 for dir in \$*; do
1860         case "\$thing" in
1861         .)
1862         if test -d \$dir/\$thing; then
1863                 echo \$dir
1864                 exit 0
1865         fi
1866         ;;
1867         *)
1868         for thisthing in \$dir/\$thing; do
1869                 : just loop through to pick last item
1870         done
1871         if test -f \$thisthing; then
1872                 echo \$thisthing
1873                 exit 0
1874         elif test -f \$dir/\$thing.exe; then
1875                 if test -n "$DJGPP"; then
1876                         echo \$dir/\$thing.exe
1877                 else
1878                         : on Eunice apparently
1879                         echo \$dir/\$thing
1880                 fi
1881                 exit 0
1882         fi
1883         ;;
1884         esac
1885 done
1886 echo \$dflt
1887 exit 1
1888 EOSC
1889 chmod +x loc
1890 $eunicefix loc
1891 loclist="
1892 awk
1893 cat
1894 comm
1895 cp
1896 echo
1897 expr
1898 grep
1899 ls
1900 make
1901 mkdir
1902 rm
1903 sed
1904 sort
1905 touch
1906 tr
1907 uniq
1908 "
1909 trylist="
1910 Mcc
1911 ar
1912 byacc
1913 cpp
1914 csh
1915 date
1916 egrep
1917 gzip
1918 less
1919 ln
1920 more
1921 nm
1922 nroff
1923 perl
1924 pg
1925 test
1926 uname
1927 zip
1928 "
1929 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1930 pth="$pth /lib /usr/lib"
1931 for file in $loclist; do
1932         eval xxx=\$$file
1933         case "$xxx" in
1934         /*|?:[\\/]*)
1935                 if test -f "$xxx"; then
1936                         : ok
1937                 else
1938                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1939                         xxx=`./loc $file $file $pth`
1940                 fi
1941                 ;;
1942         '') xxx=`./loc $file $file $pth`;;
1943         *) xxx=`./loc $xxx $xxx $pth`;;
1944         esac
1945         eval $file=$xxx
1946         eval _$file=$xxx
1947         case "$xxx" in
1948         /*)
1949                 echo $file is in $xxx.
1950                 ;;
1951         ?:[\\/]*)
1952                 echo $file is in $xxx.
1953                 ;;
1954         *)
1955                 echo "I don't know where '$file' is, and my life depends on it." >&4
1956                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1957                 exit 1
1958                 ;;
1959         esac
1960 done
1961 echo " "
1962 echo "Don't worry if any of the following aren't found..."
1963 say=offhand
1964 for file in $trylist; do
1965         eval xxx=\$$file
1966         case "$xxx" in
1967         /*|?:[\\/]*)
1968                 if test -f "$xxx"; then
1969                         : ok
1970                 else
1971                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1972                         xxx=`./loc $file $file $pth`
1973                 fi
1974                 ;;
1975         '') xxx=`./loc $file $file $pth`;;
1976         *) xxx=`./loc $xxx $xxx $pth`;;
1977         esac
1978         eval $file=$xxx
1979         eval _$file=$xxx
1980         case "$xxx" in
1981         /*)
1982                 echo $file is in $xxx.
1983                 ;;
1984         ?:[\\/]*)
1985                 echo $file is in $xxx.
1986                 ;;
1987         *)
1988                 echo "I don't see $file out there, $say."
1989                 say=either
1990                 ;;
1991         esac
1992 done
1993 case "$egrep" in
1994 egrep)
1995         echo "Substituting grep for egrep."
1996         egrep=$grep
1997         ;;
1998 esac
1999 case "$ln" in
2000 ln)
2001         echo "Substituting cp for ln."
2002         ln=$cp
2003         ;;
2004 esac
2005 case "$test" in
2006 test)
2007         echo "Hopefully test is built into your sh."
2008         ;;
2009 *)
2010         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2011                 echo "Using the test built into your sh."
2012                 test=test
2013                 _test=test
2014         fi
2015         ;;
2016 esac
2017 case "$echo" in
2018 echo)
2019         echo "Hopefully echo is built into your sh."
2020         ;;
2021 '') ;;
2022 *)
2023         echo " "
2024 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2025         $echo $n "hi there$c" >foo1
2026         echo $n "hi there$c" >foo2
2027         if cmp foo1 foo2 >/dev/null 2>&1; then
2028                 echo "They are compatible.  In fact, they may be identical."
2029         else
2030                 case "$n" in
2031                 '-n') n='' c='\c';;
2032                 *) n='-n' c='';;
2033                 esac
2034                 cat <<FOO
2035 They are not compatible!  You are probably running ksh on a non-USG system.
2036 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2037 have echo built in and we may have to run some Bourne shell scripts.  That
2038 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2039
2040 FOO
2041                 $echo $n "The star should be here-->$c"
2042                 $echo "*"
2043         fi
2044         $rm -f foo1 foo2
2045         ;;
2046 esac
2047
2048 : determine whether symbolic links are supported
2049 echo " "
2050 $touch blurfl
2051 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2052         echo "Symbolic links are supported." >&4
2053         lns="$ln -s"
2054 else
2055         echo "Symbolic links are NOT supported." >&4
2056         lns="$ln"
2057 fi
2058 $rm -f blurfl sym
2059
2060 : see whether [:lower:] and [:upper:] are supported character classes
2061 echo " "
2062 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2063 ABYZ)
2064         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2065         up='[:upper:]'
2066         low='[:lower:]'
2067         ;;
2068 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2069         # (0xc9 and 0xd1), therefore that is a nice testing point.
2070         if test "X$up" = X -o "X$low" = X; then
2071             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2072             ij) up='[A-Z]'
2073                 low='[a-z]'
2074                 ;;
2075             esac
2076         fi
2077         if test "X$up" = X -o "X$low" = X; then
2078             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2079             ij) up='A-Z'
2080                 low='a-z'
2081                 ;;
2082             esac
2083         fi
2084         if test "X$up" = X -o "X$low" = X; then
2085             case "`echo IJ | od -x 2>/dev/null`" in
2086             *C9D1*|*c9d1*)
2087                 echo "Hey, this might be EBCDIC." >&4
2088                 if test "X$up" = X -o "X$low" = X; then
2089                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2090                     ij) up='[A-IJ-RS-Z]'
2091                         low='[a-ij-rs-z]'
2092                         ;;
2093                     esac
2094                 fi
2095                 if test "X$up" = X -o "X$low" = X; then
2096                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2097                     ij) up='A-IJ-RS-Z'
2098                         low='a-ij-rs-z'
2099                         ;;
2100                     esac
2101                 fi
2102                 ;;
2103             esac
2104         fi
2105 esac
2106 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2107 ij)
2108     echo "Using $up and $low to convert case." >&4
2109     ;;
2110 *)
2111     echo "I don't know how to translate letters from upper to lower case." >&4
2112     echo "Your tr is not acting any way I know of." >&4
2113     exit 1
2114     ;;
2115 esac
2116 : set up the translation script tr, must be called with ./tr of course
2117 cat >tr <<EOSC
2118 $startsh
2119 case "\$1\$2" in
2120 '[A-Z][a-z]') exec $tr '$up' '$low';;
2121 '[a-z][A-Z]') exec $tr '$low' '$up';;
2122 esac
2123 exec $tr "\$@"
2124 EOSC
2125 chmod +x tr
2126 $eunicefix tr
2127
2128 : Try to determine whether config.sh was made on this system
2129 case "$config_sh" in
2130 '')
2131 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2132 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2133 # because the A-Z/a-z are not consecutive.
2134 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2135         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2136 newmyuname="$myuname"
2137 dflt=n
2138 case "$knowitall" in
2139 '')
2140         if test -f ../config.sh; then
2141                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2142                         eval "`grep myuname= ../config.sh`"
2143                 fi
2144                 if test "X$myuname" = "X$newmyuname"; then
2145                         dflt=y
2146                 fi
2147         fi
2148         ;;
2149 *) dflt=y;;
2150 esac
2151
2152 : Get old answers from old config file if Configure was run on the
2153 : same system, otherwise use the hints.
2154 hint=default
2155 cd ..
2156 if test -f config.sh; then
2157         echo " "
2158         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2159         . UU/myread
2160         case "$ans" in
2161         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2162         *)  echo "Fetching default answers from your old config.sh file..." >&4
2163                 tmp_n="$n"
2164                 tmp_c="$c"
2165                 tmp_sh="$sh"
2166                 . ./config.sh
2167                 cp config.sh UU
2168                 n="$tmp_n"
2169                 c="$tmp_c"
2170                 : Older versions did not always set $sh.  Catch re-use of such
2171                 : an old config.sh.
2172                 case "$sh" in
2173                 '') sh="$tmp_sh" ;;
2174                 esac
2175                 hint=previous
2176                 ;;
2177         esac
2178 fi
2179 if test ! -f config.sh; then
2180         $cat <<EOM
2181
2182 First time through, eh?  I have some defaults handy for some systems
2183 that need some extra help getting the Configure answers right:
2184
2185 EOM
2186         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2187         dflt=''
2188         : Half the following guesses are probably wrong... If you have better
2189         : tests or hints, please send them to perlbug@perl.com
2190         : The metaconfig authors would also appreciate a copy...
2191         $test -f /irix && osname=irix
2192         $test -f /xenix && osname=sco_xenix
2193         $test -f /dynix && osname=dynix
2194         $test -f /dnix && osname=dnix
2195         $test -f /lynx.os && osname=lynxos
2196         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2197         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2198         $test -f /bin/mips && /bin/mips && osname=mips
2199         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2200                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2201         $test -d /usr/apollo/bin && osname=apollo
2202         $test -f /etc/saf/_sactab && osname=svr4
2203         $test -d /usr/include/minix && osname=minix
2204         if $test -d /MachTen -o -d /MachTen_Folder; then
2205                 osname=machten
2206                 if $test -x /sbin/version; then
2207                         osvers=`/sbin/version | $awk '{print $2}' |
2208                         $sed -e 's/[A-Za-z]$//'`
2209                 elif $test -x /usr/etc/version; then
2210                         osvers=`/usr/etc/version | $awk '{print $2}' |
2211                         $sed -e 's/[A-Za-z]$//'`
2212                 else
2213                         osvers="$2.$3"
2214                 fi
2215         fi
2216
2217         $test -f /sys/posix.dll &&
2218                 $test -f /usr/bin/what &&
2219                 set X `/usr/bin/what /sys/posix.dll` &&
2220                 $test "$3" = UWIN &&
2221                 osname=uwin &&
2222                 osvers="$5"
2223
2224         if $test -f $uname; then
2225                 set X $myuname
2226                 shift
2227
2228                 case "$5" in
2229                 fps*) osname=fps ;;
2230                 mips*)
2231                         case "$4" in
2232                         umips) osname=umips ;;
2233                         *) osname=mips ;;
2234                         esac;;
2235                 [23]100) osname=mips ;;
2236                 next*) osname=next ;;
2237                 i386*)
2238                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2239                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2240                                 osname='sco'
2241                                 osvers=$tmp
2242                         elif $test -f /etc/kconfig; then
2243                                 osname=isc
2244                                 if test "$lns" = "$ln -s"; then
2245                                         osvers=4
2246                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2247                                         osvers=3
2248                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2249                                         osvers=2
2250                                 fi
2251                         fi
2252                         tmp=''
2253                         ;;
2254                 pc*)
2255                         if test -n "$DJGPP"; then
2256                                 osname=dos
2257                                 osvers=djgpp
2258                         fi
2259                         ;;
2260                 esac
2261
2262                 case "$1" in
2263                 aix) osname=aix
2264                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2265                         case "$tmp" in
2266                         'not found') osvers="$4"."$3" ;;
2267                         '<3240'|'<>3240') osvers=3.2.0 ;;
2268                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2269                         '=3250'|'>3250') osvers=3.2.5 ;;
2270                         *) osvers=$tmp;;
2271                         esac
2272                         ;;
2273                 bsd386) osname=bsd386
2274                         osvers=`$uname -r`
2275                         ;;
2276                 cygwin*) osname=cygwin
2277                         osvers="$3"
2278                         ;;
2279                 *dc.osx) osname=dcosx
2280                         osvers="$3"
2281                         ;;
2282                 dnix) osname=dnix
2283                         osvers="$3"
2284                         ;;
2285                 domainos) osname=apollo
2286                         osvers="$3"
2287                         ;;
2288                 dgux) osname=dgux 
2289                         osvers="$3"
2290                         ;;
2291                 dynixptx*) osname=dynixptx
2292                         osvers=`echo "$4"|sed 's/^v//'`
2293                         ;;
2294                 freebsd) osname=freebsd 
2295                         osvers="$3" ;;
2296                 genix) osname=genix ;;
2297                 hp*) osname=hpux 
2298                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2299                         ;;
2300                 irix*) osname=irix
2301                         case "$3" in
2302                         4*) osvers=4 ;;
2303                         5*) osvers=5 ;;
2304                         *)      osvers="$3" ;;
2305                         esac
2306                         ;;
2307                 linux) osname=linux
2308                         case "$3" in
2309                         *)      osvers="$3" ;;
2310                         esac
2311                         ;;
2312                 MiNT) osname=mint
2313                         ;;
2314                 netbsd*) osname=netbsd
2315                         osvers="$3"
2316                         ;;
2317                 news-os) osvers="$3"
2318                         case "$3" in
2319                         4*) osname=newsos4 ;;
2320                         *) osname=newsos ;;
2321                         esac
2322                         ;;
2323                 next*) osname=next ;;
2324                 POSIX-BC | posix-bc ) osname=posix-bc
2325                         osvers="$3"
2326                         ;;
2327                 powerux | power_ux | powermax_os | powermaxos | \
2328                 powerunix | power_unix) osname=powerux
2329                         osvers="$3"
2330                         ;;
2331                 qnx) osname=qnx
2332                         osvers="$4"
2333                         ;;
2334                 solaris) osname=solaris
2335                         case "$3" in
2336                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2337                         *)      osvers="$3" ;;
2338                         esac
2339                         ;;
2340                 sunos) osname=sunos
2341                         case "$3" in
2342                         5*) osname=solaris
2343                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2344                         *)      osvers="$3" ;;
2345                         esac
2346                         ;;
2347                 titanos) osname=titanos
2348                         case "$3" in
2349                         1*) osvers=1 ;;
2350                         2*) osvers=2 ;;
2351                         3*) osvers=3 ;;
2352                         4*) osvers=4 ;;
2353                         *)      osvers="$3" ;;
2354                         esac
2355                         ;;
2356                 ultrix) osname=ultrix
2357                         osvers="$3"
2358                         ;;
2359                 osf1|mls+)      case "$5" in
2360                                 alpha)
2361                                         osname=dec_osf
2362                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2363                                         ;;
2364                         hp*)    osname=hp_osf1  ;;
2365                         mips)   osname=mips_osf1 ;;
2366                         esac
2367                         ;;
2368                 unixware) osname=svr5
2369                         osvers="$4"
2370                         ;;
2371                 uts) osname=uts
2372                         osvers="$3"
2373                         ;;
2374                 $2) case "$osname" in
2375                         *isc*) ;;
2376                         *freebsd*) ;;
2377                         svr*)
2378                                 : svr4.x or possibly later
2379                                 case "svr$3" in 
2380                                 ${osname}*)
2381                                         osname=svr$3
2382                                         osvers=$4
2383                                         ;;
2384                                 esac
2385                                 case "$osname" in
2386                                 svr4.0)
2387                                         : Check for ESIX
2388                                         if test -f /stand/boot ; then
2389                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2390                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2391                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2392                                                         if test -n "$isesix"; then
2393                                                                 osname=esix4
2394                                                         fi
2395                                                 fi
2396                                         fi
2397                                         ;;
2398                                 esac
2399                                 ;;
2400                         *)      if test -f /etc/systemid; then
2401                                         osname=sco
2402                                         set `echo $3 | $sed 's/\./ /g'` $4
2403                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2404                                                 osvers=$1.$2.$3
2405                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2406                                                 osvers=$1.$2
2407                                         elif $test -f $src/hints/sco_$1.sh; then
2408                                                 osvers=$1
2409                                         fi
2410                                 else
2411                                         case "$osname" in
2412                                         '') : Still unknown.  Probably a generic Sys V.
2413                                                 osname="sysv"
2414                                                 osvers="$3"
2415                                                 ;;
2416                                         esac
2417                                 fi
2418                                 ;;
2419                         esac
2420                         ;;
2421                 *)      case "$osname" in
2422                         '') : Still unknown.  Probably a generic BSD.
2423                                 osname="$1"
2424                                 osvers="$3"
2425                                 ;;
2426                         esac
2427                         ;;
2428                 esac
2429         else
2430                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2431                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2432                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2433                                 osname=news_os
2434                         fi
2435                         $rm -f UU/kernel.what
2436                 elif test -d c:/.; then
2437                         set X $myuname
2438                         osname=os2
2439                         osvers="$5"
2440                 fi
2441         fi
2442         
2443         : Now look for a hint file osname_osvers, unless one has been
2444         : specified already.
2445         case "$hintfile" in
2446         ''|' ')
2447                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2448                 : Also try without trailing minor version numbers.
2449                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2450                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2451                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2452                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2453                 case "$file" in
2454                 '') dflt=none ;;
2455                 *)  case "$osvers" in
2456                         '') dflt=$file
2457                                 ;;
2458                         *)  if $test -f $src/hints/$file.sh ; then
2459                                         dflt=$file
2460                                 elif $test -f $src/hints/$xfile.sh ; then
2461                                         dflt=$xfile
2462                                 elif $test -f $src/hints/$xxfile.sh ; then
2463                                         dflt=$xxfile
2464                                 elif $test -f $src/hints/$xxxfile.sh ; then
2465                                         dflt=$xxxfile
2466                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2467                                         dflt=$xxxxfile
2468                                 elif $test -f "$src/hints/${osname}.sh" ; then
2469                                         dflt="${osname}"
2470                                 else
2471                                         dflt=none
2472                                 fi
2473                                 ;;
2474                         esac
2475                         ;;
2476                 esac
2477                 if $test -f Policy.sh ; then
2478                         case "$dflt" in
2479                         *Policy*) ;;
2480                         none) dflt="Policy" ;;
2481                         *) dflt="Policy $dflt" ;;
2482                         esac
2483                 fi
2484                 ;;
2485         *)
2486                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2487                 ;;
2488         esac
2489
2490         if $test -f Policy.sh ; then
2491                 $cat <<EOM
2492
2493 There's also a Policy hint file available, which should make the
2494 site-specific (policy) questions easier to answer.
2495 EOM
2496
2497         fi
2498
2499         $cat <<EOM
2500
2501 You may give one or more space-separated answers, or "none" if appropriate.
2502 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2503 is a good thing.  DO NOT give a wrong version or a wrong OS.
2504
2505 EOM
2506
2507         rp="Which of these apply, if any?"
2508         . UU/myread
2509         tans=$ans
2510         for file in $tans; do
2511                 if $test X$file = XPolicy -a -f Policy.sh; then
2512                         . Policy.sh
2513                         $cat Policy.sh >> UU/config.sh
2514                 elif $test -f $src/hints/$file.sh; then
2515                         . $src/hints/$file.sh
2516                         $cat $src/hints/$file.sh >> UU/config.sh
2517                 elif $test X$tans = X -o X$tans = Xnone ; then
2518                         : nothing
2519                 else
2520                         : Give one chance to correct a possible typo.
2521                         echo "$file.sh does not exist"
2522                         dflt=$file
2523                         rp="hint to use instead?"
2524                         . UU/myread
2525                         for file in $ans; do
2526                                 if $test -f "$src/hints/$file.sh"; then
2527                                         . $src/hints/$file.sh
2528                                         $cat $src/hints/$file.sh >> UU/config.sh
2529                                 elif $test X$ans = X -o X$ans = Xnone ; then
2530                                         : nothing
2531                                 else
2532                                         echo "$file.sh does not exist -- ignored."
2533                                 fi
2534                         done
2535                 fi
2536         done
2537
2538         hint=recommended
2539         : Remember our hint file for later.
2540         if $test -f "$src/hints/$file.sh" ; then
2541                 hintfile="$file"
2542         else
2543                 hintfile=''
2544         fi
2545 fi
2546 cd UU
2547 ;;
2548 *)
2549         echo " "
2550         echo "Fetching default answers from $config_sh..." >&4
2551         tmp_n="$n"
2552         tmp_c="$c"
2553         cd ..
2554         cp $config_sh config.sh 2>/dev/null
2555         chmod +w config.sh
2556         . ./config.sh
2557         cd UU
2558         cp ../config.sh .
2559         n="$tmp_n"
2560         c="$tmp_c"
2561         hint=previous
2562         ;;
2563 esac
2564 test "$override" && . ./optdef.sh
2565 myuname="$newmyuname"
2566
2567 : Restore computed paths
2568 for file in $loclist $trylist; do
2569         eval $file="\$_$file"
2570 done
2571
2572 cat << EOM
2573
2574 Configure uses the operating system name and version to set some defaults.
2575 The default value is probably right if the name rings a bell. Otherwise,
2576 since spelling matters for me, either accept the default or answer "none"
2577 to leave it blank.
2578
2579 EOM
2580 case "$osname" in
2581         ''|' ')
2582                 case "$hintfile" in
2583                 ''|' '|none) dflt=none ;;
2584                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2585                 esac
2586                 ;;
2587         *) dflt="$osname" ;;
2588 esac
2589 rp="Operating system name?"
2590 . ./myread
2591 case "$ans" in
2592 none)  osname='' ;;
2593 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2594 esac
2595 echo " "
2596 case "$osvers" in
2597         ''|' ')
2598                 case "$hintfile" in
2599                 ''|' '|none) dflt=none ;;
2600                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2601                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2602                         case "$dflt" in
2603                         ''|' ') dflt=none ;;
2604                         esac
2605                         ;;
2606                 esac
2607                 ;;
2608         *) dflt="$osvers" ;;
2609 esac
2610 rp="Operating system version?"
2611 . ./myread
2612 case "$ans" in
2613 none)  osvers='' ;;
2614 *) osvers="$ans" ;;
2615 esac
2616
2617
2618 . ./posthint.sh
2619
2620 : who configured the system
2621 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2622 cf_by=`(logname) 2>/dev/null`
2623 case "$cf_by" in
2624 "")
2625         cf_by=`(whoami) 2>/dev/null`
2626         case "$cf_by" in
2627         "") cf_by=unknown ;;
2628         esac ;;
2629 esac
2630
2631 : set up the script used to warn in case of inconsistency
2632 cat <<EOS >whoa
2633 $startsh
2634 EOS
2635 cat <<'EOSC' >>whoa
2636 dflt=y
2637 echo " "
2638 echo "*** WHOA THERE!!! ***" >&4
2639 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2640 rp="    Keep the $hint value?"
2641 . ./myread
2642 case "$ans" in
2643 y) td=$was; tu=$was;;
2644 esac
2645 EOSC
2646
2647 : function used to set $1 to $val
2648 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2649 case "$val$was" in
2650 $define$undef) . ./whoa; eval "$var=\$td";;
2651 $undef$define) . ./whoa; eval "$var=\$tu";;
2652 *) eval "$var=$val";;
2653 esac'
2654
2655 cat <<EOM
2656
2657 Perl can be built to take advantage of threads, on some systems.
2658 To do so, Configure must be run with -Dusethreads.
2659
2660 Note that threading is a highly experimental feature, and
2661 some known race conditions still remain.  If you choose to try
2662 it, be very sure to not actually deploy it for production
2663 purposes.  README.threads has more details, and is required
2664 reading if you enable threads.
2665 EOM
2666 case "$usethreads" in
2667 $define|true|[yY]*)     dflt='y';;
2668 *) dflt='n';;
2669 esac
2670 rp='Build a threading Perl?'
2671 . ./myread
2672 case "$ans" in
2673 y|Y)    val="$define" ;;
2674 *)      val="$undef" ;;
2675 esac
2676 set usethreads
2677 eval $setvar
2678
2679 case "$usethreads" in
2680 $define)
2681         $cat <<EOM
2682
2683 As of 5.5.640, Perl has two different internal threading implementations,
2684 the 5.005 version (5005threads) and an interpreter-based version
2685 (ithreads) that has one interpreter per thread.  Both are very 
2686 experimental.  This arrangement exists to help developers work out
2687 which one is better.
2688 EOM
2689         : Default to ithreads unless overridden on command line or with
2690         : old config.sh
2691         dflt='y'
2692         case "$use5005threads" in
2693                 $define|true|[yY]*) dflt='n';;
2694         esac
2695         case "$useithreads" in
2696                 $undef|false|[nN]*) dflt='n';;
2697         esac
2698         rp='Use interpreter-based ithreads?'
2699         . ./myread
2700         case "$ans" in
2701         y|Y)    val="$define" ;;
2702         *)      val="$undef" ;;
2703         esac
2704         set useithreads
2705         eval $setvar
2706         : Now set use5005threads to the opposite value.
2707         case "$useithreads" in
2708         $define) val="$undef" ;;
2709         *) val="$define" ;;
2710         esac
2711         set use5005threads
2712         eval $setvar
2713         ;;
2714 *)
2715         useithreads="$undef"
2716         use5005threads="$undef"
2717         ;;
2718 esac
2719
2720 case "$d_oldpthreads" in
2721 '')     : Configure tests would be welcome here.  For now, assume undef.
2722         val="$undef" ;;
2723 *)      val="$d_oldpthreads" ;;
2724 esac
2725 set d_oldpthreads
2726 eval $setvar
2727
2728
2729 case "$usethreads" in
2730 "$define"|true|[yY]*)
2731 : Look for a hint-file generated 'call-back-unit'.  If the
2732 : user has specified that a threading perl is to be built,
2733 : we may need to set or change some other defaults.
2734         if $test -f usethreads.cbu; then
2735                 echo "Your platform has some specific hints for threaded builds, using them..."
2736                 . ./usethreads.cbu
2737         else
2738                 $cat <<EOM
2739 (Your platform doesn't have any specific hints for threaded builds.
2740  Assuming POSIX threads, then.)
2741 EOM
2742         fi
2743         ;;
2744 esac
2745
2746 cat <<EOM
2747
2748 Perl can be built so that multiple Perl interpreters can coexist
2749 within the same Perl executable.
2750 EOM
2751
2752 case "$useithreads" in
2753 $define)
2754         cat <<EOM
2755 This multiple interpreter support is required for interpreter-based threads.
2756 EOM
2757         val="$define"
2758         ;;
2759 *)
2760         echo 'Normally you do not need this and you should answer no.'
2761         case "$usemultiplicity" in
2762         $define|true|[yY]*)     dflt='y';;
2763         *) dflt='n';;
2764         esac
2765         rp='Build Perl for multiplicity?'
2766         . ./myread
2767         case "$ans" in
2768         y|Y)    val="$define" ;;
2769         *)      val="$undef" ;;
2770         esac
2771         ;;
2772 esac
2773 set usemultiplicity
2774 eval $setvar
2775
2776 : determine where manual pages are on this system
2777 echo " "
2778 case "$sysman" in
2779 '') 
2780         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2781         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2782         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2783         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2784         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2785         sysman=`./loc . /usr/man/man1 $syspath`
2786         ;;
2787 esac
2788 if $test -d "$sysman"; then
2789         echo "System manual is in $sysman." >&4
2790 else
2791         echo "Could not find manual pages in source form." >&4
2792 fi
2793
2794 : see what memory models we can support
2795 case "$models" in
2796 '')
2797         $cat >pdp11.c <<'EOP'
2798 int main() {
2799 #ifdef pdp11
2800         exit(0);
2801 #else
2802         exit(1);
2803 #endif
2804 }
2805 EOP
2806         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2807         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2808                 dflt='unsplit split'
2809         else
2810                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2811                 case "$tans" in
2812                 X) dflt='none';;
2813                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2814                                 dflt='small'
2815                         else
2816                                 dflt=''
2817                         fi
2818                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2819                                 dflt="$dflt medium"
2820                         fi
2821                         if $test -d /lib/large || $test -d /usr/lib/large; then
2822                                 dflt="$dflt large"
2823                         fi
2824                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2825                                 dflt="$dflt huge"
2826                         fi
2827                 esac
2828         fi;;
2829 *) dflt="$models";;
2830 esac
2831 $cat <<EOM
2832  
2833 Some systems have different model sizes.  On most systems they are called
2834 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2835 split.  If your system doesn't support different memory models, say "none".
2836 If you wish to force everything to one memory model, say "none" here and
2837 put the appropriate flags later when it asks you for other cc and ld flags.
2838 Venix systems may wish to put "none" and let the compiler figure things out.
2839 (In the following question multiple model names should be space separated.)
2840
2841 The default for most systems is "none".
2842
2843 EOM
2844 rp="Which memory models are supported?"
2845 . ./myread
2846 models="$ans"
2847
2848 case "$models" in
2849 none)
2850         small=''
2851         medium=''
2852         large=''
2853         huge=''
2854         unsplit=''
2855         split=''
2856         ;;
2857 *split)
2858         case "$split" in
2859         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2860                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2861                         dflt='-i'
2862                 else
2863                         dflt='none'
2864                 fi;;
2865         *) dflt="$split";;
2866         esac
2867         rp="What flag indicates separate I and D space?"
2868         . ./myread
2869         tans="$ans"
2870         case "$tans" in
2871         none) tans='';;
2872         esac
2873         split="$tans"
2874         unsplit='';;
2875 *large*|*small*|*medium*|*huge*)
2876         case "$models" in
2877         *large*)
2878                 case "$large" in
2879                 '') dflt='-Ml';;
2880                 *) dflt="$large";;
2881                 esac
2882         rp="What flag indicates large model?"
2883         . ./myread
2884         tans="$ans"
2885         case "$tans" in
2886         none) tans='';
2887         esac
2888         large="$tans";;
2889         *) large='';;
2890         esac
2891         case "$models" in
2892         *huge*) case "$huge" in
2893                 '') dflt='-Mh';;
2894                 *) dflt="$huge";;
2895                 esac
2896                 rp="What flag indicates huge model?"
2897                 . ./myread
2898                 tans="$ans"
2899                 case "$tans" in
2900                 none) tans='';
2901                 esac
2902                 huge="$tans";;
2903         *) huge="$large";;
2904         esac
2905         case "$models" in
2906         *medium*) case "$medium" in
2907                 '') dflt='-Mm';;
2908                 *) dflt="$medium";;
2909                 esac
2910                 rp="What flag indicates medium model?"
2911                 . ./myread
2912                 tans="$ans"
2913                 case "$tans" in
2914                 none) tans='';
2915                 esac
2916                 medium="$tans";;
2917         *) medium="$large";;
2918         esac
2919         case "$models" in
2920         *small*) case "$small" in
2921                 '') dflt='none';;
2922                 *) dflt="$small";;
2923                 esac
2924                 rp="What flag indicates small model?"
2925                 . ./myread
2926                 tans="$ans"
2927                 case "$tans" in
2928                 none) tans='';
2929                 esac
2930                 small="$tans";;
2931         *) small='';;
2932         esac
2933         ;;
2934 *)
2935         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2936         ;;
2937 esac
2938 $rm -f pdp11.* pdp11
2939
2940 : make some quick guesses about what we are up against
2941 echo " "
2942 $echo $n "Hmm...  $c"
2943 echo exit 1 >bsd
2944 echo exit 1 >usg
2945 echo exit 1 >v7
2946 echo exit 1 >osf1
2947 echo exit 1 >eunice
2948 echo exit 1 >xenix
2949 echo exit 1 >venix
2950 echo exit 1 >os2
2951 d_bsd="$undef"
2952 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2953 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2954 then
2955         echo "Looks kind of like an OSF/1 system, but we'll see..."
2956         echo exit 0 >osf1
2957 elif test `echo abc | tr a-z A-Z` = Abc ; then
2958         xxx=`./loc addbib blurfl $pth`
2959         if $test -f $xxx; then
2960         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2961                 echo exit 0 >bsd
2962                 echo exit 0 >usg
2963         else
2964                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2965                         echo "Looks kind of like an extended USG system, but we'll see..."
2966                 else
2967                         echo "Looks kind of like a USG system, but we'll see..."
2968                 fi
2969                 echo exit 0 >usg
2970         fi
2971 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2972         echo "Looks kind of like a BSD system, but we'll see..."
2973         d_bsd="$define"
2974         echo exit 0 >bsd
2975 else
2976         echo "Looks kind of like a Version 7 system, but we'll see..."
2977         echo exit 0 >v7
2978 fi
2979 case "$eunicefix" in
2980 *unixtovms*)
2981         $cat <<'EOI'
2982 There is, however, a strange, musty smell in the air that reminds me of
2983 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2984 EOI
2985         echo exit 0 >eunice
2986         d_eunice="$define"
2987 : it so happens the Eunice I know will not run shell scripts in Unix format
2988         ;;
2989 *)
2990         echo " "
2991         echo "Congratulations.  You aren't running Eunice."
2992         d_eunice="$undef"
2993         ;;
2994 esac
2995 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2996 case "$p_" in
2997 :) ;;
2998 *)
2999         $cat <<'EOI'
3000 I have the feeling something is not exactly right, however...don't tell me...
3001 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3002 EOI
3003         echo exit 0 >os2
3004         ;;
3005 esac
3006 if test -f /xenix; then
3007         echo "Actually, this looks more like a XENIX system..."
3008         echo exit 0 >xenix
3009         d_xenix="$define"
3010 else
3011         echo " "
3012         echo "It's not Xenix..."
3013         d_xenix="$undef"
3014 fi
3015 chmod +x xenix
3016 $eunicefix xenix
3017 if test -f /venix; then
3018         echo "Actually, this looks more like a VENIX system..."
3019         echo exit 0 >venix
3020 else
3021         echo " "
3022         if ./xenix; then
3023                 : null
3024         else
3025                 echo "Nor is it Venix..."
3026         fi
3027 fi
3028 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3029 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3030 $rm -f foo
3031
3032 : see if we need a special compiler
3033 echo " "
3034 if ./usg; then
3035         case "$cc" in
3036         '') case "$Mcc" in
3037                 /*) dflt='Mcc';;
3038                 *) case "$large" in
3039                         -M*) dflt='cc';;
3040                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3041                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3042                                                 dflt='cc'
3043                                         else
3044                                                 dflt='cc -M'
3045                                         fi
3046                                 else
3047                                         dflt='cc'
3048                                 fi;;
3049                         esac;;
3050                 esac;;
3051         *)  dflt="$cc";;
3052         esac
3053         case "$dflt" in
3054         *M*)    $cat <<'EOM'
3055 On some older systems the default C compiler will not resolve multiple global
3056 references that happen to have the same name.  On some such systems the "Mcc"
3057 command may be used to force these to be resolved.  On other systems a "cc -M"
3058 command is required.  (Note that the -M flag on other systems indicates a
3059 memory model to use!) If you have the Gnu C compiler, you might wish to use
3060 that instead.
3061
3062 EOM
3063         ;;
3064         esac
3065         rp="Use which C compiler?"
3066         . ./myread
3067         cc="$ans"
3068 else
3069         case "$cc" in
3070         '') dflt=cc;;
3071         *) dflt="$cc";;
3072         esac
3073         rp="Use which C compiler?"
3074         . ./myread
3075         cc="$ans"
3076 fi
3077 : Look for a hint-file generated 'call-back-unit'.  Now that the
3078 : user has specified the compiler, we may need to set or change some
3079 : other defaults.
3080 if $test -f cc.cbu; then
3081     . ./cc.cbu
3082 fi
3083 echo " "
3084 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3085 $cat >gccvers.c <<EOM
3086 #include <stdio.h>
3087 int main() {
3088 #ifdef __GNUC__
3089 #ifdef __VERSION__
3090         printf("%s\n", __VERSION__);
3091 #else
3092         printf("%s\n", "1");
3093 #endif
3094 #endif
3095         exit(0);
3096 }
3097 EOM
3098 if $cc -o gccvers gccvers.c; then
3099         gccversion=`./gccvers`
3100         case "$gccversion" in
3101         '') echo "You are not using GNU cc." ;;
3102         *)  echo "You are using GNU cc $gccversion."
3103             echo "Adding -D_GNU_SOURCE to ccflags."
3104             ccflags="$ccflags -D_GNU_SOURCE" # expose glibc interfaces
3105             ;;
3106         esac
3107 else
3108         echo " "
3109         echo "*** WHOA THERE!!! ***" >&4
3110         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3111         case "$knowitall" in
3112         '')
3113         echo "    You'd better start hunting for one and let me know about it." >&4
3114                 exit 1
3115                 ;;
3116         esac
3117 fi
3118 $rm -f gccvers*
3119 case "$gccversion" in
3120 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3121 esac
3122
3123 : decide how portable to be.  Allow command line overrides.
3124 case "$d_portable" in
3125 "$undef") ;;
3126 *)      d_portable="$define" ;;
3127 esac
3128
3129 : set up shell script to do ~ expansion
3130 cat >filexp <<EOSS
3131 $startsh
3132 : expand filename
3133 case "\$1" in
3134  ~/*|~)
3135         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3136         ;;
3137  ~*)
3138         if $test -f /bin/csh; then
3139                 /bin/csh -f -c "glob \$1"
3140                 failed=\$?
3141                 echo ""
3142                 exit \$failed
3143         else
3144                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3145                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3146                 if $test ! -d "\$dir"; then
3147                         me=\`basename \$0\`
3148                         echo "\$me: can't locate home directory for: \$name" >&2
3149                         exit 1
3150                 fi
3151                 case "\$1" in
3152                 */*)
3153                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3154                         ;;
3155                 *)
3156                         echo \$dir
3157                         ;;
3158                 esac
3159         fi
3160         ;;
3161 *)
3162         echo \$1
3163         ;;
3164 esac
3165 EOSS
3166 chmod +x filexp
3167 $eunicefix filexp
3168
3169 : now set up to get a file name
3170 cat <<EOS >getfile
3171 $startsh
3172 EOS
3173 cat <<'EOSC' >>getfile
3174 tilde=''
3175 fullpath=''
3176 already=''
3177 skip=''
3178 none_ok=''
3179 exp_file=''
3180 nopath_ok=''
3181 orig_rp="$rp"
3182 orig_dflt="$dflt"
3183 case "$gfpth" in
3184 '') gfpth='.' ;;
3185 esac
3186
3187 case "$fn" in
3188 *\(*)
3189         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3190         fn=`echo $fn | sed 's/(.*)//'`
3191         ;;
3192 esac
3193
3194 case "$fn" in
3195 *:*)
3196         loc_file=`expr $fn : '.*:\(.*\)'`
3197         fn=`expr $fn : '\(.*\):.*'`
3198         ;;
3199 esac
3200
3201 case "$fn" in
3202 *~*) tilde=true;;
3203 esac
3204 case "$fn" in
3205 */*) fullpath=true;;
3206 esac
3207 case "$fn" in
3208 *+*) skip=true;;
3209 esac
3210 case "$fn" in
3211 *n*) none_ok=true;;
3212 esac
3213 case "$fn" in
3214 *e*) exp_file=true;;
3215 esac
3216 case "$fn" in
3217 *p*) nopath_ok=true;;
3218 esac
3219
3220 case "$fn" in
3221 *f*) type='File';;
3222 *d*) type='Directory';;
3223 *l*) type='Locate';;
3224 esac
3225
3226 what="$type"
3227 case "$what" in
3228 Locate) what='File';;
3229 esac
3230
3231 case "$exp_file" in
3232 '')
3233         case "$d_portable" in
3234         "$define") ;;
3235         *) exp_file=true;;
3236         esac
3237         ;;
3238 esac
3239
3240 cd ..
3241 while test "$type"; do
3242         redo=''
3243         rp="$orig_rp"
3244         dflt="$orig_dflt"
3245         case "$tilde" in
3246         true) rp="$rp (~name ok)";;
3247         esac
3248         . UU/myread
3249         if test -f UU/getfile.ok && \
3250                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3251         then
3252                 value="$ans"
3253                 ansexp="$ans"
3254                 break
3255         fi
3256         case "$ans" in
3257         none)
3258                 value=''
3259                 ansexp=''
3260                 case "$none_ok" in
3261                 true) type='';;
3262                 esac
3263                 ;;
3264         *)
3265                 case "$tilde" in
3266                 '') value="$ans"
3267                         ansexp="$ans";;
3268                 *)
3269                         value=`UU/filexp $ans`
3270                         case $? in
3271                         0)
3272                                 if test "$ans" != "$value"; then
3273                                         echo "(That expands to $value on this system.)"
3274                                 fi
3275                                 ;;
3276                         *) value="$ans";;
3277                         esac
3278                         ansexp="$value"
3279                         case "$exp_file" in
3280                         '') value="$ans";;
3281                         esac
3282                         ;;
3283                 esac
3284                 case "$fullpath" in
3285                 true)
3286                         case "$ansexp" in
3287                         /*) value="$ansexp" ;;
3288                         *)
3289                                 redo=true
3290                                 case "$already" in
3291                                 true)
3292                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3293                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3294                                         ;;
3295                                 *)
3296                                 echo "Please give a full path name, starting with slash." >&4
3297                                         case "$tilde" in
3298                                         true)
3299                                 echo "Note that using ~name is ok provided it expands well." >&4
3300                                                 already=true
3301                                                 ;;
3302                                         esac
3303                                 esac
3304                                 ;;
3305                         esac
3306                         ;;
3307                 esac
3308                 case "$redo" in
3309                 '')
3310                         case "$type" in
3311                         File)
3312                                 for fp in $gfpth; do
3313                                         if test "X$fp" = X.; then
3314                                             pf="$ansexp"
3315                                         else    
3316                                             pf="$fp/$ansexp"
3317                                         fi
3318                                         if test -f "$pf"; then
3319                                                 type=''
3320                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3321                                         then
3322                                                 echo "($value is not a plain file, but that's ok.)"
3323                                                 type=''
3324                                         fi
3325                                         if test X"$type" = X; then
3326                                             value="$pf"
3327                                             break
3328                                         fi
3329                                 done
3330                                 ;;
3331                         Directory)
3332                                 for fp in $gfpth; do
3333                                         if test "X$fp" = X.; then
3334                                             pf="$ansexp"
3335                                         else    
3336                                             pf="$fp/$ansexp"
3337                                         fi
3338                                         if test -d "$pf"; then
3339                                                 type=''
3340                                                 value="$pf"
3341                                                 break
3342                                         fi
3343                                 done
3344                                 ;;
3345                         Locate)
3346                                 if test -d "$ansexp"; then
3347                                         echo "(Looking for $loc_file in directory $value.)"
3348                                         value="$value/$loc_file"
3349                                         ansexp="$ansexp/$loc_file"
3350                                 fi
3351                                 if test -f "$ansexp"; then
3352                                         type=''
3353                                 fi
3354                                 case "$nopath_ok" in
3355                                 true)   case "$value" in
3356                                         */*) ;;
3357                                         *)      echo "Assuming $value will be in people's path."
3358                                                 type=''
3359                                                 ;;
3360                                         esac
3361                                         ;;
3362                                 esac
3363                                 ;;
3364                         esac
3365
3366                         case "$skip" in
3367                         true) type='';
3368                         esac
3369
3370                         case "$type" in
3371                         '') ;;
3372                         *)
3373                                 if test "$fastread" = yes; then
3374                                         dflt=y
3375                                 else
3376                                         dflt=n
3377                                 fi
3378                                 rp="$what $value doesn't exist.  Use that name anyway?"
3379                                 . UU/myread
3380                                 dflt=''
3381                                 case "$ans" in
3382                                 y*) type='';;
3383                                 *) echo " ";;
3384                                 esac
3385                                 ;;
3386                         esac
3387                         ;;
3388                 esac
3389                 ;;
3390         esac
3391 done
3392 cd UU
3393 ans="$value"
3394 rp="$orig_rp"
3395 dflt="$orig_dflt"
3396 rm -f getfile.ok
3397 test "X$gfpthkeep" != Xy && gfpth=""
3398 EOSC
3399
3400 : What should the include directory be ?
3401 echo " "
3402 $echo $n "Hmm...  $c"
3403 dflt='/usr/include'
3404 incpath=''
3405 mips_type=''
3406 if $test -f /bin/mips && /bin/mips; then
3407         echo "Looks like a MIPS system..."
3408         $cat >usr.c <<'EOCP'
3409 #ifdef SYSTYPE_BSD43
3410 /bsd43
3411 #endif
3412 EOCP
3413         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3414                 dflt='/bsd43/usr/include'
3415                 incpath='/bsd43'
3416                 mips_type='BSD 4.3'
3417         else
3418                 mips_type='System V'
3419         fi
3420         $rm -f usr.c usr.out
3421         echo "and you're compiling with the $mips_type compiler and libraries."
3422         xxx_prompt=y
3423         echo "exit 0" >mips
3424 else
3425         echo "Doesn't look like a MIPS system."
3426         xxx_prompt=n
3427         echo "exit 1" >mips
3428 fi
3429 chmod +x mips
3430 $eunicefix mips
3431 case "$usrinc" in
3432 '') ;;
3433 *) dflt="$usrinc";;
3434 esac
3435 case "$xxx_prompt" in
3436 y)      fn=d/
3437         echo " "
3438         rp='Where are the include files you want to use?'
3439         . ./getfile
3440         usrinc="$ans"
3441         ;;
3442 *)      usrinc="$dflt"
3443         ;;
3444 esac
3445
3446 : see how we invoke the C preprocessor
3447 echo " "
3448 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3449 cat <<'EOT' >testcpp.c
3450 #define ABC abc
3451 #define XYZ xyz
3452 ABC.XYZ
3453 EOT
3454 cd ..
3455 if test ! -f cppstdin; then
3456         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3457                 # AIX cc -E doesn't show the absolute headerfile
3458                 # locations but we'll cheat by using the -M flag.
3459                 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
3460         else
3461                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3462         fi
3463 else
3464         echo "Keeping your $hint cppstdin wrapper."
3465 fi
3466 chmod 755 cppstdin
3467 wrapper=`pwd`/cppstdin
3468 ok='false'
3469 cd UU
3470
3471 if $test "X$cppstdin" != "X" && \
3472         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3473         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3474 then
3475         echo "You used to use $cppstdin $cppminus so we'll use that again."
3476         case "$cpprun" in
3477         '') echo "But let's see if we can live without a wrapper..." ;;
3478         *)
3479                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3480                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3481                 then
3482                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3483                         ok='true'
3484                 else
3485                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3486                 fi
3487                 ;;
3488         esac
3489 else
3490         case "$cppstdin" in
3491         '') ;;
3492         *)
3493                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3494                 ;;
3495         esac
3496 fi
3497
3498 if $ok; then
3499         : nothing
3500 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3501         $cc -E <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         echo "Yup, it does."
3504         x_cpp="$cc -E"
3505         x_minus='';
3506 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3507         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3509         echo "Yup, it does."
3510         x_cpp="$cc -E"
3511         x_minus='-';
3512 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3513         $cc -P <testcpp.c >testcpp.out 2>&1; \
3514         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3515         echo "Yipee, that works!"
3516         x_cpp="$cc -P"
3517         x_minus='';
3518 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3519         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3520         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3521         echo "At long last!"
3522         x_cpp="$cc -P"
3523         x_minus='-';
3524 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3525         $cpp <testcpp.c >testcpp.out 2>&1; \
3526         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3527         echo "It works!"
3528         x_cpp="$cpp"
3529         x_minus='';
3530 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3531         $cpp - <testcpp.c >testcpp.out 2>&1; \
3532         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3533         echo "Hooray, it works!  I was beginning to wonder."
3534         x_cpp="$cpp"
3535         x_minus='-';
3536 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3537         $wrapper <testcpp.c >testcpp.out 2>&1; \
3538         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3539         x_cpp="$wrapper"
3540         x_minus=''
3541         echo "Eureka!"
3542 else
3543         dflt=''
3544         rp="No dice.  I can't find a C preprocessor.  Name one:"
3545         . ./myread
3546         x_cpp="$ans"
3547         x_minus=''
3548         $x_cpp <testcpp.c >testcpp.out 2>&1
3549         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3550                 echo "OK, that will do." >&4
3551         else
3552 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3553                 exit 1
3554         fi
3555 fi
3556
3557 case "$ok" in
3558 false)
3559         cppstdin="$x_cpp"
3560         cppminus="$x_minus"
3561         cpprun="$x_cpp"
3562         cpplast="$x_minus"
3563         set X $x_cpp
3564         shift
3565         case "$1" in
3566         "$cpp")
3567                 echo "Perhaps can we force $cc -E using a wrapper..."
3568                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3569                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3570                 then
3571                         echo "Yup, we can."
3572                         cppstdin="$wrapper"
3573                         cppminus='';
3574                 else
3575                         echo "Nope, we'll have to live without it..."
3576                 fi
3577                 ;;
3578         esac
3579         case "$cpprun" in
3580         "$wrapper")
3581                 cpprun=''
3582                 cpplast=''
3583                 ;;
3584         esac
3585         ;;
3586 esac
3587
3588 case "$cppstdin" in
3589 "$wrapper"|'cppstdin') ;;
3590 *) $rm -f $wrapper;;
3591 esac
3592 $rm -f testcpp.c testcpp.out
3593
3594 : Set private lib path
3595 case "$plibpth" in
3596 '') if ./mips; then
3597                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3598         fi;;
3599 esac
3600 case "$libpth" in
3601 ' ') dlist='';;
3602 '') dlist="$loclibpth $plibpth $glibpth";;
3603 *) dlist="$libpth";;
3604 esac
3605
3606 : Now check and see which directories actually exist, avoiding duplicates
3607 libpth=''
3608 for xxx in $dlist
3609 do
3610     if $test -d $xxx; then
3611                 case " $libpth " in
3612                 *" $xxx "*) ;;
3613                 *) libpth="$libpth $xxx";;
3614                 esac
3615     fi
3616 done
3617 $cat <<'EOM'
3618
3619 Some systems have incompatible or broken versions of libraries.  Among
3620 the directories listed in the question below, please remove any you
3621 know not to be holding relevant libraries, and add any that are needed.
3622 Say "none" for none.
3623
3624 EOM
3625 case "$libpth" in
3626 '') dflt='none';;
3627 *)
3628         set X $libpth
3629         shift
3630         dflt=${1+"$@"}
3631         ;;
3632 esac
3633 rp="Directories to use for library searches?"
3634 . ./myread
3635 case "$ans" in
3636 none) libpth=' ';;
3637 *) libpth="$ans";;
3638 esac
3639
3640 : compute shared library extension
3641 case "$so" in
3642 '')
3643         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3644                 dflt='sl'
3645         else
3646                 dflt='so'
3647         fi
3648         ;;
3649 *) dflt="$so";;
3650 esac
3651 $cat <<EOM
3652
3653 On some systems, shared libraries may be available.  Answer 'none' if
3654 you want to suppress searching of shared libraries for the remaining
3655 of this configuration.
3656
3657 EOM
3658 rp='What is the file extension used for shared libraries?'
3659 . ./myread
3660 so="$ans"
3661
3662 : Define several unixisms.
3663 : Hints files or command line option can be used to override them.
3664 : The convoluted testing is in case hints files set either the old
3665 : or the new name.
3666 case "$_exe" in
3667 '')     case "$exe_ext" in
3668     '') ;;
3669         *)      _exe="$exe_ext" ;;
3670         esac
3671         ;;
3672 esac
3673 case "$_a" in
3674 '')     case "$lib_ext" in
3675     '') _a='.a';;
3676         *)      _a="$lib_ext" ;;
3677         esac
3678         ;;
3679 esac
3680 case "$_o" in
3681 '') case "$obj_ext" in
3682         '')     _o='.o';;
3683         *)      _o="$obj_ext";;
3684         esac
3685         ;;
3686 esac
3687 case "$p_" in
3688 '') case "$path_sep" in
3689         '')     p_=':';;
3690         *)      p_="$path_sep";;
3691         esac
3692         ;;
3693 esac
3694 exe_ext=$_exe
3695 lib_ext=$_a
3696 obj_ext=$_o
3697 path_sep=$p_
3698
3699 : Which makefile gets called first.  This is used by make depend.
3700 case "$firstmakefile" in
3701 '') firstmakefile='makefile';;
3702 esac
3703
3704 cat <<EOM
3705
3706 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3707 Configure must be run with -Dusesocks.
3708
3709 Normally you do not need this and you should answer no.
3710
3711 EOM
3712 case "$usesocks" in
3713 $define|true|[yY]*)     dflt='y';;
3714 *) dflt='n';;
3715 esac
3716 rp='Build Perl for SOCKS?'
3717 . ./myread
3718 case "$ans" in
3719 y|Y)    val="$define" ;;     
3720 *)      val="$undef" ;;
3721 esac
3722 set usesocks
3723 eval $setvar
3724
3725 : Looking for optional libraries
3726 echo " "
3727 echo "Checking for optional libraries..." >&4
3728 case "$libs" in
3729 ' '|'') dflt='';;
3730 *) dflt="$libs";;
3731 esac
3732 case "$libswanted" in
3733 '') libswanted='c_s';;
3734 esac
3735 case "$usesocks" in
3736 $define)
3737         libswanted="$libswanted socks5 socks5_sh"
3738         ;;
3739 esac
3740 for thislib in $libswanted; do
3741         
3742         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3743                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3744                 echo "Found -l$thislib (shared)."
3745                 case " $dflt " in
3746                 *"-l$thislib "*);;
3747                 *) dflt="$dflt -l$thislib";;
3748                 esac
3749         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3750                 echo "Found -l$thislib (shared)."
3751                 case " $dflt " in
3752                 *"-l$thislib "*);;
3753                 *) dflt="$dflt -l$thislib";;
3754                 esac
3755         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3756                 echo "Found -l$thislib."
3757                 case " $dflt " in
3758                 *"-l$thislib "*);;
3759                 *) dflt="$dflt -l$thislib";;
3760                 esac
3761         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3762                 echo "Found -l$thislib."
3763                 case " $dflt " in
3764                 *"-l$thislib "*);;
3765                 *) dflt="$dflt -l$thislib";;
3766                 esac
3767         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3768                 echo "Found -l${thislib}_s."
3769                 case " $dflt " in
3770                 *"-l$thislib "*);;
3771                 *) dflt="$dflt -l${thislib}_s";;
3772                 esac
3773         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3774                 echo "Found -l$thislib."
3775                 case " $dflt " in
3776                 *"-l$thislib "*);;
3777                 *) dflt="$dflt -l$thislib";;
3778                 esac
3779         else
3780                 echo "No -l$thislib."
3781         fi
3782 done
3783 set X $dflt
3784 shift
3785 dflt="$*"
3786 case "$libs" in
3787 '') dflt="$dflt";;
3788 *) dflt="$libs";;
3789 esac
3790 case "$dflt" in
3791 ' '|'') dflt='none';;
3792 esac
3793
3794 $cat <<EOM
3795
3796 In order to compile $package on your machine, a number of libraries
3797 are usually needed.  Include any other special libraries here as well.
3798 Say "none" for none.  The default list is almost always right.
3799 EOM
3800
3801 echo " "
3802 rp="What libraries to use?"
3803 . ./myread
3804 case "$ans" in
3805 none) libs=' ';;
3806 *) libs="$ans";;
3807 esac
3808
3809 : determine optimization, if desired, or use for debug flag also
3810 case "$optimize" in
3811 ' '|$undef) dflt='none';;
3812 '') dflt='-O';;
3813 *) dflt="$optimize";;
3814 esac
3815 $cat <<EOH
3816
3817 By default, $package compiles with the -O flag to use the optimizer.
3818 Alternately, you might want to use the symbolic debugger, which uses
3819 the -g flag (on traditional Unix systems).  Either flag can be
3820 specified here.  To use neither flag, specify the word "none".
3821
3822 EOH
3823 rp="What optimizer/debugger flag should be used?"
3824 . ./myread
3825 optimize="$ans"
3826 case "$optimize" in
3827 'none') optimize=" ";;
3828 esac
3829
3830 dflt=''
3831 : We will not override a previous value, but we might want to
3832 : augment a hint file
3833 case "$hint" in
3834 default|recommended)
3835         case "$gccversion" in
3836         1*) dflt='-fpcc-struct-return' ;;
3837         esac
3838         case "$optimize" in
3839         *-g*) dflt="$dflt -DDEBUGGING";;
3840         esac
3841         case "$gccversion" in
3842         2*) if test -d /etc/conf/kconfig.d &&
3843                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3844                 then
3845                         dflt="$dflt -posix"
3846                 fi
3847                 ;;
3848         esac
3849         case "$gccversion" in
3850         1*) ;;
3851         2.[0-8]*) ;;
3852         ?*)     echo " "
3853                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3854                 echo 'int main(void) { return 0; }' > gcctest.c
3855                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3856                         echo "Yes, it does." 2>&1
3857                         case "$ccflags" in
3858                         *strict-aliasing*) 
3859                                 echo "Leaving current flags $ccflags alone." 2>&1
3860                                 ;;
3861                         *) dflt="$dflt -fno-strict-aliasing" ;;
3862                         esac
3863                 else
3864                         echo "Nope, it doesn't, but that's ok." 2>&1
3865                 fi
3866                 ;;
3867         esac
3868         ;;
3869 esac
3870
3871 case "$mips_type" in
3872 *BSD*|'') inclwanted="$locincpth $usrinc";;
3873 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3874 esac
3875 for thisincl in $inclwanted; do
3876         if $test -d $thisincl; then
3877                 if $test x$thisincl != x$usrinc; then
3878                         case "$dflt" in
3879                         *$thisincl*);;
3880                         *) dflt="$dflt -I$thisincl";;
3881                         esac
3882                 fi
3883         fi
3884 done
3885
3886 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3887         xxx=true;
3888 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3889         xxx=true;
3890 else
3891         xxx=false;
3892 fi;
3893 if $xxx; then
3894         case "$dflt" in
3895         *$2*);;
3896         *) dflt="$dflt -D$2";;
3897         esac;
3898 fi'
3899
3900 set signal.h LANGUAGE_C; eval $inctest
3901
3902 case "$usesocks" in
3903 $define)
3904         ccflags="$ccflags -DSOCKS"
3905         ;;
3906 esac
3907
3908 case "$hint" in
3909 default|recommended) dflt="$ccflags $dflt" ;;
3910 *) dflt="$ccflags";;
3911 esac
3912
3913 case "$dflt" in
3914 ''|' ') dflt=none;;
3915 esac
3916 $cat <<EOH
3917
3918 Your C compiler may want other flags.  For this question you should include
3919 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3920 but you should NOT include libraries or ld flags like -lwhatever.  If you
3921 want $package to honor its debug switch, you should include -DDEBUGGING here.
3922 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3923
3924 To use no flags, specify the word "none".
3925
3926 EOH
3927 set X $dflt
3928 shift
3929 dflt=${1+"$@"}
3930 rp="Any additional cc flags?"
3931 . ./myread
3932 case "$ans" in
3933 none) ccflags='';;
3934 *) ccflags="$ans";;
3935 esac
3936
3937 : the following weeds options from ccflags that are of no interest to cpp
3938 cppflags="$ccflags"
3939 case "$gccversion" in
3940 1*) cppflags="$cppflags -D__GNUC__"
3941 esac
3942 case "$mips_type" in
3943 '');;
3944 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3945 esac
3946 case "$cppflags" in
3947 '');;
3948 *)
3949         echo " "
3950         echo "Let me guess what the preprocessor flags are..." >&4
3951         set X $cppflags
3952         shift
3953         cppflags=''
3954         $cat >cpp.c <<'EOM'
3955 #define BLURFL foo
3956
3957 BLURFL xx LFRULB
3958 EOM
3959         previous=''
3960         for flag in $*
3961         do
3962                 case "$flag" in
3963                 -*) ftry="$flag";;
3964                 *) ftry="$previous $flag";;
3965                 esac
3966                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3967                         >cpp1.out 2>/dev/null && \
3968                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3969                         >cpp2.out 2>/dev/null && \
3970                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3971                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3972                 then
3973                         cppflags="$cppflags $ftry"
3974                         previous=''
3975                 else
3976                         previous="$flag"
3977                 fi
3978         done
3979         set X $cppflags
3980         shift
3981         cppflags=${1+"$@"}
3982         case "$cppflags" in
3983         *-*)  echo "They appear to be: $cppflags";;
3984         esac
3985         $rm -f cpp.c cpp?.out
3986         ;;
3987 esac
3988
3989 : flags used in final linking phase
3990 case "$ldflags" in
3991 '') if ./venix; then
3992                 dflt='-i -z'
3993         else
3994                 dflt=''
3995         fi
3996         case "$ccflags" in
3997         *-posix*) dflt="$dflt -posix" ;;
3998         esac
3999         ;;
4000 *) dflt="$ldflags";;
4001 esac
4002
4003 : Try to guess additional flags to pick up local libraries.
4004 for thislibdir in $libpth; do
4005         case " $loclibpth " in
4006         *" $thislibdir "*)
4007                 case "$dflt " in 
4008                 *"-L$thislibdir "*) ;;
4009                 *)  dflt="$dflt -L$thislibdir" ;;
4010                 esac
4011                 ;;
4012         esac
4013 done
4014
4015 case "$dflt" in
4016 '') dflt='none' ;;
4017 esac
4018
4019 $cat <<EOH
4020
4021 Your C linker may need flags.  For this question you should
4022 include -L/whatever and any other flags used by the C linker, but you
4023 should NOT include libraries like -lwhatever.
4024
4025 Make sure you include the appropriate -L/path flags if your C linker
4026 does not normally search all of the directories you specified above,
4027 namely
4028         $libpth
4029 To use no flags, specify the word "none".
4030
4031 EOH
4032
4033 rp="Any additional ld flags (NOT including libraries)?"
4034 . ./myread
4035 case "$ans" in
4036 none) ldflags='';;
4037 *) ldflags="$ans";;
4038 esac
4039 rmlist="$rmlist pdp11"
4040
4041 : coherency check
4042 echo " "
4043 echo "Checking your choice of C compiler and flags for coherency..." >&4
4044 $cat > try.c <<'EOF'
4045 #include <stdio.h>
4046 int main() { printf("Ok\n"); exit(0); }
4047 EOF
4048 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4049 shift
4050 $cat >try.msg <<'EOM'
4051 I've tried to compile and run the following simple program:
4052
4053 EOM
4054 $cat try.c >> try.msg
4055
4056 $cat >> try.msg <<EOM
4057
4058 I used the command:
4059
4060         $*
4061         ./try
4062
4063 and I got the following output:
4064
4065 EOM
4066 dflt=y
4067 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4068         if sh -c './try' >>try.msg 2>&1; then
4069                 xxx=`./try`
4070                 case "$xxx" in
4071                 "Ok") dflt=n ;;
4072                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4073                         case " $libs " in
4074                         *" -lsfio "*)
4075                                 cat >> try.msg <<'EOQS'
4076 If $libs contains -lsfio, and sfio is mis-configured, then it
4077 sometimes (apparently) runs and exits with a 0 status, but with no
4078 output!  It may have to do with sfio's use of _exit vs. exit.
4079
4080 EOQS
4081                                 rp="You have a big problem.  Shall I abort Configure"
4082                                 dflt=y
4083                                 ;;
4084                         esac
4085                         ;;
4086                 esac
4087         else
4088                 echo "The program compiled OK, but exited with status $?." >>try.msg
4089                 rp="You have a problem.  Shall I abort Configure"
4090                 dflt=y
4091         fi
4092 else
4093         echo "I can't compile the test program." >>try.msg
4094         rp="You have a BIG problem.  Shall I abort Configure"
4095         dflt=y
4096 fi
4097 case "$dflt" in
4098 y)
4099         $cat try.msg >&4
4100         case "$knowitall" in
4101         '')
4102                 echo "(The supplied flags or libraries might be incorrect.)"
4103                 ;;
4104         *) dflt=n;;
4105         esac
4106         echo " "
4107         . ./myread
4108         case "$ans" in
4109         n*|N*) ;;
4110         *)      echo "Ok.  Stopping Configure." >&4
4111                 exit 1
4112                 ;;
4113         esac
4114         ;;
4115 n) echo "OK, that should do.";;
4116 esac
4117 $rm -f try try.* core
4118
4119 : define an is-a-typedef? function
4120 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4121 case "$inclist" in
4122 "") inclist="sys/types.h";;
4123 esac;
4124 eval "varval=\$$var";
4125 case "$varval" in
4126 "")
4127         $rm -f temp.c;
4128         for inc in $inclist; do
4129                 echo "#include <$inc>" >>temp.c;
4130         done;
4131         echo "#ifdef $type" >> temp.c;
4132         echo "printf(\"We have $type\");" >> temp.c;
4133         echo "#endif" >> temp.c;
4134         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4135         if $contains $type temp.E >/dev/null 2>&1; then
4136                 eval "$var=\$type";
4137         else
4138                 eval "$var=\$def";
4139         fi;
4140         $rm -f temp.?;;
4141 *) eval "$var=\$varval";;
4142 esac'
4143
4144 : define an is-a-typedef? function that prompts if the type is not available.
4145 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4146 case "$inclist" in
4147 "") inclist="sys/types.h";;
4148 esac;
4149 eval "varval=\$$var";
4150 case "$varval" in
4151 "")
4152         $rm -f temp.c;
4153         for inc in $inclist; do
4154                 echo "#include <$inc>" >>temp.c;
4155         done;
4156         echo "#ifdef $type" >> temp.c;
4157         echo "printf(\"We have $type\");" >> temp.c;
4158         echo "#endif" >> temp.c;
4159         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4160         echo " " ;
4161         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4162         if $contains $type temp.E >/dev/null 2>&1; then
4163                 echo "$type found." >&4;
4164                 eval "$var=\$type";
4165         else
4166                 echo "$type NOT found." >&4;
4167                 dflt="$def";
4168                 . ./myread ;
4169                 eval "$var=\$ans";
4170         fi;
4171         $rm -f temp.?;;
4172 *) eval "$var=\$varval";;
4173 esac'
4174
4175 : define a shorthand compile call
4176 compile='
4177 mc_file=$1;
4178 shift;
4179 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4180 : define a shorthand compile call for compilations that should be ok.
4181 compile_ok='
4182 mc_file=$1;
4183 shift;
4184 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4185
4186 : check for lengths of integral types
4187 echo " "
4188 case "$intsize" in
4189 '')
4190         echo "Checking to see how big your integers are..." >&4
4191         $cat >intsize.c <<'EOCP'
4192 #include <stdio.h>
4193 int main()
4194 {
4195         printf("intsize=%d;\n", (int)sizeof(int));
4196         printf("longsize=%d;\n", (int)sizeof(long));
4197         printf("shortsize=%d;\n", (int)sizeof(short));
4198         exit(0);
4199 }
4200 EOCP
4201         set intsize
4202         if eval $compile_ok && ./intsize > /dev/null; then
4203                 eval `./intsize`
4204                 echo "Your integers are $intsize bytes long."
4205                 echo "Your long integers are $longsize bytes long."
4206                 echo "Your short integers are $shortsize bytes long."
4207         else
4208                 $cat >&4 <<EOM
4209 !
4210 Help! I can't compile and run the intsize test program: please enlighten me!
4211 (This is probably a misconfiguration in your system or libraries, and
4212 you really ought to fix it.  Still, I'll try anyway.)
4213 !
4214 EOM
4215                 dflt=4
4216                 rp="What is the size of an integer (in bytes)?"
4217                 . ./myread
4218                 intsize="$ans"
4219                 dflt=$intsize
4220                 rp="What is the size of a long integer (in bytes)?"
4221                 . ./myread
4222                 longsize="$ans"
4223                 dflt=2
4224                 rp="What is the size of a short integer (in bytes)?"
4225                 . ./myread
4226                 shortsize="$ans"
4227         fi
4228         ;;
4229 esac
4230 $rm -f intsize intsize.*
4231
4232 : see what type lseek is declared as in the kernel
4233 rp="What is the type used for lseek's offset on this system?"
4234 set off_t lseektype long stdio.h sys/types.h
4235 eval $typedef_ask
4236
4237 echo " "
4238 $echo $n "Checking to see how big your file offsets are...$c" >&4
4239 $cat >try.c <<EOCP
4240 #include <sys/types.h>
4241 #include <stdio.h>
4242 int main()
4243 {
4244     printf("%d\n", (int)sizeof($lseektype));
4245     return(0); 
4246 }
4247 EOCP
4248 set try
4249 if eval $compile_ok; then
4250         lseeksize=`./try`
4251         $echo " $lseeksize bytes." >&4
4252 else
4253         dflt=$longsize
4254         echo " "
4255         echo "(I can't seem to compile the test program.  Guessing...)"
4256         rp="What is the size of your file offsets (in bytes)?"
4257         . ./myread
4258         lseeksize="$ans"
4259 fi
4260 $rm -f try.c try
4261
4262 : see what type file positions are declared as in the library
4263 rp="What is the type for file position used by fsetpos()?"
4264 set fpos_t fpostype long stdio.h sys/types.h
4265 eval $typedef_ask
4266
4267 echo " "
4268 case "$fpostype" in
4269 *_t) zzz="$fpostype"    ;;
4270 *)   zzz="fpos_t"       ;;
4271 esac
4272 $echo $n "Checking the size of $zzz...$c" >&4 
4273 cat > try.c <<EOCP
4274 #include <sys/types.h>
4275 #include <stdio.h>
4276 int main() {
4277     printf("%d\n", (int)sizeof($fpostype));
4278     exit(0);
4279 }
4280 EOCP
4281 set try
4282 if eval $compile_ok; then
4283         yyy=`./try`
4284         case "$yyy" in
4285         '')     fpossize=4
4286                 echo " "
4287                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4288                 ;;
4289         *)      fpossize=$yyy
4290                 echo " $fpossize bytes."
4291                 ;;
4292         esac
4293 else
4294         dflt="$longsize"
4295         echo " "
4296         echo "(I can't compile the test program.  Guessing...)" >&4
4297         rp="What is the size of your file positions (in bytes)?"
4298         . ./myread
4299         fpossize="$ans"
4300 fi
4301
4302
4303
4304 case "$lseeksize:$fpossize" in
4305 8:8) cat <<EOM
4306
4307 You can have files larger than 2 gigabytes.
4308 EOM
4309    val="$define" ;;
4310 *) cat <<EOM
4311
4312 Perl can be built to understand large files (files larger than 2 gigabytes)
4313 on some systems.  To do so, Configure must be run with -Duselargefiles.
4314
4315 If this doesn't make any sense to you, just accept the default 'y'.
4316 EOM
4317    case "$uselargefiles" in
4318    "$undef"|false|[nN]*) dflt='n' ;;
4319    *)   dflt='y' ;;
4320    esac
4321    rp='Try to understand large files, if available?'
4322    . ./myread
4323    case "$ans" in
4324    y|Y)         val="$define" ;;
4325    *)           val="$undef"  ;;
4326    esac
4327    ;;
4328 esac
4329 set uselargefiles
4330 eval $setvar
4331 case "$uselargefiles" in
4332 "$define")
4333 : Look for a hint-file generated 'call-back-unit'.  If the
4334 : user has specified that a large files perl is to be built,
4335 : we may need to set or change some other defaults.
4336         if $test -f uselfs.cbu; then
4337                 echo "Your platform has some specific hints for large file builds, using them..."
4338                 . ./uselfs.cbu
4339                 echo " "
4340                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4341                 $cat >try.c <<EOCP
4342 #include <sys/types.h>
4343 #include <stdio.h>
4344 int main()
4345 {
4346     printf("%d\n", (int)sizeof($lseektype));
4347     return(0); 
4348 }
4349 EOCP
4350                 set try
4351                 if eval $compile_ok; then
4352                         lseeksize=`./try`
4353                         $echo " $lseeksize bytes." >&4
4354                 else
4355                         dflt="$lseeksize"
4356                         echo " "
4357                         echo "(I can't seem to compile the test program.  Guessing...)"
4358                         rp="What is the size of your file offsets (in bytes)?"
4359                         . ./myread
4360                         lseeksize="$ans"
4361                 fi
4362                 case "$fpostype" in
4363                 *_t) zzz="$fpostype"    ;;
4364                 *)   zzz="fpos_t"       ;;
4365                 esac
4366                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4367                 $cat > try.c <<EOCP
4368 #include <sys/types.h>
4369 #include <stdio.h>
4370 int main() {
4371     printf("%d\n", (int)sizeof($fpostype));
4372     exit(0);
4373 }
4374 EOCP
4375                 set try
4376                 if eval $compile_ok; then
4377                         yyy=`./try`
4378                         dflt="$lseeksize"
4379                         case "$yyy" in
4380                         '')     echo " "
4381                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4382                                 ;;
4383                         *)      fpossize=$yyy
4384                                 echo " $fpossize bytes."
4385                                 ;;
4386                         esac
4387                 else
4388                         dflt="$fpossize"
4389                         echo " "
4390                         echo "(I can't compile the test program.  Guessing...)" >&4
4391                         rp="What is the size of your file positions (in bytes)?"
4392                         . ./myread
4393                         fpossize="$ans"
4394                 fi
4395                 $rm -f try.c try
4396         fi
4397         ;;
4398 esac
4399
4400
4401 case "$usemorebits" in
4402 "$define"|true|[yY]*)
4403         use64bits="$define"
4404         uselongdouble="$define"
4405         usemorebits="$define"
4406         ;;
4407 *)      usemorebits="$undef"
4408         ;;
4409 esac
4410
4411
4412 case "$intsize:$longsize" in
4413 8:*|*:8) cat <<EOM
4414
4415 You have natively 64-bit integers.
4416 EOM
4417    val="$define" ;;
4418 *) cat <<EOM
4419
4420 Perl can be built to take advantage of 64-bit integer types
4421 on some systems.  To do so, Configure must be run with -Duse64bits.
4422
4423 If this doesn't make any sense to you, just accept the default.
4424 EOM
4425   case "$use64bits" in
4426   $define|true|[yY]*)   dflt='y';;
4427   *) dflt='n';;
4428   esac
4429   rp='Try to use 64-bit integers, if available?'
4430   . ./myread
4431   case "$ans" in
4432   y|Y) val="$define" ;;
4433   *)   val="$undef"  ;;
4434   esac
4435   ;;
4436 esac
4437 set use64bits
4438 eval $setvar
4439
4440 case "$archname64" in
4441 '') archname64='' ;;    # not a typo
4442 esac
4443
4444 case "$use64bits" in
4445 "$define"|true|[yY]*)
4446 : Look for a hint-file generated 'call-back-unit'.  If the
4447 : user has specified that a 64-bit perl is to be built,
4448 : we may need to set or change some other defaults.
4449         if $test -f use64bits.cbu; then
4450                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4451                 . ./use64bits.cbu
4452         else
4453                 $cat <<EOM
4454 (Your platform doesn't have any specific hints for 64-bit builds.)
4455 EOM
4456                 case "$intsize:$longsize" in
4457 8:*|*:8) cat <<EOM
4458 (This is probably okay, as your system is a natively 64-bit system.)
4459 EOM
4460                   ;;
4461                 esac
4462                 case "$gccversion" in
4463                 '')     ;;
4464                 *)      case "$ccflags" in
4465                         *-DUSE_LONG_LONG*) ;;
4466                         *) $cat <<EOM
4467 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4468 to the compilation flags.
4469 EOM
4470                            ccflags="$ccflags -DUSE_LONG_LONG"
4471                            ;;
4472                         esac
4473                         ;;
4474                 esac
4475         fi
4476         ;;
4477 esac
4478
4479 : determine the architecture name
4480 echo " "
4481 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4482         tarch=`arch`"-$osname"
4483 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4484         if uname -m > tmparch 2>&1 ; then
4485                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4486                         -e 's/$/'"-$osname/" tmparch`
4487         else
4488                 tarch="$osname"
4489         fi
4490         $rm -f tmparch
4491 else
4492         tarch="$osname"
4493 fi
4494 case "$myarchname" in
4495 ''|"$tarch") ;;
4496 *)
4497         echo "(Your architecture name used to be $myarchname.)"
4498         archname=''
4499         ;;
4500 esac
4501 myarchname="$tarch"
4502 case "$archname" in
4503 '') dflt="$tarch";;
4504 *) dflt="$archname";;
4505 esac
4506 rp='What is your architecture name'
4507 . ./myread
4508 archname="$ans"
4509 case "$usethreads" in
4510 $define)
4511         echo "Threads selected." >&4
4512         case "$archname" in
4513         *-thread*) echo "...and architecture name already has -thread." >&4
4514                 ;;
4515         *)      archname="$archname-thread"
4516                 echo "...setting architecture name to $archname." >&4
4517                 ;;
4518         esac
4519         ;;
4520 esac
4521 case "$usemultiplicity" in
4522 $define)
4523         echo "Multiplicity selected." >&4
4524         case "$archname" in
4525         *-multi*) echo "...and architecture name already has -multi." >&4
4526                 ;;
4527         *)      archname="$archname-multi"
4528                 echo "...setting architecture name to $archname." >&4
4529                 ;;
4530         esac
4531         ;;
4532 esac
4533 case "$use64bits" in
4534 $define)
4535         case "$archname64" in
4536         '')
4537                 ;;
4538         *)
4539                 case "$archname" in
4540                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4541                         ;;
4542                 *)      archname="$archname-$archname64"
4543                         echo "...setting architecture name to $archname." >&4
4544                         ;;
4545                 esac
4546                 ;;
4547         esac
4548 esac
4549
4550 : determine root of directory hierarchy where package will be installed.
4551 case "$prefix" in
4552 '')
4553         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4554         ;;
4555 *)
4556         dflt="$prefix"
4557         ;;
4558 esac
4559 $cat <<EOM
4560
4561 By default, $package will be installed in $dflt/bin, manual pages
4562 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4563 installation directories. Typically this is something like /usr/local.
4564 If you wish to have binaries under /usr/bin but other parts of the
4565 installation under /usr/local, that's ok: you will be prompted
4566 separately for each of the installation directories, the prefix being
4567 only used to set the defaults.
4568
4569 EOM
4570 fn=d~
4571 rp='Installation prefix to use?'
4572 . ./getfile
4573 oldprefix=''
4574 case "$prefix" in
4575 '') ;;
4576 *)
4577         case "$ans" in
4578         "$prefix") ;;
4579         *) oldprefix="$prefix";;
4580         esac
4581         ;;
4582 esac
4583 prefix="$ans"
4584 prefixexp="$ansexp"
4585
4586 : is AFS running?
4587 echo " "
4588 case "$afs" in
4589 $define|true)   afs=true ;;
4590 $undef|false)   afs=false ;;
4591 *)      if test -d /afs; then
4592                 afs=true
4593         else
4594                 afs=false
4595         fi
4596         ;;
4597 esac
4598 if $afs; then
4599         echo "AFS may be running... I'll be extra cautious then..." >&4
4600 else
4601         echo "AFS does not seem to be running..." >&4
4602 fi
4603
4604 : determine installation prefix for where package is to be installed.
4605 if $afs; then 
4606 $cat <<EOM
4607
4608 Since you are running AFS, I need to distinguish the directory in which
4609 files will reside from the directory in which they are installed (and from
4610 which they are presumably copied to the former directory by occult means).
4611
4612 EOM
4613         case "$installprefix" in
4614         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4615         *) dflt="$installprefix";;
4616         esac
4617 else
4618 $cat <<EOM
4619
4620 In some special cases, particularly when building $package for distribution,
4621 it is convenient to distinguish between the directory in which files should 
4622 be installed from the directory ($prefix) in which they 
4623 will eventually reside.  For most users, these two directories are the same.
4624
4625 EOM
4626         case "$installprefix" in
4627         '') dflt=$prefix ;;
4628         *) dflt=$installprefix;;
4629         esac
4630 fi
4631 fn=d~
4632 rp='What installation prefix should I use for installing files?'
4633 . ./getfile
4634 installprefix="$ans"
4635 installprefixexp="$ansexp"
4636
4637 : set the prefixit variable, to compute a suitable default value
4638 prefixit='case "$3" in
4639 ""|none)
4640         case "$oldprefix" in
4641         "") eval "$1=\"\$$2\"";;
4642         *)
4643                 case "$3" in
4644                 "") eval "$1=";;
4645                 none)
4646                         eval "tp=\"\$$2\"";
4647                         case "$tp" in
4648                         ""|" ") eval "$1=\"\$$2\"";;
4649                         *) eval "$1=";;
4650                         esac;;
4651                 esac;;
4652         esac;;
4653 *)
4654         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4655         case "$tp" in
4656         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4657         /*-$oldprefix/*|\~*-$oldprefix/*)
4658                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4659         *) eval "$1=\"\$$2\"";;
4660         esac;;
4661 esac'
4662
4663 : set the base revision
4664 baserev=5.0
4665
4666
4667 : get the patchlevel
4668 echo " "
4669 echo "Getting the current patchlevel..." >&4
4670 if $test -r $rsrc/patchlevel.h;then
4671         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4672         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4673         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4674         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4675         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4676 else
4677         patchlevel=0
4678         subversion=0
4679         api_revision=0
4680         api_version=0
4681         api_subversion=0
4682 fi
4683 $echo $n "(You have $package" $c
4684 case "$package" in
4685 "*$baserev")    ;;
4686 *)              $echo $n " $baserev" $c ;;
4687 esac
4688 $echo $n " patchlevel $patchlevel" $c
4689 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4690 echo ".)"
4691 case "$osname" in
4692 dos|cygwin|vms|win32)
4693         : XXX Should be a Configure test for double-dots in filenames.
4694         version=`echo $baserev $patchlevel $subversion | \
4695                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4696         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4697                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4698         ;;
4699 *)
4700         version=`echo $baserev $patchlevel $subversion | \
4701                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4702         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4703                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4704         ;;
4705 esac
4706 : Special case the 5.005_xx maintenance series, which used 5.005
4707 : without any subversion label as a subdirectory in $sitelib
4708 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4709         api_versionstring='5.005'
4710 fi
4711
4712 : determine installation style
4713 : For now, try to deduce it from prefix unless it is already set.
4714 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4715 case "$installstyle" in
4716 '')     case "$prefix" in
4717                 *perl*) dflt='lib';;
4718                 *) dflt='lib/perl5' ;;
4719         esac
4720         ;;
4721 *)      dflt='lib/perl5' ;;
4722 esac
4723 : Probably not worth prompting for this since we prompt for all
4724 : the directories individually, and the prompt would be too long and
4725 : confusing anyway.
4726 installstyle=$dflt
4727
4728 : determine where private library files go
4729 : Usual default is /usr/local/lib/perl5/$version.
4730 : Also allow things like /opt/perl/lib/$version, since 
4731 : /opt/perl/lib/perl5... would be redundant.
4732 : The default "style" setting is made in installstyle.U
4733 case "$installstyle" in
4734 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4735 *)       set dflt privlib lib/$version ;;
4736 esac
4737 eval $prefixit
4738 $cat <<EOM
4739
4740 There are some auxiliary files for $package that need to be put into a
4741 private library directory that is accessible by everyone.
4742
4743 EOM
4744 fn=d~+
4745 rp='Pathname where the private library files will reside?'
4746 . ./getfile
4747 privlib="$ans"
4748 privlibexp="$ansexp"
4749 : Change installation prefix, if necessary.
4750 if $test X"$prefix" != X"$installprefix"; then
4751         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4752 else
4753         installprivlib="$privlibexp"
4754 fi
4755
4756 : set the prefixup variable, to restore leading tilda escape
4757 prefixup='case "$prefixexp" in
4758 "$prefix") ;;
4759 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4760 esac'
4761
4762 : determine where public architecture dependent libraries go
4763 set archlib archlib
4764 eval $prefixit
4765 : privlib default is /usr/local/lib/$package/$version
4766 : archlib default is /usr/local/lib/$package/$version/$archname
4767 : privlib may have an optional trailing /share.
4768 tdflt=`echo $privlib | $sed 's,/share$,,'`
4769 tdflt=$tdflt/$archname
4770 case "$archlib" in
4771 '')     dflt=$tdflt
4772         ;;
4773 *)      dflt="$archlib"
4774     ;;
4775 esac
4776 $cat <<EOM
4777
4778 $spackage contains architecture-dependent library files.  If you are
4779 sharing libraries in a heterogeneous environment, you might store
4780 these files in a separate location.  Otherwise, you can just include
4781 them with the rest of the public library files.
4782
4783 EOM
4784 fn=d+~
4785 rp='Where do you want to put the public architecture-dependent libraries?'
4786 . ./getfile
4787 archlib="$ans"
4788 archlibexp="$ansexp"
4789 if $test X"$archlib" = X"$privlib"; then
4790         d_archlib="$undef"
4791 else
4792         d_archlib="$define"
4793 fi
4794 : Change installation prefix, if necessary.
4795 if $test X"$prefix" != X"$installprefix"; then
4796         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4797 else
4798         installarchlib="$archlibexp"
4799 fi
4800
4801
4802 : Binary compatibility with 5.005 is not possible for builds
4803 : with advanced features
4804 case "$usethreads$usemultiplicity" in
4805 *define*)
4806         bincompat5005="$undef"
4807         d_bincompat5005="$undef"
4808         ;;
4809 *)      $cat <<EOM
4810
4811 Perl 5.006 can be compiled for binary compatibility with 5.005.
4812 If you decide to do so, you will be able to continue using most
4813 of the extensions that were compiled for Perl 5.005.
4814
4815 EOM
4816         case "$bincompat5005$d_bincompat5005" in
4817         *"$undef"*) dflt=n ;;
4818         *) dflt=y ;;
4819         esac
4820         rp='Binary compatibility with Perl 5.005?'
4821         . ./myread
4822         case "$ans" in
4823         y*) val="$define" ;;
4824         *)  val="$undef" ;;
4825         esac
4826         set d_bincompat5005
4827         eval $setvar
4828         case "$d_bincompat5005" in
4829         "$define")
4830                 bincompat5005="$define"
4831                 ;;
4832         *)      bincompat5005="$undef"
4833                 d_bincompat5005="$undef"
4834                 ;;
4835         esac
4836         ;;
4837 esac
4838
4839
4840 : see if setuid scripts can be secure
4841 $cat <<EOM
4842
4843 Some kernels have a bug that prevents setuid #! scripts from being
4844 secure.  Some sites have disabled setuid #! scripts because of this.
4845
4846 First let's decide if your kernel supports secure setuid #! scripts.
4847 (If setuid #! scripts would be secure but have been disabled anyway,
4848 don't say that they are secure if asked.)
4849
4850 EOM
4851
4852 val="$undef"
4853 if $test -d /dev/fd; then
4854         echo "#!$ls" >reflect
4855         chmod +x,u+s reflect
4856         ./reflect >flect 2>&1
4857         if $contains "/dev/fd" flect >/dev/null; then
4858                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4859                 val="$define"
4860         else
4861                 $cat <<EOM
4862 If you are not sure if they are secure, I can check but I'll need a
4863 username and password different from the one you are using right now.
4864 If you don't have such a username or don't want me to test, simply
4865 enter 'none'.
4866
4867 EOM
4868                 rp='Other username to test security of setuid scripts with?'
4869                 dflt='none'
4870                 . ./myread
4871                 case "$ans" in
4872                 n|none)
4873                         case "$d_suidsafe" in
4874                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4875                                 dflt=n;;
4876                         "$undef")
4877                                 echo "Well, the $hint value is *not* secure." >&4
4878                                 dflt=n;;
4879                         *)      echo "Well, the $hint value *is* secure." >&4
4880                                 dflt=y;;
4881                         esac
4882                         ;;
4883                 *)
4884                         $rm -f reflect flect
4885                         echo "#!$ls" >reflect
4886                         chmod +x,u+s reflect
4887                         echo >flect
4888                         chmod a+w flect
4889                         echo '"su" will (probably) prompt you for '"$ans's password."
4890                         su $ans -c './reflect >flect'
4891                         if $contains "/dev/fd" flect >/dev/null; then
4892                                 echo "Okay, it looks like setuid scripts are secure." >&4
4893                                 dflt=y
4894                         else
4895                                 echo "I don't think setuid scripts are secure." >&4
4896                                 dflt=n
4897                         fi
4898                         ;;
4899                 esac
4900                 rp='Does your kernel have *secure* setuid scripts?'
4901                 . ./myread
4902                 case "$ans" in
4903                 [yY]*)  val="$define";;
4904                 *)      val="$undef";;
4905                 esac
4906         fi
4907 else
4908         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4909         echo "(That's for file descriptors, not floppy disks.)"
4910         val="$undef"
4911 fi
4912 set d_suidsafe
4913 eval $setvar
4914
4915 $rm -f reflect flect
4916
4917 : now see if they want to do setuid emulation
4918 echo " "
4919 val="$undef"
4920 case "$d_suidsafe" in
4921 "$define")
4922         val="$undef"
4923         echo "No need to emulate SUID scripts since they are secure here." >& 4
4924         ;;
4925 *)
4926         $cat <<EOM
4927 Some systems have disabled setuid scripts, especially systems where
4928 setuid scripts cannot be secure.  On systems where setuid scripts have
4929 been disabled, the setuid/setgid bits on scripts are currently
4930 useless.  It is possible for $package to detect those bits and emulate
4931 setuid/setgid in a secure fashion.  This emulation will only work if
4932 setuid scripts have been disabled in your kernel.
4933
4934 EOM
4935         case "$d_dosuid" in
4936         "$define") dflt=y ;;
4937         *) dflt=n ;;
4938         esac
4939         rp="Do you want to do setuid/setgid emulation?"
4940         . ./myread
4941         case "$ans" in
4942         [yY]*)  val="$define";;
4943         *)      val="$undef";;
4944         esac
4945         ;;
4946 esac
4947 set d_dosuid
4948 eval $setvar
4949
4950 : determine filename position in cpp output
4951 echo " "
4952 echo "Computing filename position in cpp output for #include directives..." >&4
4953 echo '#include <stdio.h>' > foo.c
4954 $cat >fieldn <<EOF
4955 $startsh
4956 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4957 $grep '^[       ]*#.*stdio\.h' | \
4958 while read cline; do
4959         pos=1
4960         set \$cline
4961         while $test \$# -gt 0; do
4962                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4963                         echo "\$pos"
4964                         exit 0
4965                 fi
4966                 shift
4967                 pos=\`expr \$pos + 1\`
4968         done
4969 done
4970 EOF
4971 chmod +x fieldn
4972 fieldn=`./fieldn`
4973 $rm -f foo.c fieldn
4974 case $fieldn in
4975 '') pos='???';;
4976 1) pos=first;;
4977 2) pos=second;;
4978 3) pos=third;;
4979 *) pos="${fieldn}th";;
4980 esac
4981 echo "Your cpp writes the filename in the $pos field of the line."
4982
4983 : locate header file
4984 $cat >findhdr <<EOF
4985 $startsh
4986 wanted=\$1
4987 name=''
4988 for usrincdir in $usrinc
4989 do
4990         if test -f \$usrincdir/\$wanted; then
4991                 echo "\$usrincdir/\$wanted"
4992                 exit 0
4993         fi
4994 done
4995 awkprg='{ print \$$fieldn }'
4996 echo "#include <\$wanted>" > foo\$\$.c
4997 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4998 $grep "^[       ]*#.*\$wanted" | \
4999 while read cline; do
5000         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5001         case "\$name" in
5002         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5003         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5004         *) exit 2;;
5005         esac;
5006 done;
5007 #
5008 # status = 0: grep returned 0 lines, case statement not executed
5009 # status = 1: headerfile found
5010 # status = 2: while loop executed, no headerfile found
5011 #
5012 status=\$?
5013 $rm -f foo\$\$.c;
5014 if test \$status -eq 1; then
5015         exit 0;
5016 fi
5017 exit 1
5018 EOF
5019 chmod +x findhdr
5020
5021 : define an alternate in-header-list? function
5022 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5023 cont=true; xxf="echo \"<\$1> found.\" >&4";
5024 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5025 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5026 esac;
5027 case $# in 4) instead=instead;; *) instead="at last";; esac;
5028 while $test "$cont"; do
5029         xxx=`./findhdr $1`
5030         var=$2; eval "was=\$$2";
5031         if $test "$xxx" && $test -r "$xxx";
5032         then eval $xxf;
5033         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5034                 cont="";
5035         else eval $xxnf;
5036         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5037         set $yyy; shift; shift; yyy=$@;
5038         case $# in 0) cont="";;
5039         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5040                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5041         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5042                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5043         esac;
5044 done;
5045 while $test "$yyy";
5046 do set $yyy; var=$2; eval "was=\$$2";
5047         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5048         set $yyy; shift; shift; yyy=$@;
5049 done'
5050
5051 : see if this is a malloc.h system
5052 set malloc.h i_malloc
5053 eval $inhdr
5054
5055 : see if stdlib is available
5056 set stdlib.h i_stdlib
5057 eval $inhdr
5058
5059 : determine which malloc to compile in
5060 echo " "
5061 case "$usemymalloc" in
5062 ''|[yY]*|true|$define)  dflt='y' ;;
5063 *)      dflt='n' ;;
5064 esac
5065 rp="Do you wish to attempt to use the malloc that comes with $package?"
5066 . ./myread
5067 usemymalloc="$ans"
5068 case "$ans" in
5069 y*|true)
5070         usemymalloc='y'
5071         mallocsrc='malloc.c'
5072         mallocobj="malloc$_o"
5073         d_mymalloc="$define"
5074         case "$libs" in
5075         *-lmalloc*)
5076                 : Remove malloc from list of libraries to use
5077                 echo "Removing unneeded -lmalloc from library list" >&4
5078                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5079                 shift
5080                 libs="$*"
5081                 echo "libs = $libs" >&4
5082                 ;;
5083         esac
5084         ;;
5085 *)
5086         usemymalloc='n'
5087         mallocsrc=''
5088         mallocobj=''
5089         d_mymalloc="$undef"
5090         ;;
5091 esac
5092
5093 : compute the return types of malloc and free
5094 echo " "
5095 $cat >malloc.c <<END
5096 #$i_malloc I_MALLOC
5097 #$i_stdlib I_STDLIB
5098 #include <stdio.h>
5099 #include <sys/types.h>
5100 #ifdef I_MALLOC
5101 #include <malloc.h>
5102 #endif
5103 #ifdef I_STDLIB
5104 #include <stdlib.h>
5105 #endif
5106 #ifdef TRY_MALLOC
5107 void *malloc();
5108 #endif
5109 #ifdef TRY_FREE
5110 void free();
5111 #endif
5112 END
5113 case "$malloctype" in
5114 '')
5115         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5116                 malloctype='void *'
5117         else
5118                 malloctype='char *'
5119         fi
5120         ;;
5121 esac
5122 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5123
5124 case "$freetype" in
5125 '')
5126         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5127                 freetype='void'
5128         else
5129                 freetype='int'
5130         fi
5131         ;;
5132 esac
5133 echo "Your system uses $freetype free(), it would seem." >&4
5134 $rm -f malloc.[co]
5135 $cat <<EOM
5136
5137 The installation process will also create a directory for
5138 vendor-supplied add-ons.  Vendors who supply perl with their system
5139 may find it convenient to place all vendor-supplied files in this
5140 directory rather than in the main distribution directory.  This will
5141 ease upgrades between binary-compatible maintenance versions of perl.
5142
5143 Of course you may also use these directories in whatever way you see
5144 fit.  For example, you might use them to access modules shared over a
5145 company-wide network.
5146
5147 The default answer should be fine for most people.
5148 This causes further questions about vendor add-ons to be skipped
5149 and no vendor-specific directories will be configured for perl.
5150
5151 EOM
5152 rp='Do you want to configure vendor-specific add-on directories?'
5153 case "$usevendorprefix" in
5154 define|true|[yY]*) dflt=y ;;
5155 *) dflt=n ;;
5156 esac
5157 . ./myread
5158 case "$ans" in
5159 [yY]*)  fn=d~+
5160         rp='Installation prefix to use for vendor-supplied add-ons?'
5161         case "$vendorprefix" in
5162         '') dflt='' ;;
5163         *)  dflt=$vendorprefix ;;
5164         esac
5165         . ./getfile
5166         oldvendorprefix=''
5167         case "$vendorprefix" in
5168         '') ;;
5169         *)      case "$ans" in
5170                 "$prefix") ;;
5171                 *) oldvendorprefix="$prefix";;
5172                 esac
5173                 ;;
5174         esac
5175         usevendorprefix="$define"
5176         vendorprefix="$ans"
5177         vendorprefixexp="$ansexp"
5178         ;;
5179 *)      usevendorprefix="$undef"
5180         vendorprefix=''
5181         vendorprefixexp=''
5182         ;;
5183 esac
5184
5185 case "$vendorprefix" in
5186 '')     d_vendorlib="$undef"
5187         vendorlib=''
5188         vendorlibexp=''
5189         ;;
5190 *)      d_vendorlib="$define"
5191         : determine where vendor-supplied modules go.
5192         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5193         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5194         case "$installstyle" in
5195         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5196         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5197         esac
5198         fn=d~+
5199         rp='Pathname for the vendor-supplied library files?'
5200         . ./getfile
5201         vendorlib="$ans"
5202         vendorlibexp="$ansexp"
5203         : Change installation prefix, if necessary.
5204         if $test X"$prefix" != X"$installprefix"; then
5205                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5206         else
5207                 installvendorlib="$vendorlibexp"
5208         fi
5209         ;;
5210 esac
5211
5212 : Cruising for prototypes
5213 echo " "
5214 echo "Checking out function prototypes..." >&4
5215 $cat >prototype.c <<'EOCP'
5216 int main(int argc, char *argv[]) {
5217         exit(0);}
5218 EOCP
5219 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5220         echo "Your C compiler appears to support function prototypes."
5221         val="$define"
5222 else
5223         echo "Your C compiler doesn't seem to understand function prototypes."
5224         val="$undef"
5225 fi
5226 set prototype
5227 eval $setvar
5228 $rm -f prototype*
5229
5230 case "$prototype" in
5231 "$define") ;;
5232 *)      ansi2knr='ansi2knr'
5233         echo " "
5234         cat <<EOM >&4
5235
5236 $me:  FATAL ERROR:
5237 This version of $package can only be compiled by a compiler that 
5238 understands function prototypes.  Unfortunately, your C compiler 
5239         $cc $ccflags
5240 doesn't seem to understand them.  Sorry about that.
5241
5242 If GNU cc is available for your system, perhaps you could try that instead.  
5243
5244 Eventually, we hope to support building Perl with pre-ANSI compilers.
5245 If you would like to help in that effort, please contact <perlbug@perl.org>.
5246
5247 Aborting Configure now.
5248 EOM
5249         exit 2
5250         ;;
5251 esac
5252
5253 : determine where public executables go
5254 echo " "
5255 set dflt bin bin
5256 eval $prefixit
5257 fn=d~
5258 rp='Pathname where the public executables will reside?'
5259 . ./getfile
5260 if $test "X$ansexp" != "X$binexp"; then
5261         installbin=''
5262 fi
5263 bin="$ans"
5264 binexp="$ansexp"
5265 : Change installation prefix, if necessary.
5266 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5267 if $test X"$prefix" != X"$installprefix"; then
5268         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5269 else
5270         installbin="$binexp"
5271 fi
5272
5273 $cat <<EOM
5274
5275 After $package is installed, you may wish to install various
5276 add-on modules and utilities.  Typically, these add-ons will
5277 be installed under $prefix with the rest
5278 of this package.  However, you may wish to install such add-ons
5279 elsewhere under a different prefix.
5280
5281 If you do not wish to put everything under a single prefix, that's
5282 ok.  You will be prompted for the individual locations; this siteprefix
5283 is only used to suggest the defaults.
5284
5285 The default should be fine for most people.
5286
5287 EOM
5288 fn=d~+
5289 rp='Installation prefix to use for add-on modules and utilities?'
5290 : XXX Here might be another good place for an installstyle setting.
5291 case "$siteprefix" in
5292 '') dflt=$prefix ;;
5293 *)  dflt=$siteprefix ;;
5294 esac
5295 . ./getfile
5296 oldsiteprefix=''
5297 case "$siteprefix" in
5298 '') ;;
5299 *)
5300         case "$ans" in
5301         "$prefix") ;;
5302         *) oldsiteprefix="$prefix";;
5303         esac
5304         ;;
5305 esac
5306 siteprefix="$ans"
5307 siteprefixexp="$ansexp"
5308
5309 : determine where site specific libraries go.
5310 : Usual default is /usr/local/lib/perl5/site_perl/$version
5311 : The default "style" setting is made in installstyle.U
5312 : XXX No longer works with Prefixit stuff.
5313 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5314 case "$installstyle" in
5315 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5316 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5317 esac
5318 $cat <<EOM
5319
5320 The installation process will create a directory for
5321 site-specific extensions and modules.  Most users find it convenient
5322 to place all site-specific files in this directory rather than in the
5323 main distribution directory.
5324
5325 EOM
5326 fn=d~+
5327 rp='Pathname for the site-specific library files?'
5328 . ./getfile
5329 sitelib="$ans"
5330 sitelibexp="$ansexp"
5331 : Change installation prefix, if necessary.
5332 if $test X"$prefix" != X"$installprefix"; then
5333         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5334 else
5335         installsitelib="$sitelibexp"
5336 fi
5337
5338 : Determine list of previous versions to include in @INC
5339 $cat > getverlist <<EOPL
5340 #!$perl -w
5341 use File::Basename;
5342 \$api_versionstring = "$api_versionstring";
5343 \$version = "$version";
5344 \$sitelib = "$sitelib";
5345 \$archname = "$archname";
5346 EOPL
5347         $cat >> getverlist <<'EOPL'
5348 # Can't have leading @ because metaconfig interprets it as a command!
5349 ;@inc_version_list=();
5350 $stem=dirname($sitelib);
5351 # Redo to do opendir/readdir? 
5352 if (-d $stem) {
5353     chdir($stem);
5354     ;@candidates = glob("5.*");
5355 }
5356 else {
5357     ;@candidates = ();
5358 }
5359
5360 foreach $d (@candidates) {
5361     if ($d lt $version) {
5362         if ($d ge $api_versionstring) {
5363             unshift(@inc_version_list, "$d/$archname", $d);
5364         }
5365         elsif ($d ge "5.005") {
5366             unshift(@inc_version_list, $d);
5367         }
5368     }
5369     else {
5370         # Skip newer version.  I.e. don't look in
5371         # 5.7.0 if we're installing 5.6.1.
5372     }
5373 }
5374
5375 if (@inc_version_list) {
5376     print '"';
5377     print join('", "', @inc_version_list);
5378     print '"';
5379 }
5380 else {
5381     # Blank space to preserve value for next Configure run.
5382     print " ";
5383 }
5384 EOPL
5385 chmod +x getverlist
5386 case "$inc_version_list" in
5387 '')     if test -x $perl; then
5388                 dflt=`$perl getverlist`
5389         else
5390                 dflt=''
5391         fi
5392         ;;
5393 *)  dflt="$inc_version_list" ;;
5394 esac
5395 $cat <<'EOM'
5396
5397 In order to ease the process of upgrading, this version of perl 
5398 can be configured to use modules built and installed with earlier 
5399 versions of perl that were installed under $prefix.  Specify here
5400 the list of earlier versions that this version of perl should check.
5401 If Configure detected no earlier versions of perl installed under
5402 $prefix, then the list will be empty.
5403
5404 The default should almost always be sensible, so if you're not sure,
5405 just accept the default.
5406 EOM
5407
5408 rp='list of earlier versions to include in @INC?'
5409 . ./myread
5410 inc_version_list="$ans"
5411 $rm -f getverlist
5412
5413 : determine whether to install perl also as /usr/bin/perl
5414
5415 echo " "
5416 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5417         $cat <<EOM
5418 Many scripts expect to perl to be installed as /usr/bin/perl.
5419 I can install the perl you are about to compile also as /usr/bin/perl
5420 (in addition to $installbin/perl).
5421 EOM
5422         case "$installusrbinperl" in
5423         "$undef"|[nN]*) dflt='n';;
5424         *)              dflt='y';;
5425         esac
5426         rp="Do you want to install perl as /usr/bin/perl?"
5427         . ./myread
5428         case "$ans" in
5429         [yY]*)  val="$define";;
5430         *)      val="$undef" ;;
5431         esac
5432 else
5433         val="$undef"
5434 fi
5435 set installusrbinperl
5436 eval $setvar
5437
5438 echo " "
5439 echo "Checking for GNU C Library..." >&4
5440 cat >gnulibc.c <<EOM
5441 #include <stdio.h>
5442 int main()
5443 {
5444 #ifdef __GLIBC__
5445     exit(0);
5446 #else
5447     exit(1);
5448 #endif
5449 }
5450 EOM
5451 set gnulibc
5452 if eval $compile_ok && ./gnulibc; then
5453         val="$define"
5454         echo "You are using the GNU C Library"
5455 else
5456         val="$undef"
5457         echo "You are not using the GNU C Library"
5458 fi
5459 $rm -f gnulibc*
5460 set d_gnulibc
5461 eval $setvar
5462
5463 : see if nm is to be used to determine whether a symbol is defined or not
5464 case "$usenm" in
5465 '')
5466         dflt=''
5467         case "$d_gnulibc" in
5468         "$define")
5469                 echo " "
5470                 echo "nm probably won't work on the GNU C Library." >&4
5471                 dflt=n
5472                 ;;
5473         esac
5474         case "$dflt" in
5475         '') 
5476                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5477                         echo " "
5478                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5479                         echo "'nm' won't be sufficient on this sytem." >&4
5480                         dflt=n
5481                 fi
5482                 ;;
5483         esac
5484         case "$dflt" in
5485         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5486                 if $test $dflt -gt 20; then
5487                         dflt=y
5488                 else
5489                         dflt=n
5490                 fi
5491                 ;;
5492         esac
5493         ;;
5494 *)
5495         case "$usenm" in
5496         true|$define) dflt=y;;
5497         *) dflt=n;;
5498         esac
5499         ;;
5500 esac
5501 $cat <<EOM
5502
5503 I can use $nm to extract the symbols from your C libraries. This
5504 is a time consuming task which may generate huge output on the disk (up
5505 to 3 megabytes) but that should make the symbols extraction faster. The
5506 alternative is to skip the 'nm' extraction part and to compile a small
5507 test program instead to determine whether each symbol is present. If
5508 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5509 this may be the best solution.
5510
5511 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5512
5513 EOM
5514 rp="Shall I use $nm to extract C symbols from the libraries?"
5515 . ./myread
5516 case "$ans" in
5517 [Nn]*) usenm=false;;
5518 *) usenm=true;;
5519 esac
5520
5521 runnm=$usenm
5522 case "$reuseval" in
5523 true) runnm=false;;
5524 esac
5525
5526 : nm options which may be necessary
5527 case "$nm_opt" in
5528 '') if $test -f /mach_boot; then
5529                 nm_opt=''       # Mach
5530         elif $test -d /usr/ccs/lib; then
5531                 nm_opt='-p'     # Solaris (and SunOS?)
5532         elif $test -f /dgux; then
5533                 nm_opt='-p'     # DG-UX
5534         elif $test -f /lib64/rld; then
5535                 nm_opt='-p'     # 64-bit Irix
5536         else
5537                 nm_opt=''
5538         fi;;
5539 esac
5540
5541 : nm options which may be necessary for shared libraries but illegal
5542 : for archive libraries.  Thank you, Linux.
5543 case "$nm_so_opt" in
5544 '')     case "$myuname" in
5545         *linux*)
5546                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5547                         nm_so_opt='--dynamic'
5548                 fi
5549                 ;;
5550         esac
5551         ;;
5552 esac
5553
5554 case "$runnm" in
5555 true)
5556 : get list of predefined functions in a handy place
5557 echo " "
5558 case "$libc" in
5559 '') libc=unknown
5560         case "$libs" in
5561         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5562         esac
5563         ;;
5564 esac
5565 libnames='';
5566 case "$libs" in
5567 '') ;;
5568 *)  for thislib in $libs; do
5569         case "$thislib" in
5570         -lc|-lc_s)
5571                 : Handle C library specially below.
5572                 ;;
5573         -l*)
5574                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5575                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5576                         :
5577                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5578                         :
5579                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5580                         :
5581                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5582                         :
5583                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5584                         :
5585                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5586                         :
5587                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5588                         :
5589                 else
5590                         try=''
5591                 fi
5592                 libnames="$libnames $try"
5593                 ;;
5594         *) libnames="$libnames $thislib" ;;
5595         esac
5596         done
5597         ;;
5598 esac
5599 xxx=normal
5600 case "$libc" in
5601 unknown)
5602         set /lib/libc.$so
5603         for xxx in $libpth; do
5604                 $test -r $1 || set $xxx/libc.$so
5605                 : The messy sed command sorts on library version numbers.
5606                 $test -r $1 || \
5607                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5608                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5609                                 h
5610                                 s/[0-9][0-9]*/0000&/g
5611                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5612                                 G
5613                                 s/\n/ /' | \
5614                          sort | $sed -e 's/^.* //'`
5615                 eval set \$$#
5616         done
5617         $test -r $1 || set /usr/ccs/lib/libc.$so
5618         $test -r $1 || set /lib/libsys_s$_a
5619         ;;
5620 *)
5621         set blurfl
5622         ;;
5623 esac
5624 if $test -r "$1"; then
5625         echo "Your (shared) C library seems to be in $1."
5626         libc="$1"
5627 elif $test -r /lib/libc && $test -r /lib/clib; then
5628         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5629         xxx=apollo
5630         libc='/lib/clib /lib/libc'
5631         if $test -r /lib/syslib; then
5632                 echo "(Your math library is in /lib/syslib.)"
5633                 libc="$libc /lib/syslib"
5634         fi
5635 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5636         echo "Your C library seems to be in $libc, as you said before."
5637 elif $test -r $incpath/usr/lib/libc$_a; then
5638         libc=$incpath/usr/lib/libc$_a;
5639         echo "Your C library seems to be in $libc.  That's fine."
5640 elif $test -r /lib/libc$_a; then
5641         libc=/lib/libc$_a;
5642         echo "Your C library seems to be in $libc.  You're normal."
5643 else
5644         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5645                 :
5646         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5647                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5648         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5649                 :
5650         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5651                 :
5652         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5653                 :
5654         else
5655                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5656         fi
5657         if $test -r "$tans"; then
5658                 echo "Your C library seems to be in $tans, of all places."
5659                 libc=$tans
5660         else
5661                 libc='blurfl'
5662         fi
5663 fi
5664 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5665         dflt="$libc"
5666         cat <<EOM
5667
5668 If the guess above is wrong (which it might be if you're using a strange
5669 compiler, or your machine supports multiple models), you can override it here.
5670
5671 EOM
5672 else
5673         dflt=''
5674         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5675         cat >&4 <<EOM
5676 I can't seem to find your C library.  I've looked in the following places:
5677
5678 EOM
5679         $sed 's/^/      /' libpath
5680         cat <<EOM
5681
5682 None of these seems to contain your C library. I need to get its name...
5683
5684 EOM
5685 fi
5686 fn=f
5687 rp='Where is your C library?'
5688 . ./getfile
5689 libc="$ans"
5690
5691 echo " "
5692 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5693 set X `cat libnames`
5694 shift
5695 xxx=files
5696 case $# in 1) xxx=file; esac
5697 echo "Extracting names from the following $xxx for later perusal:" >&4
5698 echo " "
5699 $sed 's/^/      /' libnames >&4
5700 echo " "
5701 $echo $n "This may take a while...$c" >&4
5702
5703 for file in $*; do
5704         case $file in
5705         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5706         *) $nm $nm_opt $file 2>/dev/null;;
5707         esac
5708 done >libc.tmp
5709
5710 $echo $n ".$c"
5711 $grep fprintf libc.tmp > libc.ptf
5712 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5713 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5714 xxx='[ADTSIW]'
5715 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5720         eval $xscan;\
5721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722                 eval $xrun
5723 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5724         eval $xscan;\
5725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5726                 eval $xrun
5727 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5728         eval $xscan;\
5729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5730                 eval $xrun
5731 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5732         eval $xscan;\
5733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734                 eval $xrun
5735 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5736         eval $xscan;\
5737         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5738                 eval $xrun
5739 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5740                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5741         eval $xscan;\
5742         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743                 eval $xrun
5744 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5745         eval $xscan;\
5746         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747                 eval $xrun
5748 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5749         eval $xscan;\
5750         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751                 eval $xrun
5752 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5753         eval $xscan;\
5754         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755                 eval $xrun
5756 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\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/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5761         eval $xscan;\
5762         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5763                 eval $xrun
5764 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5765         eval $xscan;\
5766         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5767                 eval $xrun
5768 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5769         eval $xscan;\
5770         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5771                 eval $xrun
5772 else
5773         $nm -p $* 2>/dev/null >libc.tmp
5774         $grep fprintf libc.tmp > libc.ptf
5775         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5776                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5777         then
5778                 nm_opt='-p'
5779                 eval $xrun
5780         else
5781                 echo " "
5782                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5783                 com=''
5784                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5785                         for thisname in $libnames $libc; do
5786                                 $ar t $thisname >>libc.tmp
5787                         done
5788                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5789                         echo "Ok." >&4
5790                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5791                         # Repeat libc to extract forwarders to DLL entries too
5792                         for thisname in $libnames $libc; do
5793                                 $ar tv $thisname >>libc.tmp
5794                                 # Revision 50 of EMX has bug in $ar.
5795                                 # it will not extract forwarders to DLL entries
5796                                 # Use emximp which will extract exactly them.
5797                                 emximp -o tmp.imp $thisname \
5798                                     2>/dev/null && \
5799                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5800                                     < tmp.imp >>libc.tmp
5801                                 $rm tmp.imp
5802                         done
5803                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5804                         echo "Ok." >&4
5805                 else
5806                         echo "$ar didn't seem to work right." >&4
5807                         echo "Maybe this is a Cray...trying bld instead..." >&4
5808                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5809                         then
5810                                 for thisname in $libnames; do
5811                                         bld t $libnames | \
5812                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5813                                         $ar t $thisname >>libc.tmp
5814                                 done
5815                                 echo "Ok." >&4
5816                         else
5817                                 echo "That didn't work either.  Giving up." >&4
5818                                 exit 1
5819                         fi
5820                 fi
5821         fi
5822 fi
5823 nm_extract="$com"
5824 if $test -f /lib/syscalls.exp; then
5825         echo " "
5826         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5827         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5828 fi
5829 ;;
5830 esac
5831 $rm -f libnames libpath
5832
5833 : see if dld is available
5834 set dld.h i_dld
5835 eval $inhdr
5836
5837 : is a C symbol defined?
5838 csym='tlook=$1;
5839 case "$3" in
5840 -v) tf=libc.tmp; tc=""; tdc="";;
5841 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5842 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5843 esac;
5844 tx=yes;
5845 case "$reuseval-$4" in
5846 true-) ;;
5847 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5848 esac;
5849 case "$tx" in
5850 yes)
5851         case "$runnm" in
5852         true)
5853                 if $contains $tlook $tf >/dev/null 2>&1;
5854                 then tval=true;
5855                 else tval=false;
5856                 fi;;
5857         *)
5858                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5859                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5860                 then tval=true;
5861                 else tval=false;
5862                 fi;
5863                 $rm -f t t.c;;
5864         esac;;
5865 *)
5866         case "$tval" in
5867         $define) tval=true;;
5868         *) tval=false;;
5869         esac;;
5870 esac;
5871 eval "$2=$tval"'
5872
5873 : define an is-in-libc? function
5874 inlibc='echo " "; td=$define; tu=$undef;
5875 sym=$1; var=$2; eval "was=\$$2";
5876 tx=yes;
5877 case "$reuseval$was" in
5878 true) ;;
5879 true*) tx=no;;
5880 esac;
5881 case "$tx" in
5882 yes)
5883         set $sym tres -f;
5884         eval $csym;
5885         case "$tres" in
5886         true)
5887                 echo "$sym() found." >&4;
5888                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5889         *)
5890                 echo "$sym() NOT found." >&4;
5891                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5892         esac;;
5893 *)
5894         case "$was" in
5895         $define) echo "$sym() found." >&4;;
5896         *) echo "$sym() NOT found." >&4;;
5897         esac;;
5898 esac'
5899
5900 : see if dlopen exists
5901 xxx_runnm="$runnm"
5902 runnm=false
5903 set dlopen d_dlopen
5904 eval $inlibc
5905 runnm="$xxx_runnm"
5906
5907 : determine which dynamic loading, if any, to compile in
5908 echo " "
5909 dldir="ext/DynaLoader"
5910 case "$usedl" in
5911 $define|y|true)
5912         dflt='y'
5913         usedl="$define"
5914         ;;
5915 $undef|n|false)
5916         dflt='n'
5917         usedl="$undef"
5918         ;;
5919 *) 
5920         dflt='n'
5921         case "$d_dlopen" in
5922             $define) dflt='y' ;;
5923         esac
5924         case "$i_dld" in
5925             $define) dflt='y' ;;
5926         esac
5927         : Does a dl_xxx.xs file exist for this operating system
5928         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5929         ;;
5930 esac
5931 rp="Do you wish to use dynamic loading?"
5932 . ./myread
5933 usedl="$ans"
5934 case "$ans" in
5935 y*) usedl="$define"
5936         case "$dlsrc" in
5937         '')
5938                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5939                         dflt="$dldir/dl_${osname}.xs"
5940                 elif $test "$d_dlopen" = "$define" ; then
5941                         dflt="$dldir/dl_dlopen.xs"
5942                 elif $test "$i_dld" = "$define" ; then
5943                         dflt="$dldir/dl_dld.xs"
5944                 else
5945                         dflt=''
5946                 fi
5947                 ;;
5948         *)      dflt="$dldir/$dlsrc"
5949                 ;;
5950         esac
5951     echo "The following dynamic loading files are available:"
5952         : Can not go over to $dldir because getfile has path hard-coded in.
5953         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5954         rp="Source file to use for dynamic loading"
5955         fn="fne"
5956         gfpth="$src"
5957         . ./getfile
5958         usedl="$define"
5959         : emulate basename
5960         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5961
5962         $cat << EOM
5963
5964 Some systems may require passing special flags to $cc -c to
5965 compile modules that will be used to create a shared library.
5966 To use no flags, say "none".
5967
5968 EOM
5969     case "$cccdlflags" in
5970     '') case "$gccversion" in
5971                 '') case "$osname" in
5972                         hpux)   dflt='+z' ;;
5973                         next)   dflt='none' ;;
5974                         irix*)  dflt='-KPIC' ;;
5975                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5976                         sunos)  dflt='-pic' ;;
5977                         *)      dflt='none' ;;
5978                     esac
5979                         ;;
5980                 *)  case "$osname" in
5981                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5982                         *)      dflt='-fpic' ;;
5983                     esac ;;
5984             esac ;;
5985         ' ') dflt='none' ;;
5986     *)  dflt="$cccdlflags" ;;
5987     esac
5988     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5989     . ./myread
5990     case "$ans" in
5991     none) cccdlflags=' ' ;;
5992     *) cccdlflags="$ans" ;;
5993     esac
5994
5995     cat << EOM
5996
5997 Some systems use ld to create libraries that can be dynamically loaded,
5998 while other systems (such as those using ELF) use $cc.
5999
6000 EOM
6001         case "$ld" in
6002         '')     $cat >try.c <<'EOM'
6003 /* Test for whether ELF binaries are produced */
6004 #include <fcntl.h>
6005 #include <stdlib.h>
6006 int main() {
6007         char b[4];
6008         int i = open("a.out",O_RDONLY);
6009         if(i == -1) 
6010                 exit(1); /* fail */
6011         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6012                 exit(0); /* succeed (yes, it's ELF) */
6013         else
6014                 exit(1); /* fail */
6015 }
6016 EOM
6017                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6018                         cat <<EOM
6019 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6020 EOM
6021                         dflt="$cc"
6022                 else
6023                         echo "I'll use ld to build dynamic libraries."
6024                         dflt='ld'
6025                 fi
6026                 rm -f try.c a.out
6027                 ;;
6028         *)      dflt="$ld"
6029                 ;;
6030         esac
6031
6032     rp="What command should be used to create dynamic libraries?"
6033     . ./myread
6034         ld="$ans"
6035
6036     cat << EOM
6037
6038 Some systems may require passing special flags to $ld to create a
6039 library that can be dynamically loaded.  If your ld flags include
6040 -L/other/path options to locate libraries outside your loader's normal
6041 search path, you may need to specify those -L options here as well.  To
6042 use no flags, say "none".
6043
6044 EOM
6045     case "$lddlflags" in
6046     '') case "$osname" in
6047                         beos) dflt='-nostart' ;;
6048                         hpux)  dflt='-b' ;;
6049                         linux|irix*)    dflt='-shared' ;;
6050                         next)  dflt='none' ;;
6051                         solaris) dflt='-G' ;;
6052                         sunos) dflt='-assert nodefinitions' ;;
6053                         svr4*|esix*) dflt="-G $ldflags" ;;
6054                 *)     dflt='none' ;;
6055                         esac
6056                         ;;
6057     *) dflt="$lddlflags" ;;
6058     esac
6059
6060         : Try to guess additional flags to pick up local libraries.
6061         : Be careful not to append to a plain 'none'
6062         case "$dflt" in
6063         none) dflt='' ;;
6064         esac
6065         for thisflag in $ldflags; do
6066                 case "$thisflag" in
6067                 -L*)
6068                         case " $dflt " in
6069                         *" $thisflag "*) ;;
6070                         *) dflt="$dflt $thisflag" ;;
6071                         esac
6072                         ;;
6073                 esac
6074         done
6075
6076         case "$dflt" in
6077         ''|' ') dflt='none' ;;
6078         esac
6079
6080     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6081     . ./myread
6082     case "$ans" in
6083     none) lddlflags=' ' ;;
6084     *) lddlflags="$ans" ;;
6085     esac
6086
6087         cat <<EOM
6088
6089 Some systems may require passing special flags to $cc to indicate that
6090 the resulting executable will use dynamic linking.  To use no flags,
6091 say "none".
6092
6093 EOM
6094     case "$ccdlflags" in
6095     '') case "$osname" in
6096                 hpux)   dflt='-Wl,-E' ;;
6097                 linux)  dflt='-rdynamic' ;;
6098                 next)   dflt='none' ;;
6099                 sunos)  dflt='none' ;;
6100                 *)      dflt='none' ;;
6101             esac ;;
6102     ' ')  dflt='none' ;;
6103     *)  dflt="$ccdlflags" ;;
6104     esac
6105     rp="Any special flags to pass to $cc to use dynamic loading?"
6106     . ./myread
6107     case "$ans" in
6108     none) ccdlflags=' ' ;;
6109     *) ccdlflags="$ans" ;;
6110     esac
6111     ;;
6112 *)  usedl="$undef"
6113         ld='ld'
6114     dlsrc='dl_none.xs'
6115     lddlflags=''
6116     ccdlflags=''
6117     ;;
6118 esac
6119
6120 also=''
6121 case "$usedl" in
6122 $undef)
6123         # No dynamic loading being used, so don't bother even to prompt.
6124         useshrplib='false'
6125         ;;
6126 *)      case "$useshrplib" in
6127         '')     case "$osname" in
6128                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6129                         dflt=y
6130                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6131                         ;;
6132                 next*)
6133                         case "$osvers" in
6134                         4*)     dflt=y
6135                                 also='Building a shared libperl is needed for MAB support.'
6136                                 ;;
6137                         *)      dflt=n
6138                                 ;;
6139                         esac
6140                         ;;
6141                 *)      dflt=n
6142                         ;;
6143                 esac
6144                 ;;
6145         $define|true|[Yy]*)
6146                 dflt=y
6147                 ;;
6148         *)      dflt=n
6149                 ;;
6150         esac
6151         $cat << EOM
6152
6153 The perl executable is normally obtained by linking perlmain.c with
6154 libperl${_a}, any static extensions (usually just DynaLoader), and
6155 any other libraries needed on this system (such as -lm, etc.).  Since
6156 your system supports dynamic loading, it is probably possible to build
6157 a shared libperl.$so.  If you will have more than one executable linked
6158 to libperl.$so, this will significantly reduce the size of each
6159 executable, but it may have a noticeable affect on performance.  The
6160 default is probably sensible for your system.
6161 $also
6162
6163 EOM
6164         rp="Build a shared libperl.$so (y/n)"
6165         . ./myread
6166         case "$ans" in
6167         true|$define|[Yy]*)
6168                 useshrplib='true'  ;;
6169         *)      useshrplib='false' ;;
6170         esac
6171         ;;
6172 esac
6173
6174 case "$useshrplib" in
6175 true)
6176         case "$libperl" in
6177         '')
6178                 # Figure out a good name for libperl.so.  Since it gets stored in
6179                 # a version-specific architecture-dependent library, the version
6180                 # number isn't really that important, except for making cc/ld happy.
6181                 #
6182                 # A name such as libperl.so.3.1
6183                 majmin="libperl.$so.$patchlevel.$subversion"
6184                 # A name such as libperl.so.301
6185                 majonly=`echo $patchlevel $subversion |
6186                         $awk '{printf "%d%02d", $1, $2}'`
6187                 majonly=libperl.$so.$majonly
6188                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6189                 # rely on figuring it out from the naming of libc.
6190                 case "${osname}${osvers}" in
6191                 next4*)
6192                         dflt=libperl.5.$so
6193                         # XXX How handle the --version stuff for MAB?
6194                         ;;
6195                 linux*)  # ld won't link with a bare -lperl otherwise.
6196                         dflt=libperl.$so
6197                         ;;
6198                 cygwin*) # include version
6199                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6200                         ;;
6201                 *)      # Try to guess based on whether libc has major.minor.
6202                         case "$libc" in
6203                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6204                         *libc.$so.[0-9]*) dflt=$majonly ;;
6205                         *)      dflt=libperl.$so ;;
6206                         esac
6207                         ;;
6208                 esac
6209                 ;;
6210         *)      dflt=$libperl
6211                 ;;
6212         esac
6213         cat << EOM
6214
6215 I need to select a good name for the shared libperl.  If your system uses
6216 library names with major and minor numbers, then you might want something
6217 like $majmin.  Alternatively, if your system uses a single version
6218 number for shared libraries, then you might want to use $majonly.
6219 Or, your system might be quite happy with a simple libperl.$so.
6220
6221 Since the shared libperl will get installed into a version-specific
6222 architecture-dependent directory, the version number of the shared perl
6223 library probably isn't important, so the default should be o.k.
6224
6225 EOM
6226         rp='What name do you want to give to the shared libperl?'
6227         . ./myread
6228         libperl=$ans
6229         echo "Ok, I'll use $libperl"
6230         ;;
6231 *)
6232         libperl="libperl${_a}"
6233         ;;
6234 esac
6235
6236 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6237 case "$shrpdir" in
6238 '') ;;
6239 *)      $cat >&4 <<EOM
6240 WARNING:  Use of the shrpdir variable for the installation location of
6241 the shared $libperl is not supported.  It was never documented and
6242 will not work in this version.  Let me (perlbug@perl.com)
6243 know of any problems this may cause.
6244
6245 EOM
6246         case "$shrpdir" in
6247         "$archlibexp/CORE")
6248                 $cat >&4 <<EOM
6249 But your current setting of $shrpdir is
6250 the default anyway, so it's harmless.
6251 EOM
6252                 ;;
6253         *)
6254                 $cat >&4 <<EOM
6255 Further, your current attempted setting of $shrpdir
6256 conflicts with the value of $archlibexp/CORE
6257 that installperl will use.
6258 EOM
6259                 ;;
6260         esac
6261         ;;
6262 esac
6263
6264 # How will the perl executable find the installed shared $libperl?
6265 # Add $xxx to ccdlflags.
6266 # If we can't figure out a command-line option, use $shrpenv to
6267 # set env LD_RUN_PATH.  The main perl makefile uses this.
6268 shrpdir=$archlibexp/CORE
6269 xxx=''
6270 tmp_shrpenv=''
6271 if "$useshrplib"; then
6272     case "$osname" in 
6273         aix)
6274                 # We'll set it in Makefile.SH...
6275                 ;;
6276         solaris|netbsd)
6277                 xxx="-R $shrpdir"
6278                 ;;
6279         freebsd)
6280                 xxx="-Wl,-R$shrpdir"
6281                 ;;
6282         linux|irix*|dec_osf)
6283                 xxx="-Wl,-rpath,$shrpdir"
6284                 ;;
6285         next)
6286                 # next doesn't like the default...
6287                 ;;
6288         beos)
6289                 # beos doesn't like the default, either.
6290                 ;;
6291         hpux*)
6292                 # hpux doesn't like the default, either.
6293                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6294                 ;;
6295         *)
6296                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6297                 ;;
6298         esac
6299         case "$xxx" in
6300         '') ;;
6301         *)      
6302                 # Only add $xxx if it isn't already in ccdlflags.
6303                 case " $ccdlflags " in
6304                 *" $xxx "*)     ;;
6305                 *)      ccdlflags="$ccdlflags $xxx"
6306                         cat <<EOM >&4
6307
6308 Adding $xxx to the flags
6309 passed to $ld so that the perl executable will find the 
6310 installed shared $libperl.
6311
6312 EOM
6313                         ;;
6314                 esac
6315                 ;;
6316         esac
6317 fi
6318 # Fix ccdlflags in AIX for building external extensions.
6319 # (For building Perl itself bare -bE:perl.exp is needed,
6320 #  Makefile.SH takes care of this.)
6321 case "$osname" in
6322 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6323 esac
6324 # Respect a hint or command-line value.
6325 case "$shrpenv" in
6326 '') shrpenv="$tmp_shrpenv" ;;
6327 esac
6328 case "$ldlibpthname" in
6329 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6330 none)   ldlibpthname='' ;;
6331 esac
6332
6333 : determine where manual pages go
6334 set man1dir man1dir none
6335 eval $prefixit
6336 $cat <<EOM
6337
6338 $spackage has manual pages available in source form.
6339 EOM
6340 case "$nroff" in
6341 nroff)
6342         echo "However, you don't have nroff, so they're probably useless to you."
6343         case "$man1dir" in
6344         '') man1dir="none";;
6345         esac;;
6346 esac
6347 echo "If you don't want the manual sources installed, answer 'none'."
6348 case "$man1dir" in
6349 ' ') dflt=none
6350         ;;
6351 '')
6352         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6353         lookpath="$lookpath $prefixexp/man/p_man/man1"
6354         lookpath="$lookpath $prefixexp/man/u_man/man1"
6355         lookpath="$lookpath $prefixexp/man/man.1"
6356         case "$sysman" in
6357         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6358         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6359         esac
6360         set dflt
6361         eval $prefixup
6362         ;;
6363 *)  dflt="$man1dir"
6364         ;;
6365 esac
6366 echo " "
6367 fn=dn+~
6368 rp="Where do the main $spackage manual pages (source) go?"
6369 . ./getfile
6370 if $test "X$man1direxp" != "X$ansexp"; then
6371         installman1dir=''
6372 fi
6373 man1dir="$ans"
6374 man1direxp="$ansexp"
6375 case "$man1dir" in
6376 '')     man1dir=' '
6377         installman1dir='';;
6378 esac
6379
6380 : Change installation prefix, if necessary.
6381 if $test X"$prefix" != X"$installprefix"; then
6382         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6383 else
6384         installman1dir="$man1direxp"
6385 fi
6386
6387 : What suffix to use on installed man pages
6388
6389 case "$man1dir" in
6390 ' ')
6391         man1ext='0'
6392         ;;
6393 *)
6394         rp="What suffix should be used for the main $spackage man pages?"
6395         case "$man1ext" in
6396         '')     case "$man1dir" in
6397                 *1)  dflt=1 ;;
6398                 *1p) dflt=1p ;;
6399                 *1pm) dflt=1pm ;;
6400                 *l) dflt=l;;
6401                 *n) dflt=n;;
6402                 *o) dflt=o;;
6403                 *p) dflt=p;;
6404                 *C) dflt=C;;
6405                 *L) dflt=L;;
6406                 *L1) dflt=L1;;
6407                 *) dflt=1;;
6408                 esac
6409                 ;;
6410         *)      dflt="$man1ext";;
6411         esac
6412         . ./myread
6413         man1ext="$ans"
6414         ;;
6415 esac
6416
6417 : see if we can have long filenames
6418 echo " "
6419 rmlist="$rmlist /tmp/cf$$"
6420 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6421 first=123456789abcdef
6422 second=/tmp/cf$$/$first
6423 $rm -f $first $second
6424 if (echo hi >$first) 2>/dev/null; then
6425         if $test -f 123456789abcde; then
6426                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6427                 val="$undef"
6428         else
6429                 if (echo hi >$second) 2>/dev/null; then
6430                         if $test -f /tmp/cf$$/123456789abcde; then
6431                                 $cat <<'EOM'
6432 That's peculiar... You can have filenames longer than 14 characters, but only
6433 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6434 I shall consider your system cannot support long filenames at all.
6435 EOM
6436                                 val="$undef"
6437                         else
6438                                 echo 'You can have filenames longer than 14 characters.' >&4
6439                                 val="$define"
6440                         fi
6441                 else
6442                         $cat <<'EOM'
6443 How confusing! Some of your filesystems are sane enough to allow filenames
6444 longer than 14 characters but some others like /tmp can't even think about them.
6445 So, for now on, I shall assume your kernel does not allow them at all.
6446 EOM
6447                         val="$undef"
6448                 fi
6449         fi
6450 else
6451         $cat <<'EOM'
6452 You can't have filenames longer than 14 chars.  You can't even think about them!
6453 EOM
6454         val="$undef"
6455 fi 
6456 set d_flexfnam
6457 eval $setvar
6458 $rm -rf /tmp/cf$$ 123456789abcde*
6459
6460 : determine where library module manual pages go
6461 set man3dir man3dir none
6462 eval $prefixit
6463 $cat <<EOM
6464
6465 $spackage has manual pages for many of the library modules.
6466 EOM
6467
6468 case "$nroff" in
6469 nroff)
6470         $cat <<'EOM'
6471 However, you don't have nroff, so they're probably useless to you.
6472 EOM
6473         case "$man3dir" in
6474         '') man3dir="none";;
6475         esac;;
6476 esac
6477
6478 case "$d_flexfnam" in
6479 undef)
6480         $cat <<'EOM'
6481 However, your system can't handle the long file names like File::Basename.3. 
6482 EOM
6483         case "$man3dir" in
6484         '') man3dir="none";;
6485         esac;;
6486 esac
6487
6488 echo "If you don't want the manual sources installed, answer 'none'."
6489 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6490 case "$man3dir" in
6491 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6492         if $test -d "$privlib/man/man3"; then
6493                 cat <<EOM >&4
6494
6495 WARNING:  Previous versions of perl installed man3 pages into
6496 $privlib/man/man3.  This version will suggest a 
6497 new default of $dflt.  
6498 EOM
6499                 tdflt=$dflt
6500                 dflt='n'
6501                 rp='Do you wish to preserve the old behavior?(y/n)'
6502                 . ./myread
6503                 case "$ans" in
6504                 y*) dflt="$privlib/man/man3" ;;
6505                 *)  dflt=$tdflt ;;
6506                 esac
6507     fi
6508         ;;
6509 ' ') dflt=none;;
6510 *)      dflt="$man3dir" ;;
6511 esac
6512 echo " "
6513 fn=dn+~
6514 rp="Where do the $package library man pages (source) go?"
6515 . ./getfile
6516 man3dir="$ans"
6517 man3direxp="$ansexp"
6518 case "$man1dir" in
6519 '')     man3dir=' '
6520         installman3dir='';;
6521 esac
6522
6523 : Change installation prefix, if necessary.
6524 if $test X"$prefix" != X"$installprefix"; then
6525         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6526 else
6527         installman3dir="$man3direxp"
6528 fi
6529
6530 : What suffix to use on installed man pages
6531 case "$man3dir" in
6532 ' ')
6533         man3ext='0'
6534         ;;
6535 *)
6536         rp="What suffix should be used for the $package library man pages?"
6537         case "$man3ext" in
6538         '')     case "$man3dir" in
6539                 *3)  dflt=3 ;;
6540                 *3p) dflt=3p ;;
6541                 *3pm) dflt=3pm ;;
6542                 *l) dflt=l;;
6543                 *n) dflt=n;;
6544                 *o) dflt=o;;
6545                 *p) dflt=p;;
6546                 *C) dflt=C;;
6547                 *L) dflt=L;;
6548                 *L3) dflt=L3;;
6549                 *) dflt=3;;
6550                 esac
6551                 ;;
6552         *)      dflt="$man3ext";;
6553         esac
6554         . ./myread
6555         man3ext="$ans"
6556         ;;
6557 esac
6558
6559 : see if we have to deal with yellow pages, now NIS.
6560 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6561         if $test -f /usr/etc/nibindd; then
6562                 echo " "
6563                 echo "I'm fairly confident you're on a NeXT."
6564                 echo " "
6565                 rp='Do you get the hosts file via NetInfo?'
6566                 dflt=y
6567                 case "$hostcat" in
6568                 nidump*) ;;
6569                 '') ;;
6570                 *) dflt=n;;
6571                 esac
6572                 . ./myread
6573                 case "$ans" in
6574                 y*) hostcat='nidump hosts .';;
6575                 *)      case "$hostcat" in
6576                         nidump*) hostcat='';;
6577                         esac
6578                         ;;
6579                 esac
6580         fi
6581         case "$hostcat" in
6582         nidump*) ;;
6583         *)
6584                 case "$hostcat" in
6585                 *ypcat*) dflt=y;;
6586                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6587                                 dflt=y
6588                         else
6589                                 dflt=n
6590                         fi;;
6591                 *) dflt=n;;
6592                 esac
6593                 echo " "
6594                 rp='Are you getting the hosts file via yellow pages?'
6595                 . ./myread
6596                 case "$ans" in
6597                 y*) hostcat='ypcat hosts';;
6598                 *) hostcat='cat /etc/hosts';;
6599                 esac
6600                 ;;
6601         esac
6602 fi
6603 case "$hostcat" in
6604 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6605 esac
6606 case "$groupcat" in
6607 '') test -f /etc/group && groupcat='cat /etc/group';;
6608 esac
6609 case "$passcat" in
6610 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6611 esac
6612
6613 : now get the host name
6614 echo " "
6615 echo "Figuring out host name..." >&4
6616 case "$myhostname" in
6617 '') cont=true
6618         echo 'Maybe "hostname" will work...'
6619         if tans=`sh -c hostname 2>&1` ; then
6620                 myhostname=$tans
6621                 phostname=hostname
6622                 cont=''
6623         fi
6624         ;;
6625 *) cont='';;
6626 esac
6627 if $test "$cont"; then
6628         if ./xenix; then
6629                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6630                 if tans=`cat /etc/systemid 2>&1` ; then
6631                         myhostname=$tans
6632                         phostname='cat /etc/systemid'
6633                         echo "Whadyaknow.  Xenix always was a bit strange..."
6634                         cont=''
6635                 fi
6636         elif $test -r /etc/systemid; then
6637                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6638         fi
6639 fi
6640 if $test "$cont"; then
6641         echo 'No, maybe "uuname -l" will work...'
6642         if tans=`sh -c 'uuname -l' 2>&1` ; then
6643                 myhostname=$tans
6644                 phostname='uuname -l'
6645         else
6646                 echo 'Strange.  Maybe "uname -n" will work...'
6647                 if tans=`sh -c 'uname -n' 2>&1` ; then
6648                         myhostname=$tans
6649                         phostname='uname -n'
6650                 else
6651                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6652                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6653                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6654                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6655                         else
6656                                 case "$myhostname" in
6657                                 '') echo "Does this machine have an identity crisis or something?"
6658                                         phostname='';;
6659                                 *)
6660                                         echo "Well, you said $myhostname before..."
6661                                         phostname='echo $myhostname';;
6662                                 esac
6663                         fi
6664                 fi
6665         fi
6666 fi
6667 : you do not want to know about this
6668 set $myhostname
6669 myhostname=$1
6670
6671 : verify guess
6672 if $test "$myhostname" ; then
6673         dflt=y
6674         rp='Your host name appears to be "'$myhostname'".'" Right?"
6675         . ./myread
6676         case "$ans" in
6677         y*) ;;
6678         *) myhostname='';;
6679         esac
6680 fi
6681
6682 : bad guess or no guess
6683 while $test "X$myhostname" = X ; do
6684         dflt=''
6685         rp="Please type the (one word) name of your host:"
6686         . ./myread
6687         myhostname="$ans"
6688 done
6689
6690 : translate upper to lower if necessary
6691 case "$myhostname" in
6692 *[A-Z]*)
6693         echo "(Normalizing case in your host name)"
6694         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6695         ;;
6696 esac
6697
6698 case "$myhostname" in
6699 *.*)
6700         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6701         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6702         echo "(Trimming domain name from host name--host name is now $myhostname)"
6703         ;;
6704 *) case "$mydomain" in
6705         '')
6706                 {
6707                         test "X$hostcat" = "Xypcat hosts" &&
6708                         ypmatch "$myhostname" hosts 2>/dev/null |\
6709                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6710                         $test -s hosts
6711                 } || {
6712                         test "X$hostcat" != "X" &&
6713                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6714                                         /[       ]$myhostname[  . ]/p" > hosts
6715                 }
6716                 tmp_re="[       . ]"
6717                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6718                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6719                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6720                         hosts | $sort | $uniq | \
6721                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6722                 case `$echo X$dflt` in
6723                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6724                         dflt=.
6725                         ;;
6726                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6727                         ;;
6728                 esac
6729                 case "$dflt" in
6730                 .)
6731                         tans=`./loc resolv.conf X /etc /usr/etc`
6732                         if $test -f "$tans"; then
6733                                 echo "(Attempting domain name extraction from $tans)"
6734                                 dflt=.`$sed -n -e 's/   / /g' \
6735                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6736                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6737                                 case "$dflt" in
6738                                 .) dflt=.`$sed -n -e 's/        / /g' \
6739                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6740                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6741                                         ;;
6742                                 esac
6743                         fi
6744                         ;;
6745                 esac
6746                 case "$dflt" in
6747                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6748                         dflt=.`sh -c domainname 2>/dev/null`
6749                         case "$dflt" in
6750                         '') dflt='.';;
6751                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6752                         esac
6753                         ;;
6754                 esac
6755                 case "$dflt" in
6756                 .) echo "(Lost all hope -- silly guess then)"
6757                         dflt='.uucp'
6758                         ;;
6759                 esac
6760                 $rm -f hosts
6761                 ;;
6762         *) dflt="$mydomain";;
6763         esac;;
6764 esac
6765 echo " "
6766 rp="What is your domain name?"
6767 . ./myread
6768 tans="$ans"
6769 case "$ans" in
6770 '') ;;
6771 .*) ;;
6772 *) tans=".$tans";;
6773 esac
6774 mydomain="$tans"
6775
6776 : translate upper to lower if necessary
6777 case "$mydomain" in
6778 *[A-Z]*)
6779         echo "(Normalizing case in your domain name)"
6780         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6781         ;;
6782 esac
6783
6784 : a little sanity check here
6785 case "$phostname" in
6786 '') ;;
6787 *)
6788         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6789         $myhostname$mydomain|$myhostname) ;;
6790         *)
6791                 case "$phostname" in
6792                 sed*)
6793                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6794                         ;;
6795                 *)
6796                         echo "(That doesn't agree with your $phostname command, by the way.)"
6797                         ;;
6798                 esac
6799         ;;
6800         esac
6801         ;;
6802 esac
6803
6804 $cat <<EOM
6805
6806 I need to get your e-mail address in Internet format if possible, i.e.
6807 something like user@host.domain. Please answer accurately since I have
6808 no easy means to double check it. The default value provided below
6809 is most probably close to the reality but may not be valid from outside
6810 your organization...
6811
6812 EOM
6813 cont=x
6814 while test "$cont"; do
6815         case "$cf_email" in
6816         '') dflt="$cf_by@$myhostname$mydomain";;
6817         *) dflt="$cf_email";;
6818         esac
6819         rp='What is your e-mail address?'
6820         . ./myread
6821         cf_email="$ans"
6822         case "$cf_email" in
6823         *@*.*) cont='' ;;
6824         *)
6825                 rp='Address does not look like an Internet one.  Use it anyway?'
6826                 case "$fastread" in
6827                 yes) dflt=y ;;
6828                 *) dflt=n ;;
6829                 esac
6830                 . ./myread
6831                 case "$ans" in
6832                 y*) cont='' ;;
6833                 *) echo " " ;;
6834                 esac
6835                 ;;
6836         esac
6837 done
6838
6839 $cat <<EOM
6840
6841 If you or somebody else will be maintaining perl at your site, please
6842 fill in the correct e-mail address here so that they may be contacted
6843 if necessary. Currently, the "perlbug" program included with perl
6844 will send mail to this address in addition to perlbug@perl.com. You may
6845 enter "none" for no administrator.
6846
6847 EOM
6848 case "$perladmin" in
6849 '') dflt="$cf_email";;
6850 *) dflt="$perladmin";;
6851 esac
6852 rp='Perl administrator e-mail address'
6853 . ./myread
6854 perladmin="$ans"
6855
6856 : figure out how to guarantee perl startup
6857 case "$startperl" in
6858 '')
6859         case "$sharpbang" in
6860         *!)
6861                 $cat <<EOH
6862
6863 I can use the #! construct to start perl on your system. This will
6864 make startup of perl scripts faster, but may cause problems if you
6865 want to share those scripts and perl is not in a standard place
6866 ($binexp/perl) on all your platforms. The alternative is to force
6867 a shell by starting the script with a single ':' character.
6868
6869 EOH
6870                 dflt="$binexp/perl"
6871                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6872                 . ./myread
6873                 case "$ans" in
6874                 none)   startperl=": # use perl";;
6875                 *)      startperl="#!$ans"
6876                         if $test 30 -lt `echo "$ans" | wc -c`; then
6877                                 $cat >&4 <<EOM
6878
6879 WARNING:  Some systems limit the #! command to 32 characters.
6880 If you experience difficulty running Perl scripts with #!, try
6881 installing Perl in a directory with a shorter pathname.
6882
6883 EOM
6884                         fi ;;
6885                 esac
6886                 ;;
6887         *) startperl=": # use perl"
6888                 ;;
6889         esac
6890         ;;
6891 esac
6892 echo "I'll use $startperl to start perl scripts."
6893
6894 : figure best path for perl in scripts
6895 case "$perlpath" in
6896 '')
6897         perlpath="$binexp/perl"
6898         case "$startperl" in
6899         *!*) ;;
6900         *)
6901                 $cat <<EOH
6902
6903 I will use the "eval 'exec'" idiom to start Perl on your system.
6904 I can use the full path of your Perl binary for this purpose, but
6905 doing so may cause problems if you want to share those scripts and
6906 Perl is not always in a standard place ($binexp/perl).
6907
6908 EOH
6909                 dflt="$binexp/perl"
6910                 rp="What path shall I use in \"eval 'exec'\"?"
6911                 . ./myread
6912                 perlpath="$ans"
6913                 ;;
6914         esac
6915         ;;
6916 esac
6917 case "$startperl" in
6918 *!*)    ;;
6919 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6920 esac
6921
6922 : determine where public executable scripts go
6923 set scriptdir scriptdir
6924 eval $prefixit
6925 case "$scriptdir" in
6926 '')
6927         dflt="$bin"
6928         : guess some guesses
6929         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6930         $test -d /usr/share/bin     && dflt=/usr/share/bin
6931         $test -d /usr/local/script  && dflt=/usr/local/script
6932         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6933         $test -d $prefixexp/script  && dflt=$prefixexp/script
6934         set dflt
6935         eval $prefixup
6936         ;;
6937 *)  dflt="$scriptdir"
6938         ;;
6939 esac
6940 $cat <<EOM
6941  
6942 Some installations have a separate directory just for executable scripts so
6943 that they can mount it across multiple architectures but keep the scripts in
6944 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6945 Or you might just lump your scripts in with all your other executables.
6946  
6947 EOM
6948 fn=d~
6949 rp='Where do you keep publicly executable scripts?'
6950 . ./getfile
6951 if $test "X$ansexp" != "X$scriptdirexp"; then
6952         installscript=''
6953 fi
6954 scriptdir="$ans"
6955 scriptdirexp="$ansexp"
6956 : Change installation prefix, if necessary.
6957 if $test X"$prefix" != X"$installprefix"; then
6958         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6959 else
6960         installscript="$scriptdirexp"
6961 fi
6962
6963 : determine where site specific architecture-dependent libraries go.
6964 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6965 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6966 : sitelib may have an optional trailing /share.
6967 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6968 tdflt="$tdflt/$archname"
6969 set sitearch sitearch none
6970 eval $prefixit
6971 case "$sitearch" in
6972 '')     dflt="$tdflt" ;;
6973 *)      dflt="$sitearch" ;;
6974 esac
6975 $cat <<EOM
6976
6977 The installation process will also create a directory for
6978 architecture-dependent site-specific extensions and modules.
6979
6980 EOM
6981 fn=nd~+
6982 rp='Pathname for the site-specific architecture-dependent library files?'
6983 . ./getfile
6984 sitearch="$ans"
6985 sitearchexp="$ansexp"
6986 : Change installation prefix, if necessary.
6987 if $test X"$prefix" != X"$installprefix"; then
6988         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6989 else
6990         installsitearch="$sitearchexp"
6991 fi
6992
6993 : determine where add-on public executables go
6994 case "$sitebin" in
6995 '')     dflt=$siteprefix/bin ;;
6996 *)      dflt=$sitebin ;;
6997 esac
6998 fn=d~
6999 rp='Pathname where the add-on public executables should be installed?'
7000 . ./getfile
7001 sitebin="$ans"
7002 sitebinexp="$ansexp"
7003 : Change installation prefix, if necessary.
7004 if $test X"$prefix" != X"$installprefix"; then
7005         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7006 else
7007         installsitebin="$sitebinexp"
7008 fi
7009
7010 cat <<EOM
7011
7012 Perl can be built to take advantage of long doubles which
7013 (if available) may give more accuracy and range for floating point numbers.
7014
7015 If this doesn't make any sense to you, just accept the default 'n'.
7016 EOM
7017
7018 case "$ccflags" in
7019 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7020 esac
7021
7022 case "$uselongdouble" in
7023 $define|true|[yY]*)     dflt='y';;
7024 *) dflt='n';;
7025 esac
7026 rp='Try to use long doubles if available?'
7027 . ./myread
7028 case "$ans" in
7029 y|Y)    val="$define"   ;;
7030 *)      val="$undef"    ;;
7031 esac
7032 set uselongdouble
7033 eval $setvar
7034
7035 case "$uselongdouble" in
7036 true|[yY]*) uselongdouble="$define" ;;
7037 esac
7038
7039 case "$uselongdouble" in
7040 $define)
7041 : Look for a hint-file generated 'call-back-unit'.  If the
7042 : user has specified that long doubles should be used,
7043 : we may need to set or change some other defaults.
7044         if $test -f uselongdouble.cbu; then
7045                 echo "Your platform has some specific hints for long doubles, using them..."
7046                 . ./uselongdouble.cbu
7047         else
7048                 $cat <<EOM
7049 (Your platform doesn't have any specific hints for long doubles.)
7050 EOM
7051         fi
7052         ;;
7053 esac
7054
7055 cat <<EOM
7056
7057 Perl can be built to take advantage of long longs which
7058 (if available) may give more range for integer numbers.
7059
7060 If this doesn't make any sense to you, just accept the default 'n'.
7061 EOM
7062
7063 case "$ccflags" in
7064 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7065 esac
7066
7067 case "$uselonglong" in
7068 $define|true|[yY]*)     dflt='y';;
7069 *) dflt='n';;
7070 esac
7071 rp='Try to use long longs if available?'
7072 . ./myread
7073 case "$ans" in
7074 y|Y)    val="$define"   ;;
7075 *)      val="$undef"    ;;
7076 esac
7077 set uselonglong
7078 eval $setvar
7079
7080 case "$uselonglong" in
7081 true|[yY]*) uselonglong="$define" ;;
7082 esac
7083
7084 case "$uselonglong" in
7085 $define)
7086 : Look for a hint-file generated 'call-back-unit'.  If the
7087 : user has specified that long longs should be used,
7088 : we may need to set or change some other defaults.
7089         if $test -f uselonglong.cbu; then
7090                 echo "Your platform has some specific hints for long longs, using them..."
7091                 . ./uselonglong.cbu
7092         else
7093                 $cat <<EOM
7094 (Your platform doesn't have any specific hints for long longs.)
7095 EOM
7096         fi
7097         ;;
7098 esac
7099
7100 cat <<EOM
7101
7102 Previous version of $package used the standard IO mechanisms as defined
7103 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7104 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7105 the default.  This abstraction layer can use AT&T's sfio (if you already
7106 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7107 problems with some extension modules.  Using PerlIO with stdio is safe,
7108 but it is slower than plain stdio and therefore is not the default.
7109
7110 If this doesn't make any sense to you, just accept the default 'n'.
7111 EOM
7112 case "$useperlio" in
7113 $define|true|[yY]*)     dflt='y';;
7114 *) dflt='n';;
7115 esac
7116 rp='Use the experimental PerlIO abstraction layer?'
7117 . ./myread
7118 case "$ans" in
7119 y|Y) 
7120         val="$define"
7121         ;;     
7122 *)      
7123         echo "Ok, doing things the stdio way"
7124         val="$undef"
7125         ;;
7126 esac
7127 set useperlio
7128 eval $setvar 
7129
7130 case "$vendorprefix" in
7131 '')     d_vendorbin="$undef"
7132         vendorbin=''
7133         vendorbinexp=''
7134         ;;
7135 *)      d_vendorbin="$define"
7136         : determine where vendor-supplied executables go.
7137         dflt=$vendorprefix/bin
7138         fn=d~+
7139         rp='Pathname for the vendor-supplied executables directory?'
7140         . ./getfile
7141         vendorbin="$ans"
7142         vendorbinexp="$ansexp"
7143         : Change installation prefix, if necessary.
7144         if $test X"$prefix" != X"$installprefix"; then
7145                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7146         else
7147                 installvendorbin="$vendorbinexp"
7148         fi
7149         ;;
7150 esac
7151
7152 : check for length of double
7153 echo " "
7154 case "$doublesize" in
7155 '')
7156         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7157         $cat >try.c <<'EOCP'
7158 #include <stdio.h>
7159 int main()
7160 {
7161     printf("%d\n", (int)sizeof(double));
7162     exit(0);
7163 }
7164 EOCP
7165         set try
7166         if eval $compile_ok; then
7167                 doublesize=`./try`
7168                 $echo " $doublesize bytes." >&4
7169         else
7170                 dflt='8'
7171                 echo "(I can't seem to compile the test program.  Guessing...)"
7172                 rp="What is the size of a double precision number (in bytes)?"
7173                 . ./myread
7174                 doublesize="$ans"
7175         fi
7176         ;;
7177 esac
7178 $rm -f try.c try
7179
7180 : check for long doubles
7181 echo " "
7182 $echo $n "Checking to see if your system supports long double..." $c >&4
7183 echo 'int main() { long double x = 7.0; }' > try.c
7184 set try
7185 if eval $compile; then
7186         val="$define"
7187         echo " Yes, it does." >&4
7188 else
7189         val="$undef"
7190         echo " No, it doesn't." >&4
7191 fi
7192 $rm try.*
7193 set d_longdbl
7194 eval $setvar
7195
7196 : check for length of long double
7197 case "${d_longdbl}${longdblsize}" in
7198 $define)
7199         echo " "
7200         $echo $n "Checking to see how big your long doubles are..." $c >&4
7201         $cat >try.c <<'EOCP'
7202 #include <stdio.h>
7203 int main()
7204 {
7205         printf("%d\n", sizeof(long double));
7206 }
7207 EOCP
7208         set try
7209         set try
7210         if eval $compile; then
7211                 longdblsize=`./try$exe_ext`
7212                 $echo " $longdblsize bytes." >&4
7213         else
7214                 dflt='8'
7215                 echo " "
7216                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7217                 rp="What is the size of a long double (in bytes)?"
7218                 . ./myread
7219                 longdblsize="$ans"
7220         fi
7221         if $test "X$doublesize" = "X$longdblsize"; then
7222                 echo "(That isn't any different from an ordinary double.)"
7223         fi      
7224         ;;
7225 esac
7226 $rm -f try.* try
7227
7228 : Check how to convert floats to strings.
7229 if test "X$d_Gconvert" = X; then
7230         echo " "
7231         echo "Checking for an efficient way to convert floats to strings."
7232         $cat >try.c <<EOP
7233 #ifdef TRY_gconvert
7234 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7235 char *myname = "gconvert";
7236 #endif
7237 #ifdef TRY_gcvt
7238 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7239 char *myname = "gcvt";
7240 #endif
7241 #ifdef TRY_qgcvt
7242 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7243 char *myname = "qgcvt";
7244 #define DOUBLETYPE long double
7245 #endif
7246 #ifdef TRY_sprintf
7247 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7248 char *myname = "sprintf";
7249 #endif
7250
7251 #ifndef DOUBLETYPE
7252 #define DOUBLETYPE double
7253 #endif
7254
7255 #include <stdio.h>
7256
7257 #ifdef I_STDLIB
7258 #include <stdlib.h>
7259 #endif
7260
7261 int
7262 checkit(expect, got)
7263 char *expect;
7264 char *got;
7265 {
7266     if (strcmp(expect, got)) {
7267                 printf("%s oddity:  Expected %s, got %s\n",
7268                         myname, expect, got);
7269                 exit(1);
7270         }
7271 }
7272
7273 int main()
7274
7275         char buf[64]; 
7276         buf[63] = '\0';
7277
7278         /* This must be 1st test on (which?) platform */
7279         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7280         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7281         checkit("0.1", buf);
7282
7283         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7284         checkit("1", buf);
7285
7286         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7287         checkit("0", buf);
7288
7289         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7290         checkit("-1", 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         /* Some Linux gcvt's give -1.e+5 here. */
7297         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7298         checkit("-100000", buf);
7299
7300         exit(0);
7301 }
7302 EOP
7303         case "$d_Gconvert" in
7304         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7305         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7306         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7307         *) xxx_list='gconvert gcvt sprintf' ;;
7308         esac
7309
7310         case "$d_longdbl$uselongdouble" in
7311         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7312         esac
7313
7314         for xxx_convert in $xxx_list; do
7315                 echo "Trying $xxx_convert..."
7316                 $rm -f try try$_o
7317                 set try -DTRY_$xxx_convert
7318                 if eval $compile; then
7319                         echo "$xxx_convert() found." >&4
7320                         if ./try; then
7321                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7322                                 break;
7323                         else
7324                                 echo "...But $xxx_convert didn't work as I expected."
7325                         fi
7326                 else
7327                         echo "$xxx_convert NOT found." >&4
7328                 fi
7329         done
7330                 
7331         case "$xxx_convert" in
7332         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7333         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7334         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7335         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7336         esac
7337 fi
7338
7339 echo " "
7340
7341 if $test X"$d_longdbl" = X"$define"; then
7342
7343 echo "Checking how to print long doubles..." >&4
7344
7345 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7346         $cat >try.c <<'EOCP'
7347 #include <sys/types.h>
7348 #include <stdio.h>
7349 int main() {
7350   double d = 123.456;
7351   printf("%.3f\n", d);
7352 }
7353 EOCP
7354         set try
7355         if eval $compile; then
7356                 yyy=`./try$exe_ext`
7357                 case "$yyy" in
7358                 123.456)
7359                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7360                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7361                         echo "We will use %f."
7362                         ;;
7363                 esac
7364         fi
7365 fi
7366
7367 if $test X"$sPRIfldbl" = X; then
7368         $cat >try.c <<'EOCP'
7369 #include <sys/types.h>
7370 #include <stdio.h>
7371 int main() {
7372   long double d = 123.456;
7373   printf("%.3llf\n", d);
7374 }
7375 EOCP
7376         set try
7377         if eval $compile; then
7378                 yyy=`./try$exe_ext`
7379                 case "$yyy" in
7380                 123.456)
7381                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7382                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7383                         echo "We will use %llf."
7384                         ;;
7385                 esac
7386         fi
7387 fi
7388
7389 if $test X"$sPRIfldbl" = X; then
7390         $cat >try.c <<'EOCP'
7391 #include <sys/types.h>
7392 #include <stdio.h>
7393 int main() {
7394   long double d = 123.456;
7395   printf("%.3Lf\n", d);
7396 }
7397 EOCP
7398         set try
7399         if eval $compile; then
7400                 yyy=`./try$exe_ext`
7401                 case "$yyy" in
7402                 123.456)
7403                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7404                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7405                         echo "We will use %Lf."
7406                         ;;
7407                 esac
7408         fi
7409 fi
7410
7411 if $test X"$sPRIfldbl" = X; then
7412         $cat >try.c <<'EOCP'
7413 #include <sys/types.h>
7414 #include <stdio.h>
7415 int main() {
7416   long double d = 123.456;
7417   printf("%.3lf\n", d);
7418 }
7419 EOCP
7420         set try
7421         if eval $compile; then
7422                 yyy=`./try$exe_ext`
7423                 case "$yyy" in
7424                 123.456)
7425                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7426                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7427                         echo "We will use %lf."
7428                         ;;
7429                 esac
7430         fi
7431 fi
7432
7433 if $test X"$sPRIfldbl" = X; then
7434         echo "Cannot figure out how to print long doubles." >&4
7435 fi
7436
7437 $rm -f try try.*
7438
7439 fi # d_longdbl
7440
7441 case "$sPRIfldbl" in
7442 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7443         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7444         ;;
7445 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7446         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7447         ;;
7448 esac
7449
7450 : Initialize h_fcntl
7451 h_fcntl=false
7452
7453 : Initialize h_sysfile
7454 h_sysfile=false
7455
7456 : access call always available on UNIX
7457 set access d_access
7458 eval $inlibc
7459
7460 : locate the flags for 'access()'
7461 case "$d_access" in
7462 "$define")
7463         echo " "
7464         $cat >access.c <<'EOCP'
7465 #include <sys/types.h>
7466 #ifdef I_FCNTL
7467 #include <fcntl.h>
7468 #endif
7469 #ifdef I_SYS_FILE
7470 #include <sys/file.h>
7471 #endif
7472 #ifdef I_UNISTD
7473 #include <unistd.h>
7474 #endif
7475 int main() {
7476         exit(R_OK);
7477 }
7478 EOCP
7479         : check sys/file.h first, no particular reason here
7480         if $test `./findhdr sys/file.h` && \
7481                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7482                 h_sysfile=true;
7483                 echo "<sys/file.h> defines the *_OK access constants." >&4
7484         elif $test `./findhdr fcntl.h` && \
7485                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7486                 h_fcntl=true;
7487                 echo "<fcntl.h> defines the *_OK access constants." >&4
7488         elif $test `./findhdr unistd.h` && \
7489                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7490                 echo "<unistd.h> defines the *_OK access constants." >&4
7491         else
7492                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7493         fi
7494         ;;
7495 esac
7496 $rm -f access*
7497
7498 : see if accessx exists
7499 set accessx d_accessx
7500 eval $inlibc
7501
7502 : see if alarm exists
7503 set alarm d_alarm
7504 eval $inlibc
7505
7506 : see if atolf exists
7507 set atolf d_atolf
7508 eval $inlibc
7509
7510 : see if atoll exists
7511 set atoll d_atoll
7512 eval $inlibc
7513
7514 : Look for GNU-cc style attribute checking
7515 echo " "
7516 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7517 $cat >attrib.c <<'EOCP'
7518 #include <stdio.h>
7519 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7520 EOCP
7521 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7522         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7523                 echo "Your C compiler doesn't fully support __attribute__."
7524                 val="$undef"
7525         else
7526                 echo "Your C compiler supports __attribute__."
7527                 val="$define"
7528         fi
7529 else
7530         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7531         val="$undef"
7532 fi
7533 set d_attribut
7534 eval $setvar
7535 $rm -f attrib*
7536
7537 : see if bcmp exists
7538 set bcmp d_bcmp
7539 eval $inlibc
7540
7541 : see if bcopy exists
7542 set bcopy d_bcopy
7543 eval $inlibc
7544
7545 : see if this is a unistd.h system
7546 set unistd.h i_unistd
7547 eval $inhdr
7548
7549 : see if getpgrp exists
7550 set getpgrp d_getpgrp
7551 eval $inlibc
7552
7553 case "$d_getpgrp" in
7554 "$define")
7555         echo " "
7556         echo "Checking to see which flavor of getpgrp is in use..."
7557         $cat >set.c <<EOP
7558 #$i_unistd I_UNISTD
7559 #include <sys/types.h>
7560 #ifdef I_UNISTD
7561 #  include <unistd.h>
7562 #endif
7563 int main()
7564 {
7565         if (getuid() == 0) {
7566                 printf("(I see you are running Configure as super-user...)\n");
7567                 setuid(1);
7568         }
7569 #ifdef TRY_BSD_PGRP
7570         if (getpgrp(1) == 0)
7571                 exit(0);
7572 #else
7573         if (getpgrp() > 0)
7574                 exit(0);
7575 #endif
7576         exit(1);
7577 }
7578 EOP
7579         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7580                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7581                 val="$define"
7582         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7583                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7584                 val="$undef"
7585         else
7586                 echo "I can't seem to compile and run the test program."
7587                 if ./usg; then
7588                         xxx="a USG one, i.e. you use getpgrp()."
7589                 else
7590                         # SVR4 systems can appear rather BSD-ish.
7591                         case "$i_unistd" in
7592                         $undef)
7593                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7594                                 val="$define"
7595                                 ;;
7596                         $define)
7597                                 xxx="probably a USG one, i.e. you use getpgrp()."
7598                                 val="$undef"
7599                                 ;;
7600                         esac
7601                 fi
7602                 echo "Assuming your getpgrp is $xxx" >&4
7603         fi
7604         ;;
7605 *) val="$undef";;
7606 esac
7607 set d_bsdgetpgrp
7608 eval $setvar
7609 $rm -f set set.c
7610
7611 : see if setpgrp exists
7612 set setpgrp d_setpgrp
7613 eval $inlibc
7614
7615 case "$d_setpgrp" in
7616 "$define")
7617         echo " "
7618         echo "Checking to see which flavor of setpgrp is in use..."
7619         $cat >set.c <<EOP
7620 #$i_unistd I_UNISTD
7621 #include <sys/types.h>
7622 #ifdef I_UNISTD
7623 #  include <unistd.h>
7624 #endif
7625 int main()
7626 {
7627         if (getuid() == 0) {
7628                 printf("(I see you are running Configure as super-user...)\n");
7629                 setuid(1);
7630         }
7631 #ifdef TRY_BSD_PGRP
7632         if (-1 == setpgrp(1, 1))
7633                 exit(0);
7634 #else
7635         if (setpgrp() != -1)
7636                 exit(0);
7637 #endif
7638         exit(1);
7639 }
7640 EOP
7641         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7642                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7643                 val="$define"
7644         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7645                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7646                 val="$undef"
7647         else
7648                 echo "(I can't seem to compile and run the test program.)"
7649                 if ./usg; then
7650                         xxx="a USG one, i.e. you use setpgrp()."
7651                 else
7652                         # SVR4 systems can appear rather BSD-ish.
7653                         case "$i_unistd" in
7654                         $undef)
7655                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7656                                 val="$define"
7657                                 ;;
7658                         $define)
7659                                 xxx="probably a USG one, i.e. you use setpgrp()."
7660                                 val="$undef"
7661                                 ;;
7662                         esac
7663                 fi
7664                 echo "Assuming your setpgrp is $xxx" >&4
7665         fi
7666         ;;
7667 *) val="$undef";;
7668 esac
7669 set d_bsdsetpgrp
7670 eval $setvar
7671 $rm -f set set.c
7672 : see if bzero exists
7673 set bzero d_bzero
7674 eval $inlibc
7675
7676 : see if signal is declared as pointer to function returning int or void
7677 echo " "
7678 xxx=`./findhdr signal.h`
7679 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7680 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7681         echo "You have int (*signal())() instead of void." >&4
7682         val="$undef"
7683 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7684         echo "You have void (*signal())()." >&4
7685         val="$define"
7686 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7687         echo "You have int (*signal())() instead of void." >&4
7688         val="$undef"
7689 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7690         echo "You have void (*signal())()." >&4
7691         val="$define"
7692 else
7693         case "$d_voidsig" in
7694         '')
7695         echo "I can't determine whether signal handler returns void or int..." >&4
7696                 dflt=void
7697                 rp="What type does your signal handler return?"
7698                 . ./myread
7699                 case "$ans" in
7700                 v*) val="$define";;
7701                 *) val="$undef";;
7702                 esac;;
7703         "$define")
7704                 echo "As you already told me, signal handler returns void." >&4
7705                 val="$define"
7706                 ;;
7707         *)      echo "As you already told me, signal handler returns int." >&4
7708                 val="$undef"
7709                 ;;
7710         esac
7711 fi
7712 set d_voidsig
7713 eval $setvar
7714 case "$d_voidsig" in
7715 "$define") signal_t="void";;
7716 *) signal_t="int";;
7717 esac
7718 $rm -f $$.tmp
7719
7720 : check for ability to cast large floats to 32-bit ints.
7721 echo " "
7722 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7723 if $test "$intsize" -ge 4; then
7724         xxx=int
7725 else
7726         xxx=long
7727 fi
7728 $cat >try.c <<EOCP
7729 #include <stdio.h>
7730 #include <sys/types.h>
7731 #include <signal.h>
7732 $signal_t blech(s) int s; { exit(3); }
7733 int main()
7734 {
7735         $xxx i32;
7736         double f, g;
7737         int result = 0;
7738         char str[16];
7739         signal(SIGFPE, blech);
7740
7741         /* Don't let compiler optimize the test away.  Store the number 
7742            in a writable string for gcc to pass to sscanf under HP/UX.
7743         */
7744         sprintf(str, "2147483647");
7745         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7746         g = 10 * f;
7747         i32  = ($xxx) g;
7748
7749         /* x86 processors will probably give 0x8000 0000, which is a
7750        sign change.  We don't want that.  We want to mimic SPARC
7751            behavior here, which is to preserve the sign and give
7752            back 0x7fff ffff.
7753         */
7754         if (i32 != ($xxx) f)
7755                 result |= 1;
7756         exit(result);
7757 }
7758 EOCP
7759 set try
7760 if eval $compile_ok; then
7761         ./try
7762         yyy=$?
7763 else
7764         echo "(I can't seem to compile the test program--assuming it can't)"
7765         yyy=1
7766 fi
7767 case "$yyy" in
7768 0)      val="$define"
7769         echo "Yup, it can."
7770         ;;
7771 *)      val="$undef"
7772         echo "Nope, it can't."
7773         ;;
7774 esac
7775 set d_casti32
7776 eval $setvar
7777 $rm -f try try.*
7778
7779 : check for ability to cast negative floats to unsigned
7780 echo " "
7781 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7782 $cat >try.c <<EOCP
7783 #include <stdio.h>
7784 #include <sys/types.h>
7785 #include <signal.h>
7786 $signal_t blech(s) int s; { exit(7); }
7787 $signal_t blech_in_list(s) int s; { exit(4); }
7788 unsigned long dummy_long(p) unsigned long p; { return p; }
7789 unsigned int dummy_int(p) unsigned int p; { return p; }
7790 unsigned short dummy_short(p) unsigned short p; { return p; }
7791 int main()
7792 {
7793         double f;
7794         unsigned long along;
7795         unsigned int aint;
7796         unsigned short ashort;
7797         int result = 0;
7798         char str[16];
7799         
7800         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7801            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7802            optimized the whole file away
7803         */
7804         /* Store the number in a writable string for gcc to pass to 
7805            sscanf under HP/UX.
7806         */
7807         sprintf(str, "-123");
7808         sscanf(str, "%lf", &f);  /* f = -123.; */
7809
7810         signal(SIGFPE, blech);
7811         along = (unsigned long)f;
7812         aint = (unsigned int)f;
7813         ashort = (unsigned short)f;
7814         if (along != (unsigned long)-123)
7815                 result |= 1;
7816         if (aint != (unsigned int)-123)
7817                 result |= 1;
7818         if (ashort != (unsigned short)-123)
7819                 result |= 1;
7820         sprintf(str, "1073741824.");
7821         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7822         f = f + f;
7823         along = 0;
7824         along = (unsigned long)f;
7825         if (along != 0x80000000)
7826                 result |= 2;
7827         f -= 1.;
7828         along = 0;
7829         along = (unsigned long)f;
7830         if (along != 0x7fffffff)
7831                 result |= 1;
7832         f += 2.;
7833         along = 0;
7834         along = (unsigned long)f;
7835         if (along != 0x80000001)
7836                 result |= 2;
7837         if (result)
7838                 exit(result);
7839         signal(SIGFPE, blech_in_list);
7840         sprintf(str, "123.");
7841         sscanf(str, "%lf", &f);  /* f = 123.; */
7842         along = dummy_long((unsigned long)f);
7843         aint = dummy_int((unsigned int)f);
7844         ashort = dummy_short((unsigned short)f);
7845         if (along != (unsigned long)123)
7846                 result |= 4;
7847         if (aint != (unsigned int)123)
7848                 result |= 4;
7849         if (ashort != (unsigned short)123)
7850                 result |= 4;
7851         exit(result);
7852
7853 }
7854 EOCP
7855 set try
7856 if eval $compile_ok; then
7857         ./try
7858         castflags=$?
7859 else
7860         echo "(I can't seem to compile the test program--assuming it can't)"
7861         castflags=7
7862 fi
7863 case "$castflags" in
7864 0)      val="$define"
7865         echo "Yup, it can."
7866         ;;
7867 *)      val="$undef"
7868         echo "Nope, it can't."
7869         ;;
7870 esac
7871 set d_castneg
7872 eval $setvar
7873 $rm -f try.*
7874
7875 : see if vprintf exists
7876 echo " "
7877 if set vprintf val -f d_vprintf; eval $csym; $val; then
7878         echo 'vprintf() found.' >&4
7879         val="$define"
7880         $cat >vprintf.c <<'EOF'
7881 #include <varargs.h>
7882
7883 int main() { xxx("foo"); }
7884
7885 xxx(va_alist)
7886 va_dcl
7887 {
7888         va_list args;
7889         char buf[10];
7890
7891         va_start(args);
7892         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7893 }
7894 EOF
7895         set vprintf
7896         if eval $compile && ./vprintf; then
7897                 echo "Your vsprintf() returns (int)." >&4
7898                 val2="$undef"
7899         else
7900                 echo "Your vsprintf() returns (char*)." >&4
7901                 val2="$define"
7902         fi
7903 else
7904         echo 'vprintf() NOT found.' >&4
7905                 val="$undef"
7906                 val2="$undef"
7907 fi
7908 set d_vprintf
7909 eval $setvar
7910 val=$val2
7911 set d_charvspr
7912 eval $setvar
7913
7914 : see if chown exists
7915 set chown d_chown
7916 eval $inlibc
7917
7918 : see if chroot exists
7919 set chroot d_chroot
7920 eval $inlibc
7921
7922 : see if chsize exists
7923 set chsize d_chsize
7924 eval $inlibc
7925
7926 : check for const keyword
7927 echo " "
7928 echo 'Checking to see if your C compiler knows about "const"...' >&4
7929 $cat >const.c <<'EOCP'
7930 typedef struct spug { int drokk; } spug;
7931 int main()
7932 {
7933         const char *foo;
7934         const spug y;
7935 }
7936 EOCP
7937 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7938         val="$define"
7939         echo "Yup, it does."
7940 else
7941         val="$undef"
7942         echo "Nope, it doesn't."
7943 fi
7944 set d_const
7945 eval $setvar
7946
7947 : see if crypt exists
7948 echo " "
7949 if set crypt val -f d_crypt; eval $csym; $val; then
7950         echo 'crypt() found.' >&4
7951         val="$define"
7952         cryptlib=''
7953 else
7954         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7955         if $test -z "$cryptlib"; then
7956                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7957         else
7958                 cryptlib=-lcrypt
7959         fi
7960         if $test -z "$cryptlib"; then
7961                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7962         else
7963                 cryptlib=-lcrypt
7964         fi
7965         if $test -z "$cryptlib"; then
7966                 cryptlib=`./loc libcrypt$_a "" $libpth`
7967         else
7968                 cryptlib=-lcrypt
7969         fi
7970         if $test -z "$cryptlib"; then
7971                 echo 'crypt() NOT found.' >&4
7972                 val="$undef"
7973         else
7974                 val="$define"
7975         fi
7976 fi
7977 set d_crypt
7978 eval $setvar
7979
7980 : get csh whereabouts
7981 case "$csh" in
7982 'csh') val="$undef" ;;
7983 *) val="$define" ;;
7984 esac
7985 set d_csh
7986 eval $setvar
7987 : Respect a hint or command line value for full_csh.
7988 case "$full_csh" in
7989 '') full_csh=$csh ;;
7990 esac
7991
7992 : see if cuserid exists
7993 set cuserid d_cuserid
7994 eval $inlibc
7995
7996 : see if this is a limits.h system
7997 set limits.h i_limits
7998 eval $inhdr
7999
8000 : see if this is a float.h system
8001 set float.h i_float
8002 eval $inhdr
8003
8004 : See if number of significant digits in a double precision number is known
8005 echo " "
8006 $cat >dbl_dig.c <<EOM
8007 #$i_limits I_LIMITS
8008 #$i_float I_FLOAT
8009 #ifdef I_LIMITS
8010 #include <limits.h>
8011 #endif
8012 #ifdef I_FLOAT
8013 #include <float.h>
8014 #endif
8015 #ifdef DBL_DIG
8016 printf("Contains DBL_DIG");
8017 #endif
8018 EOM
8019 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8020 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8021         echo "DBL_DIG found." >&4
8022         val="$define"
8023 else
8024         echo "DBL_DIG NOT found." >&4
8025         val="$undef"
8026 fi
8027 $rm -f dbl_dig.?
8028 set d_dbl_dig
8029 eval $setvar
8030
8031 : see if difftime exists
8032 set difftime d_difftime
8033 eval $inlibc
8034
8035 : see if this is a dirent system
8036 echo " "
8037 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8038         val="$define"
8039         echo "<dirent.h> found." >&4
8040 else
8041         val="$undef"
8042         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8043                 echo "<sys/dir.h> found." >&4
8044                 echo " "
8045         else
8046                 xinc=`./findhdr sys/ndir.h`
8047         fi
8048         echo "<dirent.h> NOT found." >&4
8049 fi
8050 set i_dirent
8051 eval $setvar
8052
8053 : Look for type of directory structure.
8054 echo " "
8055 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8056
8057 case "$direntrytype" in
8058 ''|' ')
8059         case "$i_dirent" in
8060         $define) guess1='struct dirent' ;;
8061         *) guess1='struct direct'  ;;
8062         esac
8063         ;;
8064 *)      guess1="$direntrytype"
8065         ;;
8066 esac
8067
8068 case "$guess1" in
8069 'struct dirent') guess2='struct direct' ;;
8070 *) guess2='struct dirent' ;;
8071 esac
8072                 
8073 if $contains "$guess1" try.c >/dev/null 2>&1; then
8074         direntrytype="$guess1"
8075         echo "Your directory entries are $direntrytype." >&4
8076 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8077         direntrytype="$guess2"
8078         echo "Your directory entries seem to be $direntrytype." >&4
8079 else
8080         echo "I don't recognize your system's directory entries." >&4
8081         rp="What type is used for directory entries on this system?"
8082         dflt="$guess1"
8083         . ./myread
8084         direntrytype="$ans"
8085 fi
8086 $rm -f try.c
8087
8088
8089 : see if the directory entry stores field length
8090 echo " "
8091 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8092 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8093         echo "Good, your directory entry keeps length information in d_namlen." >&4
8094         val="$define"
8095 else
8096         echo "Your directory entry does not know about the d_namlen field." >&4
8097         val="$undef"
8098 fi
8099 set d_dirnamlen
8100 eval $setvar
8101 $rm -f try.c
8102
8103 : see if dlerror exists
8104 xxx_runnm="$runnm"
8105 runnm=false
8106 set dlerror d_dlerror
8107 eval $inlibc
8108 runnm="$xxx_runnm"
8109
8110 : see if dlfcn is available
8111 set dlfcn.h i_dlfcn
8112 eval $inhdr
8113
8114 case "$usedl" in
8115 $define|y|true)
8116         $cat << EOM
8117
8118 On a few systems, the dynamically loaded modules that perl generates and uses
8119 will need a different extension than shared libs. The default will probably
8120 be appropriate.
8121
8122 EOM
8123         case "$dlext" in
8124         '')     dflt="$so" ;;
8125         *)      dflt="$dlext" ;;
8126         esac
8127         rp='What is the extension of dynamically loaded modules'
8128         . ./myread
8129         dlext="$ans"
8130         ;;
8131 *)
8132         dlext="none"
8133         ;;
8134 esac
8135
8136 : Check if dlsym need a leading underscore
8137 echo " "
8138 val="$undef"
8139
8140 case "$dlsrc" in
8141 dl_dlopen.xs)
8142         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8143         $cat >dyna.c <<'EOM'
8144 fred () { }
8145 EOM
8146
8147 $cat >fred.c<<EOM
8148
8149 #include <stdio.h>
8150 #$i_dlfcn I_DLFCN
8151 #ifdef I_DLFCN
8152 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8153 #else
8154 #include <sys/types.h>
8155 #include <nlist.h>
8156 #include <link.h>
8157 #endif
8158
8159 extern int fred() ;
8160
8161 int main()
8162 {
8163     void * handle ;
8164     void * symbol ;
8165 #ifndef RTLD_LAZY
8166     int mode = 1 ;
8167 #else
8168     int mode = RTLD_LAZY ;
8169 #endif
8170     handle = dlopen("./dyna.$dlext", mode) ;
8171     if (handle == NULL) {
8172         printf ("1\n") ;
8173         fflush (stdout) ;
8174         exit(0);
8175     }
8176     symbol = dlsym(handle, "fred") ;
8177     if (symbol == NULL) {
8178         /* try putting a leading underscore */
8179         symbol = dlsym(handle, "_fred") ;
8180         if (symbol == NULL) {
8181             printf ("2\n") ;
8182             fflush (stdout) ;
8183             exit(0);
8184         }
8185         printf ("3\n") ;
8186     }
8187     else
8188         printf ("4\n") ;
8189     fflush (stdout) ;
8190     exit(0);
8191 }
8192 EOM
8193         : Call the object file tmp-dyna.o in case dlext=o.
8194         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8195                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8196                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8197                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8198                 xxx=`./fred`
8199                 case $xxx in
8200                 1)      echo "Test program failed using dlopen." >&4
8201                         echo "Perhaps you should not use dynamic loading." >&4;;
8202                 2)      echo "Test program failed using dlsym." >&4
8203                         echo "Perhaps you should not use dynamic loading." >&4;;
8204                 3)      echo "dlsym needs a leading underscore" >&4
8205                         val="$define" ;;
8206                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8207                 esac
8208         else
8209                 echo "I can't compile and run the test program." >&4
8210                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8211         fi
8212         ;;
8213 esac
8214                 
8215 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8216
8217 set d_dlsymun
8218 eval $setvar
8219
8220 hasproto='varname=$1; func=$2; shift; shift;
8221 while $test $# -ge 2; do
8222         case "$1" in
8223         $define) echo "#include <$2>";;
8224         esac ;
8225     shift 2;
8226 done > try.c;
8227 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8228 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8229         echo "$func() prototype found.";
8230         val="$define";
8231 else
8232         echo "$func() prototype NOT found.";
8233         val="$undef";
8234 fi;
8235 set $varname;
8236 eval $setvar;
8237 $rm -f try.c tryout.c'
8238
8239 : see if prototype for drand48 is available
8240 echo " "
8241 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8242 eval $hasproto
8243
8244 : see if dup2 exists
8245 set dup2 d_dup2
8246 eval $inlibc
8247
8248 : see if eaccess exists
8249 set eaccess d_eaccess
8250 eval $inlibc
8251
8252 : see if endgrent exists
8253 set endgrent d_endgrent
8254 eval $inlibc
8255
8256 : see if endhostent exists
8257 set endhostent d_endhent
8258 eval $inlibc
8259
8260 : see if endnetent exists
8261 set endnetent d_endnent
8262 eval $inlibc
8263
8264 : see if endprotoent exists
8265 set endprotoent d_endpent
8266 eval $inlibc
8267
8268 : see if endpwent exists
8269 set endpwent d_endpwent
8270 eval $inlibc
8271
8272 : see if endservent exists
8273 set endservent d_endsent
8274 eval $inlibc
8275
8276 : see if endspent exists
8277 set endspent d_endspent
8278 eval $inlibc
8279
8280 : Locate the flags for 'open()'
8281 echo " "
8282 $cat >open3.c <<'EOCP'
8283 #include <sys/types.h>
8284 #ifdef I_FCNTL
8285 #include <fcntl.h>
8286 #endif
8287 #ifdef I_SYS_FILE
8288 #include <sys/file.h>
8289 #endif
8290 int main() {
8291         if(O_RDONLY);
8292 #ifdef O_TRUNC
8293         exit(0);
8294 #else
8295         exit(1);
8296 #endif
8297 }
8298 EOCP
8299 : check sys/file.h first to get FREAD on Sun
8300 if $test `./findhdr sys/file.h` && \
8301                 set open3 -DI_SYS_FILE && eval $compile; then
8302         h_sysfile=true;
8303         echo "<sys/file.h> defines the O_* constants..." >&4
8304         if ./open3; then
8305                 echo "and you have the 3 argument form of open()." >&4
8306                 val="$define"
8307         else
8308                 echo "but not the 3 argument form of open().  Oh, well." >&4
8309                 val="$undef"
8310         fi
8311 elif $test `./findhdr fcntl.h` && \
8312                 set open3 -DI_FCNTL && eval $compile; then
8313         h_fcntl=true;
8314         echo "<fcntl.h> defines the O_* constants..." >&4
8315         if ./open3; then
8316                 echo "and you have the 3 argument form of open()." >&4
8317                 val="$define"
8318         else
8319                 echo "but not the 3 argument form of open().  Oh, well." >&4
8320                 val="$undef"
8321         fi
8322 else
8323         val="$undef"
8324         echo "I can't find the O_* constant definitions!  You got problems." >&4
8325 fi
8326 set d_open3
8327 eval $setvar
8328 $rm -f open3*
8329
8330 : see which of string.h or strings.h is needed
8331 echo " "
8332 strings=`./findhdr string.h`
8333 if $test "$strings" && $test -r "$strings"; then
8334         echo "Using <string.h> instead of <strings.h>." >&4
8335         val="$define"
8336 else
8337         val="$undef"
8338         strings=`./findhdr strings.h`
8339         if $test "$strings" && $test -r "$strings"; then
8340                 echo "Using <strings.h> instead of <string.h>." >&4
8341         else
8342                 echo "No string header found -- You'll surely have problems." >&4
8343         fi
8344 fi
8345 set i_string
8346 eval $setvar
8347 case "$i_string" in
8348 "$undef") strings=`./findhdr strings.h`;;
8349 *)        strings=`./findhdr string.h`;;
8350 esac
8351
8352 : check for non-blocking I/O stuff
8353 case "$h_sysfile" in
8354 true) echo "#include <sys/file.h>" > head.c;;
8355 *)
8356         case "$h_fcntl" in
8357         true) echo "#include <fcntl.h>" > head.c;;
8358         *) echo "#include <sys/fcntl.h>" > head.c;;
8359         esac
8360         ;;
8361 esac
8362 echo " "
8363 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8364 case "$o_nonblock" in
8365 '')
8366         $cat head.c > try.c
8367         $cat >>try.c <<'EOCP'
8368 #include <stdio.h>
8369 int main() {
8370 #ifdef O_NONBLOCK
8371         printf("O_NONBLOCK\n");
8372         exit(0);
8373 #endif
8374 #ifdef O_NDELAY
8375         printf("O_NDELAY\n");
8376         exit(0);
8377 #endif
8378 #ifdef FNDELAY
8379         printf("FNDELAY\n");
8380         exit(0);
8381 #endif
8382         exit(0);
8383 }
8384 EOCP
8385         set try
8386         if eval $compile_ok; then
8387                 o_nonblock=`./try`
8388                 case "$o_nonblock" in
8389                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8390                 *) echo "Seems like we can use $o_nonblock.";;
8391                 esac
8392         else
8393                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8394         fi
8395         ;;
8396 *) echo "Using $hint value $o_nonblock.";;
8397 esac
8398 $rm -f try try.* .out core
8399
8400 echo " "
8401 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8402 case "$eagain" in
8403 '')
8404         $cat head.c > try.c
8405         $cat >>try.c <<EOCP
8406 #include <errno.h>
8407 #include <sys/types.h>
8408 #include <signal.h>
8409 #include <stdio.h> 
8410 #define MY_O_NONBLOCK $o_nonblock
8411 #ifndef errno  /* XXX need better Configure test */
8412 extern int errno;
8413 #endif
8414 #$i_unistd I_UNISTD
8415 #ifdef I_UNISTD
8416 #include <unistd.h>
8417 #endif
8418 #ifdef $i_string
8419 #include <string.h>
8420 #else
8421 #include <strings.h>
8422 #endif
8423 $signal_t blech(x) int x; { exit(3); }
8424 EOCP
8425         $cat >> try.c <<'EOCP'
8426 int main()
8427 {
8428         int pd[2];
8429         int pu[2];
8430         char buf[1];
8431         char string[100];
8432
8433         pipe(pd);       /* Down: child -> parent */
8434         pipe(pu);       /* Up: parent -> child */
8435         if (0 != fork()) {
8436                 int ret;
8437                 close(pd[1]);   /* Parent reads from pd[0] */
8438                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8439                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8440                         exit(1);
8441                 signal(SIGALRM, blech);
8442                 alarm(5);
8443                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8444                         exit(2);
8445                 sprintf(string, "%d\n", ret);
8446                 write(2, string, strlen(string));
8447                 alarm(0);
8448 #ifdef EAGAIN
8449                 if (errno == EAGAIN) {
8450                         printf("EAGAIN\n");
8451                         goto ok;
8452                 }
8453 #endif
8454 #ifdef EWOULDBLOCK
8455                 if (errno == EWOULDBLOCK)
8456                         printf("EWOULDBLOCK\n");
8457 #endif
8458         ok:
8459                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8460                 sleep(2);                               /* Give it time to close our pipe */
8461                 alarm(5);
8462                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8463                 alarm(0);
8464                 sprintf(string, "%d\n", ret);
8465                 write(3, string, strlen(string));
8466                 exit(0);
8467         }
8468
8469         close(pd[0]);                   /* We write to pd[1] */
8470         close(pu[1]);                   /* We read from pu[0] */
8471         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8472         close(pd[1]);                   /* Pipe pd is now fully closed! */
8473         exit(0);                                /* Bye bye, thank you for playing! */
8474 }
8475 EOCP
8476         set try
8477         if eval $compile_ok; then
8478                 echo "$startsh" >mtry
8479                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8480                 chmod +x mtry
8481                 ./mtry >/dev/null 2>&1
8482                 case $? in
8483                 0) eagain=`$cat try.out`;;
8484                 1) echo "Could not perform non-blocking setting!";;
8485                 2) echo "I did a successful read() for something that was not there!";;
8486                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8487                 *) echo "Something terribly wrong happened during testing.";;
8488                 esac
8489                 rd_nodata=`$cat try.ret`
8490                 echo "A read() system call with no data present returns $rd_nodata."
8491                 case "$rd_nodata" in
8492                 0|-1) ;;
8493                 *)
8494                         echo "(That's peculiar, fixing that to be -1.)"
8495                         rd_nodata=-1
8496                         ;;
8497                 esac
8498                 case "$eagain" in
8499                 '')
8500                         echo "Forcing errno EAGAIN on read() with no data available."
8501                         eagain=EAGAIN
8502                         ;;
8503                 *)
8504                         echo "Your read() sets errno to $eagain when no data is available."
8505                         ;;
8506                 esac
8507                 status=`$cat try.err`
8508                 case "$status" in
8509                 0) echo "And it correctly returns 0 to signal EOF.";;
8510                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8511                 *) echo "However, your read() returns '$status' on EOF??";;
8512                 esac
8513                 val="$define"
8514                 if test "$status" = "$rd_nodata"; then
8515                         echo "WARNING: you can't distinguish between EOF and no data!"
8516                         val="$undef"
8517                 fi
8518         else
8519                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8520                 eagain=EAGAIN
8521         fi
8522         set d_eofnblk
8523         eval $setvar
8524         ;;
8525 *)
8526         echo "Using $hint value $eagain."
8527         echo "Your read() returns $rd_nodata when no data is present."
8528         case "$d_eofnblk" in
8529         "$define") echo "And you can see EOF because read() returns 0.";;
8530         "$undef") echo "But you can't see EOF status from read() returned value.";;
8531         *)
8532                 echo "(Assuming you can't see EOF status from read anyway.)"
8533                 d_eofnblk=$undef
8534                 ;;
8535         esac
8536         ;;
8537 esac
8538 $rm -f try try.* .out core head.c mtry
8539
8540 : see if fchmod exists
8541 set fchmod d_fchmod
8542 eval $inlibc
8543
8544 : see if fchown exists
8545 set fchown d_fchown
8546 eval $inlibc
8547
8548 : see if this is an fcntl system
8549 set fcntl d_fcntl
8550 eval $inlibc
8551
8552 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8553 while $test $# -ge 2; do
8554         case "$1" in
8555         $define) echo "#include <$2>";;
8556         esac ;
8557     shift 2;
8558 done > try.c;
8559 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8560 set try;
8561 if eval $compile; then
8562         val="$define";
8563 else
8564         val="$undef";
8565 fi;
8566 set $varname;
8567 eval $setvar;
8568 $rm -f try.c try.o'
8569
8570 socketlib=''
8571 sockethdr=''
8572 : see whether socket exists
8573 echo " "
8574 $echo $n "Hmm... $c" >&4
8575 if set socket val -f d_socket; eval $csym; $val; then
8576         echo "Looks like you have Berkeley networking support." >&4
8577         d_socket="$define"
8578         if set setsockopt val -f; eval $csym; $val; then
8579                 d_oldsock="$undef"
8580         else
8581                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8582                 d_oldsock="$define"
8583         fi
8584 else
8585         if $contains socklib libc.list >/dev/null 2>&1; then
8586                 echo "Looks like you have Berkeley networking support." >&4
8587                 d_socket="$define"
8588                 : we will have to assume that it supports the 4.2 BSD interface
8589                 d_oldsock="$undef"
8590         else
8591                 echo "You don't have Berkeley networking in libc$_a..." >&4
8592                 if test "X$d_socket" = "X$define"; then
8593                    echo "...but you seem to believe that you have sockets." >&4
8594                 else
8595                         for net in net socket
8596                         do
8597                                 if test -f /usr/lib/lib$net$_a; then
8598                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8599                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8600                                         if $contains socket libc.list >/dev/null 2>&1; then
8601                                                 d_socket="$define"
8602                                                 socketlib="-l$net"
8603                                                 case "$net" in
8604                                                 net)
8605                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8606                                                         sockethdr="-I/usr/netinclude"
8607                                                         ;;
8608                                                 esac
8609                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8610                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8611                                                         d_oldsock="$undef"
8612                                                 else
8613                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8614                                                         d_oldsock="$define"
8615                                                 fi
8616                                                 break
8617                                         fi
8618                                 fi
8619                         done
8620                         if test "X$d_socket" != "X$define"; then
8621                            echo "or anywhere else I see." >&4
8622                            d_socket="$undef"
8623                            d_oldsock="$undef"
8624                         fi
8625                 fi
8626         fi
8627 fi
8628
8629 : see if socketpair exists
8630 set socketpair d_sockpair
8631 eval $inlibc
8632
8633
8634 echo " "
8635 echo "Checking the availability of certain socket constants..." >& 4
8636 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8637         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8638         $cat >try.c <<EOF
8639 #include <sys/types.h>
8640 #include <sys/socket.h>
8641 int main() {
8642     int i = $ENUM;
8643 }
8644 EOF
8645         val="$undef"
8646         set try; if eval $compile; then
8647                 val="$define"
8648         fi
8649         set d_${enum}; eval $setvar
8650         $rm -f try.c try
8651 done
8652
8653 : see if sys/select.h has to be included
8654 set sys/select.h i_sysselct
8655 eval $inhdr
8656
8657 : see if we should include time.h, sys/time.h, or both
8658 echo " "
8659 if test "X$timeincl" = X; then
8660         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8661         $echo $n "I'm now running the test program...$c"
8662         $cat >try.c <<'EOCP'
8663 #include <sys/types.h>
8664 #ifdef I_TIME
8665 #include <time.h>
8666 #endif
8667 #ifdef I_SYSTIME
8668 #ifdef SYSTIMEKERNEL
8669 #define KERNEL
8670 #endif
8671 #include <sys/time.h>
8672 #endif
8673 #ifdef I_SYSSELECT
8674 #include <sys/select.h>
8675 #endif
8676 int main()
8677 {
8678         struct tm foo;
8679 #ifdef S_TIMEVAL
8680         struct timeval bar;
8681 #endif
8682 #ifdef S_TIMEZONE
8683         struct timezone tzp;
8684 #endif
8685         if (foo.tm_sec == foo.tm_sec)
8686                 exit(0);
8687 #ifdef S_TIMEVAL
8688         if (bar.tv_sec == bar.tv_sec)
8689                 exit(0);
8690 #endif
8691         exit(1);
8692 }
8693 EOCP
8694         flags=''
8695         for s_timezone in '-DS_TIMEZONE' ''; do
8696         sysselect=''
8697         for s_timeval in '-DS_TIMEVAL' ''; do
8698         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8699         for i_time in '' '-DI_TIME'; do
8700         for i_systime in '-DI_SYSTIME' ''; do
8701                 case "$flags" in
8702                 '') $echo $n ".$c"
8703                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8704                         if eval $compile; then
8705                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8706                                 shift
8707                                 flags="$*"
8708                                 echo " "
8709                                 $echo $n "Succeeded with $flags$c"
8710                         fi
8711                         ;;
8712                 esac
8713         done
8714         done
8715         done
8716         done
8717         done
8718         timeincl=''
8719         echo " "
8720         case "$flags" in
8721         *SYSTIMEKERNEL*) i_systimek="$define"
8722                 timeincl=`./findhdr sys/time.h`
8723                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8724         *) i_systimek="$undef";;
8725         esac
8726         case "$flags" in
8727         *I_TIME*) i_time="$define"
8728                 timeincl=`./findhdr time.h`" $timeincl"
8729                 echo "We'll include <time.h>." >&4;;
8730         *) i_time="$undef";;
8731         esac
8732         case "$flags" in
8733         *I_SYSTIME*) i_systime="$define"
8734                 timeincl=`./findhdr sys/time.h`" $timeincl"
8735                 echo "We'll include <sys/time.h>." >&4;;
8736         *) i_systime="$undef";;
8737         esac
8738         $rm -f try.c try
8739 fi
8740
8741 : check for fd_set items
8742 $cat <<EOM
8743
8744 Checking to see how well your C compiler handles fd_set and friends ...
8745 EOM
8746 $cat >fd_set.c <<EOCP
8747 #$i_systime I_SYS_TIME
8748 #$i_sysselct I_SYS_SELECT
8749 #$d_socket HAS_SOCKET
8750 #include <sys/types.h>
8751 #ifdef HAS_SOCKET
8752 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8753 #endif
8754 #ifdef I_SYS_TIME
8755 #include <sys/time.h>
8756 #endif
8757 #ifdef I_SYS_SELECT
8758 #include <sys/select.h>
8759 #endif
8760 int main() {
8761         fd_set fds;
8762
8763 #ifdef TRYBITS
8764         if(fds.fds_bits);
8765 #endif
8766
8767 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8768         exit(0);
8769 #else
8770         exit(1);
8771 #endif
8772 }
8773 EOCP
8774 set fd_set -DTRYBITS
8775 if eval $compile; then
8776         d_fds_bits="$define"
8777         d_fd_set="$define"
8778         echo "Well, your system knows about the normal fd_set typedef..." >&4
8779         if ./fd_set; then
8780                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8781                 d_fd_macros="$define"
8782         else
8783                 $cat >&4 <<'EOM'
8784 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8785 EOM
8786                 d_fd_macros="$undef"
8787         fi
8788 else
8789         $cat <<'EOM'
8790 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8791 EOM
8792         set fd_set
8793         if eval $compile; then
8794                 d_fds_bits="$undef"
8795                 d_fd_set="$define"
8796                 echo "Well, your system has some sort of fd_set available..." >&4
8797                 if ./fd_set; then
8798                         echo "and you have the normal fd_set macros." >&4
8799                         d_fd_macros="$define"
8800                 else
8801                         $cat <<'EOM'
8802 but not the normal fd_set macros!  Gross!  More work for me...
8803 EOM
8804                         d_fd_macros="$undef"
8805                 fi
8806         else
8807         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8808                 d_fd_set="$undef"
8809                 d_fds_bits="$undef"
8810                 d_fd_macros="$undef"
8811         fi
8812 fi
8813 $rm -f fd_set*
8814
8815 : see if fgetpos exists
8816 set fgetpos d_fgetpos
8817 eval $inlibc
8818
8819 : see if flock exists
8820 set flock d_flock
8821 eval $inlibc
8822
8823 : see if fork exists
8824 set fork d_fork
8825 eval $inlibc
8826
8827 : see if pathconf exists
8828 set pathconf d_pathconf
8829 eval $inlibc
8830
8831 : see if fpathconf exists
8832 set fpathconf d_fpathconf
8833 eval $inlibc
8834
8835
8836 : check for off64_t
8837 echo " "
8838 echo "Checking to see if your system supports off64_t..." >&4
8839 $cat >try.c <<EOCP
8840 #include <sys/types.h>
8841 #include <unistd.h>
8842 int main() { off64_t x = 7; }'
8843 EOCP
8844 set try
8845 if eval $compile; then
8846         val="$define"
8847         echo "Yes, it does."
8848 else
8849         val="$undef"
8850         echo "No, it doesn't."
8851         case "$lseeksize" in
8852         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8853         esac
8854 fi
8855 $rm -f try.* try
8856 set d_off64_t
8857 eval $setvar
8858
8859 : check for fpos64_t
8860 echo " "
8861 echo "Checking to see if your system supports fpos64_t..." >&4
8862 $cat >try.c <<EOCP
8863 #include <sys/stdio.h>
8864 int main() { fpos64_t x x = 7; }'
8865 EOCP
8866 set try
8867 if eval $compile; then
8868         val="$define"
8869         echo "Yes, it does."
8870 else
8871         val="$undef"
8872         echo "No, it doesn't."
8873         case "$fpossize" in
8874         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8875         esac
8876 fi
8877 $rm -f try.* try
8878 set d_fpos64_t
8879 eval $setvar
8880
8881 hasstruct='varname=$1; struct=$2; shift; shift;
8882 while $test $# -ge 2; do
8883         case "$1" in
8884         $define) echo "#include <$2>";;
8885         esac ;
8886     shift 2;
8887 done > try.c;
8888 echo "int main () { struct $struct foo; }" >> try.c;
8889 set try;
8890 if eval $compile; then
8891         val="$define";
8892 else
8893         val="$undef";
8894 fi;
8895 set $varname;
8896 eval $setvar;
8897 $rm -f try.c try.o'
8898
8899 : see if this is a sys/param system
8900 set sys/param.h i_sysparam
8901 eval $inhdr
8902
8903 : see if this is a sys/mount.h system
8904 set sys/mount.h i_sysmount
8905 eval $inhdr
8906
8907 : see if sys/types.h has to be included
8908 set sys/types.h i_systypes
8909 eval $inhdr
8910
8911
8912 echo " "
8913 echo "Checking to see if your system supports struct fs_data..." >&4
8914 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8915 eval $hasstruct
8916 case "$d_fs_data_s" in
8917 "$define")      echo "Yes, it does."   ;;
8918 *)              echo "No, it doesn't." ;;
8919 esac
8920
8921 : see if fseeko exists
8922 set fseeko d_fseeko
8923 eval $inlibc
8924 case "$longsize" in
8925 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8926 esac
8927
8928 : see if fsetpos exists
8929 set fsetpos d_fsetpos
8930 eval $inlibc
8931
8932
8933 : see if fstatfs exists
8934 set fstatfs d_fstatfs
8935 eval $inlibc
8936
8937
8938 : see if statvfs exists
8939 set statvfs d_statvfs
8940 eval $inlibc
8941
8942 : see if fstatvfs exists
8943 set fstatvfs d_fstatvfs
8944 eval $inlibc
8945
8946
8947 : see if ftello exists
8948 set ftello d_ftello
8949 eval $inlibc
8950 case "$longsize" in
8951 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8952 esac
8953
8954 : see if getgrent exists
8955 set getgrent d_getgrent
8956 eval $inlibc
8957
8958 : see if gethostbyaddr exists
8959 set gethostbyaddr d_gethbyaddr
8960 eval $inlibc
8961
8962 : see if gethostbyname exists
8963 set gethostbyname d_gethbyname
8964 eval $inlibc
8965
8966 : see if gethostent exists
8967 set gethostent d_gethent
8968 eval $inlibc
8969
8970 : see how we will look up host name
8971 echo " "
8972 call=''
8973 if set gethostname val -f d_gethname; eval $csym; $val; then
8974         echo 'gethostname() found.' >&4
8975         d_gethname="$define"
8976         call=gethostname
8977 fi
8978 if set uname val -f d_uname; eval $csym; $val; then
8979         if ./xenix; then
8980                 $cat <<'EOM'
8981 uname() was found, but you're running xenix, and older versions of xenix
8982 have a broken uname(). If you don't really know whether your xenix is old
8983 enough to have a broken system call, use the default answer.
8984
8985 EOM
8986                 dflt=y
8987                 case "$d_uname" in
8988                 "$define") dflt=n;;
8989                 esac
8990                 rp='Is your uname() broken?'
8991                 . ./myread
8992                 case "$ans" in
8993                 n*) d_uname="$define"; call=uname;;
8994                 esac
8995         else
8996                 echo 'uname() found.' >&4
8997                 d_uname="$define"
8998                 case "$call" in
8999                 '') call=uname ;;
9000                 esac
9001         fi
9002 fi
9003 case "$d_gethname" in
9004 '') d_gethname="$undef";;
9005 esac
9006 case "$d_uname" in
9007 '') d_uname="$undef";;
9008 esac
9009 case "$d_uname$d_gethname" in
9010 *define*)
9011         dflt=n
9012         cat <<EOM
9013  
9014 Every now and then someone has a $call() that lies about the hostname
9015 but can't be fixed for political or economic reasons.  If you wish, I can
9016 pretend $call() isn't there and maybe compute hostname at run-time
9017 thanks to the '$phostname' command.
9018
9019 EOM
9020         rp="Shall I ignore $call() from now on?"
9021         . ./myread
9022         case "$ans" in
9023         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9024         esac;;
9025 esac
9026 case "$phostname" in
9027 '') aphostname='';;
9028 *) case "$aphostname" in
9029         /*) ;;
9030         *) set X $phostname
9031                 shift
9032                 file=$1
9033                 shift
9034                 file=`./loc $file $file $pth`
9035                 aphostname=`echo $file $*`
9036                 ;;
9037         esac
9038         ;;
9039 esac
9040 case "$d_uname$d_gethname" in
9041 *define*) ;;
9042 *)
9043         case "$phostname" in
9044         '')
9045                 echo "There will be no way for $package to get your hostname." >&4;;
9046         *)
9047         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9048                 ;;
9049         esac;;
9050 esac
9051 case "$d_phostname" in
9052 '') d_phostname="$undef";;
9053 esac
9054
9055 : see if this is a netdb.h system
9056 set netdb.h i_netdb
9057 eval $inhdr
9058
9059 : see if prototypes for various gethostxxx netdb.h functions are available
9060 echo " "
9061 set d_gethostprotos gethostent $i_netdb netdb.h
9062 eval $hasproto
9063
9064 : see if getlogin exists
9065 set getlogin d_getlogin
9066 eval $inlibc
9067
9068 : see if getmnt exists
9069 set getmnt d_getmnt
9070 eval $inlibc
9071
9072 : see if getmntent exists
9073 set getmntent d_getmntent
9074 eval $inlibc
9075
9076 : see if getnetbyaddr exists
9077 set getnetbyaddr d_getnbyaddr
9078 eval $inlibc
9079
9080 : see if getnetbyname exists
9081 set getnetbyname d_getnbyname
9082 eval $inlibc
9083
9084 : see if getnetent exists
9085 set getnetent d_getnent
9086 eval $inlibc
9087
9088 : see if prototypes for various getnetxxx netdb.h functions are available
9089 echo " "
9090 set d_getnetprotos getnetent $i_netdb netdb.h
9091 eval $hasproto
9092
9093
9094 : see if getprotobyname exists
9095 set getprotobyname d_getpbyname
9096 eval $inlibc
9097
9098 : see if getprotobynumber exists
9099 set getprotobynumber d_getpbynumber
9100 eval $inlibc
9101
9102 : see if getprotoent exists
9103 set getprotoent d_getpent
9104 eval $inlibc
9105
9106 : see if getpgid exists
9107 set getpgid d_getpgid
9108 eval $inlibc
9109
9110 : see if getpgrp2 exists
9111 set getpgrp2 d_getpgrp2
9112 eval $inlibc
9113
9114 : see if getppid exists
9115 set getppid d_getppid
9116 eval $inlibc
9117
9118 : see if getpriority exists
9119 set getpriority d_getprior
9120 eval $inlibc
9121
9122 : see if prototypes for various getprotoxxx netdb.h functions are available
9123 echo " "
9124 set d_getprotoprotos getprotoent $i_netdb netdb.h
9125 eval $hasproto
9126
9127 : see if getpwent exists
9128 set getpwent d_getpwent
9129 eval $inlibc
9130
9131
9132 : see if getservbyname exists
9133 set getservbyname d_getsbyname
9134 eval $inlibc
9135
9136 : see if getservbyport exists
9137 set getservbyport d_getsbyport
9138 eval $inlibc
9139
9140 : see if getservent exists
9141 set getservent d_getsent
9142 eval $inlibc
9143
9144 : see if prototypes for various getservxxx netdb.h functions are available
9145 echo " "
9146 set d_getservprotos getservent $i_netdb netdb.h
9147 eval $hasproto
9148
9149 : see if getspent exists
9150 set getspent d_getspent
9151 eval $inlibc
9152
9153 : see if getspnam exists
9154 set getspnam d_getspnam
9155 eval $inlibc
9156
9157 : see if gettimeofday or ftime exists
9158 set gettimeofday d_gettimeod
9159 eval $inlibc
9160 case "$d_gettimeod" in
9161 "$undef")
9162         set ftime d_ftime 
9163         eval $inlibc
9164         ;;
9165 *)
9166         val="$undef"; set d_ftime; eval $setvar
9167         ;;
9168 esac
9169 case "$d_gettimeod$d_ftime" in
9170 "$undef$undef")
9171         echo " "
9172         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9173         ;;
9174 esac
9175
9176 : see if this is an grp system
9177 set grp.h i_grp
9178 eval $inhdr
9179
9180 case "$i_grp" in
9181 $define)
9182         xxx=`./findhdr grp.h`
9183         $cppstdin $cppflags $cppminus < $xxx >$$.h
9184
9185         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9186                 val="$define"
9187         else
9188                 val="$undef"
9189         fi
9190         set d_grpasswd
9191         eval $setvar
9192
9193         $rm -f $$.h
9194         ;;
9195 *)
9196         val="$undef";
9197         set d_grpasswd; eval $setvar
9198         ;;
9199 esac
9200
9201 : see if hasmntopt exists
9202 set hasmntopt d_hasmntopt
9203 eval $inlibc
9204
9205 : see if this is a netinet/in.h or sys/in.h system
9206 set netinet/in.h i_niin sys/in.h i_sysin
9207 eval $inhdr
9208
9209 : see if arpa/inet.h has to be included
9210 set arpa/inet.h i_arpainet
9211 eval $inhdr
9212
9213 : see if htonl --and friends-- exists
9214 val=''
9215 set htonl val
9216 eval $inlibc
9217
9218 : Maybe they are macros.
9219 case "$val" in
9220 $undef)
9221         $cat >htonl.c <<EOM
9222 #include <stdio.h>
9223 #include <sys/types.h>
9224 #$i_niin I_NETINET_IN
9225 #$i_sysin I_SYS_IN
9226 #$i_arpainet I_ARPA_INET
9227 #ifdef I_NETINET_IN
9228 #include <netinet/in.h>
9229 #endif
9230 #ifdef I_SYS_IN
9231 #include <sys/in.h>
9232 #endif
9233 #ifdef I_ARPA_INET
9234 #include <arpa/inet.h>
9235 #endif
9236 #ifdef htonl
9237 printf("Defined as a macro.");
9238 #endif
9239 EOM
9240         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9241         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9242                 val="$define"
9243                 echo "But it seems to be defined as a macro." >&4
9244         fi
9245         $rm -f htonl.?
9246         ;;
9247 esac
9248 set d_htonl
9249 eval $setvar
9250
9251 : index or strchr
9252 echo " "
9253 if set index val -f; eval $csym; $val; then
9254         if set strchr val -f d_strchr; eval $csym; $val; then
9255                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9256                         val="$define"
9257                         vali="$undef"
9258                         echo "strchr() found." >&4
9259                 else
9260                         val="$undef"
9261                         vali="$define"
9262                         echo "index() found." >&4
9263                 fi
9264         else
9265                 val="$undef"
9266                 vali="$define"
9267                 echo "index() found." >&4
9268         fi
9269 else
9270         if set strchr val -f d_strchr; eval $csym; $val; then
9271                 val="$define"
9272                 vali="$undef"
9273                 echo "strchr() found." >&4
9274         else
9275                 echo "No index() or strchr() found!" >&4
9276                 val="$undef"
9277                 vali="$undef"
9278         fi
9279 fi
9280 set d_strchr; eval $setvar
9281 val="$vali"
9282 set d_index; eval $setvar
9283
9284 : check whether inet_aton exists
9285 set inet_aton d_inetaton
9286 eval $inlibc
9287
9288 : Look for isascii
9289 echo " "
9290 $cat >isascii.c <<'EOCP'
9291 #include <stdio.h>
9292 #include <ctype.h>
9293 int main() {
9294         int c = 'A';
9295         if (isascii(c))
9296                 exit(0);
9297         else
9298                 exit(1);
9299 }
9300 EOCP
9301 set isascii
9302 if eval $compile; then
9303         echo "isascii() found." >&4
9304         val="$define"
9305 else
9306         echo "isascii() NOT found." >&4
9307         val="$undef"
9308 fi
9309 set d_isascii
9310 eval $setvar
9311 $rm -f isascii*
9312
9313 : see if killpg exists
9314 set killpg d_killpg
9315 eval $inlibc
9316
9317 : see if lchown exists
9318 echo " "
9319 $cat > try.c <<'EOCP'
9320 /* System header to define __stub macros and hopefully few prototypes,
9321     which can conflict with char lchown(); below.  */
9322 #include <assert.h>
9323 /* Override any gcc2 internal prototype to avoid an error.  */
9324 /* We use char because int might match the return type of a gcc2
9325    builtin and then its argument prototype would still apply.  */
9326 char lchown();
9327 int main() {
9328     /*  The GNU C library defines this for functions which it implements
9329         to always fail with ENOSYS.  Some functions are actually named
9330         something starting with __ and the normal name is an alias.  */
9331 #if defined (__stub_lchown) || defined (__stub___lchown)
9332 choke me
9333 #else
9334 lchown();
9335 #endif
9336 ; return 0; }
9337 EOCP
9338 set try
9339 if eval $compile; then
9340     $echo "lchown() found." >&4
9341     val="$define"
9342 else
9343     $echo "lchown() NOT found." >&4
9344     val="$undef"
9345 fi
9346 set d_lchown
9347 eval $setvar
9348
9349 : See if number of significant digits in a double precision number is known
9350 echo " "
9351 $cat >ldbl_dig.c <<EOM
9352 #$i_limits I_LIMITS
9353 #$i_float I_FLOAT
9354 #ifdef I_LIMITS
9355 #include <limits.h>
9356 #endif
9357 #ifdef I_FLOAT
9358 #include <float.h>
9359 #endif
9360 #ifdef LDBL_DIG
9361 printf("Contains LDBL_DIG");
9362 #endif
9363 EOM
9364 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9365 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9366         echo "LDBL_DIG found." >&4
9367         val="$define"
9368 else
9369         echo "LDBL_DIG NOT found." >&4
9370         val="$undef"
9371 fi
9372 $rm -f ldbl_dig.?
9373 set d_ldbl_dig
9374 eval $setvar
9375
9376 : see if link exists
9377 set link d_link
9378 eval $inlibc
9379
9380 : see if localeconv exists
9381 set localeconv d_locconv
9382 eval $inlibc
9383
9384 : see if lockf exists
9385 set lockf d_lockf
9386 eval $inlibc
9387
9388 : check for long long
9389 echo " "
9390 $echo $n "Checking to see if your system supports long long..." $c >&4
9391 echo 'int main() { long long x = 7; return 0; }' > try.c
9392 set try
9393 if eval $compile; then
9394         val="$define"
9395         echo " Yes, it does." >&4
9396 else
9397         val="$undef"
9398         echo " No, it doesn't." >&4
9399 fi
9400 $rm try.*
9401 set d_longlong
9402 eval $setvar
9403
9404 : check for length of long long
9405 case "${d_longlong}${longlongsize}" in
9406 $define)
9407         echo " "
9408         $echo $n "Checking to see how big your long longs are..." $c >&4
9409         $cat >try.c <<'EOCP'
9410 #include <stdio.h>
9411 int main()
9412 {
9413     printf("%d\n", (int)sizeof(long long));
9414     return(0);
9415 }
9416 EOCP
9417         set try
9418         if eval $compile_ok; then
9419                 longlongsize=`./try$exe_ext`
9420                 $echo " $longlongsize bytes." >&4
9421         else
9422                 dflt='8'
9423                 echo " "
9424                 echo "(I can't seem to compile the test program.  Guessing...)"
9425                 rp="What is the size of a long long (in bytes)?"
9426                 . ./myread
9427                 longlongsize="$ans"
9428         fi
9429         if $test "X$longsize" = "X$longlongsize"; then
9430                 echo "(That isn't any different from an ordinary long.)"
9431         fi      
9432         ;;
9433 esac
9434 $rm -f try.* try
9435
9436 : see if lstat exists
9437 set lstat d_lstat
9438 eval $inlibc
9439
9440 : see if mblen exists
9441 set mblen d_mblen
9442 eval $inlibc
9443
9444 : see if mbstowcs exists
9445 set mbstowcs d_mbstowcs
9446 eval $inlibc
9447
9448 : see if mbtowc exists
9449 set mbtowc d_mbtowc
9450 eval $inlibc
9451
9452 : see if memchr exists
9453 set memchr d_memchr
9454 eval $inlibc
9455
9456 : see if memcmp exists
9457 set memcmp d_memcmp
9458 eval $inlibc
9459
9460 : see if memcpy exists
9461 set memcpy d_memcpy
9462 eval $inlibc
9463
9464 : see if memmove exists
9465 set memmove d_memmove
9466 eval $inlibc
9467
9468 : see if memset exists
9469 set memset d_memset
9470 eval $inlibc
9471
9472 : see if mkdir exists
9473 set mkdir d_mkdir
9474 eval $inlibc
9475
9476 : see if mkfifo exists
9477 set mkfifo d_mkfifo
9478 eval $inlibc
9479
9480 : see if mktime exists
9481 set mktime d_mktime
9482 eval $inlibc
9483
9484 : see if msgctl exists
9485 set msgctl d_msgctl
9486 eval $inlibc
9487
9488 : see if msgget exists
9489 set msgget d_msgget
9490 eval $inlibc
9491
9492 : see if msgsnd exists
9493 set msgsnd d_msgsnd
9494 eval $inlibc
9495
9496 : see if msgrcv exists
9497 set msgrcv d_msgrcv
9498 eval $inlibc
9499
9500 : see how much of the 'msg*(2)' library is present.
9501 h_msg=true
9502 echo " "
9503 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9504 *"$undef"*) h_msg=false;;
9505 esac
9506 case "$osname" in
9507 freebsd)
9508     case "`ipcs 2>&1`" in
9509     "SVID messages"*"not configured"*)
9510         echo "Your $osname does not have the msg*(2) configured." >&4
9511         h_msg=false
9512         val="$undef"
9513         set msgctl d_msgctl
9514         eval $setvar
9515         set msgget d_msgget
9516         eval $setvar
9517         set msgsnd d_msgsnd
9518         eval $setvar
9519         set msgrcv d_msgrcv
9520         eval $setvar
9521         ;;
9522     esac
9523     ;;
9524 esac
9525 : we could also check for sys/ipc.h ...
9526 if $h_msg && $test `./findhdr sys/msg.h`; then
9527         echo "You have the full msg*(2) library." >&4
9528         val="$define"
9529 else
9530         echo "You don't have the full msg*(2) library." >&4
9531         val="$undef"
9532 fi
9533 set d_msg
9534 eval $setvar
9535
9536 : see if nice exists
9537 set nice d_nice
9538 eval $inlibc
9539
9540 : see if POSIX threads are available
9541 set pthread.h i_pthread
9542 eval $inhdr
9543
9544
9545
9546
9547 : how to create joinable pthreads
9548 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9549         echo " "
9550         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9551         $cat >try.c <<'EOCP'
9552 #include <pthread.h>
9553 int main() {
9554     int detachstate = JOINABLE;
9555 }
9556 EOCP
9557         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9558         if eval $compile; then
9559                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9560                 val="$undef" # Yes, undef.
9561                 set d_old_pthread_create_joinable
9562                 eval $setvar
9563                 val=""
9564                 set old_pthread_create_joinable
9565                 eval $setvar
9566         else
9567                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9568                 if eval $compile; then
9569                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9570                         val="$define"
9571                         set d_old_pthread_create_joinable
9572                         eval $setvar
9573                         val=PTHREAD_CREATE_UNDETACHED
9574                         set old_pthread_create_joinable
9575                         eval $setvar
9576                 else            
9577                         set try -DJOINABLE=__UNDETACHED
9578                         if eval $compile; then
9579                                 echo "You seem to use __UNDETACHED." >&4
9580                                 val="$define"
9581                                 set d_old_pthread_create_joinable
9582                                 eval $setvar
9583                                 val=__UNDETACHED
9584                                 set old_pthread_create_joinable
9585                                 eval $setvar
9586                         else
9587                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9588                                 val="$define"
9589                                 set d_old_pthread_create_joinable
9590                                 eval $setvar
9591                                 val=0
9592                                 set old_pthread_create_joinable
9593                                 eval $setvar
9594                         fi
9595                 fi
9596         fi
9597         $rm -f try try.*
9598 else
9599     d_old_pthread_create_joinable="$undef"
9600     old_pthread_create_joinable=""
9601 fi
9602
9603 : see if pause exists
9604 set pause d_pause
9605 eval $inlibc
9606
9607 : see if pipe exists
9608 set pipe d_pipe
9609 eval $inlibc
9610
9611 : see if poll exists
9612 set poll d_poll
9613 eval $inlibc
9614
9615
9616 : see whether the various POSIXish _yields exist
9617 $cat >try.c <<EOP
9618 #include <pthread.h>
9619 #include <stdio.h>
9620 int main() {
9621 #ifdef SCHED_YIELD
9622         sched_yield();
9623 #else
9624 #ifdef PTHREAD_YIELD
9625         pthread_yield();
9626 #else
9627 #ifdef PTHREAD_YIELD_NULL
9628         pthread_yield(NULL);
9629 #endif
9630 #endif
9631 #endif
9632 }
9633 EOP
9634 : see if sched_yield exists
9635 set try -DSCHED_YIELD
9636 if eval $compile; then
9637     val="$define"
9638     sched_yield='sched_yield()'
9639 else
9640     val="$undef"
9641 fi
9642 case "$usethreads" in
9643 $define)
9644         case "$val" in
9645         $define) echo 'sched_yield() found.' >&4        ;;
9646         *)       echo 'sched_yield() NOT found.' >&4    ;;
9647         esac
9648 esac
9649 set d_sched_yield
9650 eval $setvar
9651
9652 : see if pthread_yield exists
9653 set try -DPTHREAD_YIELD
9654 if eval $compile; then
9655     val="$define"
9656     case "$sched_yield" in
9657     '') sched_yield='pthread_yield()' ;;
9658     esac
9659 else
9660     set try -DPTHREAD_YIELD_NULL
9661     if eval $compile; then
9662         val="$define"
9663         case "$sched_yield" in
9664         '') sched_yield='pthread_yield(NULL)' ;;
9665         esac
9666     else
9667         val="$undef"
9668     fi
9669 fi
9670 case "$usethreads" in
9671 $define)
9672         case "$val" in
9673         $define) echo 'pthread_yield() found.' >&4      ;;
9674         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9675         esac
9676         ;;
9677 esac
9678 set d_pthread_yield
9679 eval $setvar
9680
9681 case "$sched_yield" in
9682 '') sched_yield=undef ;;
9683 esac
9684
9685 $rm -f try try.*
9686
9687 : see if this is a pwd.h system
9688 set pwd.h i_pwd
9689 eval $inhdr
9690
9691 case "$i_pwd" in
9692 $define)
9693         xxx=`./findhdr pwd.h`
9694         $cppstdin $cppflags $cppminus < $xxx >$$.h
9695
9696         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9697                 val="$define"
9698         else
9699                 val="$undef"
9700         fi
9701         set d_pwquota
9702         eval $setvar
9703
9704         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9705                 val="$define"
9706         else
9707                 val="$undef"
9708         fi
9709         set d_pwage
9710         eval $setvar
9711
9712         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9713                 val="$define"
9714         else
9715                 val="$undef"
9716         fi
9717         set d_pwchange
9718         eval $setvar
9719
9720         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9721                 val="$define"
9722         else
9723                 val="$undef"
9724         fi
9725         set d_pwclass
9726         eval $setvar
9727
9728         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9729                 val="$define"
9730         else
9731                 val="$undef"
9732         fi
9733         set d_pwexpire
9734         eval $setvar
9735
9736         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9737                 val="$define"
9738         else
9739                 val="$undef"
9740         fi
9741         set d_pwcomment
9742         eval $setvar
9743
9744         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9745                 val="$define"
9746         else
9747                 val="$undef"
9748         fi
9749         set d_pwgecos
9750         eval $setvar
9751
9752         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9753                 val="$define"
9754         else
9755                 val="$undef"
9756         fi
9757         set d_pwpasswd
9758         eval $setvar
9759
9760         $rm -f $$.h
9761         ;;
9762 *)
9763         val="$undef"; 
9764         set d_pwquota; eval $setvar
9765         set d_pwage; eval $setvar
9766         set d_pwchange; eval $setvar
9767         set d_pwclass; eval $setvar
9768         set d_pwexpire; eval $setvar
9769         set d_pwcomment; eval $setvar
9770         set d_pwgecos; eval $setvar
9771         set d_pwpasswd; eval $setvar
9772         ;;
9773 esac
9774
9775 : see if inttypes.h is available
9776 : we want a real compile instead of Inhdr because some systems
9777 : have an inttypes.h which includes non-existent headers
9778 echo " "
9779 $cat >try.c <<EOCP
9780 #include <inttypes.h>
9781 int main() {
9782         static int32_t foo32 = 0x12345678;
9783 }
9784 EOCP
9785 set try
9786 if eval $compile; then
9787         echo "<inttypes.h> found." >&4
9788         val="$define"
9789 else
9790         echo "<inttypes.h> NOT found." >&4
9791         val="$undef"
9792 fi
9793 $rm -f try.c try
9794 set i_inttypes
9795 eval $setvar
9796
9797 : check for int64_t
9798 echo " "
9799 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9800 $cat >try.c <<EOCP
9801 #include <sys/types.h>
9802 #$i_inttypes I_INTTYPES
9803 #ifdef I_INTTYPES
9804 #include <inttypes.h>
9805 #endif
9806 int main() { int64_t x = 7; }
9807 EOCP
9808 set try
9809 if eval $compile; then
9810         val="$define"
9811         echo " Yes, it does." >&4
9812 else
9813         val="$undef"
9814         echo " No, it doesn't." >&4
9815 fi
9816 $rm -f try try.*
9817 set d_int64t
9818 eval $setvar
9819
9820
9821 echo " "
9822 echo "Checking which 64-bit integer type we could use..." >&4
9823
9824 case "$intsize" in
9825 8) val=int
9826    set quadtype
9827    eval $setvar
9828    val='"unsigned int"'
9829    set uquadtype
9830    eval $setvar
9831    quadkind=1
9832    ;;
9833 *) case "$longsize" in
9834    8) val=long
9835       set quadtype
9836       eval $setvar
9837       val='"unsigned long"'
9838       set uquadtype
9839       eval $setvar
9840       quadkind=2
9841       ;;
9842    *) case "$uselonglong:$d_longlong:$longlongsize" in
9843       define:define:8)
9844         val='"long long"'
9845         set quadtype
9846         eval $setvar
9847         val='"unsigned long long"'
9848         set uquadtype
9849         eval $setvar
9850         quadkind=3
9851         ;;
9852       *) case "$d_int64t" in
9853          define)
9854            val=int64_t
9855            set quadtype
9856            eval $setvar
9857            val=uint64_t
9858            set uquadtype
9859            eval $setvar
9860            quadkind=4
9861            ;;
9862          esac
9863          ;;
9864       esac
9865       ;;
9866    esac
9867    ;;
9868 esac
9869
9870 case "$quadtype" in
9871 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9872         undef:define:8)
9873            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9874         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9875         esac
9876         d_quad="$undef"
9877         ;;
9878 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9879             verb="will"
9880         else
9881             verb="could"
9882         fi
9883         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9884         d_quad="$define"
9885         ;;
9886 esac
9887
9888 : see if readdir and friends exist
9889 set readdir d_readdir
9890 eval $inlibc
9891 set seekdir d_seekdir
9892 eval $inlibc
9893 set telldir d_telldir
9894 eval $inlibc
9895 set rewinddir d_rewinddir
9896 eval $inlibc
9897
9898 : see if readlink exists
9899 set readlink d_readlink
9900 eval $inlibc
9901
9902 : see if rename exists
9903 set rename d_rename
9904 eval $inlibc
9905
9906 : see if rmdir exists
9907 set rmdir d_rmdir
9908 eval $inlibc
9909
9910 : see if memory.h is available.
9911 val=''
9912 set memory.h val
9913 eval $inhdr
9914
9915 : See if it conflicts with string.h
9916 case "$val" in
9917 $define)
9918         case "$strings" in
9919         '') ;;
9920         *)
9921                 $cppstdin $cppflags $cppminus < $strings > mem.h
9922                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9923                         echo " "
9924                         echo "We won't be including <memory.h>."
9925                         val="$undef"
9926                 fi
9927                 $rm -f mem.h
9928                 ;;
9929         esac
9930 esac
9931 set i_memory
9932 eval $setvar
9933
9934 : can bcopy handle overlapping blocks?
9935 val="$undef"
9936 case "$d_bcopy" in
9937 "$define")
9938         echo " "
9939         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9940         $cat >try.c <<EOCP
9941 #$i_memory I_MEMORY
9942 #$i_stdlib I_STDLIB
9943 #$i_string I_STRING
9944 #$i_unistd I_UNISTD
9945 EOCP
9946         $cat >>try.c <<'EOCP'
9947 #include <stdio.h>
9948 #ifdef I_MEMORY
9949 #  include <memory.h>
9950 #endif
9951 #ifdef I_STDLIB
9952 #  include <stdlib.h>
9953 #endif
9954 #ifdef I_STRING
9955 #  include <string.h>
9956 #else
9957 #  include <strings.h>
9958 #endif
9959 #ifdef I_UNISTD
9960 #  include <unistd.h>  /* Needed for NetBSD */
9961 #endif
9962 int main()
9963 {
9964 char buf[128], abc[128];
9965 char *b;
9966 int len;
9967 int off;
9968 int align;
9969
9970 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9971
9972 for (align = 7; align >= 0; align--) {
9973         for (len = 36; len; len--) {
9974                 b = buf+align;
9975                 bcopy(abc, b, len);
9976                 for (off = 1; off <= len; off++) {
9977                         bcopy(b, b+off, len);
9978                         bcopy(b+off, b, len);
9979                         if (bcmp(b, abc, len))
9980                                 exit(1);
9981                 }
9982         }
9983 }
9984 exit(0);
9985 }
9986 EOCP
9987         set try
9988         if eval $compile_ok; then
9989                 if ./try 2>/dev/null; then
9990                         echo "Yes, it can."
9991                         val="$define"
9992                 else
9993                         echo "It can't, sorry."
9994                         case "$d_memmove" in
9995                         "$define") echo "But that's Ok since you have memmove()." ;;
9996                         esac
9997                 fi
9998         else
9999                 echo "(I can't compile the test program, so we'll assume not...)"
10000                 case "$d_memmove" in
10001                 "$define") echo "But that's Ok since you have memmove()." ;;
10002                 esac
10003         fi
10004         ;;
10005 esac
10006 $rm -f try.* try core
10007 set d_safebcpy
10008 eval $setvar
10009
10010 : can memcpy handle overlapping blocks?
10011 val="$undef"
10012 case "$d_memcpy" in
10013 "$define")
10014         echo " "
10015         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10016         $cat >try.c <<EOCP
10017 #$i_memory I_MEMORY
10018 #$i_stdlib I_STDLIB
10019 #$i_string I_STRING
10020 #$i_unistd I_UNISTD
10021 EOCP
10022         $cat >>try.c <<'EOCP'
10023 #include <stdio.h>
10024 #ifdef I_MEMORY
10025 #  include <memory.h>
10026 #endif
10027 #ifdef I_STDLIB
10028 #  include <stdlib.h>
10029 #endif
10030 #ifdef I_STRING
10031 #  include <string.h>
10032 #else
10033 #  include <strings.h>
10034 #endif
10035 #ifdef I_UNISTD
10036 #  include <unistd.h>  /* Needed for NetBSD */
10037 #endif
10038 int main()
10039 {
10040 char buf[128], abc[128];
10041 char *b;
10042 int len;
10043 int off;
10044 int align;
10045
10046 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10047    try to store the string in read-only memory. */
10048 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10049
10050 for (align = 7; align >= 0; align--) {
10051         for (len = 36; len; len--) {
10052                 b = buf+align;
10053                 memcpy(b, abc, len);
10054                 for (off = 1; off <= len; off++) {
10055                         memcpy(b+off, b, len);
10056                         memcpy(b, b+off, len);
10057                         if (memcmp(b, abc, len))
10058                                 exit(1);
10059                 }
10060         }
10061 }
10062 exit(0);
10063 }
10064 EOCP
10065         set try
10066         if eval $compile_ok; then
10067                 if ./try 2>/dev/null; then
10068                         echo "Yes, it can."
10069                         val="$define"
10070                 else
10071                         echo "It can't, sorry."
10072                         case "$d_memmove" in
10073                         "$define") echo "But that's Ok since you have memmove()." ;;
10074                         esac
10075                 fi
10076         else
10077                 echo "(I can't compile the test program, so we'll assume not...)"
10078                 case "$d_memmove" in
10079                 "$define") echo "But that's Ok since you have memmove()." ;;
10080                 esac
10081         fi
10082         ;;
10083 esac
10084 $rm -f try.* try core
10085 set d_safemcpy
10086 eval $setvar
10087
10088 : can memcmp be trusted to compare relative magnitude?
10089 val="$undef"
10090 case "$d_memcmp" in
10091 "$define")
10092         echo " "
10093         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10094         $cat >try.c <<EOCP
10095 #$i_memory I_MEMORY
10096 #$i_stdlib I_STDLIB
10097 #$i_string I_STRING
10098 #$i_unistd I_UNISTD
10099 EOCP
10100         $cat >>try.c <<'EOCP'
10101 #include <stdio.h>
10102 #ifdef I_MEMORY
10103 #  include <memory.h>
10104 #endif
10105 #ifdef I_STDLIB
10106 #  include <stdlib.h>
10107 #endif
10108 #ifdef I_STRING
10109 #  include <string.h>
10110 #else
10111 #  include <strings.h>
10112 #endif
10113 #ifdef I_UNISTD
10114 #  include <unistd.h>  /* Needed for NetBSD */
10115 #endif
10116 int main()
10117 {
10118 char a = -1;
10119 char b = 0;
10120 if ((a < b) && memcmp(&a, &b, 1) < 0)
10121         exit(1);
10122 exit(0);
10123 }
10124 EOCP
10125         set try
10126         if eval $compile_ok; then
10127                 if ./try 2>/dev/null; then
10128                         echo "Yes, it can."
10129                         val="$define"
10130                 else
10131                         echo "No, it can't (it uses signed chars)."
10132                 fi
10133         else
10134                 echo "(I can't compile the test program, so we'll assume not...)"
10135         fi
10136         ;;
10137 esac
10138 $rm -f try.* try core
10139 set d_sanemcmp
10140 eval $setvar
10141
10142 : see if select exists
10143 set select d_select
10144 eval $inlibc
10145
10146 : see if semctl exists
10147 set semctl d_semctl
10148 eval $inlibc
10149
10150 : see if semget exists
10151 set semget d_semget
10152 eval $inlibc
10153
10154 : see if semop exists
10155 set semop d_semop
10156 eval $inlibc
10157
10158 : see how much of the 'sem*(2)' library is present.
10159 h_sem=true
10160 echo " "
10161 case "$d_semctl$d_semget$d_semop" in
10162 *"$undef"*) h_sem=false;;
10163 esac
10164 case "$osname" in
10165 freebsd)
10166     case "`ipcs 2>&1`" in
10167     "SVID messages"*"not configured"*)
10168         echo "Your $osname does not have the sem*(2) configured." >&4
10169         h_sem=false
10170         val="$undef"
10171         set semctl d_semctl
10172         eval $setvar
10173         set semget d_semget
10174         eval $setvar
10175         set semop d_semop
10176         eval $setvar
10177         ;;
10178     esac
10179     ;;
10180 esac
10181 : we could also check for sys/ipc.h ...
10182 if $h_sem && $test `./findhdr sys/sem.h`; then
10183         echo "You have the full sem*(2) library." >&4
10184         val="$define"
10185 else
10186         echo "You don't have the full sem*(2) library." >&4
10187         val="$undef"
10188 fi
10189 set d_sem
10190 eval $setvar
10191
10192 : see whether sys/sem.h defines union semun
10193 echo " "
10194 $cat > try.c <<'END'
10195 #include <sys/types.h>
10196 #include <sys/ipc.h>
10197 #include <sys/sem.h>
10198 int main () { union semun semun; semun.buf = 0; }
10199 END
10200 set try
10201 if eval $compile; then
10202     echo "You have union semun in <sys/sem.h>." >&4
10203     val="$define"
10204 else
10205     echo "You do not have union semun in <sys/sem.h>." >&4
10206     val="$undef"
10207 fi
10208 $rm -f try try.c try.h
10209 set d_union_semun
10210 eval $setvar
10211
10212 : see how to do semctl IPC_STAT
10213 case "$d_sem" in
10214 $define)
10215     : see whether semctl IPC_STAT can use union semun
10216     echo " "
10217     $cat > try.h <<END
10218 #ifndef S_IRUSR
10219 #   ifdef S_IREAD
10220 #       define S_IRUSR S_IREAD
10221 #       define S_IWUSR S_IWRITE
10222 #       define S_IXUSR S_IEXEC
10223 #   else
10224 #       define S_IRUSR 0400
10225 #       define S_IWUSR 0200
10226 #       define S_IXUSR 0100
10227 #   endif
10228 #   define S_IRGRP (S_IRUSR>>3)
10229 #   define S_IWGRP (S_IWUSR>>3)
10230 #   define S_IXGRP (S_IXUSR>>3)
10231 #   define S_IROTH (S_IRUSR>>6)
10232 #   define S_IWOTH (S_IWUSR>>6)
10233 #   define S_IXOTH (S_IXUSR>>6)
10234 #endif
10235 #ifndef S_IRWXU
10236 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10237 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10238 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10239 #endif
10240 END
10241
10242     $cat > try.c <<END
10243 #include <sys/types.h>
10244 #include <sys/ipc.h>
10245 #include <sys/sem.h>
10246 #include <sys/stat.h>
10247 #include <stdio.h>
10248 #include <errno.h>
10249 #include "try.h"
10250 #ifndef errno
10251 extern int errno;
10252 #endif
10253 #$d_union_semun HAS_UNION_SEMUN
10254 int main() {
10255     union semun
10256 #ifndef HAS_UNION_SEMUN
10257     {
10258         int val;
10259         struct semid_ds *buf;
10260         unsigned short *array;
10261     }
10262 #endif
10263     arg;
10264     int sem, st;
10265
10266 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10267     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10268     if (sem > -1) {
10269         struct semid_ds argbuf;
10270         arg.buf = &argbuf;
10271 #       ifdef IPC_STAT
10272         st = semctl(sem, 0, IPC_STAT, arg);
10273         if (st == 0)
10274             printf("semun\n");
10275         else
10276 #       endif /* IPC_STAT */
10277             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10278 #       ifdef IPC_RMID
10279         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10280 #       endif /* IPC_RMID */
10281             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10282     } else
10283 #endif /* IPC_PRIVATE && ... */
10284         printf("semget failed: errno = %d\n", errno);
10285   return 0;
10286 }
10287 END
10288     val="$undef"
10289     set try
10290     if eval $compile; then
10291         xxx=`./try`
10292         case "$xxx" in
10293         semun) val="$define" ;;
10294         esac
10295     fi
10296     $rm -f try try.c
10297     set d_semctl_semun
10298     eval $setvar
10299     case "$d_semctl_semun" in
10300     $define)
10301         echo "You can use union semun for semctl IPC_STAT." >&4
10302         also='also'
10303         ;;
10304     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10305         also=''
10306         ;;
10307     esac
10308
10309     : see whether semctl IPC_STAT can use struct semid_ds pointer
10310     $cat > try.c <<'END'
10311 #include <sys/types.h>
10312 #include <sys/ipc.h>
10313 #include <sys/sem.h>
10314 #include <sys/stat.h>
10315 #include "try.h"
10316 #include <stdio.h>
10317 #include <errno.h>
10318 #ifndef errno
10319 extern int errno;
10320 #endif
10321 int main() {
10322     struct semid_ds arg;
10323     int sem, st;
10324
10325 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10326     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10327     if (sem > -1) {
10328 #       ifdef IPC_STAT
10329         st = semctl(sem, 0, IPC_STAT, &arg);
10330         if (st == 0)
10331             printf("semid_ds\n");
10332         else
10333 #       endif /* IPC_STAT */
10334             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10335 #       ifdef IPC_RMID
10336         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10337 #       endif /* IPC_RMID */
10338             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10339     } else
10340 #endif /* IPC_PRIVATE && ... */
10341         printf("semget failed: errno = %d\n", errno);
10342
10343     return 0;
10344 }
10345 END
10346     val="$undef"
10347     set try
10348     if eval $compile; then
10349         xxx=`./try`
10350         case "$xxx" in
10351         semid_ds) val="$define" ;;
10352         esac
10353     fi
10354     $rm -f try try.c
10355     set d_semctl_semid_ds
10356     eval $setvar
10357     case "$d_semctl_semid_ds" in
10358     $define)
10359         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10360         ;;
10361     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10362         ;;
10363     esac
10364     $rm -f try.h
10365     ;;
10366 *)  val="$undef"
10367
10368     # We do not have the full sem*(2) library, so assume we can not
10369     # use either.
10370
10371     set d_semctl_semun
10372     eval $setvar
10373
10374     set d_semctl_semid_ds
10375     eval $setvar
10376     ;;
10377 esac
10378
10379 : see if setegid exists
10380 set setegid d_setegid
10381 eval $inlibc
10382
10383 : see if seteuid exists
10384 set seteuid d_seteuid
10385 eval $inlibc
10386
10387 : see if setgrent exists
10388 set setgrent d_setgrent
10389 eval $inlibc
10390
10391 : see if sethostent exists
10392 set sethostent d_sethent
10393 eval $inlibc
10394
10395 : see if setlinebuf exists
10396 set setlinebuf d_setlinebuf
10397 eval $inlibc
10398
10399 : see if setlocale exists
10400 set setlocale d_setlocale
10401 eval $inlibc
10402
10403 : see if setnetent exists
10404 set setnetent d_setnent
10405 eval $inlibc
10406
10407 : see if setprotoent exists
10408 set setprotoent d_setpent
10409 eval $inlibc
10410
10411 : see if setpgid exists
10412 set setpgid d_setpgid
10413 eval $inlibc
10414
10415 : see if setpgrp2 exists
10416 set setpgrp2 d_setpgrp2
10417 eval $inlibc
10418
10419 : see if setpriority exists
10420 set setpriority d_setprior
10421 eval $inlibc
10422
10423 : see if setpwent exists
10424 set setpwent d_setpwent
10425 eval $inlibc
10426
10427 : see if setregid exists
10428 set setregid d_setregid
10429 eval $inlibc
10430 set setresgid d_setresgid
10431 eval $inlibc
10432
10433 : see if setreuid exists
10434 set setreuid d_setreuid
10435 eval $inlibc
10436 set setresuid d_setresuid
10437 eval $inlibc
10438
10439 : see if setrgid exists
10440 set setrgid d_setrgid
10441 eval $inlibc
10442
10443 : see if setruid exists
10444 set setruid d_setruid
10445 eval $inlibc
10446
10447 : see if setservent exists
10448 set setservent d_setsent
10449 eval $inlibc
10450
10451 : see if setsid exists
10452 set setsid d_setsid
10453 eval $inlibc
10454
10455 : see if setspent exists
10456 set setspent d_setspent
10457 eval $inlibc
10458
10459 : see if setvbuf exists
10460 set setvbuf d_setvbuf
10461 eval $inlibc
10462
10463 : see if sfio.h is available
10464 set sfio.h i_sfio
10465 eval $inhdr
10466
10467
10468 : see if sfio library is available
10469 case "$i_sfio" in
10470 $define)
10471         val=''
10472         set sfreserve val
10473         eval $inlibc
10474         ;;
10475 *)
10476         val="$undef"
10477         ;;
10478 esac
10479 : Ok, but do we want to use it.
10480 case "$val" in
10481 $define)
10482         case "$usesfio" in
10483         true|$define|[yY]*) dflt='y';;
10484         *) dflt='n';;
10485         esac
10486         echo "$package can use the sfio library, but it is experimental."
10487         rp="You seem to have sfio available, do you want to try using it?"
10488         . ./myread
10489         case "$ans" in
10490         y|Y) ;;
10491         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10492                 val="$undef"
10493                 : Remove sfio from list of libraries to use
10494                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10495                 shift
10496                 libs="$*"
10497                 echo "libs = $libs" >&4
10498                 ;;
10499         esac
10500         ;;
10501 *)      case "$usesfio" in
10502         true|$define|[yY]*)
10503                 echo "Sorry, cannot find sfio on this machine" >&4
10504                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10505                 ;;
10506         esac
10507         ;;
10508 esac
10509 set d_sfio
10510 eval $setvar
10511 case "$d_sfio" in
10512 $define) usesfio='true';;
10513 *) usesfio='false';;
10514 esac
10515
10516 : see if shmctl exists
10517 set shmctl d_shmctl
10518 eval $inlibc
10519
10520 : see if shmget exists
10521 set shmget d_shmget
10522 eval $inlibc
10523
10524 : see if shmat exists
10525 set shmat d_shmat
10526 eval $inlibc
10527 : see what shmat returns
10528 case "$d_shmat" in
10529 "$define")
10530         $cat >shmat.c <<'END'
10531 #include <sys/shm.h>
10532 void *shmat();
10533 END
10534         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10535                 shmattype='void *'
10536         else
10537                 shmattype='char *'
10538         fi
10539         echo "and it returns ($shmattype)." >&4
10540         : see if a prototype for shmat is available
10541         xxx=`./findhdr sys/shm.h`
10542         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10543         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10544                 val="$define"
10545         else
10546                 val="$undef"
10547         fi
10548         $rm -f shmat.[co]
10549         ;;
10550 *)
10551         val="$undef"
10552         ;;
10553 esac
10554 set d_shmatprototype
10555 eval $setvar
10556
10557 : see if shmdt exists
10558 set shmdt d_shmdt
10559 eval $inlibc
10560
10561 : see how much of the 'shm*(2)' library is present.
10562 h_shm=true
10563 echo " "
10564 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10565 *"$undef"*) h_shm=false;;
10566 esac
10567 case "$osname" in
10568 freebsd)
10569     case "`ipcs 2>&1`" in
10570     "SVID shared memory"*"not configured"*)
10571         echo "Your $osname does not have the shm*(2) configured." >&4
10572         h_shm=false
10573         val="$undef"
10574         set shmctl d_shmctl
10575         evat $setvar
10576         set shmget d_shmget
10577         evat $setvar
10578         set shmat d_shmat
10579         evat $setvar
10580         set shmdt d_shmdt
10581         evat $setvar
10582         ;;
10583     esac
10584     ;;
10585 esac
10586 : we could also check for sys/ipc.h ...
10587 if $h_shm && $test `./findhdr sys/shm.h`; then
10588         echo "You have the full shm*(2) library." >&4
10589         val="$define"
10590 else
10591         echo "You don't have the full shm*(2) library." >&4
10592         val="$undef"
10593 fi
10594 set d_shm
10595 eval $setvar
10596
10597 echo " "
10598 : see if we have sigaction
10599 if set sigaction val -f d_sigaction; eval $csym; $val; then
10600         echo 'sigaction() found.' >&4
10601         $cat > try.c <<'EOP'
10602 #include <stdio.h>
10603 #include <sys/types.h>
10604 #include <signal.h>
10605 int main()
10606 {
10607     struct sigaction act, oact;
10608     act.sa_flags = 0;
10609     oact.sa_handler = 0;
10610     /* so that act and oact are used */
10611     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10612 }
10613 EOP
10614         set try
10615         if eval $compile_ok; then
10616                 val="$define"
10617         else
10618                 echo "But you don't seem to have a useable struct sigaction." >&4
10619                 val="$undef"
10620         fi
10621 else
10622         echo 'sigaction NOT found.' >&4
10623         val="$undef"
10624 fi
10625 set d_sigaction; eval $setvar
10626 $rm -f try try$_o try.c
10627
10628 : see if sigsetjmp exists
10629 echo " "
10630 case "$d_sigsetjmp" in
10631 '')
10632         $cat >try.c <<'EOP'
10633 #include <setjmp.h>
10634 sigjmp_buf env;
10635 int set = 1;
10636 int main()
10637 {
10638         if (sigsetjmp(env,1))
10639                 exit(set);
10640         set = 0;
10641         siglongjmp(env, 1);
10642         exit(1);
10643 }
10644 EOP
10645         set try
10646         if eval $compile; then
10647                 if ./try >/dev/null 2>&1; then
10648                         echo "POSIX sigsetjmp found." >&4
10649                         val="$define"
10650                 else
10651                         $cat >&4 <<EOM
10652 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10653 I'll ignore them.
10654 EOM
10655                         val="$undef"
10656                 fi
10657         else
10658                 echo "sigsetjmp not found." >&4
10659                 val="$undef"
10660         fi
10661         ;;
10662 *) val="$d_sigsetjmp"
10663         case "$d_sigsetjmp" in
10664         $define) echo "POSIX sigsetjmp found." >&4;;
10665         $undef) echo "sigsetjmp not found." >&4;;
10666         esac
10667         ;;
10668 esac
10669 set d_sigsetjmp
10670 eval $setvar
10671 $rm -f try.c try
10672
10673 : see if sqrtl exists
10674 set sqrtl d_sqrtl
10675 eval $inlibc
10676
10677 : see if sys/stat.h is available
10678 set sys/stat.h i_sysstat
10679 eval $inhdr
10680
10681
10682 : see if stat knows about block sizes
10683 echo " "
10684 echo "Checking to see if your struct stat has st_blocks field..." >&4
10685 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10686 eval $hasfield
10687
10688
10689 : see if this is a sys/vfs.h system
10690 set sys/vfs.h i_sysvfs
10691 eval $inhdr
10692
10693
10694 : see if this is a sys/statfs.h system
10695 set sys/statfs.h i_sysstatfs
10696 eval $inhdr
10697
10698
10699 echo " "
10700 echo "Checking to see if your system supports struct statfs..." >&4
10701 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
10702 eval $hasstruct
10703 case "$d_statfs_s" in
10704 "$define")      echo "Yes, it does."   ;;
10705 *)              echo "No, it doesn't." ;;
10706 esac
10707
10708
10709
10710 : see if struct statfs knows about f_flags
10711 case "$d_statfs_s" in
10712 define) 
10713         echo " "
10714         echo "Checking to see if your struct statfs has f_flags field..." >&4
10715         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
10716         eval $hasfield
10717         ;;
10718 *)      val="$undef"
10719         set d_statfs_f_flags
10720         eval $setvar
10721         ;;
10722 esac
10723 case "$d_statfs_f_flags" in
10724 "$define")      echo "Yes, it does."   ;;
10725 *)              echo "No, it doesn't." ;;
10726 esac
10727
10728 : see if _ptr and _cnt from stdio act std
10729 echo " "
10730 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10731         echo "(Looks like you have stdio.h from Linux.)"
10732         case "$stdio_ptr" in
10733         '') stdio_ptr='((fp)->_IO_read_ptr)'
10734                 ptr_lval=$define
10735                 ;;
10736         *)      ptr_lval=$d_stdio_ptr_lval;;
10737         esac
10738         case "$stdio_cnt" in
10739         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10740                 cnt_lval=$undef
10741                 ;;
10742         *)      cnt_lval=$d_stdio_cnt_lval;;
10743         esac
10744         case "$stdio_base" in
10745         '') stdio_base='((fp)->_IO_read_base)';;
10746         esac
10747         case "$stdio_bufsiz" in
10748         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10749         esac
10750 else
10751         case "$stdio_ptr" in
10752         '') stdio_ptr='((fp)->_ptr)'
10753                 ptr_lval=$define
10754                 ;;
10755         *)      ptr_lval=$d_stdio_ptr_lval;;
10756         esac
10757         case "$stdio_cnt" in
10758         '') stdio_cnt='((fp)->_cnt)'
10759                 cnt_lval=$define
10760                 ;;
10761         *)      cnt_lval=$d_stdio_cnt_lval;;
10762         esac
10763         case "$stdio_base" in
10764         '') stdio_base='((fp)->_base)';;
10765         esac
10766         case "$stdio_bufsiz" in
10767         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10768         esac
10769 fi
10770 : test whether _ptr and _cnt really work
10771 echo "Checking how std your stdio is..." >&4
10772 $cat >try.c <<EOP
10773 #include <stdio.h>
10774 #define FILE_ptr(fp)    $stdio_ptr
10775 #define FILE_cnt(fp)    $stdio_cnt
10776 int main() {
10777         FILE *fp = fopen("try.c", "r");
10778         char c = getc(fp);
10779         if (
10780                 18 <= FILE_cnt(fp) &&
10781                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10782         )
10783                 exit(0);
10784         exit(1);
10785 }
10786 EOP
10787 val="$undef"
10788 set try
10789 if eval $compile; then
10790         if ./try; then
10791                 echo "Your stdio acts pretty std."
10792                 val="$define"
10793         else
10794                 echo "Your stdio isn't very std."
10795         fi
10796 else
10797         echo "Your stdio doesn't appear very std."
10798 fi
10799 $rm -f try.c try
10800 set d_stdstdio
10801 eval $setvar
10802
10803 : Can _ptr be used as an lvalue?
10804 case "$d_stdstdio$ptr_lval" in
10805 $define$define) val=$define ;;
10806 *) val=$undef ;;
10807 esac
10808 set d_stdio_ptr_lval
10809 eval $setvar
10810
10811 : Can _cnt be used as an lvalue?
10812 case "$d_stdstdio$cnt_lval" in
10813 $define$define) val=$define ;;
10814 *) val=$undef ;;
10815 esac
10816 set d_stdio_cnt_lval
10817 eval $setvar
10818
10819 : see if _base is also standard
10820 val="$undef"
10821 case "$d_stdstdio" in
10822 $define)
10823         $cat >try.c <<EOP
10824 #include <stdio.h>
10825 #define FILE_base(fp)   $stdio_base
10826 #define FILE_bufsiz(fp) $stdio_bufsiz
10827 int main() {
10828         FILE *fp = fopen("try.c", "r");
10829         char c = getc(fp);
10830         if (
10831                 19 <= FILE_bufsiz(fp) &&
10832                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10833         )
10834                 exit(0);
10835         exit(1);
10836 }
10837 EOP
10838         set try
10839         if eval $compile; then
10840                 if ./try; then
10841                         echo "And its _base field acts std."
10842                         val="$define"
10843                 else
10844                         echo "But its _base field isn't std."
10845                 fi
10846         else
10847                 echo "However, it seems to be lacking the _base field."
10848         fi
10849         $rm -f try.c try
10850         ;;
10851 esac
10852 set d_stdiobase
10853 eval $setvar
10854
10855 $cat >&4 <<EOM
10856 Checking how to access stdio streams by file descriptor number...
10857 EOM
10858 case "$stdio_stream_array" in
10859 '')     $cat >try.c <<EOCP
10860 #include <stdio.h>
10861 int main() {
10862   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10863     printf("yes\n");
10864 }
10865 EOCP
10866         for s in _iob __iob __sF
10867         do
10868                 set try -DSTDIO_STREAM_ARRAY=$s
10869                 if eval $compile; then
10870                         case "`./try$exe_ext`" in
10871                         yes)    stdio_stream_array=$s; break ;;
10872                         esac
10873                 fi
10874         done
10875         $rm -f try.* try$exe_ext
10876 esac
10877 case "$stdio_stream_array" in
10878 '')     $cat >&4 <<EOM
10879 I can't figure out how to access stdio streams by file descriptor number.
10880 EOM
10881         d_stdio_stream_array="$undef"
10882         ;;
10883 *)      $cat >&4 <<EOM
10884 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10885 EOM
10886         d_stdio_stream_array="$define"
10887         ;;
10888 esac
10889
10890 : see if strcoll exists
10891 set strcoll d_strcoll
10892 eval $inlibc
10893
10894 : check for structure copying
10895 echo " "
10896 echo "Checking to see if your C compiler can copy structs..." >&4
10897 $cat >try.c <<'EOCP'
10898 int main()
10899 {
10900         struct blurfl {
10901                 int dyick;
10902         } foo, bar;
10903
10904         foo = bar;
10905 }
10906 EOCP
10907 if $cc -c try.c >/dev/null 2>&1 ; then
10908         val="$define"
10909         echo "Yup, it can."
10910 else
10911         val="$undef"
10912         echo "Nope, it can't."
10913 fi
10914 set d_strctcpy
10915 eval $setvar
10916 $rm -f try.*
10917
10918 : see if strerror and/or sys_errlist[] exist
10919 echo " "
10920 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10921     if set strerror val -f d_strerror; eval $csym; $val; then
10922                 echo 'strerror() found.' >&4
10923                 d_strerror="$define"
10924                 d_strerrm='strerror(e)'
10925                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10926                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10927                         d_syserrlst="$define"
10928                 else
10929                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10930                         d_syserrlst="$undef"
10931                 fi
10932     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10933                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10934                 echo 'strerror() found in string header.' >&4
10935                 d_strerror="$define"
10936                 d_strerrm='strerror(e)'
10937                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10938                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10939                                 d_syserrlst="$define"
10940                 else
10941                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10942                         d_syserrlst="$undef"
10943                 fi
10944     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10945                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10946                 d_strerror="$undef"
10947                 d_syserrlst="$define"
10948                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10949     else
10950                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10951                 d_strerror="$undef"
10952                 d_syserrlst="$undef"
10953                 d_strerrm='"unknown"'
10954     fi
10955 fi
10956
10957 : see if strtod exists
10958 set strtod d_strtod
10959 eval $inlibc
10960
10961 : see if strtol exists
10962 set strtol d_strtol
10963 eval $inlibc
10964
10965 : see if strtold exists
10966 set strtold d_strtold
10967 eval $inlibc
10968
10969 : see if strtoll exists
10970 set strtoll d_strtoll
10971 eval $inlibc
10972
10973 : see if strtoul exists
10974 set strtoul d_strtoul
10975 eval $inlibc
10976
10977 : see if strtoull exists
10978 set strtoull d_strtoull
10979 eval $inlibc
10980
10981 : see if strtouq exists
10982 set strtouq d_strtouq
10983 eval $inlibc
10984
10985 : see if strxfrm exists
10986 set strxfrm d_strxfrm
10987 eval $inlibc
10988
10989 : see if symlink exists
10990 set symlink d_symlink
10991 eval $inlibc
10992
10993 : see if syscall exists
10994 set syscall d_syscall
10995 eval $inlibc
10996
10997 : see if sysconf exists
10998 set sysconf d_sysconf
10999 eval $inlibc
11000
11001 : see if system exists
11002 set system d_system
11003 eval $inlibc
11004
11005 : see if tcgetpgrp exists
11006 set tcgetpgrp d_tcgetpgrp
11007 eval $inlibc
11008
11009 : see if tcsetpgrp exists
11010 set tcsetpgrp d_tcsetpgrp
11011 eval $inlibc
11012
11013 : see if prototype for telldir is available
11014 echo " "
11015 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11016 eval $hasproto
11017
11018 : see if this is a sys/times.h system
11019 set sys/times.h i_systimes
11020 eval $inhdr
11021
11022 : see if times exists
11023 echo " "
11024 if set times val -f d_times; eval $csym; $val; then
11025         echo 'times() found.' >&4
11026         d_times="$define"
11027         inc=''
11028         case "$i_systimes" in
11029         "$define") inc='sys/times.h';;
11030         esac
11031         rp="What is the type returned by times() on this system?"
11032         set clock_t clocktype long stdio.h sys/types.h $inc
11033         eval $typedef_ask
11034 else
11035         echo 'times() NOT found, hope that will do.' >&4
11036         d_times="$undef"
11037         clocktype='int'
11038 fi
11039
11040 : see if truncate exists
11041 set truncate d_truncate
11042 eval $inlibc
11043
11044 : see if tzname[] exists
11045 echo " "
11046 if set tzname val -a d_tzname; eval $csym; $val; then
11047         val="$define"
11048         echo 'tzname[] found.' >&4
11049 else
11050         val="$undef"
11051         echo 'tzname[] NOT found.' >&4
11052 fi
11053 set d_tzname
11054 eval $setvar
11055
11056 : see if umask exists
11057 set umask d_umask
11058 eval $inlibc
11059
11060 : see if ustat exists
11061 set ustat d_ustat
11062 eval $inlibc
11063
11064 : backward compatibility for d_hvfork
11065 if test X$d_hvfork != X; then
11066         d_vfork="$d_hvfork"
11067         d_hvfork=''
11068 fi
11069 : see if there is a vfork
11070 val=''
11071 set vfork val
11072 eval $inlibc
11073
11074 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11075 : perl on Solaris 2.x, and probably elsewhere.
11076 case "$val" in
11077 $define)
11078         echo " "
11079         case "$usevfork" in
11080         false) dflt='n';;
11081         *) dflt='y';;
11082         esac
11083         cat <<'EOM'
11084  
11085 Perl can only use a vfork() that doesn't suffer from strict
11086 restrictions on calling functions or modifying global data in
11087 the child.  For example, glibc-2.1 contains such a vfork()
11088 that is unsuitable.  If your system provides a proper fork()
11089 call, chances are that you do NOT want perl to use vfork().
11090
11091 EOM
11092         rp="Do you still want to use vfork()?"
11093         . ./myread
11094         case "$ans" in
11095         y|Y) ;;
11096         *)
11097                 echo "Ok, we won't use vfork()."
11098                 val="$undef"
11099                 ;;
11100         esac
11101         ;;
11102 esac
11103 set d_vfork
11104 eval $setvar
11105 case "$d_vfork" in
11106 $define) usevfork='true';;
11107 *) usevfork='false';;
11108 esac
11109
11110 : see if this is an sysdir system
11111 set sys/dir.h i_sysdir
11112 eval $inhdr
11113
11114 : see if this is an sysndir system
11115 set sys/ndir.h i_sysndir
11116 eval $inhdr
11117
11118 : see if closedir exists
11119 set closedir d_closedir
11120 eval $inlibc
11121
11122 case "$d_closedir" in
11123 "$define")
11124         echo " "
11125         echo "Checking whether closedir() returns a status..." >&4
11126         cat > closedir.c <<EOM
11127 #$i_dirent I_DIRENT             /**/
11128 #$i_sysdir I_SYS_DIR            /**/
11129 #$i_sysndir I_SYS_NDIR          /**/
11130 #$i_systypes I_SYS_TYPES        /**/
11131
11132 #if defined(I_SYS_TYPES)
11133 #include <sys/types.h>
11134 #endif
11135 #if defined(I_DIRENT)
11136 #include <dirent.h>
11137 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11138 #include <sys/dir.h>
11139 #endif
11140 #else
11141 #ifdef I_SYS_NDIR
11142 #include <sys/ndir.h>
11143 #else
11144 #ifdef I_SYS_DIR
11145 #ifdef hp9000s500
11146 #include <ndir.h>       /* may be wrong in the future */
11147 #else
11148 #include <sys/dir.h>
11149 #endif
11150 #endif
11151 #endif
11152 #endif 
11153 int main() { return closedir(opendir(".")); }
11154 EOM
11155         set closedir
11156         if eval $compile_ok; then
11157                 if ./closedir > /dev/null 2>&1 ; then
11158                         echo "Yes, it does."
11159                         val="$undef"
11160                 else
11161                         echo "No, it doesn't."
11162                         val="$define"
11163                 fi
11164         else
11165                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11166                 val="$define"
11167         fi
11168         ;;
11169 *)
11170         val="$undef";
11171         ;;
11172 esac
11173 set d_void_closedir
11174 eval $setvar
11175 $rm -f closedir*
11176 : check for volatile keyword
11177 echo " "
11178 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11179 $cat >try.c <<'EOCP'
11180 int main()
11181 {
11182         typedef struct _goo_struct goo_struct;
11183         goo_struct * volatile goo = ((goo_struct *)0);
11184         struct _goo_struct {
11185                 long long_int;
11186                 int reg_int;
11187                 char char_var;
11188         };
11189         typedef unsigned short foo_t;
11190         char *volatile foo;
11191         volatile int bar;
11192         volatile foo_t blech;
11193         foo = foo;
11194 }
11195 EOCP
11196 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11197         val="$define"
11198         echo "Yup, it does."
11199 else
11200         val="$undef"
11201         echo "Nope, it doesn't."
11202 fi
11203 set d_volatile
11204 eval $setvar
11205 $rm -f try.*
11206
11207 : see if there is a wait4
11208 set wait4 d_wait4
11209 eval $inlibc
11210
11211 : see if waitpid exists
11212 set waitpid d_waitpid
11213 eval $inlibc
11214
11215 : see if wcstombs exists
11216 set wcstombs d_wcstombs
11217 eval $inlibc
11218
11219 : see if wctomb exists
11220 set wctomb d_wctomb
11221 eval $inlibc
11222
11223 : preserve RCS keywords in files with variable substitution, grrr
11224 Date='$Date'
11225 Id='$Id'
11226 Log='$Log'
11227 RCSfile='$RCSfile'
11228 Revision='$Revision'
11229
11230 case "$crosscompile" in
11231 ''|[nN]*) crosscompile="$undef" ;;
11232 esac
11233
11234 case "$osname" in
11235 next|rhapsody) multiarch="$define" ;;
11236 esac
11237 case "$multiarch" in
11238 ''|[nN]*) multiarch="$undef" ;;
11239 esac
11240
11241 : check for alignment requirements
11242 echo " "
11243 case "$crosscompile$multiarch" in
11244 *$define*)
11245         $cat <<EOM
11246 You seem to be either cross-compiling or doing a multiarchitecture build,
11247 skipping the memory alignment check.
11248
11249 EOM
11250         case "$alignbytes" in
11251         '') alignbytes=8 ;;
11252         esac
11253         ;;
11254 *)
11255         case "$alignbytes" in
11256         '') echo "Checking alignment constraints..." >&4
11257                 $cat >try.c <<'EOCP'
11258 #include <stdio.h>
11259 struct foobar {
11260         char foo;
11261         double bar;
11262 } try_algn;
11263 int main()
11264 {
11265     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11266     return(0);
11267 }
11268 EOCP
11269                 set try
11270                 if eval $compile_ok; then
11271                         dflt=`./try`
11272                 else
11273                         dflt='8'
11274                         echo "(I can't seem to compile the test program...)"
11275                 fi
11276                 ;;
11277         *) dflt="$alignbytes"
11278                 ;;
11279         esac
11280         rp="Doubles must be aligned on a how-many-byte boundary?"
11281         . ./myread
11282         alignbytes="$ans"
11283         $rm -f try.c try
11284         ;;
11285 esac
11286
11287
11288 : check for ordering of bytes in a long
11289 echo " "
11290 case "$crosscompile$multiarch" in
11291 *$define*)
11292         $cat <<EOM
11293 You seem to be either cross-compiling or doing a multiarchitecture build,
11294 skipping the byteorder check.
11295
11296 EOM
11297         byteorder='0xffff'
11298         ;;
11299 *)
11300         case "$byteorder" in
11301         '')
11302                 $cat <<'EOM'
11303 In the following, larger digits indicate more significance.  A big-endian
11304 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11305 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11306 machines may have weird orders like 3412.  A Cray will report 87654321,
11307 an Alpha will report 12345678. If the test program works the default is
11308 probably right.
11309 I'm now running the test program...
11310 EOM
11311                 $cat >try.c <<'EOCP'
11312 #include <stdio.h>
11313 int main()
11314 {
11315         int i;
11316         union {
11317                 unsigned long l;
11318                 char c[sizeof(long)];
11319         } u;
11320
11321         if (sizeof(long) > 4)
11322                 u.l = (0x08070605L << 32) | 0x04030201L;
11323         else
11324                 u.l = 0x04030201L;
11325         for (i = 0; i < sizeof(long); i++)
11326                 printf("%c", u.c[i]+'0');
11327         printf("\n");
11328         exit(0);
11329 }
11330 EOCP
11331                 xxx_prompt=y
11332                 set try
11333                 if eval $compile && ./try > /dev/null; then
11334                         dflt=`./try`
11335                         case "$dflt" in
11336                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11337                                 echo "(The test program ran ok.)"
11338                                 echo "byteorder=$dflt"
11339                                 xxx_prompt=n
11340                         ;;
11341                         ????|????????) echo "(The test program ran ok.)" ;;
11342                         *) echo "(The test program didn't run right for some reason.)" ;;
11343                         esac
11344                 else
11345                         dflt='4321'
11346                         cat <<'EOM'
11347 (I can't seem to compile the test program.  Guessing big-endian...)
11348 EOM
11349                 fi
11350                 case "$xxx_prompt" in
11351                 y)
11352                         rp="What is the order of bytes in a long?"
11353                         . ./myread
11354                         byteorder="$ans"
11355                         ;;
11356                 *)      byteorder=$dflt
11357                         ;;
11358                 esac
11359                 ;;
11360         esac
11361         $rm -f try.c try
11362         ;;
11363 esac
11364
11365
11366 : how do we catenate cpp tokens here?
11367 echo " "
11368 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11369 $cat >cpp_stuff.c <<'EOCP'
11370 #define RCAT(a,b)a/**/b
11371 #define ACAT(a,b)a ## b
11372 RCAT(Rei,ser)
11373 ACAT(Cir,cus)
11374 EOCP
11375 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11376 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11377         echo "Oh!  Smells like ANSI's been here." >&4
11378         echo "We can catify or stringify, separately or together!"
11379         cpp_stuff=42
11380 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11381         echo "Ah, yes!  The good old days!" >&4
11382         echo "However, in the good old days we don't know how to stringify and"
11383         echo "catify at the same time."
11384         cpp_stuff=1
11385 else
11386         $cat >&4 <<EOM
11387 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11388 to have to edit the values of CAT[2-5] in config.h...
11389 EOM
11390         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11391 fi
11392 $rm -f cpp_stuff.*
11393
11394 : see if this is a db.h system
11395 set db.h i_db
11396 eval $inhdr
11397
11398 case "$i_db" in
11399 $define)
11400         : Check db version.
11401         echo " "
11402         echo "Checking Berkeley DB version ..." >&4
11403         $cat >try.c <<EOCP
11404 #$d_const HASCONST
11405 #ifndef HASCONST
11406 #define const
11407 #endif
11408 #include <sys/types.h>
11409 #include <stdio.h>
11410 #include <db.h>
11411 int main()
11412 {
11413 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11414     int Major, Minor, Patch ;
11415     unsigned long Version ;
11416     (void)db_version(&Major, &Minor, &Patch) ;
11417     printf("You have Berkeley DB Version 2 or greater\n");
11418
11419     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11420                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11421     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11422                 Major, Minor, Patch) ;
11423
11424     /* check that db.h & libdb are compatible */
11425     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11426         printf("db.h and libdb are incompatible\n") ;
11427         exit(3);        
11428     }
11429
11430     printf("db.h and libdb are compatible\n") ;
11431
11432     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11433                 + DB_VERSION_PATCH ;
11434
11435     /* needs to be >= 2.3.4 */
11436     if (Version < 2003004) {
11437     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11438         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11439         exit(2);        
11440     }
11441
11442     exit(0);
11443 #else
11444 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11445     printf("You have Berkeley DB Version 1\n");
11446     exit(0);    /* DB version < 2: the coast is clear. */
11447 #else
11448     exit(1);    /* <db.h> not Berkeley DB? */
11449 #endif
11450 #endif
11451 }
11452 EOCP
11453         set try
11454         if eval $compile_ok && ./try; then
11455                 echo 'Looks OK.' >&4
11456         else
11457                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11458                 i_db=$undef
11459                 case " $libs " in
11460                 *"-ldb "*)
11461                         : Remove db from list of libraries to use
11462                         echo "Removing unusable -ldb from library list" >&4
11463                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11464                         shift
11465                         libs="$*"
11466                         echo "libs = $libs" >&4
11467                         ;;
11468                 esac
11469         fi
11470         $rm -f try.*
11471         ;;
11472 esac
11473
11474 case "$i_db" in
11475 define)
11476         : Check the return type needed for hash 
11477         echo " "
11478         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11479         $cat >try.c <<EOCP
11480 #$d_const HASCONST
11481 #ifndef HASCONST
11482 #define const
11483 #endif
11484 #include <sys/types.h>
11485 #include <db.h>
11486
11487 #ifndef DB_VERSION_MAJOR
11488 u_int32_t hash_cb (ptr, size)
11489 const void *ptr;
11490 size_t size;
11491 {
11492 }
11493 HASHINFO info;
11494 int main()
11495 {
11496         info.hash = hash_cb;
11497 }
11498 #endif
11499 EOCP
11500         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11501                 if $contains warning try.out >>/dev/null 2>&1 ; then
11502                         db_hashtype='int'
11503                 else
11504                         db_hashtype='u_int32_t'
11505                 fi
11506         else
11507                 : XXX Maybe we should just give up here.
11508                 db_hashtype=u_int32_t
11509                 $cat try.out >&4
11510                 echo "Help:  I can't seem to compile the db test program." >&4
11511                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11512         fi
11513         $rm -f try.*
11514         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11515         ;;
11516 *)      db_hashtype=u_int32_t
11517         ;;
11518 esac
11519 case "$i_db" in
11520 define)
11521         : Check the return type needed for prefix 
11522         echo " "
11523         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11524         cat >try.c <<EOCP
11525 #$d_const HASCONST
11526 #ifndef HASCONST
11527 #define const
11528 #endif
11529 #include <sys/types.h>
11530 #include <db.h>
11531
11532 #ifndef DB_VERSION_MAJOR
11533 size_t prefix_cb (key1, key2)
11534 const DBT *key1;
11535 const DBT *key2;
11536 {
11537 }
11538 BTREEINFO info;
11539 int main()
11540 {
11541         info.prefix = prefix_cb;
11542 }
11543 #endif
11544 EOCP
11545         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11546                 if $contains warning try.out >>/dev/null 2>&1 ; then
11547                         db_prefixtype='int'
11548                 else
11549                         db_prefixtype='size_t'
11550                 fi
11551         else
11552                 db_prefixtype='size_t'
11553                 : XXX Maybe we should just give up here.
11554                 $cat try.out >&4
11555                 echo "Help:  I can't seem to compile the db test program." >&4
11556                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11557         fi
11558         $rm -f try.*
11559         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11560         ;;
11561 *)      db_prefixtype='size_t'
11562         ;;
11563 esac
11564
11565 : check for void type
11566 echo " "
11567 echo "Checking to see how well your C compiler groks the void type..." >&4
11568 case "$voidflags" in
11569 '')
11570         $cat >try.c <<'EOCP'
11571 #if TRY & 1
11572 void sub() {
11573 #else
11574 sub() {
11575 #endif
11576         extern void moo();      /* function returning void */
11577         void (*goo)();          /* ptr to func returning void */
11578 #if TRY & 8
11579         void *hue;              /* generic ptr */
11580 #endif
11581 #if TRY & 2
11582         void (*foo[10])();
11583 #endif
11584
11585 #if TRY & 4
11586         if(goo == moo) {
11587                 exit(0);
11588         }
11589 #endif
11590         exit(0);
11591 }
11592 int main() { sub(); }
11593 EOCP
11594         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11595                 voidflags=$defvoidused
11596         echo "Good.  It appears to support void to the level $package wants.">&4
11597                 if $contains warning .out >/dev/null 2>&1; then
11598                         echo "However, you might get some warnings that look like this:"
11599                         $cat .out
11600                 fi
11601         else
11602 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11603                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11604                         echo "It supports 1..."
11605                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11606                                 echo "It also supports 2..."
11607                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11608                                         voidflags=7
11609                                         echo "And it supports 4 but not 8 definitely."
11610                                 else
11611                                         echo "It doesn't support 4..."
11612                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11613                                                 voidflags=11
11614                                                 echo "But it supports 8."
11615                                         else
11616                                                 voidflags=3
11617                                                 echo "Neither does it support 8."
11618                                         fi
11619                                 fi
11620                         else
11621                                 echo "It does not support 2..."
11622                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11623                                         voidflags=13
11624                                         echo "But it supports 4 and 8."
11625                                 else
11626                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11627                                                 voidflags=5
11628                                                 echo "And it supports 4 but has not heard about 8."
11629                                         else
11630                                                 echo "However it supports 8 but not 4."
11631                                         fi
11632                                 fi
11633                         fi
11634                 else
11635                         echo "There is no support at all for void."
11636                         voidflags=0
11637                 fi
11638         fi
11639 esac
11640 case "$voidflags" in
11641 "$defvoidused") ;;
11642 *)      $cat >&4 <<'EOM'
11643   Support flag bits are:
11644     1: basic void declarations.
11645     2: arrays of pointers to functions returning void.
11646     4: operations between pointers to and addresses of void functions.
11647     8: generic void pointers.
11648 EOM
11649         dflt="$voidflags";
11650         rp="Your void support flags add up to what?"
11651         . ./myread
11652         voidflags="$ans"
11653         ;;
11654 esac
11655 $rm -f try.* .out
11656
11657
11658 : How can we generate normalized random numbers ?
11659 echo " "
11660 echo "Looking for a random number function..." >&4
11661 case "$randfunc" in
11662 '')
11663         if set drand48 val -f; eval $csym; $val; then
11664                 dflt="drand48"
11665                 echo "Good, found drand48()." >&4
11666         elif set random val -f; eval $csym; $val; then
11667                 dflt="random"
11668                 echo "OK, found random()." >&4
11669         else
11670                 dflt="rand"
11671                 echo "Yick, looks like I have to use rand()." >&4
11672         fi
11673         echo " "
11674         ;;
11675 *)
11676         dflt="$randfunc"
11677         ;;
11678 esac
11679 cont=true
11680
11681 case "$ccflags" in
11682 *-Dmy_rand=*|*-Dmy_srand=*)
11683         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11684         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11685         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11686         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11687         ;;
11688 esac
11689
11690 while $test "$cont"; do
11691         rp="Use which function to generate random numbers?"
11692         . ./myread
11693         if $test "$ans" = "$dflt"; then
11694                 : null
11695         else
11696                 randbits=''
11697         fi
11698         randfunc="$ans"
11699         if set $ans val -f; eval $csym; $val; then
11700                 cont=''
11701         else
11702                 dflt=y
11703                 rp="I cannot find function $ans. Use that name anyway?"
11704                 . ./myread
11705                 dflt=rand
11706                 case "$ans" in
11707                         [yY]*) cont='';;
11708                 esac
11709         fi
11710         case "$cont" in
11711         '')
11712                 case "$randfunc" in
11713                 drand48)
11714                         drand01="drand48()"
11715                         seedfunc="srand48"
11716                         randbits=48
11717                         randseedtype=long
11718                         ;;
11719                 rand|random)
11720                         case "$randbits" in
11721                         '')
11722 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11723                                 $cat >try.c <<EOCP
11724 #$i_unistd I_UNISTD
11725 #$i_stdlib I_STDLIB
11726 #include <stdio.h>
11727 #ifdef I_UNISTD
11728 #  include <unistd.h>
11729 #endif
11730 #ifdef I_STDLIB
11731 #  include <stdlib.h>
11732 #endif
11733 int main()
11734 {
11735         register int i;
11736         register unsigned long tmp;
11737         register unsigned long max = 0L;
11738
11739         for (i = 1000; i; i--) {
11740                 tmp = (unsigned long) $randfunc();
11741                 if (tmp > max) max = tmp;
11742         }
11743         for (i = 0; max; i++)
11744                 max /= 2;
11745         printf("%d\n",i);
11746 }
11747 EOCP
11748                                 set try
11749                                 if eval $compile_ok; then
11750                                         dflt=`try`
11751                                 else
11752                                         dflt='?'
11753                                         echo "(I can't seem to compile the test program...)"
11754                                 fi
11755                                 ;;
11756                         *)
11757                                 dflt="$randbits"
11758                                 ;;
11759                         esac
11760                         rp="How many bits does your $randfunc() function produce?"
11761                         . ./myread
11762                         randbits="$ans"
11763                         $rm -f try.c try
11764                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11765                         seedfunc="s$randfunc"
11766                         randseedtype=unsigned
11767                         ;;
11768                 *)
11769                         dflt="31"
11770                         rp="How many bits does your $randfunc() function produce?"
11771                         . ./myread
11772                         randbits="$ans"
11773                         seedfunc="s$randfunc"
11774                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11775                         if set $seedfunc val -f; eval $csym; $val; then
11776                                 echo "(Using $seedfunc() to seed random generator)"
11777                         else
11778                                 echo "(Warning: no $seedfunc() to seed random generator)"
11779                                 seedfunc=rand
11780                         fi
11781                         randseedtype=unsigned
11782                         ;;
11783                 esac
11784                 ;;
11785         esac
11786 done
11787
11788 echo " "
11789 echo "Determining whether or not we are on an EBCDIC system..." >&4
11790 $cat >tebcdic.c <<'EOM'
11791 int main()
11792 {
11793   if ('M'==0xd4) return 0;
11794   return 1;
11795 }
11796 EOM
11797
11798 val=$undef
11799 set tebcdic
11800 if eval $compile_ok; then
11801         if ./tebcdic; then
11802                 echo "You have EBCDIC." >&4
11803                 val="$define"
11804         else
11805                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11806         fi
11807 else
11808         echo "I'm unable to compile the test program." >&4
11809         echo "I'll assume ASCII or some ISO Latin." >&4
11810 fi
11811 $rm -f tebcdic.c tebcdic
11812 set ebcdic
11813 eval $setvar
11814
11815 echo " "
11816 $cat >&4 <<EOM
11817 Checking how to flush all pending stdio output...
11818 EOM
11819 # I only know how to find the first 32 possibly open files on SunOS.
11820 # See also hints/sunos_4_1.sh and util.c  --AD
11821 case "$osname" in
11822 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11823 esac
11824 $cat >>try.c <<EOCP
11825 #include <stdio.h>
11826 #$i_unistd I_UNISTD
11827 #ifdef I_UNISTD
11828 # include <unistd.h>
11829 #endif
11830 #$d_sysconf HAS_SYSCONF
11831 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11832 #ifdef HAS_STDIO_STREAM_ARRAY
11833 # define STDIO_STREAM_ARRAY $stdio_stream_array
11834 #endif
11835 int main() {
11836   FILE* p = fopen("try.out", "w");
11837 #ifdef TRY_FPUTC
11838   fputc('x', p);
11839 #else
11840 # ifdef TRY_FPRINTF
11841   fprintf(p, "x");
11842 # endif
11843 #endif
11844 #ifdef TRY_FFLUSH_NULL
11845   fflush(NULL);
11846 #endif
11847 #ifdef TRY_FFLUSH_ALL
11848   {
11849     long open_max = -1;
11850 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11851     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11852 # else
11853 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11854     open_max = sysconf(_SC_OPEN_MAX);
11855 #  else
11856 #   ifdef FOPEN_MAX
11857     open_max = FOPEN_MAX;
11858 #   else
11859 #    ifdef OPEN_MAX
11860     open_max = OPEN_MAX;
11861 #    else
11862 #     ifdef _NFILE
11863     open_max = _NFILE;
11864 #     endif
11865 #    endif
11866 #   endif
11867 #  endif
11868 # endif 
11869 # ifdef HAS_STDIO_STREAM_ARRAY
11870     if (open_max > 0) {
11871       long i;
11872       for (i = 0; i < open_max; i++)
11873             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11874                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11875                 STDIO_STREAM_ARRAY[i]._flag)
11876                 fflush(&STDIO_STREAM_ARRAY[i]);
11877     }   
11878   }
11879 # endif
11880 #endif
11881   _exit(42);
11882 }
11883 EOCP
11884 : first we have to find out how _not_ to flush
11885 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11886     output=''
11887     set try -DTRY_FPUTC
11888     if eval $compile; then
11889             $rm -f try.out
11890             ./try$exe_ext 2>/dev/null
11891             if $test ! -s try.out -a "X$?" = X42; then
11892                 output=-DTRY_FPUTC
11893             fi
11894     fi
11895     case "$output" in
11896     '')
11897             set try -DTRY_FPRINTF
11898             $rm -f try.out
11899             if eval $compile; then
11900                     $rm -f try.out
11901                     ./try$exe_ext 2>/dev/null
11902                     if $test ! -s try.out -a "X$?" = X42; then
11903                         output=-DTRY_FPRINTF
11904                     fi
11905             fi
11906         ;;
11907     esac
11908 fi
11909 : check for fflush NULL behaviour
11910 case "$fflushNULL" in
11911 '')     set try -DTRY_FFLUSH_NULL $output
11912         if eval $compile; then
11913                 $rm -f try.out
11914                 ./try$exe_ext 2>/dev/null
11915                 code="$?"
11916                 if $test -s try.out -a "X$code" = X42; then
11917                         fflushNULL="`$cat try.out`"
11918                 else
11919                         if $test "X$code" != X42; then
11920                                 $cat >&4 <<EOM
11921 (If this test failed, don't worry, we'll try another method shortly.)
11922 EOM
11923                         fi
11924                 fi
11925         fi
11926         $rm -f core try.core core.try.*
11927         case "$fflushNULL" in
11928         x)      $cat >&4 <<EOM
11929 Your fflush(NULL) works okay.
11930 EOM
11931                 fflushNULL="$define"
11932                 ;;
11933         '')     $cat >&4 <<EOM
11934 Your fflush(NULL) isn't working (contrary to ANSI C).
11935 EOM
11936                 fflushNULL="$undef"
11937                 ;;
11938         *)      $cat >&4 <<EOM
11939 Cannot figure out whether your fflush(NULL) works or not.
11940 I'm assuming it doesn't (contrary to ANSI C).
11941 EOM
11942                 fflushNULL="$undef"
11943                 ;;
11944         esac
11945         ;;
11946 $define|true|[yY]*)
11947         fflushNULL="$define"
11948         ;;
11949 *)
11950         fflushNULL="$undef"
11951         ;;
11952 esac
11953 : check explicit looping only if NULL did not work
11954 case "$fflushNULL" in
11955 "$undef")
11956         : check for fflush all behaviour
11957         case "$fflushall" in
11958         '')     set try -DTRY_FFLUSH_ALL $output
11959                 if eval $compile; then
11960                         $cat >&4 <<EOM
11961 (Now testing the other method--but note that also this may fail.)
11962 EOM
11963                         $rm -f try.out
11964                         ./try$exe_ext 2>/dev/null
11965                         if $test -s try.out -a "X$?" = X42; then
11966                                 fflushall="`$cat try.out`"
11967                         fi
11968                 fi
11969                 $rm -f core try.core core.try.*
11970                 case "$fflushall" in
11971                 x)      $cat >&4 <<EOM
11972 Whew. Flushing explicitly all the stdio streams works.
11973 EOM
11974                         fflushall="$define"
11975                         ;;
11976                 '')     $cat >&4 <<EOM
11977 Sigh. Flushing explicitly all the stdio streams doesn't work.
11978 EOM
11979                         fflushall="$undef"
11980                         ;;
11981                 *)      $cat >&4 <<EOM
11982 Cannot figure out whether flushing stdio streams explicitly works or not.
11983 I'm assuming it doesn't.
11984 EOM
11985                         fflushall="$undef"
11986                         ;;
11987                 esac
11988                 ;;
11989         "$define"|true|[yY]*)
11990                 fflushall="$define"
11991                 ;;
11992         *)
11993                 fflushall="$undef"
11994                 ;;
11995         esac
11996         ;;
11997 *)      fflushall="$undef"      
11998         ;;
11999 esac
12000 case "$fflushNULL$fflushall" in
12001 undefundef)
12002         $cat <<EOM
12003 I cannot figure out how to flush pending stdio output.
12004 EOM
12005         ;;
12006 esac
12007 $rm -f try.* try$exe_ext
12008
12009 : Store the full pathname to the ar program for use in the C program
12010 : Respect a hint or command line value for full_ar.
12011 case "$full_ar" in
12012 '') full_ar=$ar ;;
12013 esac
12014
12015 : Store the full pathname to the sed program for use in the C program
12016 full_sed=$sed
12017
12018 : see what type gids are declared as in the kernel
12019 echo " "
12020 echo "Looking for the type for group ids returned by getgid()."
12021 set gid_t gidtype xxx stdio.h sys/types.h
12022 eval $typedef
12023 case "$gidtype" in
12024 xxx)
12025         xxx=`./findhdr sys/user.h`
12026         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12027         case $1 in
12028         unsigned) dflt="$1 $2" ;;
12029         *) dflt="$1" ;;
12030         esac
12031         ;;
12032 *) dflt="$gidtype";;
12033 esac
12034 case "$gidtype" in
12035 gid_t) echo "gid_t found." ;;
12036 *)      rp="What is the type for group ids returned by getgid()?"
12037         . ./myread
12038         gidtype="$ans"
12039         ;;
12040 esac
12041
12042 echo " "
12043 case "$gidtype" in
12044 *_t) zzz="$gidtype"     ;;
12045 *)   zzz="gid"          ;;
12046 esac
12047 echo "Checking the size of $zzz..." >&4 
12048 cat > try.c <<EOCP
12049 #include <sys/types.h>
12050 #include <stdio.h>
12051 int main() {
12052     printf("%d\n", (int)sizeof($gidtype));
12053     exit(0);
12054 }
12055 EOCP
12056 set try
12057 if eval $compile_ok; then
12058         yyy=`./try`
12059         case "$yyy" in
12060         '')     gidsize=4
12061                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12062                 ;;
12063         *)      gidsize=$yyy
12064                 echo "Your $zzz size is $gidsize bytes."
12065                 ;;
12066         esac
12067 else
12068         gidsize=4
12069         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12070 fi
12071
12072
12073 echo " "
12074 case "$gidtype" in
12075 *_t) zzz="$gidtype"     ;;
12076 *)   zzz="gid"          ;;
12077 esac
12078 echo "Checking the sign of $zzz..." >&4 
12079 cat > try.c <<EOCP
12080 #include <sys/types.h>
12081 #include <stdio.h>
12082 int main() {
12083         $gidtype foo = -1;
12084         if (foo < 0)
12085                 printf("-1\n");
12086         else
12087                 printf("1\n");
12088 }
12089 EOCP
12090 set try
12091 if eval $compile; then
12092         yyy=`./try`
12093         case "$yyy" in
12094         '')     gidsign=1
12095                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12096                 ;;
12097         *)      gidsign=$yyy
12098                 case "$gidsign" in
12099                  1) echo "Your $zzz is unsigned." ;;
12100                 -1) echo "Your $zzz is signed."   ;;
12101                 esac
12102                 ;;
12103         esac
12104 else
12105         gidsign=1
12106         echo "(I can't compile the test program--guessing unsigned.)" >&4
12107 fi
12108
12109
12110 : check for length of character
12111 echo " "
12112 case "$charsize" in
12113 '')
12114         echo "Checking to see how big your characters are (hey, you never know)..." >&4
12115         $cat >try.c <<'EOCP'
12116 #include <stdio.h>
12117 int main()
12118 {
12119     printf("%d\n", (int)sizeof(char));
12120     exit(0);
12121 }
12122 EOCP
12123         set try
12124         if eval $compile_ok; then
12125                 dflt=`./try`
12126         else
12127                 dflt='1'
12128                 echo "(I can't seem to compile the test program.  Guessing...)"
12129         fi
12130         ;;
12131 *)
12132         dflt="$charsize"
12133         ;;
12134 esac
12135 rp="What is the size of a character (in bytes)?"
12136 . ./myread
12137 charsize="$ans"
12138 $rm -f try.c try
12139
12140
12141 echo " "
12142 $echo "Choosing the C types to be used for Perl's internal types..." >&4
12143
12144 case "$use64bits:$d_quad:$quadtype" in
12145 define:define:?*)
12146         ivtype="$quadtype"
12147         uvtype="$uquadtype"
12148         ivsize=8
12149         uvsize=8
12150         ;;
12151 *)      ivtype="long"
12152         uvtype="unsigned long"
12153         ivsize=$longsize
12154         uvsize=$longsize
12155         ;;
12156 esac
12157
12158 case "$uselongdouble:$d_longdbl" in
12159 define:define)
12160         nvtype="long double"
12161         nvsize=$longdblsize
12162         ;;
12163 *)      nvtype=double
12164         nvsize=$doublesize
12165         ;;
12166 esac
12167
12168 echo "(IV will be "$ivtype", $ivsize bytes)"
12169 echo "(UV will be "$uvtype", $uvsize bytes)"
12170 echo "(NV will be "$nvtype", $nvsize bytes)"
12171
12172 $cat >try.c <<EOCP
12173 #$i_inttypes I_INTTYPES
12174 #ifdef I_INTTYPES
12175 #include <inttypes.h>
12176 #endif
12177 #include <stdio.h>
12178 int main() {
12179 #ifdef INT8
12180    int8_t i =  INT8_MAX;
12181   uint8_t u = UINT8_MAX;
12182   printf("int8_t\n");
12183 #endif
12184 #ifdef INT16
12185    int16_t i =  INT16_MAX;
12186   uint16_t i = UINT16_MAX;
12187   printf("int16_t\n");
12188 #endif
12189 #ifdef INT32
12190    int32_t i =  INT32_MAX;
12191   uint32_t u = UINT32_MAX;
12192   printf("int32_t\n");
12193 #endif
12194 }
12195 EOCP
12196
12197 case "$i8type" in
12198 '')     case "$charsize" in
12199         1)      i8type=char
12200                 u8type="unsigned char"
12201                 i8size=$charsize
12202                 u8size=$charsize
12203                 ;;
12204         esac
12205         ;;
12206 esac
12207 case "$i8type" in
12208 '')     set try -DINT8
12209         if eval $compile; then
12210                 case "`./try$exe_ext`" in
12211                 int8_t) i8type=int8_t
12212                         u8type=uint8_t
12213                         i8size=1
12214                         u8size=1
12215                         ;;
12216                 esac
12217         fi
12218         ;;
12219 esac
12220 case "$i8type" in
12221 '')     if $test $charsize -ge 1; then
12222                 i8type=char
12223                 u8type="unsigned char"
12224                 i8size=$charsize
12225                 u8size=$charsize
12226         fi
12227         ;;
12228 esac
12229
12230 case "$i16type" in
12231 '')     case "$shortsize" in
12232         2)      i16type=short
12233                 u16type="unsigned short"
12234                 i16size=$shortsize
12235                 u16size=$shortsize
12236                 ;;
12237         esac
12238         ;;
12239 esac
12240 case "$i16type" in
12241 '')     set try -DINT16
12242         if eval $compile; then
12243                 case "`./try$exe_ext`" in
12244                 int16_t)
12245                         i16type=int16_t
12246                         u16type=uint16_t
12247                         i16size=2
12248                         u16size=2
12249                         ;;
12250                 esac
12251         fi
12252         ;;
12253 esac
12254 case "$i16type" in
12255 '')     if $test $shortsize -ge 2; then
12256                 i16type=short
12257                 u16type="unsigned short"
12258                 i16size=$shortsize
12259                 u16size=$shortsize
12260         fi
12261         ;;
12262 esac
12263
12264 case "$i32type" in
12265 '')     case "$longsize" in
12266         4)      i32type=long
12267                 u32type="unsigned long"
12268                 i32size=$longsize
12269                 u32size=$longsize
12270                 ;;
12271         *)      case "$intsize" in
12272                 4)      i32type=int
12273                         u32type="unsigned int"
12274                         i32size=$intsize
12275                         u32size=$intsize
12276                         ;;
12277                 esac
12278                 ;;
12279         esac
12280         ;;
12281 esac
12282 case "$i32type" in
12283 '')     set try -DINT32
12284         if eval $compile; then
12285                 case "`./try$exe_ext`" in
12286                 int32_t)
12287                         i32type=int32_t
12288                         u32type=uint32_t
12289                         i32size=4
12290                         u32size=4
12291                         ;;
12292                 esac
12293         fi
12294         ;;
12295 esac
12296 case "$i32type" in
12297 '')     if $test $intsize -ge 4; then
12298                 i32type=int
12299                 u32type="unsigned int"
12300                 i32size=$intsize
12301                 u32size=$intsize
12302         fi
12303         ;;
12304 esac
12305
12306 case "$i64type" in
12307 '')     case "$d_quad:$quadtype" in
12308         define:?*)
12309                 i64type="$quadtype"
12310                 u64type="$uquadtype"
12311                 i64size=8
12312                 u64size=8
12313                 ;;
12314         esac
12315         ;;
12316 esac
12317
12318 $rm -f try.* try
12319
12320 echo " "
12321
12322 if $test X"$quadtype" != X; then
12323
12324 echo "Checking how to print 64-bit integers..." >&4
12325
12326 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12327         $cat >try.c <<'EOCP'
12328 #include <sys/types.h>
12329 #include <stdio.h>
12330 int main() {
12331   int q = 12345678901;
12332   printf("%ld\n", q);
12333 }
12334 EOCP
12335         set try
12336         if eval $compile; then
12337                 yyy=`./try$exe_ext`
12338                 case "$yyy" in
12339                 12345678901)
12340                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12341                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12342                         echo "We will use %d."
12343                         ;;
12344                 esac
12345         fi
12346 fi
12347
12348 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12349         $cat >try.c <<'EOCP'
12350 #include <sys/types.h>
12351 #include <stdio.h>
12352 int main() {
12353   long q = 12345678901;
12354   printf("%ld\n", q);
12355 }
12356 EOCP
12357         set try
12358         if eval $compile; then
12359                 yyy=`./try$exe_ext`
12360                 case "$yyy" in
12361                 12345678901)
12362                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12363                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12364                         echo "We will use %ld."
12365                         ;;
12366                 esac
12367         fi
12368 fi
12369
12370 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12371         $cat >try.c <<'EOCP'
12372 #include <sys/types.h>
12373 #include <inttypes.h>
12374 #include <stdio.h>
12375 int main() {
12376   int64_t q = 12345678901;
12377   printf("%" PRId64 "\n", q);
12378 }
12379 EOCP
12380         set try
12381         if eval $compile; then
12382                 yyy=`./try$exe_ext`
12383                 case "$yyy" in
12384                 12345678901)
12385                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12386                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12387                         echo "We will use the C9X style."
12388                         ;;
12389                 esac
12390         fi
12391 fi
12392
12393 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12394         $cat >try.c <<'EOCP'
12395 #include <sys/types.h>
12396 #include <stdio.h>
12397 int main() {
12398   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12399   printf("%lld\n", q);
12400 }
12401 EOCP
12402         set try
12403         if eval $compile; then
12404                 yyy=`./try$exe_ext`
12405                 case "$yyy" in
12406                 12345678901)
12407                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12408                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12409                         echo "We will use the %lld style."
12410                         ;;
12411                 esac
12412         fi
12413 fi
12414
12415 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12416         $cat >try.c <<EOCP
12417 #include <sys/types.h>
12418 #include <stdio.h>
12419 int main() {
12420   $quadtype q = 12345678901;
12421   printf("%Ld\n", q);
12422 }
12423 EOCP
12424         set try
12425         if eval $compile; then
12426                 yyy=`./try$exe_ext`
12427                 case "$yyy" in
12428                 12345678901)
12429                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12430                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12431                         echo "We will use %Ld."
12432                         ;;
12433                 esac
12434         fi
12435 fi
12436
12437 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12438         $cat >try.c <<EOCP
12439 #include <sys/types.h>
12440 #include <stdio.h>
12441 int main() {
12442   $quadtype q = 12345678901;
12443   printf("%qd\n", q);
12444 }
12445 EOCP
12446         set try
12447         if eval $compile; then
12448                 yyy=`./try$exe_ext`
12449                 case "$yyy" in
12450                 12345678901)
12451                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12452                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12453                         echo "We will use %qd."
12454                         ;;
12455                 esac
12456         fi
12457 fi
12458
12459 if $test X"$sPRId64" = X; then
12460         echo "Cannot figure out how to print 64-bit integers." >&4
12461 fi
12462
12463 $rm -f try try.*
12464
12465 fi
12466
12467 case "$sPRId64" in
12468 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12469         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12470         ;;
12471 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12472         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12473         ;;
12474 esac
12475
12476
12477 echo " "
12478 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12479
12480 if $test X"$ivsize" = X8; then
12481         ivdformat="$sPRId64"
12482         uvuformat="$sPRIu64"
12483         uvoformat="$sPRIo64"
12484         uvxformat="$sPRIx64"
12485 else
12486         if $test X"$ivsize" = X"$longsize"; then
12487                 ivdformat='"ld"'
12488                 uvuformat='"lu"'
12489                 uvoformat='"lo"'
12490                 uvxformat='"lx"'
12491         else
12492                 if $test X"$ivsize" = X"$intsize"; then
12493                         ivdformat='"d"'
12494                         uvuformat='"u"'
12495                         uvoformat='"o"'
12496                         uvxformat='"x"'
12497                 else
12498                         : far out
12499                         if $test X"$ivsize" = X"$shortsize"; then
12500                                 ivdformat='"hd"'
12501                                 uvuformat='"hu"'
12502                                 uvoformat='"ho"'
12503                                 uvxformat='"hx"'
12504                         fi
12505                 fi
12506         fi
12507 fi
12508
12509 case "$ivdformat" in
12510 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12511     exit 1
12512     ;;
12513 esac
12514
12515
12516 echo " "
12517 $echo "Checking the format string to be used for gids..." >&4
12518
12519 case "$gidsign" in
12520 -1)     if $test X"$gidsize" = X"$ivsize"; then
12521                 gidformat="$ivdformat"
12522         else
12523                 if $test X"$gidsize" = X"$longsize"; then
12524                         gidformat='"ld"'
12525                 else
12526                         if $test X"$gidsize" = X"$intsize"; then
12527                                 gidformat='"d"'
12528                         else
12529                                 if $test X"$gidsize" = X"$shortsize"; then
12530                                         gidformat='"hd"'
12531                                 fi
12532                         fi
12533                 fi
12534         fi
12535         ;;
12536 *)      if $test X"$gidsize" = X"$uvsize"; then
12537                 gidformat="$uvuformat"
12538         else
12539                 if $test X"$gidsize" = X"$longsize"; then
12540                         gidformat='"lu"'
12541                 else
12542                         if $test X"$gidsize" = X"$intsize"; then
12543                                 gidformat='"u"'
12544                         else
12545                                 if $test X"$gidsize" = X"$shortsize"; then
12546                                         gidformat='"hu"'
12547                                 fi
12548                         fi
12549                 fi
12550         fi
12551         ;;
12552 esac
12553
12554 : see if getgroups exists
12555 set getgroups d_getgrps
12556 eval $inlibc
12557
12558 : see if setgroups exists
12559 set setgroups d_setgrps
12560 eval $inlibc
12561
12562
12563 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12564 echo " "
12565 case "$d_getgrps$d_setgrps" in
12566 *define*)
12567         case "$groupstype" in
12568         '') dflt="$gidtype" ;;
12569         *)  dflt="$groupstype" ;;
12570         esac
12571         $cat <<EOM
12572 What type of pointer is the second argument to getgroups() and setgroups()?
12573 Usually this is the same as group ids, $gidtype, but not always.
12574
12575 EOM
12576         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12577         . ./myread
12578         groupstype="$ans"
12579         ;;
12580 *)  groupstype="$gidtype";;
12581 esac
12582
12583 echo " "
12584 echo "Checking if your $make program sets \$(MAKE)..." >&4
12585 case "$make_set_make" in
12586 '')
12587         $sed 's/^X //' > testmake.mak << 'EOF'
12588 Xall:
12589 X       @echo 'maketemp="$(MAKE)"'
12590 EOF
12591         case "`$make -f testmake.mak 2>/dev/null`" in
12592         *maketemp=*) make_set_make='#' ;;
12593         *)      make_set_make="MAKE=$make" ;;
12594         esac
12595         $rm -f testmake.mak
12596         ;;
12597 esac
12598 case "$make_set_make" in
12599 '#') echo "Yup, it does.";;
12600 *) echo "Nope, it doesn't.";;
12601 esac
12602
12603 : see what type is used for mode_t
12604 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12605 set mode_t modetype int stdio.h sys/types.h
12606 eval $typedef_ask
12607
12608 : define a fucntion to check prototypes
12609 $cat > protochk <<EOSH
12610 $startsh
12611 cc="$cc"
12612 optimize="$optimize"
12613 ccflags="$ccflags"
12614 prototype="$prototype"
12615 define="$define"
12616 rm=$rm
12617 EOSH
12618
12619 $cat >> protochk <<'EOSH'
12620
12621 $rm -f try.c
12622 foo="$1"
12623 shift
12624 while test $# -ge 2; do
12625         case "$1" in
12626                 $define) echo "#include <$2>" >> try.c ;;
12627                 literal) echo "$2" >> try.c ;;
12628         esac
12629     shift 2
12630 done
12631 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12632 cat >> try.c <<'EOCP'
12633 #ifdef CAN_PROTOTYPE
12634 #define _(args) args
12635 #else
12636 #define _(args) ()
12637 #endif
12638 EOCP
12639 echo "$foo" >> try.c
12640 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12641 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12642 status=$?
12643 $rm -f try.[co]
12644 exit $status
12645 EOSH
12646 chmod +x protochk
12647 $eunicefix protochk
12648
12649 : see what type is used for size_t
12650 rp="What is the type used for the length parameter for string functions?"
12651 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12652 eval $typedef_ask
12653
12654 : check for type of arguments to gethostbyaddr. 
12655 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12656         case "$d_gethbyaddr" in
12657         $define)
12658                 $cat <<EOM
12659
12660 Checking to see what type of arguments are accepted by gethostbyaddr().
12661 EOM
12662                 hdrs="$define sys/types.h
12663                         $d_socket sys/socket.h 
12664                         $i_niin netinet/in.h 
12665                         $i_netdb netdb.h
12666                         $i_unistd unistd.h"
12667                 : The first arg can 'char *' or 'void *'
12668                 : The second arg is some of integral type
12669                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12670                         for yyy in size_t long int; do
12671                                 case "$netdb_host_type" in
12672                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12673                                         if ./protochk "$try" $hdrs; then
12674                                                 echo "Your system accepts $xxx for the first arg."
12675                                                 echo "...and $yyy for the second arg."
12676                                                 netdb_host_type="$xxx"
12677                                                 netdb_hlen_type="$yyy"
12678                                         fi
12679                                         ;;
12680                                 esac
12681                         done
12682                 done
12683                 : In case none of those worked, prompt the user.
12684                 case "$netdb_host_type" in
12685                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12686                         dflt='char *'
12687                         . ./myread
12688                         netdb_host_type=$ans
12689                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12690                         dflt="$sizetype"
12691                         . ./myread
12692                         netdb_hlen_type=$ans
12693                         ;;
12694                 esac
12695                 ;;
12696         *)      : no gethostbyaddr, so pick harmless defaults
12697                 netdb_host_type='char *'
12698                 netdb_hlen_type="$sizetype"
12699                 ;;
12700         esac
12701         # Remove the "const" if needed. -- but then we'll have a 
12702         # prototype clash!
12703         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12704 fi
12705
12706 : check for type of argument to gethostbyname. 
12707 if test "X$netdb_name_type" = X ; then
12708         case "$d_gethbyname" in
12709         $define)
12710                 $cat <<EOM
12711
12712 Checking to see what type of argument is accepted by gethostbyname().
12713 EOM
12714                 hdrs="$define sys/types.h
12715                         $d_socket sys/socket.h 
12716                         $i_niin netinet/in.h 
12717                         $i_netdb netdb.h
12718                         $i_unistd unistd.h"
12719                 for xxx in "const char *" "char *"; do
12720                         case "$netdb_name_type" in
12721                         '')     try="extern struct hostent *gethostbyname($xxx);"
12722                                 if ./protochk "$try" $hdrs; then
12723                                         echo "Your system accepts $xxx."
12724                                         netdb_name_type="$xxx"
12725                                 fi
12726                                 ;;
12727                         esac
12728                 done
12729                 : In case none of those worked, prompt the user.
12730                 case "$netdb_name_type" in
12731                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12732                         dflt='char *'
12733                         . ./myread
12734                         netdb_name_type=$ans
12735                         ;;
12736                 esac
12737                 ;;
12738         *)      : no gethostbyname, so pick harmless default
12739                 netdb_name_type='char *'
12740                 ;;
12741         esac
12742 fi
12743
12744 : check for type of 1st argument to getnetbyaddr. 
12745 if test "X$netdb_net_type" = X ; then
12746         case "$d_getnbyaddr" in
12747         $define)
12748                 $cat <<EOM
12749
12750 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12751 EOM
12752                 hdrs="$define sys/types.h
12753                         $d_socket sys/socket.h 
12754                         $i_niin netinet/in.h 
12755                         $i_netdb netdb.h
12756                         $i_unistd unistd.h"
12757                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12758                         case "$netdb_net_type" in
12759                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12760                                 if ./protochk "$try" $hdrs; then
12761                                         echo "Your system accepts $xxx."
12762                                         netdb_net_type="$xxx"
12763                                 fi
12764                                 ;;
12765                         esac
12766                 done
12767                 : In case none of those worked, prompt the user.
12768                 case "$netdb_net_type" in
12769                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12770                         dflt='long'
12771                         . ./myread
12772                         netdb_net_type=$ans
12773                         ;;
12774                 esac
12775                 ;;
12776         *)      : no getnetbyaddr, so pick harmless default
12777                 netdb_net_type='long'
12778                 ;;
12779         esac
12780 fi
12781 : locate the preferred pager for this system
12782 case "$pager" in
12783 '')
12784         dflt=''
12785         case "$pg" in
12786         /*) dflt=$pg;;
12787         esac
12788         case "$more" in
12789         /*) dflt=$more;;
12790         esac
12791         case "$less" in
12792         /*) dflt=$less;;
12793         esac
12794         case "$dflt" in
12795         '') dflt=/usr/ucb/more;;
12796         esac
12797         ;;
12798 *) dflt="$pager";;
12799 esac
12800 echo " "
12801 fn=f/
12802 rp='What pager is used on your system?'
12803 . ./getfile
12804 pager="$ans"
12805
12806 : see what type pids are declared as in the kernel
12807 rp="What is the type of process ids on this system?"
12808 set pid_t pidtype int stdio.h sys/types.h
12809 eval $typedef_ask
12810
12811 : check for length of pointer
12812 echo " "
12813 case "$ptrsize" in
12814 '')
12815         $echo $n "Checking to see how big your pointers are...$c" >&4
12816         if test "$voidflags" -gt 7; then
12817                 echo '#define VOID_PTR char *' > try.c
12818         else
12819                 echo '#define VOID_PTR void *' > try.c
12820         fi
12821         $cat >>try.c <<'EOCP'
12822 #include <stdio.h>
12823 int main()
12824 {
12825     printf("%d\n", (int)sizeof(VOID_PTR));
12826     exit(0);
12827 }
12828 EOCP
12829         set try
12830         if eval $compile_ok; then
12831                 ptrsize=`./try`
12832                 $echo " $ptrsize bytes." >&4
12833         else
12834                 dflt='4'
12835                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12836                 rp="What is the size of a pointer (in bytes)?"
12837                 . ./myread
12838                 ptrsize="$ans"
12839         fi
12840         ;;
12841 esac
12842 $rm -f try.c try
12843
12844 : see if ar generates random libraries by itself
12845 echo " "
12846 echo "Checking how to generate random libraries on your machine..." >&4
12847 echo 'int bar1() { return bar2(); }' > bar1.c
12848 echo 'int bar2() { return 2; }' > bar2.c
12849 $cat > foo.c <<'EOP'
12850 int main() { printf("%d\n", bar1()); exit(0); }
12851 EOP
12852 $cc $ccflags -c bar1.c >/dev/null 2>&1
12853 $cc $ccflags -c bar2.c >/dev/null 2>&1
12854 $cc $ccflags -c foo.c >/dev/null 2>&1
12855 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12856 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12857         ./foobar >/dev/null 2>&1; then
12858         echo "$ar appears to generate random libraries itself."
12859         orderlib=false
12860         ranlib=":"
12861 elif $ar ts bar$_a >/dev/null 2>&1 &&
12862         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12863         ./foobar >/dev/null 2>&1; then
12864                 echo "a table of contents needs to be added with '$ar ts'."
12865                 orderlib=false
12866                 ranlib="$ar ts"
12867 else
12868         case "$ranlib" in
12869         :) ranlib='';;
12870         '')
12871                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12872                 $test -f $ranlib || ranlib=''
12873                 ;;
12874         esac
12875         if $test -n "$ranlib"; then
12876                 echo "your system has '$ranlib'; we'll use that."
12877                 orderlib=false
12878         else
12879                 echo "your system doesn't seem to support random libraries"
12880                 echo "so we'll use lorder and tsort to order the libraries."
12881                 orderlib=true
12882                 ranlib=":"
12883         fi
12884 fi
12885 $rm -f foo* bar* 
12886
12887 : check for type of arguments to select. 
12888 case "$selecttype" in
12889 '') case "$d_select" in
12890         $define)
12891                 $cat <<EOM
12892 Checking to see what type of arguments are accepted by select().
12893 EOM
12894                 hdrs="$define sys/types.h
12895                         $i_systime sys/time.h 
12896                         $i_sysselct sys/select.h
12897                         $d_socket sys/socket.h"
12898                 : The first arg can be int, unsigned, or size_t
12899                 : The last arg may or may not be 'const'
12900                 val=''
12901                 : void pointer has been seen but using that
12902                 : breaks the selectminbits test
12903                 for xxx in 'fd_set *' 'int *'; do
12904                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12905                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12906                                         case "$val" in
12907                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12908                                                 if ./protochk "$try" $hdrs; then
12909                                                         echo "Your system accepts $xxx."
12910                                                         val="$xxx"
12911                                                 fi
12912                                                 ;;
12913                                         esac
12914                                 done
12915                         done
12916                 done
12917                 case "$val" in
12918                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12919                         case "$d_fd_set" in
12920                                 $define) dflt="fd_set *" ;;
12921                                 *)              dflt="int *" ;;
12922                         esac
12923                         . ./myread
12924                         val=$ans
12925                         ;;
12926                 esac
12927                 selecttype="$val"
12928                 ;;
12929         *)      : no select, so pick a harmless default
12930                 selecttype='int *'
12931                 ;;
12932         esac
12933         ;;
12934 esac
12935
12936 : check for the select 'width'
12937 case "$selectminbits" in
12938 '') case "$d_select" in
12939         $define)
12940                 $cat <<EOM
12941
12942 Checking to see on how many bits at a time your select() operates...
12943 EOM
12944                 $cat >try.c <<EOCP
12945 #include <sys/types.h>
12946 #$i_time I_TIME
12947 #$i_systime I_SYS_TIME
12948 #$i_systimek I_SYS_TIME_KERNEL
12949 #ifdef I_TIME
12950 #   include <time.h>
12951 #endif
12952 #ifdef I_SYS_TIME
12953 #   ifdef I_SYS_TIME_KERNEL
12954 #       define KERNEL
12955 #   endif
12956 #   include <sys/time.h>
12957 #   ifdef I_SYS_TIME_KERNEL
12958 #       undef KERNEL
12959 #   endif
12960 #endif
12961 #$i_sysselct I_SYS_SELECT
12962 #ifdef I_SYS_SELECT
12963 #include <sys/select.h>
12964 #endif
12965 #$d_socket HAS_SOCKET
12966 #ifdef HAS_SOCKET
12967 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12968 #endif
12969 #include <stdio.h>
12970 $selecttype b;
12971 #define S sizeof(*(b))
12972 #define MINBITS 64
12973 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12974 #define NBITS  (NBYTES * 8)
12975 int main() {
12976     char s[NBYTES];
12977     struct timeval t;
12978     int i;
12979     FILE* fp;
12980     int fd;
12981
12982     fclose(stdin);
12983     fp = fopen("try.c", "r");
12984     if (fp == 0)
12985       exit(1);
12986     fd = fileno(fp);
12987     if (fd < 0)
12988       exit(2);
12989     b = ($selecttype)s;
12990     for (i = 0; i < NBITS; i++)
12991         FD_SET(i, b);
12992     t.tv_sec  = 0;
12993     t.tv_usec = 0;
12994     select(fd + 1, b, 0, 0, &t);
12995     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12996     printf("%d\n", i + 1);
12997     return 0;
12998 }
12999 EOCP
13000                 set try
13001                 if eval $compile_ok; then
13002                         selectminbits=`./try`
13003                         case "$selectminbits" in
13004                         '')     cat >&4 <<EOM
13005 Cannot figure out on how many bits at a time your select() operates.
13006 I'll play safe and guess it is 32 bits.
13007 EOM
13008                                 selectminbits=32
13009                                 bits="32 bits"
13010                                 ;;
13011                         1)      bits="1 bit" ;;
13012                         *)      bits="$selectminbits bits" ;;
13013                         esac
13014                         echo "Your select() operates on $bits at a time." >&4
13015                 else
13016                         rp='What is the minimum number of bits your select() operates on?'
13017                         case "$byteorder" in
13018                         1234|12345678)  dflt=32 ;;
13019                         *)              dflt=1  ;;
13020                         esac
13021                         . ./myread
13022                         val=$ans
13023                         selectminbits="$val"
13024                 fi
13025                 $rm -f try.* try
13026                 ;;
13027         *)      : no select, so pick a harmless default
13028                 selectminbits='32'
13029                 ;;
13030         esac
13031         ;;
13032 esac
13033
13034 : Trace out the files included by signal.h, then look for SIGxxx names.
13035 : Remove SIGARRAYSIZE used by HPUX.
13036 : Remove SIGSTKSIZE used by Linux.
13037 : Remove SIGSTKSZ used by Posix.
13038 : Remove SIGTYP void lines used by OS2.
13039 : Some cpps, like os390, dont give the file name anywhere
13040 if [ "X$fieldn" = X ]; then
13041         : Just make some guesses.  We check them later.
13042         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13043 else
13044         xxx=`echo '#include <signal.h>' |
13045         $cppstdin $cppminus $cppflags 2>/dev/null |
13046         $grep '^[       ]*#.*include' | 
13047         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13048 fi
13049 : Check this list of files to be sure we have parsed the cpp output ok.
13050 : This will also avoid potentially non-existent files, such 
13051 : as ../foo/bar.h
13052 xxxfiles=''
13053 for xx in $xxx /dev/null ; do
13054         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13055 done
13056 : If we have found no files, at least try signal.h
13057 case "$xxxfiles" in
13058 '')     xxxfiles=`./findhdr signal.h` ;;
13059 esac
13060 xxx=`awk '
13061 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13062         print substr($2, 4, 20)
13063 }
13064 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13065         print substr($3, 4, 20)
13066 }' $xxxfiles`
13067 : Append some common names just in case the awk scan failed.
13068 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13069 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13070 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13071 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13072 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13073
13074 : generate a few handy files for later
13075 $cat > signal.c <<'EOCP'
13076 #include <sys/types.h>
13077 #include <signal.h>
13078 #include <stdio.h>
13079 int main() {
13080
13081 /* Strange style to avoid deeply-nested #if/#else/#endif */
13082 #ifndef NSIG
13083 #  ifdef _NSIG
13084 #    define NSIG (_NSIG)
13085 #  endif
13086 #endif
13087
13088 #ifndef NSIG
13089 #  ifdef SIGMAX
13090 #    define NSIG (SIGMAX+1)
13091 #  endif
13092 #endif
13093
13094 #ifndef NSIG
13095 #  ifdef SIG_MAX
13096 #    define NSIG (SIG_MAX+1)
13097 #  endif
13098 #endif
13099
13100 #ifndef NSIG
13101 #  ifdef MAXSIG
13102 #    define NSIG (MAXSIG+1)
13103 #  endif
13104 #endif
13105
13106 #ifndef NSIG
13107 #  ifdef MAX_SIG
13108 #    define NSIG (MAX_SIG+1)
13109 #  endif
13110 #endif
13111
13112 #ifndef NSIG
13113 #  ifdef SIGARRAYSIZE
13114 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13115 #  endif
13116 #endif
13117
13118 #ifndef NSIG
13119 #  ifdef _sys_nsig
13120 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13121 #  endif
13122 #endif
13123
13124 /* Default to some arbitrary number that's big enough to get most
13125    of the common signals.
13126 */
13127 #ifndef NSIG
13128 #    define NSIG 50
13129 #endif
13130
13131 printf("NSIG %d\n", NSIG);
13132
13133 #ifndef JUST_NSIG
13134
13135 EOCP
13136
13137 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13138 {
13139         printf "#ifdef SIG"; printf $1; printf "\n"
13140         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13141         printf $1; printf ");\n"
13142         printf "#endif\n"
13143 }
13144 END {
13145         printf "#endif /* JUST_NSIG */\n";
13146         printf "exit(0);\n}\n";
13147 }
13148 ' >>signal.c
13149 $cat >signal.awk <<'EOP'
13150 BEGIN { ndups = 0 }
13151 $1 ~ /^NSIG$/ { nsig = $2 }
13152 ($1 !~ /^NSIG$/) && (NF == 2) {
13153     if ($2 > maxsig) { maxsig = $2 }
13154     if (sig_name[$2]) {
13155         dup_name[ndups] = $1
13156         dup_num[ndups] = $2
13157         ndups++ 
13158     }
13159     else {
13160         sig_name[$2] = $1
13161         sig_num[$2] = $2
13162     }
13163 }
13164 END { 
13165     if (nsig == 0) {
13166         nsig = maxsig + 1
13167     }
13168     printf("NSIG %d\n", nsig);
13169     for (n = 1; n < nsig; n++) {
13170         if (sig_name[n]) {
13171             printf("%s %d\n", sig_name[n], sig_num[n])
13172         }
13173         else {
13174             printf("NUM%d %d\n", n, n) 
13175         }
13176     }
13177     for (n = 0; n < ndups; n++) {
13178         printf("%s %d\n", dup_name[n], dup_num[n])
13179     }
13180 }
13181 EOP
13182 $cat >signal_cmd <<EOS
13183 $startsh
13184 if $test -s signal.lst; then
13185     echo "Using your existing signal.lst file"
13186         exit 0
13187 fi
13188 xxx="$xxx"
13189 EOS
13190 $cat >>signal_cmd <<'EOS'
13191
13192 set signal
13193 if eval $compile_ok; then
13194         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13195 else
13196         echo "(I can't seem be able to compile the whole test program)" >&4
13197         echo "(I'll try it in little pieces.)" >&4
13198         set signal -DJUST_NSIG
13199         if eval $compile_ok; then
13200                 ./signal$_exe > signal.nsg
13201                 $cat signal.nsg
13202         else
13203                 echo "I can't seem to figure out how many signals you have." >&4
13204                 echo "Guessing 50." >&4
13205                 echo 'NSIG 50' > signal.nsg
13206         fi
13207         : Now look at all the signal names, one at a time.
13208         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13209                 $cat > signal.c <<EOCP
13210 #include <sys/types.h>
13211 #include <signal.h>
13212 #include <stdio.h>
13213 int main() {
13214 printf("$xx %d\n", SIG${xx});
13215 return 0;
13216 }
13217 EOCP
13218                 set signal
13219                 if eval $compile; then
13220                         echo "SIG${xx} found."
13221                         ./signal$_exe  >> signal.ls1
13222                 else
13223                         echo "SIG${xx} NOT found."
13224                 fi
13225         done
13226         if $test -s signal.ls1; then
13227                 $cat signal.nsg signal.ls1 |
13228                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13229         fi
13230
13231 fi
13232 if $test -s signal.lst; then
13233         :
13234 else
13235         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13236         echo 'kill -l' >signal
13237         set X `csh -f <signal`
13238         $rm -f signal
13239         shift
13240         case $# in
13241         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13242         esac
13243         echo $@ | $tr ' ' $trnl | \
13244             $awk '{ printf "%s %d\n", $1, ++s; }
13245                   END { printf "NSIG %d\n", ++s }' >signal.lst
13246 fi
13247 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13248 EOS
13249 chmod a+x signal_cmd
13250 $eunicefix signal_cmd
13251
13252 : generate list of signal names
13253 echo " "
13254 case "$sig_name_init" in
13255 '') doinit=yes ;;
13256 *)  case "$sig_num_init" in
13257     ''|*,*) doinit=yes ;;
13258     esac ;;
13259 esac
13260 case "$doinit" in
13261 yes)
13262         echo "Generating a list of signal names and numbers..." >&4
13263         . ./signal_cmd
13264         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13265         sig_name=`$awk 'BEGIN { printf "ZERO " }
13266                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13267         sig_num=`$awk  'BEGIN { printf "0 " }
13268                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13269         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13270                              !/^NSIG/   { printf "\"%s\", ", $1 }
13271                              END        { printf "0\n" }' signal.lst`
13272         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13273                              !/^NSIG/   { printf "%d, ", $2}
13274                              END        { printf "0\n"}' signal.lst`
13275         ;;
13276 esac
13277 echo "The following $sig_count signals are available:"
13278 echo " "
13279 echo $sig_name | $awk \
13280 'BEGIN { linelen = 0 }
13281 {
13282         for (i = 1; i <= NF; i++) {
13283                 name = "SIG" $i " "
13284                 linelen = linelen + length(name)
13285                 if (linelen > 70) {
13286                         printf "\n"
13287                         linelen = length(name)
13288                 }
13289                 printf "%s", name
13290         }
13291         printf "\n"
13292 }'
13293 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13294
13295 : see what type is used for signed size_t
13296 set ssize_t ssizetype int stdio.h sys/types.h
13297 eval $typedef
13298 dflt="$ssizetype"
13299 $cat > ssize.c <<EOM
13300 #include <stdio.h>
13301 #include <sys/types.h>
13302 #define Size_t $sizetype
13303 #define SSize_t $dflt
13304 int main()
13305 {
13306         if (sizeof(Size_t) == sizeof(SSize_t))
13307                 printf("$dflt\n");
13308         else if (sizeof(Size_t) == sizeof(int))
13309                 printf("int\n");
13310         else 
13311                 printf("long\n");
13312         exit(0);
13313 }
13314 EOM
13315 echo " "
13316 set ssize
13317 if eval $compile_ok && ./ssize > /dev/null; then
13318         ssizetype=`./ssize`
13319         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13320 else
13321         $cat >&4 <<EOM
13322 Help! I can't compile and run the ssize_t test program: please enlighten me!
13323 (This is probably a misconfiguration in your system or libraries, and
13324 you really ought to fix it.  Still, I'll try anyway.)
13325
13326 I need a type that is the same size as $sizetype, but is guaranteed to
13327 be signed.  Common values are ssize_t, int and long.
13328
13329 EOM
13330         rp="What signed type is the same size as $sizetype?"
13331         . ./myread
13332         ssizetype="$ans"
13333 fi
13334 $rm -f ssize ssize.*
13335
13336 : see what type of char stdio uses.
13337 echo " "
13338 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13339         echo "Your stdio uses unsigned chars." >&4
13340         stdchar="unsigned char"
13341 else
13342         echo "Your stdio uses signed chars." >&4
13343         stdchar="char"
13344 fi
13345
13346 : see if time exists
13347 echo " "
13348 if test "X$d_time" = X -o X"$timetype" = X; then
13349     if set time val -f d_time; eval $csym; $val; then
13350                 echo 'time() found.' >&4
13351                 val="$define"
13352                 rp="What is the type returned by time() on this system?"
13353                 set time_t timetype long stdio.h sys/types.h
13354                 eval $typedef_ask
13355     else
13356                 echo 'time() not found, hope that will do.' >&4
13357                 val="$undef"
13358                 timetype='int';
13359     fi
13360     set d_time
13361     eval $setvar
13362 fi
13363
13364 : see what type uids are declared as in the kernel
13365 echo " "
13366 echo "Looking for the type for user ids returned by getuid()."
13367 set uid_t uidtype xxx stdio.h sys/types.h
13368 eval $typedef
13369 case "$uidtype" in
13370 xxx)
13371         xxx=`./findhdr sys/user.h`
13372         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13373         case $1 in
13374         unsigned) dflt="$1 $2" ;;
13375         *) dflt="$1" ;;
13376         esac
13377         ;;
13378 *) dflt="$uidtype";;
13379 esac
13380 case "$uidtype" in
13381 uid_t)  echo "uid_t found." ;;
13382 *)      rp="What is the type for user ids returned by getuid()?"
13383         . ./myread
13384         uidtype="$ans"
13385         ;;
13386 esac
13387
13388 echo " "
13389 case "$uidtype" in
13390 *_t) zzz="$uidtype"     ;;
13391 *)   zzz="uid"          ;;
13392 esac
13393 echo "Checking the size of $zzz..." >&4 
13394 cat > try.c <<EOCP
13395 #include <sys/types.h>
13396 #include <stdio.h>
13397 int main() {
13398     printf("%d\n", (int)sizeof($uidtype));
13399     exit(0);
13400 }
13401 EOCP
13402 set try
13403 if eval $compile_ok; then
13404         yyy=`./try`
13405         case "$yyy" in
13406         '')     uidsize=4
13407                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13408                 ;;
13409         *)      uidsize=$yyy
13410                 echo "Your $zzz size is $uidsize bytes."
13411                 ;;
13412         esac
13413 else
13414         uidsize=4
13415         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13416 fi
13417
13418 echo " "
13419 case "$uidtype" in
13420 *_t) zzz="$uidtype"     ;;
13421 *)   zzz="uid"          ;;
13422 esac
13423 echo "Checking the sign of $zzz..." >&4
13424 cat > try.c <<EOCP
13425 #include <sys/types.h>
13426 #include <stdio.h>
13427 int main() {
13428         $uidtype foo = -1;
13429         if (foo < 0)
13430                 printf("-1\n");
13431         else
13432                 printf("1\n");
13433 }
13434 EOCP
13435 set try
13436 if eval $compile; then
13437         yyy=`./try`
13438         case "$yyy" in
13439         '')     uidsign=1
13440                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13441                 ;;
13442         *)      uidsign=$yyy
13443                 case "$uidsign" in
13444                  1) echo "Your $zzz is unsigned." ;;
13445                 -1) echo "Your $zzz is signed."   ;;
13446                 esac
13447                 ;;
13448         esac
13449 else
13450         uidsign=1
13451         echo "(I can't compile the test program--guessing unsigned.)" >&4
13452 fi
13453
13454
13455
13456 echo " "
13457 $echo "Checking the format string to be used for uids..." >&4
13458
13459 case "$uidsign" in
13460 -1)     if $test X"$uidsize" = X"$ivsize"; then
13461                 uidformat="$ivdformat"
13462         else
13463                 if $test X"$uidsize" = X"$longsize"; then
13464                         uidformat='"ld"'
13465                 else
13466                         if $test X"$uidsize" = X"$intsize"; then
13467                                 uidformat='"d"'
13468                         else
13469                                 if $test X"$uidsize" = X"$shortsize"; then
13470                                         uidformat='"hd"'
13471                                 fi
13472                         fi
13473                 fi
13474         fi
13475         ;;
13476 *)      if $test X"$uidsize" = X"$uvsize"; then
13477                 uidformat="$uvuformat"
13478         else
13479                 if $test X"$uidsize" = X"$longsize"; then
13480                         uidformat='"lu"'
13481                 else
13482                         if $test X"$uidsize" = X"$intsize"; then
13483                                 uidformat='"u"'
13484                         else
13485                                 if $test X"$uidsize" = X"$shortsize"; then
13486                                         uidformat='"hu"'
13487                                 fi
13488                         fi
13489                 fi
13490         fi
13491         ;;
13492 esac
13493
13494 : see if dbm.h is available
13495 : see if dbmclose exists
13496 set dbmclose d_dbmclose
13497 eval $inlibc
13498
13499 case "$d_dbmclose" in
13500 $define)
13501         set dbm.h i_dbm
13502         eval $inhdr
13503         case "$i_dbm" in
13504         $define)
13505                 val="$undef"
13506                 set i_rpcsvcdbm
13507                 eval $setvar
13508                 ;;
13509         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13510                 eval $inhdr
13511                 ;;
13512         esac
13513         ;;
13514 *)      echo "We won't be including <dbm.h>"
13515         val="$undef"
13516         set i_dbm
13517         eval $setvar
13518         val="$undef"
13519         set i_rpcsvcdbm
13520         eval $setvar
13521         ;;
13522 esac
13523
13524 : see if this is a sys/file.h system
13525 val=''
13526 set sys/file.h val
13527 eval $inhdr
13528
13529 : do we need to include sys/file.h ?
13530 case "$val" in
13531 "$define")
13532         echo " "
13533         if $h_sysfile; then
13534                 val="$define"
13535                 echo "We'll be including <sys/file.h>." >&4
13536         else
13537                 val="$undef"
13538                 echo "We won't be including <sys/file.h>." >&4
13539         fi
13540         ;;
13541 *)
13542         h_sysfile=false
13543         ;;
13544 esac
13545 set i_sysfile
13546 eval $setvar
13547
13548 : see if fcntl.h is there
13549 val=''
13550 set fcntl.h val
13551 eval $inhdr
13552
13553 : see if we can include fcntl.h
13554 case "$val" in
13555 "$define")
13556         echo " "
13557         if $h_fcntl; then
13558                 val="$define"
13559                 echo "We'll be including <fcntl.h>." >&4
13560         else
13561                 val="$undef"
13562                 if $h_sysfile; then
13563         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13564                 else
13565                         echo "We won't be including <fcntl.h>." >&4
13566                 fi
13567         fi
13568         ;;
13569 *)
13570         h_fcntl=false
13571         val="$undef"
13572         ;;
13573 esac
13574 set i_fcntl
13575 eval $setvar
13576
13577 : see if locale.h is available
13578 set locale.h i_locale
13579 eval $inhdr
13580
13581 : see if mach cthreads are available
13582 if test "X$usethreads" = "X$define"; then
13583         set mach/cthreads.h i_machcthr
13584         eval $inhdr
13585 else
13586         i_machcthr="$undef"
13587 fi
13588
13589
13590
13591 : see if this is a math.h system
13592 set math.h i_math
13593 eval $inhdr
13594
13595 : see if this is a mntent.h system
13596 set mntent.h i_mntent
13597 eval $inhdr
13598
13599 : see if ndbm.h is available
13600 set ndbm.h t_ndbm
13601 eval $inhdr
13602 case "$t_ndbm" in
13603 $define)
13604         : see if dbm_open exists
13605         set dbm_open d_dbm_open
13606         eval $inlibc
13607         case "$d_dbm_open" in
13608         $undef)
13609                 t_ndbm="$undef"
13610                 echo "We won't be including <ndbm.h>"
13611                 ;;
13612         esac
13613         ;;
13614 esac
13615 val="$t_ndbm"
13616 set i_ndbm
13617 eval $setvar
13618
13619 : see if net/errno.h is available
13620 val=''
13621 set net/errno.h val
13622 eval $inhdr
13623
13624 : Unfortunately, it causes problems on some systems.  Arrgh.
13625 case "$val" in
13626 $define)
13627         cat > try.c <<'EOM'
13628 #include <stdio.h>
13629 #include <errno.h>
13630 #include <net/errno.h>
13631 int func()
13632 {
13633         return ENOTSOCK;
13634 }
13635 EOM
13636         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13637                 echo "We'll be including <net/errno.h>." >&4
13638         else
13639                 echo "We won't be including <net/errno.h>." >&4
13640                 val="$undef"
13641         fi
13642         $rm -f try.* try
13643         ;;
13644 esac
13645 set i_neterrno
13646 eval $setvar
13647
13648 : see if netinet/tcp.h is available
13649 set netinet/tcp.h i_netinettcp
13650 eval $inhdr
13651
13652 : see if this is a poll.h system
13653 set poll.h i_poll
13654 eval $inhdr
13655
13656 : get C preprocessor symbols handy
13657 echo " "
13658 $echo $n "Hmm... $c"
13659 echo $al | $tr ' ' $trnl >Cppsym.know
13660 $cat <<EOSS >Cppsym
13661 $startsh
13662 case "\$1" in
13663 -l) list=true
13664         shift
13665         ;;
13666 esac
13667 unknown=''
13668 case "\$list\$#" in
13669 1|2)
13670         for sym do
13671                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13672                         exit 0
13673                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13674                         :
13675                 else
13676                         unknown="\$unknown \$sym"
13677                 fi
13678         done
13679         set X \$unknown
13680         shift
13681         ;;
13682 esac
13683 case \$# in
13684 0) exit 1;;
13685 esac
13686 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13687 #ifdef \1\\
13688 exit 0; _ _ _ _\1\\      \1\\
13689 #endif\\
13690 /' >Cppsym\$\$
13691 echo "exit 1; _ _ _" >>Cppsym\$\$
13692 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13693 case "\$list" in
13694 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13695 *)
13696         sh Cppsym2\$\$
13697         status=\$?
13698         ;;
13699 esac
13700 $rm -f Cppsym\$\$ Cppsym2\$\$
13701 exit \$status
13702 EOSS
13703 chmod +x Cppsym
13704 $eunicefix Cppsym
13705 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13706
13707 : now check the C compiler for additional symbols
13708 postprocess_cc_v=''
13709 case "$osname" in
13710 aix) postprocess_cc_v="|$tr , ' '" ;;
13711 esac
13712 $cat >ccsym <<EOS
13713 $startsh
13714 $cat >tmp.c <<EOF
13715 extern int foo;
13716 EOF
13717 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13718 do
13719         case "\$i" in
13720         -D*) echo "\$i" | $sed 's/^-D//';;
13721         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13722         esac
13723 done
13724 $rm -f try.c
13725 EOS
13726 postprocess_cc_v=''
13727 chmod +x ccsym
13728 $eunicefix ccsym
13729 ./ccsym > ccsym1.raw
13730 if $test -s ccsym1.raw; then
13731        $sort ccsym1.raw | $uniq >ccsym.raw
13732 else
13733        mv ccsym1.raw ccsym.raw
13734 fi
13735
13736 $awk '/\=/ { print $0; next }
13737         { print $0"=1" }' ccsym.raw >ccsym.list
13738 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13739 $comm -13 ccsym.true ccsym.list >ccsym.own
13740 $comm -12 ccsym.true ccsym.list >ccsym.com
13741 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13742 also=''
13743 if $test -z ccsym.raw; then
13744         echo "Your C compiler doesn't seem to define any symbols!" >&4
13745         echo " "
13746         echo "However, your C preprocessor defines the following symbols:"
13747         $cat Cppsym.true
13748         ccsymbols=''
13749         cppsymbols=`$cat Cppsym.true`
13750         cppsymbols=`echo $cppsymbols`
13751         cppccsymbols="$cppsymbols"
13752 else
13753         if $test -s ccsym.com; then
13754                 echo "Your C compiler and pre-processor define these symbols:"
13755                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13756                 also='also '
13757                 symbols='ones'
13758                 cppccsymbols=`$cat ccsym.com`
13759                 cppccsymbols=`echo $cppccsymbols`
13760                 $test "$silent" || sleep 1
13761         fi
13762         if $test -s ccsym.cpp; then
13763                 $test "$also" && echo " "
13764                 echo "Your C pre-processor ${also}defines the following symbols:"
13765                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13766                 also='further '
13767                 cppsymbols=`$cat ccsym.cpp`
13768                 cppsymbols=`echo $cppsymbols`
13769                 $test "$silent" || sleep 1
13770         fi
13771         if $test -s ccsym.own; then
13772                 $test "$also" && echo " "
13773                 echo "Your C compiler ${also}defines the following cpp symbols:"
13774                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13775                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13776                 ccsymbols=`$cat ccsym.own`
13777                 ccsymbols=`echo $ccsymbols`
13778                 $test "$silent" || sleep 1
13779         fi
13780 fi
13781 $rm -f ccsym*
13782
13783 : see if this is a termio system
13784 val="$undef"
13785 val2="$undef"
13786 val3="$undef"
13787 if $test `./findhdr termios.h`; then
13788         set tcsetattr i_termios
13789         eval $inlibc
13790         val3="$i_termios"
13791 fi
13792 echo " "
13793 case "$val3" in
13794 "$define") echo "You have POSIX termios.h... good!" >&4;;
13795 *) if ./Cppsym pyr; then
13796                 case "`/bin/universe`" in
13797                 ucb) if $test `./findhdr sgtty.h`; then
13798                                 val2="$define"
13799                                 echo "<sgtty.h> found." >&4
13800                         else
13801                                 echo "System is pyramid with BSD universe."
13802                                 echo "<sgtty.h> not found--you could have problems." >&4
13803                         fi;;
13804                 *) if $test `./findhdr termio.h`; then
13805                                 val="$define"
13806                                 echo "<termio.h> found." >&4
13807                         else
13808                                 echo "System is pyramid with USG universe."
13809                                 echo "<termio.h> not found--you could have problems." >&4
13810                         fi;;
13811                 esac
13812         elif ./usg; then
13813                 if $test `./findhdr termio.h`; then
13814                         echo "<termio.h> found." >&4
13815                         val="$define"
13816                 elif $test `./findhdr sgtty.h`; then
13817                         echo "<sgtty.h> found." >&4
13818                         val2="$define"
13819                 else
13820 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13821                 fi
13822         else
13823                 if $test `./findhdr sgtty.h`; then
13824                         echo "<sgtty.h> found." >&4
13825                         val2="$define"
13826                 elif $test `./findhdr termio.h`; then
13827                         echo "<termio.h> found." >&4
13828                         val="$define"
13829                 else
13830 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13831                 fi
13832         fi;;
13833 esac
13834 set i_termio; eval $setvar
13835 val=$val2; set i_sgtty; eval $setvar
13836 val=$val3; set i_termios; eval $setvar
13837
13838 : see if this is a shadow.h system
13839 set shadow.h i_shadow
13840 eval $inhdr
13841
13842 : see if this is a socks.h system
13843 set socks.h i_socks
13844 eval $inhdr
13845
13846 : see if stdarg is available
13847 echo " "
13848 if $test `./findhdr stdarg.h`; then
13849         echo "<stdarg.h> found." >&4
13850         valstd="$define"
13851 else
13852         echo "<stdarg.h> NOT found." >&4
13853         valstd="$undef"
13854 fi
13855
13856 : see if varags is available
13857 echo " "
13858 if $test `./findhdr varargs.h`; then
13859         echo "<varargs.h> found." >&4
13860 else
13861         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13862 fi
13863
13864 : set up the varargs testing programs
13865 $cat > varargs.c <<EOP
13866 #ifdef I_STDARG
13867 #include <stdarg.h>
13868 #endif
13869 #ifdef I_VARARGS
13870 #include <varargs.h>
13871 #endif
13872
13873 #ifdef I_STDARG
13874 int f(char *p, ...)
13875 #else
13876 int f(va_alist)
13877 va_dcl
13878 #endif
13879 {
13880         va_list ap;
13881 #ifndef I_STDARG
13882         char *p;
13883 #endif
13884 #ifdef I_STDARG
13885         va_start(ap,p);
13886 #else
13887         va_start(ap);
13888         p = va_arg(ap, char *);
13889 #endif
13890         va_end(ap);
13891 }
13892 EOP
13893 $cat > varargs <<EOP
13894 $startsh
13895 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13896         echo "true"
13897 else
13898         echo "false"
13899 fi
13900 $rm -f varargs$_o
13901 EOP
13902 chmod +x varargs
13903
13904 : now check which varargs header should be included
13905 echo " "
13906 i_varhdr=''
13907 case "$valstd" in
13908 "$define")
13909         if `./varargs I_STDARG`; then
13910                 val='stdarg.h'
13911         elif `./varargs I_VARARGS`; then
13912                 val='varargs.h'
13913         fi
13914         ;;
13915 *)
13916         if `./varargs I_VARARGS`; then
13917                 val='varargs.h'
13918         fi
13919         ;;
13920 esac
13921 case "$val" in
13922 '')
13923 echo "I could not find the definition for va_dcl... You have problems..." >&4
13924         val="$undef"; set i_stdarg; eval $setvar
13925         val="$undef"; set i_varargs; eval $setvar
13926         ;;
13927 *) 
13928         set i_varhdr
13929         eval $setvar
13930         case "$i_varhdr" in
13931         stdarg.h)
13932                 val="$define"; set i_stdarg; eval $setvar
13933                 val="$undef"; set i_varargs; eval $setvar
13934                 ;;
13935         varargs.h)
13936                 val="$undef"; set i_stdarg; eval $setvar
13937                 val="$define"; set i_varargs; eval $setvar
13938                 ;;
13939         esac
13940         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13941 esac
13942 $rm -f varargs*
13943
13944 : see if stddef is available
13945 set stddef.h i_stddef
13946 eval $inhdr
13947
13948 : see if sys/access.h is available
13949 set sys/access.h i_sysaccess
13950 eval $inhdr
13951
13952 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13953 set sys/filio.h i_sysfilio
13954 eval $inhdr
13955 echo " "
13956 if $test `./findhdr sys/ioctl.h`; then
13957         val="$define"
13958         echo '<sys/ioctl.h> found.' >&4
13959 else
13960         val="$undef"
13961         if $test $i_sysfilio = "$define"; then
13962             echo '<sys/ioctl.h> NOT found.' >&4
13963         else
13964                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13965                 $test $i_termio = "$define" && xxx="termio.h"
13966                 $test $i_termios = "$define" && xxx="termios.h"
13967 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13968         fi
13969 fi
13970 set i_sysioctl
13971 eval $setvar
13972
13973 : see if sys/resource.h has to be included
13974 set sys/resource.h i_sysresrc
13975 eval $inhdr
13976
13977 : see if sys/security.h is available
13978 set sys/security.h i_syssecrt
13979 eval $inhdr
13980
13981 : see if this is a sys/statvfs.h system
13982 set sys/statvfs.h i_sysstatvfs
13983 eval $inhdr
13984
13985 : see if this is a sys/uio.h system
13986 set sys/uio.h i_sysuio
13987 eval $inhdr
13988
13989 : see if this is a sys/un.h system
13990 set sys/un.h i_sysun
13991 eval $inhdr
13992
13993 : see if this is a syswait system
13994 set sys/wait.h i_syswait
13995 eval $inhdr
13996
13997 : see if this is a ustat.h system
13998 set ustat.h i_ustat
13999 eval $inhdr
14000
14001 : see if this is an utime system
14002 set utime.h i_utime
14003 eval $inhdr
14004
14005 : see if this is a values.h system
14006 set values.h i_values
14007 eval $inhdr
14008
14009 : see if this is a vfork system
14010 case "$d_vfork" in
14011 "$define")
14012         set vfork.h i_vfork
14013         eval $inhdr
14014         ;;
14015 *)
14016         i_vfork="$undef"
14017         ;;
14018 esac
14019
14020 : see if gdbm.h is available
14021 set gdbm.h t_gdbm
14022 eval $inhdr
14023 case "$t_gdbm" in
14024 $define)
14025         : see if gdbm_open exists
14026         set gdbm_open d_gdbm_open
14027         eval $inlibc
14028         case "$d_gdbm_open" in
14029         $undef)
14030                 t_gdbm="$undef"
14031                 echo "We won't be including <gdbm.h>"
14032                 ;;
14033         esac
14034         ;;
14035 esac
14036 val="$t_gdbm"
14037 set i_gdbm
14038 eval $setvar
14039
14040 echo " "
14041 echo "Looking for extensions..." >&4
14042 : If we are using the old config.sh, known_extensions may contain
14043 : old or inaccurate or duplicate values.
14044 known_extensions=''
14045 nonxs_extensions=''
14046 : We do not use find because it might not be available.
14047 : We do not just use MANIFEST because the user may have dropped
14048 : some additional extensions into the source tree and expect them
14049 : to be built.
14050
14051 : Function to recursively find available extensions, ignoring DynaLoader
14052 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14053 find_extensions='
14054     for xxx in *; do
14055        case "$xxx" in
14056            DynaLoader|dynaload) ;;
14057            *)
14058            if $test -f $xxx/$xxx.xs; then
14059                known_extensions="$known_extensions $1$xxx";
14060            elif $test -f $xxx/Makefile.PL; then
14061                nonxs_extensions="$nonxs_extensions $1$xxx";
14062            else
14063                if $test -d $xxx -a $# -lt 10; then
14064                    set $1$xxx/ $*;
14065                    cd $xxx;
14066                    eval $find_extensions;
14067                    cd ..;
14068                    shift;
14069                fi;
14070            fi
14071            ;;
14072        esac;
14073     done'
14074 tdir=`pwd`
14075 cd $rsrc/ext
14076 set X
14077 shift
14078 eval $find_extensions
14079 set X $nonxs_extensions
14080 shift
14081 nonxs_extensions="$*"
14082 set X $known_extensions
14083 shift
14084 known_extensions="$*"
14085 cd $tdir
14086
14087 : Now see which are supported on this system.
14088 avail_ext=''
14089 for xxx in $known_extensions ; do
14090         case "$xxx" in
14091         DB_File|db_file)
14092                 case "$i_db" in
14093                 $define) avail_ext="$avail_ext $xxx" ;;
14094                 esac
14095                 ;;
14096         GDBM_File|gdbm_fil)
14097                 case "$i_gdbm" in 
14098                 $define) avail_ext="$avail_ext $xxx" ;;
14099                 esac
14100                 ;;
14101         NDBM_File|ndbm_fil)
14102                 case "$i_ndbm" in
14103                 $define) avail_ext="$avail_ext $xxx" ;;
14104                 esac
14105                 ;;
14106         ODBM_File|odbm_fil) 
14107                 case "${i_dbm}${i_rpcsvcdbm}" in
14108                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14109                 esac
14110                 ;;
14111         POSIX|posix)
14112                 case "$useposix" in
14113                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14114                 esac
14115                 ;;
14116         Opcode|opcode)
14117                 case "$useopcode" in
14118                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14119                 esac
14120                 ;;
14121         Socket|socket)
14122                 case "$d_socket" in 
14123                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14124                 esac
14125                 ;;
14126         Thread|thread)
14127                 case "$usethreads" in 
14128                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14129                 esac
14130                 ;;
14131         IPC/SysV|ipc/sysv)
14132                 : XXX Do we need a useipcsysv variable here
14133                 case "${d_msg}${d_sem}${d_shm}" in 
14134                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14135                 esac
14136                 ;;
14137         *)      avail_ext="$avail_ext $xxx"
14138                 ;;
14139         esac
14140 done
14141
14142 set X $avail_ext
14143 shift
14144 avail_ext="$*"
14145
14146 : Now see which nonxs extensions are supported on this system.
14147 : For now assume all are.
14148 nonxs_ext=''
14149 for xxx in $nonxs_extensions ; do
14150         case "$xxx" in
14151         *)      nonxs_ext="$nonxs_ext $xxx"
14152                 ;;
14153         esac
14154 done
14155
14156 set X $nonxs_ext
14157 shift
14158 nonxs_ext="$*"
14159
14160 case $usedl in
14161 $define)
14162         $cat <<EOM
14163 A number of extensions are supplied with $package.  You may choose to
14164 compile these extensions for dynamic loading (the default), compile
14165 them into the $package executable (static loading), or not include
14166 them at all.  Answer "none" to include no extensions.
14167 Note that DynaLoader is always built and need not be mentioned here.
14168
14169 EOM
14170         case "$dynamic_ext" in
14171         '') dflt="$avail_ext" ;;
14172         *)      dflt="$dynamic_ext"
14173                 # Perhaps we are reusing an old out-of-date config.sh.
14174                 case "$hint" in
14175                 previous)
14176                         if test X"$dynamic_ext" != X"$avail_ext"; then
14177                                 $cat <<EOM
14178 NOTICE:  Your previous config.sh list may be incorrect. 
14179 The extensions now available to you are 
14180         ${avail_ext}
14181 but the default list from your previous config.sh is
14182         ${dynamic_ext} 
14183
14184 EOM
14185                         fi
14186                         ;;
14187                 esac
14188                 ;;
14189         esac
14190         case "$dflt" in
14191         '')     dflt=none;;
14192         esac
14193         rp="What extensions do you wish to load dynamically?"
14194         . ./myread
14195         case "$ans" in
14196         none) dynamic_ext=' ' ;;
14197         *) dynamic_ext="$ans" ;;
14198         esac
14199
14200         case "$static_ext" in
14201         '')
14202                 : Exclude those already listed in dynamic linking
14203                 dflt=''
14204                 for xxx in $avail_ext; do
14205                         case " $dynamic_ext " in
14206                         *" $xxx "*) ;;
14207                         *) dflt="$dflt $xxx" ;;
14208                         esac
14209                 done
14210                 set X $dflt
14211                 shift
14212                 dflt="$*"
14213                 ;;
14214         *)  dflt="$static_ext" 
14215                 ;;
14216         esac
14217
14218         case "$dflt" in
14219         '')     dflt=none;;
14220         esac
14221         rp="What extensions do you wish to load statically?"
14222         . ./myread
14223         case "$ans" in
14224         none) static_ext=' ' ;;
14225         *) static_ext="$ans" ;;
14226         esac
14227         ;;
14228 *)
14229         $cat <<EOM
14230 A number of extensions are supplied with $package.  Answer "none" 
14231 to include no extensions. 
14232 Note that DynaLoader is always built and need not be mentioned here.
14233
14234 EOM
14235         case "$static_ext" in
14236         '') dflt="$avail_ext" ;;
14237         *)      dflt="$static_ext"
14238                 # Perhaps we are reusing an old out-of-date config.sh.
14239                 case "$hint" in
14240                 previous)
14241                         if test X"$static_ext" != X"$avail_ext"; then
14242                                 $cat <<EOM
14243 NOTICE:  Your previous config.sh list may be incorrect. 
14244 The extensions now available to you are 
14245         ${avail_ext}
14246 but the default list from your previous config.sh is
14247         ${static_ext} 
14248
14249 EOM
14250                         fi
14251                         ;;
14252                 esac
14253                 ;;
14254         esac
14255         : Exclude those that are not xs extensions
14256         case "$dflt" in
14257         '')     dflt=none;;
14258         esac
14259         rp="What extensions do you wish to include?"
14260         . ./myread
14261         case "$ans" in
14262         none) static_ext=' ' ;;
14263         *) static_ext="$ans" ;;
14264         esac
14265         ;;
14266 esac
14267
14268 set X $dynamic_ext $static_ext $nonxs_ext
14269 shift
14270 extensions="$*"
14271
14272 : Remove build directory name from cppstdin so it can be used from
14273 : either the present location or the final installed location.
14274 echo " "
14275 : Get out of the UU directory to get correct path name.
14276 cd ..
14277 case "$cppstdin" in
14278 `pwd`/cppstdin)
14279         echo "Stripping down cppstdin path name"
14280         cppstdin=cppstdin
14281         ;;
14282 esac
14283 cd UU
14284
14285 : end of configuration questions
14286 echo " "
14287 echo "End of configuration questions."
14288 echo " "
14289
14290 : back to where it started
14291 if test -d ../UU; then
14292         cd ..
14293 fi
14294
14295 : configuration may be patched via a 'config.over' file
14296 if $test -f config.over; then
14297         echo " "
14298         dflt=y
14299         rp='I see a config.over file.  Do you wish to load it?'
14300         . UU/myread
14301         case "$ans" in
14302         n*) echo "OK, I'll ignore it.";;
14303         *)      . ./config.over
14304                 echo "Configuration override changes have been loaded."
14305                 ;;
14306         esac
14307 fi
14308
14309 : in case they want portability, strip down executable paths
14310 case "$d_portable" in
14311 "$define")
14312         echo " "
14313         echo "Stripping down executable paths..." >&4
14314         for file in $loclist $trylist; do
14315                 eval temp=\$$file
14316                 eval $file=`basename $temp`
14317         done
14318         ;;
14319 esac
14320
14321 : create config.sh file
14322 echo " "
14323 echo "Creating config.sh..." >&4
14324 $spitshell <<EOT >config.sh
14325 $startsh
14326 #
14327 # This file was produced by running the Configure script. It holds all the
14328 # definitions figured out by Configure. Should you modify one of these values,
14329 # do not forget to propagate your changes by running "Configure -der". You may
14330 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14331 #
14332
14333 # Package name      : $package
14334 # Source directory  : $src
14335 # Configuration time: $cf_time
14336 # Configured by     : $cf_by
14337 # Target system     : $myuname
14338
14339 Author='$Author'
14340 Date='$Date'
14341 Header='$Header'
14342 Id='$Id'
14343 Locker='$Locker'
14344 Log='$Log'
14345 Mcc='$Mcc'
14346 RCSfile='$RCSfile'
14347 Revision='$Revision'
14348 Source='$Source'
14349 State='$State'
14350 _a='$_a'
14351 _exe='$_exe'
14352 _o='$_o'
14353 afs='$afs'
14354 alignbytes='$alignbytes'
14355 ansi2knr='$ansi2knr'
14356 aphostname='$aphostname'
14357 api_revision='$api_revision'
14358 api_subversion='$api_subversion'
14359 api_version='$api_version'
14360 api_versionstring='$api_versionstring'
14361 ar='$ar'
14362 archlib='$archlib'
14363 archlibexp='$archlibexp'
14364 archname64='$archname64'
14365 archname='$archname'
14366 archobjs='$archobjs'
14367 awk='$awk'
14368 baserev='$baserev'
14369 bash='$bash'
14370 bin='$bin'
14371 bincompat5005='$bincompat5005'
14372 binexp='$binexp'
14373 bison='$bison'
14374 byacc='$byacc'
14375 byteorder='$byteorder'
14376 c='$c'
14377 castflags='$castflags'
14378 cat='$cat'
14379 cc='$cc'
14380 cccdlflags='$cccdlflags'
14381 ccdlflags='$ccdlflags'
14382 ccflags='$ccflags'
14383 ccsymbols='$ccsymbols'
14384 cf_by='$cf_by'
14385 cf_email='$cf_email'
14386 cf_time='$cf_time'
14387 charsize='$charsize'
14388 chgrp='$chgrp'
14389 chmod='$chmod'
14390 chown='$chown'
14391 clocktype='$clocktype'
14392 comm='$comm'
14393 compress='$compress'
14394 contains='$contains'
14395 cp='$cp'
14396 cpio='$cpio'
14397 cpp='$cpp'
14398 cpp_stuff='$cpp_stuff'
14399 cppccsymbols='$cppccsymbols'
14400 cppflags='$cppflags'
14401 cpplast='$cpplast'
14402 cppminus='$cppminus'
14403 cpprun='$cpprun'
14404 cppstdin='$cppstdin'
14405 cppsymbols='$cppsymbols'
14406 crosscompile='$crosscompile'
14407 cryptlib='$cryptlib'
14408 csh='$csh'
14409 d_Gconvert='$d_Gconvert'
14410 d_PRIEldbl='$d_PRIEldbl'
14411 d_PRIFldbl='$d_PRIFldbl'
14412 d_PRIGldbl='$d_PRIGldbl'
14413 d_PRIX64='$d_PRIX64'
14414 d_PRId64='$d_PRId64'
14415 d_PRIeldbl='$d_PRIeldbl'
14416 d_PRIfldbl='$d_PRIfldbl'
14417 d_PRIgldbl='$d_PRIgldbl'
14418 d_PRIi64='$d_PRIi64'
14419 d_PRIo64='$d_PRIo64'
14420 d_PRIu64='$d_PRIu64'
14421 d_PRIx64='$d_PRIx64'
14422 d_access='$d_access'
14423 d_accessx='$d_accessx'
14424 d_alarm='$d_alarm'
14425 d_archlib='$d_archlib'
14426 d_atolf='$d_atolf'
14427 d_atoll='$d_atoll'
14428 d_attribut='$d_attribut'
14429 d_bcmp='$d_bcmp'
14430 d_bcopy='$d_bcopy'
14431 d_bincompat5005='$d_bincompat5005'
14432 d_bsd='$d_bsd'
14433 d_bsdgetpgrp='$d_bsdgetpgrp'
14434 d_bsdsetpgrp='$d_bsdsetpgrp'
14435 d_bzero='$d_bzero'
14436 d_casti32='$d_casti32'
14437 d_castneg='$d_castneg'
14438 d_charvspr='$d_charvspr'
14439 d_chown='$d_chown'
14440 d_chroot='$d_chroot'
14441 d_chsize='$d_chsize'
14442 d_closedir='$d_closedir'
14443 d_const='$d_const'
14444 d_crypt='$d_crypt'
14445 d_csh='$d_csh'
14446 d_cuserid='$d_cuserid'
14447 d_dbl_dig='$d_dbl_dig'
14448 d_difftime='$d_difftime'
14449 d_dirnamlen='$d_dirnamlen'
14450 d_dlerror='$d_dlerror'
14451 d_dlopen='$d_dlopen'
14452 d_dlsymun='$d_dlsymun'
14453 d_dosuid='$d_dosuid'
14454 d_drand48proto='$d_drand48proto'
14455 d_dup2='$d_dup2'
14456 d_eaccess='$d_eaccess'
14457 d_endgrent='$d_endgrent'
14458 d_endhent='$d_endhent'
14459 d_endnent='$d_endnent'
14460 d_endpent='$d_endpent'
14461 d_endpwent='$d_endpwent'
14462 d_endsent='$d_endsent'
14463 d_endspent='$d_endspent'
14464 d_eofnblk='$d_eofnblk'
14465 d_eunice='$d_eunice'
14466 d_fchmod='$d_fchmod'
14467 d_fchown='$d_fchown'
14468 d_fcntl='$d_fcntl'
14469 d_fd_macros='$d_fd_macros'
14470 d_fd_set='$d_fd_set'
14471 d_fds_bits='$d_fds_bits'
14472 d_fgetpos='$d_fgetpos'
14473 d_flexfnam='$d_flexfnam'
14474 d_flock='$d_flock'
14475 d_fork='$d_fork'
14476 d_fpathconf='$d_fpathconf'
14477 d_fpos64_t='$d_fpos64_t'
14478 d_fs_data_s='$d_fs_data_s'
14479 d_fseeko='$d_fseeko'
14480 d_fsetpos='$d_fsetpos'
14481 d_fstatfs='$d_fstatfs'
14482 d_fstatvfs='$d_fstatvfs'
14483 d_ftello='$d_ftello'
14484 d_ftime='$d_ftime'
14485 d_getgrent='$d_getgrent'
14486 d_getgrps='$d_getgrps'
14487 d_gethbyaddr='$d_gethbyaddr'
14488 d_gethbyname='$d_gethbyname'
14489 d_gethent='$d_gethent'
14490 d_gethname='$d_gethname'
14491 d_gethostprotos='$d_gethostprotos'
14492 d_getlogin='$d_getlogin'
14493 d_getmnt='$d_getmnt'
14494 d_getmntent='$d_getmntent'
14495 d_getnbyaddr='$d_getnbyaddr'
14496 d_getnbyname='$d_getnbyname'
14497 d_getnent='$d_getnent'
14498 d_getnetprotos='$d_getnetprotos'
14499 d_getpbyname='$d_getpbyname'
14500 d_getpbynumber='$d_getpbynumber'
14501 d_getpent='$d_getpent'
14502 d_getpgid='$d_getpgid'
14503 d_getpgrp2='$d_getpgrp2'
14504 d_getpgrp='$d_getpgrp'
14505 d_getppid='$d_getppid'
14506 d_getprior='$d_getprior'
14507 d_getprotoprotos='$d_getprotoprotos'
14508 d_getpwent='$d_getpwent'
14509 d_getsbyname='$d_getsbyname'
14510 d_getsbyport='$d_getsbyport'
14511 d_getsent='$d_getsent'
14512 d_getservprotos='$d_getservprotos'
14513 d_getspent='$d_getspent'
14514 d_getspnam='$d_getspnam'
14515 d_gettimeod='$d_gettimeod'
14516 d_gnulibc='$d_gnulibc'
14517 d_grpasswd='$d_grpasswd'
14518 d_hasmntopt='$d_hasmntopt'
14519 d_htonl='$d_htonl'
14520 d_index='$d_index'
14521 d_inetaton='$d_inetaton'
14522 d_int64t='$d_int64t'
14523 d_isascii='$d_isascii'
14524 d_killpg='$d_killpg'
14525 d_lchown='$d_lchown'
14526 d_ldbl_dig='$d_ldbl_dig'
14527 d_link='$d_link'
14528 d_locconv='$d_locconv'
14529 d_lockf='$d_lockf'
14530 d_longdbl='$d_longdbl'
14531 d_longlong='$d_longlong'
14532 d_lstat='$d_lstat'
14533 d_mblen='$d_mblen'
14534 d_mbstowcs='$d_mbstowcs'
14535 d_mbtowc='$d_mbtowc'
14536 d_memchr='$d_memchr'
14537 d_memcmp='$d_memcmp'
14538 d_memcpy='$d_memcpy'
14539 d_memmove='$d_memmove'
14540 d_memset='$d_memset'
14541 d_mkdir='$d_mkdir'
14542 d_mkfifo='$d_mkfifo'
14543 d_mktime='$d_mktime'
14544 d_msg='$d_msg'
14545 d_msg_ctrunc='$d_msg_ctrunc'
14546 d_msg_dontroute='$d_msg_dontroute'
14547 d_msg_oob='$d_msg_oob'
14548 d_msg_peek='$d_msg_peek'
14549 d_msg_proxy='$d_msg_proxy'
14550 d_msgctl='$d_msgctl'
14551 d_msgget='$d_msgget'
14552 d_msgrcv='$d_msgrcv'
14553 d_msgsnd='$d_msgsnd'
14554 d_mymalloc='$d_mymalloc'
14555 d_nice='$d_nice'
14556 d_off64_t='$d_off64_t'
14557 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14558 d_oldpthreads='$d_oldpthreads'
14559 d_oldsock='$d_oldsock'
14560 d_open3='$d_open3'
14561 d_pathconf='$d_pathconf'
14562 d_pause='$d_pause'
14563 d_phostname='$d_phostname'
14564 d_pipe='$d_pipe'
14565 d_poll='$d_poll'
14566 d_portable='$d_portable'
14567 d_pthread_yield='$d_pthread_yield'
14568 d_pwage='$d_pwage'
14569 d_pwchange='$d_pwchange'
14570 d_pwclass='$d_pwclass'
14571 d_pwcomment='$d_pwcomment'
14572 d_pwexpire='$d_pwexpire'
14573 d_pwgecos='$d_pwgecos'
14574 d_pwpasswd='$d_pwpasswd'
14575 d_pwquota='$d_pwquota'
14576 d_quad='$d_quad'
14577 d_readdir='$d_readdir'
14578 d_readlink='$d_readlink'
14579 d_rename='$d_rename'
14580 d_rewinddir='$d_rewinddir'
14581 d_rmdir='$d_rmdir'
14582 d_safebcpy='$d_safebcpy'
14583 d_safemcpy='$d_safemcpy'
14584 d_sanemcmp='$d_sanemcmp'
14585 d_sched_yield='$d_sched_yield'
14586 d_scm_rights='$d_scm_rights'
14587 d_seekdir='$d_seekdir'
14588 d_select='$d_select'
14589 d_sem='$d_sem'
14590 d_semctl='$d_semctl'
14591 d_semctl_semid_ds='$d_semctl_semid_ds'
14592 d_semctl_semun='$d_semctl_semun'
14593 d_semget='$d_semget'
14594 d_semop='$d_semop'
14595 d_setegid='$d_setegid'
14596 d_seteuid='$d_seteuid'
14597 d_setgrent='$d_setgrent'
14598 d_setgrps='$d_setgrps'
14599 d_sethent='$d_sethent'
14600 d_setlinebuf='$d_setlinebuf'
14601 d_setlocale='$d_setlocale'
14602 d_setnent='$d_setnent'
14603 d_setpent='$d_setpent'
14604 d_setpgid='$d_setpgid'
14605 d_setpgrp2='$d_setpgrp2'
14606 d_setpgrp='$d_setpgrp'
14607 d_setprior='$d_setprior'
14608 d_setpwent='$d_setpwent'
14609 d_setregid='$d_setregid'
14610 d_setresgid='$d_setresgid'
14611 d_setresuid='$d_setresuid'
14612 d_setreuid='$d_setreuid'
14613 d_setrgid='$d_setrgid'
14614 d_setruid='$d_setruid'
14615 d_setsent='$d_setsent'
14616 d_setsid='$d_setsid'
14617 d_setspent='$d_setspent'
14618 d_setvbuf='$d_setvbuf'
14619 d_sfio='$d_sfio'
14620 d_shm='$d_shm'
14621 d_shmat='$d_shmat'
14622 d_shmatprototype='$d_shmatprototype'
14623 d_shmctl='$d_shmctl'
14624 d_shmdt='$d_shmdt'
14625 d_shmget='$d_shmget'
14626 d_sigaction='$d_sigaction'
14627 d_sigsetjmp='$d_sigsetjmp'
14628 d_socket='$d_socket'
14629 d_sockpair='$d_sockpair'
14630 d_sqrtl='$d_sqrtl'
14631 d_statblks='$d_statblks'
14632 d_statfs_f_flags='$d_statfs_f_flags'
14633 d_statfs_s='$d_statfs_s'
14634 d_statvfs='$d_statvfs'
14635 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14636 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14637 d_stdio_stream_array='$d_stdio_stream_array'
14638 d_stdiobase='$d_stdiobase'
14639 d_stdstdio='$d_stdstdio'
14640 d_strchr='$d_strchr'
14641 d_strcoll='$d_strcoll'
14642 d_strctcpy='$d_strctcpy'
14643 d_strerrm='$d_strerrm'
14644 d_strerror='$d_strerror'
14645 d_strtod='$d_strtod'
14646 d_strtol='$d_strtol'
14647 d_strtold='$d_strtold'
14648 d_strtoll='$d_strtoll'
14649 d_strtoul='$d_strtoul'
14650 d_strtoull='$d_strtoull'
14651 d_strtouq='$d_strtouq'
14652 d_strxfrm='$d_strxfrm'
14653 d_suidsafe='$d_suidsafe'
14654 d_symlink='$d_symlink'
14655 d_syscall='$d_syscall'
14656 d_sysconf='$d_sysconf'
14657 d_sysernlst='$d_sysernlst'
14658 d_syserrlst='$d_syserrlst'
14659 d_system='$d_system'
14660 d_tcgetpgrp='$d_tcgetpgrp'
14661 d_tcsetpgrp='$d_tcsetpgrp'
14662 d_telldir='$d_telldir'
14663 d_telldirproto='$d_telldirproto'
14664 d_time='$d_time'
14665 d_times='$d_times'
14666 d_truncate='$d_truncate'
14667 d_tzname='$d_tzname'
14668 d_umask='$d_umask'
14669 d_uname='$d_uname'
14670 d_union_semun='$d_union_semun'
14671 d_ustat='$d_ustat'
14672 d_vendorbin='$d_vendorbin'
14673 d_vendorlib='$d_vendorlib'
14674 d_vfork='$d_vfork'
14675 d_void_closedir='$d_void_closedir'
14676 d_voidsig='$d_voidsig'
14677 d_voidtty='$d_voidtty'
14678 d_volatile='$d_volatile'
14679 d_vprintf='$d_vprintf'
14680 d_wait4='$d_wait4'
14681 d_waitpid='$d_waitpid'
14682 d_wcstombs='$d_wcstombs'
14683 d_wctomb='$d_wctomb'
14684 d_xenix='$d_xenix'
14685 date='$date'
14686 db_hashtype='$db_hashtype'
14687 db_prefixtype='$db_prefixtype'
14688 defvoidused='$defvoidused'
14689 direntrytype='$direntrytype'
14690 dlext='$dlext'
14691 dlsrc='$dlsrc'
14692 doublesize='$doublesize'
14693 drand01='$drand01'
14694 dynamic_ext='$dynamic_ext'
14695 eagain='$eagain'
14696 ebcdic='$ebcdic'
14697 echo='$echo'
14698 egrep='$egrep'
14699 emacs='$emacs'
14700 eunicefix='$eunicefix'
14701 exe_ext='$exe_ext'
14702 expr='$expr'
14703 extensions='$extensions'
14704 fflushNULL='$fflushNULL'
14705 fflushall='$fflushall'
14706 find='$find'
14707 firstmakefile='$firstmakefile'
14708 flex='$flex'
14709 fpossize='$fpossize'
14710 fpostype='$fpostype'
14711 freetype='$freetype'
14712 full_ar='$full_ar'
14713 full_csh='$full_csh'
14714 full_sed='$full_sed'
14715 gccversion='$gccversion'
14716 gidformat='$gidformat'
14717 gidsign='$gidsign'
14718 gidsize='$gidsize'
14719 gidtype='$gidtype'
14720 glibpth='$glibpth'
14721 grep='$grep'
14722 groupcat='$groupcat'
14723 groupstype='$groupstype'
14724 gzip='$gzip'
14725 h_fcntl='$h_fcntl'
14726 h_sysfile='$h_sysfile'
14727 hint='$hint'
14728 hostcat='$hostcat'
14729 huge='$huge'
14730 i16size='$i16size'
14731 i16type='$i16type'
14732 i32size='$i32size'
14733 i32type='$i32type'
14734 i64size='$i64size'
14735 i64type='$i64type'
14736 i8size='$i8size'
14737 i8type='$i8type'
14738 i_arpainet='$i_arpainet'
14739 i_bsdioctl='$i_bsdioctl'
14740 i_db='$i_db'
14741 i_dbm='$i_dbm'
14742 i_dirent='$i_dirent'
14743 i_dld='$i_dld'
14744 i_dlfcn='$i_dlfcn'
14745 i_fcntl='$i_fcntl'
14746 i_float='$i_float'
14747 i_gdbm='$i_gdbm'
14748 i_grp='$i_grp'
14749 i_inttypes='$i_inttypes'
14750 i_limits='$i_limits'
14751 i_locale='$i_locale'
14752 i_machcthr='$i_machcthr'
14753 i_malloc='$i_malloc'
14754 i_math='$i_math'
14755 i_memory='$i_memory'
14756 i_mntent='$i_mntent'
14757 i_ndbm='$i_ndbm'
14758 i_netdb='$i_netdb'
14759 i_neterrno='$i_neterrno'
14760 i_netinettcp='$i_netinettcp'
14761 i_niin='$i_niin'
14762 i_poll='$i_poll'
14763 i_pthread='$i_pthread'
14764 i_pwd='$i_pwd'
14765 i_rpcsvcdbm='$i_rpcsvcdbm'
14766 i_sfio='$i_sfio'
14767 i_sgtty='$i_sgtty'
14768 i_shadow='$i_shadow'
14769 i_socks='$i_socks'
14770 i_stdarg='$i_stdarg'
14771 i_stddef='$i_stddef'
14772 i_stdlib='$i_stdlib'
14773 i_string='$i_string'
14774 i_sysaccess='$i_sysaccess'
14775 i_sysdir='$i_sysdir'
14776 i_sysfile='$i_sysfile'
14777 i_sysfilio='$i_sysfilio'
14778 i_sysin='$i_sysin'
14779 i_sysioctl='$i_sysioctl'
14780 i_sysmount='$i_sysmount'
14781 i_sysndir='$i_sysndir'
14782 i_sysparam='$i_sysparam'
14783 i_sysresrc='$i_sysresrc'
14784 i_syssecrt='$i_syssecrt'
14785 i_sysselct='$i_sysselct'
14786 i_syssockio='$i_syssockio'
14787 i_sysstat='$i_sysstat'
14788 i_sysstatfs='$i_sysstatfs'
14789 i_sysstatvfs='$i_sysstatvfs'
14790 i_systime='$i_systime'
14791 i_systimek='$i_systimek'
14792 i_systimes='$i_systimes'
14793 i_systypes='$i_systypes'
14794 i_sysuio='$i_sysuio'
14795 i_sysun='$i_sysun'
14796 i_sysvfs='$i_sysvfs'
14797 i_syswait='$i_syswait'
14798 i_termio='$i_termio'
14799 i_termios='$i_termios'
14800 i_time='$i_time'
14801 i_unistd='$i_unistd'
14802 i_ustat='$i_ustat'
14803 i_utime='$i_utime'
14804 i_values='$i_values'
14805 i_varargs='$i_varargs'
14806 i_varhdr='$i_varhdr'
14807 i_vfork='$i_vfork'
14808 ignore_versioned_solibs='$ignore_versioned_solibs'
14809 inc_version_list='$inc_version_list'
14810 incpath='$incpath'
14811 inews='$inews'
14812 installarchlib='$installarchlib'
14813 installbin='$installbin'
14814 installman1dir='$installman1dir'
14815 installman3dir='$installman3dir'
14816 installprefix='$installprefix'
14817 installprefixexp='$installprefixexp'
14818 installprivlib='$installprivlib'
14819 installscript='$installscript'
14820 installsitearch='$installsitearch'
14821 installsitebin='$installsitebin'
14822 installsitelib='$installsitelib'
14823 installstyle='$installstyle'
14824 installusrbinperl='$installusrbinperl'
14825 installvendorbin='$installvendorbin'
14826 installvendorlib='$installvendorlib'
14827 intsize='$intsize'
14828 ivdformat='$ivdformat'
14829 ivsize='$ivsize'
14830 ivtype='$ivtype'
14831 known_extensions='$known_extensions'
14832 ksh='$ksh'
14833 large='$large'
14834 ld='$ld'
14835 lddlflags='$lddlflags'
14836 ldflags='$ldflags'
14837 ldlibpthname='$ldlibpthname'
14838 less='$less'
14839 lib_ext='$lib_ext'
14840 libc='$libc'
14841 libperl='$libperl'
14842 libpth='$libpth'
14843 libs='$libs'
14844 libswanted='$libswanted'
14845 line='$line'
14846 lint='$lint'
14847 lkflags='$lkflags'
14848 ln='$ln'
14849 lns='$lns'
14850 locincpth='$locincpth'
14851 loclibpth='$loclibpth'
14852 longdblsize='$longdblsize'
14853 longlongsize='$longlongsize'
14854 longsize='$longsize'
14855 lp='$lp'
14856 lpr='$lpr'
14857 ls='$ls'
14858 lseeksize='$lseeksize'
14859 lseektype='$lseektype'
14860 mail='$mail'
14861 mailx='$mailx'
14862 make='$make'
14863 make_set_make='$make_set_make'
14864 mallocobj='$mallocobj'
14865 mallocsrc='$mallocsrc'
14866 malloctype='$malloctype'
14867 man1dir='$man1dir'
14868 man1direxp='$man1direxp'
14869 man1ext='$man1ext'
14870 man3dir='$man3dir'
14871 man3direxp='$man3direxp'
14872 man3ext='$man3ext'
14873 medium='$medium'
14874 mips_type='$mips_type'
14875 mkdir='$mkdir'
14876 models='$models'
14877 modetype='$modetype'
14878 more='$more'
14879 multiarch='$multiarch'
14880 mv='$mv'
14881 myarchname='$myarchname'
14882 mydomain='$mydomain'
14883 myhostname='$myhostname'
14884 myuname='$myuname'
14885 n='$n'
14886 netdb_hlen_type='$netdb_hlen_type'
14887 netdb_host_type='$netdb_host_type'
14888 netdb_name_type='$netdb_name_type'
14889 netdb_net_type='$netdb_net_type'
14890 nm='$nm'
14891 nm_opt='$nm_opt'
14892 nm_so_opt='$nm_so_opt'
14893 nonxs_ext='$nonxs_ext'
14894 nroff='$nroff'
14895 nvsize='$nvsize'
14896 nvtype='$nvtype'
14897 o_nonblock='$o_nonblock'
14898 obj_ext='$obj_ext'
14899 old_pthread_create_joinable='$old_pthread_create_joinable'
14900 optimize='$optimize'
14901 orderlib='$orderlib'
14902 osname='$osname'
14903 osvers='$osvers'
14904 package='$package'
14905 pager='$pager'
14906 passcat='$passcat'
14907 patchlevel='$patchlevel'
14908 path_sep='$path_sep'
14909 perl='$perl'
14910 perladmin='$perladmin'
14911 perlpath='$perlpath'
14912 pg='$pg'
14913 phostname='$phostname'
14914 pidtype='$pidtype'
14915 plibpth='$plibpth'
14916 pmake='$pmake'
14917 pr='$pr'
14918 prefix='$prefix'
14919 prefixexp='$prefixexp'
14920 privlib='$privlib'
14921 privlibexp='$privlibexp'
14922 prototype='$prototype'
14923 ptrsize='$ptrsize'
14924 quadkind='$quadkind'
14925 quadtype='$quadtype'
14926 randbits='$randbits'
14927 randfunc='$randfunc'
14928 randseedtype='$randseedtype'
14929 ranlib='$ranlib'
14930 rd_nodata='$rd_nodata'
14931 rm='$rm'
14932 rmail='$rmail'
14933 runnm='$runnm'
14934 sPRIEldbl='$sPRIEldbl'
14935 sPRIFldbl='$sPRIFldbl'
14936 sPRIGldbl='$sPRIGldbl'
14937 sPRIX64='$sPRIX64'
14938 sPRId64='$sPRId64'
14939 sPRIeldbl='$sPRIeldbl'
14940 sPRIfldbl='$sPRIfldbl'
14941 sPRIgldbl='$sPRIgldbl'
14942 sPRIi64='$sPRIi64'
14943 sPRIo64='$sPRIo64'
14944 sPRIu64='$sPRIu64'
14945 sPRIx64='$sPRIx64'
14946 sched_yield='$sched_yield'
14947 scriptdir='$scriptdir'
14948 scriptdirexp='$scriptdirexp'
14949 sed='$sed'
14950 seedfunc='$seedfunc'
14951 selectminbits='$selectminbits'
14952 selecttype='$selecttype'
14953 sendmail='$sendmail'
14954 sh='$sh'
14955 shar='$shar'
14956 sharpbang='$sharpbang'
14957 shmattype='$shmattype'
14958 shortsize='$shortsize'
14959 shrpenv='$shrpenv'
14960 shsharp='$shsharp'
14961 sig_count='$sig_count'
14962 sig_name='$sig_name'
14963 sig_name_init='$sig_name_init'
14964 sig_num='$sig_num'
14965 sig_num_init='$sig_num_init'
14966 signal_t='$signal_t'
14967 sitearch='$sitearch'
14968 sitearchexp='$sitearchexp'
14969 sitebin='$sitebin'
14970 sitebinexp='$sitebinexp'
14971 sitelib='$sitelib'
14972 sitelibexp='$sitelibexp'
14973 siteprefix='$siteprefix'
14974 siteprefixexp='$siteprefixexp'
14975 sizetype='$sizetype'
14976 sleep='$sleep'
14977 smail='$smail'
14978 small='$small'
14979 so='$so'
14980 sockethdr='$sockethdr'
14981 socketlib='$socketlib'
14982 sort='$sort'
14983 spackage='$spackage'
14984 spitshell='$spitshell'
14985 split='$split'
14986 src='$src'
14987 ssizetype='$ssizetype'
14988 startperl='$startperl'
14989 startsh='$startsh'
14990 static_ext='$static_ext'
14991 stdchar='$stdchar'
14992 stdio_base='$stdio_base'
14993 stdio_bufsiz='$stdio_bufsiz'
14994 stdio_cnt='$stdio_cnt'
14995 stdio_filbuf='$stdio_filbuf'
14996 stdio_ptr='$stdio_ptr'
14997 stdio_stream_array='$stdio_stream_array'
14998 strings='$strings'
14999 submit='$submit'
15000 subversion='$subversion'
15001 sysman='$sysman'
15002 tail='$tail'
15003 tar='$tar'
15004 tbl='$tbl'
15005 tee='$tee'
15006 test='$test'
15007 timeincl='$timeincl'
15008 timetype='$timetype'
15009 touch='$touch'
15010 tr='$tr'
15011 trnl='$trnl'
15012 troff='$troff'
15013 u16size='$u16size'
15014 u16type='$u16type'
15015 u32size='$u32size'
15016 u32type='$u32type'
15017 u64size='$u64size'
15018 u64type='$u64type'
15019 u8size='$u8size'
15020 u8type='$u8type'
15021 uidformat='$uidformat'
15022 uidsign='$uidsign'
15023 uidsize='$uidsize'
15024 uidtype='$uidtype'
15025 uname='$uname'
15026 uniq='$uniq'
15027 uquadtype='$uquadtype'
15028 use5005threads='$use5005threads'
15029 use64bits='$use64bits'
15030 usedl='$usedl'
15031 useithreads='$useithreads'
15032 uselargefiles='$uselargefiles'
15033 uselongdouble='$uselongdouble'
15034 uselonglong='$uselonglong'
15035 usemorebits='$usemorebits'
15036 usemultiplicity='$usemultiplicity'
15037 usemymalloc='$usemymalloc'
15038 usenm='$usenm'
15039 useopcode='$useopcode'
15040 useperlio='$useperlio'
15041 useposix='$useposix'
15042 usesfio='$usesfio'
15043 useshrplib='$useshrplib'
15044 usesocks='$usesocks'
15045 usethreads='$usethreads'
15046 usevendorprefix='$usevendorprefix'
15047 usevfork='$usevfork'
15048 usrinc='$usrinc'
15049 uuname='$uuname'
15050 uvoformat='$uvoformat'
15051 uvsize='$uvsize'
15052 uvtype='$uvtype'
15053 uvuformat='$uvuformat'
15054 uvxformat='$uvxformat'
15055 vendorbin='$vendorbin'
15056 vendorbinexp='$vendorbinexp'
15057 vendorlib='$vendorlib'
15058 vendorlibexp='$vendorlibexp'
15059 vendorprefix='$vendorprefix'
15060 vendorprefixexp='$vendorprefixexp'
15061 version='$version'
15062 vi='$vi'
15063 voidflags='$voidflags'
15064 xlibpth='$xlibpth'
15065 zcat='$zcat'
15066 zip='$zip'
15067 EOT
15068
15069 : Add in command line options if available
15070 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15071
15072 : add special variables
15073 $test -f $src/patchlevel.h && \
15074 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15075 echo "CONFIGDOTSH=true" >>config.sh
15076
15077 : propagate old symbols
15078 if $test -f UU/config.sh; then
15079         <UU/config.sh sort | uniq >UU/oldconfig.sh
15080         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15081         sort | uniq -u >UU/oldsyms
15082         set X `cat UU/oldsyms`
15083         shift
15084         case $# in
15085         0) ;;
15086         *)
15087                 cat <<EOM
15088 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15089 EOM
15090                 echo "# Variables propagated from previous config.sh file." >>config.sh
15091                 for sym in `cat UU/oldsyms`; do
15092                         echo "    Propagating $hint variable "'$'"$sym..."
15093                         eval 'tmp="$'"${sym}"'"'
15094                         echo "$tmp" | \
15095                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15096                 done
15097                 ;;
15098         esac
15099 fi
15100
15101 : Finish up by extracting the .SH files
15102 case "$alldone" in
15103 exit)
15104         $rm -rf UU
15105         echo "Done."
15106         exit 0
15107         ;;
15108 cont)
15109         ;;
15110 '')
15111         dflt=''
15112         nostick=true
15113         $cat <<EOM
15114
15115 If you'd like to make any changes to the config.sh file before I begin
15116 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15117
15118 EOM
15119         rp="Press return or use a shell escape to edit config.sh:"
15120         . UU/myread
15121         nostick=''
15122         case "$ans" in
15123         '') ;;
15124         *) : in case they cannot read
15125                 sh 1>&4 -c "$ans";;
15126         esac
15127         ;;
15128 esac
15129
15130 : if this fails, just run all the .SH files by hand
15131 . ./config.sh
15132
15133 echo " "
15134 exec 1>&4
15135 . ./UU/extract
15136
15137 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15138         dflt=y
15139         case "$silent" in
15140         true) ;;
15141         *)
15142                 $cat <<EOM
15143
15144 Now you need to generate make dependencies by running "$make depend".
15145 You might prefer to run it in background: "$make depend > makedepend.out &"
15146 It can take a while, so you might not want to run it right now.
15147
15148 EOM
15149                 ;;
15150         esac
15151         rp="Run $make depend now?"
15152         . UU/myread
15153         case "$ans" in
15154         y*)
15155                 $make depend && echo "Now you must run a $make."
15156                 ;;
15157         *)
15158                 echo "You must run '$make depend' then '$make'."
15159                 ;;
15160         esac
15161 elif test -f [Mm]akefile; then
15162         echo " "
15163         echo "Now you must run a $make."
15164 else
15165         echo "Done."
15166 fi
15167
15168 if $test -f Policy.sh; then
15169     $cat <<EOM
15170
15171 If you compile $package on a different machine or from a different object
15172 directory, copy the Policy.sh file from this object directory to the
15173 new one before you run Configure -- this will help you with most of
15174 the policy defaults.
15175
15176 EOM
15177 fi
15178 if $test -f config.msg; then
15179     echo "Hmm.  I also noted the following information while running:"
15180     echo " "
15181     $cat config.msg >&4
15182     $rm -f config.msg
15183 fi
15184 $rm -f kit*isdone ark*isdone
15185 $rm -rf UU
15186
15187 : End of Configure
15188