AIX 4.3.3 has SOCKS in libc with a differently named init routine,
[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 Fri Aug 25 21:05:22 EET DST 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 ccflags=''
292 cppflags=''
293 ldflags=''
294 lkflags=''
295 locincpth=''
296 optimize=''
297 cf_email=''
298 cf_by=''
299 cf_time=''
300 charsize=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_fchmod=''
346 d_fchown=''
347 d_fcntl=''
348 d_fd_macros=''
349 d_fd_set=''
350 d_fds_bits=''
351 d_fgetpos=''
352 d_flexfnam=''
353 d_flock=''
354 d_fork=''
355 d_fpos64_t=''
356 d_frexpl=''
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_getcwd=''
366 d_getespwnam=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getprpwnam=''
396 d_getpwent=''
397 d_getsent=''
398 d_getservprotos=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_isnan=''
410 d_isnanl=''
411 d_killpg=''
412 d_lchown=''
413 d_ldbl_dig=''
414 d_link=''
415 d_locconv=''
416 d_lockf=''
417 d_longdbl=''
418 longdblsize=''
419 d_longlong=''
420 longlongsize=''
421 d_lseekproto=''
422 d_lstat=''
423 d_madvise=''
424 d_mblen=''
425 d_mbstowcs=''
426 d_mbtowc=''
427 d_memchr=''
428 d_memcmp=''
429 d_memcpy=''
430 d_memmove=''
431 d_memset=''
432 d_mkdir=''
433 d_mkdtemp=''
434 d_mkfifo=''
435 d_mkstemp=''
436 d_mkstemps=''
437 d_mktime=''
438 d_mmap=''
439 mmaptype=''
440 d_modfl=''
441 d_mprotect=''
442 d_msg=''
443 d_msgctl=''
444 d_msgget=''
445 d_msgrcv=''
446 d_msgsnd=''
447 d_msync=''
448 d_munmap=''
449 d_nice=''
450 d_off64_t=''
451 d_open3=''
452 d_fpathconf=''
453 d_pathconf=''
454 d_pause=''
455 d_pipe=''
456 d_poll=''
457 d_portable=''
458 d_old_pthread_create_joinable=''
459 old_pthread_create_joinable=''
460 d_pthread_yield=''
461 d_sched_yield=''
462 sched_yield=''
463 d_qgcvt=''
464 d_readdir=''
465 d_rewinddir=''
466 d_seekdir=''
467 d_telldir=''
468 d_readlink=''
469 d_rename=''
470 d_rmdir=''
471 d_safebcpy=''
472 d_safemcpy=''
473 d_sanemcmp=''
474 d_select=''
475 d_sem=''
476 d_semctl=''
477 d_semget=''
478 d_semop=''
479 d_setegid=''
480 d_seteuid=''
481 d_setgrent=''
482 d_setgrps=''
483 d_sethent=''
484 d_setlinebuf=''
485 d_setlocale=''
486 d_setnent=''
487 d_setpent=''
488 d_setpgid=''
489 d_setpgrp2=''
490 d_bsdsetpgrp=''
491 d_setpgrp=''
492 d_setprior=''
493 d_setproctitle=''
494 d_setpwent=''
495 d_setregid=''
496 d_setresgid=''
497 d_setresuid=''
498 d_setreuid=''
499 d_setrgid=''
500 d_setruid=''
501 d_setsent=''
502 d_setsid=''
503 d_setvbuf=''
504 d_sfio=''
505 usesfio=''
506 d_shm=''
507 d_shmat=''
508 d_shmatprototype=''
509 shmattype=''
510 d_shmctl=''
511 d_shmdt=''
512 d_shmget=''
513 d_sigaction=''
514 d_sigsetjmp=''
515 d_msg_ctrunc=''
516 d_msg_dontroute=''
517 d_msg_oob=''
518 d_msg_peek=''
519 d_msg_proxy=''
520 d_oldsock=''
521 d_scm_rights=''
522 d_socket=''
523 d_sockpair=''
524 sockethdr=''
525 socketlib=''
526 d_socklen_t=''
527 d_socks5_init=''
528 d_sqrtl=''
529 d_statblks=''
530 d_statfs_f_flags=''
531 d_statfs_s=''
532 d_fstatvfs=''
533 d_statvfs=''
534 d_stdio_cnt_lval=''
535 d_stdio_ptr_lval=''
536 d_stdiobase=''
537 d_stdstdio=''
538 stdio_base=''
539 stdio_bufsiz=''
540 stdio_cnt=''
541 stdio_filbuf=''
542 stdio_ptr=''
543 d_index=''
544 d_strchr=''
545 d_strcoll=''
546 d_strctcpy=''
547 d_strerrm=''
548 d_strerror=''
549 d_sysernlst=''
550 d_syserrlst=''
551 d_strtod=''
552 d_strtol=''
553 d_strtold=''
554 d_strtoll=''
555 d_strtoul=''
556 d_strtoull=''
557 d_strtouq=''
558 d_strxfrm=''
559 d_symlink=''
560 d_syscall=''
561 d_sysconf=''
562 d_system=''
563 d_tcgetpgrp=''
564 d_tcsetpgrp=''
565 d_telldirproto=''
566 d_time=''
567 timetype=''
568 clocktype=''
569 d_times=''
570 d_truncate=''
571 d_tzname=''
572 d_umask=''
573 d_semctl_semid_ds=''
574 d_semctl_semun=''
575 d_union_semun=''
576 d_ustat=''
577 d_vfork=''
578 usevfork=''
579 d_voidsig=''
580 signal_t=''
581 d_volatile=''
582 d_charvspr=''
583 d_vprintf=''
584 d_wait4=''
585 d_waitpid=''
586 d_wcstombs=''
587 d_wctomb=''
588 dlext=''
589 cccdlflags=''
590 ccdlflags=''
591 dlsrc=''
592 ld=''
593 lddlflags=''
594 usedl=''
595 doublesize=''
596 ebcdic=''
597 fflushNULL=''
598 fflushall=''
599 fpossize=''
600 fpostype=''
601 gccosandvers=''
602 gccversion=''
603 gidformat=''
604 gidsign=''
605 gidsize=''
606 gidtype=''
607 groupstype=''
608 h_fcntl=''
609 h_sysfile=''
610 i_arpainet=''
611 db_hashtype=''
612 db_prefixtype=''
613 i_db=''
614 i_dbm=''
615 i_rpcsvcdbm=''
616 d_dirnamlen=''
617 direntrytype=''
618 i_dirent=''
619 i_dld=''
620 i_dlfcn=''
621 i_fcntl=''
622 i_float=''
623 i_gdbm=''
624 d_grpasswd=''
625 i_grp=''
626 i_iconv=''
627 i_ieeefp=''
628 i_inttypes=''
629 i_libutil=''
630 i_limits=''
631 i_locale=''
632 i_machcthr=''
633 i_malloc=''
634 i_math=''
635 i_memory=''
636 i_mntent=''
637 i_ndbm=''
638 i_netdb=''
639 i_neterrno=''
640 i_netinettcp=''
641 i_niin=''
642 i_sysin=''
643 i_poll=''
644 i_prot=''
645 i_pthread=''
646 d_pwage=''
647 d_pwchange=''
648 d_pwclass=''
649 d_pwcomment=''
650 d_pwexpire=''
651 d_pwgecos=''
652 d_pwpasswd=''
653 d_pwquota=''
654 i_pwd=''
655 i_sfio=''
656 i_shadow=''
657 i_socks=''
658 i_stddef=''
659 i_stdlib=''
660 i_string=''
661 strings=''
662 i_sunmath=''
663 i_sysaccess=''
664 i_sysdir=''
665 i_sysfile=''
666 d_voidtty=''
667 i_bsdioctl=''
668 i_sysfilio=''
669 i_sysioctl=''
670 i_syssockio=''
671 i_syslog=''
672 i_sysmman=''
673 i_sysmode=''
674 i_sysmount=''
675 i_sysndir=''
676 i_sysparam=''
677 i_sysresrc=''
678 i_syssecrt=''
679 i_sysselct=''
680 i_sysstat=''
681 i_sysstatfs=''
682 i_sysstatvfs=''
683 i_systimes=''
684 i_systypes=''
685 i_sysuio=''
686 i_sysun=''
687 i_sysutsname=''
688 i_sysvfs=''
689 i_syswait=''
690 i_sgtty=''
691 i_termio=''
692 i_termios=''
693 i_systime=''
694 i_systimek=''
695 i_time=''
696 timeincl=''
697 i_unistd=''
698 i_ustat=''
699 i_utime=''
700 i_values=''
701 i_stdarg=''
702 i_varargs=''
703 i_varhdr=''
704 i_vfork=''
705 inc_version_list=''
706 inc_version_list_init=''
707 installprefix=''
708 installprefixexp=''
709 installstyle=''
710 installusrbinperl=''
711 intsize=''
712 longsize=''
713 shortsize=''
714 libc=''
715 ldlibpthname=''
716 libperl=''
717 shrpenv=''
718 useshrplib=''
719 glibpth=''
720 libpth=''
721 loclibpth=''
722 plibpth=''
723 xlibpth=''
724 ignore_versioned_solibs=''
725 libs=''
726 libsdirs=''
727 libsfiles=''
728 libsfound=''
729 libspath=''
730 lns=''
731 d_PRIEldbl=''
732 d_PRIFldbl=''
733 d_PRIGldbl=''
734 d_PRIeldbl=''
735 d_PRIfldbl=''
736 d_PRIgldbl=''
737 sPRIEldbl=''
738 sPRIFldbl=''
739 sPRIGldbl=''
740 sPRIeldbl=''
741 sPRIfldbl=''
742 sPRIgldbl=''
743 lseeksize=''
744 lseektype=''
745 make_set_make=''
746 d_mymalloc=''
747 freetype=''
748 mallocobj=''
749 mallocsrc=''
750 malloctype=''
751 usemymalloc=''
752 installman1dir=''
753 man1dir=''
754 man1direxp=''
755 man1ext=''
756 installman3dir=''
757 man3dir=''
758 man3direxp=''
759 man3ext=''
760 huge=''
761 large=''
762 medium=''
763 models=''
764 small=''
765 split=''
766 modetype=''
767 multiarch=''
768 mydomain=''
769 myhostname=''
770 phostname=''
771 c=''
772 n=''
773 d_eofnblk=''
774 eagain=''
775 o_nonblock=''
776 rd_nodata=''
777 netdb_hlen_type=''
778 netdb_host_type=''
779 netdb_name_type=''
780 netdb_net_type=''
781 groupcat=''
782 hostcat=''
783 passcat=''
784 orderlib=''
785 ranlib=''
786 d_perl_otherlibdirs=''
787 otherlibdirs=''
788 package=''
789 spackage=''
790 pager=''
791 api_revision=''
792 api_subversion=''
793 api_version=''
794 api_versionstring=''
795 patchlevel=''
796 revision=''
797 subversion=''
798 version=''
799 perl5=''
800 perladmin=''
801 perlpath=''
802 d_nv_preserves_uv=''
803 d_nv_preserves_uv_bits=''
804 i16size=''
805 i16type=''
806 i32size=''
807 i32type=''
808 i64size=''
809 i64type=''
810 i8size=''
811 i8type=''
812 ivsize=''
813 ivtype=''
814 nvsize=''
815 nvtype=''
816 u16size=''
817 u16type=''
818 u32size=''
819 u32type=''
820 u64size=''
821 u64type=''
822 u8size=''
823 u8type=''
824 uvsize=''
825 uvtype=''
826 ivdformat=''
827 nvEformat=''
828 nvFformat=''
829 nvGformat=''
830 nveformat=''
831 nvfformat=''
832 nvgformat=''
833 uvXformat=''
834 uvoformat=''
835 uvuformat=''
836 uvxformat=''
837 pidtype=''
838 prefix=''
839 prefixexp=''
840 installprivlib=''
841 privlib=''
842 privlibexp=''
843 prototype=''
844 ptrsize=''
845 d_PRIX64=''
846 d_PRId64=''
847 d_PRIi64=''
848 d_PRIo64=''
849 d_PRIu64=''
850 d_PRIx64=''
851 sPRIX64=''
852 sPRId64=''
853 sPRIi64=''
854 sPRIo64=''
855 sPRIu64=''
856 sPRIx64=''
857 d_quad=''
858 quadkind=''
859 quadtype=''
860 uquadtype=''
861 drand01=''
862 randbits=''
863 randfunc=''
864 randseedtype=''
865 seedfunc=''
866 installscript=''
867 scriptdir=''
868 scriptdirexp=''
869 selectminbits=''
870 selecttype=''
871 sh=''
872 sig_count=''
873 sig_name=''
874 sig_name_init=''
875 sig_num=''
876 sig_num_init=''
877 installsitearch=''
878 sitearch=''
879 sitearchexp=''
880 installsitebin=''
881 sitebin=''
882 sitebinexp=''
883 installsitelib=''
884 sitelib=''
885 sitelib_stem=''
886 sitelibexp=''
887 siteprefix=''
888 siteprefixexp=''
889 sizesize=''
890 sizetype=''
891 so=''
892 socksizetype=''
893 sharpbang=''
894 shsharp=''
895 spitshell=''
896 src=''
897 ssizetype=''
898 startperl=''
899 startsh=''
900 stdchar=''
901 d_stdio_stream_array=''
902 stdio_stream_array=''
903 sysman=''
904 trnl=''
905 uidformat=''
906 uidsign=''
907 uidsize=''
908 uidtype=''
909 archname64=''
910 use64bitall=''
911 use64bitint=''
912 ccflags_uselargefiles=''
913 ldflags_uselargefiles=''
914 libswanted_uselargefiles=''
915 uselargefiles=''
916 uselongdouble=''
917 usemorebits=''
918 usemultiplicity=''
919 nm_opt=''
920 nm_so_opt=''
921 runnm=''
922 usenm=''
923 useperlio=''
924 usesocks=''
925 d_oldpthreads=''
926 use5005threads=''
927 useithreads=''
928 usethreads=''
929 incpath=''
930 mips_type=''
931 usrinc=''
932 d_vendorarch=''
933 installvendorarch=''
934 vendorarch=''
935 vendorarchexp=''
936 d_vendorbin=''
937 installvendorbin=''
938 vendorbin=''
939 vendorbinexp=''
940 d_vendorlib=''
941 installvendorlib=''
942 vendorlib=''
943 vendorlib_stem=''
944 vendorlibexp=''
945 usevendorprefix=''
946 vendorprefix=''
947 vendorprefixexp=''
948 defvoidused=''
949 voidflags=''
950 pm_apiversion=''
951 xs_apiversion=''
952 CONFIG=''
953
954 define='define'
955 undef='undef'
956 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
957 rmlist=''
958
959 : We must find out about Eunice early
960 eunicefix=':'
961 if test -f /etc/unixtovms; then
962         eunicefix=/etc/unixtovms
963 fi
964 if test -f /etc/unixtovms.exe; then
965         eunicefix=/etc/unixtovms.exe
966 fi
967
968 i_whoami=''
969 : set useposix=false in your hint file to disable the POSIX extension.
970 useposix=true
971 : set useopcode=false in your hint file to disable the Opcode extension.
972 useopcode=true
973 : Trailing extension.  Override this in a hint file, if needed.
974 _exe=''
975 : Extra object files, if any, needed on this platform.
976 archobjs=''
977 : Possible local include directories to search.
978 : Set locincpth to "" in a hint file to defeat local include searches.
979 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
980 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
981 :
982 : no include file wanted by default
983 inclwanted=''
984
985 groupstype=''
986 : change the next line if compiling for Xenix/286 on Xenix/386
987 xlibpth='/usr/lib/386 /lib/386'
988 : Possible local library directories to search.
989 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
990 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
991
992 : general looking path for locating libraries
993 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
994 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
995 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
996 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
997 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
998
999 : Private path used by Configure to find libraries.  Its value
1000 : is prepended to libpth. This variable takes care of special
1001 : machines, like the mips.  Usually, it should be empty.
1002 plibpth=''
1003
1004 : default library list
1005 libswanted=''
1006 : some systems want to use only the non-versioned libso:s
1007 ignore_versioned_solibs=''
1008 ccflags_uselargefiles=''
1009 ldflags_uselargefiles=''
1010 libswanted_uselargefiles=''
1011 : set usemultiplicity on the Configure command line to enable multiplicity.
1012 : set usesocks on the Configure command line to enable socks.
1013 : set usethreads on the Configure command line to enable threads.
1014 : full support for void wanted by default
1015 defvoidused=15
1016
1017 : List of libraries we want.
1018 : If anyone needs -lnet, put it in a hint file.
1019 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1020 libswanted="$libswanted dld ld sun m c cposix posix"
1021 libswanted="$libswanted ndir dir crypt sec"
1022 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1023 : We probably want to search /usr/shlib before most other libraries.
1024 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1025 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1026 glibpth="/usr/shlib $glibpth"
1027 : Do not use vfork unless overridden by a hint file.
1028 usevfork=false
1029
1030 : Find the basic shell for Bourne shell scripts
1031 case "$sh" in
1032 '')
1033         case "$SYSTYPE" in
1034         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1035         *) xxx='/bin/sh';;
1036         esac
1037         if test -f "$xxx"; then
1038                 sh="$xxx"
1039         else
1040                 : Build up a list and do a single loop so we can 'break' out.
1041                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1042                 for xxx in sh bash ksh pdksh ash; do
1043                         for p in $pth; do
1044                                 try="$try ${p}/${xxx}"
1045                         done
1046                 done
1047                 for xxx in $try; do
1048                         if test -f "$xxx"; then
1049                                 sh="$xxx";
1050                                 break
1051                         elif test -f "$xxx.exe"; then
1052                                 sh="$xxx";
1053                                 break
1054                         fi
1055                 done
1056         fi
1057         ;;
1058 esac
1059
1060 case "$sh" in
1061 '')     cat <<EOM >&2
1062 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1063
1064 Usually it's in /bin/sh.  How did you even get this far?
1065 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1066 we'll try to straighten this all out.
1067 EOM
1068         exit 1
1069         ;;
1070 esac
1071
1072 : see if sh knows # comments
1073 if `$sh -c '#' >/dev/null 2>&1`; then
1074         shsharp=true
1075         spitshell=cat
1076         xcat=/bin/cat
1077         test -f $xcat || xcat=/usr/bin/cat
1078         echo "#!$xcat" >try
1079         $eunicefix try
1080         chmod +x try
1081         ./try > today
1082         if test -s today; then
1083                 sharpbang='#!'
1084         else
1085                 echo "#! $xcat" > try
1086                 $eunicefix try
1087                 chmod +x try
1088                 ./try > today
1089                 if test -s today; then
1090                         sharpbang='#! '
1091                 else
1092                         sharpbang=': use '
1093                 fi
1094         fi
1095 else
1096         echo " "
1097         echo "Your $sh doesn't grok # comments--I will strip them later on."
1098         shsharp=false
1099         cd ..
1100         echo "exec grep -v '^[  ]*#'" >spitshell
1101         chmod +x spitshell
1102         $eunicefix spitshell
1103         spitshell=`pwd`/spitshell
1104         cd UU
1105         echo "I presume that if # doesn't work, #! won't work either!"
1106         sharpbang=': use '
1107 fi
1108 rm -f try today
1109
1110 : figure out how to guarantee sh startup
1111 case "$startsh" in
1112 '') startsh=${sharpbang}${sh} ;;
1113 *)
1114 esac
1115 cat >try <<EOSS
1116 $startsh
1117 set abc
1118 test "$?abc" != 1
1119 EOSS
1120
1121 chmod +x try
1122 $eunicefix try
1123 if ./try; then
1124         : echo "Yup, it does."
1125 else
1126         echo "Hmm... '$startsh' does not guarantee sh startup..."
1127         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1128 fi
1129 rm -f try
1130
1131
1132 : Save command line options in file UU/cmdline.opt for later use in
1133 : generating config.sh.
1134 cat > cmdline.opt <<EOSH
1135 # Configure command line arguments.
1136 config_arg0='$0'
1137 config_args='$*'
1138 config_argc=$#
1139 EOSH
1140 argn=1
1141 for arg in "$@"; do
1142         cat >>cmdline.opt <<EOSH
1143 config_arg$argn='$arg'
1144 EOSH
1145         argn=`expr $argn + 1`
1146 done
1147
1148 : produce awk script to parse command line options
1149 cat >options.awk <<'EOF'
1150 BEGIN {
1151         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1152
1153         len = length(optstr);
1154         for (i = 1; i <= len; i++) {
1155                 c = substr(optstr, i, 1);
1156                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1157                 if (a == ":") {
1158                         arg[c] = 1;
1159                         i++;
1160                 }
1161                 opt[c] = 1;
1162         }
1163 }
1164 {
1165         expect = 0;
1166         str = $0;
1167         if (substr(str, 1, 1) != "-") {
1168                 printf("'%s'\n", str);
1169                 next;
1170         }
1171         len = length($0);
1172         for (i = 2; i <= len; i++) {
1173                 c = substr(str, i, 1);
1174                 if (!opt[c]) {
1175                         printf("-%s\n", substr(str, i));
1176                         next;
1177                 }
1178                 printf("-%s\n", c);
1179                 if (arg[c]) {
1180                         if (i < len)
1181                                 printf("'%s'\n", substr(str, i + 1));
1182                         else
1183                                 expect = 1;
1184                         next;
1185                 }
1186         }
1187 }
1188 END {
1189         if (expect)
1190                 print "?";
1191 }
1192 EOF
1193
1194 : process the command line options
1195 set X `for arg in "$@"; do echo "X$arg"; done |
1196         sed -e s/X// | awk -f options.awk`
1197 eval "set $*"
1198 shift
1199 rm -f options.awk
1200
1201 : set up default values
1202 fastread=''
1203 reuseval=false
1204 config_sh=''
1205 alldone=''
1206 error=''
1207 silent=''
1208 extractsh=''
1209 override=''
1210 knowitall=''
1211 rm -f optdef.sh posthint.sh
1212 cat >optdef.sh <<EOS
1213 $startsh
1214 EOS
1215
1216
1217 : option parsing
1218 while test $# -gt 0; do
1219         case "$1" in
1220         -d) shift; fastread=yes;;
1221         -e) shift; alldone=cont;;
1222         -f)
1223                 shift
1224                 cd ..
1225                 if test -r "$1"; then
1226                         config_sh="$1"
1227                 else
1228                         echo "$me: cannot read config file $1." >&2
1229                         error=true
1230                 fi
1231                 cd UU
1232                 shift;;
1233         -h) shift; error=true;;
1234         -r) shift; reuseval=true;;
1235         -s) shift; silent=true; realsilent=true;;
1236         -E) shift; alldone=exit;;
1237         -K) shift; knowitall=true;;
1238         -O) shift; override=true;;
1239         -S) shift; silent=true; extractsh=true;;
1240         -D)
1241                 shift
1242                 case "$1" in
1243                 *=)
1244                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1245                         echo "$me: ignoring -D $1" >&2
1246                         ;;
1247                 *=*) echo "$1" | \
1248                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1249                 *) echo "$1='define'" >> optdef.sh;;
1250                 esac
1251                 shift
1252                 ;;
1253         -U)
1254                 shift
1255                 case "$1" in
1256                 *=) echo "$1" >> optdef.sh;;
1257                 *=*)
1258                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1259                         echo "$me: ignoring -U $1" >&2
1260                         ;;
1261                 *) echo "$1='undef'" >> optdef.sh;;
1262                 esac
1263                 shift
1264                 ;;
1265         -A)
1266             shift
1267             xxx=''
1268             yyy="$1"
1269             zzz=''
1270             uuu=undef
1271             case "$yyy" in
1272             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1273                  case "$zzz" in
1274                  *:*) zzz='' ;;
1275                  *)   xxx=append
1276                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1277                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1278                  esac
1279                  ;;
1280             esac
1281             case "$xxx" in
1282             '')  case "$yyy" in
1283                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1284                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1285                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1286                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1287                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1288                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1289                  esac
1290                  ;;       
1291             esac
1292             case "$xxx" in
1293             append)
1294                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1295             clear)
1296                 echo "$yyy=''"                  >> posthint.sh ;;
1297             define)
1298                 case "$zzz" in
1299                 '') zzz=define ;;
1300                 esac
1301                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1302             eval)
1303                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1304             prepend)
1305                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1306             undef)
1307                 case "$zzz" in
1308                 '') zzz="$uuu" ;;
1309                 esac
1310                 echo "$yyy=$zzz"                >> posthint.sh ;;
1311             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1312             esac
1313             shift
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         case "$extractsh" in
1365         true) ;;
1366         *)
1367                 if test ! -t 0; then
1368                         echo "Say 'sh Configure', not 'sh <Configure'"
1369                         exit 1
1370                 fi
1371                 ;;
1372         esac
1373         ;;
1374 esac
1375
1376 exec 4>&1
1377 case "$silent" in
1378 true) exec 1>/dev/null;;
1379 esac
1380
1381 : run the defines and the undefines, if any, but leave the file out there...
1382 touch optdef.sh
1383 . ./optdef.sh
1384 : create the posthint manipulation script and leave the file out there...
1385 touch posthint.sh
1386
1387 : set package name
1388 package=perl5
1389 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1390 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1391 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1392 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1393 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1394 esac
1395
1396 : Some greps do not return status, grrr.
1397 echo "grimblepritz" >grimble
1398 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1399         contains=contains
1400 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1401         contains=grep
1402 else
1403         contains=contains
1404 fi
1405 rm -f grimble
1406 : the following should work in any shell
1407 case "$contains" in
1408 contains*)
1409         echo " "
1410         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1411         cat >contains <<'EOSS'
1412 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1413 EOSS
1414 chmod +x contains
1415 esac
1416
1417 : Find the path to the source tree
1418 case "$src" in
1419 '') case "$0" in
1420     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1421          case "$src" in
1422          /*)    ;;
1423          *)     src=`cd ../$src && pwd` ;;
1424          esac
1425          ;;
1426     *)   src='.';;
1427     esac;;
1428 esac
1429 case "$src" in
1430 '')     src=/
1431         rsrc=/
1432         ;;
1433 /*) rsrc="$src";;
1434 *) rsrc="../$src";;
1435 esac
1436 if test -f $rsrc/Configure && \
1437         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1438 then
1439    : found it, so we are ok.
1440 else
1441         rsrc=''
1442         for src in . .. ../.. ../../.. ../../../..; do
1443                 if test -f ../$src/Configure && \
1444                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1445                 then
1446                         rsrc=../$src
1447                         break
1448                 fi
1449         done
1450 fi
1451 case "$rsrc" in
1452 '')
1453         cat <<EOM >&4
1454
1455 Sorry, I can't seem to locate the source dir for $package.  Please start
1456 Configure with an explicit path -- i.e. /some/path/Configure.
1457
1458 EOM
1459         exit 1
1460         ;;
1461 ../.)   rsrc='..';;
1462 *)
1463         echo " "
1464         echo "Sources for $package found in \"$src\"." >&4
1465         ;;
1466 esac
1467
1468 : script used to extract .SH files with variable substitutions
1469 cat >extract <<'EOS'
1470 CONFIGDOTSH=true
1471 echo "Doing variable substitutions on .SH files..."
1472 if test -f $src/MANIFEST; then
1473         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1474 else
1475         echo "(Looking for .SH files under the source directory.)"
1476         set x `(cd $src; find . -name "*.SH" -print)`
1477 fi
1478 shift
1479 case $# in
1480 0) set x `(cd $src; echo *.SH)`; shift;;
1481 esac
1482 if test ! -f $src/$1; then
1483         shift
1484 fi
1485 mkdir_p='
1486 name=$1;
1487 create="";
1488 while test $name; do
1489         if test ! -d "$name"; then
1490                 create="$name $create";
1491                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1492                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1493         else
1494                 name="";
1495         fi;
1496 done;
1497 for file in $create; do
1498         mkdir $file;
1499 done
1500 '
1501 for file in $*; do
1502         case "$src" in
1503         ".")
1504                 case "$file" in
1505                 */*)
1506                         dir=`expr X$file : 'X\(.*\)/'`
1507                         file=`expr X$file : 'X.*/\(.*\)'`
1508                         (cd $dir && . ./$file)
1509                         ;;
1510                 *)
1511                         . ./$file
1512                         ;;
1513                 esac
1514                 ;;
1515         *)
1516                 case "$file" in
1517                 */*)
1518                         dir=`expr X$file : 'X\(.*\)/'`
1519                         file=`expr X$file : 'X.*/\(.*\)'`
1520                         (set x $dir; shift; eval $mkdir_p)
1521                         sh <$src/$dir/$file
1522                         ;;
1523                 *)
1524                         sh <$src/$file
1525                         ;;
1526                 esac
1527                 ;;
1528         esac
1529 done
1530 if test -f $src/config_h.SH; then
1531         if test ! -f config.h; then
1532         : oops, they left it out of MANIFEST, probably, so do it anyway.
1533         . $src/config_h.SH
1534         fi
1535 fi
1536 EOS
1537
1538 : extract files and exit if asked to do so
1539 case "$extractsh" in
1540 true)
1541         case "$realsilent" in
1542         true) ;;
1543         *) exec 1>&4;;
1544         esac
1545         case "$config_sh" in
1546         '') config_sh='config.sh';;
1547         esac
1548         echo " "
1549         echo "Fetching answers from $config_sh..."
1550         cd ..
1551         . $config_sh
1552         test "$override" && . ./optdef.sh
1553         echo " "
1554         . UU/extract
1555         rm -rf UU
1556         echo "Done."
1557         exit 0
1558         ;;
1559 esac
1560
1561 : Eunice requires " " instead of "", can you believe it
1562 echo " "
1563 : Here we go...
1564 echo "Beginning of configuration questions for $package."
1565
1566 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1567
1568 : first determine how to suppress newline on echo command
1569 echo " "
1570 echo "Checking echo to see how to suppress newlines..."
1571 (echo "hi there\c" ; echo " ") >.echotmp
1572 if $contains c .echotmp >/dev/null 2>&1 ; then
1573         echo "...using -n."
1574         n='-n'
1575         c=''
1576 else
1577         cat <<'EOM'
1578 ...using \c
1579 EOM
1580         n=''
1581         c='\c'
1582 fi
1583 echo $n "The star should be here-->$c"
1584 echo '*'
1585 rm -f .echotmp
1586
1587 : Now test for existence of everything in MANIFEST
1588 echo " "
1589 if test -f $rsrc/MANIFEST; then
1590         echo "First let's make sure your kit is complete.  Checking..." >&4
1591         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1592         rm -f missing
1593         tmppwd=`pwd`
1594         for filelist in x??; do
1595                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1596         done
1597         if test -s missing; then
1598                 cat missing >&4
1599                 cat >&4 <<'EOM'
1600
1601 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1602
1603 You have the option of continuing the configuration process, despite the
1604 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1605 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1606 and contact the author (perlbug@perl.com).
1607
1608 EOM
1609                 echo $n "Continue? [n] $c" >&4
1610                 read ans
1611                 case "$ans" in
1612                 y*)
1613                         echo "Continuing..." >&4
1614                         rm -f missing
1615                         ;;
1616                 *)
1617                         echo "ABORTING..." >&4
1618                         kill $$
1619                         ;;
1620                 esac
1621         else
1622                 echo "Looks good..."
1623         fi
1624 else
1625         echo "There is no MANIFEST file.  I hope your kit is complete !"
1626 fi
1627 rm -f missing x??
1628
1629 echo " "
1630 : Find the appropriate value for a newline for tr
1631 if test -n "$DJGPP"; then
1632        trnl='\012'
1633 fi
1634 if test X"$trnl" = X; then
1635         case "`echo foo|tr '\n' x 2>/dev/null`" in
1636         foox) trnl='\n' ;;
1637         esac
1638 fi
1639 if test X"$trnl" = X; then
1640         case "`echo foo|tr '\012' x 2>/dev/null`" in
1641         foox) trnl='\012' ;;
1642         esac
1643 fi
1644 if test X"$trnl" = X; then
1645         cat <<EOM >&2
1646
1647 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1648
1649 EOM
1650         exit 1
1651 fi
1652
1653 : compute the number of columns on the terminal for proper question formatting
1654 case "$COLUMNS" in
1655 '') COLUMNS='80';;
1656 esac
1657
1658 : set up the echo used in my read
1659 myecho="case \"\$xxxm\" in
1660 '') echo $n \"\$rp $c\" >&4;;
1661 *) case \"\$rp\" in
1662         '') echo $n \"[\$xxxm] $c\";;
1663         *)
1664                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1665                         echo \"\$rp\" >&4
1666                         echo $n \"[\$xxxm] $c\" >&4
1667                 else
1668                         echo $n \"\$rp [\$xxxm] $c\" >&4
1669                 fi
1670                 ;;
1671         esac;;
1672 esac"
1673
1674 : now set up to do reads with possible shell escape and default assignment
1675 cat <<EOSC >myread
1676 $startsh
1677 xxxm=\$dflt
1678 $myecho
1679 ans='!'
1680 case "\$fastread" in
1681 yes) case "\$dflt" in
1682         '') ;;
1683         *) ans='';
1684                 case "\$silent-\$rp" in
1685                 true-) ;;
1686                 *) echo " " >&4;;
1687                 esac;;
1688         esac;;
1689 *) case "\$silent" in
1690         true) case "\$rp" in
1691                 '') ans='';;
1692                 esac;;
1693         esac;;
1694 esac
1695 while expr "X\$ans" : "X!" >/dev/null; do
1696         read answ
1697         set x \$xxxm
1698         shift
1699         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1700         case  "\$answ" in
1701         "!")
1702                 sh 1>&4
1703                 echo " "
1704                 $myecho
1705                 ;;
1706         !*)
1707                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1708                 shift
1709                 sh 1>&4 -c "\$*"
1710                 echo " "
1711                 $myecho
1712                 ;;
1713         "\$ans")
1714                 case "\$ans" in
1715                 \\&*)
1716                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1717                         shift
1718                         case "\$1" in
1719                         -d)
1720                                 fastread=yes
1721                                 echo "(OK, I'll run with -d after this question.)" >&4
1722                                 ;;
1723                         -*)
1724                                 echo "*** Sorry, \$1 not supported yet." >&4
1725                                 ;;
1726                         esac
1727                         $myecho
1728                         ans=!
1729                         ;;
1730                 esac;;
1731         *)
1732                 case "\$aok" in
1733                 y)
1734                         echo "*** Substitution done -- please confirm."
1735                         xxxm="\$ans"
1736                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1737                         xxxm="\$ans"
1738                         ans=!
1739                         ;;
1740                 *)
1741                         echo "*** Error -- try again."
1742                         ans=!
1743                         ;;
1744                 esac
1745                 $myecho
1746                 ;;
1747         esac
1748         case "\$ans\$xxxm\$nostick" in
1749         '')
1750                 ans=!
1751                 $myecho
1752                 ;;
1753         esac
1754 done
1755 case "\$ans" in
1756 '') ans="\$xxxm";;
1757 esac
1758 EOSC
1759
1760 : create .config dir to save info across Configure sessions
1761 test -d ../.config || mkdir ../.config
1762 cat >../.config/README <<EOF
1763 This directory created by Configure to save information that should
1764 persist across sessions for $package.
1765
1766 You may safely delete it if you wish.
1767 EOF
1768
1769 xpatchlevel=`awk '/define[      ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1770 case "$usedevel" in
1771 $define|true|[yY]*) ;;
1772 *) case "$xpatchlevel" in
1773    *[13579])
1774         cat >&4 <<EOH
1775 *** WHOA THERE!!! ***
1776
1777     This is an UNSTABLE DEVELOPMENT release.
1778     (The patchlevel, $xpatchlevel, is odd--as opposed to even,
1779      and that signifies a development release.  If you want a
1780      maintenance release, you want an even-numbered release.)
1781
1782     Do ***NOT*** install this into production use.
1783     Data corruption and crashes are possible.
1784
1785     It is most seriously suggested that you do not continue any further
1786     unless you want to help in developing and debugging Perl.
1787
1788 EOH
1789         rp='Do you really want to continue?'
1790         dflt='n'
1791         . ./myread
1792         case "$ans" in
1793         [yY]) echo >&4 "Okay, continuing." ;;
1794         *) echo >&4 "Okay, bye."
1795            exit 1
1796            ;;
1797         esac
1798         ;;
1799     esac
1800     ;;
1801 esac
1802
1803 : general instructions
1804 needman=true
1805 firsttime=true
1806 user=`(logname) 2>/dev/null`
1807 case "$user" in
1808 '') user=`whoami 2>&1`;;
1809 esac
1810 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1811         firsttime=false
1812         echo " "
1813         rp='Would you like to see the instructions?'
1814         dflt=n
1815         . ./myread
1816         case "$ans" in
1817         [yY]*) ;;
1818         *) needman=false;;
1819         esac
1820 fi
1821 if $needman; then
1822         cat <<EOH
1823
1824 This installation shell script will examine your system and ask you questions
1825 to determine how the perl5 package should be installed. If you get
1826 stuck on a question, you may use a ! shell escape to start a subshell or
1827 execute a command.  Many of the questions will have default answers in square
1828 brackets; typing carriage return will give you the default.
1829
1830 On some of the questions which ask for file or directory names you are allowed
1831 to use the ~name construct to specify the login directory belonging to "name",
1832 even if you don't have a shell which knows about that.  Questions where this is
1833 allowed will be marked "(~name ok)".
1834
1835 EOH
1836         rp=''
1837         dflt='Type carriage return to continue'
1838         . ./myread
1839         cat <<'EOH'
1840
1841 The prompter used in this script allows you to use shell variables and
1842 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1843 in the default answer, as if the default line was a set of arguments given to a
1844 script shell.  This means you may also use $* to repeat the whole default line,
1845 so you do not have to re-type everything to add something to the default.
1846
1847 Everytime there is a substitution, you will have to confirm.  If there is an
1848 error (e.g. an unmatched backtick), the default answer will remain unchanged
1849 and you will be prompted again.
1850
1851 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1852 the questions and use the computed defaults (or the previous answers if there
1853 was already a config.sh file). Type 'Configure -h' for a list of options.
1854 You may also start interactively and then answer '& -d' at any prompt to turn
1855 on the non-interactive behaviour for the remainder of the execution.
1856
1857 EOH
1858         . ./myread
1859         cat <<EOH
1860
1861 Much effort has been expended to ensure that this shell script will run on any
1862 Unix system.  If despite that it blows up on yours, your best bet is to edit
1863 Configure and run it again.  If you can't run Configure for some reason,
1864 you'll have to generate a config.sh file by hand.  Whatever problems you
1865 have, let me (perlbug@perl.com) know how I blew it.
1866
1867 This installation script affects things in two ways:
1868
1869 1) it may do direct variable substitutions on some of the files included
1870    in this kit.
1871 2) it builds a config.h file for inclusion in C programs.  You may edit
1872    any of these files as the need arises after running this script.
1873
1874 If you make a mistake on a question, there is no easy way to back up to it
1875 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1876 files.  Configure will offer to let you do this before it runs the SH files.
1877
1878 EOH
1879         dflt='Type carriage return to continue'
1880         . ./myread
1881         case "$firsttime" in
1882         true) echo $user >>../.config/instruct;;
1883         esac
1884 fi
1885
1886 : find out where common programs are
1887 echo " "
1888 echo "Locating common programs..." >&4
1889 cat <<EOSC >loc
1890 $startsh
1891 case \$# in
1892 0) exit 1;;
1893 esac
1894 thing=\$1
1895 shift
1896 dflt=\$1
1897 shift
1898 for dir in \$*; do
1899         case "\$thing" in
1900         .)
1901         if test -d \$dir/\$thing; then
1902                 echo \$dir
1903                 exit 0
1904         fi
1905         ;;
1906         *)
1907         for thisthing in \$dir/\$thing; do
1908                 : just loop through to pick last item
1909         done
1910         if test -f \$thisthing; then
1911                 echo \$thisthing
1912                 exit 0
1913         elif test -f \$dir/\$thing.exe; then
1914                 if test -n "$DJGPP"; then
1915                         echo \$dir/\$thing.exe
1916                 else
1917                         : on Eunice apparently
1918                         echo \$dir/\$thing
1919                 fi
1920                 exit 0
1921         fi
1922         ;;
1923         esac
1924 done
1925 echo \$dflt
1926 exit 1
1927 EOSC
1928 chmod +x loc
1929 $eunicefix loc
1930 loclist="
1931 awk
1932 cat
1933 comm
1934 cp
1935 echo
1936 expr
1937 grep
1938 ls
1939 make
1940 mkdir
1941 rm
1942 sed
1943 sort
1944 touch
1945 tr
1946 uniq
1947 "
1948 trylist="
1949 Mcc
1950 ar
1951 byacc
1952 cpp
1953 csh
1954 date
1955 egrep
1956 gzip
1957 less
1958 ln
1959 more
1960 nm
1961 nroff
1962 pg
1963 test
1964 uname
1965 zip
1966 "
1967 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1968 pth="$pth /lib /usr/lib"
1969 for file in $loclist; do
1970         eval xxx=\$$file
1971         case "$xxx" in
1972         /*|?:[\\/]*)
1973                 if test -f "$xxx"; then
1974                         : ok
1975                 else
1976                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1977                         xxx=`./loc $file $file $pth`
1978                 fi
1979                 ;;
1980         '') xxx=`./loc $file $file $pth`;;
1981         *) xxx=`./loc $xxx $xxx $pth`;;
1982         esac
1983         eval $file=$xxx
1984         eval _$file=$xxx
1985         case "$xxx" in
1986         /*)
1987                 echo $file is in $xxx.
1988                 ;;
1989         ?:[\\/]*)
1990                 echo $file is in $xxx.
1991                 ;;
1992         *)
1993                 echo "I don't know where '$file' is, and my life depends on it." >&4
1994                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1995                 exit 1
1996                 ;;
1997         esac
1998 done
1999 echo " "
2000 echo "Don't worry if any of the following aren't found..."
2001 say=offhand
2002 for file in $trylist; do
2003         eval xxx=\$$file
2004         case "$xxx" in
2005         /*|?:[\\/]*)
2006                 if test -f "$xxx"; then
2007                         : ok
2008                 else
2009                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2010                         xxx=`./loc $file $file $pth`
2011                 fi
2012                 ;;
2013         '') xxx=`./loc $file $file $pth`;;
2014         *) xxx=`./loc $xxx $xxx $pth`;;
2015         esac
2016         eval $file=$xxx
2017         eval _$file=$xxx
2018         case "$xxx" in
2019         /*)
2020                 echo $file is in $xxx.
2021                 ;;
2022         ?:[\\/]*)
2023                 echo $file is in $xxx.
2024                 ;;
2025         *)
2026                 echo "I don't see $file out there, $say."
2027                 say=either
2028                 ;;
2029         esac
2030 done
2031 case "$egrep" in
2032 egrep)
2033         echo "Substituting grep for egrep."
2034         egrep=$grep
2035         ;;
2036 esac
2037 case "$ln" in
2038 ln)
2039         echo "Substituting cp for ln."
2040         ln=$cp
2041         ;;
2042 esac
2043 case "$test" in
2044 test)
2045         echo "Hopefully test is built into your sh."
2046         ;;
2047 *)
2048         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2049                 echo "Using the test built into your sh."
2050                 test=test
2051                 _test=test
2052         fi
2053         ;;
2054 esac
2055 case "$echo" in
2056 echo)
2057         echo "Hopefully echo is built into your sh."
2058         ;;
2059 '') ;;
2060 *)
2061         echo " "
2062 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2063         $echo $n "hi there$c" >foo1
2064         echo $n "hi there$c" >foo2
2065         if cmp foo1 foo2 >/dev/null 2>&1; then
2066                 echo "They are compatible.  In fact, they may be identical."
2067         else
2068                 case "$n" in
2069                 '-n') n='' c='\c';;
2070                 *) n='-n' c='';;
2071                 esac
2072                 cat <<FOO
2073 They are not compatible!  You are probably running ksh on a non-USG system.
2074 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2075 have echo built in and we may have to run some Bourne shell scripts.  That
2076 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2077
2078 FOO
2079                 $echo $n "The star should be here-->$c"
2080                 $echo "*"
2081         fi
2082         $rm -f foo1 foo2
2083         ;;
2084 esac
2085
2086 cat <<EOS >checkcc
2087 $startsh
2088 EOS
2089 cat <<'EOSC' >>checkcc
2090 case "$cc" in
2091 '') ;;
2092 *)  $rm -f try try.*
2093     $cat >try.c <<EOM
2094 int main(int argc, char *argv[]) {
2095   return 0;
2096 }
2097 EOM
2098     if $cc -o try try.c; then
2099        :
2100     else
2101         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2102         despair=yes
2103         trygcc=yes
2104         case "$cc" in
2105         *gcc*) trygcc=no ;;
2106         esac
2107         case "`$cc -v -c try.c 2>&1`" in
2108         *gcc*) trygcc=no ;;
2109         esac
2110         if $test X"$trygcc" = Xyes; then
2111             if gcc -o try -c try.c; then
2112                 echo " "
2113                 echo "You seem to have a working gcc, though." >&4
2114                 rp="Would you like to use it?"
2115                 dflt=y
2116                 if $test -f myread; then
2117                     . ./myread
2118                 else
2119                     if $test -f UU/myread; then
2120                         . ./UU/myread
2121                     else
2122                         echo "Cannot find myread, sorry.  Aborting." >&2
2123                         exit 1
2124                     fi
2125                 fi  
2126                 case "$ans" in
2127                 [yY]*) cc=gcc; ccflags=''; despair=no ;;
2128                 esac
2129             fi
2130         fi
2131         if $test X"$despair" = Xyes; then
2132             echo "You need to find a working C compiler." >&4
2133             echo "I cannot continue any further, aborting." >&4
2134             exit 1
2135         fi
2136     fi
2137     $rm -f try try.*
2138     ;;
2139 esac
2140 EOSC
2141
2142 : determine whether symbolic links are supported
2143 echo " "
2144 $touch blurfl
2145 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2146         echo "Symbolic links are supported." >&4
2147         lns="$ln -s"
2148 else
2149         echo "Symbolic links are NOT supported." >&4
2150         lns="$ln"
2151 fi
2152 $rm -f blurfl sym
2153
2154 : see whether [:lower:] and [:upper:] are supported character classes
2155 echo " "
2156 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2157 ABYZ)
2158         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2159         up='[:upper:]'
2160         low='[:lower:]'
2161         ;;
2162 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2163         # (0xc9 and 0xd1), therefore that is a nice testing point.
2164         if test "X$up" = X -o "X$low" = X; then
2165             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2166             ij) up='[A-Z]'
2167                 low='[a-z]'
2168                 ;;
2169             esac
2170         fi
2171         if test "X$up" = X -o "X$low" = X; then
2172             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2173             ij) up='A-Z'
2174                 low='a-z'
2175                 ;;
2176             esac
2177         fi
2178         if test "X$up" = X -o "X$low" = X; then
2179             case "`echo IJ | od -x 2>/dev/null`" in
2180             *C9D1*|*c9d1*)
2181                 echo "Hey, this might be EBCDIC." >&4
2182                 if test "X$up" = X -o "X$low" = X; then
2183                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2184                     ij) up='[A-IJ-RS-Z]'
2185                         low='[a-ij-rs-z]'
2186                         ;;
2187                     esac
2188                 fi
2189                 if test "X$up" = X -o "X$low" = X; then
2190                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2191                     ij) up='A-IJ-RS-Z'
2192                         low='a-ij-rs-z'
2193                         ;;
2194                     esac
2195                 fi
2196                 ;;
2197             esac
2198         fi
2199 esac
2200 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2201 ij)
2202     echo "Using $up and $low to convert case." >&4
2203     ;;
2204 *)
2205     echo "I don't know how to translate letters from upper to lower case." >&4
2206     echo "Your tr is not acting any way I know of." >&4
2207     exit 1
2208     ;;
2209 esac
2210 : set up the translation script tr, must be called with ./tr of course
2211 cat >tr <<EOSC
2212 $startsh
2213 case "\$1\$2" in
2214 '[A-Z][a-z]') exec $tr '$up' '$low';;
2215 '[a-z][A-Z]') exec $tr '$low' '$up';;
2216 esac
2217 exec $tr "\$@"
2218 EOSC
2219 chmod +x tr
2220 $eunicefix tr
2221
2222 : Try to determine whether config.sh was made on this system
2223 case "$config_sh" in
2224 '')
2225 myuname=`$uname -a 2>/dev/null`
2226 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2227 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2228 # because the A-Z/a-z are not consecutive.
2229 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2230         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2231 newmyuname="$myuname"
2232 dflt=n
2233 case "$knowitall" in
2234 '')
2235         if test -f ../config.sh; then
2236                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2237                         eval "`grep myuname= ../config.sh`"
2238                 fi
2239                 if test "X$myuname" = "X$newmyuname"; then
2240                         dflt=y
2241                 fi
2242         fi
2243         ;;
2244 *) dflt=y;;
2245 esac
2246
2247 : Get old answers from old config file if Configure was run on the
2248 : same system, otherwise use the hints.
2249 hint=default
2250 cd ..
2251 if test -f config.sh; then
2252         echo " "
2253         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2254         . UU/myread
2255         case "$ans" in
2256         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2257         *)  echo "Fetching default answers from your old config.sh file..." >&4
2258                 tmp_n="$n"
2259                 tmp_c="$c"
2260                 tmp_sh="$sh"
2261                 . ./config.sh
2262                 cp config.sh UU
2263                 n="$tmp_n"
2264                 c="$tmp_c"
2265                 : Older versions did not always set $sh.  Catch re-use of such
2266                 : an old config.sh.
2267                 case "$sh" in
2268                 '') sh="$tmp_sh" ;;
2269                 esac
2270                 hint=previous
2271                 ;;
2272         esac
2273 fi
2274 . ./UU/checkcc
2275 if test ! -f config.sh; then
2276         $cat <<EOM
2277
2278 First time through, eh?  I have some defaults handy for some systems
2279 that need some extra help getting the Configure answers right:
2280
2281 EOM
2282         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2283         dflt=''
2284         : Half the following guesses are probably wrong... If you have better
2285         : tests or hints, please send them to perlbug@perl.com
2286         : The metaconfig authors would also appreciate a copy...
2287         $test -f /irix && osname=irix
2288         $test -f /xenix && osname=sco_xenix
2289         $test -f /dynix && osname=dynix
2290         $test -f /dnix && osname=dnix
2291         $test -f /lynx.os && osname=lynxos
2292         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2293         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2294         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2295         $test -f /bin/mips && /bin/mips && osname=mips
2296         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2297                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2298         $test -d /usr/apollo/bin && osname=apollo
2299         $test -f /etc/saf/_sactab && osname=svr4
2300         $test -d /usr/include/minix && osname=minix
2301         if $test -d /MachTen -o -d /MachTen_Folder; then
2302                 osname=machten
2303                 if $test -x /sbin/version; then
2304                         osvers=`/sbin/version | $awk '{print $2}' |
2305                         $sed -e 's/[A-Za-z]$//'`
2306                 elif $test -x /usr/etc/version; then
2307                         osvers=`/usr/etc/version | $awk '{print $2}' |
2308                         $sed -e 's/[A-Za-z]$//'`
2309                 else
2310                         osvers="$2.$3"
2311                 fi
2312         fi
2313
2314         $test -f /sys/posix.dll &&
2315                 $test -f /usr/bin/what &&
2316                 set X `/usr/bin/what /sys/posix.dll` &&
2317                 $test "$3" = UWIN &&
2318                 osname=uwin &&
2319                 osvers="$5"
2320
2321         if $test -f $uname; then
2322                 set X $myuname
2323                 shift
2324
2325                 case "$5" in
2326                 fps*) osname=fps ;;
2327                 mips*)
2328                         case "$4" in
2329                         umips) osname=umips ;;
2330                         *) osname=mips ;;
2331                         esac;;
2332                 [23]100) osname=mips ;;
2333                 next*) osname=next ;;
2334                 i386*)
2335                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2336                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2337                                 osname='sco'
2338                                 osvers=$tmp
2339                         elif $test -f /etc/kconfig; then
2340                                 osname=isc
2341                                 if test "$lns" = "$ln -s"; then
2342                                         osvers=4
2343                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2344                                         osvers=3
2345                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2346                                         osvers=2
2347                                 fi
2348                         fi
2349                         tmp=''
2350                         ;;
2351                 pc*)
2352                         if test -n "$DJGPP"; then
2353                                 osname=dos
2354                                 osvers=djgpp
2355                         fi
2356                         ;;
2357                 esac
2358
2359                 case "$1" in
2360                 aix) osname=aix
2361                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2362                         case "$tmp" in
2363                         'not found') osvers="$4"."$3" ;;
2364                         '<3240'|'<>3240') osvers=3.2.0 ;;
2365                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2366                         '=3250'|'>3250') osvers=3.2.5 ;;
2367                         *) osvers=$tmp;;
2368                         esac
2369                         ;;
2370                 bsd386) osname=bsd386
2371                         osvers=`$uname -r`
2372                         ;;
2373                 cygwin*) osname=cygwin
2374                         osvers="$3"
2375                         ;;
2376                 *dc.osx) osname=dcosx
2377                         osvers="$3"
2378                         ;;
2379                 dnix) osname=dnix
2380                         osvers="$3"
2381                         ;;
2382                 domainos) osname=apollo
2383                         osvers="$3"
2384                         ;;
2385                 dgux) osname=dgux 
2386                         osvers="$3"
2387                         ;;
2388                 dynixptx*) osname=dynixptx
2389                         osvers=`echo "$4"|sed 's/^v//'`
2390                         ;;
2391                 freebsd) osname=freebsd 
2392                         osvers="$3" ;;
2393                 genix) osname=genix ;;
2394                 hp*) osname=hpux 
2395                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2396                         ;;
2397                 irix*) osname=irix
2398                         case "$3" in
2399                         4*) osvers=4 ;;
2400                         5*) osvers=5 ;;
2401                         *)      osvers="$3" ;;
2402                         esac
2403                         ;;
2404                 linux) osname=linux
2405                         case "$3" in
2406                         *)      osvers="$3" ;;
2407                         esac
2408                         ;;
2409                 MiNT) osname=mint
2410                         ;;
2411                 netbsd*) osname=netbsd
2412                         osvers="$3"
2413                         ;;
2414                 news-os) osvers="$3"
2415                         case "$3" in
2416                         4*) osname=newsos4 ;;
2417                         *) osname=newsos ;;
2418                         esac
2419                         ;;
2420                 next*) osname=next ;;
2421                 POSIX-BC | posix-bc ) osname=posix-bc
2422                         osvers="$3"
2423                         ;;
2424                 powerux | power_ux | powermax_os | powermaxos | \
2425                 powerunix | power_unix) osname=powerux
2426                         osvers="$3"
2427                         ;;
2428                 qnx) osname=qnx
2429                         osvers="$4"
2430                         ;;
2431                 solaris) osname=solaris
2432                         case "$3" in
2433                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2434                         *)      osvers="$3" ;;
2435                         esac
2436                         ;;
2437                 sunos) osname=sunos
2438                         case "$3" in
2439                         5*) osname=solaris
2440                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2441                         *)      osvers="$3" ;;
2442                         esac
2443                         ;;
2444                 titanos) osname=titanos
2445                         case "$3" in
2446                         1*) osvers=1 ;;
2447                         2*) osvers=2 ;;
2448                         3*) osvers=3 ;;
2449                         4*) osvers=4 ;;
2450                         *)      osvers="$3" ;;
2451                         esac
2452                         ;;
2453                 ultrix) osname=ultrix
2454                         osvers="$3"
2455                         ;;
2456                 osf1|mls+)      case "$5" in
2457                                 alpha)
2458                                         osname=dec_osf
2459                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2460                                         case "$osvers" in
2461                                         [1-9].[0-9]*) ;;
2462                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2463                                         esac
2464                                         ;;
2465                         hp*)    osname=hp_osf1  ;;
2466                         mips)   osname=mips_osf1 ;;
2467                         esac
2468                         ;;
2469                 unixware) osname=svr5
2470                         osvers="$4"
2471                         ;;
2472                 uts) osname=uts
2473                         osvers="$3"
2474                         ;;
2475                 $2) case "$osname" in
2476                         *isc*) ;;
2477                         *freebsd*) ;;
2478                         svr*)
2479                                 : svr4.x or possibly later
2480                                 case "svr$3" in 
2481                                 ${osname}*)
2482                                         osname=svr$3
2483                                         osvers=$4
2484                                         ;;
2485                                 esac
2486                                 case "$osname" in
2487                                 svr4.0)
2488                                         : Check for ESIX
2489                                         if test -f /stand/boot ; then
2490                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2491                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2492                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2493                                                         if test -n "$isesix"; then
2494                                                                 osname=esix4
2495                                                         fi
2496                                                 fi
2497                                         fi
2498                                         ;;
2499                                 esac
2500                                 ;;
2501                         *)      if test -f /etc/systemid; then
2502                                         osname=sco
2503                                         set `echo $3 | $sed 's/\./ /g'` $4
2504                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2505                                                 osvers=$1.$2.$3
2506                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2507                                                 osvers=$1.$2
2508                                         elif $test -f $src/hints/sco_$1.sh; then
2509                                                 osvers=$1
2510                                         fi
2511                                 else
2512                                         case "$osname" in
2513                                         '') : Still unknown.  Probably a generic Sys V.
2514                                                 osname="sysv"
2515                                                 osvers="$3"
2516                                                 ;;
2517                                         esac
2518                                 fi
2519                                 ;;
2520                         esac
2521                         ;;
2522                 *)      case "$osname" in
2523                         '') : Still unknown.  Probably a generic BSD.
2524                                 osname="$1"
2525                                 osvers="$3"
2526                                 ;;
2527                         esac
2528                         ;;
2529                 esac
2530         else
2531                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2532                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2533                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2534                                 osname=news_os
2535                         fi
2536                         $rm -f UU/kernel.what
2537                 elif test -d c:/.; then
2538                         set X $myuname
2539                         osname=os2
2540                         osvers="$5"
2541                 fi
2542         fi
2543         
2544         : Now look for a hint file osname_osvers, unless one has been
2545         : specified already.
2546         case "$hintfile" in
2547         ''|' ')
2548                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2549                 : Also try without trailing minor version numbers.
2550                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2551                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2552                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2553                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2554                 case "$file" in
2555                 '') dflt=none ;;
2556                 *)  case "$osvers" in
2557                         '') dflt=$file
2558                                 ;;
2559                         *)  if $test -f $src/hints/$file.sh ; then
2560                                         dflt=$file
2561                                 elif $test -f $src/hints/$xfile.sh ; then
2562                                         dflt=$xfile
2563                                 elif $test -f $src/hints/$xxfile.sh ; then
2564                                         dflt=$xxfile
2565                                 elif $test -f $src/hints/$xxxfile.sh ; then
2566                                         dflt=$xxxfile
2567                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2568                                         dflt=$xxxxfile
2569                                 elif $test -f "$src/hints/${osname}.sh" ; then
2570                                         dflt="${osname}"
2571                                 else
2572                                         dflt=none
2573                                 fi
2574                                 ;;
2575                         esac
2576                         ;;
2577                 esac
2578                 if $test -f Policy.sh ; then
2579                         case "$dflt" in
2580                         *Policy*) ;;
2581                         none) dflt="Policy" ;;
2582                         *) dflt="Policy $dflt" ;;
2583                         esac
2584                 fi
2585                 ;;
2586         *)
2587                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2588                 ;;
2589         esac
2590
2591         if $test -f Policy.sh ; then
2592                 $cat <<EOM
2593
2594 There's also a Policy hint file available, which should make the
2595 site-specific (policy) questions easier to answer.
2596 EOM
2597
2598         fi
2599
2600         $cat <<EOM
2601
2602 You may give one or more space-separated answers, or "none" if appropriate.
2603 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2604 is a good thing.  DO NOT give a wrong version or a wrong OS.
2605
2606 EOM
2607
2608         rp="Which of these apply, if any?"
2609         . UU/myread
2610         tans=$ans
2611         for file in $tans; do
2612                 if $test X$file = XPolicy -a -f Policy.sh; then
2613                         . Policy.sh
2614                         $cat Policy.sh >> UU/config.sh
2615                 elif $test -f $src/hints/$file.sh; then
2616                         . $src/hints/$file.sh
2617                         $cat $src/hints/$file.sh >> UU/config.sh
2618                 elif $test X$tans = X -o X$tans = Xnone ; then
2619                         : nothing
2620                 else
2621                         : Give one chance to correct a possible typo.
2622                         echo "$file.sh does not exist"
2623                         dflt=$file
2624                         rp="hint to use instead?"
2625                         . UU/myread
2626                         for file in $ans; do
2627                                 if $test -f "$src/hints/$file.sh"; then
2628                                         . $src/hints/$file.sh
2629                                         $cat $src/hints/$file.sh >> UU/config.sh
2630                                 elif $test X$ans = X -o X$ans = Xnone ; then
2631                                         : nothing
2632                                 else
2633                                         echo "$file.sh does not exist -- ignored."
2634                                 fi
2635                         done
2636                 fi
2637         done
2638
2639         hint=recommended
2640         : Remember our hint file for later.
2641         if $test -f "$src/hints/$file.sh" ; then
2642                 hintfile="$file"
2643         else
2644                 hintfile=''
2645         fi
2646 fi
2647 cd UU
2648 ;;
2649 *)
2650         echo " "
2651         echo "Fetching default answers from $config_sh..." >&4
2652         tmp_n="$n"
2653         tmp_c="$c"
2654         cd ..
2655         cp $config_sh config.sh 2>/dev/null
2656         chmod +w config.sh
2657         . ./config.sh
2658         cd UU
2659         cp ../config.sh .
2660         n="$tmp_n"
2661         c="$tmp_c"
2662         hint=previous
2663         ;;
2664 esac
2665 test "$override" && . ./optdef.sh
2666 myuname="$newmyuname"
2667
2668 : Restore computed paths
2669 for file in $loclist $trylist; do
2670         eval $file="\$_$file"
2671 done
2672
2673 cat << EOM
2674
2675 Configure uses the operating system name and version to set some defaults.
2676 The default value is probably right if the name rings a bell. Otherwise,
2677 since spelling matters for me, either accept the default or answer "none"
2678 to leave it blank.
2679
2680 EOM
2681 case "$osname" in
2682         ''|' ')
2683                 case "$hintfile" in
2684                 ''|' '|none) dflt=none ;;
2685                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2686                 esac
2687                 ;;
2688         *) dflt="$osname" ;;
2689 esac
2690 rp="Operating system name?"
2691 . ./myread
2692 case "$ans" in
2693 none)  osname='' ;;
2694 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2695 esac
2696 echo " "
2697 case "$osvers" in
2698         ''|' ')
2699                 case "$hintfile" in
2700                 ''|' '|none) dflt=none ;;
2701                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2702                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2703                         case "$dflt" in
2704                         ''|' ') dflt=none ;;
2705                         esac
2706                         ;;
2707                 esac
2708                 ;;
2709         *) dflt="$osvers" ;;
2710 esac
2711 rp="Operating system version?"
2712 . ./myread
2713 case "$ans" in
2714 none)  osvers='' ;;
2715 *) osvers="$ans" ;;
2716 esac
2717
2718
2719 . ./posthint.sh
2720
2721 : who configured the system
2722 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2723 cf_by=`(logname) 2>/dev/null`
2724 case "$cf_by" in
2725 "")
2726         cf_by=`(whoami) 2>/dev/null`
2727         case "$cf_by" in
2728         "") cf_by=unknown ;;
2729         esac ;;
2730 esac
2731
2732 : set up the script used to warn in case of inconsistency
2733 cat <<EOS >whoa
2734 $startsh
2735 EOS
2736 cat <<'EOSC' >>whoa
2737 dflt=y
2738 echo " "
2739 echo "*** WHOA THERE!!! ***" >&4
2740 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2741 rp="    Keep the $hint value?"
2742 . ./myread
2743 case "$ans" in
2744 y) td=$was; tu=$was;;
2745 esac
2746 EOSC
2747
2748 : function used to set $1 to $val
2749 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2750 case "$val$was" in
2751 $define$undef) . ./whoa; eval "$var=\$td";;
2752 $undef$define) . ./whoa; eval "$var=\$tu";;
2753 *) eval "$var=$val";;
2754 esac'
2755
2756 case "$usethreads" in
2757 $define|true|[yY]*)     dflt='y';;
2758 *) dflt='n';;
2759 esac
2760 cat <<EOM
2761
2762 Perl can be built to take advantage of threads on some systems.
2763 To do so, Configure can be run with -Dusethreads.
2764
2765 Note that threading is a highly experimental feature, and
2766 some known race conditions still remain.  If you choose to try
2767 it, be very sure to not actually deploy it for production
2768 purposes.  README.threads has more details, and is required
2769 reading if you enable threads.
2770
2771 If this doesn't make any sense to you, just accept the default '$dflt'.
2772 EOM
2773 rp='Build a threading Perl?'
2774 . ./myread
2775 case "$ans" in
2776 y|Y)    val="$define" ;;
2777 *)      val="$undef" ;;
2778 esac
2779 set usethreads
2780 eval $setvar
2781
2782 case "$usethreads" in
2783 $define)
2784         $cat <<EOM
2785
2786 As of 5.5.640, Perl has two different internal threading implementations,
2787 the 5.005 version (5005threads) and an interpreter-based version
2788 (ithreads) that has one interpreter per thread.  Both are very 
2789 experimental.  This arrangement exists to help developers work out
2790 which one is better.
2791
2792 If you're a casual user, you probably don't want interpreter-threads
2793 at this time.  There doesn't yet exist a way to create threads from
2794 within Perl in this model, i.e., "use Thread;" will NOT work.
2795 EOM
2796         : Default to ithreads unless overridden on command line or with
2797         : old config.sh
2798         dflt='y'
2799         case "$use5005threads" in
2800                 $define|true|[yY]*) dflt='n';;
2801         esac
2802         case "$useithreads" in
2803                 $undef|false|[nN]*) dflt='n';;
2804         esac
2805         rp='Use interpreter-based ithreads?'
2806         . ./myread
2807         case "$ans" in
2808         y|Y)    val="$define" ;;
2809         *)      val="$undef" ;;
2810         esac
2811         set useithreads
2812         eval $setvar
2813         : Now set use5005threads to the opposite value.
2814         case "$useithreads" in
2815         $define) val="$undef" ;;
2816         *) val="$define" ;;
2817         esac
2818         set use5005threads
2819         eval $setvar
2820         ;;
2821 *)
2822         useithreads="$undef"
2823         use5005threads="$undef"
2824         ;;
2825 esac
2826
2827 case "$d_oldpthreads" in
2828 '')     : Configure tests would be welcome here.  For now, assume undef.
2829         val="$undef" ;;
2830 *)      val="$d_oldpthreads" ;;
2831 esac
2832 set d_oldpthreads
2833 eval $setvar
2834
2835
2836 case "$usethreads" in
2837 "$define"|true|[yY]*)
2838 : Look for a hint-file generated 'call-back-unit'.  If the
2839 : user has specified that a threading perl is to be built,
2840 : we may need to set or change some other defaults.
2841         if $test -f usethreads.cbu; then
2842                 echo "Your platform has some specific hints for threaded builds, using them..."
2843                 . ./usethreads.cbu
2844         else
2845                 $cat <<EOM
2846 (Your platform doesn't have any specific hints for threaded builds.
2847  Assuming POSIX threads, then.)
2848 EOM
2849         fi
2850         ;;
2851 esac
2852
2853 cat <<EOM
2854
2855 Perl can be built so that multiple Perl interpreters can coexist
2856 within the same Perl executable.
2857 EOM
2858
2859 case "$useithreads" in
2860 $define)
2861         cat <<EOM
2862 This multiple interpreter support is required for interpreter-based threads.
2863 EOM
2864         val="$define"
2865         ;;
2866 *)      case "$usemultiplicity" in
2867         $define|true|[yY]*)     dflt='y';;
2868         *) dflt='n';;
2869         esac
2870         echo " "
2871         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2872         rp='Build Perl for multiplicity?'
2873         . ./myread
2874         case "$ans" in
2875         y|Y)    val="$define" ;;
2876         *)      val="$undef" ;;
2877         esac
2878         ;;
2879 esac
2880 set usemultiplicity
2881 eval $setvar
2882
2883 : determine where manual pages are on this system
2884 echo " "
2885 case "$sysman" in
2886 '') 
2887         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2888         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2889         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2890         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2891         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2892         sysman=`./loc . /usr/man/man1 $syspath`
2893         ;;
2894 esac
2895 if $test -d "$sysman"; then
2896         echo "System manual is in $sysman." >&4
2897 else
2898         echo "Could not find manual pages in source form." >&4
2899 fi
2900
2901 : see what memory models we can support
2902 case "$models" in
2903 '')
2904         $cat >pdp11.c <<'EOP'
2905 int main() {
2906 #ifdef pdp11
2907         exit(0);
2908 #else
2909         exit(1);
2910 #endif
2911 }
2912 EOP
2913         case "$cc" in
2914         '') modelcc="$cc" ;;
2915         *) modelcc="cc" ;;
2916         esac
2917         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2918         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2919                 dflt='unsplit split'
2920         else
2921                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2922                 case "$tans" in
2923                 X) dflt='none';;
2924                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2925                                 dflt='small'
2926                         else
2927                                 dflt=''
2928                         fi
2929                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2930                                 dflt="$dflt medium"
2931                         fi
2932                         if $test -d /lib/large || $test -d /usr/lib/large; then
2933                                 dflt="$dflt large"
2934                         fi
2935                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2936                                 dflt="$dflt huge"
2937                         fi
2938                 esac
2939         fi;;
2940 *) dflt="$models";;
2941 esac
2942 $cat <<EOM
2943  
2944 Some systems have different model sizes.  On most systems they are called
2945 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2946 split.  If your system doesn't support different memory models, say "none".
2947 If you wish to force everything to one memory model, say "none" here and
2948 put the appropriate flags later when it asks you for other cc and ld flags.
2949 Venix systems may wish to put "none" and let the compiler figure things out.
2950 (In the following question multiple model names should be space separated.)
2951
2952 The default for most systems is "none".
2953
2954 EOM
2955 rp="Which memory models are supported?"
2956 . ./myread
2957 models="$ans"
2958
2959 case "$models" in
2960 none)
2961         small=''
2962         medium=''
2963         large=''
2964         huge=''
2965         unsplit=''
2966         split=''
2967         ;;
2968 *split)
2969         case "$split" in
2970         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2971                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2972                         dflt='-i'
2973                 else
2974                         dflt='none'
2975                 fi;;
2976         *) dflt="$split";;
2977         esac
2978         rp="What flag indicates separate I and D space?"
2979         . ./myread
2980         tans="$ans"
2981         case "$tans" in
2982         none) tans='';;
2983         esac
2984         split="$tans"
2985         unsplit='';;
2986 *large*|*small*|*medium*|*huge*)
2987         case "$models" in
2988         *large*)
2989                 case "$large" in
2990                 '') dflt='-Ml';;
2991                 *) dflt="$large";;
2992                 esac
2993         rp="What flag indicates large model?"
2994         . ./myread
2995         tans="$ans"
2996         case "$tans" in
2997         none) tans='';
2998         esac
2999         large="$tans";;
3000         *) large='';;
3001         esac
3002         case "$models" in
3003         *huge*) case "$huge" in
3004                 '') dflt='-Mh';;
3005                 *) dflt="$huge";;
3006                 esac
3007                 rp="What flag indicates huge model?"
3008                 . ./myread
3009                 tans="$ans"
3010                 case "$tans" in
3011                 none) tans='';
3012                 esac
3013                 huge="$tans";;
3014         *) huge="$large";;
3015         esac
3016         case "$models" in
3017         *medium*) case "$medium" in
3018                 '') dflt='-Mm';;
3019                 *) dflt="$medium";;
3020                 esac
3021                 rp="What flag indicates medium model?"
3022                 . ./myread
3023                 tans="$ans"
3024                 case "$tans" in
3025                 none) tans='';
3026                 esac
3027                 medium="$tans";;
3028         *) medium="$large";;
3029         esac
3030         case "$models" in
3031         *small*) case "$small" in
3032                 '') dflt='none';;
3033                 *) dflt="$small";;
3034                 esac
3035                 rp="What flag indicates small model?"
3036                 . ./myread
3037                 tans="$ans"
3038                 case "$tans" in
3039                 none) tans='';
3040                 esac
3041                 small="$tans";;
3042         *) small='';;
3043         esac
3044         ;;
3045 *)
3046         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3047         ;;
3048 esac
3049 $rm -f pdp11.* pdp11
3050
3051 : make some quick guesses about what we are up against
3052 echo " "
3053 $echo $n "Hmm...  $c"
3054 echo exit 1 >bsd
3055 echo exit 1 >usg
3056 echo exit 1 >v7
3057 echo exit 1 >osf1
3058 echo exit 1 >eunice
3059 echo exit 1 >xenix
3060 echo exit 1 >venix
3061 echo exit 1 >os2
3062 d_bsd="$undef"
3063 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3064 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3065 then
3066         echo "Looks kind of like an OSF/1 system, but we'll see..."
3067         echo exit 0 >osf1
3068 elif test `echo abc | tr a-z A-Z` = Abc ; then
3069         xxx=`./loc addbib blurfl $pth`
3070         if $test -f $xxx; then
3071         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3072                 echo exit 0 >bsd
3073                 echo exit 0 >usg
3074         else
3075                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3076                         echo "Looks kind of like an extended USG system, but we'll see..."
3077                 else
3078                         echo "Looks kind of like a USG system, but we'll see..."
3079                 fi
3080                 echo exit 0 >usg
3081         fi
3082 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3083         echo "Looks kind of like a BSD system, but we'll see..."
3084         d_bsd="$define"
3085         echo exit 0 >bsd
3086 else
3087         echo "Looks kind of like a Version 7 system, but we'll see..."
3088         echo exit 0 >v7
3089 fi
3090 case "$eunicefix" in
3091 *unixtovms*)
3092         $cat <<'EOI'
3093 There is, however, a strange, musty smell in the air that reminds me of
3094 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3095 EOI
3096         echo exit 0 >eunice
3097         d_eunice="$define"
3098 : it so happens the Eunice I know will not run shell scripts in Unix format
3099         ;;
3100 *)
3101         echo " "
3102         echo "Congratulations.  You aren't running Eunice."
3103         d_eunice="$undef"
3104         ;;
3105 esac
3106 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3107 case "$p_" in
3108 :) ;;
3109 *)
3110         $cat <<'EOI'
3111 I have the feeling something is not exactly right, however...don't tell me...
3112 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3113 EOI
3114         echo exit 0 >os2
3115         ;;
3116 esac
3117 if test -f /xenix; then
3118         echo "Actually, this looks more like a XENIX system..."
3119         echo exit 0 >xenix
3120         d_xenix="$define"
3121 else
3122         echo " "
3123         echo "It's not Xenix..."
3124         d_xenix="$undef"
3125 fi
3126 chmod +x xenix
3127 $eunicefix xenix
3128 if test -f /venix; then
3129         echo "Actually, this looks more like a VENIX system..."
3130         echo exit 0 >venix
3131 else
3132         echo " "
3133         if ./xenix; then
3134                 : null
3135         else
3136                 echo "Nor is it Venix..."
3137         fi
3138 fi
3139 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3140 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3141 $rm -f foo
3142
3143 : see if we need a special compiler
3144 echo " "
3145 if ./usg; then
3146         case "$cc" in
3147         '') case "$Mcc" in
3148                 /*) dflt='Mcc';;
3149                 *) case "$large" in
3150                         -M*) dflt='cc';;
3151                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3152                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3153                                                 dflt='cc'
3154                                         else
3155                                                 dflt='cc -M'
3156                                         fi
3157                                 else
3158                                         dflt='cc'
3159                                 fi;;
3160                         esac;;
3161                 esac;;
3162         *)  dflt="$cc";;
3163         esac
3164         case "$dflt" in
3165         *M*)    $cat <<'EOM'
3166 On some older systems the default C compiler will not resolve multiple global
3167 references that happen to have the same name.  On some such systems the "Mcc"
3168 command may be used to force these to be resolved.  On other systems a "cc -M"
3169 command is required.  (Note that the -M flag on other systems indicates a
3170 memory model to use!) If you have the Gnu C compiler, you might wish to use
3171 that instead.
3172
3173 EOM
3174         ;;
3175         esac
3176         rp="Use which C compiler?"
3177         . ./myread
3178         cc="$ans"
3179 else
3180         case "$cc" in
3181         '') dflt=cc;;
3182         *) dflt="$cc";;
3183         esac
3184         rp="Use which C compiler?"
3185         . ./myread
3186         cc="$ans"
3187 fi
3188 : Look for a hint-file generated 'call-back-unit'.  Now that the
3189 : user has specified the compiler, we may need to set or change some
3190 : other defaults.
3191 if $test -f cc.cbu; then
3192     . ./cc.cbu
3193 fi
3194 . ./checkcc
3195
3196 echo " "
3197 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3198 $cat >gccvers.c <<EOM
3199 #include <stdio.h>
3200 int main() {
3201 #ifdef __GNUC__
3202 #ifdef __VERSION__
3203         printf("%s\n", __VERSION__);
3204 #else
3205         printf("%s\n", "1");
3206 #endif
3207 #endif
3208         exit(0);
3209 }
3210 EOM
3211 if $cc $ldflags -o gccvers gccvers.c; then
3212         gccversion=`./gccvers`
3213         case "$gccversion" in
3214         '') echo "You are not using GNU cc." ;;
3215         *)  echo "You are using GNU cc $gccversion."
3216             ;;
3217         esac
3218 else
3219         echo " "
3220         echo "*** WHOA THERE!!! ***" >&4
3221         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3222         case "$knowitall" in
3223         '')
3224         echo "    You'd better start hunting for one and let me know about it." >&4
3225                 exit 1
3226                 ;;
3227         esac
3228 fi
3229 $rm -f gccvers*
3230 case "$gccversion" in
3231 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3232 esac
3233 case "$gccversion" in
3234 '') gccosandvers='' ;;
3235 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3236    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3237    gccshortvers=''
3238    case "$gccosandvers" in
3239    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3240    $osname$osvers) ;; # looking good
3241    $osname*) cat <<EOM >&4
3242
3243 *** WHOA THERE!!! ***
3244
3245     Your gcc has not been compiled for the exact release of
3246     your operating system ($gccosandvers versus $osname$osvers).
3247
3248     In general it is a good idea to keep gcc synchronized with
3249     the operating system because otherwise serious problems
3250     may ensue when trying to compile software, like Perl.
3251
3252     I'm trying to be optimistic here, though, and will continue.
3253     If later during the configuration and build icky compilation
3254     problems appear (headerfile conflicts being the most common
3255     manifestation), I suggest reinstalling the gcc to match
3256     your operating system release.
3257
3258 EOM
3259       ;;
3260    *) gccosandvers='' ;; # failed to parse, better be silent
3261    esac
3262    ;;
3263 esac
3264
3265
3266
3267
3268 : see how we invoke the C preprocessor
3269 echo " "
3270 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3271 cat <<'EOT' >testcpp.c
3272 #define ABC abc
3273 #define XYZ xyz
3274 ABC.XYZ
3275 EOT
3276 cd ..
3277 if test ! -f cppstdin; then
3278         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3279                 # AIX cc -E doesn't show the absolute headerfile
3280                 # locations but we'll cheat by using the -M flag.
3281                 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
3282         else
3283                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3284         fi
3285 else
3286         echo "Keeping your $hint cppstdin wrapper."
3287 fi
3288 chmod 755 cppstdin
3289 wrapper=`pwd`/cppstdin
3290 ok='false'
3291 cd UU
3292
3293 if $test "X$cppstdin" != "X" && \
3294         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3295         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3296 then
3297         echo "You used to use $cppstdin $cppminus so we'll use that again."
3298         case "$cpprun" in
3299         '') echo "But let's see if we can live without a wrapper..." ;;
3300         *)
3301                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3302                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3303                 then
3304                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3305                         ok='true'
3306                 else
3307                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3308                 fi
3309                 ;;
3310         esac
3311 else
3312         case "$cppstdin" in
3313         '') ;;
3314         *)
3315                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3316                 ;;
3317         esac
3318 fi
3319
3320 if $ok; then
3321         : nothing
3322 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3323         $cc -E <testcpp.c >testcpp.out 2>&1; \
3324         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3325         echo "Yup, it does."
3326         x_cpp="$cc -E"
3327         x_minus='';
3328 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3329         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3330         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3331         echo "Yup, it does."
3332         x_cpp="$cc -E"
3333         x_minus='-';
3334 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3335         $cc -P <testcpp.c >testcpp.out 2>&1; \
3336         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3337         echo "Yipee, that works!"
3338         x_cpp="$cc -P"
3339         x_minus='';
3340 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3341         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3342         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3343         echo "At long last!"
3344         x_cpp="$cc -P"
3345         x_minus='-';
3346 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3347         $cpp <testcpp.c >testcpp.out 2>&1; \
3348         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3349         echo "It works!"
3350         x_cpp="$cpp"
3351         x_minus='';
3352 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3353         $cpp - <testcpp.c >testcpp.out 2>&1; \
3354         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3355         echo "Hooray, it works!  I was beginning to wonder."
3356         x_cpp="$cpp"
3357         x_minus='-';
3358 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3359         $wrapper <testcpp.c >testcpp.out 2>&1; \
3360         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3361         x_cpp="$wrapper"
3362         x_minus=''
3363         echo "Eureka!"
3364 else
3365         dflt=''
3366         rp="No dice.  I can't find a C preprocessor.  Name one:"
3367         . ./myread
3368         x_cpp="$ans"
3369         x_minus=''
3370         $x_cpp <testcpp.c >testcpp.out 2>&1
3371         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3372                 echo "OK, that will do." >&4
3373         else
3374 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3375                 exit 1
3376         fi
3377 fi
3378
3379 case "$ok" in
3380 false)
3381         cppstdin="$x_cpp"
3382         cppminus="$x_minus"
3383         cpprun="$x_cpp"
3384         cpplast="$x_minus"
3385         set X $x_cpp
3386         shift
3387         case "$1" in
3388         "$cpp")
3389                 echo "Perhaps can we force $cc -E using a wrapper..."
3390                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3391                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3392                 then
3393                         echo "Yup, we can."
3394                         cppstdin="$wrapper"
3395                         cppminus='';
3396                 else
3397                         echo "Nope, we'll have to live without it..."
3398                 fi
3399                 ;;
3400         esac
3401         case "$cpprun" in
3402         "$wrapper")
3403                 cpprun=''
3404                 cpplast=''
3405                 ;;
3406         esac
3407         ;;
3408 esac
3409
3410 case "$cppstdin" in
3411 "$wrapper"|'cppstdin') ;;
3412 *) $rm -f $wrapper;;
3413 esac
3414 $rm -f testcpp.c testcpp.out
3415
3416 : decide how portable to be.  Allow command line overrides.
3417 case "$d_portable" in
3418 "$undef") ;;
3419 *)      d_portable="$define" ;;
3420 esac
3421
3422 : set up shell script to do ~ expansion
3423 cat >filexp <<EOSS
3424 $startsh
3425 : expand filename
3426 case "\$1" in
3427  ~/*|~)
3428         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3429         ;;
3430  ~*)
3431         if $test -f /bin/csh; then
3432                 /bin/csh -f -c "glob \$1"
3433                 failed=\$?
3434                 echo ""
3435                 exit \$failed
3436         else
3437                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3438                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3439                 if $test ! -d "\$dir"; then
3440                         me=\`basename \$0\`
3441                         echo "\$me: can't locate home directory for: \$name" >&2
3442                         exit 1
3443                 fi
3444                 case "\$1" in
3445                 */*)
3446                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3447                         ;;
3448                 *)
3449                         echo \$dir
3450                         ;;
3451                 esac
3452         fi
3453         ;;
3454 *)
3455         echo \$1
3456         ;;
3457 esac
3458 EOSS
3459 chmod +x filexp
3460 $eunicefix filexp
3461
3462 : now set up to get a file name
3463 cat <<EOS >getfile
3464 $startsh
3465 EOS
3466 cat <<'EOSC' >>getfile
3467 tilde=''
3468 fullpath=''
3469 already=''
3470 skip=''
3471 none_ok=''
3472 exp_file=''
3473 nopath_ok=''
3474 orig_rp="$rp"
3475 orig_dflt="$dflt"
3476 case "$gfpth" in
3477 '') gfpth='.' ;;
3478 esac
3479
3480 case "$fn" in
3481 *\(*)
3482         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3483         fn=`echo $fn | sed 's/(.*)//'`
3484         ;;
3485 esac
3486
3487 case "$fn" in
3488 *:*)
3489         loc_file=`expr $fn : '.*:\(.*\)'`
3490         fn=`expr $fn : '\(.*\):.*'`
3491         ;;
3492 esac
3493
3494 case "$fn" in
3495 *~*) tilde=true;;
3496 esac
3497 case "$fn" in
3498 */*) fullpath=true;;
3499 esac
3500 case "$fn" in
3501 *+*) skip=true;;
3502 esac
3503 case "$fn" in
3504 *n*) none_ok=true;;
3505 esac
3506 case "$fn" in
3507 *e*) exp_file=true;;
3508 esac
3509 case "$fn" in
3510 *p*) nopath_ok=true;;
3511 esac
3512
3513 case "$fn" in
3514 *f*) type='File';;
3515 *d*) type='Directory';;
3516 *l*) type='Locate';;
3517 esac
3518
3519 what="$type"
3520 case "$what" in
3521 Locate) what='File';;
3522 esac
3523
3524 case "$exp_file" in
3525 '')
3526         case "$d_portable" in
3527         "$define") ;;
3528         *) exp_file=true;;
3529         esac
3530         ;;
3531 esac
3532
3533 cd ..
3534 while test "$type"; do
3535         redo=''
3536         rp="$orig_rp"
3537         dflt="$orig_dflt"
3538         case "$tilde" in
3539         true) rp="$rp (~name ok)";;
3540         esac
3541         . UU/myread
3542         if test -f UU/getfile.ok && \
3543                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3544         then
3545                 value="$ans"
3546                 ansexp="$ans"
3547                 break
3548         fi
3549         case "$ans" in
3550         none)
3551                 value=''
3552                 ansexp=''
3553                 case "$none_ok" in
3554                 true) type='';;
3555                 esac
3556                 ;;
3557         *)
3558                 case "$tilde" in
3559                 '') value="$ans"
3560                         ansexp="$ans";;
3561                 *)
3562                         value=`UU/filexp $ans`
3563                         case $? in
3564                         0)
3565                                 if test "$ans" != "$value"; then
3566                                         echo "(That expands to $value on this system.)"
3567                                 fi
3568                                 ;;
3569                         *) value="$ans";;
3570                         esac
3571                         ansexp="$value"
3572                         case "$exp_file" in
3573                         '') value="$ans";;
3574                         esac
3575                         ;;
3576                 esac
3577                 case "$fullpath" in
3578                 true)
3579                         case "$ansexp" in
3580                         /*) value="$ansexp" ;;
3581                         [a-zA-Z]:/*) value="$ansexp" ;;
3582                         *)
3583                                 redo=true
3584                                 case "$already" in
3585                                 true)
3586                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3587                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3588                                         ;;
3589                                 *)
3590                                 echo "Please give a full path name, starting with slash." >&4
3591                                         case "$tilde" in
3592                                         true)
3593                                 echo "Note that using ~name is ok provided it expands well." >&4
3594                                                 already=true
3595                                                 ;;
3596                                         esac
3597                                 esac
3598                                 ;;
3599                         esac
3600                         ;;
3601                 esac
3602                 case "$redo" in
3603                 '')
3604                         case "$type" in
3605                         File)
3606                                 for fp in $gfpth; do
3607                                         if test "X$fp" = X.; then
3608                                             pf="$ansexp"
3609                                         else    
3610                                             pf="$fp/$ansexp"
3611                                         fi
3612                                         if test -f "$pf"; then
3613                                                 type=''
3614                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3615                                         then
3616                                                 echo "($value is not a plain file, but that's ok.)"
3617                                                 type=''
3618                                         fi
3619                                         if test X"$type" = X; then
3620                                             value="$pf"
3621                                             break
3622                                         fi
3623                                 done
3624                                 ;;
3625                         Directory)
3626                                 for fp in $gfpth; do
3627                                         if test "X$fp" = X.; then
3628                                             dir="$ans"
3629                                             direxp="$ansexp"
3630                                         else    
3631                                             dir="$fp/$ansexp"
3632                                             direxp="$fp/$ansexp"
3633                                         fi
3634                                         if test -d "$direxp"; then
3635                                                 type=''
3636                                                 value="$dir"
3637                                                 break
3638                                         fi
3639                                 done
3640                                 ;;
3641                         Locate)
3642                                 if test -d "$ansexp"; then
3643                                         echo "(Looking for $loc_file in directory $value.)"
3644                                         value="$value/$loc_file"
3645                                         ansexp="$ansexp/$loc_file"
3646                                 fi
3647                                 if test -f "$ansexp"; then
3648                                         type=''
3649                                 fi
3650                                 case "$nopath_ok" in
3651                                 true)   case "$value" in
3652                                         */*) ;;
3653                                         *)      echo "Assuming $value will be in people's path."
3654                                                 type=''
3655                                                 ;;
3656                                         esac
3657                                         ;;
3658                                 esac
3659                                 ;;
3660                         esac
3661
3662                         case "$skip" in
3663                         true) type='';
3664                         esac
3665
3666                         case "$type" in
3667                         '') ;;
3668                         *)
3669                                 if test "$fastread" = yes; then
3670                                         dflt=y
3671                                 else
3672                                         dflt=n
3673                                 fi
3674                                 rp="$what $value doesn't exist.  Use that name anyway?"
3675                                 . UU/myread
3676                                 dflt=''
3677                                 case "$ans" in
3678                                 y*) type='';;
3679                                 *) echo " ";;
3680                                 esac
3681                                 ;;
3682                         esac
3683                         ;;
3684                 esac
3685                 ;;
3686         esac
3687 done
3688 cd UU
3689 ans="$value"
3690 rp="$orig_rp"
3691 dflt="$orig_dflt"
3692 rm -f getfile.ok
3693 test "X$gfpthkeep" != Xy && gfpth=""
3694 EOSC
3695
3696 : What should the include directory be ?
3697 echo " "
3698 $echo $n "Hmm...  $c"
3699 dflt='/usr/include'
3700 incpath=''
3701 mips_type=''
3702 if $test -f /bin/mips && /bin/mips; then
3703         echo "Looks like a MIPS system..."
3704         $cat >usr.c <<'EOCP'
3705 #ifdef SYSTYPE_BSD43
3706 /bsd43
3707 #endif
3708 EOCP
3709         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3710                 dflt='/bsd43/usr/include'
3711                 incpath='/bsd43'
3712                 mips_type='BSD 4.3'
3713         else
3714                 mips_type='System V'
3715         fi
3716         $rm -f usr.c usr.out
3717         echo "and you're compiling with the $mips_type compiler and libraries."
3718         xxx_prompt=y
3719         echo "exit 0" >mips
3720 else
3721         echo "Doesn't look like a MIPS system."
3722         xxx_prompt=n
3723         echo "exit 1" >mips
3724 fi
3725 chmod +x mips
3726 $eunicefix mips
3727 case "$usrinc" in
3728 '') ;;
3729 *) dflt="$usrinc";;
3730 esac
3731 case "$xxx_prompt" in
3732 y)      fn=d/
3733         echo " "
3734         rp='Where are the include files you want to use?'
3735         . ./getfile
3736         usrinc="$ans"
3737         ;;
3738 *)      usrinc="$dflt"
3739         ;;
3740 esac
3741
3742 : Set private lib path
3743 case "$plibpth" in
3744 '') if ./mips; then
3745                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3746         fi;;
3747 esac
3748 case "$libpth" in
3749 ' ') dlist='';;
3750 '') dlist="$loclibpth $plibpth $glibpth";;
3751 *) dlist="$libpth";;
3752 esac
3753
3754 : Now check and see which directories actually exist, avoiding duplicates
3755 libpth=''
3756 for xxx in $dlist
3757 do
3758     if $test -d $xxx; then
3759                 case " $libpth " in
3760                 *" $xxx "*) ;;
3761                 *) libpth="$libpth $xxx";;
3762                 esac
3763     fi
3764 done
3765 $cat <<'EOM'
3766
3767 Some systems have incompatible or broken versions of libraries.  Among
3768 the directories listed in the question below, please remove any you
3769 know not to be holding relevant libraries, and add any that are needed.
3770 Say "none" for none.
3771
3772 EOM
3773 case "$libpth" in
3774 '') dflt='none';;
3775 *)
3776         set X $libpth
3777         shift
3778         dflt=${1+"$@"}
3779         ;;
3780 esac
3781 rp="Directories to use for library searches?"
3782 . ./myread
3783 case "$ans" in
3784 none) libpth=' ';;
3785 *) libpth="$ans";;
3786 esac
3787
3788 : compute shared library extension
3789 case "$so" in
3790 '')
3791         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3792                 dflt='sl'
3793         else
3794                 dflt='so'
3795         fi
3796         ;;
3797 *) dflt="$so";;
3798 esac
3799 $cat <<EOM
3800
3801 On some systems, shared libraries may be available.  Answer 'none' if
3802 you want to suppress searching of shared libraries for the remainder
3803 of this configuration.
3804
3805 EOM
3806 rp='What is the file extension used for shared libraries?'
3807 . ./myread
3808 so="$ans"
3809
3810 : Define several unixisms.
3811 : Hints files or command line option can be used to override them.
3812 : The convoluted testing is in case hints files set either the old
3813 : or the new name.
3814 case "$_exe" in
3815 '')     case "$exe_ext" in
3816     '') ;;
3817         *)      _exe="$exe_ext" ;;
3818         esac
3819         ;;
3820 esac
3821 case "$_a" in
3822 '')     case "$lib_ext" in
3823     '') _a='.a';;
3824         *)      _a="$lib_ext" ;;
3825         esac
3826         ;;
3827 esac
3828 case "$_o" in
3829 '') case "$obj_ext" in
3830         '')     _o='.o';;
3831         *)      _o="$obj_ext";;
3832         esac
3833         ;;
3834 esac
3835 case "$p_" in
3836 '') case "$path_sep" in
3837         '')     p_=':';;
3838         *)      p_="$path_sep";;
3839         esac
3840         ;;
3841 esac
3842 exe_ext=$_exe
3843 lib_ext=$_a
3844 obj_ext=$_o
3845 path_sep=$p_
3846
3847 : Which makefile gets called first.  This is used by make depend.
3848 case "$firstmakefile" in
3849 '') firstmakefile='makefile';;
3850 esac
3851
3852 case "$usesocks" in
3853 $define|true|[yY]*)     dflt='y';;
3854 *) dflt='n';;
3855 esac
3856 cat <<EOM
3857
3858 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3859 Configure must be run with -Dusesocks.
3860
3861 If this doesn't make any sense to you, just accept the default '$dflt'.
3862 EOM
3863 rp='Build Perl for SOCKS?'
3864 . ./myread
3865 case "$ans" in
3866 y|Y)    val="$define" ;;     
3867 *)      val="$undef" ;;
3868 esac
3869 set usesocks
3870 eval $setvar
3871
3872 : Looking for optional libraries
3873 echo " "
3874 echo "Checking for optional libraries..." >&4
3875 case "$libs" in
3876 ' '|'') dflt='';;
3877 *) dflt="$libs";;
3878 esac
3879 case "$libswanted" in
3880 '') libswanted='c_s';;
3881 esac
3882 case "$usesocks" in
3883 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3884 esac
3885 libsfound=''
3886 libsfiles=''
3887 libsdirs=''
3888 libspath=''
3889 for thisdir in $libpth $xlibpth; do
3890   test -d $thisdir && libspath="$libspath $thisdir"
3891 done
3892 for thislib in $libswanted; do
3893         for thisdir in $libspath; do
3894             xxx=''
3895             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3896                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3897                 $test -f "$xxx" && eval $libscheck
3898                 $test -f "$xxx" && libstyle=shared
3899             fi
3900             if test ! -f "$xxx"; then
3901                 xxx=$thisdir/lib$thislib.$so
3902                 $test -f "$xxx" && eval $libscheck
3903                 $test -f "$xxx" && libstyle=shared
3904             fi  
3905             if test ! -f "$xxx"; then
3906                 xxx=$thisdir/lib$thislib$_a
3907                 $test -f "$xxx" && eval $libscheck
3908                 $test -f "$xxx" && libstyle=static
3909             fi
3910             if test ! -f "$xxx"; then
3911                 xxx=$thisdir/$thislib$_a
3912                 $test -f "$xxx" && eval $libscheck
3913                 $test -f "$xxx" && libstyle=static
3914             fi
3915             if test ! -f "$xxx"; then
3916                 xxx=$thisdir/lib${thislib}_s$_a
3917                 $test -f "$xxx" && eval $libscheck
3918                 $test -f "$xxx" && libstyle=static
3919                 $test -f "$xxx" && thislib=${thislib}_s
3920             fi
3921             if test ! -f "$xxx"; then
3922                 xxx=$thisdir/Slib$thislib$_a
3923                 $test -f "$xxx" && eval $libscheck
3924                 $test -f "$xxx" && libstyle=static
3925             fi
3926             if $test -f "$xxx"; then
3927                 case "$libstyle" in
3928                 shared) echo "Found -l$thislib (shared)." ;;
3929                 static) echo "Found -l$thislib." ;;
3930                 *)      echo "Found -l$thislib ($libstyle)." ;;
3931                 esac
3932                 case " $dflt " in
3933                 *"-l$thislib "*);;
3934                 *) dflt="$dflt -l$thislib"
3935                    libsfound="$libsfound $xxx"
3936                    yyy=`basename $xxx`
3937                    libsfiles="$libsfiles $yyy"
3938                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3939                    case " $libsdirs " in
3940                    *" $yyy "*) ;;
3941                    *) libsdirs="$libsdirs $yyy" ;;
3942                    esac
3943                    ;;
3944                 esac
3945                 break
3946             fi  
3947         done
3948         if $test ! -f "$xxx"; then
3949             echo "No -l$thislib."
3950         fi
3951 done
3952 set X $dflt
3953 shift
3954 dflt="$*"
3955 case "$libs" in
3956 '') dflt="$dflt";;
3957 *) dflt="$libs";;
3958 esac
3959 case "$dflt" in
3960 ' '|'') dflt='none';;
3961 esac
3962
3963 $cat <<EOM
3964
3965 In order to compile $package on your machine, a number of libraries
3966 are usually needed.  Include any other special libraries here as well.
3967 Say "none" for none.  The default list is almost always right.
3968 EOM
3969
3970 echo " "
3971 rp="What libraries to use?"
3972 . ./myread
3973 case "$ans" in
3974 none) libs=' ';;
3975 *) libs="$ans";;
3976 esac
3977
3978 : determine optimization, if desired, or use for debug flag also
3979 case "$optimize" in
3980 ' '|$undef) dflt='none';;
3981 '') dflt='-O';;
3982 *) dflt="$optimize";;
3983 esac
3984 $cat <<EOH
3985
3986 By default, $package compiles with the -O flag to use the optimizer.
3987 Alternately, you might want to use the symbolic debugger, which uses
3988 the -g flag (on traditional Unix systems).  Either flag can be
3989 specified here.  To use neither flag, specify the word "none".
3990
3991 EOH
3992 rp="What optimizer/debugger flag should be used?"
3993 . ./myread
3994 optimize="$ans"
3995 case "$optimize" in
3996 'none') optimize=" ";;
3997 esac
3998
3999 dflt=''
4000 : We will not override a previous value, but we might want to
4001 : augment a hint file
4002 case "$hint" in
4003 default|recommended)
4004         case "$gccversion" in
4005         1*) dflt='-fpcc-struct-return' ;;
4006         esac
4007         case "$optimize" in
4008         *-g*) dflt="$dflt -DDEBUGGING";;
4009         esac
4010         case "$gccversion" in
4011         2*) if test -d /etc/conf/kconfig.d &&
4012                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4013                 then
4014                         dflt="$dflt -posix"
4015                 fi
4016                 ;;
4017         esac
4018         case "$gccversion" in
4019         1*) ;;
4020         2.[0-8]*) ;;
4021         ?*)     echo " "
4022                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4023                 echo 'int main(void) { return 0; }' > gcctest.c
4024                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4025                         echo "Yes, it does." 2>&1
4026                         case "$ccflags" in
4027                         *strict-aliasing*) 
4028                                 echo "Leaving current flags $ccflags alone." 2>&1
4029                                 ;;
4030                         *) dflt="$dflt -fno-strict-aliasing" ;;
4031                         esac
4032                 else
4033                         echo "Nope, it doesn't, but that's ok." 2>&1
4034                 fi
4035                 ;;
4036         esac
4037         ;;
4038 esac
4039
4040 case "$mips_type" in
4041 *BSD*|'') inclwanted="$locincpth $usrinc";;
4042 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4043 esac
4044 for thisincl in $inclwanted; do
4045         if $test -d $thisincl; then
4046                 if $test x$thisincl != x$usrinc; then
4047                         case "$dflt" in
4048                         *$thisincl*);;
4049                         *) dflt="$dflt -I$thisincl";;
4050                         esac
4051                 fi
4052         fi
4053 done
4054
4055 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4056         xxx=true;
4057 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4058         xxx=true;
4059 else
4060         xxx=false;
4061 fi;
4062 if $xxx; then
4063         case "$dflt" in
4064         *$2*);;
4065         *) dflt="$dflt -D$2";;
4066         esac;
4067 fi'
4068
4069 set signal.h LANGUAGE_C; eval $inctest
4070
4071 case "$usesocks" in
4072 $define)
4073         ccflags="$ccflags -DSOCKS"
4074         ;;
4075 esac
4076
4077 case "$hint" in
4078 default|recommended) dflt="$ccflags $dflt" ;;
4079 *) dflt="$ccflags";;
4080 esac
4081
4082 case "$dflt" in
4083 ''|' ') dflt=none;;
4084 esac
4085 $cat <<EOH
4086
4087 Your C compiler may want other flags.  For this question you should include
4088 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4089 but you should NOT include libraries or ld flags like -lwhatever.  If you
4090 want $package to honor its debug switch, you should include -DDEBUGGING here.
4091 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4092
4093 To use no flags, specify the word "none".
4094
4095 EOH
4096 set X $dflt
4097 shift
4098 dflt=${1+"$@"}
4099 rp="Any additional cc flags?"
4100 . ./myread
4101 case "$ans" in
4102 none) ccflags='';;
4103 *) ccflags="$ans";;
4104 esac
4105
4106 : the following weeds options from ccflags that are of no interest to cpp
4107 cppflags="$ccflags"
4108 case "$gccversion" in
4109 1*) cppflags="$cppflags -D__GNUC__"
4110 esac
4111 case "$mips_type" in
4112 '');;
4113 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4114 esac
4115 case "$cppflags" in
4116 '');;
4117 *)
4118         echo " "
4119         echo "Let me guess what the preprocessor flags are..." >&4
4120         set X $cppflags
4121         shift
4122         cppflags=''
4123         $cat >cpp.c <<'EOM'
4124 #define BLURFL foo
4125
4126 BLURFL xx LFRULB
4127 EOM
4128         previous=''
4129         for flag in $*
4130         do
4131                 case "$flag" in
4132                 -*) ftry="$flag";;
4133                 *) ftry="$previous $flag";;
4134                 esac
4135                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4136                         >cpp1.out 2>/dev/null && \
4137                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4138                         >cpp2.out 2>/dev/null && \
4139                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4140                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4141                 then
4142                         cppflags="$cppflags $ftry"
4143                         previous=''
4144                 else
4145                         previous="$flag"
4146                 fi
4147         done
4148         set X $cppflags
4149         shift
4150         cppflags=${1+"$@"}
4151         case "$cppflags" in
4152         *-*)  echo "They appear to be: $cppflags";;
4153         esac
4154         $rm -f cpp.c cpp?.out
4155         ;;
4156 esac
4157
4158 : flags used in final linking phase
4159 case "$ldflags" in
4160 '') if ./venix; then
4161                 dflt='-i -z'
4162         else
4163                 dflt=''
4164         fi
4165         case "$ccflags" in
4166         *-posix*) dflt="$dflt -posix" ;;
4167         esac
4168         ;;
4169 *) dflt="$ldflags";;
4170 esac
4171
4172 : Try to guess additional flags to pick up local libraries.
4173 for thislibdir in $libpth; do
4174         case " $loclibpth " in
4175         *" $thislibdir "*)
4176                 case "$dflt " in 
4177                 *"-L$thislibdir "*) ;;
4178                 *)  dflt="$dflt -L$thislibdir" ;;
4179                 esac
4180                 ;;
4181         esac
4182 done
4183
4184 case "$dflt" in
4185 '') dflt='none' ;;
4186 esac
4187
4188 $cat <<EOH
4189
4190 Your C linker may need flags.  For this question you should
4191 include -L/whatever and any other flags used by the C linker, but you
4192 should NOT include libraries like -lwhatever.
4193
4194 Make sure you include the appropriate -L/path flags if your C linker
4195 does not normally search all of the directories you specified above,
4196 namely
4197         $libpth
4198 To use no flags, specify the word "none".
4199
4200 EOH
4201
4202 rp="Any additional ld flags (NOT including libraries)?"
4203 . ./myread
4204 case "$ans" in
4205 none) ldflags='';;
4206 *) ldflags="$ans";;
4207 esac
4208 rmlist="$rmlist pdp11"
4209
4210 : coherency check
4211 echo " "
4212 echo "Checking your choice of C compiler and flags for coherency..." >&4
4213 $cat > try.c <<'EOF'
4214 #include <stdio.h>
4215 int main() { printf("Ok\n"); exit(0); }
4216 EOF
4217 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4218 shift
4219 $cat >try.msg <<'EOM'
4220 I've tried to compile and run the following simple program:
4221
4222 EOM
4223 $cat try.c >> try.msg
4224
4225 $cat >> try.msg <<EOM
4226
4227 I used the command:
4228
4229         $*
4230         ./try
4231
4232 and I got the following output:
4233
4234 EOM
4235 dflt=y
4236 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4237         if sh -c './try' >>try.msg 2>&1; then
4238                 xxx=`./try`
4239                 case "$xxx" in
4240                 "Ok") dflt=n ;;
4241                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4242                         case " $libs " in
4243                         *" -lsfio "*)
4244                                 cat >> try.msg <<'EOQS'
4245 If $libs contains -lsfio, and sfio is mis-configured, then it
4246 sometimes (apparently) runs and exits with a 0 status, but with no
4247 output!  It may have to do with sfio's use of _exit vs. exit.
4248
4249 EOQS
4250                                 rp="You have a big problem.  Shall I abort Configure"
4251                                 dflt=y
4252                                 ;;
4253                         esac
4254                         ;;
4255                 esac
4256         else
4257                 echo "The program compiled OK, but exited with status $?." >>try.msg
4258                 rp="You have a problem.  Shall I abort Configure"
4259                 dflt=y
4260         fi
4261 else
4262         echo "I can't compile the test program." >>try.msg
4263         rp="You have a BIG problem.  Shall I abort Configure"
4264         dflt=y
4265 fi
4266 case "$dflt" in
4267 y)
4268         $cat try.msg >&4
4269         case "$knowitall" in
4270         '')
4271                 echo "(The supplied flags or libraries might be incorrect.)"
4272                 ;;
4273         *) dflt=n;;
4274         esac
4275         echo " "
4276         . ./myread
4277         case "$ans" in
4278         n*|N*) ;;
4279         *)      echo "Ok.  Stopping Configure." >&4
4280                 exit 1
4281                 ;;
4282         esac
4283         ;;
4284 n) echo "OK, that should do.";;
4285 esac
4286 $rm -f try try.* core
4287
4288 : define an is-a-typedef? function
4289 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4290 case "$inclist" in
4291 "") inclist="sys/types.h";;
4292 esac;
4293 eval "varval=\$$var";
4294 case "$varval" in
4295 "")
4296         $rm -f temp.c;
4297         for inc in $inclist; do
4298                 echo "#include <$inc>" >>temp.c;
4299         done;
4300         echo "#ifdef $type" >> temp.c;
4301         echo "printf(\"We have $type\");" >> temp.c;
4302         echo "#endif" >> temp.c;
4303         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4304         if $contains $type temp.E >/dev/null 2>&1; then
4305                 eval "$var=\$type";
4306         else
4307                 eval "$var=\$def";
4308         fi;
4309         $rm -f temp.?;;
4310 *) eval "$var=\$varval";;
4311 esac'
4312
4313 : define an is-a-typedef? function that prompts if the type is not available.
4314 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4315 case "$inclist" in
4316 "") inclist="sys/types.h";;
4317 esac;
4318 eval "varval=\$$var";
4319 case "$varval" in
4320 "")
4321         $rm -f temp.c;
4322         for inc in $inclist; do
4323                 echo "#include <$inc>" >>temp.c;
4324         done;
4325         echo "#ifdef $type" >> temp.c;
4326         echo "printf(\"We have $type\");" >> temp.c;
4327         echo "#endif" >> temp.c;
4328         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4329         echo " " ;
4330         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4331         if $contains $type temp.E >/dev/null 2>&1; then
4332                 echo "$type found." >&4;
4333                 eval "$var=\$type";
4334         else
4335                 echo "$type NOT found." >&4;
4336                 dflt="$def";
4337                 . ./myread ;
4338                 eval "$var=\$ans";
4339         fi;
4340         $rm -f temp.?;;
4341 *) eval "$var=\$varval";;
4342 esac'
4343
4344 : define a shorthand compile call
4345 compile='
4346 mc_file=$1;
4347 shift;
4348 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4349 : define a shorthand compile call for compilations that should be ok.
4350 compile_ok='
4351 mc_file=$1;
4352 shift;
4353 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4354
4355 : check for lengths of integral types
4356 echo " "
4357 case "$intsize" in
4358 '')
4359         echo "Checking to see how big your integers are..." >&4
4360         $cat >intsize.c <<'EOCP'
4361 #include <stdio.h>
4362 int main()
4363 {
4364         printf("intsize=%d;\n", (int)sizeof(int));
4365         printf("longsize=%d;\n", (int)sizeof(long));
4366         printf("shortsize=%d;\n", (int)sizeof(short));
4367         exit(0);
4368 }
4369 EOCP
4370         set intsize
4371         if eval $compile_ok && ./intsize > /dev/null; then
4372                 eval `./intsize`
4373                 echo "Your integers are $intsize bytes long."
4374                 echo "Your long integers are $longsize bytes long."
4375                 echo "Your short integers are $shortsize bytes long."
4376         else
4377                 $cat >&4 <<EOM
4378 !
4379 Help! I can't compile and run the intsize test program: please enlighten me!
4380 (This is probably a misconfiguration in your system or libraries, and
4381 you really ought to fix it.  Still, I'll try anyway.)
4382 !
4383 EOM
4384                 dflt=4
4385                 rp="What is the size of an integer (in bytes)?"
4386                 . ./myread
4387                 intsize="$ans"
4388                 dflt=$intsize
4389                 rp="What is the size of a long integer (in bytes)?"
4390                 . ./myread
4391                 longsize="$ans"
4392                 dflt=2
4393                 rp="What is the size of a short integer (in bytes)?"
4394                 . ./myread
4395                 shortsize="$ans"
4396         fi
4397         ;;
4398 esac
4399 $rm -f intsize intsize.*
4400
4401 : see what type lseek is declared as in the kernel
4402 rp="What is the type used for lseek's offset on this system?"
4403 set off_t lseektype long stdio.h sys/types.h
4404 eval $typedef_ask
4405
4406 echo " "
4407 echo "Checking to see how big your file offsets are..." >&4
4408 $cat >try.c <<EOCP
4409 #include <sys/types.h>
4410 #include <stdio.h>
4411 int main()
4412 {
4413     printf("%d\n", (int)sizeof($lseektype));
4414     return(0); 
4415 }
4416 EOCP
4417 set try
4418 if eval $compile_ok; then
4419         lseeksize=`./try`
4420         echo "Your file offsets are $lseeksize bytes long."
4421 else
4422         dflt=$longsize
4423         echo " "
4424         echo "(I can't seem to compile the test program.  Guessing...)"
4425         rp="What is the size of your file offsets (in bytes)?"
4426         . ./myread
4427         lseeksize="$ans"
4428 fi
4429 $rm -f try.c try
4430
4431 : see what type file positions are declared as in the library
4432 rp="What is the type for file position used by fsetpos()?"
4433 set fpos_t fpostype long stdio.h sys/types.h
4434 eval $typedef_ask
4435
4436 echo " "
4437 case "$fpostype" in
4438 *_t) zzz="$fpostype"    ;;
4439 *)   zzz="fpos_t"       ;;
4440 esac
4441 echo "Checking the size of $zzz..." >&4 
4442 cat > try.c <<EOCP
4443 #include <sys/types.h>
4444 #include <stdio.h>
4445 int main() {
4446     printf("%d\n", (int)sizeof($fpostype));
4447     exit(0);
4448 }
4449 EOCP
4450 set try
4451 if eval $compile_ok; then
4452         yyy=`./try`
4453         case "$yyy" in
4454         '')     fpossize=4
4455                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4456                 ;;
4457         *)      fpossize=$yyy
4458                 echo "Your $zzz is $fpossize bytes long."
4459                 ;;
4460         esac
4461 else
4462         dflt="$longsize"
4463         echo " " >&4
4464         echo "(I can't compile the test program.  Guessing...)" >&4
4465         rp="What is the size of your file positions (in bytes)?"
4466         . ./myread
4467         fpossize="$ans"
4468 fi
4469
4470
4471
4472 # Backward compatibility (uselfs is deprecated).
4473 case "$uselfs" in
4474 "$define"|true|[yY]*)
4475         cat <<EOM >&4
4476
4477 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4478 EOM
4479         uselargefiles="$define"
4480         ;;
4481 esac                          
4482
4483 case "$lseeksize:$fpossize" in
4484 8:8) cat <<EOM
4485
4486 You can have files larger than 2 gigabytes.
4487 EOM
4488    val="$define" ;;
4489 *)    case "$uselargefiles" in
4490    "$undef"|false|[nN]*) dflt='n' ;;
4491    *)   dflt='y' ;;
4492    esac
4493    cat <<EOM
4494
4495 Perl can be built to understand large files (files larger than 2 gigabytes)
4496 on some systems.  To do so, Configure can be run with -Duselargefiles.
4497
4498 If this doesn't make any sense to you, just accept the default '$dflt'.
4499 EOM
4500    rp='Try to understand large files, if available?'
4501    . ./myread
4502    case "$ans" in
4503    y|Y)         val="$define" ;;
4504    *)           val="$undef"  ;;
4505    esac
4506    ;;
4507 esac
4508 set uselargefiles
4509 eval $setvar
4510 case "$uselargefiles" in
4511 "$define")
4512 : Look for a hint-file generated 'call-back-unit'.  If the
4513 : user has specified that a large files perl is to be built,
4514 : we may need to set or change some other defaults.
4515         if $test -f uselargefiles.cbu; then
4516                 echo "Your platform has some specific hints for large file builds, using them..."
4517                 . ./uselargefiles.cbu
4518                 echo " "
4519                 echo "Rechecking to see how big your file offsets are..." >&4
4520                 $cat >try.c <<EOCP
4521 #include <sys/types.h>
4522 #include <stdio.h>
4523 int main()
4524 {
4525     printf("%d\n", (int)sizeof($lseektype));
4526     return(0); 
4527 }
4528 EOCP
4529                 set try
4530                 if eval $compile_ok; then
4531                         lseeksize=`./try`
4532                         $echo "Your file offsets are now $lseeksize bytes long."
4533                 else
4534                         dflt="$lseeksize"
4535                         echo " "
4536                         echo "(I can't seem to compile the test program.  Guessing...)"
4537                         rp="What is the size of your file offsets (in bytes)?"
4538                         . ./myread
4539                         lseeksize="$ans"
4540                 fi
4541                 case "$fpostype" in
4542                 *_t) zzz="$fpostype"    ;;
4543                 *)   zzz="fpos_t"       ;;
4544                 esac
4545                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4546                 $cat > try.c <<EOCP
4547 #include <sys/types.h>
4548 #include <stdio.h>
4549 int main() {
4550     printf("%d\n", (int)sizeof($fpostype));
4551     exit(0);
4552 }
4553 EOCP
4554                 set try
4555                 if eval $compile_ok; then
4556                         yyy=`./try`
4557                         dflt="$lseeksize"
4558                         case "$yyy" in
4559                         '')     echo " "
4560                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4561                                 ;;
4562                         *)      fpossize=$yyy
4563                                 echo " $fpossize bytes." >&4
4564                                 ;;
4565                         esac
4566                 else
4567                         dflt="$fpossize"
4568                         echo " "
4569                         echo "(I can't compile the test program.  Guessing...)" >&4
4570                         rp="What is the size of your file positions (in bytes)?"
4571                         . ./myread
4572                         fpossize="$ans"
4573                 fi
4574                 $rm -f try.c try
4575         fi
4576         ;;
4577 esac
4578
4579
4580 case "$usemorebits" in
4581 "$define"|true|[yY]*)
4582         use64bitint="$define"
4583         uselongdouble="$define"
4584         usemorebits="$define"
4585         ;;
4586 *)      usemorebits="$undef"
4587         ;;
4588 esac
4589
4590
4591 case "$uselonglong" in
4592 "$define"|true|[yY]*)
4593         cat <<EOM >&4
4594
4595 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4596 EOM
4597         use64bitint="$define"
4598         ;;
4599 esac                          
4600 case "$use64bits" in
4601 "$define"|true|[yY]*)
4602         cat <<EOM >&4
4603
4604 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4605 EOM
4606         use64bitint="$define"
4607         ;;
4608 esac                          
4609 case "$use64bitints" in
4610 "$define"|true|[yY]*)
4611         cat <<EOM >&4
4612
4613 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4614 EOM
4615         use64bitint="$define"
4616         ;;
4617 esac                          
4618 case "$use64bitsint" in
4619 "$define"|true|[yY]*)
4620         cat <<EOM >&4
4621
4622 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4623 EOM
4624         use64bitint="$define"
4625         ;;
4626 esac                          
4627 case "$uselonglongs" in
4628 "$define"|true|[yY]*)
4629         cat <<EOM >&4
4630
4631 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4632 EOM
4633         use64bitint="$define"
4634         ;;
4635 esac                          
4636 case "$use64bitsall" in
4637 "$define"|true|[yY]*)
4638         cat <<EOM >&4
4639
4640 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4641 EOM
4642         use64bitall="$define"
4643         ;;
4644 esac                          
4645
4646 case "$ccflags" in
4647 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4648 esac
4649 case "$use64bitall" in
4650 "$define"|true|[yY]*) use64bitint="$define" ;;
4651 esac
4652
4653 case "$longsize" in
4654 8) cat <<EOM
4655
4656 You have natively 64-bit long integers.
4657 EOM
4658    val="$define"
4659    ;;
4660 *) case "$use64bitint" in
4661    "$define"|true|[yY]*) dflt='y';;
4662    *) dflt='n';;
4663    esac
4664    cat <<EOM
4665
4666 Perl can be built to take advantage of 64-bit integer types
4667 on some systems.  To do so, Configure can be run with -Duse64bitint.
4668 Choosing this option will most probably introduce binary incompatibilities.
4669
4670 If this doesn't make any sense to you, just accept the default '$dflt'.
4671 EOM
4672    rp='Try to use 64-bit integers, if available?'
4673    . ./myread
4674    case "$ans" in
4675    [yY]*) val="$define" ;;
4676    *)     val="$undef"  ;;
4677    esac
4678    ;;
4679 esac
4680 set use64bitint
4681 eval $setvar
4682
4683 case "$use64bitall" in
4684 "$define"|true|[yY]*) dflt='y' ;;
4685 *) case "$longsize" in
4686    8) dflt='y' ;;
4687    *) dflt='n' ;;
4688    esac
4689    ;;
4690 esac    
4691 cat <<EOM
4692
4693 You may also choose to try maximal 64-bitness.  It means using as much
4694 64-bitness as possible on the platform.  This in turn means even more
4695 binary incompatibilities.  On the other hand, your platform may not
4696 have any more 64-bitness available than what you already have chosen.
4697
4698 If this doesn't make any sense to you, just accept the default '$dflt'.
4699 EOM
4700 rp='Try to use maximal 64-bit support, if available?'
4701 . ./myread
4702 case "$ans" in
4703 [yY]*) val="$define" ;;
4704 *)     val="$undef"  ;;
4705 esac
4706 set use64bitall
4707 eval $setvar
4708 case "$use64bitall" in
4709 "$define")
4710         case "$use64bitint" in
4711         "$undef")
4712                 cat <<EOM
4713
4714 Since you have chosen a maximally 64-bit build, I'm also turning on
4715 the use of 64-bit integers.
4716 EOM
4717                 use64bitint="$define" ;;
4718         esac
4719         ;;
4720 esac
4721
4722 case "$use64bitint" in
4723 "$define"|true|[yY]*)
4724 : Look for a hint-file generated 'call-back-unit'.  If the
4725 : user has specified that a 64-bit perl is to be built,
4726 : we may need to set or change some other defaults.
4727         if $test -f use64bitint.cbu; then
4728                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4729                 . ./use64bitint.cbu
4730         fi
4731         case "$longsize" in
4732         4) case "$archname64" in
4733            '') archname64=64int ;;
4734            esac
4735            ;;
4736         esac
4737         ;;
4738 esac
4739
4740 case "$use64bitall" in
4741 "$define"|true|[yY]*)
4742 : Look for a hint-file generated 'call-back-unit'.  If the
4743 : user has specified that a maximally 64-bit perl is to be built,
4744 : we may need to set or change some other defaults.
4745         if $test -f use64bitall.cbu; then
4746                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4747                 . ./use64bitall.cbu
4748         fi
4749         case "$longsize" in
4750         4) case "$archname64" in
4751            ''|64int) archname64=64all ;;
4752            esac
4753            ;;
4754         esac
4755         ;;
4756 esac
4757
4758 : determine the architecture name
4759 echo " "
4760 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4761         tarch=`arch`"-$osname"
4762 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4763         if uname -m > tmparch 2>&1 ; then
4764                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4765                         -e 's/$/'"-$osname/" tmparch`
4766         else
4767                 tarch="$osname"
4768         fi
4769         $rm -f tmparch
4770 else
4771         tarch="$osname"
4772 fi
4773 case "$myarchname" in
4774 ''|"$tarch") ;;
4775 *)
4776         echo "(Your architecture name used to be $myarchname.)"
4777         archname=''
4778         ;;
4779 esac
4780 myarchname="$tarch"
4781 case "$archname" in
4782 '') dflt="$tarch";;
4783 *) dflt="$archname";;
4784 esac
4785 rp='What is your architecture name'
4786 . ./myread
4787 archname="$ans"
4788 case "$usethreads" in
4789 $define)
4790         echo "Threads selected." >&4
4791         case "$archname" in
4792         *-thread*) echo "...and architecture name already has -thread." >&4
4793                 ;;
4794         *)      archname="$archname-thread"
4795                 echo "...setting architecture name to $archname." >&4
4796                 ;;
4797         esac
4798         ;;
4799 esac
4800 case "$usemultiplicity" in
4801 $define)
4802         echo "Multiplicity selected." >&4
4803         case "$archname" in
4804         *-multi*) echo "...and architecture name already has -multi." >&4
4805                 ;;
4806         *)      archname="$archname-multi"
4807                 echo "...setting architecture name to $archname." >&4
4808                 ;;
4809         esac
4810         ;;
4811 esac
4812 case "$use64bitint" in
4813 $define)
4814         case "$archname64" in
4815         '')
4816                 ;;
4817         *)
4818                 case "$archname" in
4819                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4820                         ;;
4821                 *)      archname="$archname-$archname64"
4822                         echo "...setting architecture name to $archname." >&4
4823                         ;;
4824                 esac
4825                 ;;
4826         esac
4827 esac
4828
4829 : determine root of directory hierarchy where package will be installed.
4830 case "$prefix" in
4831 '')
4832         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4833         ;;
4834 *)
4835         dflt="$prefix"
4836         ;;
4837 esac
4838 $cat <<EOM
4839
4840 By default, $package will be installed in $dflt/bin, manual pages
4841 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4842 installation directories. Typically this is something like /usr/local.
4843 If you wish to have binaries under /usr/bin but other parts of the
4844 installation under /usr/local, that's ok: you will be prompted
4845 separately for each of the installation directories, the prefix being
4846 only used to set the defaults.
4847
4848 EOM
4849 fn=d~
4850 rp='Installation prefix to use?'
4851 . ./getfile
4852 oldprefix=''
4853 case "$prefix" in
4854 '') ;;
4855 *)
4856         case "$ans" in
4857         "$prefix") ;;
4858         *) oldprefix="$prefix";;
4859         esac
4860         ;;
4861 esac
4862 prefix="$ans"
4863 prefixexp="$ansexp"
4864
4865 : is AFS running?
4866 echo " "
4867 case "$afs" in
4868 $define|true)   afs=true ;;
4869 $undef|false)   afs=false ;;
4870 *)      if test -d /afs; then
4871                 afs=true
4872         else
4873                 afs=false
4874         fi
4875         ;;
4876 esac
4877 if $afs; then
4878         echo "AFS may be running... I'll be extra cautious then..." >&4
4879 else
4880         echo "AFS does not seem to be running..." >&4
4881 fi
4882
4883 : determine installation prefix for where package is to be installed.
4884 if $afs; then 
4885 $cat <<EOM
4886
4887 Since you are running AFS, I need to distinguish the directory in which
4888 files will reside from the directory in which they are installed (and from
4889 which they are presumably copied to the former directory by occult means).
4890
4891 EOM
4892         case "$installprefix" in
4893         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4894         *) dflt="$installprefix";;
4895         esac
4896 else
4897 $cat <<EOM
4898
4899 In some special cases, particularly when building $package for distribution,
4900 it is convenient to distinguish between the directory in which files should 
4901 be installed from the directory ($prefix) in which they 
4902 will eventually reside.  For most users, these two directories are the same.
4903
4904 EOM
4905         case "$installprefix" in
4906         '') dflt=$prefix ;;
4907         *) dflt=$installprefix;;
4908         esac
4909 fi
4910 fn=d~
4911 rp='What installation prefix should I use for installing files?'
4912 . ./getfile
4913 installprefix="$ans"
4914 installprefixexp="$ansexp"
4915
4916 : set the prefixit variable, to compute a suitable default value
4917 prefixit='case "$3" in
4918 ""|none)
4919         case "$oldprefix" in
4920         "") eval "$1=\"\$$2\"";;
4921         *)
4922                 case "$3" in
4923                 "") eval "$1=";;
4924                 none)
4925                         eval "tp=\"\$$2\"";
4926                         case "$tp" in
4927                         ""|" ") eval "$1=\"\$$2\"";;
4928                         *) eval "$1=";;
4929                         esac;;
4930                 esac;;
4931         esac;;
4932 *)
4933         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4934         case "$tp" in
4935         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4936         /*-$oldprefix/*|\~*-$oldprefix/*)
4937                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4938         *) eval "$1=\"\$$2\"";;
4939         esac;;
4940 esac'
4941
4942
4943 : get the patchlevel
4944 echo " "
4945 echo "Getting the current patchlevel..." >&4
4946 if $test -r $rsrc/patchlevel.h;then
4947         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4948         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4949         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4950         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4951         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4952         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4953 else
4954         revision=0
4955         patchlevel=0
4956         subversion=0
4957         api_revision=0
4958         api_version=0
4959         api_subversion=0
4960 fi
4961 $echo $n "(You have $package revision $revision" $c
4962 $echo $n " patchlevel $patchlevel" $c
4963 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4964 echo ".)"
4965 case "$osname" in
4966 dos|vms)
4967         : XXX Should be a Configure test for double-dots in filenames.
4968         version=`echo $revision $patchlevel $subversion | \
4969                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4970         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4971                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4972         ;;
4973 *)
4974         version=`echo $revision $patchlevel $subversion | \
4975                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4976         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4977                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4978         ;;
4979 esac
4980 : Special case the 5.005_xx maintenance series, which used 5.005
4981 : without any subversion label as a subdirectory in $sitelib
4982 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4983         api_versionstring='5.005'
4984 fi
4985
4986 : determine installation style
4987 : For now, try to deduce it from prefix unless it is already set.
4988 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4989 case "$installstyle" in
4990 '')     case "$prefix" in
4991                 *perl*) dflt='lib';;
4992                 *) dflt='lib/perl5' ;;
4993         esac
4994         ;;
4995 *)      dflt="$installstyle" ;;
4996 esac
4997 : Probably not worth prompting for this since we prompt for all
4998 : the directories individually, and the prompt would be too long and
4999 : confusing anyway.
5000 installstyle=$dflt
5001
5002 : determine where private library files go
5003 : Usual default is /usr/local/lib/perl5/$version.
5004 : Also allow things like /opt/perl/lib/$version, since 
5005 : /opt/perl/lib/perl5... would be redundant.
5006 : The default "style" setting is made in installstyle.U
5007 case "$installstyle" in
5008 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5009 *)       set dflt privlib lib/$version ;;
5010 esac
5011 eval $prefixit
5012 $cat <<EOM
5013
5014 There are some auxiliary files for $package that need to be put into a
5015 private library directory that is accessible by everyone.
5016
5017 EOM
5018 fn=d~+
5019 rp='Pathname where the private library files will reside?'
5020 . ./getfile
5021 privlib="$ans"
5022 privlibexp="$ansexp"
5023 : Change installation prefix, if necessary.
5024 if $test X"$prefix" != X"$installprefix"; then
5025         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5026 else
5027         installprivlib="$privlibexp"
5028 fi
5029
5030 : set the prefixup variable, to restore leading tilda escape
5031 prefixup='case "$prefixexp" in
5032 "$prefix") ;;
5033 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5034 esac'
5035
5036 : determine where public architecture dependent libraries go
5037 set archlib archlib
5038 eval $prefixit
5039 : privlib default is /usr/local/lib/$package/$version
5040 : archlib default is /usr/local/lib/$package/$version/$archname
5041 : privlib may have an optional trailing /share.
5042 tdflt=`echo $privlib | $sed 's,/share$,,'`
5043 tdflt=$tdflt/$archname
5044 case "$archlib" in
5045 '')     dflt=$tdflt
5046         ;;
5047 *)      dflt="$archlib"
5048     ;;
5049 esac
5050 $cat <<EOM
5051
5052 $spackage contains architecture-dependent library files.  If you are
5053 sharing libraries in a heterogeneous environment, you might store
5054 these files in a separate location.  Otherwise, you can just include
5055 them with the rest of the public library files.
5056
5057 EOM
5058 fn=d+~
5059 rp='Where do you want to put the public architecture-dependent libraries?'
5060 . ./getfile
5061 archlib="$ans"
5062 archlibexp="$ansexp"
5063 if $test X"$archlib" = X"$privlib"; then
5064         d_archlib="$undef"
5065 else
5066         d_archlib="$define"
5067 fi
5068 : Change installation prefix, if necessary.
5069 if $test X"$prefix" != X"$installprefix"; then
5070         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5071 else
5072         installarchlib="$archlibexp"
5073 fi
5074
5075
5076 : Binary compatibility with 5.005 is not possible for builds
5077 : with advanced features
5078 case "$usethreads$usemultiplicity" in
5079 *define*)
5080         bincompat5005="$undef"
5081         d_bincompat5005="$undef"
5082         ;;
5083 *)      $cat <<EOM
5084
5085 This version of Perl can be compiled for binary compatibility with 5.005.
5086 If you decide to do so, you will be able to continue using most of the
5087 extensions that were compiled for Perl 5.005.
5088
5089 EOM
5090         case "$bincompat5005$d_bincompat5005" in
5091         *"$undef"*) dflt=n ;;
5092         *) dflt=y ;;
5093         esac
5094         rp='Binary compatibility with Perl 5.005?'
5095         . ./myread
5096         case "$ans" in
5097         y*) val="$define" ;;
5098         *)  val="$undef" ;;
5099         esac
5100         set d_bincompat5005
5101         eval $setvar
5102         case "$d_bincompat5005" in
5103         "$define")
5104                 bincompat5005="$define"
5105                 ;;
5106         *)      bincompat5005="$undef"
5107                 d_bincompat5005="$undef"
5108                 ;;
5109         esac
5110         ;;
5111 esac
5112
5113
5114 : see if setuid scripts can be secure
5115 $cat <<EOM
5116
5117 Some kernels have a bug that prevents setuid #! scripts from being
5118 secure.  Some sites have disabled setuid #! scripts because of this.
5119
5120 First let's decide if your kernel supports secure setuid #! scripts.
5121 (If setuid #! scripts would be secure but have been disabled anyway,
5122 don't say that they are secure if asked.)
5123
5124 EOM
5125
5126 val="$undef"
5127 if $test -d /dev/fd; then
5128         echo "#!$ls" >reflect
5129         chmod +x,u+s reflect
5130         ./reflect >flect 2>&1
5131         if $contains "/dev/fd" flect >/dev/null; then
5132                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5133                 val="$define"
5134         else
5135                 $cat <<EOM
5136 If you are not sure if they are secure, I can check but I'll need a
5137 username and password different from the one you are using right now.
5138 If you don't have such a username or don't want me to test, simply
5139 enter 'none'.
5140
5141 EOM
5142                 rp='Other username to test security of setuid scripts with?'
5143                 dflt='none'
5144                 . ./myread
5145                 case "$ans" in
5146                 n|none)
5147                         case "$d_suidsafe" in
5148                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5149                                 dflt=n;;
5150                         "$undef")
5151                                 echo "Well, the $hint value is *not* secure." >&4
5152                                 dflt=n;;
5153                         *)      echo "Well, the $hint value *is* secure." >&4
5154                                 dflt=y;;
5155                         esac
5156                         ;;
5157                 *)
5158                         $rm -f reflect flect
5159                         echo "#!$ls" >reflect
5160                         chmod +x,u+s reflect
5161                         echo >flect
5162                         chmod a+w flect
5163                         echo '"su" will (probably) prompt you for '"$ans's password."
5164                         su $ans -c './reflect >flect'
5165                         if $contains "/dev/fd" flect >/dev/null; then
5166                                 echo "Okay, it looks like setuid scripts are secure." >&4
5167                                 dflt=y
5168                         else
5169                                 echo "I don't think setuid scripts are secure." >&4
5170                                 dflt=n
5171                         fi
5172                         ;;
5173                 esac
5174                 rp='Does your kernel have *secure* setuid scripts?'
5175                 . ./myread
5176                 case "$ans" in
5177                 [yY]*)  val="$define";;
5178                 *)      val="$undef";;
5179                 esac
5180         fi
5181 else
5182         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5183         echo "(That's for file descriptors, not floppy disks.)"
5184         val="$undef"
5185 fi
5186 set d_suidsafe
5187 eval $setvar
5188
5189 $rm -f reflect flect
5190
5191 : now see if they want to do setuid emulation
5192 echo " "
5193 val="$undef"
5194 case "$d_suidsafe" in
5195 "$define")
5196         val="$undef"
5197         echo "No need to emulate SUID scripts since they are secure here." >& 4
5198         ;;
5199 *)
5200         $cat <<EOM
5201 Some systems have disabled setuid scripts, especially systems where
5202 setuid scripts cannot be secure.  On systems where setuid scripts have
5203 been disabled, the setuid/setgid bits on scripts are currently
5204 useless.  It is possible for $package to detect those bits and emulate
5205 setuid/setgid in a secure fashion.  This emulation will only work if
5206 setuid scripts have been disabled in your kernel.
5207
5208 EOM
5209         case "$d_dosuid" in
5210         "$define") dflt=y ;;
5211         *) dflt=n ;;
5212         esac
5213         rp="Do you want to do setuid/setgid emulation?"
5214         . ./myread
5215         case "$ans" in
5216         [yY]*)  val="$define";;
5217         *)      val="$undef";;
5218         esac
5219         ;;
5220 esac
5221 set d_dosuid
5222 eval $setvar
5223
5224 : determine filename position in cpp output
5225 echo " "
5226 echo "Computing filename position in cpp output for #include directives..." >&4
5227 echo '#include <stdio.h>' > foo.c
5228 $cat >fieldn <<EOF
5229 $startsh
5230 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5231 $grep '^[       ]*#.*stdio\.h' | \
5232 while read cline; do
5233         pos=1
5234         set \$cline
5235         while $test \$# -gt 0; do
5236                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5237                         echo "\$pos"
5238                         exit 0
5239                 fi
5240                 shift
5241                 pos=\`expr \$pos + 1\`
5242         done
5243 done
5244 EOF
5245 chmod +x fieldn
5246 fieldn=`./fieldn`
5247 $rm -f foo.c fieldn
5248 case $fieldn in
5249 '') pos='???';;
5250 1) pos=first;;
5251 2) pos=second;;
5252 3) pos=third;;
5253 *) pos="${fieldn}th";;
5254 esac
5255 echo "Your cpp writes the filename in the $pos field of the line."
5256
5257 : locate header file
5258 $cat >findhdr <<EOF
5259 $startsh
5260 wanted=\$1
5261 name=''
5262 for usrincdir in $usrinc
5263 do
5264         if test -f \$usrincdir/\$wanted; then
5265                 echo "\$usrincdir/\$wanted"
5266                 exit 0
5267         fi
5268 done
5269 awkprg='{ print \$$fieldn }'
5270 echo "#include <\$wanted>" > foo\$\$.c
5271 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5272 $grep "^[       ]*#.*\$wanted" | \
5273 while read cline; do
5274         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5275         case "\$name" in
5276         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5277         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5278         *) exit 2;;
5279         esac;
5280 done;
5281 #
5282 # status = 0: grep returned 0 lines, case statement not executed
5283 # status = 1: headerfile found
5284 # status = 2: while loop executed, no headerfile found
5285 #
5286 status=\$?
5287 $rm -f foo\$\$.c;
5288 if test \$status -eq 1; then
5289         exit 0;
5290 fi
5291 exit 1
5292 EOF
5293 chmod +x findhdr
5294
5295 : define an alternate in-header-list? function
5296 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5297 cont=true; xxf="echo \"<\$1> found.\" >&4";
5298 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5299 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5300 esac;
5301 case $# in 4) instead=instead;; *) instead="at last";; esac;
5302 while $test "$cont"; do
5303         xxx=`./findhdr $1`
5304         var=$2; eval "was=\$$2";
5305         if $test "$xxx" && $test -r "$xxx";
5306         then eval $xxf;
5307         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5308                 cont="";
5309         else eval $xxnf;
5310         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5311         set $yyy; shift; shift; yyy=$@;
5312         case $# in 0) cont="";;
5313         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5314                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5315         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5316                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5317         esac;
5318 done;
5319 while $test "$yyy";
5320 do set $yyy; var=$2; eval "was=\$$2";
5321         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5322         set $yyy; shift; shift; yyy=$@;
5323 done'
5324
5325 : see if this is a malloc.h system
5326 set malloc.h i_malloc
5327 eval $inhdr
5328
5329 : see if stdlib is available
5330 set stdlib.h i_stdlib
5331 eval $inhdr
5332
5333 : determine which malloc to compile in
5334 echo " "
5335 case "$usemymalloc" in
5336 ''|[yY]*|true|$define)  dflt='y' ;;
5337 *)      dflt='n' ;;
5338 esac
5339 rp="Do you wish to attempt to use the malloc that comes with $package?"
5340 . ./myread
5341 usemymalloc="$ans"
5342 case "$ans" in
5343 y*|true)
5344         usemymalloc='y'
5345         mallocsrc='malloc.c'
5346         mallocobj="malloc$_o"
5347         d_mymalloc="$define"
5348         case "$libs" in
5349         *-lmalloc*)
5350                 : Remove malloc from list of libraries to use
5351                 echo "Removing unneeded -lmalloc from library list" >&4
5352                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5353                 shift
5354                 libs="$*"
5355                 echo "libs = $libs" >&4
5356                 ;;
5357         esac
5358         ;;
5359 *)
5360         usemymalloc='n'
5361         mallocsrc=''
5362         mallocobj=''
5363         d_mymalloc="$undef"
5364         ;;
5365 esac
5366
5367 : compute the return types of malloc and free
5368 echo " "
5369 $cat >malloc.c <<END
5370 #$i_malloc I_MALLOC
5371 #$i_stdlib I_STDLIB
5372 #include <stdio.h>
5373 #include <sys/types.h>
5374 #ifdef I_MALLOC
5375 #include <malloc.h>
5376 #endif
5377 #ifdef I_STDLIB
5378 #include <stdlib.h>
5379 #endif
5380 #ifdef TRY_MALLOC
5381 void *malloc();
5382 #endif
5383 #ifdef TRY_FREE
5384 void free();
5385 #endif
5386 END
5387 case "$malloctype" in
5388 '')
5389         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5390                 malloctype='void *'
5391         else
5392                 malloctype='char *'
5393         fi
5394         ;;
5395 esac
5396 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5397
5398 case "$freetype" in
5399 '')
5400         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5401                 freetype='void'
5402         else
5403                 freetype='int'
5404         fi
5405         ;;
5406 esac
5407 echo "Your system uses $freetype free(), it would seem." >&4
5408 $rm -f malloc.[co]
5409 $cat <<EOM
5410
5411 After $package is installed, you may wish to install various
5412 add-on modules and utilities.  Typically, these add-ons will
5413 be installed under $prefix with the rest
5414 of this package.  However, you may wish to install such add-ons
5415 elsewhere under a different prefix.
5416
5417 If you do not wish to put everything under a single prefix, that's
5418 ok.  You will be prompted for the individual locations; this siteprefix
5419 is only used to suggest the defaults.
5420
5421 The default should be fine for most people.
5422
5423 EOM
5424 fn=d~+
5425 rp='Installation prefix to use for add-on modules and utilities?'
5426 : XXX Here might be another good place for an installstyle setting.
5427 case "$siteprefix" in
5428 '') dflt=$prefix ;;
5429 *)  dflt=$siteprefix ;;
5430 esac
5431 . ./getfile
5432 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5433 oldsiteprefix=''
5434 case "$siteprefix" in
5435 '') ;;
5436 *)      case "$ans" in
5437         "$prefix") ;;
5438         *) oldsiteprefix="$prefix";;
5439         esac
5440         ;;
5441 esac
5442 siteprefix="$ans"
5443 siteprefixexp="$ansexp"
5444
5445 : determine where site specific libraries go.
5446 : Usual default is /usr/local/lib/perl5/site_perl/$version
5447 : The default "style" setting is made in installstyle.U
5448 : XXX No longer works with Prefixit stuff.
5449 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5450 case "$sitelib" in
5451 '') case "$installstyle" in
5452         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5453         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5454         esac
5455         ;;
5456 *)      dflt="$sitelib"
5457         ;;
5458 esac
5459 $cat <<EOM
5460
5461 The installation process will create a directory for
5462 site-specific extensions and modules.  Most users find it convenient
5463 to place all site-specific files in this directory rather than in the
5464 main distribution directory.
5465
5466 EOM
5467 fn=d~+
5468 rp='Pathname for the site-specific library files?'
5469 . ./getfile
5470 sitelib="$ans"
5471 sitelibexp="$ansexp"
5472 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5473 : Change installation prefix, if necessary.
5474 if $test X"$prefix" != X"$installprefix"; then
5475         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5476 else
5477         installsitelib="$sitelibexp"
5478 fi
5479
5480 : determine where site specific architecture-dependent libraries go.
5481 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5482 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5483 : sitelib may have an optional trailing /share.
5484 case "$sitearch" in
5485 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5486         dflt="$dflt/$archname"
5487         ;;
5488 *)      dflt="$sitearch"
5489         ;;
5490 esac
5491 set sitearch sitearch none
5492 eval $prefixit
5493 $cat <<EOM
5494
5495 The installation process will also create a directory for
5496 architecture-dependent site-specific extensions and modules.
5497
5498 EOM
5499 fn=d~+
5500 rp='Pathname for the site-specific architecture-dependent library files?'
5501 . ./getfile
5502 sitearch="$ans"
5503 sitearchexp="$ansexp"
5504 : Change installation prefix, if necessary.
5505 if $test X"$prefix" != X"$installprefix"; then
5506         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5507 else
5508         installsitearch="$sitearchexp"
5509 fi
5510
5511 $cat <<EOM
5512
5513 The installation process will also create a directory for
5514 vendor-supplied add-ons.  Vendors who supply perl with their system
5515 may find it convenient to place all vendor-supplied files in this
5516 directory rather than in the main distribution directory.  This will
5517 ease upgrades between binary-compatible maintenance versions of perl.
5518
5519 Of course you may also use these directories in whatever way you see
5520 fit.  For example, you might use them to access modules shared over a
5521 company-wide network.
5522
5523 The default answer should be fine for most people.
5524 This causes further questions about vendor add-ons to be skipped
5525 and no vendor-specific directories will be configured for perl.
5526
5527 EOM
5528 rp='Do you want to configure vendor-specific add-on directories?'
5529 case "$usevendorprefix" in
5530 define|true|[yY]*) dflt=y ;;
5531 *)      : User may have set vendorprefix directly on Configure command line.
5532         case "$vendorprefix" in
5533         ''|' ') dflt=n ;;
5534         *)      dflt=y ;;
5535         esac
5536         ;;
5537 esac
5538 . ./myread
5539 case "$ans" in
5540 [yY]*)  fn=d~+
5541         rp='Installation prefix to use for vendor-supplied add-ons?'
5542         case "$vendorprefix" in
5543         '') dflt='' ;;
5544         *)  dflt=$vendorprefix ;;
5545         esac
5546         . ./getfile
5547         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5548         oldvendorprefix=''
5549         case "$vendorprefix" in
5550         '') ;;
5551         *)      case "$ans" in
5552                 "$prefix") ;;
5553                 *) oldvendorprefix="$prefix";;
5554                 esac
5555                 ;;
5556         esac
5557         usevendorprefix="$define"
5558         vendorprefix="$ans"
5559         vendorprefixexp="$ansexp"
5560         ;;
5561 *)      usevendorprefix="$undef"
5562         vendorprefix=''
5563         vendorprefixexp=''
5564         ;;
5565 esac
5566
5567 case "$vendorprefix" in
5568 '')     d_vendorlib="$undef"
5569         vendorlib=''
5570         vendorlibexp=''
5571         ;;
5572 *)      d_vendorlib="$define"
5573         : determine where vendor-supplied modules go.
5574         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5575         case "$vendorlib" in
5576         '')
5577                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5578                 case "$installstyle" in
5579                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5580                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5581                 esac
5582                 ;;
5583         *)      dflt="$vendorlib"
5584                 ;;
5585         esac
5586         fn=d~+
5587         rp='Pathname for the vendor-supplied library files?'
5588         . ./getfile
5589         vendorlib="$ans"
5590         vendorlibexp="$ansexp"
5591         ;;
5592 esac
5593 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5594 : Change installation prefix, if necessary.
5595 if $test X"$prefix" != X"$installprefix"; then
5596         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5597 else
5598         installvendorlib="$vendorlibexp"
5599 fi
5600
5601 case "$vendorprefix" in
5602 '')     d_vendorarch="$undef"
5603         vendorarch=''
5604         vendorarchexp=''
5605         ;;
5606 *)      d_vendorarch="$define"
5607         : determine where vendor-supplied architecture-dependent libraries go.
5608         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5609         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5610         : vendorlib may have an optional trailing /share.
5611         case "$vendorarch" in
5612         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5613                 dflt="$dflt/$archname"
5614                 ;;
5615         *)      dflt="$vendorarch" ;;
5616         esac
5617         fn=d~+
5618         rp='Pathname for vendor-supplied architecture-dependent files?'
5619         . ./getfile
5620         vendorarch="$ans"
5621         vendorarchexp="$ansexp"
5622         ;;
5623 esac
5624 : Change installation prefix, if necessary.
5625 if $test X"$prefix" != X"$installprefix"; then
5626         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5627 else
5628         installvendorarch="$vendorarchexp"
5629 fi
5630
5631 : Final catch-all directories to search
5632 $cat <<EOM
5633
5634 Lastly, you can have perl look in other directories for extensions and
5635 modules in addition to those already specified.
5636 These directories will be searched after 
5637         $sitearch 
5638         $sitelib 
5639 EOM
5640 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5641 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5642 echo ' '
5643 case "$otherlibdirs" in
5644 ''|' ') dflt='none' ;;
5645 *)      dflt="$otherlibdirs" ;;
5646 esac
5647 $cat <<EOM
5648 Enter a colon-separated set of extra paths to include in perl's @INC
5649 search path, or enter 'none' for no extra paths.
5650
5651 EOM
5652
5653 rp='Colon-separated list of additional directories for perl to search?'
5654 . ./myread
5655 case "$ans" in
5656 ' '|''|none)    otherlibdirs=' ' ;;     
5657 *)      otherlibdirs="$ans" ;;
5658 esac
5659 case "$otherlibdirs" in
5660 ' ') val=$undef ;;
5661 *)      val=$define ;;
5662 esac
5663 set d_perl_otherlibdirs
5664 eval $setvar
5665
5666 : Cruising for prototypes
5667 echo " "
5668 echo "Checking out function prototypes..." >&4
5669 $cat >prototype.c <<'EOCP'
5670 int main(int argc, char *argv[]) {
5671         exit(0);}
5672 EOCP
5673 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5674         echo "Your C compiler appears to support function prototypes."
5675         val="$define"
5676 else
5677         echo "Your C compiler doesn't seem to understand function prototypes."
5678         val="$undef"
5679 fi
5680 set prototype
5681 eval $setvar
5682 $rm -f prototype*
5683
5684 case "$prototype" in
5685 "$define") ;;
5686 *)      ansi2knr='ansi2knr'
5687         echo " "
5688         cat <<EOM >&4
5689
5690 $me:  FATAL ERROR:
5691 This version of $package can only be compiled by a compiler that 
5692 understands function prototypes.  Unfortunately, your C compiler 
5693         $cc $ccflags
5694 doesn't seem to understand them.  Sorry about that.
5695
5696 If GNU cc is available for your system, perhaps you could try that instead.  
5697
5698 Eventually, we hope to support building Perl with pre-ANSI compilers.
5699 If you would like to help in that effort, please contact <perlbug@perl.org>.
5700
5701 Aborting Configure now.
5702 EOM
5703         exit 2
5704         ;;
5705 esac
5706
5707 : determine where public executables go
5708 echo " "
5709 set dflt bin bin
5710 eval $prefixit
5711 fn=d~
5712 rp='Pathname where the public executables will reside?'
5713 . ./getfile
5714 if $test "X$ansexp" != "X$binexp"; then
5715         installbin=''
5716 fi
5717 bin="$ans"
5718 binexp="$ansexp"
5719 : Change installation prefix, if necessary.
5720 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5721 if $test X"$prefix" != X"$installprefix"; then
5722         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5723 else
5724         installbin="$binexp"
5725 fi
5726
5727 : Find perl5.005 or later.
5728 echo "Looking for a previously installed perl5.005 or later... "
5729 case "$perl5" in
5730 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5731                 : Check if this perl is recent and can load a simple module
5732                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5733                         perl5=$tdir/perl
5734                         break;
5735                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5736                         perl5=$tdir/perl
5737                         break;
5738                 fi
5739         done
5740         ;;
5741 *)      perl5="$perl5"
5742         ;;
5743 esac
5744 case "$perl5" in
5745 '')     echo "None found.  That's ok.";;
5746 *)      echo "Using $perl5." ;;
5747 esac
5748
5749 : Determine list of previous versions to include in @INC
5750 $cat > getverlist <<EOPL
5751 #!$perl5 -w
5752 use File::Basename;
5753 \$api_versionstring = "$api_versionstring";
5754 \$version = "$version";
5755 \$stem = "$sitelib_stem";
5756 \$archname = "$archname";
5757 EOPL
5758         $cat >> getverlist <<'EOPL'
5759 # Can't have leading @ because metaconfig interprets it as a command!
5760 ;@inc_version_list=();
5761 # XXX Redo to do opendir/readdir? 
5762 if (-d $stem) {
5763     chdir($stem);
5764     ;@candidates = glob("5.*");
5765 }
5766 else {
5767     ;@candidates = ();
5768 }
5769
5770 # XXX ToDo:  These comparisons must be reworked when two-digit
5771 # subversions come along, so that 5.7.10 compares as greater than
5772 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5773 # widespread that we can use the built-in version vectors rather
5774 # than reinventing them here.  For 5.6.0, however, we must
5775 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5776 foreach $d (@candidates) {
5777     if ($d lt $version) {
5778         if ($d ge $api_versionstring) {
5779             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5780         }
5781         elsif ($d ge "5.005") {
5782             unshift(@inc_version_list, grep { -d } $d);
5783         }
5784     }
5785     else {
5786         # Skip newer version.  I.e. don't look in
5787         # 5.7.0 if we're installing 5.6.1.
5788     }
5789 }
5790
5791 if (@inc_version_list) {
5792     print join(' ', @inc_version_list);
5793 }
5794 else {
5795     # Blank space to preserve value for next Configure run.
5796     print " ";
5797 }
5798 EOPL
5799 chmod +x getverlist
5800 case "$inc_version_list" in
5801 '')     if test -x "$perl5"; then
5802                 dflt=`$perl5 getverlist`
5803         else
5804                 dflt='none'
5805         fi
5806         ;;
5807 $undef) dflt='none' ;;
5808 *)  dflt="$inc_version_list" ;;
5809 esac
5810 case "$dflt" in
5811 ''|' ') dflt=none ;;
5812 esac
5813 case "$dflt" in
5814 5.005) case "$bincompat5005" in
5815        $define|true|[yY]*) ;;
5816        *) dflt=none ;;
5817        esac
5818        ;;
5819 esac
5820 $cat <<'EOM'
5821
5822 In order to ease the process of upgrading, this version of perl 
5823 can be configured to use modules built and installed with earlier 
5824 versions of perl that were installed under $prefix.  Specify here
5825 the list of earlier versions that this version of perl should check.
5826 If Configure detected no earlier versions of perl installed under
5827 $prefix, then the list will be empty.  Answer 'none' to tell perl
5828 to not search earlier versions.
5829
5830 The default should almost always be sensible, so if you're not sure,
5831 just accept the default.
5832 EOM
5833
5834 rp='List of earlier versions to include in @INC?'
5835 . ./myread
5836 case "$ans" in
5837 [Nn]one|''|' ') inc_version_list=' ' ;;
5838 *) inc_version_list="$ans" ;;
5839 esac
5840 case "$inc_version_list" in
5841 ''|' ') 
5842         inc_version_list_init='0';;
5843 *)      inc_version_list_init=`echo $inc_version_list |
5844                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5845         ;;
5846 esac
5847 $rm -f getverlist
5848
5849 : determine whether to install perl also as /usr/bin/perl
5850
5851 echo " "
5852 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5853         $cat <<EOM
5854 Many scripts expect perl to be installed as /usr/bin/perl.
5855 I can install the perl you are about to compile also as /usr/bin/perl
5856 (in addition to $installbin/perl).
5857 EOM
5858         case "$installusrbinperl" in
5859         "$undef"|[nN]*) dflt='n';;
5860         *)              dflt='y';;
5861         esac
5862         rp="Do you want to install perl as /usr/bin/perl?"
5863         . ./myread
5864         case "$ans" in
5865         [yY]*)  val="$define";;
5866         *)      val="$undef" ;;
5867         esac
5868 else
5869         val="$undef"
5870 fi
5871 set installusrbinperl
5872 eval $setvar
5873
5874 echo " "
5875 echo "Checking for GNU C Library..." >&4
5876 cat >gnulibc.c <<EOM
5877 #include <stdio.h>
5878 int main()
5879 {
5880 #ifdef __GLIBC__
5881     exit(0);
5882 #else
5883     exit(1);
5884 #endif
5885 }
5886 EOM
5887 set gnulibc
5888 if eval $compile_ok && ./gnulibc; then
5889         val="$define"
5890         echo "You are using the GNU C Library"
5891 else
5892         val="$undef"
5893         echo "You are not using the GNU C Library"
5894 fi
5895 $rm -f gnulibc*
5896 set d_gnulibc
5897 eval $setvar
5898
5899 : see if nm is to be used to determine whether a symbol is defined or not
5900 case "$usenm" in
5901 '')
5902         dflt=''
5903         case "$d_gnulibc" in
5904         "$define")
5905                 echo " "
5906                 echo "nm probably won't work on the GNU C Library." >&4
5907                 dflt=n
5908                 ;;
5909         esac
5910         case "$dflt" in
5911         '') 
5912                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5913                         echo " "
5914                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5915                         echo "'nm' won't be sufficient on this sytem." >&4
5916                         dflt=n
5917                 fi
5918                 ;;
5919         esac
5920         case "$dflt" in
5921         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5922                 if $test $dflt -gt 20; then
5923                         dflt=y
5924                 else
5925                         dflt=n
5926                 fi
5927                 ;;
5928         esac
5929         ;;
5930 *)
5931         case "$usenm" in
5932         true|$define) dflt=y;;
5933         *) dflt=n;;
5934         esac
5935         ;;
5936 esac
5937 $cat <<EOM
5938
5939 I can use $nm to extract the symbols from your C libraries. This
5940 is a time consuming task which may generate huge output on the disk (up
5941 to 3 megabytes) but that should make the symbols extraction faster. The
5942 alternative is to skip the 'nm' extraction part and to compile a small
5943 test program instead to determine whether each symbol is present. If
5944 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5945 this may be the best solution.
5946
5947 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5948
5949 EOM
5950 rp="Shall I use $nm to extract C symbols from the libraries?"
5951 . ./myread
5952 case "$ans" in
5953 [Nn]*) usenm=false;;
5954 *) usenm=true;;
5955 esac
5956
5957 runnm=$usenm
5958 case "$reuseval" in
5959 true) runnm=false;;
5960 esac
5961
5962 : nm options which may be necessary
5963 case "$nm_opt" in
5964 '') if $test -f /mach_boot; then
5965                 nm_opt=''       # Mach
5966         elif $test -d /usr/ccs/lib; then
5967                 nm_opt='-p'     # Solaris (and SunOS?)
5968         elif $test -f /dgux; then
5969                 nm_opt='-p'     # DG-UX
5970         elif $test -f /lib64/rld; then
5971                 nm_opt='-p'     # 64-bit Irix
5972         else
5973                 nm_opt=''
5974         fi;;
5975 esac
5976
5977 : nm options which may be necessary for shared libraries but illegal
5978 : for archive libraries.  Thank you, Linux.
5979 case "$nm_so_opt" in
5980 '')     case "$myuname" in
5981         *linux*)
5982                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5983                         nm_so_opt='--dynamic'
5984                 fi
5985                 ;;
5986         esac
5987         ;;
5988 esac
5989
5990 case "$runnm" in
5991 true)
5992 : get list of predefined functions in a handy place
5993 echo " "
5994 case "$libc" in
5995 '') libc=unknown
5996         case "$libs" in
5997         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5998         esac
5999         ;;
6000 esac
6001 libnames='';
6002 case "$libs" in
6003 '') ;;
6004 *)  for thislib in $libs; do
6005         case "$thislib" in
6006         -lc|-lc_s)
6007                 : Handle C library specially below.
6008                 ;;
6009         -l*)
6010                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6011                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6012                         :
6013                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6014                         :
6015                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6016                         :
6017                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6018                         :
6019                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6020                         :
6021                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6022                         :
6023                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6024                         :
6025                 else
6026                         try=''
6027                 fi
6028                 libnames="$libnames $try"
6029                 ;;
6030         *) libnames="$libnames $thislib" ;;
6031         esac
6032         done
6033         ;;
6034 esac
6035 xxx=normal
6036 case "$libc" in
6037 unknown)
6038         set /lib/libc.$so
6039         for xxx in $libpth; do
6040                 $test -r $1 || set $xxx/libc.$so
6041                 : The messy sed command sorts on library version numbers.
6042                 $test -r $1 || \
6043                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6044                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6045                                 h
6046                                 s/[0-9][0-9]*/0000&/g
6047                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6048                                 G
6049                                 s/\n/ /' | \
6050                          sort | $sed -e 's/^.* //'`
6051                 eval set \$$#
6052         done
6053         $test -r $1 || set /usr/ccs/lib/libc.$so
6054         $test -r $1 || set /lib/libsys_s$_a
6055         ;;
6056 *)
6057         set blurfl
6058         ;;
6059 esac
6060 if $test -r "$1"; then
6061         echo "Your (shared) C library seems to be in $1."
6062         libc="$1"
6063 elif $test -r /lib/libc && $test -r /lib/clib; then
6064         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6065         xxx=apollo
6066         libc='/lib/clib /lib/libc'
6067         if $test -r /lib/syslib; then
6068                 echo "(Your math library is in /lib/syslib.)"
6069                 libc="$libc /lib/syslib"
6070         fi
6071 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6072         echo "Your C library seems to be in $libc, as you said before."
6073 elif $test -r $incpath/usr/lib/libc$_a; then
6074         libc=$incpath/usr/lib/libc$_a;
6075         echo "Your C library seems to be in $libc.  That's fine."
6076 elif $test -r /lib/libc$_a; then
6077         libc=/lib/libc$_a;
6078         echo "Your C library seems to be in $libc.  You're normal."
6079 else
6080         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6081                 :
6082         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6083                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6084         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6085                 :
6086         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6087                 :
6088         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6089                 :
6090         else
6091                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6092         fi
6093         if $test -r "$tans"; then
6094                 echo "Your C library seems to be in $tans, of all places."
6095                 libc=$tans
6096         else
6097                 libc='blurfl'
6098         fi
6099 fi
6100 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6101         dflt="$libc"
6102         cat <<EOM
6103
6104 If the guess above is wrong (which it might be if you're using a strange
6105 compiler, or your machine supports multiple models), you can override it here.
6106
6107 EOM
6108 else
6109         dflt=''
6110         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
6111         cat >&4 <<EOM
6112 I can't seem to find your C library.  I've looked in the following places:
6113
6114 EOM
6115         $sed 's/^/      /' libpath
6116         cat <<EOM
6117
6118 None of these seems to contain your C library. I need to get its name...
6119
6120 EOM
6121 fi
6122 fn=f
6123 rp='Where is your C library?'
6124 . ./getfile
6125 libc="$ans"
6126
6127 echo " "
6128 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
6129 set X `cat libnames`
6130 shift
6131 xxx=files
6132 case $# in 1) xxx=file; esac
6133 echo "Extracting names from the following $xxx for later perusal:" >&4
6134 echo " "
6135 $sed 's/^/      /' libnames >&4
6136 echo " "
6137 $echo $n "This may take a while...$c" >&4
6138
6139 for file in $*; do
6140         case $file in
6141         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6142         *) $nm $nm_opt $file 2>/dev/null;;
6143         esac
6144 done >libc.tmp
6145
6146 $echo $n ".$c"
6147 $grep fprintf libc.tmp > libc.ptf
6148 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6149 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
6150 xxx='[ADTSIW]'
6151 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
6152         eval $xscan;\
6153         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6154                 eval $xrun
6155 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6156         eval $xscan;\
6157         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6158                 eval $xrun
6159 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6160         eval $xscan;\
6161         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6162                 eval $xrun
6163 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6164         eval $xscan;\
6165         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6166                 eval $xrun
6167 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6168         eval $xscan;\
6169         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6170                 eval $xrun
6171 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6172         eval $xscan;\
6173         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6174                 eval $xrun
6175 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6176                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6177         eval $xscan;\
6178         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6179                 eval $xrun
6180 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6181         eval $xscan;\
6182         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6183                 eval $xrun
6184 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6185         eval $xscan;\
6186         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6187                 eval $xrun
6188 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6189         eval $xscan;\
6190         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6191                 eval $xrun
6192 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6193         eval $xscan;\
6194         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6195                 eval $xrun
6196 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6197         eval $xscan;\
6198         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6199                 eval $xrun
6200 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6201         eval $xscan;\
6202         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6203                 eval $xrun
6204 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6205         eval $xscan;\
6206         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6207                 eval $xrun
6208 else
6209         $nm -p $* 2>/dev/null >libc.tmp
6210         $grep fprintf libc.tmp > libc.ptf
6211         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6212                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6213         then
6214                 nm_opt='-p'
6215                 eval $xrun
6216         else
6217                 echo " "
6218                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6219                 com=''
6220                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6221                         for thisname in $libnames $libc; do
6222                                 $ar t $thisname >>libc.tmp
6223                         done
6224                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6225                         echo "Ok." >&4
6226                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6227                         # Repeat libc to extract forwarders to DLL entries too
6228                         for thisname in $libnames $libc; do
6229                                 $ar tv $thisname >>libc.tmp
6230                                 # Revision 50 of EMX has bug in $ar.
6231                                 # it will not extract forwarders to DLL entries
6232                                 # Use emximp which will extract exactly them.
6233                                 emximp -o tmp.imp $thisname \
6234                                     2>/dev/null && \
6235                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6236                                     < tmp.imp >>libc.tmp
6237                                 $rm tmp.imp
6238                         done
6239                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6240                         echo "Ok." >&4
6241                 else
6242                         echo "$ar didn't seem to work right." >&4
6243                         echo "Maybe this is a Cray...trying bld instead..." >&4
6244                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6245                         then
6246                                 for thisname in $libnames; do
6247                                         bld t $libnames | \
6248                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6249                                         $ar t $thisname >>libc.tmp
6250                                 done
6251                                 echo "Ok." >&4
6252                         else
6253                                 echo "That didn't work either.  Giving up." >&4
6254                                 exit 1
6255                         fi
6256                 fi
6257         fi
6258 fi
6259 nm_extract="$com"
6260 if $test -f /lib/syscalls.exp; then
6261         echo " "
6262         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6263         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6264 fi
6265 ;;
6266 esac
6267 $rm -f libnames libpath
6268
6269 : see if dld is available
6270 set dld.h i_dld
6271 eval $inhdr
6272
6273 : is a C symbol defined?
6274 csym='tlook=$1;
6275 case "$3" in
6276 -v) tf=libc.tmp; tc=""; tdc="";;
6277 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6278 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6279 esac;
6280 tx=yes;
6281 case "$reuseval-$4" in
6282 true-) ;;
6283 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6284 esac;
6285 case "$tx" in
6286 yes)
6287         case "$runnm" in
6288         true)
6289                 if $contains $tlook $tf >/dev/null 2>&1;
6290                 then tval=true;
6291                 else tval=false;
6292                 fi;;
6293         *)
6294                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6295                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6296                 then tval=true;
6297                 else tval=false;
6298                 fi;
6299                 $rm -f t t.c;;
6300         esac;;
6301 *)
6302         case "$tval" in
6303         $define) tval=true;;
6304         *) tval=false;;
6305         esac;;
6306 esac;
6307 eval "$2=$tval"'
6308
6309 : define an is-in-libc? function
6310 inlibc='echo " "; td=$define; tu=$undef;
6311 sym=$1; var=$2; eval "was=\$$2";
6312 tx=yes;
6313 case "$reuseval$was" in
6314 true) ;;
6315 true*) tx=no;;
6316 esac;
6317 case "$tx" in
6318 yes)
6319         set $sym tres -f;
6320         eval $csym;
6321         case "$tres" in
6322         true)
6323                 echo "$sym() found." >&4;
6324                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6325         *)
6326                 echo "$sym() NOT found." >&4;
6327                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6328         esac;;
6329 *)
6330         case "$was" in
6331         $define) echo "$sym() found." >&4;;
6332         *) echo "$sym() NOT found." >&4;;
6333         esac;;
6334 esac'
6335
6336 : see if dlopen exists
6337 xxx_runnm="$runnm"
6338 runnm=false
6339 set dlopen d_dlopen
6340 eval $inlibc
6341 runnm="$xxx_runnm"
6342
6343 : determine which dynamic loading, if any, to compile in
6344 echo " "
6345 dldir="ext/DynaLoader"
6346 case "$usedl" in
6347 $define|y|true)
6348         dflt='y'
6349         usedl="$define"
6350         ;;
6351 $undef|n|false)
6352         dflt='n'
6353         usedl="$undef"
6354         ;;
6355 *) 
6356         dflt='n'
6357         case "$d_dlopen" in
6358             $define) dflt='y' ;;
6359         esac
6360         case "$i_dld" in
6361             $define) dflt='y' ;;
6362         esac
6363         : Does a dl_xxx.xs file exist for this operating system
6364         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6365         ;;
6366 esac
6367 rp="Do you wish to use dynamic loading?"
6368 . ./myread
6369 usedl="$ans"
6370 case "$ans" in
6371 y*) usedl="$define"
6372         case "$dlsrc" in
6373         '')
6374                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6375                         dflt="$dldir/dl_${osname}.xs"
6376                 elif $test "$d_dlopen" = "$define" ; then
6377                         dflt="$dldir/dl_dlopen.xs"
6378                 elif $test "$i_dld" = "$define" ; then
6379                         dflt="$dldir/dl_dld.xs"
6380                 else
6381                         dflt=''
6382                 fi
6383                 ;;
6384         *)      dflt="$dldir/$dlsrc"
6385                 ;;
6386         esac
6387     echo "The following dynamic loading files are available:"
6388         : Can not go over to $dldir because getfile has path hard-coded in.
6389         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6390         rp="Source file to use for dynamic loading"
6391         fn="fne"
6392         gfpth="$src"
6393         . ./getfile
6394         usedl="$define"
6395         : emulate basename
6396         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6397
6398         $cat << EOM
6399
6400 Some systems may require passing special flags to $cc -c to
6401 compile modules that will be used to create a shared library.
6402 To use no flags, say "none".
6403
6404 EOM
6405     case "$cccdlflags" in
6406     '') case "$gccversion" in
6407                 '') case "$osname" in
6408                         hpux)   dflt='+z' ;;
6409                         next)   dflt='none' ;;
6410                         irix*)  dflt='-KPIC' ;;
6411                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6412                         sunos)  dflt='-pic' ;;
6413                         *)      dflt='none' ;;
6414                     esac
6415                         ;;
6416                 *)  case "$osname" in
6417                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6418                         *)      dflt='-fpic' ;;
6419                     esac ;;
6420             esac ;;
6421         ' ') dflt='none' ;;
6422     *)  dflt="$cccdlflags" ;;
6423     esac
6424     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6425     . ./myread
6426     case "$ans" in
6427     none) cccdlflags=' ' ;;
6428     *) cccdlflags="$ans" ;;
6429     esac
6430
6431     cat << EOM
6432
6433 Some systems use ld to create libraries that can be dynamically loaded,
6434 while other systems (such as those using ELF) use $cc.
6435
6436 EOM
6437         case "$ld" in
6438         '')     $cat >try.c <<'EOM'
6439 /* Test for whether ELF binaries are produced */
6440 #include <fcntl.h>
6441 #include <stdlib.h>
6442 int main() {
6443         char b[4];
6444         int i = open("a.out",O_RDONLY);
6445         if(i == -1) 
6446                 exit(1); /* fail */
6447         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6448                 exit(0); /* succeed (yes, it's ELF) */
6449         else
6450                 exit(1); /* fail */
6451 }
6452 EOM
6453                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6454                         cat <<EOM
6455 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6456 EOM
6457                         dflt="$cc"
6458                 else
6459                         echo "I'll use ld to build dynamic libraries."
6460                         dflt='ld'
6461                 fi
6462                 rm -f try.c a.out
6463                 ;;
6464         *)      dflt="$ld"
6465                 ;;
6466         esac
6467
6468     rp="What command should be used to create dynamic libraries?"
6469     . ./myread
6470         ld="$ans"
6471
6472     cat << EOM
6473
6474 Some systems may require passing special flags to $ld to create a
6475 library that can be dynamically loaded.  If your ld flags include
6476 -L/other/path options to locate libraries outside your loader's normal
6477 search path, you may need to specify those -L options here as well.  To
6478 use no flags, say "none".
6479
6480 EOM
6481     case "$lddlflags" in
6482     '') case "$osname" in
6483                         beos) dflt='-nostart' ;;
6484                         hpux) dflt='-b';
6485                               case "$gccversion" in
6486                               '') dflt="$dflt +vnocompatwarnings" ;;
6487                               esac
6488                               ;;        
6489                         linux|irix*)    dflt='-shared' ;;
6490                         next)  dflt='none' ;;
6491                         solaris) dflt='-G' ;;
6492                         sunos) dflt='-assert nodefinitions' ;;
6493                         svr4*|esix*) dflt="-G $ldflags" ;;
6494                 *)     dflt='none' ;;
6495                         esac
6496                         ;;
6497     *) dflt="$lddlflags" ;;
6498     esac
6499
6500         : Try to guess additional flags to pick up local libraries.
6501         : Be careful not to append to a plain 'none'
6502         case "$dflt" in
6503         none) dflt='' ;;
6504         esac
6505         for thisflag in $ldflags; do
6506                 case "$thisflag" in
6507                 -L*)
6508                         case " $dflt " in
6509                         *" $thisflag "*) ;;
6510                         *) dflt="$dflt $thisflag" ;;
6511                         esac
6512                         ;;
6513                 esac
6514         done
6515
6516         case "$dflt" in
6517         ''|' ') dflt='none' ;;
6518         esac
6519
6520     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6521     . ./myread
6522     case "$ans" in
6523     none) lddlflags=' ' ;;
6524     *) lddlflags="$ans" ;;
6525     esac
6526
6527         cat <<EOM
6528
6529 Some systems may require passing special flags to $cc to indicate that
6530 the resulting executable will use dynamic linking.  To use no flags,
6531 say "none".
6532
6533 EOM
6534     case "$ccdlflags" in
6535     '') case "$osname" in
6536                 hpux)   dflt='-Wl,-E' ;;
6537                 linux)  dflt='-rdynamic' ;;
6538                 next)   dflt='none' ;;
6539                 sunos)  dflt='none' ;;
6540                 *)      dflt='none' ;;
6541             esac ;;
6542     ' ')  dflt='none' ;;
6543     *)  dflt="$ccdlflags" ;;
6544     esac
6545     rp="Any special flags to pass to $cc to use dynamic linking?"
6546     . ./myread
6547     case "$ans" in
6548     none) ccdlflags=' ' ;;
6549     *) ccdlflags="$ans" ;;
6550     esac
6551     ;;
6552 *)  usedl="$undef"
6553         ld='ld'
6554     dlsrc='dl_none.xs'
6555     lddlflags=''
6556     ccdlflags=''
6557     ;;
6558 esac
6559
6560 also=''
6561 case "$usedl" in
6562 $undef)
6563         # No dynamic loading being used, so don't bother even to prompt.
6564         useshrplib='false'
6565         ;;
6566 *)      case "$useshrplib" in
6567         '')     case "$osname" in
6568                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6569                         dflt=y
6570                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6571                         ;;
6572                 next*)
6573                         case "$osvers" in
6574                         4*)     dflt=y
6575                                 also='Building a shared libperl is needed for MAB support.'
6576                                 ;;
6577                         *)      dflt=n
6578                                 ;;
6579                         esac
6580                         ;;
6581                 *)      dflt=n
6582                         ;;
6583                 esac
6584                 ;;
6585         $define|true|[Yy]*)
6586                 dflt=y
6587                 ;;
6588         *)      dflt=n
6589                 ;;
6590         esac
6591         $cat << EOM
6592
6593 The perl executable is normally obtained by linking perlmain.c with
6594 libperl${_a}, any static extensions (usually just DynaLoader), and
6595 any other libraries needed on this system (such as -lm, etc.).  Since
6596 your system supports dynamic loading, it is probably possible to build
6597 a shared libperl.$so.  If you will have more than one executable linked
6598 to libperl.$so, this will significantly reduce the size of each
6599 executable, but it may have a noticeable affect on performance.  The
6600 default is probably sensible for your system.
6601 $also
6602
6603 EOM
6604         rp="Build a shared libperl.$so (y/n)"
6605         . ./myread
6606         case "$ans" in
6607         true|$define|[Yy]*)
6608                 useshrplib='true'  ;;
6609         *)      useshrplib='false' ;;
6610         esac
6611         ;;
6612 esac
6613
6614 case "$useshrplib" in
6615 true)
6616         case "$libperl" in
6617         '')
6618                 # Figure out a good name for libperl.so.  Since it gets stored in
6619                 # a version-specific architecture-dependent library, the version
6620                 # number isn't really that important, except for making cc/ld happy.
6621                 #
6622                 # A name such as libperl.so.3.1
6623                 majmin="libperl.$so.$patchlevel.$subversion"
6624                 # A name such as libperl.so.301
6625                 majonly=`echo $patchlevel $subversion |
6626                         $awk '{printf "%d%02d", $1, $2}'`
6627                 majonly=libperl.$so.$majonly
6628                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6629                 # rely on figuring it out from the naming of libc.
6630                 case "${osname}${osvers}" in
6631                 next4*)
6632                         dflt=libperl.5.$so
6633                         # XXX How handle the --version stuff for MAB?
6634                         ;;
6635                 linux*)  # ld won't link with a bare -lperl otherwise.
6636                         dflt=libperl.$so
6637                         ;;
6638                 cygwin*) # include version
6639                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6640                         ;;
6641                 *)      # Try to guess based on whether libc has major.minor.
6642                         case "$libc" in
6643                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6644                         *libc.$so.[0-9]*) dflt=$majonly ;;
6645                         *)      dflt=libperl.$so ;;
6646                         esac
6647                         ;;
6648                 esac
6649                 ;;
6650         *)      dflt=$libperl
6651                 ;;
6652         esac
6653         cat << EOM
6654
6655 I need to select a good name for the shared libperl.  If your system uses
6656 library names with major and minor numbers, then you might want something
6657 like $majmin.  Alternatively, if your system uses a single version
6658 number for shared libraries, then you might want to use $majonly.
6659 Or, your system might be quite happy with a simple libperl.$so.
6660
6661 Since the shared libperl will get installed into a version-specific
6662 architecture-dependent directory, the version number of the shared perl
6663 library probably isn't important, so the default should be o.k.
6664
6665 EOM
6666         rp='What name do you want to give to the shared libperl?'
6667         . ./myread
6668         libperl=$ans
6669         echo "Ok, I'll use $libperl"
6670         ;;
6671 *)
6672         libperl="libperl${_a}"
6673         ;;
6674 esac
6675
6676 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6677 case "$shrpdir" in
6678 '') ;;
6679 *)      $cat >&4 <<EOM
6680 WARNING:  Use of the shrpdir variable for the installation location of
6681 the shared $libperl is not supported.  It was never documented and
6682 will not work in this version.  Let me (perlbug@perl.com)
6683 know of any problems this may cause.
6684
6685 EOM
6686         case "$shrpdir" in
6687         "$archlibexp/CORE")
6688                 $cat >&4 <<EOM
6689 But your current setting of $shrpdir is
6690 the default anyway, so it's harmless.
6691 EOM
6692                 ;;
6693         *)
6694                 $cat >&4 <<EOM
6695 Further, your current attempted setting of $shrpdir
6696 conflicts with the value of $archlibexp/CORE
6697 that installperl will use.
6698 EOM
6699                 ;;
6700         esac
6701         ;;
6702 esac
6703
6704 # How will the perl executable find the installed shared $libperl?
6705 # Add $xxx to ccdlflags.
6706 # If we can't figure out a command-line option, use $shrpenv to
6707 # set env LD_RUN_PATH.  The main perl makefile uses this.
6708 shrpdir=$archlibexp/CORE
6709 xxx=''
6710 tmp_shrpenv=''
6711 if "$useshrplib"; then
6712     case "$osname" in 
6713         aix)
6714                 # We'll set it in Makefile.SH...
6715                 ;;
6716         solaris|netbsd)
6717                 xxx="-R $shrpdir"
6718                 ;;
6719         freebsd)
6720                 xxx="-Wl,-R$shrpdir"
6721                 ;;
6722         linux|irix*|dec_osf)
6723                 xxx="-Wl,-rpath,$shrpdir"
6724                 ;;
6725         next)
6726                 # next doesn't like the default...
6727                 ;;
6728         beos)
6729                 # beos doesn't like the default, either.
6730                 ;;
6731         hpux*)
6732                 # hpux doesn't like the default, either.
6733                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6734                 ;;
6735         *)
6736                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6737                 ;;
6738         esac
6739         case "$xxx" in
6740         '') ;;
6741         *)      
6742                 # Only add $xxx if it isn't already in ccdlflags.
6743                 case " $ccdlflags " in
6744                 *" $xxx "*)     ;;
6745                 *)      ccdlflags="$ccdlflags $xxx"
6746                         cat <<EOM >&4
6747
6748 Adding $xxx to the flags
6749 passed to $ld so that the perl executable will find the 
6750 installed shared $libperl.
6751
6752 EOM
6753                         ;;
6754                 esac
6755                 ;;
6756         esac
6757 fi
6758 # Fix ccdlflags in AIX for building external extensions.
6759 # (For building Perl itself bare -bE:perl.exp is needed,
6760 #  Makefile.SH takes care of this.)
6761 case "$osname" in
6762 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6763 esac
6764 # Respect a hint or command-line value.
6765 case "$shrpenv" in
6766 '') shrpenv="$tmp_shrpenv" ;;
6767 esac
6768 case "$ldlibpthname" in
6769 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6770 none)   ldlibpthname='' ;;
6771 esac
6772
6773 : determine where manual pages go
6774 set man1dir man1dir none
6775 eval $prefixit
6776 $cat <<EOM
6777
6778 $spackage has manual pages available in source form.
6779 EOM
6780 case "$nroff" in
6781 nroff)
6782         echo "However, you don't have nroff, so they're probably useless to you."
6783         case "$man1dir" in
6784         '') man1dir="none";;
6785         esac;;
6786 esac
6787 echo "If you don't want the manual sources installed, answer 'none'."
6788 case "$man1dir" in
6789 ' ') dflt=none
6790         ;;
6791 '')
6792         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6793         lookpath="$lookpath $prefixexp/man/p_man/man1"
6794         lookpath="$lookpath $prefixexp/man/u_man/man1"
6795         lookpath="$lookpath $prefixexp/man/man.1"
6796         case "$sysman" in
6797         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6798         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6799         esac
6800         set dflt
6801         eval $prefixup
6802         ;;
6803 *)  dflt="$man1dir"
6804         ;;
6805 esac
6806 echo " "
6807 fn=dn+~
6808 rp="Where do the main $spackage manual pages (source) go?"
6809 . ./getfile
6810 if $test "X$man1direxp" != "X$ansexp"; then
6811         installman1dir=''
6812 fi
6813 man1dir="$ans"
6814 man1direxp="$ansexp"
6815 case "$man1dir" in
6816 '')     man1dir=' '
6817         installman1dir='';;
6818 esac
6819
6820 : Change installation prefix, if necessary.
6821 if $test X"$prefix" != X"$installprefix"; then
6822         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6823 else
6824         installman1dir="$man1direxp"
6825 fi
6826
6827 : What suffix to use on installed man pages
6828
6829 case "$man1dir" in
6830 ' ')
6831         man1ext='0'
6832         ;;
6833 *)
6834         rp="What suffix should be used for the main $spackage man pages?"
6835         case "$man1ext" in
6836         '')     case "$man1dir" in
6837                 *1)  dflt=1 ;;
6838                 *1p) dflt=1p ;;
6839                 *1pm) dflt=1pm ;;
6840                 *l) dflt=l;;
6841                 *n) dflt=n;;
6842                 *o) dflt=o;;
6843                 *p) dflt=p;;
6844                 *C) dflt=C;;
6845                 *L) dflt=L;;
6846                 *L1) dflt=L1;;
6847                 *) dflt=1;;
6848                 esac
6849                 ;;
6850         *)      dflt="$man1ext";;
6851         esac
6852         . ./myread
6853         man1ext="$ans"
6854         ;;
6855 esac
6856
6857 : see if we can have long filenames
6858 echo " "
6859 first=123456789abcdef
6860 $rm -f $first
6861 if (echo hi >$first) 2>/dev/null; then
6862         if $test -f 123456789abcde; then
6863                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6864                 val="$undef"
6865         else
6866                 echo 'You can have filenames longer than 14 characters.'>&4
6867                 val="$define"
6868         fi
6869 else
6870         $cat <<'EOM'
6871 You can't have filenames longer than 14 chars.
6872 You can't even think about them!
6873 EOM
6874         val="$undef"
6875 fi 
6876 set d_flexfnam
6877 eval $setvar
6878 $rm -rf 123456789abcde*
6879
6880 : determine where library module manual pages go
6881 set man3dir man3dir none
6882 eval $prefixit
6883 $cat <<EOM
6884
6885 $spackage has manual pages for many of the library modules.
6886 EOM
6887
6888 case "$nroff" in
6889 nroff)
6890         $cat <<'EOM'
6891 However, you don't have nroff, so they're probably useless to you.
6892 EOM
6893         case "$man3dir" in
6894         '') man3dir="none";;
6895         esac;;
6896 esac
6897
6898 case "$d_flexfnam" in
6899 undef)
6900         $cat <<'EOM'
6901 However, your system can't handle the long file names like File::Basename.3. 
6902 EOM
6903         case "$man3dir" in
6904         '') man3dir="none";;
6905         esac;;
6906 esac
6907
6908 echo "If you don't want the manual sources installed, answer 'none'."
6909 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6910 case "$man3dir" in
6911 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6912         if $test -d "$privlib/man/man3"; then
6913                 cat <<EOM >&4
6914
6915 WARNING:  Previous versions of perl installed man3 pages into
6916 $privlib/man/man3.  This version will suggest a 
6917 new default of $dflt.  
6918 EOM
6919                 tdflt=$dflt
6920                 dflt='n'
6921                 rp='Do you wish to preserve the old behavior?(y/n)'
6922                 . ./myread
6923                 case "$ans" in
6924                 y*) dflt="$privlib/man/man3" ;;
6925                 *)  dflt=$tdflt ;;
6926                 esac
6927     fi
6928         ;;
6929 *)      dflt="$man3dir" ;;
6930 esac
6931 case "$dflt" in
6932 ' ') dflt=none ;;
6933 esac
6934 echo " "
6935 fn=dn+~
6936 rp="Where do the $package library man pages (source) go?"
6937 . ./getfile
6938 man3dir="$ans"
6939 man3direxp="$ansexp"
6940 case "$man3dir" in
6941 '')     man3dir=' '
6942         installman3dir='';;
6943 esac
6944
6945 : Change installation prefix, if necessary.
6946 if $test X"$prefix" != X"$installprefix"; then
6947         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6948 else
6949         installman3dir="$man3direxp"
6950 fi
6951
6952 : What suffix to use on installed man pages
6953 case "$man3dir" in
6954 ' ')
6955         man3ext='0'
6956         ;;
6957 *)
6958         rp="What suffix should be used for the $package library man pages?"
6959         case "$man3ext" in
6960         '')     case "$man3dir" in
6961                 *3)  dflt=3 ;;
6962                 *3p) dflt=3p ;;
6963                 *3pm) dflt=3pm ;;
6964                 *l) dflt=l;;
6965                 *n) dflt=n;;
6966                 *o) dflt=o;;
6967                 *p) dflt=p;;
6968                 *C) dflt=C;;
6969                 *L) dflt=L;;
6970                 *L3) dflt=L3;;
6971                 *) dflt=3;;
6972                 esac
6973                 ;;
6974         *)      dflt="$man3ext";;
6975         esac
6976         . ./myread
6977         man3ext="$ans"
6978         ;;
6979 esac
6980
6981 : see if we have to deal with yellow pages, now NIS.
6982 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6983         if $test -f /usr/etc/nibindd; then
6984                 echo " "
6985                 echo "I'm fairly confident you're on a NeXT."
6986                 echo " "
6987                 rp='Do you get the hosts file via NetInfo?'
6988                 dflt=y
6989                 case "$hostcat" in
6990                 nidump*) ;;
6991                 '') ;;
6992                 *) dflt=n;;
6993                 esac
6994                 . ./myread
6995                 case "$ans" in
6996                 y*) hostcat='nidump hosts .';;
6997                 *)      case "$hostcat" in
6998                         nidump*) hostcat='';;
6999                         esac
7000                         ;;
7001                 esac
7002         fi
7003         case "$hostcat" in
7004         nidump*) ;;
7005         *)
7006                 case "$hostcat" in
7007                 *ypcat*) dflt=y;;
7008                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7009                                 dflt=y
7010                         else
7011                                 dflt=n
7012                         fi;;
7013                 *) dflt=n;;
7014                 esac
7015                 echo " "
7016                 rp='Are you getting the hosts file via yellow pages?'
7017                 . ./myread
7018                 case "$ans" in
7019                 y*) hostcat='ypcat hosts';;
7020                 *) hostcat='cat /etc/hosts';;
7021                 esac
7022                 ;;
7023         esac
7024 fi
7025 case "$hostcat" in
7026 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7027 esac
7028 case "$groupcat" in
7029 '') test -f /etc/group && groupcat='cat /etc/group';;
7030 esac
7031 case "$passcat" in
7032 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7033 esac
7034
7035 : now get the host name
7036 echo " "
7037 echo "Figuring out host name..." >&4
7038 case "$myhostname" in
7039 '') cont=true
7040         echo 'Maybe "hostname" will work...'
7041         if tans=`sh -c hostname 2>&1` ; then
7042                 myhostname=$tans
7043                 phostname=hostname
7044                 cont=''
7045         fi
7046         ;;
7047 *) cont='';;
7048 esac
7049 if $test "$cont"; then
7050         if ./xenix; then
7051                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7052                 if tans=`cat /etc/systemid 2>&1` ; then
7053                         myhostname=$tans
7054                         phostname='cat /etc/systemid'
7055                         echo "Whadyaknow.  Xenix always was a bit strange..."
7056                         cont=''
7057                 fi
7058         elif $test -r /etc/systemid; then
7059                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7060         fi
7061 fi
7062 if $test "$cont"; then
7063         echo 'No, maybe "uuname -l" will work...'
7064         if tans=`sh -c 'uuname -l' 2>&1` ; then
7065                 myhostname=$tans
7066                 phostname='uuname -l'
7067         else
7068                 echo 'Strange.  Maybe "uname -n" will work...'
7069                 if tans=`sh -c 'uname -n' 2>&1` ; then
7070                         myhostname=$tans
7071                         phostname='uname -n'
7072                 else
7073                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7074                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7075                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7076                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7077                         else
7078                                 case "$myhostname" in
7079                                 '') echo "Does this machine have an identity crisis or something?"
7080                                         phostname='';;
7081                                 *)
7082                                         echo "Well, you said $myhostname before..."
7083                                         phostname='echo $myhostname';;
7084                                 esac
7085                         fi
7086                 fi
7087         fi
7088 fi
7089 : you do not want to know about this
7090 set $myhostname
7091 myhostname=$1
7092
7093 : verify guess
7094 if $test "$myhostname" ; then
7095         dflt=y
7096         rp='Your host name appears to be "'$myhostname'".'" Right?"
7097         . ./myread
7098         case "$ans" in
7099         y*) ;;
7100         *) myhostname='';;
7101         esac
7102 fi
7103
7104 : bad guess or no guess
7105 while $test "X$myhostname" = X ; do
7106         dflt=''
7107         rp="Please type the (one word) name of your host:"
7108         . ./myread
7109         myhostname="$ans"
7110 done
7111
7112 : translate upper to lower if necessary
7113 case "$myhostname" in
7114 *[A-Z]*)
7115         echo "(Normalizing case in your host name)"
7116         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7117         ;;
7118 esac
7119
7120 case "$myhostname" in
7121 *.*)
7122         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7123         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7124         echo "(Trimming domain name from host name--host name is now $myhostname)"
7125         ;;
7126 *) case "$mydomain" in
7127         '')
7128                 {
7129                         test "X$hostcat" = "Xypcat hosts" &&
7130                         ypmatch "$myhostname" hosts 2>/dev/null |\
7131                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7132                         $test -s hosts
7133                 } || {
7134                         test "X$hostcat" != "X" &&
7135                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7136                                         /[       ]$myhostname[  . ]/p" > hosts
7137                 }
7138                 tmp_re="[       . ]"
7139                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7140                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7141                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7142                         hosts | $sort | $uniq | \
7143                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7144                 case `$echo X$dflt` in
7145                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7146                         dflt=.
7147                         ;;
7148                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7149                         ;;
7150                 esac
7151                 case "$dflt" in
7152                 .)
7153                         tans=`./loc resolv.conf X /etc /usr/etc`
7154                         if $test -f "$tans"; then
7155                                 echo "(Attempting domain name extraction from $tans)"
7156                                 dflt=.`$sed -n -e 's/   / /g' \
7157                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7158                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7159                                 case "$dflt" in
7160                                 .) dflt=.`$sed -n -e 's/        / /g' \
7161                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7162                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7163                                         ;;
7164                                 esac
7165                         fi
7166                         ;;
7167                 esac
7168                 case "$dflt" in
7169                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7170                         dflt=.`sh -c domainname 2>/dev/null`
7171                         case "$dflt" in
7172                         '') dflt='.';;
7173                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7174                         esac
7175                         ;;
7176                 esac
7177                 case "$dflt" in
7178                 .) echo "(Lost all hope -- silly guess then)"
7179                         dflt='.uucp'
7180                         ;;
7181                 esac
7182                 $rm -f hosts
7183                 ;;
7184         *) dflt="$mydomain";;
7185         esac;;
7186 esac
7187 echo " "
7188 rp="What is your domain name?"
7189 . ./myread
7190 tans="$ans"
7191 case "$ans" in
7192 '') ;;
7193 .*) ;;
7194 *) tans=".$tans";;
7195 esac
7196 mydomain="$tans"
7197
7198 : translate upper to lower if necessary
7199 case "$mydomain" in
7200 *[A-Z]*)
7201         echo "(Normalizing case in your domain name)"
7202         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7203         ;;
7204 esac
7205
7206 : a little sanity check here
7207 case "$phostname" in
7208 '') ;;
7209 *)
7210         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7211         $myhostname$mydomain|$myhostname) ;;
7212         *)
7213                 case "$phostname" in
7214                 sed*)
7215                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7216                         ;;
7217                 *)
7218                         echo "(That doesn't agree with your $phostname command, by the way.)"
7219                         ;;
7220                 esac
7221         ;;
7222         esac
7223         ;;
7224 esac
7225
7226 $cat <<EOM
7227
7228 I need to get your e-mail address in Internet format if possible, i.e.
7229 something like user@host.domain. Please answer accurately since I have
7230 no easy means to double check it. The default value provided below
7231 is most probably close to reality but may not be valid from outside
7232 your organization...
7233
7234 EOM
7235 cont=x
7236 while test "$cont"; do
7237         case "$cf_email" in
7238         '') dflt="$cf_by@$myhostname$mydomain";;
7239         *) dflt="$cf_email";;
7240         esac
7241         rp='What is your e-mail address?'
7242         . ./myread
7243         cf_email="$ans"
7244         case "$cf_email" in
7245         *@*.*) cont='' ;;
7246         *)
7247                 rp='Address does not look like an Internet one.  Use it anyway?'
7248                 case "$fastread" in
7249                 yes) dflt=y ;;
7250                 *) dflt=n ;;
7251                 esac
7252                 . ./myread
7253                 case "$ans" in
7254                 y*) cont='' ;;
7255                 *) echo " " ;;
7256                 esac
7257                 ;;
7258         esac
7259 done
7260
7261 $cat <<EOM
7262
7263 If you or somebody else will be maintaining perl at your site, please
7264 fill in the correct e-mail address here so that they may be contacted
7265 if necessary. Currently, the "perlbug" program included with perl
7266 will send mail to this address in addition to perlbug@perl.com. You may
7267 enter "none" for no administrator.
7268
7269 EOM
7270 case "$perladmin" in
7271 '') dflt="$cf_email";;
7272 *) dflt="$perladmin";;
7273 esac
7274 rp='Perl administrator e-mail address'
7275 . ./myread
7276 perladmin="$ans"
7277
7278 : figure out how to guarantee perl startup
7279 case "$startperl" in
7280 '')
7281         case "$sharpbang" in
7282         *!)
7283                 $cat <<EOH
7284
7285 I can use the #! construct to start perl on your system. This will
7286 make startup of perl scripts faster, but may cause problems if you
7287 want to share those scripts and perl is not in a standard place
7288 ($binexp/perl) on all your platforms. The alternative is to force
7289 a shell by starting the script with a single ':' character.
7290
7291 EOH
7292                 dflt="$binexp/perl"
7293                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7294                 . ./myread
7295                 case "$ans" in
7296                 none)   startperl=": # use perl";;
7297                 *)      startperl="#!$ans"
7298                         if $test 30 -lt `echo "$ans" | wc -c`; then
7299                                 $cat >&4 <<EOM
7300
7301 WARNING:  Some systems limit the #! command to 32 characters.
7302 If you experience difficulty running Perl scripts with #!, try
7303 installing Perl in a directory with a shorter pathname.
7304
7305 EOM
7306                         fi ;;
7307                 esac
7308                 ;;
7309         *) startperl=": # use perl"
7310                 ;;
7311         esac
7312         ;;
7313 esac
7314 echo "I'll use $startperl to start perl scripts."
7315
7316 : figure best path for perl in scripts
7317 case "$perlpath" in
7318 '')
7319         perlpath="$binexp/perl"
7320         case "$startperl" in
7321         *!*) ;;
7322         *)
7323                 $cat <<EOH
7324
7325 I will use the "eval 'exec'" idiom to start Perl on your system.
7326 I can use the full path of your Perl binary for this purpose, but
7327 doing so may cause problems if you want to share those scripts and
7328 Perl is not always in a standard place ($binexp/perl).
7329
7330 EOH
7331                 dflt="$binexp/perl"
7332                 rp="What path shall I use in \"eval 'exec'\"?"
7333                 . ./myread
7334                 perlpath="$ans"
7335                 ;;
7336         esac
7337         ;;
7338 esac
7339 case "$startperl" in
7340 *!*)    ;;
7341 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7342 esac
7343
7344 : determine where public executable scripts go
7345 set scriptdir scriptdir
7346 eval $prefixit
7347 case "$scriptdir" in
7348 '')
7349         dflt="$bin"
7350         : guess some guesses
7351         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7352         $test -d /usr/share/bin     && dflt=/usr/share/bin
7353         $test -d /usr/local/script  && dflt=/usr/local/script
7354         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7355         $test -d $prefixexp/script  && dflt=$prefixexp/script
7356         set dflt
7357         eval $prefixup
7358         ;;
7359 *)  dflt="$scriptdir"
7360         ;;
7361 esac
7362 $cat <<EOM
7363  
7364 Some installations have a separate directory just for executable scripts so
7365 that they can mount it across multiple architectures but keep the scripts in
7366 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7367 Or you might just lump your scripts in with all your other executables.
7368  
7369 EOM
7370 fn=d~
7371 rp='Where do you keep publicly executable scripts?'
7372 . ./getfile
7373 if $test "X$ansexp" != "X$scriptdirexp"; then
7374         installscript=''
7375 fi
7376 scriptdir="$ans"
7377 scriptdirexp="$ansexp"
7378 : Change installation prefix, if necessary.
7379 if $test X"$prefix" != X"$installprefix"; then
7380         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7381 else
7382         installscript="$scriptdirexp"
7383 fi
7384
7385 : determine where add-on public executables go
7386 case "$sitebin" in
7387 '')     dflt=$siteprefix/bin ;;
7388 *)      dflt=$sitebin ;;
7389 esac
7390 fn=d~
7391 rp='Pathname where the add-on public executables should be installed?'
7392 . ./getfile
7393 sitebin="$ans"
7394 sitebinexp="$ansexp"
7395 : Change installation prefix, if necessary.
7396 if $test X"$prefix" != X"$installprefix"; then
7397         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7398 else
7399         installsitebin="$sitebinexp"
7400 fi
7401
7402 : see if sqrtl exists
7403 set sqrtl d_sqrtl
7404 eval $inlibc
7405
7406 case "$ccflags" in
7407 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7408 esac
7409
7410 case "$uselongdouble" in
7411 $define|true|[yY]*)     dflt='y';;
7412 *) dflt='n';;
7413 esac
7414 cat <<EOM
7415
7416 Perl can be built to take advantage of long doubles which
7417 (if available) may give more accuracy and range for floating point numbers.
7418
7419 If this doesn't make any sense to you, just accept the default '$dflt'.
7420 EOM
7421 rp='Try to use long doubles if available?'
7422 . ./myread
7423 case "$ans" in
7424 y|Y)    val="$define"   ;;
7425 *)      val="$undef"    ;;
7426 esac
7427 set uselongdouble
7428 eval $setvar
7429
7430 case "$uselongdouble" in
7431 true|[yY]*) uselongdouble="$define" ;;
7432 esac
7433
7434 case "$uselongdouble" in
7435 $define)
7436 : Look for a hint-file generated 'call-back-unit'.  If the
7437 : user has specified that long doubles should be used,
7438 : we may need to set or change some other defaults.
7439         if $test -f uselongdouble.cbu; then
7440                 echo "Your platform has some specific hints for long doubles, using them..."
7441                 . ./uselongdouble.cbu
7442         else
7443                 $cat <<EOM
7444 (Your platform doesn't have any specific hints for long doubles.)
7445 EOM
7446         fi
7447         ;;
7448 esac
7449
7450 case "$uselongdouble:$d_sqrtl" in
7451 $define:$undef)
7452                 $cat <<EOM >&4
7453
7454 *** You requested the use of long doubles but you do not seem to have
7455 *** the mathematic functions for long doubles.  I'm disabling the use
7456 *** of long doubles.
7457
7458 EOM
7459         uselongdouble=$undef
7460         ;;
7461 esac
7462
7463 case "$useperlio" in
7464 $define|true|[yY]*)     dflt='y';;
7465 *) dflt='n';;
7466 esac
7467 cat <<EOM
7468
7469 Previous version of $package used the standard IO mechanisms as defined
7470 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7471 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7472 the default.  This abstraction layer can use AT&T's sfio (if you already
7473 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7474 problems with some extension modules.  Using PerlIO with stdio is safe,
7475 but it is slower than plain stdio and therefore is not the default.
7476
7477 If this doesn't make any sense to you, just accept the default '$dflt'.
7478 EOM
7479 rp='Use the experimental PerlIO abstraction layer?'
7480 . ./myread
7481 case "$ans" in
7482 y|Y) 
7483         val="$define"
7484         ;;     
7485 *)      
7486         echo "Ok, doing things the stdio way"
7487         val="$undef"
7488         ;;
7489 esac
7490 set useperlio
7491 eval $setvar 
7492
7493 case "$vendorprefix" in
7494 '')     d_vendorbin="$undef"
7495         vendorbin=''
7496         vendorbinexp=''
7497         ;;
7498 *)      d_vendorbin="$define"
7499         : determine where vendor-supplied executables go.
7500         case "$vendorbin" in
7501         '') dflt=$vendorprefix/bin ;;
7502         *)      dflt="$vendorbin" ;;
7503         esac
7504         fn=d~+
7505         rp='Pathname for the vendor-supplied executables directory?'
7506         . ./getfile
7507         vendorbin="$ans"
7508         vendorbinexp="$ansexp"
7509         ;;
7510 esac
7511 : Change installation prefix, if necessary.
7512 if $test X"$prefix" != X"$installprefix"; then
7513         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7514 else
7515         installvendorbin="$vendorbinexp"
7516 fi
7517
7518 : see if qgcvt exists
7519 set qgcvt d_qgcvt
7520 eval $inlibc
7521
7522 : check for length of double
7523 echo " "
7524 case "$doublesize" in
7525 '')
7526         echo "Checking to see how big your double precision numbers are..." >&4
7527         $cat >try.c <<'EOCP'
7528 #include <stdio.h>
7529 int main()
7530 {
7531     printf("%d\n", (int)sizeof(double));
7532     exit(0);
7533 }
7534 EOCP
7535         set try
7536         if eval $compile_ok; then
7537                 doublesize=`./try`
7538                 echo "Your double is $doublesize bytes long."
7539         else
7540                 dflt='8'
7541                 echo "(I can't seem to compile the test program.  Guessing...)"
7542                 rp="What is the size of a double precision number (in bytes)?"
7543                 . ./myread
7544                 doublesize="$ans"
7545         fi
7546         ;;
7547 esac
7548 $rm -f try.c try
7549
7550 : check for long doubles
7551 echo " "
7552 echo "Checking to see if you have long double..." >&4
7553 echo 'int main() { long double x = 7.0; }' > try.c
7554 set try
7555 if eval $compile; then
7556         val="$define"
7557         echo "You have long double."
7558 else
7559         val="$undef"
7560         echo "You do not have long double."
7561 fi
7562 $rm try.*
7563 set d_longdbl
7564 eval $setvar
7565
7566 : check for length of long double
7567 case "${d_longdbl}${longdblsize}" in
7568 $define)
7569         echo " "
7570         echo "Checking to see how big your long doubles are..." >&4
7571         $cat >try.c <<'EOCP'
7572 #include <stdio.h>
7573 int main()
7574 {
7575         printf("%d\n", sizeof(long double));
7576 }
7577 EOCP
7578         set try
7579         set try
7580         if eval $compile; then
7581                 longdblsize=`./try$exe_ext`
7582                 echo "Your long doubles are $longdblsize bytes long."
7583         else
7584                 dflt='8'
7585                 echo " "
7586                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7587                 rp="What is the size of a long double (in bytes)?"
7588                 . ./myread
7589                 longdblsize="$ans"
7590         fi
7591         if $test "X$doublesize" = "X$longdblsize"; then
7592                 echo "(That isn't any different from an ordinary double.)"
7593         fi      
7594         ;;
7595 esac
7596 $rm -f try.* try
7597
7598 echo " "
7599
7600 if $test X"$d_longdbl" = X"$define"; then
7601
7602 echo "Checking how to print long doubles..." >&4
7603
7604 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7605         $cat >try.c <<'EOCP'
7606 #include <sys/types.h>
7607 #include <stdio.h>
7608 int main() {
7609   double d = 123.456;
7610   printf("%.3f\n", d);
7611 }
7612 EOCP
7613         set try
7614         if eval $compile; then
7615                 yyy=`./try$exe_ext`
7616                 case "$yyy" in
7617                 123.456)
7618                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7619                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7620                         echo "We will use %f."
7621                         ;;
7622                 esac
7623         fi
7624 fi
7625
7626 if $test X"$sPRIfldbl" = X; then
7627         $cat >try.c <<'EOCP'
7628 #include <sys/types.h>
7629 #include <stdio.h>
7630 int main() {
7631   long double d = 123.456;
7632   printf("%.3llf\n", d);
7633 }
7634 EOCP
7635         set try
7636         if eval $compile; then
7637                 yyy=`./try$exe_ext`
7638                 case "$yyy" in
7639                 123.456)
7640                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7641                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7642                         echo "We will use %llf."
7643                         ;;
7644                 esac
7645         fi
7646 fi
7647
7648 if $test X"$sPRIfldbl" = X; then
7649         $cat >try.c <<'EOCP'
7650 #include <sys/types.h>
7651 #include <stdio.h>
7652 int main() {
7653   long double d = 123.456;
7654   printf("%.3Lf\n", d);
7655 }
7656 EOCP
7657         set try
7658         if eval $compile; then
7659                 yyy=`./try$exe_ext`
7660                 case "$yyy" in
7661                 123.456)
7662                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7663                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7664                         echo "We will use %Lf."
7665                         ;;
7666                 esac
7667         fi
7668 fi
7669
7670 if $test X"$sPRIfldbl" = X; then
7671         $cat >try.c <<'EOCP'
7672 #include <sys/types.h>
7673 #include <stdio.h>
7674 int main() {
7675   long double d = 123.456;
7676   printf("%.3lf\n", d);
7677 }
7678 EOCP
7679         set try
7680         if eval $compile; then
7681                 yyy=`./try$exe_ext`
7682                 case "$yyy" in
7683                 123.456)
7684                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7685                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7686                         echo "We will use %lf."
7687                         ;;
7688                 esac
7689         fi
7690 fi
7691
7692 if $test X"$sPRIfldbl" = X; then
7693         echo "Cannot figure out how to print long doubles." >&4
7694 fi
7695
7696 $rm -f try try.*
7697
7698 fi # d_longdbl
7699
7700 case "$sPRIfldbl" in
7701 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7702         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7703         ;;
7704 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7705         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7706         ;;
7707 esac
7708
7709 : Check how to convert floats to strings.
7710 echo " "
7711 echo "Checking for an efficient way to convert floats to strings."
7712 echo " " > try.c
7713 case "$uselongdouble" in
7714 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7715 esac
7716 case "$d_longdbl" in
7717 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7718 esac
7719 case "$d_PRIgldbl" in
7720 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7721 esac
7722 $cat >>try.c <<EOP
7723 #ifdef TRY_gconvert
7724 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7725 char *myname = "gconvert";
7726 #endif
7727 #ifdef TRY_gcvt
7728 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7729 char *myname = "gcvt";
7730 #endif
7731 #ifdef TRY_qgcvt
7732 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7733 char *myname = "qgcvt";
7734 #define DOUBLETYPE long double
7735 #endif
7736 #ifdef TRY_sprintf
7737 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7738 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7739 #else
7740 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7741 #endif
7742 char *myname = "sprintf";
7743 #endif
7744
7745 #ifndef DOUBLETYPE
7746 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7747 #define DOUBLETYPE long double
7748 #else
7749 #define DOUBLETYPE double
7750 #endif
7751 #endif
7752
7753 #include <stdio.h>
7754
7755 #define I_STDLIB $i_stdlib
7756 #ifdef I_STDLIB
7757 #include <stdlib.h>
7758 #endif
7759
7760 int
7761 checkit(expect, got)
7762 char *expect;
7763 char *got;
7764 {
7765     if (strcmp(expect, got)) {
7766                 printf("%s oddity:  Expected %s, got %s\n",
7767                         myname, expect, got);
7768                 exit(1);
7769         }
7770 }
7771
7772 int main()
7773
7774         char buf[64]; 
7775         buf[63] = '\0';
7776
7777         /* This must be 1st test on (which?) platform */
7778         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7779         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7780         checkit("0.1", buf);
7781
7782         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7783         checkit("1", buf);
7784
7785         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7786         checkit("1.1", buf);
7787
7788         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7789         checkit("1.01", buf);
7790
7791         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7792         checkit("1.001", buf);
7793
7794         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7795         checkit("1.0001", buf);
7796
7797         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7798         checkit("1.00001", buf);
7799
7800         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7801         checkit("1.000001", buf);
7802
7803         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7804         checkit("0", buf);
7805
7806         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7807         checkit("-1", buf);
7808
7809         /* Some Linux gcvt's give 1.e+5 here. */
7810         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7811         checkit("100000", buf);
7812         
7813         /* Some Linux gcvt's give -1.e+5 here. */
7814         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7815         checkit("-100000", buf);
7816
7817         exit(0);
7818 }
7819 EOP
7820 case "$d_Gconvert" in
7821 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7822 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7823 *) xxx_list='sprintf gconvert gcvt' ;;
7824 esac
7825
7826 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7827 "$define$define$define")
7828     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7829     xxx_list="sprintf $xxx_list"
7830     case "$d_qgcvt" in
7831     "$define") xxx_list="qgcvt $xxx_list" ;;
7832     esac
7833     ;;
7834 esac
7835
7836 for xxx_convert in $xxx_list; do
7837         echo "Trying $xxx_convert..."
7838         $rm -f try try$_o
7839         set try -DTRY_$xxx_convert
7840         if eval $compile; then
7841                 echo "$xxx_convert() found." >&4
7842                 if ./try; then
7843                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7844                         break;
7845                 else
7846                         echo "...But $xxx_convert didn't work as I expected."
7847                 fi
7848         else
7849                 echo "$xxx_convert NOT found." >&4
7850         fi
7851 done
7852         
7853 case "$xxx_convert" in
7854 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7855 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7856 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7857 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7858    "$define$define$define")
7859       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7860    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7861    esac
7862    ;;  
7863 esac
7864
7865 : Initialize h_fcntl
7866 h_fcntl=false
7867
7868 : Initialize h_sysfile
7869 h_sysfile=false
7870
7871 : access call always available on UNIX
7872 set access d_access
7873 eval $inlibc
7874
7875 : locate the flags for 'access()'
7876 case "$d_access" in
7877 "$define")
7878         echo " "
7879         $cat >access.c <<'EOCP'
7880 #include <sys/types.h>
7881 #ifdef I_FCNTL
7882 #include <fcntl.h>
7883 #endif
7884 #ifdef I_SYS_FILE
7885 #include <sys/file.h>
7886 #endif
7887 #ifdef I_UNISTD
7888 #include <unistd.h>
7889 #endif
7890 int main() {
7891         exit(R_OK);
7892 }
7893 EOCP
7894         : check sys/file.h first, no particular reason here
7895         if $test `./findhdr sys/file.h` && \
7896                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7897                 h_sysfile=true;
7898                 echo "<sys/file.h> defines the *_OK access constants." >&4
7899         elif $test `./findhdr fcntl.h` && \
7900                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7901                 h_fcntl=true;
7902                 echo "<fcntl.h> defines the *_OK access constants." >&4
7903         elif $test `./findhdr unistd.h` && \
7904                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7905                 echo "<unistd.h> defines the *_OK access constants." >&4
7906         else
7907                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7908         fi
7909         ;;
7910 esac
7911 $rm -f access*
7912
7913 : see if accessx exists
7914 set accessx d_accessx
7915 eval $inlibc
7916
7917 : see if alarm exists
7918 set alarm d_alarm
7919 eval $inlibc
7920
7921 : see if atolf exists
7922 set atolf d_atolf
7923 eval $inlibc
7924
7925 : see if atoll exists
7926 set atoll d_atoll
7927 eval $inlibc
7928
7929 : Look for GNU-cc style attribute checking
7930 echo " "
7931 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7932 $cat >attrib.c <<'EOCP'
7933 #include <stdio.h>
7934 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7935 EOCP
7936 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7937         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7938                 echo "Your C compiler doesn't fully support __attribute__."
7939                 val="$undef"
7940         else
7941                 echo "Your C compiler supports __attribute__."
7942                 val="$define"
7943         fi
7944 else
7945         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7946         val="$undef"
7947 fi
7948 set d_attribut
7949 eval $setvar
7950 $rm -f attrib*
7951
7952 : see if bcmp exists
7953 set bcmp d_bcmp
7954 eval $inlibc
7955
7956 : see if bcopy exists
7957 set bcopy d_bcopy
7958 eval $inlibc
7959
7960 : see if this is a unistd.h system
7961 set unistd.h i_unistd
7962 eval $inhdr
7963
7964 : see if getpgrp exists
7965 set getpgrp d_getpgrp
7966 eval $inlibc
7967
7968 case "$d_getpgrp" in
7969 "$define")
7970         echo " "
7971         echo "Checking to see which flavor of getpgrp is in use..."
7972         $cat >set.c <<EOP
7973 #$i_unistd I_UNISTD
7974 #include <sys/types.h>
7975 #ifdef I_UNISTD
7976 #  include <unistd.h>
7977 #endif
7978 int main()
7979 {
7980         if (getuid() == 0) {
7981                 printf("(I see you are running Configure as super-user...)\n");
7982                 setuid(1);
7983         }
7984 #ifdef TRY_BSD_PGRP
7985         if (getpgrp(1) == 0)
7986                 exit(0);
7987 #else
7988         if (getpgrp() > 0)
7989                 exit(0);
7990 #endif
7991         exit(1);
7992 }
7993 EOP
7994         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7995                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7996                 val="$define"
7997         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7998                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7999                 val="$undef"
8000         else
8001                 echo "I can't seem to compile and run the test program."
8002                 if ./usg; then
8003                         xxx="a USG one, i.e. you use getpgrp()."
8004                 else
8005                         # SVR4 systems can appear rather BSD-ish.
8006                         case "$i_unistd" in
8007                         $undef)
8008                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8009                                 val="$define"
8010                                 ;;
8011                         $define)
8012                                 xxx="probably a USG one, i.e. you use getpgrp()."
8013                                 val="$undef"
8014                                 ;;
8015                         esac
8016                 fi
8017                 echo "Assuming your getpgrp is $xxx" >&4
8018         fi
8019         ;;
8020 *) val="$undef";;
8021 esac
8022 set d_bsdgetpgrp
8023 eval $setvar
8024 $rm -f set set.c
8025
8026 : see if setpgrp exists
8027 set setpgrp d_setpgrp
8028 eval $inlibc
8029
8030 case "$d_setpgrp" in
8031 "$define")
8032         echo " "
8033         echo "Checking to see which flavor of setpgrp is in use..."
8034         $cat >set.c <<EOP
8035 #$i_unistd I_UNISTD
8036 #include <sys/types.h>
8037 #ifdef I_UNISTD
8038 #  include <unistd.h>
8039 #endif
8040 int main()
8041 {
8042         if (getuid() == 0) {
8043                 printf("(I see you are running Configure as super-user...)\n");
8044                 setuid(1);
8045         }
8046 #ifdef TRY_BSD_PGRP
8047         if (-1 == setpgrp(1, 1))
8048                 exit(0);
8049 #else
8050         if (setpgrp() != -1)
8051                 exit(0);
8052 #endif
8053         exit(1);
8054 }
8055 EOP
8056         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8057                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8058                 val="$define"
8059         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8060                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8061                 val="$undef"
8062         else
8063                 echo "(I can't seem to compile and run the test program.)"
8064                 if ./usg; then
8065                         xxx="a USG one, i.e. you use setpgrp()."
8066                 else
8067                         # SVR4 systems can appear rather BSD-ish.
8068                         case "$i_unistd" in
8069                         $undef)
8070                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8071                                 val="$define"
8072                                 ;;
8073                         $define)
8074                                 xxx="probably a USG one, i.e. you use setpgrp()."
8075                                 val="$undef"
8076                                 ;;
8077                         esac
8078                 fi
8079                 echo "Assuming your setpgrp is $xxx" >&4
8080         fi
8081         ;;
8082 *) val="$undef";;
8083 esac
8084 set d_bsdsetpgrp
8085 eval $setvar
8086 $rm -f set set.c
8087 : see if bzero exists
8088 set bzero d_bzero
8089 eval $inlibc
8090
8091 : see if signal is declared as pointer to function returning int or void
8092 echo " "
8093 xxx=`./findhdr signal.h`
8094 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8095 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8096         echo "You have int (*signal())() instead of void." >&4
8097         val="$undef"
8098 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8099         echo "You have void (*signal())()." >&4
8100         val="$define"
8101 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8102         echo "You have int (*signal())() instead of void." >&4
8103         val="$undef"
8104 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8105         echo "You have void (*signal())()." >&4
8106         val="$define"
8107 else
8108         case "$d_voidsig" in
8109         '')
8110         echo "I can't determine whether signal handler returns void or int..." >&4
8111                 dflt=void
8112                 rp="What type does your signal handler return?"
8113                 . ./myread
8114                 case "$ans" in
8115                 v*) val="$define";;
8116                 *) val="$undef";;
8117                 esac;;
8118         "$define")
8119                 echo "As you already told me, signal handler returns void." >&4
8120                 val="$define"
8121                 ;;
8122         *)      echo "As you already told me, signal handler returns int." >&4
8123                 val="$undef"
8124                 ;;
8125         esac
8126 fi
8127 set d_voidsig
8128 eval $setvar
8129 case "$d_voidsig" in
8130 "$define") signal_t="void";;
8131 *) signal_t="int";;
8132 esac
8133 $rm -f $$.tmp
8134
8135 : check for ability to cast large floats to 32-bit ints.
8136 echo " "
8137 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8138 if $test "$intsize" -ge 4; then
8139         xxx=int
8140 else
8141         xxx=long
8142 fi
8143 $cat >try.c <<EOCP
8144 #include <stdio.h>
8145 #include <sys/types.h>
8146 #include <signal.h>
8147 $signal_t blech(s) int s; { exit(3); }
8148 int main()
8149 {
8150         $xxx i32;
8151         double f, g;
8152         int result = 0;
8153         char str[16];
8154         signal(SIGFPE, blech);
8155
8156         /* Don't let compiler optimize the test away.  Store the number 
8157            in a writable string for gcc to pass to sscanf under HP/UX.
8158         */
8159         sprintf(str, "2147483647");
8160         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8161         g = 10 * f;
8162         i32  = ($xxx) g;
8163
8164         /* x86 processors will probably give 0x8000 0000, which is a
8165        sign change.  We don't want that.  We want to mimic SPARC
8166            behavior here, which is to preserve the sign and give
8167            back 0x7fff ffff.
8168         */
8169         if (i32 != ($xxx) f)
8170                 result |= 1;
8171         exit(result);
8172 }
8173 EOCP
8174 set try
8175 if eval $compile_ok; then
8176         ./try
8177         yyy=$?
8178 else
8179         echo "(I can't seem to compile the test program--assuming it can't)"
8180         yyy=1
8181 fi
8182 case "$yyy" in
8183 0)      val="$define"
8184         echo "Yup, it can."
8185         ;;
8186 *)      val="$undef"
8187         echo "Nope, it can't."
8188         ;;
8189 esac
8190 set d_casti32
8191 eval $setvar
8192 $rm -f try try.*
8193
8194 : check for ability to cast negative floats to unsigned
8195 echo " "
8196 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8197 $cat >try.c <<EOCP
8198 #include <stdio.h>
8199 #include <sys/types.h>
8200 #include <signal.h>
8201 $signal_t blech(s) int s; { exit(7); }
8202 $signal_t blech_in_list(s) int s; { exit(4); }
8203 unsigned long dummy_long(p) unsigned long p; { return p; }
8204 unsigned int dummy_int(p) unsigned int p; { return p; }
8205 unsigned short dummy_short(p) unsigned short p; { return p; }
8206 int main()
8207 {
8208         double f;
8209         unsigned long along;
8210         unsigned int aint;
8211         unsigned short ashort;
8212         int result = 0;
8213         char str[16];
8214         
8215         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8216            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8217            optimized the whole file away
8218         */
8219         /* Store the number in a writable string for gcc to pass to 
8220            sscanf under HP/UX.
8221         */
8222         sprintf(str, "-123");
8223         sscanf(str, "%lf", &f);  /* f = -123.; */
8224
8225         signal(SIGFPE, blech);
8226         along = (unsigned long)f;
8227         aint = (unsigned int)f;
8228         ashort = (unsigned short)f;
8229         if (along != (unsigned long)-123)
8230                 result |= 1;
8231         if (aint != (unsigned int)-123)
8232                 result |= 1;
8233         if (ashort != (unsigned short)-123)
8234                 result |= 1;
8235         sprintf(str, "1073741824.");
8236         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8237         f = f + f;
8238         along = 0;
8239         along = (unsigned long)f;
8240         if (along != 0x80000000)
8241                 result |= 2;
8242         f -= 1.;
8243         along = 0;
8244         along = (unsigned long)f;
8245         if (along != 0x7fffffff)
8246                 result |= 1;
8247         f += 2.;
8248         along = 0;
8249         along = (unsigned long)f;
8250         if (along != 0x80000001)
8251                 result |= 2;
8252         if (result)
8253                 exit(result);
8254         signal(SIGFPE, blech_in_list);
8255         sprintf(str, "123.");
8256         sscanf(str, "%lf", &f);  /* f = 123.; */
8257         along = dummy_long((unsigned long)f);
8258         aint = dummy_int((unsigned int)f);
8259         ashort = dummy_short((unsigned short)f);
8260         if (along != (unsigned long)123)
8261                 result |= 4;
8262         if (aint != (unsigned int)123)
8263                 result |= 4;
8264         if (ashort != (unsigned short)123)
8265                 result |= 4;
8266         exit(result);
8267
8268 }
8269 EOCP
8270 set try
8271 if eval $compile_ok; then
8272         ./try
8273         castflags=$?
8274 else
8275         echo "(I can't seem to compile the test program--assuming it can't)"
8276         castflags=7
8277 fi
8278 case "$castflags" in
8279 0)      val="$define"
8280         echo "Yup, it can."
8281         ;;
8282 *)      val="$undef"
8283         echo "Nope, it can't."
8284         ;;
8285 esac
8286 set d_castneg
8287 eval $setvar
8288 $rm -f try.*
8289
8290 : see if vprintf exists
8291 echo " "
8292 if set vprintf val -f d_vprintf; eval $csym; $val; then
8293         echo 'vprintf() found.' >&4
8294         val="$define"
8295         $cat >vprintf.c <<'EOF'
8296 #include <varargs.h>
8297
8298 int main() { xxx("foo"); }
8299
8300 xxx(va_alist)
8301 va_dcl
8302 {
8303         va_list args;
8304         char buf[10];
8305
8306         va_start(args);
8307         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8308 }
8309 EOF
8310         set vprintf
8311         if eval $compile && ./vprintf; then
8312                 echo "Your vsprintf() returns (int)." >&4
8313                 val2="$undef"
8314         else
8315                 echo "Your vsprintf() returns (char*)." >&4
8316                 val2="$define"
8317         fi
8318 else
8319         echo 'vprintf() NOT found.' >&4
8320                 val="$undef"
8321                 val2="$undef"
8322 fi
8323 set d_vprintf
8324 eval $setvar
8325 val=$val2
8326 set d_charvspr
8327 eval $setvar
8328
8329 : see if chown exists
8330 set chown d_chown
8331 eval $inlibc
8332
8333 : see if chroot exists
8334 set chroot d_chroot
8335 eval $inlibc
8336
8337 : see if chsize exists
8338 set chsize d_chsize
8339 eval $inlibc
8340
8341 : check for const keyword
8342 echo " "
8343 echo 'Checking to see if your C compiler knows about "const"...' >&4
8344 $cat >const.c <<'EOCP'
8345 typedef struct spug { int drokk; } spug;
8346 int main()
8347 {
8348         const char *foo;
8349         const spug y;
8350 }
8351 EOCP
8352 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8353         val="$define"
8354         echo "Yup, it does."
8355 else
8356         val="$undef"
8357         echo "Nope, it doesn't."
8358 fi
8359 set d_const
8360 eval $setvar
8361
8362 : see if crypt exists
8363 echo " "
8364 if set crypt val -f d_crypt; eval $csym; $val; then
8365         echo 'crypt() found.' >&4
8366         val="$define"
8367         cryptlib=''
8368 else
8369         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8370         if $test -z "$cryptlib"; then
8371                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8372         else
8373                 cryptlib=-lcrypt
8374         fi
8375         if $test -z "$cryptlib"; then
8376                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8377         else
8378                 cryptlib=-lcrypt
8379         fi
8380         if $test -z "$cryptlib"; then
8381                 cryptlib=`./loc libcrypt$_a "" $libpth`
8382         else
8383                 cryptlib=-lcrypt
8384         fi
8385         if $test -z "$cryptlib"; then
8386                 echo 'crypt() NOT found.' >&4
8387                 val="$undef"
8388         else
8389                 val="$define"
8390         fi
8391 fi
8392 set d_crypt
8393 eval $setvar
8394
8395 : get csh whereabouts
8396 case "$csh" in
8397 'csh') val="$undef" ;;
8398 *) val="$define" ;;
8399 esac
8400 set d_csh
8401 eval $setvar
8402 : Respect a hint or command line value for full_csh.
8403 case "$full_csh" in
8404 '') full_csh=$csh ;;
8405 esac
8406
8407 : see if cuserid exists
8408 set cuserid d_cuserid
8409 eval $inlibc
8410
8411 : see if this is a limits.h system
8412 set limits.h i_limits
8413 eval $inhdr
8414
8415 : see if this is a float.h system
8416 set float.h i_float
8417 eval $inhdr
8418
8419 : See if number of significant digits in a double precision number is known
8420 echo " "
8421 $cat >dbl_dig.c <<EOM
8422 #$i_limits I_LIMITS
8423 #$i_float I_FLOAT
8424 #ifdef I_LIMITS
8425 #include <limits.h>
8426 #endif
8427 #ifdef I_FLOAT
8428 #include <float.h>
8429 #endif
8430 #ifdef DBL_DIG
8431 printf("Contains DBL_DIG");
8432 #endif
8433 EOM
8434 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8435 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8436         echo "DBL_DIG found." >&4
8437         val="$define"
8438 else
8439         echo "DBL_DIG NOT found." >&4
8440         val="$undef"
8441 fi
8442 $rm -f dbl_dig.?
8443 set d_dbl_dig
8444 eval $setvar
8445
8446 : see if difftime exists
8447 set difftime d_difftime
8448 eval $inlibc
8449
8450 : see if this is a dirent system
8451 echo " "
8452 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8453         val="$define"
8454         echo "<dirent.h> found." >&4
8455 else
8456         val="$undef"
8457         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8458                 echo "<sys/dir.h> found." >&4
8459                 echo " "
8460         else
8461                 xinc=`./findhdr sys/ndir.h`
8462         fi
8463         echo "<dirent.h> NOT found." >&4
8464 fi
8465 set i_dirent
8466 eval $setvar
8467
8468 : Look for type of directory structure.
8469 echo " "
8470 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8471
8472 case "$direntrytype" in
8473 ''|' ')
8474         case "$i_dirent" in
8475         $define) guess1='struct dirent' ;;
8476         *) guess1='struct direct'  ;;
8477         esac
8478         ;;
8479 *)      guess1="$direntrytype"
8480         ;;
8481 esac
8482
8483 case "$guess1" in
8484 'struct dirent') guess2='struct direct' ;;
8485 *) guess2='struct dirent' ;;
8486 esac
8487                 
8488 if $contains "$guess1" try.c >/dev/null 2>&1; then
8489         direntrytype="$guess1"
8490         echo "Your directory entries are $direntrytype." >&4
8491 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8492         direntrytype="$guess2"
8493         echo "Your directory entries seem to be $direntrytype." >&4
8494 else
8495         echo "I don't recognize your system's directory entries." >&4
8496         rp="What type is used for directory entries on this system?"
8497         dflt="$guess1"
8498         . ./myread
8499         direntrytype="$ans"
8500 fi
8501 $rm -f try.c
8502
8503
8504 : see if the directory entry stores field length
8505 echo " "
8506 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8507 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8508         echo "Good, your directory entry keeps length information in d_namlen." >&4
8509         val="$define"
8510 else
8511         echo "Your directory entry does not know about the d_namlen field." >&4
8512         val="$undef"
8513 fi
8514 set d_dirnamlen
8515 eval $setvar
8516 $rm -f try.c
8517
8518 : see if dlerror exists
8519 xxx_runnm="$runnm"
8520 runnm=false
8521 set dlerror d_dlerror
8522 eval $inlibc
8523 runnm="$xxx_runnm"
8524
8525 : see if dlfcn is available
8526 set dlfcn.h i_dlfcn
8527 eval $inhdr
8528
8529 case "$usedl" in
8530 $define|y|true)
8531         $cat << EOM
8532
8533 On a few systems, the dynamically loaded modules that perl generates and uses
8534 will need a different extension than shared libs. The default will probably
8535 be appropriate.
8536
8537 EOM
8538         case "$dlext" in
8539         '')     dflt="$so" ;;
8540         *)      dflt="$dlext" ;;
8541         esac
8542         rp='What is the extension of dynamically loaded modules'
8543         . ./myread
8544         dlext="$ans"
8545         ;;
8546 *)
8547         dlext="none"
8548         ;;
8549 esac
8550
8551 : Check if dlsym need a leading underscore
8552 echo " "
8553 val="$undef"
8554
8555 case "$dlsrc" in
8556 dl_dlopen.xs)
8557         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8558         $cat >dyna.c <<'EOM'
8559 fred () { }
8560 EOM
8561
8562 $cat >fred.c<<EOM
8563
8564 #include <stdio.h>
8565 #$i_dlfcn I_DLFCN
8566 #ifdef I_DLFCN
8567 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8568 #else
8569 #include <sys/types.h>
8570 #include <nlist.h>
8571 #include <link.h>
8572 #endif
8573
8574 extern int fred() ;
8575
8576 int main()
8577 {
8578     void * handle ;
8579     void * symbol ;
8580 #ifndef RTLD_LAZY
8581     int mode = 1 ;
8582 #else
8583     int mode = RTLD_LAZY ;
8584 #endif
8585     handle = dlopen("./dyna.$dlext", mode) ;
8586     if (handle == NULL) {
8587         printf ("1\n") ;
8588         fflush (stdout) ;
8589         exit(0);
8590     }
8591     symbol = dlsym(handle, "fred") ;
8592     if (symbol == NULL) {
8593         /* try putting a leading underscore */
8594         symbol = dlsym(handle, "_fred") ;
8595         if (symbol == NULL) {
8596             printf ("2\n") ;
8597             fflush (stdout) ;
8598             exit(0);
8599         }
8600         printf ("3\n") ;
8601     }
8602     else
8603         printf ("4\n") ;
8604     fflush (stdout) ;
8605     exit(0);
8606 }
8607 EOM
8608         : Call the object file tmp-dyna.o in case dlext=o.
8609         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8610                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8611                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8612                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8613                 xxx=`./fred`
8614                 case $xxx in
8615                 1)      echo "Test program failed using dlopen." >&4
8616                         echo "Perhaps you should not use dynamic loading." >&4;;
8617                 2)      echo "Test program failed using dlsym." >&4
8618                         echo "Perhaps you should not use dynamic loading." >&4;;
8619                 3)      echo "dlsym needs a leading underscore" >&4
8620                         val="$define" ;;
8621                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8622                 esac
8623         else
8624                 echo "I can't compile and run the test program." >&4
8625                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8626         fi
8627         ;;
8628 esac
8629                 
8630 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8631
8632 set d_dlsymun
8633 eval $setvar
8634
8635 hasproto='varname=$1; func=$2; shift; shift;
8636 while $test $# -ge 2; do
8637         case "$1" in
8638         $define) echo "#include <$2>";;
8639         esac ;
8640     shift 2;
8641 done > try.c;
8642 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8643 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8644         echo "$func() prototype found.";
8645         val="$define";
8646 else
8647         echo "$func() prototype NOT found.";
8648         val="$undef";
8649 fi;
8650 set $varname;
8651 eval $setvar;
8652 $rm -f try.c tryout.c'
8653
8654 : see if prototype for drand48 is available
8655 echo " "
8656 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8657 eval $hasproto
8658
8659 : see if dup2 exists
8660 set dup2 d_dup2
8661 eval $inlibc
8662
8663 : see if eaccess exists
8664 set eaccess d_eaccess
8665 eval $inlibc
8666
8667 : see if endgrent exists
8668 set endgrent d_endgrent
8669 eval $inlibc
8670
8671 : see if endhostent exists
8672 set endhostent d_endhent
8673 eval $inlibc
8674
8675 : see if endnetent exists
8676 set endnetent d_endnent
8677 eval $inlibc
8678
8679 : see if endprotoent exists
8680 set endprotoent d_endpent
8681 eval $inlibc
8682
8683 : see if endpwent exists
8684 set endpwent d_endpwent
8685 eval $inlibc
8686
8687 : see if endservent exists
8688 set endservent d_endsent
8689 eval $inlibc
8690
8691 : Locate the flags for 'open()'
8692 echo " "
8693 $cat >open3.c <<'EOCP'
8694 #include <sys/types.h>
8695 #ifdef I_FCNTL
8696 #include <fcntl.h>
8697 #endif
8698 #ifdef I_SYS_FILE
8699 #include <sys/file.h>
8700 #endif
8701 int main() {
8702         if(O_RDONLY);
8703 #ifdef O_TRUNC
8704         exit(0);
8705 #else
8706         exit(1);
8707 #endif
8708 }
8709 EOCP
8710 : check sys/file.h first to get FREAD on Sun
8711 if $test `./findhdr sys/file.h` && \
8712                 set open3 -DI_SYS_FILE && eval $compile; then
8713         h_sysfile=true;
8714         echo "<sys/file.h> defines the O_* constants..." >&4
8715         if ./open3; then
8716                 echo "and you have the 3 argument form of open()." >&4
8717                 val="$define"
8718         else
8719                 echo "but not the 3 argument form of open().  Oh, well." >&4
8720                 val="$undef"
8721         fi
8722 elif $test `./findhdr fcntl.h` && \
8723                 set open3 -DI_FCNTL && eval $compile; then
8724         h_fcntl=true;
8725         echo "<fcntl.h> defines the O_* constants..." >&4
8726         if ./open3; then
8727                 echo "and you have the 3 argument form of open()." >&4
8728                 val="$define"
8729         else
8730                 echo "but not the 3 argument form of open().  Oh, well." >&4
8731                 val="$undef"
8732         fi
8733 else
8734         val="$undef"
8735         echo "I can't find the O_* constant definitions!  You got problems." >&4
8736 fi
8737 set d_open3
8738 eval $setvar
8739 $rm -f open3*
8740
8741 : see which of string.h or strings.h is needed
8742 echo " "
8743 strings=`./findhdr string.h`
8744 if $test "$strings" && $test -r "$strings"; then
8745         echo "Using <string.h> instead of <strings.h>." >&4
8746         val="$define"
8747 else
8748         val="$undef"
8749         strings=`./findhdr strings.h`
8750         if $test "$strings" && $test -r "$strings"; then
8751                 echo "Using <strings.h> instead of <string.h>." >&4
8752         else
8753                 echo "No string header found -- You'll surely have problems." >&4
8754         fi
8755 fi
8756 set i_string
8757 eval $setvar
8758 case "$i_string" in
8759 "$undef") strings=`./findhdr strings.h`;;
8760 *)        strings=`./findhdr string.h`;;
8761 esac
8762
8763 : check for non-blocking I/O stuff
8764 case "$h_sysfile" in
8765 true) echo "#include <sys/file.h>" > head.c;;
8766 *)
8767         case "$h_fcntl" in
8768         true) echo "#include <fcntl.h>" > head.c;;
8769         *) echo "#include <sys/fcntl.h>" > head.c;;
8770         esac
8771         ;;
8772 esac
8773 echo " "
8774 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8775 case "$o_nonblock" in
8776 '')
8777         $cat head.c > try.c
8778         $cat >>try.c <<'EOCP'
8779 #include <stdio.h>
8780 int main() {
8781 #ifdef O_NONBLOCK
8782         printf("O_NONBLOCK\n");
8783         exit(0);
8784 #endif
8785 #ifdef O_NDELAY
8786         printf("O_NDELAY\n");
8787         exit(0);
8788 #endif
8789 #ifdef FNDELAY
8790         printf("FNDELAY\n");
8791         exit(0);
8792 #endif
8793         exit(0);
8794 }
8795 EOCP
8796         set try
8797         if eval $compile_ok; then
8798                 o_nonblock=`./try`
8799                 case "$o_nonblock" in
8800                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8801                 *) echo "Seems like we can use $o_nonblock.";;
8802                 esac
8803         else
8804                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8805         fi
8806         ;;
8807 *) echo "Using $hint value $o_nonblock.";;
8808 esac
8809 $rm -f try try.* .out core
8810
8811 echo " "
8812 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8813 case "$eagain" in
8814 '')
8815         $cat head.c > try.c
8816         $cat >>try.c <<EOCP
8817 #include <errno.h>
8818 #include <sys/types.h>
8819 #include <signal.h>
8820 #include <stdio.h> 
8821 #define MY_O_NONBLOCK $o_nonblock
8822 #ifndef errno  /* XXX need better Configure test */
8823 extern int errno;
8824 #endif
8825 #$i_unistd I_UNISTD
8826 #ifdef I_UNISTD
8827 #include <unistd.h>
8828 #endif
8829 #$i_string I_STRING
8830 #ifdef I_STRING
8831 #include <string.h>
8832 #else
8833 #include <strings.h>
8834 #endif
8835 $signal_t blech(x) int x; { exit(3); }
8836 EOCP
8837         $cat >> try.c <<'EOCP'
8838 int main()
8839 {
8840         int pd[2];
8841         int pu[2];
8842         char buf[1];
8843         char string[100];
8844
8845         pipe(pd);       /* Down: child -> parent */
8846         pipe(pu);       /* Up: parent -> child */
8847         if (0 != fork()) {
8848                 int ret;
8849                 close(pd[1]);   /* Parent reads from pd[0] */
8850                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8851                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8852                         exit(1);
8853                 signal(SIGALRM, blech);
8854                 alarm(5);
8855                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8856                         exit(2);
8857                 sprintf(string, "%d\n", ret);
8858                 write(2, string, strlen(string));
8859                 alarm(0);
8860 #ifdef EAGAIN
8861                 if (errno == EAGAIN) {
8862                         printf("EAGAIN\n");
8863                         goto ok;
8864                 }
8865 #endif
8866 #ifdef EWOULDBLOCK
8867                 if (errno == EWOULDBLOCK)
8868                         printf("EWOULDBLOCK\n");
8869 #endif
8870         ok:
8871                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8872                 sleep(2);                               /* Give it time to close our pipe */
8873                 alarm(5);
8874                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8875                 alarm(0);
8876                 sprintf(string, "%d\n", ret);
8877                 write(3, string, strlen(string));
8878                 exit(0);
8879         }
8880
8881         close(pd[0]);                   /* We write to pd[1] */
8882         close(pu[1]);                   /* We read from pu[0] */
8883         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8884         close(pd[1]);                   /* Pipe pd is now fully closed! */
8885         exit(0);                                /* Bye bye, thank you for playing! */
8886 }
8887 EOCP
8888         set try
8889         if eval $compile_ok; then
8890                 echo "$startsh" >mtry
8891                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8892                 chmod +x mtry
8893                 ./mtry >/dev/null 2>&1
8894                 case $? in
8895                 0) eagain=`$cat try.out`;;
8896                 1) echo "Could not perform non-blocking setting!";;
8897                 2) echo "I did a successful read() for something that was not there!";;
8898                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8899                 *) echo "Something terribly wrong happened during testing.";;
8900                 esac
8901                 rd_nodata=`$cat try.ret`
8902                 echo "A read() system call with no data present returns $rd_nodata."
8903                 case "$rd_nodata" in
8904                 0|-1) ;;
8905                 *)
8906                         echo "(That's peculiar, fixing that to be -1.)"
8907                         rd_nodata=-1
8908                         ;;
8909                 esac
8910                 case "$eagain" in
8911                 '')
8912                         echo "Forcing errno EAGAIN on read() with no data available."
8913                         eagain=EAGAIN
8914                         ;;
8915                 *)
8916                         echo "Your read() sets errno to $eagain when no data is available."
8917                         ;;
8918                 esac
8919                 status=`$cat try.err`
8920                 case "$status" in
8921                 0) echo "And it correctly returns 0 to signal EOF.";;
8922                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8923                 *) echo "However, your read() returns '$status' on EOF??";;
8924                 esac
8925                 val="$define"
8926                 if test "$status" = "$rd_nodata"; then
8927                         echo "WARNING: you can't distinguish between EOF and no data!"
8928                         val="$undef"
8929                 fi
8930         else
8931                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8932                 eagain=EAGAIN
8933         fi
8934         set d_eofnblk
8935         eval $setvar
8936         ;;
8937 *)
8938         echo "Using $hint value $eagain."
8939         echo "Your read() returns $rd_nodata when no data is present."
8940         case "$d_eofnblk" in
8941         "$define") echo "And you can see EOF because read() returns 0.";;
8942         "$undef") echo "But you can't see EOF status from read() returned value.";;
8943         *)
8944                 echo "(Assuming you can't see EOF status from read anyway.)"
8945                 d_eofnblk=$undef
8946                 ;;
8947         esac
8948         ;;
8949 esac
8950 $rm -f try try.* .out core head.c mtry
8951
8952 : see if fchmod exists
8953 set fchmod d_fchmod
8954 eval $inlibc
8955
8956 : see if fchown exists
8957 set fchown d_fchown
8958 eval $inlibc
8959
8960 : see if this is an fcntl system
8961 set fcntl d_fcntl
8962 eval $inlibc
8963
8964 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8965 while $test $# -ge 2; do
8966         case "$1" in
8967         $define) echo "#include <$2>";;
8968         esac ;
8969     shift 2;
8970 done > try.c;
8971 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8972 set try;
8973 if eval $compile; then
8974         val="$define";
8975 else
8976         val="$undef";
8977 fi;
8978 set $varname;
8979 eval $setvar;
8980 $rm -f try.c try.o'
8981
8982 socketlib=''
8983 sockethdr=''
8984 : see whether socket exists
8985 echo " "
8986 $echo $n "Hmm... $c" >&4
8987 if set socket val -f d_socket; eval $csym; $val; then
8988         echo "Looks like you have Berkeley networking support." >&4
8989         d_socket="$define"
8990         if set setsockopt val -f; eval $csym; $val; then
8991                 d_oldsock="$undef"
8992         else
8993                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8994                 d_oldsock="$define"
8995         fi
8996 else
8997         if $contains socklib libc.list >/dev/null 2>&1; then
8998                 echo "Looks like you have Berkeley networking support." >&4
8999                 d_socket="$define"
9000                 : we will have to assume that it supports the 4.2 BSD interface
9001                 d_oldsock="$undef"
9002         else
9003                 echo "You don't have Berkeley networking in libc$_a..." >&4
9004                 if test "X$d_socket" = "X$define"; then
9005                    echo "...but you seem to believe that you have sockets." >&4
9006                 else
9007                         for net in net socket
9008                         do
9009                                 if test -f /usr/lib/lib$net$_a; then
9010                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9011                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9012                                         if $contains socket libc.list >/dev/null 2>&1; then
9013                                                 d_socket="$define"
9014                                                 socketlib="-l$net"
9015                                                 case "$net" in
9016                                                 net)
9017                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9018                                                         sockethdr="-I/usr/netinclude"
9019                                                         ;;
9020                                                 esac
9021                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9022                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9023                                                         d_oldsock="$undef"
9024                                                 else
9025                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9026                                                         d_oldsock="$define"
9027                                                 fi
9028                                                 break
9029                                         fi
9030                                 fi
9031                         done
9032                         if test "X$d_socket" != "X$define"; then
9033                            echo "or anywhere else I see." >&4
9034                            d_socket="$undef"
9035                            d_oldsock="$undef"
9036                         fi
9037                 fi
9038         fi
9039 fi
9040
9041 : see if socketpair exists
9042 set socketpair d_sockpair
9043 eval $inlibc
9044
9045
9046 echo " "
9047 echo "Checking the availability of certain socket constants..." >& 4
9048 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9049         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9050         $cat >try.c <<EOF
9051 #include <sys/types.h>
9052 #include <sys/socket.h>
9053 int main() {
9054     int i = $ENUM;
9055 }
9056 EOF
9057         val="$undef"
9058         set try; if eval $compile; then
9059                 val="$define"
9060         fi
9061         set d_${enum}; eval $setvar
9062         $rm -f try.c try
9063 done
9064
9065 : see if sys/select.h has to be included
9066 set sys/select.h i_sysselct
9067 eval $inhdr
9068
9069 : see if we should include time.h, sys/time.h, or both
9070 echo " "
9071 if test "X$timeincl" = X; then
9072         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9073         $echo $n "I'm now running the test program...$c"
9074         $cat >try.c <<'EOCP'
9075 #include <sys/types.h>
9076 #ifdef I_TIME
9077 #include <time.h>
9078 #endif
9079 #ifdef I_SYSTIME
9080 #ifdef SYSTIMEKERNEL
9081 #define KERNEL
9082 #endif
9083 #include <sys/time.h>
9084 #endif
9085 #ifdef I_SYSSELECT
9086 #include <sys/select.h>
9087 #endif
9088 int main()
9089 {
9090         struct tm foo;
9091 #ifdef S_TIMEVAL
9092         struct timeval bar;
9093 #endif
9094 #ifdef S_TIMEZONE
9095         struct timezone tzp;
9096 #endif
9097         if (foo.tm_sec == foo.tm_sec)
9098                 exit(0);
9099 #ifdef S_TIMEVAL
9100         if (bar.tv_sec == bar.tv_sec)
9101                 exit(0);
9102 #endif
9103         exit(1);
9104 }
9105 EOCP
9106         flags=''
9107         for s_timezone in '-DS_TIMEZONE' ''; do
9108         sysselect=''
9109         for s_timeval in '-DS_TIMEVAL' ''; do
9110         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9111         for i_time in '' '-DI_TIME'; do
9112         for i_systime in '-DI_SYSTIME' ''; do
9113                 case "$flags" in
9114                 '') $echo $n ".$c"
9115                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9116                         if eval $compile; then
9117                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9118                                 shift
9119                                 flags="$*"
9120                                 echo " "
9121                                 $echo $n "Succeeded with $flags$c"
9122                         fi
9123                         ;;
9124                 esac
9125         done
9126         done
9127         done
9128         done
9129         done
9130         timeincl=''
9131         echo " "
9132         case "$flags" in
9133         *SYSTIMEKERNEL*) i_systimek="$define"
9134                 timeincl=`./findhdr sys/time.h`
9135                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9136         *) i_systimek="$undef";;
9137         esac
9138         case "$flags" in
9139         *I_TIME*) i_time="$define"
9140                 timeincl=`./findhdr time.h`" $timeincl"
9141                 echo "We'll include <time.h>." >&4;;
9142         *) i_time="$undef";;
9143         esac
9144         case "$flags" in
9145         *I_SYSTIME*) i_systime="$define"
9146                 timeincl=`./findhdr sys/time.h`" $timeincl"
9147                 echo "We'll include <sys/time.h>." >&4;;
9148         *) i_systime="$undef";;
9149         esac
9150         $rm -f try.c try
9151 fi
9152
9153 : check for fd_set items
9154 $cat <<EOM
9155
9156 Checking to see how well your C compiler handles fd_set and friends ...
9157 EOM
9158 $cat >fd_set.c <<EOCP
9159 #$i_systime I_SYS_TIME
9160 #$i_sysselct I_SYS_SELECT
9161 #$d_socket HAS_SOCKET
9162 #include <sys/types.h>
9163 #ifdef HAS_SOCKET
9164 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9165 #endif
9166 #ifdef I_SYS_TIME
9167 #include <sys/time.h>
9168 #endif
9169 #ifdef I_SYS_SELECT
9170 #include <sys/select.h>
9171 #endif
9172 int main() {
9173         fd_set fds;
9174
9175 #ifdef TRYBITS
9176         if(fds.fds_bits);
9177 #endif
9178
9179 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9180         exit(0);
9181 #else
9182         exit(1);
9183 #endif
9184 }
9185 EOCP
9186 set fd_set -DTRYBITS
9187 if eval $compile; then
9188         d_fds_bits="$define"
9189         d_fd_set="$define"
9190         echo "Well, your system knows about the normal fd_set typedef..." >&4
9191         if ./fd_set; then
9192                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9193                 d_fd_macros="$define"
9194         else
9195                 $cat >&4 <<'EOM'
9196 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9197 EOM
9198                 d_fd_macros="$undef"
9199         fi
9200 else
9201         $cat <<'EOM'
9202 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9203 EOM
9204         set fd_set
9205         if eval $compile; then
9206                 d_fds_bits="$undef"
9207                 d_fd_set="$define"
9208                 echo "Well, your system has some sort of fd_set available..." >&4
9209                 if ./fd_set; then
9210                         echo "and you have the normal fd_set macros." >&4
9211                         d_fd_macros="$define"
9212                 else
9213                         $cat <<'EOM'
9214 but not the normal fd_set macros!  Gross!  More work for me...
9215 EOM
9216                         d_fd_macros="$undef"
9217                 fi
9218         else
9219         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9220                 d_fd_set="$undef"
9221                 d_fds_bits="$undef"
9222                 d_fd_macros="$undef"
9223         fi
9224 fi
9225 $rm -f fd_set*
9226
9227 : see if fgetpos exists
9228 set fgetpos d_fgetpos
9229 eval $inlibc
9230
9231 : see if flock exists
9232 set flock d_flock
9233 eval $inlibc
9234
9235 : see if fork exists
9236 set fork d_fork
9237 eval $inlibc
9238
9239 : see if pathconf exists
9240 set pathconf d_pathconf
9241 eval $inlibc
9242
9243 : see if fpathconf exists
9244 set fpathconf d_fpathconf
9245 eval $inlibc
9246
9247
9248 : check for fpos64_t
9249 echo " "
9250 echo "Checking to see if you have fpos64_t..." >&4
9251 $cat >try.c <<EOCP
9252 #include <stdio.h>
9253 int main() { fpos64_t x = 7; }
9254 EOCP
9255 set try
9256 if eval $compile; then
9257         val="$define"
9258         echo "You have fpos64_t."
9259 else
9260         val="$undef"
9261         echo "You do not have fpos64_t."
9262         case "$fpossize" in
9263         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9264         esac
9265 fi
9266 $rm -f try.* try
9267 set d_fpos64_t
9268 eval $setvar
9269
9270 : see if frexpl exists
9271 set frexpl d_frexpl
9272 eval $inlibc
9273
9274 hasstruct='varname=$1; struct=$2; shift; shift;
9275 while $test $# -ge 2; do
9276         case "$1" in
9277         $define) echo "#include <$2>";;
9278         esac ;
9279     shift 2;
9280 done > try.c;
9281 echo "int main () { struct $struct foo; }" >> try.c;
9282 set try;
9283 if eval $compile; then
9284         val="$define";
9285 else
9286         val="$undef";
9287 fi;
9288 set $varname;
9289 eval $setvar;
9290 $rm -f try.c try.o'
9291
9292 : see if this is a sys/param system
9293 set sys/param.h i_sysparam
9294 eval $inhdr
9295
9296 : see if this is a sys/mount.h system
9297 set sys/mount.h i_sysmount
9298 eval $inhdr
9299
9300 : see if sys/types.h has to be included
9301 set sys/types.h i_systypes
9302 eval $inhdr
9303
9304
9305 echo " "
9306 echo "Checking to see if your system supports struct fs_data..." >&4
9307 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9308 eval $hasstruct
9309 case "$d_fs_data_s" in
9310 "$define")      echo "Yes, it does."   ;;
9311 *)              echo "No, it doesn't." ;;
9312 esac
9313
9314 : see if fseeko exists
9315 set fseeko d_fseeko
9316 eval $inlibc
9317 case "$longsize" in
9318 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9319 esac
9320
9321 : see if fsetpos exists
9322 set fsetpos d_fsetpos
9323 eval $inlibc
9324
9325
9326 : see if fstatfs exists
9327 set fstatfs d_fstatfs
9328 eval $inlibc
9329
9330
9331 : see if statvfs exists
9332 set statvfs d_statvfs
9333 eval $inlibc
9334
9335 : see if fstatvfs exists
9336 set fstatvfs d_fstatvfs
9337 eval $inlibc
9338
9339
9340 : see if ftello exists
9341 set ftello d_ftello
9342 eval $inlibc
9343 case "$longsize" in
9344 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9345 esac
9346
9347 : see if getcwd exists
9348 set getcwd d_getcwd
9349 eval $inlibc
9350
9351 : see if getespwnam exists
9352 set getespwnam d_getespwnam
9353 eval $inlibc
9354
9355
9356 : see if getfsstat exists
9357 set getfsstat d_getfsstat
9358 eval $inlibc
9359
9360 : see if getgrent exists
9361 set getgrent d_getgrent
9362 eval $inlibc
9363
9364 : see if gethostbyaddr exists
9365 set gethostbyaddr d_gethbyaddr
9366 eval $inlibc
9367
9368 : see if gethostbyname exists
9369 set gethostbyname d_gethbyname
9370 eval $inlibc
9371
9372 : see if gethostent exists
9373 set gethostent d_gethent
9374 eval $inlibc
9375
9376 : see how we will look up host name
9377 echo " "
9378 call=''
9379 if set gethostname val -f d_gethname; eval $csym; $val; then
9380         echo 'gethostname() found.' >&4
9381         d_gethname="$define"
9382         call=gethostname
9383 fi
9384 if set uname val -f d_uname; eval $csym; $val; then
9385         if ./xenix; then
9386                 $cat <<'EOM'
9387 uname() was found, but you're running xenix, and older versions of xenix
9388 have a broken uname(). If you don't really know whether your xenix is old
9389 enough to have a broken system call, use the default answer.
9390
9391 EOM
9392                 dflt=y
9393                 case "$d_uname" in
9394                 "$define") dflt=n;;
9395                 esac
9396                 rp='Is your uname() broken?'
9397                 . ./myread
9398                 case "$ans" in
9399                 n*) d_uname="$define"; call=uname;;
9400                 esac
9401         else
9402                 echo 'uname() found.' >&4
9403                 d_uname="$define"
9404                 case "$call" in
9405                 '') call=uname ;;
9406                 esac
9407         fi
9408 fi
9409 case "$d_gethname" in
9410 '') d_gethname="$undef";;
9411 esac
9412 case "$d_uname" in
9413 '') d_uname="$undef";;
9414 esac
9415 case "$d_uname$d_gethname" in
9416 *define*)
9417         dflt=n
9418         cat <<EOM
9419  
9420 Every now and then someone has a $call() that lies about the hostname
9421 but can't be fixed for political or economic reasons.  If you wish, I can
9422 pretend $call() isn't there and maybe compute hostname at run-time
9423 thanks to the '$phostname' command.
9424
9425 EOM
9426         rp="Shall I ignore $call() from now on?"
9427         . ./myread
9428         case "$ans" in
9429         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9430         esac;;
9431 esac
9432 case "$phostname" in
9433 '') aphostname='';;
9434 *) case "$aphostname" in
9435         /*) ;;
9436         *) set X $phostname
9437                 shift
9438                 file=$1
9439                 shift
9440                 file=`./loc $file $file $pth`
9441                 aphostname=`echo $file $*`
9442                 ;;
9443         esac
9444         ;;
9445 esac
9446 case "$d_uname$d_gethname" in
9447 *define*) ;;
9448 *)
9449         case "$phostname" in
9450         '')
9451                 echo "There will be no way for $package to get your hostname." >&4;;
9452         *)
9453         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9454                 ;;
9455         esac;;
9456 esac
9457 case "$d_phostname" in
9458 '') d_phostname="$undef";;
9459 esac
9460
9461 : see if this is a netdb.h system
9462 set netdb.h i_netdb
9463 eval $inhdr
9464
9465 : see if prototypes for various gethostxxx netdb.h functions are available
9466 echo " "
9467 set d_gethostprotos gethostent $i_netdb netdb.h
9468 eval $hasproto
9469
9470 : see if getlogin exists
9471 set getlogin d_getlogin
9472 eval $inlibc
9473
9474 : see if getmnt exists
9475 set getmnt d_getmnt
9476 eval $inlibc
9477
9478 : see if getmntent exists
9479 set getmntent d_getmntent
9480 eval $inlibc
9481
9482 : see if getnetbyaddr exists
9483 set getnetbyaddr d_getnbyaddr
9484 eval $inlibc
9485
9486 : see if getnetbyname exists
9487 set getnetbyname d_getnbyname
9488 eval $inlibc
9489
9490 : see if getnetent exists
9491 set getnetent d_getnent
9492 eval $inlibc
9493
9494 : see if prototypes for various getnetxxx netdb.h functions are available
9495 echo " "
9496 set d_getnetprotos getnetent $i_netdb netdb.h
9497 eval $hasproto
9498
9499
9500 : see if getprotobyname exists
9501 set getprotobyname d_getpbyname
9502 eval $inlibc
9503
9504 : see if getprotobynumber exists
9505 set getprotobynumber d_getpbynumber
9506 eval $inlibc
9507
9508 : see if getprotoent exists
9509 set getprotoent d_getpent
9510 eval $inlibc
9511
9512 : see if getpgid exists
9513 set getpgid d_getpgid
9514 eval $inlibc
9515
9516 : see if getpgrp2 exists
9517 set getpgrp2 d_getpgrp2
9518 eval $inlibc
9519
9520 : see if getppid exists
9521 set getppid d_getppid
9522 eval $inlibc
9523
9524 : see if getpriority exists
9525 set getpriority d_getprior
9526 eval $inlibc
9527
9528 : see if prototypes for various getprotoxxx netdb.h functions are available
9529 echo " "
9530 set d_getprotoprotos getprotoent $i_netdb netdb.h
9531 eval $hasproto
9532
9533 : see if getprpwnam exists
9534 set getprpwnam d_getprpwnam
9535 eval $inlibc
9536
9537 : see if getpwent exists
9538 set getpwent d_getpwent
9539 eval $inlibc
9540
9541
9542 : see if getservbyname exists
9543 set getservbyname d_getsbyname
9544 eval $inlibc
9545
9546 : see if getservbyport exists
9547 set getservbyport d_getsbyport
9548 eval $inlibc
9549
9550 : see if getservent exists
9551 set getservent d_getsent
9552 eval $inlibc
9553
9554 : see if prototypes for various getservxxx netdb.h functions are available
9555 echo " "
9556 set d_getservprotos getservent $i_netdb netdb.h
9557 eval $hasproto
9558
9559 : see if getspnam exists
9560 set getspnam d_getspnam
9561 eval $inlibc
9562
9563 : see if gettimeofday or ftime exists
9564 set gettimeofday d_gettimeod
9565 eval $inlibc
9566 case "$d_gettimeod" in
9567 "$undef")
9568         set ftime d_ftime 
9569         eval $inlibc
9570         ;;
9571 *)
9572         val="$undef"; set d_ftime; eval $setvar
9573         ;;
9574 esac
9575 case "$d_gettimeod$d_ftime" in
9576 "$undef$undef")
9577         echo " "
9578         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9579         ;;
9580 esac
9581
9582 : see if this is an grp system
9583 set grp.h i_grp
9584 eval $inhdr
9585
9586 case "$i_grp" in
9587 $define)
9588         xxx=`./findhdr grp.h`
9589         $cppstdin $cppflags $cppminus < $xxx >$$.h
9590
9591         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9592                 val="$define"
9593         else
9594                 val="$undef"
9595         fi
9596         set d_grpasswd
9597         eval $setvar
9598
9599         $rm -f $$.h
9600         ;;
9601 *)
9602         val="$undef";
9603         set d_grpasswd; eval $setvar
9604         ;;
9605 esac
9606
9607 : see if hasmntopt exists
9608 set hasmntopt d_hasmntopt
9609 eval $inlibc
9610
9611 : see if this is a netinet/in.h or sys/in.h system
9612 set netinet/in.h i_niin sys/in.h i_sysin
9613 eval $inhdr
9614
9615 : see if arpa/inet.h has to be included
9616 set arpa/inet.h i_arpainet
9617 eval $inhdr
9618
9619 : see if htonl --and friends-- exists
9620 val=''
9621 set htonl val
9622 eval $inlibc
9623
9624 : Maybe they are macros.
9625 case "$val" in
9626 $undef)
9627         $cat >htonl.c <<EOM
9628 #include <stdio.h>
9629 #include <sys/types.h>
9630 #$i_niin I_NETINET_IN
9631 #$i_sysin I_SYS_IN
9632 #$i_arpainet I_ARPA_INET
9633 #ifdef I_NETINET_IN
9634 #include <netinet/in.h>
9635 #endif
9636 #ifdef I_SYS_IN
9637 #include <sys/in.h>
9638 #endif
9639 #ifdef I_ARPA_INET
9640 #include <arpa/inet.h>
9641 #endif
9642 #ifdef htonl
9643 printf("Defined as a macro.");
9644 #endif
9645 EOM
9646         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9647         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9648                 val="$define"
9649                 echo "But it seems to be defined as a macro." >&4
9650         fi
9651         $rm -f htonl.?
9652         ;;
9653 esac
9654 set d_htonl
9655 eval $setvar
9656
9657 : see if iconv exists
9658 set iconv d_iconv
9659 eval $inlibc
9660
9661 : index or strchr
9662 echo " "
9663 if set index val -f; eval $csym; $val; then
9664         if set strchr val -f d_strchr; eval $csym; $val; then
9665                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9666                         val="$define"
9667                         vali="$undef"
9668                         echo "strchr() found." >&4
9669                 else
9670                         val="$undef"
9671                         vali="$define"
9672                         echo "index() found." >&4
9673                 fi
9674         else
9675                 val="$undef"
9676                 vali="$define"
9677                 echo "index() found." >&4
9678         fi
9679 else
9680         if set strchr val -f d_strchr; eval $csym; $val; then
9681                 val="$define"
9682                 vali="$undef"
9683                 echo "strchr() found." >&4
9684         else
9685                 echo "No index() or strchr() found!" >&4
9686                 val="$undef"
9687                 vali="$undef"
9688         fi
9689 fi
9690 set d_strchr; eval $setvar
9691 val="$vali"
9692 set d_index; eval $setvar
9693
9694 : check whether inet_aton exists
9695 set inet_aton d_inetaton
9696 eval $inlibc
9697
9698 : see if inttypes.h is available
9699 : we want a real compile instead of Inhdr because some systems
9700 : have an inttypes.h which includes non-existent headers
9701 echo " "
9702 $cat >try.c <<EOCP
9703 #include <inttypes.h>
9704 int main() {
9705         static int32_t foo32 = 0x12345678;
9706 }
9707 EOCP
9708 set try
9709 if eval $compile; then
9710         echo "<inttypes.h> found." >&4
9711         val="$define"
9712 else
9713         echo "<inttypes.h> NOT found." >&4
9714         val="$undef"
9715 fi
9716 $rm -f try.c try
9717 set i_inttypes
9718 eval $setvar
9719
9720 : check for int64_t
9721 echo " "
9722 echo "Checking to see if you have int64_t..." >&4
9723 $cat >try.c <<EOCP
9724 #include <sys/types.h>
9725 #$i_inttypes I_INTTYPES
9726 #ifdef I_INTTYPES
9727 #include <inttypes.h>
9728 #endif
9729 int main() { int64_t x = 7; }
9730 EOCP
9731 set try
9732 if eval $compile; then
9733         val="$define"
9734         echo "You have int64_t."
9735 else
9736         val="$undef"
9737         echo "You do not have int64_t."
9738 fi
9739 $rm -f try try.*
9740 set d_int64_t
9741 eval $setvar
9742
9743 : Look for isascii
9744 echo " "
9745 $cat >isascii.c <<'EOCP'
9746 #include <stdio.h>
9747 #include <ctype.h>
9748 int main() {
9749         int c = 'A';
9750         if (isascii(c))
9751                 exit(0);
9752         else
9753                 exit(1);
9754 }
9755 EOCP
9756 set isascii
9757 if eval $compile; then
9758         echo "isascii() found." >&4
9759         val="$define"
9760 else
9761         echo "isascii() NOT found." >&4
9762         val="$undef"
9763 fi
9764 set d_isascii
9765 eval $setvar
9766 $rm -f isascii*
9767
9768 : see if isnan exists
9769 set isnan d_isnan
9770 eval $inlibc
9771
9772 : see if isnanl exists
9773 set isnanl d_isnanl
9774 eval $inlibc
9775
9776 : see if killpg exists
9777 set killpg d_killpg
9778 eval $inlibc
9779
9780 : see if lchown exists
9781 echo " "
9782 $cat > try.c <<'EOCP'
9783 /* System header to define __stub macros and hopefully few prototypes,
9784     which can conflict with char lchown(); below.  */
9785 #include <assert.h>
9786 /* Override any gcc2 internal prototype to avoid an error.  */
9787 /* We use char because int might match the return type of a gcc2
9788    builtin and then its argument prototype would still apply.  */
9789 char lchown();
9790 int main() {
9791     /*  The GNU C library defines this for functions which it implements
9792         to always fail with ENOSYS.  Some functions are actually named
9793         something starting with __ and the normal name is an alias.  */
9794 #if defined (__stub_lchown) || defined (__stub___lchown)
9795 choke me
9796 #else
9797 lchown();
9798 #endif
9799 ; return 0; }
9800 EOCP
9801 set try
9802 if eval $compile; then
9803     $echo "lchown() found." >&4
9804     val="$define"
9805 else
9806     $echo "lchown() NOT found." >&4
9807     val="$undef"
9808 fi
9809 set d_lchown
9810 eval $setvar
9811
9812 : See if number of significant digits in a double precision number is known
9813 echo " "
9814 $cat >ldbl_dig.c <<EOM
9815 #$i_limits I_LIMITS
9816 #$i_float I_FLOAT
9817 #ifdef I_LIMITS
9818 #include <limits.h>
9819 #endif
9820 #ifdef I_FLOAT
9821 #include <float.h>
9822 #endif
9823 #ifdef LDBL_DIG
9824 printf("Contains LDBL_DIG");
9825 #endif
9826 EOM
9827 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9828 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9829         echo "LDBL_DIG found." >&4
9830         val="$define"
9831 else
9832         echo "LDBL_DIG NOT found." >&4
9833         val="$undef"
9834 fi
9835 $rm -f ldbl_dig.?
9836 set d_ldbl_dig
9837 eval $setvar
9838
9839 : see if link exists
9840 set link d_link
9841 eval $inlibc
9842
9843 : see if localeconv exists
9844 set localeconv d_locconv
9845 eval $inlibc
9846
9847 : see if lockf exists
9848 set lockf d_lockf
9849 eval $inlibc
9850
9851 : check for long long
9852 echo " "
9853 echo "Checking to see if you have long long..." >&4
9854 echo 'int main() { long long x = 7; return 0; }' > try.c
9855 set try
9856 if eval $compile; then
9857         val="$define"
9858         echo "You have long long."
9859 else
9860         val="$undef"
9861         echo "You do not have long long."
9862 fi
9863 $rm try.*
9864 set d_longlong
9865 eval $setvar
9866
9867 : check for length of long long
9868 case "${d_longlong}${longlongsize}" in
9869 $define)
9870         echo " "
9871         echo "Checking to see how big your long longs are..." >&4
9872         $cat >try.c <<'EOCP'
9873 #include <stdio.h>
9874 int main()
9875 {
9876     printf("%d\n", (int)sizeof(long long));
9877     return(0);
9878 }
9879 EOCP
9880         set try
9881         if eval $compile_ok; then
9882                 longlongsize=`./try$exe_ext`
9883                 echo "Your long longs are $longlongsize bytes long."
9884         else
9885                 dflt='8'
9886                 echo " "
9887                 echo "(I can't seem to compile the test program.  Guessing...)"
9888                 rp="What is the size of a long long (in bytes)?"
9889                 . ./myread
9890                 longlongsize="$ans"
9891         fi
9892         if $test "X$longsize" = "X$longlongsize"; then
9893                 echo "(That isn't any different from an ordinary long.)"
9894         fi      
9895         ;;
9896 esac
9897 $rm -f try.* try
9898
9899 : see if prototype for lseek is available
9900 echo " "
9901 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9902 eval $hasproto
9903
9904 : see if lstat exists
9905 set lstat d_lstat
9906 eval $inlibc
9907
9908 : see if madvise exists
9909 set madvise d_madvise
9910 eval $inlibc
9911
9912 : see if mblen exists
9913 set mblen d_mblen
9914 eval $inlibc
9915
9916 : see if mbstowcs exists
9917 set mbstowcs d_mbstowcs
9918 eval $inlibc
9919
9920 : see if mbtowc exists
9921 set mbtowc d_mbtowc
9922 eval $inlibc
9923
9924 : see if memchr exists
9925 set memchr d_memchr
9926 eval $inlibc
9927
9928 : see if memcmp exists
9929 set memcmp d_memcmp
9930 eval $inlibc
9931
9932 : see if memcpy exists
9933 set memcpy d_memcpy
9934 eval $inlibc
9935
9936 : see if memmove exists
9937 set memmove d_memmove
9938 eval $inlibc
9939
9940 : see if memset exists
9941 set memset d_memset
9942 eval $inlibc
9943
9944 : see if mkdir exists
9945 set mkdir d_mkdir
9946 eval $inlibc
9947
9948 : see if mkdtemp exists
9949 set mkdtemp d_mkdtemp
9950 eval $inlibc
9951
9952 : see if mkfifo exists
9953 set mkfifo d_mkfifo
9954 eval $inlibc
9955
9956 : see if mkstemp exists
9957 set mkstemp d_mkstemp
9958 eval $inlibc
9959
9960 : see if mkstemps exists
9961 set mkstemps d_mkstemps
9962 eval $inlibc
9963
9964 : see if mktime exists
9965 set mktime d_mktime
9966 eval $inlibc
9967
9968 : see if this is a sys/mman.h system
9969 set sys/mman.h i_sysmman
9970 eval $inhdr
9971
9972 : see if mmap exists
9973 set mmap d_mmap
9974 eval $inlibc
9975 : see what shmat returns
9976 : default to something harmless
9977 mmaptype='void *'
9978 case "$i_sysmman$d_mmap" in
9979 "$define$define")
9980         $cat >mmap.c <<'END'
9981 #include <sys/mman.h>
9982 void *mmap();
9983 END
9984         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9985                 mmaptype='void *'
9986         else
9987                 mmaptype='caddr_t'
9988         fi
9989         echo "and it returns ($mmaptype)." >&4
9990         ;;
9991 esac
9992
9993
9994
9995 : see if modfl exists
9996 set modfl d_modfl
9997 eval $inlibc
9998
9999 : see if mprotect exists
10000 set mprotect d_mprotect
10001 eval $inlibc
10002
10003 : see if msgctl exists
10004 set msgctl d_msgctl
10005 eval $inlibc
10006
10007 : see if msgget exists
10008 set msgget d_msgget
10009 eval $inlibc
10010
10011 : see if msgsnd exists
10012 set msgsnd d_msgsnd
10013 eval $inlibc
10014
10015 : see if msgrcv exists
10016 set msgrcv d_msgrcv
10017 eval $inlibc
10018
10019 : see how much of the 'msg*(2)' library is present.
10020 h_msg=true
10021 echo " "
10022 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10023 *"$undef"*) h_msg=false;;
10024 esac
10025 case "$osname" in
10026 freebsd)
10027     case "`ipcs 2>&1`" in
10028     "SVID messages"*"not configured"*)
10029         echo "Your $osname does not have the msg*(2) configured." >&4
10030         h_msg=false
10031         val="$undef"
10032         set msgctl d_msgctl
10033         eval $setvar
10034         set msgget d_msgget
10035         eval $setvar
10036         set msgsnd d_msgsnd
10037         eval $setvar
10038         set msgrcv d_msgrcv
10039         eval $setvar
10040         ;;
10041     esac
10042     ;;
10043 esac
10044 : we could also check for sys/ipc.h ...
10045 if $h_msg && $test `./findhdr sys/msg.h`; then
10046         echo "You have the full msg*(2) library." >&4
10047         val="$define"
10048 else
10049         echo "You don't have the full msg*(2) library." >&4
10050         val="$undef"
10051 fi
10052 set d_msg
10053 eval $setvar
10054
10055 : see if msync exists
10056 set msync d_msync
10057 eval $inlibc
10058
10059 : see if munmap exists
10060 set munmap d_munmap
10061 eval $inlibc
10062
10063 : see if nice exists
10064 set nice d_nice
10065 eval $inlibc
10066
10067
10068 echo " "
10069 echo "Checking which 64-bit integer type we could use..." >&4
10070
10071 case "$intsize" in
10072 8) val=int
10073    set quadtype
10074    eval $setvar
10075    val='"unsigned int"'
10076    set uquadtype
10077    eval $setvar
10078    quadkind=1
10079    ;;
10080 *) case "$longsize" in
10081    8) val=long
10082       set quadtype
10083       eval $setvar
10084       val='"unsigned long"'
10085       set uquadtype
10086       eval $setvar
10087       quadkind=2
10088       ;;
10089    *) case "$d_longlong:$longlongsize" in
10090       define:8)
10091         val='"long long"'
10092         set quadtype
10093         eval $setvar
10094         val='"unsigned long long"'
10095         set uquadtype
10096         eval $setvar
10097         quadkind=3
10098         ;;
10099       *) case "$d_int64_t" in
10100          define)
10101            val=int64_t
10102            set quadtype
10103            eval $setvar
10104            val=uint64_t
10105            set uquadtype
10106            eval $setvar
10107            quadkind=4
10108            ;;
10109          esac
10110          ;;
10111       esac
10112       ;;
10113    esac
10114    ;;
10115 esac
10116
10117 case "$quadtype" in
10118 '')     echo "Alas, no 64-bit integer types in sight." >&4
10119         d_quad="$undef"
10120         ;;
10121 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10122             verb="will"
10123         else
10124             verb="could"
10125         fi
10126         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10127         d_quad="$define"
10128         ;;
10129 esac
10130
10131 : check for length of character
10132 echo " "
10133 case "$charsize" in
10134 '')
10135         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10136         $cat >try.c <<'EOCP'
10137 #include <stdio.h>
10138 int main()
10139 {
10140     printf("%d\n", (int)sizeof(char));
10141     exit(0);
10142 }
10143 EOCP
10144         set try
10145         if eval $compile_ok; then
10146                 dflt=`./try`
10147         else
10148                 dflt='1'
10149                 echo "(I can't seem to compile the test program.  Guessing...)"
10150         fi
10151         ;;
10152 *)
10153         dflt="$charsize"
10154         ;;
10155 esac
10156 rp="What is the size of a character (in bytes)?"
10157 . ./myread
10158 charsize="$ans"
10159 $rm -f try.c try
10160
10161
10162 echo " "
10163 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10164
10165 case "$use64bitint:$d_quad:$quadtype" in
10166 define:define:?*)
10167         ivtype="$quadtype"
10168         uvtype="$uquadtype"
10169         ivsize=8
10170         uvsize=8
10171         ;;
10172 *)      ivtype="long"
10173         uvtype="unsigned long"
10174         ivsize=$longsize
10175         uvsize=$longsize
10176         ;;
10177 esac
10178
10179 case "$uselongdouble:$d_longdbl" in
10180 define:define)
10181         nvtype="long double"
10182         nvsize=$longdblsize
10183         ;;
10184 *)      nvtype=double
10185         nvsize=$doublesize
10186         ;;
10187 esac
10188
10189 $echo "(IV will be "$ivtype", $ivsize bytes)"
10190 $echo "(UV will be "$uvtype", $uvsize bytes)"
10191 $echo "(NV will be "$nvtype", $nvsize bytes)"
10192
10193 $cat >try.c <<EOCP
10194 #$i_inttypes I_INTTYPES
10195 #ifdef I_INTTYPES
10196 #include <inttypes.h>
10197 #endif
10198 #include <stdio.h>
10199 int main() {
10200 #ifdef INT8
10201    int8_t i =  INT8_MAX;
10202   uint8_t u = UINT8_MAX;
10203   printf("int8_t\n");
10204 #endif
10205 #ifdef INT16
10206    int16_t i =  INT16_MAX;
10207   uint16_t i = UINT16_MAX;
10208   printf("int16_t\n");
10209 #endif
10210 #ifdef INT32
10211    int32_t i =  INT32_MAX;
10212   uint32_t u = UINT32_MAX;
10213   printf("int32_t\n");
10214 #endif
10215 }
10216 EOCP
10217
10218 case "$i8type" in
10219 '')     case "$charsize" in
10220         1)      i8type=char
10221                 u8type="unsigned char"
10222                 i8size=$charsize
10223                 u8size=$charsize
10224                 ;;
10225         esac
10226         ;;
10227 esac
10228 case "$i8type" in
10229 '')     set try -DINT8
10230         if eval $compile; then
10231                 case "`./try$exe_ext`" in
10232                 int8_t) i8type=int8_t
10233                         u8type=uint8_t
10234                         i8size=1
10235                         u8size=1
10236                         ;;
10237                 esac
10238         fi
10239         ;;
10240 esac
10241 case "$i8type" in
10242 '')     if $test $charsize -ge 1; then
10243                 i8type=char
10244                 u8type="unsigned char"
10245                 i8size=$charsize
10246                 u8size=$charsize
10247         fi
10248         ;;
10249 esac
10250
10251 case "$i16type" in
10252 '')     case "$shortsize" in
10253         2)      i16type=short
10254                 u16type="unsigned short"
10255                 i16size=$shortsize
10256                 u16size=$shortsize
10257                 ;;
10258         esac
10259         ;;
10260 esac
10261 case "$i16type" in
10262 '')     set try -DINT16
10263         if eval $compile; then
10264                 case "`./try$exe_ext`" in
10265                 int16_t)
10266                         i16type=int16_t
10267                         u16type=uint16_t
10268                         i16size=2
10269                         u16size=2
10270                         ;;
10271                 esac
10272         fi
10273         ;;
10274 esac
10275 case "$i16type" in
10276 '')     if $test $shortsize -ge 2; then
10277                 i16type=short
10278                 u16type="unsigned short"
10279                 i16size=$shortsize
10280                 u16size=$shortsize
10281         fi
10282         ;;
10283 esac
10284
10285 case "$i32type" in
10286 '')     case "$longsize" in
10287         4)      i32type=long
10288                 u32type="unsigned long"
10289                 i32size=$longsize
10290                 u32size=$longsize
10291                 ;;
10292         *)      case "$intsize" in
10293                 4)      i32type=int
10294                         u32type="unsigned int"
10295                         i32size=$intsize
10296                         u32size=$intsize
10297                         ;;
10298                 esac
10299                 ;;
10300         esac
10301         ;;
10302 esac
10303 case "$i32type" in
10304 '')     set try -DINT32
10305         if eval $compile; then
10306                 case "`./try$exe_ext`" in
10307                 int32_t)
10308                         i32type=int32_t
10309                         u32type=uint32_t
10310                         i32size=4
10311                         u32size=4
10312                         ;;
10313                 esac
10314         fi
10315         ;;
10316 esac
10317 case "$i32type" in
10318 '')     if $test $intsize -ge 4; then
10319                 i32type=int
10320                 u32type="unsigned int"
10321                 i32size=$intsize
10322                 u32size=$intsize
10323         fi
10324         ;;
10325 esac
10326
10327 case "$i64type" in
10328 '')     case "$d_quad:$quadtype" in
10329         define:?*)
10330                 i64type="$quadtype"
10331                 u64type="$uquadtype"
10332                 i64size=8
10333                 u64size=8
10334                 ;;
10335         esac
10336         ;;
10337 esac
10338
10339 $echo "Checking whether your NVs can preserve your UVs..." >&4
10340 $cat <<EOP >try.c
10341 #include <stdio.h>
10342 int main() {
10343     $uvtype k = ($uvtype)~0, l;
10344     $nvtype d;
10345     l = k;
10346     d = ($nvtype)l;
10347     l = ($uvtype)d;
10348     if (l == k)
10349        printf("preserve\n");
10350     exit(0);
10351 }
10352 EOP
10353 set try
10354 if eval $compile; then
10355         case "`./try$exe_ext`" in
10356         preserve) d_nv_preserves_uv="$define" ;;
10357         esac
10358 fi      
10359 case "$d_nv_preserves_uv" in
10360 $define) $echo "Yes, they can."  2>&1 ;;
10361 *)       $echo "No, they can't." 2>&1
10362          d_nv_preserves_uv="$undef"
10363          ;;
10364 esac
10365
10366 $rm -f try.* try
10367
10368 case "$d_nv_preserves_uv" in
10369 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10370 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10371         $cat <<EOP >try.c
10372 #include <stdio.h>
10373 int main() {
10374     $uvtype u = 0;
10375     int     n = 8 * $uvsize;
10376     int     i;
10377     for (i = 0; i < n; i++) {
10378       u = u << 1 | ($uvtype)1;
10379       if (($uvtype)($nvtype)u != u)
10380         break;
10381     }
10382     printf("%d\n", i);
10383     exit(0);
10384 }
10385 EOP
10386         set try
10387         if eval $compile; then
10388                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10389         fi
10390         case "$d_nv_preserves_uv_bits" in
10391         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10392         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10393                 d_nv_preserves_uv_bits="$undef"
10394                 ;;
10395         esac
10396         $rm -f try.* try
10397         ;;
10398 esac
10399
10400
10401
10402 : check for off64_t
10403 echo " "
10404 echo "Checking to see if you have off64_t..." >&4
10405 $cat >try.c <<EOCP
10406 #include <sys/types.h>
10407 #include <unistd.h>
10408 int main() { off64_t x = 7; }
10409 EOCP
10410 set try
10411 if eval $compile; then
10412         val="$define"
10413         echo "You have off64_t."
10414 else
10415         val="$undef"
10416         echo "You do not have off64_t."
10417         case "$lseeksize" in
10418         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10419         esac
10420 fi
10421 $rm -f try.* try
10422 set d_off64_t
10423 eval $setvar
10424
10425 : see if POSIX threads are available
10426 set pthread.h i_pthread
10427 eval $inhdr
10428
10429
10430
10431
10432 : how to create joinable pthreads
10433 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10434         echo " "
10435         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10436         $cat >try.c <<'EOCP'
10437 #include <pthread.h>
10438 int main() {
10439     int detachstate = JOINABLE;
10440 }
10441 EOCP
10442         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10443         if eval $compile; then
10444                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10445                 val="$undef" # Yes, undef.
10446                 set d_old_pthread_create_joinable
10447                 eval $setvar
10448                 val=""
10449                 set old_pthread_create_joinable
10450                 eval $setvar
10451         else
10452                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10453                 if eval $compile; then
10454                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10455                         val="$define"
10456                         set d_old_pthread_create_joinable
10457                         eval $setvar
10458                         val=PTHREAD_CREATE_UNDETACHED
10459                         set old_pthread_create_joinable
10460                         eval $setvar
10461                 else            
10462                         set try -DJOINABLE=__UNDETACHED
10463                         if eval $compile; then
10464                                 echo "You seem to use __UNDETACHED." >&4
10465                                 val="$define"
10466                                 set d_old_pthread_create_joinable
10467                                 eval $setvar
10468                                 val=__UNDETACHED
10469                                 set old_pthread_create_joinable
10470                                 eval $setvar
10471                         else
10472                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10473                                 val="$define"
10474                                 set d_old_pthread_create_joinable
10475                                 eval $setvar
10476                                 val=0
10477                                 set old_pthread_create_joinable
10478                                 eval $setvar
10479                         fi
10480                 fi
10481         fi
10482         $rm -f try try.*
10483 else
10484     d_old_pthread_create_joinable="$undef"
10485     old_pthread_create_joinable=""
10486 fi
10487
10488 : see if pause exists
10489 set pause d_pause
10490 eval $inlibc
10491
10492 : see if pipe exists
10493 set pipe d_pipe
10494 eval $inlibc
10495
10496 : see if poll exists
10497 set poll d_poll
10498 eval $inlibc
10499
10500
10501 : see whether the various POSIXish _yields exist
10502 $cat >try.c <<EOP
10503 #include <pthread.h>
10504 #include <stdio.h>
10505 int main() {
10506 #ifdef SCHED_YIELD
10507         sched_yield();
10508 #else
10509 #ifdef PTHREAD_YIELD
10510         pthread_yield();
10511 #else
10512 #ifdef PTHREAD_YIELD_NULL
10513         pthread_yield(NULL);
10514 #endif
10515 #endif
10516 #endif
10517 }
10518 EOP
10519 : see if sched_yield exists
10520 set try -DSCHED_YIELD
10521 if eval $compile; then
10522     val="$define"
10523     sched_yield='sched_yield()'
10524 else
10525     val="$undef"
10526 fi
10527 case "$usethreads" in
10528 $define)
10529         case "$val" in
10530         $define) echo 'sched_yield() found.' >&4        ;;
10531         *)       echo 'sched_yield() NOT found.' >&4    ;;
10532         esac
10533 esac
10534 set d_sched_yield
10535 eval $setvar
10536
10537 : see if pthread_yield exists
10538 set try -DPTHREAD_YIELD
10539 if eval $compile; then
10540     val="$define"
10541     case "$sched_yield" in
10542     '') sched_yield='pthread_yield()' ;;
10543     esac
10544 else
10545     set try -DPTHREAD_YIELD_NULL
10546     if eval $compile; then
10547         val="$define"
10548         case "$sched_yield" in
10549         '') sched_yield='pthread_yield(NULL)' ;;
10550         esac
10551     else
10552         val="$undef"
10553     fi
10554 fi
10555 case "$usethreads" in
10556 $define)
10557         case "$val" in
10558         $define) echo 'pthread_yield() found.' >&4      ;;
10559         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10560         esac
10561         ;;
10562 esac
10563 set d_pthread_yield
10564 eval $setvar
10565
10566 case "$sched_yield" in
10567 '') sched_yield=undef ;;
10568 esac
10569
10570 $rm -f try try.*
10571
10572 : see if this is a pwd.h system
10573 set pwd.h i_pwd
10574 eval $inhdr
10575
10576 case "$i_pwd" in
10577 $define)
10578         xxx=`./findhdr pwd.h`
10579         $cppstdin $cppflags $cppminus < $xxx >$$.h
10580
10581         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10582                 val="$define"
10583         else
10584                 val="$undef"
10585         fi
10586         set d_pwquota
10587         eval $setvar
10588
10589         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10590                 val="$define"
10591         else
10592                 val="$undef"
10593         fi
10594         set d_pwage
10595         eval $setvar
10596
10597         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10598                 val="$define"
10599         else
10600                 val="$undef"
10601         fi
10602         set d_pwchange
10603         eval $setvar
10604
10605         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10606                 val="$define"
10607         else
10608                 val="$undef"
10609         fi
10610         set d_pwclass
10611         eval $setvar
10612
10613         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10614                 val="$define"
10615         else
10616                 val="$undef"
10617         fi
10618         set d_pwexpire
10619         eval $setvar
10620
10621         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10622                 val="$define"
10623         else
10624                 val="$undef"
10625         fi
10626         set d_pwcomment
10627         eval $setvar
10628
10629         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10630                 val="$define"
10631         else
10632                 val="$undef"
10633         fi
10634         set d_pwgecos
10635         eval $setvar
10636
10637         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10638                 val="$define"
10639         else
10640                 val="$undef"
10641         fi
10642         set d_pwpasswd
10643         eval $setvar
10644
10645         $rm -f $$.h
10646         ;;
10647 *)
10648         val="$undef"; 
10649         set d_pwquota; eval $setvar
10650         set d_pwage; eval $setvar
10651         set d_pwchange; eval $setvar
10652         set d_pwclass; eval $setvar
10653         set d_pwexpire; eval $setvar
10654         set d_pwcomment; eval $setvar
10655         set d_pwgecos; eval $setvar
10656         set d_pwpasswd; eval $setvar
10657         ;;
10658 esac
10659
10660 : see if readdir and friends exist
10661 set readdir d_readdir
10662 eval $inlibc
10663 set seekdir d_seekdir
10664 eval $inlibc
10665 set telldir d_telldir
10666 eval $inlibc
10667 set rewinddir d_rewinddir
10668 eval $inlibc
10669
10670 : see if readlink exists
10671 set readlink d_readlink
10672 eval $inlibc
10673
10674 : see if rename exists
10675 set rename d_rename
10676 eval $inlibc
10677
10678 : see if rmdir exists
10679 set rmdir d_rmdir
10680 eval $inlibc
10681
10682 : see if memory.h is available.
10683 val=''
10684 set memory.h val
10685 eval $inhdr
10686
10687 : See if it conflicts with string.h
10688 case "$val" in
10689 $define)
10690         case "$strings" in
10691         '') ;;
10692         *)
10693                 $cppstdin $cppflags $cppminus < $strings > mem.h
10694                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10695                         echo " "
10696                         echo "We won't be including <memory.h>."
10697                         val="$undef"
10698                 fi
10699                 $rm -f mem.h
10700                 ;;
10701         esac
10702 esac
10703 set i_memory
10704 eval $setvar
10705
10706 : can bcopy handle overlapping blocks?
10707 val="$undef"
10708 case "$d_bcopy" in
10709 "$define")
10710         echo " "
10711         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10712         $cat >try.c <<EOCP
10713 #$i_memory I_MEMORY
10714 #$i_stdlib I_STDLIB
10715 #$i_string I_STRING
10716 #$i_unistd I_UNISTD
10717 EOCP
10718         $cat >>try.c <<'EOCP'
10719 #include <stdio.h>
10720 #ifdef I_MEMORY
10721 #  include <memory.h>
10722 #endif
10723 #ifdef I_STDLIB
10724 #  include <stdlib.h>
10725 #endif
10726 #ifdef I_STRING
10727 #  include <string.h>
10728 #else
10729 #  include <strings.h>
10730 #endif
10731 #ifdef I_UNISTD
10732 #  include <unistd.h>  /* Needed for NetBSD */
10733 #endif
10734 int main()
10735 {
10736 char buf[128], abc[128];
10737 char *b;
10738 int len;
10739 int off;
10740 int align;
10741
10742 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10743
10744 for (align = 7; align >= 0; align--) {
10745         for (len = 36; len; len--) {
10746                 b = buf+align;
10747                 bcopy(abc, b, len);
10748                 for (off = 1; off <= len; off++) {
10749                         bcopy(b, b+off, len);
10750                         bcopy(b+off, b, len);
10751                         if (bcmp(b, abc, len))
10752                                 exit(1);
10753                 }
10754         }
10755 }
10756 exit(0);
10757 }
10758 EOCP
10759         set try
10760         if eval $compile_ok; then
10761                 if ./try 2>/dev/null; then
10762                         echo "Yes, it can."
10763                         val="$define"
10764                 else
10765                         echo "It can't, sorry."
10766                         case "$d_memmove" in
10767                         "$define") echo "But that's Ok since you have memmove()." ;;
10768                         esac
10769                 fi
10770         else
10771                 echo "(I can't compile the test program, so we'll assume not...)"
10772                 case "$d_memmove" in
10773                 "$define") echo "But that's Ok since you have memmove()." ;;
10774                 esac
10775         fi
10776         ;;
10777 esac
10778 $rm -f try.* try core
10779 set d_safebcpy
10780 eval $setvar
10781
10782 : can memcpy handle overlapping blocks?
10783 val="$undef"
10784 case "$d_memcpy" in
10785 "$define")
10786         echo " "
10787         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10788         $cat >try.c <<EOCP
10789 #$i_memory I_MEMORY
10790 #$i_stdlib I_STDLIB
10791 #$i_string I_STRING
10792 #$i_unistd I_UNISTD
10793 EOCP
10794         $cat >>try.c <<'EOCP'
10795 #include <stdio.h>
10796 #ifdef I_MEMORY
10797 #  include <memory.h>
10798 #endif
10799 #ifdef I_STDLIB
10800 #  include <stdlib.h>
10801 #endif
10802 #ifdef I_STRING
10803 #  include <string.h>
10804 #else
10805 #  include <strings.h>
10806 #endif
10807 #ifdef I_UNISTD
10808 #  include <unistd.h>  /* Needed for NetBSD */
10809 #endif
10810 int main()
10811 {
10812 char buf[128], abc[128];
10813 char *b;
10814 int len;
10815 int off;
10816 int align;
10817
10818 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10819    try to store the string in read-only memory. */
10820 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10821
10822 for (align = 7; align >= 0; align--) {
10823         for (len = 36; len; len--) {
10824                 b = buf+align;
10825                 memcpy(b, abc, len);
10826                 for (off = 1; off <= len; off++) {
10827                         memcpy(b+off, b, len);
10828                         memcpy(b, b+off, len);
10829                         if (memcmp(b, abc, len))
10830                                 exit(1);
10831                 }
10832         }
10833 }
10834 exit(0);
10835 }
10836 EOCP
10837         set try
10838         if eval $compile_ok; then
10839                 if ./try 2>/dev/null; then
10840                         echo "Yes, it can."
10841                         val="$define"
10842                 else
10843                         echo "It can't, sorry."
10844                         case "$d_memmove" in
10845                         "$define") echo "But that's Ok since you have memmove()." ;;
10846                         esac
10847                 fi
10848         else
10849                 echo "(I can't compile the test program, so we'll assume not...)"
10850                 case "$d_memmove" in
10851                 "$define") echo "But that's Ok since you have memmove()." ;;
10852                 esac
10853         fi
10854         ;;
10855 esac
10856 $rm -f try.* try core
10857 set d_safemcpy
10858 eval $setvar
10859
10860 : can memcmp be trusted to compare relative magnitude?
10861 val="$undef"
10862 case "$d_memcmp" in
10863 "$define")
10864         echo " "
10865         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10866         $cat >try.c <<EOCP
10867 #$i_memory I_MEMORY
10868 #$i_stdlib I_STDLIB
10869 #$i_string I_STRING
10870 #$i_unistd I_UNISTD
10871 EOCP
10872         $cat >>try.c <<'EOCP'
10873 #include <stdio.h>
10874 #ifdef I_MEMORY
10875 #  include <memory.h>
10876 #endif
10877 #ifdef I_STDLIB
10878 #  include <stdlib.h>
10879 #endif
10880 #ifdef I_STRING
10881 #  include <string.h>
10882 #else
10883 #  include <strings.h>
10884 #endif
10885 #ifdef I_UNISTD
10886 #  include <unistd.h>  /* Needed for NetBSD */
10887 #endif
10888 int main()
10889 {
10890 char a = -1;
10891 char b = 0;
10892 if ((a < b) && memcmp(&a, &b, 1) < 0)
10893         exit(1);
10894 exit(0);
10895 }
10896 EOCP
10897         set try
10898         if eval $compile_ok; then
10899                 if ./try 2>/dev/null; then
10900                         echo "Yes, it can."
10901                         val="$define"
10902                 else
10903                         echo "No, it can't (it uses signed chars)."
10904                 fi
10905         else
10906                 echo "(I can't compile the test program, so we'll assume not...)"
10907         fi
10908         ;;
10909 esac
10910 $rm -f try.* try core
10911 set d_sanemcmp
10912 eval $setvar
10913
10914 : see if select exists
10915 set select d_select
10916 eval $inlibc
10917
10918 : see if semctl exists
10919 set semctl d_semctl
10920 eval $inlibc
10921
10922 : see if semget exists
10923 set semget d_semget
10924 eval $inlibc
10925
10926 : see if semop exists
10927 set semop d_semop
10928 eval $inlibc
10929
10930 : see how much of the 'sem*(2)' library is present.
10931 h_sem=true
10932 echo " "
10933 case "$d_semctl$d_semget$d_semop" in
10934 *"$undef"*) h_sem=false;;
10935 esac
10936 case "$osname" in
10937 freebsd)
10938     case "`ipcs 2>&1`" in
10939     "SVID messages"*"not configured"*)
10940         echo "Your $osname does not have the sem*(2) configured." >&4
10941         h_sem=false
10942         val="$undef"
10943         set semctl d_semctl
10944         eval $setvar
10945         set semget d_semget
10946         eval $setvar
10947         set semop d_semop
10948         eval $setvar
10949         ;;
10950     esac
10951     ;;
10952 esac
10953 : we could also check for sys/ipc.h ...
10954 if $h_sem && $test `./findhdr sys/sem.h`; then
10955         echo "You have the full sem*(2) library." >&4
10956         val="$define"
10957 else
10958         echo "You don't have the full sem*(2) library." >&4
10959         val="$undef"
10960 fi
10961 set d_sem
10962 eval $setvar
10963
10964 : see whether sys/sem.h defines union semun
10965 echo " "
10966 $cat > try.c <<'END'
10967 #include <sys/types.h>
10968 #include <sys/ipc.h>
10969 #include <sys/sem.h>
10970 int main () { union semun semun; semun.buf = 0; }
10971 END
10972 set try
10973 if eval $compile; then
10974     echo "You have union semun in <sys/sem.h>." >&4
10975     val="$define"
10976 else
10977     echo "You do not have union semun in <sys/sem.h>." >&4
10978     val="$undef"
10979 fi
10980 $rm -f try try.c try.h
10981 set d_union_semun
10982 eval $setvar
10983
10984 : see how to do semctl IPC_STAT
10985 case "$d_sem" in
10986 $define)
10987     : see whether semctl IPC_STAT can use union semun
10988     echo " "
10989     $cat > try.h <<END
10990 #ifndef S_IRUSR
10991 #   ifdef S_IREAD
10992 #       define S_IRUSR S_IREAD
10993 #       define S_IWUSR S_IWRITE
10994 #       define S_IXUSR S_IEXEC
10995 #   else
10996 #       define S_IRUSR 0400
10997 #       define S_IWUSR 0200
10998 #       define S_IXUSR 0100
10999 #   endif
11000 #   define S_IRGRP (S_IRUSR>>3)
11001 #   define S_IWGRP (S_IWUSR>>3)
11002 #   define S_IXGRP (S_IXUSR>>3)
11003 #   define S_IROTH (S_IRUSR>>6)
11004 #   define S_IWOTH (S_IWUSR>>6)
11005 #   define S_IXOTH (S_IXUSR>>6)
11006 #endif
11007 #ifndef S_IRWXU
11008 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11009 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11010 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11011 #endif
11012 END
11013
11014     $cat > try.c <<END
11015 #include <sys/types.h>
11016 #include <sys/ipc.h>
11017 #include <sys/sem.h>
11018 #include <sys/stat.h>
11019 #include <stdio.h>
11020 #include <errno.h>
11021 #include "try.h"
11022 #ifndef errno
11023 extern int errno;
11024 #endif
11025 #$d_union_semun HAS_UNION_SEMUN
11026 int main() {
11027     union semun
11028 #ifndef HAS_UNION_SEMUN
11029     {
11030         int val;
11031         struct semid_ds *buf;
11032         unsigned short *array;
11033     }
11034 #endif
11035     arg;
11036     int sem, st;
11037
11038 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11039     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11040     if (sem > -1) {
11041         struct semid_ds argbuf;
11042         arg.buf = &argbuf;
11043 #       ifdef IPC_STAT
11044         st = semctl(sem, 0, IPC_STAT, arg);
11045         if (st == 0)
11046             printf("semun\n");
11047         else
11048 #       endif /* IPC_STAT */
11049             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11050 #       ifdef IPC_RMID
11051         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11052 #       endif /* IPC_RMID */
11053             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11054     } else
11055 #endif /* IPC_PRIVATE && ... */
11056         printf("semget failed: errno = %d\n", errno);
11057   return 0;
11058 }
11059 END
11060     val="$undef"
11061     set try
11062     if eval $compile; then
11063         xxx=`./try`
11064         case "$xxx" in
11065         semun) val="$define" ;;
11066         esac
11067     fi
11068     $rm -f try try.c
11069     set d_semctl_semun
11070     eval $setvar
11071     case "$d_semctl_semun" in
11072     $define)
11073         echo "You can use union semun for semctl IPC_STAT." >&4
11074         also='also'
11075         ;;
11076     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11077         also=''
11078         ;;
11079     esac
11080
11081     : see whether semctl IPC_STAT can use struct semid_ds pointer
11082     $cat > try.c <<'END'
11083 #include <sys/types.h>
11084 #include <sys/ipc.h>
11085 #include <sys/sem.h>
11086 #include <sys/stat.h>
11087 #include "try.h"
11088 #include <stdio.h>
11089 #include <errno.h>
11090 #ifndef errno
11091 extern int errno;
11092 #endif
11093 int main() {
11094     struct semid_ds arg;
11095     int sem, st;
11096
11097 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11098     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11099     if (sem > -1) {
11100 #       ifdef IPC_STAT
11101         st = semctl(sem, 0, IPC_STAT, &arg);
11102         if (st == 0)
11103             printf("semid_ds\n");
11104         else
11105 #       endif /* IPC_STAT */
11106             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11107 #       ifdef IPC_RMID
11108         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11109 #       endif /* IPC_RMID */
11110             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11111     } else
11112 #endif /* IPC_PRIVATE && ... */
11113         printf("semget failed: errno = %d\n", errno);
11114
11115     return 0;
11116 }
11117 END
11118     val="$undef"
11119     set try
11120     if eval $compile; then
11121         xxx=`./try`
11122         case "$xxx" in
11123         semid_ds) val="$define" ;;
11124         esac
11125     fi
11126     $rm -f try try.c
11127     set d_semctl_semid_ds
11128     eval $setvar
11129     case "$d_semctl_semid_ds" in
11130     $define)
11131         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11132         ;;
11133     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11134         ;;
11135     esac
11136     $rm -f try.h
11137     ;;
11138 *)  val="$undef"
11139
11140     # We do not have the full sem*(2) library, so assume we can not
11141     # use either.
11142
11143     set d_semctl_semun
11144     eval $setvar
11145
11146     set d_semctl_semid_ds
11147     eval $setvar
11148     ;;
11149 esac
11150
11151 : see if setegid exists
11152 set setegid d_setegid
11153 eval $inlibc
11154
11155 : see if seteuid exists
11156 set seteuid d_seteuid
11157 eval $inlibc
11158
11159 : see if setgrent exists
11160 set setgrent d_setgrent
11161 eval $inlibc
11162
11163 : see if sethostent exists
11164 set sethostent d_sethent
11165 eval $inlibc
11166
11167 : see if setlinebuf exists
11168 set setlinebuf d_setlinebuf
11169 eval $inlibc
11170
11171 : see if setlocale exists
11172 set setlocale d_setlocale
11173 eval $inlibc
11174
11175 : see if setnetent exists
11176 set setnetent d_setnent
11177 eval $inlibc
11178
11179 : see if setprotoent exists
11180 set setprotoent d_setpent
11181 eval $inlibc
11182
11183 : see if setpgid exists
11184 set setpgid d_setpgid
11185 eval $inlibc
11186
11187 : see if setpgrp2 exists
11188 set setpgrp2 d_setpgrp2
11189 eval $inlibc
11190
11191 : see if setpriority exists
11192 set setpriority d_setprior
11193 eval $inlibc
11194
11195 : see if setproctitle exists
11196 set setproctitle d_setproctitle
11197 eval $inlibc
11198
11199 : see if setpwent exists
11200 set setpwent d_setpwent
11201 eval $inlibc
11202
11203 : see if setregid exists
11204 set setregid d_setregid
11205 eval $inlibc
11206 set setresgid d_setresgid
11207 eval $inlibc
11208
11209 : see if setreuid exists
11210 set setreuid d_setreuid
11211 eval $inlibc
11212 set setresuid d_setresuid
11213 eval $inlibc
11214
11215 : see if setrgid exists
11216 set setrgid d_setrgid
11217 eval $inlibc
11218
11219 : see if setruid exists
11220 set setruid d_setruid
11221 eval $inlibc
11222
11223 : see if setservent exists
11224 set setservent d_setsent
11225 eval $inlibc
11226
11227 : see if setsid exists
11228 set setsid d_setsid
11229 eval $inlibc
11230
11231 : see if setvbuf exists
11232 set setvbuf d_setvbuf
11233 eval $inlibc
11234
11235 : see if sfio.h is available
11236 set sfio.h i_sfio
11237 eval $inhdr
11238
11239
11240 : see if sfio library is available
11241 case "$i_sfio" in
11242 $define)
11243         val=''
11244         set sfreserve val
11245         eval $inlibc
11246         ;;
11247 *)
11248         val="$undef"
11249         ;;
11250 esac
11251 : Ok, but do we want to use it.
11252 case "$val" in
11253 $define)
11254         case "$usesfio" in
11255         true|$define|[yY]*) dflt='y';;
11256         *) dflt='n';;
11257         esac
11258         echo "$package can use the sfio library, but it is experimental."
11259         rp="You seem to have sfio available, do you want to try using it?"
11260         . ./myread
11261         case "$ans" in
11262         y|Y) ;;
11263         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11264                 val="$undef"
11265                 : Remove sfio from list of libraries to use
11266                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11267                 shift
11268                 libs="$*"
11269                 echo "libs = $libs" >&4
11270                 ;;
11271         esac
11272         ;;
11273 *)      case "$usesfio" in
11274         true|$define|[yY]*)
11275                 echo "Sorry, cannot find sfio on this machine" >&4
11276                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11277                 ;;
11278         esac
11279         ;;
11280 esac
11281 set d_sfio
11282 eval $setvar
11283 case "$d_sfio" in
11284 $define) usesfio='true';;
11285 *) usesfio='false';;
11286 esac
11287
11288 : see if shmctl exists
11289 set shmctl d_shmctl
11290 eval $inlibc
11291
11292 : see if shmget exists
11293 set shmget d_shmget
11294 eval $inlibc
11295
11296 : see if shmat exists
11297 set shmat d_shmat
11298 eval $inlibc
11299 : see what shmat returns
11300 case "$d_shmat" in
11301 "$define")
11302         $cat >shmat.c <<'END'
11303 #include <sys/shm.h>
11304 void *shmat();
11305 END
11306         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11307                 shmattype='void *'
11308         else
11309                 shmattype='char *'
11310         fi
11311         echo "and it returns ($shmattype)." >&4
11312         : see if a prototype for shmat is available
11313         xxx=`./findhdr sys/shm.h`
11314         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11315         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11316                 val="$define"
11317         else
11318                 val="$undef"
11319         fi
11320         $rm -f shmat.[co]
11321         ;;
11322 *)
11323         val="$undef"
11324         ;;
11325 esac
11326 set d_shmatprototype
11327 eval $setvar
11328
11329 : see if shmdt exists
11330 set shmdt d_shmdt
11331 eval $inlibc
11332
11333 : see how much of the 'shm*(2)' library is present.
11334 h_shm=true
11335 echo " "
11336 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11337 *"$undef"*) h_shm=false;;
11338 esac
11339 case "$osname" in
11340 freebsd)
11341     case "`ipcs 2>&1`" in
11342     "SVID shared memory"*"not configured"*)
11343         echo "Your $osname does not have the shm*(2) configured." >&4
11344         h_shm=false
11345         val="$undef"
11346         set shmctl d_shmctl
11347         evat $setvar
11348         set shmget d_shmget
11349         evat $setvar
11350         set shmat d_shmat
11351         evat $setvar
11352         set shmdt d_shmdt
11353         evat $setvar
11354         ;;
11355     esac
11356     ;;
11357 esac
11358 : we could also check for sys/ipc.h ...
11359 if $h_shm && $test `./findhdr sys/shm.h`; then
11360         echo "You have the full shm*(2) library." >&4
11361         val="$define"
11362 else
11363         echo "You don't have the full shm*(2) library." >&4
11364         val="$undef"
11365 fi
11366 set d_shm
11367 eval $setvar
11368
11369 echo " "
11370 : see if we have sigaction
11371 if set sigaction val -f d_sigaction; eval $csym; $val; then
11372         echo 'sigaction() found.' >&4
11373         $cat > try.c <<'EOP'
11374 #include <stdio.h>
11375 #include <sys/types.h>
11376 #include <signal.h>
11377 int main()
11378 {
11379     struct sigaction act, oact;
11380     act.sa_flags = 0;
11381     oact.sa_handler = 0;
11382     /* so that act and oact are used */
11383     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11384 }
11385 EOP
11386         set try
11387         if eval $compile_ok; then
11388                 val="$define"
11389         else
11390                 echo "But you don't seem to have a useable struct sigaction." >&4
11391                 val="$undef"
11392         fi
11393 else
11394         echo 'sigaction NOT found.' >&4
11395         val="$undef"
11396 fi
11397 set d_sigaction; eval $setvar
11398 $rm -f try try$_o try.c
11399
11400 : see if sigsetjmp exists
11401 echo " "
11402 case "$d_sigsetjmp" in
11403 '')
11404         $cat >try.c <<'EOP'
11405 #include <setjmp.h>
11406 sigjmp_buf env;
11407 int set = 1;
11408 int main()
11409 {
11410         if (sigsetjmp(env,1))
11411                 exit(set);
11412         set = 0;
11413         siglongjmp(env, 1);
11414         exit(1);
11415 }
11416 EOP
11417         set try
11418         if eval $compile; then
11419                 if ./try >/dev/null 2>&1; then
11420                         echo "POSIX sigsetjmp found." >&4
11421                         val="$define"
11422                 else
11423                         $cat >&4 <<EOM
11424 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11425 I'll ignore them.
11426 EOM
11427                         val="$undef"
11428                 fi
11429         else
11430                 echo "sigsetjmp not found." >&4
11431                 val="$undef"
11432         fi
11433         ;;
11434 *) val="$d_sigsetjmp"
11435         case "$d_sigsetjmp" in
11436         $define) echo "POSIX sigsetjmp found." >&4;;
11437         $undef) echo "sigsetjmp not found." >&4;;
11438         esac
11439         ;;
11440 esac
11441 set d_sigsetjmp
11442 eval $setvar
11443 $rm -f try.c try
11444
11445 : see if socks5_init exists
11446 set socks5_init d_socks5_init
11447 eval $inlibc
11448
11449 : see if sys/stat.h is available
11450 set sys/stat.h i_sysstat
11451 eval $inhdr
11452
11453
11454 : see if stat knows about block sizes
11455 echo " "
11456 echo "Checking to see if your struct stat has st_blocks field..." >&4
11457 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11458 eval $hasfield
11459
11460
11461 : see if this is a sys/vfs.h system
11462 set sys/vfs.h i_sysvfs
11463 eval $inhdr
11464
11465
11466 : see if this is a sys/statfs.h system
11467 set sys/statfs.h i_sysstatfs
11468 eval $inhdr
11469
11470
11471 echo " "
11472 echo "Checking to see if your system supports struct statfs..." >&4
11473 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
11474 eval $hasstruct
11475 case "$d_statfs_s" in
11476 "$define")      echo "Yes, it does."   ;;
11477 *)              echo "No, it doesn't." ;;
11478 esac
11479
11480
11481
11482 : see if struct statfs knows about f_flags
11483 case "$d_statfs_s" in
11484 define) 
11485         echo " "
11486         echo "Checking to see if your struct statfs has f_flags field..." >&4
11487         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
11488         eval $hasfield
11489         ;;
11490 *)      val="$undef"
11491         set d_statfs_f_flags
11492         eval $setvar
11493         ;;
11494 esac
11495 case "$d_statfs_f_flags" in
11496 "$define")      echo "Yes, it does."   ;;
11497 *)              echo "No, it doesn't." ;;
11498 esac
11499
11500 : see if _ptr and _cnt from stdio act std
11501 echo " "
11502 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11503         echo "(Looks like you have stdio.h from Linux.)"
11504         case "$stdio_ptr" in
11505         '') stdio_ptr='((fp)->_IO_read_ptr)'
11506                 ptr_lval=$define
11507                 ;;
11508         *)      ptr_lval=$d_stdio_ptr_lval;;
11509         esac
11510         case "$stdio_cnt" in
11511         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11512                 cnt_lval=$undef
11513                 ;;
11514         *)      cnt_lval=$d_stdio_cnt_lval;;
11515         esac
11516         case "$stdio_base" in
11517         '') stdio_base='((fp)->_IO_read_base)';;
11518         esac
11519         case "$stdio_bufsiz" in
11520         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11521         esac
11522 else
11523         case "$stdio_ptr" in
11524         '') stdio_ptr='((fp)->_ptr)'
11525                 ptr_lval=$define
11526                 ;;
11527         *)      ptr_lval=$d_stdio_ptr_lval;;
11528         esac
11529         case "$stdio_cnt" in
11530         '') stdio_cnt='((fp)->_cnt)'
11531                 cnt_lval=$define
11532                 ;;
11533         *)      cnt_lval=$d_stdio_cnt_lval;;
11534         esac
11535         case "$stdio_base" in
11536         '') stdio_base='((fp)->_base)';;
11537         esac
11538         case "$stdio_bufsiz" in
11539         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11540         esac
11541 fi
11542 : test whether _ptr and _cnt really work
11543 echo "Checking how std your stdio is..." >&4
11544 $cat >try.c <<EOP
11545 #include <stdio.h>
11546 #define FILE_ptr(fp)    $stdio_ptr
11547 #define FILE_cnt(fp)    $stdio_cnt
11548 int main() {
11549         FILE *fp = fopen("try.c", "r");
11550         char c = getc(fp);
11551         if (
11552                 18 <= FILE_cnt(fp) &&
11553                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11554         )
11555                 exit(0);
11556         exit(1);
11557 }
11558 EOP
11559 val="$undef"
11560 set try
11561 if eval $compile; then
11562         if ./try; then
11563                 echo "Your stdio acts pretty std."
11564                 val="$define"
11565         else
11566                 echo "Your stdio isn't very std."
11567         fi
11568 else
11569         echo "Your stdio doesn't appear very std."
11570 fi
11571 $rm -f try.c try
11572 set d_stdstdio
11573 eval $setvar
11574
11575 : Can _ptr be used as an lvalue?
11576 case "$d_stdstdio$ptr_lval" in
11577 $define$define) val=$define ;;
11578 *) val=$undef ;;
11579 esac
11580 set d_stdio_ptr_lval
11581 eval $setvar
11582
11583 : Can _cnt be used as an lvalue?
11584 case "$d_stdstdio$cnt_lval" in
11585 $define$define) val=$define ;;
11586 *) val=$undef ;;
11587 esac
11588 set d_stdio_cnt_lval
11589 eval $setvar
11590
11591 : see if _base is also standard
11592 val="$undef"
11593 case "$d_stdstdio" in
11594 $define)
11595         $cat >try.c <<EOP
11596 #include <stdio.h>
11597 #define FILE_base(fp)   $stdio_base
11598 #define FILE_bufsiz(fp) $stdio_bufsiz
11599 int main() {
11600         FILE *fp = fopen("try.c", "r");
11601         char c = getc(fp);
11602         if (
11603                 19 <= FILE_bufsiz(fp) &&
11604                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11605         )
11606                 exit(0);
11607         exit(1);
11608 }
11609 EOP
11610         set try
11611         if eval $compile; then
11612                 if ./try; then
11613                         echo "And its _base field acts std."
11614                         val="$define"
11615                 else
11616                         echo "But its _base field isn't std."
11617                 fi
11618         else
11619                 echo "However, it seems to be lacking the _base field."
11620         fi
11621         $rm -f try.c try
11622         ;;
11623 esac
11624 set d_stdiobase
11625 eval $setvar
11626
11627 $cat >&4 <<EOM
11628 Checking how to access stdio streams by file descriptor number...
11629 EOM
11630 case "$stdio_stream_array" in
11631 '')     $cat >try.c <<EOCP
11632 #include <stdio.h>
11633 int main() {
11634   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11635     printf("yes\n");
11636 }
11637 EOCP
11638         for s in _iob __iob __sF
11639         do
11640                 set try -DSTDIO_STREAM_ARRAY=$s
11641                 if eval $compile; then
11642                         case "`./try$exe_ext`" in
11643                         yes)    stdio_stream_array=$s; break ;;
11644                         esac
11645                 fi
11646         done
11647         $rm -f try.* try$exe_ext
11648 esac
11649 case "$stdio_stream_array" in
11650 '')     $cat >&4 <<EOM
11651 I can't figure out how to access stdio streams by file descriptor number.
11652 EOM
11653         d_stdio_stream_array="$undef"
11654         ;;
11655 *)      $cat >&4 <<EOM
11656 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11657 EOM
11658         d_stdio_stream_array="$define"
11659         ;;
11660 esac
11661
11662 : see if strcoll exists
11663 set strcoll d_strcoll
11664 eval $inlibc
11665
11666 : check for structure copying
11667 echo " "
11668 echo "Checking to see if your C compiler can copy structs..." >&4
11669 $cat >try.c <<'EOCP'
11670 int main()
11671 {
11672         struct blurfl {
11673                 int dyick;
11674         } foo, bar;
11675
11676         foo = bar;
11677 }
11678 EOCP
11679 if $cc -c try.c >/dev/null 2>&1 ; then
11680         val="$define"
11681         echo "Yup, it can."
11682 else
11683         val="$undef"
11684         echo "Nope, it can't."
11685 fi
11686 set d_strctcpy
11687 eval $setvar
11688 $rm -f try.*
11689
11690 : see if strerror and/or sys_errlist[] exist
11691 echo " "
11692 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11693     if set strerror val -f d_strerror; eval $csym; $val; then
11694                 echo 'strerror() found.' >&4
11695                 d_strerror="$define"
11696                 d_strerrm='strerror(e)'
11697                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11698                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11699                         d_syserrlst="$define"
11700                 else
11701                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11702                         d_syserrlst="$undef"
11703                 fi
11704     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11705                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11706                 echo 'strerror() found in string header.' >&4
11707                 d_strerror="$define"
11708                 d_strerrm='strerror(e)'
11709                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11710                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11711                                 d_syserrlst="$define"
11712                 else
11713                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11714                         d_syserrlst="$undef"
11715                 fi
11716     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11717                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11718                 d_strerror="$undef"
11719                 d_syserrlst="$define"
11720                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11721     else
11722                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11723                 d_strerror="$undef"
11724                 d_syserrlst="$undef"
11725                 d_strerrm='"unknown"'
11726     fi
11727 fi
11728
11729 : see if strtod exists
11730 set strtod d_strtod
11731 eval $inlibc
11732
11733 : see if strtol exists
11734 set strtol d_strtol
11735 eval $inlibc
11736
11737 : see if strtold exists
11738 set strtold d_strtold
11739 eval $inlibc
11740
11741 : see if strtoll exists
11742 set strtoll d_strtoll
11743 eval $inlibc
11744
11745 case "$d_longlong-$d_strtoll" in
11746 "$define-$define")
11747         $cat <<EOM
11748 Checking whether your strtoll() works okay...
11749 EOM
11750         $cat >try.c <<'EOCP'
11751 #include <errno.h>
11752 #ifdef __hpux
11753 #define strtoll __strtoll
11754 #endif
11755 #include <stdio.h>
11756 extern long long int strtoll(char *s, char **, int); 
11757 static int bad = 0;
11758 int check(char *s, long long ell, int een) {
11759         long long gll;
11760         errno = 0;
11761         gll = strtoll(s, 0, 10);
11762         if (!((gll == ell) && (errno == een)))
11763                 bad++;
11764 }
11765 int main() {
11766         check(" 1",                                      1LL, 0);
11767         check(" 0",                                      0LL, 0);
11768         check("-1",                                     -1LL, 0);
11769         check("-9223372036854775808", -9223372036854775808LL, 0);
11770         check("-9223372036854775808", -9223372036854775808LL, 0);
11771         check(" 9223372036854775807",  9223372036854775807LL, 0);
11772         check("-9223372036854775808", -9223372036854775808LL, 0);
11773         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11774         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11775         if (!bad)
11776                 printf("ok\n");
11777 }
11778 EOCP
11779         set try
11780         if eval $compile; then
11781                 case "`./try`" in
11782                 ok) echo "Your strtoll() seems to be working okay." ;;
11783                 *) cat <<EOM >&4
11784 Your strtoll() doesn't seem to be working okay.
11785 EOM
11786                    d_strtoll="$undef"
11787                    ;;
11788                 esac
11789         fi
11790         ;;
11791 esac
11792
11793 : see if strtoul exists
11794 set strtoul d_strtoul
11795 eval $inlibc
11796
11797 : see if strtoull exists
11798 set strtoull d_strtoull
11799 eval $inlibc
11800
11801 case "$d_longlong-$d_strtoull" in
11802 "$define-$define")
11803         $cat <<EOM
11804 Checking whether your strtoull() works okay...
11805 EOM
11806         $cat >try.c <<'EOCP'
11807 #include <errno.h>
11808 #ifdef __hpux
11809 #define strtoull __strtoull
11810 #endif
11811 #include <stdio.h>
11812 extern unsigned long long int strtoull(char *s, char **, int); 
11813 static int bad = 0;
11814 int check(char *s, long long eull, int een) {
11815         long long gull;
11816         errno = 0;
11817         gull = strtoull(s, 0, 10);
11818         if (!((gull == eull) && (errno == een)))
11819                 bad++;
11820 }
11821 int main() {
11822         check(" 1",                                       1LL, 0);
11823         check(" 0",                                       0LL, 0);
11824         check("18446744073709551615", 18446744073709551615ULL, 0);
11825         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11826         if (!bad)
11827                 printf("ok\n");
11828 }
11829 EOCP
11830         set try
11831         if eval $compile; then
11832                 case "`./try`" in
11833                 ok) echo "Your strtoull() seems to be working okay." ;;
11834                 *) cat <<EOM >&4
11835 Your strtoull() doesn't seem to be working okay.
11836 EOM
11837                    d_strtoull="$undef"
11838                    ;;
11839                 esac
11840         fi
11841         ;;
11842 esac
11843
11844 : see if strtouq exists
11845 set strtouq d_strtouq
11846 eval $inlibc
11847
11848 : see if strxfrm exists
11849 set strxfrm d_strxfrm
11850 eval $inlibc
11851
11852 : see if symlink exists
11853 set symlink d_symlink
11854 eval $inlibc
11855
11856 : see if syscall exists
11857 set syscall d_syscall
11858 eval $inlibc
11859
11860 : see if sysconf exists
11861 set sysconf d_sysconf
11862 eval $inlibc
11863
11864 : see if system exists
11865 set system d_system
11866 eval $inlibc
11867
11868 : see if tcgetpgrp exists
11869 set tcgetpgrp d_tcgetpgrp
11870 eval $inlibc
11871
11872 : see if tcsetpgrp exists
11873 set tcsetpgrp d_tcsetpgrp
11874 eval $inlibc
11875
11876 : see if prototype for telldir is available
11877 echo " "
11878 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11879 eval $hasproto
11880
11881 : see if this is a sys/times.h system
11882 set sys/times.h i_systimes
11883 eval $inhdr
11884
11885 : see if times exists
11886 echo " "
11887 if set times val -f d_times; eval $csym; $val; then
11888         echo 'times() found.' >&4
11889         d_times="$define"
11890         inc=''
11891         case "$i_systimes" in
11892         "$define") inc='sys/times.h';;
11893         esac
11894         rp="What is the type returned by times() on this system?"
11895         set clock_t clocktype long stdio.h sys/types.h $inc
11896         eval $typedef_ask
11897 else
11898         echo 'times() NOT found, hope that will do.' >&4
11899         d_times="$undef"
11900         clocktype='int'
11901 fi
11902
11903 : see if truncate exists
11904 set truncate d_truncate
11905 eval $inlibc
11906
11907 : see if tzname[] exists
11908 echo " "
11909 if set tzname val -a d_tzname; eval $csym; $val; then
11910         val="$define"
11911         echo 'tzname[] found.' >&4
11912 else
11913         val="$undef"
11914         echo 'tzname[] NOT found.' >&4
11915 fi
11916 set d_tzname
11917 eval $setvar
11918
11919 : see if umask exists
11920 set umask d_umask
11921 eval $inlibc
11922
11923 : see if ustat exists
11924 set ustat d_ustat
11925 eval $inlibc
11926
11927 : backward compatibility for d_hvfork
11928 if test X$d_hvfork != X; then
11929         d_vfork="$d_hvfork"
11930         d_hvfork=''
11931 fi
11932 : see if there is a vfork
11933 val=''
11934 set vfork val
11935 eval $inlibc
11936
11937 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11938 : perl on Solaris 2.x, and probably elsewhere.
11939 case "$val" in
11940 $define)
11941         echo " "
11942         case "$usevfork" in
11943         false) dflt='n';;
11944         *) dflt='y';;
11945         esac
11946         cat <<'EOM'
11947  
11948 Perl can only use a vfork() that doesn't suffer from strict
11949 restrictions on calling functions or modifying global data in
11950 the child.  For example, glibc-2.1 contains such a vfork()
11951 that is unsuitable.  If your system provides a proper fork()
11952 call, chances are that you do NOT want perl to use vfork().
11953
11954 EOM
11955         rp="Do you still want to use vfork()?"
11956         . ./myread
11957         case "$ans" in
11958         y|Y) ;;
11959         *)
11960                 echo "Ok, we won't use vfork()."
11961                 val="$undef"
11962                 ;;
11963         esac
11964         ;;
11965 esac
11966 set d_vfork
11967 eval $setvar
11968 case "$d_vfork" in
11969 $define) usevfork='true';;
11970 *) usevfork='false';;
11971 esac
11972
11973 : see if this is an sysdir system
11974 set sys/dir.h i_sysdir
11975 eval $inhdr
11976
11977 : see if this is an sysndir system
11978 set sys/ndir.h i_sysndir
11979 eval $inhdr
11980
11981 : see if closedir exists
11982 set closedir d_closedir
11983 eval $inlibc
11984
11985 case "$d_closedir" in
11986 "$define")
11987         echo " "
11988         echo "Checking whether closedir() returns a status..." >&4
11989         cat > closedir.c <<EOM
11990 #$i_dirent I_DIRENT             /**/
11991 #$i_sysdir I_SYS_DIR            /**/
11992 #$i_sysndir I_SYS_NDIR          /**/
11993 #$i_systypes I_SYS_TYPES        /**/
11994
11995 #if defined(I_SYS_TYPES)
11996 #include <sys/types.h>
11997 #endif
11998 #if defined(I_DIRENT)
11999 #include <dirent.h>
12000 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12001 #include <sys/dir.h>
12002 #endif
12003 #else
12004 #ifdef I_SYS_NDIR
12005 #include <sys/ndir.h>
12006 #else
12007 #ifdef I_SYS_DIR
12008 #ifdef hp9000s500
12009 #include <ndir.h>       /* may be wrong in the future */
12010 #else
12011 #include <sys/dir.h>
12012 #endif
12013 #endif
12014 #endif
12015 #endif 
12016 int main() { return closedir(opendir(".")); }
12017 EOM
12018         set closedir
12019         if eval $compile_ok; then
12020                 if ./closedir > /dev/null 2>&1 ; then
12021                         echo "Yes, it does."
12022                         val="$undef"
12023                 else
12024                         echo "No, it doesn't."
12025                         val="$define"
12026                 fi
12027         else
12028                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12029                 val="$define"
12030         fi
12031         ;;
12032 *)
12033         val="$undef";
12034         ;;
12035 esac
12036 set d_void_closedir
12037 eval $setvar
12038 $rm -f closedir*
12039 : check for volatile keyword
12040 echo " "
12041 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12042 $cat >try.c <<'EOCP'
12043 int main()
12044 {
12045         typedef struct _goo_struct goo_struct;
12046         goo_struct * volatile goo = ((goo_struct *)0);
12047         struct _goo_struct {
12048                 long long_int;
12049                 int reg_int;
12050                 char char_var;
12051         };
12052         typedef unsigned short foo_t;
12053         char *volatile foo;
12054         volatile int bar;
12055         volatile foo_t blech;
12056         foo = foo;
12057 }
12058 EOCP
12059 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12060         val="$define"
12061         echo "Yup, it does."
12062 else
12063         val="$undef"
12064         echo "Nope, it doesn't."
12065 fi
12066 set d_volatile
12067 eval $setvar
12068 $rm -f try.*
12069
12070 : see if there is a wait4
12071 set wait4 d_wait4
12072 eval $inlibc
12073
12074 : see if waitpid exists
12075 set waitpid d_waitpid
12076 eval $inlibc
12077
12078 : see if wcstombs exists
12079 set wcstombs d_wcstombs
12080 eval $inlibc
12081
12082 : see if wctomb exists
12083 set wctomb d_wctomb
12084 eval $inlibc
12085
12086 : preserve RCS keywords in files with variable substitution, grrr
12087 Date='$Date'
12088 Id='$Id'
12089 Log='$Log'
12090 RCSfile='$RCSfile'
12091 Revision='$Revision'
12092
12093 case "$crosscompile" in
12094 ''|[nN]*) crosscompile="$undef" ;;
12095 esac
12096
12097 case "$osname" in
12098 next|rhapsody|darwin) multiarch="$define" ;;
12099 esac
12100 case "$multiarch" in
12101 ''|[nN]*) multiarch="$undef" ;;
12102 esac
12103
12104 : check for alignment requirements
12105 echo " "
12106 case "$crosscompile$multiarch" in
12107 *$define*)
12108         $cat <<EOM
12109 You seem to be either cross-compiling or doing a multiarchitecture build,
12110 skipping the memory alignment check.
12111
12112 EOM
12113         case "$alignbytes" in
12114         '') alignbytes=8 ;;
12115         esac
12116         ;;
12117 *)
12118         case "$alignbytes" in
12119         '') echo "Checking alignment constraints..." >&4
12120                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12121                         $cat >try.c <<'EOCP'
12122 typedef long double NV;
12123 EOCP
12124                 else
12125                         $cat >try.c <<'EOCP'
12126 typedef double NV;
12127 EOCP
12128                 fi
12129                 $cat >>try.c <<'EOCP'
12130 #include <stdio.h>
12131 struct foobar {
12132         char foo;
12133         NV bar;
12134 } try_algn;
12135 int main()
12136 {
12137     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12138     return(0);
12139 }
12140 EOCP
12141                 set try
12142                 if eval $compile_ok; then
12143                         dflt=`./try`
12144                 else
12145                         dflt='8'
12146                         echo "(I can't seem to compile the test program...)"
12147                 fi
12148                 ;;
12149         *) dflt="$alignbytes"
12150                 ;;
12151         esac
12152         rp="Doubles must be aligned on a how-many-byte boundary?"
12153         . ./myread
12154         alignbytes="$ans"
12155         $rm -f try.c try
12156         ;;
12157 esac
12158
12159
12160 : set the base revision
12161 baserev=5.0
12162
12163 : check for ordering of bytes in a long
12164 echo " "
12165 case "$crosscompile$multiarch" in
12166 *$define*)
12167         $cat <<EOM
12168 You seem to be either cross-compiling or doing a multiarchitecture build,
12169 skipping the byteorder check.
12170
12171 EOM
12172         byteorder='0xffff'
12173         ;;
12174 *)
12175         case "$byteorder" in
12176         '')
12177                 $cat <<'EOM'
12178 In the following, larger digits indicate more significance.  A big-endian
12179 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12180 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12181 machines may have weird orders like 3412.  A Cray will report 87654321,
12182 an Alpha will report 12345678. If the test program works the default is
12183 probably right.
12184 I'm now running the test program...
12185 EOM
12186                 $cat >try.c <<'EOCP'
12187 #include <stdio.h>
12188 int main()
12189 {
12190         int i;
12191         union {
12192                 unsigned long l;
12193                 char c[sizeof(long)];
12194         } u;
12195
12196         if (sizeof(long) > 4)
12197                 u.l = (0x08070605L << 32) | 0x04030201L;
12198         else
12199                 u.l = 0x04030201L;
12200         for (i = 0; i < sizeof(long); i++)
12201                 printf("%c", u.c[i]+'0');
12202         printf("\n");
12203         exit(0);
12204 }
12205 EOCP
12206                 xxx_prompt=y
12207                 set try
12208                 if eval $compile && ./try > /dev/null; then
12209                         dflt=`./try`
12210                         case "$dflt" in
12211                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12212                                 echo "(The test program ran ok.)"
12213                                 echo "byteorder=$dflt"
12214                                 xxx_prompt=n
12215                         ;;
12216                         ????|????????) echo "(The test program ran ok.)" ;;
12217                         *) echo "(The test program didn't run right for some reason.)" ;;
12218                         esac
12219                 else
12220                         dflt='4321'
12221                         cat <<'EOM'
12222 (I can't seem to compile the test program.  Guessing big-endian...)
12223 EOM
12224                 fi
12225                 case "$xxx_prompt" in
12226                 y)
12227                         rp="What is the order of bytes in a long?"
12228                         . ./myread
12229                         byteorder="$ans"
12230                         ;;
12231                 *)      byteorder=$dflt
12232                         ;;
12233                 esac
12234                 ;;
12235         esac
12236         $rm -f try.c try
12237         ;;
12238 esac
12239
12240
12241 : how do we catenate cpp tokens here?
12242 echo " "
12243 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12244 $cat >cpp_stuff.c <<'EOCP'
12245 #define RCAT(a,b)a/**/b
12246 #define ACAT(a,b)a ## b
12247 RCAT(Rei,ser)
12248 ACAT(Cir,cus)
12249 EOCP
12250 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12251 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12252         echo "Oh!  Smells like ANSI's been here." >&4
12253         echo "We can catify or stringify, separately or together!"
12254         cpp_stuff=42
12255 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12256         echo "Ah, yes!  The good old days!" >&4
12257         echo "However, in the good old days we don't know how to stringify and"
12258         echo "catify at the same time."
12259         cpp_stuff=1
12260 else
12261         $cat >&4 <<EOM
12262 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12263 to have to edit the values of CAT[2-5] in config.h...
12264 EOM
12265         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12266 fi
12267 $rm -f cpp_stuff.*
12268
12269 : see if this is a db.h system
12270 set db.h i_db
12271 eval $inhdr
12272
12273 case "$i_db" in
12274 $define)
12275         : Check db version.
12276         echo " "
12277         echo "Checking Berkeley DB version ..." >&4
12278         $cat >try.c <<EOCP
12279 #$d_const HASCONST
12280 #ifndef HASCONST
12281 #define const
12282 #endif
12283 #include <sys/types.h>
12284 #include <stdio.h>
12285 #include <db.h>
12286 int main()
12287 {
12288 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12289     int Major, Minor, Patch ;
12290     unsigned long Version ;
12291     (void)db_version(&Major, &Minor, &Patch) ;
12292     printf("You have Berkeley DB Version 2 or greater\n");
12293
12294     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12295                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12296     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12297                 Major, Minor, Patch) ;
12298
12299     /* check that db.h & libdb are compatible */
12300     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12301         printf("db.h and libdb are incompatible\n") ;
12302         exit(3);        
12303     }
12304
12305     printf("db.h and libdb are compatible\n") ;
12306
12307     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12308                 + DB_VERSION_PATCH ;
12309
12310     /* needs to be >= 2.3.4 */
12311     if (Version < 2003004) {
12312     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12313         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12314         exit(2);        
12315     }
12316
12317     exit(0);
12318 #else
12319 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12320     printf("You have Berkeley DB Version 1\n");
12321     exit(0);    /* DB version < 2: the coast is clear. */
12322 #else
12323     exit(1);    /* <db.h> not Berkeley DB? */
12324 #endif
12325 #endif
12326 }
12327 EOCP
12328         set try
12329         if eval $compile_ok && ./try; then
12330                 echo 'Looks OK.' >&4
12331         else
12332                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12333                 i_db=$undef
12334                 case " $libs " in
12335                 *"-ldb "*)
12336                         : Remove db from list of libraries to use
12337                         echo "Removing unusable -ldb from library list" >&4
12338                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12339                         shift
12340                         libs="$*"
12341                         echo "libs = $libs" >&4
12342                         ;;
12343                 esac
12344         fi
12345         $rm -f try.*
12346         ;;
12347 esac
12348
12349 case "$i_db" in
12350 define)
12351         : Check the return type needed for hash 
12352         echo " "
12353         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12354         $cat >try.c <<EOCP
12355 #$d_const HASCONST
12356 #ifndef HASCONST
12357 #define const
12358 #endif
12359 #include <sys/types.h>
12360 #include <db.h>
12361
12362 #ifndef DB_VERSION_MAJOR
12363 u_int32_t hash_cb (ptr, size)
12364 const void *ptr;
12365 size_t size;
12366 {
12367 }
12368 HASHINFO info;
12369 int main()
12370 {
12371         info.hash = hash_cb;
12372 }
12373 #endif
12374 EOCP
12375         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12376                 if $contains warning try.out >>/dev/null 2>&1 ; then
12377                         db_hashtype='int'
12378                 else
12379                         db_hashtype='u_int32_t'
12380                 fi
12381         else
12382                 : XXX Maybe we should just give up here.
12383                 db_hashtype=u_int32_t
12384                 $cat try.out >&4
12385                 echo "Help:  I can't seem to compile the db test program." >&4
12386                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12387         fi
12388         $rm -f try.*
12389         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12390         ;;
12391 *)      db_hashtype=u_int32_t
12392         ;;
12393 esac
12394 case "$i_db" in
12395 define)
12396         : Check the return type needed for prefix 
12397         echo " "
12398         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12399         cat >try.c <<EOCP
12400 #$d_const HASCONST
12401 #ifndef HASCONST
12402 #define const
12403 #endif
12404 #include <sys/types.h>
12405 #include <db.h>
12406
12407 #ifndef DB_VERSION_MAJOR
12408 size_t prefix_cb (key1, key2)
12409 const DBT *key1;
12410 const DBT *key2;
12411 {
12412 }
12413 BTREEINFO info;
12414 int main()
12415 {
12416         info.prefix = prefix_cb;
12417 }
12418 #endif
12419 EOCP
12420         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12421                 if $contains warning try.out >>/dev/null 2>&1 ; then
12422                         db_prefixtype='int'
12423                 else
12424                         db_prefixtype='size_t'
12425                 fi
12426         else
12427                 db_prefixtype='size_t'
12428                 : XXX Maybe we should just give up here.
12429                 $cat try.out >&4
12430                 echo "Help:  I can't seem to compile the db test program." >&4
12431                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12432         fi
12433         $rm -f try.*
12434         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12435         ;;
12436 *)      db_prefixtype='size_t'
12437         ;;
12438 esac
12439
12440 : check for void type
12441 echo " "
12442 echo "Checking to see how well your C compiler groks the void type..." >&4
12443 case "$voidflags" in
12444 '')
12445         $cat >try.c <<'EOCP'
12446 #if TRY & 1
12447 void sub() {
12448 #else
12449 sub() {
12450 #endif
12451         extern void moo();      /* function returning void */
12452         void (*goo)();          /* ptr to func returning void */
12453 #if TRY & 8
12454         void *hue;              /* generic ptr */
12455 #endif
12456 #if TRY & 2
12457         void (*foo[10])();
12458 #endif
12459
12460 #if TRY & 4
12461         if(goo == moo) {
12462                 exit(0);
12463         }
12464 #endif
12465         exit(0);
12466 }
12467 int main() { sub(); }
12468 EOCP
12469         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12470                 voidflags=$defvoidused
12471         echo "Good.  It appears to support void to the level $package wants.">&4
12472                 if $contains warning .out >/dev/null 2>&1; then
12473                         echo "However, you might get some warnings that look like this:"
12474                         $cat .out
12475                 fi
12476         else
12477 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12478                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12479                         echo "It supports 1..."
12480                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12481                                 echo "It also supports 2..."
12482                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12483                                         voidflags=7
12484                                         echo "And it supports 4 but not 8 definitely."
12485                                 else
12486                                         echo "It doesn't support 4..."
12487                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12488                                                 voidflags=11
12489                                                 echo "But it supports 8."
12490                                         else
12491                                                 voidflags=3
12492                                                 echo "Neither does it support 8."
12493                                         fi
12494                                 fi
12495                         else
12496                                 echo "It does not support 2..."
12497                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12498                                         voidflags=13
12499                                         echo "But it supports 4 and 8."
12500                                 else
12501                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12502                                                 voidflags=5
12503                                                 echo "And it supports 4 but has not heard about 8."
12504                                         else
12505                                                 echo "However it supports 8 but not 4."
12506                                         fi
12507                                 fi
12508                         fi
12509                 else
12510                         echo "There is no support at all for void."
12511                         voidflags=0
12512                 fi
12513         fi
12514 esac
12515 case "$voidflags" in
12516 "$defvoidused") ;;
12517 *)      $cat >&4 <<'EOM'
12518   Support flag bits are:
12519     1: basic void declarations.
12520     2: arrays of pointers to functions returning void.
12521     4: operations between pointers to and addresses of void functions.
12522     8: generic void pointers.
12523 EOM
12524         dflt="$voidflags";
12525         rp="Your void support flags add up to what?"
12526         . ./myread
12527         voidflags="$ans"
12528         ;;
12529 esac
12530 $rm -f try.* .out
12531
12532
12533 : How can we generate normalized random numbers ?
12534 echo " "
12535 echo "Looking for a random number function..." >&4
12536 case "$randfunc" in
12537 '')
12538         if set drand48 val -f; eval $csym; $val; then
12539                 dflt="drand48"
12540                 echo "Good, found drand48()." >&4
12541         elif set random val -f; eval $csym; $val; then
12542                 dflt="random"
12543                 echo "OK, found random()." >&4
12544         else
12545                 dflt="rand"
12546                 echo "Yick, looks like I have to use rand()." >&4
12547         fi
12548         echo " "
12549         ;;
12550 *)
12551         dflt="$randfunc"
12552         ;;
12553 esac
12554 cont=true
12555
12556 case "$ccflags" in
12557 *-Dmy_rand=*|*-Dmy_srand=*)
12558         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12559         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12560         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12561         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12562         ;;
12563 esac
12564
12565 while $test "$cont"; do
12566         rp="Use which function to generate random numbers?"
12567         . ./myread
12568         if $test "$ans" = "$dflt"; then
12569                 : null
12570         else
12571                 randbits=''
12572         fi
12573         randfunc="$ans"
12574         if set $ans val -f; eval $csym; $val; then
12575                 cont=''
12576         else
12577                 dflt=y
12578                 rp="I cannot find function $ans. Use that name anyway?"
12579                 . ./myread
12580                 dflt=rand
12581                 case "$ans" in
12582                         [yY]*) cont='';;
12583                 esac
12584         fi
12585         case "$cont" in
12586         '')
12587                 case "$randfunc" in
12588                 drand48)
12589                         drand01="drand48()"
12590                         seedfunc="srand48"
12591                         randbits=48
12592                         randseedtype=long
12593                         ;;
12594                 rand|random)
12595                         case "$randbits" in
12596                         '')
12597 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12598                                 $cat >try.c <<EOCP
12599 #$i_unistd I_UNISTD
12600 #$i_stdlib I_STDLIB
12601 #include <stdio.h>
12602 #ifdef I_UNISTD
12603 #  include <unistd.h>
12604 #endif
12605 #ifdef I_STDLIB
12606 #  include <stdlib.h>
12607 #endif
12608 int main()
12609 {
12610         register int i;
12611         register unsigned long tmp;
12612         register unsigned long max = 0L;
12613
12614         for (i = 1000; i; i--) {
12615                 tmp = (unsigned long) $randfunc();
12616                 if (tmp > max) max = tmp;
12617         }
12618         for (i = 0; max; i++)
12619                 max /= 2;
12620         printf("%d\n",i);
12621 }
12622 EOCP
12623                                 set try
12624                                 if eval $compile_ok; then
12625                                         dflt=`try`
12626                                 else
12627                                         dflt='?'
12628                                         echo "(I can't seem to compile the test program...)"
12629                                 fi
12630                                 ;;
12631                         *)
12632                                 dflt="$randbits"
12633                                 ;;
12634                         esac
12635                         rp="How many bits does your $randfunc() function produce?"
12636                         . ./myread
12637                         randbits="$ans"
12638                         $rm -f try.c try
12639                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12640                         seedfunc="s$randfunc"
12641                         randseedtype=unsigned
12642                         ;;
12643                 *)
12644                         dflt="31"
12645                         rp="How many bits does your $randfunc() function produce?"
12646                         . ./myread
12647                         randbits="$ans"
12648                         seedfunc="s$randfunc"
12649                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12650                         if set $seedfunc val -f; eval $csym; $val; then
12651                                 echo "(Using $seedfunc() to seed random generator)"
12652                         else
12653                                 echo "(Warning: no $seedfunc() to seed random generator)"
12654                                 seedfunc=rand
12655                         fi
12656                         randseedtype=unsigned
12657                         ;;
12658                 esac
12659                 ;;
12660         esac
12661 done
12662
12663 echo " "
12664 echo "Determining whether or not we are on an EBCDIC system..." >&4
12665 $cat >tebcdic.c <<'EOM'
12666 int main()
12667 {
12668   if ('M'==0xd4) return 0;
12669   return 1;
12670 }
12671 EOM
12672
12673 val=$undef
12674 set tebcdic
12675 if eval $compile_ok; then
12676         if ./tebcdic; then
12677                 echo "You have EBCDIC." >&4
12678                 val="$define"
12679         else
12680                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12681         fi
12682 else
12683         echo "I'm unable to compile the test program." >&4
12684         echo "I'll assume ASCII or some ISO Latin." >&4
12685 fi
12686 $rm -f tebcdic.c tebcdic
12687 set ebcdic
12688 eval $setvar
12689
12690 echo " "
12691 $cat >&4 <<EOM
12692 Checking how to flush all pending stdio output...
12693 EOM
12694 # I only know how to find the first 32 possibly open files on SunOS.
12695 # See also hints/sunos_4_1.sh and util.c  --AD
12696 case "$osname" in
12697 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12698 esac
12699 $cat >>try.c <<EOCP
12700 #include <stdio.h>
12701 #$i_unistd I_UNISTD
12702 #ifdef I_UNISTD
12703 # include <unistd.h>
12704 #endif
12705 #$d_sysconf HAS_SYSCONF
12706 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12707 #ifdef HAS_STDIO_STREAM_ARRAY
12708 # define STDIO_STREAM_ARRAY $stdio_stream_array
12709 #endif
12710 int main() {
12711   FILE* p = fopen("try.out", "w");
12712 #ifdef TRY_FPUTC
12713   fputc('x', p);
12714 #else
12715 # ifdef TRY_FPRINTF
12716   fprintf(p, "x");
12717 # endif
12718 #endif
12719 #ifdef TRY_FFLUSH_NULL
12720   fflush(NULL);
12721 #endif
12722 #ifdef TRY_FFLUSH_ALL
12723   {
12724     long open_max = -1;
12725 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12726     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12727 # else
12728 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12729     open_max = sysconf(_SC_OPEN_MAX);
12730 #  else
12731 #   ifdef FOPEN_MAX
12732     open_max = FOPEN_MAX;
12733 #   else
12734 #    ifdef OPEN_MAX
12735     open_max = OPEN_MAX;
12736 #    else
12737 #     ifdef _NFILE
12738     open_max = _NFILE;
12739 #     endif
12740 #    endif
12741 #   endif
12742 #  endif
12743 # endif 
12744 # ifdef HAS_STDIO_STREAM_ARRAY
12745     if (open_max > 0) {
12746       long i;
12747       for (i = 0; i < open_max; i++)
12748             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12749                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12750                 STDIO_STREAM_ARRAY[i]._flag)
12751                 fflush(&STDIO_STREAM_ARRAY[i]);
12752     }   
12753   }
12754 # endif
12755 #endif
12756   _exit(42);
12757 }
12758 EOCP
12759 : first we have to find out how _not_ to flush
12760 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12761     output=''
12762     set try -DTRY_FPUTC
12763     if eval $compile; then
12764             $rm -f try.out
12765             ./try$exe_ext 2>/dev/null
12766             if $test ! -s try.out -a "X$?" = X42; then
12767                 output=-DTRY_FPUTC
12768             fi
12769     fi
12770     case "$output" in
12771     '')
12772             set try -DTRY_FPRINTF
12773             $rm -f try.out
12774             if eval $compile; then
12775                     $rm -f try.out
12776                     ./try$exe_ext 2>/dev/null
12777                     if $test ! -s try.out -a "X$?" = X42; then
12778                         output=-DTRY_FPRINTF
12779                     fi
12780             fi
12781         ;;
12782     esac
12783 fi
12784 : check for fflush NULL behaviour
12785 case "$fflushNULL" in
12786 '')     set try -DTRY_FFLUSH_NULL $output
12787         if eval $compile; then
12788                 $rm -f try.out
12789                 ./try$exe_ext 2>/dev/null
12790                 code="$?"
12791                 if $test -s try.out -a "X$code" = X42; then
12792                         fflushNULL="`$cat try.out`"
12793                 else
12794                         if $test "X$code" != X42; then
12795                                 $cat >&4 <<EOM
12796 (If this test failed, don't worry, we'll try another method shortly.)
12797 EOM
12798                         fi
12799                 fi
12800         fi
12801         $rm -f core try.core core.try.*
12802         case "$fflushNULL" in
12803         x)      $cat >&4 <<EOM
12804 Your fflush(NULL) works okay for output streams.
12805 Let's see if it clobbers input pipes...
12806 EOM
12807 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12808 # bug that improperly flushes the input end of pipes.  So we avoid the
12809 # autoflush on fork/system/exec support for now. :-(
12810 $cat >tryp.c <<EOCP
12811 #include <stdio.h>
12812 int
12813 main(int argc, char **argv)
12814 {
12815     char buf[1024];
12816     int i;
12817     char *bp = buf;
12818     while (1) {
12819         while ((i = getc(stdin)) != -1
12820                && (*bp++ = i) != '\n'
12821                && bp < &buf[1024])
12822         /* DO NOTHING */ ;
12823         *bp = '\0';
12824         fprintf(stdout, "%s", buf);
12825         fflush(NULL);
12826         if (i == -1)
12827             return 0;
12828         bp = buf;
12829     }
12830 }
12831 EOCP
12832                 fflushNULL="$define"
12833                 set tryp
12834                 if eval $compile; then
12835                     $rm -f tryp.out
12836                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12837                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12838                        $cat >&4 <<EOM
12839 fflush(NULL) seems to behave okay with input streams.
12840 EOM
12841                         fflushNULL="$define"
12842                     else
12843                         $cat >&4 <<EOM
12844 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12845 EOM
12846                         fflushNULL="$undef"
12847                     fi
12848                 fi
12849                 $rm -f core tryp.c tryp.core core.tryp.*
12850                 ;;
12851         '')     $cat >&4 <<EOM
12852 Your fflush(NULL) isn't working (contrary to ANSI C).
12853 EOM
12854                 fflushNULL="$undef"
12855                 ;;
12856         *)      $cat >&4 <<EOM
12857 Cannot figure out whether your fflush(NULL) works or not.
12858 I'm assuming it doesn't (contrary to ANSI C).
12859 EOM
12860                 fflushNULL="$undef"
12861                 ;;
12862         esac
12863         ;;
12864 $define|true|[yY]*)
12865         fflushNULL="$define"
12866         ;;
12867 *)
12868         fflushNULL="$undef"
12869         ;;
12870 esac
12871 : check explicit looping only if NULL did not work, and if the pipe
12872 : bug does not show up on an explicit flush too
12873 case "$fflushNULL" in
12874 "$undef")
12875         $cat >tryp.c <<EOCP
12876 #include <stdio.h>
12877 int
12878 main(int argc, char **argv)
12879 {
12880     char buf[1024];
12881     int i;
12882     char *bp = buf;
12883     while (1) {
12884         while ((i = getc(stdin)) != -1
12885                && (*bp++ = i) != '\n'
12886                && bp < &buf[1024])
12887         /* DO NOTHING */ ;
12888         *bp = '\0';
12889         fprintf(stdout, "%s", buf);
12890         fflush(stdin);
12891         if (i == -1)
12892             return 0;
12893         bp = buf;
12894     }
12895 }
12896 EOCP
12897         set tryp
12898         if eval $compile; then
12899             $rm -f tryp.out
12900             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12901             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12902                $cat >&4 <<EOM
12903 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12904 EOM
12905                 : now check for fflushall behaviour
12906                 case "$fflushall" in
12907                 '')     set try -DTRY_FFLUSH_ALL $output
12908                         if eval $compile; then
12909                                 $cat >&4 <<EOM
12910 (Now testing the other method--but note that this also may fail.)
12911 EOM
12912                                 $rm -f try.out
12913                                 ./try$exe_ext 2>/dev/null
12914                                 if $test -s try.out -a "X$?" = X42; then
12915                                         fflushall="`$cat try.out`"
12916                                 fi
12917                         fi
12918                         $rm -f core try.core core.try.*
12919                         case "$fflushall" in
12920                         x)      $cat >&4 <<EOM
12921 Whew. Flushing explicitly all the stdio streams works.
12922 EOM
12923                                 fflushall="$define"
12924                                 ;;
12925                         '')     $cat >&4 <<EOM
12926 Sigh. Flushing explicitly all the stdio streams doesn't work.
12927 EOM
12928                                 fflushall="$undef"
12929                                 ;;
12930                         *)      $cat >&4 <<EOM
12931 Cannot figure out whether flushing stdio streams explicitly works or not.
12932 I'm assuming it doesn't.
12933 EOM
12934                                 fflushall="$undef"
12935                                 ;;
12936                         esac
12937                         ;;
12938                 "$define"|true|[yY]*)
12939                         fflushall="$define"
12940                         ;;
12941                 *)
12942                         fflushall="$undef"
12943                         ;;
12944                 esac
12945             else
12946                 $cat >&4 <<EOM
12947 All is futile.  Even fflush(stdin) clobbers input pipes!
12948 EOM
12949                 fflushall="$undef"
12950             fi
12951         else
12952             fflushall="$undef"
12953         fi
12954         $rm -f core tryp.c tryp.core core.tryp.*
12955         ;;
12956 *)      fflushall="$undef"
12957         ;;
12958 esac
12959
12960 case "$fflushNULL$fflushall" in
12961 undefundef)
12962         $cat <<EOM
12963 OK, I give up.  I cannot figure out how to flush pending stdio output.
12964 We won't be flushing handles at all before fork/exec/popen.
12965 EOM
12966         ;;
12967 esac
12968 $rm -f try.* try$exe_ext
12969
12970 : Store the full pathname to the ar program for use in the C program
12971 : Respect a hint or command line value for full_ar.
12972 case "$full_ar" in
12973 '') full_ar=$ar ;;
12974 esac
12975
12976 : Store the full pathname to the sed program for use in the C program
12977 full_sed=$sed
12978
12979 : see what type gids are declared as in the kernel
12980 echo " "
12981 echo "Looking for the type for group ids returned by getgid()."
12982 set gid_t gidtype xxx stdio.h sys/types.h
12983 eval $typedef
12984 case "$gidtype" in
12985 xxx)
12986         xxx=`./findhdr sys/user.h`
12987         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12988         case $1 in
12989         unsigned) dflt="$1 $2" ;;
12990         *) dflt="$1" ;;
12991         esac
12992         ;;
12993 *) dflt="$gidtype";;
12994 esac
12995 case "$gidtype" in
12996 gid_t) echo "gid_t found." ;;
12997 *)      rp="What is the type for group ids returned by getgid()?"
12998         . ./myread
12999         gidtype="$ans"
13000         ;;
13001 esac
13002
13003 echo " "
13004 case "$gidtype" in
13005 *_t) zzz="$gidtype"     ;;
13006 *)   zzz="gid"          ;;
13007 esac
13008 echo "Checking the size of $zzz..." >&4 
13009 cat > try.c <<EOCP
13010 #include <sys/types.h>
13011 #include <stdio.h>
13012 int main() {
13013     printf("%d\n", (int)sizeof($gidtype));
13014     exit(0);
13015 }
13016 EOCP
13017 set try
13018 if eval $compile_ok; then
13019         yyy=`./try`
13020         case "$yyy" in
13021         '')     gidsize=4
13022                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13023                 ;;
13024         *)      gidsize=$yyy
13025                 echo "Your $zzz is $gidsize bytes long."
13026                 ;;
13027         esac
13028 else
13029         gidsize=4
13030         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13031 fi
13032
13033
13034 echo " "
13035 case "$gidtype" in
13036 *_t) zzz="$gidtype"     ;;
13037 *)   zzz="gid"          ;;
13038 esac
13039 echo "Checking the sign of $zzz..." >&4 
13040 cat > try.c <<EOCP
13041 #include <sys/types.h>
13042 #include <stdio.h>
13043 int main() {
13044         $gidtype foo = -1;
13045         if (foo < 0)
13046                 printf("-1\n");
13047         else
13048                 printf("1\n");
13049 }
13050 EOCP
13051 set try
13052 if eval $compile; then
13053         yyy=`./try`
13054         case "$yyy" in
13055         '')     gidsign=1
13056                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13057                 ;;
13058         *)      gidsign=$yyy
13059                 case "$gidsign" in
13060                  1) echo "Your $zzz is unsigned." ;;
13061                 -1) echo "Your $zzz is signed."   ;;
13062                 esac
13063                 ;;
13064         esac
13065 else
13066         gidsign=1
13067         echo "(I can't compile the test program--guessing unsigned.)" >&4
13068 fi
13069
13070
13071 echo " "
13072
13073 if $test X"$quadtype" != X; then
13074
13075 echo "Checking how to print 64-bit integers..." >&4
13076
13077 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13078         $cat >try.c <<'EOCP'
13079 #include <sys/types.h>
13080 #include <stdio.h>
13081 int main() {
13082   int q = 12345678901;
13083   printf("%ld\n", q);
13084 }
13085 EOCP
13086         set try
13087         if eval $compile; then
13088                 yyy=`./try$exe_ext`
13089                 case "$yyy" in
13090                 12345678901)
13091                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13092                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
13093                         echo "We will use %d."
13094                         ;;
13095                 esac
13096         fi
13097 fi
13098
13099 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13100         $cat >try.c <<'EOCP'
13101 #include <sys/types.h>
13102 #include <stdio.h>
13103 int main() {
13104   long q = 12345678901;
13105   printf("%ld\n", q);
13106 }
13107 EOCP
13108         set try
13109         if eval $compile; then
13110                 yyy=`./try$exe_ext`
13111                 case "$yyy" in
13112                 12345678901)
13113                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13114                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
13115                         echo "We will use %ld."
13116                         ;;
13117                 esac
13118         fi
13119 fi
13120
13121 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13122         $cat >try.c <<'EOCP'
13123 #include <sys/types.h>
13124 #include <inttypes.h>
13125 #include <stdio.h>
13126 int main() {
13127   int64_t q = 12345678901;
13128   printf("%" PRId64 "\n", q);
13129 }
13130 EOCP
13131         set try
13132         if eval $compile; then
13133                 yyy=`./try$exe_ext`
13134                 case "$yyy" in
13135                 12345678901)
13136                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13137                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13138                         echo "We will use the C9X style."
13139                         ;;
13140                 esac
13141         fi
13142 fi
13143
13144 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13145         $cat >try.c <<'EOCP'
13146 #include <sys/types.h>
13147 #include <stdio.h>
13148 int main() {
13149   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13150   printf("%lld\n", q);
13151 }
13152 EOCP
13153         set try
13154         if eval $compile; then
13155                 yyy=`./try$exe_ext`
13156                 case "$yyy" in
13157                 12345678901)
13158                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13159                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13160                         echo "We will use the %lld style."
13161                         ;;
13162                 esac
13163         fi
13164 fi
13165
13166 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13167         $cat >try.c <<EOCP
13168 #include <sys/types.h>
13169 #include <stdio.h>
13170 int main() {
13171   $quadtype q = 12345678901;
13172   printf("%Ld\n", q);
13173 }
13174 EOCP
13175         set try
13176         if eval $compile; then
13177                 yyy=`./try$exe_ext`
13178                 case "$yyy" in
13179                 12345678901)
13180                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13181                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13182                         echo "We will use %Ld."
13183                         ;;
13184                 esac
13185         fi
13186 fi
13187
13188 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13189         $cat >try.c <<EOCP
13190 #include <sys/types.h>
13191 #include <stdio.h>
13192 int main() {
13193   $quadtype q = 12345678901;
13194   printf("%qd\n", q);
13195 }
13196 EOCP
13197         set try
13198         if eval $compile; then
13199                 yyy=`./try$exe_ext`
13200                 case "$yyy" in
13201                 12345678901)
13202                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13203                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13204                         echo "We will use %qd."
13205                         ;;
13206                 esac
13207         fi
13208 fi
13209
13210 if $test X"$sPRId64" = X; then
13211         echo "Cannot figure out how to print 64-bit integers." >&4
13212 fi
13213
13214 $rm -f try try.*
13215
13216 fi
13217
13218 case "$sPRId64" in
13219 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13220         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13221         ;;
13222 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13223         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13224         ;;
13225 esac
13226
13227
13228 echo " "
13229 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13230
13231 if $test X"$ivsize" = X8; then
13232         ivdformat="$sPRId64"
13233         uvuformat="$sPRIu64"
13234         uvoformat="$sPRIo64"
13235         uvxformat="$sPRIx64"
13236         uvXformat="$sPRIX64"
13237 else
13238         if $test X"$ivsize" = X"$longsize"; then
13239                 ivdformat='"ld"'
13240                 uvuformat='"lu"'
13241                 uvoformat='"lo"'
13242                 uvxformat='"lx"'
13243                 uvXformat='"lX"'
13244         else
13245                 if $test X"$ivsize" = X"$intsize"; then
13246                         ivdformat='"d"'
13247                         uvuformat='"u"'
13248                         uvoformat='"o"'
13249                         uvxformat='"x"'
13250                         uvXformat='"X"'
13251                 else
13252                         : far out
13253                         if $test X"$ivsize" = X"$shortsize"; then
13254                                 ivdformat='"hd"'
13255                                 uvuformat='"hu"'
13256                                 uvoformat='"ho"'
13257                                 uvxformat='"hx"'
13258                                 uvXformat='"hX"'
13259                         fi
13260                 fi
13261         fi
13262 fi
13263
13264 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13265         nveformat="$sPRIeldbl"
13266         nvfformat="$sPRIfldbl"
13267         nvgformat="$sPRIgldbl"
13268         nvEformat="$sPRIEldbl"
13269         nvFformat="$sPRIFldbl"
13270         nvGformat="$sPRIGldbl"
13271 else
13272         nveformat='"e"'
13273         nvfformat='"f"'
13274         nvgformat='"g"'
13275         nvEformat='"E"'
13276         nvFformat='"F"'
13277         nvGformat='"G"'
13278 fi
13279
13280 case "$ivdformat" in
13281 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13282     exit 1
13283     ;;
13284 esac
13285
13286
13287 echo " "
13288 $echo "Checking the format string to be used for gids..." >&4
13289
13290 case "$gidsign" in
13291 -1)     if $test X"$gidsize" = X"$ivsize"; then
13292                 gidformat="$ivdformat"
13293         else
13294                 if $test X"$gidsize" = X"$longsize"; then
13295                         gidformat='"ld"'
13296                 else
13297                         if $test X"$gidsize" = X"$intsize"; then
13298                                 gidformat='"d"'
13299                         else
13300                                 if $test X"$gidsize" = X"$shortsize"; then
13301                                         gidformat='"hd"'
13302                                 fi
13303                         fi
13304                 fi
13305         fi
13306         ;;
13307 *)      if $test X"$gidsize" = X"$uvsize"; then
13308                 gidformat="$uvuformat"
13309         else
13310                 if $test X"$gidsize" = X"$longsize"; then
13311                         gidformat='"lu"'
13312                 else
13313                         if $test X"$gidsize" = X"$intsize"; then
13314                                 gidformat='"u"'
13315                         else
13316                                 if $test X"$gidsize" = X"$shortsize"; then
13317                                         gidformat='"hu"'
13318                                 fi
13319                         fi
13320                 fi
13321         fi
13322         ;;
13323 esac
13324
13325 : see if getgroups exists
13326 set getgroups d_getgrps
13327 eval $inlibc
13328
13329 : see if setgroups exists
13330 set setgroups d_setgrps
13331 eval $inlibc
13332
13333
13334 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13335 echo " "
13336 case "$d_getgrps$d_setgrps" in
13337 *define*)
13338         case "$groupstype" in
13339         '') dflt="$gidtype" ;;
13340         *)  dflt="$groupstype" ;;
13341         esac
13342         $cat <<EOM
13343 What type of pointer is the second argument to getgroups() and setgroups()?
13344 Usually this is the same as group ids, $gidtype, but not always.
13345
13346 EOM
13347         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13348         . ./myread
13349         groupstype="$ans"
13350         ;;
13351 *)  groupstype="$gidtype";;
13352 esac
13353
13354 echo " "
13355 echo "Checking if your $make program sets \$(MAKE)..." >&4
13356 case "$make_set_make" in
13357 '')
13358         $sed 's/^X //' > testmake.mak << 'EOF'
13359 Xall:
13360 X       @echo 'maketemp="$(MAKE)"'
13361 EOF
13362         case "`$make -f testmake.mak 2>/dev/null`" in
13363         *maketemp=*) make_set_make='#' ;;
13364         *)      make_set_make="MAKE=$make" ;;
13365         esac
13366         $rm -f testmake.mak
13367         ;;
13368 esac
13369 case "$make_set_make" in
13370 '#') echo "Yup, it does.";;
13371 *) echo "Nope, it doesn't.";;
13372 esac
13373
13374 : see what type is used for mode_t
13375 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13376 set mode_t modetype int stdio.h sys/types.h
13377 eval $typedef_ask
13378
13379 : define a fucntion to check prototypes
13380 $cat > protochk <<EOSH
13381 $startsh
13382 cc="$cc"
13383 optimize="$optimize"
13384 ccflags="$ccflags"
13385 prototype="$prototype"
13386 define="$define"
13387 rm=$rm
13388 EOSH
13389
13390 $cat >> protochk <<'EOSH'
13391
13392 $rm -f try.c
13393 foo="$1"
13394 shift
13395 while test $# -ge 2; do
13396         case "$1" in
13397                 $define) echo "#include <$2>" >> try.c ;;
13398                 literal) echo "$2" >> try.c ;;
13399         esac
13400     shift 2
13401 done
13402 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13403 cat >> try.c <<'EOCP'
13404 #ifdef CAN_PROTOTYPE
13405 #define _(args) args
13406 #else
13407 #define _(args) ()
13408 #endif
13409 EOCP
13410 echo "$foo" >> try.c
13411 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13412 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13413 status=$?
13414 $rm -f try.[co]
13415 exit $status
13416 EOSH
13417 chmod +x protochk
13418 $eunicefix protochk
13419
13420 : see what type is used for size_t
13421 rp="What is the type used for the length parameter for string functions?"
13422 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13423 eval $typedef_ask
13424
13425 : check for type of arguments to gethostbyaddr. 
13426 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13427         case "$d_gethbyaddr" in
13428         $define)
13429                 $cat <<EOM
13430
13431 Checking to see what type of arguments are accepted by gethostbyaddr().
13432 EOM
13433                 hdrs="$define sys/types.h
13434                         $d_socket sys/socket.h 
13435                         $i_niin netinet/in.h 
13436                         $i_netdb netdb.h
13437                         $i_unistd unistd.h"
13438                 : The first arg can 'char *' or 'void *'
13439                 : The second arg is some of integral type
13440                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13441                         for yyy in size_t long int; do
13442                                 case "$netdb_host_type" in
13443                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13444                                         if ./protochk "$try" $hdrs; then
13445                                                 echo "Your system accepts $xxx for the first arg."
13446                                                 echo "...and $yyy for the second arg."
13447                                                 netdb_host_type="$xxx"
13448                                                 netdb_hlen_type="$yyy"
13449                                         fi
13450                                         ;;
13451                                 esac
13452                         done
13453                 done
13454                 : In case none of those worked, prompt the user.
13455                 case "$netdb_host_type" in
13456                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13457                         dflt='char *'
13458                         . ./myread
13459                         netdb_host_type=$ans
13460                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13461                         dflt="$sizetype"
13462                         . ./myread
13463                         netdb_hlen_type=$ans
13464                         ;;
13465                 esac
13466                 ;;
13467         *)      : no gethostbyaddr, so pick harmless defaults
13468                 netdb_host_type='char *'
13469                 netdb_hlen_type="$sizetype"
13470                 ;;
13471         esac
13472         # Remove the "const" if needed. -- but then we'll have a 
13473         # prototype clash!
13474         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13475 fi
13476
13477 : check for type of argument to gethostbyname. 
13478 if test "X$netdb_name_type" = X ; then
13479         case "$d_gethbyname" in
13480         $define)
13481                 $cat <<EOM
13482
13483 Checking to see what type of argument is accepted by gethostbyname().
13484 EOM
13485                 hdrs="$define sys/types.h
13486                         $d_socket sys/socket.h 
13487                         $i_niin netinet/in.h 
13488                         $i_netdb netdb.h
13489                         $i_unistd unistd.h"
13490                 for xxx in "const char *" "char *"; do
13491                         case "$netdb_name_type" in
13492                         '')     try="extern struct hostent *gethostbyname($xxx);"
13493                                 if ./protochk "$try" $hdrs; then
13494                                         echo "Your system accepts $xxx."
13495                                         netdb_name_type="$xxx"
13496                                 fi
13497                                 ;;
13498                         esac
13499                 done
13500                 : In case none of those worked, prompt the user.
13501                 case "$netdb_name_type" in
13502                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13503                         dflt='char *'
13504                         . ./myread
13505                         netdb_name_type=$ans
13506                         ;;
13507                 esac
13508                 ;;
13509         *)      : no gethostbyname, so pick harmless default
13510                 netdb_name_type='char *'
13511                 ;;
13512         esac
13513 fi
13514
13515 : check for type of 1st argument to getnetbyaddr. 
13516 if test "X$netdb_net_type" = X ; then
13517         case "$d_getnbyaddr" in
13518         $define)
13519                 $cat <<EOM
13520
13521 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13522 EOM
13523                 hdrs="$define sys/types.h
13524                         $d_socket sys/socket.h 
13525                         $i_niin netinet/in.h 
13526                         $i_netdb netdb.h
13527                         $i_unistd unistd.h"
13528                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13529                         case "$netdb_net_type" in
13530                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13531                                 if ./protochk "$try" $hdrs; then
13532                                         echo "Your system accepts $xxx."
13533                                         netdb_net_type="$xxx"
13534                                 fi
13535                                 ;;
13536                         esac
13537                 done
13538                 : In case none of those worked, prompt the user.
13539                 case "$netdb_net_type" in
13540                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13541                         dflt='long'
13542                         . ./myread
13543                         netdb_net_type=$ans
13544                         ;;
13545                 esac
13546                 ;;
13547         *)      : no getnetbyaddr, so pick harmless default
13548                 netdb_net_type='long'
13549                 ;;
13550         esac
13551 fi
13552 : locate the preferred pager for this system
13553 case "$pager" in
13554 '')
13555         dflt=''
13556         case "$pg" in
13557         /*) dflt=$pg;;
13558         esac
13559         case "$more" in
13560         /*) dflt=$more;;
13561         esac
13562         case "$less" in
13563         /*) dflt=$less;;
13564         esac
13565         case "$dflt" in
13566         '') dflt=/usr/ucb/more;;
13567         esac
13568         ;;
13569 *) dflt="$pager";;
13570 esac
13571 echo " "
13572 fn=f/
13573 rp='What pager is used on your system?'
13574 . ./getfile
13575 pager="$ans"
13576
13577 : see what type pids are declared as in the kernel
13578 rp="What is the type of process ids on this system?"
13579 set pid_t pidtype int stdio.h sys/types.h
13580 eval $typedef_ask
13581
13582 : Find earliest binary compatible site_perl subdirectory perl can use.
13583 case "$bincompat5005" in
13584 "$define") xs_apiversion='5.005' ;;
13585 *) xs_apiversion=$version ;;   # The current site_perl version.
13586 esac
13587 : Find earliest pure perl site_perl subdirectory perl can use.
13588 : The versioned directories started at 5.005.
13589 pm_apiversion='5.005'
13590
13591 : check for length of pointer
13592 echo " "
13593 case "$ptrsize" in
13594 '')
13595         echo "Checking to see how big your pointers are..." >&4
13596         if test "$voidflags" -gt 7; then
13597                 echo '#define VOID_PTR char *' > try.c
13598         else
13599                 echo '#define VOID_PTR void *' > try.c
13600         fi
13601         $cat >>try.c <<'EOCP'
13602 #include <stdio.h>
13603 int main()
13604 {
13605     printf("%d\n", (int)sizeof(VOID_PTR));
13606     exit(0);
13607 }
13608 EOCP
13609         set try
13610         if eval $compile_ok; then
13611                 ptrsize=`./try`
13612                 echo "Your pointers are $ptrsize bytes long."
13613         else
13614                 dflt='4'
13615                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13616                 rp="What is the size of a pointer (in bytes)?"
13617                 . ./myread
13618                 ptrsize="$ans"
13619         fi
13620         ;;
13621 esac
13622 $rm -f try.c try
13623
13624 : see if ar generates random libraries by itself
13625 echo " "
13626 echo "Checking how to generate random libraries on your machine..." >&4
13627 echo 'int bar1() { return bar2(); }' > bar1.c
13628 echo 'int bar2() { return 2; }' > bar2.c
13629 $cat > foo.c <<'EOP'
13630 int main() { printf("%d\n", bar1()); exit(0); }
13631 EOP
13632 $cc $ccflags -c bar1.c >/dev/null 2>&1
13633 $cc $ccflags -c bar2.c >/dev/null 2>&1
13634 $cc $ccflags -c foo.c >/dev/null 2>&1
13635 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13636 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13637         ./foobar >/dev/null 2>&1; then
13638         echo "$ar appears to generate random libraries itself."
13639         orderlib=false
13640         ranlib=":"
13641 elif $ar ts bar$_a >/dev/null 2>&1 &&
13642         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13643         ./foobar >/dev/null 2>&1; then
13644                 echo "a table of contents needs to be added with '$ar ts'."
13645                 orderlib=false
13646                 ranlib="$ar ts"
13647 else
13648         case "$ranlib" in
13649         :) ranlib='';;
13650         '')
13651                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13652                 $test -f $ranlib || ranlib=''
13653                 ;;
13654         esac
13655         if $test -n "$ranlib"; then
13656                 echo "your system has '$ranlib'; we'll use that."
13657                 orderlib=false
13658         else
13659                 echo "your system doesn't seem to support random libraries"
13660                 echo "so we'll use lorder and tsort to order the libraries."
13661                 orderlib=true
13662                 ranlib=":"
13663         fi
13664 fi
13665 $rm -f foo* bar* 
13666
13667 : check for type of arguments to select. 
13668 case "$selecttype" in
13669 '') case "$d_select" in
13670         $define)
13671                 echo " "
13672                 $cat <<EOM
13673 Checking to see what type of arguments are accepted by select().
13674 EOM
13675                 hdrs="$define sys/types.h
13676                         $i_systime sys/time.h 
13677                         $i_sysselct sys/select.h
13678                         $d_socket sys/socket.h"
13679                 : The first arg can be int, unsigned, or size_t
13680                 : The last arg may or may not be 'const'
13681                 val=''
13682                 : void pointer has been seen but using that
13683                 : breaks the selectminbits test
13684                 for xxx in 'fd_set *' 'int *'; do
13685                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13686                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13687                                         case "$val" in
13688                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13689                                                 if ./protochk "$try" $hdrs; then
13690                                                         echo "Your system accepts $xxx."
13691                                                         val="$xxx"
13692                                                 fi
13693                                                 ;;
13694                                         esac
13695                                 done
13696                         done
13697                 done
13698                 case "$val" in
13699                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13700                         case "$d_fd_set" in
13701                                 $define) dflt="fd_set *" ;;
13702                                 *)              dflt="int *" ;;
13703                         esac
13704                         . ./myread
13705                         val=$ans
13706                         ;;
13707                 esac
13708                 selecttype="$val"
13709                 ;;
13710         *)      : no select, so pick a harmless default
13711                 selecttype='int *'
13712                 ;;
13713         esac
13714         ;;
13715 esac
13716
13717 : check for the select 'width'
13718 case "$selectminbits" in
13719 '') case "$d_select" in
13720         $define)
13721                 $cat <<EOM
13722
13723 Checking to see on how many bits at a time your select() operates...
13724 EOM
13725                 $cat >try.c <<EOCP
13726 #include <sys/types.h>
13727 #$i_time I_TIME
13728 #$i_systime I_SYS_TIME
13729 #$i_systimek I_SYS_TIME_KERNEL
13730 #ifdef I_TIME
13731 #   include <time.h>
13732 #endif
13733 #ifdef I_SYS_TIME
13734 #   ifdef I_SYS_TIME_KERNEL
13735 #       define KERNEL
13736 #   endif
13737 #   include <sys/time.h>
13738 #   ifdef I_SYS_TIME_KERNEL
13739 #       undef KERNEL
13740 #   endif
13741 #endif
13742 #$i_sysselct I_SYS_SELECT
13743 #ifdef I_SYS_SELECT
13744 #include <sys/select.h>
13745 #endif
13746 #$d_socket HAS_SOCKET
13747 #ifdef HAS_SOCKET
13748 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13749 #endif
13750 #include <stdio.h>
13751 $selecttype b;
13752 #define S sizeof(*(b))
13753 #define MINBITS 64
13754 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13755 #define NBITS  (NBYTES * 8)
13756 int main() {
13757     char s[NBYTES];
13758     struct timeval t;
13759     int i;
13760     FILE* fp;
13761     int fd;
13762
13763     fclose(stdin);
13764     fp = fopen("try.c", "r");
13765     if (fp == 0)
13766       exit(1);
13767     fd = fileno(fp);
13768     if (fd < 0)
13769       exit(2);
13770     b = ($selecttype)s;
13771     for (i = 0; i < NBITS; i++)
13772         FD_SET(i, b);
13773     t.tv_sec  = 0;
13774     t.tv_usec = 0;
13775     select(fd + 1, b, 0, 0, &t);
13776     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13777     printf("%d\n", i + 1);
13778     return 0;
13779 }
13780 EOCP
13781                 set try
13782                 if eval $compile_ok; then
13783                         selectminbits=`./try`
13784                         case "$selectminbits" in
13785                         '')     cat >&4 <<EOM
13786 Cannot figure out on how many bits at a time your select() operates.
13787 I'll play safe and guess it is 32 bits.
13788 EOM
13789                                 selectminbits=32
13790                                 bits="32 bits"
13791                                 ;;
13792                         1)      bits="1 bit" ;;
13793                         *)      bits="$selectminbits bits" ;;
13794                         esac
13795                         echo "Your select() operates on $bits at a time." >&4
13796                 else
13797                         rp='What is the minimum number of bits your select() operates on?'
13798                         case "$byteorder" in
13799                         1234|12345678)  dflt=32 ;;
13800                         *)              dflt=1  ;;
13801                         esac
13802                         . ./myread
13803                         val=$ans
13804                         selectminbits="$val"
13805                 fi
13806                 $rm -f try.* try
13807                 ;;
13808         *)      : no select, so pick a harmless default
13809                 selectminbits='32'
13810                 ;;
13811         esac
13812         ;;
13813 esac
13814
13815 : Trace out the files included by signal.h, then look for SIGxxx names.
13816 : Remove SIGARRAYSIZE used by HPUX.
13817 : Remove SIGSTKSIZE used by Linux.
13818 : Remove SIGSTKSZ used by Posix.
13819 : Remove SIGTYP void lines used by OS2.
13820 : Some cpps, like os390, dont give the file name anywhere
13821 if [ "X$fieldn" = X ]; then
13822         : Just make some guesses.  We check them later.
13823         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13824 else
13825         xxx=`echo '#include <signal.h>' |
13826         $cppstdin $cppminus $cppflags 2>/dev/null |
13827         $grep '^[       ]*#.*include' | 
13828         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13829 fi
13830 : Check this list of files to be sure we have parsed the cpp output ok.
13831 : This will also avoid potentially non-existent files, such 
13832 : as ../foo/bar.h
13833 xxxfiles=''
13834 for xx in $xxx /dev/null ; do
13835         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13836 done
13837 : If we have found no files, at least try signal.h
13838 case "$xxxfiles" in
13839 '')     xxxfiles=`./findhdr signal.h` ;;
13840 esac
13841 xxx=`awk '
13842 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13843         print substr($2, 4, 20)
13844 }
13845 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13846         print substr($3, 4, 20)
13847 }' $xxxfiles`
13848 : Append some common names just in case the awk scan failed.
13849 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13850 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13851 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13852 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13853 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13854
13855 : generate a few handy files for later
13856 $cat > signal.c <<'EOCP'
13857 #include <sys/types.h>
13858 #include <signal.h>
13859 #include <stdio.h>
13860 int main() {
13861
13862 /* Strange style to avoid deeply-nested #if/#else/#endif */
13863 #ifndef NSIG
13864 #  ifdef _NSIG
13865 #    define NSIG (_NSIG)
13866 #  endif
13867 #endif
13868
13869 #ifndef NSIG
13870 #  ifdef SIGMAX
13871 #    define NSIG (SIGMAX+1)
13872 #  endif
13873 #endif
13874
13875 #ifndef NSIG
13876 #  ifdef SIG_MAX
13877 #    define NSIG (SIG_MAX+1)
13878 #  endif
13879 #endif
13880
13881 #ifndef NSIG
13882 #  ifdef MAXSIG
13883 #    define NSIG (MAXSIG+1)
13884 #  endif
13885 #endif
13886
13887 #ifndef NSIG
13888 #  ifdef MAX_SIG
13889 #    define NSIG (MAX_SIG+1)
13890 #  endif
13891 #endif
13892
13893 #ifndef NSIG
13894 #  ifdef SIGARRAYSIZE
13895 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13896 #  endif
13897 #endif
13898
13899 #ifndef NSIG
13900 #  ifdef _sys_nsig
13901 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13902 #  endif
13903 #endif
13904
13905 /* Default to some arbitrary number that's big enough to get most
13906    of the common signals.
13907 */
13908 #ifndef NSIG
13909 #    define NSIG 50
13910 #endif
13911
13912 printf("NSIG %d\n", NSIG);
13913
13914 #ifndef JUST_NSIG
13915
13916 EOCP
13917
13918 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13919 {
13920         printf "#ifdef SIG"; printf $1; printf "\n"
13921         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13922         printf $1; printf ");\n"
13923         printf "#endif\n"
13924 }
13925 END {
13926         printf "#endif /* JUST_NSIG */\n";
13927         printf "exit(0);\n}\n";
13928 }
13929 ' >>signal.c
13930 $cat >signal.awk <<'EOP'
13931 BEGIN { ndups = 0 }
13932 $1 ~ /^NSIG$/ { nsig = $2 }
13933 ($1 !~ /^NSIG$/) && (NF == 2) {
13934     if ($2 > maxsig) { maxsig = $2 }
13935     if (sig_name[$2]) {
13936         dup_name[ndups] = $1
13937         dup_num[ndups] = $2
13938         ndups++ 
13939     }
13940     else {
13941         sig_name[$2] = $1
13942         sig_num[$2] = $2
13943     }
13944 }
13945 END { 
13946     if (nsig == 0) {
13947         nsig = maxsig + 1
13948     }
13949     printf("NSIG %d\n", nsig);
13950     for (n = 1; n < nsig; n++) {
13951         if (sig_name[n]) {
13952             printf("%s %d\n", sig_name[n], sig_num[n])
13953         }
13954         else {
13955             printf("NUM%d %d\n", n, n) 
13956         }
13957     }
13958     for (n = 0; n < ndups; n++) {
13959         printf("%s %d\n", dup_name[n], dup_num[n])
13960     }
13961 }
13962 EOP
13963 $cat >signal_cmd <<EOS
13964 $startsh
13965 if $test -s signal.lst; then
13966     echo "Using your existing signal.lst file"
13967         exit 0
13968 fi
13969 xxx="$xxx"
13970 EOS
13971 $cat >>signal_cmd <<'EOS'
13972
13973 set signal
13974 if eval $compile_ok; then
13975         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13976 else
13977         echo "(I can't seem be able to compile the whole test program)" >&4
13978         echo "(I'll try it in little pieces.)" >&4
13979         set signal -DJUST_NSIG
13980         if eval $compile_ok; then
13981                 ./signal$_exe > signal.nsg
13982                 $cat signal.nsg
13983         else
13984                 echo "I can't seem to figure out how many signals you have." >&4
13985                 echo "Guessing 50." >&4
13986                 echo 'NSIG 50' > signal.nsg
13987         fi
13988         : Now look at all the signal names, one at a time.
13989         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13990                 $cat > signal.c <<EOCP
13991 #include <sys/types.h>
13992 #include <signal.h>
13993 #include <stdio.h>
13994 int main() {
13995 printf("$xx %d\n", SIG${xx});
13996 return 0;
13997 }
13998 EOCP
13999                 set signal
14000                 if eval $compile; then
14001                         echo "SIG${xx} found."
14002                         ./signal$_exe  >> signal.ls1
14003                 else
14004                         echo "SIG${xx} NOT found."
14005                 fi
14006         done
14007         if $test -s signal.ls1; then
14008                 $cat signal.nsg signal.ls1 |
14009                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14010         fi
14011
14012 fi
14013 if $test -s signal.lst; then
14014         :
14015 else
14016         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14017         echo 'kill -l' >signal
14018         set X `csh -f <signal`
14019         $rm -f signal
14020         shift
14021         case $# in
14022         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14023         esac
14024         echo $@ | $tr ' ' $trnl | \
14025             $awk '{ printf "%s %d\n", $1, ++s; }
14026                   END { printf "NSIG %d\n", ++s }' >signal.lst
14027 fi
14028 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14029 EOS
14030 chmod a+x signal_cmd
14031 $eunicefix signal_cmd
14032
14033 : generate list of signal names
14034 echo " "
14035 case "$sig_name_init" in
14036 '') doinit=yes ;;
14037 *)  case "$sig_num_init" in
14038     ''|*,*) doinit=yes ;;
14039     esac ;;
14040 esac
14041 case "$doinit" in
14042 yes)
14043         echo "Generating a list of signal names and numbers..." >&4
14044         . ./signal_cmd
14045         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14046         sig_name=`$awk 'BEGIN { printf "ZERO " }
14047                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14048         sig_num=`$awk  'BEGIN { printf "0 " }
14049                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14050         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14051                              !/^NSIG/   { printf "\"%s\", ", $1 }
14052                              END        { printf "0\n" }' signal.lst`
14053         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14054                              !/^NSIG/   { printf "%d, ", $2}
14055                              END        { printf "0\n"}' signal.lst`
14056         ;;
14057 esac
14058 echo "The following $sig_count signals are available:"
14059 echo " "
14060 echo $sig_name | $awk \
14061 'BEGIN { linelen = 0 }
14062 {
14063         for (i = 1; i <= NF; i++) {
14064                 name = "SIG" $i " "
14065                 linelen = linelen + length(name)
14066                 if (linelen > 70) {
14067                         printf "\n"
14068                         linelen = length(name)
14069                 }
14070                 printf "%s", name
14071         }
14072         printf "\n"
14073 }'
14074 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14075
14076 echo " "
14077 case "$sizetype" in
14078 *_t) zzz="$sizetype"    ;;
14079 *)   zzz="filesize"     ;;
14080 esac
14081 echo "Checking the size of $zzz..." >&4 
14082 cat > try.c <<EOCP
14083 #include <sys/types.h>
14084 #include <stdio.h>
14085 int main() {
14086     printf("%d\n", (int)sizeof($sizetype));
14087     exit(0);
14088 }
14089 EOCP
14090 set try
14091 if eval $compile_ok; then
14092         yyy=`./try`
14093         case "$yyy" in
14094         '')     sizesize=4
14095                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14096                 ;;
14097         *)      sizesize=$yyy
14098                 echo "Your $zzz size is $sizesize bytes."
14099                 ;;
14100         esac
14101 else
14102         sizesize=4
14103         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14104 fi
14105
14106
14107 : check for socklen_t
14108 echo " "
14109 echo "Checking to see if you have socklen_t..." >&4
14110 $cat >try.c <<EOCP
14111 #include <sys/types.h>
14112 #$d_socket HAS_SOCKET
14113 #ifdef HAS_SOCKET
14114 #include <sys/socket.h>
14115 #endif
14116 int main() { socklen_t x = 16; }
14117 EOCP
14118 set try
14119 if eval $compile; then
14120         val="$define"
14121         echo "You have socklen_t."
14122 else
14123         val="$undef"
14124         echo "You do not have socklen_t."
14125         case "$sizetype" in
14126         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14127         esac
14128 fi
14129 $rm -f try try.*
14130 set d_socklen_t
14131 eval $setvar
14132
14133 : check for type of the size argument to socket calls
14134 case "$d_socket" in
14135 "$define")
14136         $cat <<EOM
14137
14138 Checking to see what type is the last argument of accept().
14139 EOM
14140         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14141         yyy=''
14142         case "$d_socklen_t" in
14143         "$define") yyy="$yyy socklen_t"
14144         esac
14145         yyy="$yyy $sizetype int long unsigned"
14146         for xxx in $yyy; do
14147                 case "$socksizetype" in
14148                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14149                         if ./protochk "$try" $hdrs; then
14150                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14151                                 socksizetype="$xxx"
14152                         fi
14153                         ;;
14154                 esac
14155         done
14156 : In case none of those worked, prompt the user.
14157         case "$socksizetype" in
14158         '')     rp='What is the type for socket address structure sizes?'
14159                 dflt='int'
14160                 . ./myread
14161                 socksizetype=$ans
14162                 ;;
14163         esac
14164         ;;
14165 *)      : no sockets, so pick relatively harmless default
14166         socksizetype='int'
14167         ;;
14168 esac
14169
14170 : see what type is used for signed size_t
14171 set ssize_t ssizetype int stdio.h sys/types.h
14172 eval $typedef
14173 dflt="$ssizetype"
14174 $cat > ssize.c <<EOM
14175 #include <stdio.h>
14176 #include <sys/types.h>
14177 #define Size_t $sizetype
14178 #define SSize_t $dflt
14179 int main()
14180 {
14181         if (sizeof(Size_t) == sizeof(SSize_t))
14182                 printf("$dflt\n");
14183         else if (sizeof(Size_t) == sizeof(int))
14184                 printf("int\n");
14185         else 
14186                 printf("long\n");
14187         exit(0);
14188 }
14189 EOM
14190 echo " "
14191 set ssize
14192 if eval $compile_ok && ./ssize > /dev/null; then
14193         ssizetype=`./ssize`
14194         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14195 else
14196         $cat >&4 <<EOM
14197 Help! I can't compile and run the ssize_t test program: please enlighten me!
14198 (This is probably a misconfiguration in your system or libraries, and
14199 you really ought to fix it.  Still, I'll try anyway.)
14200
14201 I need a type that is the same size as $sizetype, but is guaranteed to
14202 be signed.  Common values are ssize_t, int and long.
14203
14204 EOM
14205         rp="What signed type is the same size as $sizetype?"
14206         . ./myread
14207         ssizetype="$ans"
14208 fi
14209 $rm -f ssize ssize.*
14210
14211 : see what type of char stdio uses.
14212 echo " "
14213 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14214         echo "Your stdio uses unsigned chars." >&4
14215         stdchar="unsigned char"
14216 else
14217         echo "Your stdio uses signed chars." >&4
14218         stdchar="char"
14219 fi
14220
14221 : see if time exists
14222 echo " "
14223 if test "X$d_time" = X -o X"$timetype" = X; then
14224     if set time val -f d_time; eval $csym; $val; then
14225                 echo 'time() found.' >&4
14226                 val="$define"
14227                 rp="What is the type returned by time() on this system?"
14228                 set time_t timetype long stdio.h sys/types.h
14229                 eval $typedef_ask
14230     else
14231                 echo 'time() not found, hope that will do.' >&4
14232                 val="$undef"
14233                 timetype='int';
14234     fi
14235     set d_time
14236     eval $setvar
14237 fi
14238
14239 : see what type uids are declared as in the kernel
14240 echo " "
14241 echo "Looking for the type for user ids returned by getuid()."
14242 set uid_t uidtype xxx stdio.h sys/types.h
14243 eval $typedef
14244 case "$uidtype" in
14245 xxx)
14246         xxx=`./findhdr sys/user.h`
14247         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14248         case $1 in
14249         unsigned) dflt="$1 $2" ;;
14250         *) dflt="$1" ;;
14251         esac
14252         ;;
14253 *) dflt="$uidtype";;
14254 esac
14255 case "$uidtype" in
14256 uid_t)  echo "uid_t found." ;;
14257 *)      rp="What is the type for user ids returned by getuid()?"
14258         . ./myread
14259         uidtype="$ans"
14260         ;;
14261 esac
14262
14263 echo " "
14264 case "$uidtype" in
14265 *_t) zzz="$uidtype"     ;;
14266 *)   zzz="uid"          ;;
14267 esac
14268 echo "Checking the size of $zzz..." >&4 
14269 cat > try.c <<EOCP
14270 #include <sys/types.h>
14271 #include <stdio.h>
14272 int main() {
14273     printf("%d\n", (int)sizeof($uidtype));
14274     exit(0);
14275 }
14276 EOCP
14277 set try
14278 if eval $compile_ok; then
14279         yyy=`./try`
14280         case "$yyy" in
14281         '')     uidsize=4
14282                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14283                 ;;
14284         *)      uidsize=$yyy
14285                 echo "Your $zzz is $uidsize bytes long."
14286                 ;;
14287         esac
14288 else
14289         uidsize=4
14290         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14291 fi
14292
14293 echo " "
14294 case "$uidtype" in
14295 *_t) zzz="$uidtype"     ;;
14296 *)   zzz="uid"          ;;
14297 esac
14298 echo "Checking the sign of $zzz..." >&4
14299 cat > try.c <<EOCP
14300 #include <sys/types.h>
14301 #include <stdio.h>
14302 int main() {
14303         $uidtype foo = -1;
14304         if (foo < 0)
14305                 printf("-1\n");
14306         else
14307                 printf("1\n");
14308 }
14309 EOCP
14310 set try
14311 if eval $compile; then
14312         yyy=`./try`
14313         case "$yyy" in
14314         '')     uidsign=1
14315                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14316                 ;;
14317         *)      uidsign=$yyy
14318                 case "$uidsign" in
14319                  1) echo "Your $zzz is unsigned." ;;
14320                 -1) echo "Your $zzz is signed."   ;;
14321                 esac
14322                 ;;
14323         esac
14324 else
14325         uidsign=1
14326         echo "(I can't compile the test program--guessing unsigned.)" >&4
14327 fi
14328
14329
14330
14331 echo " "
14332 $echo "Checking the format string to be used for uids..." >&4
14333
14334 case "$uidsign" in
14335 -1)     if $test X"$uidsize" = X"$ivsize"; then
14336                 uidformat="$ivdformat"
14337         else
14338                 if $test X"$uidsize" = X"$longsize"; then
14339                         uidformat='"ld"'
14340                 else
14341                         if $test X"$uidsize" = X"$intsize"; then
14342                                 uidformat='"d"'
14343                         else
14344                                 if $test X"$uidsize" = X"$shortsize"; then
14345                                         uidformat='"hd"'
14346                                 fi
14347                         fi
14348                 fi
14349         fi
14350         ;;
14351 *)      if $test X"$uidsize" = X"$uvsize"; then
14352                 uidformat="$uvuformat"
14353         else
14354                 if $test X"$uidsize" = X"$longsize"; then
14355                         uidformat='"lu"'
14356                 else
14357                         if $test X"$uidsize" = X"$intsize"; then
14358                                 uidformat='"u"'
14359                         else
14360                                 if $test X"$uidsize" = X"$shortsize"; then
14361                                         uidformat='"hu"'
14362                                 fi
14363                         fi
14364                 fi
14365         fi
14366         ;;
14367 esac
14368
14369 : see if dbm.h is available
14370 : see if dbmclose exists
14371 set dbmclose d_dbmclose
14372 eval $inlibc
14373
14374 case "$d_dbmclose" in
14375 $define)
14376         set dbm.h i_dbm
14377         eval $inhdr
14378         case "$i_dbm" in
14379         $define)
14380                 val="$undef"
14381                 set i_rpcsvcdbm
14382                 eval $setvar
14383                 ;;
14384         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14385                 eval $inhdr
14386                 ;;
14387         esac
14388         ;;
14389 *)      echo "We won't be including <dbm.h>"
14390         val="$undef"
14391         set i_dbm
14392         eval $setvar
14393         val="$undef"
14394         set i_rpcsvcdbm
14395         eval $setvar
14396         ;;
14397 esac
14398
14399 : see if this is a sys/file.h system
14400 val=''
14401 set sys/file.h val
14402 eval $inhdr
14403
14404 : do we need to include sys/file.h ?
14405 case "$val" in
14406 "$define")
14407         echo " "
14408         if $h_sysfile; then
14409                 val="$define"
14410                 echo "We'll be including <sys/file.h>." >&4
14411         else
14412                 val="$undef"
14413                 echo "We won't be including <sys/file.h>." >&4
14414         fi
14415         ;;
14416 *)
14417         h_sysfile=false
14418         ;;
14419 esac
14420 set i_sysfile
14421 eval $setvar
14422
14423 : see if fcntl.h is there
14424 val=''
14425 set fcntl.h val
14426 eval $inhdr
14427
14428 : see if we can include fcntl.h
14429 case "$val" in
14430 "$define")
14431         echo " "
14432         if $h_fcntl; then
14433                 val="$define"
14434                 echo "We'll be including <fcntl.h>." >&4
14435         else
14436                 val="$undef"
14437                 if $h_sysfile; then
14438         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14439                 else
14440                         echo "We won't be including <fcntl.h>." >&4
14441                 fi
14442         fi
14443         ;;
14444 *)
14445         h_fcntl=false
14446         val="$undef"
14447         ;;
14448 esac
14449 set i_fcntl
14450 eval $setvar
14451
14452 : see if this is a iconv.h system
14453 set iconv.h i_iconv
14454 eval $inhdr
14455
14456 : see if this is a ieeefp.h system
14457 set ieeefp.h i_ieeefp
14458 eval $inhdr
14459
14460 : see if this is a libutil.h system
14461 set libutil.h i_libutil
14462 eval $inhdr
14463
14464 : see if locale.h is available
14465 set locale.h i_locale
14466 eval $inhdr
14467
14468 : see if mach cthreads are available
14469 if test "X$usethreads" = "X$define"; then
14470         set mach/cthreads.h i_machcthr
14471         eval $inhdr
14472 else
14473         i_machcthr="$undef"
14474 fi
14475
14476
14477
14478 : see if this is a math.h system
14479 set math.h i_math
14480 eval $inhdr
14481
14482 : see if this is a mntent.h system
14483 set mntent.h i_mntent
14484 eval $inhdr
14485
14486 : see if ndbm.h is available
14487 set ndbm.h t_ndbm
14488 eval $inhdr
14489 case "$t_ndbm" in
14490 $define)
14491         : see if dbm_open exists
14492         set dbm_open d_dbm_open
14493         eval $inlibc
14494         case "$d_dbm_open" in
14495         $undef)
14496                 t_ndbm="$undef"
14497                 echo "We won't be including <ndbm.h>"
14498                 ;;
14499         esac
14500         ;;
14501 esac
14502 val="$t_ndbm"
14503 set i_ndbm
14504 eval $setvar
14505
14506 : see if net/errno.h is available
14507 val=''
14508 set net/errno.h val
14509 eval $inhdr
14510
14511 : Unfortunately, it causes problems on some systems.  Arrgh.
14512 case "$val" in
14513 $define)
14514         cat > try.c <<'EOM'
14515 #include <stdio.h>
14516 #include <errno.h>
14517 #include <net/errno.h>
14518 int func()
14519 {
14520         return ENOTSOCK;
14521 }
14522 EOM
14523         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14524                 echo "We'll be including <net/errno.h>." >&4
14525         else
14526                 echo "We won't be including <net/errno.h>." >&4
14527                 val="$undef"
14528         fi
14529         $rm -f try.* try
14530         ;;
14531 esac
14532 set i_neterrno
14533 eval $setvar
14534
14535 : see if netinet/tcp.h is available
14536 set netinet/tcp.h i_netinettcp
14537 eval $inhdr
14538
14539 : see if this is a poll.h system
14540 set poll.h i_poll
14541 eval $inhdr
14542
14543 : see if this is a prot.h system
14544 set prot.h i_prot
14545 eval $inhdr
14546
14547 echo " "
14548 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14549 $cat <<'EOSH' > Cppsym.know
14550 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14551 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14552 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14553 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14554 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14555 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14556 bull c cadmus clipper CMU COFF COMPILER_VERSION
14557 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14558 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14559 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14560 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14561 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14562 H3050R H3050RX hbullx20 hcx host_mips
14563 hp200 hp300 hp700 HP700 hp800 hp9000
14564 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14565 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14566 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14567 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14568 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14569 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14570 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14571 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14572 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14573 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14574 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14575 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14576 MATH_HAS_NO_SIDE_EFFECTS
14577 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14578 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14579 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14580 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14581 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14582 NetBSD news1500 news1700 news1800 news1900 news3700
14583 news700 news800 news900 NeXT NLS ns16000 ns32000
14584 ns32016 ns32332 ns32k nsc32000
14585 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14586 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14587 pc532 pdp11 PGC PIC plexus PORTAR posix
14588 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14589 POSIX_C_SOURCE POSIX_SOURCE POWER
14590 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14591 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14592 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14593 sony sony_news sonyrisc sparc sparclite spectrum
14594 stardent stdc STDC_EXT stratos sun sun3 sun386
14595 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14596 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14597 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14598 sysV68 sysV88 Tek4132 Tek4300 titan
14599 tower tower32 tower32_200 tower32_600 tower32_700
14600 tower32_800 tower32_850 tss
14601 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14602 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14603 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14604 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14605 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14606 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14607 z8000
14608 EOSH
14609 # Maybe put other stuff here too.
14610 cat <<EOSH >>Cppsym.know
14611 $osname
14612 EOSH
14613 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14614 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14615 $cat Cppsym.know > Cppsym.c
14616 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14617 $rm -f Cppsym.a Cppsym.b Cppsym.c
14618 cat <<EOSH > Cppsym
14619 $startsh
14620 if $test \$# -gt 0; then
14621     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14622     if $test -s Cppsym.got; then
14623         $rm -f Cppsym.got
14624         exit 0
14625     fi
14626     $rm -f Cppsym.got
14627     exit 1
14628 else
14629     $tr " " "$trnl" | ./Cppsym.try
14630     exit 0
14631 fi
14632 EOSH
14633 chmod +x Cppsym
14634 $eunicefix Cppsym
14635 cat <<EOSH > Cppsym.try
14636 $startsh
14637 cat <<'EOCP' > try.c
14638 #include <stdio.h>
14639 int main() {
14640 EOCP
14641 $awk \\
14642 EOSH
14643 cat <<'EOSH' >> Cppsym.try
14644 'length($1) > 0 {
14645     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14646     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14647     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14648     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14649 }'       >> try.c
14650 echo '}' >> try.c
14651 EOSH
14652 cat <<EOSH >> Cppsym.try
14653 ccflags="$ccflags"
14654 case "$osname-$gccversion" in
14655 irix-) ccflags="\$ccflags -woff 1178" ;;
14656 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14657 esac
14658 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14659 EOSH
14660 chmod +x Cppsym.try
14661 $eunicefix Cppsym.try
14662 ./Cppsym < Cppsym.know > Cppsym.true
14663 : now check the C compiler for additional symbols
14664 postprocess_cc_v=''
14665 case "$osname" in
14666 aix) postprocess_cc_v="|$tr , ' '" ;;
14667 esac
14668 $cat >ccsym <<EOS
14669 $startsh
14670 $cat >tmp.c <<EOF
14671 extern int foo;
14672 EOF
14673 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14674 do
14675         case "\$i" in
14676         -D*) echo "\$i" | $sed 's/^-D//';;
14677         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14678         esac
14679 done
14680 $rm -f try.c
14681 EOS
14682 postprocess_cc_v=''
14683 chmod +x ccsym
14684 $eunicefix ccsym
14685 ./ccsym > ccsym1.raw
14686 if $test -s ccsym1.raw; then
14687        $sort ccsym1.raw | $uniq >ccsym.raw
14688 else
14689        mv ccsym1.raw ccsym.raw
14690 fi
14691
14692 $awk '/\=/ { print $0; next }
14693         { print $0"=1" }' ccsym.raw >ccsym.list
14694 $awk '/\=/ { print $0; next }
14695         { print $0"=1" }' Cppsym.true >ccsym.true
14696 $comm -13 ccsym.true ccsym.list >ccsym.own
14697 $comm -12 ccsym.true ccsym.list >ccsym.com
14698 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14699 also=''
14700 if $test -z ccsym.raw; then
14701         echo "Your C compiler doesn't seem to define any symbols!" >&4
14702         echo " "
14703         echo "However, your C preprocessor defines the following symbols:"
14704         $cat Cppsym.true
14705         ccsymbols=''
14706         cppsymbols=`$cat Cppsym.true`
14707         cppsymbols=`echo $cppsymbols`
14708         cppccsymbols="$cppsymbols"
14709 else
14710         if $test -s ccsym.com; then
14711                 echo "Your C compiler and pre-processor define these symbols:"
14712                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14713                 also='also '
14714                 symbols='ones'
14715                 cppccsymbols=`$cat ccsym.com`
14716                 cppccsymbols=`echo $cppccsymbols`
14717                 $test "$silent" || sleep 1
14718         fi
14719         if $test -s ccsym.cpp; then
14720                 $test "$also" && echo " "
14721                 echo "Your C pre-processor ${also}defines the following symbols:"
14722                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14723                 also='further '
14724                 cppsymbols=`$cat ccsym.cpp`
14725                 cppsymbols=`echo $cppsymbols`
14726                 $test "$silent" || sleep 1
14727         fi
14728         if $test -s ccsym.own; then
14729                 $test "$also" && echo " "
14730                 echo "Your C compiler ${also}defines the following cpp symbols:"
14731                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14732                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14733                 ccsymbols=`$cat ccsym.own`
14734                 ccsymbols=`echo $ccsymbols`
14735                 $test "$silent" || sleep 1
14736         fi
14737 fi
14738 $rm -f ccsym* Cppsym.*
14739
14740 : see if this is a termio system
14741 val="$undef"
14742 val2="$undef"
14743 val3="$undef"
14744 if $test `./findhdr termios.h`; then
14745         set tcsetattr i_termios
14746         eval $inlibc
14747         val3="$i_termios"
14748 fi
14749 echo " "
14750 case "$val3" in
14751 "$define") echo "You have POSIX termios.h... good!" >&4;;
14752 *) if ./Cppsym pyr; then
14753                 case "`/bin/universe`" in
14754                 ucb) if $test `./findhdr sgtty.h`; then
14755                                 val2="$define"
14756                                 echo "<sgtty.h> found." >&4
14757                         else
14758                                 echo "System is pyramid with BSD universe."
14759                                 echo "<sgtty.h> not found--you could have problems." >&4
14760                         fi;;
14761                 *) if $test `./findhdr termio.h`; then
14762                                 val="$define"
14763                                 echo "<termio.h> found." >&4
14764                         else
14765                                 echo "System is pyramid with USG universe."
14766                                 echo "<termio.h> not found--you could have problems." >&4
14767                         fi;;
14768                 esac
14769         elif ./usg; then
14770                 if $test `./findhdr termio.h`; then
14771                         echo "<termio.h> found." >&4
14772                         val="$define"
14773                 elif $test `./findhdr sgtty.h`; then
14774                         echo "<sgtty.h> found." >&4
14775                         val2="$define"
14776                 else
14777 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14778                 fi
14779         else
14780                 if $test `./findhdr sgtty.h`; then
14781                         echo "<sgtty.h> found." >&4
14782                         val2="$define"
14783                 elif $test `./findhdr termio.h`; then
14784                         echo "<termio.h> found." >&4
14785                         val="$define"
14786                 else
14787 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14788                 fi
14789         fi;;
14790 esac
14791 set i_termio; eval $setvar
14792 val=$val2; set i_sgtty; eval $setvar
14793 val=$val3; set i_termios; eval $setvar
14794
14795 : see if this is a shadow.h system
14796 set shadow.h i_shadow
14797 eval $inhdr
14798
14799 : see if this is a socks.h system
14800 set socks.h i_socks
14801 eval $inhdr
14802
14803 : see if stdarg is available
14804 echo " "
14805 if $test `./findhdr stdarg.h`; then
14806         echo "<stdarg.h> found." >&4
14807         valstd="$define"
14808 else
14809         echo "<stdarg.h> NOT found." >&4
14810         valstd="$undef"
14811 fi
14812
14813 : see if varags is available
14814 echo " "
14815 if $test `./findhdr varargs.h`; then
14816         echo "<varargs.h> found." >&4
14817 else
14818         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14819 fi
14820
14821 : set up the varargs testing programs
14822 $cat > varargs.c <<EOP
14823 #ifdef I_STDARG
14824 #include <stdarg.h>
14825 #endif
14826 #ifdef I_VARARGS
14827 #include <varargs.h>
14828 #endif
14829
14830 #ifdef I_STDARG
14831 int f(char *p, ...)
14832 #else
14833 int f(va_alist)
14834 va_dcl
14835 #endif
14836 {
14837         va_list ap;
14838 #ifndef I_STDARG
14839         char *p;
14840 #endif
14841 #ifdef I_STDARG
14842         va_start(ap,p);
14843 #else
14844         va_start(ap);
14845         p = va_arg(ap, char *);
14846 #endif
14847         va_end(ap);
14848 }
14849 EOP
14850 $cat > varargs <<EOP
14851 $startsh
14852 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14853         echo "true"
14854 else
14855         echo "false"
14856 fi
14857 $rm -f varargs$_o
14858 EOP
14859 chmod +x varargs
14860
14861 : now check which varargs header should be included
14862 echo " "
14863 i_varhdr=''
14864 case "$valstd" in
14865 "$define")
14866         if `./varargs I_STDARG`; then
14867                 val='stdarg.h'
14868         elif `./varargs I_VARARGS`; then
14869                 val='varargs.h'
14870         fi
14871         ;;
14872 *)
14873         if `./varargs I_VARARGS`; then
14874                 val='varargs.h'
14875         fi
14876         ;;
14877 esac
14878 case "$val" in
14879 '')
14880 echo "I could not find the definition for va_dcl... You have problems..." >&4
14881         val="$undef"; set i_stdarg; eval $setvar
14882         val="$undef"; set i_varargs; eval $setvar
14883         ;;
14884 *) 
14885         set i_varhdr
14886         eval $setvar
14887         case "$i_varhdr" in
14888         stdarg.h)
14889                 val="$define"; set i_stdarg; eval $setvar
14890                 val="$undef"; set i_varargs; eval $setvar
14891                 ;;
14892         varargs.h)
14893                 val="$undef"; set i_stdarg; eval $setvar
14894                 val="$define"; set i_varargs; eval $setvar
14895                 ;;
14896         esac
14897         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14898 esac
14899 $rm -f varargs*
14900
14901 : see if stddef is available
14902 set stddef.h i_stddef
14903 eval $inhdr
14904
14905 : see if this is a sunmath.h system
14906 set sunmath.h i_sunmath
14907 eval $inhdr
14908
14909 : see if sys/access.h is available
14910 set sys/access.h i_sysaccess
14911 eval $inhdr
14912
14913 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14914 set sys/filio.h i_sysfilio
14915 eval $inhdr
14916 echo " "
14917 if $test `./findhdr sys/ioctl.h`; then
14918         val="$define"
14919         echo '<sys/ioctl.h> found.' >&4
14920 else
14921         val="$undef"
14922         if $test $i_sysfilio = "$define"; then
14923             echo '<sys/ioctl.h> NOT found.' >&4
14924         else
14925                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14926                 $test $i_termio = "$define" && xxx="termio.h"
14927                 $test $i_termios = "$define" && xxx="termios.h"
14928 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14929         fi
14930 fi
14931 set i_sysioctl
14932 eval $setvar
14933
14934
14935 : see if this is a syslog.h system
14936 set syslog.h i_syslog
14937 eval $inhdr
14938
14939
14940 : see if this is a sys/mode.h system
14941 set sys/mode.h i_sysmode
14942 eval $inhdr
14943
14944 : see if sys/resource.h has to be included
14945 set sys/resource.h i_sysresrc
14946 eval $inhdr
14947
14948 : see if sys/security.h is available
14949 set sys/security.h i_syssecrt
14950 eval $inhdr
14951
14952 : see if this is a sys/statvfs.h system
14953 set sys/statvfs.h i_sysstatvfs
14954 eval $inhdr
14955
14956 : see if this is a sys/uio.h system
14957 set sys/uio.h i_sysuio
14958 eval $inhdr
14959
14960 : see if this is a sys/un.h system
14961 set sys/un.h i_sysun
14962 eval $inhdr
14963
14964
14965 : see if this is a sys/utsname.h system
14966 set sys/utsname.h i_sysutsname
14967 eval $inhdr
14968
14969 : see if this is a syswait system
14970 set sys/wait.h i_syswait
14971 eval $inhdr
14972
14973 : see if this is a ustat.h system
14974 set ustat.h i_ustat
14975 eval $inhdr
14976
14977 : see if this is an utime system
14978 set utime.h i_utime
14979 eval $inhdr
14980
14981 : see if this is a values.h system
14982 set values.h i_values
14983 eval $inhdr
14984
14985 : see if this is a vfork system
14986 case "$d_vfork" in
14987 "$define")
14988         set vfork.h i_vfork
14989         eval $inhdr
14990         ;;
14991 *)
14992         i_vfork="$undef"
14993         ;;
14994 esac
14995
14996 : see if gdbm.h is available
14997 set gdbm.h t_gdbm
14998 eval $inhdr
14999 case "$t_gdbm" in
15000 $define)
15001         : see if gdbm_open exists
15002         set gdbm_open d_gdbm_open
15003         eval $inlibc
15004         case "$d_gdbm_open" in
15005         $undef)
15006                 t_gdbm="$undef"
15007                 echo "We won't be including <gdbm.h>"
15008                 ;;
15009         esac
15010         ;;
15011 esac
15012 val="$t_gdbm"
15013 set i_gdbm
15014 eval $setvar
15015
15016 echo " "
15017 echo "Looking for extensions..." >&4
15018 : If we are using the old config.sh, known_extensions may contain
15019 : old or inaccurate or duplicate values.
15020 known_extensions=''
15021 nonxs_extensions=''
15022 : We do not use find because it might not be available.
15023 : We do not just use MANIFEST because the user may have dropped
15024 : some additional extensions into the source tree and expect them
15025 : to be built.
15026
15027 : Function to recursively find available extensions, ignoring DynaLoader
15028 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15029 find_extensions='
15030     for xxx in *; do
15031        case "$xxx" in
15032            DynaLoader|dynaload) ;;
15033            *)
15034            if $test -f $xxx/$xxx.xs; then
15035                known_extensions="$known_extensions $1$xxx";
15036            elif $test -f $xxx/Makefile.PL; then
15037                nonxs_extensions="$nonxs_extensions $1$xxx";
15038            else
15039                if $test -d $xxx -a $# -lt 10; then
15040                    set $1$xxx/ $*;
15041                    cd $xxx;
15042                    eval $find_extensions;
15043                    cd ..;
15044                    shift;
15045                fi;
15046            fi
15047            ;;
15048        esac;
15049     done'
15050 tdir=`pwd`
15051 cd $rsrc/ext
15052 set X
15053 shift
15054 eval $find_extensions
15055 set X $nonxs_extensions
15056 shift
15057 nonxs_extensions="$*"
15058 set X $known_extensions
15059 shift
15060 known_extensions="$*"
15061 cd $tdir
15062
15063 : Now see which are supported on this system.
15064 avail_ext=''
15065 for xxx in $known_extensions ; do
15066         case "$xxx" in
15067         DB_File|db_file)
15068                 case "$i_db" in
15069                 $define) avail_ext="$avail_ext $xxx" ;;
15070                 esac
15071                 ;;
15072         GDBM_File|gdbm_fil)
15073                 case "$i_gdbm" in 
15074                 $define) avail_ext="$avail_ext $xxx" ;;
15075                 esac
15076                 ;;
15077         NDBM_File|ndbm_fil)
15078                 case "$i_ndbm" in
15079                 $define)
15080                     case "$osname-$use64bitint" in
15081                     hpux-define)
15082                         case "$libs" in
15083                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15084                         esac
15085                         ;;
15086                     *) avail_ext="$avail_ext $xxx" ;;
15087                     esac
15088                     ;;
15089                 esac
15090                 ;;
15091         ODBM_File|odbm_fil) 
15092                 case "${i_dbm}${i_rpcsvcdbm}" in
15093                 *"${define}"*)
15094                     case "$osname-$use64bitint" in
15095                     hpux-define)
15096                         case "$libs" in
15097                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15098                         esac
15099                         ;;
15100                     *) avail_ext="$avail_ext $xxx" ;;
15101                     esac
15102                     ;;
15103                 esac
15104                 ;;
15105         POSIX|posix)
15106                 case "$useposix" in
15107                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15108                 esac
15109                 ;;
15110         Opcode|opcode)
15111                 case "$useopcode" in
15112                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15113                 esac
15114                 ;;
15115         Socket|socket)
15116                 case "$d_socket" in 
15117                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15118                 esac
15119                 ;;
15120         Sys/Syslog|sys/syslog)
15121                 : XXX syslog requires socket
15122                 case "$d_socket" in 
15123                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15124                 esac
15125                 ;;
15126         Thread|thread)
15127                 case "$usethreads" in 
15128                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15129                 esac
15130                 ;;
15131         IPC/SysV|ipc/sysv)
15132                 : XXX Do we need a useipcsysv variable here
15133                 case "${d_msg}${d_sem}${d_shm}" in 
15134                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15135                 esac
15136                 ;;
15137         *)      avail_ext="$avail_ext $xxx"
15138                 ;;
15139         esac
15140 done
15141
15142 set X $avail_ext
15143 shift
15144 avail_ext="$*"
15145
15146 : Now see which nonxs extensions are supported on this system.
15147 : For now assume all are.
15148 nonxs_ext=''
15149 for xxx in $nonxs_extensions ; do
15150         case "$xxx" in
15151         *)      nonxs_ext="$nonxs_ext $xxx"
15152                 ;;
15153         esac
15154 done
15155
15156 set X $nonxs_ext
15157 shift
15158 nonxs_ext="$*"
15159
15160 case $usedl in
15161 $define)
15162         $cat <<EOM
15163 A number of extensions are supplied with $package.  You may choose to
15164 compile these extensions for dynamic loading (the default), compile
15165 them into the $package executable (static loading), or not include
15166 them at all.  Answer "none" to include no extensions.
15167 Note that DynaLoader is always built and need not be mentioned here.
15168
15169 EOM
15170         case "$dynamic_ext" in
15171         '') dflt="$avail_ext" ;;
15172         *)      dflt="$dynamic_ext"
15173                 # Perhaps we are reusing an old out-of-date config.sh.
15174                 case "$hint" in
15175                 previous)
15176                         if test X"$dynamic_ext" != X"$avail_ext"; then
15177                                 $cat <<EOM
15178 NOTICE:  Your previous config.sh list may be incorrect. 
15179 The extensions now available to you are 
15180         ${avail_ext}
15181 but the default list from your previous config.sh is
15182         ${dynamic_ext} 
15183
15184 EOM
15185                         fi
15186                         ;;
15187                 esac
15188                 ;;
15189         esac
15190         case "$dflt" in
15191         '')     dflt=none;;
15192         esac
15193         rp="What extensions do you wish to load dynamically?"
15194         . ./myread
15195         case "$ans" in
15196         none) dynamic_ext=' ' ;;
15197         *) dynamic_ext="$ans" ;;
15198         esac
15199
15200         case "$static_ext" in
15201         '')
15202                 : Exclude those already listed in dynamic linking
15203                 dflt=''
15204                 for xxx in $avail_ext; do
15205                         case " $dynamic_ext " in
15206                         *" $xxx "*) ;;
15207                         *) dflt="$dflt $xxx" ;;
15208                         esac
15209                 done
15210                 set X $dflt
15211                 shift
15212                 dflt="$*"
15213                 ;;
15214         *)  dflt="$static_ext" 
15215                 ;;
15216         esac
15217
15218         case "$dflt" in
15219         '')     dflt=none;;
15220         esac
15221         rp="What extensions do you wish to load statically?"
15222         . ./myread
15223         case "$ans" in
15224         none) static_ext=' ' ;;
15225         *) static_ext="$ans" ;;
15226         esac
15227         ;;
15228 *)
15229         $cat <<EOM
15230 A number of extensions are supplied with $package.  Answer "none" 
15231 to include no extensions. 
15232 Note that DynaLoader is always built and need not be mentioned here.
15233
15234 EOM
15235         case "$static_ext" in
15236         '') dflt="$avail_ext" ;;
15237         *)      dflt="$static_ext"
15238                 # Perhaps we are reusing an old out-of-date config.sh.
15239                 case "$hint" in
15240                 previous)
15241                         if test X"$static_ext" != X"$avail_ext"; then
15242                                 $cat <<EOM
15243 NOTICE:  Your previous config.sh list may be incorrect. 
15244 The extensions now available to you are 
15245         ${avail_ext}
15246 but the default list from your previous config.sh is
15247         ${static_ext} 
15248
15249 EOM
15250                         fi
15251                         ;;
15252                 esac
15253                 ;;
15254         esac
15255         : Exclude those that are not xs extensions
15256         case "$dflt" in
15257         '')     dflt=none;;
15258         esac
15259         rp="What extensions do you wish to include?"
15260         . ./myread
15261         case "$ans" in
15262         none) static_ext=' ' ;;
15263         *) static_ext="$ans" ;;
15264         esac
15265         ;;
15266 esac
15267
15268 set X $dynamic_ext $static_ext $nonxs_ext
15269 shift
15270 extensions="$*"
15271
15272 : Remove build directory name from cppstdin so it can be used from
15273 : either the present location or the final installed location.
15274 echo " "
15275 : Get out of the UU directory to get correct path name.
15276 cd ..
15277 case "$cppstdin" in
15278 `pwd`/cppstdin)
15279         echo "Stripping down cppstdin path name"
15280         cppstdin=cppstdin
15281         ;;
15282 esac
15283 cd UU
15284
15285 : end of configuration questions
15286 echo " "
15287 echo "End of configuration questions."
15288 echo " "
15289
15290 : back to where it started
15291 if test -d ../UU; then
15292         cd ..
15293 fi
15294
15295 : configuration may be patched via a 'config.over' file
15296 if $test -f config.over; then
15297         echo " "
15298         dflt=y
15299         rp='I see a config.over file.  Do you wish to load it?'
15300         . UU/myread
15301         case "$ans" in
15302         n*) echo "OK, I'll ignore it.";;
15303         *)      . ./config.over
15304                 echo "Configuration override changes have been loaded."
15305                 ;;
15306         esac
15307 fi
15308
15309 : in case they want portability, strip down executable paths
15310 case "$d_portable" in
15311 "$define")
15312         echo " "
15313         echo "Stripping down executable paths..." >&4
15314         for file in $loclist $trylist; do
15315                 eval temp=\$$file
15316                 eval $file=`basename $temp`
15317         done
15318         ;;
15319 esac
15320
15321 : create config.sh file
15322 echo " "
15323 echo "Creating config.sh..." >&4
15324 $spitshell <<EOT >config.sh
15325 $startsh
15326 #
15327 # This file was produced by running the Configure script. It holds all the
15328 # definitions figured out by Configure. Should you modify one of these values,
15329 # do not forget to propagate your changes by running "Configure -der". You may
15330 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15331 #
15332
15333 # Package name      : $package
15334 # Source directory  : $src
15335 # Configuration time: $cf_time
15336 # Configured by     : $cf_by
15337 # Target system     : $myuname
15338
15339 Author='$Author'
15340 Date='$Date'
15341 Header='$Header'
15342 Id='$Id'
15343 Locker='$Locker'
15344 Log='$Log'
15345 Mcc='$Mcc'
15346 RCSfile='$RCSfile'
15347 Revision='$Revision'
15348 Source='$Source'
15349 State='$State'
15350 _a='$_a'
15351 _exe='$_exe'
15352 _o='$_o'
15353 afs='$afs'
15354 alignbytes='$alignbytes'
15355 ansi2knr='$ansi2knr'
15356 aphostname='$aphostname'
15357 api_revision='$api_revision'
15358 api_subversion='$api_subversion'
15359 api_version='$api_version'
15360 api_versionstring='$api_versionstring'
15361 ar='$ar'
15362 archlib='$archlib'
15363 archlibexp='$archlibexp'
15364 archname64='$archname64'
15365 archname='$archname'
15366 archobjs='$archobjs'
15367 awk='$awk'
15368 baserev='$baserev'
15369 bash='$bash'
15370 bin='$bin'
15371 bincompat5005='$bincompat5005'
15372 binexp='$binexp'
15373 bison='$bison'
15374 byacc='$byacc'
15375 byteorder='$byteorder'
15376 c='$c'
15377 castflags='$castflags'
15378 cat='$cat'
15379 cc='$cc'
15380 cccdlflags='$cccdlflags'
15381 ccdlflags='$ccdlflags'
15382 ccflags='$ccflags'
15383 ccflags_uselargefiles='$ccflags_uselargefiles'
15384 ccsymbols='$ccsymbols'
15385 cf_by='$cf_by'
15386 cf_email='$cf_email'
15387 cf_time='$cf_time'
15388 charsize='$charsize'
15389 chgrp='$chgrp'
15390 chmod='$chmod'
15391 chown='$chown'
15392 clocktype='$clocktype'
15393 comm='$comm'
15394 compress='$compress'
15395 contains='$contains'
15396 cp='$cp'
15397 cpio='$cpio'
15398 cpp='$cpp'
15399 cpp_stuff='$cpp_stuff'
15400 cppccsymbols='$cppccsymbols'
15401 cppflags='$cppflags'
15402 cpplast='$cpplast'
15403 cppminus='$cppminus'
15404 cpprun='$cpprun'
15405 cppstdin='$cppstdin'
15406 cppsymbols='$cppsymbols'
15407 crosscompile='$crosscompile'
15408 cryptlib='$cryptlib'
15409 csh='$csh'
15410 d_Gconvert='$d_Gconvert'
15411 d_PRIEldbl='$d_PRIEldbl'
15412 d_PRIFldbl='$d_PRIFldbl'
15413 d_PRIGldbl='$d_PRIGldbl'
15414 d_PRIX64='$d_PRIX64'
15415 d_PRId64='$d_PRId64'
15416 d_PRIeldbl='$d_PRIeldbl'
15417 d_PRIfldbl='$d_PRIfldbl'
15418 d_PRIgldbl='$d_PRIgldbl'
15419 d_PRIi64='$d_PRIi64'
15420 d_PRIo64='$d_PRIo64'
15421 d_PRIu64='$d_PRIu64'
15422 d_PRIx64='$d_PRIx64'
15423 d_access='$d_access'
15424 d_accessx='$d_accessx'
15425 d_alarm='$d_alarm'
15426 d_archlib='$d_archlib'
15427 d_atolf='$d_atolf'
15428 d_atoll='$d_atoll'
15429 d_attribut='$d_attribut'
15430 d_bcmp='$d_bcmp'
15431 d_bcopy='$d_bcopy'
15432 d_bincompat5005='$d_bincompat5005'
15433 d_bsd='$d_bsd'
15434 d_bsdgetpgrp='$d_bsdgetpgrp'
15435 d_bsdsetpgrp='$d_bsdsetpgrp'
15436 d_bzero='$d_bzero'
15437 d_casti32='$d_casti32'
15438 d_castneg='$d_castneg'
15439 d_charvspr='$d_charvspr'
15440 d_chown='$d_chown'
15441 d_chroot='$d_chroot'
15442 d_chsize='$d_chsize'
15443 d_closedir='$d_closedir'
15444 d_const='$d_const'
15445 d_crypt='$d_crypt'
15446 d_csh='$d_csh'
15447 d_cuserid='$d_cuserid'
15448 d_dbl_dig='$d_dbl_dig'
15449 d_difftime='$d_difftime'
15450 d_dirnamlen='$d_dirnamlen'
15451 d_dlerror='$d_dlerror'
15452 d_dlopen='$d_dlopen'
15453 d_dlsymun='$d_dlsymun'
15454 d_dosuid='$d_dosuid'
15455 d_drand48proto='$d_drand48proto'
15456 d_dup2='$d_dup2'
15457 d_eaccess='$d_eaccess'
15458 d_endgrent='$d_endgrent'
15459 d_endhent='$d_endhent'
15460 d_endnent='$d_endnent'
15461 d_endpent='$d_endpent'
15462 d_endpwent='$d_endpwent'
15463 d_endsent='$d_endsent'
15464 d_eofnblk='$d_eofnblk'
15465 d_eunice='$d_eunice'
15466 d_fchmod='$d_fchmod'
15467 d_fchown='$d_fchown'
15468 d_fcntl='$d_fcntl'
15469 d_fd_macros='$d_fd_macros'
15470 d_fd_set='$d_fd_set'
15471 d_fds_bits='$d_fds_bits'
15472 d_fgetpos='$d_fgetpos'
15473 d_flexfnam='$d_flexfnam'
15474 d_flock='$d_flock'
15475 d_fork='$d_fork'
15476 d_fpathconf='$d_fpathconf'
15477 d_fpos64_t='$d_fpos64_t'
15478 d_frexpl='$d_frexpl'
15479 d_fs_data_s='$d_fs_data_s'
15480 d_fseeko='$d_fseeko'
15481 d_fsetpos='$d_fsetpos'
15482 d_fstatfs='$d_fstatfs'
15483 d_fstatvfs='$d_fstatvfs'
15484 d_ftello='$d_ftello'
15485 d_ftime='$d_ftime'
15486 d_getcwd='$d_getcwd'
15487 d_getespwnam='$d_getespwnam'
15488 d_getfsstat='$d_getfsstat'
15489 d_getgrent='$d_getgrent'
15490 d_getgrps='$d_getgrps'
15491 d_gethbyaddr='$d_gethbyaddr'
15492 d_gethbyname='$d_gethbyname'
15493 d_gethent='$d_gethent'
15494 d_gethname='$d_gethname'
15495 d_gethostprotos='$d_gethostprotos'
15496 d_getlogin='$d_getlogin'
15497 d_getmnt='$d_getmnt'
15498 d_getmntent='$d_getmntent'
15499 d_getnbyaddr='$d_getnbyaddr'
15500 d_getnbyname='$d_getnbyname'
15501 d_getnent='$d_getnent'
15502 d_getnetprotos='$d_getnetprotos'
15503 d_getpbyname='$d_getpbyname'
15504 d_getpbynumber='$d_getpbynumber'
15505 d_getpent='$d_getpent'
15506 d_getpgid='$d_getpgid'
15507 d_getpgrp2='$d_getpgrp2'
15508 d_getpgrp='$d_getpgrp'
15509 d_getppid='$d_getppid'
15510 d_getprior='$d_getprior'
15511 d_getprotoprotos='$d_getprotoprotos'
15512 d_getprpwnam='$d_getprpwnam'
15513 d_getpwent='$d_getpwent'
15514 d_getsbyname='$d_getsbyname'
15515 d_getsbyport='$d_getsbyport'
15516 d_getsent='$d_getsent'
15517 d_getservprotos='$d_getservprotos'
15518 d_getspnam='$d_getspnam'
15519 d_gettimeod='$d_gettimeod'
15520 d_gnulibc='$d_gnulibc'
15521 d_grpasswd='$d_grpasswd'
15522 d_hasmntopt='$d_hasmntopt'
15523 d_htonl='$d_htonl'
15524 d_iconv='$d_iconv'
15525 d_index='$d_index'
15526 d_inetaton='$d_inetaton'
15527 d_int64_t='$d_int64_t'
15528 d_isascii='$d_isascii'
15529 d_isnan='$d_isnan'
15530 d_isnanl='$d_isnanl'
15531 d_killpg='$d_killpg'
15532 d_lchown='$d_lchown'
15533 d_ldbl_dig='$d_ldbl_dig'
15534 d_link='$d_link'
15535 d_locconv='$d_locconv'
15536 d_lockf='$d_lockf'
15537 d_longdbl='$d_longdbl'
15538 d_longlong='$d_longlong'
15539 d_lseekproto='$d_lseekproto'
15540 d_lstat='$d_lstat'
15541 d_madvise='$d_madvise'
15542 d_mblen='$d_mblen'
15543 d_mbstowcs='$d_mbstowcs'
15544 d_mbtowc='$d_mbtowc'
15545 d_memchr='$d_memchr'
15546 d_memcmp='$d_memcmp'
15547 d_memcpy='$d_memcpy'
15548 d_memmove='$d_memmove'
15549 d_memset='$d_memset'
15550 d_mkdir='$d_mkdir'
15551 d_mkdtemp='$d_mkdtemp'
15552 d_mkfifo='$d_mkfifo'
15553 d_mkstemp='$d_mkstemp'
15554 d_mkstemps='$d_mkstemps'
15555 d_mktime='$d_mktime'
15556 d_mmap='$d_mmap'
15557 d_modfl='$d_modfl'
15558 d_mprotect='$d_mprotect'
15559 d_msg='$d_msg'
15560 d_msg_ctrunc='$d_msg_ctrunc'
15561 d_msg_dontroute='$d_msg_dontroute'
15562 d_msg_oob='$d_msg_oob'
15563 d_msg_peek='$d_msg_peek'
15564 d_msg_proxy='$d_msg_proxy'
15565 d_msgctl='$d_msgctl'
15566 d_msgget='$d_msgget'
15567 d_msgrcv='$d_msgrcv'
15568 d_msgsnd='$d_msgsnd'
15569 d_msync='$d_msync'
15570 d_munmap='$d_munmap'
15571 d_mymalloc='$d_mymalloc'
15572 d_nice='$d_nice'
15573 d_nv_preserves_uv='$d_nv_preserves_uv'
15574 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15575 d_off64_t='$d_off64_t'
15576 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15577 d_oldpthreads='$d_oldpthreads'
15578 d_oldsock='$d_oldsock'
15579 d_open3='$d_open3'
15580 d_pathconf='$d_pathconf'
15581 d_pause='$d_pause'
15582 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15583 d_phostname='$d_phostname'
15584 d_pipe='$d_pipe'
15585 d_poll='$d_poll'
15586 d_portable='$d_portable'
15587 d_pthread_yield='$d_pthread_yield'
15588 d_pwage='$d_pwage'
15589 d_pwchange='$d_pwchange'
15590 d_pwclass='$d_pwclass'
15591 d_pwcomment='$d_pwcomment'
15592 d_pwexpire='$d_pwexpire'
15593 d_pwgecos='$d_pwgecos'
15594 d_pwpasswd='$d_pwpasswd'
15595 d_pwquota='$d_pwquota'
15596 d_qgcvt='$d_qgcvt'
15597 d_quad='$d_quad'
15598 d_readdir='$d_readdir'
15599 d_readlink='$d_readlink'
15600 d_rename='$d_rename'
15601 d_rewinddir='$d_rewinddir'
15602 d_rmdir='$d_rmdir'
15603 d_safebcpy='$d_safebcpy'
15604 d_safemcpy='$d_safemcpy'
15605 d_sanemcmp='$d_sanemcmp'
15606 d_sched_yield='$d_sched_yield'
15607 d_scm_rights='$d_scm_rights'
15608 d_seekdir='$d_seekdir'
15609 d_select='$d_select'
15610 d_sem='$d_sem'
15611 d_semctl='$d_semctl'
15612 d_semctl_semid_ds='$d_semctl_semid_ds'
15613 d_semctl_semun='$d_semctl_semun'
15614 d_semget='$d_semget'
15615 d_semop='$d_semop'
15616 d_setegid='$d_setegid'
15617 d_seteuid='$d_seteuid'
15618 d_setgrent='$d_setgrent'
15619 d_setgrps='$d_setgrps'
15620 d_sethent='$d_sethent'
15621 d_setlinebuf='$d_setlinebuf'
15622 d_setlocale='$d_setlocale'
15623 d_setnent='$d_setnent'
15624 d_setpent='$d_setpent'
15625 d_setpgid='$d_setpgid'
15626 d_setpgrp2='$d_setpgrp2'
15627 d_setpgrp='$d_setpgrp'
15628 d_setprior='$d_setprior'
15629 d_setproctitle='$d_setproctitle'
15630 d_setpwent='$d_setpwent'
15631 d_setregid='$d_setregid'
15632 d_setresgid='$d_setresgid'
15633 d_setresuid='$d_setresuid'
15634 d_setreuid='$d_setreuid'
15635 d_setrgid='$d_setrgid'
15636 d_setruid='$d_setruid'
15637 d_setsent='$d_setsent'
15638 d_setsid='$d_setsid'
15639 d_setvbuf='$d_setvbuf'
15640 d_sfio='$d_sfio'
15641 d_shm='$d_shm'
15642 d_shmat='$d_shmat'
15643 d_shmatprototype='$d_shmatprototype'
15644 d_shmctl='$d_shmctl'
15645 d_shmdt='$d_shmdt'
15646 d_shmget='$d_shmget'
15647 d_sigaction='$d_sigaction'
15648 d_sigsetjmp='$d_sigsetjmp'
15649 d_socket='$d_socket'
15650 d_socklen_t='$d_socklen_t'
15651 d_sockpair='$d_sockpair'
15652 d_socks5_init='$d_socks5_init'
15653 d_sqrtl='$d_sqrtl'
15654 d_statblks='$d_statblks'
15655 d_statfs_f_flags='$d_statfs_f_flags'
15656 d_statfs_s='$d_statfs_s'
15657 d_statvfs='$d_statvfs'
15658 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15659 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15660 d_stdio_stream_array='$d_stdio_stream_array'
15661 d_stdiobase='$d_stdiobase'
15662 d_stdstdio='$d_stdstdio'
15663 d_strchr='$d_strchr'
15664 d_strcoll='$d_strcoll'
15665 d_strctcpy='$d_strctcpy'
15666 d_strerrm='$d_strerrm'
15667 d_strerror='$d_strerror'
15668 d_strtod='$d_strtod'
15669 d_strtol='$d_strtol'
15670 d_strtold='$d_strtold'
15671 d_strtoll='$d_strtoll'
15672 d_strtoul='$d_strtoul'
15673 d_strtoull='$d_strtoull'
15674 d_strtouq='$d_strtouq'
15675 d_strxfrm='$d_strxfrm'
15676 d_suidsafe='$d_suidsafe'
15677 d_symlink='$d_symlink'
15678 d_syscall='$d_syscall'
15679 d_sysconf='$d_sysconf'
15680 d_sysernlst='$d_sysernlst'
15681 d_syserrlst='$d_syserrlst'
15682 d_system='$d_system'
15683 d_tcgetpgrp='$d_tcgetpgrp'
15684 d_tcsetpgrp='$d_tcsetpgrp'
15685 d_telldir='$d_telldir'
15686 d_telldirproto='$d_telldirproto'
15687 d_time='$d_time'
15688 d_times='$d_times'
15689 d_truncate='$d_truncate'
15690 d_tzname='$d_tzname'
15691 d_umask='$d_umask'
15692 d_uname='$d_uname'
15693 d_union_semun='$d_union_semun'
15694 d_ustat='$d_ustat'
15695 d_vendorarch='$d_vendorarch'
15696 d_vendorbin='$d_vendorbin'
15697 d_vendorlib='$d_vendorlib'
15698 d_vfork='$d_vfork'
15699 d_void_closedir='$d_void_closedir'
15700 d_voidsig='$d_voidsig'
15701 d_voidtty='$d_voidtty'
15702 d_volatile='$d_volatile'
15703 d_vprintf='$d_vprintf'
15704 d_wait4='$d_wait4'
15705 d_waitpid='$d_waitpid'
15706 d_wcstombs='$d_wcstombs'
15707 d_wctomb='$d_wctomb'
15708 d_xenix='$d_xenix'
15709 date='$date'
15710 db_hashtype='$db_hashtype'
15711 db_prefixtype='$db_prefixtype'
15712 defvoidused='$defvoidused'
15713 direntrytype='$direntrytype'
15714 dlext='$dlext'
15715 dlsrc='$dlsrc'
15716 doublesize='$doublesize'
15717 drand01='$drand01'
15718 dynamic_ext='$dynamic_ext'
15719 eagain='$eagain'
15720 ebcdic='$ebcdic'
15721 echo='$echo'
15722 egrep='$egrep'
15723 emacs='$emacs'
15724 eunicefix='$eunicefix'
15725 exe_ext='$exe_ext'
15726 expr='$expr'
15727 extensions='$extensions'
15728 fflushNULL='$fflushNULL'
15729 fflushall='$fflushall'
15730 find='$find'
15731 firstmakefile='$firstmakefile'
15732 flex='$flex'
15733 fpossize='$fpossize'
15734 fpostype='$fpostype'
15735 freetype='$freetype'
15736 full_ar='$full_ar'
15737 full_csh='$full_csh'
15738 full_sed='$full_sed'
15739 gccosandvers='$gccosandvers'
15740 gccversion='$gccversion'
15741 gidformat='$gidformat'
15742 gidsign='$gidsign'
15743 gidsize='$gidsize'
15744 gidtype='$gidtype'
15745 glibpth='$glibpth'
15746 grep='$grep'
15747 groupcat='$groupcat'
15748 groupstype='$groupstype'
15749 gzip='$gzip'
15750 h_fcntl='$h_fcntl'
15751 h_sysfile='$h_sysfile'
15752 hint='$hint'
15753 hostcat='$hostcat'
15754 huge='$huge'
15755 i16size='$i16size'
15756 i16type='$i16type'
15757 i32size='$i32size'
15758 i32type='$i32type'
15759 i64size='$i64size'
15760 i64type='$i64type'
15761 i8size='$i8size'
15762 i8type='$i8type'
15763 i_arpainet='$i_arpainet'
15764 i_bsdioctl='$i_bsdioctl'
15765 i_db='$i_db'
15766 i_dbm='$i_dbm'
15767 i_dirent='$i_dirent'
15768 i_dld='$i_dld'
15769 i_dlfcn='$i_dlfcn'
15770 i_fcntl='$i_fcntl'
15771 i_float='$i_float'
15772 i_gdbm='$i_gdbm'
15773 i_grp='$i_grp'
15774 i_iconv='$i_iconv'
15775 i_ieeefp='$i_ieeefp'
15776 i_inttypes='$i_inttypes'
15777 i_libutil='$i_libutil'
15778 i_limits='$i_limits'
15779 i_locale='$i_locale'
15780 i_machcthr='$i_machcthr'
15781 i_malloc='$i_malloc'
15782 i_math='$i_math'
15783 i_memory='$i_memory'
15784 i_mntent='$i_mntent'
15785 i_ndbm='$i_ndbm'
15786 i_netdb='$i_netdb'
15787 i_neterrno='$i_neterrno'
15788 i_netinettcp='$i_netinettcp'
15789 i_niin='$i_niin'
15790 i_poll='$i_poll'
15791 i_prot='$i_prot'
15792 i_pthread='$i_pthread'
15793 i_pwd='$i_pwd'
15794 i_rpcsvcdbm='$i_rpcsvcdbm'
15795 i_sfio='$i_sfio'
15796 i_sgtty='$i_sgtty'
15797 i_shadow='$i_shadow'
15798 i_socks='$i_socks'
15799 i_stdarg='$i_stdarg'
15800 i_stddef='$i_stddef'
15801 i_stdlib='$i_stdlib'
15802 i_string='$i_string'
15803 i_sunmath='$i_sunmath'
15804 i_sysaccess='$i_sysaccess'
15805 i_sysdir='$i_sysdir'
15806 i_sysfile='$i_sysfile'
15807 i_sysfilio='$i_sysfilio'
15808 i_sysin='$i_sysin'
15809 i_sysioctl='$i_sysioctl'
15810 i_syslog='$i_syslog'
15811 i_sysmman='$i_sysmman'
15812 i_sysmode='$i_sysmode'
15813 i_sysmount='$i_sysmount'
15814 i_sysndir='$i_sysndir'
15815 i_sysparam='$i_sysparam'
15816 i_sysresrc='$i_sysresrc'
15817 i_syssecrt='$i_syssecrt'
15818 i_sysselct='$i_sysselct'
15819 i_syssockio='$i_syssockio'
15820 i_sysstat='$i_sysstat'
15821 i_sysstatfs='$i_sysstatfs'
15822 i_sysstatvfs='$i_sysstatvfs'
15823 i_systime='$i_systime'
15824 i_systimek='$i_systimek'
15825 i_systimes='$i_systimes'
15826 i_systypes='$i_systypes'
15827 i_sysuio='$i_sysuio'
15828 i_sysun='$i_sysun'
15829 i_sysutsname='$i_sysutsname'
15830 i_sysvfs='$i_sysvfs'
15831 i_syswait='$i_syswait'
15832 i_termio='$i_termio'
15833 i_termios='$i_termios'
15834 i_time='$i_time'
15835 i_unistd='$i_unistd'
15836 i_ustat='$i_ustat'
15837 i_utime='$i_utime'
15838 i_values='$i_values'
15839 i_varargs='$i_varargs'
15840 i_varhdr='$i_varhdr'
15841 i_vfork='$i_vfork'
15842 ignore_versioned_solibs='$ignore_versioned_solibs'
15843 inc_version_list='$inc_version_list'
15844 inc_version_list_init='$inc_version_list_init'
15845 incpath='$incpath'
15846 inews='$inews'
15847 installarchlib='$installarchlib'
15848 installbin='$installbin'
15849 installman1dir='$installman1dir'
15850 installman3dir='$installman3dir'
15851 installprefix='$installprefix'
15852 installprefixexp='$installprefixexp'
15853 installprivlib='$installprivlib'
15854 installscript='$installscript'
15855 installsitearch='$installsitearch'
15856 installsitebin='$installsitebin'
15857 installsitelib='$installsitelib'
15858 installstyle='$installstyle'
15859 installusrbinperl='$installusrbinperl'
15860 installvendorarch='$installvendorarch'
15861 installvendorbin='$installvendorbin'
15862 installvendorlib='$installvendorlib'
15863 intsize='$intsize'
15864 ivdformat='$ivdformat'
15865 ivsize='$ivsize'
15866 ivtype='$ivtype'
15867 known_extensions='$known_extensions'
15868 ksh='$ksh'
15869 large='$large'
15870 ld='$ld'
15871 lddlflags='$lddlflags'
15872 ldflags='$ldflags'
15873 ldflags_uselargefiles='$ldflags_uselargefiles'
15874 ldlibpthname='$ldlibpthname'
15875 less='$less'
15876 lib_ext='$lib_ext'
15877 libc='$libc'
15878 libperl='$libperl'
15879 libpth='$libpth'
15880 libs='$libs'
15881 libsdirs='$libsdirs'
15882 libsfiles='$libsfiles'
15883 libsfound='$libsfound'
15884 libspath='$libspath'
15885 libswanted='$libswanted'
15886 libswanted_uselargefiles='$libswanted_uselargefiles'
15887 line='$line'
15888 lint='$lint'
15889 lkflags='$lkflags'
15890 ln='$ln'
15891 lns='$lns'
15892 locincpth='$locincpth'
15893 loclibpth='$loclibpth'
15894 longdblsize='$longdblsize'
15895 longlongsize='$longlongsize'
15896 longsize='$longsize'
15897 lp='$lp'
15898 lpr='$lpr'
15899 ls='$ls'
15900 lseeksize='$lseeksize'
15901 lseektype='$lseektype'
15902 mail='$mail'
15903 mailx='$mailx'
15904 make='$make'
15905 make_set_make='$make_set_make'
15906 mallocobj='$mallocobj'
15907 mallocsrc='$mallocsrc'
15908 malloctype='$malloctype'
15909 man1dir='$man1dir'
15910 man1direxp='$man1direxp'
15911 man1ext='$man1ext'
15912 man3dir='$man3dir'
15913 man3direxp='$man3direxp'
15914 man3ext='$man3ext'
15915 medium='$medium'
15916 mips_type='$mips_type'
15917 mkdir='$mkdir'
15918 mmaptype='$mmaptype'
15919 models='$models'
15920 modetype='$modetype'
15921 more='$more'
15922 multiarch='$multiarch'
15923 mv='$mv'
15924 myarchname='$myarchname'
15925 mydomain='$mydomain'
15926 myhostname='$myhostname'
15927 myuname='$myuname'
15928 n='$n'
15929 netdb_hlen_type='$netdb_hlen_type'
15930 netdb_host_type='$netdb_host_type'
15931 netdb_name_type='$netdb_name_type'
15932 netdb_net_type='$netdb_net_type'
15933 nm='$nm'
15934 nm_opt='$nm_opt'
15935 nm_so_opt='$nm_so_opt'
15936 nonxs_ext='$nonxs_ext'
15937 nroff='$nroff'
15938 nvEformat='$nvEformat'
15939 nvFformat='$nvFformat'
15940 nvGformat='$nvGformat'
15941 nveformat='$nveformat'
15942 nvfformat='$nvfformat'
15943 nvgformat='$nvgformat'
15944 nvsize='$nvsize'
15945 nvtype='$nvtype'
15946 o_nonblock='$o_nonblock'
15947 obj_ext='$obj_ext'
15948 old_pthread_create_joinable='$old_pthread_create_joinable'
15949 optimize='$optimize'
15950 orderlib='$orderlib'
15951 osname='$osname'
15952 osvers='$osvers'
15953 otherlibdirs='$otherlibdirs'
15954 package='$package'
15955 pager='$pager'
15956 passcat='$passcat'
15957 patchlevel='$patchlevel'
15958 path_sep='$path_sep'
15959 perl5='$perl5'
15960 perl='$perl'
15961 perladmin='$perladmin'
15962 perlpath='$perlpath'
15963 pg='$pg'
15964 phostname='$phostname'
15965 pidtype='$pidtype'
15966 plibpth='$plibpth'
15967 pm_apiversion='$pm_apiversion'
15968 pmake='$pmake'
15969 pr='$pr'
15970 prefix='$prefix'
15971 prefixexp='$prefixexp'
15972 privlib='$privlib'
15973 privlibexp='$privlibexp'
15974 prototype='$prototype'
15975 ptrsize='$ptrsize'
15976 quadkind='$quadkind'
15977 quadtype='$quadtype'
15978 randbits='$randbits'
15979 randfunc='$randfunc'
15980 randseedtype='$randseedtype'
15981 ranlib='$ranlib'
15982 rd_nodata='$rd_nodata'
15983 revision='$revision'
15984 rm='$rm'
15985 rmail='$rmail'
15986 runnm='$runnm'
15987 sPRIEldbl='$sPRIEldbl'
15988 sPRIFldbl='$sPRIFldbl'
15989 sPRIGldbl='$sPRIGldbl'
15990 sPRIX64='$sPRIX64'
15991 sPRId64='$sPRId64'
15992 sPRIeldbl='$sPRIeldbl'
15993 sPRIfldbl='$sPRIfldbl'
15994 sPRIgldbl='$sPRIgldbl'
15995 sPRIi64='$sPRIi64'
15996 sPRIo64='$sPRIo64'
15997 sPRIu64='$sPRIu64'
15998 sPRIx64='$sPRIx64'
15999 sched_yield='$sched_yield'
16000 scriptdir='$scriptdir'
16001 scriptdirexp='$scriptdirexp'
16002 sed='$sed'
16003 seedfunc='$seedfunc'
16004 selectminbits='$selectminbits'
16005 selecttype='$selecttype'
16006 sendmail='$sendmail'
16007 sh='$sh'
16008 shar='$shar'
16009 sharpbang='$sharpbang'
16010 shmattype='$shmattype'
16011 shortsize='$shortsize'
16012 shrpenv='$shrpenv'
16013 shsharp='$shsharp'
16014 sig_count='$sig_count'
16015 sig_name='$sig_name'
16016 sig_name_init='$sig_name_init'
16017 sig_num='$sig_num'
16018 sig_num_init='$sig_num_init'
16019 signal_t='$signal_t'
16020 sitearch='$sitearch'
16021 sitearchexp='$sitearchexp'
16022 sitebin='$sitebin'
16023 sitebinexp='$sitebinexp'
16024 sitelib='$sitelib'
16025 sitelib_stem='$sitelib_stem'
16026 sitelibexp='$sitelibexp'
16027 siteprefix='$siteprefix'
16028 siteprefixexp='$siteprefixexp'
16029 sizesize='$sizesize'
16030 sizetype='$sizetype'
16031 sleep='$sleep'
16032 smail='$smail'
16033 small='$small'
16034 so='$so'
16035 sockethdr='$sockethdr'
16036 socketlib='$socketlib'
16037 socksizetype='$socksizetype'
16038 sort='$sort'
16039 spackage='$spackage'
16040 spitshell='$spitshell'
16041 split='$split'
16042 src='$src'
16043 ssizetype='$ssizetype'
16044 startperl='$startperl'
16045 startsh='$startsh'
16046 static_ext='$static_ext'
16047 stdchar='$stdchar'
16048 stdio_base='$stdio_base'
16049 stdio_bufsiz='$stdio_bufsiz'
16050 stdio_cnt='$stdio_cnt'
16051 stdio_filbuf='$stdio_filbuf'
16052 stdio_ptr='$stdio_ptr'
16053 stdio_stream_array='$stdio_stream_array'
16054 strings='$strings'
16055 submit='$submit'
16056 subversion='$subversion'
16057 sysman='$sysman'
16058 tail='$tail'
16059 tar='$tar'
16060 tbl='$tbl'
16061 tee='$tee'
16062 test='$test'
16063 timeincl='$timeincl'
16064 timetype='$timetype'
16065 touch='$touch'
16066 tr='$tr'
16067 trnl='$trnl'
16068 troff='$troff'
16069 u16size='$u16size'
16070 u16type='$u16type'
16071 u32size='$u32size'
16072 u32type='$u32type'
16073 u64size='$u64size'
16074 u64type='$u64type'
16075 u8size='$u8size'
16076 u8type='$u8type'
16077 uidformat='$uidformat'
16078 uidsign='$uidsign'
16079 uidsize='$uidsize'
16080 uidtype='$uidtype'
16081 uname='$uname'
16082 uniq='$uniq'
16083 uquadtype='$uquadtype'
16084 use5005threads='$use5005threads'
16085 use64bitall='$use64bitall'
16086 use64bitint='$use64bitint'
16087 usedl='$usedl'
16088 useithreads='$useithreads'
16089 uselargefiles='$uselargefiles'
16090 uselongdouble='$uselongdouble'
16091 usemorebits='$usemorebits'
16092 usemultiplicity='$usemultiplicity'
16093 usemymalloc='$usemymalloc'
16094 usenm='$usenm'
16095 useopcode='$useopcode'
16096 useperlio='$useperlio'
16097 useposix='$useposix'
16098 usesfio='$usesfio'
16099 useshrplib='$useshrplib'
16100 usesocks='$usesocks'
16101 usethreads='$usethreads'
16102 usevendorprefix='$usevendorprefix'
16103 usevfork='$usevfork'
16104 usrinc='$usrinc'
16105 uuname='$uuname'
16106 uvXformat='$uvXformat'
16107 uvoformat='$uvoformat'
16108 uvsize='$uvsize'
16109 uvtype='$uvtype'
16110 uvuformat='$uvuformat'
16111 uvxformat='$uvxformat'
16112 vendorarch='$vendorarch'
16113 vendorarchexp='$vendorarchexp'
16114 vendorbin='$vendorbin'
16115 vendorbinexp='$vendorbinexp'
16116 vendorlib='$vendorlib'
16117 vendorlib_stem='$vendorlib_stem'
16118 vendorlibexp='$vendorlibexp'
16119 vendorprefix='$vendorprefix'
16120 vendorprefixexp='$vendorprefixexp'
16121 version='$version'
16122 vi='$vi'
16123 voidflags='$voidflags'
16124 xlibpth='$xlibpth'
16125 xs_apiversion='$xs_apiversion'
16126 zcat='$zcat'
16127 zip='$zip'
16128 EOT
16129
16130 : Add in command line options if available
16131 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16132
16133 : add special variables
16134 $test -f $src/patchlevel.h && \
16135 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16136 echo "CONFIGDOTSH=true" >>config.sh
16137
16138 : propagate old symbols
16139 if $test -f UU/config.sh; then
16140         <UU/config.sh sort | uniq >UU/oldconfig.sh
16141         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16142         sort | uniq -u >UU/oldsyms
16143         set X `cat UU/oldsyms`
16144         shift
16145         case $# in
16146         0) ;;
16147         *)
16148                 cat <<EOM
16149 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16150 EOM
16151                 echo "# Variables propagated from previous config.sh file." >>config.sh
16152                 for sym in `cat UU/oldsyms`; do
16153                         echo "    Propagating $hint variable "'$'"$sym..."
16154                         eval 'tmp="$'"${sym}"'"'
16155                         echo "$tmp" | \
16156                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16157                 done
16158                 ;;
16159         esac
16160 fi
16161
16162 : Finish up by extracting the .SH files
16163 case "$alldone" in
16164 exit)
16165         $rm -rf UU
16166         echo "Done."
16167         exit 0
16168         ;;
16169 cont)
16170         ;;
16171 '')
16172         dflt=''
16173         nostick=true
16174         $cat <<EOM
16175
16176 If you'd like to make any changes to the config.sh file before I begin
16177 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16178
16179 EOM
16180         rp="Press return or use a shell escape to edit config.sh:"
16181         . UU/myread
16182         nostick=''
16183         case "$ans" in
16184         '') ;;
16185         *) : in case they cannot read
16186                 sh 1>&4 -c "$ans";;
16187         esac
16188         ;;
16189 esac
16190
16191 : if this fails, just run all the .SH files by hand
16192 . ./config.sh
16193
16194 echo " "
16195 exec 1>&4
16196 . ./UU/extract
16197
16198 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16199         dflt=y
16200         case "$silent" in
16201         true) ;;
16202         *)
16203                 $cat <<EOM
16204
16205 Now you need to generate make dependencies by running "$make depend".
16206 You might prefer to run it in background: "$make depend > makedepend.out &"
16207 It can take a while, so you might not want to run it right now.
16208
16209 EOM
16210                 ;;
16211         esac
16212         rp="Run $make depend now?"
16213         . UU/myread
16214         case "$ans" in
16215         y*)
16216                 $make depend && echo "Now you must run a $make."
16217                 ;;
16218         *)
16219                 echo "You must run '$make depend' then '$make'."
16220                 ;;
16221         esac
16222 elif test -f [Mm]akefile; then
16223         echo " "
16224         echo "Now you must run a $make."
16225 else
16226         echo "Done."
16227 fi
16228
16229 if $test -f Policy.sh; then
16230     $cat <<EOM
16231
16232 If you compile $package on a different machine or from a different object
16233 directory, copy the Policy.sh file from this object directory to the
16234 new one before you run Configure -- this will help you with most of
16235 the policy defaults.
16236
16237 EOM
16238 fi
16239 if $test -f config.msg; then
16240     echo "Hmm.  I also noted the following information while running:"
16241     echo " "
16242     $cat config.msg >&4
16243     $rm -f config.msg
16244 fi
16245 $rm -f kit*isdone ark*isdone
16246 $rm -rf UU
16247
16248 : End of Configure
16249