d4741cb0fce309a44fa54ce761934060f9a23da4
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sun Jan 16 21:08:34 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         esac
3104 else
3105         echo " "
3106         echo "*** WHOA THERE!!! ***" >&4
3107         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3108         case "$knowitall" in
3109         '')
3110         echo "    You'd better start hunting for one and let me know about it." >&4
3111                 exit 1
3112                 ;;
3113         esac
3114 fi
3115 $rm -f gccvers*
3116 case "$gccversion" in
3117 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3118 esac
3119
3120 : see how we invoke the C preprocessor
3121 echo " "
3122 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3123 cat <<'EOT' >testcpp.c
3124 #define ABC abc
3125 #define XYZ xyz
3126 ABC.XYZ
3127 EOT
3128 cd ..
3129 if test ! -f cppstdin; then
3130         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3131                 # AIX cc -E doesn't show the absolute headerfile
3132                 # locations but we'll cheat by using the -M flag.
3133                 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
3134         else
3135                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3136         fi
3137 else
3138         echo "Keeping your $hint cppstdin wrapper."
3139 fi
3140 chmod 755 cppstdin
3141 wrapper=`pwd`/cppstdin
3142 ok='false'
3143 cd UU
3144
3145 if $test "X$cppstdin" != "X" && \
3146         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3147         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3148 then
3149         echo "You used to use $cppstdin $cppminus so we'll use that again."
3150         case "$cpprun" in
3151         '') echo "But let's see if we can live without a wrapper..." ;;
3152         *)
3153                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3154                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3155                 then
3156                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3157                         ok='true'
3158                 else
3159                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3160                 fi
3161                 ;;
3162         esac
3163 else
3164         case "$cppstdin" in
3165         '') ;;
3166         *)
3167                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3168                 ;;
3169         esac
3170 fi
3171
3172 if $ok; then
3173         : nothing
3174 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3175         $cc -E <testcpp.c >testcpp.out 2>&1; \
3176         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3177         echo "Yup, it does."
3178         x_cpp="$cc -E"
3179         x_minus='';
3180 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3181         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3182         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3183         echo "Yup, it does."
3184         x_cpp="$cc -E"
3185         x_minus='-';
3186 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3187         $cc -P <testcpp.c >testcpp.out 2>&1; \
3188         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3189         echo "Yipee, that works!"
3190         x_cpp="$cc -P"
3191         x_minus='';
3192 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3193         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3194         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3195         echo "At long last!"
3196         x_cpp="$cc -P"
3197         x_minus='-';
3198 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3199         $cpp <testcpp.c >testcpp.out 2>&1; \
3200         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3201         echo "It works!"
3202         x_cpp="$cpp"
3203         x_minus='';
3204 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3205         $cpp - <testcpp.c >testcpp.out 2>&1; \
3206         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3207         echo "Hooray, it works!  I was beginning to wonder."
3208         x_cpp="$cpp"
3209         x_minus='-';
3210 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3211         $wrapper <testcpp.c >testcpp.out 2>&1; \
3212         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3213         x_cpp="$wrapper"
3214         x_minus=''
3215         echo "Eureka!"
3216 else
3217         dflt=''
3218         rp="No dice.  I can't find a C preprocessor.  Name one:"
3219         . ./myread
3220         x_cpp="$ans"
3221         x_minus=''
3222         $x_cpp <testcpp.c >testcpp.out 2>&1
3223         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3224                 echo "OK, that will do." >&4
3225         else
3226 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3227                 exit 1
3228         fi
3229 fi
3230
3231 case "$ok" in
3232 false)
3233         cppstdin="$x_cpp"
3234         cppminus="$x_minus"
3235         cpprun="$x_cpp"
3236         cpplast="$x_minus"
3237         set X $x_cpp
3238         shift
3239         case "$1" in
3240         "$cpp")
3241                 echo "Perhaps can we force $cc -E using a wrapper..."
3242                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3243                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3244                 then
3245                         echo "Yup, we can."
3246                         cppstdin="$wrapper"
3247                         cppminus='';
3248                 else
3249                         echo "Nope, we'll have to live without it..."
3250                 fi
3251                 ;;
3252         esac
3253         case "$cpprun" in
3254         "$wrapper")
3255                 cpprun=''
3256                 cpplast=''
3257                 ;;
3258         esac
3259         ;;
3260 esac
3261
3262 case "$cppstdin" in
3263 "$wrapper"|'cppstdin') ;;
3264 *) $rm -f $wrapper;;
3265 esac
3266 $rm -f testcpp.c testcpp.out
3267
3268 : decide how portable to be.  Allow command line overrides.
3269 case "$d_portable" in
3270 "$undef") ;;
3271 *)      d_portable="$define" ;;
3272 esac
3273
3274 : set up shell script to do ~ expansion
3275 cat >filexp <<EOSS
3276 $startsh
3277 : expand filename
3278 case "\$1" in
3279  ~/*|~)
3280         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3281         ;;
3282  ~*)
3283         if $test -f /bin/csh; then
3284                 /bin/csh -f -c "glob \$1"
3285                 failed=\$?
3286                 echo ""
3287                 exit \$failed
3288         else
3289                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3290                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3291                 if $test ! -d "\$dir"; then
3292                         me=\`basename \$0\`
3293                         echo "\$me: can't locate home directory for: \$name" >&2
3294                         exit 1
3295                 fi
3296                 case "\$1" in
3297                 */*)
3298                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3299                         ;;
3300                 *)
3301                         echo \$dir
3302                         ;;
3303                 esac
3304         fi
3305         ;;
3306 *)
3307         echo \$1
3308         ;;
3309 esac
3310 EOSS
3311 chmod +x filexp
3312 $eunicefix filexp
3313
3314 : now set up to get a file name
3315 cat <<EOS >getfile
3316 $startsh
3317 EOS
3318 cat <<'EOSC' >>getfile
3319 tilde=''
3320 fullpath=''
3321 already=''
3322 skip=''
3323 none_ok=''
3324 exp_file=''
3325 nopath_ok=''
3326 orig_rp="$rp"
3327 orig_dflt="$dflt"
3328 case "$gfpth" in
3329 '') gfpth='.' ;;
3330 esac
3331
3332 case "$fn" in
3333 *\(*)
3334         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3335         fn=`echo $fn | sed 's/(.*)//'`
3336         ;;
3337 esac
3338
3339 case "$fn" in
3340 *:*)
3341         loc_file=`expr $fn : '.*:\(.*\)'`
3342         fn=`expr $fn : '\(.*\):.*'`
3343         ;;
3344 esac
3345
3346 case "$fn" in
3347 *~*) tilde=true;;
3348 esac
3349 case "$fn" in
3350 */*) fullpath=true;;
3351 esac
3352 case "$fn" in
3353 *+*) skip=true;;
3354 esac
3355 case "$fn" in
3356 *n*) none_ok=true;;
3357 esac
3358 case "$fn" in
3359 *e*) exp_file=true;;
3360 esac
3361 case "$fn" in
3362 *p*) nopath_ok=true;;
3363 esac
3364
3365 case "$fn" in
3366 *f*) type='File';;
3367 *d*) type='Directory';;
3368 *l*) type='Locate';;
3369 esac
3370
3371 what="$type"
3372 case "$what" in
3373 Locate) what='File';;
3374 esac
3375
3376 case "$exp_file" in
3377 '')
3378         case "$d_portable" in
3379         "$define") ;;
3380         *) exp_file=true;;
3381         esac
3382         ;;
3383 esac
3384
3385 cd ..
3386 while test "$type"; do
3387         redo=''
3388         rp="$orig_rp"
3389         dflt="$orig_dflt"
3390         case "$tilde" in
3391         true) rp="$rp (~name ok)";;
3392         esac
3393         . UU/myread
3394         if test -f UU/getfile.ok && \
3395                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3396         then
3397                 value="$ans"
3398                 ansexp="$ans"
3399                 break
3400         fi
3401         case "$ans" in
3402         none)
3403                 value=''
3404                 ansexp=''
3405                 case "$none_ok" in
3406                 true) type='';;
3407                 esac
3408                 ;;
3409         *)
3410                 case "$tilde" in
3411                 '') value="$ans"
3412                         ansexp="$ans";;
3413                 *)
3414                         value=`UU/filexp $ans`
3415                         case $? in
3416                         0)
3417                                 if test "$ans" != "$value"; then
3418                                         echo "(That expands to $value on this system.)"
3419                                 fi
3420                                 ;;
3421                         *) value="$ans";;
3422                         esac
3423                         ansexp="$value"
3424                         case "$exp_file" in
3425                         '') value="$ans";;
3426                         esac
3427                         ;;
3428                 esac
3429                 case "$fullpath" in
3430                 true)
3431                         case "$ansexp" in
3432                         /*) value="$ansexp" ;;
3433                         *)
3434                                 redo=true
3435                                 case "$already" in
3436                                 true)
3437                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3438                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3439                                         ;;
3440                                 *)
3441                                 echo "Please give a full path name, starting with slash." >&4
3442                                         case "$tilde" in
3443                                         true)
3444                                 echo "Note that using ~name is ok provided it expands well." >&4
3445                                                 already=true
3446                                                 ;;
3447                                         esac
3448                                 esac
3449                                 ;;
3450                         esac
3451                         ;;
3452                 esac
3453                 case "$redo" in
3454                 '')
3455                         case "$type" in
3456                         File)
3457                                 for fp in $gfpth; do
3458                                         if test "X$fp" = X.; then
3459                                             pf="$ansexp"
3460                                         else    
3461                                             pf="$fp/$ansexp"
3462                                         fi
3463                                         if test -f "$pf"; then
3464                                                 type=''
3465                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3466                                         then
3467                                                 echo "($value is not a plain file, but that's ok.)"
3468                                                 type=''
3469                                         fi
3470                                         if test X"$type" = X; then
3471                                             value="$pf"
3472                                             break
3473                                         fi
3474                                 done
3475                                 ;;
3476                         Directory)
3477                                 for fp in $gfpth; do
3478                                         if test "X$fp" = X.; then
3479                                             pf="$ansexp"
3480                                         else    
3481                                             pf="$fp/$ansexp"
3482                                         fi
3483                                         if test -d "$pf"; then
3484                                                 type=''
3485                                                 value="$pf"
3486                                                 break
3487                                         fi
3488                                 done
3489                                 ;;
3490                         Locate)
3491                                 if test -d "$ansexp"; then
3492                                         echo "(Looking for $loc_file in directory $value.)"
3493                                         value="$value/$loc_file"
3494                                         ansexp="$ansexp/$loc_file"
3495                                 fi
3496                                 if test -f "$ansexp"; then
3497                                         type=''
3498                                 fi
3499                                 case "$nopath_ok" in
3500                                 true)   case "$value" in
3501                                         */*) ;;
3502                                         *)      echo "Assuming $value will be in people's path."
3503                                                 type=''
3504                                                 ;;
3505                                         esac
3506                                         ;;
3507                                 esac
3508                                 ;;
3509                         esac
3510
3511                         case "$skip" in
3512                         true) type='';
3513                         esac
3514
3515                         case "$type" in
3516                         '') ;;
3517                         *)
3518                                 if test "$fastread" = yes; then
3519                                         dflt=y
3520                                 else
3521                                         dflt=n
3522                                 fi
3523                                 rp="$what $value doesn't exist.  Use that name anyway?"
3524                                 . UU/myread
3525                                 dflt=''
3526                                 case "$ans" in
3527                                 y*) type='';;
3528                                 *) echo " ";;
3529                                 esac
3530                                 ;;
3531                         esac
3532                         ;;
3533                 esac
3534                 ;;
3535         esac
3536 done
3537 cd UU
3538 ans="$value"
3539 rp="$orig_rp"
3540 dflt="$orig_dflt"
3541 rm -f getfile.ok
3542 test "X$gfpthkeep" != Xy && gfpth=""
3543 EOSC
3544
3545 : What should the include directory be ?
3546 echo " "
3547 $echo $n "Hmm...  $c"
3548 dflt='/usr/include'
3549 incpath=''
3550 mips_type=''
3551 if $test -f /bin/mips && /bin/mips; then
3552         echo "Looks like a MIPS system..."
3553         $cat >usr.c <<'EOCP'
3554 #ifdef SYSTYPE_BSD43
3555 /bsd43
3556 #endif
3557 EOCP
3558         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3559                 dflt='/bsd43/usr/include'
3560                 incpath='/bsd43'
3561                 mips_type='BSD 4.3'
3562         else
3563                 mips_type='System V'
3564         fi
3565         $rm -f usr.c usr.out
3566         echo "and you're compiling with the $mips_type compiler and libraries."
3567         xxx_prompt=y
3568         echo "exit 0" >mips
3569 else
3570         echo "Doesn't look like a MIPS system."
3571         xxx_prompt=n
3572         echo "exit 1" >mips
3573 fi
3574 chmod +x mips
3575 $eunicefix mips
3576 case "$usrinc" in
3577 '') ;;
3578 *) dflt="$usrinc";;
3579 esac
3580 case "$xxx_prompt" in
3581 y)      fn=d/
3582         echo " "
3583         rp='Where are the include files you want to use?'
3584         . ./getfile
3585         usrinc="$ans"
3586         ;;
3587 *)      usrinc="$dflt"
3588         ;;
3589 esac
3590
3591 : Set private lib path
3592 case "$plibpth" in
3593 '') if ./mips; then
3594                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3595         fi;;
3596 esac
3597 case "$libpth" in
3598 ' ') dlist='';;
3599 '') dlist="$loclibpth $plibpth $glibpth";;
3600 *) dlist="$libpth";;
3601 esac
3602
3603 : Now check and see which directories actually exist, avoiding duplicates
3604 libpth=''
3605 for xxx in $dlist
3606 do
3607     if $test -d $xxx; then
3608                 case " $libpth " in
3609                 *" $xxx "*) ;;
3610                 *) libpth="$libpth $xxx";;
3611                 esac
3612     fi
3613 done
3614 $cat <<'EOM'
3615
3616 Some systems have incompatible or broken versions of libraries.  Among
3617 the directories listed in the question below, please remove any you
3618 know not to be holding relevant libraries, and add any that are needed.
3619 Say "none" for none.
3620
3621 EOM
3622 case "$libpth" in
3623 '') dflt='none';;
3624 *)
3625         set X $libpth
3626         shift
3627         dflt=${1+"$@"}
3628         ;;
3629 esac
3630 rp="Directories to use for library searches?"
3631 . ./myread
3632 case "$ans" in
3633 none) libpth=' ';;
3634 *) libpth="$ans";;
3635 esac
3636
3637 : compute shared library extension
3638 case "$so" in
3639 '')
3640         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3641                 dflt='sl'
3642         else
3643                 dflt='so'
3644         fi
3645         ;;
3646 *) dflt="$so";;
3647 esac
3648 $cat <<EOM
3649
3650 On some systems, shared libraries may be available.  Answer 'none' if
3651 you want to suppress searching of shared libraries for the remaining
3652 of this configuration.
3653
3654 EOM
3655 rp='What is the file extension used for shared libraries?'
3656 . ./myread
3657 so="$ans"
3658
3659 : Define several unixisms.
3660 : Hints files or command line option can be used to override them.
3661 : The convoluted testing is in case hints files set either the old
3662 : or the new name.
3663 case "$_exe" in
3664 '')     case "$exe_ext" in
3665     '') ;;
3666         *)      _exe="$exe_ext" ;;
3667         esac
3668         ;;
3669 esac
3670 case "$_a" in
3671 '')     case "$lib_ext" in
3672     '') _a='.a';;
3673         *)      _a="$lib_ext" ;;
3674         esac
3675         ;;
3676 esac
3677 case "$_o" in
3678 '') case "$obj_ext" in
3679         '')     _o='.o';;
3680         *)      _o="$obj_ext";;
3681         esac
3682         ;;
3683 esac
3684 case "$p_" in
3685 '') case "$path_sep" in
3686         '')     p_=':';;
3687         *)      p_="$path_sep";;
3688         esac
3689         ;;
3690 esac
3691 exe_ext=$_exe
3692 lib_ext=$_a
3693 obj_ext=$_o
3694 path_sep=$p_
3695
3696 : Which makefile gets called first.  This is used by make depend.
3697 case "$firstmakefile" in
3698 '') firstmakefile='makefile';;
3699 esac
3700
3701 cat <<EOM
3702
3703 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3704 Configure must be run with -Dusesocks.
3705
3706 Normally you do not need this and you should answer no.
3707
3708 EOM
3709 case "$usesocks" in
3710 $define|true|[yY]*)     dflt='y';;
3711 *) dflt='n';;
3712 esac
3713 rp='Build Perl for SOCKS?'
3714 . ./myread
3715 case "$ans" in
3716 y|Y)    val="$define" ;;     
3717 *)      val="$undef" ;;
3718 esac
3719 set usesocks
3720 eval $setvar
3721
3722 : Looking for optional libraries
3723 echo " "
3724 echo "Checking for optional libraries..." >&4
3725 case "$libs" in
3726 ' '|'') dflt='';;
3727 *) dflt="$libs";;
3728 esac
3729 case "$libswanted" in
3730 '') libswanted='c_s';;
3731 esac
3732 case "$usesocks" in
3733 $define)
3734         libswanted="$libswanted socks5 socks5_sh"
3735         ;;
3736 esac
3737 for thislib in $libswanted; do
3738         
3739         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3740                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3741                 echo "Found -l$thislib (shared)."
3742                 case " $dflt " in
3743                 *"-l$thislib "*);;
3744                 *) dflt="$dflt -l$thislib";;
3745                 esac
3746         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3747                 echo "Found -l$thislib (shared)."
3748                 case " $dflt " in
3749                 *"-l$thislib "*);;
3750                 *) dflt="$dflt -l$thislib";;
3751                 esac
3752         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3753                 echo "Found -l$thislib."
3754                 case " $dflt " in
3755                 *"-l$thislib "*);;
3756                 *) dflt="$dflt -l$thislib";;
3757                 esac
3758         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3759                 echo "Found -l$thislib."
3760                 case " $dflt " in
3761                 *"-l$thislib "*);;
3762                 *) dflt="$dflt -l$thislib";;
3763                 esac
3764         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3765                 echo "Found -l${thislib}_s."
3766                 case " $dflt " in
3767                 *"-l$thislib "*);;
3768                 *) dflt="$dflt -l${thislib}_s";;
3769                 esac
3770         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3771                 echo "Found -l$thislib."
3772                 case " $dflt " in
3773                 *"-l$thislib "*);;
3774                 *) dflt="$dflt -l$thislib";;
3775                 esac
3776         else
3777                 echo "No -l$thislib."
3778         fi
3779 done
3780 set X $dflt
3781 shift
3782 dflt="$*"
3783 case "$libs" in
3784 '') dflt="$dflt";;
3785 *) dflt="$libs";;
3786 esac
3787 case "$dflt" in
3788 ' '|'') dflt='none';;
3789 esac
3790
3791 $cat <<EOM
3792
3793 In order to compile $package on your machine, a number of libraries
3794 are usually needed.  Include any other special libraries here as well.
3795 Say "none" for none.  The default list is almost always right.
3796 EOM
3797
3798 echo " "
3799 rp="What libraries to use?"
3800 . ./myread
3801 case "$ans" in
3802 none) libs=' ';;
3803 *) libs="$ans";;
3804 esac
3805
3806 : determine optimization, if desired, or use for debug flag also
3807 case "$optimize" in
3808 ' '|$undef) dflt='none';;
3809 '') dflt='-O';;
3810 *) dflt="$optimize";;
3811 esac
3812 $cat <<EOH
3813
3814 By default, $package compiles with the -O flag to use the optimizer.
3815 Alternately, you might want to use the symbolic debugger, which uses
3816 the -g flag (on traditional Unix systems).  Either flag can be
3817 specified here.  To use neither flag, specify the word "none".
3818
3819 EOH
3820 rp="What optimizer/debugger flag should be used?"
3821 . ./myread
3822 optimize="$ans"
3823 case "$optimize" in
3824 'none') optimize=" ";;
3825 esac
3826
3827 dflt=''
3828 : We will not override a previous value, but we might want to
3829 : augment a hint file
3830 case "$hint" in
3831 default|recommended)
3832         case "$gccversion" in
3833         1*) dflt='-fpcc-struct-return' ;;
3834         esac
3835         case "$optimize" in
3836         *-g*) dflt="$dflt -DDEBUGGING";;
3837         esac
3838         case "$gccversion" in
3839         2*) if test -d /etc/conf/kconfig.d &&
3840                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3841                 then
3842                         dflt="$dflt -posix"
3843                 fi
3844                 ;;
3845         esac
3846         case "$gccversion" in
3847         1*) ;;
3848         2.[0-8]*) ;;
3849         ?*)     echo " "
3850                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3851                 echo 'int main(void) { return 0; }' > gcctest.c
3852                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3853                         echo "Yes, it does." 2>&1
3854                         case "$ccflags" in
3855                         *strict-aliasing*) 
3856                                 echo "Leaving current flags $ccflags alone." 2>&1
3857                                 ;;
3858                         *) dflt="$dflt -fno-strict-aliasing" ;;
3859                         esac
3860                 else
3861                         echo "Nope, it doesn't, but that's ok." 2>&1
3862                 fi
3863                 ;;
3864         esac
3865         ;;
3866 esac
3867
3868 case "$mips_type" in
3869 *BSD*|'') inclwanted="$locincpth $usrinc";;
3870 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3871 esac
3872 for thisincl in $inclwanted; do
3873         if $test -d $thisincl; then
3874                 if $test x$thisincl != x$usrinc; then
3875                         case "$dflt" in
3876                         *$thisincl*);;
3877                         *) dflt="$dflt -I$thisincl";;
3878                         esac
3879                 fi
3880         fi
3881 done
3882
3883 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3884         xxx=true;
3885 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3886         xxx=true;
3887 else
3888         xxx=false;
3889 fi;
3890 if $xxx; then
3891         case "$dflt" in
3892         *$2*);;
3893         *) dflt="$dflt -D$2";;
3894         esac;
3895 fi'
3896
3897 set signal.h LANGUAGE_C; eval $inctest
3898
3899 case "$usesocks" in
3900 $define)
3901         ccflags="$ccflags -DSOCKS"
3902         ;;
3903 esac
3904
3905 case "$hint" in
3906 default|recommended) dflt="$ccflags $dflt" ;;
3907 *) dflt="$ccflags";;
3908 esac
3909
3910 case "$dflt" in
3911 ''|' ') dflt=none;;
3912 esac
3913 $cat <<EOH
3914
3915 Your C compiler may want other flags.  For this question you should include
3916 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3917 but you should NOT include libraries or ld flags like -lwhatever.  If you
3918 want $package to honor its debug switch, you should include -DDEBUGGING here.
3919 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3920
3921 To use no flags, specify the word "none".
3922
3923 EOH
3924 set X $dflt
3925 shift
3926 dflt=${1+"$@"}
3927 rp="Any additional cc flags?"
3928 . ./myread
3929 case "$ans" in
3930 none) ccflags='';;
3931 *) ccflags="$ans";;
3932 esac
3933
3934 : the following weeds options from ccflags that are of no interest to cpp
3935 cppflags="$ccflags"
3936 case "$gccversion" in
3937 1*) cppflags="$cppflags -D__GNUC__"
3938 esac
3939 case "$mips_type" in
3940 '');;
3941 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3942 esac
3943 case "$cppflags" in
3944 '');;
3945 *)
3946         echo " "
3947         echo "Let me guess what the preprocessor flags are..." >&4
3948         set X $cppflags
3949         shift
3950         cppflags=''
3951         $cat >cpp.c <<'EOM'
3952 #define BLURFL foo
3953
3954 BLURFL xx LFRULB
3955 EOM
3956         previous=''
3957         for flag in $*
3958         do
3959                 case "$flag" in
3960                 -*) ftry="$flag";;
3961                 *) ftry="$previous $flag";;
3962                 esac
3963                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3964                         >cpp1.out 2>/dev/null && \
3965                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3966                         >cpp2.out 2>/dev/null && \
3967                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3968                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3969                 then
3970                         cppflags="$cppflags $ftry"
3971                         previous=''
3972                 else
3973                         previous="$flag"
3974                 fi
3975         done
3976         set X $cppflags
3977         shift
3978         cppflags=${1+"$@"}
3979         case "$cppflags" in
3980         *-*)  echo "They appear to be: $cppflags";;
3981         esac
3982         $rm -f cpp.c cpp?.out
3983         ;;
3984 esac
3985
3986 : flags used in final linking phase
3987 case "$ldflags" in
3988 '') if ./venix; then
3989                 dflt='-i -z'
3990         else
3991                 dflt=''
3992         fi
3993         case "$ccflags" in
3994         *-posix*) dflt="$dflt -posix" ;;
3995         esac
3996         ;;
3997 *) dflt="$ldflags";;
3998 esac
3999
4000 : Try to guess additional flags to pick up local libraries.
4001 for thislibdir in $libpth; do
4002         case " $loclibpth " in
4003         *" $thislibdir "*)
4004                 case "$dflt " in 
4005                 *"-L$thislibdir "*) ;;
4006                 *)  dflt="$dflt -L$thislibdir" ;;
4007                 esac
4008                 ;;
4009         esac
4010 done
4011
4012 case "$dflt" in
4013 '') dflt='none' ;;
4014 esac
4015
4016 $cat <<EOH
4017
4018 Your C linker may need flags.  For this question you should
4019 include -L/whatever and any other flags used by the C linker, but you
4020 should NOT include libraries like -lwhatever.
4021
4022 Make sure you include the appropriate -L/path flags if your C linker
4023 does not normally search all of the directories you specified above,
4024 namely
4025         $libpth
4026 To use no flags, specify the word "none".
4027
4028 EOH
4029
4030 rp="Any additional ld flags (NOT including libraries)?"
4031 . ./myread
4032 case "$ans" in
4033 none) ldflags='';;
4034 *) ldflags="$ans";;
4035 esac
4036 rmlist="$rmlist pdp11"
4037
4038 : coherency check
4039 echo " "
4040 echo "Checking your choice of C compiler and flags for coherency..." >&4
4041 $cat > try.c <<'EOF'
4042 #include <stdio.h>
4043 int main() { printf("Ok\n"); exit(0); }
4044 EOF
4045 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4046 shift
4047 $cat >try.msg <<'EOM'
4048 I've tried to compile and run the following simple program:
4049
4050 EOM
4051 $cat try.c >> try.msg
4052
4053 $cat >> try.msg <<EOM
4054
4055 I used the command:
4056
4057         $*
4058         ./try
4059
4060 and I got the following output:
4061
4062 EOM
4063 dflt=y
4064 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4065         if sh -c './try' >>try.msg 2>&1; then
4066                 xxx=`./try`
4067                 case "$xxx" in
4068                 "Ok") dflt=n ;;
4069                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4070                         case " $libs " in
4071                         *" -lsfio "*)
4072                                 cat >> try.msg <<'EOQS'
4073 If $libs contains -lsfio, and sfio is mis-configured, then it
4074 sometimes (apparently) runs and exits with a 0 status, but with no
4075 output!  It may have to do with sfio's use of _exit vs. exit.
4076
4077 EOQS
4078                                 rp="You have a big problem.  Shall I abort Configure"
4079                                 dflt=y
4080                                 ;;
4081                         esac
4082                         ;;
4083                 esac
4084         else
4085                 echo "The program compiled OK, but exited with status $?." >>try.msg
4086                 rp="You have a problem.  Shall I abort Configure"
4087                 dflt=y
4088         fi
4089 else
4090         echo "I can't compile the test program." >>try.msg
4091         rp="You have a BIG problem.  Shall I abort Configure"
4092         dflt=y
4093 fi
4094 case "$dflt" in
4095 y)
4096         $cat try.msg >&4
4097         case "$knowitall" in
4098         '')
4099                 echo "(The supplied flags or libraries might be incorrect.)"
4100                 ;;
4101         *) dflt=n;;
4102         esac
4103         echo " "
4104         . ./myread
4105         case "$ans" in
4106         n*|N*) ;;
4107         *)      echo "Ok.  Stopping Configure." >&4
4108                 exit 1
4109                 ;;
4110         esac
4111         ;;
4112 n) echo "OK, that should do.";;
4113 esac
4114 $rm -f try try.* core
4115
4116 : define an is-a-typedef? function
4117 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4118 case "$inclist" in
4119 "") inclist="sys/types.h";;
4120 esac;
4121 eval "varval=\$$var";
4122 case "$varval" in
4123 "")
4124         $rm -f temp.c;
4125         for inc in $inclist; do
4126                 echo "#include <$inc>" >>temp.c;
4127         done;
4128         echo "#ifdef $type" >> temp.c;
4129         echo "printf(\"We have $type\");" >> temp.c;
4130         echo "#endif" >> temp.c;
4131         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4132         if $contains $type temp.E >/dev/null 2>&1; then
4133                 eval "$var=\$type";
4134         else
4135                 eval "$var=\$def";
4136         fi;
4137         $rm -f temp.?;;
4138 *) eval "$var=\$varval";;
4139 esac'
4140
4141 : define an is-a-typedef? function that prompts if the type is not available.
4142 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4143 case "$inclist" in
4144 "") inclist="sys/types.h";;
4145 esac;
4146 eval "varval=\$$var";
4147 case "$varval" in
4148 "")
4149         $rm -f temp.c;
4150         for inc in $inclist; do
4151                 echo "#include <$inc>" >>temp.c;
4152         done;
4153         echo "#ifdef $type" >> temp.c;
4154         echo "printf(\"We have $type\");" >> temp.c;
4155         echo "#endif" >> temp.c;
4156         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4157         echo " " ;
4158         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4159         if $contains $type temp.E >/dev/null 2>&1; then
4160                 echo "$type found." >&4;
4161                 eval "$var=\$type";
4162         else
4163                 echo "$type NOT found." >&4;
4164                 dflt="$def";
4165                 . ./myread ;
4166                 eval "$var=\$ans";
4167         fi;
4168         $rm -f temp.?;;
4169 *) eval "$var=\$varval";;
4170 esac'
4171
4172 : define a shorthand compile call
4173 compile='
4174 mc_file=$1;
4175 shift;
4176 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4177 : define a shorthand compile call for compilations that should be ok.
4178 compile_ok='
4179 mc_file=$1;
4180 shift;
4181 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4182
4183 : check for lengths of integral types
4184 echo " "
4185 case "$intsize" in
4186 '')
4187         echo "Checking to see how big your integers are..." >&4
4188         $cat >intsize.c <<'EOCP'
4189 #include <stdio.h>
4190 int main()
4191 {
4192         printf("intsize=%d;\n", (int)sizeof(int));
4193         printf("longsize=%d;\n", (int)sizeof(long));
4194         printf("shortsize=%d;\n", (int)sizeof(short));
4195         exit(0);
4196 }
4197 EOCP
4198         set intsize
4199         if eval $compile_ok && ./intsize > /dev/null; then
4200                 eval `./intsize`
4201                 echo "Your integers are $intsize bytes long."
4202                 echo "Your long integers are $longsize bytes long."
4203                 echo "Your short integers are $shortsize bytes long."
4204         else
4205                 $cat >&4 <<EOM
4206 !
4207 Help! I can't compile and run the intsize test program: please enlighten me!
4208 (This is probably a misconfiguration in your system or libraries, and
4209 you really ought to fix it.  Still, I'll try anyway.)
4210 !
4211 EOM
4212                 dflt=4
4213                 rp="What is the size of an integer (in bytes)?"
4214                 . ./myread
4215                 intsize="$ans"
4216                 dflt=$intsize
4217                 rp="What is the size of a long integer (in bytes)?"
4218                 . ./myread
4219                 longsize="$ans"
4220                 dflt=2
4221                 rp="What is the size of a short integer (in bytes)?"
4222                 . ./myread
4223                 shortsize="$ans"
4224         fi
4225         ;;
4226 esac
4227 $rm -f intsize intsize.*
4228
4229 : see what type lseek is declared as in the kernel
4230 rp="What is the type used for lseek's offset on this system?"
4231 set off_t lseektype long stdio.h sys/types.h
4232 eval $typedef_ask
4233
4234 echo " "
4235 $echo $n "Checking to see how big your file offsets are...$c" >&4
4236 $cat >try.c <<EOCP
4237 #include <sys/types.h>
4238 #include <stdio.h>
4239 int main()
4240 {
4241     printf("%d\n", (int)sizeof($lseektype));
4242     return(0); 
4243 }
4244 EOCP
4245 set try
4246 if eval $compile_ok; then
4247         lseeksize=`./try`
4248         $echo " $lseeksize bytes." >&4
4249 else
4250         dflt=$longsize
4251         echo " "
4252         echo "(I can't seem to compile the test program.  Guessing...)"
4253         rp="What is the size of your file offsets (in bytes)?"
4254         . ./myread
4255         lseeksize="$ans"
4256 fi
4257 $rm -f try.c try
4258
4259 : see what type file positions are declared as in the library
4260 rp="What is the type for file position used by fsetpos()?"
4261 set fpos_t fpostype long stdio.h sys/types.h
4262 eval $typedef_ask
4263
4264 echo " "
4265 case "$fpostype" in
4266 *_t) zzz="$fpostype"    ;;
4267 *)   zzz="fpos_t"       ;;
4268 esac
4269 $echo $n "Checking the size of $zzz...$c" >&4 
4270 cat > try.c <<EOCP
4271 #include <sys/types.h>
4272 #include <stdio.h>
4273 int main() {
4274     printf("%d\n", (int)sizeof($fpostype));
4275     exit(0);
4276 }
4277 EOCP
4278 set try
4279 if eval $compile_ok; then
4280         yyy=`./try`
4281         case "$yyy" in
4282         '')     fpossize=4
4283                 echo " "
4284                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4285                 ;;
4286         *)      fpossize=$yyy
4287                 echo " $fpossize bytes."
4288                 ;;
4289         esac
4290 else
4291         dflt="$longsize"
4292         echo " "
4293         echo "(I can't compile the test program.  Guessing...)" >&4
4294         rp="What is the size of your file positions (in bytes)?"
4295         . ./myread
4296         fpossize="$ans"
4297 fi
4298
4299
4300
4301 case "$lseeksize:$fpossize" in
4302 8:8) cat <<EOM
4303
4304 You can have files larger than 2 gigabytes.
4305 EOM
4306    val="$define" ;;
4307 *) cat <<EOM
4308
4309 Perl can be built to understand large files (files larger than 2 gigabytes)
4310 on some systems.  To do so, Configure must be run with -Duselargefiles.
4311
4312 If this doesn't make any sense to you, just accept the default 'y'.
4313 EOM
4314    case "$uselargefiles" in
4315    "$undef"|false|[nN]*) dflt='n' ;;
4316    *)   dflt='y' ;;
4317    esac
4318    rp='Try to understand large files, if available?'
4319    . ./myread
4320    case "$ans" in
4321    y|Y)         val="$define" ;;
4322    *)           val="$undef"  ;;
4323    esac
4324    ;;
4325 esac
4326 set uselargefiles
4327 eval $setvar
4328 case "$uselargefiles" in
4329 "$define")
4330 : Look for a hint-file generated 'call-back-unit'.  If the
4331 : user has specified that a large files perl is to be built,
4332 : we may need to set or change some other defaults.
4333         if $test -f uselfs.cbu; then
4334                 echo "Your platform has some specific hints for large file builds, using them..."
4335                 . ./uselfs.cbu
4336                 echo " "
4337                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4338                 $cat >try.c <<EOCP
4339 #include <sys/types.h>
4340 #include <stdio.h>
4341 int main()
4342 {
4343     printf("%d\n", (int)sizeof($lseektype));
4344     return(0); 
4345 }
4346 EOCP
4347                 set try
4348                 if eval $compile_ok; then
4349                         lseeksize=`./try`
4350                         $echo " $lseeksize bytes." >&4
4351                 else
4352                         dflt="$lseeksize"
4353                         echo " "
4354                         echo "(I can't seem to compile the test program.  Guessing...)"
4355                         rp="What is the size of your file offsets (in bytes)?"
4356                         . ./myread
4357                         lseeksize="$ans"
4358                 fi
4359                 case "$fpostype" in
4360                 *_t) zzz="$fpostype"    ;;
4361                 *)   zzz="fpos_t"       ;;
4362                 esac
4363                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4364                 $cat > try.c <<EOCP
4365 #include <sys/types.h>
4366 #include <stdio.h>
4367 int main() {
4368     printf("%d\n", (int)sizeof($fpostype));
4369     exit(0);
4370 }
4371 EOCP
4372                 set try
4373                 if eval $compile_ok; then
4374                         yyy=`./try`
4375                         dflt="$lseeksize"
4376                         case "$yyy" in
4377                         '')     echo " "
4378                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4379                                 ;;
4380                         *)      fpossize=$yyy
4381                                 echo " $fpossize bytes."
4382                                 ;;
4383                         esac
4384                 else
4385                         dflt="$fpossize"
4386                         echo " "
4387                         echo "(I can't compile the test program.  Guessing...)" >&4
4388                         rp="What is the size of your file positions (in bytes)?"
4389                         . ./myread
4390                         fpossize="$ans"
4391                 fi
4392                 $rm -f try.c try
4393         fi
4394         ;;
4395 esac
4396
4397
4398 case "$usemorebits" in
4399 "$define"|true|[yY]*)
4400         use64bits="$define"
4401         uselongdouble="$define"
4402         usemorebits="$define"
4403         ;;
4404 *)      usemorebits="$undef"
4405         ;;
4406 esac
4407
4408
4409 case "$intsize:$longsize" in
4410 8:*|*:8) cat <<EOM
4411
4412 You have natively 64-bit integers.
4413 EOM
4414    val="$define" ;;
4415 *) cat <<EOM
4416
4417 Perl can be built to take advantage of 64-bit integer types
4418 on some systems.  To do so, Configure must be run with -Duse64bits.
4419
4420 If this doesn't make any sense to you, just accept the default.
4421 EOM
4422   case "$use64bits" in
4423   $define|true|[yY]*)   dflt='y';;
4424   *) dflt='n';;
4425   esac
4426   rp='Try to use 64-bit integers, if available?'
4427   . ./myread
4428   case "$ans" in
4429   y|Y) val="$define" ;;
4430   *)   val="$undef"  ;;
4431   esac
4432   ;;
4433 esac
4434 set use64bits
4435 eval $setvar
4436
4437 case "$archname64" in
4438 '') archname64='' ;;    # not a typo
4439 esac
4440
4441 case "$use64bits" in
4442 "$define"|true|[yY]*)
4443 : Look for a hint-file generated 'call-back-unit'.  If the
4444 : user has specified that a 64-bit perl is to be built,
4445 : we may need to set or change some other defaults.
4446         if $test -f use64bits.cbu; then
4447                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4448                 . ./use64bits.cbu
4449         else
4450                 $cat <<EOM
4451 (Your platform doesn't have any specific hints for 64-bit builds.)
4452 EOM
4453                 case "$intsize:$longsize" in
4454 8:*|*:8) cat <<EOM
4455 (This is probably okay, as your system is a natively 64-bit system.)
4456 EOM
4457                   ;;
4458                 esac
4459                 case "$gccversion" in
4460                 '')     ;;
4461                 *)      case "$ccflags" in
4462                         *-DUSE_LONG_LONG*) ;;
4463                         *) $cat <<EOM
4464 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4465 to the compilation flags.
4466 EOM
4467                            ccflags="$ccflags -DUSE_LONG_LONG"
4468                            ;;
4469                         esac
4470                         ;;
4471                 esac
4472         fi
4473         ;;
4474 esac
4475
4476 : determine the architecture name
4477 echo " "
4478 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4479         tarch=`arch`"-$osname"
4480 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4481         if uname -m > tmparch 2>&1 ; then
4482                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4483                         -e 's/$/'"-$osname/" tmparch`
4484         else
4485                 tarch="$osname"
4486         fi
4487         $rm -f tmparch
4488 else
4489         tarch="$osname"
4490 fi
4491 case "$myarchname" in
4492 ''|"$tarch") ;;
4493 *)
4494         echo "(Your architecture name used to be $myarchname.)"
4495         archname=''
4496         ;;
4497 esac
4498 myarchname="$tarch"
4499 case "$archname" in
4500 '') dflt="$tarch";;
4501 *) dflt="$archname";;
4502 esac
4503 rp='What is your architecture name'
4504 . ./myread
4505 archname="$ans"
4506 case "$usethreads" in
4507 $define)
4508         echo "Threads selected." >&4
4509         case "$archname" in
4510         *-thread*) echo "...and architecture name already has -thread." >&4
4511                 ;;
4512         *)      archname="$archname-thread"
4513                 echo "...setting architecture name to $archname." >&4
4514                 ;;
4515         esac
4516         ;;
4517 esac
4518 case "$usemultiplicity" in
4519 $define)
4520         echo "Multiplicity selected." >&4
4521         case "$archname" in
4522         *-multi*) echo "...and architecture name already has -multi." >&4
4523                 ;;
4524         *)      archname="$archname-multi"
4525                 echo "...setting architecture name to $archname." >&4
4526                 ;;
4527         esac
4528         ;;
4529 esac
4530 case "$use64bits" in
4531 $define)
4532         case "$archname64" in
4533         '')
4534                 ;;
4535         *)
4536                 case "$archname" in
4537                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4538                         ;;
4539                 *)      archname="$archname-$archname64"
4540                         echo "...setting architecture name to $archname." >&4
4541                         ;;
4542                 esac
4543                 ;;
4544         esac
4545 esac
4546
4547 : determine root of directory hierarchy where package will be installed.
4548 case "$prefix" in
4549 '')
4550         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4551         ;;
4552 *)
4553         dflt="$prefix"
4554         ;;
4555 esac
4556 $cat <<EOM
4557
4558 By default, $package will be installed in $dflt/bin, manual pages
4559 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4560 installation directories. Typically this is something like /usr/local.
4561 If you wish to have binaries under /usr/bin but other parts of the
4562 installation under /usr/local, that's ok: you will be prompted
4563 separately for each of the installation directories, the prefix being
4564 only used to set the defaults.
4565
4566 EOM
4567 fn=d~
4568 rp='Installation prefix to use?'
4569 . ./getfile
4570 oldprefix=''
4571 case "$prefix" in
4572 '') ;;
4573 *)
4574         case "$ans" in
4575         "$prefix") ;;
4576         *) oldprefix="$prefix";;
4577         esac
4578         ;;
4579 esac
4580 prefix="$ans"
4581 prefixexp="$ansexp"
4582
4583 : is AFS running?
4584 echo " "
4585 case "$afs" in
4586 $define|true)   afs=true ;;
4587 $undef|false)   afs=false ;;
4588 *)      if test -d /afs; then
4589                 afs=true
4590         else
4591                 afs=false
4592         fi
4593         ;;
4594 esac
4595 if $afs; then
4596         echo "AFS may be running... I'll be extra cautious then..." >&4
4597 else
4598         echo "AFS does not seem to be running..." >&4
4599 fi
4600
4601 : determine installation prefix for where package is to be installed.
4602 if $afs; then 
4603 $cat <<EOM
4604
4605 Since you are running AFS, I need to distinguish the directory in which
4606 files will reside from the directory in which they are installed (and from
4607 which they are presumably copied to the former directory by occult means).
4608
4609 EOM
4610         case "$installprefix" in
4611         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4612         *) dflt="$installprefix";;
4613         esac
4614 else
4615 $cat <<EOM
4616
4617 In some special cases, particularly when building $package for distribution,
4618 it is convenient to distinguish between the directory in which files should 
4619 be installed from the directory ($prefix) in which they 
4620 will eventually reside.  For most users, these two directories are the same.
4621
4622 EOM
4623         case "$installprefix" in
4624         '') dflt=$prefix ;;
4625         *) dflt=$installprefix;;
4626         esac
4627 fi
4628 fn=d~
4629 rp='What installation prefix should I use for installing files?'
4630 . ./getfile
4631 installprefix="$ans"
4632 installprefixexp="$ansexp"
4633
4634 : set the prefixit variable, to compute a suitable default value
4635 prefixit='case "$3" in
4636 ""|none)
4637         case "$oldprefix" in
4638         "") eval "$1=\"\$$2\"";;
4639         *)
4640                 case "$3" in
4641                 "") eval "$1=";;
4642                 none)
4643                         eval "tp=\"\$$2\"";
4644                         case "$tp" in
4645                         ""|" ") eval "$1=\"\$$2\"";;
4646                         *) eval "$1=";;
4647                         esac;;
4648                 esac;;
4649         esac;;
4650 *)
4651         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4652         case "$tp" in
4653         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4654         /*-$oldprefix/*|\~*-$oldprefix/*)
4655                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4656         *) eval "$1=\"\$$2\"";;
4657         esac;;
4658 esac'
4659
4660 : set the base revision
4661 baserev=5.0
4662
4663
4664 : get the patchlevel
4665 echo " "
4666 echo "Getting the current patchlevel..." >&4
4667 if $test -r $rsrc/patchlevel.h;then
4668         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4669         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4670         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4671         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4672         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4673 else
4674         patchlevel=0
4675         subversion=0
4676         api_revision=0
4677         api_version=0
4678         api_subversion=0
4679 fi
4680 $echo $n "(You have $package" $c
4681 case "$package" in
4682 "*$baserev")    ;;
4683 *)              $echo $n " $baserev" $c ;;
4684 esac
4685 $echo $n " patchlevel $patchlevel" $c
4686 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4687 echo ".)"
4688 case "$osname" in
4689 dos|cygwin|vms|win32)
4690         : XXX Should be a Configure test for double-dots in filenames.
4691         version=`echo $baserev $patchlevel $subversion | \
4692                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4693         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4694                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4695         ;;
4696 *)
4697         version=`echo $baserev $patchlevel $subversion | \
4698                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4699         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4700                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4701         ;;
4702 esac
4703 : Special case the 5.005_xx maintenance series, which used 5.005
4704 : without any subversion label as a subdirectory in $sitelib
4705 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4706         api_versionstring='5.005'
4707 fi
4708
4709 : determine installation style
4710 : For now, try to deduce it from prefix unless it is already set.
4711 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4712 case "$installstyle" in
4713 '')     case "$prefix" in
4714                 *perl*) dflt='lib';;
4715                 *) dflt='lib/perl5' ;;
4716         esac
4717         ;;
4718 *)      dflt='lib/perl5' ;;
4719 esac
4720 : Probably not worth prompting for this since we prompt for all
4721 : the directories individually, and the prompt would be too long and
4722 : confusing anyway.
4723 installstyle=$dflt
4724
4725 : determine where private library files go
4726 : Usual default is /usr/local/lib/perl5/$version.
4727 : Also allow things like /opt/perl/lib/$version, since 
4728 : /opt/perl/lib/perl5... would be redundant.
4729 : The default "style" setting is made in installstyle.U
4730 case "$installstyle" in
4731 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4732 *)       set dflt privlib lib/$version ;;
4733 esac
4734 eval $prefixit
4735 $cat <<EOM
4736
4737 There are some auxiliary files for $package that need to be put into a
4738 private library directory that is accessible by everyone.
4739
4740 EOM
4741 fn=d~+
4742 rp='Pathname where the private library files will reside?'
4743 . ./getfile
4744 privlib="$ans"
4745 privlibexp="$ansexp"
4746 : Change installation prefix, if necessary.
4747 if $test X"$prefix" != X"$installprefix"; then
4748         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4749 else
4750         installprivlib="$privlibexp"
4751 fi
4752
4753 : set the prefixup variable, to restore leading tilda escape
4754 prefixup='case "$prefixexp" in
4755 "$prefix") ;;
4756 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4757 esac'
4758
4759 : determine where public architecture dependent libraries go
4760 set archlib archlib
4761 eval $prefixit
4762 : privlib default is /usr/local/lib/$package/$version
4763 : archlib default is /usr/local/lib/$package/$version/$archname
4764 : privlib may have an optional trailing /share.
4765 tdflt=`echo $privlib | $sed 's,/share$,,'`
4766 tdflt=$tdflt/$archname
4767 case "$archlib" in
4768 '')     dflt=$tdflt
4769         ;;
4770 *)      dflt="$archlib"
4771     ;;
4772 esac
4773 $cat <<EOM
4774
4775 $spackage contains architecture-dependent library files.  If you are
4776 sharing libraries in a heterogeneous environment, you might store
4777 these files in a separate location.  Otherwise, you can just include
4778 them with the rest of the public library files.
4779
4780 EOM
4781 fn=d+~
4782 rp='Where do you want to put the public architecture-dependent libraries?'
4783 . ./getfile
4784 archlib="$ans"
4785 archlibexp="$ansexp"
4786 if $test X"$archlib" = X"$privlib"; then
4787         d_archlib="$undef"
4788 else
4789         d_archlib="$define"
4790 fi
4791 : Change installation prefix, if necessary.
4792 if $test X"$prefix" != X"$installprefix"; then
4793         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4794 else
4795         installarchlib="$archlibexp"
4796 fi
4797
4798
4799 : Binary compatibility with 5.005 is not possible for builds
4800 : with advanced features
4801 case "$usethreads$usemultiplicity" in
4802 *define*)
4803         bincompat5005="$undef"
4804         d_bincompat5005="$undef"
4805         ;;
4806 *)      $cat <<EOM
4807
4808 Perl 5.006 can be compiled for binary compatibility with 5.005.
4809 If you decide to do so, you will be able to continue using most
4810 of the extensions that were compiled for Perl 5.005.
4811
4812 EOM
4813         case "$bincompat5005$d_bincompat5005" in
4814         *"$undef"*) dflt=n ;;
4815         *) dflt=y ;;
4816         esac
4817         rp='Binary compatibility with Perl 5.005?'
4818         . ./myread
4819         case "$ans" in
4820         y*) val="$define" ;;
4821         *)  val="$undef" ;;
4822         esac
4823         set d_bincompat5005
4824         eval $setvar
4825         case "$d_bincompat5005" in
4826         "$define")
4827                 bincompat5005="$define"
4828                 ;;
4829         *)      bincompat5005="$undef"
4830                 d_bincompat5005="$undef"
4831                 ;;
4832         esac
4833         ;;
4834 esac
4835
4836
4837 : see if setuid scripts can be secure
4838 $cat <<EOM
4839
4840 Some kernels have a bug that prevents setuid #! scripts from being
4841 secure.  Some sites have disabled setuid #! scripts because of this.
4842
4843 First let's decide if your kernel supports secure setuid #! scripts.
4844 (If setuid #! scripts would be secure but have been disabled anyway,
4845 don't say that they are secure if asked.)
4846
4847 EOM
4848
4849 val="$undef"
4850 if $test -d /dev/fd; then
4851         echo "#!$ls" >reflect
4852         chmod +x,u+s reflect
4853         ./reflect >flect 2>&1
4854         if $contains "/dev/fd" flect >/dev/null; then
4855                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4856                 val="$define"
4857         else
4858                 $cat <<EOM
4859 If you are not sure if they are secure, I can check but I'll need a
4860 username and password different from the one you are using right now.
4861 If you don't have such a username or don't want me to test, simply
4862 enter 'none'.
4863
4864 EOM
4865                 rp='Other username to test security of setuid scripts with?'
4866                 dflt='none'
4867                 . ./myread
4868                 case "$ans" in
4869                 n|none)
4870                         case "$d_suidsafe" in
4871                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4872                                 dflt=n;;
4873                         "$undef")
4874                                 echo "Well, the $hint value is *not* secure." >&4
4875                                 dflt=n;;
4876                         *)      echo "Well, the $hint value *is* secure." >&4
4877                                 dflt=y;;
4878                         esac
4879                         ;;
4880                 *)
4881                         $rm -f reflect flect
4882                         echo "#!$ls" >reflect
4883                         chmod +x,u+s reflect
4884                         echo >flect
4885                         chmod a+w flect
4886                         echo '"su" will (probably) prompt you for '"$ans's password."
4887                         su $ans -c './reflect >flect'
4888                         if $contains "/dev/fd" flect >/dev/null; then
4889                                 echo "Okay, it looks like setuid scripts are secure." >&4
4890                                 dflt=y
4891                         else
4892                                 echo "I don't think setuid scripts are secure." >&4
4893                                 dflt=n
4894                         fi
4895                         ;;
4896                 esac
4897                 rp='Does your kernel have *secure* setuid scripts?'
4898                 . ./myread
4899                 case "$ans" in
4900                 [yY]*)  val="$define";;
4901                 *)      val="$undef";;
4902                 esac
4903         fi
4904 else
4905         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4906         echo "(That's for file descriptors, not floppy disks.)"
4907         val="$undef"
4908 fi
4909 set d_suidsafe
4910 eval $setvar
4911
4912 $rm -f reflect flect
4913
4914 : now see if they want to do setuid emulation
4915 echo " "
4916 val="$undef"
4917 case "$d_suidsafe" in
4918 "$define")
4919         val="$undef"
4920         echo "No need to emulate SUID scripts since they are secure here." >& 4
4921         ;;
4922 *)
4923         $cat <<EOM
4924 Some systems have disabled setuid scripts, especially systems where
4925 setuid scripts cannot be secure.  On systems where setuid scripts have
4926 been disabled, the setuid/setgid bits on scripts are currently
4927 useless.  It is possible for $package to detect those bits and emulate
4928 setuid/setgid in a secure fashion.  This emulation will only work if
4929 setuid scripts have been disabled in your kernel.
4930
4931 EOM
4932         case "$d_dosuid" in
4933         "$define") dflt=y ;;
4934         *) dflt=n ;;
4935         esac
4936         rp="Do you want to do setuid/setgid emulation?"
4937         . ./myread
4938         case "$ans" in
4939         [yY]*)  val="$define";;
4940         *)      val="$undef";;
4941         esac
4942         ;;
4943 esac
4944 set d_dosuid
4945 eval $setvar
4946
4947 : determine filename position in cpp output
4948 echo " "
4949 echo "Computing filename position in cpp output for #include directives..." >&4
4950 echo '#include <stdio.h>' > foo.c
4951 $cat >fieldn <<EOF
4952 $startsh
4953 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4954 $grep '^[       ]*#.*stdio\.h' | \
4955 while read cline; do
4956         pos=1
4957         set \$cline
4958         while $test \$# -gt 0; do
4959                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4960                         echo "\$pos"
4961                         exit 0
4962                 fi
4963                 shift
4964                 pos=\`expr \$pos + 1\`
4965         done
4966 done
4967 EOF
4968 chmod +x fieldn
4969 fieldn=`./fieldn`
4970 $rm -f foo.c fieldn
4971 case $fieldn in
4972 '') pos='???';;
4973 1) pos=first;;
4974 2) pos=second;;
4975 3) pos=third;;
4976 *) pos="${fieldn}th";;
4977 esac
4978 echo "Your cpp writes the filename in the $pos field of the line."
4979
4980 : locate header file
4981 $cat >findhdr <<EOF
4982 $startsh
4983 wanted=\$1
4984 name=''
4985 for usrincdir in $usrinc
4986 do
4987         if test -f \$usrincdir/\$wanted; then
4988                 echo "\$usrincdir/\$wanted"
4989                 exit 0
4990         fi
4991 done
4992 awkprg='{ print \$$fieldn }'
4993 echo "#include <\$wanted>" > foo\$\$.c
4994 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4995 $grep "^[       ]*#.*\$wanted" | \
4996 while read cline; do
4997         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4998         case "\$name" in
4999         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5000         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5001         *) exit 2;;
5002         esac;
5003 done;
5004 #
5005 # status = 0: grep returned 0 lines, case statement not executed
5006 # status = 1: headerfile found
5007 # status = 2: while loop executed, no headerfile found
5008 #
5009 status=\$?
5010 $rm -f foo\$\$.c;
5011 if test \$status -eq 1; then
5012         exit 0;
5013 fi
5014 exit 1
5015 EOF
5016 chmod +x findhdr
5017
5018 : define an alternate in-header-list? function
5019 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5020 cont=true; xxf="echo \"<\$1> found.\" >&4";
5021 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5022 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5023 esac;
5024 case $# in 4) instead=instead;; *) instead="at last";; esac;
5025 while $test "$cont"; do
5026         xxx=`./findhdr $1`
5027         var=$2; eval "was=\$$2";
5028         if $test "$xxx" && $test -r "$xxx";
5029         then eval $xxf;
5030         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5031                 cont="";
5032         else eval $xxnf;
5033         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5034         set $yyy; shift; shift; yyy=$@;
5035         case $# in 0) cont="";;
5036         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5037                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5038         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5039                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5040         esac;
5041 done;
5042 while $test "$yyy";
5043 do set $yyy; var=$2; eval "was=\$$2";
5044         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5045         set $yyy; shift; shift; yyy=$@;
5046 done'
5047
5048 : see if this is a malloc.h system
5049 set malloc.h i_malloc
5050 eval $inhdr
5051
5052 : see if stdlib is available
5053 set stdlib.h i_stdlib
5054 eval $inhdr
5055
5056 : determine which malloc to compile in
5057 echo " "
5058 case "$usemymalloc" in
5059 ''|[yY]*|true|$define)  dflt='y' ;;
5060 *)      dflt='n' ;;
5061 esac
5062 rp="Do you wish to attempt to use the malloc that comes with $package?"
5063 . ./myread
5064 usemymalloc="$ans"
5065 case "$ans" in
5066 y*|true)
5067         usemymalloc='y'
5068         mallocsrc='malloc.c'
5069         mallocobj="malloc$_o"
5070         d_mymalloc="$define"
5071         case "$libs" in
5072         *-lmalloc*)
5073                 : Remove malloc from list of libraries to use
5074                 echo "Removing unneeded -lmalloc from library list" >&4
5075                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5076                 shift
5077                 libs="$*"
5078                 echo "libs = $libs" >&4
5079                 ;;
5080         esac
5081         ;;
5082 *)
5083         usemymalloc='n'
5084         mallocsrc=''
5085         mallocobj=''
5086         d_mymalloc="$undef"
5087         ;;
5088 esac
5089
5090 : compute the return types of malloc and free
5091 echo " "
5092 $cat >malloc.c <<END
5093 #$i_malloc I_MALLOC
5094 #$i_stdlib I_STDLIB
5095 #include <stdio.h>
5096 #include <sys/types.h>
5097 #ifdef I_MALLOC
5098 #include <malloc.h>
5099 #endif
5100 #ifdef I_STDLIB
5101 #include <stdlib.h>
5102 #endif
5103 #ifdef TRY_MALLOC
5104 void *malloc();
5105 #endif
5106 #ifdef TRY_FREE
5107 void free();
5108 #endif
5109 END
5110 case "$malloctype" in
5111 '')
5112         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5113                 malloctype='void *'
5114         else
5115                 malloctype='char *'
5116         fi
5117         ;;
5118 esac
5119 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5120
5121 case "$freetype" in
5122 '')
5123         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5124                 freetype='void'
5125         else
5126                 freetype='int'
5127         fi
5128         ;;
5129 esac
5130 echo "Your system uses $freetype free(), it would seem." >&4
5131 $rm -f malloc.[co]
5132 $cat <<EOM
5133
5134 The installation process will also create a directory for
5135 vendor-supplied add-ons.  Vendors who supply perl with their system
5136 may find it convenient to place all vendor-supplied files in this
5137 directory rather than in the main distribution directory.  This will
5138 ease upgrades between binary-compatible maintenance versions of perl.
5139
5140 Of course you may also use these directories in whatever way you see
5141 fit.  For example, you might use them to access modules shared over a
5142 company-wide network.
5143
5144 The default answer should be fine for most people.
5145 This causes further questions about vendor add-ons to be skipped
5146 and no vendor-specific directories will be configured for perl.
5147
5148 EOM
5149 rp='Do you want to configure vendor-specific add-on directories?'
5150 case "$usevendorprefix" in
5151 define|true|[yY]*) dflt=y ;;
5152 *) dflt=n ;;
5153 esac
5154 . ./myread
5155 case "$ans" in
5156 [yY]*)  fn=d~+
5157         rp='Installation prefix to use for vendor-supplied add-ons?'
5158         case "$vendorprefix" in
5159         '') dflt='' ;;
5160         *)  dflt=$vendorprefix ;;
5161         esac
5162         . ./getfile
5163         oldvendorprefix=''
5164         case "$vendorprefix" in
5165         '') ;;
5166         *)      case "$ans" in
5167                 "$prefix") ;;
5168                 *) oldvendorprefix="$prefix";;
5169                 esac
5170                 ;;
5171         esac
5172         usevendorprefix="$define"
5173         vendorprefix="$ans"
5174         vendorprefixexp="$ansexp"
5175         ;;
5176 *)      usevendorprefix="$undef"
5177         vendorprefix=''
5178         vendorprefixexp=''
5179         ;;
5180 esac
5181
5182 case "$vendorprefix" in
5183 '')     d_vendorlib="$undef"
5184         vendorlib=''
5185         vendorlibexp=''
5186         ;;
5187 *)      d_vendorlib="$define"
5188         : determine where vendor-supplied modules go.
5189         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5190         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5191         case "$installstyle" in
5192         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5193         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5194         esac
5195         fn=d~+
5196         rp='Pathname for the vendor-supplied library files?'
5197         . ./getfile
5198         vendorlib="$ans"
5199         vendorlibexp="$ansexp"
5200         : Change installation prefix, if necessary.
5201         if $test X"$prefix" != X"$installprefix"; then
5202                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5203         else
5204                 installvendorlib="$vendorlibexp"
5205         fi
5206         ;;
5207 esac
5208
5209 : Cruising for prototypes
5210 echo " "
5211 echo "Checking out function prototypes..." >&4
5212 $cat >prototype.c <<'EOCP'
5213 int main(int argc, char *argv[]) {
5214         exit(0);}
5215 EOCP
5216 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5217         echo "Your C compiler appears to support function prototypes."
5218         val="$define"
5219 else
5220         echo "Your C compiler doesn't seem to understand function prototypes."
5221         val="$undef"
5222 fi
5223 set prototype
5224 eval $setvar
5225 $rm -f prototype*
5226
5227 case "$prototype" in
5228 "$define") ;;
5229 *)      ansi2knr='ansi2knr'
5230         echo " "
5231         cat <<EOM >&4
5232
5233 $me:  FATAL ERROR:
5234 This version of $package can only be compiled by a compiler that 
5235 understands function prototypes.  Unfortunately, your C compiler 
5236         $cc $ccflags
5237 doesn't seem to understand them.  Sorry about that.
5238
5239 If GNU cc is available for your system, perhaps you could try that instead.  
5240
5241 Eventually, we hope to support building Perl with pre-ANSI compilers.
5242 If you would like to help in that effort, please contact <perlbug@perl.org>.
5243
5244 Aborting Configure now.
5245 EOM
5246         exit 2
5247         ;;
5248 esac
5249
5250 : determine where public executables go
5251 echo " "
5252 set dflt bin bin
5253 eval $prefixit
5254 fn=d~
5255 rp='Pathname where the public executables will reside?'
5256 . ./getfile
5257 if $test "X$ansexp" != "X$binexp"; then
5258         installbin=''
5259 fi
5260 bin="$ans"
5261 binexp="$ansexp"
5262 : Change installation prefix, if necessary.
5263 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5264 if $test X"$prefix" != X"$installprefix"; then
5265         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5266 else
5267         installbin="$binexp"
5268 fi
5269
5270 $cat <<EOM
5271
5272 After $package is installed, you may wish to install various
5273 add-on modules and utilities.  Typically, these add-ons will
5274 be installed under $prefix with the rest
5275 of this package.  However, you may wish to install such add-ons
5276 elsewhere under a different prefix.
5277
5278 If you do not wish to put everything under a single prefix, that's
5279 ok.  You will be prompted for the individual locations; this siteprefix
5280 is only used to suggest the defaults.
5281
5282 The default should be fine for most people.
5283
5284 EOM
5285 fn=d~+
5286 rp='Installation prefix to use for add-on modules and utilities?'
5287 : XXX Here might be another good place for an installstyle setting.
5288 case "$siteprefix" in
5289 '') dflt=$prefix ;;
5290 *)  dflt=$siteprefix ;;
5291 esac
5292 . ./getfile
5293 oldsiteprefix=''
5294 case "$siteprefix" in
5295 '') ;;
5296 *)
5297         case "$ans" in
5298         "$prefix") ;;
5299         *) oldsiteprefix="$prefix";;
5300         esac
5301         ;;
5302 esac
5303 siteprefix="$ans"
5304 siteprefixexp="$ansexp"
5305
5306 : determine where site specific libraries go.
5307 : Usual default is /usr/local/lib/perl5/site_perl/$version
5308 : The default "style" setting is made in installstyle.U
5309 : XXX No longer works with Prefixit stuff.
5310 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5311 case "$installstyle" in
5312 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5313 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5314 esac
5315 $cat <<EOM
5316
5317 The installation process will create a directory for
5318 site-specific extensions and modules.  Most users find it convenient
5319 to place all site-specific files in this directory rather than in the
5320 main distribution directory.
5321
5322 EOM
5323 fn=d~+
5324 rp='Pathname for the site-specific library files?'
5325 . ./getfile
5326 sitelib="$ans"
5327 sitelibexp="$ansexp"
5328 : Change installation prefix, if necessary.
5329 if $test X"$prefix" != X"$installprefix"; then
5330         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5331 else
5332         installsitelib="$sitelibexp"
5333 fi
5334
5335 : Determine list of previous versions to include in @INC
5336 $cat > getverlist <<EOPL
5337 #!$perl -w
5338 use File::Basename;
5339 \$api_versionstring = "$api_versionstring";
5340 \$version = "$version";
5341 \$sitelib = "$sitelib";
5342 \$archname = "$archname";
5343 EOPL
5344         $cat >> getverlist <<'EOPL'
5345 # Can't have leading @ because metaconfig interprets it as a command!
5346 ;@inc_version_list=();
5347 $stem=dirname($sitelib);
5348 # Redo to do opendir/readdir? 
5349 if (-d $stem) {
5350     chdir($stem);
5351     ;@candidates = glob("5.*");
5352 }
5353 else {
5354     ;@candidates = ();
5355 }
5356
5357 foreach $d (@candidates) {
5358     if ($d lt $version) {
5359         if ($d ge $api_versionstring) {
5360             unshift(@inc_version_list, "$d/$archname", $d);
5361         }
5362         elsif ($d ge "5.005") {
5363             unshift(@inc_version_list, $d);
5364         }
5365     }
5366     else {
5367         # Skip newer version.  I.e. don't look in
5368         # 5.7.0 if we're installing 5.6.1.
5369     }
5370 }
5371
5372 if (@inc_version_list) {
5373     print '"';
5374     print join('", "', @inc_version_list);
5375     print '"';
5376 }
5377 else {
5378     # Blank space to preserve value for next Configure run.
5379     print " ";
5380 }
5381 EOPL
5382 chmod +x getverlist
5383 case "$inc_version_list" in
5384 '')     if test -x $perl; then
5385                 dflt=`$perl getverlist`
5386         else
5387                 dflt=''
5388         fi
5389         ;;
5390 *)  dflt="$inc_version_list" ;;
5391 esac
5392 $cat <<'EOM'
5393
5394 In order to ease the process of upgrading, this version of perl 
5395 can be configured to use modules built and installed with earlier 
5396 versions of perl that were installed under $prefix.  Specify here
5397 the list of earlier versions that this version of perl should check.
5398 If Configure detected no earlier versions of perl installed under
5399 $prefix, then the list will be empty.
5400
5401 The default should almost always be sensible, so if you're not sure,
5402 just accept the default.
5403 EOM
5404
5405 rp='list of earlier versions to include in @INC?'
5406 . ./myread
5407 inc_version_list="$ans"
5408 $rm -f getverlist
5409
5410 : determine whether to install perl also as /usr/bin/perl
5411
5412 echo " "
5413 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5414         $cat <<EOM
5415 Many scripts expect to perl to be installed as /usr/bin/perl.
5416 I can install the perl you are about to compile also as /usr/bin/perl
5417 (in addition to $installbin/perl).
5418 EOM
5419         case "$installusrbinperl" in
5420         "$undef"|[nN]*) dflt='n';;
5421         *)              dflt='y';;
5422         esac
5423         rp="Do you want to install perl as /usr/bin/perl?"
5424         . ./myread
5425         case "$ans" in
5426         [yY]*)  val="$define";;
5427         *)      val="$undef" ;;
5428         esac
5429 else
5430         val="$undef"
5431 fi
5432 set installusrbinperl
5433 eval $setvar
5434
5435 echo " "
5436 echo "Checking for GNU C Library..." >&4
5437 cat >gnulibc.c <<EOM
5438 #include <stdio.h>
5439 int main()
5440 {
5441 #ifdef __GLIBC__
5442     exit(0);
5443 #else
5444     exit(1);
5445 #endif
5446 }
5447 EOM
5448 set gnulibc
5449 if eval $compile_ok && ./gnulibc; then
5450         val="$define"
5451         echo "You are using the GNU C Library"
5452 else
5453         val="$undef"
5454         echo "You are not using the GNU C Library"
5455 fi
5456 $rm -f gnulibc*
5457 set d_gnulibc
5458 eval $setvar
5459
5460 : see if nm is to be used to determine whether a symbol is defined or not
5461 case "$usenm" in
5462 '')
5463         dflt=''
5464         case "$d_gnulibc" in
5465         "$define")
5466                 echo " "
5467                 echo "nm probably won't work on the GNU C Library." >&4
5468                 dflt=n
5469                 ;;
5470         esac
5471         case "$dflt" in
5472         '') 
5473                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5474                         echo " "
5475                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5476                         echo "'nm' won't be sufficient on this sytem." >&4
5477                         dflt=n
5478                 fi
5479                 ;;
5480         esac
5481         case "$dflt" in
5482         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5483                 if $test $dflt -gt 20; then
5484                         dflt=y
5485                 else
5486                         dflt=n
5487                 fi
5488                 ;;
5489         esac
5490         ;;
5491 *)
5492         case "$usenm" in
5493         true|$define) dflt=y;;
5494         *) dflt=n;;
5495         esac
5496         ;;
5497 esac
5498 $cat <<EOM
5499
5500 I can use $nm to extract the symbols from your C libraries. This
5501 is a time consuming task which may generate huge output on the disk (up
5502 to 3 megabytes) but that should make the symbols extraction faster. The
5503 alternative is to skip the 'nm' extraction part and to compile a small
5504 test program instead to determine whether each symbol is present. If
5505 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5506 this may be the best solution.
5507
5508 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5509
5510 EOM
5511 rp="Shall I use $nm to extract C symbols from the libraries?"
5512 . ./myread
5513 case "$ans" in
5514 [Nn]*) usenm=false;;
5515 *) usenm=true;;
5516 esac
5517
5518 runnm=$usenm
5519 case "$reuseval" in
5520 true) runnm=false;;
5521 esac
5522
5523 : nm options which may be necessary
5524 case "$nm_opt" in
5525 '') if $test -f /mach_boot; then
5526                 nm_opt=''       # Mach
5527         elif $test -d /usr/ccs/lib; then
5528                 nm_opt='-p'     # Solaris (and SunOS?)
5529         elif $test -f /dgux; then
5530                 nm_opt='-p'     # DG-UX
5531         elif $test -f /lib64/rld; then
5532                 nm_opt='-p'     # 64-bit Irix
5533         else
5534                 nm_opt=''
5535         fi;;
5536 esac
5537
5538 : nm options which may be necessary for shared libraries but illegal
5539 : for archive libraries.  Thank you, Linux.
5540 case "$nm_so_opt" in
5541 '')     case "$myuname" in
5542         *linux*)
5543                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5544                         nm_so_opt='--dynamic'
5545                 fi
5546                 ;;
5547         esac
5548         ;;
5549 esac
5550
5551 case "$runnm" in
5552 true)
5553 : get list of predefined functions in a handy place
5554 echo " "
5555 case "$libc" in
5556 '') libc=unknown
5557         case "$libs" in
5558         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5559         esac
5560         ;;
5561 esac
5562 libnames='';
5563 case "$libs" in
5564 '') ;;
5565 *)  for thislib in $libs; do
5566         case "$thislib" in
5567         -lc|-lc_s)
5568                 : Handle C library specially below.
5569                 ;;
5570         -l*)
5571                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5572                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5573                         :
5574                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5575                         :
5576                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5577                         :
5578                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5579                         :
5580                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5581                         :
5582                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5583                         :
5584                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5585                         :
5586                 else
5587                         try=''
5588                 fi
5589                 libnames="$libnames $try"
5590                 ;;
5591         *) libnames="$libnames $thislib" ;;
5592         esac
5593         done
5594         ;;
5595 esac
5596 xxx=normal
5597 case "$libc" in
5598 unknown)
5599         set /lib/libc.$so
5600         for xxx in $libpth; do
5601                 $test -r $1 || set $xxx/libc.$so
5602                 : The messy sed command sorts on library version numbers.
5603                 $test -r $1 || \
5604                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5605                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5606                                 h
5607                                 s/[0-9][0-9]*/0000&/g
5608                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5609                                 G
5610                                 s/\n/ /' | \
5611                          sort | $sed -e 's/^.* //'`
5612                 eval set \$$#
5613         done
5614         $test -r $1 || set /usr/ccs/lib/libc.$so
5615         $test -r $1 || set /lib/libsys_s$_a
5616         ;;
5617 *)
5618         set blurfl
5619         ;;
5620 esac
5621 if $test -r "$1"; then
5622         echo "Your (shared) C library seems to be in $1."
5623         libc="$1"
5624 elif $test -r /lib/libc && $test -r /lib/clib; then
5625         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5626         xxx=apollo
5627         libc='/lib/clib /lib/libc'
5628         if $test -r /lib/syslib; then
5629                 echo "(Your math library is in /lib/syslib.)"
5630                 libc="$libc /lib/syslib"
5631         fi
5632 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5633         echo "Your C library seems to be in $libc, as you said before."
5634 elif $test -r $incpath/usr/lib/libc$_a; then
5635         libc=$incpath/usr/lib/libc$_a;
5636         echo "Your C library seems to be in $libc.  That's fine."
5637 elif $test -r /lib/libc$_a; then
5638         libc=/lib/libc$_a;
5639         echo "Your C library seems to be in $libc.  You're normal."
5640 else
5641         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5642                 :
5643         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5644                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5645         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5646                 :
5647         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5648                 :
5649         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5650                 :
5651         else
5652                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5653         fi
5654         if $test -r "$tans"; then
5655                 echo "Your C library seems to be in $tans, of all places."
5656                 libc=$tans
5657         else
5658                 libc='blurfl'
5659         fi
5660 fi
5661 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5662         dflt="$libc"
5663         cat <<EOM
5664
5665 If the guess above is wrong (which it might be if you're using a strange
5666 compiler, or your machine supports multiple models), you can override it here.
5667
5668 EOM
5669 else
5670         dflt=''
5671         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5672         cat >&4 <<EOM
5673 I can't seem to find your C library.  I've looked in the following places:
5674
5675 EOM
5676         $sed 's/^/      /' libpath
5677         cat <<EOM
5678
5679 None of these seems to contain your C library. I need to get its name...
5680
5681 EOM
5682 fi
5683 fn=f
5684 rp='Where is your C library?'
5685 . ./getfile
5686 libc="$ans"
5687
5688 echo " "
5689 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5690 set X `cat libnames`
5691 shift
5692 xxx=files
5693 case $# in 1) xxx=file; esac
5694 echo "Extracting names from the following $xxx for later perusal:" >&4
5695 echo " "
5696 $sed 's/^/      /' libnames >&4
5697 echo " "
5698 $echo $n "This may take a while...$c" >&4
5699
5700 for file in $*; do
5701         case $file in
5702         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5703         *) $nm $nm_opt $file 2>/dev/null;;
5704         esac
5705 done >libc.tmp
5706
5707 $echo $n ".$c"
5708 $grep fprintf libc.tmp > libc.ptf
5709 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5710 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5711 xxx='[ADTSIW]'
5712 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5713         eval $xscan;\
5714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5715                 eval $xrun
5716 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5717         eval $xscan;\
5718         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719                 eval $xrun
5720 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5721         eval $xscan;\
5722         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723                 eval $xrun
5724 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5737                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5738         eval $xscan;\
5739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5740                 eval $xrun
5741 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5750         eval $xscan;\
5751         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752                 eval $xrun
5753 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5754         eval $xscan;\
5755         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756                 eval $xrun
5757 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5758         eval $xscan;\
5759         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760                 eval $xrun
5761 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5762         eval $xscan;\
5763         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764                 eval $xrun
5765 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5766         eval $xscan;\
5767         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768                 eval $xrun
5769 else
5770         $nm -p $* 2>/dev/null >libc.tmp
5771         $grep fprintf libc.tmp > libc.ptf
5772         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5773                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5774         then
5775                 nm_opt='-p'
5776                 eval $xrun
5777         else
5778                 echo " "
5779                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5780                 com=''
5781                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5782                         for thisname in $libnames $libc; do
5783                                 $ar t $thisname >>libc.tmp
5784                         done
5785                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5786                         echo "Ok." >&4
5787                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5788                         # Repeat libc to extract forwarders to DLL entries too
5789                         for thisname in $libnames $libc; do
5790                                 $ar tv $thisname >>libc.tmp
5791                                 # Revision 50 of EMX has bug in $ar.
5792                                 # it will not extract forwarders to DLL entries
5793                                 # Use emximp which will extract exactly them.
5794                                 emximp -o tmp.imp $thisname \
5795                                     2>/dev/null && \
5796                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5797                                     < tmp.imp >>libc.tmp
5798                                 $rm tmp.imp
5799                         done
5800                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5801                         echo "Ok." >&4
5802                 else
5803                         echo "$ar didn't seem to work right." >&4
5804                         echo "Maybe this is a Cray...trying bld instead..." >&4
5805                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5806                         then
5807                                 for thisname in $libnames; do
5808                                         bld t $libnames | \
5809                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5810                                         $ar t $thisname >>libc.tmp
5811                                 done
5812                                 echo "Ok." >&4
5813                         else
5814                                 echo "That didn't work either.  Giving up." >&4
5815                                 exit 1
5816                         fi
5817                 fi
5818         fi
5819 fi
5820 nm_extract="$com"
5821 if $test -f /lib/syscalls.exp; then
5822         echo " "
5823         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5824         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5825 fi
5826 ;;
5827 esac
5828 $rm -f libnames libpath
5829
5830 : see if dld is available
5831 set dld.h i_dld
5832 eval $inhdr
5833
5834 : is a C symbol defined?
5835 csym='tlook=$1;
5836 case "$3" in
5837 -v) tf=libc.tmp; tc=""; tdc="";;
5838 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5839 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5840 esac;
5841 tx=yes;
5842 case "$reuseval-$4" in
5843 true-) ;;
5844 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5845 esac;
5846 case "$tx" in
5847 yes)
5848         case "$runnm" in
5849         true)
5850                 if $contains $tlook $tf >/dev/null 2>&1;
5851                 then tval=true;
5852                 else tval=false;
5853                 fi;;
5854         *)
5855                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5856                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5857                 then tval=true;
5858                 else tval=false;
5859                 fi;
5860                 $rm -f t t.c;;
5861         esac;;
5862 *)
5863         case "$tval" in
5864         $define) tval=true;;
5865         *) tval=false;;
5866         esac;;
5867 esac;
5868 eval "$2=$tval"'
5869
5870 : define an is-in-libc? function
5871 inlibc='echo " "; td=$define; tu=$undef;
5872 sym=$1; var=$2; eval "was=\$$2";
5873 tx=yes;
5874 case "$reuseval$was" in
5875 true) ;;
5876 true*) tx=no;;
5877 esac;
5878 case "$tx" in
5879 yes)
5880         set $sym tres -f;
5881         eval $csym;
5882         case "$tres" in
5883         true)
5884                 echo "$sym() found." >&4;
5885                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5886         *)
5887                 echo "$sym() NOT found." >&4;
5888                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5889         esac;;
5890 *)
5891         case "$was" in
5892         $define) echo "$sym() found." >&4;;
5893         *) echo "$sym() NOT found." >&4;;
5894         esac;;
5895 esac'
5896
5897 : see if dlopen exists
5898 xxx_runnm="$runnm"
5899 runnm=false
5900 set dlopen d_dlopen
5901 eval $inlibc
5902 runnm="$xxx_runnm"
5903
5904 : determine which dynamic loading, if any, to compile in
5905 echo " "
5906 dldir="ext/DynaLoader"
5907 case "$usedl" in
5908 $define|y|true)
5909         dflt='y'
5910         usedl="$define"
5911         ;;
5912 $undef|n|false)
5913         dflt='n'
5914         usedl="$undef"
5915         ;;
5916 *) 
5917         dflt='n'
5918         case "$d_dlopen" in
5919             $define) dflt='y' ;;
5920         esac
5921         case "$i_dld" in
5922             $define) dflt='y' ;;
5923         esac
5924         : Does a dl_xxx.xs file exist for this operating system
5925         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5926         ;;
5927 esac
5928 rp="Do you wish to use dynamic loading?"
5929 . ./myread
5930 usedl="$ans"
5931 case "$ans" in
5932 y*) usedl="$define"
5933         case "$dlsrc" in
5934         '')
5935                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5936                         dflt="$dldir/dl_${osname}.xs"
5937                 elif $test "$d_dlopen" = "$define" ; then
5938                         dflt="$dldir/dl_dlopen.xs"
5939                 elif $test "$i_dld" = "$define" ; then
5940                         dflt="$dldir/dl_dld.xs"
5941                 else
5942                         dflt=''
5943                 fi
5944                 ;;
5945         *)      dflt="$dldir/$dlsrc"
5946                 ;;
5947         esac
5948     echo "The following dynamic loading files are available:"
5949         : Can not go over to $dldir because getfile has path hard-coded in.
5950         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5951         rp="Source file to use for dynamic loading"
5952         fn="fne"
5953         gfpth="$src"
5954         . ./getfile
5955         usedl="$define"
5956         : emulate basename
5957         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5958
5959         $cat << EOM
5960
5961 Some systems may require passing special flags to $cc -c to
5962 compile modules that will be used to create a shared library.
5963 To use no flags, say "none".
5964
5965 EOM
5966     case "$cccdlflags" in
5967     '') case "$gccversion" in
5968                 '') case "$osname" in
5969                         hpux)   dflt='+z' ;;
5970                         next)   dflt='none' ;;
5971                         irix*)  dflt='-KPIC' ;;
5972                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5973                         sunos)  dflt='-pic' ;;
5974                         *)      dflt='none' ;;
5975                     esac
5976                         ;;
5977                 *)  case "$osname" in
5978                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5979                         *)      dflt='-fpic' ;;
5980                     esac ;;
5981             esac ;;
5982         ' ') dflt='none' ;;
5983     *)  dflt="$cccdlflags" ;;
5984     esac
5985     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5986     . ./myread
5987     case "$ans" in
5988     none) cccdlflags=' ' ;;
5989     *) cccdlflags="$ans" ;;
5990     esac
5991
5992     cat << EOM
5993
5994 Some systems use ld to create libraries that can be dynamically loaded,
5995 while other systems (such as those using ELF) use $cc.
5996
5997 EOM
5998         case "$ld" in
5999         '')     $cat >try.c <<'EOM'
6000 /* Test for whether ELF binaries are produced */
6001 #include <fcntl.h>
6002 #include <stdlib.h>
6003 int main() {
6004         char b[4];
6005         int i = open("a.out",O_RDONLY);
6006         if(i == -1) 
6007                 exit(1); /* fail */
6008         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6009                 exit(0); /* succeed (yes, it's ELF) */
6010         else
6011                 exit(1); /* fail */
6012 }
6013 EOM
6014                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6015                         cat <<EOM
6016 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6017 EOM
6018                         dflt="$cc"
6019                 else
6020                         echo "I'll use ld to build dynamic libraries."
6021                         dflt='ld'
6022                 fi
6023                 rm -f try.c a.out
6024                 ;;
6025         *)      dflt="$ld"
6026                 ;;
6027         esac
6028
6029     rp="What command should be used to create dynamic libraries?"
6030     . ./myread
6031         ld="$ans"
6032
6033     cat << EOM
6034
6035 Some systems may require passing special flags to $ld to create a
6036 library that can be dynamically loaded.  If your ld flags include
6037 -L/other/path options to locate libraries outside your loader's normal
6038 search path, you may need to specify those -L options here as well.  To
6039 use no flags, say "none".
6040
6041 EOM
6042     case "$lddlflags" in
6043     '') case "$osname" in
6044                         beos) dflt='-nostart' ;;
6045                         hpux)  dflt='-b' ;;
6046                         linux|irix*)    dflt='-shared' ;;
6047                         next)  dflt='none' ;;
6048                         solaris) dflt='-G' ;;
6049                         sunos) dflt='-assert nodefinitions' ;;
6050                         svr4*|esix*) dflt="-G $ldflags" ;;
6051                 *)     dflt='none' ;;
6052                         esac
6053                         ;;
6054     *) dflt="$lddlflags" ;;
6055     esac
6056
6057         : Try to guess additional flags to pick up local libraries.
6058         : Be careful not to append to a plain 'none'
6059         case "$dflt" in
6060         none) dflt='' ;;
6061         esac
6062         for thisflag in $ldflags; do
6063                 case "$thisflag" in
6064                 -L*)
6065                         case " $dflt " in
6066                         *" $thisflag "*) ;;
6067                         *) dflt="$dflt $thisflag" ;;
6068                         esac
6069                         ;;
6070                 esac
6071         done
6072
6073         case "$dflt" in
6074         ''|' ') dflt='none' ;;
6075         esac
6076
6077     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6078     . ./myread
6079     case "$ans" in
6080     none) lddlflags=' ' ;;
6081     *) lddlflags="$ans" ;;
6082     esac
6083
6084         cat <<EOM
6085
6086 Some systems may require passing special flags to $cc to indicate that
6087 the resulting executable will use dynamic linking.  To use no flags,
6088 say "none".
6089
6090 EOM
6091     case "$ccdlflags" in
6092     '') case "$osname" in
6093                 hpux)   dflt='-Wl,-E' ;;
6094                 linux)  dflt='-rdynamic' ;;
6095                 next)   dflt='none' ;;
6096                 sunos)  dflt='none' ;;
6097                 *)      dflt='none' ;;
6098             esac ;;
6099     ' ')  dflt='none' ;;
6100     *)  dflt="$ccdlflags" ;;
6101     esac
6102     rp="Any special flags to pass to $cc to use dynamic loading?"
6103     . ./myread
6104     case "$ans" in
6105     none) ccdlflags=' ' ;;
6106     *) ccdlflags="$ans" ;;
6107     esac
6108     ;;
6109 *)  usedl="$undef"
6110         ld='ld'
6111     dlsrc='dl_none.xs'
6112     lddlflags=''
6113     ccdlflags=''
6114     ;;
6115 esac
6116
6117 also=''
6118 case "$usedl" in
6119 $undef)
6120         # No dynamic loading being used, so don't bother even to prompt.
6121         useshrplib='false'
6122         ;;
6123 *)      case "$useshrplib" in
6124         '')     case "$osname" in
6125                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6126                         dflt=y
6127                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6128                         ;;
6129                 next*)
6130                         case "$osvers" in
6131                         4*)     dflt=y
6132                                 also='Building a shared libperl is needed for MAB support.'
6133                                 ;;
6134                         *)      dflt=n
6135                                 ;;
6136                         esac
6137                         ;;
6138                 *)      dflt=n
6139                         ;;
6140                 esac
6141                 ;;
6142         $define|true|[Yy]*)
6143                 dflt=y
6144                 ;;
6145         *)      dflt=n
6146                 ;;
6147         esac
6148         $cat << EOM
6149
6150 The perl executable is normally obtained by linking perlmain.c with
6151 libperl${_a}, any static extensions (usually just DynaLoader), and
6152 any other libraries needed on this system (such as -lm, etc.).  Since
6153 your system supports dynamic loading, it is probably possible to build
6154 a shared libperl.$so.  If you will have more than one executable linked
6155 to libperl.$so, this will significantly reduce the size of each
6156 executable, but it may have a noticeable affect on performance.  The
6157 default is probably sensible for your system.
6158 $also
6159
6160 EOM
6161         rp="Build a shared libperl.$so (y/n)"
6162         . ./myread
6163         case "$ans" in
6164         true|$define|[Yy]*)
6165                 useshrplib='true'  ;;
6166         *)      useshrplib='false' ;;
6167         esac
6168         ;;
6169 esac
6170
6171 case "$useshrplib" in
6172 true)
6173         case "$libperl" in
6174         '')
6175                 # Figure out a good name for libperl.so.  Since it gets stored in
6176                 # a version-specific architecture-dependent library, the version
6177                 # number isn't really that important, except for making cc/ld happy.
6178                 #
6179                 # A name such as libperl.so.3.1
6180                 majmin="libperl.$so.$patchlevel.$subversion"
6181                 # A name such as libperl.so.301
6182                 majonly=`echo $patchlevel $subversion |
6183                         $awk '{printf "%d%02d", $1, $2}'`
6184                 majonly=libperl.$so.$majonly
6185                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6186                 # rely on figuring it out from the naming of libc.
6187                 case "${osname}${osvers}" in
6188                 next4*)
6189                         dflt=libperl.5.$so
6190                         # XXX How handle the --version stuff for MAB?
6191                         ;;
6192                 linux*)  # ld won't link with a bare -lperl otherwise.
6193                         dflt=libperl.$so
6194                         ;;
6195                 cygwin*) # include version
6196                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6197                         ;;
6198                 *)      # Try to guess based on whether libc has major.minor.
6199                         case "$libc" in
6200                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6201                         *libc.$so.[0-9]*) dflt=$majonly ;;
6202                         *)      dflt=libperl.$so ;;
6203                         esac
6204                         ;;
6205                 esac
6206                 ;;
6207         *)      dflt=$libperl
6208                 ;;
6209         esac
6210         cat << EOM
6211
6212 I need to select a good name for the shared libperl.  If your system uses
6213 library names with major and minor numbers, then you might want something
6214 like $majmin.  Alternatively, if your system uses a single version
6215 number for shared libraries, then you might want to use $majonly.
6216 Or, your system might be quite happy with a simple libperl.$so.
6217
6218 Since the shared libperl will get installed into a version-specific
6219 architecture-dependent directory, the version number of the shared perl
6220 library probably isn't important, so the default should be o.k.
6221
6222 EOM
6223         rp='What name do you want to give to the shared libperl?'
6224         . ./myread
6225         libperl=$ans
6226         echo "Ok, I'll use $libperl"
6227         ;;
6228 *)
6229         libperl="libperl${_a}"
6230         ;;
6231 esac
6232
6233 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6234 case "$shrpdir" in
6235 '') ;;
6236 *)      $cat >&4 <<EOM
6237 WARNING:  Use of the shrpdir variable for the installation location of
6238 the shared $libperl is not supported.  It was never documented and
6239 will not work in this version.  Let me (perlbug@perl.com)
6240 know of any problems this may cause.
6241
6242 EOM
6243         case "$shrpdir" in
6244         "$archlibexp/CORE")
6245                 $cat >&4 <<EOM
6246 But your current setting of $shrpdir is
6247 the default anyway, so it's harmless.
6248 EOM
6249                 ;;
6250         *)
6251                 $cat >&4 <<EOM
6252 Further, your current attempted setting of $shrpdir
6253 conflicts with the value of $archlibexp/CORE
6254 that installperl will use.
6255 EOM
6256                 ;;
6257         esac
6258         ;;
6259 esac
6260
6261 # How will the perl executable find the installed shared $libperl?
6262 # Add $xxx to ccdlflags.
6263 # If we can't figure out a command-line option, use $shrpenv to
6264 # set env LD_RUN_PATH.  The main perl makefile uses this.
6265 shrpdir=$archlibexp/CORE
6266 xxx=''
6267 tmp_shrpenv=''
6268 if "$useshrplib"; then
6269     case "$osname" in 
6270         aix)
6271                 # We'll set it in Makefile.SH...
6272                 ;;
6273         solaris|netbsd)
6274                 xxx="-R $shrpdir"
6275                 ;;
6276         freebsd)
6277                 xxx="-Wl,-R$shrpdir"
6278                 ;;
6279         linux|irix*|dec_osf)
6280                 xxx="-Wl,-rpath,$shrpdir"
6281                 ;;
6282         next)
6283                 # next doesn't like the default...
6284                 ;;
6285         beos)
6286                 # beos doesn't like the default, either.
6287                 ;;
6288         hpux*)
6289                 # hpux doesn't like the default, either.
6290                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6291                 ;;
6292         *)
6293                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6294                 ;;
6295         esac
6296         case "$xxx" in
6297         '') ;;
6298         *)      
6299                 # Only add $xxx if it isn't already in ccdlflags.
6300                 case " $ccdlflags " in
6301                 *" $xxx "*)     ;;
6302                 *)      ccdlflags="$ccdlflags $xxx"
6303                         cat <<EOM >&4
6304
6305 Adding $xxx to the flags
6306 passed to $ld so that the perl executable will find the 
6307 installed shared $libperl.
6308
6309 EOM
6310                         ;;
6311                 esac
6312                 ;;
6313         esac
6314 fi
6315 # Fix ccdlflags in AIX for building external extensions.
6316 # (For building Perl itself bare -bE:perl.exp is needed,
6317 #  Makefile.SH takes care of this.)
6318 case "$osname" in
6319 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6320 esac
6321 # Respect a hint or command-line value.
6322 case "$shrpenv" in
6323 '') shrpenv="$tmp_shrpenv" ;;
6324 esac
6325 case "$ldlibpthname" in
6326 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6327 none)   ldlibpthname='' ;;
6328 esac
6329
6330 : determine where manual pages go
6331 set man1dir man1dir none
6332 eval $prefixit
6333 $cat <<EOM
6334
6335 $spackage has manual pages available in source form.
6336 EOM
6337 case "$nroff" in
6338 nroff)
6339         echo "However, you don't have nroff, so they're probably useless to you."
6340         case "$man1dir" in
6341         '') man1dir="none";;
6342         esac;;
6343 esac
6344 echo "If you don't want the manual sources installed, answer 'none'."
6345 case "$man1dir" in
6346 ' ') dflt=none
6347         ;;
6348 '')
6349         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6350         lookpath="$lookpath $prefixexp/man/p_man/man1"
6351         lookpath="$lookpath $prefixexp/man/u_man/man1"
6352         lookpath="$lookpath $prefixexp/man/man.1"
6353         case "$sysman" in
6354         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6355         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6356         esac
6357         set dflt
6358         eval $prefixup
6359         ;;
6360 *)  dflt="$man1dir"
6361         ;;
6362 esac
6363 echo " "
6364 fn=dn+~
6365 rp="Where do the main $spackage manual pages (source) go?"
6366 . ./getfile
6367 if $test "X$man1direxp" != "X$ansexp"; then
6368         installman1dir=''
6369 fi
6370 man1dir="$ans"
6371 man1direxp="$ansexp"
6372 case "$man1dir" in
6373 '')     man1dir=' '
6374         installman1dir='';;
6375 esac
6376
6377 : Change installation prefix, if necessary.
6378 if $test X"$prefix" != X"$installprefix"; then
6379         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6380 else
6381         installman1dir="$man1direxp"
6382 fi
6383
6384 : What suffix to use on installed man pages
6385
6386 case "$man1dir" in
6387 ' ')
6388         man1ext='0'
6389         ;;
6390 *)
6391         rp="What suffix should be used for the main $spackage man pages?"
6392         case "$man1ext" in
6393         '')     case "$man1dir" in
6394                 *1)  dflt=1 ;;
6395                 *1p) dflt=1p ;;
6396                 *1pm) dflt=1pm ;;
6397                 *l) dflt=l;;
6398                 *n) dflt=n;;
6399                 *o) dflt=o;;
6400                 *p) dflt=p;;
6401                 *C) dflt=C;;
6402                 *L) dflt=L;;
6403                 *L1) dflt=L1;;
6404                 *) dflt=1;;
6405                 esac
6406                 ;;
6407         *)      dflt="$man1ext";;
6408         esac
6409         . ./myread
6410         man1ext="$ans"
6411         ;;
6412 esac
6413
6414 : see if we can have long filenames
6415 echo " "
6416 rmlist="$rmlist /tmp/cf$$"
6417 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6418 first=123456789abcdef
6419 second=/tmp/cf$$/$first
6420 $rm -f $first $second
6421 if (echo hi >$first) 2>/dev/null; then
6422         if $test -f 123456789abcde; then
6423                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6424                 val="$undef"
6425         else
6426                 if (echo hi >$second) 2>/dev/null; then
6427                         if $test -f /tmp/cf$$/123456789abcde; then
6428                                 $cat <<'EOM'
6429 That's peculiar... You can have filenames longer than 14 characters, but only
6430 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6431 I shall consider your system cannot support long filenames at all.
6432 EOM
6433                                 val="$undef"
6434                         else
6435                                 echo 'You can have filenames longer than 14 characters.' >&4
6436                                 val="$define"
6437                         fi
6438                 else
6439                         $cat <<'EOM'
6440 How confusing! Some of your filesystems are sane enough to allow filenames
6441 longer than 14 characters but some others like /tmp can't even think about them.
6442 So, for now on, I shall assume your kernel does not allow them at all.
6443 EOM
6444                         val="$undef"
6445                 fi
6446         fi
6447 else
6448         $cat <<'EOM'
6449 You can't have filenames longer than 14 chars.  You can't even think about them!
6450 EOM
6451         val="$undef"
6452 fi 
6453 set d_flexfnam
6454 eval $setvar
6455 $rm -rf /tmp/cf$$ 123456789abcde*
6456
6457 : determine where library module manual pages go
6458 set man3dir man3dir none
6459 eval $prefixit
6460 $cat <<EOM
6461
6462 $spackage has manual pages for many of the library modules.
6463 EOM
6464
6465 case "$nroff" in
6466 nroff)
6467         $cat <<'EOM'
6468 However, you don't have nroff, so they're probably useless to you.
6469 EOM
6470         case "$man3dir" in
6471         '') man3dir="none";;
6472         esac;;
6473 esac
6474
6475 case "$d_flexfnam" in
6476 undef)
6477         $cat <<'EOM'
6478 However, your system can't handle the long file names like File::Basename.3. 
6479 EOM
6480         case "$man3dir" in
6481         '') man3dir="none";;
6482         esac;;
6483 esac
6484
6485 echo "If you don't want the manual sources installed, answer 'none'."
6486 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6487 case "$man3dir" in
6488 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6489         if $test -d "$privlib/man/man3"; then
6490                 cat <<EOM >&4
6491
6492 WARNING:  Previous versions of perl installed man3 pages into
6493 $privlib/man/man3.  This version will suggest a 
6494 new default of $dflt.  
6495 EOM
6496                 tdflt=$dflt
6497                 dflt='n'
6498                 rp='Do you wish to preserve the old behavior?(y/n)'
6499                 . ./myread
6500                 case "$ans" in
6501                 y*) dflt="$privlib/man/man3" ;;
6502                 *)  dflt=$tdflt ;;
6503                 esac
6504     fi
6505         ;;
6506 ' ') dflt=none;;
6507 *)      dflt="$man3dir" ;;
6508 esac
6509 echo " "
6510 fn=dn+~
6511 rp="Where do the $package library man pages (source) go?"
6512 . ./getfile
6513 man3dir="$ans"
6514 man3direxp="$ansexp"
6515 case "$man1dir" in
6516 '')     man3dir=' '
6517         installman3dir='';;
6518 esac
6519
6520 : Change installation prefix, if necessary.
6521 if $test X"$prefix" != X"$installprefix"; then
6522         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6523 else
6524         installman3dir="$man3direxp"
6525 fi
6526
6527 : What suffix to use on installed man pages
6528 case "$man3dir" in
6529 ' ')
6530         man3ext='0'
6531         ;;
6532 *)
6533         rp="What suffix should be used for the $package library man pages?"
6534         case "$man3ext" in
6535         '')     case "$man3dir" in
6536                 *3)  dflt=3 ;;
6537                 *3p) dflt=3p ;;
6538                 *3pm) dflt=3pm ;;
6539                 *l) dflt=l;;
6540                 *n) dflt=n;;
6541                 *o) dflt=o;;
6542                 *p) dflt=p;;
6543                 *C) dflt=C;;
6544                 *L) dflt=L;;
6545                 *L3) dflt=L3;;
6546                 *) dflt=3;;
6547                 esac
6548                 ;;
6549         *)      dflt="$man3ext";;
6550         esac
6551         . ./myread
6552         man3ext="$ans"
6553         ;;
6554 esac
6555
6556 : see if we have to deal with yellow pages, now NIS.
6557 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6558         if $test -f /usr/etc/nibindd; then
6559                 echo " "
6560                 echo "I'm fairly confident you're on a NeXT."
6561                 echo " "
6562                 rp='Do you get the hosts file via NetInfo?'
6563                 dflt=y
6564                 case "$hostcat" in
6565                 nidump*) ;;
6566                 '') ;;
6567                 *) dflt=n;;
6568                 esac
6569                 . ./myread
6570                 case "$ans" in
6571                 y*) hostcat='nidump hosts .';;
6572                 *)      case "$hostcat" in
6573                         nidump*) hostcat='';;
6574                         esac
6575                         ;;
6576                 esac
6577         fi
6578         case "$hostcat" in
6579         nidump*) ;;
6580         *)
6581                 case "$hostcat" in
6582                 *ypcat*) dflt=y;;
6583                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6584                                 dflt=y
6585                         else
6586                                 dflt=n
6587                         fi;;
6588                 *) dflt=n;;
6589                 esac
6590                 echo " "
6591                 rp='Are you getting the hosts file via yellow pages?'
6592                 . ./myread
6593                 case "$ans" in
6594                 y*) hostcat='ypcat hosts';;
6595                 *) hostcat='cat /etc/hosts';;
6596                 esac
6597                 ;;
6598         esac
6599 fi
6600 case "$hostcat" in
6601 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6602 esac
6603 case "$groupcat" in
6604 '') test -f /etc/group && groupcat='cat /etc/group';;
6605 esac
6606 case "$passcat" in
6607 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6608 esac
6609
6610 : now get the host name
6611 echo " "
6612 echo "Figuring out host name..." >&4
6613 case "$myhostname" in
6614 '') cont=true
6615         echo 'Maybe "hostname" will work...'
6616         if tans=`sh -c hostname 2>&1` ; then
6617                 myhostname=$tans
6618                 phostname=hostname
6619                 cont=''
6620         fi
6621         ;;
6622 *) cont='';;
6623 esac
6624 if $test "$cont"; then
6625         if ./xenix; then
6626                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6627                 if tans=`cat /etc/systemid 2>&1` ; then
6628                         myhostname=$tans
6629                         phostname='cat /etc/systemid'
6630                         echo "Whadyaknow.  Xenix always was a bit strange..."
6631                         cont=''
6632                 fi
6633         elif $test -r /etc/systemid; then
6634                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6635         fi
6636 fi
6637 if $test "$cont"; then
6638         echo 'No, maybe "uuname -l" will work...'
6639         if tans=`sh -c 'uuname -l' 2>&1` ; then
6640                 myhostname=$tans
6641                 phostname='uuname -l'
6642         else
6643                 echo 'Strange.  Maybe "uname -n" will work...'
6644                 if tans=`sh -c 'uname -n' 2>&1` ; then
6645                         myhostname=$tans
6646                         phostname='uname -n'
6647                 else
6648                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6649                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6650                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6651                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6652                         else
6653                                 case "$myhostname" in
6654                                 '') echo "Does this machine have an identity crisis or something?"
6655                                         phostname='';;
6656                                 *)
6657                                         echo "Well, you said $myhostname before..."
6658                                         phostname='echo $myhostname';;
6659                                 esac
6660                         fi
6661                 fi
6662         fi
6663 fi
6664 : you do not want to know about this
6665 set $myhostname
6666 myhostname=$1
6667
6668 : verify guess
6669 if $test "$myhostname" ; then
6670         dflt=y
6671         rp='Your host name appears to be "'$myhostname'".'" Right?"
6672         . ./myread
6673         case "$ans" in
6674         y*) ;;
6675         *) myhostname='';;
6676         esac
6677 fi
6678
6679 : bad guess or no guess
6680 while $test "X$myhostname" = X ; do
6681         dflt=''
6682         rp="Please type the (one word) name of your host:"
6683         . ./myread
6684         myhostname="$ans"
6685 done
6686
6687 : translate upper to lower if necessary
6688 case "$myhostname" in
6689 *[A-Z]*)
6690         echo "(Normalizing case in your host name)"
6691         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6692         ;;
6693 esac
6694
6695 case "$myhostname" in
6696 *.*)
6697         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6698         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6699         echo "(Trimming domain name from host name--host name is now $myhostname)"
6700         ;;
6701 *) case "$mydomain" in
6702         '')
6703                 {
6704                         test "X$hostcat" = "Xypcat hosts" &&
6705                         ypmatch "$myhostname" hosts 2>/dev/null |\
6706                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6707                         $test -s hosts
6708                 } || {
6709                         test "X$hostcat" != "X" &&
6710                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6711                                         /[       ]$myhostname[  . ]/p" > hosts
6712                 }
6713                 tmp_re="[       . ]"
6714                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6715                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6716                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6717                         hosts | $sort | $uniq | \
6718                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6719                 case `$echo X$dflt` in
6720                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6721                         dflt=.
6722                         ;;
6723                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6724                         ;;
6725                 esac
6726                 case "$dflt" in
6727                 .)
6728                         tans=`./loc resolv.conf X /etc /usr/etc`
6729                         if $test -f "$tans"; then
6730                                 echo "(Attempting domain name extraction from $tans)"
6731                                 dflt=.`$sed -n -e 's/   / /g' \
6732                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6733                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6734                                 case "$dflt" in
6735                                 .) dflt=.`$sed -n -e 's/        / /g' \
6736                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6737                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6738                                         ;;
6739                                 esac
6740                         fi
6741                         ;;
6742                 esac
6743                 case "$dflt" in
6744                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6745                         dflt=.`sh -c domainname 2>/dev/null`
6746                         case "$dflt" in
6747                         '') dflt='.';;
6748                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6749                         esac
6750                         ;;
6751                 esac
6752                 case "$dflt" in
6753                 .) echo "(Lost all hope -- silly guess then)"
6754                         dflt='.uucp'
6755                         ;;
6756                 esac
6757                 $rm -f hosts
6758                 ;;
6759         *) dflt="$mydomain";;
6760         esac;;
6761 esac
6762 echo " "
6763 rp="What is your domain name?"
6764 . ./myread
6765 tans="$ans"
6766 case "$ans" in
6767 '') ;;
6768 .*) ;;
6769 *) tans=".$tans";;
6770 esac
6771 mydomain="$tans"
6772
6773 : translate upper to lower if necessary
6774 case "$mydomain" in
6775 *[A-Z]*)
6776         echo "(Normalizing case in your domain name)"
6777         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6778         ;;
6779 esac
6780
6781 : a little sanity check here
6782 case "$phostname" in
6783 '') ;;
6784 *)
6785         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6786         $myhostname$mydomain|$myhostname) ;;
6787         *)
6788                 case "$phostname" in
6789                 sed*)
6790                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6791                         ;;
6792                 *)
6793                         echo "(That doesn't agree with your $phostname command, by the way.)"
6794                         ;;
6795                 esac
6796         ;;
6797         esac
6798         ;;
6799 esac
6800
6801 $cat <<EOM
6802
6803 I need to get your e-mail address in Internet format if possible, i.e.
6804 something like user@host.domain. Please answer accurately since I have
6805 no easy means to double check it. The default value provided below
6806 is most probably close to the reality but may not be valid from outside
6807 your organization...
6808
6809 EOM
6810 cont=x
6811 while test "$cont"; do
6812         case "$cf_email" in
6813         '') dflt="$cf_by@$myhostname$mydomain";;
6814         *) dflt="$cf_email";;
6815         esac
6816         rp='What is your e-mail address?'
6817         . ./myread
6818         cf_email="$ans"
6819         case "$cf_email" in
6820         *@*.*) cont='' ;;
6821         *)
6822                 rp='Address does not look like an Internet one.  Use it anyway?'
6823                 case "$fastread" in
6824                 yes) dflt=y ;;
6825                 *) dflt=n ;;
6826                 esac
6827                 . ./myread
6828                 case "$ans" in
6829                 y*) cont='' ;;
6830                 *) echo " " ;;
6831                 esac
6832                 ;;
6833         esac
6834 done
6835
6836 $cat <<EOM
6837
6838 If you or somebody else will be maintaining perl at your site, please
6839 fill in the correct e-mail address here so that they may be contacted
6840 if necessary. Currently, the "perlbug" program included with perl
6841 will send mail to this address in addition to perlbug@perl.com. You may
6842 enter "none" for no administrator.
6843
6844 EOM
6845 case "$perladmin" in
6846 '') dflt="$cf_email";;
6847 *) dflt="$perladmin";;
6848 esac
6849 rp='Perl administrator e-mail address'
6850 . ./myread
6851 perladmin="$ans"
6852
6853 : figure out how to guarantee perl startup
6854 case "$startperl" in
6855 '')
6856         case "$sharpbang" in
6857         *!)
6858                 $cat <<EOH
6859
6860 I can use the #! construct to start perl on your system. This will
6861 make startup of perl scripts faster, but may cause problems if you
6862 want to share those scripts and perl is not in a standard place
6863 ($binexp/perl) on all your platforms. The alternative is to force
6864 a shell by starting the script with a single ':' character.
6865
6866 EOH
6867                 dflt="$binexp/perl"
6868                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6869                 . ./myread
6870                 case "$ans" in
6871                 none)   startperl=": # use perl";;
6872                 *)      startperl="#!$ans"
6873                         if $test 30 -lt `echo "$ans" | wc -c`; then
6874                                 $cat >&4 <<EOM
6875
6876 WARNING:  Some systems limit the #! command to 32 characters.
6877 If you experience difficulty running Perl scripts with #!, try
6878 installing Perl in a directory with a shorter pathname.
6879
6880 EOM
6881                         fi ;;
6882                 esac
6883                 ;;
6884         *) startperl=": # use perl"
6885                 ;;
6886         esac
6887         ;;
6888 esac
6889 echo "I'll use $startperl to start perl scripts."
6890
6891 : figure best path for perl in scripts
6892 case "$perlpath" in
6893 '')
6894         perlpath="$binexp/perl"
6895         case "$startperl" in
6896         *!*) ;;
6897         *)
6898                 $cat <<EOH
6899
6900 I will use the "eval 'exec'" idiom to start Perl on your system.
6901 I can use the full path of your Perl binary for this purpose, but
6902 doing so may cause problems if you want to share those scripts and
6903 Perl is not always in a standard place ($binexp/perl).
6904
6905 EOH
6906                 dflt="$binexp/perl"
6907                 rp="What path shall I use in \"eval 'exec'\"?"
6908                 . ./myread
6909                 perlpath="$ans"
6910                 ;;
6911         esac
6912         ;;
6913 esac
6914 case "$startperl" in
6915 *!*)    ;;
6916 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6917 esac
6918
6919 : determine where public executable scripts go
6920 set scriptdir scriptdir
6921 eval $prefixit
6922 case "$scriptdir" in
6923 '')
6924         dflt="$bin"
6925         : guess some guesses
6926         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6927         $test -d /usr/share/bin     && dflt=/usr/share/bin
6928         $test -d /usr/local/script  && dflt=/usr/local/script
6929         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6930         $test -d $prefixexp/script  && dflt=$prefixexp/script
6931         set dflt
6932         eval $prefixup
6933         ;;
6934 *)  dflt="$scriptdir"
6935         ;;
6936 esac
6937 $cat <<EOM
6938  
6939 Some installations have a separate directory just for executable scripts so
6940 that they can mount it across multiple architectures but keep the scripts in
6941 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6942 Or you might just lump your scripts in with all your other executables.
6943  
6944 EOM
6945 fn=d~
6946 rp='Where do you keep publicly executable scripts?'
6947 . ./getfile
6948 if $test "X$ansexp" != "X$scriptdirexp"; then
6949         installscript=''
6950 fi
6951 scriptdir="$ans"
6952 scriptdirexp="$ansexp"
6953 : Change installation prefix, if necessary.
6954 if $test X"$prefix" != X"$installprefix"; then
6955         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6956 else
6957         installscript="$scriptdirexp"
6958 fi
6959
6960 : determine where site specific architecture-dependent libraries go.
6961 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6962 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6963 : sitelib may have an optional trailing /share.
6964 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6965 tdflt="$tdflt/$archname"
6966 set sitearch sitearch none
6967 eval $prefixit
6968 case "$sitearch" in
6969 '')     dflt="$tdflt" ;;
6970 *)      dflt="$sitearch" ;;
6971 esac
6972 $cat <<EOM
6973
6974 The installation process will also create a directory for
6975 architecture-dependent site-specific extensions and modules.
6976
6977 EOM
6978 fn=nd~+
6979 rp='Pathname for the site-specific architecture-dependent library files?'
6980 . ./getfile
6981 sitearch="$ans"
6982 sitearchexp="$ansexp"
6983 : Change installation prefix, if necessary.
6984 if $test X"$prefix" != X"$installprefix"; then
6985         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6986 else
6987         installsitearch="$sitearchexp"
6988 fi
6989
6990 : determine where add-on public executables go
6991 case "$sitebin" in
6992 '')     dflt=$siteprefix/bin ;;
6993 *)      dflt=$sitebin ;;
6994 esac
6995 fn=d~
6996 rp='Pathname where the add-on public executables should be installed?'
6997 . ./getfile
6998 sitebin="$ans"
6999 sitebinexp="$ansexp"
7000 : Change installation prefix, if necessary.
7001 if $test X"$prefix" != X"$installprefix"; then
7002         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7003 else
7004         installsitebin="$sitebinexp"
7005 fi
7006
7007 cat <<EOM
7008
7009 Perl can be built to take advantage of long doubles which
7010 (if available) may give more accuracy and range for floating point numbers.
7011
7012 If this doesn't make any sense to you, just accept the default 'n'.
7013 EOM
7014
7015 case "$ccflags" in
7016 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7017 esac
7018
7019 case "$uselongdouble" in
7020 $define|true|[yY]*)     dflt='y';;
7021 *) dflt='n';;
7022 esac
7023 rp='Try to use long doubles if available?'
7024 . ./myread
7025 case "$ans" in
7026 y|Y)    val="$define"   ;;
7027 *)      val="$undef"    ;;
7028 esac
7029 set uselongdouble
7030 eval $setvar
7031
7032 case "$uselongdouble" in
7033 true|[yY]*) uselongdouble="$define" ;;
7034 esac
7035
7036 case "$uselongdouble" in
7037 $define)
7038 : Look for a hint-file generated 'call-back-unit'.  If the
7039 : user has specified that long doubles should be used,
7040 : we may need to set or change some other defaults.
7041         if $test -f uselongdouble.cbu; then
7042                 echo "Your platform has some specific hints for long doubles, using them..."
7043                 . ./uselongdouble.cbu
7044         else
7045                 $cat <<EOM
7046 (Your platform doesn't have any specific hints for long doubles.)
7047 EOM
7048         fi
7049         ;;
7050 esac
7051
7052 cat <<EOM
7053
7054 Perl can be built to take advantage of long longs which
7055 (if available) may give more range for integer numbers.
7056
7057 If this doesn't make any sense to you, just accept the default 'n'.
7058 EOM
7059
7060 case "$ccflags" in
7061 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7062 esac
7063
7064 case "$uselonglong" in
7065 $define|true|[yY]*)     dflt='y';;
7066 *) dflt='n';;
7067 esac
7068 rp='Try to use long longs if available?'
7069 . ./myread
7070 case "$ans" in
7071 y|Y)    val="$define"   ;;
7072 *)      val="$undef"    ;;
7073 esac
7074 set uselonglong
7075 eval $setvar
7076
7077 case "$uselonglong" in
7078 true|[yY]*) uselonglong="$define" ;;
7079 esac
7080
7081 case "$uselonglong" in
7082 $define)
7083 : Look for a hint-file generated 'call-back-unit'.  If the
7084 : user has specified that long longs should be used,
7085 : we may need to set or change some other defaults.
7086         if $test -f uselonglong.cbu; then
7087                 echo "Your platform has some specific hints for long longs, using them..."
7088                 . ./uselonglong.cbu
7089         else
7090                 $cat <<EOM
7091 (Your platform doesn't have any specific hints for long longs.)
7092 EOM
7093         fi
7094         ;;
7095 esac
7096
7097 cat <<EOM
7098
7099 Previous version of $package used the standard IO mechanisms as defined
7100 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7101 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7102 the default.  This abstraction layer can use AT&T's sfio (if you already
7103 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7104 problems with some extension modules.  Using PerlIO with stdio is safe,
7105 but it is slower than plain stdio and therefore is not the default.
7106
7107 If this doesn't make any sense to you, just accept the default 'n'.
7108 EOM
7109 case "$useperlio" in
7110 $define|true|[yY]*)     dflt='y';;
7111 *) dflt='n';;
7112 esac
7113 rp='Use the experimental PerlIO abstraction layer?'
7114 . ./myread
7115 case "$ans" in
7116 y|Y) 
7117         val="$define"
7118         ;;     
7119 *)      
7120         echo "Ok, doing things the stdio way"
7121         val="$undef"
7122         ;;
7123 esac
7124 set useperlio
7125 eval $setvar 
7126
7127 case "$vendorprefix" in
7128 '')     d_vendorbin="$undef"
7129         vendorbin=''
7130         vendorbinexp=''
7131         ;;
7132 *)      d_vendorbin="$define"
7133         : determine where vendor-supplied executables go.
7134         dflt=$vendorprefix/bin
7135         fn=d~+
7136         rp='Pathname for the vendor-supplied executables directory?'
7137         . ./getfile
7138         vendorbin="$ans"
7139         vendorbinexp="$ansexp"
7140         : Change installation prefix, if necessary.
7141         if $test X"$prefix" != X"$installprefix"; then
7142                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7143         else
7144                 installvendorbin="$vendorbinexp"
7145         fi
7146         ;;
7147 esac
7148
7149 : check for length of double
7150 echo " "
7151 case "$doublesize" in
7152 '')
7153         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7154         $cat >try.c <<'EOCP'
7155 #include <stdio.h>
7156 int main()
7157 {
7158     printf("%d\n", (int)sizeof(double));
7159     exit(0);
7160 }
7161 EOCP
7162         set try
7163         if eval $compile_ok; then
7164                 doublesize=`./try`
7165                 $echo " $doublesize bytes." >&4
7166         else
7167                 dflt='8'
7168                 echo "(I can't seem to compile the test program.  Guessing...)"
7169                 rp="What is the size of a double precision number (in bytes)?"
7170                 . ./myread
7171                 doublesize="$ans"
7172         fi
7173         ;;
7174 esac
7175 $rm -f try.c try
7176
7177 : check for long doubles
7178 echo " "
7179 $echo $n "Checking to see if your system supports long double..." $c >&4
7180 echo 'int main() { long double x = 7.0; }' > try.c
7181 set try
7182 if eval $compile; then
7183         val="$define"
7184         echo " Yes, it does." >&4
7185 else
7186         val="$undef"
7187         echo " No, it doesn't." >&4
7188 fi
7189 $rm try.*
7190 set d_longdbl
7191 eval $setvar
7192
7193 : check for length of long double
7194 case "${d_longdbl}${longdblsize}" in
7195 $define)
7196         echo " "
7197         $echo $n "Checking to see how big your long doubles are..." $c >&4
7198         $cat >try.c <<'EOCP'
7199 #include <stdio.h>
7200 int main()
7201 {
7202         printf("%d\n", sizeof(long double));
7203 }
7204 EOCP
7205         set try
7206         set try
7207         if eval $compile; then
7208                 longdblsize=`./try$exe_ext`
7209                 $echo " $longdblsize bytes." >&4
7210         else
7211                 dflt='8'
7212                 echo " "
7213                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7214                 rp="What is the size of a long double (in bytes)?"
7215                 . ./myread
7216                 longdblsize="$ans"
7217         fi
7218         if $test "X$doublesize" = "X$longdblsize"; then
7219                 echo "(That isn't any different from an ordinary double.)"
7220         fi      
7221         ;;
7222 esac
7223 $rm -f try.* try
7224
7225 : Check how to convert floats to strings.
7226 if test "X$d_Gconvert" = X; then
7227         echo " "
7228         echo "Checking for an efficient way to convert floats to strings."
7229         $cat >try.c <<EOP
7230 #ifdef TRY_gconvert
7231 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7232 char *myname = "gconvert";
7233 #endif
7234 #ifdef TRY_gcvt
7235 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7236 char *myname = "gcvt";
7237 #endif
7238 #ifdef TRY_qgcvt
7239 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7240 char *myname = "qgcvt";
7241 #define DOUBLETYPE long double
7242 #endif
7243 #ifdef TRY_sprintf
7244 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7245 char *myname = "sprintf";
7246 #endif
7247
7248 #ifndef DOUBLETYPE
7249 #define DOUBLETYPE double
7250 #endif
7251
7252 #include <stdio.h>
7253
7254 #ifdef I_STDLIB
7255 #include <stdlib.h>
7256 #endif
7257
7258 int
7259 checkit(expect, got)
7260 char *expect;
7261 char *got;
7262 {
7263     if (strcmp(expect, got)) {
7264                 printf("%s oddity:  Expected %s, got %s\n",
7265                         myname, expect, got);
7266                 exit(1);
7267         }
7268 }
7269
7270 int main()
7271
7272         char buf[64]; 
7273         buf[63] = '\0';
7274
7275         /* This must be 1st test on (which?) platform */
7276         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7277         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7278         checkit("0.1", buf);
7279
7280         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7281         checkit("1", buf);
7282
7283         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7284         checkit("0", buf);
7285
7286         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7287         checkit("-1", buf);
7288
7289         /* Some Linux gcvt's give 1.e+5 here. */
7290         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7291         checkit("100000", buf);
7292         
7293         /* Some Linux gcvt's give -1.e+5 here. */
7294         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7295         checkit("-100000", buf);
7296
7297         exit(0);
7298 }
7299 EOP
7300         case "$d_Gconvert" in
7301         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7302         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7303         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7304         *) xxx_list='gconvert gcvt sprintf' ;;
7305         esac
7306
7307         case "$d_longdbl$uselongdouble" in
7308         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7309         esac
7310
7311         for xxx_convert in $xxx_list; do
7312                 echo "Trying $xxx_convert..."
7313                 $rm -f try try$_o
7314                 set try -DTRY_$xxx_convert
7315                 if eval $compile; then
7316                         echo "$xxx_convert() found." >&4
7317                         if ./try; then
7318                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7319                                 break;
7320                         else
7321                                 echo "...But $xxx_convert didn't work as I expected."
7322                         fi
7323                 else
7324                         echo "$xxx_convert NOT found." >&4
7325                 fi
7326         done
7327                 
7328         case "$xxx_convert" in
7329         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7330         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7331         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7332         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7333         esac
7334 fi
7335
7336 echo " "
7337
7338 if $test X"$d_longdbl" = X"$define"; then
7339
7340 echo "Checking how to print long doubles..." >&4
7341
7342 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7343         $cat >try.c <<'EOCP'
7344 #include <sys/types.h>
7345 #include <stdio.h>
7346 int main() {
7347   double d = 123.456;
7348   printf("%.3f\n", d);
7349 }
7350 EOCP
7351         set try
7352         if eval $compile; then
7353                 yyy=`./try$exe_ext`
7354                 case "$yyy" in
7355                 123.456)
7356                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7357                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7358                         echo "We will use %f."
7359                         ;;
7360                 esac
7361         fi
7362 fi
7363
7364 if $test X"$sPRIfldbl" = X; then
7365         $cat >try.c <<'EOCP'
7366 #include <sys/types.h>
7367 #include <stdio.h>
7368 int main() {
7369   long double d = 123.456;
7370   printf("%.3llf\n", d);
7371 }
7372 EOCP
7373         set try
7374         if eval $compile; then
7375                 yyy=`./try$exe_ext`
7376                 case "$yyy" in
7377                 123.456)
7378                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7379                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7380                         echo "We will use %llf."
7381                         ;;
7382                 esac
7383         fi
7384 fi
7385
7386 if $test X"$sPRIfldbl" = X; then
7387         $cat >try.c <<'EOCP'
7388 #include <sys/types.h>
7389 #include <stdio.h>
7390 int main() {
7391   long double d = 123.456;
7392   printf("%.3Lf\n", d);
7393 }
7394 EOCP
7395         set try
7396         if eval $compile; then
7397                 yyy=`./try$exe_ext`
7398                 case "$yyy" in
7399                 123.456)
7400                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7401                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7402                         echo "We will use %Lf."
7403                         ;;
7404                 esac
7405         fi
7406 fi
7407
7408 if $test X"$sPRIfldbl" = X; then
7409         $cat >try.c <<'EOCP'
7410 #include <sys/types.h>
7411 #include <stdio.h>
7412 int main() {
7413   long double d = 123.456;
7414   printf("%.3lf\n", d);
7415 }
7416 EOCP
7417         set try
7418         if eval $compile; then
7419                 yyy=`./try$exe_ext`
7420                 case "$yyy" in
7421                 123.456)
7422                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7423                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7424                         echo "We will use %lf."
7425                         ;;
7426                 esac
7427         fi
7428 fi
7429
7430 if $test X"$sPRIfldbl" = X; then
7431         echo "Cannot figure out how to print long doubles." >&4
7432 fi
7433
7434 $rm -f try try.*
7435
7436 fi # d_longdbl
7437
7438 case "$sPRIfldbl" in
7439 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7440         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7441         ;;
7442 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7443         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7444         ;;
7445 esac
7446
7447 : Initialize h_fcntl
7448 h_fcntl=false
7449
7450 : Initialize h_sysfile
7451 h_sysfile=false
7452
7453 : access call always available on UNIX
7454 set access d_access
7455 eval $inlibc
7456
7457 : locate the flags for 'access()'
7458 case "$d_access" in
7459 "$define")
7460         echo " "
7461         $cat >access.c <<'EOCP'
7462 #include <sys/types.h>
7463 #ifdef I_FCNTL
7464 #include <fcntl.h>
7465 #endif
7466 #ifdef I_SYS_FILE
7467 #include <sys/file.h>
7468 #endif
7469 #ifdef I_UNISTD
7470 #include <unistd.h>
7471 #endif
7472 int main() {
7473         exit(R_OK);
7474 }
7475 EOCP
7476         : check sys/file.h first, no particular reason here
7477         if $test `./findhdr sys/file.h` && \
7478                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7479                 h_sysfile=true;
7480                 echo "<sys/file.h> defines the *_OK access constants." >&4
7481         elif $test `./findhdr fcntl.h` && \
7482                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7483                 h_fcntl=true;
7484                 echo "<fcntl.h> defines the *_OK access constants." >&4
7485         elif $test `./findhdr unistd.h` && \
7486                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7487                 echo "<unistd.h> defines the *_OK access constants." >&4
7488         else
7489                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7490         fi
7491         ;;
7492 esac
7493 $rm -f access*
7494
7495 : see if accessx exists
7496 set accessx d_accessx
7497 eval $inlibc
7498
7499 : see if alarm exists
7500 set alarm d_alarm
7501 eval $inlibc
7502
7503 : see if atolf exists
7504 set atolf d_atolf
7505 eval $inlibc
7506
7507 : see if atoll exists
7508 set atoll d_atoll
7509 eval $inlibc
7510
7511 : Look for GNU-cc style attribute checking
7512 echo " "
7513 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7514 $cat >attrib.c <<'EOCP'
7515 #include <stdio.h>
7516 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7517 EOCP
7518 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7519         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7520                 echo "Your C compiler doesn't fully support __attribute__."
7521                 val="$undef"
7522         else
7523                 echo "Your C compiler supports __attribute__."
7524                 val="$define"
7525         fi
7526 else
7527         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7528         val="$undef"
7529 fi
7530 set d_attribut
7531 eval $setvar
7532 $rm -f attrib*
7533
7534 : see if bcmp exists
7535 set bcmp d_bcmp
7536 eval $inlibc
7537
7538 : see if bcopy exists
7539 set bcopy d_bcopy
7540 eval $inlibc
7541
7542 : see if this is a unistd.h system
7543 set unistd.h i_unistd
7544 eval $inhdr
7545
7546 : see if getpgrp exists
7547 set getpgrp d_getpgrp
7548 eval $inlibc
7549
7550 case "$d_getpgrp" in
7551 "$define")
7552         echo " "
7553         echo "Checking to see which flavor of getpgrp is in use..."
7554         $cat >set.c <<EOP
7555 #$i_unistd I_UNISTD
7556 #include <sys/types.h>
7557 #ifdef I_UNISTD
7558 #  include <unistd.h>
7559 #endif
7560 int main()
7561 {
7562         if (getuid() == 0) {
7563                 printf("(I see you are running Configure as super-user...)\n");
7564                 setuid(1);
7565         }
7566 #ifdef TRY_BSD_PGRP
7567         if (getpgrp(1) == 0)
7568                 exit(0);
7569 #else
7570         if (getpgrp() > 0)
7571                 exit(0);
7572 #endif
7573         exit(1);
7574 }
7575 EOP
7576         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7577                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7578                 val="$define"
7579         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7580                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7581                 val="$undef"
7582         else
7583                 echo "I can't seem to compile and run the test program."
7584                 if ./usg; then
7585                         xxx="a USG one, i.e. you use getpgrp()."
7586                 else
7587                         # SVR4 systems can appear rather BSD-ish.
7588                         case "$i_unistd" in
7589                         $undef)
7590                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7591                                 val="$define"
7592                                 ;;
7593                         $define)
7594                                 xxx="probably a USG one, i.e. you use getpgrp()."
7595                                 val="$undef"
7596                                 ;;
7597                         esac
7598                 fi
7599                 echo "Assuming your getpgrp is $xxx" >&4
7600         fi
7601         ;;
7602 *) val="$undef";;
7603 esac
7604 set d_bsdgetpgrp
7605 eval $setvar
7606 $rm -f set set.c
7607
7608 : see if setpgrp exists
7609 set setpgrp d_setpgrp
7610 eval $inlibc
7611
7612 case "$d_setpgrp" in
7613 "$define")
7614         echo " "
7615         echo "Checking to see which flavor of setpgrp is in use..."
7616         $cat >set.c <<EOP
7617 #$i_unistd I_UNISTD
7618 #include <sys/types.h>
7619 #ifdef I_UNISTD
7620 #  include <unistd.h>
7621 #endif
7622 int main()
7623 {
7624         if (getuid() == 0) {
7625                 printf("(I see you are running Configure as super-user...)\n");
7626                 setuid(1);
7627         }
7628 #ifdef TRY_BSD_PGRP
7629         if (-1 == setpgrp(1, 1))
7630                 exit(0);
7631 #else
7632         if (setpgrp() != -1)
7633                 exit(0);
7634 #endif
7635         exit(1);
7636 }
7637 EOP
7638         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7639                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7640                 val="$define"
7641         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7642                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7643                 val="$undef"
7644         else
7645                 echo "(I can't seem to compile and run the test program.)"
7646                 if ./usg; then
7647                         xxx="a USG one, i.e. you use setpgrp()."
7648                 else
7649                         # SVR4 systems can appear rather BSD-ish.
7650                         case "$i_unistd" in
7651                         $undef)
7652                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7653                                 val="$define"
7654                                 ;;
7655                         $define)
7656                                 xxx="probably a USG one, i.e. you use setpgrp()."
7657                                 val="$undef"
7658                                 ;;
7659                         esac
7660                 fi
7661                 echo "Assuming your setpgrp is $xxx" >&4
7662         fi
7663         ;;
7664 *) val="$undef";;
7665 esac
7666 set d_bsdsetpgrp
7667 eval $setvar
7668 $rm -f set set.c
7669 : see if bzero exists
7670 set bzero d_bzero
7671 eval $inlibc
7672
7673 : see if signal is declared as pointer to function returning int or void
7674 echo " "
7675 xxx=`./findhdr signal.h`
7676 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7677 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7678         echo "You have int (*signal())() instead of void." >&4
7679         val="$undef"
7680 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7681         echo "You have void (*signal())()." >&4
7682         val="$define"
7683 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7684         echo "You have int (*signal())() instead of void." >&4
7685         val="$undef"
7686 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7687         echo "You have void (*signal())()." >&4
7688         val="$define"
7689 else
7690         case "$d_voidsig" in
7691         '')
7692         echo "I can't determine whether signal handler returns void or int..." >&4
7693                 dflt=void
7694                 rp="What type does your signal handler return?"
7695                 . ./myread
7696                 case "$ans" in
7697                 v*) val="$define";;
7698                 *) val="$undef";;
7699                 esac;;
7700         "$define")
7701                 echo "As you already told me, signal handler returns void." >&4
7702                 val="$define"
7703                 ;;
7704         *)      echo "As you already told me, signal handler returns int." >&4
7705                 val="$undef"
7706                 ;;
7707         esac
7708 fi
7709 set d_voidsig
7710 eval $setvar
7711 case "$d_voidsig" in
7712 "$define") signal_t="void";;
7713 *) signal_t="int";;
7714 esac
7715 $rm -f $$.tmp
7716
7717 : check for ability to cast large floats to 32-bit ints.
7718 echo " "
7719 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7720 if $test "$intsize" -ge 4; then
7721         xxx=int
7722 else
7723         xxx=long
7724 fi
7725 $cat >try.c <<EOCP
7726 #include <stdio.h>
7727 #include <sys/types.h>
7728 #include <signal.h>
7729 $signal_t blech(s) int s; { exit(3); }
7730 int main()
7731 {
7732         $xxx i32;
7733         double f, g;
7734         int result = 0;
7735         char str[16];
7736         signal(SIGFPE, blech);
7737
7738         /* Don't let compiler optimize the test away.  Store the number 
7739            in a writable string for gcc to pass to sscanf under HP/UX.
7740         */
7741         sprintf(str, "2147483647");
7742         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7743         g = 10 * f;
7744         i32  = ($xxx) g;
7745
7746         /* x86 processors will probably give 0x8000 0000, which is a
7747        sign change.  We don't want that.  We want to mimic SPARC
7748            behavior here, which is to preserve the sign and give
7749            back 0x7fff ffff.
7750         */
7751         if (i32 != ($xxx) f)
7752                 result |= 1;
7753         exit(result);
7754 }
7755 EOCP
7756 set try
7757 if eval $compile_ok; then
7758         ./try
7759         yyy=$?
7760 else
7761         echo "(I can't seem to compile the test program--assuming it can't)"
7762         yyy=1
7763 fi
7764 case "$yyy" in
7765 0)      val="$define"
7766         echo "Yup, it can."
7767         ;;
7768 *)      val="$undef"
7769         echo "Nope, it can't."
7770         ;;
7771 esac
7772 set d_casti32
7773 eval $setvar
7774 $rm -f try try.*
7775
7776 : check for ability to cast negative floats to unsigned
7777 echo " "
7778 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7779 $cat >try.c <<EOCP
7780 #include <stdio.h>
7781 #include <sys/types.h>
7782 #include <signal.h>
7783 $signal_t blech(s) int s; { exit(7); }
7784 $signal_t blech_in_list(s) int s; { exit(4); }
7785 unsigned long dummy_long(p) unsigned long p; { return p; }
7786 unsigned int dummy_int(p) unsigned int p; { return p; }
7787 unsigned short dummy_short(p) unsigned short p; { return p; }
7788 int main()
7789 {
7790         double f;
7791         unsigned long along;
7792         unsigned int aint;
7793         unsigned short ashort;
7794         int result = 0;
7795         char str[16];
7796         
7797         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7798            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7799            optimized the whole file away
7800         */
7801         /* Store the number in a writable string for gcc to pass to 
7802            sscanf under HP/UX.
7803         */
7804         sprintf(str, "-123");
7805         sscanf(str, "%lf", &f);  /* f = -123.; */
7806
7807         signal(SIGFPE, blech);
7808         along = (unsigned long)f;
7809         aint = (unsigned int)f;
7810         ashort = (unsigned short)f;
7811         if (along != (unsigned long)-123)
7812                 result |= 1;
7813         if (aint != (unsigned int)-123)
7814                 result |= 1;
7815         if (ashort != (unsigned short)-123)
7816                 result |= 1;
7817         sprintf(str, "1073741824.");
7818         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7819         f = f + f;
7820         along = 0;
7821         along = (unsigned long)f;
7822         if (along != 0x80000000)
7823                 result |= 2;
7824         f -= 1.;
7825         along = 0;
7826         along = (unsigned long)f;
7827         if (along != 0x7fffffff)
7828                 result |= 1;
7829         f += 2.;
7830         along = 0;
7831         along = (unsigned long)f;
7832         if (along != 0x80000001)
7833                 result |= 2;
7834         if (result)
7835                 exit(result);
7836         signal(SIGFPE, blech_in_list);
7837         sprintf(str, "123.");
7838         sscanf(str, "%lf", &f);  /* f = 123.; */
7839         along = dummy_long((unsigned long)f);
7840         aint = dummy_int((unsigned int)f);
7841         ashort = dummy_short((unsigned short)f);
7842         if (along != (unsigned long)123)
7843                 result |= 4;
7844         if (aint != (unsigned int)123)
7845                 result |= 4;
7846         if (ashort != (unsigned short)123)
7847                 result |= 4;
7848         exit(result);
7849
7850 }
7851 EOCP
7852 set try
7853 if eval $compile_ok; then
7854         ./try
7855         castflags=$?
7856 else
7857         echo "(I can't seem to compile the test program--assuming it can't)"
7858         castflags=7
7859 fi
7860 case "$castflags" in
7861 0)      val="$define"
7862         echo "Yup, it can."
7863         ;;
7864 *)      val="$undef"
7865         echo "Nope, it can't."
7866         ;;
7867 esac
7868 set d_castneg
7869 eval $setvar
7870 $rm -f try.*
7871
7872 : see if vprintf exists
7873 echo " "
7874 if set vprintf val -f d_vprintf; eval $csym; $val; then
7875         echo 'vprintf() found.' >&4
7876         val="$define"
7877         $cat >vprintf.c <<'EOF'
7878 #include <varargs.h>
7879
7880 int main() { xxx("foo"); }
7881
7882 xxx(va_alist)
7883 va_dcl
7884 {
7885         va_list args;
7886         char buf[10];
7887
7888         va_start(args);
7889         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7890 }
7891 EOF
7892         set vprintf
7893         if eval $compile && ./vprintf; then
7894                 echo "Your vsprintf() returns (int)." >&4
7895                 val2="$undef"
7896         else
7897                 echo "Your vsprintf() returns (char*)." >&4
7898                 val2="$define"
7899         fi
7900 else
7901         echo 'vprintf() NOT found.' >&4
7902                 val="$undef"
7903                 val2="$undef"
7904 fi
7905 set d_vprintf
7906 eval $setvar
7907 val=$val2
7908 set d_charvspr
7909 eval $setvar
7910
7911 : see if chown exists
7912 set chown d_chown
7913 eval $inlibc
7914
7915 : see if chroot exists
7916 set chroot d_chroot
7917 eval $inlibc
7918
7919 : see if chsize exists
7920 set chsize d_chsize
7921 eval $inlibc
7922
7923 : check for const keyword
7924 echo " "
7925 echo 'Checking to see if your C compiler knows about "const"...' >&4
7926 $cat >const.c <<'EOCP'
7927 typedef struct spug { int drokk; } spug;
7928 int main()
7929 {
7930         const char *foo;
7931         const spug y;
7932 }
7933 EOCP
7934 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7935         val="$define"
7936         echo "Yup, it does."
7937 else
7938         val="$undef"
7939         echo "Nope, it doesn't."
7940 fi
7941 set d_const
7942 eval $setvar
7943
7944 : see if crypt exists
7945 echo " "
7946 if set crypt val -f d_crypt; eval $csym; $val; then
7947         echo 'crypt() found.' >&4
7948         val="$define"
7949         cryptlib=''
7950 else
7951         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7952         if $test -z "$cryptlib"; then
7953                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7954         else
7955                 cryptlib=-lcrypt
7956         fi
7957         if $test -z "$cryptlib"; then
7958                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7959         else
7960                 cryptlib=-lcrypt
7961         fi
7962         if $test -z "$cryptlib"; then
7963                 cryptlib=`./loc libcrypt$_a "" $libpth`
7964         else
7965                 cryptlib=-lcrypt
7966         fi
7967         if $test -z "$cryptlib"; then
7968                 echo 'crypt() NOT found.' >&4
7969                 val="$undef"
7970         else
7971                 val="$define"
7972         fi
7973 fi
7974 set d_crypt
7975 eval $setvar
7976
7977 : get csh whereabouts
7978 case "$csh" in
7979 'csh') val="$undef" ;;
7980 *) val="$define" ;;
7981 esac
7982 set d_csh
7983 eval $setvar
7984 : Respect a hint or command line value for full_csh.
7985 case "$full_csh" in
7986 '') full_csh=$csh ;;
7987 esac
7988
7989 : see if cuserid exists
7990 set cuserid d_cuserid
7991 eval $inlibc
7992
7993 : see if this is a limits.h system
7994 set limits.h i_limits
7995 eval $inhdr
7996
7997 : see if this is a float.h system
7998 set float.h i_float
7999 eval $inhdr
8000
8001 : See if number of significant digits in a double precision number is known
8002 echo " "
8003 $cat >dbl_dig.c <<EOM
8004 #$i_limits I_LIMITS
8005 #$i_float I_FLOAT
8006 #ifdef I_LIMITS
8007 #include <limits.h>
8008 #endif
8009 #ifdef I_FLOAT
8010 #include <float.h>
8011 #endif
8012 #ifdef DBL_DIG
8013 printf("Contains DBL_DIG");
8014 #endif
8015 EOM
8016 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8017 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8018         echo "DBL_DIG found." >&4
8019         val="$define"
8020 else
8021         echo "DBL_DIG NOT found." >&4
8022         val="$undef"
8023 fi
8024 $rm -f dbl_dig.?
8025 set d_dbl_dig
8026 eval $setvar
8027
8028 : see if difftime exists
8029 set difftime d_difftime
8030 eval $inlibc
8031
8032 : see if this is a dirent system
8033 echo " "
8034 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8035         val="$define"
8036         echo "<dirent.h> found." >&4
8037 else
8038         val="$undef"
8039         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8040                 echo "<sys/dir.h> found." >&4
8041                 echo " "
8042         else
8043                 xinc=`./findhdr sys/ndir.h`
8044         fi
8045         echo "<dirent.h> NOT found." >&4
8046 fi
8047 set i_dirent
8048 eval $setvar
8049
8050 : Look for type of directory structure.
8051 echo " "
8052 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8053
8054 case "$direntrytype" in
8055 ''|' ')
8056         case "$i_dirent" in
8057         $define) guess1='struct dirent' ;;
8058         *) guess1='struct direct'  ;;
8059         esac
8060         ;;
8061 *)      guess1="$direntrytype"
8062         ;;
8063 esac
8064
8065 case "$guess1" in
8066 'struct dirent') guess2='struct direct' ;;
8067 *) guess2='struct dirent' ;;
8068 esac
8069                 
8070 if $contains "$guess1" try.c >/dev/null 2>&1; then
8071         direntrytype="$guess1"
8072         echo "Your directory entries are $direntrytype." >&4
8073 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8074         direntrytype="$guess2"
8075         echo "Your directory entries seem to be $direntrytype." >&4
8076 else
8077         echo "I don't recognize your system's directory entries." >&4
8078         rp="What type is used for directory entries on this system?"
8079         dflt="$guess1"
8080         . ./myread
8081         direntrytype="$ans"
8082 fi
8083 $rm -f try.c
8084
8085
8086 : see if the directory entry stores field length
8087 echo " "
8088 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8089 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8090         echo "Good, your directory entry keeps length information in d_namlen." >&4
8091         val="$define"
8092 else
8093         echo "Your directory entry does not know about the d_namlen field." >&4
8094         val="$undef"
8095 fi
8096 set d_dirnamlen
8097 eval $setvar
8098 $rm -f try.c
8099
8100 : see if dlerror exists
8101 xxx_runnm="$runnm"
8102 runnm=false
8103 set dlerror d_dlerror
8104 eval $inlibc
8105 runnm="$xxx_runnm"
8106
8107 : see if dlfcn is available
8108 set dlfcn.h i_dlfcn
8109 eval $inhdr
8110
8111 case "$usedl" in
8112 $define|y|true)
8113         $cat << EOM
8114
8115 On a few systems, the dynamically loaded modules that perl generates and uses
8116 will need a different extension than shared libs. The default will probably
8117 be appropriate.
8118
8119 EOM
8120         case "$dlext" in
8121         '')     dflt="$so" ;;
8122         *)      dflt="$dlext" ;;
8123         esac
8124         rp='What is the extension of dynamically loaded modules'
8125         . ./myread
8126         dlext="$ans"
8127         ;;
8128 *)
8129         dlext="none"
8130         ;;
8131 esac
8132
8133 : Check if dlsym need a leading underscore
8134 echo " "
8135 val="$undef"
8136
8137 case "$dlsrc" in
8138 dl_dlopen.xs)
8139         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8140         $cat >dyna.c <<'EOM'
8141 fred () { }
8142 EOM
8143
8144 $cat >fred.c<<EOM
8145
8146 #include <stdio.h>
8147 #$i_dlfcn I_DLFCN
8148 #ifdef I_DLFCN
8149 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8150 #else
8151 #include <sys/types.h>
8152 #include <nlist.h>
8153 #include <link.h>
8154 #endif
8155
8156 extern int fred() ;
8157
8158 int main()
8159 {
8160     void * handle ;
8161     void * symbol ;
8162 #ifndef RTLD_LAZY
8163     int mode = 1 ;
8164 #else
8165     int mode = RTLD_LAZY ;
8166 #endif
8167     handle = dlopen("./dyna.$dlext", mode) ;
8168     if (handle == NULL) {
8169         printf ("1\n") ;
8170         fflush (stdout) ;
8171         exit(0);
8172     }
8173     symbol = dlsym(handle, "fred") ;
8174     if (symbol == NULL) {
8175         /* try putting a leading underscore */
8176         symbol = dlsym(handle, "_fred") ;
8177         if (symbol == NULL) {
8178             printf ("2\n") ;
8179             fflush (stdout) ;
8180             exit(0);
8181         }
8182         printf ("3\n") ;
8183     }
8184     else
8185         printf ("4\n") ;
8186     fflush (stdout) ;
8187     exit(0);
8188 }
8189 EOM
8190         : Call the object file tmp-dyna.o in case dlext=o.
8191         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8192                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8193                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8194                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8195                 xxx=`./fred`
8196                 case $xxx in
8197                 1)      echo "Test program failed using dlopen." >&4
8198                         echo "Perhaps you should not use dynamic loading." >&4;;
8199                 2)      echo "Test program failed using dlsym." >&4
8200                         echo "Perhaps you should not use dynamic loading." >&4;;
8201                 3)      echo "dlsym needs a leading underscore" >&4
8202                         val="$define" ;;
8203                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8204                 esac
8205         else
8206                 echo "I can't compile and run the test program." >&4
8207                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8208         fi
8209         ;;
8210 esac
8211                 
8212 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8213
8214 set d_dlsymun
8215 eval $setvar
8216
8217 hasproto='varname=$1; func=$2; shift; shift;
8218 while $test $# -ge 2; do
8219         case "$1" in
8220         $define) echo "#include <$2>";;
8221         esac ;
8222     shift 2;
8223 done > try.c;
8224 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8225 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8226         echo "$func() prototype found.";
8227         val="$define";
8228 else
8229         echo "$func() prototype NOT found.";
8230         val="$undef";
8231 fi;
8232 set $varname;
8233 eval $setvar;
8234 $rm -f try.c tryout.c'
8235
8236 : see if prototype for drand48 is available
8237 echo " "
8238 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8239 eval $hasproto
8240
8241 : see if dup2 exists
8242 set dup2 d_dup2
8243 eval $inlibc
8244
8245 : see if eaccess exists
8246 set eaccess d_eaccess
8247 eval $inlibc
8248
8249 : see if endgrent exists
8250 set endgrent d_endgrent
8251 eval $inlibc
8252
8253 : see if endhostent exists
8254 set endhostent d_endhent
8255 eval $inlibc
8256
8257 : see if endnetent exists
8258 set endnetent d_endnent
8259 eval $inlibc
8260
8261 : see if endprotoent exists
8262 set endprotoent d_endpent
8263 eval $inlibc
8264
8265 : see if endpwent exists
8266 set endpwent d_endpwent
8267 eval $inlibc
8268
8269 : see if endservent exists
8270 set endservent d_endsent
8271 eval $inlibc
8272
8273 : see if endspent exists
8274 set endspent d_endspent
8275 eval $inlibc
8276
8277 : Locate the flags for 'open()'
8278 echo " "
8279 $cat >open3.c <<'EOCP'
8280 #include <sys/types.h>
8281 #ifdef I_FCNTL
8282 #include <fcntl.h>
8283 #endif
8284 #ifdef I_SYS_FILE
8285 #include <sys/file.h>
8286 #endif
8287 int main() {
8288         if(O_RDONLY);
8289 #ifdef O_TRUNC
8290         exit(0);
8291 #else
8292         exit(1);
8293 #endif
8294 }
8295 EOCP
8296 : check sys/file.h first to get FREAD on Sun
8297 if $test `./findhdr sys/file.h` && \
8298                 set open3 -DI_SYS_FILE && eval $compile; then
8299         h_sysfile=true;
8300         echo "<sys/file.h> defines the O_* constants..." >&4
8301         if ./open3; then
8302                 echo "and you have the 3 argument form of open()." >&4
8303                 val="$define"
8304         else
8305                 echo "but not the 3 argument form of open().  Oh, well." >&4
8306                 val="$undef"
8307         fi
8308 elif $test `./findhdr fcntl.h` && \
8309                 set open3 -DI_FCNTL && eval $compile; then
8310         h_fcntl=true;
8311         echo "<fcntl.h> defines the O_* constants..." >&4
8312         if ./open3; then
8313                 echo "and you have the 3 argument form of open()." >&4
8314                 val="$define"
8315         else
8316                 echo "but not the 3 argument form of open().  Oh, well." >&4
8317                 val="$undef"
8318         fi
8319 else
8320         val="$undef"
8321         echo "I can't find the O_* constant definitions!  You got problems." >&4
8322 fi
8323 set d_open3
8324 eval $setvar
8325 $rm -f open3*
8326
8327 : see which of string.h or strings.h is needed
8328 echo " "
8329 strings=`./findhdr string.h`
8330 if $test "$strings" && $test -r "$strings"; then
8331         echo "Using <string.h> instead of <strings.h>." >&4
8332         val="$define"
8333 else
8334         val="$undef"
8335         strings=`./findhdr strings.h`
8336         if $test "$strings" && $test -r "$strings"; then
8337                 echo "Using <strings.h> instead of <string.h>." >&4
8338         else
8339                 echo "No string header found -- You'll surely have problems." >&4
8340         fi
8341 fi
8342 set i_string
8343 eval $setvar
8344 case "$i_string" in
8345 "$undef") strings=`./findhdr strings.h`;;
8346 *)        strings=`./findhdr string.h`;;
8347 esac
8348
8349 : check for non-blocking I/O stuff
8350 case "$h_sysfile" in
8351 true) echo "#include <sys/file.h>" > head.c;;
8352 *)
8353         case "$h_fcntl" in
8354         true) echo "#include <fcntl.h>" > head.c;;
8355         *) echo "#include <sys/fcntl.h>" > head.c;;
8356         esac
8357         ;;
8358 esac
8359 echo " "
8360 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8361 case "$o_nonblock" in
8362 '')
8363         $cat head.c > try.c
8364         $cat >>try.c <<'EOCP'
8365 #include <stdio.h>
8366 int main() {
8367 #ifdef O_NONBLOCK
8368         printf("O_NONBLOCK\n");
8369         exit(0);
8370 #endif
8371 #ifdef O_NDELAY
8372         printf("O_NDELAY\n");
8373         exit(0);
8374 #endif
8375 #ifdef FNDELAY
8376         printf("FNDELAY\n");
8377         exit(0);
8378 #endif
8379         exit(0);
8380 }
8381 EOCP
8382         set try
8383         if eval $compile_ok; then
8384                 o_nonblock=`./try`
8385                 case "$o_nonblock" in
8386                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8387                 *) echo "Seems like we can use $o_nonblock.";;
8388                 esac
8389         else
8390                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8391         fi
8392         ;;
8393 *) echo "Using $hint value $o_nonblock.";;
8394 esac
8395 $rm -f try try.* .out core
8396
8397 echo " "
8398 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8399 case "$eagain" in
8400 '')
8401         $cat head.c > try.c
8402         $cat >>try.c <<EOCP
8403 #include <errno.h>
8404 #include <sys/types.h>
8405 #include <signal.h>
8406 #include <stdio.h> 
8407 #define MY_O_NONBLOCK $o_nonblock
8408 #ifndef errno  /* XXX need better Configure test */
8409 extern int errno;
8410 #endif
8411 #$i_unistd I_UNISTD
8412 #ifdef I_UNISTD
8413 #include <unistd.h>
8414 #endif
8415 #ifdef $i_string
8416 #include <string.h>
8417 #else
8418 #include <strings.h>
8419 #endif
8420 $signal_t blech(x) int x; { exit(3); }
8421 EOCP
8422         $cat >> try.c <<'EOCP'
8423 int main()
8424 {
8425         int pd[2];
8426         int pu[2];
8427         char buf[1];
8428         char string[100];
8429
8430         pipe(pd);       /* Down: child -> parent */
8431         pipe(pu);       /* Up: parent -> child */
8432         if (0 != fork()) {
8433                 int ret;
8434                 close(pd[1]);   /* Parent reads from pd[0] */
8435                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8436                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8437                         exit(1);
8438                 signal(SIGALRM, blech);
8439                 alarm(5);
8440                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8441                         exit(2);
8442                 sprintf(string, "%d\n", ret);
8443                 write(2, string, strlen(string));
8444                 alarm(0);
8445 #ifdef EAGAIN
8446                 if (errno == EAGAIN) {
8447                         printf("EAGAIN\n");
8448                         goto ok;
8449                 }
8450 #endif
8451 #ifdef EWOULDBLOCK
8452                 if (errno == EWOULDBLOCK)
8453                         printf("EWOULDBLOCK\n");
8454 #endif
8455         ok:
8456                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8457                 sleep(2);                               /* Give it time to close our pipe */
8458                 alarm(5);
8459                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8460                 alarm(0);
8461                 sprintf(string, "%d\n", ret);
8462                 write(3, string, strlen(string));
8463                 exit(0);
8464         }
8465
8466         close(pd[0]);                   /* We write to pd[1] */
8467         close(pu[1]);                   /* We read from pu[0] */
8468         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8469         close(pd[1]);                   /* Pipe pd is now fully closed! */
8470         exit(0);                                /* Bye bye, thank you for playing! */
8471 }
8472 EOCP
8473         set try
8474         if eval $compile_ok; then
8475                 echo "$startsh" >mtry
8476                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8477                 chmod +x mtry
8478                 ./mtry >/dev/null 2>&1
8479                 case $? in
8480                 0) eagain=`$cat try.out`;;
8481                 1) echo "Could not perform non-blocking setting!";;
8482                 2) echo "I did a successful read() for something that was not there!";;
8483                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8484                 *) echo "Something terribly wrong happened during testing.";;
8485                 esac
8486                 rd_nodata=`$cat try.ret`
8487                 echo "A read() system call with no data present returns $rd_nodata."
8488                 case "$rd_nodata" in
8489                 0|-1) ;;
8490                 *)
8491                         echo "(That's peculiar, fixing that to be -1.)"
8492                         rd_nodata=-1
8493                         ;;
8494                 esac
8495                 case "$eagain" in
8496                 '')
8497                         echo "Forcing errno EAGAIN on read() with no data available."
8498                         eagain=EAGAIN
8499                         ;;
8500                 *)
8501                         echo "Your read() sets errno to $eagain when no data is available."
8502                         ;;
8503                 esac
8504                 status=`$cat try.err`
8505                 case "$status" in
8506                 0) echo "And it correctly returns 0 to signal EOF.";;
8507                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8508                 *) echo "However, your read() returns '$status' on EOF??";;
8509                 esac
8510                 val="$define"
8511                 if test "$status" = "$rd_nodata"; then
8512                         echo "WARNING: you can't distinguish between EOF and no data!"
8513                         val="$undef"
8514                 fi
8515         else
8516                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8517                 eagain=EAGAIN
8518         fi
8519         set d_eofnblk
8520         eval $setvar
8521         ;;
8522 *)
8523         echo "Using $hint value $eagain."
8524         echo "Your read() returns $rd_nodata when no data is present."
8525         case "$d_eofnblk" in
8526         "$define") echo "And you can see EOF because read() returns 0.";;
8527         "$undef") echo "But you can't see EOF status from read() returned value.";;
8528         *)
8529                 echo "(Assuming you can't see EOF status from read anyway.)"
8530                 d_eofnblk=$undef
8531                 ;;
8532         esac
8533         ;;
8534 esac
8535 $rm -f try try.* .out core head.c mtry
8536
8537 : see if fchmod exists
8538 set fchmod d_fchmod
8539 eval $inlibc
8540
8541 : see if fchown exists
8542 set fchown d_fchown
8543 eval $inlibc
8544
8545 : see if this is an fcntl system
8546 set fcntl d_fcntl
8547 eval $inlibc
8548
8549 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8550 while $test $# -ge 2; do
8551         case "$1" in
8552         $define) echo "#include <$2>";;
8553         esac ;
8554     shift 2;
8555 done > try.c;
8556 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8557 set try;
8558 if eval $compile; then
8559         val="$define";
8560 else
8561         val="$undef";
8562 fi;
8563 set $varname;
8564 eval $setvar;
8565 $rm -f try.c try.o'
8566
8567 socketlib=''
8568 sockethdr=''
8569 : see whether socket exists
8570 echo " "
8571 $echo $n "Hmm... $c" >&4
8572 if set socket val -f d_socket; eval $csym; $val; then
8573         echo "Looks like you have Berkeley networking support." >&4
8574         d_socket="$define"
8575         if set setsockopt val -f; eval $csym; $val; then
8576                 d_oldsock="$undef"
8577         else
8578                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8579                 d_oldsock="$define"
8580         fi
8581 else
8582         if $contains socklib libc.list >/dev/null 2>&1; then
8583                 echo "Looks like you have Berkeley networking support." >&4
8584                 d_socket="$define"
8585                 : we will have to assume that it supports the 4.2 BSD interface
8586                 d_oldsock="$undef"
8587         else
8588                 echo "You don't have Berkeley networking in libc$_a..." >&4
8589                 if test "X$d_socket" = "X$define"; then
8590                    echo "...but you seem to believe that you have sockets." >&4
8591                 else
8592                         for net in net socket
8593                         do
8594                                 if test -f /usr/lib/lib$net$_a; then
8595                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8596                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8597                                         if $contains socket libc.list >/dev/null 2>&1; then
8598                                                 d_socket="$define"
8599                                                 socketlib="-l$net"
8600                                                 case "$net" in
8601                                                 net)
8602                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8603                                                         sockethdr="-I/usr/netinclude"
8604                                                         ;;
8605                                                 esac
8606                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8607                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8608                                                         d_oldsock="$undef"
8609                                                 else
8610                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8611                                                         d_oldsock="$define"
8612                                                 fi
8613                                                 break
8614                                         fi
8615                                 fi
8616                         done
8617                         if test "X$d_socket" != "X$define"; then
8618                            echo "or anywhere else I see." >&4
8619                            d_socket="$undef"
8620                            d_oldsock="$undef"
8621                         fi
8622                 fi
8623         fi
8624 fi
8625
8626 : see if socketpair exists
8627 set socketpair d_sockpair
8628 eval $inlibc
8629
8630
8631 echo " "
8632 echo "Checking the availability of certain socket constants..." >& 4
8633 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8634         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8635         $cat >try.c <<EOF
8636 #include <sys/types.h>
8637 #include <sys/socket.h>
8638 int main() {
8639     int i = $ENUM;
8640 }
8641 EOF
8642         val="$undef"
8643         set try; if eval $compile; then
8644                 val="$define"
8645         fi
8646         set d_${enum}; eval $setvar
8647         $rm -f try.c try
8648 done
8649
8650 : see if sys/select.h has to be included
8651 set sys/select.h i_sysselct
8652 eval $inhdr
8653
8654 : see if we should include time.h, sys/time.h, or both
8655 echo " "
8656 if test "X$timeincl" = X; then
8657         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8658         $echo $n "I'm now running the test program...$c"
8659         $cat >try.c <<'EOCP'
8660 #include <sys/types.h>
8661 #ifdef I_TIME
8662 #include <time.h>
8663 #endif
8664 #ifdef I_SYSTIME
8665 #ifdef SYSTIMEKERNEL
8666 #define KERNEL
8667 #endif
8668 #include <sys/time.h>
8669 #endif
8670 #ifdef I_SYSSELECT
8671 #include <sys/select.h>
8672 #endif
8673 int main()
8674 {
8675         struct tm foo;
8676 #ifdef S_TIMEVAL
8677         struct timeval bar;
8678 #endif
8679 #ifdef S_TIMEZONE
8680         struct timezone tzp;
8681 #endif
8682         if (foo.tm_sec == foo.tm_sec)
8683                 exit(0);
8684 #ifdef S_TIMEVAL
8685         if (bar.tv_sec == bar.tv_sec)
8686                 exit(0);
8687 #endif
8688         exit(1);
8689 }
8690 EOCP
8691         flags=''
8692         for s_timezone in '-DS_TIMEZONE' ''; do
8693         sysselect=''
8694         for s_timeval in '-DS_TIMEVAL' ''; do
8695         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8696         for i_time in '' '-DI_TIME'; do
8697         for i_systime in '-DI_SYSTIME' ''; do
8698                 case "$flags" in
8699                 '') $echo $n ".$c"
8700                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8701                         if eval $compile; then
8702                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8703                                 shift
8704                                 flags="$*"
8705                                 echo " "
8706                                 $echo $n "Succeeded with $flags$c"
8707                         fi
8708                         ;;
8709                 esac
8710         done
8711         done
8712         done
8713         done
8714         done
8715         timeincl=''
8716         echo " "
8717         case "$flags" in
8718         *SYSTIMEKERNEL*) i_systimek="$define"
8719                 timeincl=`./findhdr sys/time.h`
8720                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8721         *) i_systimek="$undef";;
8722         esac
8723         case "$flags" in
8724         *I_TIME*) i_time="$define"
8725                 timeincl=`./findhdr time.h`" $timeincl"
8726                 echo "We'll include <time.h>." >&4;;
8727         *) i_time="$undef";;
8728         esac
8729         case "$flags" in
8730         *I_SYSTIME*) i_systime="$define"
8731                 timeincl=`./findhdr sys/time.h`" $timeincl"
8732                 echo "We'll include <sys/time.h>." >&4;;
8733         *) i_systime="$undef";;
8734         esac
8735         $rm -f try.c try
8736 fi
8737
8738 : check for fd_set items
8739 $cat <<EOM
8740
8741 Checking to see how well your C compiler handles fd_set and friends ...
8742 EOM
8743 $cat >fd_set.c <<EOCP
8744 #$i_systime I_SYS_TIME
8745 #$i_sysselct I_SYS_SELECT
8746 #$d_socket HAS_SOCKET
8747 #include <sys/types.h>
8748 #ifdef HAS_SOCKET
8749 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8750 #endif
8751 #ifdef I_SYS_TIME
8752 #include <sys/time.h>
8753 #endif
8754 #ifdef I_SYS_SELECT
8755 #include <sys/select.h>
8756 #endif
8757 int main() {
8758         fd_set fds;
8759
8760 #ifdef TRYBITS
8761         if(fds.fds_bits);
8762 #endif
8763
8764 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8765         exit(0);
8766 #else
8767         exit(1);
8768 #endif
8769 }
8770 EOCP
8771 set fd_set -DTRYBITS
8772 if eval $compile; then
8773         d_fds_bits="$define"
8774         d_fd_set="$define"
8775         echo "Well, your system knows about the normal fd_set typedef..." >&4
8776         if ./fd_set; then
8777                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8778                 d_fd_macros="$define"
8779         else
8780                 $cat >&4 <<'EOM'
8781 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8782 EOM
8783                 d_fd_macros="$undef"
8784         fi
8785 else
8786         $cat <<'EOM'
8787 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8788 EOM
8789         set fd_set
8790         if eval $compile; then
8791                 d_fds_bits="$undef"
8792                 d_fd_set="$define"
8793                 echo "Well, your system has some sort of fd_set available..." >&4
8794                 if ./fd_set; then
8795                         echo "and you have the normal fd_set macros." >&4
8796                         d_fd_macros="$define"
8797                 else
8798                         $cat <<'EOM'
8799 but not the normal fd_set macros!  Gross!  More work for me...
8800 EOM
8801                         d_fd_macros="$undef"
8802                 fi
8803         else
8804         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8805                 d_fd_set="$undef"
8806                 d_fds_bits="$undef"
8807                 d_fd_macros="$undef"
8808         fi
8809 fi
8810 $rm -f fd_set*
8811
8812 : see if fgetpos exists
8813 set fgetpos d_fgetpos
8814 eval $inlibc
8815
8816 : see if flock exists
8817 set flock d_flock
8818 eval $inlibc
8819
8820 : see if fork exists
8821 set fork d_fork
8822 eval $inlibc
8823
8824 : see if pathconf exists
8825 set pathconf d_pathconf
8826 eval $inlibc
8827
8828 : see if fpathconf exists
8829 set fpathconf d_fpathconf
8830 eval $inlibc
8831
8832
8833 : check for off64_t
8834 echo " "
8835 echo "Checking to see if your system supports off64_t..." >&4
8836 $cat >try.c <<EOCP
8837 #include <sys/types.h>
8838 #include <unistd.h>
8839 int main() { off64_t x = 7; }'
8840 EOCP
8841 set try
8842 if eval $compile; then
8843         val="$define"
8844         echo "Yes, it does."
8845 else
8846         val="$undef"
8847         echo "No, it doesn't."
8848         case "$lseeksize" in
8849         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8850         esac
8851 fi
8852 $rm -f try.* try
8853 set d_off64_t
8854 eval $setvar
8855
8856 : check for fpos64_t
8857 echo " "
8858 echo "Checking to see if your system supports fpos64_t..." >&4
8859 $cat >try.c <<EOCP
8860 #include <sys/stdio.h>
8861 int main() { fpos64_t x x = 7; }'
8862 EOCP
8863 set try
8864 if eval $compile; then
8865         val="$define"
8866         echo "Yes, it does."
8867 else
8868         val="$undef"
8869         echo "No, it doesn't."
8870         case "$fpossize" in
8871         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8872         esac
8873 fi
8874 $rm -f try.* try
8875 set d_fpos64_t
8876 eval $setvar
8877
8878 hasstruct='varname=$1; struct=$2; shift; shift;
8879 while $test $# -ge 2; do
8880         case "$1" in
8881         $define) echo "#include <$2>";;
8882         esac ;
8883     shift 2;
8884 done > try.c;
8885 echo "int main () { struct $struct foo; }" >> try.c;
8886 set try;
8887 if eval $compile; then
8888         val="$define";
8889 else
8890         val="$undef";
8891 fi;
8892 set $varname;
8893 eval $setvar;
8894 $rm -f try.c try.o'
8895
8896 : see if this is a sys/param system
8897 set sys/param.h i_sysparam
8898 eval $inhdr
8899
8900 : see if this is a sys/mount.h system
8901 set sys/mount.h i_sysmount
8902 eval $inhdr
8903
8904 : see if sys/types.h has to be included
8905 set sys/types.h i_systypes
8906 eval $inhdr
8907
8908
8909 echo " "
8910 echo "Checking to see if your system supports struct fs_data..." >&4
8911 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8912 eval $hasstruct
8913 case "$d_fs_data_s" in
8914 "$define")      echo "Yes, it does."   ;;
8915 *)              echo "No, it doesn't." ;;
8916 esac
8917
8918 : see if fseeko exists
8919 set fseeko d_fseeko
8920 eval $inlibc
8921 case "$longsize" in
8922 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8923 esac
8924
8925 : see if fsetpos exists
8926 set fsetpos d_fsetpos
8927 eval $inlibc
8928
8929
8930 : see if fstatfs exists
8931 set fstatfs d_fstatfs
8932 eval $inlibc
8933
8934
8935 : see if statvfs exists
8936 set statvfs d_statvfs
8937 eval $inlibc
8938
8939 : see if fstatvfs exists
8940 set fstatvfs d_fstatvfs
8941 eval $inlibc
8942
8943
8944 : see if ftello exists
8945 set ftello d_ftello
8946 eval $inlibc
8947 case "$longsize" in
8948 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8949 esac
8950
8951 : see if getgrent exists
8952 set getgrent d_getgrent
8953 eval $inlibc
8954
8955 : see if gethostbyaddr exists
8956 set gethostbyaddr d_gethbyaddr
8957 eval $inlibc
8958
8959 : see if gethostbyname exists
8960 set gethostbyname d_gethbyname
8961 eval $inlibc
8962
8963 : see if gethostent exists
8964 set gethostent d_gethent
8965 eval $inlibc
8966
8967 : see how we will look up host name
8968 echo " "
8969 call=''
8970 if set gethostname val -f d_gethname; eval $csym; $val; then
8971         echo 'gethostname() found.' >&4
8972         d_gethname="$define"
8973         call=gethostname
8974 fi
8975 if set uname val -f d_uname; eval $csym; $val; then
8976         if ./xenix; then
8977                 $cat <<'EOM'
8978 uname() was found, but you're running xenix, and older versions of xenix
8979 have a broken uname(). If you don't really know whether your xenix is old
8980 enough to have a broken system call, use the default answer.
8981
8982 EOM
8983                 dflt=y
8984                 case "$d_uname" in
8985                 "$define") dflt=n;;
8986                 esac
8987                 rp='Is your uname() broken?'
8988                 . ./myread
8989                 case "$ans" in
8990                 n*) d_uname="$define"; call=uname;;
8991                 esac
8992         else
8993                 echo 'uname() found.' >&4
8994                 d_uname="$define"
8995                 case "$call" in
8996                 '') call=uname ;;
8997                 esac
8998         fi
8999 fi
9000 case "$d_gethname" in
9001 '') d_gethname="$undef";;
9002 esac
9003 case "$d_uname" in
9004 '') d_uname="$undef";;
9005 esac
9006 case "$d_uname$d_gethname" in
9007 *define*)
9008         dflt=n
9009         cat <<EOM
9010  
9011 Every now and then someone has a $call() that lies about the hostname
9012 but can't be fixed for political or economic reasons.  If you wish, I can
9013 pretend $call() isn't there and maybe compute hostname at run-time
9014 thanks to the '$phostname' command.
9015
9016 EOM
9017         rp="Shall I ignore $call() from now on?"
9018         . ./myread
9019         case "$ans" in
9020         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9021         esac;;
9022 esac
9023 case "$phostname" in
9024 '') aphostname='';;
9025 *) case "$aphostname" in
9026         /*) ;;
9027         *) set X $phostname
9028                 shift
9029                 file=$1
9030                 shift
9031                 file=`./loc $file $file $pth`
9032                 aphostname=`echo $file $*`
9033                 ;;
9034         esac
9035         ;;
9036 esac
9037 case "$d_uname$d_gethname" in
9038 *define*) ;;
9039 *)
9040         case "$phostname" in
9041         '')
9042                 echo "There will be no way for $package to get your hostname." >&4;;
9043         *)
9044         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9045                 ;;
9046         esac;;
9047 esac
9048 case "$d_phostname" in
9049 '') d_phostname="$undef";;
9050 esac
9051
9052 : see if this is a netdb.h system
9053 set netdb.h i_netdb
9054 eval $inhdr
9055
9056 : see if prototypes for various gethostxxx netdb.h functions are available
9057 echo " "
9058 set d_gethostprotos gethostent $i_netdb netdb.h
9059 eval $hasproto
9060
9061 : see if getlogin exists
9062 set getlogin d_getlogin
9063 eval $inlibc
9064
9065 : see if getmnt exists
9066 set getmnt d_getmnt
9067 eval $inlibc
9068
9069 : see if getmntent exists
9070 set getmntent d_getmntent
9071 eval $inlibc
9072
9073 : see if getnetbyaddr exists
9074 set getnetbyaddr d_getnbyaddr
9075 eval $inlibc
9076
9077 : see if getnetbyname exists
9078 set getnetbyname d_getnbyname
9079 eval $inlibc
9080
9081 : see if getnetent exists
9082 set getnetent d_getnent
9083 eval $inlibc
9084
9085 : see if prototypes for various getnetxxx netdb.h functions are available
9086 echo " "
9087 set d_getnetprotos getnetent $i_netdb netdb.h
9088 eval $hasproto
9089
9090
9091 : see if getprotobyname exists
9092 set getprotobyname d_getpbyname
9093 eval $inlibc
9094
9095 : see if getprotobynumber exists
9096 set getprotobynumber d_getpbynumber
9097 eval $inlibc
9098
9099 : see if getprotoent exists
9100 set getprotoent d_getpent
9101 eval $inlibc
9102
9103 : see if getpgid exists
9104 set getpgid d_getpgid
9105 eval $inlibc
9106
9107 : see if getpgrp2 exists
9108 set getpgrp2 d_getpgrp2
9109 eval $inlibc
9110
9111 : see if getppid exists
9112 set getppid d_getppid
9113 eval $inlibc
9114
9115 : see if getpriority exists
9116 set getpriority d_getprior
9117 eval $inlibc
9118
9119 : see if prototypes for various getprotoxxx netdb.h functions are available
9120 echo " "
9121 set d_getprotoprotos getprotoent $i_netdb netdb.h
9122 eval $hasproto
9123
9124 : see if getpwent exists
9125 set getpwent d_getpwent
9126 eval $inlibc
9127
9128
9129 : see if getservbyname exists
9130 set getservbyname d_getsbyname
9131 eval $inlibc
9132
9133 : see if getservbyport exists
9134 set getservbyport d_getsbyport
9135 eval $inlibc
9136
9137 : see if getservent exists
9138 set getservent d_getsent
9139 eval $inlibc
9140
9141 : see if prototypes for various getservxxx netdb.h functions are available
9142 echo " "
9143 set d_getservprotos getservent $i_netdb netdb.h
9144 eval $hasproto
9145
9146 : see if getspent exists
9147 set getspent d_getspent
9148 eval $inlibc
9149
9150 : see if getspnam exists
9151 set getspnam d_getspnam
9152 eval $inlibc
9153
9154 : see if gettimeofday or ftime exists
9155 set gettimeofday d_gettimeod
9156 eval $inlibc
9157 case "$d_gettimeod" in
9158 "$undef")
9159         set ftime d_ftime 
9160         eval $inlibc
9161         ;;
9162 *)
9163         val="$undef"; set d_ftime; eval $setvar
9164         ;;
9165 esac
9166 case "$d_gettimeod$d_ftime" in
9167 "$undef$undef")
9168         echo " "
9169         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9170         ;;
9171 esac
9172
9173 : see if this is an grp system
9174 set grp.h i_grp
9175 eval $inhdr
9176
9177 case "$i_grp" in
9178 $define)
9179         xxx=`./findhdr grp.h`
9180         $cppstdin $cppflags $cppminus < $xxx >$$.h
9181
9182         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9183                 val="$define"
9184         else
9185                 val="$undef"
9186         fi
9187         set d_grpasswd
9188         eval $setvar
9189
9190         $rm -f $$.h
9191         ;;
9192 *)
9193         val="$undef";
9194         set d_grpasswd; eval $setvar
9195         ;;
9196 esac
9197
9198 : see if hasmntopt exists
9199 set hasmntopt d_hasmntopt
9200 eval $inlibc
9201
9202 : see if this is a netinet/in.h or sys/in.h system
9203 set netinet/in.h i_niin sys/in.h i_sysin
9204 eval $inhdr
9205
9206 : see if arpa/inet.h has to be included
9207 set arpa/inet.h i_arpainet
9208 eval $inhdr
9209
9210 : see if htonl --and friends-- exists
9211 val=''
9212 set htonl val
9213 eval $inlibc
9214
9215 : Maybe they are macros.
9216 case "$val" in
9217 $undef)
9218         $cat >htonl.c <<EOM
9219 #include <stdio.h>
9220 #include <sys/types.h>
9221 #$i_niin I_NETINET_IN
9222 #$i_sysin I_SYS_IN
9223 #$i_arpainet I_ARPA_INET
9224 #ifdef I_NETINET_IN
9225 #include <netinet/in.h>
9226 #endif
9227 #ifdef I_SYS_IN
9228 #include <sys/in.h>
9229 #endif
9230 #ifdef I_ARPA_INET
9231 #include <arpa/inet.h>
9232 #endif
9233 #ifdef htonl
9234 printf("Defined as a macro.");
9235 #endif
9236 EOM
9237         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9238         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9239                 val="$define"
9240                 echo "But it seems to be defined as a macro." >&4
9241         fi
9242         $rm -f htonl.?
9243         ;;
9244 esac
9245 set d_htonl
9246 eval $setvar
9247
9248 : index or strchr
9249 echo " "
9250 if set index val -f; eval $csym; $val; then
9251         if set strchr val -f d_strchr; eval $csym; $val; then
9252                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9253                         val="$define"
9254                         vali="$undef"
9255                         echo "strchr() found." >&4
9256                 else
9257                         val="$undef"
9258                         vali="$define"
9259                         echo "index() found." >&4
9260                 fi
9261         else
9262                 val="$undef"
9263                 vali="$define"
9264                 echo "index() found." >&4
9265         fi
9266 else
9267         if set strchr val -f d_strchr; eval $csym; $val; then
9268                 val="$define"
9269                 vali="$undef"
9270                 echo "strchr() found." >&4
9271         else
9272                 echo "No index() or strchr() found!" >&4
9273                 val="$undef"
9274                 vali="$undef"
9275         fi
9276 fi
9277 set d_strchr; eval $setvar
9278 val="$vali"
9279 set d_index; eval $setvar
9280
9281 : check whether inet_aton exists
9282 set inet_aton d_inetaton
9283 eval $inlibc
9284
9285 : Look for isascii
9286 echo " "
9287 $cat >isascii.c <<'EOCP'
9288 #include <stdio.h>
9289 #include <ctype.h>
9290 int main() {
9291         int c = 'A';
9292         if (isascii(c))
9293                 exit(0);
9294         else
9295                 exit(1);
9296 }
9297 EOCP
9298 set isascii
9299 if eval $compile; then
9300         echo "isascii() found." >&4
9301         val="$define"
9302 else
9303         echo "isascii() NOT found." >&4
9304         val="$undef"
9305 fi
9306 set d_isascii
9307 eval $setvar
9308 $rm -f isascii*
9309
9310 : see if killpg exists
9311 set killpg d_killpg
9312 eval $inlibc
9313
9314 : see if lchown exists
9315 echo " "
9316 $cat > try.c <<'EOCP'
9317 /* System header to define __stub macros and hopefully few prototypes,
9318     which can conflict with char lchown(); below.  */
9319 #include <assert.h>
9320 /* Override any gcc2 internal prototype to avoid an error.  */
9321 /* We use char because int might match the return type of a gcc2
9322    builtin and then its argument prototype would still apply.  */
9323 char lchown();
9324 int main() {
9325     /*  The GNU C library defines this for functions which it implements
9326         to always fail with ENOSYS.  Some functions are actually named
9327         something starting with __ and the normal name is an alias.  */
9328 #if defined (__stub_lchown) || defined (__stub___lchown)
9329 choke me
9330 #else
9331 lchown();
9332 #endif
9333 ; return 0; }
9334 EOCP
9335 set try
9336 if eval $compile; then
9337     $echo "lchown() found." >&4
9338     val="$define"
9339 else
9340     $echo "lchown() NOT found." >&4
9341     val="$undef"
9342 fi
9343 set d_lchown
9344 eval $setvar
9345
9346 : See if number of significant digits in a double precision number is known
9347 echo " "
9348 $cat >ldbl_dig.c <<EOM
9349 #$i_limits I_LIMITS
9350 #$i_float I_FLOAT
9351 #ifdef I_LIMITS
9352 #include <limits.h>
9353 #endif
9354 #ifdef I_FLOAT
9355 #include <float.h>
9356 #endif
9357 #ifdef LDBL_DIG
9358 printf("Contains LDBL_DIG");
9359 #endif
9360 EOM
9361 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9362 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9363         echo "LDBL_DIG found." >&4
9364         val="$define"
9365 else
9366         echo "LDBL_DIG NOT found." >&4
9367         val="$undef"
9368 fi
9369 $rm -f ldbl_dig.?
9370 set d_ldbl_dig
9371 eval $setvar
9372
9373 : see if link exists
9374 set link d_link
9375 eval $inlibc
9376
9377 : see if localeconv exists
9378 set localeconv d_locconv
9379 eval $inlibc
9380
9381 : see if lockf exists
9382 set lockf d_lockf
9383 eval $inlibc
9384
9385 : check for long long
9386 echo " "
9387 $echo $n "Checking to see if your system supports long long..." $c >&4
9388 echo 'int main() { long long x = 7; return 0; }' > try.c
9389 set try
9390 if eval $compile; then
9391         val="$define"
9392         echo " Yes, it does." >&4
9393 else
9394         val="$undef"
9395         echo " No, it doesn't." >&4
9396 fi
9397 $rm try.*
9398 set d_longlong
9399 eval $setvar
9400
9401 : check for length of long long
9402 case "${d_longlong}${longlongsize}" in
9403 $define)
9404         echo " "
9405         $echo $n "Checking to see how big your long longs are..." $c >&4
9406         $cat >try.c <<'EOCP'
9407 #include <stdio.h>
9408 int main()
9409 {
9410     printf("%d\n", (int)sizeof(long long));
9411     return(0);
9412 }
9413 EOCP
9414         set try
9415         if eval $compile_ok; then
9416                 longlongsize=`./try$exe_ext`
9417                 $echo " $longlongsize bytes." >&4
9418         else
9419                 dflt='8'
9420                 echo " "
9421                 echo "(I can't seem to compile the test program.  Guessing...)"
9422                 rp="What is the size of a long long (in bytes)?"
9423                 . ./myread
9424                 longlongsize="$ans"
9425         fi
9426         if $test "X$longsize" = "X$longlongsize"; then
9427                 echo "(That isn't any different from an ordinary long.)"
9428         fi      
9429         ;;
9430 esac
9431 $rm -f try.* try
9432
9433 : see if lstat exists
9434 set lstat d_lstat
9435 eval $inlibc
9436
9437 : see if mblen exists
9438 set mblen d_mblen
9439 eval $inlibc
9440
9441 : see if mbstowcs exists
9442 set mbstowcs d_mbstowcs
9443 eval $inlibc
9444
9445 : see if mbtowc exists
9446 set mbtowc d_mbtowc
9447 eval $inlibc
9448
9449 : see if memchr exists
9450 set memchr d_memchr
9451 eval $inlibc
9452
9453 : see if memcmp exists
9454 set memcmp d_memcmp
9455 eval $inlibc
9456
9457 : see if memcpy exists
9458 set memcpy d_memcpy
9459 eval $inlibc
9460
9461 : see if memmove exists
9462 set memmove d_memmove
9463 eval $inlibc
9464
9465 : see if memset exists
9466 set memset d_memset
9467 eval $inlibc
9468
9469 : see if mkdir exists
9470 set mkdir d_mkdir
9471 eval $inlibc
9472
9473 : see if mkfifo exists
9474 set mkfifo d_mkfifo
9475 eval $inlibc
9476
9477 : see if mktime exists
9478 set mktime d_mktime
9479 eval $inlibc
9480
9481 : see if msgctl exists
9482 set msgctl d_msgctl
9483 eval $inlibc
9484
9485 : see if msgget exists
9486 set msgget d_msgget
9487 eval $inlibc
9488
9489 : see if msgsnd exists
9490 set msgsnd d_msgsnd
9491 eval $inlibc
9492
9493 : see if msgrcv exists
9494 set msgrcv d_msgrcv
9495 eval $inlibc
9496
9497 : see how much of the 'msg*(2)' library is present.
9498 h_msg=true
9499 echo " "
9500 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9501 *"$undef"*) h_msg=false;;
9502 esac
9503 case "$osname" in
9504 freebsd)
9505     case "`ipcs 2>&1`" in
9506     "SVID messages"*"not configured"*)
9507         echo "Your $osname does not have the msg*(2) configured." >&4
9508         h_msg=false
9509         val="$undef"
9510         set msgctl d_msgctl
9511         eval $setvar
9512         set msgget d_msgget
9513         eval $setvar
9514         set msgsnd d_msgsnd
9515         eval $setvar
9516         set msgrcv d_msgrcv
9517         eval $setvar
9518         ;;
9519     esac
9520     ;;
9521 esac
9522 : we could also check for sys/ipc.h ...
9523 if $h_msg && $test `./findhdr sys/msg.h`; then
9524         echo "You have the full msg*(2) library." >&4
9525         val="$define"
9526 else
9527         echo "You don't have the full msg*(2) library." >&4
9528         val="$undef"
9529 fi
9530 set d_msg
9531 eval $setvar
9532
9533 : see if nice exists
9534 set nice d_nice
9535 eval $inlibc
9536
9537 : see if POSIX threads are available
9538 set pthread.h i_pthread
9539 eval $inhdr
9540
9541
9542
9543
9544 : how to create joinable pthreads
9545 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9546         echo " "
9547         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9548         $cat >try.c <<'EOCP'
9549 #include <pthread.h>
9550 int main() {
9551     int detachstate = JOINABLE;
9552 }
9553 EOCP
9554         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9555         if eval $compile; then
9556                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9557                 val="$undef" # Yes, undef.
9558                 set d_old_pthread_create_joinable
9559                 eval $setvar
9560                 val=""
9561                 set old_pthread_create_joinable
9562                 eval $setvar
9563         else
9564                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9565                 if eval $compile; then
9566                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9567                         val="$define"
9568                         set d_old_pthread_create_joinable
9569                         eval $setvar
9570                         val=PTHREAD_CREATE_UNDETACHED
9571                         set old_pthread_create_joinable
9572                         eval $setvar
9573                 else            
9574                         set try -DJOINABLE=__UNDETACHED
9575                         if eval $compile; then
9576                                 echo "You seem to use __UNDETACHED." >&4
9577                                 val="$define"
9578                                 set d_old_pthread_create_joinable
9579                                 eval $setvar
9580                                 val=__UNDETACHED
9581                                 set old_pthread_create_joinable
9582                                 eval $setvar
9583                         else
9584                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9585                                 val="$define"
9586                                 set d_old_pthread_create_joinable
9587                                 eval $setvar
9588                                 val=0
9589                                 set old_pthread_create_joinable
9590                                 eval $setvar
9591                         fi
9592                 fi
9593         fi
9594         $rm -f try try.*
9595 else
9596     d_old_pthread_create_joinable="$undef"
9597     old_pthread_create_joinable=""
9598 fi
9599
9600 : see if pause exists
9601 set pause d_pause
9602 eval $inlibc
9603
9604 : see if pipe exists
9605 set pipe d_pipe
9606 eval $inlibc
9607
9608 : see if poll exists
9609 set poll d_poll
9610 eval $inlibc
9611
9612
9613 : see whether the various POSIXish _yields exist
9614 $cat >try.c <<EOP
9615 #include <pthread.h>
9616 #include <stdio.h>
9617 int main() {
9618 #ifdef SCHED_YIELD
9619         sched_yield();
9620 #else
9621 #ifdef PTHREAD_YIELD
9622         pthread_yield();
9623 #else
9624 #ifdef PTHREAD_YIELD_NULL
9625         pthread_yield(NULL);
9626 #endif
9627 #endif
9628 #endif
9629 }
9630 EOP
9631 : see if sched_yield exists
9632 set try -DSCHED_YIELD
9633 if eval $compile; then
9634     val="$define"
9635     sched_yield='sched_yield()'
9636 else
9637     val="$undef"
9638 fi
9639 case "$usethreads" in
9640 $define)
9641         case "$val" in
9642         $define) echo 'sched_yield() found.' >&4        ;;
9643         *)       echo 'sched_yield() NOT found.' >&4    ;;
9644         esac
9645 esac
9646 set d_sched_yield
9647 eval $setvar
9648
9649 : see if pthread_yield exists
9650 set try -DPTHREAD_YIELD
9651 if eval $compile; then
9652     val="$define"
9653     case "$sched_yield" in
9654     '') sched_yield='pthread_yield()' ;;
9655     esac
9656 else
9657     set try -DPTHREAD_YIELD_NULL
9658     if eval $compile; then
9659         val="$define"
9660         case "$sched_yield" in
9661         '') sched_yield='pthread_yield(NULL)' ;;
9662         esac
9663     else
9664         val="$undef"
9665     fi
9666 fi
9667 case "$usethreads" in
9668 $define)
9669         case "$val" in
9670         $define) echo 'pthread_yield() found.' >&4      ;;
9671         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9672         esac
9673         ;;
9674 esac
9675 set d_pthread_yield
9676 eval $setvar
9677
9678 case "$sched_yield" in
9679 '') sched_yield=undef ;;
9680 esac
9681
9682 $rm -f try try.*
9683
9684 : see if this is a pwd.h system
9685 set pwd.h i_pwd
9686 eval $inhdr
9687
9688 case "$i_pwd" in
9689 $define)
9690         xxx=`./findhdr pwd.h`
9691         $cppstdin $cppflags $cppminus < $xxx >$$.h
9692
9693         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9694                 val="$define"
9695         else
9696                 val="$undef"
9697         fi
9698         set d_pwquota
9699         eval $setvar
9700
9701         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9702                 val="$define"
9703         else
9704                 val="$undef"
9705         fi
9706         set d_pwage
9707         eval $setvar
9708
9709         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9710                 val="$define"
9711         else
9712                 val="$undef"
9713         fi
9714         set d_pwchange
9715         eval $setvar
9716
9717         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9718                 val="$define"
9719         else
9720                 val="$undef"
9721         fi
9722         set d_pwclass
9723         eval $setvar
9724
9725         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9726                 val="$define"
9727         else
9728                 val="$undef"
9729         fi
9730         set d_pwexpire
9731         eval $setvar
9732
9733         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9734                 val="$define"
9735         else
9736                 val="$undef"
9737         fi
9738         set d_pwcomment
9739         eval $setvar
9740
9741         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9742                 val="$define"
9743         else
9744                 val="$undef"
9745         fi
9746         set d_pwgecos
9747         eval $setvar
9748
9749         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9750                 val="$define"
9751         else
9752                 val="$undef"
9753         fi
9754         set d_pwpasswd
9755         eval $setvar
9756
9757         $rm -f $$.h
9758         ;;
9759 *)
9760         val="$undef"; 
9761         set d_pwquota; eval $setvar
9762         set d_pwage; eval $setvar
9763         set d_pwchange; eval $setvar
9764         set d_pwclass; eval $setvar
9765         set d_pwexpire; eval $setvar
9766         set d_pwcomment; eval $setvar
9767         set d_pwgecos; eval $setvar
9768         set d_pwpasswd; eval $setvar
9769         ;;
9770 esac
9771
9772 : see if inttypes.h is available
9773 : we want a real compile instead of Inhdr because some systems
9774 : have an inttypes.h which includes non-existent headers
9775 echo " "
9776 $cat >try.c <<EOCP
9777 #include <inttypes.h>
9778 int main() {
9779         static int32_t foo32 = 0x12345678;
9780 }
9781 EOCP
9782 set try
9783 if eval $compile; then
9784         echo "<inttypes.h> found." >&4
9785         val="$define"
9786 else
9787         echo "<inttypes.h> NOT found." >&4
9788         val="$undef"
9789 fi
9790 $rm -f try.c try
9791 set i_inttypes
9792 eval $setvar
9793
9794 : check for int64_t
9795 echo " "
9796 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9797 $cat >try.c <<EOCP
9798 #include <sys/types.h>
9799 #$i_inttypes I_INTTYPES
9800 #ifdef I_INTTYPES
9801 #include <inttypes.h>
9802 #endif
9803 int main() { int64_t x = 7; }
9804 EOCP
9805 set try
9806 if eval $compile; then
9807         val="$define"
9808         echo " Yes, it does." >&4
9809 else
9810         val="$undef"
9811         echo " No, it doesn't." >&4
9812 fi
9813 $rm -f try try.*
9814 set d_int64t
9815 eval $setvar
9816
9817
9818 echo " "
9819 echo "Checking which 64-bit integer type we could use..." >&4
9820
9821 case "$intsize" in
9822 8) val=int
9823    set quadtype
9824    eval $setvar
9825    val='"unsigned int"'
9826    set uquadtype
9827    eval $setvar
9828    quadkind=1
9829    ;;
9830 *) case "$longsize" in
9831    8) val=long
9832       set quadtype
9833       eval $setvar
9834       val='"unsigned long"'
9835       set uquadtype
9836       eval $setvar
9837       quadkind=2
9838       ;;
9839    *) case "$uselonglong:$d_longlong:$longlongsize" in
9840       define:define:8)
9841         val='"long long"'
9842         set quadtype
9843         eval $setvar
9844         val='"unsigned long long"'
9845         set uquadtype
9846         eval $setvar
9847         quadkind=3
9848         ;;
9849       *) case "$d_int64t" in
9850          define)
9851            val=int64_t
9852            set quadtype
9853            eval $setvar
9854            val=uint64_t
9855            set uquadtype
9856            eval $setvar
9857            quadkind=4
9858            ;;
9859          esac
9860          ;;
9861       esac
9862       ;;
9863    esac
9864    ;;
9865 esac
9866
9867 case "$quadtype" in
9868 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9869         undef:define:8)
9870            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9871         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9872         esac
9873         d_quad="$undef"
9874         ;;
9875 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9876             verb="will"
9877         else
9878             verb="could"
9879         fi
9880         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9881         d_quad="$define"
9882         ;;
9883 esac
9884
9885 : see if readdir and friends exist
9886 set readdir d_readdir
9887 eval $inlibc
9888 set seekdir d_seekdir
9889 eval $inlibc
9890 set telldir d_telldir
9891 eval $inlibc
9892 set rewinddir d_rewinddir
9893 eval $inlibc
9894
9895 : see if readlink exists
9896 set readlink d_readlink
9897 eval $inlibc
9898
9899 : see if rename exists
9900 set rename d_rename
9901 eval $inlibc
9902
9903 : see if rmdir exists
9904 set rmdir d_rmdir
9905 eval $inlibc
9906
9907 : see if memory.h is available.
9908 val=''
9909 set memory.h val
9910 eval $inhdr
9911
9912 : See if it conflicts with string.h
9913 case "$val" in
9914 $define)
9915         case "$strings" in
9916         '') ;;
9917         *)
9918                 $cppstdin $cppflags $cppminus < $strings > mem.h
9919                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9920                         echo " "
9921                         echo "We won't be including <memory.h>."
9922                         val="$undef"
9923                 fi
9924                 $rm -f mem.h
9925                 ;;
9926         esac
9927 esac
9928 set i_memory
9929 eval $setvar
9930
9931 : can bcopy handle overlapping blocks?
9932 val="$undef"
9933 case "$d_bcopy" in
9934 "$define")
9935         echo " "
9936         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9937         $cat >try.c <<EOCP
9938 #$i_memory I_MEMORY
9939 #$i_stdlib I_STDLIB
9940 #$i_string I_STRING
9941 #$i_unistd I_UNISTD
9942 EOCP
9943         $cat >>try.c <<'EOCP'
9944 #include <stdio.h>
9945 #ifdef I_MEMORY
9946 #  include <memory.h>
9947 #endif
9948 #ifdef I_STDLIB
9949 #  include <stdlib.h>
9950 #endif
9951 #ifdef I_STRING
9952 #  include <string.h>
9953 #else
9954 #  include <strings.h>
9955 #endif
9956 #ifdef I_UNISTD
9957 #  include <unistd.h>  /* Needed for NetBSD */
9958 #endif
9959 int main()
9960 {
9961 char buf[128], abc[128];
9962 char *b;
9963 int len;
9964 int off;
9965 int align;
9966
9967 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9968
9969 for (align = 7; align >= 0; align--) {
9970         for (len = 36; len; len--) {
9971                 b = buf+align;
9972                 bcopy(abc, b, len);
9973                 for (off = 1; off <= len; off++) {
9974                         bcopy(b, b+off, len);
9975                         bcopy(b+off, b, len);
9976                         if (bcmp(b, abc, len))
9977                                 exit(1);
9978                 }
9979         }
9980 }
9981 exit(0);
9982 }
9983 EOCP
9984         set try
9985         if eval $compile_ok; then
9986                 if ./try 2>/dev/null; then
9987                         echo "Yes, it can."
9988                         val="$define"
9989                 else
9990                         echo "It can't, sorry."
9991                         case "$d_memmove" in
9992                         "$define") echo "But that's Ok since you have memmove()." ;;
9993                         esac
9994                 fi
9995         else
9996                 echo "(I can't compile the test program, so we'll assume not...)"
9997                 case "$d_memmove" in
9998                 "$define") echo "But that's Ok since you have memmove()." ;;
9999                 esac
10000         fi
10001         ;;
10002 esac
10003 $rm -f try.* try core
10004 set d_safebcpy
10005 eval $setvar
10006
10007 : can memcpy handle overlapping blocks?
10008 val="$undef"
10009 case "$d_memcpy" in
10010 "$define")
10011         echo " "
10012         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10013         $cat >try.c <<EOCP
10014 #$i_memory I_MEMORY
10015 #$i_stdlib I_STDLIB
10016 #$i_string I_STRING
10017 #$i_unistd I_UNISTD
10018 EOCP
10019         $cat >>try.c <<'EOCP'
10020 #include <stdio.h>
10021 #ifdef I_MEMORY
10022 #  include <memory.h>
10023 #endif
10024 #ifdef I_STDLIB
10025 #  include <stdlib.h>
10026 #endif
10027 #ifdef I_STRING
10028 #  include <string.h>
10029 #else
10030 #  include <strings.h>
10031 #endif
10032 #ifdef I_UNISTD
10033 #  include <unistd.h>  /* Needed for NetBSD */
10034 #endif
10035 int main()
10036 {
10037 char buf[128], abc[128];
10038 char *b;
10039 int len;
10040 int off;
10041 int align;
10042
10043 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10044    try to store the string in read-only memory. */
10045 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10046
10047 for (align = 7; align >= 0; align--) {
10048         for (len = 36; len; len--) {
10049                 b = buf+align;
10050                 memcpy(b, abc, len);
10051                 for (off = 1; off <= len; off++) {
10052                         memcpy(b+off, b, len);
10053                         memcpy(b, b+off, len);
10054                         if (memcmp(b, abc, len))
10055                                 exit(1);
10056                 }
10057         }
10058 }
10059 exit(0);
10060 }
10061 EOCP
10062         set try
10063         if eval $compile_ok; then
10064                 if ./try 2>/dev/null; then
10065                         echo "Yes, it can."
10066                         val="$define"
10067                 else
10068                         echo "It can't, sorry."
10069                         case "$d_memmove" in
10070                         "$define") echo "But that's Ok since you have memmove()." ;;
10071                         esac
10072                 fi
10073         else
10074                 echo "(I can't compile the test program, so we'll assume not...)"
10075                 case "$d_memmove" in
10076                 "$define") echo "But that's Ok since you have memmove()." ;;
10077                 esac
10078         fi
10079         ;;
10080 esac
10081 $rm -f try.* try core
10082 set d_safemcpy
10083 eval $setvar
10084
10085 : can memcmp be trusted to compare relative magnitude?
10086 val="$undef"
10087 case "$d_memcmp" in
10088 "$define")
10089         echo " "
10090         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10091         $cat >try.c <<EOCP
10092 #$i_memory I_MEMORY
10093 #$i_stdlib I_STDLIB
10094 #$i_string I_STRING
10095 #$i_unistd I_UNISTD
10096 EOCP
10097         $cat >>try.c <<'EOCP'
10098 #include <stdio.h>
10099 #ifdef I_MEMORY
10100 #  include <memory.h>
10101 #endif
10102 #ifdef I_STDLIB
10103 #  include <stdlib.h>
10104 #endif
10105 #ifdef I_STRING
10106 #  include <string.h>
10107 #else
10108 #  include <strings.h>
10109 #endif
10110 #ifdef I_UNISTD
10111 #  include <unistd.h>  /* Needed for NetBSD */
10112 #endif
10113 int main()
10114 {
10115 char a = -1;
10116 char b = 0;
10117 if ((a < b) && memcmp(&a, &b, 1) < 0)
10118         exit(1);
10119 exit(0);
10120 }
10121 EOCP
10122         set try
10123         if eval $compile_ok; then
10124                 if ./try 2>/dev/null; then
10125                         echo "Yes, it can."
10126                         val="$define"
10127                 else
10128                         echo "No, it can't (it uses signed chars)."
10129                 fi
10130         else
10131                 echo "(I can't compile the test program, so we'll assume not...)"
10132         fi
10133         ;;
10134 esac
10135 $rm -f try.* try core
10136 set d_sanemcmp
10137 eval $setvar
10138
10139 : see if select exists
10140 set select d_select
10141 eval $inlibc
10142
10143 : see if semctl exists
10144 set semctl d_semctl
10145 eval $inlibc
10146
10147 : see if semget exists
10148 set semget d_semget
10149 eval $inlibc
10150
10151 : see if semop exists
10152 set semop d_semop
10153 eval $inlibc
10154
10155 : see how much of the 'sem*(2)' library is present.
10156 h_sem=true
10157 echo " "
10158 case "$d_semctl$d_semget$d_semop" in
10159 *"$undef"*) h_sem=false;;
10160 esac
10161 case "$osname" in
10162 freebsd)
10163     case "`ipcs 2>&1`" in
10164     "SVID messages"*"not configured"*)
10165         echo "Your $osname does not have the sem*(2) configured." >&4
10166         h_sem=false
10167         val="$undef"
10168         set semctl d_semctl
10169         eval $setvar
10170         set semget d_semget
10171         eval $setvar
10172         set semop d_semop
10173         eval $setvar
10174         ;;
10175     esac
10176     ;;
10177 esac
10178 : we could also check for sys/ipc.h ...
10179 if $h_sem && $test `./findhdr sys/sem.h`; then
10180         echo "You have the full sem*(2) library." >&4
10181         val="$define"
10182 else
10183         echo "You don't have the full sem*(2) library." >&4
10184         val="$undef"
10185 fi
10186 set d_sem
10187 eval $setvar
10188
10189 : see whether sys/sem.h defines union semun
10190 echo " "
10191 $cat > try.c <<'END'
10192 #include <sys/types.h>
10193 #include <sys/ipc.h>
10194 #include <sys/sem.h>
10195 int main () { union semun semun; semun.buf = 0; }
10196 END
10197 set try
10198 if eval $compile; then
10199     echo "You have union semun in <sys/sem.h>." >&4
10200     val="$define"
10201 else
10202     echo "You do not have union semun in <sys/sem.h>." >&4
10203     val="$undef"
10204 fi
10205 $rm -f try try.c try.h
10206 set d_union_semun
10207 eval $setvar
10208
10209 : see how to do semctl IPC_STAT
10210 case "$d_sem" in
10211 $define)
10212     : see whether semctl IPC_STAT can use union semun
10213     echo " "
10214     $cat > try.h <<END
10215 #ifndef S_IRUSR
10216 #   ifdef S_IREAD
10217 #       define S_IRUSR S_IREAD
10218 #       define S_IWUSR S_IWRITE
10219 #       define S_IXUSR S_IEXEC
10220 #   else
10221 #       define S_IRUSR 0400
10222 #       define S_IWUSR 0200
10223 #       define S_IXUSR 0100
10224 #   endif
10225 #   define S_IRGRP (S_IRUSR>>3)
10226 #   define S_IWGRP (S_IWUSR>>3)
10227 #   define S_IXGRP (S_IXUSR>>3)
10228 #   define S_IROTH (S_IRUSR>>6)
10229 #   define S_IWOTH (S_IWUSR>>6)
10230 #   define S_IXOTH (S_IXUSR>>6)
10231 #endif
10232 #ifndef S_IRWXU
10233 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10234 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10235 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10236 #endif
10237 END
10238
10239     $cat > try.c <<END
10240 #include <sys/types.h>
10241 #include <sys/ipc.h>
10242 #include <sys/sem.h>
10243 #include <sys/stat.h>
10244 #include <stdio.h>
10245 #include <errno.h>
10246 #include "try.h"
10247 #ifndef errno
10248 extern int errno;
10249 #endif
10250 #$d_union_semun HAS_UNION_SEMUN
10251 int main() {
10252     union semun
10253 #ifndef HAS_UNION_SEMUN
10254     {
10255         int val;
10256         struct semid_ds *buf;
10257         unsigned short *array;
10258     }
10259 #endif
10260     arg;
10261     int sem, st;
10262
10263 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10264     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10265     if (sem > -1) {
10266         struct semid_ds argbuf;
10267         arg.buf = &argbuf;
10268 #       ifdef IPC_STAT
10269         st = semctl(sem, 0, IPC_STAT, arg);
10270         if (st == 0)
10271             printf("semun\n");
10272         else
10273 #       endif /* IPC_STAT */
10274             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10275 #       ifdef IPC_RMID
10276         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10277 #       endif /* IPC_RMID */
10278             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10279     } else
10280 #endif /* IPC_PRIVATE && ... */
10281         printf("semget failed: errno = %d\n", errno);
10282   return 0;
10283 }
10284 END
10285     val="$undef"
10286     set try
10287     if eval $compile; then
10288         xxx=`./try`
10289         case "$xxx" in
10290         semun) val="$define" ;;
10291         esac
10292     fi
10293     $rm -f try try.c
10294     set d_semctl_semun
10295     eval $setvar
10296     case "$d_semctl_semun" in
10297     $define)
10298         echo "You can use union semun for semctl IPC_STAT." >&4
10299         also='also'
10300         ;;
10301     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10302         also=''
10303         ;;
10304     esac
10305
10306     : see whether semctl IPC_STAT can use struct semid_ds pointer
10307     $cat > try.c <<'END'
10308 #include <sys/types.h>
10309 #include <sys/ipc.h>
10310 #include <sys/sem.h>
10311 #include <sys/stat.h>
10312 #include "try.h"
10313 #include <stdio.h>
10314 #include <errno.h>
10315 #ifndef errno
10316 extern int errno;
10317 #endif
10318 int main() {
10319     struct semid_ds arg;
10320     int sem, st;
10321
10322 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10323     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10324     if (sem > -1) {
10325 #       ifdef IPC_STAT
10326         st = semctl(sem, 0, IPC_STAT, &arg);
10327         if (st == 0)
10328             printf("semid_ds\n");
10329         else
10330 #       endif /* IPC_STAT */
10331             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10332 #       ifdef IPC_RMID
10333         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10334 #       endif /* IPC_RMID */
10335             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10336     } else
10337 #endif /* IPC_PRIVATE && ... */
10338         printf("semget failed: errno = %d\n", errno);
10339
10340     return 0;
10341 }
10342 END
10343     val="$undef"
10344     set try
10345     if eval $compile; then
10346         xxx=`./try`
10347         case "$xxx" in
10348         semid_ds) val="$define" ;;
10349         esac
10350     fi
10351     $rm -f try try.c
10352     set d_semctl_semid_ds
10353     eval $setvar
10354     case "$d_semctl_semid_ds" in
10355     $define)
10356         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10357         ;;
10358     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10359         ;;
10360     esac
10361     $rm -f try.h
10362     ;;
10363 *)  val="$undef"
10364
10365     # We do not have the full sem*(2) library, so assume we can not
10366     # use either.
10367
10368     set d_semctl_semun
10369     eval $setvar
10370
10371     set d_semctl_semid_ds
10372     eval $setvar
10373     ;;
10374 esac
10375
10376 : see if setegid exists
10377 set setegid d_setegid
10378 eval $inlibc
10379
10380 : see if seteuid exists
10381 set seteuid d_seteuid
10382 eval $inlibc
10383
10384 : see if setgrent exists
10385 set setgrent d_setgrent
10386 eval $inlibc
10387
10388 : see if sethostent exists
10389 set sethostent d_sethent
10390 eval $inlibc
10391
10392 : see if setlinebuf exists
10393 set setlinebuf d_setlinebuf
10394 eval $inlibc
10395
10396 : see if setlocale exists
10397 set setlocale d_setlocale
10398 eval $inlibc
10399
10400 : see if setnetent exists
10401 set setnetent d_setnent
10402 eval $inlibc
10403
10404 : see if setprotoent exists
10405 set setprotoent d_setpent
10406 eval $inlibc
10407
10408 : see if setpgid exists
10409 set setpgid d_setpgid
10410 eval $inlibc
10411
10412 : see if setpgrp2 exists
10413 set setpgrp2 d_setpgrp2
10414 eval $inlibc
10415
10416 : see if setpriority exists
10417 set setpriority d_setprior
10418 eval $inlibc
10419
10420 : see if setpwent exists
10421 set setpwent d_setpwent
10422 eval $inlibc
10423
10424 : see if setregid exists
10425 set setregid d_setregid
10426 eval $inlibc
10427 set setresgid d_setresgid
10428 eval $inlibc
10429
10430 : see if setreuid exists
10431 set setreuid d_setreuid
10432 eval $inlibc
10433 set setresuid d_setresuid
10434 eval $inlibc
10435
10436 : see if setrgid exists
10437 set setrgid d_setrgid
10438 eval $inlibc
10439
10440 : see if setruid exists
10441 set setruid d_setruid
10442 eval $inlibc
10443
10444 : see if setservent exists
10445 set setservent d_setsent
10446 eval $inlibc
10447
10448 : see if setsid exists
10449 set setsid d_setsid
10450 eval $inlibc
10451
10452 : see if setspent exists
10453 set setspent d_setspent
10454 eval $inlibc
10455
10456 : see if setvbuf exists
10457 set setvbuf d_setvbuf
10458 eval $inlibc
10459
10460 : see if sfio.h is available
10461 set sfio.h i_sfio
10462 eval $inhdr
10463
10464
10465 : see if sfio library is available
10466 case "$i_sfio" in
10467 $define)
10468         val=''
10469         set sfreserve val
10470         eval $inlibc
10471         ;;
10472 *)
10473         val="$undef"
10474         ;;
10475 esac
10476 : Ok, but do we want to use it.
10477 case "$val" in
10478 $define)
10479         case "$usesfio" in
10480         true|$define|[yY]*) dflt='y';;
10481         *) dflt='n';;
10482         esac
10483         echo "$package can use the sfio library, but it is experimental."
10484         rp="You seem to have sfio available, do you want to try using it?"
10485         . ./myread
10486         case "$ans" in
10487         y|Y) ;;
10488         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10489                 val="$undef"
10490                 : Remove sfio from list of libraries to use
10491                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10492                 shift
10493                 libs="$*"
10494                 echo "libs = $libs" >&4
10495                 ;;
10496         esac
10497         ;;
10498 *)      case "$usesfio" in
10499         true|$define|[yY]*)
10500                 echo "Sorry, cannot find sfio on this machine" >&4
10501                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10502                 ;;
10503         esac
10504         ;;
10505 esac
10506 set d_sfio
10507 eval $setvar
10508 case "$d_sfio" in
10509 $define) usesfio='true';;
10510 *) usesfio='false';;
10511 esac
10512
10513 : see if shmctl exists
10514 set shmctl d_shmctl
10515 eval $inlibc
10516
10517 : see if shmget exists
10518 set shmget d_shmget
10519 eval $inlibc
10520
10521 : see if shmat exists
10522 set shmat d_shmat
10523 eval $inlibc
10524 : see what shmat returns
10525 case "$d_shmat" in
10526 "$define")
10527         $cat >shmat.c <<'END'
10528 #include <sys/shm.h>
10529 void *shmat();
10530 END
10531         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10532                 shmattype='void *'
10533         else
10534                 shmattype='char *'
10535         fi
10536         echo "and it returns ($shmattype)." >&4
10537         : see if a prototype for shmat is available
10538         xxx=`./findhdr sys/shm.h`
10539         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10540         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10541                 val="$define"
10542         else
10543                 val="$undef"
10544         fi
10545         $rm -f shmat.[co]
10546         ;;
10547 *)
10548         val="$undef"
10549         ;;
10550 esac
10551 set d_shmatprototype
10552 eval $setvar
10553
10554 : see if shmdt exists
10555 set shmdt d_shmdt
10556 eval $inlibc
10557
10558 : see how much of the 'shm*(2)' library is present.
10559 h_shm=true
10560 echo " "
10561 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10562 *"$undef"*) h_shm=false;;
10563 esac
10564 case "$osname" in
10565 freebsd)
10566     case "`ipcs 2>&1`" in
10567     "SVID shared memory"*"not configured"*)
10568         echo "Your $osname does not have the shm*(2) configured." >&4
10569         h_shm=false
10570         val="$undef"
10571         set shmctl d_shmctl
10572         evat $setvar
10573         set shmget d_shmget
10574         evat $setvar
10575         set shmat d_shmat
10576         evat $setvar
10577         set shmdt d_shmdt
10578         evat $setvar
10579         ;;
10580     esac
10581     ;;
10582 esac
10583 : we could also check for sys/ipc.h ...
10584 if $h_shm && $test `./findhdr sys/shm.h`; then
10585         echo "You have the full shm*(2) library." >&4
10586         val="$define"
10587 else
10588         echo "You don't have the full shm*(2) library." >&4
10589         val="$undef"
10590 fi
10591 set d_shm
10592 eval $setvar
10593
10594 echo " "
10595 : see if we have sigaction
10596 if set sigaction val -f d_sigaction; eval $csym; $val; then
10597         echo 'sigaction() found.' >&4
10598         $cat > try.c <<'EOP'
10599 #include <stdio.h>
10600 #include <sys/types.h>
10601 #include <signal.h>
10602 int main()
10603 {
10604     struct sigaction act, oact;
10605     act.sa_flags = 0;
10606     oact.sa_handler = 0;
10607     /* so that act and oact are used */
10608     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10609 }
10610 EOP
10611         set try
10612         if eval $compile_ok; then
10613                 val="$define"
10614         else
10615                 echo "But you don't seem to have a useable struct sigaction." >&4
10616                 val="$undef"
10617         fi
10618 else
10619         echo 'sigaction NOT found.' >&4
10620         val="$undef"
10621 fi
10622 set d_sigaction; eval $setvar
10623 $rm -f try try$_o try.c
10624
10625 : see if sigsetjmp exists
10626 echo " "
10627 case "$d_sigsetjmp" in
10628 '')
10629         $cat >try.c <<'EOP'
10630 #include <setjmp.h>
10631 sigjmp_buf env;
10632 int set = 1;
10633 int main()
10634 {
10635         if (sigsetjmp(env,1))
10636                 exit(set);
10637         set = 0;
10638         siglongjmp(env, 1);
10639         exit(1);
10640 }
10641 EOP
10642         set try
10643         if eval $compile; then
10644                 if ./try >/dev/null 2>&1; then
10645                         echo "POSIX sigsetjmp found." >&4
10646                         val="$define"
10647                 else
10648                         $cat >&4 <<EOM
10649 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10650 I'll ignore them.
10651 EOM
10652                         val="$undef"
10653                 fi
10654         else
10655                 echo "sigsetjmp not found." >&4
10656                 val="$undef"
10657         fi
10658         ;;
10659 *) val="$d_sigsetjmp"
10660         case "$d_sigsetjmp" in
10661         $define) echo "POSIX sigsetjmp found." >&4;;
10662         $undef) echo "sigsetjmp not found." >&4;;
10663         esac
10664         ;;
10665 esac
10666 set d_sigsetjmp
10667 eval $setvar
10668 $rm -f try.c try
10669
10670 : see if sqrtl exists
10671 set sqrtl d_sqrtl
10672 eval $inlibc
10673
10674 : see if sys/stat.h is available
10675 set sys/stat.h i_sysstat
10676 eval $inhdr
10677
10678
10679 : see if stat knows about block sizes
10680 echo " "
10681 echo "Checking to see if your struct stat has st_blocks field..." >&4
10682 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10683 eval $hasfield
10684
10685
10686 : see if this is a sys/vfs.h system
10687 set sys/vfs.h i_sysvfs
10688 eval $inhdr
10689
10690
10691 : see if this is a sys/statfs.h system
10692 set sys/statfs.h i_sysstatfs
10693 eval $inhdr
10694
10695
10696 echo " "
10697 echo "Checking to see if your system supports struct statfs..." >&4
10698 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
10699 eval $hasstruct
10700 case "$d_statfs_s" in
10701 "$define")      echo "Yes, it does."   ;;
10702 *)              echo "No, it doesn't." ;;
10703 esac
10704
10705
10706
10707 : see if struct statfs knows about f_flags
10708 case "$d_statfs_s" in
10709 define) 
10710         echo " "
10711         echo "Checking to see if your struct statfs has f_flags field..." >&4
10712         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
10713         eval $hasfield
10714         ;;
10715 *)      val="$undef"
10716         set d_statfs_f_flags
10717         eval $setvar
10718         ;;
10719 esac
10720 case "$d_statfs_f_flags" in
10721 "$define")      echo "Yes, it does."   ;;
10722 *)              echo "No, it doesn't." ;;
10723 esac
10724
10725 : see if _ptr and _cnt from stdio act std
10726 echo " "
10727 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10728         echo "(Looks like you have stdio.h from Linux.)"
10729         case "$stdio_ptr" in
10730         '') stdio_ptr='((fp)->_IO_read_ptr)'
10731                 ptr_lval=$define
10732                 ;;
10733         *)      ptr_lval=$d_stdio_ptr_lval;;
10734         esac
10735         case "$stdio_cnt" in
10736         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10737                 cnt_lval=$undef
10738                 ;;
10739         *)      cnt_lval=$d_stdio_cnt_lval;;
10740         esac
10741         case "$stdio_base" in
10742         '') stdio_base='((fp)->_IO_read_base)';;
10743         esac
10744         case "$stdio_bufsiz" in
10745         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10746         esac
10747 else
10748         case "$stdio_ptr" in
10749         '') stdio_ptr='((fp)->_ptr)'
10750                 ptr_lval=$define
10751                 ;;
10752         *)      ptr_lval=$d_stdio_ptr_lval;;
10753         esac
10754         case "$stdio_cnt" in
10755         '') stdio_cnt='((fp)->_cnt)'
10756                 cnt_lval=$define
10757                 ;;
10758         *)      cnt_lval=$d_stdio_cnt_lval;;
10759         esac
10760         case "$stdio_base" in
10761         '') stdio_base='((fp)->_base)';;
10762         esac
10763         case "$stdio_bufsiz" in
10764         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10765         esac
10766 fi
10767 : test whether _ptr and _cnt really work
10768 echo "Checking how std your stdio is..." >&4
10769 $cat >try.c <<EOP
10770 #include <stdio.h>
10771 #define FILE_ptr(fp)    $stdio_ptr
10772 #define FILE_cnt(fp)    $stdio_cnt
10773 int main() {
10774         FILE *fp = fopen("try.c", "r");
10775         char c = getc(fp);
10776         if (
10777                 18 <= FILE_cnt(fp) &&
10778                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10779         )
10780                 exit(0);
10781         exit(1);
10782 }
10783 EOP
10784 val="$undef"
10785 set try
10786 if eval $compile; then
10787         if ./try; then
10788                 echo "Your stdio acts pretty std."
10789                 val="$define"
10790         else
10791                 echo "Your stdio isn't very std."
10792         fi
10793 else
10794         echo "Your stdio doesn't appear very std."
10795 fi
10796 $rm -f try.c try
10797 set d_stdstdio
10798 eval $setvar
10799
10800 : Can _ptr be used as an lvalue?
10801 case "$d_stdstdio$ptr_lval" in
10802 $define$define) val=$define ;;
10803 *) val=$undef ;;
10804 esac
10805 set d_stdio_ptr_lval
10806 eval $setvar
10807
10808 : Can _cnt be used as an lvalue?
10809 case "$d_stdstdio$cnt_lval" in
10810 $define$define) val=$define ;;
10811 *) val=$undef ;;
10812 esac
10813 set d_stdio_cnt_lval
10814 eval $setvar
10815
10816 : see if _base is also standard
10817 val="$undef"
10818 case "$d_stdstdio" in
10819 $define)
10820         $cat >try.c <<EOP
10821 #include <stdio.h>
10822 #define FILE_base(fp)   $stdio_base
10823 #define FILE_bufsiz(fp) $stdio_bufsiz
10824 int main() {
10825         FILE *fp = fopen("try.c", "r");
10826         char c = getc(fp);
10827         if (
10828                 19 <= FILE_bufsiz(fp) &&
10829                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10830         )
10831                 exit(0);
10832         exit(1);
10833 }
10834 EOP
10835         set try
10836         if eval $compile; then
10837                 if ./try; then
10838                         echo "And its _base field acts std."
10839                         val="$define"
10840                 else
10841                         echo "But its _base field isn't std."
10842                 fi
10843         else
10844                 echo "However, it seems to be lacking the _base field."
10845         fi
10846         $rm -f try.c try
10847         ;;
10848 esac
10849 set d_stdiobase
10850 eval $setvar
10851
10852 $cat >&4 <<EOM
10853 Checking how to access stdio streams by file descriptor number...
10854 EOM
10855 case "$stdio_stream_array" in
10856 '')     $cat >try.c <<EOCP
10857 #include <stdio.h>
10858 int main() {
10859   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10860     printf("yes\n");
10861 }
10862 EOCP
10863         for s in _iob __iob __sF
10864         do
10865                 set try -DSTDIO_STREAM_ARRAY=$s
10866                 if eval $compile; then
10867                         case "`./try$exe_ext`" in
10868                         yes)    stdio_stream_array=$s; break ;;
10869                         esac
10870                 fi
10871         done
10872         $rm -f try.* try$exe_ext
10873 esac
10874 case "$stdio_stream_array" in
10875 '')     $cat >&4 <<EOM
10876 I can't figure out how to access stdio streams by file descriptor number.
10877 EOM
10878         d_stdio_stream_array="$undef"
10879         ;;
10880 *)      $cat >&4 <<EOM
10881 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10882 EOM
10883         d_stdio_stream_array="$define"
10884         ;;
10885 esac
10886
10887 : see if strcoll exists
10888 set strcoll d_strcoll
10889 eval $inlibc
10890
10891 : check for structure copying
10892 echo " "
10893 echo "Checking to see if your C compiler can copy structs..." >&4
10894 $cat >try.c <<'EOCP'
10895 int main()
10896 {
10897         struct blurfl {
10898                 int dyick;
10899         } foo, bar;
10900
10901         foo = bar;
10902 }
10903 EOCP
10904 if $cc -c try.c >/dev/null 2>&1 ; then
10905         val="$define"
10906         echo "Yup, it can."
10907 else
10908         val="$undef"
10909         echo "Nope, it can't."
10910 fi
10911 set d_strctcpy
10912 eval $setvar
10913 $rm -f try.*
10914
10915 : see if strerror and/or sys_errlist[] exist
10916 echo " "
10917 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10918     if set strerror val -f d_strerror; eval $csym; $val; then
10919                 echo 'strerror() found.' >&4
10920                 d_strerror="$define"
10921                 d_strerrm='strerror(e)'
10922                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10923                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10924                         d_syserrlst="$define"
10925                 else
10926                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10927                         d_syserrlst="$undef"
10928                 fi
10929     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10930                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10931                 echo 'strerror() found in string header.' >&4
10932                 d_strerror="$define"
10933                 d_strerrm='strerror(e)'
10934                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10935                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10936                                 d_syserrlst="$define"
10937                 else
10938                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10939                         d_syserrlst="$undef"
10940                 fi
10941     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10942                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10943                 d_strerror="$undef"
10944                 d_syserrlst="$define"
10945                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10946     else
10947                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10948                 d_strerror="$undef"
10949                 d_syserrlst="$undef"
10950                 d_strerrm='"unknown"'
10951     fi
10952 fi
10953
10954 : see if strtod exists
10955 set strtod d_strtod
10956 eval $inlibc
10957
10958 : see if strtol exists
10959 set strtol d_strtol
10960 eval $inlibc
10961
10962 : see if strtold exists
10963 set strtold d_strtold
10964 eval $inlibc
10965
10966 : see if strtoll exists
10967 set strtoll d_strtoll
10968 eval $inlibc
10969
10970 : see if strtoul exists
10971 set strtoul d_strtoul
10972 eval $inlibc
10973
10974 : see if strtoull exists
10975 set strtoull d_strtoull
10976 eval $inlibc
10977
10978 : see if strtouq exists
10979 set strtouq d_strtouq
10980 eval $inlibc
10981
10982 : see if strxfrm exists
10983 set strxfrm d_strxfrm
10984 eval $inlibc
10985
10986 : see if symlink exists
10987 set symlink d_symlink
10988 eval $inlibc
10989
10990 : see if syscall exists
10991 set syscall d_syscall
10992 eval $inlibc
10993
10994 : see if sysconf exists
10995 set sysconf d_sysconf
10996 eval $inlibc
10997
10998 : see if system exists
10999 set system d_system
11000 eval $inlibc
11001
11002 : see if tcgetpgrp exists
11003 set tcgetpgrp d_tcgetpgrp
11004 eval $inlibc
11005
11006 : see if tcsetpgrp exists
11007 set tcsetpgrp d_tcsetpgrp
11008 eval $inlibc
11009
11010 : see if prototype for telldir is available
11011 echo " "
11012 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11013 eval $hasproto
11014
11015 : see if this is a sys/times.h system
11016 set sys/times.h i_systimes
11017 eval $inhdr
11018
11019 : see if times exists
11020 echo " "
11021 if set times val -f d_times; eval $csym; $val; then
11022         echo 'times() found.' >&4
11023         d_times="$define"
11024         inc=''
11025         case "$i_systimes" in
11026         "$define") inc='sys/times.h';;
11027         esac
11028         rp="What is the type returned by times() on this system?"
11029         set clock_t clocktype long stdio.h sys/types.h $inc
11030         eval $typedef_ask
11031 else
11032         echo 'times() NOT found, hope that will do.' >&4
11033         d_times="$undef"
11034         clocktype='int'
11035 fi
11036
11037 : see if truncate exists
11038 set truncate d_truncate
11039 eval $inlibc
11040
11041 : see if tzname[] exists
11042 echo " "
11043 if set tzname val -a d_tzname; eval $csym; $val; then
11044         val="$define"
11045         echo 'tzname[] found.' >&4
11046 else
11047         val="$undef"
11048         echo 'tzname[] NOT found.' >&4
11049 fi
11050 set d_tzname
11051 eval $setvar
11052
11053 : see if umask exists
11054 set umask d_umask
11055 eval $inlibc
11056
11057 : see if ustat exists
11058 set ustat d_ustat
11059 eval $inlibc
11060
11061 : backward compatibility for d_hvfork
11062 if test X$d_hvfork != X; then
11063         d_vfork="$d_hvfork"
11064         d_hvfork=''
11065 fi
11066 : see if there is a vfork
11067 val=''
11068 set vfork val
11069 eval $inlibc
11070
11071 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11072 : perl on Solaris 2.x, and probably elsewhere.
11073 case "$val" in
11074 $define)
11075         echo " "
11076         case "$usevfork" in
11077         false) dflt='n';;
11078         *) dflt='y';;
11079         esac
11080         cat <<'EOM'
11081  
11082 Perl can only use a vfork() that doesn't suffer from strict
11083 restrictions on calling functions or modifying global data in
11084 the child.  For example, glibc-2.1 contains such a vfork()
11085 that is unsuitable.  If your system provides a proper fork()
11086 call, chances are that you do NOT want perl to use vfork().
11087
11088 EOM
11089         rp="Do you still want to use vfork()?"
11090         . ./myread
11091         case "$ans" in
11092         y|Y) ;;
11093         *)
11094                 echo "Ok, we won't use vfork()."
11095                 val="$undef"
11096                 ;;
11097         esac
11098         ;;
11099 esac
11100 set d_vfork
11101 eval $setvar
11102 case "$d_vfork" in
11103 $define) usevfork='true';;
11104 *) usevfork='false';;
11105 esac
11106
11107 : see if this is an sysdir system
11108 set sys/dir.h i_sysdir
11109 eval $inhdr
11110
11111 : see if this is an sysndir system
11112 set sys/ndir.h i_sysndir
11113 eval $inhdr
11114
11115 : see if closedir exists
11116 set closedir d_closedir
11117 eval $inlibc
11118
11119 case "$d_closedir" in
11120 "$define")
11121         echo " "
11122         echo "Checking whether closedir() returns a status..." >&4
11123         cat > closedir.c <<EOM
11124 #$i_dirent I_DIRENT             /**/
11125 #$i_sysdir I_SYS_DIR            /**/
11126 #$i_sysndir I_SYS_NDIR          /**/
11127 #$i_systypes I_SYS_TYPES        /**/
11128
11129 #if defined(I_SYS_TYPES)
11130 #include <sys/types.h>
11131 #endif
11132 #if defined(I_DIRENT)
11133 #include <dirent.h>
11134 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11135 #include <sys/dir.h>
11136 #endif
11137 #else
11138 #ifdef I_SYS_NDIR
11139 #include <sys/ndir.h>
11140 #else
11141 #ifdef I_SYS_DIR
11142 #ifdef hp9000s500
11143 #include <ndir.h>       /* may be wrong in the future */
11144 #else
11145 #include <sys/dir.h>
11146 #endif
11147 #endif
11148 #endif
11149 #endif 
11150 int main() { return closedir(opendir(".")); }
11151 EOM
11152         set closedir
11153         if eval $compile_ok; then
11154                 if ./closedir > /dev/null 2>&1 ; then
11155                         echo "Yes, it does."
11156                         val="$undef"
11157                 else
11158                         echo "No, it doesn't."
11159                         val="$define"
11160                 fi
11161         else
11162                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11163                 val="$define"
11164         fi
11165         ;;
11166 *)
11167         val="$undef";
11168         ;;
11169 esac
11170 set d_void_closedir
11171 eval $setvar
11172 $rm -f closedir*
11173 : check for volatile keyword
11174 echo " "
11175 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11176 $cat >try.c <<'EOCP'
11177 int main()
11178 {
11179         typedef struct _goo_struct goo_struct;
11180         goo_struct * volatile goo = ((goo_struct *)0);
11181         struct _goo_struct {
11182                 long long_int;
11183                 int reg_int;
11184                 char char_var;
11185         };
11186         typedef unsigned short foo_t;
11187         char *volatile foo;
11188         volatile int bar;
11189         volatile foo_t blech;
11190         foo = foo;
11191 }
11192 EOCP
11193 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11194         val="$define"
11195         echo "Yup, it does."
11196 else
11197         val="$undef"
11198         echo "Nope, it doesn't."
11199 fi
11200 set d_volatile
11201 eval $setvar
11202 $rm -f try.*
11203
11204 : see if there is a wait4
11205 set wait4 d_wait4
11206 eval $inlibc
11207
11208 : see if waitpid exists
11209 set waitpid d_waitpid
11210 eval $inlibc
11211
11212 : see if wcstombs exists
11213 set wcstombs d_wcstombs
11214 eval $inlibc
11215
11216 : see if wctomb exists
11217 set wctomb d_wctomb
11218 eval $inlibc
11219
11220 : preserve RCS keywords in files with variable substitution, grrr
11221 Date='$Date'
11222 Id='$Id'
11223 Log='$Log'
11224 RCSfile='$RCSfile'
11225 Revision='$Revision'
11226
11227 case "$crosscompile" in
11228 ''|[nN]*) crosscompile="$undef" ;;
11229 esac
11230
11231 case "$osname" in
11232 next|rhapsody) multiarch="$define" ;;
11233 esac
11234 case "$multiarch" in
11235 ''|[nN]*) multiarch="$undef" ;;
11236 esac
11237
11238 : check for alignment requirements
11239 echo " "
11240 case "$crosscompile$multiarch" in
11241 *$define*)
11242         $cat <<EOM
11243 You seem to be either cross-compiling or doing a multiarchitecture build,
11244 skipping the memory alignment check.
11245
11246 EOM
11247         case "$alignbytes" in
11248         '') alignbytes=8 ;;
11249         esac
11250         ;;
11251 *)
11252         case "$alignbytes" in
11253         '') echo "Checking alignment constraints..." >&4
11254                 $cat >try.c <<'EOCP'
11255 #include <stdio.h>
11256 struct foobar {
11257         char foo;
11258         double bar;
11259 } try_algn;
11260 int main()
11261 {
11262     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11263     return(0);
11264 }
11265 EOCP
11266                 set try
11267                 if eval $compile_ok; then
11268                         dflt=`./try`
11269                 else
11270                         dflt='8'
11271                         echo "(I can't seem to compile the test program...)"
11272                 fi
11273                 ;;
11274         *) dflt="$alignbytes"
11275                 ;;
11276         esac
11277         rp="Doubles must be aligned on a how-many-byte boundary?"
11278         . ./myread
11279         alignbytes="$ans"
11280         $rm -f try.c try
11281         ;;
11282 esac
11283
11284
11285 : check for ordering of bytes in a long
11286 echo " "
11287 case "$crosscompile$multiarch" in
11288 *$define*)
11289         $cat <<EOM
11290 You seem to be either cross-compiling or doing a multiarchitecture build,
11291 skipping the byteorder check.
11292
11293 EOM
11294         byteorder='0xffff'
11295         ;;
11296 *)
11297         case "$byteorder" in
11298         '')
11299                 $cat <<'EOM'
11300 In the following, larger digits indicate more significance.  A big-endian
11301 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11302 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11303 machines may have weird orders like 3412.  A Cray will report 87654321,
11304 an Alpha will report 12345678. If the test program works the default is
11305 probably right.
11306 I'm now running the test program...
11307 EOM
11308                 $cat >try.c <<'EOCP'
11309 #include <stdio.h>
11310 int main()
11311 {
11312         int i;
11313         union {
11314                 unsigned long l;
11315                 char c[sizeof(long)];
11316         } u;
11317
11318         if (sizeof(long) > 4)
11319                 u.l = (0x08070605L << 32) | 0x04030201L;
11320         else
11321                 u.l = 0x04030201L;
11322         for (i = 0; i < sizeof(long); i++)
11323                 printf("%c", u.c[i]+'0');
11324         printf("\n");
11325         exit(0);
11326 }
11327 EOCP
11328                 xxx_prompt=y
11329                 set try
11330                 if eval $compile && ./try > /dev/null; then
11331                         dflt=`./try`
11332                         case "$dflt" in
11333                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11334                                 echo "(The test program ran ok.)"
11335                                 echo "byteorder=$dflt"
11336                                 xxx_prompt=n
11337                         ;;
11338                         ????|????????) echo "(The test program ran ok.)" ;;
11339                         *) echo "(The test program didn't run right for some reason.)" ;;
11340                         esac
11341                 else
11342                         dflt='4321'
11343                         cat <<'EOM'
11344 (I can't seem to compile the test program.  Guessing big-endian...)
11345 EOM
11346                 fi
11347                 case "$xxx_prompt" in
11348                 y)
11349                         rp="What is the order of bytes in a long?"
11350                         . ./myread
11351                         byteorder="$ans"
11352                         ;;
11353                 *)      byteorder=$dflt
11354                         ;;
11355                 esac
11356                 ;;
11357         esac
11358         $rm -f try.c try
11359         ;;
11360 esac
11361
11362
11363 : how do we catenate cpp tokens here?
11364 echo " "
11365 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11366 $cat >cpp_stuff.c <<'EOCP'
11367 #define RCAT(a,b)a/**/b
11368 #define ACAT(a,b)a ## b
11369 RCAT(Rei,ser)
11370 ACAT(Cir,cus)
11371 EOCP
11372 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11373 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11374         echo "Oh!  Smells like ANSI's been here." >&4
11375         echo "We can catify or stringify, separately or together!"
11376         cpp_stuff=42
11377 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11378         echo "Ah, yes!  The good old days!" >&4
11379         echo "However, in the good old days we don't know how to stringify and"
11380         echo "catify at the same time."
11381         cpp_stuff=1
11382 else
11383         $cat >&4 <<EOM
11384 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11385 to have to edit the values of CAT[2-5] in config.h...
11386 EOM
11387         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11388 fi
11389 $rm -f cpp_stuff.*
11390
11391 : see if this is a db.h system
11392 set db.h i_db
11393 eval $inhdr
11394
11395 case "$i_db" in
11396 $define)
11397         : Check db version.
11398         echo " "
11399         echo "Checking Berkeley DB version ..." >&4
11400         $cat >try.c <<EOCP
11401 #$d_const HASCONST
11402 #ifndef HASCONST
11403 #define const
11404 #endif
11405 #include <sys/types.h>
11406 #include <stdio.h>
11407 #include <db.h>
11408 int main()
11409 {
11410 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11411     int Major, Minor, Patch ;
11412     unsigned long Version ;
11413     (void)db_version(&Major, &Minor, &Patch) ;
11414     printf("You have Berkeley DB Version 2 or greater\n");
11415
11416     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11417                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11418     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11419                 Major, Minor, Patch) ;
11420
11421     /* check that db.h & libdb are compatible */
11422     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11423         printf("db.h and libdb are incompatible\n") ;
11424         exit(3);        
11425     }
11426
11427     printf("db.h and libdb are compatible\n") ;
11428
11429     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11430                 + DB_VERSION_PATCH ;
11431
11432     /* needs to be >= 2.3.4 */
11433     if (Version < 2003004) {
11434     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11435         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11436         exit(2);        
11437     }
11438
11439     exit(0);
11440 #else
11441 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11442     printf("You have Berkeley DB Version 1\n");
11443     exit(0);    /* DB version < 2: the coast is clear. */
11444 #else
11445     exit(1);    /* <db.h> not Berkeley DB? */
11446 #endif
11447 #endif
11448 }
11449 EOCP
11450         set try
11451         if eval $compile_ok && ./try; then
11452                 echo 'Looks OK.' >&4
11453         else
11454                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11455                 i_db=$undef
11456                 case " $libs " in
11457                 *"-ldb "*)
11458                         : Remove db from list of libraries to use
11459                         echo "Removing unusable -ldb from library list" >&4
11460                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11461                         shift
11462                         libs="$*"
11463                         echo "libs = $libs" >&4
11464                         ;;
11465                 esac
11466         fi
11467         $rm -f try.*
11468         ;;
11469 esac
11470
11471 case "$i_db" in
11472 define)
11473         : Check the return type needed for hash 
11474         echo " "
11475         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11476         $cat >try.c <<EOCP
11477 #$d_const HASCONST
11478 #ifndef HASCONST
11479 #define const
11480 #endif
11481 #include <sys/types.h>
11482 #include <db.h>
11483
11484 #ifndef DB_VERSION_MAJOR
11485 u_int32_t hash_cb (ptr, size)
11486 const void *ptr;
11487 size_t size;
11488 {
11489 }
11490 HASHINFO info;
11491 int main()
11492 {
11493         info.hash = hash_cb;
11494 }
11495 #endif
11496 EOCP
11497         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11498                 if $contains warning try.out >>/dev/null 2>&1 ; then
11499                         db_hashtype='int'
11500                 else
11501                         db_hashtype='u_int32_t'
11502                 fi
11503         else
11504                 : XXX Maybe we should just give up here.
11505                 db_hashtype=u_int32_t
11506                 $cat try.out >&4
11507                 echo "Help:  I can't seem to compile the db test program." >&4
11508                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11509         fi
11510         $rm -f try.*
11511         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11512         ;;
11513 *)      db_hashtype=u_int32_t
11514         ;;
11515 esac
11516 case "$i_db" in
11517 define)
11518         : Check the return type needed for prefix 
11519         echo " "
11520         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11521         cat >try.c <<EOCP
11522 #$d_const HASCONST
11523 #ifndef HASCONST
11524 #define const
11525 #endif
11526 #include <sys/types.h>
11527 #include <db.h>
11528
11529 #ifndef DB_VERSION_MAJOR
11530 size_t prefix_cb (key1, key2)
11531 const DBT *key1;
11532 const DBT *key2;
11533 {
11534 }
11535 BTREEINFO info;
11536 int main()
11537 {
11538         info.prefix = prefix_cb;
11539 }
11540 #endif
11541 EOCP
11542         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11543                 if $contains warning try.out >>/dev/null 2>&1 ; then
11544                         db_prefixtype='int'
11545                 else
11546                         db_prefixtype='size_t'
11547                 fi
11548         else
11549                 db_prefixtype='size_t'
11550                 : XXX Maybe we should just give up here.
11551                 $cat try.out >&4
11552                 echo "Help:  I can't seem to compile the db test program." >&4
11553                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11554         fi
11555         $rm -f try.*
11556         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11557         ;;
11558 *)      db_prefixtype='size_t'
11559         ;;
11560 esac
11561
11562 : check for void type
11563 echo " "
11564 echo "Checking to see how well your C compiler groks the void type..." >&4
11565 case "$voidflags" in
11566 '')
11567         $cat >try.c <<'EOCP'
11568 #if TRY & 1
11569 void sub() {
11570 #else
11571 sub() {
11572 #endif
11573         extern void moo();      /* function returning void */
11574         void (*goo)();          /* ptr to func returning void */
11575 #if TRY & 8
11576         void *hue;              /* generic ptr */
11577 #endif
11578 #if TRY & 2
11579         void (*foo[10])();
11580 #endif
11581
11582 #if TRY & 4
11583         if(goo == moo) {
11584                 exit(0);
11585         }
11586 #endif
11587         exit(0);
11588 }
11589 int main() { sub(); }
11590 EOCP
11591         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11592                 voidflags=$defvoidused
11593         echo "Good.  It appears to support void to the level $package wants.">&4
11594                 if $contains warning .out >/dev/null 2>&1; then
11595                         echo "However, you might get some warnings that look like this:"
11596                         $cat .out
11597                 fi
11598         else
11599 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11600                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11601                         echo "It supports 1..."
11602                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11603                                 echo "It also supports 2..."
11604                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11605                                         voidflags=7
11606                                         echo "And it supports 4 but not 8 definitely."
11607                                 else
11608                                         echo "It doesn't support 4..."
11609                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11610                                                 voidflags=11
11611                                                 echo "But it supports 8."
11612                                         else
11613                                                 voidflags=3
11614                                                 echo "Neither does it support 8."
11615                                         fi
11616                                 fi
11617                         else
11618                                 echo "It does not support 2..."
11619                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11620                                         voidflags=13
11621                                         echo "But it supports 4 and 8."
11622                                 else
11623                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11624                                                 voidflags=5
11625                                                 echo "And it supports 4 but has not heard about 8."
11626                                         else
11627                                                 echo "However it supports 8 but not 4."
11628                                         fi
11629                                 fi
11630                         fi
11631                 else
11632                         echo "There is no support at all for void."
11633                         voidflags=0
11634                 fi
11635         fi
11636 esac
11637 case "$voidflags" in
11638 "$defvoidused") ;;
11639 *)      $cat >&4 <<'EOM'
11640   Support flag bits are:
11641     1: basic void declarations.
11642     2: arrays of pointers to functions returning void.
11643     4: operations between pointers to and addresses of void functions.
11644     8: generic void pointers.
11645 EOM
11646         dflt="$voidflags";
11647         rp="Your void support flags add up to what?"
11648         . ./myread
11649         voidflags="$ans"
11650         ;;
11651 esac
11652 $rm -f try.* .out
11653
11654
11655 : How can we generate normalized random numbers ?
11656 echo " "
11657 echo "Looking for a random number function..." >&4
11658 case "$randfunc" in
11659 '')
11660         if set drand48 val -f; eval $csym; $val; then
11661                 dflt="drand48"
11662                 echo "Good, found drand48()." >&4
11663         elif set random val -f; eval $csym; $val; then
11664                 dflt="random"
11665                 echo "OK, found random()." >&4
11666         else
11667                 dflt="rand"
11668                 echo "Yick, looks like I have to use rand()." >&4
11669         fi
11670         echo " "
11671         ;;
11672 *)
11673         dflt="$randfunc"
11674         ;;
11675 esac
11676 cont=true
11677
11678 case "$ccflags" in
11679 *-Dmy_rand=*|*-Dmy_srand=*)
11680         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11681         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11682         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11683         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11684         ;;
11685 esac
11686
11687 while $test "$cont"; do
11688         rp="Use which function to generate random numbers?"
11689         . ./myread
11690         if $test "$ans" = "$dflt"; then
11691                 : null
11692         else
11693                 randbits=''
11694         fi
11695         randfunc="$ans"
11696         if set $ans val -f; eval $csym; $val; then
11697                 cont=''
11698         else
11699                 dflt=y
11700                 rp="I cannot find function $ans. Use that name anyway?"
11701                 . ./myread
11702                 dflt=rand
11703                 case "$ans" in
11704                         [yY]*) cont='';;
11705                 esac
11706         fi
11707         case "$cont" in
11708         '')
11709                 case "$randfunc" in
11710                 drand48)
11711                         drand01="drand48()"
11712                         seedfunc="srand48"
11713                         randbits=48
11714                         randseedtype=long
11715                         ;;
11716                 rand|random)
11717                         case "$randbits" in
11718                         '')
11719 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11720                                 $cat >try.c <<EOCP
11721 #$i_unistd I_UNISTD
11722 #$i_stdlib I_STDLIB
11723 #include <stdio.h>
11724 #ifdef I_UNISTD
11725 #  include <unistd.h>
11726 #endif
11727 #ifdef I_STDLIB
11728 #  include <stdlib.h>
11729 #endif
11730 int main()
11731 {
11732         register int i;
11733         register unsigned long tmp;
11734         register unsigned long max = 0L;
11735
11736         for (i = 1000; i; i--) {
11737                 tmp = (unsigned long) $randfunc();
11738                 if (tmp > max) max = tmp;
11739         }
11740         for (i = 0; max; i++)
11741                 max /= 2;
11742         printf("%d\n",i);
11743 }
11744 EOCP
11745                                 set try
11746                                 if eval $compile_ok; then
11747                                         dflt=`try`
11748                                 else
11749                                         dflt='?'
11750                                         echo "(I can't seem to compile the test program...)"
11751                                 fi
11752                                 ;;
11753                         *)
11754                                 dflt="$randbits"
11755                                 ;;
11756                         esac
11757                         rp="How many bits does your $randfunc() function produce?"
11758                         . ./myread
11759                         randbits="$ans"
11760                         $rm -f try.c try
11761                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11762                         seedfunc="s$randfunc"
11763                         randseedtype=unsigned
11764                         ;;
11765                 *)
11766                         dflt="31"
11767                         rp="How many bits does your $randfunc() function produce?"
11768                         . ./myread
11769                         randbits="$ans"
11770                         seedfunc="s$randfunc"
11771                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11772                         if set $seedfunc val -f; eval $csym; $val; then
11773                                 echo "(Using $seedfunc() to seed random generator)"
11774                         else
11775                                 echo "(Warning: no $seedfunc() to seed random generator)"
11776                                 seedfunc=rand
11777                         fi
11778                         randseedtype=unsigned
11779                         ;;
11780                 esac
11781                 ;;
11782         esac
11783 done
11784
11785 echo " "
11786 echo "Determining whether or not we are on an EBCDIC system..." >&4
11787 $cat >tebcdic.c <<'EOM'
11788 int main()
11789 {
11790   if ('M'==0xd4) return 0;
11791   return 1;
11792 }
11793 EOM
11794
11795 val=$undef
11796 set tebcdic
11797 if eval $compile_ok; then
11798         if ./tebcdic; then
11799                 echo "You have EBCDIC." >&4
11800                 val="$define"
11801         else
11802                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11803         fi
11804 else
11805         echo "I'm unable to compile the test program." >&4
11806         echo "I'll assume ASCII or some ISO Latin." >&4
11807 fi
11808 $rm -f tebcdic.c tebcdic
11809 set ebcdic
11810 eval $setvar
11811
11812 echo " "
11813 $cat >&4 <<EOM
11814 Checking how to flush all pending stdio output...
11815 EOM
11816 # I only know how to find the first 32 possibly open files on SunOS.
11817 # See also hints/sunos_4_1.sh and util.c  --AD
11818 case "$osname" in
11819 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11820 esac
11821 $cat >>try.c <<EOCP
11822 #include <stdio.h>
11823 #$i_unistd I_UNISTD
11824 #ifdef I_UNISTD
11825 # include <unistd.h>
11826 #endif
11827 #$d_sysconf HAS_SYSCONF
11828 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11829 #ifdef HAS_STDIO_STREAM_ARRAY
11830 # define STDIO_STREAM_ARRAY $stdio_stream_array
11831 #endif
11832 int main() {
11833   FILE* p = fopen("try.out", "w");
11834 #ifdef TRY_FPUTC
11835   fputc('x', p);
11836 #else
11837 # ifdef TRY_FPRINTF
11838   fprintf(p, "x");
11839 # endif
11840 #endif
11841 #ifdef TRY_FFLUSH_NULL
11842   fflush(NULL);
11843 #endif
11844 #ifdef TRY_FFLUSH_ALL
11845   {
11846     long open_max = -1;
11847 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11848     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11849 # else
11850 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11851     open_max = sysconf(_SC_OPEN_MAX);
11852 #  else
11853 #   ifdef FOPEN_MAX
11854     open_max = FOPEN_MAX;
11855 #   else
11856 #    ifdef OPEN_MAX
11857     open_max = OPEN_MAX;
11858 #    else
11859 #     ifdef _NFILE
11860     open_max = _NFILE;
11861 #     endif
11862 #    endif
11863 #   endif
11864 #  endif
11865 # endif 
11866 # ifdef HAS_STDIO_STREAM_ARRAY
11867     if (open_max > 0) {
11868       long i;
11869       for (i = 0; i < open_max; i++)
11870             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11871                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11872                 STDIO_STREAM_ARRAY[i]._flag)
11873                 fflush(&STDIO_STREAM_ARRAY[i]);
11874     }   
11875   }
11876 # endif
11877 #endif
11878   _exit(42);
11879 }
11880 EOCP
11881 : first we have to find out how _not_ to flush
11882 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11883     output=''
11884     set try -DTRY_FPUTC
11885     if eval $compile; then
11886             $rm -f try.out
11887             ./try$exe_ext 2>/dev/null
11888             if $test ! -s try.out -a "X$?" = X42; then
11889                 output=-DTRY_FPUTC
11890             fi
11891     fi
11892     case "$output" in
11893     '')
11894             set try -DTRY_FPRINTF
11895             $rm -f try.out
11896             if eval $compile; then
11897                     $rm -f try.out
11898                     ./try$exe_ext 2>/dev/null
11899                     if $test ! -s try.out -a "X$?" = X42; then
11900                         output=-DTRY_FPRINTF
11901                     fi
11902             fi
11903         ;;
11904     esac
11905 fi
11906 : check for fflush NULL behaviour
11907 case "$fflushNULL" in
11908 '')     set try -DTRY_FFLUSH_NULL $output
11909         if eval $compile; then
11910                 $rm -f try.out
11911                 ./try$exe_ext 2>/dev/null
11912                 code="$?"
11913                 if $test -s try.out -a "X$code" = X42; then
11914                         fflushNULL="`$cat try.out`"
11915                 else
11916                         if $test "X$code" != X42; then
11917                                 $cat >&4 <<EOM
11918 (If this test failed, don't worry, we'll try another method shortly.)
11919 EOM
11920                         fi
11921                 fi
11922         fi
11923         $rm -f core try.core core.try.*
11924         case "$fflushNULL" in
11925         x)      $cat >&4 <<EOM
11926 Your fflush(NULL) works okay.
11927 EOM
11928                 fflushNULL="$define"
11929                 ;;
11930         '')     $cat >&4 <<EOM
11931 Your fflush(NULL) isn't working (contrary to ANSI C).
11932 EOM
11933                 fflushNULL="$undef"
11934                 ;;
11935         *)      $cat >&4 <<EOM
11936 Cannot figure out whether your fflush(NULL) works or not.
11937 I'm assuming it doesn't (contrary to ANSI C).
11938 EOM
11939                 fflushNULL="$undef"
11940                 ;;
11941         esac
11942         ;;
11943 $define|true|[yY]*)
11944         fflushNULL="$define"
11945         ;;
11946 *)
11947         fflushNULL="$undef"
11948         ;;
11949 esac
11950 : check explicit looping only if NULL did not work
11951 case "$fflushNULL" in
11952 "$undef")
11953         : check for fflush all behaviour
11954         case "$fflushall" in
11955         '')     set try -DTRY_FFLUSH_ALL $output
11956                 if eval $compile; then
11957                         $cat >&4 <<EOM
11958 (Now testing the other method--but note that also this may fail.)
11959 EOM
11960                         $rm -f try.out
11961                         ./try$exe_ext 2>/dev/null
11962                         if $test -s try.out -a "X$?" = X42; then
11963                                 fflushall="`$cat try.out`"
11964                         fi
11965                 fi
11966                 $rm -f core try.core core.try.*
11967                 case "$fflushall" in
11968                 x)      $cat >&4 <<EOM
11969 Whew. Flushing explicitly all the stdio streams works.
11970 EOM
11971                         fflushall="$define"
11972                         ;;
11973                 '')     $cat >&4 <<EOM
11974 Sigh. Flushing explicitly all the stdio streams doesn't work.
11975 EOM
11976                         fflushall="$undef"
11977                         ;;
11978                 *)      $cat >&4 <<EOM
11979 Cannot figure out whether flushing stdio streams explicitly works or not.
11980 I'm assuming it doesn't.
11981 EOM
11982                         fflushall="$undef"
11983                         ;;
11984                 esac
11985                 ;;
11986         "$define"|true|[yY]*)
11987                 fflushall="$define"
11988                 ;;
11989         *)
11990                 fflushall="$undef"
11991                 ;;
11992         esac
11993         ;;
11994 *)      fflushall="$undef"      
11995         ;;
11996 esac
11997 case "$fflushNULL$fflushall" in
11998 undefundef)
11999         $cat <<EOM
12000 I cannot figure out how to flush pending stdio output.
12001 EOM
12002         ;;
12003 esac
12004 $rm -f try.* try$exe_ext
12005
12006 : Store the full pathname to the ar program for use in the C program
12007 : Respect a hint or command line value for full_ar.
12008 case "$full_ar" in
12009 '') full_ar=$ar ;;
12010 esac
12011
12012 : Store the full pathname to the sed program for use in the C program
12013 full_sed=$sed
12014
12015 : see what type gids are declared as in the kernel
12016 echo " "
12017 echo "Looking for the type for group ids returned by getgid()."
12018 set gid_t gidtype xxx stdio.h sys/types.h
12019 eval $typedef
12020 case "$gidtype" in
12021 xxx)
12022         xxx=`./findhdr sys/user.h`
12023         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12024         case $1 in
12025         unsigned) dflt="$1 $2" ;;
12026         *) dflt="$1" ;;
12027         esac
12028         ;;
12029 *) dflt="$gidtype";;
12030 esac
12031 case "$gidtype" in
12032 gid_t) echo "gid_t found." ;;
12033 *)      rp="What is the type for group ids returned by getgid()?"
12034         . ./myread
12035         gidtype="$ans"
12036         ;;
12037 esac
12038
12039 echo " "
12040 case "$gidtype" in
12041 *_t) zzz="$gidtype"     ;;
12042 *)   zzz="gid"          ;;
12043 esac
12044 echo "Checking the size of $zzz..." >&4 
12045 cat > try.c <<EOCP
12046 #include <sys/types.h>
12047 #include <stdio.h>
12048 int main() {
12049     printf("%d\n", (int)sizeof($gidtype));
12050     exit(0);
12051 }
12052 EOCP
12053 set try
12054 if eval $compile_ok; then
12055         yyy=`./try`
12056         case "$yyy" in
12057         '')     gidsize=4
12058                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12059                 ;;
12060         *)      gidsize=$yyy
12061                 echo "Your $zzz size is $gidsize bytes."
12062                 ;;
12063         esac
12064 else
12065         gidsize=4
12066         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12067 fi
12068
12069
12070 echo " "
12071 case "$gidtype" in
12072 *_t) zzz="$gidtype"     ;;
12073 *)   zzz="gid"          ;;
12074 esac
12075 echo "Checking the sign of $zzz..." >&4 
12076 cat > try.c <<EOCP
12077 #include <sys/types.h>
12078 #include <stdio.h>
12079 int main() {
12080         $gidtype foo = -1;
12081         if (foo < 0)
12082                 printf("-1\n");
12083         else
12084                 printf("1\n");
12085 }
12086 EOCP
12087 set try
12088 if eval $compile; then
12089         yyy=`./try`
12090         case "$yyy" in
12091         '')     gidsign=1
12092                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12093                 ;;
12094         *)      gidsign=$yyy
12095                 case "$gidsign" in
12096                  1) echo "Your $zzz is unsigned." ;;
12097                 -1) echo "Your $zzz is signed."   ;;
12098                 esac
12099                 ;;
12100         esac
12101 else
12102         gidsign=1
12103         echo "(I can't compile the test program--guessing unsigned.)" >&4
12104 fi
12105
12106
12107 : check for length of character
12108 echo " "
12109 case "$charsize" in
12110 '')
12111         echo "Checking to see how big your characters are (hey, you never know)..." >&4
12112         $cat >try.c <<'EOCP'
12113 #include <stdio.h>
12114 int main()
12115 {
12116     printf("%d\n", (int)sizeof(char));
12117     exit(0);
12118 }
12119 EOCP
12120         set try
12121         if eval $compile_ok; then
12122                 dflt=`./try`
12123         else
12124                 dflt='1'
12125                 echo "(I can't seem to compile the test program.  Guessing...)"
12126         fi
12127         ;;
12128 *)
12129         dflt="$charsize"
12130         ;;
12131 esac
12132 rp="What is the size of a character (in bytes)?"
12133 . ./myread
12134 charsize="$ans"
12135 $rm -f try.c try
12136
12137
12138 echo " "
12139 $echo "Choosing the C types to be used for Perl's internal types..." >&4
12140
12141 case "$use64bits:$d_quad:$quadtype" in
12142 define:define:?*)
12143         ivtype="$quadtype"
12144         uvtype="$uquadtype"
12145         ivsize=8
12146         uvsize=8
12147         ;;
12148 *)      ivtype="long"
12149         uvtype="unsigned long"
12150         ivsize=$longsize
12151         uvsize=$longsize
12152         ;;
12153 esac
12154
12155 case "$uselongdouble:$d_longdbl" in
12156 define:define)
12157         nvtype="long double"
12158         nvsize=$longdblsize
12159         ;;
12160 *)      nvtype=double
12161         nvsize=$doublesize
12162         ;;
12163 esac
12164
12165 echo "(IV will be "$ivtype", $ivsize bytes)"
12166 echo "(UV will be "$uvtype", $uvsize bytes)"
12167 echo "(NV will be "$nvtype", $nvsize bytes)"
12168
12169 $cat >try.c <<EOCP
12170 #$i_inttypes I_INTTYPES
12171 #ifdef I_INTTYPES
12172 #include <inttypes.h>
12173 #endif
12174 #include <stdio.h>
12175 int main() {
12176 #ifdef INT8
12177    int8_t i =  INT8_MAX;
12178   uint8_t u = UINT8_MAX;
12179   printf("int8_t\n");
12180 #endif
12181 #ifdef INT16
12182    int16_t i =  INT16_MAX;
12183   uint16_t i = UINT16_MAX;
12184   printf("int16_t\n");
12185 #endif
12186 #ifdef INT32
12187    int32_t i =  INT32_MAX;
12188   uint32_t u = UINT32_MAX;
12189   printf("int32_t\n");
12190 #endif
12191 }
12192 EOCP
12193
12194 case "$i8type" in
12195 '')     case "$charsize" in
12196         1)      i8type=char
12197                 u8type="unsigned char"
12198                 i8size=$charsize
12199                 u8size=$charsize
12200                 ;;
12201         esac
12202         ;;
12203 esac
12204 case "$i8type" in
12205 '')     set try -DINT8
12206         if eval $compile; then
12207                 case "`./try$exe_ext`" in
12208                 int8_t) i8type=int8_t
12209                         u8type=uint8_t
12210                         i8size=1
12211                         u8size=1
12212                         ;;
12213                 esac
12214         fi
12215         ;;
12216 esac
12217 case "$i8type" in
12218 '')     if $test $charsize -ge 1; then
12219                 i8type=char
12220                 u8type="unsigned char"
12221                 i8size=$charsize
12222                 u8size=$charsize
12223         fi
12224         ;;
12225 esac
12226
12227 case "$i16type" in
12228 '')     case "$shortsize" in
12229         2)      i16type=short
12230                 u16type="unsigned short"
12231                 i16size=$shortsize
12232                 u16size=$shortsize
12233                 ;;
12234         esac
12235         ;;
12236 esac
12237 case "$i16type" in
12238 '')     set try -DINT16
12239         if eval $compile; then
12240                 case "`./try$exe_ext`" in
12241                 int16_t)
12242                         i16type=int16_t
12243                         u16type=uint16_t
12244                         i16size=2
12245                         u16size=2
12246                         ;;
12247                 esac
12248         fi
12249         ;;
12250 esac
12251 case "$i16type" in
12252 '')     if $test $shortsize -ge 2; then
12253                 i16type=short
12254                 u16type="unsigned short"
12255                 i16size=$shortsize
12256                 u16size=$shortsize
12257         fi
12258         ;;
12259 esac
12260
12261 case "$i32type" in
12262 '')     case "$longsize" in
12263         4)      i32type=long
12264                 u32type="unsigned long"
12265                 i32size=$longsize
12266                 u32size=$longsize
12267                 ;;
12268         *)      case "$intsize" in
12269                 4)      i32type=int
12270                         u32type="unsigned int"
12271                         i32size=$intsize
12272                         u32size=$intsize
12273                         ;;
12274                 esac
12275                 ;;
12276         esac
12277         ;;
12278 esac
12279 case "$i32type" in
12280 '')     set try -DINT32
12281         if eval $compile; then
12282                 case "`./try$exe_ext`" in
12283                 int32_t)
12284                         i32type=int32_t
12285                         u32type=uint32_t
12286                         i32size=4
12287                         u32size=4
12288                         ;;
12289                 esac
12290         fi
12291         ;;
12292 esac
12293 case "$i32type" in
12294 '')     if $test $intsize -ge 4; then
12295                 i32type=int
12296                 u32type="unsigned int"
12297                 i32size=$intsize
12298                 u32size=$intsize
12299         fi
12300         ;;
12301 esac
12302
12303 case "$i64type" in
12304 '')     case "$d_quad:$quadtype" in
12305         define:?*)
12306                 i64type="$quadtype"
12307                 u64type="$uquadtype"
12308                 i64size=8
12309                 u64size=8
12310                 ;;
12311         esac
12312         ;;
12313 esac
12314
12315 $rm -f try.* try
12316
12317 echo " "
12318
12319 if $test X"$quadtype" != X; then
12320
12321 echo "Checking how to print 64-bit integers..." >&4
12322
12323 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12324         $cat >try.c <<'EOCP'
12325 #include <sys/types.h>
12326 #include <stdio.h>
12327 int main() {
12328   int q = 12345678901;
12329   printf("%ld\n", q);
12330 }
12331 EOCP
12332         set try
12333         if eval $compile; then
12334                 yyy=`./try$exe_ext`
12335                 case "$yyy" in
12336                 12345678901)
12337                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12338                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12339                         echo "We will use %d."
12340                         ;;
12341                 esac
12342         fi
12343 fi
12344
12345 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12346         $cat >try.c <<'EOCP'
12347 #include <sys/types.h>
12348 #include <stdio.h>
12349 int main() {
12350   long q = 12345678901;
12351   printf("%ld\n", q);
12352 }
12353 EOCP
12354         set try
12355         if eval $compile; then
12356                 yyy=`./try$exe_ext`
12357                 case "$yyy" in
12358                 12345678901)
12359                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12360                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12361                         echo "We will use %ld."
12362                         ;;
12363                 esac
12364         fi
12365 fi
12366
12367 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12368         $cat >try.c <<'EOCP'
12369 #include <sys/types.h>
12370 #include <inttypes.h>
12371 #include <stdio.h>
12372 int main() {
12373   int64_t q = 12345678901;
12374   printf("%" PRId64 "\n", q);
12375 }
12376 EOCP
12377         set try
12378         if eval $compile; then
12379                 yyy=`./try$exe_ext`
12380                 case "$yyy" in
12381                 12345678901)
12382                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12383                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12384                         echo "We will use the C9X style."
12385                         ;;
12386                 esac
12387         fi
12388 fi
12389
12390 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12391         $cat >try.c <<'EOCP'
12392 #include <sys/types.h>
12393 #include <stdio.h>
12394 int main() {
12395   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12396   printf("%lld\n", q);
12397 }
12398 EOCP
12399         set try
12400         if eval $compile; then
12401                 yyy=`./try$exe_ext`
12402                 case "$yyy" in
12403                 12345678901)
12404                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12405                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12406                         echo "We will use the %lld style."
12407                         ;;
12408                 esac
12409         fi
12410 fi
12411
12412 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12413         $cat >try.c <<EOCP
12414 #include <sys/types.h>
12415 #include <stdio.h>
12416 int main() {
12417   $quadtype q = 12345678901;
12418   printf("%Ld\n", q);
12419 }
12420 EOCP
12421         set try
12422         if eval $compile; then
12423                 yyy=`./try$exe_ext`
12424                 case "$yyy" in
12425                 12345678901)
12426                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12427                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12428                         echo "We will use %Ld."
12429                         ;;
12430                 esac
12431         fi
12432 fi
12433
12434 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12435         $cat >try.c <<EOCP
12436 #include <sys/types.h>
12437 #include <stdio.h>
12438 int main() {
12439   $quadtype q = 12345678901;
12440   printf("%qd\n", q);
12441 }
12442 EOCP
12443         set try
12444         if eval $compile; then
12445                 yyy=`./try$exe_ext`
12446                 case "$yyy" in
12447                 12345678901)
12448                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12449                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12450                         echo "We will use %qd."
12451                         ;;
12452                 esac
12453         fi
12454 fi
12455
12456 if $test X"$sPRId64" = X; then
12457         echo "Cannot figure out how to print 64-bit integers." >&4
12458 fi
12459
12460 $rm -f try try.*
12461
12462 fi
12463
12464 case "$sPRId64" in
12465 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12466         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12467         ;;
12468 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12469         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12470         ;;
12471 esac
12472
12473
12474 echo " "
12475 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12476
12477 if $test X"$ivsize" = X8; then
12478         ivdformat="$sPRId64"
12479         uvuformat="$sPRIu64"
12480         uvoformat="$sPRIo64"
12481         uvxformat="$sPRIx64"
12482 else
12483         if $test X"$ivsize" = X"$longsize"; then
12484                 ivdformat='"ld"'
12485                 uvuformat='"lu"'
12486                 uvoformat='"lo"'
12487                 uvxformat='"lx"'
12488         else
12489                 if $test X"$ivsize" = X"$intsize"; then
12490                         ivdformat='"d"'
12491                         uvuformat='"u"'
12492                         uvoformat='"o"'
12493                         uvxformat='"x"'
12494                 else
12495                         : far out
12496                         if $test X"$ivsize" = X"$shortsize"; then
12497                                 ivdformat='"hd"'
12498                                 uvuformat='"hu"'
12499                                 uvoformat='"ho"'
12500                                 uvxformat='"hx"'
12501                         fi
12502                 fi
12503         fi
12504 fi
12505
12506 case "$ivdformat" in
12507 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12508     exit 1
12509     ;;
12510 esac
12511
12512
12513 echo " "
12514 $echo "Checking the format string to be used for gids..." >&4
12515
12516 case "$gidsign" in
12517 -1)     if $test X"$gidsize" = X"$ivsize"; then
12518                 gidformat="$ivdformat"
12519         else
12520                 if $test X"$gidsize" = X"$longsize"; then
12521                         gidformat='"ld"'
12522                 else
12523                         if $test X"$gidsize" = X"$intsize"; then
12524                                 gidformat='"d"'
12525                         else
12526                                 if $test X"$gidsize" = X"$shortsize"; then
12527                                         gidformat='"hd"'
12528                                 fi
12529                         fi
12530                 fi
12531         fi
12532         ;;
12533 *)      if $test X"$gidsize" = X"$uvsize"; then
12534                 gidformat="$uvuformat"
12535         else
12536                 if $test X"$gidsize" = X"$longsize"; then
12537                         gidformat='"lu"'
12538                 else
12539                         if $test X"$gidsize" = X"$intsize"; then
12540                                 gidformat='"u"'
12541                         else
12542                                 if $test X"$gidsize" = X"$shortsize"; then
12543                                         gidformat='"hu"'
12544                                 fi
12545                         fi
12546                 fi
12547         fi
12548         ;;
12549 esac
12550
12551 : see if getgroups exists
12552 set getgroups d_getgrps
12553 eval $inlibc
12554
12555 : see if setgroups exists
12556 set setgroups d_setgrps
12557 eval $inlibc
12558
12559
12560 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12561 echo " "
12562 case "$d_getgrps$d_setgrps" in
12563 *define*)
12564         case "$groupstype" in
12565         '') dflt="$gidtype" ;;
12566         *)  dflt="$groupstype" ;;
12567         esac
12568         $cat <<EOM
12569 What type of pointer is the second argument to getgroups() and setgroups()?
12570 Usually this is the same as group ids, $gidtype, but not always.
12571
12572 EOM
12573         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12574         . ./myread
12575         groupstype="$ans"
12576         ;;
12577 *)  groupstype="$gidtype";;
12578 esac
12579
12580 echo " "
12581 echo "Checking if your $make program sets \$(MAKE)..." >&4
12582 case "$make_set_make" in
12583 '')
12584         $sed 's/^X //' > testmake.mak << 'EOF'
12585 Xall:
12586 X       @echo 'maketemp="$(MAKE)"'
12587 EOF
12588         case "`$make -f testmake.mak 2>/dev/null`" in
12589         *maketemp=*) make_set_make='#' ;;
12590         *)      make_set_make="MAKE=$make" ;;
12591         esac
12592         $rm -f testmake.mak
12593         ;;
12594 esac
12595 case "$make_set_make" in
12596 '#') echo "Yup, it does.";;
12597 *) echo "Nope, it doesn't.";;
12598 esac
12599
12600 : see what type is used for mode_t
12601 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12602 set mode_t modetype int stdio.h sys/types.h
12603 eval $typedef_ask
12604
12605 : define a fucntion to check prototypes
12606 $cat > protochk <<EOSH
12607 $startsh
12608 cc="$cc"
12609 optimize="$optimize"
12610 ccflags="$ccflags"
12611 prototype="$prototype"
12612 define="$define"
12613 rm=$rm
12614 EOSH
12615
12616 $cat >> protochk <<'EOSH'
12617
12618 $rm -f try.c
12619 foo="$1"
12620 shift
12621 while test $# -ge 2; do
12622         case "$1" in
12623                 $define) echo "#include <$2>" >> try.c ;;
12624                 literal) echo "$2" >> try.c ;;
12625         esac
12626     shift 2
12627 done
12628 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12629 cat >> try.c <<'EOCP'
12630 #ifdef CAN_PROTOTYPE
12631 #define _(args) args
12632 #else
12633 #define _(args) ()
12634 #endif
12635 EOCP
12636 echo "$foo" >> try.c
12637 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12638 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12639 status=$?
12640 $rm -f try.[co]
12641 exit $status
12642 EOSH
12643 chmod +x protochk
12644 $eunicefix protochk
12645
12646 : see what type is used for size_t
12647 rp="What is the type used for the length parameter for string functions?"
12648 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12649 eval $typedef_ask
12650
12651 : check for type of arguments to gethostbyaddr. 
12652 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12653         case "$d_gethbyaddr" in
12654         $define)
12655                 $cat <<EOM
12656
12657 Checking to see what type of arguments are accepted by gethostbyaddr().
12658 EOM
12659                 hdrs="$define sys/types.h
12660                         $d_socket sys/socket.h 
12661                         $i_niin netinet/in.h 
12662                         $i_netdb netdb.h
12663                         $i_unistd unistd.h"
12664                 : The first arg can 'char *' or 'void *'
12665                 : The second arg is some of integral type
12666                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12667                         for yyy in size_t long int; do
12668                                 case "$netdb_host_type" in
12669                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12670                                         if ./protochk "$try" $hdrs; then
12671                                                 echo "Your system accepts $xxx for the first arg."
12672                                                 echo "...and $yyy for the second arg."
12673                                                 netdb_host_type="$xxx"
12674                                                 netdb_hlen_type="$yyy"
12675                                         fi
12676                                         ;;
12677                                 esac
12678                         done
12679                 done
12680                 : In case none of those worked, prompt the user.
12681                 case "$netdb_host_type" in
12682                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12683                         dflt='char *'
12684                         . ./myread
12685                         netdb_host_type=$ans
12686                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12687                         dflt="$sizetype"
12688                         . ./myread
12689                         netdb_hlen_type=$ans
12690                         ;;
12691                 esac
12692                 ;;
12693         *)      : no gethostbyaddr, so pick harmless defaults
12694                 netdb_host_type='char *'
12695                 netdb_hlen_type="$sizetype"
12696                 ;;
12697         esac
12698         # Remove the "const" if needed. -- but then we'll have a 
12699         # prototype clash!
12700         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12701 fi
12702
12703 : check for type of argument to gethostbyname. 
12704 if test "X$netdb_name_type" = X ; then
12705         case "$d_gethbyname" in
12706         $define)
12707                 $cat <<EOM
12708
12709 Checking to see what type of argument is accepted by gethostbyname().
12710 EOM
12711                 hdrs="$define sys/types.h
12712                         $d_socket sys/socket.h 
12713                         $i_niin netinet/in.h 
12714                         $i_netdb netdb.h
12715                         $i_unistd unistd.h"
12716                 for xxx in "const char *" "char *"; do
12717                         case "$netdb_name_type" in
12718                         '')     try="extern struct hostent *gethostbyname($xxx);"
12719                                 if ./protochk "$try" $hdrs; then
12720                                         echo "Your system accepts $xxx."
12721                                         netdb_name_type="$xxx"
12722                                 fi
12723                                 ;;
12724                         esac
12725                 done
12726                 : In case none of those worked, prompt the user.
12727                 case "$netdb_name_type" in
12728                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12729                         dflt='char *'
12730                         . ./myread
12731                         netdb_name_type=$ans
12732                         ;;
12733                 esac
12734                 ;;
12735         *)      : no gethostbyname, so pick harmless default
12736                 netdb_name_type='char *'
12737                 ;;
12738         esac
12739 fi
12740
12741 : check for type of 1st argument to getnetbyaddr. 
12742 if test "X$netdb_net_type" = X ; then
12743         case "$d_getnbyaddr" in
12744         $define)
12745                 $cat <<EOM
12746
12747 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12748 EOM
12749                 hdrs="$define sys/types.h
12750                         $d_socket sys/socket.h 
12751                         $i_niin netinet/in.h 
12752                         $i_netdb netdb.h
12753                         $i_unistd unistd.h"
12754                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12755                         case "$netdb_net_type" in
12756                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12757                                 if ./protochk "$try" $hdrs; then
12758                                         echo "Your system accepts $xxx."
12759                                         netdb_net_type="$xxx"
12760                                 fi
12761                                 ;;
12762                         esac
12763                 done
12764                 : In case none of those worked, prompt the user.
12765                 case "$netdb_net_type" in
12766                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12767                         dflt='long'
12768                         . ./myread
12769                         netdb_net_type=$ans
12770                         ;;
12771                 esac
12772                 ;;
12773         *)      : no getnetbyaddr, so pick harmless default
12774                 netdb_net_type='long'
12775                 ;;
12776         esac
12777 fi
12778 : locate the preferred pager for this system
12779 case "$pager" in
12780 '')
12781         dflt=''
12782         case "$pg" in
12783         /*) dflt=$pg;;
12784         esac
12785         case "$more" in
12786         /*) dflt=$more;;
12787         esac
12788         case "$less" in
12789         /*) dflt=$less;;
12790         esac
12791         case "$dflt" in
12792         '') dflt=/usr/ucb/more;;
12793         esac
12794         ;;
12795 *) dflt="$pager";;
12796 esac
12797 echo " "
12798 fn=f/
12799 rp='What pager is used on your system?'
12800 . ./getfile
12801 pager="$ans"
12802
12803 : see what type pids are declared as in the kernel
12804 rp="What is the type of process ids on this system?"
12805 set pid_t pidtype int stdio.h sys/types.h
12806 eval $typedef_ask
12807
12808 : check for length of pointer
12809 echo " "
12810 case "$ptrsize" in
12811 '')
12812         $echo $n "Checking to see how big your pointers are...$c" >&4
12813         if test "$voidflags" -gt 7; then
12814                 echo '#define VOID_PTR char *' > try.c
12815         else
12816                 echo '#define VOID_PTR void *' > try.c
12817         fi
12818         $cat >>try.c <<'EOCP'
12819 #include <stdio.h>
12820 int main()
12821 {
12822     printf("%d\n", (int)sizeof(VOID_PTR));
12823     exit(0);
12824 }
12825 EOCP
12826         set try
12827         if eval $compile_ok; then
12828                 ptrsize=`./try`
12829                 $echo " $ptrsize bytes." >&4
12830         else
12831                 dflt='4'
12832                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12833                 rp="What is the size of a pointer (in bytes)?"
12834                 . ./myread
12835                 ptrsize="$ans"
12836         fi
12837         ;;
12838 esac
12839 $rm -f try.c try
12840
12841 : see if ar generates random libraries by itself
12842 echo " "
12843 echo "Checking how to generate random libraries on your machine..." >&4
12844 echo 'int bar1() { return bar2(); }' > bar1.c
12845 echo 'int bar2() { return 2; }' > bar2.c
12846 $cat > foo.c <<'EOP'
12847 int main() { printf("%d\n", bar1()); exit(0); }
12848 EOP
12849 $cc $ccflags -c bar1.c >/dev/null 2>&1
12850 $cc $ccflags -c bar2.c >/dev/null 2>&1
12851 $cc $ccflags -c foo.c >/dev/null 2>&1
12852 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12853 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12854         ./foobar >/dev/null 2>&1; then
12855         echo "$ar appears to generate random libraries itself."
12856         orderlib=false
12857         ranlib=":"
12858 elif $ar ts bar$_a >/dev/null 2>&1 &&
12859         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12860         ./foobar >/dev/null 2>&1; then
12861                 echo "a table of contents needs to be added with '$ar ts'."
12862                 orderlib=false
12863                 ranlib="$ar ts"
12864 else
12865         case "$ranlib" in
12866         :) ranlib='';;
12867         '')
12868                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12869                 $test -f $ranlib || ranlib=''
12870                 ;;
12871         esac
12872         if $test -n "$ranlib"; then
12873                 echo "your system has '$ranlib'; we'll use that."
12874                 orderlib=false
12875         else
12876                 echo "your system doesn't seem to support random libraries"
12877                 echo "so we'll use lorder and tsort to order the libraries."
12878                 orderlib=true
12879                 ranlib=":"
12880         fi
12881 fi
12882 $rm -f foo* bar* 
12883
12884 : check for type of arguments to select. 
12885 case "$selecttype" in
12886 '') case "$d_select" in
12887         $define)
12888                 $cat <<EOM
12889 Checking to see what type of arguments are accepted by select().
12890 EOM
12891                 hdrs="$define sys/types.h
12892                         $i_systime sys/time.h 
12893                         $i_sysselct sys/select.h
12894                         $d_socket sys/socket.h"
12895                 : The first arg can be int, unsigned, or size_t
12896                 : The last arg may or may not be 'const'
12897                 val=''
12898                 : void pointer has been seen but using that
12899                 : breaks the selectminbits test
12900                 for xxx in 'fd_set *' 'int *'; do
12901                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12902                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12903                                         case "$val" in
12904                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12905                                                 if ./protochk "$try" $hdrs; then
12906                                                         echo "Your system accepts $xxx."
12907                                                         val="$xxx"
12908                                                 fi
12909                                                 ;;
12910                                         esac
12911                                 done
12912                         done
12913                 done
12914                 case "$val" in
12915                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12916                         case "$d_fd_set" in
12917                                 $define) dflt="fd_set *" ;;
12918                                 *)              dflt="int *" ;;
12919                         esac
12920                         . ./myread
12921                         val=$ans
12922                         ;;
12923                 esac
12924                 selecttype="$val"
12925                 ;;
12926         *)      : no select, so pick a harmless default
12927                 selecttype='int *'
12928                 ;;
12929         esac
12930         ;;
12931 esac
12932
12933 : check for the select 'width'
12934 case "$selectminbits" in
12935 '') case "$d_select" in
12936         $define)
12937                 $cat <<EOM
12938
12939 Checking to see on how many bits at a time your select() operates...
12940 EOM
12941                 $cat >try.c <<EOCP
12942 #include <sys/types.h>
12943 #$i_time I_TIME
12944 #$i_systime I_SYS_TIME
12945 #$i_systimek I_SYS_TIME_KERNEL
12946 #ifdef I_TIME
12947 #   include <time.h>
12948 #endif
12949 #ifdef I_SYS_TIME
12950 #   ifdef I_SYS_TIME_KERNEL
12951 #       define KERNEL
12952 #   endif
12953 #   include <sys/time.h>
12954 #   ifdef I_SYS_TIME_KERNEL
12955 #       undef KERNEL
12956 #   endif
12957 #endif
12958 #$i_sysselct I_SYS_SELECT
12959 #ifdef I_SYS_SELECT
12960 #include <sys/select.h>
12961 #endif
12962 #$d_socket HAS_SOCKET
12963 #ifdef HAS_SOCKET
12964 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12965 #endif
12966 #include <stdio.h>
12967 $selecttype b;
12968 #define S sizeof(*(b))
12969 #define MINBITS 64
12970 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12971 #define NBITS  (NBYTES * 8)
12972 int main() {
12973     char s[NBYTES];
12974     struct timeval t;
12975     int i;
12976     FILE* fp;
12977     int fd;
12978
12979     fclose(stdin);
12980     fp = fopen("try.c", "r");
12981     if (fp == 0)
12982       exit(1);
12983     fd = fileno(fp);
12984     if (fd < 0)
12985       exit(2);
12986     b = ($selecttype)s;
12987     for (i = 0; i < NBITS; i++)
12988         FD_SET(i, b);
12989     t.tv_sec  = 0;
12990     t.tv_usec = 0;
12991     select(fd + 1, b, 0, 0, &t);
12992     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12993     printf("%d\n", i + 1);
12994     return 0;
12995 }
12996 EOCP
12997                 set try
12998                 if eval $compile_ok; then
12999                         selectminbits=`./try`
13000                         case "$selectminbits" in
13001                         '')     cat >&4 <<EOM
13002 Cannot figure out on how many bits at a time your select() operates.
13003 I'll play safe and guess it is 32 bits.
13004 EOM
13005                                 selectminbits=32
13006                                 bits="32 bits"
13007                                 ;;
13008                         1)      bits="1 bit" ;;
13009                         *)      bits="$selectminbits bits" ;;
13010                         esac
13011                         echo "Your select() operates on $bits at a time." >&4
13012                 else
13013                         rp='What is the minimum number of bits your select() operates on?'
13014                         case "$byteorder" in
13015                         1234|12345678)  dflt=32 ;;
13016                         *)              dflt=1  ;;
13017                         esac
13018                         . ./myread
13019                         val=$ans
13020                         selectminbits="$val"
13021                 fi
13022                 $rm -f try.* try
13023                 ;;
13024         *)      : no select, so pick a harmless default
13025                 selectminbits='32'
13026                 ;;
13027         esac
13028         ;;
13029 esac
13030
13031 : Trace out the files included by signal.h, then look for SIGxxx names.
13032 : Remove SIGARRAYSIZE used by HPUX.
13033 : Remove SIGSTKSIZE used by Linux.
13034 : Remove SIGSTKSZ used by Posix.
13035 : Remove SIGTYP void lines used by OS2.
13036 : Some cpps, like os390, dont give the file name anywhere
13037 if [ "X$fieldn" = X ]; then
13038         : Just make some guesses.  We check them later.
13039         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13040 else
13041         xxx=`echo '#include <signal.h>' |
13042         $cppstdin $cppminus $cppflags 2>/dev/null |
13043         $grep '^[       ]*#.*include' | 
13044         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13045 fi
13046 : Check this list of files to be sure we have parsed the cpp output ok.
13047 : This will also avoid potentially non-existent files, such 
13048 : as ../foo/bar.h
13049 xxxfiles=''
13050 for xx in $xxx /dev/null ; do
13051         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13052 done
13053 : If we have found no files, at least try signal.h
13054 case "$xxxfiles" in
13055 '')     xxxfiles=`./findhdr signal.h` ;;
13056 esac
13057 xxx=`awk '
13058 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13059         print substr($2, 4, 20)
13060 }
13061 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13062         print substr($3, 4, 20)
13063 }' $xxxfiles`
13064 : Append some common names just in case the awk scan failed.
13065 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13066 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13067 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13068 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13069 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13070
13071 : generate a few handy files for later
13072 $cat > signal.c <<'EOCP'
13073 #include <sys/types.h>
13074 #include <signal.h>
13075 #include <stdio.h>
13076 int main() {
13077
13078 /* Strange style to avoid deeply-nested #if/#else/#endif */
13079 #ifndef NSIG
13080 #  ifdef _NSIG
13081 #    define NSIG (_NSIG)
13082 #  endif
13083 #endif
13084
13085 #ifndef NSIG
13086 #  ifdef SIGMAX
13087 #    define NSIG (SIGMAX+1)
13088 #  endif
13089 #endif
13090
13091 #ifndef NSIG
13092 #  ifdef SIG_MAX
13093 #    define NSIG (SIG_MAX+1)
13094 #  endif
13095 #endif
13096
13097 #ifndef NSIG
13098 #  ifdef MAXSIG
13099 #    define NSIG (MAXSIG+1)
13100 #  endif
13101 #endif
13102
13103 #ifndef NSIG
13104 #  ifdef MAX_SIG
13105 #    define NSIG (MAX_SIG+1)
13106 #  endif
13107 #endif
13108
13109 #ifndef NSIG
13110 #  ifdef SIGARRAYSIZE
13111 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13112 #  endif
13113 #endif
13114
13115 #ifndef NSIG
13116 #  ifdef _sys_nsig
13117 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13118 #  endif
13119 #endif
13120
13121 /* Default to some arbitrary number that's big enough to get most
13122    of the common signals.
13123 */
13124 #ifndef NSIG
13125 #    define NSIG 50
13126 #endif
13127
13128 printf("NSIG %d\n", NSIG);
13129
13130 #ifndef JUST_NSIG
13131
13132 EOCP
13133
13134 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13135 {
13136         printf "#ifdef SIG"; printf $1; printf "\n"
13137         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13138         printf $1; printf ");\n"
13139         printf "#endif\n"
13140 }
13141 END {
13142         printf "#endif /* JUST_NSIG */\n";
13143         printf "exit(0);\n}\n";
13144 }
13145 ' >>signal.c
13146 $cat >signal.awk <<'EOP'
13147 BEGIN { ndups = 0 }
13148 $1 ~ /^NSIG$/ { nsig = $2 }
13149 ($1 !~ /^NSIG$/) && (NF == 2) {
13150     if ($2 > maxsig) { maxsig = $2 }
13151     if (sig_name[$2]) {
13152         dup_name[ndups] = $1
13153         dup_num[ndups] = $2
13154         ndups++ 
13155     }
13156     else {
13157         sig_name[$2] = $1
13158         sig_num[$2] = $2
13159     }
13160 }
13161 END { 
13162     if (nsig == 0) {
13163         nsig = maxsig + 1
13164     }
13165     printf("NSIG %d\n", nsig);
13166     for (n = 1; n < nsig; n++) {
13167         if (sig_name[n]) {
13168             printf("%s %d\n", sig_name[n], sig_num[n])
13169         }
13170         else {
13171             printf("NUM%d %d\n", n, n) 
13172         }
13173     }
13174     for (n = 0; n < ndups; n++) {
13175         printf("%s %d\n", dup_name[n], dup_num[n])
13176     }
13177 }
13178 EOP
13179 $cat >signal_cmd <<EOS
13180 $startsh
13181 if $test -s signal.lst; then
13182     echo "Using your existing signal.lst file"
13183         exit 0
13184 fi
13185 xxx="$xxx"
13186 EOS
13187 $cat >>signal_cmd <<'EOS'
13188
13189 set signal
13190 if eval $compile_ok; then
13191         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13192 else
13193         echo "(I can't seem be able to compile the whole test program)" >&4
13194         echo "(I'll try it in little pieces.)" >&4
13195         set signal -DJUST_NSIG
13196         if eval $compile_ok; then
13197                 ./signal$_exe > signal.nsg
13198                 $cat signal.nsg
13199         else
13200                 echo "I can't seem to figure out how many signals you have." >&4
13201                 echo "Guessing 50." >&4
13202                 echo 'NSIG 50' > signal.nsg
13203         fi
13204         : Now look at all the signal names, one at a time.
13205         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13206                 $cat > signal.c <<EOCP
13207 #include <sys/types.h>
13208 #include <signal.h>
13209 #include <stdio.h>
13210 int main() {
13211 printf("$xx %d\n", SIG${xx});
13212 return 0;
13213 }
13214 EOCP
13215                 set signal
13216                 if eval $compile; then
13217                         echo "SIG${xx} found."
13218                         ./signal$_exe  >> signal.ls1
13219                 else
13220                         echo "SIG${xx} NOT found."
13221                 fi
13222         done
13223         if $test -s signal.ls1; then
13224                 $cat signal.nsg signal.ls1 |
13225                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13226         fi
13227
13228 fi
13229 if $test -s signal.lst; then
13230         :
13231 else
13232         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13233         echo 'kill -l' >signal
13234         set X `csh -f <signal`
13235         $rm -f signal
13236         shift
13237         case $# in
13238         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13239         esac
13240         echo $@ | $tr ' ' $trnl | \
13241             $awk '{ printf "%s %d\n", $1, ++s; }
13242                   END { printf "NSIG %d\n", ++s }' >signal.lst
13243 fi
13244 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13245 EOS
13246 chmod a+x signal_cmd
13247 $eunicefix signal_cmd
13248
13249 : generate list of signal names
13250 echo " "
13251 case "$sig_name_init" in
13252 '') doinit=yes ;;
13253 *)  case "$sig_num_init" in
13254     ''|*,*) doinit=yes ;;
13255     esac ;;
13256 esac
13257 case "$doinit" in
13258 yes)
13259         echo "Generating a list of signal names and numbers..." >&4
13260         . ./signal_cmd
13261         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13262         sig_name=`$awk 'BEGIN { printf "ZERO " }
13263                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13264         sig_num=`$awk  'BEGIN { printf "0 " }
13265                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13266         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13267                              !/^NSIG/   { printf "\"%s\", ", $1 }
13268                              END        { printf "0\n" }' signal.lst`
13269         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13270                              !/^NSIG/   { printf "%d, ", $2}
13271                              END        { printf "0\n"}' signal.lst`
13272         ;;
13273 esac
13274 echo "The following $sig_count signals are available:"
13275 echo " "
13276 echo $sig_name | $awk \
13277 'BEGIN { linelen = 0 }
13278 {
13279         for (i = 1; i <= NF; i++) {
13280                 name = "SIG" $i " "
13281                 linelen = linelen + length(name)
13282                 if (linelen > 70) {
13283                         printf "\n"
13284                         linelen = length(name)
13285                 }
13286                 printf "%s", name
13287         }
13288         printf "\n"
13289 }'
13290 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13291
13292 : see what type is used for signed size_t
13293 set ssize_t ssizetype int stdio.h sys/types.h
13294 eval $typedef
13295 dflt="$ssizetype"
13296 $cat > ssize.c <<EOM
13297 #include <stdio.h>
13298 #include <sys/types.h>
13299 #define Size_t $sizetype
13300 #define SSize_t $dflt
13301 int main()
13302 {
13303         if (sizeof(Size_t) == sizeof(SSize_t))
13304                 printf("$dflt\n");
13305         else if (sizeof(Size_t) == sizeof(int))
13306                 printf("int\n");
13307         else 
13308                 printf("long\n");
13309         exit(0);
13310 }
13311 EOM
13312 echo " "
13313 set ssize
13314 if eval $compile_ok && ./ssize > /dev/null; then
13315         ssizetype=`./ssize`
13316         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13317 else
13318         $cat >&4 <<EOM
13319 Help! I can't compile and run the ssize_t test program: please enlighten me!
13320 (This is probably a misconfiguration in your system or libraries, and
13321 you really ought to fix it.  Still, I'll try anyway.)
13322
13323 I need a type that is the same size as $sizetype, but is guaranteed to
13324 be signed.  Common values are ssize_t, int and long.
13325
13326 EOM
13327         rp="What signed type is the same size as $sizetype?"
13328         . ./myread
13329         ssizetype="$ans"
13330 fi
13331 $rm -f ssize ssize.*
13332
13333 : see what type of char stdio uses.
13334 echo " "
13335 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13336         echo "Your stdio uses unsigned chars." >&4
13337         stdchar="unsigned char"
13338 else
13339         echo "Your stdio uses signed chars." >&4
13340         stdchar="char"
13341 fi
13342
13343 : see if time exists
13344 echo " "
13345 if test "X$d_time" = X -o X"$timetype" = X; then
13346     if set time val -f d_time; eval $csym; $val; then
13347                 echo 'time() found.' >&4
13348                 val="$define"
13349                 rp="What is the type returned by time() on this system?"
13350                 set time_t timetype long stdio.h sys/types.h
13351                 eval $typedef_ask
13352     else
13353                 echo 'time() not found, hope that will do.' >&4
13354                 val="$undef"
13355                 timetype='int';
13356     fi
13357     set d_time
13358     eval $setvar
13359 fi
13360
13361 : see what type uids are declared as in the kernel
13362 echo " "
13363 echo "Looking for the type for user ids returned by getuid()."
13364 set uid_t uidtype xxx stdio.h sys/types.h
13365 eval $typedef
13366 case "$uidtype" in
13367 xxx)
13368         xxx=`./findhdr sys/user.h`
13369         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13370         case $1 in
13371         unsigned) dflt="$1 $2" ;;
13372         *) dflt="$1" ;;
13373         esac
13374         ;;
13375 *) dflt="$uidtype";;
13376 esac
13377 case "$uidtype" in
13378 uid_t)  echo "uid_t found." ;;
13379 *)      rp="What is the type for user ids returned by getuid()?"
13380         . ./myread
13381         uidtype="$ans"
13382         ;;
13383 esac
13384
13385 echo " "
13386 case "$uidtype" in
13387 *_t) zzz="$uidtype"     ;;
13388 *)   zzz="uid"          ;;
13389 esac
13390 echo "Checking the size of $zzz..." >&4 
13391 cat > try.c <<EOCP
13392 #include <sys/types.h>
13393 #include <stdio.h>
13394 int main() {
13395     printf("%d\n", (int)sizeof($uidtype));
13396     exit(0);
13397 }
13398 EOCP
13399 set try
13400 if eval $compile_ok; then
13401         yyy=`./try`
13402         case "$yyy" in
13403         '')     uidsize=4
13404                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13405                 ;;
13406         *)      uidsize=$yyy
13407                 echo "Your $zzz size is $uidsize bytes."
13408                 ;;
13409         esac
13410 else
13411         uidsize=4
13412         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13413 fi
13414
13415 echo " "
13416 case "$uidtype" in
13417 *_t) zzz="$uidtype"     ;;
13418 *)   zzz="uid"          ;;
13419 esac
13420 echo "Checking the sign of $zzz..." >&4
13421 cat > try.c <<EOCP
13422 #include <sys/types.h>
13423 #include <stdio.h>
13424 int main() {
13425         $uidtype foo = -1;
13426         if (foo < 0)
13427                 printf("-1\n");
13428         else
13429                 printf("1\n");
13430 }
13431 EOCP
13432 set try
13433 if eval $compile; then
13434         yyy=`./try`
13435         case "$yyy" in
13436         '')     uidsign=1
13437                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13438                 ;;
13439         *)      uidsign=$yyy
13440                 case "$uidsign" in
13441                  1) echo "Your $zzz is unsigned." ;;
13442                 -1) echo "Your $zzz is signed."   ;;
13443                 esac
13444                 ;;
13445         esac
13446 else
13447         uidsign=1
13448         echo "(I can't compile the test program--guessing unsigned.)" >&4
13449 fi
13450
13451
13452
13453 echo " "
13454 $echo "Checking the format string to be used for uids..." >&4
13455
13456 case "$uidsign" in
13457 -1)     if $test X"$uidsize" = X"$ivsize"; then
13458                 uidformat="$ivdformat"
13459         else
13460                 if $test X"$uidsize" = X"$longsize"; then
13461                         uidformat='"ld"'
13462                 else
13463                         if $test X"$uidsize" = X"$intsize"; then
13464                                 uidformat='"d"'
13465                         else
13466                                 if $test X"$uidsize" = X"$shortsize"; then
13467                                         uidformat='"hd"'
13468                                 fi
13469                         fi
13470                 fi
13471         fi
13472         ;;
13473 *)      if $test X"$uidsize" = X"$uvsize"; then
13474                 uidformat="$uvuformat"
13475         else
13476                 if $test X"$uidsize" = X"$longsize"; then
13477                         uidformat='"lu"'
13478                 else
13479                         if $test X"$uidsize" = X"$intsize"; then
13480                                 uidformat='"u"'
13481                         else
13482                                 if $test X"$uidsize" = X"$shortsize"; then
13483                                         uidformat='"hu"'
13484                                 fi
13485                         fi
13486                 fi
13487         fi
13488         ;;
13489 esac
13490
13491 : see if dbm.h is available
13492 : see if dbmclose exists
13493 set dbmclose d_dbmclose
13494 eval $inlibc
13495
13496 case "$d_dbmclose" in
13497 $define)
13498         set dbm.h i_dbm
13499         eval $inhdr
13500         case "$i_dbm" in
13501         $define)
13502                 val="$undef"
13503                 set i_rpcsvcdbm
13504                 eval $setvar
13505                 ;;
13506         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13507                 eval $inhdr
13508                 ;;
13509         esac
13510         ;;
13511 *)      echo "We won't be including <dbm.h>"
13512         val="$undef"
13513         set i_dbm
13514         eval $setvar
13515         val="$undef"
13516         set i_rpcsvcdbm
13517         eval $setvar
13518         ;;
13519 esac
13520
13521 : see if this is a sys/file.h system
13522 val=''
13523 set sys/file.h val
13524 eval $inhdr
13525
13526 : do we need to include sys/file.h ?
13527 case "$val" in
13528 "$define")
13529         echo " "
13530         if $h_sysfile; then
13531                 val="$define"
13532                 echo "We'll be including <sys/file.h>." >&4
13533         else
13534                 val="$undef"
13535                 echo "We won't be including <sys/file.h>." >&4
13536         fi
13537         ;;
13538 *)
13539         h_sysfile=false
13540         ;;
13541 esac
13542 set i_sysfile
13543 eval $setvar
13544
13545 : see if fcntl.h is there
13546 val=''
13547 set fcntl.h val
13548 eval $inhdr
13549
13550 : see if we can include fcntl.h
13551 case "$val" in
13552 "$define")
13553         echo " "
13554         if $h_fcntl; then
13555                 val="$define"
13556                 echo "We'll be including <fcntl.h>." >&4
13557         else
13558                 val="$undef"
13559                 if $h_sysfile; then
13560         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13561                 else
13562                         echo "We won't be including <fcntl.h>." >&4
13563                 fi
13564         fi
13565         ;;
13566 *)
13567         h_fcntl=false
13568         val="$undef"
13569         ;;
13570 esac
13571 set i_fcntl
13572 eval $setvar
13573
13574 : see if locale.h is available
13575 set locale.h i_locale
13576 eval $inhdr
13577
13578 : see if mach cthreads are available
13579 if test "X$usethreads" = "X$define"; then
13580         set mach/cthreads.h i_machcthr
13581         eval $inhdr
13582 else
13583         i_machcthr="$undef"
13584 fi
13585
13586
13587
13588 : see if this is a math.h system
13589 set math.h i_math
13590 eval $inhdr
13591
13592 : see if this is a mntent.h system
13593 set mntent.h i_mntent
13594 eval $inhdr
13595
13596 : see if ndbm.h is available
13597 set ndbm.h t_ndbm
13598 eval $inhdr
13599 case "$t_ndbm" in
13600 $define)
13601         : see if dbm_open exists
13602         set dbm_open d_dbm_open
13603         eval $inlibc
13604         case "$d_dbm_open" in
13605         $undef)
13606                 t_ndbm="$undef"
13607                 echo "We won't be including <ndbm.h>"
13608                 ;;
13609         esac
13610         ;;
13611 esac
13612 val="$t_ndbm"
13613 set i_ndbm
13614 eval $setvar
13615
13616 : see if net/errno.h is available
13617 val=''
13618 set net/errno.h val
13619 eval $inhdr
13620
13621 : Unfortunately, it causes problems on some systems.  Arrgh.
13622 case "$val" in
13623 $define)
13624         cat > try.c <<'EOM'
13625 #include <stdio.h>
13626 #include <errno.h>
13627 #include <net/errno.h>
13628 int func()
13629 {
13630         return ENOTSOCK;
13631 }
13632 EOM
13633         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13634                 echo "We'll be including <net/errno.h>." >&4
13635         else
13636                 echo "We won't be including <net/errno.h>." >&4
13637                 val="$undef"
13638         fi
13639         $rm -f try.* try
13640         ;;
13641 esac
13642 set i_neterrno
13643 eval $setvar
13644
13645 : see if netinet/tcp.h is available
13646 set netinet/tcp.h i_netinettcp
13647 eval $inhdr
13648
13649 : see if this is a poll.h system
13650 set poll.h i_poll
13651 eval $inhdr
13652
13653 : get C preprocessor symbols handy
13654 echo " "
13655 $echo $n "Hmm... $c"
13656 echo $al | $tr ' ' $trnl >Cppsym.know
13657 $cat <<EOSS >Cppsym
13658 $startsh
13659 case "\$1" in
13660 -l) list=true
13661         shift
13662         ;;
13663 esac
13664 unknown=''
13665 case "\$list\$#" in
13666 1|2)
13667         for sym do
13668                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13669                         exit 0
13670                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13671                         :
13672                 else
13673                         unknown="\$unknown \$sym"
13674                 fi
13675         done
13676         set X \$unknown
13677         shift
13678         ;;
13679 esac
13680 case \$# in
13681 0) exit 1;;
13682 esac
13683 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13684 #ifdef \1\\
13685 exit 0; _ _ _ _\1\\      \1\\
13686 #endif\\
13687 /' >Cppsym\$\$
13688 echo "exit 1; _ _ _" >>Cppsym\$\$
13689 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13690 case "\$list" in
13691 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13692 *)
13693         sh Cppsym2\$\$
13694         status=\$?
13695         ;;
13696 esac
13697 $rm -f Cppsym\$\$ Cppsym2\$\$
13698 exit \$status
13699 EOSS
13700 chmod +x Cppsym
13701 $eunicefix Cppsym
13702 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13703
13704 : now check the C compiler for additional symbols
13705 postprocess_cc_v=''
13706 case "$osname" in
13707 aix) postprocess_cc_v="|$tr , ' '" ;;
13708 esac
13709 $cat >ccsym <<EOS
13710 $startsh
13711 $cat >tmp.c <<EOF
13712 extern int foo;
13713 EOF
13714 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13715 do
13716         case "\$i" in
13717         -D*) echo "\$i" | $sed 's/^-D//';;
13718         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13719         esac
13720 done
13721 $rm -f try.c
13722 EOS
13723 postprocess_cc_v=''
13724 chmod +x ccsym
13725 $eunicefix ccsym
13726 ./ccsym > ccsym1.raw
13727 if $test -s ccsym1.raw; then
13728        $sort ccsym1.raw | $uniq >ccsym.raw
13729 else
13730        mv ccsym1.raw ccsym.raw
13731 fi
13732
13733 $awk '/\=/ { print $0; next }
13734         { print $0"=1" }' ccsym.raw >ccsym.list
13735 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13736 $comm -13 ccsym.true ccsym.list >ccsym.own
13737 $comm -12 ccsym.true ccsym.list >ccsym.com
13738 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13739 also=''
13740 if $test -z ccsym.raw; then
13741         echo "Your C compiler doesn't seem to define any symbols!" >&4
13742         echo " "
13743         echo "However, your C preprocessor defines the following symbols:"
13744         $cat Cppsym.true
13745         ccsymbols=''
13746         cppsymbols=`$cat Cppsym.true`
13747         cppsymbols=`echo $cppsymbols`
13748         cppccsymbols="$cppsymbols"
13749 else
13750         if $test -s ccsym.com; then
13751                 echo "Your C compiler and pre-processor define these symbols:"
13752                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13753                 also='also '
13754                 symbols='ones'
13755                 cppccsymbols=`$cat ccsym.com`
13756                 cppccsymbols=`echo $cppccsymbols`
13757                 $test "$silent" || sleep 1
13758         fi
13759         if $test -s ccsym.cpp; then
13760                 $test "$also" && echo " "
13761                 echo "Your C pre-processor ${also}defines the following symbols:"
13762                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13763                 also='further '
13764                 cppsymbols=`$cat ccsym.cpp`
13765                 cppsymbols=`echo $cppsymbols`
13766                 $test "$silent" || sleep 1
13767         fi
13768         if $test -s ccsym.own; then
13769                 $test "$also" && echo " "
13770                 echo "Your C compiler ${also}defines the following cpp symbols:"
13771                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13772                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13773                 ccsymbols=`$cat ccsym.own`
13774                 ccsymbols=`echo $ccsymbols`
13775                 $test "$silent" || sleep 1
13776         fi
13777 fi
13778 $rm -f ccsym*
13779
13780 : see if this is a termio system
13781 val="$undef"
13782 val2="$undef"
13783 val3="$undef"
13784 if $test `./findhdr termios.h`; then
13785         set tcsetattr i_termios
13786         eval $inlibc
13787         val3="$i_termios"
13788 fi
13789 echo " "
13790 case "$val3" in
13791 "$define") echo "You have POSIX termios.h... good!" >&4;;
13792 *) if ./Cppsym pyr; then
13793                 case "`/bin/universe`" in
13794                 ucb) if $test `./findhdr sgtty.h`; then
13795                                 val2="$define"
13796                                 echo "<sgtty.h> found." >&4
13797                         else
13798                                 echo "System is pyramid with BSD universe."
13799                                 echo "<sgtty.h> not found--you could have problems." >&4
13800                         fi;;
13801                 *) if $test `./findhdr termio.h`; then
13802                                 val="$define"
13803                                 echo "<termio.h> found." >&4
13804                         else
13805                                 echo "System is pyramid with USG universe."
13806                                 echo "<termio.h> not found--you could have problems." >&4
13807                         fi;;
13808                 esac
13809         elif ./usg; then
13810                 if $test `./findhdr termio.h`; then
13811                         echo "<termio.h> found." >&4
13812                         val="$define"
13813                 elif $test `./findhdr sgtty.h`; then
13814                         echo "<sgtty.h> found." >&4
13815                         val2="$define"
13816                 else
13817 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13818                 fi
13819         else
13820                 if $test `./findhdr sgtty.h`; then
13821                         echo "<sgtty.h> found." >&4
13822                         val2="$define"
13823                 elif $test `./findhdr termio.h`; then
13824                         echo "<termio.h> found." >&4
13825                         val="$define"
13826                 else
13827 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13828                 fi
13829         fi;;
13830 esac
13831 set i_termio; eval $setvar
13832 val=$val2; set i_sgtty; eval $setvar
13833 val=$val3; set i_termios; eval $setvar
13834
13835 : see if this is a shadow.h system
13836 set shadow.h i_shadow
13837 eval $inhdr
13838
13839 : see if this is a socks.h system
13840 set socks.h i_socks
13841 eval $inhdr
13842
13843 : see if stdarg is available
13844 echo " "
13845 if $test `./findhdr stdarg.h`; then
13846         echo "<stdarg.h> found." >&4
13847         valstd="$define"
13848 else
13849         echo "<stdarg.h> NOT found." >&4
13850         valstd="$undef"
13851 fi
13852
13853 : see if varags is available
13854 echo " "
13855 if $test `./findhdr varargs.h`; then
13856         echo "<varargs.h> found." >&4
13857 else
13858         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13859 fi
13860
13861 : set up the varargs testing programs
13862 $cat > varargs.c <<EOP
13863 #ifdef I_STDARG
13864 #include <stdarg.h>
13865 #endif
13866 #ifdef I_VARARGS
13867 #include <varargs.h>
13868 #endif
13869
13870 #ifdef I_STDARG
13871 int f(char *p, ...)
13872 #else
13873 int f(va_alist)
13874 va_dcl
13875 #endif
13876 {
13877         va_list ap;
13878 #ifndef I_STDARG
13879         char *p;
13880 #endif
13881 #ifdef I_STDARG
13882         va_start(ap,p);
13883 #else
13884         va_start(ap);
13885         p = va_arg(ap, char *);
13886 #endif
13887         va_end(ap);
13888 }
13889 EOP
13890 $cat > varargs <<EOP
13891 $startsh
13892 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13893         echo "true"
13894 else
13895         echo "false"
13896 fi
13897 $rm -f varargs$_o
13898 EOP
13899 chmod +x varargs
13900
13901 : now check which varargs header should be included
13902 echo " "
13903 i_varhdr=''
13904 case "$valstd" in
13905 "$define")
13906         if `./varargs I_STDARG`; then
13907                 val='stdarg.h'
13908         elif `./varargs I_VARARGS`; then
13909                 val='varargs.h'
13910         fi
13911         ;;
13912 *)
13913         if `./varargs I_VARARGS`; then
13914                 val='varargs.h'
13915         fi
13916         ;;
13917 esac
13918 case "$val" in
13919 '')
13920 echo "I could not find the definition for va_dcl... You have problems..." >&4
13921         val="$undef"; set i_stdarg; eval $setvar
13922         val="$undef"; set i_varargs; eval $setvar
13923         ;;
13924 *) 
13925         set i_varhdr
13926         eval $setvar
13927         case "$i_varhdr" in
13928         stdarg.h)
13929                 val="$define"; set i_stdarg; eval $setvar
13930                 val="$undef"; set i_varargs; eval $setvar
13931                 ;;
13932         varargs.h)
13933                 val="$undef"; set i_stdarg; eval $setvar
13934                 val="$define"; set i_varargs; eval $setvar
13935                 ;;
13936         esac
13937         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13938 esac
13939 $rm -f varargs*
13940
13941 : see if stddef is available
13942 set stddef.h i_stddef
13943 eval $inhdr
13944
13945 : see if sys/access.h is available
13946 set sys/access.h i_sysaccess
13947 eval $inhdr
13948
13949 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13950 set sys/filio.h i_sysfilio
13951 eval $inhdr
13952 echo " "
13953 if $test `./findhdr sys/ioctl.h`; then
13954         val="$define"
13955         echo '<sys/ioctl.h> found.' >&4
13956 else
13957         val="$undef"
13958         if $test $i_sysfilio = "$define"; then
13959             echo '<sys/ioctl.h> NOT found.' >&4
13960         else
13961                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13962                 $test $i_termio = "$define" && xxx="termio.h"
13963                 $test $i_termios = "$define" && xxx="termios.h"
13964 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13965         fi
13966 fi
13967 set i_sysioctl
13968 eval $setvar
13969
13970 : see if sys/resource.h has to be included
13971 set sys/resource.h i_sysresrc
13972 eval $inhdr
13973
13974 : see if sys/security.h is available
13975 set sys/security.h i_syssecrt
13976 eval $inhdr
13977
13978 : see if this is a sys/statvfs.h system
13979 set sys/statvfs.h i_sysstatvfs
13980 eval $inhdr
13981
13982 : see if this is a sys/uio.h system
13983 set sys/uio.h i_sysuio
13984 eval $inhdr
13985
13986 : see if this is a sys/un.h system
13987 set sys/un.h i_sysun
13988 eval $inhdr
13989
13990 : see if this is a syswait system
13991 set sys/wait.h i_syswait
13992 eval $inhdr
13993
13994 : see if this is a ustat.h system
13995 set ustat.h i_ustat
13996 eval $inhdr
13997
13998 : see if this is an utime system
13999 set utime.h i_utime
14000 eval $inhdr
14001
14002 : see if this is a values.h system
14003 set values.h i_values
14004 eval $inhdr
14005
14006 : see if this is a vfork system
14007 case "$d_vfork" in
14008 "$define")
14009         set vfork.h i_vfork
14010         eval $inhdr
14011         ;;
14012 *)
14013         i_vfork="$undef"
14014         ;;
14015 esac
14016
14017 : see if gdbm.h is available
14018 set gdbm.h t_gdbm
14019 eval $inhdr
14020 case "$t_gdbm" in
14021 $define)
14022         : see if gdbm_open exists
14023         set gdbm_open d_gdbm_open
14024         eval $inlibc
14025         case "$d_gdbm_open" in
14026         $undef)
14027                 t_gdbm="$undef"
14028                 echo "We won't be including <gdbm.h>"
14029                 ;;
14030         esac
14031         ;;
14032 esac
14033 val="$t_gdbm"
14034 set i_gdbm
14035 eval $setvar
14036
14037 echo " "
14038 echo "Looking for extensions..." >&4
14039 : If we are using the old config.sh, known_extensions may contain
14040 : old or inaccurate or duplicate values.
14041 known_extensions=''
14042 nonxs_extensions=''
14043 : We do not use find because it might not be available.
14044 : We do not just use MANIFEST because the user may have dropped
14045 : some additional extensions into the source tree and expect them
14046 : to be built.
14047
14048 : Function to recursively find available extensions, ignoring DynaLoader
14049 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14050 find_extensions='
14051     for xxx in *; do
14052        case "$xxx" in
14053            DynaLoader|dynaload) ;;
14054            *)
14055            if $test -f $xxx/$xxx.xs; then
14056                known_extensions="$known_extensions $1$xxx";
14057            elif $test -f $xxx/Makefile.PL; then
14058                nonxs_extensions="$nonxs_extensions $1$xxx";
14059            else
14060                if $test -d $xxx -a $# -lt 10; then
14061                    set $1$xxx/ $*;
14062                    cd $xxx;
14063                    eval $find_extensions;
14064                    cd ..;
14065                    shift;
14066                fi;
14067            fi
14068            ;;
14069        esac;
14070     done'
14071 tdir=`pwd`
14072 cd $rsrc/ext
14073 set X
14074 shift
14075 eval $find_extensions
14076 set X $nonxs_extensions
14077 shift
14078 nonxs_extensions="$*"
14079 set X $known_extensions
14080 shift
14081 known_extensions="$*"
14082 cd $tdir
14083
14084 : Now see which are supported on this system.
14085 avail_ext=''
14086 for xxx in $known_extensions ; do
14087         case "$xxx" in
14088         DB_File|db_file)
14089                 case "$i_db" in
14090                 $define) avail_ext="$avail_ext $xxx" ;;
14091                 esac
14092                 ;;
14093         GDBM_File|gdbm_fil)
14094                 case "$i_gdbm" in 
14095                 $define) avail_ext="$avail_ext $xxx" ;;
14096                 esac
14097                 ;;
14098         NDBM_File|ndbm_fil)
14099                 case "$i_ndbm" in
14100                 $define) avail_ext="$avail_ext $xxx" ;;
14101                 esac
14102                 ;;
14103         ODBM_File|odbm_fil) 
14104                 case "${i_dbm}${i_rpcsvcdbm}" in
14105                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14106                 esac
14107                 ;;
14108         POSIX|posix)
14109                 case "$useposix" in
14110                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14111                 esac
14112                 ;;
14113         Opcode|opcode)
14114                 case "$useopcode" in
14115                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14116                 esac
14117                 ;;
14118         Socket|socket)
14119                 case "$d_socket" in 
14120                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14121                 esac
14122                 ;;
14123         Thread|thread)
14124                 case "$usethreads" in 
14125                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14126                 esac
14127                 ;;
14128         IPC/SysV|ipc/sysv)
14129                 : XXX Do we need a useipcsysv variable here
14130                 case "${d_msg}${d_sem}${d_shm}" in 
14131                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14132                 esac
14133                 ;;
14134         *)      avail_ext="$avail_ext $xxx"
14135                 ;;
14136         esac
14137 done
14138
14139 set X $avail_ext
14140 shift
14141 avail_ext="$*"
14142
14143 : Now see which nonxs extensions are supported on this system.
14144 : For now assume all are.
14145 nonxs_ext=''
14146 for xxx in $nonxs_extensions ; do
14147         case "$xxx" in
14148         *)      nonxs_ext="$nonxs_ext $xxx"
14149                 ;;
14150         esac
14151 done
14152
14153 set X $nonxs_ext
14154 shift
14155 nonxs_ext="$*"
14156
14157 case $usedl in
14158 $define)
14159         $cat <<EOM
14160 A number of extensions are supplied with $package.  You may choose to
14161 compile these extensions for dynamic loading (the default), compile
14162 them into the $package executable (static loading), or not include
14163 them at all.  Answer "none" to include no extensions.
14164 Note that DynaLoader is always built and need not be mentioned here.
14165
14166 EOM
14167         case "$dynamic_ext" in
14168         '') dflt="$avail_ext" ;;
14169         *)      dflt="$dynamic_ext"
14170                 # Perhaps we are reusing an old out-of-date config.sh.
14171                 case "$hint" in
14172                 previous)
14173                         if test X"$dynamic_ext" != X"$avail_ext"; then
14174                                 $cat <<EOM
14175 NOTICE:  Your previous config.sh list may be incorrect. 
14176 The extensions now available to you are 
14177         ${avail_ext}
14178 but the default list from your previous config.sh is
14179         ${dynamic_ext} 
14180
14181 EOM
14182                         fi
14183                         ;;
14184                 esac
14185                 ;;
14186         esac
14187         case "$dflt" in
14188         '')     dflt=none;;
14189         esac
14190         rp="What extensions do you wish to load dynamically?"
14191         . ./myread
14192         case "$ans" in
14193         none) dynamic_ext=' ' ;;
14194         *) dynamic_ext="$ans" ;;
14195         esac
14196
14197         case "$static_ext" in
14198         '')
14199                 : Exclude those already listed in dynamic linking
14200                 dflt=''
14201                 for xxx in $avail_ext; do
14202                         case " $dynamic_ext " in
14203                         *" $xxx "*) ;;
14204                         *) dflt="$dflt $xxx" ;;
14205                         esac
14206                 done
14207                 set X $dflt
14208                 shift
14209                 dflt="$*"
14210                 ;;
14211         *)  dflt="$static_ext" 
14212                 ;;
14213         esac
14214
14215         case "$dflt" in
14216         '')     dflt=none;;
14217         esac
14218         rp="What extensions do you wish to load statically?"
14219         . ./myread
14220         case "$ans" in
14221         none) static_ext=' ' ;;
14222         *) static_ext="$ans" ;;
14223         esac
14224         ;;
14225 *)
14226         $cat <<EOM
14227 A number of extensions are supplied with $package.  Answer "none" 
14228 to include no extensions. 
14229 Note that DynaLoader is always built and need not be mentioned here.
14230
14231 EOM
14232         case "$static_ext" in
14233         '') dflt="$avail_ext" ;;
14234         *)      dflt="$static_ext"
14235                 # Perhaps we are reusing an old out-of-date config.sh.
14236                 case "$hint" in
14237                 previous)
14238                         if test X"$static_ext" != X"$avail_ext"; then
14239                                 $cat <<EOM
14240 NOTICE:  Your previous config.sh list may be incorrect. 
14241 The extensions now available to you are 
14242         ${avail_ext}
14243 but the default list from your previous config.sh is
14244         ${static_ext} 
14245
14246 EOM
14247                         fi
14248                         ;;
14249                 esac
14250                 ;;
14251         esac
14252         : Exclude those that are not xs extensions
14253         case "$dflt" in
14254         '')     dflt=none;;
14255         esac
14256         rp="What extensions do you wish to include?"
14257         . ./myread
14258         case "$ans" in
14259         none) static_ext=' ' ;;
14260         *) static_ext="$ans" ;;
14261         esac
14262         ;;
14263 esac
14264
14265 set X $dynamic_ext $static_ext $nonxs_ext
14266 shift
14267 extensions="$*"
14268
14269 : Remove build directory name from cppstdin so it can be used from
14270 : either the present location or the final installed location.
14271 echo " "
14272 : Get out of the UU directory to get correct path name.
14273 cd ..
14274 case "$cppstdin" in
14275 `pwd`/cppstdin)
14276         echo "Stripping down cppstdin path name"
14277         cppstdin=cppstdin
14278         ;;
14279 esac
14280 cd UU
14281
14282 : end of configuration questions
14283 echo " "
14284 echo "End of configuration questions."
14285 echo " "
14286
14287 : back to where it started
14288 if test -d ../UU; then
14289         cd ..
14290 fi
14291
14292 : configuration may be patched via a 'config.over' file
14293 if $test -f config.over; then
14294         echo " "
14295         dflt=y
14296         rp='I see a config.over file.  Do you wish to load it?'
14297         . UU/myread
14298         case "$ans" in
14299         n*) echo "OK, I'll ignore it.";;
14300         *)      . ./config.over
14301                 echo "Configuration override changes have been loaded."
14302                 ;;
14303         esac
14304 fi
14305
14306 : in case they want portability, strip down executable paths
14307 case "$d_portable" in
14308 "$define")
14309         echo " "
14310         echo "Stripping down executable paths..." >&4
14311         for file in $loclist $trylist; do
14312                 eval temp=\$$file
14313                 eval $file=`basename $temp`
14314         done
14315         ;;
14316 esac
14317
14318 : create config.sh file
14319 echo " "
14320 echo "Creating config.sh..." >&4
14321 $spitshell <<EOT >config.sh
14322 $startsh
14323 #
14324 # This file was produced by running the Configure script. It holds all the
14325 # definitions figured out by Configure. Should you modify one of these values,
14326 # do not forget to propagate your changes by running "Configure -der". You may
14327 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14328 #
14329
14330 # Package name      : $package
14331 # Source directory  : $src
14332 # Configuration time: $cf_time
14333 # Configured by     : $cf_by
14334 # Target system     : $myuname
14335
14336 Author='$Author'
14337 Date='$Date'
14338 Header='$Header'
14339 Id='$Id'
14340 Locker='$Locker'
14341 Log='$Log'
14342 Mcc='$Mcc'
14343 RCSfile='$RCSfile'
14344 Revision='$Revision'
14345 Source='$Source'
14346 State='$State'
14347 _a='$_a'
14348 _exe='$_exe'
14349 _o='$_o'
14350 afs='$afs'
14351 alignbytes='$alignbytes'
14352 ansi2knr='$ansi2knr'
14353 aphostname='$aphostname'
14354 api_revision='$api_revision'
14355 api_subversion='$api_subversion'
14356 api_version='$api_version'
14357 api_versionstring='$api_versionstring'
14358 ar='$ar'
14359 archlib='$archlib'
14360 archlibexp='$archlibexp'
14361 archname64='$archname64'
14362 archname='$archname'
14363 archobjs='$archobjs'
14364 awk='$awk'
14365 baserev='$baserev'
14366 bash='$bash'
14367 bin='$bin'
14368 bincompat5005='$bincompat5005'
14369 binexp='$binexp'
14370 bison='$bison'
14371 byacc='$byacc'
14372 byteorder='$byteorder'
14373 c='$c'
14374 castflags='$castflags'
14375 cat='$cat'
14376 cc='$cc'
14377 cccdlflags='$cccdlflags'
14378 ccdlflags='$ccdlflags'
14379 ccflags='$ccflags'
14380 ccsymbols='$ccsymbols'
14381 cf_by='$cf_by'
14382 cf_email='$cf_email'
14383 cf_time='$cf_time'
14384 charsize='$charsize'
14385 chgrp='$chgrp'
14386 chmod='$chmod'
14387 chown='$chown'
14388 clocktype='$clocktype'
14389 comm='$comm'
14390 compress='$compress'
14391 contains='$contains'
14392 cp='$cp'
14393 cpio='$cpio'
14394 cpp='$cpp'
14395 cpp_stuff='$cpp_stuff'
14396 cppccsymbols='$cppccsymbols'
14397 cppflags='$cppflags'
14398 cpplast='$cpplast'
14399 cppminus='$cppminus'
14400 cpprun='$cpprun'
14401 cppstdin='$cppstdin'
14402 cppsymbols='$cppsymbols'
14403 crosscompile='$crosscompile'
14404 cryptlib='$cryptlib'
14405 csh='$csh'
14406 d_Gconvert='$d_Gconvert'
14407 d_PRIEldbl='$d_PRIEldbl'
14408 d_PRIFldbl='$d_PRIFldbl'
14409 d_PRIGldbl='$d_PRIGldbl'
14410 d_PRIX64='$d_PRIX64'
14411 d_PRId64='$d_PRId64'
14412 d_PRIeldbl='$d_PRIeldbl'
14413 d_PRIfldbl='$d_PRIfldbl'
14414 d_PRIgldbl='$d_PRIgldbl'
14415 d_PRIi64='$d_PRIi64'
14416 d_PRIo64='$d_PRIo64'
14417 d_PRIu64='$d_PRIu64'
14418 d_PRIx64='$d_PRIx64'
14419 d_access='$d_access'
14420 d_accessx='$d_accessx'
14421 d_alarm='$d_alarm'
14422 d_archlib='$d_archlib'
14423 d_atolf='$d_atolf'
14424 d_atoll='$d_atoll'
14425 d_attribut='$d_attribut'
14426 d_bcmp='$d_bcmp'
14427 d_bcopy='$d_bcopy'
14428 d_bincompat5005='$d_bincompat5005'
14429 d_bsd='$d_bsd'
14430 d_bsdgetpgrp='$d_bsdgetpgrp'
14431 d_bsdsetpgrp='$d_bsdsetpgrp'
14432 d_bzero='$d_bzero'
14433 d_casti32='$d_casti32'
14434 d_castneg='$d_castneg'
14435 d_charvspr='$d_charvspr'
14436 d_chown='$d_chown'
14437 d_chroot='$d_chroot'
14438 d_chsize='$d_chsize'
14439 d_closedir='$d_closedir'
14440 d_const='$d_const'
14441 d_crypt='$d_crypt'
14442 d_csh='$d_csh'
14443 d_cuserid='$d_cuserid'
14444 d_dbl_dig='$d_dbl_dig'
14445 d_difftime='$d_difftime'
14446 d_dirnamlen='$d_dirnamlen'
14447 d_dlerror='$d_dlerror'
14448 d_dlopen='$d_dlopen'
14449 d_dlsymun='$d_dlsymun'
14450 d_dosuid='$d_dosuid'
14451 d_drand48proto='$d_drand48proto'
14452 d_dup2='$d_dup2'
14453 d_eaccess='$d_eaccess'
14454 d_endgrent='$d_endgrent'
14455 d_endhent='$d_endhent'
14456 d_endnent='$d_endnent'
14457 d_endpent='$d_endpent'
14458 d_endpwent='$d_endpwent'
14459 d_endsent='$d_endsent'
14460 d_endspent='$d_endspent'
14461 d_eofnblk='$d_eofnblk'
14462 d_eunice='$d_eunice'
14463 d_fchmod='$d_fchmod'
14464 d_fchown='$d_fchown'
14465 d_fcntl='$d_fcntl'
14466 d_fd_macros='$d_fd_macros'
14467 d_fd_set='$d_fd_set'
14468 d_fds_bits='$d_fds_bits'
14469 d_fgetpos='$d_fgetpos'
14470 d_flexfnam='$d_flexfnam'
14471 d_flock='$d_flock'
14472 d_fork='$d_fork'
14473 d_fpathconf='$d_fpathconf'
14474 d_fpos64_t='$d_fpos64_t'
14475 d_fs_data_s='$d_fs_data_s'
14476 d_fseeko='$d_fseeko'
14477 d_fsetpos='$d_fsetpos'
14478 d_fstatfs='$d_fstatfs'
14479 d_fstatvfs='$d_fstatvfs'
14480 d_ftello='$d_ftello'
14481 d_ftime='$d_ftime'
14482 d_getgrent='$d_getgrent'
14483 d_getgrps='$d_getgrps'
14484 d_gethbyaddr='$d_gethbyaddr'
14485 d_gethbyname='$d_gethbyname'
14486 d_gethent='$d_gethent'
14487 d_gethname='$d_gethname'
14488 d_gethostprotos='$d_gethostprotos'
14489 d_getlogin='$d_getlogin'
14490 d_getmnt='$d_getmnt'
14491 d_getmntent='$d_getmntent'
14492 d_getnbyaddr='$d_getnbyaddr'
14493 d_getnbyname='$d_getnbyname'
14494 d_getnent='$d_getnent'
14495 d_getnetprotos='$d_getnetprotos'
14496 d_getpbyname='$d_getpbyname'
14497 d_getpbynumber='$d_getpbynumber'
14498 d_getpent='$d_getpent'
14499 d_getpgid='$d_getpgid'
14500 d_getpgrp2='$d_getpgrp2'
14501 d_getpgrp='$d_getpgrp'
14502 d_getppid='$d_getppid'
14503 d_getprior='$d_getprior'
14504 d_getprotoprotos='$d_getprotoprotos'
14505 d_getpwent='$d_getpwent'
14506 d_getsbyname='$d_getsbyname'
14507 d_getsbyport='$d_getsbyport'
14508 d_getsent='$d_getsent'
14509 d_getservprotos='$d_getservprotos'
14510 d_getspent='$d_getspent'
14511 d_getspnam='$d_getspnam'
14512 d_gettimeod='$d_gettimeod'
14513 d_gnulibc='$d_gnulibc'
14514 d_grpasswd='$d_grpasswd'
14515 d_hasmntopt='$d_hasmntopt'
14516 d_htonl='$d_htonl'
14517 d_index='$d_index'
14518 d_inetaton='$d_inetaton'
14519 d_int64t='$d_int64t'
14520 d_isascii='$d_isascii'
14521 d_killpg='$d_killpg'
14522 d_lchown='$d_lchown'
14523 d_ldbl_dig='$d_ldbl_dig'
14524 d_link='$d_link'
14525 d_locconv='$d_locconv'
14526 d_lockf='$d_lockf'
14527 d_longdbl='$d_longdbl'
14528 d_longlong='$d_longlong'
14529 d_lstat='$d_lstat'
14530 d_mblen='$d_mblen'
14531 d_mbstowcs='$d_mbstowcs'
14532 d_mbtowc='$d_mbtowc'
14533 d_memchr='$d_memchr'
14534 d_memcmp='$d_memcmp'
14535 d_memcpy='$d_memcpy'
14536 d_memmove='$d_memmove'
14537 d_memset='$d_memset'
14538 d_mkdir='$d_mkdir'
14539 d_mkfifo='$d_mkfifo'
14540 d_mktime='$d_mktime'
14541 d_msg='$d_msg'
14542 d_msg_ctrunc='$d_msg_ctrunc'
14543 d_msg_dontroute='$d_msg_dontroute'
14544 d_msg_oob='$d_msg_oob'
14545 d_msg_peek='$d_msg_peek'
14546 d_msg_proxy='$d_msg_proxy'
14547 d_msgctl='$d_msgctl'
14548 d_msgget='$d_msgget'
14549 d_msgrcv='$d_msgrcv'
14550 d_msgsnd='$d_msgsnd'
14551 d_mymalloc='$d_mymalloc'
14552 d_nice='$d_nice'
14553 d_off64_t='$d_off64_t'
14554 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14555 d_oldpthreads='$d_oldpthreads'
14556 d_oldsock='$d_oldsock'
14557 d_open3='$d_open3'
14558 d_pathconf='$d_pathconf'
14559 d_pause='$d_pause'
14560 d_phostname='$d_phostname'
14561 d_pipe='$d_pipe'
14562 d_poll='$d_poll'
14563 d_portable='$d_portable'
14564 d_pthread_yield='$d_pthread_yield'
14565 d_pwage='$d_pwage'
14566 d_pwchange='$d_pwchange'
14567 d_pwclass='$d_pwclass'
14568 d_pwcomment='$d_pwcomment'
14569 d_pwexpire='$d_pwexpire'
14570 d_pwgecos='$d_pwgecos'
14571 d_pwpasswd='$d_pwpasswd'
14572 d_pwquota='$d_pwquota'
14573 d_quad='$d_quad'
14574 d_readdir='$d_readdir'
14575 d_readlink='$d_readlink'
14576 d_rename='$d_rename'
14577 d_rewinddir='$d_rewinddir'
14578 d_rmdir='$d_rmdir'
14579 d_safebcpy='$d_safebcpy'
14580 d_safemcpy='$d_safemcpy'
14581 d_sanemcmp='$d_sanemcmp'
14582 d_sched_yield='$d_sched_yield'
14583 d_scm_rights='$d_scm_rights'
14584 d_seekdir='$d_seekdir'
14585 d_select='$d_select'
14586 d_sem='$d_sem'
14587 d_semctl='$d_semctl'
14588 d_semctl_semid_ds='$d_semctl_semid_ds'
14589 d_semctl_semun='$d_semctl_semun'
14590 d_semget='$d_semget'
14591 d_semop='$d_semop'
14592 d_setegid='$d_setegid'
14593 d_seteuid='$d_seteuid'
14594 d_setgrent='$d_setgrent'
14595 d_setgrps='$d_setgrps'
14596 d_sethent='$d_sethent'
14597 d_setlinebuf='$d_setlinebuf'
14598 d_setlocale='$d_setlocale'
14599 d_setnent='$d_setnent'
14600 d_setpent='$d_setpent'
14601 d_setpgid='$d_setpgid'
14602 d_setpgrp2='$d_setpgrp2'
14603 d_setpgrp='$d_setpgrp'
14604 d_setprior='$d_setprior'
14605 d_setpwent='$d_setpwent'
14606 d_setregid='$d_setregid'
14607 d_setresgid='$d_setresgid'
14608 d_setresuid='$d_setresuid'
14609 d_setreuid='$d_setreuid'
14610 d_setrgid='$d_setrgid'
14611 d_setruid='$d_setruid'
14612 d_setsent='$d_setsent'
14613 d_setsid='$d_setsid'
14614 d_setspent='$d_setspent'
14615 d_setvbuf='$d_setvbuf'
14616 d_sfio='$d_sfio'
14617 d_shm='$d_shm'
14618 d_shmat='$d_shmat'
14619 d_shmatprototype='$d_shmatprototype'
14620 d_shmctl='$d_shmctl'
14621 d_shmdt='$d_shmdt'
14622 d_shmget='$d_shmget'
14623 d_sigaction='$d_sigaction'
14624 d_sigsetjmp='$d_sigsetjmp'
14625 d_socket='$d_socket'
14626 d_sockpair='$d_sockpair'
14627 d_sqrtl='$d_sqrtl'
14628 d_statblks='$d_statblks'
14629 d_statfs_f_flags='$d_statfs_f_flags'
14630 d_statfs_s='$d_statfs_s'
14631 d_statvfs='$d_statvfs'
14632 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14633 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14634 d_stdio_stream_array='$d_stdio_stream_array'
14635 d_stdiobase='$d_stdiobase'
14636 d_stdstdio='$d_stdstdio'
14637 d_strchr='$d_strchr'
14638 d_strcoll='$d_strcoll'
14639 d_strctcpy='$d_strctcpy'
14640 d_strerrm='$d_strerrm'
14641 d_strerror='$d_strerror'
14642 d_strtod='$d_strtod'
14643 d_strtol='$d_strtol'
14644 d_strtold='$d_strtold'
14645 d_strtoll='$d_strtoll'
14646 d_strtoul='$d_strtoul'
14647 d_strtoull='$d_strtoull'
14648 d_strtouq='$d_strtouq'
14649 d_strxfrm='$d_strxfrm'
14650 d_suidsafe='$d_suidsafe'
14651 d_symlink='$d_symlink'
14652 d_syscall='$d_syscall'
14653 d_sysconf='$d_sysconf'
14654 d_sysernlst='$d_sysernlst'
14655 d_syserrlst='$d_syserrlst'
14656 d_system='$d_system'
14657 d_tcgetpgrp='$d_tcgetpgrp'
14658 d_tcsetpgrp='$d_tcsetpgrp'
14659 d_telldir='$d_telldir'
14660 d_telldirproto='$d_telldirproto'
14661 d_time='$d_time'
14662 d_times='$d_times'
14663 d_truncate='$d_truncate'
14664 d_tzname='$d_tzname'
14665 d_umask='$d_umask'
14666 d_uname='$d_uname'
14667 d_union_semun='$d_union_semun'
14668 d_ustat='$d_ustat'
14669 d_vendorbin='$d_vendorbin'
14670 d_vendorlib='$d_vendorlib'
14671 d_vfork='$d_vfork'
14672 d_void_closedir='$d_void_closedir'
14673 d_voidsig='$d_voidsig'
14674 d_voidtty='$d_voidtty'
14675 d_volatile='$d_volatile'
14676 d_vprintf='$d_vprintf'
14677 d_wait4='$d_wait4'
14678 d_waitpid='$d_waitpid'
14679 d_wcstombs='$d_wcstombs'
14680 d_wctomb='$d_wctomb'
14681 d_xenix='$d_xenix'
14682 date='$date'
14683 db_hashtype='$db_hashtype'
14684 db_prefixtype='$db_prefixtype'
14685 defvoidused='$defvoidused'
14686 direntrytype='$direntrytype'
14687 dlext='$dlext'
14688 dlsrc='$dlsrc'
14689 doublesize='$doublesize'
14690 drand01='$drand01'
14691 dynamic_ext='$dynamic_ext'
14692 eagain='$eagain'
14693 ebcdic='$ebcdic'
14694 echo='$echo'
14695 egrep='$egrep'
14696 emacs='$emacs'
14697 eunicefix='$eunicefix'
14698 exe_ext='$exe_ext'
14699 expr='$expr'
14700 extensions='$extensions'
14701 fflushNULL='$fflushNULL'
14702 fflushall='$fflushall'
14703 find='$find'
14704 firstmakefile='$firstmakefile'
14705 flex='$flex'
14706 fpossize='$fpossize'
14707 fpostype='$fpostype'
14708 freetype='$freetype'
14709 full_ar='$full_ar'
14710 full_csh='$full_csh'
14711 full_sed='$full_sed'
14712 gccversion='$gccversion'
14713 gidformat='$gidformat'
14714 gidsign='$gidsign'
14715 gidsize='$gidsize'
14716 gidtype='$gidtype'
14717 glibpth='$glibpth'
14718 grep='$grep'
14719 groupcat='$groupcat'
14720 groupstype='$groupstype'
14721 gzip='$gzip'
14722 h_fcntl='$h_fcntl'
14723 h_sysfile='$h_sysfile'
14724 hint='$hint'
14725 hostcat='$hostcat'
14726 huge='$huge'
14727 i16size='$i16size'
14728 i16type='$i16type'
14729 i32size='$i32size'
14730 i32type='$i32type'
14731 i64size='$i64size'
14732 i64type='$i64type'
14733 i8size='$i8size'
14734 i8type='$i8type'
14735 i_arpainet='$i_arpainet'
14736 i_bsdioctl='$i_bsdioctl'
14737 i_db='$i_db'
14738 i_dbm='$i_dbm'
14739 i_dirent='$i_dirent'
14740 i_dld='$i_dld'
14741 i_dlfcn='$i_dlfcn'
14742 i_fcntl='$i_fcntl'
14743 i_float='$i_float'
14744 i_gdbm='$i_gdbm'
14745 i_grp='$i_grp'
14746 i_inttypes='$i_inttypes'
14747 i_limits='$i_limits'
14748 i_locale='$i_locale'
14749 i_machcthr='$i_machcthr'
14750 i_malloc='$i_malloc'
14751 i_math='$i_math'
14752 i_memory='$i_memory'
14753 i_mntent='$i_mntent'
14754 i_ndbm='$i_ndbm'
14755 i_netdb='$i_netdb'
14756 i_neterrno='$i_neterrno'
14757 i_netinettcp='$i_netinettcp'
14758 i_niin='$i_niin'
14759 i_poll='$i_poll'
14760 i_pthread='$i_pthread'
14761 i_pwd='$i_pwd'
14762 i_rpcsvcdbm='$i_rpcsvcdbm'
14763 i_sfio='$i_sfio'
14764 i_sgtty='$i_sgtty'
14765 i_shadow='$i_shadow'
14766 i_socks='$i_socks'
14767 i_stdarg='$i_stdarg'
14768 i_stddef='$i_stddef'
14769 i_stdlib='$i_stdlib'
14770 i_string='$i_string'
14771 i_sysaccess='$i_sysaccess'
14772 i_sysdir='$i_sysdir'
14773 i_sysfile='$i_sysfile'
14774 i_sysfilio='$i_sysfilio'
14775 i_sysin='$i_sysin'
14776 i_sysioctl='$i_sysioctl'
14777 i_sysmount='$i_sysmount'
14778 i_sysndir='$i_sysndir'
14779 i_sysparam='$i_sysparam'
14780 i_sysresrc='$i_sysresrc'
14781 i_syssecrt='$i_syssecrt'
14782 i_sysselct='$i_sysselct'
14783 i_syssockio='$i_syssockio'
14784 i_sysstat='$i_sysstat'
14785 i_sysstatfs='$i_sysstatfs'
14786 i_sysstatvfs='$i_sysstatvfs'
14787 i_systime='$i_systime'
14788 i_systimek='$i_systimek'
14789 i_systimes='$i_systimes'
14790 i_systypes='$i_systypes'
14791 i_sysuio='$i_sysuio'
14792 i_sysun='$i_sysun'
14793 i_sysvfs='$i_sysvfs'
14794 i_syswait='$i_syswait'
14795 i_termio='$i_termio'
14796 i_termios='$i_termios'
14797 i_time='$i_time'
14798 i_unistd='$i_unistd'
14799 i_ustat='$i_ustat'
14800 i_utime='$i_utime'
14801 i_values='$i_values'
14802 i_varargs='$i_varargs'
14803 i_varhdr='$i_varhdr'
14804 i_vfork='$i_vfork'
14805 ignore_versioned_solibs='$ignore_versioned_solibs'
14806 inc_version_list='$inc_version_list'
14807 incpath='$incpath'
14808 inews='$inews'
14809 installarchlib='$installarchlib'
14810 installbin='$installbin'
14811 installman1dir='$installman1dir'
14812 installman3dir='$installman3dir'
14813 installprefix='$installprefix'
14814 installprefixexp='$installprefixexp'
14815 installprivlib='$installprivlib'
14816 installscript='$installscript'
14817 installsitearch='$installsitearch'
14818 installsitebin='$installsitebin'
14819 installsitelib='$installsitelib'
14820 installstyle='$installstyle'
14821 installusrbinperl='$installusrbinperl'
14822 installvendorbin='$installvendorbin'
14823 installvendorlib='$installvendorlib'
14824 intsize='$intsize'
14825 ivdformat='$ivdformat'
14826 ivsize='$ivsize'
14827 ivtype='$ivtype'
14828 known_extensions='$known_extensions'
14829 ksh='$ksh'
14830 large='$large'
14831 ld='$ld'
14832 lddlflags='$lddlflags'
14833 ldflags='$ldflags'
14834 ldlibpthname='$ldlibpthname'
14835 less='$less'
14836 lib_ext='$lib_ext'
14837 libc='$libc'
14838 libperl='$libperl'
14839 libpth='$libpth'
14840 libs='$libs'
14841 libswanted='$libswanted'
14842 line='$line'
14843 lint='$lint'
14844 lkflags='$lkflags'
14845 ln='$ln'
14846 lns='$lns'
14847 locincpth='$locincpth'
14848 loclibpth='$loclibpth'
14849 longdblsize='$longdblsize'
14850 longlongsize='$longlongsize'
14851 longsize='$longsize'
14852 lp='$lp'
14853 lpr='$lpr'
14854 ls='$ls'
14855 lseeksize='$lseeksize'
14856 lseektype='$lseektype'
14857 mail='$mail'
14858 mailx='$mailx'
14859 make='$make'
14860 make_set_make='$make_set_make'
14861 mallocobj='$mallocobj'
14862 mallocsrc='$mallocsrc'
14863 malloctype='$malloctype'
14864 man1dir='$man1dir'
14865 man1direxp='$man1direxp'
14866 man1ext='$man1ext'
14867 man3dir='$man3dir'
14868 man3direxp='$man3direxp'
14869 man3ext='$man3ext'
14870 medium='$medium'
14871 mips_type='$mips_type'
14872 mkdir='$mkdir'
14873 models='$models'
14874 modetype='$modetype'
14875 more='$more'
14876 multiarch='$multiarch'
14877 mv='$mv'
14878 myarchname='$myarchname'
14879 mydomain='$mydomain'
14880 myhostname='$myhostname'
14881 myuname='$myuname'
14882 n='$n'
14883 netdb_hlen_type='$netdb_hlen_type'
14884 netdb_host_type='$netdb_host_type'
14885 netdb_name_type='$netdb_name_type'
14886 netdb_net_type='$netdb_net_type'
14887 nm='$nm'
14888 nm_opt='$nm_opt'
14889 nm_so_opt='$nm_so_opt'
14890 nonxs_ext='$nonxs_ext'
14891 nroff='$nroff'
14892 nvsize='$nvsize'
14893 nvtype='$nvtype'
14894 o_nonblock='$o_nonblock'
14895 obj_ext='$obj_ext'
14896 old_pthread_create_joinable='$old_pthread_create_joinable'
14897 optimize='$optimize'
14898 orderlib='$orderlib'
14899 osname='$osname'
14900 osvers='$osvers'
14901 package='$package'
14902 pager='$pager'
14903 passcat='$passcat'
14904 patchlevel='$patchlevel'
14905 path_sep='$path_sep'
14906 perl='$perl'
14907 perladmin='$perladmin'
14908 perlpath='$perlpath'
14909 pg='$pg'
14910 phostname='$phostname'
14911 pidtype='$pidtype'
14912 plibpth='$plibpth'
14913 pmake='$pmake'
14914 pr='$pr'
14915 prefix='$prefix'
14916 prefixexp='$prefixexp'
14917 privlib='$privlib'
14918 privlibexp='$privlibexp'
14919 prototype='$prototype'
14920 ptrsize='$ptrsize'
14921 quadkind='$quadkind'
14922 quadtype='$quadtype'
14923 randbits='$randbits'
14924 randfunc='$randfunc'
14925 randseedtype='$randseedtype'
14926 ranlib='$ranlib'
14927 rd_nodata='$rd_nodata'
14928 rm='$rm'
14929 rmail='$rmail'
14930 runnm='$runnm'
14931 sPRIEldbl='$sPRIEldbl'
14932 sPRIFldbl='$sPRIFldbl'
14933 sPRIGldbl='$sPRIGldbl'
14934 sPRIX64='$sPRIX64'
14935 sPRId64='$sPRId64'
14936 sPRIeldbl='$sPRIeldbl'
14937 sPRIfldbl='$sPRIfldbl'
14938 sPRIgldbl='$sPRIgldbl'
14939 sPRIi64='$sPRIi64'
14940 sPRIo64='$sPRIo64'
14941 sPRIu64='$sPRIu64'
14942 sPRIx64='$sPRIx64'
14943 sched_yield='$sched_yield'
14944 scriptdir='$scriptdir'
14945 scriptdirexp='$scriptdirexp'
14946 sed='$sed'
14947 seedfunc='$seedfunc'
14948 selectminbits='$selectminbits'
14949 selecttype='$selecttype'
14950 sendmail='$sendmail'
14951 sh='$sh'
14952 shar='$shar'
14953 sharpbang='$sharpbang'
14954 shmattype='$shmattype'
14955 shortsize='$shortsize'
14956 shrpenv='$shrpenv'
14957 shsharp='$shsharp'
14958 sig_count='$sig_count'
14959 sig_name='$sig_name'
14960 sig_name_init='$sig_name_init'
14961 sig_num='$sig_num'
14962 sig_num_init='$sig_num_init'
14963 signal_t='$signal_t'
14964 sitearch='$sitearch'
14965 sitearchexp='$sitearchexp'
14966 sitebin='$sitebin'
14967 sitebinexp='$sitebinexp'
14968 sitelib='$sitelib'
14969 sitelibexp='$sitelibexp'
14970 siteprefix='$siteprefix'
14971 siteprefixexp='$siteprefixexp'
14972 sizetype='$sizetype'
14973 sleep='$sleep'
14974 smail='$smail'
14975 small='$small'
14976 so='$so'
14977 sockethdr='$sockethdr'
14978 socketlib='$socketlib'
14979 sort='$sort'
14980 spackage='$spackage'
14981 spitshell='$spitshell'
14982 split='$split'
14983 src='$src'
14984 ssizetype='$ssizetype'
14985 startperl='$startperl'
14986 startsh='$startsh'
14987 static_ext='$static_ext'
14988 stdchar='$stdchar'
14989 stdio_base='$stdio_base'
14990 stdio_bufsiz='$stdio_bufsiz'
14991 stdio_cnt='$stdio_cnt'
14992 stdio_filbuf='$stdio_filbuf'
14993 stdio_ptr='$stdio_ptr'
14994 stdio_stream_array='$stdio_stream_array'
14995 strings='$strings'
14996 submit='$submit'
14997 subversion='$subversion'
14998 sysman='$sysman'
14999 tail='$tail'
15000 tar='$tar'
15001 tbl='$tbl'
15002 tee='$tee'
15003 test='$test'
15004 timeincl='$timeincl'
15005 timetype='$timetype'
15006 touch='$touch'
15007 tr='$tr'
15008 trnl='$trnl'
15009 troff='$troff'
15010 u16size='$u16size'
15011 u16type='$u16type'
15012 u32size='$u32size'
15013 u32type='$u32type'
15014 u64size='$u64size'
15015 u64type='$u64type'
15016 u8size='$u8size'
15017 u8type='$u8type'
15018 uidformat='$uidformat'
15019 uidsign='$uidsign'
15020 uidsize='$uidsize'
15021 uidtype='$uidtype'
15022 uname='$uname'
15023 uniq='$uniq'
15024 uquadtype='$uquadtype'
15025 use5005threads='$use5005threads'
15026 use64bits='$use64bits'
15027 usedl='$usedl'
15028 useithreads='$useithreads'
15029 uselargefiles='$uselargefiles'
15030 uselongdouble='$uselongdouble'
15031 uselonglong='$uselonglong'
15032 usemorebits='$usemorebits'
15033 usemultiplicity='$usemultiplicity'
15034 usemymalloc='$usemymalloc'
15035 usenm='$usenm'
15036 useopcode='$useopcode'
15037 useperlio='$useperlio'
15038 useposix='$useposix'
15039 usesfio='$usesfio'
15040 useshrplib='$useshrplib'
15041 usesocks='$usesocks'
15042 usethreads='$usethreads'
15043 usevendorprefix='$usevendorprefix'
15044 usevfork='$usevfork'
15045 usrinc='$usrinc'
15046 uuname='$uuname'
15047 uvoformat='$uvoformat'
15048 uvsize='$uvsize'
15049 uvtype='$uvtype'
15050 uvuformat='$uvuformat'
15051 uvxformat='$uvxformat'
15052 vendorbin='$vendorbin'
15053 vendorbinexp='$vendorbinexp'
15054 vendorlib='$vendorlib'
15055 vendorlibexp='$vendorlibexp'
15056 vendorprefix='$vendorprefix'
15057 vendorprefixexp='$vendorprefixexp'
15058 version='$version'
15059 vi='$vi'
15060 voidflags='$voidflags'
15061 xlibpth='$xlibpth'
15062 zcat='$zcat'
15063 zip='$zip'
15064 EOT
15065
15066 : Add in command line options if available
15067 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15068
15069 : add special variables
15070 $test -f $src/patchlevel.h && \
15071 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15072 echo "CONFIGDOTSH=true" >>config.sh
15073
15074 : propagate old symbols
15075 if $test -f UU/config.sh; then
15076         <UU/config.sh sort | uniq >UU/oldconfig.sh
15077         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15078         sort | uniq -u >UU/oldsyms
15079         set X `cat UU/oldsyms`
15080         shift
15081         case $# in
15082         0) ;;
15083         *)
15084                 cat <<EOM
15085 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15086 EOM
15087                 echo "# Variables propagated from previous config.sh file." >>config.sh
15088                 for sym in `cat UU/oldsyms`; do
15089                         echo "    Propagating $hint variable "'$'"$sym..."
15090                         eval 'tmp="$'"${sym}"'"'
15091                         echo "$tmp" | \
15092                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15093                 done
15094                 ;;
15095         esac
15096 fi
15097
15098 : Finish up by extracting the .SH files
15099 case "$alldone" in
15100 exit)
15101         $rm -rf UU
15102         echo "Done."
15103         exit 0
15104         ;;
15105 cont)
15106         ;;
15107 '')
15108         dflt=''
15109         nostick=true
15110         $cat <<EOM
15111
15112 If you'd like to make any changes to the config.sh file before I begin
15113 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15114
15115 EOM
15116         rp="Press return or use a shell escape to edit config.sh:"
15117         . UU/myread
15118         nostick=''
15119         case "$ans" in
15120         '') ;;
15121         *) : in case they cannot read
15122                 sh 1>&4 -c "$ans";;
15123         esac
15124         ;;
15125 esac
15126
15127 : if this fails, just run all the .SH files by hand
15128 . ./config.sh
15129
15130 echo " "
15131 exec 1>&4
15132 . ./UU/extract
15133
15134 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15135         dflt=y
15136         case "$silent" in
15137         true) ;;
15138         *)
15139                 $cat <<EOM
15140
15141 Now you need to generate make dependencies by running "$make depend".
15142 You might prefer to run it in background: "$make depend > makedepend.out &"
15143 It can take a while, so you might not want to run it right now.
15144
15145 EOM
15146                 ;;
15147         esac
15148         rp="Run $make depend now?"
15149         . UU/myread
15150         case "$ans" in
15151         y*)
15152                 $make depend && echo "Now you must run a $make."
15153                 ;;
15154         *)
15155                 echo "You must run '$make depend' then '$make'."
15156                 ;;
15157         esac
15158 elif test -f [Mm]akefile; then
15159         echo " "
15160         echo "Now you must run a $make."
15161 else
15162         echo "Done."
15163 fi
15164
15165 if $test -f Policy.sh; then
15166     $cat <<EOM
15167
15168 If you compile $package on a different machine or from a different object
15169 directory, copy the Policy.sh file from this object directory to the
15170 new one before you run Configure -- this will help you with most of
15171 the policy defaults.
15172
15173 EOM
15174 fi
15175 if $test -f config.msg; then
15176     echo "Hmm.  I also noted the following information while running:"
15177     echo " "
15178     $cat config.msg >&4
15179     $rm -f config.msg
15180 fi
15181 $rm -f kit*isdone ark*isdone
15182 $rm -rf UU
15183
15184 : End of Configure
15185