Cwd::_backtick_pwd does not check return value
[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 Wed Aug 16 02:10:47 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_printf_exp_digits=''
459 d_old_pthread_create_joinable=''
460 old_pthread_create_joinable=''
461 d_pthread_yield=''
462 d_sched_yield=''
463 sched_yield=''
464 d_qgcvt=''
465 d_readdir=''
466 d_rewinddir=''
467 d_seekdir=''
468 d_telldir=''
469 d_readlink=''
470 d_rename=''
471 d_rmdir=''
472 d_safebcpy=''
473 d_safemcpy=''
474 d_sanemcmp=''
475 d_select=''
476 d_sem=''
477 d_semctl=''
478 d_semget=''
479 d_semop=''
480 d_setegid=''
481 d_seteuid=''
482 d_setgrent=''
483 d_setgrps=''
484 d_sethent=''
485 d_setlinebuf=''
486 d_setlocale=''
487 d_setnent=''
488 d_setpent=''
489 d_setpgid=''
490 d_setpgrp2=''
491 d_bsdsetpgrp=''
492 d_setpgrp=''
493 d_setprior=''
494 d_setproctitle=''
495 d_setpwent=''
496 d_setregid=''
497 d_setresgid=''
498 d_setresuid=''
499 d_setreuid=''
500 d_setrgid=''
501 d_setruid=''
502 d_setsent=''
503 d_setsid=''
504 d_setvbuf=''
505 d_sfio=''
506 usesfio=''
507 d_shm=''
508 d_shmat=''
509 d_shmatprototype=''
510 shmattype=''
511 d_shmctl=''
512 d_shmdt=''
513 d_shmget=''
514 d_sigaction=''
515 d_sigsetjmp=''
516 d_msg_ctrunc=''
517 d_msg_dontroute=''
518 d_msg_oob=''
519 d_msg_peek=''
520 d_msg_proxy=''
521 d_oldsock=''
522 d_scm_rights=''
523 d_socket=''
524 d_sockpair=''
525 sockethdr=''
526 socketlib=''
527 d_socklen_t=''
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 uvoformat=''
828 uvuformat=''
829 uvxformat=''
830 pidtype=''
831 prefix=''
832 prefixexp=''
833 installprivlib=''
834 privlib=''
835 privlibexp=''
836 prototype=''
837 ptrsize=''
838 d_PRIX64=''
839 d_PRId64=''
840 d_PRIi64=''
841 d_PRIo64=''
842 d_PRIu64=''
843 d_PRIx64=''
844 sPRIX64=''
845 sPRId64=''
846 sPRIi64=''
847 sPRIo64=''
848 sPRIu64=''
849 sPRIx64=''
850 d_quad=''
851 quadkind=''
852 quadtype=''
853 uquadtype=''
854 drand01=''
855 randbits=''
856 randfunc=''
857 randseedtype=''
858 seedfunc=''
859 installscript=''
860 scriptdir=''
861 scriptdirexp=''
862 selectminbits=''
863 selecttype=''
864 sh=''
865 sig_count=''
866 sig_name=''
867 sig_name_init=''
868 sig_num=''
869 sig_num_init=''
870 installsitearch=''
871 sitearch=''
872 sitearchexp=''
873 installsitebin=''
874 sitebin=''
875 sitebinexp=''
876 installsitelib=''
877 sitelib=''
878 sitelib_stem=''
879 sitelibexp=''
880 siteprefix=''
881 siteprefixexp=''
882 sizesize=''
883 sizetype=''
884 so=''
885 socksizetype=''
886 sharpbang=''
887 shsharp=''
888 spitshell=''
889 src=''
890 ssizetype=''
891 startperl=''
892 startsh=''
893 stdchar=''
894 d_stdio_stream_array=''
895 stdio_stream_array=''
896 sysman=''
897 trnl=''
898 uidformat=''
899 uidsign=''
900 uidsize=''
901 uidtype=''
902 archname64=''
903 use64bitall=''
904 use64bitint=''
905 ccflags_uselargefiles=''
906 ldflags_uselargefiles=''
907 libswanted_uselargefiles=''
908 uselargefiles=''
909 uselongdouble=''
910 usemorebits=''
911 usemultiplicity=''
912 nm_opt=''
913 nm_so_opt=''
914 runnm=''
915 usenm=''
916 useperlio=''
917 usesocks=''
918 d_oldpthreads=''
919 use5005threads=''
920 useithreads=''
921 usethreads=''
922 incpath=''
923 mips_type=''
924 usrinc=''
925 d_vendorarch=''
926 installvendorarch=''
927 vendorarch=''
928 vendorarchexp=''
929 d_vendorbin=''
930 installvendorbin=''
931 vendorbin=''
932 vendorbinexp=''
933 d_vendorlib=''
934 installvendorlib=''
935 vendorlib=''
936 vendorlib_stem=''
937 vendorlibexp=''
938 usevendorprefix=''
939 vendorprefix=''
940 vendorprefixexp=''
941 defvoidused=''
942 voidflags=''
943 pm_apiversion=''
944 xs_apiversion=''
945 CONFIG=''
946
947 define='define'
948 undef='undef'
949 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
950 rmlist=''
951
952 : We must find out about Eunice early
953 eunicefix=':'
954 if test -f /etc/unixtovms; then
955         eunicefix=/etc/unixtovms
956 fi
957 if test -f /etc/unixtovms.exe; then
958         eunicefix=/etc/unixtovms.exe
959 fi
960
961 i_whoami=''
962 : set useposix=false in your hint file to disable the POSIX extension.
963 useposix=true
964 : set useopcode=false in your hint file to disable the Opcode extension.
965 useopcode=true
966 : Trailing extension.  Override this in a hint file, if needed.
967 _exe=''
968 : Extra object files, if any, needed on this platform.
969 archobjs=''
970 : Possible local include directories to search.
971 : Set locincpth to "" in a hint file to defeat local include searches.
972 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
973 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
974 :
975 : no include file wanted by default
976 inclwanted=''
977
978 groupstype=''
979 : change the next line if compiling for Xenix/286 on Xenix/386
980 xlibpth='/usr/lib/386 /lib/386'
981 : Possible local library directories to search.
982 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
983 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
984
985 : general looking path for locating libraries
986 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
987 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
988 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
989 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
990 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
991
992 : Private path used by Configure to find libraries.  Its value
993 : is prepended to libpth. This variable takes care of special
994 : machines, like the mips.  Usually, it should be empty.
995 plibpth=''
996
997 : default library list
998 libswanted=''
999 : some systems want to use only the non-versioned libso:s
1000 ignore_versioned_solibs=''
1001 ccflags_uselargefiles=''
1002 ldflags_uselargefiles=''
1003 libswanted_uselargefiles=''
1004 : set usemultiplicity on the Configure command line to enable multiplicity.
1005 : set usesocks on the Configure command line to enable socks.
1006 : set usethreads on the Configure command line to enable threads.
1007 : full support for void wanted by default
1008 defvoidused=15
1009
1010 : List of libraries we want.
1011 : If anyone needs -lnet, put it in a hint file.
1012 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1013 libswanted="$libswanted dld ld sun m c cposix posix"
1014 libswanted="$libswanted ndir dir crypt sec"
1015 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1016 : We probably want to search /usr/shlib before most other libraries.
1017 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1018 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1019 glibpth="/usr/shlib $glibpth"
1020 : Do not use vfork unless overridden by a hint file.
1021 usevfork=false
1022
1023 : Find the basic shell for Bourne shell scripts
1024 case "$sh" in
1025 '')
1026         case "$SYSTYPE" in
1027         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1028         *) xxx='/bin/sh';;
1029         esac
1030         if test -f "$xxx"; then
1031                 sh="$xxx"
1032         else
1033                 : Build up a list and do a single loop so we can 'break' out.
1034                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1035                 for xxx in sh bash ksh pdksh ash; do
1036                         for p in $pth; do
1037                                 try="$try ${p}/${xxx}"
1038                         done
1039                 done
1040                 for xxx in $try; do
1041                         if test -f "$xxx"; then
1042                                 sh="$xxx";
1043                                 break
1044                         elif test -f "$xxx.exe"; then
1045                                 sh="$xxx";
1046                                 break
1047                         fi
1048                 done
1049         fi
1050         ;;
1051 esac
1052
1053 case "$sh" in
1054 '')     cat <<EOM >&2
1055 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1056
1057 Usually it's in /bin/sh.  How did you even get this far?
1058 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1059 we'll try to straighten this all out.
1060 EOM
1061         exit 1
1062         ;;
1063 esac
1064
1065 : see if sh knows # comments
1066 if `$sh -c '#' >/dev/null 2>&1`; then
1067         shsharp=true
1068         spitshell=cat
1069         xcat=/bin/cat
1070         test -f $xcat || xcat=/usr/bin/cat
1071         echo "#!$xcat" >try
1072         $eunicefix try
1073         chmod +x try
1074         ./try > today
1075         if test -s today; then
1076                 sharpbang='#!'
1077         else
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                         sharpbang=': use '
1086                 fi
1087         fi
1088 else
1089         echo " "
1090         echo "Your $sh doesn't grok # comments--I will strip them later on."
1091         shsharp=false
1092         cd ..
1093         echo "exec grep -v '^[  ]*#'" >spitshell
1094         chmod +x spitshell
1095         $eunicefix spitshell
1096         spitshell=`pwd`/spitshell
1097         cd UU
1098         echo "I presume that if # doesn't work, #! won't work either!"
1099         sharpbang=': use '
1100 fi
1101 rm -f try today
1102
1103 : figure out how to guarantee sh startup
1104 case "$startsh" in
1105 '') startsh=${sharpbang}${sh} ;;
1106 *)
1107 esac
1108 cat >try <<EOSS
1109 $startsh
1110 set abc
1111 test "$?abc" != 1
1112 EOSS
1113
1114 chmod +x try
1115 $eunicefix try
1116 if ./try; then
1117         : echo "Yup, it does."
1118 else
1119         echo "Hmm... '$startsh' does not guarantee sh startup..."
1120         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1121 fi
1122 rm -f try
1123
1124
1125 : Save command line options in file UU/cmdline.opt for later use in
1126 : generating config.sh.
1127 cat > cmdline.opt <<EOSH
1128 # Configure command line arguments.
1129 config_arg0='$0'
1130 config_args='$*'
1131 config_argc=$#
1132 EOSH
1133 argn=1
1134 for arg in "$@"; do
1135         cat >>cmdline.opt <<EOSH
1136 config_arg$argn='$arg'
1137 EOSH
1138         argn=`expr $argn + 1`
1139 done
1140
1141 : produce awk script to parse command line options
1142 cat >options.awk <<'EOF'
1143 BEGIN {
1144         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1145
1146         len = length(optstr);
1147         for (i = 1; i <= len; i++) {
1148                 c = substr(optstr, i, 1);
1149                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1150                 if (a == ":") {
1151                         arg[c] = 1;
1152                         i++;
1153                 }
1154                 opt[c] = 1;
1155         }
1156 }
1157 {
1158         expect = 0;
1159         str = $0;
1160         if (substr(str, 1, 1) != "-") {
1161                 printf("'%s'\n", str);
1162                 next;
1163         }
1164         len = length($0);
1165         for (i = 2; i <= len; i++) {
1166                 c = substr(str, i, 1);
1167                 if (!opt[c]) {
1168                         printf("-%s\n", substr(str, i));
1169                         next;
1170                 }
1171                 printf("-%s\n", c);
1172                 if (arg[c]) {
1173                         if (i < len)
1174                                 printf("'%s'\n", substr(str, i + 1));
1175                         else
1176                                 expect = 1;
1177                         next;
1178                 }
1179         }
1180 }
1181 END {
1182         if (expect)
1183                 print "?";
1184 }
1185 EOF
1186
1187 : process the command line options
1188 set X `for arg in "$@"; do echo "X$arg"; done |
1189         sed -e s/X// | awk -f options.awk`
1190 eval "set $*"
1191 shift
1192 rm -f options.awk
1193
1194 : set up default values
1195 fastread=''
1196 reuseval=false
1197 config_sh=''
1198 alldone=''
1199 error=''
1200 silent=''
1201 extractsh=''
1202 override=''
1203 knowitall=''
1204 rm -f optdef.sh posthint.sh
1205 cat >optdef.sh <<EOS
1206 $startsh
1207 EOS
1208
1209
1210 : option parsing
1211 while test $# -gt 0; do
1212         case "$1" in
1213         -d) shift; fastread=yes;;
1214         -e) shift; alldone=cont;;
1215         -f)
1216                 shift
1217                 cd ..
1218                 if test -r "$1"; then
1219                         config_sh="$1"
1220                 else
1221                         echo "$me: cannot read config file $1." >&2
1222                         error=true
1223                 fi
1224                 cd UU
1225                 shift;;
1226         -h) shift; error=true;;
1227         -r) shift; reuseval=true;;
1228         -s) shift; silent=true; realsilent=true;;
1229         -E) shift; alldone=exit;;
1230         -K) shift; knowitall=true;;
1231         -O) shift; override=true;;
1232         -S) shift; silent=true; extractsh=true;;
1233         -D)
1234                 shift
1235                 case "$1" in
1236                 *=)
1237                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1238                         echo "$me: ignoring -D $1" >&2
1239                         ;;
1240                 *=*) echo "$1" | \
1241                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1242                 *) echo "$1='define'" >> optdef.sh;;
1243                 esac
1244                 shift
1245                 ;;
1246         -U)
1247                 shift
1248                 case "$1" in
1249                 *=) echo "$1" >> optdef.sh;;
1250                 *=*)
1251                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1252                         echo "$me: ignoring -U $1" >&2
1253                         ;;
1254                 *) echo "$1='undef'" >> optdef.sh;;
1255                 esac
1256                 shift
1257                 ;;
1258         -A)
1259             shift
1260             xxx=''
1261             yyy="$1"
1262             zzz=''
1263             uuu=undef
1264             case "$yyy" in
1265             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1266                  case "$zzz" in
1267                  *:*) zzz='' ;;
1268                  *)   xxx=append
1269                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1270                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1271                  esac
1272                  ;;
1273             esac
1274             case "$xxx" in
1275             '')  case "$yyy" in
1276                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1277                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1278                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1279                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1280                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1281                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1282                  esac
1283                  ;;       
1284             esac
1285             case "$xxx" in
1286             append)
1287                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1288             clear)
1289                 echo "$yyy=''"                  >> posthint.sh ;;
1290             define)
1291                 case "$zzz" in
1292                 '') zzz=define ;;
1293                 esac
1294                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1295             eval)
1296                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1297             prepend)
1298                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1299             undef)
1300                 case "$zzz" in
1301                 '') zzz="$uuu" ;;
1302                 esac
1303                 echo "$yyy=$zzz"                >> posthint.sh ;;
1304             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1305             esac
1306             shift
1307             ;;
1308         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1309             exit 0;;
1310         --) break;;
1311         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1312         *) break;;
1313         esac
1314 done
1315
1316 case "$error" in
1317 true)
1318         cat >&2 <<EOM
1319 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1320                  [-U symbol] [-U symbol=] [-A command:symbol...]
1321   -d : use defaults for all answers.
1322   -e : go on without questioning past the production of config.sh.
1323   -f : specify an alternate default configuration file.
1324   -h : print this help message and exit (with an error status).
1325   -r : reuse C symbols value if possible (skips costly nm extraction).
1326   -s : silent mode, only echoes questions and essential information.
1327   -D : define symbol to have some value:
1328          -D symbol         symbol gets the value 'define'
1329          -D symbol=value   symbol gets the value 'value'
1330   -E : stop at the end of questions, after having produced config.sh.
1331   -K : do not use unless you know what you are doing.
1332   -O : let -D and -U override definitions from loaded configuration file.
1333   -S : perform variable substitutions on all .SH files (can mix with -f)
1334   -U : undefine symbol:
1335          -U symbol    symbol gets the value 'undef'
1336          -U symbol=   symbol gets completely empty
1337   -A : manipulate symbol after the platform specific hints have been applied:
1338          -A symbol=value                append " "value to symbol
1339          -A append:symbol=value         append value to symbol
1340          -A define:symbol=value         define symbol to have value
1341          -A clear:symbol                define symbol to be ''
1342          -A define:symbol               define symbol to be 'define'
1343          -A eval:symbol=value           define symbol to be eval of value
1344          -A prepend:symbol=value        prepend value to symbol
1345          -A undef:symbol                define symbol to be 'undef'
1346          -A undef:symbol=               define symbol to be ''
1347   -V : print version number and exit (with a zero status).
1348 EOM
1349         exit 1
1350         ;;
1351 esac
1352
1353 : Sanity checks
1354 case "$fastread$alldone" in
1355 yescont|yesexit) ;;
1356 *)
1357         case "$extractsh" in
1358         true) ;;
1359         *)
1360                 if test ! -t 0; then
1361                         echo "Say 'sh Configure', not 'sh <Configure'"
1362                         exit 1
1363                 fi
1364                 ;;
1365         esac
1366         ;;
1367 esac
1368
1369 exec 4>&1
1370 case "$silent" in
1371 true) exec 1>/dev/null;;
1372 esac
1373
1374 : run the defines and the undefines, if any, but leave the file out there...
1375 touch optdef.sh
1376 . ./optdef.sh
1377 : create the posthint manipulation script and leave the file out there...
1378 touch posthint.sh
1379
1380 : set package name
1381 package=perl5
1382 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1383 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1384 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1385 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1386 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1387 esac
1388
1389 : Some greps do not return status, grrr.
1390 echo "grimblepritz" >grimble
1391 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1392         contains=contains
1393 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1394         contains=grep
1395 else
1396         contains=contains
1397 fi
1398 rm -f grimble
1399 : the following should work in any shell
1400 case "$contains" in
1401 contains*)
1402         echo " "
1403         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1404         cat >contains <<'EOSS'
1405 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1406 EOSS
1407 chmod +x contains
1408 esac
1409
1410 : Find the path to the source tree
1411 case "$src" in
1412 '') case "$0" in
1413     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1414          case "$src" in
1415          /*)    ;;
1416          *)     src=`cd ../$src && pwd` ;;
1417          esac
1418          ;;
1419     *)   src='.';;
1420     esac;;
1421 esac
1422 case "$src" in
1423 '')     src=/
1424         rsrc=/
1425         ;;
1426 /*) rsrc="$src";;
1427 *) rsrc="../$src";;
1428 esac
1429 if test -f $rsrc/Configure && \
1430         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1431 then
1432    : found it, so we are ok.
1433 else
1434         rsrc=''
1435         for src in . .. ../.. ../../.. ../../../..; do
1436                 if test -f ../$src/Configure && \
1437                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1438                 then
1439                         rsrc=../$src
1440                         break
1441                 fi
1442         done
1443 fi
1444 case "$rsrc" in
1445 '')
1446         cat <<EOM >&4
1447
1448 Sorry, I can't seem to locate the source dir for $package.  Please start
1449 Configure with an explicit path -- i.e. /some/path/Configure.
1450
1451 EOM
1452         exit 1
1453         ;;
1454 ../.)   rsrc='..';;
1455 *)
1456         echo " "
1457         echo "Sources for $package found in \"$src\"." >&4
1458         ;;
1459 esac
1460
1461 : script used to extract .SH files with variable substitutions
1462 cat >extract <<'EOS'
1463 CONFIGDOTSH=true
1464 echo "Doing variable substitutions on .SH files..."
1465 if test -f $src/MANIFEST; then
1466         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1467 else
1468         echo "(Looking for .SH files under the source directory.)"
1469         set x `(cd $src; find . -name "*.SH" -print)`
1470 fi
1471 shift
1472 case $# in
1473 0) set x `(cd $src; echo *.SH)`; shift;;
1474 esac
1475 if test ! -f $src/$1; then
1476         shift
1477 fi
1478 mkdir_p='
1479 name=$1;
1480 create="";
1481 while test $name; do
1482         if test ! -d "$name"; then
1483                 create="$name $create";
1484                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1485                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1486         else
1487                 name="";
1488         fi;
1489 done;
1490 for file in $create; do
1491         mkdir $file;
1492 done
1493 '
1494 for file in $*; do
1495         case "$src" in
1496         ".")
1497                 case "$file" in
1498                 */*)
1499                         dir=`expr X$file : 'X\(.*\)/'`
1500                         file=`expr X$file : 'X.*/\(.*\)'`
1501                         (cd $dir && . ./$file)
1502                         ;;
1503                 *)
1504                         . ./$file
1505                         ;;
1506                 esac
1507                 ;;
1508         *)
1509                 case "$file" in
1510                 */*)
1511                         dir=`expr X$file : 'X\(.*\)/'`
1512                         file=`expr X$file : 'X.*/\(.*\)'`
1513                         (set x $dir; shift; eval $mkdir_p)
1514                         sh <$src/$dir/$file
1515                         ;;
1516                 *)
1517                         sh <$src/$file
1518                         ;;
1519                 esac
1520                 ;;
1521         esac
1522 done
1523 if test -f $src/config_h.SH; then
1524         if test ! -f config.h; then
1525         : oops, they left it out of MANIFEST, probably, so do it anyway.
1526         . $src/config_h.SH
1527         fi
1528 fi
1529 EOS
1530
1531 : extract files and exit if asked to do so
1532 case "$extractsh" in
1533 true)
1534         case "$realsilent" in
1535         true) ;;
1536         *) exec 1>&4;;
1537         esac
1538         case "$config_sh" in
1539         '') config_sh='config.sh';;
1540         esac
1541         echo " "
1542         echo "Fetching answers from $config_sh..."
1543         cd ..
1544         . $config_sh
1545         test "$override" && . ./optdef.sh
1546         echo " "
1547         . UU/extract
1548         rm -rf UU
1549         echo "Done."
1550         exit 0
1551         ;;
1552 esac
1553
1554 : Eunice requires " " instead of "", can you believe it
1555 echo " "
1556 : Here we go...
1557 echo "Beginning of configuration questions for $package."
1558
1559 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1560
1561 : first determine how to suppress newline on echo command
1562 echo " "
1563 echo "Checking echo to see how to suppress newlines..."
1564 (echo "hi there\c" ; echo " ") >.echotmp
1565 if $contains c .echotmp >/dev/null 2>&1 ; then
1566         echo "...using -n."
1567         n='-n'
1568         c=''
1569 else
1570         cat <<'EOM'
1571 ...using \c
1572 EOM
1573         n=''
1574         c='\c'
1575 fi
1576 echo $n "The star should be here-->$c"
1577 echo '*'
1578 rm -f .echotmp
1579
1580 : Now test for existence of everything in MANIFEST
1581 echo " "
1582 if test -f $rsrc/MANIFEST; then
1583         echo "First let's make sure your kit is complete.  Checking..." >&4
1584         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1585         rm -f missing
1586         tmppwd=`pwd`
1587         for filelist in x??; do
1588                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1589         done
1590         if test -s missing; then
1591                 cat missing >&4
1592                 cat >&4 <<'EOM'
1593
1594 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1595
1596 You have the option of continuing the configuration process, despite the
1597 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1598 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1599 and contact the author (perlbug@perl.com).
1600
1601 EOM
1602                 echo $n "Continue? [n] $c" >&4
1603                 read ans
1604                 case "$ans" in
1605                 y*)
1606                         echo "Continuing..." >&4
1607                         rm -f missing
1608                         ;;
1609                 *)
1610                         echo "ABORTING..." >&4
1611                         kill $$
1612                         ;;
1613                 esac
1614         else
1615                 echo "Looks good..."
1616         fi
1617 else
1618         echo "There is no MANIFEST file.  I hope your kit is complete !"
1619 fi
1620 rm -f missing x??
1621
1622 echo " "
1623 : Find the appropriate value for a newline for tr
1624 if test -n "$DJGPP"; then
1625        trnl='\012'
1626 fi
1627 if test X"$trnl" = X; then
1628         case "`echo foo|tr '\n' x 2>/dev/null`" in
1629         foox) trnl='\n' ;;
1630         esac
1631 fi
1632 if test X"$trnl" = X; then
1633         case "`echo foo|tr '\012' x 2>/dev/null`" in
1634         foox) trnl='\012' ;;
1635         esac
1636 fi
1637 if test X"$trnl" = X; then
1638         cat <<EOM >&2
1639
1640 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1641
1642 EOM
1643         exit 1
1644 fi
1645
1646 : compute the number of columns on the terminal for proper question formatting
1647 case "$COLUMNS" in
1648 '') COLUMNS='80';;
1649 esac
1650
1651 : set up the echo used in my read
1652 myecho="case \"\$xxxm\" in
1653 '') echo $n \"\$rp $c\" >&4;;
1654 *) case \"\$rp\" in
1655         '') echo $n \"[\$xxxm] $c\";;
1656         *)
1657                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1658                         echo \"\$rp\" >&4
1659                         echo $n \"[\$xxxm] $c\" >&4
1660                 else
1661                         echo $n \"\$rp [\$xxxm] $c\" >&4
1662                 fi
1663                 ;;
1664         esac;;
1665 esac"
1666
1667 : now set up to do reads with possible shell escape and default assignment
1668 cat <<EOSC >myread
1669 $startsh
1670 xxxm=\$dflt
1671 $myecho
1672 ans='!'
1673 case "\$fastread" in
1674 yes) case "\$dflt" in
1675         '') ;;
1676         *) ans='';
1677                 case "\$silent-\$rp" in
1678                 true-) ;;
1679                 *) echo " " >&4;;
1680                 esac;;
1681         esac;;
1682 *) case "\$silent" in
1683         true) case "\$rp" in
1684                 '') ans='';;
1685                 esac;;
1686         esac;;
1687 esac
1688 while expr "X\$ans" : "X!" >/dev/null; do
1689         read answ
1690         set x \$xxxm
1691         shift
1692         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1693         case  "\$answ" in
1694         "!")
1695                 sh 1>&4
1696                 echo " "
1697                 $myecho
1698                 ;;
1699         !*)
1700                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1701                 shift
1702                 sh 1>&4 -c "\$*"
1703                 echo " "
1704                 $myecho
1705                 ;;
1706         "\$ans")
1707                 case "\$ans" in
1708                 \\&*)
1709                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1710                         shift
1711                         case "\$1" in
1712                         -d)
1713                                 fastread=yes
1714                                 echo "(OK, I'll run with -d after this question.)" >&4
1715                                 ;;
1716                         -*)
1717                                 echo "*** Sorry, \$1 not supported yet." >&4
1718                                 ;;
1719                         esac
1720                         $myecho
1721                         ans=!
1722                         ;;
1723                 esac;;
1724         *)
1725                 case "\$aok" in
1726                 y)
1727                         echo "*** Substitution done -- please confirm."
1728                         xxxm="\$ans"
1729                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1730                         xxxm="\$ans"
1731                         ans=!
1732                         ;;
1733                 *)
1734                         echo "*** Error -- try again."
1735                         ans=!
1736                         ;;
1737                 esac
1738                 $myecho
1739                 ;;
1740         esac
1741         case "\$ans\$xxxm\$nostick" in
1742         '')
1743                 ans=!
1744                 $myecho
1745                 ;;
1746         esac
1747 done
1748 case "\$ans" in
1749 '') ans="\$xxxm";;
1750 esac
1751 EOSC
1752
1753 : create .config dir to save info across Configure sessions
1754 test -d ../.config || mkdir ../.config
1755 cat >../.config/README <<EOF
1756 This directory created by Configure to save information that should
1757 persist across sessions for $package.
1758
1759 You may safely delete it if you wish.
1760 EOF
1761
1762 xpatchlevel=`awk '/define[      ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1763 case "$usedevel" in
1764 $define|true|[yY]*) ;;
1765 *) case "$xpatchlevel" in
1766    *[13579])
1767         cat >&4 <<EOH
1768 *** WHOA THERE!!! ***
1769
1770     This is an UNSTABLE DEVELOPMENT release.
1771     (The patchlevel, $xpatchlevel, is odd--as opposed to even,
1772      and that signifies a development release.  If you want a
1773      maintenance release, you want an even-numbered release.)
1774
1775     Do ***NOT*** install this into production use.
1776     Data corruption and crashes are possible.
1777
1778     It is most seriously suggested that you do not continue any further
1779     unless you want to help in developing and debugging Perl.
1780
1781 EOH
1782         rp='Do you really want to continue?'
1783         dflt='n'
1784         . ./myread
1785         case "$ans" in
1786         [yY]) echo >&4 "Okay, continuing." ;;
1787         *) echo >&4 "Okay, bye."
1788            exit 1
1789            ;;
1790         esac
1791         ;;
1792     esac
1793     ;;
1794 esac
1795
1796 : general instructions
1797 needman=true
1798 firsttime=true
1799 user=`(logname) 2>/dev/null`
1800 case "$user" in
1801 '') user=`whoami 2>&1`;;
1802 esac
1803 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1804         firsttime=false
1805         echo " "
1806         rp='Would you like to see the instructions?'
1807         dflt=n
1808         . ./myread
1809         case "$ans" in
1810         [yY]*) ;;
1811         *) needman=false;;
1812         esac
1813 fi
1814 if $needman; then
1815         cat <<EOH
1816
1817 This installation shell script will examine your system and ask you questions
1818 to determine how the perl5 package should be installed. If you get
1819 stuck on a question, you may use a ! shell escape to start a subshell or
1820 execute a command.  Many of the questions will have default answers in square
1821 brackets; typing carriage return will give you the default.
1822
1823 On some of the questions which ask for file or directory names you are allowed
1824 to use the ~name construct to specify the login directory belonging to "name",
1825 even if you don't have a shell which knows about that.  Questions where this is
1826 allowed will be marked "(~name ok)".
1827
1828 EOH
1829         rp=''
1830         dflt='Type carriage return to continue'
1831         . ./myread
1832         cat <<'EOH'
1833
1834 The prompter used in this script allows you to use shell variables and
1835 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1836 in the default answer, as if the default line was a set of arguments given to a
1837 script shell.  This means you may also use $* to repeat the whole default line,
1838 so you do not have to re-type everything to add something to the default.
1839
1840 Everytime there is a substitution, you will have to confirm.  If there is an
1841 error (e.g. an unmatched backtick), the default answer will remain unchanged
1842 and you will be prompted again.
1843
1844 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1845 the questions and use the computed defaults (or the previous answers if there
1846 was already a config.sh file). Type 'Configure -h' for a list of options.
1847 You may also start interactively and then answer '& -d' at any prompt to turn
1848 on the non-interactive behaviour for the remainder of the execution.
1849
1850 EOH
1851         . ./myread
1852         cat <<EOH
1853
1854 Much effort has been expended to ensure that this shell script will run on any
1855 Unix system.  If despite that it blows up on yours, your best bet is to edit
1856 Configure and run it again.  If you can't run Configure for some reason,
1857 you'll have to generate a config.sh file by hand.  Whatever problems you
1858 have, let me (perlbug@perl.com) know how I blew it.
1859
1860 This installation script affects things in two ways:
1861
1862 1) it may do direct variable substitutions on some of the files included
1863    in this kit.
1864 2) it builds a config.h file for inclusion in C programs.  You may edit
1865    any of these files as the need arises after running this script.
1866
1867 If you make a mistake on a question, there is no easy way to back up to it
1868 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1869 files.  Configure will offer to let you do this before it runs the SH files.
1870
1871 EOH
1872         dflt='Type carriage return to continue'
1873         . ./myread
1874         case "$firsttime" in
1875         true) echo $user >>../.config/instruct;;
1876         esac
1877 fi
1878
1879 : find out where common programs are
1880 echo " "
1881 echo "Locating common programs..." >&4
1882 cat <<EOSC >loc
1883 $startsh
1884 case \$# in
1885 0) exit 1;;
1886 esac
1887 thing=\$1
1888 shift
1889 dflt=\$1
1890 shift
1891 for dir in \$*; do
1892         case "\$thing" in
1893         .)
1894         if test -d \$dir/\$thing; then
1895                 echo \$dir
1896                 exit 0
1897         fi
1898         ;;
1899         *)
1900         for thisthing in \$dir/\$thing; do
1901                 : just loop through to pick last item
1902         done
1903         if test -f \$thisthing; then
1904                 echo \$thisthing
1905                 exit 0
1906         elif test -f \$dir/\$thing.exe; then
1907                 if test -n "$DJGPP"; then
1908                         echo \$dir/\$thing.exe
1909                 else
1910                         : on Eunice apparently
1911                         echo \$dir/\$thing
1912                 fi
1913                 exit 0
1914         fi
1915         ;;
1916         esac
1917 done
1918 echo \$dflt
1919 exit 1
1920 EOSC
1921 chmod +x loc
1922 $eunicefix loc
1923 loclist="
1924 awk
1925 cat
1926 comm
1927 cp
1928 echo
1929 expr
1930 grep
1931 ls
1932 make
1933 mkdir
1934 rm
1935 sed
1936 sort
1937 touch
1938 tr
1939 uniq
1940 "
1941 trylist="
1942 Mcc
1943 ar
1944 byacc
1945 cpp
1946 csh
1947 date
1948 egrep
1949 gzip
1950 less
1951 ln
1952 more
1953 nm
1954 nroff
1955 pg
1956 test
1957 uname
1958 zip
1959 "
1960 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1961 pth="$pth /lib /usr/lib"
1962 for file in $loclist; do
1963         eval xxx=\$$file
1964         case "$xxx" in
1965         /*|?:[\\/]*)
1966                 if test -f "$xxx"; then
1967                         : ok
1968                 else
1969                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1970                         xxx=`./loc $file $file $pth`
1971                 fi
1972                 ;;
1973         '') xxx=`./loc $file $file $pth`;;
1974         *) xxx=`./loc $xxx $xxx $pth`;;
1975         esac
1976         eval $file=$xxx
1977         eval _$file=$xxx
1978         case "$xxx" in
1979         /*)
1980                 echo $file is in $xxx.
1981                 ;;
1982         ?:[\\/]*)
1983                 echo $file is in $xxx.
1984                 ;;
1985         *)
1986                 echo "I don't know where '$file' is, and my life depends on it." >&4
1987                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1988                 exit 1
1989                 ;;
1990         esac
1991 done
1992 echo " "
1993 echo "Don't worry if any of the following aren't found..."
1994 say=offhand
1995 for file in $trylist; do
1996         eval xxx=\$$file
1997         case "$xxx" in
1998         /*|?:[\\/]*)
1999                 if test -f "$xxx"; then
2000                         : ok
2001                 else
2002                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2003                         xxx=`./loc $file $file $pth`
2004                 fi
2005                 ;;
2006         '') xxx=`./loc $file $file $pth`;;
2007         *) xxx=`./loc $xxx $xxx $pth`;;
2008         esac
2009         eval $file=$xxx
2010         eval _$file=$xxx
2011         case "$xxx" in
2012         /*)
2013                 echo $file is in $xxx.
2014                 ;;
2015         ?:[\\/]*)
2016                 echo $file is in $xxx.
2017                 ;;
2018         *)
2019                 echo "I don't see $file out there, $say."
2020                 say=either
2021                 ;;
2022         esac
2023 done
2024 case "$egrep" in
2025 egrep)
2026         echo "Substituting grep for egrep."
2027         egrep=$grep
2028         ;;
2029 esac
2030 case "$ln" in
2031 ln)
2032         echo "Substituting cp for ln."
2033         ln=$cp
2034         ;;
2035 esac
2036 case "$test" in
2037 test)
2038         echo "Hopefully test is built into your sh."
2039         ;;
2040 *)
2041         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2042                 echo "Using the test built into your sh."
2043                 test=test
2044                 _test=test
2045         fi
2046         ;;
2047 esac
2048 case "$echo" in
2049 echo)
2050         echo "Hopefully echo is built into your sh."
2051         ;;
2052 '') ;;
2053 *)
2054         echo " "
2055 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2056         $echo $n "hi there$c" >foo1
2057         echo $n "hi there$c" >foo2
2058         if cmp foo1 foo2 >/dev/null 2>&1; then
2059                 echo "They are compatible.  In fact, they may be identical."
2060         else
2061                 case "$n" in
2062                 '-n') n='' c='\c';;
2063                 *) n='-n' c='';;
2064                 esac
2065                 cat <<FOO
2066 They are not compatible!  You are probably running ksh on a non-USG system.
2067 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2068 have echo built in and we may have to run some Bourne shell scripts.  That
2069 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2070
2071 FOO
2072                 $echo $n "The star should be here-->$c"
2073                 $echo "*"
2074         fi
2075         $rm -f foo1 foo2
2076         ;;
2077 esac
2078
2079 cat <<EOS >checkcc
2080 $startsh
2081 EOS
2082 cat <<'EOSC' >>checkcc
2083 case "$cc" in
2084 '') ;;
2085 *)  $rm -f try try.*
2086     $cat >try.c <<EOM
2087 int main(int argc, char *argv[]) {
2088   return 0;
2089 }
2090 EOM
2091     if $cc -o try try.c; then
2092        :
2093     else
2094         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2095         despair=yes
2096         trygcc=yes
2097         case "$cc" in
2098         *gcc*) trygcc=no ;;
2099         esac
2100         case "`$cc -v -c try.c 2>&1`" in
2101         *gcc*) trygcc=no ;;
2102         esac
2103         if $test X"$trygcc" = Xyes; then
2104             if gcc -o try -c try.c; then
2105                 echo " "
2106                 echo "You seem to have a working gcc, though." >&4
2107                 rp="Would you like to use it?"
2108                 dflt=y
2109                 if $test -f myread; then
2110                     . ./myread
2111                 else
2112                     if $test -f UU/myread; then
2113                         . ./UU/myread
2114                     else
2115                         echo "Cannot find myread, sorry.  Aborting." >&2
2116                         exit 1
2117                     fi
2118                 fi  
2119                 case "$ans" in
2120                 [yY]*) cc=gcc; ccflags=''; despair=no ;;
2121                 esac
2122             fi
2123         fi
2124         if $test X"$despair" = Xyes; then
2125             echo "You need to find a working C compiler." >&4
2126             echo "I cannot continue any further, aborting." >&4
2127             exit 1
2128         fi
2129     fi
2130     $rm -f try try.*
2131     ;;
2132 esac
2133 EOSC
2134
2135 : determine whether symbolic links are supported
2136 echo " "
2137 $touch blurfl
2138 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2139         echo "Symbolic links are supported." >&4
2140         lns="$ln -s"
2141 else
2142         echo "Symbolic links are NOT supported." >&4
2143         lns="$ln"
2144 fi
2145 $rm -f blurfl sym
2146
2147 : see whether [:lower:] and [:upper:] are supported character classes
2148 echo " "
2149 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2150 ABYZ)
2151         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2152         up='[:upper:]'
2153         low='[:lower:]'
2154         ;;
2155 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2156         # (0xc9 and 0xd1), therefore that is a nice testing point.
2157         if test "X$up" = X -o "X$low" = X; then
2158             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2159             ij) up='[A-Z]'
2160                 low='[a-z]'
2161                 ;;
2162             esac
2163         fi
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 | od -x 2>/dev/null`" in
2173             *C9D1*|*c9d1*)
2174                 echo "Hey, this might be EBCDIC." >&4
2175                 if test "X$up" = X -o "X$low" = X; then
2176                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2177                     ij) up='[A-IJ-RS-Z]'
2178                         low='[a-ij-rs-z]'
2179                         ;;
2180                     esac
2181                 fi
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                 ;;
2190             esac
2191         fi
2192 esac
2193 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2194 ij)
2195     echo "Using $up and $low to convert case." >&4
2196     ;;
2197 *)
2198     echo "I don't know how to translate letters from upper to lower case." >&4
2199     echo "Your tr is not acting any way I know of." >&4
2200     exit 1
2201     ;;
2202 esac
2203 : set up the translation script tr, must be called with ./tr of course
2204 cat >tr <<EOSC
2205 $startsh
2206 case "\$1\$2" in
2207 '[A-Z][a-z]') exec $tr '$up' '$low';;
2208 '[a-z][A-Z]') exec $tr '$low' '$up';;
2209 esac
2210 exec $tr "\$@"
2211 EOSC
2212 chmod +x tr
2213 $eunicefix tr
2214
2215 : Try to determine whether config.sh was made on this system
2216 case "$config_sh" in
2217 '')
2218 myuname=`$uname -a 2>/dev/null`
2219 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2220 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2221 # because the A-Z/a-z are not consecutive.
2222 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2223         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2224 newmyuname="$myuname"
2225 dflt=n
2226 case "$knowitall" in
2227 '')
2228         if test -f ../config.sh; then
2229                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2230                         eval "`grep myuname= ../config.sh`"
2231                 fi
2232                 if test "X$myuname" = "X$newmyuname"; then
2233                         dflt=y
2234                 fi
2235         fi
2236         ;;
2237 *) dflt=y;;
2238 esac
2239
2240 : Get old answers from old config file if Configure was run on the
2241 : same system, otherwise use the hints.
2242 hint=default
2243 cd ..
2244 if test -f config.sh; then
2245         echo " "
2246         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2247         . UU/myread
2248         case "$ans" in
2249         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2250         *)  echo "Fetching default answers from your old config.sh file..." >&4
2251                 tmp_n="$n"
2252                 tmp_c="$c"
2253                 tmp_sh="$sh"
2254                 . ./config.sh
2255                 cp config.sh UU
2256                 n="$tmp_n"
2257                 c="$tmp_c"
2258                 : Older versions did not always set $sh.  Catch re-use of such
2259                 : an old config.sh.
2260                 case "$sh" in
2261                 '') sh="$tmp_sh" ;;
2262                 esac
2263                 hint=previous
2264                 ;;
2265         esac
2266 fi
2267 . ./UU/checkcc
2268 if test ! -f config.sh; then
2269         $cat <<EOM
2270
2271 First time through, eh?  I have some defaults handy for some systems
2272 that need some extra help getting the Configure answers right:
2273
2274 EOM
2275         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2276         dflt=''
2277         : Half the following guesses are probably wrong... If you have better
2278         : tests or hints, please send them to perlbug@perl.com
2279         : The metaconfig authors would also appreciate a copy...
2280         $test -f /irix && osname=irix
2281         $test -f /xenix && osname=sco_xenix
2282         $test -f /dynix && osname=dynix
2283         $test -f /dnix && osname=dnix
2284         $test -f /lynx.os && osname=lynxos
2285         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2286         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2287         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2288         $test -f /bin/mips && /bin/mips && osname=mips
2289         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2290                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2291         $test -d /usr/apollo/bin && osname=apollo
2292         $test -f /etc/saf/_sactab && osname=svr4
2293         $test -d /usr/include/minix && osname=minix
2294         if $test -d /MachTen -o -d /MachTen_Folder; then
2295                 osname=machten
2296                 if $test -x /sbin/version; then
2297                         osvers=`/sbin/version | $awk '{print $2}' |
2298                         $sed -e 's/[A-Za-z]$//'`
2299                 elif $test -x /usr/etc/version; then
2300                         osvers=`/usr/etc/version | $awk '{print $2}' |
2301                         $sed -e 's/[A-Za-z]$//'`
2302                 else
2303                         osvers="$2.$3"
2304                 fi
2305         fi
2306
2307         $test -f /sys/posix.dll &&
2308                 $test -f /usr/bin/what &&
2309                 set X `/usr/bin/what /sys/posix.dll` &&
2310                 $test "$3" = UWIN &&
2311                 osname=uwin &&
2312                 osvers="$5"
2313
2314         if $test -f $uname; then
2315                 set X $myuname
2316                 shift
2317
2318                 case "$5" in
2319                 fps*) osname=fps ;;
2320                 mips*)
2321                         case "$4" in
2322                         umips) osname=umips ;;
2323                         *) osname=mips ;;
2324                         esac;;
2325                 [23]100) osname=mips ;;
2326                 next*) osname=next ;;
2327                 i386*)
2328                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2329                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2330                                 osname='sco'
2331                                 osvers=$tmp
2332                         elif $test -f /etc/kconfig; then
2333                                 osname=isc
2334                                 if test "$lns" = "$ln -s"; then
2335                                         osvers=4
2336                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2337                                         osvers=3
2338                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2339                                         osvers=2
2340                                 fi
2341                         fi
2342                         tmp=''
2343                         ;;
2344                 pc*)
2345                         if test -n "$DJGPP"; then
2346                                 osname=dos
2347                                 osvers=djgpp
2348                         fi
2349                         ;;
2350                 esac
2351
2352                 case "$1" in
2353                 aix) osname=aix
2354                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2355                         case "$tmp" in
2356                         'not found') osvers="$4"."$3" ;;
2357                         '<3240'|'<>3240') osvers=3.2.0 ;;
2358                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2359                         '=3250'|'>3250') osvers=3.2.5 ;;
2360                         *) osvers=$tmp;;
2361                         esac
2362                         ;;
2363                 bsd386) osname=bsd386
2364                         osvers=`$uname -r`
2365                         ;;
2366                 cygwin*) osname=cygwin
2367                         osvers="$3"
2368                         ;;
2369                 *dc.osx) osname=dcosx
2370                         osvers="$3"
2371                         ;;
2372                 dnix) osname=dnix
2373                         osvers="$3"
2374                         ;;
2375                 domainos) osname=apollo
2376                         osvers="$3"
2377                         ;;
2378                 dgux) osname=dgux 
2379                         osvers="$3"
2380                         ;;
2381                 dynixptx*) osname=dynixptx
2382                         osvers=`echo "$4"|sed 's/^v//'`
2383                         ;;
2384                 freebsd) osname=freebsd 
2385                         osvers="$3" ;;
2386                 genix) osname=genix ;;
2387                 hp*) osname=hpux 
2388                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2389                         ;;
2390                 irix*) osname=irix
2391                         case "$3" in
2392                         4*) osvers=4 ;;
2393                         5*) osvers=5 ;;
2394                         *)      osvers="$3" ;;
2395                         esac
2396                         ;;
2397                 linux) osname=linux
2398                         case "$3" in
2399                         *)      osvers="$3" ;;
2400                         esac
2401                         ;;
2402                 MiNT) osname=mint
2403                         ;;
2404                 netbsd*) osname=netbsd
2405                         osvers="$3"
2406                         ;;
2407                 news-os) osvers="$3"
2408                         case "$3" in
2409                         4*) osname=newsos4 ;;
2410                         *) osname=newsos ;;
2411                         esac
2412                         ;;
2413                 next*) osname=next ;;
2414                 POSIX-BC | posix-bc ) osname=posix-bc
2415                         osvers="$3"
2416                         ;;
2417                 powerux | power_ux | powermax_os | powermaxos | \
2418                 powerunix | power_unix) osname=powerux
2419                         osvers="$3"
2420                         ;;
2421                 qnx) osname=qnx
2422                         osvers="$4"
2423                         ;;
2424                 solaris) osname=solaris
2425                         case "$3" in
2426                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2427                         *)      osvers="$3" ;;
2428                         esac
2429                         ;;
2430                 sunos) osname=sunos
2431                         case "$3" in
2432                         5*) osname=solaris
2433                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2434                         *)      osvers="$3" ;;
2435                         esac
2436                         ;;
2437                 titanos) osname=titanos
2438                         case "$3" in
2439                         1*) osvers=1 ;;
2440                         2*) osvers=2 ;;
2441                         3*) osvers=3 ;;
2442                         4*) osvers=4 ;;
2443                         *)      osvers="$3" ;;
2444                         esac
2445                         ;;
2446                 ultrix) osname=ultrix
2447                         osvers="$3"
2448                         ;;
2449                 osf1|mls+)      case "$5" in
2450                                 alpha)
2451                                         osname=dec_osf
2452                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2453                                         case "$osvers" in
2454                                         [1-9].[0-9]*) ;;
2455                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2456                                         esac
2457                                         ;;
2458                         hp*)    osname=hp_osf1  ;;
2459                         mips)   osname=mips_osf1 ;;
2460                         esac
2461                         ;;
2462                 unixware) osname=svr5
2463                         osvers="$4"
2464                         ;;
2465                 uts) osname=uts
2466                         osvers="$3"
2467                         ;;
2468                 $2) case "$osname" in
2469                         *isc*) ;;
2470                         *freebsd*) ;;
2471                         svr*)
2472                                 : svr4.x or possibly later
2473                                 case "svr$3" in 
2474                                 ${osname}*)
2475                                         osname=svr$3
2476                                         osvers=$4
2477                                         ;;
2478                                 esac
2479                                 case "$osname" in
2480                                 svr4.0)
2481                                         : Check for ESIX
2482                                         if test -f /stand/boot ; then
2483                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2484                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2485                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2486                                                         if test -n "$isesix"; then
2487                                                                 osname=esix4
2488                                                         fi
2489                                                 fi
2490                                         fi
2491                                         ;;
2492                                 esac
2493                                 ;;
2494                         *)      if test -f /etc/systemid; then
2495                                         osname=sco
2496                                         set `echo $3 | $sed 's/\./ /g'` $4
2497                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2498                                                 osvers=$1.$2.$3
2499                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2500                                                 osvers=$1.$2
2501                                         elif $test -f $src/hints/sco_$1.sh; then
2502                                                 osvers=$1
2503                                         fi
2504                                 else
2505                                         case "$osname" in
2506                                         '') : Still unknown.  Probably a generic Sys V.
2507                                                 osname="sysv"
2508                                                 osvers="$3"
2509                                                 ;;
2510                                         esac
2511                                 fi
2512                                 ;;
2513                         esac
2514                         ;;
2515                 *)      case "$osname" in
2516                         '') : Still unknown.  Probably a generic BSD.
2517                                 osname="$1"
2518                                 osvers="$3"
2519                                 ;;
2520                         esac
2521                         ;;
2522                 esac
2523         else
2524                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2525                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2526                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2527                                 osname=news_os
2528                         fi
2529                         $rm -f UU/kernel.what
2530                 elif test -d c:/.; then
2531                         set X $myuname
2532                         osname=os2
2533                         osvers="$5"
2534                 fi
2535         fi
2536         
2537         : Now look for a hint file osname_osvers, unless one has been
2538         : specified already.
2539         case "$hintfile" in
2540         ''|' ')
2541                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2542                 : Also try without trailing minor version numbers.
2543                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2544                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2545                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2546                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2547                 case "$file" in
2548                 '') dflt=none ;;
2549                 *)  case "$osvers" in
2550                         '') dflt=$file
2551                                 ;;
2552                         *)  if $test -f $src/hints/$file.sh ; then
2553                                         dflt=$file
2554                                 elif $test -f $src/hints/$xfile.sh ; then
2555                                         dflt=$xfile
2556                                 elif $test -f $src/hints/$xxfile.sh ; then
2557                                         dflt=$xxfile
2558                                 elif $test -f $src/hints/$xxxfile.sh ; then
2559                                         dflt=$xxxfile
2560                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2561                                         dflt=$xxxxfile
2562                                 elif $test -f "$src/hints/${osname}.sh" ; then
2563                                         dflt="${osname}"
2564                                 else
2565                                         dflt=none
2566                                 fi
2567                                 ;;
2568                         esac
2569                         ;;
2570                 esac
2571                 if $test -f Policy.sh ; then
2572                         case "$dflt" in
2573                         *Policy*) ;;
2574                         none) dflt="Policy" ;;
2575                         *) dflt="Policy $dflt" ;;
2576                         esac
2577                 fi
2578                 ;;
2579         *)
2580                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2581                 ;;
2582         esac
2583
2584         if $test -f Policy.sh ; then
2585                 $cat <<EOM
2586
2587 There's also a Policy hint file available, which should make the
2588 site-specific (policy) questions easier to answer.
2589 EOM
2590
2591         fi
2592
2593         $cat <<EOM
2594
2595 You may give one or more space-separated answers, or "none" if appropriate.
2596 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2597 is a good thing.  DO NOT give a wrong version or a wrong OS.
2598
2599 EOM
2600
2601         rp="Which of these apply, if any?"
2602         . UU/myread
2603         tans=$ans
2604         for file in $tans; do
2605                 if $test X$file = XPolicy -a -f Policy.sh; then
2606                         . Policy.sh
2607                         $cat Policy.sh >> UU/config.sh
2608                 elif $test -f $src/hints/$file.sh; then
2609                         . $src/hints/$file.sh
2610                         $cat $src/hints/$file.sh >> UU/config.sh
2611                 elif $test X$tans = X -o X$tans = Xnone ; then
2612                         : nothing
2613                 else
2614                         : Give one chance to correct a possible typo.
2615                         echo "$file.sh does not exist"
2616                         dflt=$file
2617                         rp="hint to use instead?"
2618                         . UU/myread
2619                         for file in $ans; do
2620                                 if $test -f "$src/hints/$file.sh"; then
2621                                         . $src/hints/$file.sh
2622                                         $cat $src/hints/$file.sh >> UU/config.sh
2623                                 elif $test X$ans = X -o X$ans = Xnone ; then
2624                                         : nothing
2625                                 else
2626                                         echo "$file.sh does not exist -- ignored."
2627                                 fi
2628                         done
2629                 fi
2630         done
2631
2632         hint=recommended
2633         : Remember our hint file for later.
2634         if $test -f "$src/hints/$file.sh" ; then
2635                 hintfile="$file"
2636         else
2637                 hintfile=''
2638         fi
2639 fi
2640 cd UU
2641 ;;
2642 *)
2643         echo " "
2644         echo "Fetching default answers from $config_sh..." >&4
2645         tmp_n="$n"
2646         tmp_c="$c"
2647         cd ..
2648         cp $config_sh config.sh 2>/dev/null
2649         chmod +w config.sh
2650         . ./config.sh
2651         cd UU
2652         cp ../config.sh .
2653         n="$tmp_n"
2654         c="$tmp_c"
2655         hint=previous
2656         ;;
2657 esac
2658 test "$override" && . ./optdef.sh
2659 myuname="$newmyuname"
2660
2661 : Restore computed paths
2662 for file in $loclist $trylist; do
2663         eval $file="\$_$file"
2664 done
2665
2666 cat << EOM
2667
2668 Configure uses the operating system name and version to set some defaults.
2669 The default value is probably right if the name rings a bell. Otherwise,
2670 since spelling matters for me, either accept the default or answer "none"
2671 to leave it blank.
2672
2673 EOM
2674 case "$osname" in
2675         ''|' ')
2676                 case "$hintfile" in
2677                 ''|' '|none) dflt=none ;;
2678                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2679                 esac
2680                 ;;
2681         *) dflt="$osname" ;;
2682 esac
2683 rp="Operating system name?"
2684 . ./myread
2685 case "$ans" in
2686 none)  osname='' ;;
2687 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2688 esac
2689 echo " "
2690 case "$osvers" in
2691         ''|' ')
2692                 case "$hintfile" in
2693                 ''|' '|none) dflt=none ;;
2694                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2695                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2696                         case "$dflt" in
2697                         ''|' ') dflt=none ;;
2698                         esac
2699                         ;;
2700                 esac
2701                 ;;
2702         *) dflt="$osvers" ;;
2703 esac
2704 rp="Operating system version?"
2705 . ./myread
2706 case "$ans" in
2707 none)  osvers='' ;;
2708 *) osvers="$ans" ;;
2709 esac
2710
2711
2712 . ./posthint.sh
2713
2714 : who configured the system
2715 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2716 cf_by=`(logname) 2>/dev/null`
2717 case "$cf_by" in
2718 "")
2719         cf_by=`(whoami) 2>/dev/null`
2720         case "$cf_by" in
2721         "") cf_by=unknown ;;
2722         esac ;;
2723 esac
2724
2725 : set up the script used to warn in case of inconsistency
2726 cat <<EOS >whoa
2727 $startsh
2728 EOS
2729 cat <<'EOSC' >>whoa
2730 dflt=y
2731 echo " "
2732 echo "*** WHOA THERE!!! ***" >&4
2733 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2734 rp="    Keep the $hint value?"
2735 . ./myread
2736 case "$ans" in
2737 y) td=$was; tu=$was;;
2738 esac
2739 EOSC
2740
2741 : function used to set $1 to $val
2742 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2743 case "$val$was" in
2744 $define$undef) . ./whoa; eval "$var=\$td";;
2745 $undef$define) . ./whoa; eval "$var=\$tu";;
2746 *) eval "$var=$val";;
2747 esac'
2748
2749 case "$usethreads" in
2750 $define|true|[yY]*)     dflt='y';;
2751 *) dflt='n';;
2752 esac
2753 cat <<EOM
2754
2755 Perl can be built to take advantage of threads on some systems.
2756 To do so, Configure can be run with -Dusethreads.
2757
2758 Note that threading is a highly experimental feature, and
2759 some known race conditions still remain.  If you choose to try
2760 it, be very sure to not actually deploy it for production
2761 purposes.  README.threads has more details, and is required
2762 reading if you enable threads.
2763
2764 If this doesn't make any sense to you, just accept the default '$dflt'.
2765 EOM
2766 rp='Build a threading Perl?'
2767 . ./myread
2768 case "$ans" in
2769 y|Y)    val="$define" ;;
2770 *)      val="$undef" ;;
2771 esac
2772 set usethreads
2773 eval $setvar
2774
2775 case "$usethreads" in
2776 $define)
2777         $cat <<EOM
2778
2779 As of 5.5.640, Perl has two different internal threading implementations,
2780 the 5.005 version (5005threads) and an interpreter-based version
2781 (ithreads) that has one interpreter per thread.  Both are very 
2782 experimental.  This arrangement exists to help developers work out
2783 which one is better.
2784
2785 If you're a casual user, you probably don't want interpreter-threads
2786 at this time.  There doesn't yet exist a way to create threads from
2787 within Perl in this model, i.e., "use Thread;" will NOT work.
2788 EOM
2789         : Default to ithreads unless overridden on command line or with
2790         : old config.sh
2791         dflt='y'
2792         case "$use5005threads" in
2793                 $define|true|[yY]*) dflt='n';;
2794         esac
2795         case "$useithreads" in
2796                 $undef|false|[nN]*) dflt='n';;
2797         esac
2798         rp='Use interpreter-based ithreads?'
2799         . ./myread
2800         case "$ans" in
2801         y|Y)    val="$define" ;;
2802         *)      val="$undef" ;;
2803         esac
2804         set useithreads
2805         eval $setvar
2806         : Now set use5005threads to the opposite value.
2807         case "$useithreads" in
2808         $define) val="$undef" ;;
2809         *) val="$define" ;;
2810         esac
2811         set use5005threads
2812         eval $setvar
2813         ;;
2814 *)
2815         useithreads="$undef"
2816         use5005threads="$undef"
2817         ;;
2818 esac
2819
2820 case "$d_oldpthreads" in
2821 '')     : Configure tests would be welcome here.  For now, assume undef.
2822         val="$undef" ;;
2823 *)      val="$d_oldpthreads" ;;
2824 esac
2825 set d_oldpthreads
2826 eval $setvar
2827
2828
2829 case "$usethreads" in
2830 "$define"|true|[yY]*)
2831 : Look for a hint-file generated 'call-back-unit'.  If the
2832 : user has specified that a threading perl is to be built,
2833 : we may need to set or change some other defaults.
2834         if $test -f usethreads.cbu; then
2835                 echo "Your platform has some specific hints for threaded builds, using them..."
2836                 . ./usethreads.cbu
2837         else
2838                 $cat <<EOM
2839 (Your platform doesn't have any specific hints for threaded builds.
2840  Assuming POSIX threads, then.)
2841 EOM
2842         fi
2843         ;;
2844 esac
2845
2846 cat <<EOM
2847
2848 Perl can be built so that multiple Perl interpreters can coexist
2849 within the same Perl executable.
2850 EOM
2851
2852 case "$useithreads" in
2853 $define)
2854         cat <<EOM
2855 This multiple interpreter support is required for interpreter-based threads.
2856 EOM
2857         val="$define"
2858         ;;
2859 *)      case "$usemultiplicity" in
2860         $define|true|[yY]*)     dflt='y';;
2861         *) dflt='n';;
2862         esac
2863         echo " "
2864         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2865         rp='Build Perl for multiplicity?'
2866         . ./myread
2867         case "$ans" in
2868         y|Y)    val="$define" ;;
2869         *)      val="$undef" ;;
2870         esac
2871         ;;
2872 esac
2873 set usemultiplicity
2874 eval $setvar
2875
2876 : determine where manual pages are on this system
2877 echo " "
2878 case "$sysman" in
2879 '') 
2880         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2881         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2882         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2883         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2884         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2885         sysman=`./loc . /usr/man/man1 $syspath`
2886         ;;
2887 esac
2888 if $test -d "$sysman"; then
2889         echo "System manual is in $sysman." >&4
2890 else
2891         echo "Could not find manual pages in source form." >&4
2892 fi
2893
2894 : see what memory models we can support
2895 case "$models" in
2896 '')
2897         $cat >pdp11.c <<'EOP'
2898 int main() {
2899 #ifdef pdp11
2900         exit(0);
2901 #else
2902         exit(1);
2903 #endif
2904 }
2905 EOP
2906         case "$cc" in
2907         '') modelcc="$cc" ;;
2908         *) modelcc="cc" ;;
2909         esac
2910         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2911         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2912                 dflt='unsplit split'
2913         else
2914                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2915                 case "$tans" in
2916                 X) dflt='none';;
2917                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2918                                 dflt='small'
2919                         else
2920                                 dflt=''
2921                         fi
2922                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2923                                 dflt="$dflt medium"
2924                         fi
2925                         if $test -d /lib/large || $test -d /usr/lib/large; then
2926                                 dflt="$dflt large"
2927                         fi
2928                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2929                                 dflt="$dflt huge"
2930                         fi
2931                 esac
2932         fi;;
2933 *) dflt="$models";;
2934 esac
2935 $cat <<EOM
2936  
2937 Some systems have different model sizes.  On most systems they are called
2938 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2939 split.  If your system doesn't support different memory models, say "none".
2940 If you wish to force everything to one memory model, say "none" here and
2941 put the appropriate flags later when it asks you for other cc and ld flags.
2942 Venix systems may wish to put "none" and let the compiler figure things out.
2943 (In the following question multiple model names should be space separated.)
2944
2945 The default for most systems is "none".
2946
2947 EOM
2948 rp="Which memory models are supported?"
2949 . ./myread
2950 models="$ans"
2951
2952 case "$models" in
2953 none)
2954         small=''
2955         medium=''
2956         large=''
2957         huge=''
2958         unsplit=''
2959         split=''
2960         ;;
2961 *split)
2962         case "$split" in
2963         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2964                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2965                         dflt='-i'
2966                 else
2967                         dflt='none'
2968                 fi;;
2969         *) dflt="$split";;
2970         esac
2971         rp="What flag indicates separate I and D space?"
2972         . ./myread
2973         tans="$ans"
2974         case "$tans" in
2975         none) tans='';;
2976         esac
2977         split="$tans"
2978         unsplit='';;
2979 *large*|*small*|*medium*|*huge*)
2980         case "$models" in
2981         *large*)
2982                 case "$large" in
2983                 '') dflt='-Ml';;
2984                 *) dflt="$large";;
2985                 esac
2986         rp="What flag indicates large model?"
2987         . ./myread
2988         tans="$ans"
2989         case "$tans" in
2990         none) tans='';
2991         esac
2992         large="$tans";;
2993         *) large='';;
2994         esac
2995         case "$models" in
2996         *huge*) case "$huge" in
2997                 '') dflt='-Mh';;
2998                 *) dflt="$huge";;
2999                 esac
3000                 rp="What flag indicates huge model?"
3001                 . ./myread
3002                 tans="$ans"
3003                 case "$tans" in
3004                 none) tans='';
3005                 esac
3006                 huge="$tans";;
3007         *) huge="$large";;
3008         esac
3009         case "$models" in
3010         *medium*) case "$medium" in
3011                 '') dflt='-Mm';;
3012                 *) dflt="$medium";;
3013                 esac
3014                 rp="What flag indicates medium model?"
3015                 . ./myread
3016                 tans="$ans"
3017                 case "$tans" in
3018                 none) tans='';
3019                 esac
3020                 medium="$tans";;
3021         *) medium="$large";;
3022         esac
3023         case "$models" in
3024         *small*) case "$small" in
3025                 '') dflt='none';;
3026                 *) dflt="$small";;
3027                 esac
3028                 rp="What flag indicates small model?"
3029                 . ./myread
3030                 tans="$ans"
3031                 case "$tans" in
3032                 none) tans='';
3033                 esac
3034                 small="$tans";;
3035         *) small='';;
3036         esac
3037         ;;
3038 *)
3039         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3040         ;;
3041 esac
3042 $rm -f pdp11.* pdp11
3043
3044 : make some quick guesses about what we are up against
3045 echo " "
3046 $echo $n "Hmm...  $c"
3047 echo exit 1 >bsd
3048 echo exit 1 >usg
3049 echo exit 1 >v7
3050 echo exit 1 >osf1
3051 echo exit 1 >eunice
3052 echo exit 1 >xenix
3053 echo exit 1 >venix
3054 echo exit 1 >os2
3055 d_bsd="$undef"
3056 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3057 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3058 then
3059         echo "Looks kind of like an OSF/1 system, but we'll see..."
3060         echo exit 0 >osf1
3061 elif test `echo abc | tr a-z A-Z` = Abc ; then
3062         xxx=`./loc addbib blurfl $pth`
3063         if $test -f $xxx; then
3064         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3065                 echo exit 0 >bsd
3066                 echo exit 0 >usg
3067         else
3068                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3069                         echo "Looks kind of like an extended USG system, but we'll see..."
3070                 else
3071                         echo "Looks kind of like a USG system, but we'll see..."
3072                 fi
3073                 echo exit 0 >usg
3074         fi
3075 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3076         echo "Looks kind of like a BSD system, but we'll see..."
3077         d_bsd="$define"
3078         echo exit 0 >bsd
3079 else
3080         echo "Looks kind of like a Version 7 system, but we'll see..."
3081         echo exit 0 >v7
3082 fi
3083 case "$eunicefix" in
3084 *unixtovms*)
3085         $cat <<'EOI'
3086 There is, however, a strange, musty smell in the air that reminds me of
3087 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3088 EOI
3089         echo exit 0 >eunice
3090         d_eunice="$define"
3091 : it so happens the Eunice I know will not run shell scripts in Unix format
3092         ;;
3093 *)
3094         echo " "
3095         echo "Congratulations.  You aren't running Eunice."
3096         d_eunice="$undef"
3097         ;;
3098 esac
3099 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3100 case "$p_" in
3101 :) ;;
3102 *)
3103         $cat <<'EOI'
3104 I have the feeling something is not exactly right, however...don't tell me...
3105 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3106 EOI
3107         echo exit 0 >os2
3108         ;;
3109 esac
3110 if test -f /xenix; then
3111         echo "Actually, this looks more like a XENIX system..."
3112         echo exit 0 >xenix
3113         d_xenix="$define"
3114 else
3115         echo " "
3116         echo "It's not Xenix..."
3117         d_xenix="$undef"
3118 fi
3119 chmod +x xenix
3120 $eunicefix xenix
3121 if test -f /venix; then
3122         echo "Actually, this looks more like a VENIX system..."
3123         echo exit 0 >venix
3124 else
3125         echo " "
3126         if ./xenix; then
3127                 : null
3128         else
3129                 echo "Nor is it Venix..."
3130         fi
3131 fi
3132 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3133 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3134 $rm -f foo
3135
3136 : see if we need a special compiler
3137 echo " "
3138 if ./usg; then
3139         case "$cc" in
3140         '') case "$Mcc" in
3141                 /*) dflt='Mcc';;
3142                 *) case "$large" in
3143                         -M*) dflt='cc';;
3144                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3145                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3146                                                 dflt='cc'
3147                                         else
3148                                                 dflt='cc -M'
3149                                         fi
3150                                 else
3151                                         dflt='cc'
3152                                 fi;;
3153                         esac;;
3154                 esac;;
3155         *)  dflt="$cc";;
3156         esac
3157         case "$dflt" in
3158         *M*)    $cat <<'EOM'
3159 On some older systems the default C compiler will not resolve multiple global
3160 references that happen to have the same name.  On some such systems the "Mcc"
3161 command may be used to force these to be resolved.  On other systems a "cc -M"
3162 command is required.  (Note that the -M flag on other systems indicates a
3163 memory model to use!) If you have the Gnu C compiler, you might wish to use
3164 that instead.
3165
3166 EOM
3167         ;;
3168         esac
3169         rp="Use which C compiler?"
3170         . ./myread
3171         cc="$ans"
3172 else
3173         case "$cc" in
3174         '') dflt=cc;;
3175         *) dflt="$cc";;
3176         esac
3177         rp="Use which C compiler?"
3178         . ./myread
3179         cc="$ans"
3180 fi
3181 : Look for a hint-file generated 'call-back-unit'.  Now that the
3182 : user has specified the compiler, we may need to set or change some
3183 : other defaults.
3184 if $test -f cc.cbu; then
3185     . ./cc.cbu
3186 fi
3187 . ./checkcc
3188
3189 echo " "
3190 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3191 $cat >gccvers.c <<EOM
3192 #include <stdio.h>
3193 int main() {
3194 #ifdef __GNUC__
3195 #ifdef __VERSION__
3196         printf("%s\n", __VERSION__);
3197 #else
3198         printf("%s\n", "1");
3199 #endif
3200 #endif
3201         exit(0);
3202 }
3203 EOM
3204 if $cc $ldflags -o gccvers gccvers.c; then
3205         gccversion=`./gccvers`
3206         case "$gccversion" in
3207         '') echo "You are not using GNU cc." ;;
3208         *)  echo "You are using GNU cc $gccversion."
3209             ;;
3210         esac
3211 else
3212         echo " "
3213         echo "*** WHOA THERE!!! ***" >&4
3214         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3215         case "$knowitall" in
3216         '')
3217         echo "    You'd better start hunting for one and let me know about it." >&4
3218                 exit 1
3219                 ;;
3220         esac
3221 fi
3222 $rm -f gccvers*
3223 case "$gccversion" in
3224 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3225 esac
3226 case "$gccversion" in
3227 '') gccosandvers='' ;;
3228 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3229    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3230    gccshortvers=''
3231    case "$gccosandvers" in
3232    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3233    $osname$osvers) ;; # looking good
3234    $osname*) cat <<EOM >&4
3235
3236 *** WHOA THERE!!! ***
3237
3238     Your gcc has not been compiled for the exact release of
3239     your operating system ($gccosandvers versus $osname$osvers).
3240
3241     In general it is a good idea to keep gcc synchronized with
3242     the operating system because otherwise serious problems
3243     may ensue when trying to compile software, like Perl.
3244
3245     I'm trying to be optimistic here, though, and will continue.
3246     If later during the configuration and build icky compilation
3247     problems appear (headerfile conflicts being the most common
3248     manifestation), I suggest reinstalling the gcc to match
3249     your operating system release.
3250
3251 EOM
3252       ;;
3253    *) gccosandvers='' ;; # failed to parse, better be silent
3254    esac
3255    ;;
3256 esac
3257
3258
3259
3260
3261 : see how we invoke the C preprocessor
3262 echo " "
3263 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3264 cat <<'EOT' >testcpp.c
3265 #define ABC abc
3266 #define XYZ xyz
3267 ABC.XYZ
3268 EOT
3269 cd ..
3270 if test ! -f cppstdin; then
3271         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3272                 # AIX cc -E doesn't show the absolute headerfile
3273                 # locations but we'll cheat by using the -M flag.
3274                 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
3275         else
3276                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3277         fi
3278 else
3279         echo "Keeping your $hint cppstdin wrapper."
3280 fi
3281 chmod 755 cppstdin
3282 wrapper=`pwd`/cppstdin
3283 ok='false'
3284 cd UU
3285
3286 if $test "X$cppstdin" != "X" && \
3287         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3288         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3289 then
3290         echo "You used to use $cppstdin $cppminus so we'll use that again."
3291         case "$cpprun" in
3292         '') echo "But let's see if we can live without a wrapper..." ;;
3293         *)
3294                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3295                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3296                 then
3297                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3298                         ok='true'
3299                 else
3300                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3301                 fi
3302                 ;;
3303         esac
3304 else
3305         case "$cppstdin" in
3306         '') ;;
3307         *)
3308                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3309                 ;;
3310         esac
3311 fi
3312
3313 if $ok; then
3314         : nothing
3315 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3316         $cc -E <testcpp.c >testcpp.out 2>&1; \
3317         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3318         echo "Yup, it does."
3319         x_cpp="$cc -E"
3320         x_minus='';
3321 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3322         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3323         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3324         echo "Yup, it does."
3325         x_cpp="$cc -E"
3326         x_minus='-';
3327 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3328         $cc -P <testcpp.c >testcpp.out 2>&1; \
3329         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3330         echo "Yipee, that works!"
3331         x_cpp="$cc -P"
3332         x_minus='';
3333 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3334         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3335         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3336         echo "At long last!"
3337         x_cpp="$cc -P"
3338         x_minus='-';
3339 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3340         $cpp <testcpp.c >testcpp.out 2>&1; \
3341         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3342         echo "It works!"
3343         x_cpp="$cpp"
3344         x_minus='';
3345 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3346         $cpp - <testcpp.c >testcpp.out 2>&1; \
3347         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3348         echo "Hooray, it works!  I was beginning to wonder."
3349         x_cpp="$cpp"
3350         x_minus='-';
3351 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3352         $wrapper <testcpp.c >testcpp.out 2>&1; \
3353         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3354         x_cpp="$wrapper"
3355         x_minus=''
3356         echo "Eureka!"
3357 else
3358         dflt=''
3359         rp="No dice.  I can't find a C preprocessor.  Name one:"
3360         . ./myread
3361         x_cpp="$ans"
3362         x_minus=''
3363         $x_cpp <testcpp.c >testcpp.out 2>&1
3364         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3365                 echo "OK, that will do." >&4
3366         else
3367 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3368                 exit 1
3369         fi
3370 fi
3371
3372 case "$ok" in
3373 false)
3374         cppstdin="$x_cpp"
3375         cppminus="$x_minus"
3376         cpprun="$x_cpp"
3377         cpplast="$x_minus"
3378         set X $x_cpp
3379         shift
3380         case "$1" in
3381         "$cpp")
3382                 echo "Perhaps can we force $cc -E using a wrapper..."
3383                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3384                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3385                 then
3386                         echo "Yup, we can."
3387                         cppstdin="$wrapper"
3388                         cppminus='';
3389                 else
3390                         echo "Nope, we'll have to live without it..."
3391                 fi
3392                 ;;
3393         esac
3394         case "$cpprun" in
3395         "$wrapper")
3396                 cpprun=''
3397                 cpplast=''
3398                 ;;
3399         esac
3400         ;;
3401 esac
3402
3403 case "$cppstdin" in
3404 "$wrapper"|'cppstdin') ;;
3405 *) $rm -f $wrapper;;
3406 esac
3407 $rm -f testcpp.c testcpp.out
3408
3409 : decide how portable to be.  Allow command line overrides.
3410 case "$d_portable" in
3411 "$undef") ;;
3412 *)      d_portable="$define" ;;
3413 esac
3414
3415 : set up shell script to do ~ expansion
3416 cat >filexp <<EOSS
3417 $startsh
3418 : expand filename
3419 case "\$1" in
3420  ~/*|~)
3421         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3422         ;;
3423  ~*)
3424         if $test -f /bin/csh; then
3425                 /bin/csh -f -c "glob \$1"
3426                 failed=\$?
3427                 echo ""
3428                 exit \$failed
3429         else
3430                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3431                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3432                 if $test ! -d "\$dir"; then
3433                         me=\`basename \$0\`
3434                         echo "\$me: can't locate home directory for: \$name" >&2
3435                         exit 1
3436                 fi
3437                 case "\$1" in
3438                 */*)
3439                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3440                         ;;
3441                 *)
3442                         echo \$dir
3443                         ;;
3444                 esac
3445         fi
3446         ;;
3447 *)
3448         echo \$1
3449         ;;
3450 esac
3451 EOSS
3452 chmod +x filexp
3453 $eunicefix filexp
3454
3455 : now set up to get a file name
3456 cat <<EOS >getfile
3457 $startsh
3458 EOS
3459 cat <<'EOSC' >>getfile
3460 tilde=''
3461 fullpath=''
3462 already=''
3463 skip=''
3464 none_ok=''
3465 exp_file=''
3466 nopath_ok=''
3467 orig_rp="$rp"
3468 orig_dflt="$dflt"
3469 case "$gfpth" in
3470 '') gfpth='.' ;;
3471 esac
3472
3473 case "$fn" in
3474 *\(*)
3475         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3476         fn=`echo $fn | sed 's/(.*)//'`
3477         ;;
3478 esac
3479
3480 case "$fn" in
3481 *:*)
3482         loc_file=`expr $fn : '.*:\(.*\)'`
3483         fn=`expr $fn : '\(.*\):.*'`
3484         ;;
3485 esac
3486
3487 case "$fn" in
3488 *~*) tilde=true;;
3489 esac
3490 case "$fn" in
3491 */*) fullpath=true;;
3492 esac
3493 case "$fn" in
3494 *+*) skip=true;;
3495 esac
3496 case "$fn" in
3497 *n*) none_ok=true;;
3498 esac
3499 case "$fn" in
3500 *e*) exp_file=true;;
3501 esac
3502 case "$fn" in
3503 *p*) nopath_ok=true;;
3504 esac
3505
3506 case "$fn" in
3507 *f*) type='File';;
3508 *d*) type='Directory';;
3509 *l*) type='Locate';;
3510 esac
3511
3512 what="$type"
3513 case "$what" in
3514 Locate) what='File';;
3515 esac
3516
3517 case "$exp_file" in
3518 '')
3519         case "$d_portable" in
3520         "$define") ;;
3521         *) exp_file=true;;
3522         esac
3523         ;;
3524 esac
3525
3526 cd ..
3527 while test "$type"; do
3528         redo=''
3529         rp="$orig_rp"
3530         dflt="$orig_dflt"
3531         case "$tilde" in
3532         true) rp="$rp (~name ok)";;
3533         esac
3534         . UU/myread
3535         if test -f UU/getfile.ok && \
3536                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3537         then
3538                 value="$ans"
3539                 ansexp="$ans"
3540                 break
3541         fi
3542         case "$ans" in
3543         none)
3544                 value=''
3545                 ansexp=''
3546                 case "$none_ok" in
3547                 true) type='';;
3548                 esac
3549                 ;;
3550         *)
3551                 case "$tilde" in
3552                 '') value="$ans"
3553                         ansexp="$ans";;
3554                 *)
3555                         value=`UU/filexp $ans`
3556                         case $? in
3557                         0)
3558                                 if test "$ans" != "$value"; then
3559                                         echo "(That expands to $value on this system.)"
3560                                 fi
3561                                 ;;
3562                         *) value="$ans";;
3563                         esac
3564                         ansexp="$value"
3565                         case "$exp_file" in
3566                         '') value="$ans";;
3567                         esac
3568                         ;;
3569                 esac
3570                 case "$fullpath" in
3571                 true)
3572                         case "$ansexp" in
3573                         /*) value="$ansexp" ;;
3574                         [a-zA-Z]:/*) value="$ansexp" ;;
3575                         *)
3576                                 redo=true
3577                                 case "$already" in
3578                                 true)
3579                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3580                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3581                                         ;;
3582                                 *)
3583                                 echo "Please give a full path name, starting with slash." >&4
3584                                         case "$tilde" in
3585                                         true)
3586                                 echo "Note that using ~name is ok provided it expands well." >&4
3587                                                 already=true
3588                                                 ;;
3589                                         esac
3590                                 esac
3591                                 ;;
3592                         esac
3593                         ;;
3594                 esac
3595                 case "$redo" in
3596                 '')
3597                         case "$type" in
3598                         File)
3599                                 for fp in $gfpth; do
3600                                         if test "X$fp" = X.; then
3601                                             pf="$ansexp"
3602                                         else    
3603                                             pf="$fp/$ansexp"
3604                                         fi
3605                                         if test -f "$pf"; then
3606                                                 type=''
3607                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3608                                         then
3609                                                 echo "($value is not a plain file, but that's ok.)"
3610                                                 type=''
3611                                         fi
3612                                         if test X"$type" = X; then
3613                                             value="$pf"
3614                                             break
3615                                         fi
3616                                 done
3617                                 ;;
3618                         Directory)
3619                                 for fp in $gfpth; do
3620                                         if test "X$fp" = X.; then
3621                                             dir="$ans"
3622                                             direxp="$ansexp"
3623                                         else    
3624                                             dir="$fp/$ansexp"
3625                                             direxp="$fp/$ansexp"
3626                                         fi
3627                                         if test -d "$direxp"; then
3628                                                 type=''
3629                                                 value="$dir"
3630                                                 break
3631                                         fi
3632                                 done
3633                                 ;;
3634                         Locate)
3635                                 if test -d "$ansexp"; then
3636                                         echo "(Looking for $loc_file in directory $value.)"
3637                                         value="$value/$loc_file"
3638                                         ansexp="$ansexp/$loc_file"
3639                                 fi
3640                                 if test -f "$ansexp"; then
3641                                         type=''
3642                                 fi
3643                                 case "$nopath_ok" in
3644                                 true)   case "$value" in
3645                                         */*) ;;
3646                                         *)      echo "Assuming $value will be in people's path."
3647                                                 type=''
3648                                                 ;;
3649                                         esac
3650                                         ;;
3651                                 esac
3652                                 ;;
3653                         esac
3654
3655                         case "$skip" in
3656                         true) type='';
3657                         esac
3658
3659                         case "$type" in
3660                         '') ;;
3661                         *)
3662                                 if test "$fastread" = yes; then
3663                                         dflt=y
3664                                 else
3665                                         dflt=n
3666                                 fi
3667                                 rp="$what $value doesn't exist.  Use that name anyway?"
3668                                 . UU/myread
3669                                 dflt=''
3670                                 case "$ans" in
3671                                 y*) type='';;
3672                                 *) echo " ";;
3673                                 esac
3674                                 ;;
3675                         esac
3676                         ;;
3677                 esac
3678                 ;;
3679         esac
3680 done
3681 cd UU
3682 ans="$value"
3683 rp="$orig_rp"
3684 dflt="$orig_dflt"
3685 rm -f getfile.ok
3686 test "X$gfpthkeep" != Xy && gfpth=""
3687 EOSC
3688
3689 : What should the include directory be ?
3690 echo " "
3691 $echo $n "Hmm...  $c"
3692 dflt='/usr/include'
3693 incpath=''
3694 mips_type=''
3695 if $test -f /bin/mips && /bin/mips; then
3696         echo "Looks like a MIPS system..."
3697         $cat >usr.c <<'EOCP'
3698 #ifdef SYSTYPE_BSD43
3699 /bsd43
3700 #endif
3701 EOCP
3702         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3703                 dflt='/bsd43/usr/include'
3704                 incpath='/bsd43'
3705                 mips_type='BSD 4.3'
3706         else
3707                 mips_type='System V'
3708         fi
3709         $rm -f usr.c usr.out
3710         echo "and you're compiling with the $mips_type compiler and libraries."
3711         xxx_prompt=y
3712         echo "exit 0" >mips
3713 else
3714         echo "Doesn't look like a MIPS system."
3715         xxx_prompt=n
3716         echo "exit 1" >mips
3717 fi
3718 chmod +x mips
3719 $eunicefix mips
3720 case "$usrinc" in
3721 '') ;;
3722 *) dflt="$usrinc";;
3723 esac
3724 case "$xxx_prompt" in
3725 y)      fn=d/
3726         echo " "
3727         rp='Where are the include files you want to use?'
3728         . ./getfile
3729         usrinc="$ans"
3730         ;;
3731 *)      usrinc="$dflt"
3732         ;;
3733 esac
3734
3735 : Set private lib path
3736 case "$plibpth" in
3737 '') if ./mips; then
3738                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3739         fi;;
3740 esac
3741 case "$libpth" in
3742 ' ') dlist='';;
3743 '') dlist="$loclibpth $plibpth $glibpth";;
3744 *) dlist="$libpth";;
3745 esac
3746
3747 : Now check and see which directories actually exist, avoiding duplicates
3748 libpth=''
3749 for xxx in $dlist
3750 do
3751     if $test -d $xxx; then
3752                 case " $libpth " in
3753                 *" $xxx "*) ;;
3754                 *) libpth="$libpth $xxx";;
3755                 esac
3756     fi
3757 done
3758 $cat <<'EOM'
3759
3760 Some systems have incompatible or broken versions of libraries.  Among
3761 the directories listed in the question below, please remove any you
3762 know not to be holding relevant libraries, and add any that are needed.
3763 Say "none" for none.
3764
3765 EOM
3766 case "$libpth" in
3767 '') dflt='none';;
3768 *)
3769         set X $libpth
3770         shift
3771         dflt=${1+"$@"}
3772         ;;
3773 esac
3774 rp="Directories to use for library searches?"
3775 . ./myread
3776 case "$ans" in
3777 none) libpth=' ';;
3778 *) libpth="$ans";;
3779 esac
3780
3781 : compute shared library extension
3782 case "$so" in
3783 '')
3784         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3785                 dflt='sl'
3786         else
3787                 dflt='so'
3788         fi
3789         ;;
3790 *) dflt="$so";;
3791 esac
3792 $cat <<EOM
3793
3794 On some systems, shared libraries may be available.  Answer 'none' if
3795 you want to suppress searching of shared libraries for the remainder
3796 of this configuration.
3797
3798 EOM
3799 rp='What is the file extension used for shared libraries?'
3800 . ./myread
3801 so="$ans"
3802
3803 : Define several unixisms.
3804 : Hints files or command line option can be used to override them.
3805 : The convoluted testing is in case hints files set either the old
3806 : or the new name.
3807 case "$_exe" in
3808 '')     case "$exe_ext" in
3809     '') ;;
3810         *)      _exe="$exe_ext" ;;
3811         esac
3812         ;;
3813 esac
3814 case "$_a" in
3815 '')     case "$lib_ext" in
3816     '') _a='.a';;
3817         *)      _a="$lib_ext" ;;
3818         esac
3819         ;;
3820 esac
3821 case "$_o" in
3822 '') case "$obj_ext" in
3823         '')     _o='.o';;
3824         *)      _o="$obj_ext";;
3825         esac
3826         ;;
3827 esac
3828 case "$p_" in
3829 '') case "$path_sep" in
3830         '')     p_=':';;
3831         *)      p_="$path_sep";;
3832         esac
3833         ;;
3834 esac
3835 exe_ext=$_exe
3836 lib_ext=$_a
3837 obj_ext=$_o
3838 path_sep=$p_
3839
3840 : Which makefile gets called first.  This is used by make depend.
3841 case "$firstmakefile" in
3842 '') firstmakefile='makefile';;
3843 esac
3844
3845 case "$usesocks" in
3846 $define|true|[yY]*)     dflt='y';;
3847 *) dflt='n';;
3848 esac
3849 cat <<EOM
3850
3851 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3852 Configure must be run with -Dusesocks.
3853
3854 If this doesn't make any sense to you, just accept the default '$dflt'.
3855 EOM
3856 rp='Build Perl for SOCKS?'
3857 . ./myread
3858 case "$ans" in
3859 y|Y)    val="$define" ;;     
3860 *)      val="$undef" ;;
3861 esac
3862 set usesocks
3863 eval $setvar
3864
3865 : Looking for optional libraries
3866 echo " "
3867 echo "Checking for optional libraries..." >&4
3868 case "$libs" in
3869 ' '|'') dflt='';;
3870 *) dflt="$libs";;
3871 esac
3872 case "$libswanted" in
3873 '') libswanted='c_s';;
3874 esac
3875 case "$usesocks" in
3876 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3877 esac
3878 libsfound=''
3879 libsfiles=''
3880 libsdirs=''
3881 libspath=''
3882 for thisdir in $libpth $xlibpth; do
3883   test -d $thisdir && libspath="$libspath $thisdir"
3884 done
3885 for thislib in $libswanted; do
3886         for thisdir in $libspath; do
3887             xxx=''
3888             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3889                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3890                 $test -f "$xxx" && eval $libscheck
3891                 $test -f "$xxx" && libstyle=shared
3892             fi
3893             if test ! -f "$xxx"; then
3894                 xxx=$thisdir/lib$thislib.$so
3895                 $test -f "$xxx" && eval $libscheck
3896                 $test -f "$xxx" && libstyle=shared
3897             fi  
3898             if test ! -f "$xxx"; then
3899                 xxx=$thisdir/lib$thislib$_a
3900                 $test -f "$xxx" && eval $libscheck
3901                 $test -f "$xxx" && libstyle=static
3902             fi
3903             if test ! -f "$xxx"; then
3904                 xxx=$thisdir/$thislib$_a
3905                 $test -f "$xxx" && eval $libscheck
3906                 $test -f "$xxx" && libstyle=static
3907             fi
3908             if test ! -f "$xxx"; then
3909                 xxx=$thisdir/lib${thislib}_s$_a
3910                 $test -f "$xxx" && eval $libscheck
3911                 $test -f "$xxx" && libstyle=static
3912                 $test -f "$xxx" && thislib=${thislib}_s
3913             fi
3914             if test ! -f "$xxx"; then
3915                 xxx=$thisdir/Slib$thislib$_a
3916                 $test -f "$xxx" && eval $libscheck
3917                 $test -f "$xxx" && libstyle=static
3918             fi
3919             if $test -f "$xxx"; then
3920                 case "$libstyle" in
3921                 shared) echo "Found -l$thislib (shared)." ;;
3922                 static) echo "Found -l$thislib." ;;
3923                 *)      echo "Found -l$thislib ($libstyle)." ;;
3924                 esac
3925                 case " $dflt " in
3926                 *"-l$thislib "*);;
3927                 *) dflt="$dflt -l$thislib"
3928                    libsfound="$libsfound $xxx"
3929                    yyy=`basename $xxx`
3930                    libsfiles="$libsfiles $yyy"
3931                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3932                    case " $libsdirs " in
3933                    *" $yyy "*) ;;
3934                    *) libsdirs="$libsdirs $yyy" ;;
3935                    esac
3936                    ;;
3937                 esac
3938                 break
3939             fi  
3940         done
3941         if $test ! -f "$xxx"; then
3942             echo "No -l$thislib."
3943         fi
3944 done
3945 set X $dflt
3946 shift
3947 dflt="$*"
3948 case "$libs" in
3949 '') dflt="$dflt";;
3950 *) dflt="$libs";;
3951 esac
3952 case "$dflt" in
3953 ' '|'') dflt='none';;
3954 esac
3955
3956 $cat <<EOM
3957
3958 In order to compile $package on your machine, a number of libraries
3959 are usually needed.  Include any other special libraries here as well.
3960 Say "none" for none.  The default list is almost always right.
3961 EOM
3962
3963 echo " "
3964 rp="What libraries to use?"
3965 . ./myread
3966 case "$ans" in
3967 none) libs=' ';;
3968 *) libs="$ans";;
3969 esac
3970
3971 : determine optimization, if desired, or use for debug flag also
3972 case "$optimize" in
3973 ' '|$undef) dflt='none';;
3974 '') dflt='-O';;
3975 *) dflt="$optimize";;
3976 esac
3977 $cat <<EOH
3978
3979 By default, $package compiles with the -O flag to use the optimizer.
3980 Alternately, you might want to use the symbolic debugger, which uses
3981 the -g flag (on traditional Unix systems).  Either flag can be
3982 specified here.  To use neither flag, specify the word "none".
3983
3984 EOH
3985 rp="What optimizer/debugger flag should be used?"
3986 . ./myread
3987 optimize="$ans"
3988 case "$optimize" in
3989 'none') optimize=" ";;
3990 esac
3991
3992 dflt=''
3993 : We will not override a previous value, but we might want to
3994 : augment a hint file
3995 case "$hint" in
3996 default|recommended)
3997         case "$gccversion" in
3998         1*) dflt='-fpcc-struct-return' ;;
3999         esac
4000         case "$optimize" in
4001         *-g*) dflt="$dflt -DDEBUGGING";;
4002         esac
4003         case "$gccversion" in
4004         2*) if test -d /etc/conf/kconfig.d &&
4005                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4006                 then
4007                         dflt="$dflt -posix"
4008                 fi
4009                 ;;
4010         esac
4011         case "$gccversion" in
4012         1*) ;;
4013         2.[0-8]*) ;;
4014         ?*)     echo " "
4015                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4016                 echo 'int main(void) { return 0; }' > gcctest.c
4017                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4018                         echo "Yes, it does." 2>&1
4019                         case "$ccflags" in
4020                         *strict-aliasing*) 
4021                                 echo "Leaving current flags $ccflags alone." 2>&1
4022                                 ;;
4023                         *) dflt="$dflt -fno-strict-aliasing" ;;
4024                         esac
4025                 else
4026                         echo "Nope, it doesn't, but that's ok." 2>&1
4027                 fi
4028                 ;;
4029         esac
4030         ;;
4031 esac
4032
4033 case "$mips_type" in
4034 *BSD*|'') inclwanted="$locincpth $usrinc";;
4035 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4036 esac
4037 for thisincl in $inclwanted; do
4038         if $test -d $thisincl; then
4039                 if $test x$thisincl != x$usrinc; then
4040                         case "$dflt" in
4041                         *$thisincl*);;
4042                         *) dflt="$dflt -I$thisincl";;
4043                         esac
4044                 fi
4045         fi
4046 done
4047
4048 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4049         xxx=true;
4050 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4051         xxx=true;
4052 else
4053         xxx=false;
4054 fi;
4055 if $xxx; then
4056         case "$dflt" in
4057         *$2*);;
4058         *) dflt="$dflt -D$2";;
4059         esac;
4060 fi'
4061
4062 set signal.h LANGUAGE_C; eval $inctest
4063
4064 case "$usesocks" in
4065 $define)
4066         ccflags="$ccflags -DSOCKS"
4067         ;;
4068 esac
4069
4070 case "$hint" in
4071 default|recommended) dflt="$ccflags $dflt" ;;
4072 *) dflt="$ccflags";;
4073 esac
4074
4075 case "$dflt" in
4076 ''|' ') dflt=none;;
4077 esac
4078 $cat <<EOH
4079
4080 Your C compiler may want other flags.  For this question you should include
4081 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4082 but you should NOT include libraries or ld flags like -lwhatever.  If you
4083 want $package to honor its debug switch, you should include -DDEBUGGING here.
4084 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4085
4086 To use no flags, specify the word "none".
4087
4088 EOH
4089 set X $dflt
4090 shift
4091 dflt=${1+"$@"}
4092 rp="Any additional cc flags?"
4093 . ./myread
4094 case "$ans" in
4095 none) ccflags='';;
4096 *) ccflags="$ans";;
4097 esac
4098
4099 : the following weeds options from ccflags that are of no interest to cpp
4100 cppflags="$ccflags"
4101 case "$gccversion" in
4102 1*) cppflags="$cppflags -D__GNUC__"
4103 esac
4104 case "$mips_type" in
4105 '');;
4106 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4107 esac
4108 case "$cppflags" in
4109 '');;
4110 *)
4111         echo " "
4112         echo "Let me guess what the preprocessor flags are..." >&4
4113         set X $cppflags
4114         shift
4115         cppflags=''
4116         $cat >cpp.c <<'EOM'
4117 #define BLURFL foo
4118
4119 BLURFL xx LFRULB
4120 EOM
4121         previous=''
4122         for flag in $*
4123         do
4124                 case "$flag" in
4125                 -*) ftry="$flag";;
4126                 *) ftry="$previous $flag";;
4127                 esac
4128                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4129                         >cpp1.out 2>/dev/null && \
4130                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4131                         >cpp2.out 2>/dev/null && \
4132                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4133                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4134                 then
4135                         cppflags="$cppflags $ftry"
4136                         previous=''
4137                 else
4138                         previous="$flag"
4139                 fi
4140         done
4141         set X $cppflags
4142         shift
4143         cppflags=${1+"$@"}
4144         case "$cppflags" in
4145         *-*)  echo "They appear to be: $cppflags";;
4146         esac
4147         $rm -f cpp.c cpp?.out
4148         ;;
4149 esac
4150
4151 : flags used in final linking phase
4152 case "$ldflags" in
4153 '') if ./venix; then
4154                 dflt='-i -z'
4155         else
4156                 dflt=''
4157         fi
4158         case "$ccflags" in
4159         *-posix*) dflt="$dflt -posix" ;;
4160         esac
4161         ;;
4162 *) dflt="$ldflags";;
4163 esac
4164
4165 : Try to guess additional flags to pick up local libraries.
4166 for thislibdir in $libpth; do
4167         case " $loclibpth " in
4168         *" $thislibdir "*)
4169                 case "$dflt " in 
4170                 *"-L$thislibdir "*) ;;
4171                 *)  dflt="$dflt -L$thislibdir" ;;
4172                 esac
4173                 ;;
4174         esac
4175 done
4176
4177 case "$dflt" in
4178 '') dflt='none' ;;
4179 esac
4180
4181 $cat <<EOH
4182
4183 Your C linker may need flags.  For this question you should
4184 include -L/whatever and any other flags used by the C linker, but you
4185 should NOT include libraries like -lwhatever.
4186
4187 Make sure you include the appropriate -L/path flags if your C linker
4188 does not normally search all of the directories you specified above,
4189 namely
4190         $libpth
4191 To use no flags, specify the word "none".
4192
4193 EOH
4194
4195 rp="Any additional ld flags (NOT including libraries)?"
4196 . ./myread
4197 case "$ans" in
4198 none) ldflags='';;
4199 *) ldflags="$ans";;
4200 esac
4201 rmlist="$rmlist pdp11"
4202
4203 : coherency check
4204 echo " "
4205 echo "Checking your choice of C compiler and flags for coherency..." >&4
4206 $cat > try.c <<'EOF'
4207 #include <stdio.h>
4208 int main() { printf("Ok\n"); exit(0); }
4209 EOF
4210 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4211 shift
4212 $cat >try.msg <<'EOM'
4213 I've tried to compile and run the following simple program:
4214
4215 EOM
4216 $cat try.c >> try.msg
4217
4218 $cat >> try.msg <<EOM
4219
4220 I used the command:
4221
4222         $*
4223         ./try
4224
4225 and I got the following output:
4226
4227 EOM
4228 dflt=y
4229 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4230         if sh -c './try' >>try.msg 2>&1; then
4231                 xxx=`./try`
4232                 case "$xxx" in
4233                 "Ok") dflt=n ;;
4234                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4235                         case " $libs " in
4236                         *" -lsfio "*)
4237                                 cat >> try.msg <<'EOQS'
4238 If $libs contains -lsfio, and sfio is mis-configured, then it
4239 sometimes (apparently) runs and exits with a 0 status, but with no
4240 output!  It may have to do with sfio's use of _exit vs. exit.
4241
4242 EOQS
4243                                 rp="You have a big problem.  Shall I abort Configure"
4244                                 dflt=y
4245                                 ;;
4246                         esac
4247                         ;;
4248                 esac
4249         else
4250                 echo "The program compiled OK, but exited with status $?." >>try.msg
4251                 rp="You have a problem.  Shall I abort Configure"
4252                 dflt=y
4253         fi
4254 else
4255         echo "I can't compile the test program." >>try.msg
4256         rp="You have a BIG problem.  Shall I abort Configure"
4257         dflt=y
4258 fi
4259 case "$dflt" in
4260 y)
4261         $cat try.msg >&4
4262         case "$knowitall" in
4263         '')
4264                 echo "(The supplied flags or libraries might be incorrect.)"
4265                 ;;
4266         *) dflt=n;;
4267         esac
4268         echo " "
4269         . ./myread
4270         case "$ans" in
4271         n*|N*) ;;
4272         *)      echo "Ok.  Stopping Configure." >&4
4273                 exit 1
4274                 ;;
4275         esac
4276         ;;
4277 n) echo "OK, that should do.";;
4278 esac
4279 $rm -f try try.* core
4280
4281 : define an is-a-typedef? function
4282 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4283 case "$inclist" in
4284 "") inclist="sys/types.h";;
4285 esac;
4286 eval "varval=\$$var";
4287 case "$varval" in
4288 "")
4289         $rm -f temp.c;
4290         for inc in $inclist; do
4291                 echo "#include <$inc>" >>temp.c;
4292         done;
4293         echo "#ifdef $type" >> temp.c;
4294         echo "printf(\"We have $type\");" >> temp.c;
4295         echo "#endif" >> temp.c;
4296         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4297         if $contains $type temp.E >/dev/null 2>&1; then
4298                 eval "$var=\$type";
4299         else
4300                 eval "$var=\$def";
4301         fi;
4302         $rm -f temp.?;;
4303 *) eval "$var=\$varval";;
4304 esac'
4305
4306 : define an is-a-typedef? function that prompts if the type is not available.
4307 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4308 case "$inclist" in
4309 "") inclist="sys/types.h";;
4310 esac;
4311 eval "varval=\$$var";
4312 case "$varval" in
4313 "")
4314         $rm -f temp.c;
4315         for inc in $inclist; do
4316                 echo "#include <$inc>" >>temp.c;
4317         done;
4318         echo "#ifdef $type" >> temp.c;
4319         echo "printf(\"We have $type\");" >> temp.c;
4320         echo "#endif" >> temp.c;
4321         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4322         echo " " ;
4323         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4324         if $contains $type temp.E >/dev/null 2>&1; then
4325                 echo "$type found." >&4;
4326                 eval "$var=\$type";
4327         else
4328                 echo "$type NOT found." >&4;
4329                 dflt="$def";
4330                 . ./myread ;
4331                 eval "$var=\$ans";
4332         fi;
4333         $rm -f temp.?;;
4334 *) eval "$var=\$varval";;
4335 esac'
4336
4337 : define a shorthand compile call
4338 compile='
4339 mc_file=$1;
4340 shift;
4341 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4342 : define a shorthand compile call for compilations that should be ok.
4343 compile_ok='
4344 mc_file=$1;
4345 shift;
4346 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4347
4348 : check for lengths of integral types
4349 echo " "
4350 case "$intsize" in
4351 '')
4352         echo "Checking to see how big your integers are..." >&4
4353         $cat >intsize.c <<'EOCP'
4354 #include <stdio.h>
4355 int main()
4356 {
4357         printf("intsize=%d;\n", (int)sizeof(int));
4358         printf("longsize=%d;\n", (int)sizeof(long));
4359         printf("shortsize=%d;\n", (int)sizeof(short));
4360         exit(0);
4361 }
4362 EOCP
4363         set intsize
4364         if eval $compile_ok && ./intsize > /dev/null; then
4365                 eval `./intsize`
4366                 echo "Your integers are $intsize bytes long."
4367                 echo "Your long integers are $longsize bytes long."
4368                 echo "Your short integers are $shortsize bytes long."
4369         else
4370                 $cat >&4 <<EOM
4371 !
4372 Help! I can't compile and run the intsize test program: please enlighten me!
4373 (This is probably a misconfiguration in your system or libraries, and
4374 you really ought to fix it.  Still, I'll try anyway.)
4375 !
4376 EOM
4377                 dflt=4
4378                 rp="What is the size of an integer (in bytes)?"
4379                 . ./myread
4380                 intsize="$ans"
4381                 dflt=$intsize
4382                 rp="What is the size of a long integer (in bytes)?"
4383                 . ./myread
4384                 longsize="$ans"
4385                 dflt=2
4386                 rp="What is the size of a short integer (in bytes)?"
4387                 . ./myread
4388                 shortsize="$ans"
4389         fi
4390         ;;
4391 esac
4392 $rm -f intsize intsize.*
4393
4394 : see what type lseek is declared as in the kernel
4395 rp="What is the type used for lseek's offset on this system?"
4396 set off_t lseektype long stdio.h sys/types.h
4397 eval $typedef_ask
4398
4399 echo " "
4400 echo "Checking to see how big your file offsets are..." >&4
4401 $cat >try.c <<EOCP
4402 #include <sys/types.h>
4403 #include <stdio.h>
4404 int main()
4405 {
4406     printf("%d\n", (int)sizeof($lseektype));
4407     return(0); 
4408 }
4409 EOCP
4410 set try
4411 if eval $compile_ok; then
4412         lseeksize=`./try`
4413         echo "Your file offsets are $lseeksize bytes long."
4414 else
4415         dflt=$longsize
4416         echo " "
4417         echo "(I can't seem to compile the test program.  Guessing...)"
4418         rp="What is the size of your file offsets (in bytes)?"
4419         . ./myread
4420         lseeksize="$ans"
4421 fi
4422 $rm -f try.c try
4423
4424 : see what type file positions are declared as in the library
4425 rp="What is the type for file position used by fsetpos()?"
4426 set fpos_t fpostype long stdio.h sys/types.h
4427 eval $typedef_ask
4428
4429 echo " "
4430 case "$fpostype" in
4431 *_t) zzz="$fpostype"    ;;
4432 *)   zzz="fpos_t"       ;;
4433 esac
4434 echo "Checking the size of $zzz..." >&4 
4435 cat > try.c <<EOCP
4436 #include <sys/types.h>
4437 #include <stdio.h>
4438 int main() {
4439     printf("%d\n", (int)sizeof($fpostype));
4440     exit(0);
4441 }
4442 EOCP
4443 set try
4444 if eval $compile_ok; then
4445         yyy=`./try`
4446         case "$yyy" in
4447         '')     fpossize=4
4448                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4449                 ;;
4450         *)      fpossize=$yyy
4451                 echo "Your $zzz is $fpossize bytes long."
4452                 ;;
4453         esac
4454 else
4455         dflt="$longsize"
4456         echo " " >&4
4457         echo "(I can't compile the test program.  Guessing...)" >&4
4458         rp="What is the size of your file positions (in bytes)?"
4459         . ./myread
4460         fpossize="$ans"
4461 fi
4462
4463
4464
4465 # Backward compatibility (uselfs is deprecated).
4466 case "$uselfs" in
4467 "$define"|true|[yY]*)
4468         cat <<EOM >&4
4469
4470 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4471 EOM
4472         uselargefiles="$define"
4473         ;;
4474 esac                          
4475
4476 case "$lseeksize:$fpossize" in
4477 8:8) cat <<EOM
4478
4479 You can have files larger than 2 gigabytes.
4480 EOM
4481    val="$define" ;;
4482 *)    case "$uselargefiles" in
4483    "$undef"|false|[nN]*) dflt='n' ;;
4484    *)   dflt='y' ;;
4485    esac
4486    cat <<EOM
4487
4488 Perl can be built to understand large files (files larger than 2 gigabytes)
4489 on some systems.  To do so, Configure can be run with -Duselargefiles.
4490
4491 If this doesn't make any sense to you, just accept the default '$dflt'.
4492 EOM
4493    rp='Try to understand large files, if available?'
4494    . ./myread
4495    case "$ans" in
4496    y|Y)         val="$define" ;;
4497    *)           val="$undef"  ;;
4498    esac
4499    ;;
4500 esac
4501 set uselargefiles
4502 eval $setvar
4503 case "$uselargefiles" in
4504 "$define")
4505 : Look for a hint-file generated 'call-back-unit'.  If the
4506 : user has specified that a large files perl is to be built,
4507 : we may need to set or change some other defaults.
4508         if $test -f uselargefiles.cbu; then
4509                 echo "Your platform has some specific hints for large file builds, using them..."
4510                 . ./uselargefiles.cbu
4511                 echo " "
4512                 echo "Rechecking to see how big your file offsets are..." >&4
4513                 $cat >try.c <<EOCP
4514 #include <sys/types.h>
4515 #include <stdio.h>
4516 int main()
4517 {
4518     printf("%d\n", (int)sizeof($lseektype));
4519     return(0); 
4520 }
4521 EOCP
4522                 set try
4523                 if eval $compile_ok; then
4524                         lseeksize=`./try`
4525                         $echo "Your file offsets are now $lseeksize bytes long."
4526                 else
4527                         dflt="$lseeksize"
4528                         echo " "
4529                         echo "(I can't seem to compile the test program.  Guessing...)"
4530                         rp="What is the size of your file offsets (in bytes)?"
4531                         . ./myread
4532                         lseeksize="$ans"
4533                 fi
4534                 case "$fpostype" in
4535                 *_t) zzz="$fpostype"    ;;
4536                 *)   zzz="fpos_t"       ;;
4537                 esac
4538                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4539                 $cat > try.c <<EOCP
4540 #include <sys/types.h>
4541 #include <stdio.h>
4542 int main() {
4543     printf("%d\n", (int)sizeof($fpostype));
4544     exit(0);
4545 }
4546 EOCP
4547                 set try
4548                 if eval $compile_ok; then
4549                         yyy=`./try`
4550                         dflt="$lseeksize"
4551                         case "$yyy" in
4552                         '')     echo " "
4553                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4554                                 ;;
4555                         *)      fpossize=$yyy
4556                                 echo " $fpossize bytes." >&4
4557                                 ;;
4558                         esac
4559                 else
4560                         dflt="$fpossize"
4561                         echo " "
4562                         echo "(I can't compile the test program.  Guessing...)" >&4
4563                         rp="What is the size of your file positions (in bytes)?"
4564                         . ./myread
4565                         fpossize="$ans"
4566                 fi
4567                 $rm -f try.c try
4568         fi
4569         ;;
4570 esac
4571
4572
4573 case "$usemorebits" in
4574 "$define"|true|[yY]*)
4575         use64bitint="$define"
4576         uselongdouble="$define"
4577         usemorebits="$define"
4578         ;;
4579 *)      usemorebits="$undef"
4580         ;;
4581 esac
4582
4583
4584 case "$uselonglong" in
4585 "$define"|true|[yY]*)
4586         cat <<EOM >&4
4587
4588 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4589 EOM
4590         use64bitint="$define"
4591         ;;
4592 esac                          
4593 case "$use64bits" in
4594 "$define"|true|[yY]*)
4595         cat <<EOM >&4
4596
4597 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4598 EOM
4599         use64bitint="$define"
4600         ;;
4601 esac                          
4602 case "$use64bitints" in
4603 "$define"|true|[yY]*)
4604         cat <<EOM >&4
4605
4606 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4607 EOM
4608         use64bitint="$define"
4609         ;;
4610 esac                          
4611 case "$use64bitsint" in
4612 "$define"|true|[yY]*)
4613         cat <<EOM >&4
4614
4615 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4616 EOM
4617         use64bitint="$define"
4618         ;;
4619 esac                          
4620 case "$uselonglongs" in
4621 "$define"|true|[yY]*)
4622         cat <<EOM >&4
4623
4624 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4625 EOM
4626         use64bitint="$define"
4627         ;;
4628 esac                          
4629 case "$use64bitsall" in
4630 "$define"|true|[yY]*)
4631         cat <<EOM >&4
4632
4633 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4634 EOM
4635         use64bitall="$define"
4636         ;;
4637 esac                          
4638
4639 case "$ccflags" in
4640 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4641 esac
4642 case "$use64bitall" in
4643 "$define"|true|[yY]*) use64bitint="$define" ;;
4644 esac
4645
4646 case "$longsize" in
4647 8) cat <<EOM
4648
4649 You have natively 64-bit long integers.
4650 EOM
4651    val="$define"
4652    ;;
4653 *) case "$use64bitint" in
4654    "$define"|true|[yY]*) dflt='y';;
4655    *) dflt='n';;
4656    esac
4657    cat <<EOM
4658
4659 Perl can be built to take advantage of 64-bit integer types
4660 on some systems.  To do so, Configure can be run with -Duse64bitint.
4661 Choosing this option will most probably introduce binary incompatibilities.
4662
4663 If this doesn't make any sense to you, just accept the default '$dflt'.
4664 EOM
4665    rp='Try to use 64-bit integers, if available?'
4666    . ./myread
4667    case "$ans" in
4668    [yY]*) val="$define" ;;
4669    *)     val="$undef"  ;;
4670    esac
4671    ;;
4672 esac
4673 set use64bitint
4674 eval $setvar
4675
4676 case "$use64bitall" in
4677 "$define"|true|[yY]*) dflt='y' ;;
4678 *) case "$longsize" in
4679    8) dflt='y' ;;
4680    *) dflt='n' ;;
4681    esac
4682    ;;
4683 esac    
4684 cat <<EOM
4685
4686 You may also choose to try maximal 64-bitness.  It means using as much
4687 64-bitness as possible on the platform.  This in turn means even more
4688 binary incompatibilities.  On the other hand, your platform may not
4689 have any more 64-bitness available than what you already have chosen.
4690
4691 If this doesn't make any sense to you, just accept the default '$dflt'.
4692 EOM
4693 rp='Try to use maximal 64-bit support, if available?'
4694 . ./myread
4695 case "$ans" in
4696 [yY]*) val="$define" ;;
4697 *)     val="$undef"  ;;
4698 esac
4699 set use64bitall
4700 eval $setvar
4701 case "$use64bitall" in
4702 "$define")
4703         case "$use64bitint" in
4704         "$undef")
4705                 cat <<EOM
4706
4707 Since you have chosen a maximally 64-bit build, I'm also turning on
4708 the use of 64-bit integers.
4709 EOM
4710                 use64bitint="$define" ;;
4711         esac
4712         ;;
4713 esac
4714
4715 case "$use64bitint" in
4716 "$define"|true|[yY]*)
4717 : Look for a hint-file generated 'call-back-unit'.  If the
4718 : user has specified that a 64-bit perl is to be built,
4719 : we may need to set or change some other defaults.
4720         if $test -f use64bitint.cbu; then
4721                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4722                 . ./use64bitint.cbu
4723         fi
4724         case "$longsize" in
4725         4) case "$archname64" in
4726            '') archname64=64int ;;
4727            esac
4728            ;;
4729         esac
4730         ;;
4731 esac
4732
4733 case "$use64bitall" in
4734 "$define"|true|[yY]*)
4735 : Look for a hint-file generated 'call-back-unit'.  If the
4736 : user has specified that a maximally 64-bit perl is to be built,
4737 : we may need to set or change some other defaults.
4738         if $test -f use64bitall.cbu; then
4739                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4740                 . ./use64bitall.cbu
4741         fi
4742         case "$longsize" in
4743         4) case "$archname64" in
4744            ''|64int) archname64=64all ;;
4745            esac
4746            ;;
4747         esac
4748         ;;
4749 esac
4750
4751 : determine the architecture name
4752 echo " "
4753 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4754         tarch=`arch`"-$osname"
4755 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4756         if uname -m > tmparch 2>&1 ; then
4757                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4758                         -e 's/$/'"-$osname/" tmparch`
4759         else
4760                 tarch="$osname"
4761         fi
4762         $rm -f tmparch
4763 else
4764         tarch="$osname"
4765 fi
4766 case "$myarchname" in
4767 ''|"$tarch") ;;
4768 *)
4769         echo "(Your architecture name used to be $myarchname.)"
4770         archname=''
4771         ;;
4772 esac
4773 myarchname="$tarch"
4774 case "$archname" in
4775 '') dflt="$tarch";;
4776 *) dflt="$archname";;
4777 esac
4778 rp='What is your architecture name'
4779 . ./myread
4780 archname="$ans"
4781 case "$usethreads" in
4782 $define)
4783         echo "Threads selected." >&4
4784         case "$archname" in
4785         *-thread*) echo "...and architecture name already has -thread." >&4
4786                 ;;
4787         *)      archname="$archname-thread"
4788                 echo "...setting architecture name to $archname." >&4
4789                 ;;
4790         esac
4791         ;;
4792 esac
4793 case "$usemultiplicity" in
4794 $define)
4795         echo "Multiplicity selected." >&4
4796         case "$archname" in
4797         *-multi*) echo "...and architecture name already has -multi." >&4
4798                 ;;
4799         *)      archname="$archname-multi"
4800                 echo "...setting architecture name to $archname." >&4
4801                 ;;
4802         esac
4803         ;;
4804 esac
4805 case "$use64bitint" in
4806 $define)
4807         case "$archname64" in
4808         '')
4809                 ;;
4810         *)
4811                 case "$archname" in
4812                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4813                         ;;
4814                 *)      archname="$archname-$archname64"
4815                         echo "...setting architecture name to $archname." >&4
4816                         ;;
4817                 esac
4818                 ;;
4819         esac
4820 esac
4821
4822 : determine root of directory hierarchy where package will be installed.
4823 case "$prefix" in
4824 '')
4825         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4826         ;;
4827 *)
4828         dflt="$prefix"
4829         ;;
4830 esac
4831 $cat <<EOM
4832
4833 By default, $package will be installed in $dflt/bin, manual pages
4834 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4835 installation directories. Typically this is something like /usr/local.
4836 If you wish to have binaries under /usr/bin but other parts of the
4837 installation under /usr/local, that's ok: you will be prompted
4838 separately for each of the installation directories, the prefix being
4839 only used to set the defaults.
4840
4841 EOM
4842 fn=d~
4843 rp='Installation prefix to use?'
4844 . ./getfile
4845 oldprefix=''
4846 case "$prefix" in
4847 '') ;;
4848 *)
4849         case "$ans" in
4850         "$prefix") ;;
4851         *) oldprefix="$prefix";;
4852         esac
4853         ;;
4854 esac
4855 prefix="$ans"
4856 prefixexp="$ansexp"
4857
4858 : is AFS running?
4859 echo " "
4860 case "$afs" in
4861 $define|true)   afs=true ;;
4862 $undef|false)   afs=false ;;
4863 *)      if test -d /afs; then
4864                 afs=true
4865         else
4866                 afs=false
4867         fi
4868         ;;
4869 esac
4870 if $afs; then
4871         echo "AFS may be running... I'll be extra cautious then..." >&4
4872 else
4873         echo "AFS does not seem to be running..." >&4
4874 fi
4875
4876 : determine installation prefix for where package is to be installed.
4877 if $afs; then 
4878 $cat <<EOM
4879
4880 Since you are running AFS, I need to distinguish the directory in which
4881 files will reside from the directory in which they are installed (and from
4882 which they are presumably copied to the former directory by occult means).
4883
4884 EOM
4885         case "$installprefix" in
4886         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4887         *) dflt="$installprefix";;
4888         esac
4889 else
4890 $cat <<EOM
4891
4892 In some special cases, particularly when building $package for distribution,
4893 it is convenient to distinguish between the directory in which files should 
4894 be installed from the directory ($prefix) in which they 
4895 will eventually reside.  For most users, these two directories are the same.
4896
4897 EOM
4898         case "$installprefix" in
4899         '') dflt=$prefix ;;
4900         *) dflt=$installprefix;;
4901         esac
4902 fi
4903 fn=d~
4904 rp='What installation prefix should I use for installing files?'
4905 . ./getfile
4906 installprefix="$ans"
4907 installprefixexp="$ansexp"
4908
4909 : set the prefixit variable, to compute a suitable default value
4910 prefixit='case "$3" in
4911 ""|none)
4912         case "$oldprefix" in
4913         "") eval "$1=\"\$$2\"";;
4914         *)
4915                 case "$3" in
4916                 "") eval "$1=";;
4917                 none)
4918                         eval "tp=\"\$$2\"";
4919                         case "$tp" in
4920                         ""|" ") eval "$1=\"\$$2\"";;
4921                         *) eval "$1=";;
4922                         esac;;
4923                 esac;;
4924         esac;;
4925 *)
4926         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4927         case "$tp" in
4928         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4929         /*-$oldprefix/*|\~*-$oldprefix/*)
4930                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4931         *) eval "$1=\"\$$2\"";;
4932         esac;;
4933 esac'
4934
4935
4936 : get the patchlevel
4937 echo " "
4938 echo "Getting the current patchlevel..." >&4
4939 if $test -r $rsrc/patchlevel.h;then
4940         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4941         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4942         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4943         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4944         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4945         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4946 else
4947         revision=0
4948         patchlevel=0
4949         subversion=0
4950         api_revision=0
4951         api_version=0
4952         api_subversion=0
4953 fi
4954 $echo $n "(You have $package revision $revision" $c
4955 $echo $n " patchlevel $patchlevel" $c
4956 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4957 echo ".)"
4958 case "$osname" in
4959 dos|vms)
4960         : XXX Should be a Configure test for double-dots in filenames.
4961         version=`echo $revision $patchlevel $subversion | \
4962                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4963         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4964                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4965         ;;
4966 *)
4967         version=`echo $revision $patchlevel $subversion | \
4968                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4969         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4970                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4971         ;;
4972 esac
4973 : Special case the 5.005_xx maintenance series, which used 5.005
4974 : without any subversion label as a subdirectory in $sitelib
4975 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4976         api_versionstring='5.005'
4977 fi
4978
4979 : determine installation style
4980 : For now, try to deduce it from prefix unless it is already set.
4981 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4982 case "$installstyle" in
4983 '')     case "$prefix" in
4984                 *perl*) dflt='lib';;
4985                 *) dflt='lib/perl5' ;;
4986         esac
4987         ;;
4988 *)      dflt="$installstyle" ;;
4989 esac
4990 : Probably not worth prompting for this since we prompt for all
4991 : the directories individually, and the prompt would be too long and
4992 : confusing anyway.
4993 installstyle=$dflt
4994
4995 : determine where private library files go
4996 : Usual default is /usr/local/lib/perl5/$version.
4997 : Also allow things like /opt/perl/lib/$version, since 
4998 : /opt/perl/lib/perl5... would be redundant.
4999 : The default "style" setting is made in installstyle.U
5000 case "$installstyle" in
5001 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5002 *)       set dflt privlib lib/$version ;;
5003 esac
5004 eval $prefixit
5005 $cat <<EOM
5006
5007 There are some auxiliary files for $package that need to be put into a
5008 private library directory that is accessible by everyone.
5009
5010 EOM
5011 fn=d~+
5012 rp='Pathname where the private library files will reside?'
5013 . ./getfile
5014 privlib="$ans"
5015 privlibexp="$ansexp"
5016 : Change installation prefix, if necessary.
5017 if $test X"$prefix" != X"$installprefix"; then
5018         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5019 else
5020         installprivlib="$privlibexp"
5021 fi
5022
5023 : set the prefixup variable, to restore leading tilda escape
5024 prefixup='case "$prefixexp" in
5025 "$prefix") ;;
5026 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5027 esac'
5028
5029 : determine where public architecture dependent libraries go
5030 set archlib archlib
5031 eval $prefixit
5032 : privlib default is /usr/local/lib/$package/$version
5033 : archlib default is /usr/local/lib/$package/$version/$archname
5034 : privlib may have an optional trailing /share.
5035 tdflt=`echo $privlib | $sed 's,/share$,,'`
5036 tdflt=$tdflt/$archname
5037 case "$archlib" in
5038 '')     dflt=$tdflt
5039         ;;
5040 *)      dflt="$archlib"
5041     ;;
5042 esac
5043 $cat <<EOM
5044
5045 $spackage contains architecture-dependent library files.  If you are
5046 sharing libraries in a heterogeneous environment, you might store
5047 these files in a separate location.  Otherwise, you can just include
5048 them with the rest of the public library files.
5049
5050 EOM
5051 fn=d+~
5052 rp='Where do you want to put the public architecture-dependent libraries?'
5053 . ./getfile
5054 archlib="$ans"
5055 archlibexp="$ansexp"
5056 if $test X"$archlib" = X"$privlib"; then
5057         d_archlib="$undef"
5058 else
5059         d_archlib="$define"
5060 fi
5061 : Change installation prefix, if necessary.
5062 if $test X"$prefix" != X"$installprefix"; then
5063         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5064 else
5065         installarchlib="$archlibexp"
5066 fi
5067
5068
5069 : Binary compatibility with 5.005 is not possible for builds
5070 : with advanced features
5071 case "$usethreads$usemultiplicity" in
5072 *define*)
5073         bincompat5005="$undef"
5074         d_bincompat5005="$undef"
5075         ;;
5076 *)      $cat <<EOM
5077
5078 This version of Perl can be compiled for binary compatibility with 5.005.
5079 If you decide to do so, you will be able to continue using most of the
5080 extensions that were compiled for Perl 5.005.
5081
5082 EOM
5083         case "$bincompat5005$d_bincompat5005" in
5084         *"$undef"*) dflt=n ;;
5085         *) dflt=y ;;
5086         esac
5087         rp='Binary compatibility with Perl 5.005?'
5088         . ./myread
5089         case "$ans" in
5090         y*) val="$define" ;;
5091         *)  val="$undef" ;;
5092         esac
5093         set d_bincompat5005
5094         eval $setvar
5095         case "$d_bincompat5005" in
5096         "$define")
5097                 bincompat5005="$define"
5098                 ;;
5099         *)      bincompat5005="$undef"
5100                 d_bincompat5005="$undef"
5101                 ;;
5102         esac
5103         ;;
5104 esac
5105
5106
5107 : see if setuid scripts can be secure
5108 $cat <<EOM
5109
5110 Some kernels have a bug that prevents setuid #! scripts from being
5111 secure.  Some sites have disabled setuid #! scripts because of this.
5112
5113 First let's decide if your kernel supports secure setuid #! scripts.
5114 (If setuid #! scripts would be secure but have been disabled anyway,
5115 don't say that they are secure if asked.)
5116
5117 EOM
5118
5119 val="$undef"
5120 if $test -d /dev/fd; then
5121         echo "#!$ls" >reflect
5122         chmod +x,u+s reflect
5123         ./reflect >flect 2>&1
5124         if $contains "/dev/fd" flect >/dev/null; then
5125                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5126                 val="$define"
5127         else
5128                 $cat <<EOM
5129 If you are not sure if they are secure, I can check but I'll need a
5130 username and password different from the one you are using right now.
5131 If you don't have such a username or don't want me to test, simply
5132 enter 'none'.
5133
5134 EOM
5135                 rp='Other username to test security of setuid scripts with?'
5136                 dflt='none'
5137                 . ./myread
5138                 case "$ans" in
5139                 n|none)
5140                         case "$d_suidsafe" in
5141                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5142                                 dflt=n;;
5143                         "$undef")
5144                                 echo "Well, the $hint value is *not* secure." >&4
5145                                 dflt=n;;
5146                         *)      echo "Well, the $hint value *is* secure." >&4
5147                                 dflt=y;;
5148                         esac
5149                         ;;
5150                 *)
5151                         $rm -f reflect flect
5152                         echo "#!$ls" >reflect
5153                         chmod +x,u+s reflect
5154                         echo >flect
5155                         chmod a+w flect
5156                         echo '"su" will (probably) prompt you for '"$ans's password."
5157                         su $ans -c './reflect >flect'
5158                         if $contains "/dev/fd" flect >/dev/null; then
5159                                 echo "Okay, it looks like setuid scripts are secure." >&4
5160                                 dflt=y
5161                         else
5162                                 echo "I don't think setuid scripts are secure." >&4
5163                                 dflt=n
5164                         fi
5165                         ;;
5166                 esac
5167                 rp='Does your kernel have *secure* setuid scripts?'
5168                 . ./myread
5169                 case "$ans" in
5170                 [yY]*)  val="$define";;
5171                 *)      val="$undef";;
5172                 esac
5173         fi
5174 else
5175         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5176         echo "(That's for file descriptors, not floppy disks.)"
5177         val="$undef"
5178 fi
5179 set d_suidsafe
5180 eval $setvar
5181
5182 $rm -f reflect flect
5183
5184 : now see if they want to do setuid emulation
5185 echo " "
5186 val="$undef"
5187 case "$d_suidsafe" in
5188 "$define")
5189         val="$undef"
5190         echo "No need to emulate SUID scripts since they are secure here." >& 4
5191         ;;
5192 *)
5193         $cat <<EOM
5194 Some systems have disabled setuid scripts, especially systems where
5195 setuid scripts cannot be secure.  On systems where setuid scripts have
5196 been disabled, the setuid/setgid bits on scripts are currently
5197 useless.  It is possible for $package to detect those bits and emulate
5198 setuid/setgid in a secure fashion.  This emulation will only work if
5199 setuid scripts have been disabled in your kernel.
5200
5201 EOM
5202         case "$d_dosuid" in
5203         "$define") dflt=y ;;
5204         *) dflt=n ;;
5205         esac
5206         rp="Do you want to do setuid/setgid emulation?"
5207         . ./myread
5208         case "$ans" in
5209         [yY]*)  val="$define";;
5210         *)      val="$undef";;
5211         esac
5212         ;;
5213 esac
5214 set d_dosuid
5215 eval $setvar
5216
5217 : determine filename position in cpp output
5218 echo " "
5219 echo "Computing filename position in cpp output for #include directives..." >&4
5220 echo '#include <stdio.h>' > foo.c
5221 $cat >fieldn <<EOF
5222 $startsh
5223 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5224 $grep '^[       ]*#.*stdio\.h' | \
5225 while read cline; do
5226         pos=1
5227         set \$cline
5228         while $test \$# -gt 0; do
5229                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5230                         echo "\$pos"
5231                         exit 0
5232                 fi
5233                 shift
5234                 pos=\`expr \$pos + 1\`
5235         done
5236 done
5237 EOF
5238 chmod +x fieldn
5239 fieldn=`./fieldn`
5240 $rm -f foo.c fieldn
5241 case $fieldn in
5242 '') pos='???';;
5243 1) pos=first;;
5244 2) pos=second;;
5245 3) pos=third;;
5246 *) pos="${fieldn}th";;
5247 esac
5248 echo "Your cpp writes the filename in the $pos field of the line."
5249
5250 : locate header file
5251 $cat >findhdr <<EOF
5252 $startsh
5253 wanted=\$1
5254 name=''
5255 for usrincdir in $usrinc
5256 do
5257         if test -f \$usrincdir/\$wanted; then
5258                 echo "\$usrincdir/\$wanted"
5259                 exit 0
5260         fi
5261 done
5262 awkprg='{ print \$$fieldn }'
5263 echo "#include <\$wanted>" > foo\$\$.c
5264 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5265 $grep "^[       ]*#.*\$wanted" | \
5266 while read cline; do
5267         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5268         case "\$name" in
5269         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5270         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5271         *) exit 2;;
5272         esac;
5273 done;
5274 #
5275 # status = 0: grep returned 0 lines, case statement not executed
5276 # status = 1: headerfile found
5277 # status = 2: while loop executed, no headerfile found
5278 #
5279 status=\$?
5280 $rm -f foo\$\$.c;
5281 if test \$status -eq 1; then
5282         exit 0;
5283 fi
5284 exit 1
5285 EOF
5286 chmod +x findhdr
5287
5288 : define an alternate in-header-list? function
5289 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5290 cont=true; xxf="echo \"<\$1> found.\" >&4";
5291 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5292 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5293 esac;
5294 case $# in 4) instead=instead;; *) instead="at last";; esac;
5295 while $test "$cont"; do
5296         xxx=`./findhdr $1`
5297         var=$2; eval "was=\$$2";
5298         if $test "$xxx" && $test -r "$xxx";
5299         then eval $xxf;
5300         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5301                 cont="";
5302         else eval $xxnf;
5303         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5304         set $yyy; shift; shift; yyy=$@;
5305         case $# in 0) cont="";;
5306         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5307                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5308         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5309                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5310         esac;
5311 done;
5312 while $test "$yyy";
5313 do set $yyy; var=$2; eval "was=\$$2";
5314         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5315         set $yyy; shift; shift; yyy=$@;
5316 done'
5317
5318 : see if this is a malloc.h system
5319 set malloc.h i_malloc
5320 eval $inhdr
5321
5322 : see if stdlib is available
5323 set stdlib.h i_stdlib
5324 eval $inhdr
5325
5326 : determine which malloc to compile in
5327 echo " "
5328 case "$usemymalloc" in
5329 ''|[yY]*|true|$define)  dflt='y' ;;
5330 *)      dflt='n' ;;
5331 esac
5332 rp="Do you wish to attempt to use the malloc that comes with $package?"
5333 . ./myread
5334 usemymalloc="$ans"
5335 case "$ans" in
5336 y*|true)
5337         usemymalloc='y'
5338         mallocsrc='malloc.c'
5339         mallocobj="malloc$_o"
5340         d_mymalloc="$define"
5341         case "$libs" in
5342         *-lmalloc*)
5343                 : Remove malloc from list of libraries to use
5344                 echo "Removing unneeded -lmalloc from library list" >&4
5345                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5346                 shift
5347                 libs="$*"
5348                 echo "libs = $libs" >&4
5349                 ;;
5350         esac
5351         ;;
5352 *)
5353         usemymalloc='n'
5354         mallocsrc=''
5355         mallocobj=''
5356         d_mymalloc="$undef"
5357         ;;
5358 esac
5359
5360 : compute the return types of malloc and free
5361 echo " "
5362 $cat >malloc.c <<END
5363 #$i_malloc I_MALLOC
5364 #$i_stdlib I_STDLIB
5365 #include <stdio.h>
5366 #include <sys/types.h>
5367 #ifdef I_MALLOC
5368 #include <malloc.h>
5369 #endif
5370 #ifdef I_STDLIB
5371 #include <stdlib.h>
5372 #endif
5373 #ifdef TRY_MALLOC
5374 void *malloc();
5375 #endif
5376 #ifdef TRY_FREE
5377 void free();
5378 #endif
5379 END
5380 case "$malloctype" in
5381 '')
5382         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5383                 malloctype='void *'
5384         else
5385                 malloctype='char *'
5386         fi
5387         ;;
5388 esac
5389 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5390
5391 case "$freetype" in
5392 '')
5393         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5394                 freetype='void'
5395         else
5396                 freetype='int'
5397         fi
5398         ;;
5399 esac
5400 echo "Your system uses $freetype free(), it would seem." >&4
5401 $rm -f malloc.[co]
5402 $cat <<EOM
5403
5404 After $package is installed, you may wish to install various
5405 add-on modules and utilities.  Typically, these add-ons will
5406 be installed under $prefix with the rest
5407 of this package.  However, you may wish to install such add-ons
5408 elsewhere under a different prefix.
5409
5410 If you do not wish to put everything under a single prefix, that's
5411 ok.  You will be prompted for the individual locations; this siteprefix
5412 is only used to suggest the defaults.
5413
5414 The default should be fine for most people.
5415
5416 EOM
5417 fn=d~+
5418 rp='Installation prefix to use for add-on modules and utilities?'
5419 : XXX Here might be another good place for an installstyle setting.
5420 case "$siteprefix" in
5421 '') dflt=$prefix ;;
5422 *)  dflt=$siteprefix ;;
5423 esac
5424 . ./getfile
5425 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5426 oldsiteprefix=''
5427 case "$siteprefix" in
5428 '') ;;
5429 *)      case "$ans" in
5430         "$prefix") ;;
5431         *) oldsiteprefix="$prefix";;
5432         esac
5433         ;;
5434 esac
5435 siteprefix="$ans"
5436 siteprefixexp="$ansexp"
5437
5438 : determine where site specific libraries go.
5439 : Usual default is /usr/local/lib/perl5/site_perl/$version
5440 : The default "style" setting is made in installstyle.U
5441 : XXX No longer works with Prefixit stuff.
5442 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5443 case "$sitelib" in
5444 '') case "$installstyle" in
5445         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5446         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5447         esac
5448         ;;
5449 *)      dflt="$sitelib"
5450         ;;
5451 esac
5452 $cat <<EOM
5453
5454 The installation process will create a directory for
5455 site-specific extensions and modules.  Most users find it convenient
5456 to place all site-specific files in this directory rather than in the
5457 main distribution directory.
5458
5459 EOM
5460 fn=d~+
5461 rp='Pathname for the site-specific library files?'
5462 . ./getfile
5463 sitelib="$ans"
5464 sitelibexp="$ansexp"
5465 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5466 : Change installation prefix, if necessary.
5467 if $test X"$prefix" != X"$installprefix"; then
5468         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5469 else
5470         installsitelib="$sitelibexp"
5471 fi
5472
5473 : determine where site specific architecture-dependent libraries go.
5474 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5475 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5476 : sitelib may have an optional trailing /share.
5477 case "$sitearch" in
5478 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5479         dflt="$dflt/$archname"
5480         ;;
5481 *)      dflt="$sitearch"
5482         ;;
5483 esac
5484 set sitearch sitearch none
5485 eval $prefixit
5486 $cat <<EOM
5487
5488 The installation process will also create a directory for
5489 architecture-dependent site-specific extensions and modules.
5490
5491 EOM
5492 fn=d~+
5493 rp='Pathname for the site-specific architecture-dependent library files?'
5494 . ./getfile
5495 sitearch="$ans"
5496 sitearchexp="$ansexp"
5497 : Change installation prefix, if necessary.
5498 if $test X"$prefix" != X"$installprefix"; then
5499         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5500 else
5501         installsitearch="$sitearchexp"
5502 fi
5503
5504 $cat <<EOM
5505
5506 The installation process will also create a directory for
5507 vendor-supplied add-ons.  Vendors who supply perl with their system
5508 may find it convenient to place all vendor-supplied files in this
5509 directory rather than in the main distribution directory.  This will
5510 ease upgrades between binary-compatible maintenance versions of perl.
5511
5512 Of course you may also use these directories in whatever way you see
5513 fit.  For example, you might use them to access modules shared over a
5514 company-wide network.
5515
5516 The default answer should be fine for most people.
5517 This causes further questions about vendor add-ons to be skipped
5518 and no vendor-specific directories will be configured for perl.
5519
5520 EOM
5521 rp='Do you want to configure vendor-specific add-on directories?'
5522 case "$usevendorprefix" in
5523 define|true|[yY]*) dflt=y ;;
5524 *)      : User may have set vendorprefix directly on Configure command line.
5525         case "$vendorprefix" in
5526         ''|' ') dflt=n ;;
5527         *)      dflt=y ;;
5528         esac
5529         ;;
5530 esac
5531 . ./myread
5532 case "$ans" in
5533 [yY]*)  fn=d~+
5534         rp='Installation prefix to use for vendor-supplied add-ons?'
5535         case "$vendorprefix" in
5536         '') dflt='' ;;
5537         *)  dflt=$vendorprefix ;;
5538         esac
5539         . ./getfile
5540         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5541         oldvendorprefix=''
5542         case "$vendorprefix" in
5543         '') ;;
5544         *)      case "$ans" in
5545                 "$prefix") ;;
5546                 *) oldvendorprefix="$prefix";;
5547                 esac
5548                 ;;
5549         esac
5550         usevendorprefix="$define"
5551         vendorprefix="$ans"
5552         vendorprefixexp="$ansexp"
5553         ;;
5554 *)      usevendorprefix="$undef"
5555         vendorprefix=''
5556         vendorprefixexp=''
5557         ;;
5558 esac
5559
5560 case "$vendorprefix" in
5561 '')     d_vendorlib="$undef"
5562         vendorlib=''
5563         vendorlibexp=''
5564         ;;
5565 *)      d_vendorlib="$define"
5566         : determine where vendor-supplied modules go.
5567         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5568         case "$vendorlib" in
5569         '')
5570                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5571                 case "$installstyle" in
5572                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5573                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5574                 esac
5575                 ;;
5576         *)      dflt="$vendorlib"
5577                 ;;
5578         esac
5579         fn=d~+
5580         rp='Pathname for the vendor-supplied library files?'
5581         . ./getfile
5582         vendorlib="$ans"
5583         vendorlibexp="$ansexp"
5584         ;;
5585 esac
5586 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5587 : Change installation prefix, if necessary.
5588 if $test X"$prefix" != X"$installprefix"; then
5589         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5590 else
5591         installvendorlib="$vendorlibexp"
5592 fi
5593
5594 case "$vendorprefix" in
5595 '')     d_vendorarch="$undef"
5596         vendorarch=''
5597         vendorarchexp=''
5598         ;;
5599 *)      d_vendorarch="$define"
5600         : determine where vendor-supplied architecture-dependent libraries go.
5601         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5602         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5603         : vendorlib may have an optional trailing /share.
5604         case "$vendorarch" in
5605         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5606                 dflt="$dflt/$archname"
5607                 ;;
5608         *)      dflt="$vendorarch" ;;
5609         esac
5610         fn=d~+
5611         rp='Pathname for vendor-supplied architecture-dependent files?'
5612         . ./getfile
5613         vendorarch="$ans"
5614         vendorarchexp="$ansexp"
5615         ;;
5616 esac
5617 : Change installation prefix, if necessary.
5618 if $test X"$prefix" != X"$installprefix"; then
5619         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5620 else
5621         installvendorarch="$vendorarchexp"
5622 fi
5623
5624 : Final catch-all directories to search
5625 $cat <<EOM
5626
5627 Lastly, you can have perl look in other directories for extensions and
5628 modules in addition to those already specified.
5629 These directories will be searched after 
5630         $sitearch 
5631         $sitelib 
5632 EOM
5633 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5634 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5635 echo ' '
5636 case "$otherlibdirs" in
5637 ''|' ') dflt='none' ;;
5638 *)      dflt="$otherlibdirs" ;;
5639 esac
5640 $cat <<EOM
5641 Enter a colon-separated set of extra paths to include in perl's @INC
5642 search path, or enter 'none' for no extra paths.
5643
5644 EOM
5645
5646 rp='Colon-separated list of additional directories for perl to search?'
5647 . ./myread
5648 case "$ans" in
5649 ' '|''|none)    otherlibdirs=' ' ;;     
5650 *)      otherlibdirs="$ans" ;;
5651 esac
5652 case "$otherlibdirs" in
5653 ' ') val=$undef ;;
5654 *)      val=$define ;;
5655 esac
5656 set d_perl_otherlibdirs
5657 eval $setvar
5658
5659 : Cruising for prototypes
5660 echo " "
5661 echo "Checking out function prototypes..." >&4
5662 $cat >prototype.c <<'EOCP'
5663 int main(int argc, char *argv[]) {
5664         exit(0);}
5665 EOCP
5666 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5667         echo "Your C compiler appears to support function prototypes."
5668         val="$define"
5669 else
5670         echo "Your C compiler doesn't seem to understand function prototypes."
5671         val="$undef"
5672 fi
5673 set prototype
5674 eval $setvar
5675 $rm -f prototype*
5676
5677 case "$prototype" in
5678 "$define") ;;
5679 *)      ansi2knr='ansi2knr'
5680         echo " "
5681         cat <<EOM >&4
5682
5683 $me:  FATAL ERROR:
5684 This version of $package can only be compiled by a compiler that 
5685 understands function prototypes.  Unfortunately, your C compiler 
5686         $cc $ccflags
5687 doesn't seem to understand them.  Sorry about that.
5688
5689 If GNU cc is available for your system, perhaps you could try that instead.  
5690
5691 Eventually, we hope to support building Perl with pre-ANSI compilers.
5692 If you would like to help in that effort, please contact <perlbug@perl.org>.
5693
5694 Aborting Configure now.
5695 EOM
5696         exit 2
5697         ;;
5698 esac
5699
5700 : determine where public executables go
5701 echo " "
5702 set dflt bin bin
5703 eval $prefixit
5704 fn=d~
5705 rp='Pathname where the public executables will reside?'
5706 . ./getfile
5707 if $test "X$ansexp" != "X$binexp"; then
5708         installbin=''
5709 fi
5710 bin="$ans"
5711 binexp="$ansexp"
5712 : Change installation prefix, if necessary.
5713 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5714 if $test X"$prefix" != X"$installprefix"; then
5715         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5716 else
5717         installbin="$binexp"
5718 fi
5719
5720 : Find perl5.005 or later.
5721 echo "Looking for a previously installed perl5.005 or later... "
5722 case "$perl5" in
5723 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5724                 : Check if this perl is recent and can load a simple module
5725                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5726                         perl5=$tdir/perl
5727                         break;
5728                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5729                         perl5=$tdir/perl
5730                         break;
5731                 fi
5732         done
5733         ;;
5734 *)      perl5="$perl5"
5735         ;;
5736 esac
5737 case "$perl5" in
5738 '')     echo "None found.  That's ok.";;
5739 *)      echo "Using $perl5." ;;
5740 esac
5741
5742 : Determine list of previous versions to include in @INC
5743 $cat > getverlist <<EOPL
5744 #!$perl5 -w
5745 use File::Basename;
5746 \$api_versionstring = "$api_versionstring";
5747 \$version = "$version";
5748 \$stem = "$sitelib_stem";
5749 \$archname = "$archname";
5750 EOPL
5751         $cat >> getverlist <<'EOPL'
5752 # Can't have leading @ because metaconfig interprets it as a command!
5753 ;@inc_version_list=();
5754 # XXX Redo to do opendir/readdir? 
5755 if (-d $stem) {
5756     chdir($stem);
5757     ;@candidates = glob("5.*");
5758 }
5759 else {
5760     ;@candidates = ();
5761 }
5762
5763 # XXX ToDo:  These comparisons must be reworked when two-digit
5764 # subversions come along, so that 5.7.10 compares as greater than
5765 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5766 # widespread that we can use the built-in version vectors rather
5767 # than reinventing them here.  For 5.6.0, however, we must
5768 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5769 foreach $d (@candidates) {
5770     if ($d lt $version) {
5771         if ($d ge $api_versionstring) {
5772             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5773         }
5774         elsif ($d ge "5.005") {
5775             unshift(@inc_version_list, grep { -d } $d);
5776         }
5777     }
5778     else {
5779         # Skip newer version.  I.e. don't look in
5780         # 5.7.0 if we're installing 5.6.1.
5781     }
5782 }
5783
5784 if (@inc_version_list) {
5785     print join(' ', @inc_version_list);
5786 }
5787 else {
5788     # Blank space to preserve value for next Configure run.
5789     print " ";
5790 }
5791 EOPL
5792 chmod +x getverlist
5793 case "$inc_version_list" in
5794 '')     if test -x "$perl5"; then
5795                 dflt=`$perl5 getverlist`
5796         else
5797                 dflt='none'
5798         fi
5799         ;;
5800 $undef) dflt='none' ;;
5801 *)  dflt="$inc_version_list" ;;
5802 esac
5803 case "$dflt" in
5804 ''|' ') dflt=none ;;
5805 esac
5806 $cat <<'EOM'
5807
5808 In order to ease the process of upgrading, this version of perl 
5809 can be configured to use modules built and installed with earlier 
5810 versions of perl that were installed under $prefix.  Specify here
5811 the list of earlier versions that this version of perl should check.
5812 If Configure detected no earlier versions of perl installed under
5813 $prefix, then the list will be empty.  Answer 'none' to tell perl
5814 to not search earlier versions.
5815
5816 The default should almost always be sensible, so if you're not sure,
5817 just accept the default.
5818 EOM
5819
5820 rp='List of earlier versions to include in @INC?'
5821 . ./myread
5822 case "$ans" in
5823 [Nn]one|''|' ') inc_version_list=' ' ;;
5824 *) inc_version_list="$ans" ;;
5825 esac
5826 case "$inc_version_list" in
5827 ''|' ') 
5828         inc_version_list_init='0';;
5829 *)      inc_version_list_init=`echo $inc_version_list |
5830                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5831         ;;
5832 esac
5833 $rm -f getverlist
5834
5835 : determine whether to install perl also as /usr/bin/perl
5836
5837 echo " "
5838 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5839         $cat <<EOM
5840 Many scripts expect perl to be installed as /usr/bin/perl.
5841 I can install the perl you are about to compile also as /usr/bin/perl
5842 (in addition to $installbin/perl).
5843 EOM
5844         case "$installusrbinperl" in
5845         "$undef"|[nN]*) dflt='n';;
5846         *)              dflt='y';;
5847         esac
5848         rp="Do you want to install perl as /usr/bin/perl?"
5849         . ./myread
5850         case "$ans" in
5851         [yY]*)  val="$define";;
5852         *)      val="$undef" ;;
5853         esac
5854 else
5855         val="$undef"
5856 fi
5857 set installusrbinperl
5858 eval $setvar
5859
5860 echo " "
5861 echo "Checking for GNU C Library..." >&4
5862 cat >gnulibc.c <<EOM
5863 #include <stdio.h>
5864 int main()
5865 {
5866 #ifdef __GLIBC__
5867     exit(0);
5868 #else
5869     exit(1);
5870 #endif
5871 }
5872 EOM
5873 set gnulibc
5874 if eval $compile_ok && ./gnulibc; then
5875         val="$define"
5876         echo "You are using the GNU C Library"
5877 else
5878         val="$undef"
5879         echo "You are not using the GNU C Library"
5880 fi
5881 $rm -f gnulibc*
5882 set d_gnulibc
5883 eval $setvar
5884
5885 : see if nm is to be used to determine whether a symbol is defined or not
5886 case "$usenm" in
5887 '')
5888         dflt=''
5889         case "$d_gnulibc" in
5890         "$define")
5891                 echo " "
5892                 echo "nm probably won't work on the GNU C Library." >&4
5893                 dflt=n
5894                 ;;
5895         esac
5896         case "$dflt" in
5897         '') 
5898                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5899                         echo " "
5900                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5901                         echo "'nm' won't be sufficient on this sytem." >&4
5902                         dflt=n
5903                 fi
5904                 ;;
5905         esac
5906         case "$dflt" in
5907         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5908                 if $test $dflt -gt 20; then
5909                         dflt=y
5910                 else
5911                         dflt=n
5912                 fi
5913                 ;;
5914         esac
5915         ;;
5916 *)
5917         case "$usenm" in
5918         true|$define) dflt=y;;
5919         *) dflt=n;;
5920         esac
5921         ;;
5922 esac
5923 $cat <<EOM
5924
5925 I can use $nm to extract the symbols from your C libraries. This
5926 is a time consuming task which may generate huge output on the disk (up
5927 to 3 megabytes) but that should make the symbols extraction faster. The
5928 alternative is to skip the 'nm' extraction part and to compile a small
5929 test program instead to determine whether each symbol is present. If
5930 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5931 this may be the best solution.
5932
5933 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5934
5935 EOM
5936 rp="Shall I use $nm to extract C symbols from the libraries?"
5937 . ./myread
5938 case "$ans" in
5939 [Nn]*) usenm=false;;
5940 *) usenm=true;;
5941 esac
5942
5943 runnm=$usenm
5944 case "$reuseval" in
5945 true) runnm=false;;
5946 esac
5947
5948 : nm options which may be necessary
5949 case "$nm_opt" in
5950 '') if $test -f /mach_boot; then
5951                 nm_opt=''       # Mach
5952         elif $test -d /usr/ccs/lib; then
5953                 nm_opt='-p'     # Solaris (and SunOS?)
5954         elif $test -f /dgux; then
5955                 nm_opt='-p'     # DG-UX
5956         elif $test -f /lib64/rld; then
5957                 nm_opt='-p'     # 64-bit Irix
5958         else
5959                 nm_opt=''
5960         fi;;
5961 esac
5962
5963 : nm options which may be necessary for shared libraries but illegal
5964 : for archive libraries.  Thank you, Linux.
5965 case "$nm_so_opt" in
5966 '')     case "$myuname" in
5967         *linux*)
5968                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5969                         nm_so_opt='--dynamic'
5970                 fi
5971                 ;;
5972         esac
5973         ;;
5974 esac
5975
5976 case "$runnm" in
5977 true)
5978 : get list of predefined functions in a handy place
5979 echo " "
5980 case "$libc" in
5981 '') libc=unknown
5982         case "$libs" in
5983         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5984         esac
5985         ;;
5986 esac
5987 libnames='';
5988 case "$libs" in
5989 '') ;;
5990 *)  for thislib in $libs; do
5991         case "$thislib" in
5992         -lc|-lc_s)
5993                 : Handle C library specially below.
5994                 ;;
5995         -l*)
5996                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5997                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5998                         :
5999                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6000                         :
6001                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6002                         :
6003                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6004                         :
6005                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6006                         :
6007                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6008                         :
6009                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6010                         :
6011                 else
6012                         try=''
6013                 fi
6014                 libnames="$libnames $try"
6015                 ;;
6016         *) libnames="$libnames $thislib" ;;
6017         esac
6018         done
6019         ;;
6020 esac
6021 xxx=normal
6022 case "$libc" in
6023 unknown)
6024         set /lib/libc.$so
6025         for xxx in $libpth; do
6026                 $test -r $1 || set $xxx/libc.$so
6027                 : The messy sed command sorts on library version numbers.
6028                 $test -r $1 || \
6029                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6030                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6031                                 h
6032                                 s/[0-9][0-9]*/0000&/g
6033                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6034                                 G
6035                                 s/\n/ /' | \
6036                          sort | $sed -e 's/^.* //'`
6037                 eval set \$$#
6038         done
6039         $test -r $1 || set /usr/ccs/lib/libc.$so
6040         $test -r $1 || set /lib/libsys_s$_a
6041         ;;
6042 *)
6043         set blurfl
6044         ;;
6045 esac
6046 if $test -r "$1"; then
6047         echo "Your (shared) C library seems to be in $1."
6048         libc="$1"
6049 elif $test -r /lib/libc && $test -r /lib/clib; then
6050         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6051         xxx=apollo
6052         libc='/lib/clib /lib/libc'
6053         if $test -r /lib/syslib; then
6054                 echo "(Your math library is in /lib/syslib.)"
6055                 libc="$libc /lib/syslib"
6056         fi
6057 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6058         echo "Your C library seems to be in $libc, as you said before."
6059 elif $test -r $incpath/usr/lib/libc$_a; then
6060         libc=$incpath/usr/lib/libc$_a;
6061         echo "Your C library seems to be in $libc.  That's fine."
6062 elif $test -r /lib/libc$_a; then
6063         libc=/lib/libc$_a;
6064         echo "Your C library seems to be in $libc.  You're normal."
6065 else
6066         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6067                 :
6068         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6069                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6070         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6071                 :
6072         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6073                 :
6074         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6075                 :
6076         else
6077                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6078         fi
6079         if $test -r "$tans"; then
6080                 echo "Your C library seems to be in $tans, of all places."
6081                 libc=$tans
6082         else
6083                 libc='blurfl'
6084         fi
6085 fi
6086 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6087         dflt="$libc"
6088         cat <<EOM
6089
6090 If the guess above is wrong (which it might be if you're using a strange
6091 compiler, or your machine supports multiple models), you can override it here.
6092
6093 EOM
6094 else
6095         dflt=''
6096         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
6097         cat >&4 <<EOM
6098 I can't seem to find your C library.  I've looked in the following places:
6099
6100 EOM
6101         $sed 's/^/      /' libpath
6102         cat <<EOM
6103
6104 None of these seems to contain your C library. I need to get its name...
6105
6106 EOM
6107 fi
6108 fn=f
6109 rp='Where is your C library?'
6110 . ./getfile
6111 libc="$ans"
6112
6113 echo " "
6114 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
6115 set X `cat libnames`
6116 shift
6117 xxx=files
6118 case $# in 1) xxx=file; esac
6119 echo "Extracting names from the following $xxx for later perusal:" >&4
6120 echo " "
6121 $sed 's/^/      /' libnames >&4
6122 echo " "
6123 $echo $n "This may take a while...$c" >&4
6124
6125 for file in $*; do
6126         case $file in
6127         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6128         *) $nm $nm_opt $file 2>/dev/null;;
6129         esac
6130 done >libc.tmp
6131
6132 $echo $n ".$c"
6133 $grep fprintf libc.tmp > libc.ptf
6134 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6135 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
6136 xxx='[ADTSIW]'
6137 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
6138         eval $xscan;\
6139         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6140                 eval $xrun
6141 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6142         eval $xscan;\
6143         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6144                 eval $xrun
6145 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6146         eval $xscan;\
6147         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6148                 eval $xrun
6149 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6150         eval $xscan;\
6151         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6152                 eval $xrun
6153 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6154         eval $xscan;\
6155         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6156                 eval $xrun
6157 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6158         eval $xscan;\
6159         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6160                 eval $xrun
6161 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6162                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6163         eval $xscan;\
6164         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6165                 eval $xrun
6166 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6167         eval $xscan;\
6168         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6169                 eval $xrun
6170 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6171         eval $xscan;\
6172         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6173                 eval $xrun
6174 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6175         eval $xscan;\
6176         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6177                 eval $xrun
6178 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6179         eval $xscan;\
6180         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6181                 eval $xrun
6182 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6183         eval $xscan;\
6184         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6185                 eval $xrun
6186 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6187         eval $xscan;\
6188         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6189                 eval $xrun
6190 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6191         eval $xscan;\
6192         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6193                 eval $xrun
6194 else
6195         $nm -p $* 2>/dev/null >libc.tmp
6196         $grep fprintf libc.tmp > libc.ptf
6197         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6198                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6199         then
6200                 nm_opt='-p'
6201                 eval $xrun
6202         else
6203                 echo " "
6204                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6205                 com=''
6206                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6207                         for thisname in $libnames $libc; do
6208                                 $ar t $thisname >>libc.tmp
6209                         done
6210                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6211                         echo "Ok." >&4
6212                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6213                         # Repeat libc to extract forwarders to DLL entries too
6214                         for thisname in $libnames $libc; do
6215                                 $ar tv $thisname >>libc.tmp
6216                                 # Revision 50 of EMX has bug in $ar.
6217                                 # it will not extract forwarders to DLL entries
6218                                 # Use emximp which will extract exactly them.
6219                                 emximp -o tmp.imp $thisname \
6220                                     2>/dev/null && \
6221                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6222                                     < tmp.imp >>libc.tmp
6223                                 $rm tmp.imp
6224                         done
6225                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6226                         echo "Ok." >&4
6227                 else
6228                         echo "$ar didn't seem to work right." >&4
6229                         echo "Maybe this is a Cray...trying bld instead..." >&4
6230                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6231                         then
6232                                 for thisname in $libnames; do
6233                                         bld t $libnames | \
6234                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6235                                         $ar t $thisname >>libc.tmp
6236                                 done
6237                                 echo "Ok." >&4
6238                         else
6239                                 echo "That didn't work either.  Giving up." >&4
6240                                 exit 1
6241                         fi
6242                 fi
6243         fi
6244 fi
6245 nm_extract="$com"
6246 if $test -f /lib/syscalls.exp; then
6247         echo " "
6248         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6249         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6250 fi
6251 ;;
6252 esac
6253 $rm -f libnames libpath
6254
6255 : see if dld is available
6256 set dld.h i_dld
6257 eval $inhdr
6258
6259 : is a C symbol defined?
6260 csym='tlook=$1;
6261 case "$3" in
6262 -v) tf=libc.tmp; tc=""; tdc="";;
6263 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6264 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6265 esac;
6266 tx=yes;
6267 case "$reuseval-$4" in
6268 true-) ;;
6269 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6270 esac;
6271 case "$tx" in
6272 yes)
6273         case "$runnm" in
6274         true)
6275                 if $contains $tlook $tf >/dev/null 2>&1;
6276                 then tval=true;
6277                 else tval=false;
6278                 fi;;
6279         *)
6280                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6281                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6282                 then tval=true;
6283                 else tval=false;
6284                 fi;
6285                 $rm -f t t.c;;
6286         esac;;
6287 *)
6288         case "$tval" in
6289         $define) tval=true;;
6290         *) tval=false;;
6291         esac;;
6292 esac;
6293 eval "$2=$tval"'
6294
6295 : define an is-in-libc? function
6296 inlibc='echo " "; td=$define; tu=$undef;
6297 sym=$1; var=$2; eval "was=\$$2";
6298 tx=yes;
6299 case "$reuseval$was" in
6300 true) ;;
6301 true*) tx=no;;
6302 esac;
6303 case "$tx" in
6304 yes)
6305         set $sym tres -f;
6306         eval $csym;
6307         case "$tres" in
6308         true)
6309                 echo "$sym() found." >&4;
6310                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6311         *)
6312                 echo "$sym() NOT found." >&4;
6313                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6314         esac;;
6315 *)
6316         case "$was" in
6317         $define) echo "$sym() found." >&4;;
6318         *) echo "$sym() NOT found." >&4;;
6319         esac;;
6320 esac'
6321
6322 : see if dlopen exists
6323 xxx_runnm="$runnm"
6324 runnm=false
6325 set dlopen d_dlopen
6326 eval $inlibc
6327 runnm="$xxx_runnm"
6328
6329 : determine which dynamic loading, if any, to compile in
6330 echo " "
6331 dldir="ext/DynaLoader"
6332 case "$usedl" in
6333 $define|y|true)
6334         dflt='y'
6335         usedl="$define"
6336         ;;
6337 $undef|n|false)
6338         dflt='n'
6339         usedl="$undef"
6340         ;;
6341 *) 
6342         dflt='n'
6343         case "$d_dlopen" in
6344             $define) dflt='y' ;;
6345         esac
6346         case "$i_dld" in
6347             $define) dflt='y' ;;
6348         esac
6349         : Does a dl_xxx.xs file exist for this operating system
6350         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6351         ;;
6352 esac
6353 rp="Do you wish to use dynamic loading?"
6354 . ./myread
6355 usedl="$ans"
6356 case "$ans" in
6357 y*) usedl="$define"
6358         case "$dlsrc" in
6359         '')
6360                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6361                         dflt="$dldir/dl_${osname}.xs"
6362                 elif $test "$d_dlopen" = "$define" ; then
6363                         dflt="$dldir/dl_dlopen.xs"
6364                 elif $test "$i_dld" = "$define" ; then
6365                         dflt="$dldir/dl_dld.xs"
6366                 else
6367                         dflt=''
6368                 fi
6369                 ;;
6370         *)      dflt="$dldir/$dlsrc"
6371                 ;;
6372         esac
6373     echo "The following dynamic loading files are available:"
6374         : Can not go over to $dldir because getfile has path hard-coded in.
6375         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6376         rp="Source file to use for dynamic loading"
6377         fn="fne"
6378         gfpth="$src"
6379         . ./getfile
6380         usedl="$define"
6381         : emulate basename
6382         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6383
6384         $cat << EOM
6385
6386 Some systems may require passing special flags to $cc -c to
6387 compile modules that will be used to create a shared library.
6388 To use no flags, say "none".
6389
6390 EOM
6391     case "$cccdlflags" in
6392     '') case "$gccversion" in
6393                 '') case "$osname" in
6394                         hpux)   dflt='+z' ;;
6395                         next)   dflt='none' ;;
6396                         irix*)  dflt='-KPIC' ;;
6397                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6398                         sunos)  dflt='-pic' ;;
6399                         *)      dflt='none' ;;
6400                     esac
6401                         ;;
6402                 *)  case "$osname" in
6403                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6404                         *)      dflt='-fpic' ;;
6405                     esac ;;
6406             esac ;;
6407         ' ') dflt='none' ;;
6408     *)  dflt="$cccdlflags" ;;
6409     esac
6410     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6411     . ./myread
6412     case "$ans" in
6413     none) cccdlflags=' ' ;;
6414     *) cccdlflags="$ans" ;;
6415     esac
6416
6417     cat << EOM
6418
6419 Some systems use ld to create libraries that can be dynamically loaded,
6420 while other systems (such as those using ELF) use $cc.
6421
6422 EOM
6423         case "$ld" in
6424         '')     $cat >try.c <<'EOM'
6425 /* Test for whether ELF binaries are produced */
6426 #include <fcntl.h>
6427 #include <stdlib.h>
6428 int main() {
6429         char b[4];
6430         int i = open("a.out",O_RDONLY);
6431         if(i == -1) 
6432                 exit(1); /* fail */
6433         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6434                 exit(0); /* succeed (yes, it's ELF) */
6435         else
6436                 exit(1); /* fail */
6437 }
6438 EOM
6439                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6440                         cat <<EOM
6441 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6442 EOM
6443                         dflt="$cc"
6444                 else
6445                         echo "I'll use ld to build dynamic libraries."
6446                         dflt='ld'
6447                 fi
6448                 rm -f try.c a.out
6449                 ;;
6450         *)      dflt="$ld"
6451                 ;;
6452         esac
6453
6454     rp="What command should be used to create dynamic libraries?"
6455     . ./myread
6456         ld="$ans"
6457
6458     cat << EOM
6459
6460 Some systems may require passing special flags to $ld to create a
6461 library that can be dynamically loaded.  If your ld flags include
6462 -L/other/path options to locate libraries outside your loader's normal
6463 search path, you may need to specify those -L options here as well.  To
6464 use no flags, say "none".
6465
6466 EOM
6467     case "$lddlflags" in
6468     '') case "$osname" in
6469                         beos) dflt='-nostart' ;;
6470                         hpux) dflt='-b';
6471                               case "$gccversion" in
6472                               '') dflt="$dflt +vnocompatwarnings" ;;
6473                               esac
6474                               ;;        
6475                         linux|irix*)    dflt='-shared' ;;
6476                         next)  dflt='none' ;;
6477                         solaris) dflt='-G' ;;
6478                         sunos) dflt='-assert nodefinitions' ;;
6479                         svr4*|esix*) dflt="-G $ldflags" ;;
6480                 *)     dflt='none' ;;
6481                         esac
6482                         ;;
6483     *) dflt="$lddlflags" ;;
6484     esac
6485
6486         : Try to guess additional flags to pick up local libraries.
6487         : Be careful not to append to a plain 'none'
6488         case "$dflt" in
6489         none) dflt='' ;;
6490         esac
6491         for thisflag in $ldflags; do
6492                 case "$thisflag" in
6493                 -L*)
6494                         case " $dflt " in
6495                         *" $thisflag "*) ;;
6496                         *) dflt="$dflt $thisflag" ;;
6497                         esac
6498                         ;;
6499                 esac
6500         done
6501
6502         case "$dflt" in
6503         ''|' ') dflt='none' ;;
6504         esac
6505
6506     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6507     . ./myread
6508     case "$ans" in
6509     none) lddlflags=' ' ;;
6510     *) lddlflags="$ans" ;;
6511     esac
6512
6513         cat <<EOM
6514
6515 Some systems may require passing special flags to $cc to indicate that
6516 the resulting executable will use dynamic linking.  To use no flags,
6517 say "none".
6518
6519 EOM
6520     case "$ccdlflags" in
6521     '') case "$osname" in
6522                 hpux)   dflt='-Wl,-E' ;;
6523                 linux)  dflt='-rdynamic' ;;
6524                 next)   dflt='none' ;;
6525                 sunos)  dflt='none' ;;
6526                 *)      dflt='none' ;;
6527             esac ;;
6528     ' ')  dflt='none' ;;
6529     *)  dflt="$ccdlflags" ;;
6530     esac
6531     rp="Any special flags to pass to $cc to use dynamic linking?"
6532     . ./myread
6533     case "$ans" in
6534     none) ccdlflags=' ' ;;
6535     *) ccdlflags="$ans" ;;
6536     esac
6537     ;;
6538 *)  usedl="$undef"
6539         ld='ld'
6540     dlsrc='dl_none.xs'
6541     lddlflags=''
6542     ccdlflags=''
6543     ;;
6544 esac
6545
6546 also=''
6547 case "$usedl" in
6548 $undef)
6549         # No dynamic loading being used, so don't bother even to prompt.
6550         useshrplib='false'
6551         ;;
6552 *)      case "$useshrplib" in
6553         '')     case "$osname" in
6554                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6555                         dflt=y
6556                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6557                         ;;
6558                 next*)
6559                         case "$osvers" in
6560                         4*)     dflt=y
6561                                 also='Building a shared libperl is needed for MAB support.'
6562                                 ;;
6563                         *)      dflt=n
6564                                 ;;
6565                         esac
6566                         ;;
6567                 *)      dflt=n
6568                         ;;
6569                 esac
6570                 ;;
6571         $define|true|[Yy]*)
6572                 dflt=y
6573                 ;;
6574         *)      dflt=n
6575                 ;;
6576         esac
6577         $cat << EOM
6578
6579 The perl executable is normally obtained by linking perlmain.c with
6580 libperl${_a}, any static extensions (usually just DynaLoader), and
6581 any other libraries needed on this system (such as -lm, etc.).  Since
6582 your system supports dynamic loading, it is probably possible to build
6583 a shared libperl.$so.  If you will have more than one executable linked
6584 to libperl.$so, this will significantly reduce the size of each
6585 executable, but it may have a noticeable affect on performance.  The
6586 default is probably sensible for your system.
6587 $also
6588
6589 EOM
6590         rp="Build a shared libperl.$so (y/n)"
6591         . ./myread
6592         case "$ans" in
6593         true|$define|[Yy]*)
6594                 useshrplib='true'  ;;
6595         *)      useshrplib='false' ;;
6596         esac
6597         ;;
6598 esac
6599
6600 case "$useshrplib" in
6601 true)
6602         case "$libperl" in
6603         '')
6604                 # Figure out a good name for libperl.so.  Since it gets stored in
6605                 # a version-specific architecture-dependent library, the version
6606                 # number isn't really that important, except for making cc/ld happy.
6607                 #
6608                 # A name such as libperl.so.3.1
6609                 majmin="libperl.$so.$patchlevel.$subversion"
6610                 # A name such as libperl.so.301
6611                 majonly=`echo $patchlevel $subversion |
6612                         $awk '{printf "%d%02d", $1, $2}'`
6613                 majonly=libperl.$so.$majonly
6614                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6615                 # rely on figuring it out from the naming of libc.
6616                 case "${osname}${osvers}" in
6617                 next4*)
6618                         dflt=libperl.5.$so
6619                         # XXX How handle the --version stuff for MAB?
6620                         ;;
6621                 linux*)  # ld won't link with a bare -lperl otherwise.
6622                         dflt=libperl.$so
6623                         ;;
6624                 cygwin*) # include version
6625                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6626                         ;;
6627                 *)      # Try to guess based on whether libc has major.minor.
6628                         case "$libc" in
6629                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6630                         *libc.$so.[0-9]*) dflt=$majonly ;;
6631                         *)      dflt=libperl.$so ;;
6632                         esac
6633                         ;;
6634                 esac
6635                 ;;
6636         *)      dflt=$libperl
6637                 ;;
6638         esac
6639         cat << EOM
6640
6641 I need to select a good name for the shared libperl.  If your system uses
6642 library names with major and minor numbers, then you might want something
6643 like $majmin.  Alternatively, if your system uses a single version
6644 number for shared libraries, then you might want to use $majonly.
6645 Or, your system might be quite happy with a simple libperl.$so.
6646
6647 Since the shared libperl will get installed into a version-specific
6648 architecture-dependent directory, the version number of the shared perl
6649 library probably isn't important, so the default should be o.k.
6650
6651 EOM
6652         rp='What name do you want to give to the shared libperl?'
6653         . ./myread
6654         libperl=$ans
6655         echo "Ok, I'll use $libperl"
6656         ;;
6657 *)
6658         libperl="libperl${_a}"
6659         ;;
6660 esac
6661
6662 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6663 case "$shrpdir" in
6664 '') ;;
6665 *)      $cat >&4 <<EOM
6666 WARNING:  Use of the shrpdir variable for the installation location of
6667 the shared $libperl is not supported.  It was never documented and
6668 will not work in this version.  Let me (perlbug@perl.com)
6669 know of any problems this may cause.
6670
6671 EOM
6672         case "$shrpdir" in
6673         "$archlibexp/CORE")
6674                 $cat >&4 <<EOM
6675 But your current setting of $shrpdir is
6676 the default anyway, so it's harmless.
6677 EOM
6678                 ;;
6679         *)
6680                 $cat >&4 <<EOM
6681 Further, your current attempted setting of $shrpdir
6682 conflicts with the value of $archlibexp/CORE
6683 that installperl will use.
6684 EOM
6685                 ;;
6686         esac
6687         ;;
6688 esac
6689
6690 # How will the perl executable find the installed shared $libperl?
6691 # Add $xxx to ccdlflags.
6692 # If we can't figure out a command-line option, use $shrpenv to
6693 # set env LD_RUN_PATH.  The main perl makefile uses this.
6694 shrpdir=$archlibexp/CORE
6695 xxx=''
6696 tmp_shrpenv=''
6697 if "$useshrplib"; then
6698     case "$osname" in 
6699         aix)
6700                 # We'll set it in Makefile.SH...
6701                 ;;
6702         solaris|netbsd)
6703                 xxx="-R $shrpdir"
6704                 ;;
6705         freebsd)
6706                 xxx="-Wl,-R$shrpdir"
6707                 ;;
6708         linux|irix*|dec_osf)
6709                 xxx="-Wl,-rpath,$shrpdir"
6710                 ;;
6711         next)
6712                 # next doesn't like the default...
6713                 ;;
6714         beos)
6715                 # beos doesn't like the default, either.
6716                 ;;
6717         hpux*)
6718                 # hpux doesn't like the default, either.
6719                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6720                 ;;
6721         *)
6722                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6723                 ;;
6724         esac
6725         case "$xxx" in
6726         '') ;;
6727         *)      
6728                 # Only add $xxx if it isn't already in ccdlflags.
6729                 case " $ccdlflags " in
6730                 *" $xxx "*)     ;;
6731                 *)      ccdlflags="$ccdlflags $xxx"
6732                         cat <<EOM >&4
6733
6734 Adding $xxx to the flags
6735 passed to $ld so that the perl executable will find the 
6736 installed shared $libperl.
6737
6738 EOM
6739                         ;;
6740                 esac
6741                 ;;
6742         esac
6743 fi
6744 # Fix ccdlflags in AIX for building external extensions.
6745 # (For building Perl itself bare -bE:perl.exp is needed,
6746 #  Makefile.SH takes care of this.)
6747 case "$osname" in
6748 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6749 esac
6750 # Respect a hint or command-line value.
6751 case "$shrpenv" in
6752 '') shrpenv="$tmp_shrpenv" ;;
6753 esac
6754 case "$ldlibpthname" in
6755 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6756 none)   ldlibpthname='' ;;
6757 esac
6758
6759 : determine where manual pages go
6760 set man1dir man1dir none
6761 eval $prefixit
6762 $cat <<EOM
6763
6764 $spackage has manual pages available in source form.
6765 EOM
6766 case "$nroff" in
6767 nroff)
6768         echo "However, you don't have nroff, so they're probably useless to you."
6769         case "$man1dir" in
6770         '') man1dir="none";;
6771         esac;;
6772 esac
6773 echo "If you don't want the manual sources installed, answer 'none'."
6774 case "$man1dir" in
6775 ' ') dflt=none
6776         ;;
6777 '')
6778         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6779         lookpath="$lookpath $prefixexp/man/p_man/man1"
6780         lookpath="$lookpath $prefixexp/man/u_man/man1"
6781         lookpath="$lookpath $prefixexp/man/man.1"
6782         case "$sysman" in
6783         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6784         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6785         esac
6786         set dflt
6787         eval $prefixup
6788         ;;
6789 *)  dflt="$man1dir"
6790         ;;
6791 esac
6792 echo " "
6793 fn=dn+~
6794 rp="Where do the main $spackage manual pages (source) go?"
6795 . ./getfile
6796 if $test "X$man1direxp" != "X$ansexp"; then
6797         installman1dir=''
6798 fi
6799 man1dir="$ans"
6800 man1direxp="$ansexp"
6801 case "$man1dir" in
6802 '')     man1dir=' '
6803         installman1dir='';;
6804 esac
6805
6806 : Change installation prefix, if necessary.
6807 if $test X"$prefix" != X"$installprefix"; then
6808         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6809 else
6810         installman1dir="$man1direxp"
6811 fi
6812
6813 : What suffix to use on installed man pages
6814
6815 case "$man1dir" in
6816 ' ')
6817         man1ext='0'
6818         ;;
6819 *)
6820         rp="What suffix should be used for the main $spackage man pages?"
6821         case "$man1ext" in
6822         '')     case "$man1dir" in
6823                 *1)  dflt=1 ;;
6824                 *1p) dflt=1p ;;
6825                 *1pm) dflt=1pm ;;
6826                 *l) dflt=l;;
6827                 *n) dflt=n;;
6828                 *o) dflt=o;;
6829                 *p) dflt=p;;
6830                 *C) dflt=C;;
6831                 *L) dflt=L;;
6832                 *L1) dflt=L1;;
6833                 *) dflt=1;;
6834                 esac
6835                 ;;
6836         *)      dflt="$man1ext";;
6837         esac
6838         . ./myread
6839         man1ext="$ans"
6840         ;;
6841 esac
6842
6843 : see if we can have long filenames
6844 echo " "
6845 first=123456789abcdef
6846 $rm -f $first
6847 if (echo hi >$first) 2>/dev/null; then
6848         if $test -f 123456789abcde; then
6849                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6850                 val="$undef"
6851         else
6852                 echo 'You can have filenames longer than 14 characters.'>&4
6853                 val="$define"
6854         fi
6855 else
6856         $cat <<'EOM'
6857 You can't have filenames longer than 14 chars.
6858 You can't even think about them!
6859 EOM
6860         val="$undef"
6861 fi 
6862 set d_flexfnam
6863 eval $setvar
6864 $rm -rf 123456789abcde*
6865
6866 : determine where library module manual pages go
6867 set man3dir man3dir none
6868 eval $prefixit
6869 $cat <<EOM
6870
6871 $spackage has manual pages for many of the library modules.
6872 EOM
6873
6874 case "$nroff" in
6875 nroff)
6876         $cat <<'EOM'
6877 However, you don't have nroff, so they're probably useless to you.
6878 EOM
6879         case "$man3dir" in
6880         '') man3dir="none";;
6881         esac;;
6882 esac
6883
6884 case "$d_flexfnam" in
6885 undef)
6886         $cat <<'EOM'
6887 However, your system can't handle the long file names like File::Basename.3. 
6888 EOM
6889         case "$man3dir" in
6890         '') man3dir="none";;
6891         esac;;
6892 esac
6893
6894 echo "If you don't want the manual sources installed, answer 'none'."
6895 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6896 case "$man3dir" in
6897 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6898         if $test -d "$privlib/man/man3"; then
6899                 cat <<EOM >&4
6900
6901 WARNING:  Previous versions of perl installed man3 pages into
6902 $privlib/man/man3.  This version will suggest a 
6903 new default of $dflt.  
6904 EOM
6905                 tdflt=$dflt
6906                 dflt='n'
6907                 rp='Do you wish to preserve the old behavior?(y/n)'
6908                 . ./myread
6909                 case "$ans" in
6910                 y*) dflt="$privlib/man/man3" ;;
6911                 *)  dflt=$tdflt ;;
6912                 esac
6913     fi
6914         ;;
6915 *)      dflt="$man3dir" ;;
6916 esac
6917 case "$dflt" in
6918 ' ') dflt=none ;;
6919 esac
6920 echo " "
6921 fn=dn+~
6922 rp="Where do the $package library man pages (source) go?"
6923 . ./getfile
6924 man3dir="$ans"
6925 man3direxp="$ansexp"
6926 case "$man3dir" in
6927 '')     man3dir=' '
6928         installman3dir='';;
6929 esac
6930
6931 : Change installation prefix, if necessary.
6932 if $test X"$prefix" != X"$installprefix"; then
6933         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6934 else
6935         installman3dir="$man3direxp"
6936 fi
6937
6938 : What suffix to use on installed man pages
6939 case "$man3dir" in
6940 ' ')
6941         man3ext='0'
6942         ;;
6943 *)
6944         rp="What suffix should be used for the $package library man pages?"
6945         case "$man3ext" in
6946         '')     case "$man3dir" in
6947                 *3)  dflt=3 ;;
6948                 *3p) dflt=3p ;;
6949                 *3pm) dflt=3pm ;;
6950                 *l) dflt=l;;
6951                 *n) dflt=n;;
6952                 *o) dflt=o;;
6953                 *p) dflt=p;;
6954                 *C) dflt=C;;
6955                 *L) dflt=L;;
6956                 *L3) dflt=L3;;
6957                 *) dflt=3;;
6958                 esac
6959                 ;;
6960         *)      dflt="$man3ext";;
6961         esac
6962         . ./myread
6963         man3ext="$ans"
6964         ;;
6965 esac
6966
6967 : see if we have to deal with yellow pages, now NIS.
6968 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6969         if $test -f /usr/etc/nibindd; then
6970                 echo " "
6971                 echo "I'm fairly confident you're on a NeXT."
6972                 echo " "
6973                 rp='Do you get the hosts file via NetInfo?'
6974                 dflt=y
6975                 case "$hostcat" in
6976                 nidump*) ;;
6977                 '') ;;
6978                 *) dflt=n;;
6979                 esac
6980                 . ./myread
6981                 case "$ans" in
6982                 y*) hostcat='nidump hosts .';;
6983                 *)      case "$hostcat" in
6984                         nidump*) hostcat='';;
6985                         esac
6986                         ;;
6987                 esac
6988         fi
6989         case "$hostcat" in
6990         nidump*) ;;
6991         *)
6992                 case "$hostcat" in
6993                 *ypcat*) dflt=y;;
6994                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6995                                 dflt=y
6996                         else
6997                                 dflt=n
6998                         fi;;
6999                 *) dflt=n;;
7000                 esac
7001                 echo " "
7002                 rp='Are you getting the hosts file via yellow pages?'
7003                 . ./myread
7004                 case "$ans" in
7005                 y*) hostcat='ypcat hosts';;
7006                 *) hostcat='cat /etc/hosts';;
7007                 esac
7008                 ;;
7009         esac
7010 fi
7011 case "$hostcat" in
7012 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7013 esac
7014 case "$groupcat" in
7015 '') test -f /etc/group && groupcat='cat /etc/group';;
7016 esac
7017 case "$passcat" in
7018 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7019 esac
7020
7021 : now get the host name
7022 echo " "
7023 echo "Figuring out host name..." >&4
7024 case "$myhostname" in
7025 '') cont=true
7026         echo 'Maybe "hostname" will work...'
7027         if tans=`sh -c hostname 2>&1` ; then
7028                 myhostname=$tans
7029                 phostname=hostname
7030                 cont=''
7031         fi
7032         ;;
7033 *) cont='';;
7034 esac
7035 if $test "$cont"; then
7036         if ./xenix; then
7037                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7038                 if tans=`cat /etc/systemid 2>&1` ; then
7039                         myhostname=$tans
7040                         phostname='cat /etc/systemid'
7041                         echo "Whadyaknow.  Xenix always was a bit strange..."
7042                         cont=''
7043                 fi
7044         elif $test -r /etc/systemid; then
7045                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7046         fi
7047 fi
7048 if $test "$cont"; then
7049         echo 'No, maybe "uuname -l" will work...'
7050         if tans=`sh -c 'uuname -l' 2>&1` ; then
7051                 myhostname=$tans
7052                 phostname='uuname -l'
7053         else
7054                 echo 'Strange.  Maybe "uname -n" will work...'
7055                 if tans=`sh -c 'uname -n' 2>&1` ; then
7056                         myhostname=$tans
7057                         phostname='uname -n'
7058                 else
7059                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7060                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7061                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7062                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7063                         else
7064                                 case "$myhostname" in
7065                                 '') echo "Does this machine have an identity crisis or something?"
7066                                         phostname='';;
7067                                 *)
7068                                         echo "Well, you said $myhostname before..."
7069                                         phostname='echo $myhostname';;
7070                                 esac
7071                         fi
7072                 fi
7073         fi
7074 fi
7075 : you do not want to know about this
7076 set $myhostname
7077 myhostname=$1
7078
7079 : verify guess
7080 if $test "$myhostname" ; then
7081         dflt=y
7082         rp='Your host name appears to be "'$myhostname'".'" Right?"
7083         . ./myread
7084         case "$ans" in
7085         y*) ;;
7086         *) myhostname='';;
7087         esac
7088 fi
7089
7090 : bad guess or no guess
7091 while $test "X$myhostname" = X ; do
7092         dflt=''
7093         rp="Please type the (one word) name of your host:"
7094         . ./myread
7095         myhostname="$ans"
7096 done
7097
7098 : translate upper to lower if necessary
7099 case "$myhostname" in
7100 *[A-Z]*)
7101         echo "(Normalizing case in your host name)"
7102         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7103         ;;
7104 esac
7105
7106 case "$myhostname" in
7107 *.*)
7108         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7109         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7110         echo "(Trimming domain name from host name--host name is now $myhostname)"
7111         ;;
7112 *) case "$mydomain" in
7113         '')
7114                 {
7115                         test "X$hostcat" = "Xypcat hosts" &&
7116                         ypmatch "$myhostname" hosts 2>/dev/null |\
7117                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7118                         $test -s hosts
7119                 } || {
7120                         test "X$hostcat" != "X" &&
7121                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7122                                         /[       ]$myhostname[  . ]/p" > hosts
7123                 }
7124                 tmp_re="[       . ]"
7125                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7126                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7127                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7128                         hosts | $sort | $uniq | \
7129                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7130                 case `$echo X$dflt` in
7131                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7132                         dflt=.
7133                         ;;
7134                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7135                         ;;
7136                 esac
7137                 case "$dflt" in
7138                 .)
7139                         tans=`./loc resolv.conf X /etc /usr/etc`
7140                         if $test -f "$tans"; then
7141                                 echo "(Attempting domain name extraction from $tans)"
7142                                 dflt=.`$sed -n -e 's/   / /g' \
7143                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7144                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7145                                 case "$dflt" in
7146                                 .) dflt=.`$sed -n -e 's/        / /g' \
7147                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7148                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7149                                         ;;
7150                                 esac
7151                         fi
7152                         ;;
7153                 esac
7154                 case "$dflt" in
7155                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7156                         dflt=.`sh -c domainname 2>/dev/null`
7157                         case "$dflt" in
7158                         '') dflt='.';;
7159                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7160                         esac
7161                         ;;
7162                 esac
7163                 case "$dflt" in
7164                 .) echo "(Lost all hope -- silly guess then)"
7165                         dflt='.uucp'
7166                         ;;
7167                 esac
7168                 $rm -f hosts
7169                 ;;
7170         *) dflt="$mydomain";;
7171         esac;;
7172 esac
7173 echo " "
7174 rp="What is your domain name?"
7175 . ./myread
7176 tans="$ans"
7177 case "$ans" in
7178 '') ;;
7179 .*) ;;
7180 *) tans=".$tans";;
7181 esac
7182 mydomain="$tans"
7183
7184 : translate upper to lower if necessary
7185 case "$mydomain" in
7186 *[A-Z]*)
7187         echo "(Normalizing case in your domain name)"
7188         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7189         ;;
7190 esac
7191
7192 : a little sanity check here
7193 case "$phostname" in
7194 '') ;;
7195 *)
7196         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7197         $myhostname$mydomain|$myhostname) ;;
7198         *)
7199                 case "$phostname" in
7200                 sed*)
7201                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7202                         ;;
7203                 *)
7204                         echo "(That doesn't agree with your $phostname command, by the way.)"
7205                         ;;
7206                 esac
7207         ;;
7208         esac
7209         ;;
7210 esac
7211
7212 $cat <<EOM
7213
7214 I need to get your e-mail address in Internet format if possible, i.e.
7215 something like user@host.domain. Please answer accurately since I have
7216 no easy means to double check it. The default value provided below
7217 is most probably close to reality but may not be valid from outside
7218 your organization...
7219
7220 EOM
7221 cont=x
7222 while test "$cont"; do
7223         case "$cf_email" in
7224         '') dflt="$cf_by@$myhostname$mydomain";;
7225         *) dflt="$cf_email";;
7226         esac
7227         rp='What is your e-mail address?'
7228         . ./myread
7229         cf_email="$ans"
7230         case "$cf_email" in
7231         *@*.*) cont='' ;;
7232         *)
7233                 rp='Address does not look like an Internet one.  Use it anyway?'
7234                 case "$fastread" in
7235                 yes) dflt=y ;;
7236                 *) dflt=n ;;
7237                 esac
7238                 . ./myread
7239                 case "$ans" in
7240                 y*) cont='' ;;
7241                 *) echo " " ;;
7242                 esac
7243                 ;;
7244         esac
7245 done
7246
7247 $cat <<EOM
7248
7249 If you or somebody else will be maintaining perl at your site, please
7250 fill in the correct e-mail address here so that they may be contacted
7251 if necessary. Currently, the "perlbug" program included with perl
7252 will send mail to this address in addition to perlbug@perl.com. You may
7253 enter "none" for no administrator.
7254
7255 EOM
7256 case "$perladmin" in
7257 '') dflt="$cf_email";;
7258 *) dflt="$perladmin";;
7259 esac
7260 rp='Perl administrator e-mail address'
7261 . ./myread
7262 perladmin="$ans"
7263
7264 : figure out how to guarantee perl startup
7265 case "$startperl" in
7266 '')
7267         case "$sharpbang" in
7268         *!)
7269                 $cat <<EOH
7270
7271 I can use the #! construct to start perl on your system. This will
7272 make startup of perl scripts faster, but may cause problems if you
7273 want to share those scripts and perl is not in a standard place
7274 ($binexp/perl) on all your platforms. The alternative is to force
7275 a shell by starting the script with a single ':' character.
7276
7277 EOH
7278                 dflt="$binexp/perl"
7279                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7280                 . ./myread
7281                 case "$ans" in
7282                 none)   startperl=": # use perl";;
7283                 *)      startperl="#!$ans"
7284                         if $test 30 -lt `echo "$ans" | wc -c`; then
7285                                 $cat >&4 <<EOM
7286
7287 WARNING:  Some systems limit the #! command to 32 characters.
7288 If you experience difficulty running Perl scripts with #!, try
7289 installing Perl in a directory with a shorter pathname.
7290
7291 EOM
7292                         fi ;;
7293                 esac
7294                 ;;
7295         *) startperl=": # use perl"
7296                 ;;
7297         esac
7298         ;;
7299 esac
7300 echo "I'll use $startperl to start perl scripts."
7301
7302 : figure best path for perl in scripts
7303 case "$perlpath" in
7304 '')
7305         perlpath="$binexp/perl"
7306         case "$startperl" in
7307         *!*) ;;
7308         *)
7309                 $cat <<EOH
7310
7311 I will use the "eval 'exec'" idiom to start Perl on your system.
7312 I can use the full path of your Perl binary for this purpose, but
7313 doing so may cause problems if you want to share those scripts and
7314 Perl is not always in a standard place ($binexp/perl).
7315
7316 EOH
7317                 dflt="$binexp/perl"
7318                 rp="What path shall I use in \"eval 'exec'\"?"
7319                 . ./myread
7320                 perlpath="$ans"
7321                 ;;
7322         esac
7323         ;;
7324 esac
7325 case "$startperl" in
7326 *!*)    ;;
7327 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7328 esac
7329
7330 : determine where public executable scripts go
7331 set scriptdir scriptdir
7332 eval $prefixit
7333 case "$scriptdir" in
7334 '')
7335         dflt="$bin"
7336         : guess some guesses
7337         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7338         $test -d /usr/share/bin     && dflt=/usr/share/bin
7339         $test -d /usr/local/script  && dflt=/usr/local/script
7340         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7341         $test -d $prefixexp/script  && dflt=$prefixexp/script
7342         set dflt
7343         eval $prefixup
7344         ;;
7345 *)  dflt="$scriptdir"
7346         ;;
7347 esac
7348 $cat <<EOM
7349  
7350 Some installations have a separate directory just for executable scripts so
7351 that they can mount it across multiple architectures but keep the scripts in
7352 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7353 Or you might just lump your scripts in with all your other executables.
7354  
7355 EOM
7356 fn=d~
7357 rp='Where do you keep publicly executable scripts?'
7358 . ./getfile
7359 if $test "X$ansexp" != "X$scriptdirexp"; then
7360         installscript=''
7361 fi
7362 scriptdir="$ans"
7363 scriptdirexp="$ansexp"
7364 : Change installation prefix, if necessary.
7365 if $test X"$prefix" != X"$installprefix"; then
7366         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7367 else
7368         installscript="$scriptdirexp"
7369 fi
7370
7371 : determine where add-on public executables go
7372 case "$sitebin" in
7373 '')     dflt=$siteprefix/bin ;;
7374 *)      dflt=$sitebin ;;
7375 esac
7376 fn=d~
7377 rp='Pathname where the add-on public executables should be installed?'
7378 . ./getfile
7379 sitebin="$ans"
7380 sitebinexp="$ansexp"
7381 : Change installation prefix, if necessary.
7382 if $test X"$prefix" != X"$installprefix"; then
7383         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7384 else
7385         installsitebin="$sitebinexp"
7386 fi
7387
7388 : see if sqrtl exists
7389 set sqrtl d_sqrtl
7390 eval $inlibc
7391
7392 case "$ccflags" in
7393 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7394 esac
7395
7396 case "$uselongdouble" in
7397 $define|true|[yY]*)     dflt='y';;
7398 *) dflt='n';;
7399 esac
7400 cat <<EOM
7401
7402 Perl can be built to take advantage of long doubles which
7403 (if available) may give more accuracy and range for floating point numbers.
7404
7405 If this doesn't make any sense to you, just accept the default '$dflt'.
7406 EOM
7407 rp='Try to use long doubles if available?'
7408 . ./myread
7409 case "$ans" in
7410 y|Y)    val="$define"   ;;
7411 *)      val="$undef"    ;;
7412 esac
7413 set uselongdouble
7414 eval $setvar
7415
7416 case "$uselongdouble" in
7417 true|[yY]*) uselongdouble="$define" ;;
7418 esac
7419
7420 case "$uselongdouble" in
7421 $define)
7422 : Look for a hint-file generated 'call-back-unit'.  If the
7423 : user has specified that long doubles should be used,
7424 : we may need to set or change some other defaults.
7425         if $test -f uselongdouble.cbu; then
7426                 echo "Your platform has some specific hints for long doubles, using them..."
7427                 . ./uselongdouble.cbu
7428         else
7429                 $cat <<EOM
7430 (Your platform doesn't have any specific hints for long doubles.)
7431 EOM
7432         fi
7433         ;;
7434 esac
7435
7436 case "$uselongdouble:$d_sqrtl" in
7437 $define:$undef)
7438                 $cat <<EOM >&4
7439
7440 *** You requested the use of long doubles but you do not seem to have
7441 *** the mathematic functions for long doubles.  I'm disabling the use
7442 *** of long doubles.
7443
7444 EOM
7445         uselongdouble=$undef
7446         ;;
7447 esac
7448
7449 case "$useperlio" in
7450 $define|true|[yY]*)     dflt='y';;
7451 *) dflt='n';;
7452 esac
7453 cat <<EOM
7454
7455 Previous version of $package used the standard IO mechanisms as defined
7456 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7457 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7458 the default.  This abstraction layer can use AT&T's sfio (if you already
7459 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7460 problems with some extension modules.  Using PerlIO with stdio is safe,
7461 but it is slower than plain stdio and therefore is not the default.
7462
7463 If this doesn't make any sense to you, just accept the default '$dflt'.
7464 EOM
7465 rp='Use the experimental PerlIO abstraction layer?'
7466 . ./myread
7467 case "$ans" in
7468 y|Y) 
7469         val="$define"
7470         ;;     
7471 *)      
7472         echo "Ok, doing things the stdio way"
7473         val="$undef"
7474         ;;
7475 esac
7476 set useperlio
7477 eval $setvar 
7478
7479 case "$vendorprefix" in
7480 '')     d_vendorbin="$undef"
7481         vendorbin=''
7482         vendorbinexp=''
7483         ;;
7484 *)      d_vendorbin="$define"
7485         : determine where vendor-supplied executables go.
7486         case "$vendorbin" in
7487         '') dflt=$vendorprefix/bin ;;
7488         *)      dflt="$vendorbin" ;;
7489         esac
7490         fn=d~+
7491         rp='Pathname for the vendor-supplied executables directory?'
7492         . ./getfile
7493         vendorbin="$ans"
7494         vendorbinexp="$ansexp"
7495         ;;
7496 esac
7497 : Change installation prefix, if necessary.
7498 if $test X"$prefix" != X"$installprefix"; then
7499         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7500 else
7501         installvendorbin="$vendorbinexp"
7502 fi
7503
7504 : see if qgcvt exists
7505 set qgcvt d_qgcvt
7506 eval $inlibc
7507
7508 : check for length of double
7509 echo " "
7510 case "$doublesize" in
7511 '')
7512         echo "Checking to see how big your double precision numbers are..." >&4
7513         $cat >try.c <<'EOCP'
7514 #include <stdio.h>
7515 int main()
7516 {
7517     printf("%d\n", (int)sizeof(double));
7518     exit(0);
7519 }
7520 EOCP
7521         set try
7522         if eval $compile_ok; then
7523                 doublesize=`./try`
7524                 echo "Your double is $doublesize bytes long."
7525         else
7526                 dflt='8'
7527                 echo "(I can't seem to compile the test program.  Guessing...)"
7528                 rp="What is the size of a double precision number (in bytes)?"
7529                 . ./myread
7530                 doublesize="$ans"
7531         fi
7532         ;;
7533 esac
7534 $rm -f try.c try
7535
7536 : check for long doubles
7537 echo " "
7538 echo "Checking to see if you have long double..." >&4
7539 echo 'int main() { long double x = 7.0; }' > try.c
7540 set try
7541 if eval $compile; then
7542         val="$define"
7543         echo "You have long double."
7544 else
7545         val="$undef"
7546         echo "You do not have long double."
7547 fi
7548 $rm try.*
7549 set d_longdbl
7550 eval $setvar
7551
7552 : check for length of long double
7553 case "${d_longdbl}${longdblsize}" in
7554 $define)
7555         echo " "
7556         echo "Checking to see how big your long doubles are..." >&4
7557         $cat >try.c <<'EOCP'
7558 #include <stdio.h>
7559 int main()
7560 {
7561         printf("%d\n", sizeof(long double));
7562 }
7563 EOCP
7564         set try
7565         set try
7566         if eval $compile; then
7567                 longdblsize=`./try$exe_ext`
7568                 echo "Your long doubles are $longdblsize bytes long."
7569         else
7570                 dflt='8'
7571                 echo " "
7572                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7573                 rp="What is the size of a long double (in bytes)?"
7574                 . ./myread
7575                 longdblsize="$ans"
7576         fi
7577         if $test "X$doublesize" = "X$longdblsize"; then
7578                 echo "(That isn't any different from an ordinary double.)"
7579         fi      
7580         ;;
7581 esac
7582 $rm -f try.* try
7583
7584 echo " "
7585
7586 if $test X"$d_longdbl" = X"$define"; then
7587
7588 echo "Checking how to print long doubles..." >&4
7589
7590 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7591         $cat >try.c <<'EOCP'
7592 #include <sys/types.h>
7593 #include <stdio.h>
7594 int main() {
7595   double d = 123.456;
7596   printf("%.3f\n", d);
7597 }
7598 EOCP
7599         set try
7600         if eval $compile; then
7601                 yyy=`./try$exe_ext`
7602                 case "$yyy" in
7603                 123.456)
7604                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7605                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7606                         echo "We will use %f."
7607                         ;;
7608                 esac
7609         fi
7610 fi
7611
7612 if $test X"$sPRIfldbl" = X; then
7613         $cat >try.c <<'EOCP'
7614 #include <sys/types.h>
7615 #include <stdio.h>
7616 int main() {
7617   long double d = 123.456;
7618   printf("%.3llf\n", d);
7619 }
7620 EOCP
7621         set try
7622         if eval $compile; then
7623                 yyy=`./try$exe_ext`
7624                 case "$yyy" in
7625                 123.456)
7626                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7627                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7628                         echo "We will use %llf."
7629                         ;;
7630                 esac
7631         fi
7632 fi
7633
7634 if $test X"$sPRIfldbl" = X; then
7635         $cat >try.c <<'EOCP'
7636 #include <sys/types.h>
7637 #include <stdio.h>
7638 int main() {
7639   long double d = 123.456;
7640   printf("%.3Lf\n", d);
7641 }
7642 EOCP
7643         set try
7644         if eval $compile; then
7645                 yyy=`./try$exe_ext`
7646                 case "$yyy" in
7647                 123.456)
7648                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7649                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7650                         echo "We will use %Lf."
7651                         ;;
7652                 esac
7653         fi
7654 fi
7655
7656 if $test X"$sPRIfldbl" = X; then
7657         $cat >try.c <<'EOCP'
7658 #include <sys/types.h>
7659 #include <stdio.h>
7660 int main() {
7661   long double d = 123.456;
7662   printf("%.3lf\n", d);
7663 }
7664 EOCP
7665         set try
7666         if eval $compile; then
7667                 yyy=`./try$exe_ext`
7668                 case "$yyy" in
7669                 123.456)
7670                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7671                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7672                         echo "We will use %lf."
7673                         ;;
7674                 esac
7675         fi
7676 fi
7677
7678 if $test X"$sPRIfldbl" = X; then
7679         echo "Cannot figure out how to print long doubles." >&4
7680 fi
7681
7682 $rm -f try try.*
7683
7684 fi # d_longdbl
7685
7686 case "$sPRIfldbl" in
7687 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7688         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7689         ;;
7690 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7691         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7692         ;;
7693 esac
7694
7695 : Check how to convert floats to strings.
7696 if test "X$d_Gconvert" = X; then
7697         echo " "
7698         echo "Checking for an efficient way to convert floats to strings."
7699         echo " " > try.c
7700         case "$uselongdouble" in
7701         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7702         esac
7703         case "$d_longdbl" in
7704         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7705         esac
7706         case "$d_PRIgldbl" in
7707         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7708         esac
7709         $cat >>try.c <<EOP
7710 #ifdef TRY_gconvert
7711 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7712 char *myname = "gconvert";
7713 #endif
7714 #ifdef TRY_gcvt
7715 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7716 char *myname = "gcvt";
7717 #endif
7718 #ifdef TRY_qgcvt
7719 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7720 char *myname = "qgcvt";
7721 #define DOUBLETYPE long double
7722 #endif
7723 #ifdef TRY_sprintf
7724 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7725 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7726 #else
7727 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7728 #endif
7729 char *myname = "sprintf";
7730 #endif
7731
7732 #ifndef DOUBLETYPE
7733 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7734 #define DOUBLETYPE long double
7735 #else
7736 #define DOUBLETYPE double
7737 #endif
7738 #endif
7739
7740 #include <stdio.h>
7741
7742 #define I_STDLIB $i_stdlib
7743 #ifdef I_STDLIB
7744 #include <stdlib.h>
7745 #endif
7746
7747 int
7748 checkit(expect, got)
7749 char *expect;
7750 char *got;
7751 {
7752     if (strcmp(expect, got)) {
7753                 printf("%s oddity:  Expected %s, got %s\n",
7754                         myname, expect, got);
7755                 exit(1);
7756         }
7757 }
7758
7759 int main()
7760
7761         char buf[64]; 
7762         buf[63] = '\0';
7763
7764         /* This must be 1st test on (which?) platform */
7765         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7766         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7767         checkit("0.1", buf);
7768
7769         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7770         checkit("1", buf);
7771
7772         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7773         checkit("1.1", buf);
7774
7775         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7776         checkit("1.01", buf);
7777
7778         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7779         checkit("1.001", buf);
7780
7781         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7782         checkit("1.0001", buf);
7783
7784         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7785         checkit("1.00001", buf);
7786
7787         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7788         checkit("1.000001", buf);
7789
7790         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7791         checkit("0", buf);
7792
7793         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7794         checkit("-1", buf);
7795
7796         /* Some Linux gcvt's give 1.e+5 here. */
7797         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7798         checkit("100000", buf);
7799         
7800         /* Some Linux gcvt's give -1.e+5 here. */
7801         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7802         checkit("-100000", buf);
7803
7804         exit(0);
7805 }
7806 EOP
7807         case "$d_Gconvert" in
7808         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7809         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7810         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7811         *) xxx_list='gconvert gcvt sprintf' ;;
7812         esac
7813
7814         case "$d_longdbl$uselongdouble$d_qgcvt" in
7815         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7816         esac
7817
7818         for xxx_convert in $xxx_list; do
7819                 echo "Trying $xxx_convert..."
7820                 $rm -f try try$_o
7821                 set try -DTRY_$xxx_convert
7822                 if eval $compile; then
7823                         echo "$xxx_convert() found." >&4
7824                         if ./try; then
7825                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7826                                 break;
7827                         else
7828                                 echo "...But $xxx_convert didn't work as I expected."
7829                         fi
7830                 else
7831                         echo "$xxx_convert NOT found." >&4
7832                 fi
7833         done
7834                 
7835         case "$xxx_convert" in
7836         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7837         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7838         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7839         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7840            "$define$define$define")
7841               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7842            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7843            esac
7844            ;;  
7845         esac
7846 fi
7847
7848 : Initialize h_fcntl
7849 h_fcntl=false
7850
7851 : Initialize h_sysfile
7852 h_sysfile=false
7853
7854 : access call always available on UNIX
7855 set access d_access
7856 eval $inlibc
7857
7858 : locate the flags for 'access()'
7859 case "$d_access" in
7860 "$define")
7861         echo " "
7862         $cat >access.c <<'EOCP'
7863 #include <sys/types.h>
7864 #ifdef I_FCNTL
7865 #include <fcntl.h>
7866 #endif
7867 #ifdef I_SYS_FILE
7868 #include <sys/file.h>
7869 #endif
7870 #ifdef I_UNISTD
7871 #include <unistd.h>
7872 #endif
7873 int main() {
7874         exit(R_OK);
7875 }
7876 EOCP
7877         : check sys/file.h first, no particular reason here
7878         if $test `./findhdr sys/file.h` && \
7879                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7880                 h_sysfile=true;
7881                 echo "<sys/file.h> defines the *_OK access constants." >&4
7882         elif $test `./findhdr fcntl.h` && \
7883                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7884                 h_fcntl=true;
7885                 echo "<fcntl.h> defines the *_OK access constants." >&4
7886         elif $test `./findhdr unistd.h` && \
7887                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7888                 echo "<unistd.h> defines the *_OK access constants." >&4
7889         else
7890                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7891         fi
7892         ;;
7893 esac
7894 $rm -f access*
7895
7896 : see if accessx exists
7897 set accessx d_accessx
7898 eval $inlibc
7899
7900 : see if alarm exists
7901 set alarm d_alarm
7902 eval $inlibc
7903
7904 : see if atolf exists
7905 set atolf d_atolf
7906 eval $inlibc
7907
7908 : see if atoll exists
7909 set atoll d_atoll
7910 eval $inlibc
7911
7912 : Look for GNU-cc style attribute checking
7913 echo " "
7914 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7915 $cat >attrib.c <<'EOCP'
7916 #include <stdio.h>
7917 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7918 EOCP
7919 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7920         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7921                 echo "Your C compiler doesn't fully support __attribute__."
7922                 val="$undef"
7923         else
7924                 echo "Your C compiler supports __attribute__."
7925                 val="$define"
7926         fi
7927 else
7928         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7929         val="$undef"
7930 fi
7931 set d_attribut
7932 eval $setvar
7933 $rm -f attrib*
7934
7935 : see if bcmp exists
7936 set bcmp d_bcmp
7937 eval $inlibc
7938
7939 : see if bcopy exists
7940 set bcopy d_bcopy
7941 eval $inlibc
7942
7943 : see if this is a unistd.h system
7944 set unistd.h i_unistd
7945 eval $inhdr
7946
7947 : see if getpgrp exists
7948 set getpgrp d_getpgrp
7949 eval $inlibc
7950
7951 case "$d_getpgrp" in
7952 "$define")
7953         echo " "
7954         echo "Checking to see which flavor of getpgrp is in use..."
7955         $cat >set.c <<EOP
7956 #$i_unistd I_UNISTD
7957 #include <sys/types.h>
7958 #ifdef I_UNISTD
7959 #  include <unistd.h>
7960 #endif
7961 int main()
7962 {
7963         if (getuid() == 0) {
7964                 printf("(I see you are running Configure as super-user...)\n");
7965                 setuid(1);
7966         }
7967 #ifdef TRY_BSD_PGRP
7968         if (getpgrp(1) == 0)
7969                 exit(0);
7970 #else
7971         if (getpgrp() > 0)
7972                 exit(0);
7973 #endif
7974         exit(1);
7975 }
7976 EOP
7977         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7978                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7979                 val="$define"
7980         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7981                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7982                 val="$undef"
7983         else
7984                 echo "I can't seem to compile and run the test program."
7985                 if ./usg; then
7986                         xxx="a USG one, i.e. you use getpgrp()."
7987                 else
7988                         # SVR4 systems can appear rather BSD-ish.
7989                         case "$i_unistd" in
7990                         $undef)
7991                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7992                                 val="$define"
7993                                 ;;
7994                         $define)
7995                                 xxx="probably a USG one, i.e. you use getpgrp()."
7996                                 val="$undef"
7997                                 ;;
7998                         esac
7999                 fi
8000                 echo "Assuming your getpgrp is $xxx" >&4
8001         fi
8002         ;;
8003 *) val="$undef";;
8004 esac
8005 set d_bsdgetpgrp
8006 eval $setvar
8007 $rm -f set set.c
8008
8009 : see if setpgrp exists
8010 set setpgrp d_setpgrp
8011 eval $inlibc
8012
8013 case "$d_setpgrp" in
8014 "$define")
8015         echo " "
8016         echo "Checking to see which flavor of setpgrp is in use..."
8017         $cat >set.c <<EOP
8018 #$i_unistd I_UNISTD
8019 #include <sys/types.h>
8020 #ifdef I_UNISTD
8021 #  include <unistd.h>
8022 #endif
8023 int main()
8024 {
8025         if (getuid() == 0) {
8026                 printf("(I see you are running Configure as super-user...)\n");
8027                 setuid(1);
8028         }
8029 #ifdef TRY_BSD_PGRP
8030         if (-1 == setpgrp(1, 1))
8031                 exit(0);
8032 #else
8033         if (setpgrp() != -1)
8034                 exit(0);
8035 #endif
8036         exit(1);
8037 }
8038 EOP
8039         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8040                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8041                 val="$define"
8042         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8043                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8044                 val="$undef"
8045         else
8046                 echo "(I can't seem to compile and run the test program.)"
8047                 if ./usg; then
8048                         xxx="a USG one, i.e. you use setpgrp()."
8049                 else
8050                         # SVR4 systems can appear rather BSD-ish.
8051                         case "$i_unistd" in
8052                         $undef)
8053                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8054                                 val="$define"
8055                                 ;;
8056                         $define)
8057                                 xxx="probably a USG one, i.e. you use setpgrp()."
8058                                 val="$undef"
8059                                 ;;
8060                         esac
8061                 fi
8062                 echo "Assuming your setpgrp is $xxx" >&4
8063         fi
8064         ;;
8065 *) val="$undef";;
8066 esac
8067 set d_bsdsetpgrp
8068 eval $setvar
8069 $rm -f set set.c
8070 : see if bzero exists
8071 set bzero d_bzero
8072 eval $inlibc
8073
8074 : see if signal is declared as pointer to function returning int or void
8075 echo " "
8076 xxx=`./findhdr signal.h`
8077 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8078 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8079         echo "You have int (*signal())() instead of void." >&4
8080         val="$undef"
8081 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8082         echo "You have void (*signal())()." >&4
8083         val="$define"
8084 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8085         echo "You have int (*signal())() instead of void." >&4
8086         val="$undef"
8087 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8088         echo "You have void (*signal())()." >&4
8089         val="$define"
8090 else
8091         case "$d_voidsig" in
8092         '')
8093         echo "I can't determine whether signal handler returns void or int..." >&4
8094                 dflt=void
8095                 rp="What type does your signal handler return?"
8096                 . ./myread
8097                 case "$ans" in
8098                 v*) val="$define";;
8099                 *) val="$undef";;
8100                 esac;;
8101         "$define")
8102                 echo "As you already told me, signal handler returns void." >&4
8103                 val="$define"
8104                 ;;
8105         *)      echo "As you already told me, signal handler returns int." >&4
8106                 val="$undef"
8107                 ;;
8108         esac
8109 fi
8110 set d_voidsig
8111 eval $setvar
8112 case "$d_voidsig" in
8113 "$define") signal_t="void";;
8114 *) signal_t="int";;
8115 esac
8116 $rm -f $$.tmp
8117
8118 : check for ability to cast large floats to 32-bit ints.
8119 echo " "
8120 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8121 if $test "$intsize" -ge 4; then
8122         xxx=int
8123 else
8124         xxx=long
8125 fi
8126 $cat >try.c <<EOCP
8127 #include <stdio.h>
8128 #include <sys/types.h>
8129 #include <signal.h>
8130 $signal_t blech(s) int s; { exit(3); }
8131 int main()
8132 {
8133         $xxx i32;
8134         double f, g;
8135         int result = 0;
8136         char str[16];
8137         signal(SIGFPE, blech);
8138
8139         /* Don't let compiler optimize the test away.  Store the number 
8140            in a writable string for gcc to pass to sscanf under HP/UX.
8141         */
8142         sprintf(str, "2147483647");
8143         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8144         g = 10 * f;
8145         i32  = ($xxx) g;
8146
8147         /* x86 processors will probably give 0x8000 0000, which is a
8148        sign change.  We don't want that.  We want to mimic SPARC
8149            behavior here, which is to preserve the sign and give
8150            back 0x7fff ffff.
8151         */
8152         if (i32 != ($xxx) f)
8153                 result |= 1;
8154         exit(result);
8155 }
8156 EOCP
8157 set try
8158 if eval $compile_ok; then
8159         ./try
8160         yyy=$?
8161 else
8162         echo "(I can't seem to compile the test program--assuming it can't)"
8163         yyy=1
8164 fi
8165 case "$yyy" in
8166 0)      val="$define"
8167         echo "Yup, it can."
8168         ;;
8169 *)      val="$undef"
8170         echo "Nope, it can't."
8171         ;;
8172 esac
8173 set d_casti32
8174 eval $setvar
8175 $rm -f try try.*
8176
8177 : check for ability to cast negative floats to unsigned
8178 echo " "
8179 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8180 $cat >try.c <<EOCP
8181 #include <stdio.h>
8182 #include <sys/types.h>
8183 #include <signal.h>
8184 $signal_t blech(s) int s; { exit(7); }
8185 $signal_t blech_in_list(s) int s; { exit(4); }
8186 unsigned long dummy_long(p) unsigned long p; { return p; }
8187 unsigned int dummy_int(p) unsigned int p; { return p; }
8188 unsigned short dummy_short(p) unsigned short p; { return p; }
8189 int main()
8190 {
8191         double f;
8192         unsigned long along;
8193         unsigned int aint;
8194         unsigned short ashort;
8195         int result = 0;
8196         char str[16];
8197         
8198         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8199            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8200            optimized the whole file away
8201         */
8202         /* Store the number in a writable string for gcc to pass to 
8203            sscanf under HP/UX.
8204         */
8205         sprintf(str, "-123");
8206         sscanf(str, "%lf", &f);  /* f = -123.; */
8207
8208         signal(SIGFPE, blech);
8209         along = (unsigned long)f;
8210         aint = (unsigned int)f;
8211         ashort = (unsigned short)f;
8212         if (along != (unsigned long)-123)
8213                 result |= 1;
8214         if (aint != (unsigned int)-123)
8215                 result |= 1;
8216         if (ashort != (unsigned short)-123)
8217                 result |= 1;
8218         sprintf(str, "1073741824.");
8219         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8220         f = f + f;
8221         along = 0;
8222         along = (unsigned long)f;
8223         if (along != 0x80000000)
8224                 result |= 2;
8225         f -= 1.;
8226         along = 0;
8227         along = (unsigned long)f;
8228         if (along != 0x7fffffff)
8229                 result |= 1;
8230         f += 2.;
8231         along = 0;
8232         along = (unsigned long)f;
8233         if (along != 0x80000001)
8234                 result |= 2;
8235         if (result)
8236                 exit(result);
8237         signal(SIGFPE, blech_in_list);
8238         sprintf(str, "123.");
8239         sscanf(str, "%lf", &f);  /* f = 123.; */
8240         along = dummy_long((unsigned long)f);
8241         aint = dummy_int((unsigned int)f);
8242         ashort = dummy_short((unsigned short)f);
8243         if (along != (unsigned long)123)
8244                 result |= 4;
8245         if (aint != (unsigned int)123)
8246                 result |= 4;
8247         if (ashort != (unsigned short)123)
8248                 result |= 4;
8249         exit(result);
8250
8251 }
8252 EOCP
8253 set try
8254 if eval $compile_ok; then
8255         ./try
8256         castflags=$?
8257 else
8258         echo "(I can't seem to compile the test program--assuming it can't)"
8259         castflags=7
8260 fi
8261 case "$castflags" in
8262 0)      val="$define"
8263         echo "Yup, it can."
8264         ;;
8265 *)      val="$undef"
8266         echo "Nope, it can't."
8267         ;;
8268 esac
8269 set d_castneg
8270 eval $setvar
8271 $rm -f try.*
8272
8273 : see if vprintf exists
8274 echo " "
8275 if set vprintf val -f d_vprintf; eval $csym; $val; then
8276         echo 'vprintf() found.' >&4
8277         val="$define"
8278         $cat >vprintf.c <<'EOF'
8279 #include <varargs.h>
8280
8281 int main() { xxx("foo"); }
8282
8283 xxx(va_alist)
8284 va_dcl
8285 {
8286         va_list args;
8287         char buf[10];
8288
8289         va_start(args);
8290         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8291 }
8292 EOF
8293         set vprintf
8294         if eval $compile && ./vprintf; then
8295                 echo "Your vsprintf() returns (int)." >&4
8296                 val2="$undef"
8297         else
8298                 echo "Your vsprintf() returns (char*)." >&4
8299                 val2="$define"
8300         fi
8301 else
8302         echo 'vprintf() NOT found.' >&4
8303                 val="$undef"
8304                 val2="$undef"
8305 fi
8306 set d_vprintf
8307 eval $setvar
8308 val=$val2
8309 set d_charvspr
8310 eval $setvar
8311
8312 : see if chown exists
8313 set chown d_chown
8314 eval $inlibc
8315
8316 : see if chroot exists
8317 set chroot d_chroot
8318 eval $inlibc
8319
8320 : see if chsize exists
8321 set chsize d_chsize
8322 eval $inlibc
8323
8324 : check for const keyword
8325 echo " "
8326 echo 'Checking to see if your C compiler knows about "const"...' >&4
8327 $cat >const.c <<'EOCP'
8328 typedef struct spug { int drokk; } spug;
8329 int main()
8330 {
8331         const char *foo;
8332         const spug y;
8333 }
8334 EOCP
8335 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8336         val="$define"
8337         echo "Yup, it does."
8338 else
8339         val="$undef"
8340         echo "Nope, it doesn't."
8341 fi
8342 set d_const
8343 eval $setvar
8344
8345 : see if crypt exists
8346 echo " "
8347 if set crypt val -f d_crypt; eval $csym; $val; then
8348         echo 'crypt() found.' >&4
8349         val="$define"
8350         cryptlib=''
8351 else
8352         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8353         if $test -z "$cryptlib"; then
8354                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8355         else
8356                 cryptlib=-lcrypt
8357         fi
8358         if $test -z "$cryptlib"; then
8359                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8360         else
8361                 cryptlib=-lcrypt
8362         fi
8363         if $test -z "$cryptlib"; then
8364                 cryptlib=`./loc libcrypt$_a "" $libpth`
8365         else
8366                 cryptlib=-lcrypt
8367         fi
8368         if $test -z "$cryptlib"; then
8369                 echo 'crypt() NOT found.' >&4
8370                 val="$undef"
8371         else
8372                 val="$define"
8373         fi
8374 fi
8375 set d_crypt
8376 eval $setvar
8377
8378 : get csh whereabouts
8379 case "$csh" in
8380 'csh') val="$undef" ;;
8381 *) val="$define" ;;
8382 esac
8383 set d_csh
8384 eval $setvar
8385 : Respect a hint or command line value for full_csh.
8386 case "$full_csh" in
8387 '') full_csh=$csh ;;
8388 esac
8389
8390 : see if cuserid exists
8391 set cuserid d_cuserid
8392 eval $inlibc
8393
8394 : see if this is a limits.h system
8395 set limits.h i_limits
8396 eval $inhdr
8397
8398 : see if this is a float.h system
8399 set float.h i_float
8400 eval $inhdr
8401
8402 : See if number of significant digits in a double precision number is known
8403 echo " "
8404 $cat >dbl_dig.c <<EOM
8405 #$i_limits I_LIMITS
8406 #$i_float I_FLOAT
8407 #ifdef I_LIMITS
8408 #include <limits.h>
8409 #endif
8410 #ifdef I_FLOAT
8411 #include <float.h>
8412 #endif
8413 #ifdef DBL_DIG
8414 printf("Contains DBL_DIG");
8415 #endif
8416 EOM
8417 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8418 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8419         echo "DBL_DIG found." >&4
8420         val="$define"
8421 else
8422         echo "DBL_DIG NOT found." >&4
8423         val="$undef"
8424 fi
8425 $rm -f dbl_dig.?
8426 set d_dbl_dig
8427 eval $setvar
8428
8429 : see if difftime exists
8430 set difftime d_difftime
8431 eval $inlibc
8432
8433 : see if this is a dirent system
8434 echo " "
8435 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8436         val="$define"
8437         echo "<dirent.h> found." >&4
8438 else
8439         val="$undef"
8440         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8441                 echo "<sys/dir.h> found." >&4
8442                 echo " "
8443         else
8444                 xinc=`./findhdr sys/ndir.h`
8445         fi
8446         echo "<dirent.h> NOT found." >&4
8447 fi
8448 set i_dirent
8449 eval $setvar
8450
8451 : Look for type of directory structure.
8452 echo " "
8453 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8454
8455 case "$direntrytype" in
8456 ''|' ')
8457         case "$i_dirent" in
8458         $define) guess1='struct dirent' ;;
8459         *) guess1='struct direct'  ;;
8460         esac
8461         ;;
8462 *)      guess1="$direntrytype"
8463         ;;
8464 esac
8465
8466 case "$guess1" in
8467 'struct dirent') guess2='struct direct' ;;
8468 *) guess2='struct dirent' ;;
8469 esac
8470                 
8471 if $contains "$guess1" try.c >/dev/null 2>&1; then
8472         direntrytype="$guess1"
8473         echo "Your directory entries are $direntrytype." >&4
8474 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8475         direntrytype="$guess2"
8476         echo "Your directory entries seem to be $direntrytype." >&4
8477 else
8478         echo "I don't recognize your system's directory entries." >&4
8479         rp="What type is used for directory entries on this system?"
8480         dflt="$guess1"
8481         . ./myread
8482         direntrytype="$ans"
8483 fi
8484 $rm -f try.c
8485
8486
8487 : see if the directory entry stores field length
8488 echo " "
8489 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8490 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8491         echo "Good, your directory entry keeps length information in d_namlen." >&4
8492         val="$define"
8493 else
8494         echo "Your directory entry does not know about the d_namlen field." >&4
8495         val="$undef"
8496 fi
8497 set d_dirnamlen
8498 eval $setvar
8499 $rm -f try.c
8500
8501 : see if dlerror exists
8502 xxx_runnm="$runnm"
8503 runnm=false
8504 set dlerror d_dlerror
8505 eval $inlibc
8506 runnm="$xxx_runnm"
8507
8508 : see if dlfcn is available
8509 set dlfcn.h i_dlfcn
8510 eval $inhdr
8511
8512 case "$usedl" in
8513 $define|y|true)
8514         $cat << EOM
8515
8516 On a few systems, the dynamically loaded modules that perl generates and uses
8517 will need a different extension than shared libs. The default will probably
8518 be appropriate.
8519
8520 EOM
8521         case "$dlext" in
8522         '')     dflt="$so" ;;
8523         *)      dflt="$dlext" ;;
8524         esac
8525         rp='What is the extension of dynamically loaded modules'
8526         . ./myread
8527         dlext="$ans"
8528         ;;
8529 *)
8530         dlext="none"
8531         ;;
8532 esac
8533
8534 : Check if dlsym need a leading underscore
8535 echo " "
8536 val="$undef"
8537
8538 case "$dlsrc" in
8539 dl_dlopen.xs)
8540         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8541         $cat >dyna.c <<'EOM'
8542 fred () { }
8543 EOM
8544
8545 $cat >fred.c<<EOM
8546
8547 #include <stdio.h>
8548 #$i_dlfcn I_DLFCN
8549 #ifdef I_DLFCN
8550 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8551 #else
8552 #include <sys/types.h>
8553 #include <nlist.h>
8554 #include <link.h>
8555 #endif
8556
8557 extern int fred() ;
8558
8559 int main()
8560 {
8561     void * handle ;
8562     void * symbol ;
8563 #ifndef RTLD_LAZY
8564     int mode = 1 ;
8565 #else
8566     int mode = RTLD_LAZY ;
8567 #endif
8568     handle = dlopen("./dyna.$dlext", mode) ;
8569     if (handle == NULL) {
8570         printf ("1\n") ;
8571         fflush (stdout) ;
8572         exit(0);
8573     }
8574     symbol = dlsym(handle, "fred") ;
8575     if (symbol == NULL) {
8576         /* try putting a leading underscore */
8577         symbol = dlsym(handle, "_fred") ;
8578         if (symbol == NULL) {
8579             printf ("2\n") ;
8580             fflush (stdout) ;
8581             exit(0);
8582         }
8583         printf ("3\n") ;
8584     }
8585     else
8586         printf ("4\n") ;
8587     fflush (stdout) ;
8588     exit(0);
8589 }
8590 EOM
8591         : Call the object file tmp-dyna.o in case dlext=o.
8592         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8593                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8594                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8595                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8596                 xxx=`./fred`
8597                 case $xxx in
8598                 1)      echo "Test program failed using dlopen." >&4
8599                         echo "Perhaps you should not use dynamic loading." >&4;;
8600                 2)      echo "Test program failed using dlsym." >&4
8601                         echo "Perhaps you should not use dynamic loading." >&4;;
8602                 3)      echo "dlsym needs a leading underscore" >&4
8603                         val="$define" ;;
8604                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8605                 esac
8606         else
8607                 echo "I can't compile and run the test program." >&4
8608                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8609         fi
8610         ;;
8611 esac
8612                 
8613 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8614
8615 set d_dlsymun
8616 eval $setvar
8617
8618 hasproto='varname=$1; func=$2; shift; shift;
8619 while $test $# -ge 2; do
8620         case "$1" in
8621         $define) echo "#include <$2>";;
8622         esac ;
8623     shift 2;
8624 done > try.c;
8625 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8626 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8627         echo "$func() prototype found.";
8628         val="$define";
8629 else
8630         echo "$func() prototype NOT found.";
8631         val="$undef";
8632 fi;
8633 set $varname;
8634 eval $setvar;
8635 $rm -f try.c tryout.c'
8636
8637 : see if prototype for drand48 is available
8638 echo " "
8639 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8640 eval $hasproto
8641
8642 : see if dup2 exists
8643 set dup2 d_dup2
8644 eval $inlibc
8645
8646 : see if eaccess exists
8647 set eaccess d_eaccess
8648 eval $inlibc
8649
8650 : see if endgrent exists
8651 set endgrent d_endgrent
8652 eval $inlibc
8653
8654 : see if endhostent exists
8655 set endhostent d_endhent
8656 eval $inlibc
8657
8658 : see if endnetent exists
8659 set endnetent d_endnent
8660 eval $inlibc
8661
8662 : see if endprotoent exists
8663 set endprotoent d_endpent
8664 eval $inlibc
8665
8666 : see if endpwent exists
8667 set endpwent d_endpwent
8668 eval $inlibc
8669
8670 : see if endservent exists
8671 set endservent d_endsent
8672 eval $inlibc
8673
8674 : Locate the flags for 'open()'
8675 echo " "
8676 $cat >open3.c <<'EOCP'
8677 #include <sys/types.h>
8678 #ifdef I_FCNTL
8679 #include <fcntl.h>
8680 #endif
8681 #ifdef I_SYS_FILE
8682 #include <sys/file.h>
8683 #endif
8684 int main() {
8685         if(O_RDONLY);
8686 #ifdef O_TRUNC
8687         exit(0);
8688 #else
8689         exit(1);
8690 #endif
8691 }
8692 EOCP
8693 : check sys/file.h first to get FREAD on Sun
8694 if $test `./findhdr sys/file.h` && \
8695                 set open3 -DI_SYS_FILE && eval $compile; then
8696         h_sysfile=true;
8697         echo "<sys/file.h> defines the O_* constants..." >&4
8698         if ./open3; then
8699                 echo "and you have the 3 argument form of open()." >&4
8700                 val="$define"
8701         else
8702                 echo "but not the 3 argument form of open().  Oh, well." >&4
8703                 val="$undef"
8704         fi
8705 elif $test `./findhdr fcntl.h` && \
8706                 set open3 -DI_FCNTL && eval $compile; then
8707         h_fcntl=true;
8708         echo "<fcntl.h> defines the O_* constants..." >&4
8709         if ./open3; then
8710                 echo "and you have the 3 argument form of open()." >&4
8711                 val="$define"
8712         else
8713                 echo "but not the 3 argument form of open().  Oh, well." >&4
8714                 val="$undef"
8715         fi
8716 else
8717         val="$undef"
8718         echo "I can't find the O_* constant definitions!  You got problems." >&4
8719 fi
8720 set d_open3
8721 eval $setvar
8722 $rm -f open3*
8723
8724 : see which of string.h or strings.h is needed
8725 echo " "
8726 strings=`./findhdr string.h`
8727 if $test "$strings" && $test -r "$strings"; then
8728         echo "Using <string.h> instead of <strings.h>." >&4
8729         val="$define"
8730 else
8731         val="$undef"
8732         strings=`./findhdr strings.h`
8733         if $test "$strings" && $test -r "$strings"; then
8734                 echo "Using <strings.h> instead of <string.h>." >&4
8735         else
8736                 echo "No string header found -- You'll surely have problems." >&4
8737         fi
8738 fi
8739 set i_string
8740 eval $setvar
8741 case "$i_string" in
8742 "$undef") strings=`./findhdr strings.h`;;
8743 *)        strings=`./findhdr string.h`;;
8744 esac
8745
8746 : check for non-blocking I/O stuff
8747 case "$h_sysfile" in
8748 true) echo "#include <sys/file.h>" > head.c;;
8749 *)
8750         case "$h_fcntl" in
8751         true) echo "#include <fcntl.h>" > head.c;;
8752         *) echo "#include <sys/fcntl.h>" > head.c;;
8753         esac
8754         ;;
8755 esac
8756 echo " "
8757 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8758 case "$o_nonblock" in
8759 '')
8760         $cat head.c > try.c
8761         $cat >>try.c <<'EOCP'
8762 #include <stdio.h>
8763 int main() {
8764 #ifdef O_NONBLOCK
8765         printf("O_NONBLOCK\n");
8766         exit(0);
8767 #endif
8768 #ifdef O_NDELAY
8769         printf("O_NDELAY\n");
8770         exit(0);
8771 #endif
8772 #ifdef FNDELAY
8773         printf("FNDELAY\n");
8774         exit(0);
8775 #endif
8776         exit(0);
8777 }
8778 EOCP
8779         set try
8780         if eval $compile_ok; then
8781                 o_nonblock=`./try`
8782                 case "$o_nonblock" in
8783                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8784                 *) echo "Seems like we can use $o_nonblock.";;
8785                 esac
8786         else
8787                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8788         fi
8789         ;;
8790 *) echo "Using $hint value $o_nonblock.";;
8791 esac
8792 $rm -f try try.* .out core
8793
8794 echo " "
8795 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8796 case "$eagain" in
8797 '')
8798         $cat head.c > try.c
8799         $cat >>try.c <<EOCP
8800 #include <errno.h>
8801 #include <sys/types.h>
8802 #include <signal.h>
8803 #include <stdio.h> 
8804 #define MY_O_NONBLOCK $o_nonblock
8805 #ifndef errno  /* XXX need better Configure test */
8806 extern int errno;
8807 #endif
8808 #$i_unistd I_UNISTD
8809 #ifdef I_UNISTD
8810 #include <unistd.h>
8811 #endif
8812 #$i_string I_STRING
8813 #ifdef I_STRING
8814 #include <string.h>
8815 #else
8816 #include <strings.h>
8817 #endif
8818 $signal_t blech(x) int x; { exit(3); }
8819 EOCP
8820         $cat >> try.c <<'EOCP'
8821 int main()
8822 {
8823         int pd[2];
8824         int pu[2];
8825         char buf[1];
8826         char string[100];
8827
8828         pipe(pd);       /* Down: child -> parent */
8829         pipe(pu);       /* Up: parent -> child */
8830         if (0 != fork()) {
8831                 int ret;
8832                 close(pd[1]);   /* Parent reads from pd[0] */
8833                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8834                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8835                         exit(1);
8836                 signal(SIGALRM, blech);
8837                 alarm(5);
8838                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8839                         exit(2);
8840                 sprintf(string, "%d\n", ret);
8841                 write(2, string, strlen(string));
8842                 alarm(0);
8843 #ifdef EAGAIN
8844                 if (errno == EAGAIN) {
8845                         printf("EAGAIN\n");
8846                         goto ok;
8847                 }
8848 #endif
8849 #ifdef EWOULDBLOCK
8850                 if (errno == EWOULDBLOCK)
8851                         printf("EWOULDBLOCK\n");
8852 #endif
8853         ok:
8854                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8855                 sleep(2);                               /* Give it time to close our pipe */
8856                 alarm(5);
8857                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8858                 alarm(0);
8859                 sprintf(string, "%d\n", ret);
8860                 write(3, string, strlen(string));
8861                 exit(0);
8862         }
8863
8864         close(pd[0]);                   /* We write to pd[1] */
8865         close(pu[1]);                   /* We read from pu[0] */
8866         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8867         close(pd[1]);                   /* Pipe pd is now fully closed! */
8868         exit(0);                                /* Bye bye, thank you for playing! */
8869 }
8870 EOCP
8871         set try
8872         if eval $compile_ok; then
8873                 echo "$startsh" >mtry
8874                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8875                 chmod +x mtry
8876                 ./mtry >/dev/null 2>&1
8877                 case $? in
8878                 0) eagain=`$cat try.out`;;
8879                 1) echo "Could not perform non-blocking setting!";;
8880                 2) echo "I did a successful read() for something that was not there!";;
8881                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8882                 *) echo "Something terribly wrong happened during testing.";;
8883                 esac
8884                 rd_nodata=`$cat try.ret`
8885                 echo "A read() system call with no data present returns $rd_nodata."
8886                 case "$rd_nodata" in
8887                 0|-1) ;;
8888                 *)
8889                         echo "(That's peculiar, fixing that to be -1.)"
8890                         rd_nodata=-1
8891                         ;;
8892                 esac
8893                 case "$eagain" in
8894                 '')
8895                         echo "Forcing errno EAGAIN on read() with no data available."
8896                         eagain=EAGAIN
8897                         ;;
8898                 *)
8899                         echo "Your read() sets errno to $eagain when no data is available."
8900                         ;;
8901                 esac
8902                 status=`$cat try.err`
8903                 case "$status" in
8904                 0) echo "And it correctly returns 0 to signal EOF.";;
8905                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8906                 *) echo "However, your read() returns '$status' on EOF??";;
8907                 esac
8908                 val="$define"
8909                 if test "$status" = "$rd_nodata"; then
8910                         echo "WARNING: you can't distinguish between EOF and no data!"
8911                         val="$undef"
8912                 fi
8913         else
8914                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8915                 eagain=EAGAIN
8916         fi
8917         set d_eofnblk
8918         eval $setvar
8919         ;;
8920 *)
8921         echo "Using $hint value $eagain."
8922         echo "Your read() returns $rd_nodata when no data is present."
8923         case "$d_eofnblk" in
8924         "$define") echo "And you can see EOF because read() returns 0.";;
8925         "$undef") echo "But you can't see EOF status from read() returned value.";;
8926         *)
8927                 echo "(Assuming you can't see EOF status from read anyway.)"
8928                 d_eofnblk=$undef
8929                 ;;
8930         esac
8931         ;;
8932 esac
8933 $rm -f try try.* .out core head.c mtry
8934
8935 : see if fchmod exists
8936 set fchmod d_fchmod
8937 eval $inlibc
8938
8939 : see if fchown exists
8940 set fchown d_fchown
8941 eval $inlibc
8942
8943 : see if this is an fcntl system
8944 set fcntl d_fcntl
8945 eval $inlibc
8946
8947 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8948 while $test $# -ge 2; do
8949         case "$1" in
8950         $define) echo "#include <$2>";;
8951         esac ;
8952     shift 2;
8953 done > try.c;
8954 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8955 set try;
8956 if eval $compile; then
8957         val="$define";
8958 else
8959         val="$undef";
8960 fi;
8961 set $varname;
8962 eval $setvar;
8963 $rm -f try.c try.o'
8964
8965 socketlib=''
8966 sockethdr=''
8967 : see whether socket exists
8968 echo " "
8969 $echo $n "Hmm... $c" >&4
8970 if set socket val -f d_socket; eval $csym; $val; then
8971         echo "Looks like you have Berkeley networking support." >&4
8972         d_socket="$define"
8973         if set setsockopt val -f; eval $csym; $val; then
8974                 d_oldsock="$undef"
8975         else
8976                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8977                 d_oldsock="$define"
8978         fi
8979 else
8980         if $contains socklib libc.list >/dev/null 2>&1; then
8981                 echo "Looks like you have Berkeley networking support." >&4
8982                 d_socket="$define"
8983                 : we will have to assume that it supports the 4.2 BSD interface
8984                 d_oldsock="$undef"
8985         else
8986                 echo "You don't have Berkeley networking in libc$_a..." >&4
8987                 if test "X$d_socket" = "X$define"; then
8988                    echo "...but you seem to believe that you have sockets." >&4
8989                 else
8990                         for net in net socket
8991                         do
8992                                 if test -f /usr/lib/lib$net$_a; then
8993                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8994                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8995                                         if $contains socket libc.list >/dev/null 2>&1; then
8996                                                 d_socket="$define"
8997                                                 socketlib="-l$net"
8998                                                 case "$net" in
8999                                                 net)
9000                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9001                                                         sockethdr="-I/usr/netinclude"
9002                                                         ;;
9003                                                 esac
9004                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9005                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9006                                                         d_oldsock="$undef"
9007                                                 else
9008                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9009                                                         d_oldsock="$define"
9010                                                 fi
9011                                                 break
9012                                         fi
9013                                 fi
9014                         done
9015                         if test "X$d_socket" != "X$define"; then
9016                            echo "or anywhere else I see." >&4
9017                            d_socket="$undef"
9018                            d_oldsock="$undef"
9019                         fi
9020                 fi
9021         fi
9022 fi
9023
9024 : see if socketpair exists
9025 set socketpair d_sockpair
9026 eval $inlibc
9027
9028
9029 echo " "
9030 echo "Checking the availability of certain socket constants..." >& 4
9031 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9032         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9033         $cat >try.c <<EOF
9034 #include <sys/types.h>
9035 #include <sys/socket.h>
9036 int main() {
9037     int i = $ENUM;
9038 }
9039 EOF
9040         val="$undef"
9041         set try; if eval $compile; then
9042                 val="$define"
9043         fi
9044         set d_${enum}; eval $setvar
9045         $rm -f try.c try
9046 done
9047
9048 : see if sys/select.h has to be included
9049 set sys/select.h i_sysselct
9050 eval $inhdr
9051
9052 : see if we should include time.h, sys/time.h, or both
9053 echo " "
9054 if test "X$timeincl" = X; then
9055         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9056         $echo $n "I'm now running the test program...$c"
9057         $cat >try.c <<'EOCP'
9058 #include <sys/types.h>
9059 #ifdef I_TIME
9060 #include <time.h>
9061 #endif
9062 #ifdef I_SYSTIME
9063 #ifdef SYSTIMEKERNEL
9064 #define KERNEL
9065 #endif
9066 #include <sys/time.h>
9067 #endif
9068 #ifdef I_SYSSELECT
9069 #include <sys/select.h>
9070 #endif
9071 int main()
9072 {
9073         struct tm foo;
9074 #ifdef S_TIMEVAL
9075         struct timeval bar;
9076 #endif
9077 #ifdef S_TIMEZONE
9078         struct timezone tzp;
9079 #endif
9080         if (foo.tm_sec == foo.tm_sec)
9081                 exit(0);
9082 #ifdef S_TIMEVAL
9083         if (bar.tv_sec == bar.tv_sec)
9084                 exit(0);
9085 #endif
9086         exit(1);
9087 }
9088 EOCP
9089         flags=''
9090         for s_timezone in '-DS_TIMEZONE' ''; do
9091         sysselect=''
9092         for s_timeval in '-DS_TIMEVAL' ''; do
9093         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9094         for i_time in '' '-DI_TIME'; do
9095         for i_systime in '-DI_SYSTIME' ''; do
9096                 case "$flags" in
9097                 '') $echo $n ".$c"
9098                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9099                         if eval $compile; then
9100                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9101                                 shift
9102                                 flags="$*"
9103                                 echo " "
9104                                 $echo $n "Succeeded with $flags$c"
9105                         fi
9106                         ;;
9107                 esac
9108         done
9109         done
9110         done
9111         done
9112         done
9113         timeincl=''
9114         echo " "
9115         case "$flags" in
9116         *SYSTIMEKERNEL*) i_systimek="$define"
9117                 timeincl=`./findhdr sys/time.h`
9118                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9119         *) i_systimek="$undef";;
9120         esac
9121         case "$flags" in
9122         *I_TIME*) i_time="$define"
9123                 timeincl=`./findhdr time.h`" $timeincl"
9124                 echo "We'll include <time.h>." >&4;;
9125         *) i_time="$undef";;
9126         esac
9127         case "$flags" in
9128         *I_SYSTIME*) i_systime="$define"
9129                 timeincl=`./findhdr sys/time.h`" $timeincl"
9130                 echo "We'll include <sys/time.h>." >&4;;
9131         *) i_systime="$undef";;
9132         esac
9133         $rm -f try.c try
9134 fi
9135
9136 : check for fd_set items
9137 $cat <<EOM
9138
9139 Checking to see how well your C compiler handles fd_set and friends ...
9140 EOM
9141 $cat >fd_set.c <<EOCP
9142 #$i_systime I_SYS_TIME
9143 #$i_sysselct I_SYS_SELECT
9144 #$d_socket HAS_SOCKET
9145 #include <sys/types.h>
9146 #ifdef HAS_SOCKET
9147 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9148 #endif
9149 #ifdef I_SYS_TIME
9150 #include <sys/time.h>
9151 #endif
9152 #ifdef I_SYS_SELECT
9153 #include <sys/select.h>
9154 #endif
9155 int main() {
9156         fd_set fds;
9157
9158 #ifdef TRYBITS
9159         if(fds.fds_bits);
9160 #endif
9161
9162 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9163         exit(0);
9164 #else
9165         exit(1);
9166 #endif
9167 }
9168 EOCP
9169 set fd_set -DTRYBITS
9170 if eval $compile; then
9171         d_fds_bits="$define"
9172         d_fd_set="$define"
9173         echo "Well, your system knows about the normal fd_set typedef..." >&4
9174         if ./fd_set; then
9175                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9176                 d_fd_macros="$define"
9177         else
9178                 $cat >&4 <<'EOM'
9179 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9180 EOM
9181                 d_fd_macros="$undef"
9182         fi
9183 else
9184         $cat <<'EOM'
9185 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9186 EOM
9187         set fd_set
9188         if eval $compile; then
9189                 d_fds_bits="$undef"
9190                 d_fd_set="$define"
9191                 echo "Well, your system has some sort of fd_set available..." >&4
9192                 if ./fd_set; then
9193                         echo "and you have the normal fd_set macros." >&4
9194                         d_fd_macros="$define"
9195                 else
9196                         $cat <<'EOM'
9197 but not the normal fd_set macros!  Gross!  More work for me...
9198 EOM
9199                         d_fd_macros="$undef"
9200                 fi
9201         else
9202         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9203                 d_fd_set="$undef"
9204                 d_fds_bits="$undef"
9205                 d_fd_macros="$undef"
9206         fi
9207 fi
9208 $rm -f fd_set*
9209
9210 : see if fgetpos exists
9211 set fgetpos d_fgetpos
9212 eval $inlibc
9213
9214 : see if flock exists
9215 set flock d_flock
9216 eval $inlibc
9217
9218 : see if fork exists
9219 set fork d_fork
9220 eval $inlibc
9221
9222 : see if pathconf exists
9223 set pathconf d_pathconf
9224 eval $inlibc
9225
9226 : see if fpathconf exists
9227 set fpathconf d_fpathconf
9228 eval $inlibc
9229
9230
9231 : check for fpos64_t
9232 echo " "
9233 echo "Checking to see if you have fpos64_t..." >&4
9234 $cat >try.c <<EOCP
9235 #include <stdio.h>
9236 int main() { fpos64_t x = 7; }
9237 EOCP
9238 set try
9239 if eval $compile; then
9240         val="$define"
9241         echo "You have fpos64_t."
9242 else
9243         val="$undef"
9244         echo "You do not have fpos64_t."
9245         case "$fpossize" in
9246         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9247         esac
9248 fi
9249 $rm -f try.* try
9250 set d_fpos64_t
9251 eval $setvar
9252
9253 : see if frexpl exists
9254 set frexpl d_frexpl
9255 eval $inlibc
9256
9257 hasstruct='varname=$1; struct=$2; shift; shift;
9258 while $test $# -ge 2; do
9259         case "$1" in
9260         $define) echo "#include <$2>";;
9261         esac ;
9262     shift 2;
9263 done > try.c;
9264 echo "int main () { struct $struct foo; }" >> try.c;
9265 set try;
9266 if eval $compile; then
9267         val="$define";
9268 else
9269         val="$undef";
9270 fi;
9271 set $varname;
9272 eval $setvar;
9273 $rm -f try.c try.o'
9274
9275 : see if this is a sys/param system
9276 set sys/param.h i_sysparam
9277 eval $inhdr
9278
9279 : see if this is a sys/mount.h system
9280 set sys/mount.h i_sysmount
9281 eval $inhdr
9282
9283 : see if sys/types.h has to be included
9284 set sys/types.h i_systypes
9285 eval $inhdr
9286
9287
9288 echo " "
9289 echo "Checking to see if your system supports struct fs_data..." >&4
9290 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9291 eval $hasstruct
9292 case "$d_fs_data_s" in
9293 "$define")      echo "Yes, it does."   ;;
9294 *)              echo "No, it doesn't." ;;
9295 esac
9296
9297 : see if fseeko exists
9298 set fseeko d_fseeko
9299 eval $inlibc
9300 case "$longsize" in
9301 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9302 esac
9303
9304 : see if fsetpos exists
9305 set fsetpos d_fsetpos
9306 eval $inlibc
9307
9308
9309 : see if fstatfs exists
9310 set fstatfs d_fstatfs
9311 eval $inlibc
9312
9313
9314 : see if statvfs exists
9315 set statvfs d_statvfs
9316 eval $inlibc
9317
9318 : see if fstatvfs exists
9319 set fstatvfs d_fstatvfs
9320 eval $inlibc
9321
9322
9323 : see if ftello exists
9324 set ftello d_ftello
9325 eval $inlibc
9326 case "$longsize" in
9327 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9328 esac
9329
9330 : see if getcwd exists
9331 set getcwd d_getcwd
9332 eval $inlibc
9333
9334 : see if getespwnam exists
9335 set getespwnam d_getespwnam
9336 eval $inlibc
9337
9338
9339 : see if getfsstat exists
9340 set getfsstat d_getfsstat
9341 eval $inlibc
9342
9343 : see if getgrent exists
9344 set getgrent d_getgrent
9345 eval $inlibc
9346
9347 : see if gethostbyaddr exists
9348 set gethostbyaddr d_gethbyaddr
9349 eval $inlibc
9350
9351 : see if gethostbyname exists
9352 set gethostbyname d_gethbyname
9353 eval $inlibc
9354
9355 : see if gethostent exists
9356 set gethostent d_gethent
9357 eval $inlibc
9358
9359 : see how we will look up host name
9360 echo " "
9361 call=''
9362 if set gethostname val -f d_gethname; eval $csym; $val; then
9363         echo 'gethostname() found.' >&4
9364         d_gethname="$define"
9365         call=gethostname
9366 fi
9367 if set uname val -f d_uname; eval $csym; $val; then
9368         if ./xenix; then
9369                 $cat <<'EOM'
9370 uname() was found, but you're running xenix, and older versions of xenix
9371 have a broken uname(). If you don't really know whether your xenix is old
9372 enough to have a broken system call, use the default answer.
9373
9374 EOM
9375                 dflt=y
9376                 case "$d_uname" in
9377                 "$define") dflt=n;;
9378                 esac
9379                 rp='Is your uname() broken?'
9380                 . ./myread
9381                 case "$ans" in
9382                 n*) d_uname="$define"; call=uname;;
9383                 esac
9384         else
9385                 echo 'uname() found.' >&4
9386                 d_uname="$define"
9387                 case "$call" in
9388                 '') call=uname ;;
9389                 esac
9390         fi
9391 fi
9392 case "$d_gethname" in
9393 '') d_gethname="$undef";;
9394 esac
9395 case "$d_uname" in
9396 '') d_uname="$undef";;
9397 esac
9398 case "$d_uname$d_gethname" in
9399 *define*)
9400         dflt=n
9401         cat <<EOM
9402  
9403 Every now and then someone has a $call() that lies about the hostname
9404 but can't be fixed for political or economic reasons.  If you wish, I can
9405 pretend $call() isn't there and maybe compute hostname at run-time
9406 thanks to the '$phostname' command.
9407
9408 EOM
9409         rp="Shall I ignore $call() from now on?"
9410         . ./myread
9411         case "$ans" in
9412         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9413         esac;;
9414 esac
9415 case "$phostname" in
9416 '') aphostname='';;
9417 *) case "$aphostname" in
9418         /*) ;;
9419         *) set X $phostname
9420                 shift
9421                 file=$1
9422                 shift
9423                 file=`./loc $file $file $pth`
9424                 aphostname=`echo $file $*`
9425                 ;;
9426         esac
9427         ;;
9428 esac
9429 case "$d_uname$d_gethname" in
9430 *define*) ;;
9431 *)
9432         case "$phostname" in
9433         '')
9434                 echo "There will be no way for $package to get your hostname." >&4;;
9435         *)
9436         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9437                 ;;
9438         esac;;
9439 esac
9440 case "$d_phostname" in
9441 '') d_phostname="$undef";;
9442 esac
9443
9444 : see if this is a netdb.h system
9445 set netdb.h i_netdb
9446 eval $inhdr
9447
9448 : see if prototypes for various gethostxxx netdb.h functions are available
9449 echo " "
9450 set d_gethostprotos gethostent $i_netdb netdb.h
9451 eval $hasproto
9452
9453 : see if getlogin exists
9454 set getlogin d_getlogin
9455 eval $inlibc
9456
9457 : see if getmnt exists
9458 set getmnt d_getmnt
9459 eval $inlibc
9460
9461 : see if getmntent exists
9462 set getmntent d_getmntent
9463 eval $inlibc
9464
9465 : see if getnetbyaddr exists
9466 set getnetbyaddr d_getnbyaddr
9467 eval $inlibc
9468
9469 : see if getnetbyname exists
9470 set getnetbyname d_getnbyname
9471 eval $inlibc
9472
9473 : see if getnetent exists
9474 set getnetent d_getnent
9475 eval $inlibc
9476
9477 : see if prototypes for various getnetxxx netdb.h functions are available
9478 echo " "
9479 set d_getnetprotos getnetent $i_netdb netdb.h
9480 eval $hasproto
9481
9482
9483 : see if getprotobyname exists
9484 set getprotobyname d_getpbyname
9485 eval $inlibc
9486
9487 : see if getprotobynumber exists
9488 set getprotobynumber d_getpbynumber
9489 eval $inlibc
9490
9491 : see if getprotoent exists
9492 set getprotoent d_getpent
9493 eval $inlibc
9494
9495 : see if getpgid exists
9496 set getpgid d_getpgid
9497 eval $inlibc
9498
9499 : see if getpgrp2 exists
9500 set getpgrp2 d_getpgrp2
9501 eval $inlibc
9502
9503 : see if getppid exists
9504 set getppid d_getppid
9505 eval $inlibc
9506
9507 : see if getpriority exists
9508 set getpriority d_getprior
9509 eval $inlibc
9510
9511 : see if prototypes for various getprotoxxx netdb.h functions are available
9512 echo " "
9513 set d_getprotoprotos getprotoent $i_netdb netdb.h
9514 eval $hasproto
9515
9516 : see if getprpwnam exists
9517 set getprpwnam d_getprpwnam
9518 eval $inlibc
9519
9520 : see if getpwent exists
9521 set getpwent d_getpwent
9522 eval $inlibc
9523
9524
9525 : see if getservbyname exists
9526 set getservbyname d_getsbyname
9527 eval $inlibc
9528
9529 : see if getservbyport exists
9530 set getservbyport d_getsbyport
9531 eval $inlibc
9532
9533 : see if getservent exists
9534 set getservent d_getsent
9535 eval $inlibc
9536
9537 : see if prototypes for various getservxxx netdb.h functions are available
9538 echo " "
9539 set d_getservprotos getservent $i_netdb netdb.h
9540 eval $hasproto
9541
9542 : see if getspnam exists
9543 set getspnam d_getspnam
9544 eval $inlibc
9545
9546 : see if gettimeofday or ftime exists
9547 set gettimeofday d_gettimeod
9548 eval $inlibc
9549 case "$d_gettimeod" in
9550 "$undef")
9551         set ftime d_ftime 
9552         eval $inlibc
9553         ;;
9554 *)
9555         val="$undef"; set d_ftime; eval $setvar
9556         ;;
9557 esac
9558 case "$d_gettimeod$d_ftime" in
9559 "$undef$undef")
9560         echo " "
9561         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9562         ;;
9563 esac
9564
9565 : see if this is an grp system
9566 set grp.h i_grp
9567 eval $inhdr
9568
9569 case "$i_grp" in
9570 $define)
9571         xxx=`./findhdr grp.h`
9572         $cppstdin $cppflags $cppminus < $xxx >$$.h
9573
9574         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9575                 val="$define"
9576         else
9577                 val="$undef"
9578         fi
9579         set d_grpasswd
9580         eval $setvar
9581
9582         $rm -f $$.h
9583         ;;
9584 *)
9585         val="$undef";
9586         set d_grpasswd; eval $setvar
9587         ;;
9588 esac
9589
9590 : see if hasmntopt exists
9591 set hasmntopt d_hasmntopt
9592 eval $inlibc
9593
9594 : see if this is a netinet/in.h or sys/in.h system
9595 set netinet/in.h i_niin sys/in.h i_sysin
9596 eval $inhdr
9597
9598 : see if arpa/inet.h has to be included
9599 set arpa/inet.h i_arpainet
9600 eval $inhdr
9601
9602 : see if htonl --and friends-- exists
9603 val=''
9604 set htonl val
9605 eval $inlibc
9606
9607 : Maybe they are macros.
9608 case "$val" in
9609 $undef)
9610         $cat >htonl.c <<EOM
9611 #include <stdio.h>
9612 #include <sys/types.h>
9613 #$i_niin I_NETINET_IN
9614 #$i_sysin I_SYS_IN
9615 #$i_arpainet I_ARPA_INET
9616 #ifdef I_NETINET_IN
9617 #include <netinet/in.h>
9618 #endif
9619 #ifdef I_SYS_IN
9620 #include <sys/in.h>
9621 #endif
9622 #ifdef I_ARPA_INET
9623 #include <arpa/inet.h>
9624 #endif
9625 #ifdef htonl
9626 printf("Defined as a macro.");
9627 #endif
9628 EOM
9629         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9630         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9631                 val="$define"
9632                 echo "But it seems to be defined as a macro." >&4
9633         fi
9634         $rm -f htonl.?
9635         ;;
9636 esac
9637 set d_htonl
9638 eval $setvar
9639
9640 : see if iconv exists
9641 set iconv d_iconv
9642 eval $inlibc
9643
9644 : index or strchr
9645 echo " "
9646 if set index val -f; eval $csym; $val; then
9647         if set strchr val -f d_strchr; eval $csym; $val; then
9648                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9649                         val="$define"
9650                         vali="$undef"
9651                         echo "strchr() found." >&4
9652                 else
9653                         val="$undef"
9654                         vali="$define"
9655                         echo "index() found." >&4
9656                 fi
9657         else
9658                 val="$undef"
9659                 vali="$define"
9660                 echo "index() found." >&4
9661         fi
9662 else
9663         if set strchr val -f d_strchr; eval $csym; $val; then
9664                 val="$define"
9665                 vali="$undef"
9666                 echo "strchr() found." >&4
9667         else
9668                 echo "No index() or strchr() found!" >&4
9669                 val="$undef"
9670                 vali="$undef"
9671         fi
9672 fi
9673 set d_strchr; eval $setvar
9674 val="$vali"
9675 set d_index; eval $setvar
9676
9677 : check whether inet_aton exists
9678 set inet_aton d_inetaton
9679 eval $inlibc
9680
9681 : see if inttypes.h is available
9682 : we want a real compile instead of Inhdr because some systems
9683 : have an inttypes.h which includes non-existent headers
9684 echo " "
9685 $cat >try.c <<EOCP
9686 #include <inttypes.h>
9687 int main() {
9688         static int32_t foo32 = 0x12345678;
9689 }
9690 EOCP
9691 set try
9692 if eval $compile; then
9693         echo "<inttypes.h> found." >&4
9694         val="$define"
9695 else
9696         echo "<inttypes.h> NOT found." >&4
9697         val="$undef"
9698 fi
9699 $rm -f try.c try
9700 set i_inttypes
9701 eval $setvar
9702
9703 : check for int64_t
9704 echo " "
9705 echo "Checking to see if you have int64_t..." >&4
9706 $cat >try.c <<EOCP
9707 #include <sys/types.h>
9708 #$i_inttypes I_INTTYPES
9709 #ifdef I_INTTYPES
9710 #include <inttypes.h>
9711 #endif
9712 int main() { int64_t x = 7; }
9713 EOCP
9714 set try
9715 if eval $compile; then
9716         val="$define"
9717         echo "You have int64_t."
9718 else
9719         val="$undef"
9720         echo "You do not have int64_t."
9721 fi
9722 $rm -f try try.*
9723 set d_int64_t
9724 eval $setvar
9725
9726 : Look for isascii
9727 echo " "
9728 $cat >isascii.c <<'EOCP'
9729 #include <stdio.h>
9730 #include <ctype.h>
9731 int main() {
9732         int c = 'A';
9733         if (isascii(c))
9734                 exit(0);
9735         else
9736                 exit(1);
9737 }
9738 EOCP
9739 set isascii
9740 if eval $compile; then
9741         echo "isascii() found." >&4
9742         val="$define"
9743 else
9744         echo "isascii() NOT found." >&4
9745         val="$undef"
9746 fi
9747 set d_isascii
9748 eval $setvar
9749 $rm -f isascii*
9750
9751 : see if isnan exists
9752 set isnan d_isnan
9753 eval $inlibc
9754
9755 : see if isnanl exists
9756 set isnanl d_isnanl
9757 eval $inlibc
9758
9759 : see if killpg exists
9760 set killpg d_killpg
9761 eval $inlibc
9762
9763 : see if lchown exists
9764 echo " "
9765 $cat > try.c <<'EOCP'
9766 /* System header to define __stub macros and hopefully few prototypes,
9767     which can conflict with char lchown(); below.  */
9768 #include <assert.h>
9769 /* Override any gcc2 internal prototype to avoid an error.  */
9770 /* We use char because int might match the return type of a gcc2
9771    builtin and then its argument prototype would still apply.  */
9772 char lchown();
9773 int main() {
9774     /*  The GNU C library defines this for functions which it implements
9775         to always fail with ENOSYS.  Some functions are actually named
9776         something starting with __ and the normal name is an alias.  */
9777 #if defined (__stub_lchown) || defined (__stub___lchown)
9778 choke me
9779 #else
9780 lchown();
9781 #endif
9782 ; return 0; }
9783 EOCP
9784 set try
9785 if eval $compile; then
9786     $echo "lchown() found." >&4
9787     val="$define"
9788 else
9789     $echo "lchown() NOT found." >&4
9790     val="$undef"
9791 fi
9792 set d_lchown
9793 eval $setvar
9794
9795 : See if number of significant digits in a double precision number is known
9796 echo " "
9797 $cat >ldbl_dig.c <<EOM
9798 #$i_limits I_LIMITS
9799 #$i_float I_FLOAT
9800 #ifdef I_LIMITS
9801 #include <limits.h>
9802 #endif
9803 #ifdef I_FLOAT
9804 #include <float.h>
9805 #endif
9806 #ifdef LDBL_DIG
9807 printf("Contains LDBL_DIG");
9808 #endif
9809 EOM
9810 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9811 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9812         echo "LDBL_DIG found." >&4
9813         val="$define"
9814 else
9815         echo "LDBL_DIG NOT found." >&4
9816         val="$undef"
9817 fi
9818 $rm -f ldbl_dig.?
9819 set d_ldbl_dig
9820 eval $setvar
9821
9822 : see if link exists
9823 set link d_link
9824 eval $inlibc
9825
9826 : see if localeconv exists
9827 set localeconv d_locconv
9828 eval $inlibc
9829
9830 : see if lockf exists
9831 set lockf d_lockf
9832 eval $inlibc
9833
9834 : check for long long
9835 echo " "
9836 echo "Checking to see if you have long long..." >&4
9837 echo 'int main() { long long x = 7; return 0; }' > try.c
9838 set try
9839 if eval $compile; then
9840         val="$define"
9841         echo "You have long long."
9842 else
9843         val="$undef"
9844         echo "You do not have long long."
9845 fi
9846 $rm try.*
9847 set d_longlong
9848 eval $setvar
9849
9850 : check for length of long long
9851 case "${d_longlong}${longlongsize}" in
9852 $define)
9853         echo " "
9854         echo "Checking to see how big your long longs are..." >&4
9855         $cat >try.c <<'EOCP'
9856 #include <stdio.h>
9857 int main()
9858 {
9859     printf("%d\n", (int)sizeof(long long));
9860     return(0);
9861 }
9862 EOCP
9863         set try
9864         if eval $compile_ok; then
9865                 longlongsize=`./try$exe_ext`
9866                 echo "Your long longs are $longlongsize bytes long."
9867         else
9868                 dflt='8'
9869                 echo " "
9870                 echo "(I can't seem to compile the test program.  Guessing...)"
9871                 rp="What is the size of a long long (in bytes)?"
9872                 . ./myread
9873                 longlongsize="$ans"
9874         fi
9875         if $test "X$longsize" = "X$longlongsize"; then
9876                 echo "(That isn't any different from an ordinary long.)"
9877         fi      
9878         ;;
9879 esac
9880 $rm -f try.* try
9881
9882 : see if prototype for lseek is available
9883 echo " "
9884 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9885 eval $hasproto
9886
9887 : see if lstat exists
9888 set lstat d_lstat
9889 eval $inlibc
9890
9891 : see if madvise exists
9892 set madvise d_madvise
9893 eval $inlibc
9894
9895 : see if mblen exists
9896 set mblen d_mblen
9897 eval $inlibc
9898
9899 : see if mbstowcs exists
9900 set mbstowcs d_mbstowcs
9901 eval $inlibc
9902
9903 : see if mbtowc exists
9904 set mbtowc d_mbtowc
9905 eval $inlibc
9906
9907 : see if memchr exists
9908 set memchr d_memchr
9909 eval $inlibc
9910
9911 : see if memcmp exists
9912 set memcmp d_memcmp
9913 eval $inlibc
9914
9915 : see if memcpy exists
9916 set memcpy d_memcpy
9917 eval $inlibc
9918
9919 : see if memmove exists
9920 set memmove d_memmove
9921 eval $inlibc
9922
9923 : see if memset exists
9924 set memset d_memset
9925 eval $inlibc
9926
9927 : see if mkdir exists
9928 set mkdir d_mkdir
9929 eval $inlibc
9930
9931 : see if mkdtemp exists
9932 set mkdtemp d_mkdtemp
9933 eval $inlibc
9934
9935 : see if mkfifo exists
9936 set mkfifo d_mkfifo
9937 eval $inlibc
9938
9939 : see if mkstemp exists
9940 set mkstemp d_mkstemp
9941 eval $inlibc
9942
9943 : see if mkstemps exists
9944 set mkstemps d_mkstemps
9945 eval $inlibc
9946
9947 : see if mktime exists
9948 set mktime d_mktime
9949 eval $inlibc
9950
9951 : see if this is a sys/mman.h system
9952 set sys/mman.h i_sysmman
9953 eval $inhdr
9954
9955 : see if mmap exists
9956 set mmap d_mmap
9957 eval $inlibc
9958 : see what shmat returns
9959 : default to something harmless
9960 mmaptype='void *'
9961 case "$i_sysmman$d_mmap" in
9962 "$define$define")
9963         $cat >mmap.c <<'END'
9964 #include <sys/mman.h>
9965 void *mmap();
9966 END
9967         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9968                 mmaptype='void *'
9969         else
9970                 mmaptype='caddr_t'
9971         fi
9972         echo "and it returns ($mmaptype)." >&4
9973         ;;
9974 esac
9975
9976
9977
9978 : see if modfl exists
9979 set modfl d_modfl
9980 eval $inlibc
9981
9982 : see if mprotect exists
9983 set mprotect d_mprotect
9984 eval $inlibc
9985
9986 : see if msgctl exists
9987 set msgctl d_msgctl
9988 eval $inlibc
9989
9990 : see if msgget exists
9991 set msgget d_msgget
9992 eval $inlibc
9993
9994 : see if msgsnd exists
9995 set msgsnd d_msgsnd
9996 eval $inlibc
9997
9998 : see if msgrcv exists
9999 set msgrcv d_msgrcv
10000 eval $inlibc
10001
10002 : see how much of the 'msg*(2)' library is present.
10003 h_msg=true
10004 echo " "
10005 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10006 *"$undef"*) h_msg=false;;
10007 esac
10008 case "$osname" in
10009 freebsd)
10010     case "`ipcs 2>&1`" in
10011     "SVID messages"*"not configured"*)
10012         echo "Your $osname does not have the msg*(2) configured." >&4
10013         h_msg=false
10014         val="$undef"
10015         set msgctl d_msgctl
10016         eval $setvar
10017         set msgget d_msgget
10018         eval $setvar
10019         set msgsnd d_msgsnd
10020         eval $setvar
10021         set msgrcv d_msgrcv
10022         eval $setvar
10023         ;;
10024     esac
10025     ;;
10026 esac
10027 : we could also check for sys/ipc.h ...
10028 if $h_msg && $test `./findhdr sys/msg.h`; then
10029         echo "You have the full msg*(2) library." >&4
10030         val="$define"
10031 else
10032         echo "You don't have the full msg*(2) library." >&4
10033         val="$undef"
10034 fi
10035 set d_msg
10036 eval $setvar
10037
10038 : see if msync exists
10039 set msync d_msync
10040 eval $inlibc
10041
10042 : see if munmap exists
10043 set munmap d_munmap
10044 eval $inlibc
10045
10046 : see if nice exists
10047 set nice d_nice
10048 eval $inlibc
10049
10050
10051 echo " "
10052 echo "Checking which 64-bit integer type we could use..." >&4
10053
10054 case "$intsize" in
10055 8) val=int
10056    set quadtype
10057    eval $setvar
10058    val='"unsigned int"'
10059    set uquadtype
10060    eval $setvar
10061    quadkind=1
10062    ;;
10063 *) case "$longsize" in
10064    8) val=long
10065       set quadtype
10066       eval $setvar
10067       val='"unsigned long"'
10068       set uquadtype
10069       eval $setvar
10070       quadkind=2
10071       ;;
10072    *) case "$d_longlong:$longlongsize" in
10073       define:8)
10074         val='"long long"'
10075         set quadtype
10076         eval $setvar
10077         val='"unsigned long long"'
10078         set uquadtype
10079         eval $setvar
10080         quadkind=3
10081         ;;
10082       *) case "$d_int64_t" in
10083          define)
10084            val=int64_t
10085            set quadtype
10086            eval $setvar
10087            val=uint64_t
10088            set uquadtype
10089            eval $setvar
10090            quadkind=4
10091            ;;
10092          esac
10093          ;;
10094       esac
10095       ;;
10096    esac
10097    ;;
10098 esac
10099
10100 case "$quadtype" in
10101 '')     echo "Alas, no 64-bit integer types in sight." >&4
10102         d_quad="$undef"
10103         ;;
10104 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10105             verb="will"
10106         else
10107             verb="could"
10108         fi
10109         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10110         d_quad="$define"
10111         ;;
10112 esac
10113
10114 : check for length of character
10115 echo " "
10116 case "$charsize" in
10117 '')
10118         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10119         $cat >try.c <<'EOCP'
10120 #include <stdio.h>
10121 int main()
10122 {
10123     printf("%d\n", (int)sizeof(char));
10124     exit(0);
10125 }
10126 EOCP
10127         set try
10128         if eval $compile_ok; then
10129                 dflt=`./try`
10130         else
10131                 dflt='1'
10132                 echo "(I can't seem to compile the test program.  Guessing...)"
10133         fi
10134         ;;
10135 *)
10136         dflt="$charsize"
10137         ;;
10138 esac
10139 rp="What is the size of a character (in bytes)?"
10140 . ./myread
10141 charsize="$ans"
10142 $rm -f try.c try
10143
10144
10145 echo " "
10146 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10147
10148 case "$use64bitint:$d_quad:$quadtype" in
10149 define:define:?*)
10150         ivtype="$quadtype"
10151         uvtype="$uquadtype"
10152         ivsize=8
10153         uvsize=8
10154         ;;
10155 *)      ivtype="long"
10156         uvtype="unsigned long"
10157         ivsize=$longsize
10158         uvsize=$longsize
10159         ;;
10160 esac
10161
10162 case "$uselongdouble:$d_longdbl" in
10163 define:define)
10164         nvtype="long double"
10165         nvsize=$longdblsize
10166         ;;
10167 *)      nvtype=double
10168         nvsize=$doublesize
10169         ;;
10170 esac
10171
10172 $echo "(IV will be "$ivtype", $ivsize bytes)"
10173 $echo "(UV will be "$uvtype", $uvsize bytes)"
10174 $echo "(NV will be "$nvtype", $nvsize bytes)"
10175
10176 $cat >try.c <<EOCP
10177 #$i_inttypes I_INTTYPES
10178 #ifdef I_INTTYPES
10179 #include <inttypes.h>
10180 #endif
10181 #include <stdio.h>
10182 int main() {
10183 #ifdef INT8
10184    int8_t i =  INT8_MAX;
10185   uint8_t u = UINT8_MAX;
10186   printf("int8_t\n");
10187 #endif
10188 #ifdef INT16
10189    int16_t i =  INT16_MAX;
10190   uint16_t i = UINT16_MAX;
10191   printf("int16_t\n");
10192 #endif
10193 #ifdef INT32
10194    int32_t i =  INT32_MAX;
10195   uint32_t u = UINT32_MAX;
10196   printf("int32_t\n");
10197 #endif
10198 }
10199 EOCP
10200
10201 case "$i8type" in
10202 '')     case "$charsize" in
10203         1)      i8type=char
10204                 u8type="unsigned char"
10205                 i8size=$charsize
10206                 u8size=$charsize
10207                 ;;
10208         esac
10209         ;;
10210 esac
10211 case "$i8type" in
10212 '')     set try -DINT8
10213         if eval $compile; then
10214                 case "`./try$exe_ext`" in
10215                 int8_t) i8type=int8_t
10216                         u8type=uint8_t
10217                         i8size=1
10218                         u8size=1
10219                         ;;
10220                 esac
10221         fi
10222         ;;
10223 esac
10224 case "$i8type" in
10225 '')     if $test $charsize -ge 1; then
10226                 i8type=char
10227                 u8type="unsigned char"
10228                 i8size=$charsize
10229                 u8size=$charsize
10230         fi
10231         ;;
10232 esac
10233
10234 case "$i16type" in
10235 '')     case "$shortsize" in
10236         2)      i16type=short
10237                 u16type="unsigned short"
10238                 i16size=$shortsize
10239                 u16size=$shortsize
10240                 ;;
10241         esac
10242         ;;
10243 esac
10244 case "$i16type" in
10245 '')     set try -DINT16
10246         if eval $compile; then
10247                 case "`./try$exe_ext`" in
10248                 int16_t)
10249                         i16type=int16_t
10250                         u16type=uint16_t
10251                         i16size=2
10252                         u16size=2
10253                         ;;
10254                 esac
10255         fi
10256         ;;
10257 esac
10258 case "$i16type" in
10259 '')     if $test $shortsize -ge 2; then
10260                 i16type=short
10261                 u16type="unsigned short"
10262                 i16size=$shortsize
10263                 u16size=$shortsize
10264         fi
10265         ;;
10266 esac
10267
10268 case "$i32type" in
10269 '')     case "$longsize" in
10270         4)      i32type=long
10271                 u32type="unsigned long"
10272                 i32size=$longsize
10273                 u32size=$longsize
10274                 ;;
10275         *)      case "$intsize" in
10276                 4)      i32type=int
10277                         u32type="unsigned int"
10278                         i32size=$intsize
10279                         u32size=$intsize
10280                         ;;
10281                 esac
10282                 ;;
10283         esac
10284         ;;
10285 esac
10286 case "$i32type" in
10287 '')     set try -DINT32
10288         if eval $compile; then
10289                 case "`./try$exe_ext`" in
10290                 int32_t)
10291                         i32type=int32_t
10292                         u32type=uint32_t
10293                         i32size=4
10294                         u32size=4
10295                         ;;
10296                 esac
10297         fi
10298         ;;
10299 esac
10300 case "$i32type" in
10301 '')     if $test $intsize -ge 4; then
10302                 i32type=int
10303                 u32type="unsigned int"
10304                 i32size=$intsize
10305                 u32size=$intsize
10306         fi
10307         ;;
10308 esac
10309
10310 case "$i64type" in
10311 '')     case "$d_quad:$quadtype" in
10312         define:?*)
10313                 i64type="$quadtype"
10314                 u64type="$uquadtype"
10315                 i64size=8
10316                 u64size=8
10317                 ;;
10318         esac
10319         ;;
10320 esac
10321
10322 $echo "Checking whether your NVs can preserve your UVs..." >&4
10323 $cat <<EOP >try.c
10324 #include <stdio.h>
10325 int main() {
10326     $uvtype k = ($uvtype)~0, l;
10327     $nvtype d;
10328     l = k;
10329     d = ($nvtype)l;
10330     l = ($uvtype)d;
10331     if (l == k)
10332        printf("preserve\n");
10333     exit(0);
10334 }
10335 EOP
10336 set try
10337 if eval $compile; then
10338         case "`./try$exe_ext`" in
10339         preserve) d_nv_preserves_uv="$define" ;;
10340         esac
10341 fi      
10342 case "$d_nv_preserves_uv" in
10343 $define) $echo "Yes, they can."  2>&1 ;;
10344 *)       $echo "No, they can't." 2>&1
10345          d_nv_preserves_uv="$undef"
10346          ;;
10347 esac
10348
10349 $rm -f try.* try
10350
10351 case "$d_nv_preserves_uv" in
10352 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10353 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10354         $cat <<EOP >try.c
10355 #include <stdio.h>
10356 int main() {
10357     $uvtype u = 0;
10358     int     n = 8 * $uvsize;
10359     int     i;
10360     for (i = 0; i < n; i++) {
10361       u = u << 1 | ($uvtype)1;
10362       if (($uvtype)($nvtype)u != u)
10363         break;
10364     }
10365     printf("%d\n", i);
10366     exit(0);
10367 }
10368 EOP
10369         set try
10370         if eval $compile; then
10371                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10372         fi
10373         case "$d_nv_preserves_uv_bits" in
10374         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10375         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10376                 d_nv_preserves_uv_bits="$undef"
10377                 ;;
10378         esac
10379         $rm -f try.* try
10380         ;;
10381 esac
10382
10383
10384
10385 : check for off64_t
10386 echo " "
10387 echo "Checking to see if you have off64_t..." >&4
10388 $cat >try.c <<EOCP
10389 #include <sys/types.h>
10390 #include <unistd.h>
10391 int main() { off64_t x = 7; }
10392 EOCP
10393 set try
10394 if eval $compile; then
10395         val="$define"
10396         echo "You have off64_t."
10397 else
10398         val="$undef"
10399         echo "You do not have off64_t."
10400         case "$lseeksize" in
10401         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10402         esac
10403 fi
10404 $rm -f try.* try
10405 set d_off64_t
10406 eval $setvar
10407
10408 : see if POSIX threads are available
10409 set pthread.h i_pthread
10410 eval $inhdr
10411
10412
10413
10414
10415 : how to create joinable pthreads
10416 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10417         echo " "
10418         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10419         $cat >try.c <<'EOCP'
10420 #include <pthread.h>
10421 int main() {
10422     int detachstate = JOINABLE;
10423 }
10424 EOCP
10425         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10426         if eval $compile; then
10427                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10428                 val="$undef" # Yes, undef.
10429                 set d_old_pthread_create_joinable
10430                 eval $setvar
10431                 val=""
10432                 set old_pthread_create_joinable
10433                 eval $setvar
10434         else
10435                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10436                 if eval $compile; then
10437                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10438                         val="$define"
10439                         set d_old_pthread_create_joinable
10440                         eval $setvar
10441                         val=PTHREAD_CREATE_UNDETACHED
10442                         set old_pthread_create_joinable
10443                         eval $setvar
10444                 else            
10445                         set try -DJOINABLE=__UNDETACHED
10446                         if eval $compile; then
10447                                 echo "You seem to use __UNDETACHED." >&4
10448                                 val="$define"
10449                                 set d_old_pthread_create_joinable
10450                                 eval $setvar
10451                                 val=__UNDETACHED
10452                                 set old_pthread_create_joinable
10453                                 eval $setvar
10454                         else
10455                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10456                                 val="$define"
10457                                 set d_old_pthread_create_joinable
10458                                 eval $setvar
10459                                 val=0
10460                                 set old_pthread_create_joinable
10461                                 eval $setvar
10462                         fi
10463                 fi
10464         fi
10465         $rm -f try try.*
10466 else
10467     d_old_pthread_create_joinable="$undef"
10468     old_pthread_create_joinable=""
10469 fi
10470
10471 : see if pause exists
10472 set pause d_pause
10473 eval $inlibc
10474
10475 : see if pipe exists
10476 set pipe d_pipe
10477 eval $inlibc
10478
10479 : see if poll exists
10480 set poll d_poll
10481 eval $inlibc
10482
10483 echo " "
10484 echo "Checking how many exponent digits your sprintf formats use..."
10485 $cat >try.c <<'EOSC'
10486 #include <stdio.h> 
10487 int main() {
10488   char b[10];
10489   exit(sprintf(b, "%0.1e", 1.2) - 5);
10490 }
10491 EOSC
10492 set try
10493 if eval $compile; then
10494         ./try$_exe
10495         case "$?" in
10496         2|3)    d_printf_exp_digits=$? ;;
10497         esac
10498 fi
10499 case "$d_printf_exp_digits" in
10500 2|3)    echo "Your sprintf seems to use $d_printf_exp_digits exponent digits."
10501         ;;
10502 *)      cat <<EOM >&4
10503 I do not understand what your sprintf is saying.
10504 I'm guessing it uses at least 2 exponent digits.
10505 EOM
10506         d_printf_exp_digits=2
10507         ;;
10508 esac
10509 $rm -f try try.*
10510
10511
10512 : see whether the various POSIXish _yields exist
10513 $cat >try.c <<EOP
10514 #include <pthread.h>
10515 #include <stdio.h>
10516 int main() {
10517 #ifdef SCHED_YIELD
10518         sched_yield();
10519 #else
10520 #ifdef PTHREAD_YIELD
10521         pthread_yield();
10522 #else
10523 #ifdef PTHREAD_YIELD_NULL
10524         pthread_yield(NULL);
10525 #endif
10526 #endif
10527 #endif
10528 }
10529 EOP
10530 : see if sched_yield exists
10531 set try -DSCHED_YIELD
10532 if eval $compile; then
10533     val="$define"
10534     sched_yield='sched_yield()'
10535 else
10536     val="$undef"
10537 fi
10538 case "$usethreads" in
10539 $define)
10540         case "$val" in
10541         $define) echo 'sched_yield() found.' >&4        ;;
10542         *)       echo 'sched_yield() NOT found.' >&4    ;;
10543         esac
10544 esac
10545 set d_sched_yield
10546 eval $setvar
10547
10548 : see if pthread_yield exists
10549 set try -DPTHREAD_YIELD
10550 if eval $compile; then
10551     val="$define"
10552     case "$sched_yield" in
10553     '') sched_yield='pthread_yield()' ;;
10554     esac
10555 else
10556     set try -DPTHREAD_YIELD_NULL
10557     if eval $compile; then
10558         val="$define"
10559         case "$sched_yield" in
10560         '') sched_yield='pthread_yield(NULL)' ;;
10561         esac
10562     else
10563         val="$undef"
10564     fi
10565 fi
10566 case "$usethreads" in
10567 $define)
10568         case "$val" in
10569         $define) echo 'pthread_yield() found.' >&4      ;;
10570         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10571         esac
10572         ;;
10573 esac
10574 set d_pthread_yield
10575 eval $setvar
10576
10577 case "$sched_yield" in
10578 '') sched_yield=undef ;;
10579 esac
10580
10581 $rm -f try try.*
10582
10583 : see if this is a pwd.h system
10584 set pwd.h i_pwd
10585 eval $inhdr
10586
10587 case "$i_pwd" in
10588 $define)
10589         xxx=`./findhdr pwd.h`
10590         $cppstdin $cppflags $cppminus < $xxx >$$.h
10591
10592         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10593                 val="$define"
10594         else
10595                 val="$undef"
10596         fi
10597         set d_pwquota
10598         eval $setvar
10599
10600         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10601                 val="$define"
10602         else
10603                 val="$undef"
10604         fi
10605         set d_pwage
10606         eval $setvar
10607
10608         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10609                 val="$define"
10610         else
10611                 val="$undef"
10612         fi
10613         set d_pwchange
10614         eval $setvar
10615
10616         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10617                 val="$define"
10618         else
10619                 val="$undef"
10620         fi
10621         set d_pwclass
10622         eval $setvar
10623
10624         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10625                 val="$define"
10626         else
10627                 val="$undef"
10628         fi
10629         set d_pwexpire
10630         eval $setvar
10631
10632         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10633                 val="$define"
10634         else
10635                 val="$undef"
10636         fi
10637         set d_pwcomment
10638         eval $setvar
10639
10640         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10641                 val="$define"
10642         else
10643                 val="$undef"
10644         fi
10645         set d_pwgecos
10646         eval $setvar
10647
10648         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10649                 val="$define"
10650         else
10651                 val="$undef"
10652         fi
10653         set d_pwpasswd
10654         eval $setvar
10655
10656         $rm -f $$.h
10657         ;;
10658 *)
10659         val="$undef"; 
10660         set d_pwquota; eval $setvar
10661         set d_pwage; eval $setvar
10662         set d_pwchange; eval $setvar
10663         set d_pwclass; eval $setvar
10664         set d_pwexpire; eval $setvar
10665         set d_pwcomment; eval $setvar
10666         set d_pwgecos; eval $setvar
10667         set d_pwpasswd; eval $setvar
10668         ;;
10669 esac
10670
10671 : see if readdir and friends exist
10672 set readdir d_readdir
10673 eval $inlibc
10674 set seekdir d_seekdir
10675 eval $inlibc
10676 set telldir d_telldir
10677 eval $inlibc
10678 set rewinddir d_rewinddir
10679 eval $inlibc
10680
10681 : see if readlink exists
10682 set readlink d_readlink
10683 eval $inlibc
10684
10685 : see if rename exists
10686 set rename d_rename
10687 eval $inlibc
10688
10689 : see if rmdir exists
10690 set rmdir d_rmdir
10691 eval $inlibc
10692
10693 : see if memory.h is available.
10694 val=''
10695 set memory.h val
10696 eval $inhdr
10697
10698 : See if it conflicts with string.h
10699 case "$val" in
10700 $define)
10701         case "$strings" in
10702         '') ;;
10703         *)
10704                 $cppstdin $cppflags $cppminus < $strings > mem.h
10705                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10706                         echo " "
10707                         echo "We won't be including <memory.h>."
10708                         val="$undef"
10709                 fi
10710                 $rm -f mem.h
10711                 ;;
10712         esac
10713 esac
10714 set i_memory
10715 eval $setvar
10716
10717 : can bcopy handle overlapping blocks?
10718 val="$undef"
10719 case "$d_bcopy" in
10720 "$define")
10721         echo " "
10722         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10723         $cat >try.c <<EOCP
10724 #$i_memory I_MEMORY
10725 #$i_stdlib I_STDLIB
10726 #$i_string I_STRING
10727 #$i_unistd I_UNISTD
10728 EOCP
10729         $cat >>try.c <<'EOCP'
10730 #include <stdio.h>
10731 #ifdef I_MEMORY
10732 #  include <memory.h>
10733 #endif
10734 #ifdef I_STDLIB
10735 #  include <stdlib.h>
10736 #endif
10737 #ifdef I_STRING
10738 #  include <string.h>
10739 #else
10740 #  include <strings.h>
10741 #endif
10742 #ifdef I_UNISTD
10743 #  include <unistd.h>  /* Needed for NetBSD */
10744 #endif
10745 int main()
10746 {
10747 char buf[128], abc[128];
10748 char *b;
10749 int len;
10750 int off;
10751 int align;
10752
10753 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10754
10755 for (align = 7; align >= 0; align--) {
10756         for (len = 36; len; len--) {
10757                 b = buf+align;
10758                 bcopy(abc, b, len);
10759                 for (off = 1; off <= len; off++) {
10760                         bcopy(b, b+off, len);
10761                         bcopy(b+off, b, len);
10762                         if (bcmp(b, abc, len))
10763                                 exit(1);
10764                 }
10765         }
10766 }
10767 exit(0);
10768 }
10769 EOCP
10770         set try
10771         if eval $compile_ok; then
10772                 if ./try 2>/dev/null; then
10773                         echo "Yes, it can."
10774                         val="$define"
10775                 else
10776                         echo "It can't, sorry."
10777                         case "$d_memmove" in
10778                         "$define") echo "But that's Ok since you have memmove()." ;;
10779                         esac
10780                 fi
10781         else
10782                 echo "(I can't compile the test program, so we'll assume not...)"
10783                 case "$d_memmove" in
10784                 "$define") echo "But that's Ok since you have memmove()." ;;
10785                 esac
10786         fi
10787         ;;
10788 esac
10789 $rm -f try.* try core
10790 set d_safebcpy
10791 eval $setvar
10792
10793 : can memcpy handle overlapping blocks?
10794 val="$undef"
10795 case "$d_memcpy" in
10796 "$define")
10797         echo " "
10798         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10799         $cat >try.c <<EOCP
10800 #$i_memory I_MEMORY
10801 #$i_stdlib I_STDLIB
10802 #$i_string I_STRING
10803 #$i_unistd I_UNISTD
10804 EOCP
10805         $cat >>try.c <<'EOCP'
10806 #include <stdio.h>
10807 #ifdef I_MEMORY
10808 #  include <memory.h>
10809 #endif
10810 #ifdef I_STDLIB
10811 #  include <stdlib.h>
10812 #endif
10813 #ifdef I_STRING
10814 #  include <string.h>
10815 #else
10816 #  include <strings.h>
10817 #endif
10818 #ifdef I_UNISTD
10819 #  include <unistd.h>  /* Needed for NetBSD */
10820 #endif
10821 int main()
10822 {
10823 char buf[128], abc[128];
10824 char *b;
10825 int len;
10826 int off;
10827 int align;
10828
10829 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10830    try to store the string in read-only memory. */
10831 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10832
10833 for (align = 7; align >= 0; align--) {
10834         for (len = 36; len; len--) {
10835                 b = buf+align;
10836                 memcpy(b, abc, len);
10837                 for (off = 1; off <= len; off++) {
10838                         memcpy(b+off, b, len);
10839                         memcpy(b, b+off, len);
10840                         if (memcmp(b, abc, len))
10841                                 exit(1);
10842                 }
10843         }
10844 }
10845 exit(0);
10846 }
10847 EOCP
10848         set try
10849         if eval $compile_ok; then
10850                 if ./try 2>/dev/null; then
10851                         echo "Yes, it can."
10852                         val="$define"
10853                 else
10854                         echo "It can't, sorry."
10855                         case "$d_memmove" in
10856                         "$define") echo "But that's Ok since you have memmove()." ;;
10857                         esac
10858                 fi
10859         else
10860                 echo "(I can't compile the test program, so we'll assume not...)"
10861                 case "$d_memmove" in
10862                 "$define") echo "But that's Ok since you have memmove()." ;;
10863                 esac
10864         fi
10865         ;;
10866 esac
10867 $rm -f try.* try core
10868 set d_safemcpy
10869 eval $setvar
10870
10871 : can memcmp be trusted to compare relative magnitude?
10872 val="$undef"
10873 case "$d_memcmp" in
10874 "$define")
10875         echo " "
10876         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10877         $cat >try.c <<EOCP
10878 #$i_memory I_MEMORY
10879 #$i_stdlib I_STDLIB
10880 #$i_string I_STRING
10881 #$i_unistd I_UNISTD
10882 EOCP
10883         $cat >>try.c <<'EOCP'
10884 #include <stdio.h>
10885 #ifdef I_MEMORY
10886 #  include <memory.h>
10887 #endif
10888 #ifdef I_STDLIB
10889 #  include <stdlib.h>
10890 #endif
10891 #ifdef I_STRING
10892 #  include <string.h>
10893 #else
10894 #  include <strings.h>
10895 #endif
10896 #ifdef I_UNISTD
10897 #  include <unistd.h>  /* Needed for NetBSD */
10898 #endif
10899 int main()
10900 {
10901 char a = -1;
10902 char b = 0;
10903 if ((a < b) && memcmp(&a, &b, 1) < 0)
10904         exit(1);
10905 exit(0);
10906 }
10907 EOCP
10908         set try
10909         if eval $compile_ok; then
10910                 if ./try 2>/dev/null; then
10911                         echo "Yes, it can."
10912                         val="$define"
10913                 else
10914                         echo "No, it can't (it uses signed chars)."
10915                 fi
10916         else
10917                 echo "(I can't compile the test program, so we'll assume not...)"
10918         fi
10919         ;;
10920 esac
10921 $rm -f try.* try core
10922 set d_sanemcmp
10923 eval $setvar
10924
10925 : see if select exists
10926 set select d_select
10927 eval $inlibc
10928
10929 : see if semctl exists
10930 set semctl d_semctl
10931 eval $inlibc
10932
10933 : see if semget exists
10934 set semget d_semget
10935 eval $inlibc
10936
10937 : see if semop exists
10938 set semop d_semop
10939 eval $inlibc
10940
10941 : see how much of the 'sem*(2)' library is present.
10942 h_sem=true
10943 echo " "
10944 case "$d_semctl$d_semget$d_semop" in
10945 *"$undef"*) h_sem=false;;
10946 esac
10947 case "$osname" in
10948 freebsd)
10949     case "`ipcs 2>&1`" in
10950     "SVID messages"*"not configured"*)
10951         echo "Your $osname does not have the sem*(2) configured." >&4
10952         h_sem=false
10953         val="$undef"
10954         set semctl d_semctl
10955         eval $setvar
10956         set semget d_semget
10957         eval $setvar
10958         set semop d_semop
10959         eval $setvar
10960         ;;
10961     esac
10962     ;;
10963 esac
10964 : we could also check for sys/ipc.h ...
10965 if $h_sem && $test `./findhdr sys/sem.h`; then
10966         echo "You have the full sem*(2) library." >&4
10967         val="$define"
10968 else
10969         echo "You don't have the full sem*(2) library." >&4
10970         val="$undef"
10971 fi
10972 set d_sem
10973 eval $setvar
10974
10975 : see whether sys/sem.h defines union semun
10976 echo " "
10977 $cat > try.c <<'END'
10978 #include <sys/types.h>
10979 #include <sys/ipc.h>
10980 #include <sys/sem.h>
10981 int main () { union semun semun; semun.buf = 0; }
10982 END
10983 set try
10984 if eval $compile; then
10985     echo "You have union semun in <sys/sem.h>." >&4
10986     val="$define"
10987 else
10988     echo "You do not have union semun in <sys/sem.h>." >&4
10989     val="$undef"
10990 fi
10991 $rm -f try try.c try.h
10992 set d_union_semun
10993 eval $setvar
10994
10995 : see how to do semctl IPC_STAT
10996 case "$d_sem" in
10997 $define)
10998     : see whether semctl IPC_STAT can use union semun
10999     echo " "
11000     $cat > try.h <<END
11001 #ifndef S_IRUSR
11002 #   ifdef S_IREAD
11003 #       define S_IRUSR S_IREAD
11004 #       define S_IWUSR S_IWRITE
11005 #       define S_IXUSR S_IEXEC
11006 #   else
11007 #       define S_IRUSR 0400
11008 #       define S_IWUSR 0200
11009 #       define S_IXUSR 0100
11010 #   endif
11011 #   define S_IRGRP (S_IRUSR>>3)
11012 #   define S_IWGRP (S_IWUSR>>3)
11013 #   define S_IXGRP (S_IXUSR>>3)
11014 #   define S_IROTH (S_IRUSR>>6)
11015 #   define S_IWOTH (S_IWUSR>>6)
11016 #   define S_IXOTH (S_IXUSR>>6)
11017 #endif
11018 #ifndef S_IRWXU
11019 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11020 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11021 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11022 #endif
11023 END
11024
11025     $cat > try.c <<END
11026 #include <sys/types.h>
11027 #include <sys/ipc.h>
11028 #include <sys/sem.h>
11029 #include <sys/stat.h>
11030 #include <stdio.h>
11031 #include <errno.h>
11032 #include "try.h"
11033 #ifndef errno
11034 extern int errno;
11035 #endif
11036 #$d_union_semun HAS_UNION_SEMUN
11037 int main() {
11038     union semun
11039 #ifndef HAS_UNION_SEMUN
11040     {
11041         int val;
11042         struct semid_ds *buf;
11043         unsigned short *array;
11044     }
11045 #endif
11046     arg;
11047     int sem, st;
11048
11049 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11050     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11051     if (sem > -1) {
11052         struct semid_ds argbuf;
11053         arg.buf = &argbuf;
11054 #       ifdef IPC_STAT
11055         st = semctl(sem, 0, IPC_STAT, arg);
11056         if (st == 0)
11057             printf("semun\n");
11058         else
11059 #       endif /* IPC_STAT */
11060             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11061 #       ifdef IPC_RMID
11062         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11063 #       endif /* IPC_RMID */
11064             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11065     } else
11066 #endif /* IPC_PRIVATE && ... */
11067         printf("semget failed: errno = %d\n", errno);
11068   return 0;
11069 }
11070 END
11071     val="$undef"
11072     set try
11073     if eval $compile; then
11074         xxx=`./try`
11075         case "$xxx" in
11076         semun) val="$define" ;;
11077         esac
11078     fi
11079     $rm -f try try.c
11080     set d_semctl_semun
11081     eval $setvar
11082     case "$d_semctl_semun" in
11083     $define)
11084         echo "You can use union semun for semctl IPC_STAT." >&4
11085         also='also'
11086         ;;
11087     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11088         also=''
11089         ;;
11090     esac
11091
11092     : see whether semctl IPC_STAT can use struct semid_ds pointer
11093     $cat > try.c <<'END'
11094 #include <sys/types.h>
11095 #include <sys/ipc.h>
11096 #include <sys/sem.h>
11097 #include <sys/stat.h>
11098 #include "try.h"
11099 #include <stdio.h>
11100 #include <errno.h>
11101 #ifndef errno
11102 extern int errno;
11103 #endif
11104 int main() {
11105     struct semid_ds arg;
11106     int sem, st;
11107
11108 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11109     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11110     if (sem > -1) {
11111 #       ifdef IPC_STAT
11112         st = semctl(sem, 0, IPC_STAT, &arg);
11113         if (st == 0)
11114             printf("semid_ds\n");
11115         else
11116 #       endif /* IPC_STAT */
11117             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11118 #       ifdef IPC_RMID
11119         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11120 #       endif /* IPC_RMID */
11121             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11122     } else
11123 #endif /* IPC_PRIVATE && ... */
11124         printf("semget failed: errno = %d\n", errno);
11125
11126     return 0;
11127 }
11128 END
11129     val="$undef"
11130     set try
11131     if eval $compile; then
11132         xxx=`./try`
11133         case "$xxx" in
11134         semid_ds) val="$define" ;;
11135         esac
11136     fi
11137     $rm -f try try.c
11138     set d_semctl_semid_ds
11139     eval $setvar
11140     case "$d_semctl_semid_ds" in
11141     $define)
11142         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11143         ;;
11144     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11145         ;;
11146     esac
11147     $rm -f try.h
11148     ;;
11149 *)  val="$undef"
11150
11151     # We do not have the full sem*(2) library, so assume we can not
11152     # use either.
11153
11154     set d_semctl_semun
11155     eval $setvar
11156
11157     set d_semctl_semid_ds
11158     eval $setvar
11159     ;;
11160 esac
11161
11162 : see if setegid exists
11163 set setegid d_setegid
11164 eval $inlibc
11165
11166 : see if seteuid exists
11167 set seteuid d_seteuid
11168 eval $inlibc
11169
11170 : see if setgrent exists
11171 set setgrent d_setgrent
11172 eval $inlibc
11173
11174 : see if sethostent exists
11175 set sethostent d_sethent
11176 eval $inlibc
11177
11178 : see if setlinebuf exists
11179 set setlinebuf d_setlinebuf
11180 eval $inlibc
11181
11182 : see if setlocale exists
11183 set setlocale d_setlocale
11184 eval $inlibc
11185
11186 : see if setnetent exists
11187 set setnetent d_setnent
11188 eval $inlibc
11189
11190 : see if setprotoent exists
11191 set setprotoent d_setpent
11192 eval $inlibc
11193
11194 : see if setpgid exists
11195 set setpgid d_setpgid
11196 eval $inlibc
11197
11198 : see if setpgrp2 exists
11199 set setpgrp2 d_setpgrp2
11200 eval $inlibc
11201
11202 : see if setpriority exists
11203 set setpriority d_setprior
11204 eval $inlibc
11205
11206 : see if setproctitle exists
11207 set setproctitle d_setproctitle
11208 eval $inlibc
11209
11210 : see if setpwent exists
11211 set setpwent d_setpwent
11212 eval $inlibc
11213
11214 : see if setregid exists
11215 set setregid d_setregid
11216 eval $inlibc
11217 set setresgid d_setresgid
11218 eval $inlibc
11219
11220 : see if setreuid exists
11221 set setreuid d_setreuid
11222 eval $inlibc
11223 set setresuid d_setresuid
11224 eval $inlibc
11225
11226 : see if setrgid exists
11227 set setrgid d_setrgid
11228 eval $inlibc
11229
11230 : see if setruid exists
11231 set setruid d_setruid
11232 eval $inlibc
11233
11234 : see if setservent exists
11235 set setservent d_setsent
11236 eval $inlibc
11237
11238 : see if setsid exists
11239 set setsid d_setsid
11240 eval $inlibc
11241
11242 : see if setvbuf exists
11243 set setvbuf d_setvbuf
11244 eval $inlibc
11245
11246 : see if sfio.h is available
11247 set sfio.h i_sfio
11248 eval $inhdr
11249
11250
11251 : see if sfio library is available
11252 case "$i_sfio" in
11253 $define)
11254         val=''
11255         set sfreserve val
11256         eval $inlibc
11257         ;;
11258 *)
11259         val="$undef"
11260         ;;
11261 esac
11262 : Ok, but do we want to use it.
11263 case "$val" in
11264 $define)
11265         case "$usesfio" in
11266         true|$define|[yY]*) dflt='y';;
11267         *) dflt='n';;
11268         esac
11269         echo "$package can use the sfio library, but it is experimental."
11270         rp="You seem to have sfio available, do you want to try using it?"
11271         . ./myread
11272         case "$ans" in
11273         y|Y) ;;
11274         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11275                 val="$undef"
11276                 : Remove sfio from list of libraries to use
11277                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11278                 shift
11279                 libs="$*"
11280                 echo "libs = $libs" >&4
11281                 ;;
11282         esac
11283         ;;
11284 *)      case "$usesfio" in
11285         true|$define|[yY]*)
11286                 echo "Sorry, cannot find sfio on this machine" >&4
11287                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11288                 ;;
11289         esac
11290         ;;
11291 esac
11292 set d_sfio
11293 eval $setvar
11294 case "$d_sfio" in
11295 $define) usesfio='true';;
11296 *) usesfio='false';;
11297 esac
11298
11299 : see if shmctl exists
11300 set shmctl d_shmctl
11301 eval $inlibc
11302
11303 : see if shmget exists
11304 set shmget d_shmget
11305 eval $inlibc
11306
11307 : see if shmat exists
11308 set shmat d_shmat
11309 eval $inlibc
11310 : see what shmat returns
11311 case "$d_shmat" in
11312 "$define")
11313         $cat >shmat.c <<'END'
11314 #include <sys/shm.h>
11315 void *shmat();
11316 END
11317         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11318                 shmattype='void *'
11319         else
11320                 shmattype='char *'
11321         fi
11322         echo "and it returns ($shmattype)." >&4
11323         : see if a prototype for shmat is available
11324         xxx=`./findhdr sys/shm.h`
11325         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11326         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11327                 val="$define"
11328         else
11329                 val="$undef"
11330         fi
11331         $rm -f shmat.[co]
11332         ;;
11333 *)
11334         val="$undef"
11335         ;;
11336 esac
11337 set d_shmatprototype
11338 eval $setvar
11339
11340 : see if shmdt exists
11341 set shmdt d_shmdt
11342 eval $inlibc
11343
11344 : see how much of the 'shm*(2)' library is present.
11345 h_shm=true
11346 echo " "
11347 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11348 *"$undef"*) h_shm=false;;
11349 esac
11350 case "$osname" in
11351 freebsd)
11352     case "`ipcs 2>&1`" in
11353     "SVID shared memory"*"not configured"*)
11354         echo "Your $osname does not have the shm*(2) configured." >&4
11355         h_shm=false
11356         val="$undef"
11357         set shmctl d_shmctl
11358         evat $setvar
11359         set shmget d_shmget
11360         evat $setvar
11361         set shmat d_shmat
11362         evat $setvar
11363         set shmdt d_shmdt
11364         evat $setvar
11365         ;;
11366     esac
11367     ;;
11368 esac
11369 : we could also check for sys/ipc.h ...
11370 if $h_shm && $test `./findhdr sys/shm.h`; then
11371         echo "You have the full shm*(2) library." >&4
11372         val="$define"
11373 else
11374         echo "You don't have the full shm*(2) library." >&4
11375         val="$undef"
11376 fi
11377 set d_shm
11378 eval $setvar
11379
11380 echo " "
11381 : see if we have sigaction
11382 if set sigaction val -f d_sigaction; eval $csym; $val; then
11383         echo 'sigaction() found.' >&4
11384         $cat > try.c <<'EOP'
11385 #include <stdio.h>
11386 #include <sys/types.h>
11387 #include <signal.h>
11388 int main()
11389 {
11390     struct sigaction act, oact;
11391     act.sa_flags = 0;
11392     oact.sa_handler = 0;
11393     /* so that act and oact are used */
11394     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11395 }
11396 EOP
11397         set try
11398         if eval $compile_ok; then
11399                 val="$define"
11400         else
11401                 echo "But you don't seem to have a useable struct sigaction." >&4
11402                 val="$undef"
11403         fi
11404 else
11405         echo 'sigaction NOT found.' >&4
11406         val="$undef"
11407 fi
11408 set d_sigaction; eval $setvar
11409 $rm -f try try$_o try.c
11410
11411 : see if sigsetjmp exists
11412 echo " "
11413 case "$d_sigsetjmp" in
11414 '')
11415         $cat >try.c <<'EOP'
11416 #include <setjmp.h>
11417 sigjmp_buf env;
11418 int set = 1;
11419 int main()
11420 {
11421         if (sigsetjmp(env,1))
11422                 exit(set);
11423         set = 0;
11424         siglongjmp(env, 1);
11425         exit(1);
11426 }
11427 EOP
11428         set try
11429         if eval $compile; then
11430                 if ./try >/dev/null 2>&1; then
11431                         echo "POSIX sigsetjmp found." >&4
11432                         val="$define"
11433                 else
11434                         $cat >&4 <<EOM
11435 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11436 I'll ignore them.
11437 EOM
11438                         val="$undef"
11439                 fi
11440         else
11441                 echo "sigsetjmp not found." >&4
11442                 val="$undef"
11443         fi
11444         ;;
11445 *) val="$d_sigsetjmp"
11446         case "$d_sigsetjmp" in
11447         $define) echo "POSIX sigsetjmp found." >&4;;
11448         $undef) echo "sigsetjmp not found." >&4;;
11449         esac
11450         ;;
11451 esac
11452 set d_sigsetjmp
11453 eval $setvar
11454 $rm -f try.c try
11455
11456 : see if sys/stat.h is available
11457 set sys/stat.h i_sysstat
11458 eval $inhdr
11459
11460
11461 : see if stat knows about block sizes
11462 echo " "
11463 echo "Checking to see if your struct stat has st_blocks field..." >&4
11464 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11465 eval $hasfield
11466
11467
11468 : see if this is a sys/vfs.h system
11469 set sys/vfs.h i_sysvfs
11470 eval $inhdr
11471
11472
11473 : see if this is a sys/statfs.h system
11474 set sys/statfs.h i_sysstatfs
11475 eval $inhdr
11476
11477
11478 echo " "
11479 echo "Checking to see if your system supports struct statfs..." >&4
11480 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
11481 eval $hasstruct
11482 case "$d_statfs_s" in
11483 "$define")      echo "Yes, it does."   ;;
11484 *)              echo "No, it doesn't." ;;
11485 esac
11486
11487
11488
11489 : see if struct statfs knows about f_flags
11490 case "$d_statfs_s" in
11491 define) 
11492         echo " "
11493         echo "Checking to see if your struct statfs has f_flags field..." >&4
11494         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
11495         eval $hasfield
11496         ;;
11497 *)      val="$undef"
11498         set d_statfs_f_flags
11499         eval $setvar
11500         ;;
11501 esac
11502 case "$d_statfs_f_flags" in
11503 "$define")      echo "Yes, it does."   ;;
11504 *)              echo "No, it doesn't." ;;
11505 esac
11506
11507 : see if _ptr and _cnt from stdio act std
11508 echo " "
11509 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11510         echo "(Looks like you have stdio.h from Linux.)"
11511         case "$stdio_ptr" in
11512         '') stdio_ptr='((fp)->_IO_read_ptr)'
11513                 ptr_lval=$define
11514                 ;;
11515         *)      ptr_lval=$d_stdio_ptr_lval;;
11516         esac
11517         case "$stdio_cnt" in
11518         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11519                 cnt_lval=$undef
11520                 ;;
11521         *)      cnt_lval=$d_stdio_cnt_lval;;
11522         esac
11523         case "$stdio_base" in
11524         '') stdio_base='((fp)->_IO_read_base)';;
11525         esac
11526         case "$stdio_bufsiz" in
11527         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11528         esac
11529 else
11530         case "$stdio_ptr" in
11531         '') stdio_ptr='((fp)->_ptr)'
11532                 ptr_lval=$define
11533                 ;;
11534         *)      ptr_lval=$d_stdio_ptr_lval;;
11535         esac
11536         case "$stdio_cnt" in
11537         '') stdio_cnt='((fp)->_cnt)'
11538                 cnt_lval=$define
11539                 ;;
11540         *)      cnt_lval=$d_stdio_cnt_lval;;
11541         esac
11542         case "$stdio_base" in
11543         '') stdio_base='((fp)->_base)';;
11544         esac
11545         case "$stdio_bufsiz" in
11546         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11547         esac
11548 fi
11549 : test whether _ptr and _cnt really work
11550 echo "Checking how std your stdio is..." >&4
11551 $cat >try.c <<EOP
11552 #include <stdio.h>
11553 #define FILE_ptr(fp)    $stdio_ptr
11554 #define FILE_cnt(fp)    $stdio_cnt
11555 int main() {
11556         FILE *fp = fopen("try.c", "r");
11557         char c = getc(fp);
11558         if (
11559                 18 <= FILE_cnt(fp) &&
11560                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11561         )
11562                 exit(0);
11563         exit(1);
11564 }
11565 EOP
11566 val="$undef"
11567 set try
11568 if eval $compile; then
11569         if ./try; then
11570                 echo "Your stdio acts pretty std."
11571                 val="$define"
11572         else
11573                 echo "Your stdio isn't very std."
11574         fi
11575 else
11576         echo "Your stdio doesn't appear very std."
11577 fi
11578 $rm -f try.c try
11579 set d_stdstdio
11580 eval $setvar
11581
11582 : Can _ptr be used as an lvalue?
11583 case "$d_stdstdio$ptr_lval" in
11584 $define$define) val=$define ;;
11585 *) val=$undef ;;
11586 esac
11587 set d_stdio_ptr_lval
11588 eval $setvar
11589
11590 : Can _cnt be used as an lvalue?
11591 case "$d_stdstdio$cnt_lval" in
11592 $define$define) val=$define ;;
11593 *) val=$undef ;;
11594 esac
11595 set d_stdio_cnt_lval
11596 eval $setvar
11597
11598 : see if _base is also standard
11599 val="$undef"
11600 case "$d_stdstdio" in
11601 $define)
11602         $cat >try.c <<EOP
11603 #include <stdio.h>
11604 #define FILE_base(fp)   $stdio_base
11605 #define FILE_bufsiz(fp) $stdio_bufsiz
11606 int main() {
11607         FILE *fp = fopen("try.c", "r");
11608         char c = getc(fp);
11609         if (
11610                 19 <= FILE_bufsiz(fp) &&
11611                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11612         )
11613                 exit(0);
11614         exit(1);
11615 }
11616 EOP
11617         set try
11618         if eval $compile; then
11619                 if ./try; then
11620                         echo "And its _base field acts std."
11621                         val="$define"
11622                 else
11623                         echo "But its _base field isn't std."
11624                 fi
11625         else
11626                 echo "However, it seems to be lacking the _base field."
11627         fi
11628         $rm -f try.c try
11629         ;;
11630 esac
11631 set d_stdiobase
11632 eval $setvar
11633
11634 $cat >&4 <<EOM
11635 Checking how to access stdio streams by file descriptor number...
11636 EOM
11637 case "$stdio_stream_array" in
11638 '')     $cat >try.c <<EOCP
11639 #include <stdio.h>
11640 int main() {
11641   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11642     printf("yes\n");
11643 }
11644 EOCP
11645         for s in _iob __iob __sF
11646         do
11647                 set try -DSTDIO_STREAM_ARRAY=$s
11648                 if eval $compile; then
11649                         case "`./try$exe_ext`" in
11650                         yes)    stdio_stream_array=$s; break ;;
11651                         esac
11652                 fi
11653         done
11654         $rm -f try.* try$exe_ext
11655 esac
11656 case "$stdio_stream_array" in
11657 '')     $cat >&4 <<EOM
11658 I can't figure out how to access stdio streams by file descriptor number.
11659 EOM
11660         d_stdio_stream_array="$undef"
11661         ;;
11662 *)      $cat >&4 <<EOM
11663 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11664 EOM
11665         d_stdio_stream_array="$define"
11666         ;;
11667 esac
11668
11669 : see if strcoll exists
11670 set strcoll d_strcoll
11671 eval $inlibc
11672
11673 : check for structure copying
11674 echo " "
11675 echo "Checking to see if your C compiler can copy structs..." >&4
11676 $cat >try.c <<'EOCP'
11677 int main()
11678 {
11679         struct blurfl {
11680                 int dyick;
11681         } foo, bar;
11682
11683         foo = bar;
11684 }
11685 EOCP
11686 if $cc -c try.c >/dev/null 2>&1 ; then
11687         val="$define"
11688         echo "Yup, it can."
11689 else
11690         val="$undef"
11691         echo "Nope, it can't."
11692 fi
11693 set d_strctcpy
11694 eval $setvar
11695 $rm -f try.*
11696
11697 : see if strerror and/or sys_errlist[] exist
11698 echo " "
11699 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11700     if set strerror val -f d_strerror; eval $csym; $val; then
11701                 echo 'strerror() found.' >&4
11702                 d_strerror="$define"
11703                 d_strerrm='strerror(e)'
11704                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11705                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11706                         d_syserrlst="$define"
11707                 else
11708                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11709                         d_syserrlst="$undef"
11710                 fi
11711     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11712                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11713                 echo 'strerror() found in string header.' >&4
11714                 d_strerror="$define"
11715                 d_strerrm='strerror(e)'
11716                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11717                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11718                                 d_syserrlst="$define"
11719                 else
11720                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11721                         d_syserrlst="$undef"
11722                 fi
11723     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11724                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11725                 d_strerror="$undef"
11726                 d_syserrlst="$define"
11727                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11728     else
11729                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11730                 d_strerror="$undef"
11731                 d_syserrlst="$undef"
11732                 d_strerrm='"unknown"'
11733     fi
11734 fi
11735
11736 : see if strtod exists
11737 set strtod d_strtod
11738 eval $inlibc
11739
11740 : see if strtol exists
11741 set strtol d_strtol
11742 eval $inlibc
11743
11744 : see if strtold exists
11745 set strtold d_strtold
11746 eval $inlibc
11747
11748 : see if strtoll exists
11749 set strtoll d_strtoll
11750 eval $inlibc
11751
11752 case "$d_longlong-$d_strtoll" in
11753 "$define-$define")
11754         $cat <<EOM
11755 Checking whether your strtoll() works okay...
11756 EOM
11757         $cat >try.c <<'EOCP'
11758 #include <errno.h>
11759 #ifdef __hpux
11760 #define strtoll __strtoll
11761 #endif
11762 #include <stdio.h>
11763 extern long long int strtoll(char *s, char **, int); 
11764 static int bad = 0;
11765 int check(char *s, long long ell, int een) {
11766         long long gll;
11767         errno = 0;
11768         gll = strtoll(s, 0, 10);
11769         if (!((gll == ell) && (errno == een)))
11770                 bad++;
11771 }
11772 int main() {
11773         check(" 1",                                      1LL, 0);
11774         check(" 0",                                      0LL, 0);
11775         check("-1",                                     -1LL, 0);
11776         check("-9223372036854775808", -9223372036854775808LL, 0);
11777         check("-9223372036854775808", -9223372036854775808LL, 0);
11778         check(" 9223372036854775807",  9223372036854775807LL, 0);
11779         check("-9223372036854775808", -9223372036854775808LL, 0);
11780         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11781         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11782         if (!bad)
11783                 printf("ok\n");
11784 }
11785 EOCP
11786         set try
11787         if eval $compile; then
11788                 case "`./try`" in
11789                 ok) echo "Your strtoll() seems to be working okay." ;;
11790                 *) cat <<EOM >&4
11791 Your strtoll() doesn't seem to be working okay.
11792 EOM
11793                    d_strtoll="$undef"
11794                    ;;
11795                 esac
11796         fi
11797         ;;
11798 esac
11799
11800 : see if strtoul exists
11801 set strtoul d_strtoul
11802 eval $inlibc
11803
11804 : see if strtoull exists
11805 set strtoull d_strtoull
11806 eval $inlibc
11807
11808 case "$d_longlong-$d_strtoull" in
11809 "$define-$define")
11810         $cat <<EOM
11811 Checking whether your strtoull() works okay...
11812 EOM
11813         $cat >try.c <<'EOCP'
11814 #include <errno.h>
11815 #ifdef __hpux
11816 #define strtoull __strtoull
11817 #endif
11818 #include <stdio.h>
11819 extern unsigned long long int strtoull(char *s, char **, int); 
11820 static int bad = 0;
11821 int check(char *s, long long eull, int een) {
11822         long long gull;
11823         errno = 0;
11824         gull = strtoull(s, 0, 10);
11825         if (!((gull == eull) && (errno == een)))
11826                 bad++;
11827 }
11828 int main() {
11829         check(" 1",                                       1LL, 0);
11830         check(" 0",                                       0LL, 0);
11831         check("18446744073709551615", 18446744073709551615ULL, 0);
11832         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11833         if (!bad)
11834                 printf("ok\n");
11835 }
11836 EOCP
11837         set try
11838         if eval $compile; then
11839                 case "`./try`" in
11840                 ok) echo "Your strtoull() seems to be working okay." ;;
11841                 *) cat <<EOM >&4
11842 Your strtoull() doesn't seem to be working okay.
11843 EOM
11844                    d_strtoull="$undef"
11845                    ;;
11846                 esac
11847         fi
11848         ;;
11849 esac
11850
11851 : see if strtouq exists
11852 set strtouq d_strtouq
11853 eval $inlibc
11854
11855 : see if strxfrm exists
11856 set strxfrm d_strxfrm
11857 eval $inlibc
11858
11859 : see if symlink exists
11860 set symlink d_symlink
11861 eval $inlibc
11862
11863 : see if syscall exists
11864 set syscall d_syscall
11865 eval $inlibc
11866
11867 : see if sysconf exists
11868 set sysconf d_sysconf
11869 eval $inlibc
11870
11871 : see if system exists
11872 set system d_system
11873 eval $inlibc
11874
11875 : see if tcgetpgrp exists
11876 set tcgetpgrp d_tcgetpgrp
11877 eval $inlibc
11878
11879 : see if tcsetpgrp exists
11880 set tcsetpgrp d_tcsetpgrp
11881 eval $inlibc
11882
11883 : see if prototype for telldir is available
11884 echo " "
11885 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11886 eval $hasproto
11887
11888 : see if this is a sys/times.h system
11889 set sys/times.h i_systimes
11890 eval $inhdr
11891
11892 : see if times exists
11893 echo " "
11894 if set times val -f d_times; eval $csym; $val; then
11895         echo 'times() found.' >&4
11896         d_times="$define"
11897         inc=''
11898         case "$i_systimes" in
11899         "$define") inc='sys/times.h';;
11900         esac
11901         rp="What is the type returned by times() on this system?"
11902         set clock_t clocktype long stdio.h sys/types.h $inc
11903         eval $typedef_ask
11904 else
11905         echo 'times() NOT found, hope that will do.' >&4
11906         d_times="$undef"
11907         clocktype='int'
11908 fi
11909
11910 : see if truncate exists
11911 set truncate d_truncate
11912 eval $inlibc
11913
11914 : see if tzname[] exists
11915 echo " "
11916 if set tzname val -a d_tzname; eval $csym; $val; then
11917         val="$define"
11918         echo 'tzname[] found.' >&4
11919 else
11920         val="$undef"
11921         echo 'tzname[] NOT found.' >&4
11922 fi
11923 set d_tzname
11924 eval $setvar
11925
11926 : see if umask exists
11927 set umask d_umask
11928 eval $inlibc
11929
11930 : see if ustat exists
11931 set ustat d_ustat
11932 eval $inlibc
11933
11934 : backward compatibility for d_hvfork
11935 if test X$d_hvfork != X; then
11936         d_vfork="$d_hvfork"
11937         d_hvfork=''
11938 fi
11939 : see if there is a vfork
11940 val=''
11941 set vfork val
11942 eval $inlibc
11943
11944 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11945 : perl on Solaris 2.x, and probably elsewhere.
11946 case "$val" in
11947 $define)
11948         echo " "
11949         case "$usevfork" in
11950         false) dflt='n';;
11951         *) dflt='y';;
11952         esac
11953         cat <<'EOM'
11954  
11955 Perl can only use a vfork() that doesn't suffer from strict
11956 restrictions on calling functions or modifying global data in
11957 the child.  For example, glibc-2.1 contains such a vfork()
11958 that is unsuitable.  If your system provides a proper fork()
11959 call, chances are that you do NOT want perl to use vfork().
11960
11961 EOM
11962         rp="Do you still want to use vfork()?"
11963         . ./myread
11964         case "$ans" in
11965         y|Y) ;;
11966         *)
11967                 echo "Ok, we won't use vfork()."
11968                 val="$undef"
11969                 ;;
11970         esac
11971         ;;
11972 esac
11973 set d_vfork
11974 eval $setvar
11975 case "$d_vfork" in
11976 $define) usevfork='true';;
11977 *) usevfork='false';;
11978 esac
11979
11980 : see if this is an sysdir system
11981 set sys/dir.h i_sysdir
11982 eval $inhdr
11983
11984 : see if this is an sysndir system
11985 set sys/ndir.h i_sysndir
11986 eval $inhdr
11987
11988 : see if closedir exists
11989 set closedir d_closedir
11990 eval $inlibc
11991
11992 case "$d_closedir" in
11993 "$define")
11994         echo " "
11995         echo "Checking whether closedir() returns a status..." >&4
11996         cat > closedir.c <<EOM
11997 #$i_dirent I_DIRENT             /**/
11998 #$i_sysdir I_SYS_DIR            /**/
11999 #$i_sysndir I_SYS_NDIR          /**/
12000 #$i_systypes I_SYS_TYPES        /**/
12001
12002 #if defined(I_SYS_TYPES)
12003 #include <sys/types.h>
12004 #endif
12005 #if defined(I_DIRENT)
12006 #include <dirent.h>
12007 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12008 #include <sys/dir.h>
12009 #endif
12010 #else
12011 #ifdef I_SYS_NDIR
12012 #include <sys/ndir.h>
12013 #else
12014 #ifdef I_SYS_DIR
12015 #ifdef hp9000s500
12016 #include <ndir.h>       /* may be wrong in the future */
12017 #else
12018 #include <sys/dir.h>
12019 #endif
12020 #endif
12021 #endif
12022 #endif 
12023 int main() { return closedir(opendir(".")); }
12024 EOM
12025         set closedir
12026         if eval $compile_ok; then
12027                 if ./closedir > /dev/null 2>&1 ; then
12028                         echo "Yes, it does."
12029                         val="$undef"
12030                 else
12031                         echo "No, it doesn't."
12032                         val="$define"
12033                 fi
12034         else
12035                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12036                 val="$define"
12037         fi
12038         ;;
12039 *)
12040         val="$undef";
12041         ;;
12042 esac
12043 set d_void_closedir
12044 eval $setvar
12045 $rm -f closedir*
12046 : check for volatile keyword
12047 echo " "
12048 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12049 $cat >try.c <<'EOCP'
12050 int main()
12051 {
12052         typedef struct _goo_struct goo_struct;
12053         goo_struct * volatile goo = ((goo_struct *)0);
12054         struct _goo_struct {
12055                 long long_int;
12056                 int reg_int;
12057                 char char_var;
12058         };
12059         typedef unsigned short foo_t;
12060         char *volatile foo;
12061         volatile int bar;
12062         volatile foo_t blech;
12063         foo = foo;
12064 }
12065 EOCP
12066 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12067         val="$define"
12068         echo "Yup, it does."
12069 else
12070         val="$undef"
12071         echo "Nope, it doesn't."
12072 fi
12073 set d_volatile
12074 eval $setvar
12075 $rm -f try.*
12076
12077 : see if there is a wait4
12078 set wait4 d_wait4
12079 eval $inlibc
12080
12081 : see if waitpid exists
12082 set waitpid d_waitpid
12083 eval $inlibc
12084
12085 : see if wcstombs exists
12086 set wcstombs d_wcstombs
12087 eval $inlibc
12088
12089 : see if wctomb exists
12090 set wctomb d_wctomb
12091 eval $inlibc
12092
12093 : preserve RCS keywords in files with variable substitution, grrr
12094 Date='$Date'
12095 Id='$Id'
12096 Log='$Log'
12097 RCSfile='$RCSfile'
12098 Revision='$Revision'
12099
12100 case "$crosscompile" in
12101 ''|[nN]*) crosscompile="$undef" ;;
12102 esac
12103
12104 case "$osname" in
12105 next|rhapsody|darwin) multiarch="$define" ;;
12106 esac
12107 case "$multiarch" in
12108 ''|[nN]*) multiarch="$undef" ;;
12109 esac
12110
12111 : check for alignment requirements
12112 echo " "
12113 case "$crosscompile$multiarch" in
12114 *$define*)
12115         $cat <<EOM
12116 You seem to be either cross-compiling or doing a multiarchitecture build,
12117 skipping the memory alignment check.
12118
12119 EOM
12120         case "$alignbytes" in
12121         '') alignbytes=8 ;;
12122         esac
12123         ;;
12124 *)
12125         case "$alignbytes" in
12126         '') echo "Checking alignment constraints..." >&4
12127                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12128                         $cat >try.c <<'EOCP'
12129 typedef long double NV;
12130 EOCP
12131                 else
12132                         $cat >try.c <<'EOCP'
12133 typedef double NV;
12134 EOCP
12135                 fi
12136                 $cat >>try.c <<'EOCP'
12137 #include <stdio.h>
12138 struct foobar {
12139         char foo;
12140         NV bar;
12141 } try_algn;
12142 int main()
12143 {
12144     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12145     return(0);
12146 }
12147 EOCP
12148                 set try
12149                 if eval $compile_ok; then
12150                         dflt=`./try`
12151                 else
12152                         dflt='8'
12153                         echo "(I can't seem to compile the test program...)"
12154                 fi
12155                 ;;
12156         *) dflt="$alignbytes"
12157                 ;;
12158         esac
12159         rp="Doubles must be aligned on a how-many-byte boundary?"
12160         . ./myread
12161         alignbytes="$ans"
12162         $rm -f try.c try
12163         ;;
12164 esac
12165
12166
12167 : set the base revision
12168 baserev=5.0
12169
12170 : check for ordering of bytes in a long
12171 echo " "
12172 case "$crosscompile$multiarch" in
12173 *$define*)
12174         $cat <<EOM
12175 You seem to be either cross-compiling or doing a multiarchitecture build,
12176 skipping the byteorder check.
12177
12178 EOM
12179         byteorder='0xffff'
12180         ;;
12181 *)
12182         case "$byteorder" in
12183         '')
12184                 $cat <<'EOM'
12185 In the following, larger digits indicate more significance.  A big-endian
12186 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12187 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12188 machines may have weird orders like 3412.  A Cray will report 87654321,
12189 an Alpha will report 12345678. If the test program works the default is
12190 probably right.
12191 I'm now running the test program...
12192 EOM
12193                 $cat >try.c <<'EOCP'
12194 #include <stdio.h>
12195 int main()
12196 {
12197         int i;
12198         union {
12199                 unsigned long l;
12200                 char c[sizeof(long)];
12201         } u;
12202
12203         if (sizeof(long) > 4)
12204                 u.l = (0x08070605L << 32) | 0x04030201L;
12205         else
12206                 u.l = 0x04030201L;
12207         for (i = 0; i < sizeof(long); i++)
12208                 printf("%c", u.c[i]+'0');
12209         printf("\n");
12210         exit(0);
12211 }
12212 EOCP
12213                 xxx_prompt=y
12214                 set try
12215                 if eval $compile && ./try > /dev/null; then
12216                         dflt=`./try`
12217                         case "$dflt" in
12218                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12219                                 echo "(The test program ran ok.)"
12220                                 echo "byteorder=$dflt"
12221                                 xxx_prompt=n
12222                         ;;
12223                         ????|????????) echo "(The test program ran ok.)" ;;
12224                         *) echo "(The test program didn't run right for some reason.)" ;;
12225                         esac
12226                 else
12227                         dflt='4321'
12228                         cat <<'EOM'
12229 (I can't seem to compile the test program.  Guessing big-endian...)
12230 EOM
12231                 fi
12232                 case "$xxx_prompt" in
12233                 y)
12234                         rp="What is the order of bytes in a long?"
12235                         . ./myread
12236                         byteorder="$ans"
12237                         ;;
12238                 *)      byteorder=$dflt
12239                         ;;
12240                 esac
12241                 ;;
12242         esac
12243         $rm -f try.c try
12244         ;;
12245 esac
12246
12247
12248 : how do we catenate cpp tokens here?
12249 echo " "
12250 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12251 $cat >cpp_stuff.c <<'EOCP'
12252 #define RCAT(a,b)a/**/b
12253 #define ACAT(a,b)a ## b
12254 RCAT(Rei,ser)
12255 ACAT(Cir,cus)
12256 EOCP
12257 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12258 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12259         echo "Oh!  Smells like ANSI's been here." >&4
12260         echo "We can catify or stringify, separately or together!"
12261         cpp_stuff=42
12262 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12263         echo "Ah, yes!  The good old days!" >&4
12264         echo "However, in the good old days we don't know how to stringify and"
12265         echo "catify at the same time."
12266         cpp_stuff=1
12267 else
12268         $cat >&4 <<EOM
12269 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12270 to have to edit the values of CAT[2-5] in config.h...
12271 EOM
12272         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12273 fi
12274 $rm -f cpp_stuff.*
12275
12276 : see if this is a db.h system
12277 set db.h i_db
12278 eval $inhdr
12279
12280 case "$i_db" in
12281 $define)
12282         : Check db version.
12283         echo " "
12284         echo "Checking Berkeley DB version ..." >&4
12285         $cat >try.c <<EOCP
12286 #$d_const HASCONST
12287 #ifndef HASCONST
12288 #define const
12289 #endif
12290 #include <sys/types.h>
12291 #include <stdio.h>
12292 #include <db.h>
12293 int main()
12294 {
12295 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12296     int Major, Minor, Patch ;
12297     unsigned long Version ;
12298     (void)db_version(&Major, &Minor, &Patch) ;
12299     printf("You have Berkeley DB Version 2 or greater\n");
12300
12301     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12302                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12303     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12304                 Major, Minor, Patch) ;
12305
12306     /* check that db.h & libdb are compatible */
12307     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12308         printf("db.h and libdb are incompatible\n") ;
12309         exit(3);        
12310     }
12311
12312     printf("db.h and libdb are compatible\n") ;
12313
12314     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12315                 + DB_VERSION_PATCH ;
12316
12317     /* needs to be >= 2.3.4 */
12318     if (Version < 2003004) {
12319     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12320         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12321         exit(2);        
12322     }
12323
12324     exit(0);
12325 #else
12326 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12327     printf("You have Berkeley DB Version 1\n");
12328     exit(0);    /* DB version < 2: the coast is clear. */
12329 #else
12330     exit(1);    /* <db.h> not Berkeley DB? */
12331 #endif
12332 #endif
12333 }
12334 EOCP
12335         set try
12336         if eval $compile_ok && ./try; then
12337                 echo 'Looks OK.' >&4
12338         else
12339                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12340                 i_db=$undef
12341                 case " $libs " in
12342                 *"-ldb "*)
12343                         : Remove db from list of libraries to use
12344                         echo "Removing unusable -ldb from library list" >&4
12345                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12346                         shift
12347                         libs="$*"
12348                         echo "libs = $libs" >&4
12349                         ;;
12350                 esac
12351         fi
12352         $rm -f try.*
12353         ;;
12354 esac
12355
12356 case "$i_db" in
12357 define)
12358         : Check the return type needed for hash 
12359         echo " "
12360         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12361         $cat >try.c <<EOCP
12362 #$d_const HASCONST
12363 #ifndef HASCONST
12364 #define const
12365 #endif
12366 #include <sys/types.h>
12367 #include <db.h>
12368
12369 #ifndef DB_VERSION_MAJOR
12370 u_int32_t hash_cb (ptr, size)
12371 const void *ptr;
12372 size_t size;
12373 {
12374 }
12375 HASHINFO info;
12376 int main()
12377 {
12378         info.hash = hash_cb;
12379 }
12380 #endif
12381 EOCP
12382         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12383                 if $contains warning try.out >>/dev/null 2>&1 ; then
12384                         db_hashtype='int'
12385                 else
12386                         db_hashtype='u_int32_t'
12387                 fi
12388         else
12389                 : XXX Maybe we should just give up here.
12390                 db_hashtype=u_int32_t
12391                 $cat try.out >&4
12392                 echo "Help:  I can't seem to compile the db test program." >&4
12393                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12394         fi
12395         $rm -f try.*
12396         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12397         ;;
12398 *)      db_hashtype=u_int32_t
12399         ;;
12400 esac
12401 case "$i_db" in
12402 define)
12403         : Check the return type needed for prefix 
12404         echo " "
12405         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12406         cat >try.c <<EOCP
12407 #$d_const HASCONST
12408 #ifndef HASCONST
12409 #define const
12410 #endif
12411 #include <sys/types.h>
12412 #include <db.h>
12413
12414 #ifndef DB_VERSION_MAJOR
12415 size_t prefix_cb (key1, key2)
12416 const DBT *key1;
12417 const DBT *key2;
12418 {
12419 }
12420 BTREEINFO info;
12421 int main()
12422 {
12423         info.prefix = prefix_cb;
12424 }
12425 #endif
12426 EOCP
12427         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12428                 if $contains warning try.out >>/dev/null 2>&1 ; then
12429                         db_prefixtype='int'
12430                 else
12431                         db_prefixtype='size_t'
12432                 fi
12433         else
12434                 db_prefixtype='size_t'
12435                 : XXX Maybe we should just give up here.
12436                 $cat try.out >&4
12437                 echo "Help:  I can't seem to compile the db test program." >&4
12438                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12439         fi
12440         $rm -f try.*
12441         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12442         ;;
12443 *)      db_prefixtype='size_t'
12444         ;;
12445 esac
12446
12447 : check for void type
12448 echo " "
12449 echo "Checking to see how well your C compiler groks the void type..." >&4
12450 case "$voidflags" in
12451 '')
12452         $cat >try.c <<'EOCP'
12453 #if TRY & 1
12454 void sub() {
12455 #else
12456 sub() {
12457 #endif
12458         extern void moo();      /* function returning void */
12459         void (*goo)();          /* ptr to func returning void */
12460 #if TRY & 8
12461         void *hue;              /* generic ptr */
12462 #endif
12463 #if TRY & 2
12464         void (*foo[10])();
12465 #endif
12466
12467 #if TRY & 4
12468         if(goo == moo) {
12469                 exit(0);
12470         }
12471 #endif
12472         exit(0);
12473 }
12474 int main() { sub(); }
12475 EOCP
12476         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12477                 voidflags=$defvoidused
12478         echo "Good.  It appears to support void to the level $package wants.">&4
12479                 if $contains warning .out >/dev/null 2>&1; then
12480                         echo "However, you might get some warnings that look like this:"
12481                         $cat .out
12482                 fi
12483         else
12484 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12485                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12486                         echo "It supports 1..."
12487                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12488                                 echo "It also supports 2..."
12489                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12490                                         voidflags=7
12491                                         echo "And it supports 4 but not 8 definitely."
12492                                 else
12493                                         echo "It doesn't support 4..."
12494                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12495                                                 voidflags=11
12496                                                 echo "But it supports 8."
12497                                         else
12498                                                 voidflags=3
12499                                                 echo "Neither does it support 8."
12500                                         fi
12501                                 fi
12502                         else
12503                                 echo "It does not support 2..."
12504                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12505                                         voidflags=13
12506                                         echo "But it supports 4 and 8."
12507                                 else
12508                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12509                                                 voidflags=5
12510                                                 echo "And it supports 4 but has not heard about 8."
12511                                         else
12512                                                 echo "However it supports 8 but not 4."
12513                                         fi
12514                                 fi
12515                         fi
12516                 else
12517                         echo "There is no support at all for void."
12518                         voidflags=0
12519                 fi
12520         fi
12521 esac
12522 case "$voidflags" in
12523 "$defvoidused") ;;
12524 *)      $cat >&4 <<'EOM'
12525   Support flag bits are:
12526     1: basic void declarations.
12527     2: arrays of pointers to functions returning void.
12528     4: operations between pointers to and addresses of void functions.
12529     8: generic void pointers.
12530 EOM
12531         dflt="$voidflags";
12532         rp="Your void support flags add up to what?"
12533         . ./myread
12534         voidflags="$ans"
12535         ;;
12536 esac
12537 $rm -f try.* .out
12538
12539
12540 : How can we generate normalized random numbers ?
12541 echo " "
12542 echo "Looking for a random number function..." >&4
12543 case "$randfunc" in
12544 '')
12545         if set drand48 val -f; eval $csym; $val; then
12546                 dflt="drand48"
12547                 echo "Good, found drand48()." >&4
12548         elif set random val -f; eval $csym; $val; then
12549                 dflt="random"
12550                 echo "OK, found random()." >&4
12551         else
12552                 dflt="rand"
12553                 echo "Yick, looks like I have to use rand()." >&4
12554         fi
12555         echo " "
12556         ;;
12557 *)
12558         dflt="$randfunc"
12559         ;;
12560 esac
12561 cont=true
12562
12563 case "$ccflags" in
12564 *-Dmy_rand=*|*-Dmy_srand=*)
12565         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12566         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12567         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12568         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12569         ;;
12570 esac
12571
12572 while $test "$cont"; do
12573         rp="Use which function to generate random numbers?"
12574         . ./myread
12575         if $test "$ans" = "$dflt"; then
12576                 : null
12577         else
12578                 randbits=''
12579         fi
12580         randfunc="$ans"
12581         if set $ans val -f; eval $csym; $val; then
12582                 cont=''
12583         else
12584                 dflt=y
12585                 rp="I cannot find function $ans. Use that name anyway?"
12586                 . ./myread
12587                 dflt=rand
12588                 case "$ans" in
12589                         [yY]*) cont='';;
12590                 esac
12591         fi
12592         case "$cont" in
12593         '')
12594                 case "$randfunc" in
12595                 drand48)
12596                         drand01="drand48()"
12597                         seedfunc="srand48"
12598                         randbits=48
12599                         randseedtype=long
12600                         ;;
12601                 rand|random)
12602                         case "$randbits" in
12603                         '')
12604 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12605                                 $cat >try.c <<EOCP
12606 #$i_unistd I_UNISTD
12607 #$i_stdlib I_STDLIB
12608 #include <stdio.h>
12609 #ifdef I_UNISTD
12610 #  include <unistd.h>
12611 #endif
12612 #ifdef I_STDLIB
12613 #  include <stdlib.h>
12614 #endif
12615 int main()
12616 {
12617         register int i;
12618         register unsigned long tmp;
12619         register unsigned long max = 0L;
12620
12621         for (i = 1000; i; i--) {
12622                 tmp = (unsigned long) $randfunc();
12623                 if (tmp > max) max = tmp;
12624         }
12625         for (i = 0; max; i++)
12626                 max /= 2;
12627         printf("%d\n",i);
12628 }
12629 EOCP
12630                                 set try
12631                                 if eval $compile_ok; then
12632                                         dflt=`try`
12633                                 else
12634                                         dflt='?'
12635                                         echo "(I can't seem to compile the test program...)"
12636                                 fi
12637                                 ;;
12638                         *)
12639                                 dflt="$randbits"
12640                                 ;;
12641                         esac
12642                         rp="How many bits does your $randfunc() function produce?"
12643                         . ./myread
12644                         randbits="$ans"
12645                         $rm -f try.c try
12646                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12647                         seedfunc="s$randfunc"
12648                         randseedtype=unsigned
12649                         ;;
12650                 *)
12651                         dflt="31"
12652                         rp="How many bits does your $randfunc() function produce?"
12653                         . ./myread
12654                         randbits="$ans"
12655                         seedfunc="s$randfunc"
12656                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12657                         if set $seedfunc val -f; eval $csym; $val; then
12658                                 echo "(Using $seedfunc() to seed random generator)"
12659                         else
12660                                 echo "(Warning: no $seedfunc() to seed random generator)"
12661                                 seedfunc=rand
12662                         fi
12663                         randseedtype=unsigned
12664                         ;;
12665                 esac
12666                 ;;
12667         esac
12668 done
12669
12670 echo " "
12671 echo "Determining whether or not we are on an EBCDIC system..." >&4
12672 $cat >tebcdic.c <<'EOM'
12673 int main()
12674 {
12675   if ('M'==0xd4) return 0;
12676   return 1;
12677 }
12678 EOM
12679
12680 val=$undef
12681 set tebcdic
12682 if eval $compile_ok; then
12683         if ./tebcdic; then
12684                 echo "You have EBCDIC." >&4
12685                 val="$define"
12686         else
12687                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12688         fi
12689 else
12690         echo "I'm unable to compile the test program." >&4
12691         echo "I'll assume ASCII or some ISO Latin." >&4
12692 fi
12693 $rm -f tebcdic.c tebcdic
12694 set ebcdic
12695 eval $setvar
12696
12697 echo " "
12698 $cat >&4 <<EOM
12699 Checking how to flush all pending stdio output...
12700 EOM
12701 # I only know how to find the first 32 possibly open files on SunOS.
12702 # See also hints/sunos_4_1.sh and util.c  --AD
12703 case "$osname" in
12704 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12705 esac
12706 $cat >>try.c <<EOCP
12707 #include <stdio.h>
12708 #$i_unistd I_UNISTD
12709 #ifdef I_UNISTD
12710 # include <unistd.h>
12711 #endif
12712 #$d_sysconf HAS_SYSCONF
12713 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12714 #ifdef HAS_STDIO_STREAM_ARRAY
12715 # define STDIO_STREAM_ARRAY $stdio_stream_array
12716 #endif
12717 int main() {
12718   FILE* p = fopen("try.out", "w");
12719 #ifdef TRY_FPUTC
12720   fputc('x', p);
12721 #else
12722 # ifdef TRY_FPRINTF
12723   fprintf(p, "x");
12724 # endif
12725 #endif
12726 #ifdef TRY_FFLUSH_NULL
12727   fflush(NULL);
12728 #endif
12729 #ifdef TRY_FFLUSH_ALL
12730   {
12731     long open_max = -1;
12732 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12733     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12734 # else
12735 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12736     open_max = sysconf(_SC_OPEN_MAX);
12737 #  else
12738 #   ifdef FOPEN_MAX
12739     open_max = FOPEN_MAX;
12740 #   else
12741 #    ifdef OPEN_MAX
12742     open_max = OPEN_MAX;
12743 #    else
12744 #     ifdef _NFILE
12745     open_max = _NFILE;
12746 #     endif
12747 #    endif
12748 #   endif
12749 #  endif
12750 # endif 
12751 # ifdef HAS_STDIO_STREAM_ARRAY
12752     if (open_max > 0) {
12753       long i;
12754       for (i = 0; i < open_max; i++)
12755             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12756                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12757                 STDIO_STREAM_ARRAY[i]._flag)
12758                 fflush(&STDIO_STREAM_ARRAY[i]);
12759     }   
12760   }
12761 # endif
12762 #endif
12763   _exit(42);
12764 }
12765 EOCP
12766 : first we have to find out how _not_ to flush
12767 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12768     output=''
12769     set try -DTRY_FPUTC
12770     if eval $compile; then
12771             $rm -f try.out
12772             ./try$exe_ext 2>/dev/null
12773             if $test ! -s try.out -a "X$?" = X42; then
12774                 output=-DTRY_FPUTC
12775             fi
12776     fi
12777     case "$output" in
12778     '')
12779             set try -DTRY_FPRINTF
12780             $rm -f try.out
12781             if eval $compile; then
12782                     $rm -f try.out
12783                     ./try$exe_ext 2>/dev/null
12784                     if $test ! -s try.out -a "X$?" = X42; then
12785                         output=-DTRY_FPRINTF
12786                     fi
12787             fi
12788         ;;
12789     esac
12790 fi
12791 : check for fflush NULL behaviour
12792 case "$fflushNULL" in
12793 '')     set try -DTRY_FFLUSH_NULL $output
12794         if eval $compile; then
12795                 $rm -f try.out
12796                 ./try$exe_ext 2>/dev/null
12797                 code="$?"
12798                 if $test -s try.out -a "X$code" = X42; then
12799                         fflushNULL="`$cat try.out`"
12800                 else
12801                         if $test "X$code" != X42; then
12802                                 $cat >&4 <<EOM
12803 (If this test failed, don't worry, we'll try another method shortly.)
12804 EOM
12805                         fi
12806                 fi
12807         fi
12808         $rm -f core try.core core.try.*
12809         case "$fflushNULL" in
12810         x)      $cat >&4 <<EOM
12811 Your fflush(NULL) works okay for output streams.
12812 Let's see if it clobbers input pipes...
12813 EOM
12814 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12815 # bug that improperly flushes the input end of pipes.  So we avoid the
12816 # autoflush on fork/system/exec support for now. :-(
12817 $cat >tryp.c <<EOCP
12818 #include <stdio.h>
12819 int
12820 main(int argc, char **argv)
12821 {
12822     char buf[1024];
12823     int i;
12824     char *bp = buf;
12825     while (1) {
12826         while ((i = getc(stdin)) != -1
12827                && (*bp++ = i) != '\n'
12828                && bp < &buf[1024])
12829         /* DO NOTHING */ ;
12830         *bp = '\0';
12831         fprintf(stdout, "%s", buf);
12832         fflush(NULL);
12833         if (i == -1)
12834             return 0;
12835         bp = buf;
12836     }
12837 }
12838 EOCP
12839                 fflushNULL="$define"
12840                 set tryp
12841                 if eval $compile; then
12842                     $rm -f tryp.out
12843                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12844                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12845                        $cat >&4 <<EOM
12846 fflush(NULL) seems to behave okay with input streams.
12847 EOM
12848                         fflushNULL="$define"
12849                     else
12850                         $cat >&4 <<EOM
12851 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12852 EOM
12853                         fflushNULL="$undef"
12854                     fi
12855                 fi
12856                 $rm -f core tryp.c tryp.core core.tryp.*
12857                 ;;
12858         '')     $cat >&4 <<EOM
12859 Your fflush(NULL) isn't working (contrary to ANSI C).
12860 EOM
12861                 fflushNULL="$undef"
12862                 ;;
12863         *)      $cat >&4 <<EOM
12864 Cannot figure out whether your fflush(NULL) works or not.
12865 I'm assuming it doesn't (contrary to ANSI C).
12866 EOM
12867                 fflushNULL="$undef"
12868                 ;;
12869         esac
12870         ;;
12871 $define|true|[yY]*)
12872         fflushNULL="$define"
12873         ;;
12874 *)
12875         fflushNULL="$undef"
12876         ;;
12877 esac
12878 : check explicit looping only if NULL did not work, and if the pipe
12879 : bug does not show up on an explicit flush too
12880 case "$fflushNULL" in
12881 "$undef")
12882         $cat >tryp.c <<EOCP
12883 #include <stdio.h>
12884 int
12885 main(int argc, char **argv)
12886 {
12887     char buf[1024];
12888     int i;
12889     char *bp = buf;
12890     while (1) {
12891         while ((i = getc(stdin)) != -1
12892                && (*bp++ = i) != '\n'
12893                && bp < &buf[1024])
12894         /* DO NOTHING */ ;
12895         *bp = '\0';
12896         fprintf(stdout, "%s", buf);
12897         fflush(stdin);
12898         if (i == -1)
12899             return 0;
12900         bp = buf;
12901     }
12902 }
12903 EOCP
12904         set tryp
12905         if eval $compile; then
12906             $rm -f tryp.out
12907             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12908             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12909                $cat >&4 <<EOM
12910 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12911 EOM
12912                 : now check for fflushall behaviour
12913                 case "$fflushall" in
12914                 '')     set try -DTRY_FFLUSH_ALL $output
12915                         if eval $compile; then
12916                                 $cat >&4 <<EOM
12917 (Now testing the other method--but note that this also may fail.)
12918 EOM
12919                                 $rm -f try.out
12920                                 ./try$exe_ext 2>/dev/null
12921                                 if $test -s try.out -a "X$?" = X42; then
12922                                         fflushall="`$cat try.out`"
12923                                 fi
12924                         fi
12925                         $rm -f core try.core core.try.*
12926                         case "$fflushall" in
12927                         x)      $cat >&4 <<EOM
12928 Whew. Flushing explicitly all the stdio streams works.
12929 EOM
12930                                 fflushall="$define"
12931                                 ;;
12932                         '')     $cat >&4 <<EOM
12933 Sigh. Flushing explicitly all the stdio streams doesn't work.
12934 EOM
12935                                 fflushall="$undef"
12936                                 ;;
12937                         *)      $cat >&4 <<EOM
12938 Cannot figure out whether flushing stdio streams explicitly works or not.
12939 I'm assuming it doesn't.
12940 EOM
12941                                 fflushall="$undef"
12942                                 ;;
12943                         esac
12944                         ;;
12945                 "$define"|true|[yY]*)
12946                         fflushall="$define"
12947                         ;;
12948                 *)
12949                         fflushall="$undef"
12950                         ;;
12951                 esac
12952             else
12953                 $cat >&4 <<EOM
12954 All is futile.  Even fflush(stdin) clobbers input pipes!
12955 EOM
12956                 fflushall="$undef"
12957             fi
12958         else
12959             fflushall="$undef"
12960         fi
12961         $rm -f core tryp.c tryp.core core.tryp.*
12962         ;;
12963 *)      fflushall="$undef"
12964         ;;
12965 esac
12966
12967 case "$fflushNULL$fflushall" in
12968 undefundef)
12969         $cat <<EOM
12970 OK, I give up.  I cannot figure out how to flush pending stdio output.
12971 We won't be flushing handles at all before fork/exec/popen.
12972 EOM
12973         ;;
12974 esac
12975 $rm -f try.* try$exe_ext
12976
12977 : Store the full pathname to the ar program for use in the C program
12978 : Respect a hint or command line value for full_ar.
12979 case "$full_ar" in
12980 '') full_ar=$ar ;;
12981 esac
12982
12983 : Store the full pathname to the sed program for use in the C program
12984 full_sed=$sed
12985
12986 : see what type gids are declared as in the kernel
12987 echo " "
12988 echo "Looking for the type for group ids returned by getgid()."
12989 set gid_t gidtype xxx stdio.h sys/types.h
12990 eval $typedef
12991 case "$gidtype" in
12992 xxx)
12993         xxx=`./findhdr sys/user.h`
12994         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12995         case $1 in
12996         unsigned) dflt="$1 $2" ;;
12997         *) dflt="$1" ;;
12998         esac
12999         ;;
13000 *) dflt="$gidtype";;
13001 esac
13002 case "$gidtype" in
13003 gid_t) echo "gid_t found." ;;
13004 *)      rp="What is the type for group ids returned by getgid()?"
13005         . ./myread
13006         gidtype="$ans"
13007         ;;
13008 esac
13009
13010 echo " "
13011 case "$gidtype" in
13012 *_t) zzz="$gidtype"     ;;
13013 *)   zzz="gid"          ;;
13014 esac
13015 echo "Checking the size of $zzz..." >&4 
13016 cat > try.c <<EOCP
13017 #include <sys/types.h>
13018 #include <stdio.h>
13019 int main() {
13020     printf("%d\n", (int)sizeof($gidtype));
13021     exit(0);
13022 }
13023 EOCP
13024 set try
13025 if eval $compile_ok; then
13026         yyy=`./try`
13027         case "$yyy" in
13028         '')     gidsize=4
13029                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13030                 ;;
13031         *)      gidsize=$yyy
13032                 echo "Your $zzz is $gidsize bytes long."
13033                 ;;
13034         esac
13035 else
13036         gidsize=4
13037         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13038 fi
13039
13040
13041 echo " "
13042 case "$gidtype" in
13043 *_t) zzz="$gidtype"     ;;
13044 *)   zzz="gid"          ;;
13045 esac
13046 echo "Checking the sign of $zzz..." >&4 
13047 cat > try.c <<EOCP
13048 #include <sys/types.h>
13049 #include <stdio.h>
13050 int main() {
13051         $gidtype foo = -1;
13052         if (foo < 0)
13053                 printf("-1\n");
13054         else
13055                 printf("1\n");
13056 }
13057 EOCP
13058 set try
13059 if eval $compile; then
13060         yyy=`./try`
13061         case "$yyy" in
13062         '')     gidsign=1
13063                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13064                 ;;
13065         *)      gidsign=$yyy
13066                 case "$gidsign" in
13067                  1) echo "Your $zzz is unsigned." ;;
13068                 -1) echo "Your $zzz is signed."   ;;
13069                 esac
13070                 ;;
13071         esac
13072 else
13073         gidsign=1
13074         echo "(I can't compile the test program--guessing unsigned.)" >&4
13075 fi
13076
13077
13078 echo " "
13079
13080 if $test X"$quadtype" != X; then
13081
13082 echo "Checking how to print 64-bit integers..." >&4
13083
13084 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13085         $cat >try.c <<'EOCP'
13086 #include <sys/types.h>
13087 #include <stdio.h>
13088 int main() {
13089   int q = 12345678901;
13090   printf("%ld\n", q);
13091 }
13092 EOCP
13093         set try
13094         if eval $compile; then
13095                 yyy=`./try$exe_ext`
13096                 case "$yyy" in
13097                 12345678901)
13098                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13099                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
13100                         echo "We will use %d."
13101                         ;;
13102                 esac
13103         fi
13104 fi
13105
13106 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13107         $cat >try.c <<'EOCP'
13108 #include <sys/types.h>
13109 #include <stdio.h>
13110 int main() {
13111   long q = 12345678901;
13112   printf("%ld\n", q);
13113 }
13114 EOCP
13115         set try
13116         if eval $compile; then
13117                 yyy=`./try$exe_ext`
13118                 case "$yyy" in
13119                 12345678901)
13120                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13121                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
13122                         echo "We will use %ld."
13123                         ;;
13124                 esac
13125         fi
13126 fi
13127
13128 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13129         $cat >try.c <<'EOCP'
13130 #include <sys/types.h>
13131 #include <inttypes.h>
13132 #include <stdio.h>
13133 int main() {
13134   int64_t q = 12345678901;
13135   printf("%" PRId64 "\n", q);
13136 }
13137 EOCP
13138         set try
13139         if eval $compile; then
13140                 yyy=`./try$exe_ext`
13141                 case "$yyy" in
13142                 12345678901)
13143                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13144                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13145                         echo "We will use the C9X style."
13146                         ;;
13147                 esac
13148         fi
13149 fi
13150
13151 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13152         $cat >try.c <<'EOCP'
13153 #include <sys/types.h>
13154 #include <stdio.h>
13155 int main() {
13156   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13157   printf("%lld\n", q);
13158 }
13159 EOCP
13160         set try
13161         if eval $compile; then
13162                 yyy=`./try$exe_ext`
13163                 case "$yyy" in
13164                 12345678901)
13165                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13166                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13167                         echo "We will use the %lld style."
13168                         ;;
13169                 esac
13170         fi
13171 fi
13172
13173 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13174         $cat >try.c <<EOCP
13175 #include <sys/types.h>
13176 #include <stdio.h>
13177 int main() {
13178   $quadtype q = 12345678901;
13179   printf("%Ld\n", q);
13180 }
13181 EOCP
13182         set try
13183         if eval $compile; then
13184                 yyy=`./try$exe_ext`
13185                 case "$yyy" in
13186                 12345678901)
13187                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13188                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13189                         echo "We will use %Ld."
13190                         ;;
13191                 esac
13192         fi
13193 fi
13194
13195 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13196         $cat >try.c <<EOCP
13197 #include <sys/types.h>
13198 #include <stdio.h>
13199 int main() {
13200   $quadtype q = 12345678901;
13201   printf("%qd\n", q);
13202 }
13203 EOCP
13204         set try
13205         if eval $compile; then
13206                 yyy=`./try$exe_ext`
13207                 case "$yyy" in
13208                 12345678901)
13209                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13210                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13211                         echo "We will use %qd."
13212                         ;;
13213                 esac
13214         fi
13215 fi
13216
13217 if $test X"$sPRId64" = X; then
13218         echo "Cannot figure out how to print 64-bit integers." >&4
13219 fi
13220
13221 $rm -f try try.*
13222
13223 fi
13224
13225 case "$sPRId64" in
13226 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13227         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13228         ;;
13229 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13230         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13231         ;;
13232 esac
13233
13234
13235 echo " "
13236 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13237
13238 if $test X"$ivsize" = X8; then
13239         ivdformat="$sPRId64"
13240         uvuformat="$sPRIu64"
13241         uvoformat="$sPRIo64"
13242         uvxformat="$sPRIx64"
13243 else
13244         if $test X"$ivsize" = X"$longsize"; then
13245                 ivdformat='"ld"'
13246                 uvuformat='"lu"'
13247                 uvoformat='"lo"'
13248                 uvxformat='"lx"'
13249         else
13250                 if $test X"$ivsize" = X"$intsize"; then
13251                         ivdformat='"d"'
13252                         uvuformat='"u"'
13253                         uvoformat='"o"'
13254                         uvxformat='"x"'
13255                 else
13256                         : far out
13257                         if $test X"$ivsize" = X"$shortsize"; then
13258                                 ivdformat='"hd"'
13259                                 uvuformat='"hu"'
13260                                 uvoformat='"ho"'
13261                                 uvxformat='"hx"'
13262                         fi
13263                 fi
13264         fi
13265 fi
13266
13267 case "$ivdformat" in
13268 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13269     exit 1
13270     ;;
13271 esac
13272
13273
13274 echo " "
13275 $echo "Checking the format string to be used for gids..." >&4
13276
13277 case "$gidsign" in
13278 -1)     if $test X"$gidsize" = X"$ivsize"; then
13279                 gidformat="$ivdformat"
13280         else
13281                 if $test X"$gidsize" = X"$longsize"; then
13282                         gidformat='"ld"'
13283                 else
13284                         if $test X"$gidsize" = X"$intsize"; then
13285                                 gidformat='"d"'
13286                         else
13287                                 if $test X"$gidsize" = X"$shortsize"; then
13288                                         gidformat='"hd"'
13289                                 fi
13290                         fi
13291                 fi
13292         fi
13293         ;;
13294 *)      if $test X"$gidsize" = X"$uvsize"; then
13295                 gidformat="$uvuformat"
13296         else
13297                 if $test X"$gidsize" = X"$longsize"; then
13298                         gidformat='"lu"'
13299                 else
13300                         if $test X"$gidsize" = X"$intsize"; then
13301                                 gidformat='"u"'
13302                         else
13303                                 if $test X"$gidsize" = X"$shortsize"; then
13304                                         gidformat='"hu"'
13305                                 fi
13306                         fi
13307                 fi
13308         fi
13309         ;;
13310 esac
13311
13312 : see if getgroups exists
13313 set getgroups d_getgrps
13314 eval $inlibc
13315
13316 : see if setgroups exists
13317 set setgroups d_setgrps
13318 eval $inlibc
13319
13320
13321 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13322 echo " "
13323 case "$d_getgrps$d_setgrps" in
13324 *define*)
13325         case "$groupstype" in
13326         '') dflt="$gidtype" ;;
13327         *)  dflt="$groupstype" ;;
13328         esac
13329         $cat <<EOM
13330 What type of pointer is the second argument to getgroups() and setgroups()?
13331 Usually this is the same as group ids, $gidtype, but not always.
13332
13333 EOM
13334         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13335         . ./myread
13336         groupstype="$ans"
13337         ;;
13338 *)  groupstype="$gidtype";;
13339 esac
13340
13341 echo " "
13342 echo "Checking if your $make program sets \$(MAKE)..." >&4
13343 case "$make_set_make" in
13344 '')
13345         $sed 's/^X //' > testmake.mak << 'EOF'
13346 Xall:
13347 X       @echo 'maketemp="$(MAKE)"'
13348 EOF
13349         case "`$make -f testmake.mak 2>/dev/null`" in
13350         *maketemp=*) make_set_make='#' ;;
13351         *)      make_set_make="MAKE=$make" ;;
13352         esac
13353         $rm -f testmake.mak
13354         ;;
13355 esac
13356 case "$make_set_make" in
13357 '#') echo "Yup, it does.";;
13358 *) echo "Nope, it doesn't.";;
13359 esac
13360
13361 : see what type is used for mode_t
13362 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13363 set mode_t modetype int stdio.h sys/types.h
13364 eval $typedef_ask
13365
13366 : define a fucntion to check prototypes
13367 $cat > protochk <<EOSH
13368 $startsh
13369 cc="$cc"
13370 optimize="$optimize"
13371 ccflags="$ccflags"
13372 prototype="$prototype"
13373 define="$define"
13374 rm=$rm
13375 EOSH
13376
13377 $cat >> protochk <<'EOSH'
13378
13379 $rm -f try.c
13380 foo="$1"
13381 shift
13382 while test $# -ge 2; do
13383         case "$1" in
13384                 $define) echo "#include <$2>" >> try.c ;;
13385                 literal) echo "$2" >> try.c ;;
13386         esac
13387     shift 2
13388 done
13389 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13390 cat >> try.c <<'EOCP'
13391 #ifdef CAN_PROTOTYPE
13392 #define _(args) args
13393 #else
13394 #define _(args) ()
13395 #endif
13396 EOCP
13397 echo "$foo" >> try.c
13398 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13399 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13400 status=$?
13401 $rm -f try.[co]
13402 exit $status
13403 EOSH
13404 chmod +x protochk
13405 $eunicefix protochk
13406
13407 : see what type is used for size_t
13408 rp="What is the type used for the length parameter for string functions?"
13409 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13410 eval $typedef_ask
13411
13412 : check for type of arguments to gethostbyaddr. 
13413 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13414         case "$d_gethbyaddr" in
13415         $define)
13416                 $cat <<EOM
13417
13418 Checking to see what type of arguments are accepted by gethostbyaddr().
13419 EOM
13420                 hdrs="$define sys/types.h
13421                         $d_socket sys/socket.h 
13422                         $i_niin netinet/in.h 
13423                         $i_netdb netdb.h
13424                         $i_unistd unistd.h"
13425                 : The first arg can 'char *' or 'void *'
13426                 : The second arg is some of integral type
13427                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13428                         for yyy in size_t long int; do
13429                                 case "$netdb_host_type" in
13430                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13431                                         if ./protochk "$try" $hdrs; then
13432                                                 echo "Your system accepts $xxx for the first arg."
13433                                                 echo "...and $yyy for the second arg."
13434                                                 netdb_host_type="$xxx"
13435                                                 netdb_hlen_type="$yyy"
13436                                         fi
13437                                         ;;
13438                                 esac
13439                         done
13440                 done
13441                 : In case none of those worked, prompt the user.
13442                 case "$netdb_host_type" in
13443                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13444                         dflt='char *'
13445                         . ./myread
13446                         netdb_host_type=$ans
13447                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13448                         dflt="$sizetype"
13449                         . ./myread
13450                         netdb_hlen_type=$ans
13451                         ;;
13452                 esac
13453                 ;;
13454         *)      : no gethostbyaddr, so pick harmless defaults
13455                 netdb_host_type='char *'
13456                 netdb_hlen_type="$sizetype"
13457                 ;;
13458         esac
13459         # Remove the "const" if needed. -- but then we'll have a 
13460         # prototype clash!
13461         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13462 fi
13463
13464 : check for type of argument to gethostbyname. 
13465 if test "X$netdb_name_type" = X ; then
13466         case "$d_gethbyname" in
13467         $define)
13468                 $cat <<EOM
13469
13470 Checking to see what type of argument is accepted by gethostbyname().
13471 EOM
13472                 hdrs="$define sys/types.h
13473                         $d_socket sys/socket.h 
13474                         $i_niin netinet/in.h 
13475                         $i_netdb netdb.h
13476                         $i_unistd unistd.h"
13477                 for xxx in "const char *" "char *"; do
13478                         case "$netdb_name_type" in
13479                         '')     try="extern struct hostent *gethostbyname($xxx);"
13480                                 if ./protochk "$try" $hdrs; then
13481                                         echo "Your system accepts $xxx."
13482                                         netdb_name_type="$xxx"
13483                                 fi
13484                                 ;;
13485                         esac
13486                 done
13487                 : In case none of those worked, prompt the user.
13488                 case "$netdb_name_type" in
13489                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13490                         dflt='char *'
13491                         . ./myread
13492                         netdb_name_type=$ans
13493                         ;;
13494                 esac
13495                 ;;
13496         *)      : no gethostbyname, so pick harmless default
13497                 netdb_name_type='char *'
13498                 ;;
13499         esac
13500 fi
13501
13502 : check for type of 1st argument to getnetbyaddr. 
13503 if test "X$netdb_net_type" = X ; then
13504         case "$d_getnbyaddr" in
13505         $define)
13506                 $cat <<EOM
13507
13508 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13509 EOM
13510                 hdrs="$define sys/types.h
13511                         $d_socket sys/socket.h 
13512                         $i_niin netinet/in.h 
13513                         $i_netdb netdb.h
13514                         $i_unistd unistd.h"
13515                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13516                         case "$netdb_net_type" in
13517                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13518                                 if ./protochk "$try" $hdrs; then
13519                                         echo "Your system accepts $xxx."
13520                                         netdb_net_type="$xxx"
13521                                 fi
13522                                 ;;
13523                         esac
13524                 done
13525                 : In case none of those worked, prompt the user.
13526                 case "$netdb_net_type" in
13527                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13528                         dflt='long'
13529                         . ./myread
13530                         netdb_net_type=$ans
13531                         ;;
13532                 esac
13533                 ;;
13534         *)      : no getnetbyaddr, so pick harmless default
13535                 netdb_net_type='long'
13536                 ;;
13537         esac
13538 fi
13539 : locate the preferred pager for this system
13540 case "$pager" in
13541 '')
13542         dflt=''
13543         case "$pg" in
13544         /*) dflt=$pg;;
13545         esac
13546         case "$more" in
13547         /*) dflt=$more;;
13548         esac
13549         case "$less" in
13550         /*) dflt=$less;;
13551         esac
13552         case "$dflt" in
13553         '') dflt=/usr/ucb/more;;
13554         esac
13555         ;;
13556 *) dflt="$pager";;
13557 esac
13558 echo " "
13559 fn=f/
13560 rp='What pager is used on your system?'
13561 . ./getfile
13562 pager="$ans"
13563
13564 : see what type pids are declared as in the kernel
13565 rp="What is the type of process ids on this system?"
13566 set pid_t pidtype int stdio.h sys/types.h
13567 eval $typedef_ask
13568
13569 : Find earliest binary compatible site_perl subdirectory perl can use.
13570 case "$bincompat5005" in
13571 "$define") xs_apiversion='5.005' ;;
13572 *) xs_apiversion=$version ;;   # The current site_perl version.
13573 esac
13574 : Find earliest pure perl site_perl subdirectory perl can use.
13575 : The versioned directories started at 5.005.
13576 pm_apiversion='5.005'
13577
13578 : check for length of pointer
13579 echo " "
13580 case "$ptrsize" in
13581 '')
13582         echo "Checking to see how big your pointers are..." >&4
13583         if test "$voidflags" -gt 7; then
13584                 echo '#define VOID_PTR char *' > try.c
13585         else
13586                 echo '#define VOID_PTR void *' > try.c
13587         fi
13588         $cat >>try.c <<'EOCP'
13589 #include <stdio.h>
13590 int main()
13591 {
13592     printf("%d\n", (int)sizeof(VOID_PTR));
13593     exit(0);
13594 }
13595 EOCP
13596         set try
13597         if eval $compile_ok; then
13598                 ptrsize=`./try`
13599                 echo "Your pointers are $ptrsize bytes long."
13600         else
13601                 dflt='4'
13602                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13603                 rp="What is the size of a pointer (in bytes)?"
13604                 . ./myread
13605                 ptrsize="$ans"
13606         fi
13607         ;;
13608 esac
13609 $rm -f try.c try
13610
13611 : see if ar generates random libraries by itself
13612 echo " "
13613 echo "Checking how to generate random libraries on your machine..." >&4
13614 echo 'int bar1() { return bar2(); }' > bar1.c
13615 echo 'int bar2() { return 2; }' > bar2.c
13616 $cat > foo.c <<'EOP'
13617 int main() { printf("%d\n", bar1()); exit(0); }
13618 EOP
13619 $cc $ccflags -c bar1.c >/dev/null 2>&1
13620 $cc $ccflags -c bar2.c >/dev/null 2>&1
13621 $cc $ccflags -c foo.c >/dev/null 2>&1
13622 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13623 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13624         ./foobar >/dev/null 2>&1; then
13625         echo "$ar appears to generate random libraries itself."
13626         orderlib=false
13627         ranlib=":"
13628 elif $ar ts bar$_a >/dev/null 2>&1 &&
13629         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13630         ./foobar >/dev/null 2>&1; then
13631                 echo "a table of contents needs to be added with '$ar ts'."
13632                 orderlib=false
13633                 ranlib="$ar ts"
13634 else
13635         case "$ranlib" in
13636         :) ranlib='';;
13637         '')
13638                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13639                 $test -f $ranlib || ranlib=''
13640                 ;;
13641         esac
13642         if $test -n "$ranlib"; then
13643                 echo "your system has '$ranlib'; we'll use that."
13644                 orderlib=false
13645         else
13646                 echo "your system doesn't seem to support random libraries"
13647                 echo "so we'll use lorder and tsort to order the libraries."
13648                 orderlib=true
13649                 ranlib=":"
13650         fi
13651 fi
13652 $rm -f foo* bar* 
13653
13654 : check for type of arguments to select. 
13655 case "$selecttype" in
13656 '') case "$d_select" in
13657         $define)
13658                 echo " "
13659                 $cat <<EOM
13660 Checking to see what type of arguments are accepted by select().
13661 EOM
13662                 hdrs="$define sys/types.h
13663                         $i_systime sys/time.h 
13664                         $i_sysselct sys/select.h
13665                         $d_socket sys/socket.h"
13666                 : The first arg can be int, unsigned, or size_t
13667                 : The last arg may or may not be 'const'
13668                 val=''
13669                 : void pointer has been seen but using that
13670                 : breaks the selectminbits test
13671                 for xxx in 'fd_set *' 'int *'; do
13672                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13673                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13674                                         case "$val" in
13675                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13676                                                 if ./protochk "$try" $hdrs; then
13677                                                         echo "Your system accepts $xxx."
13678                                                         val="$xxx"
13679                                                 fi
13680                                                 ;;
13681                                         esac
13682                                 done
13683                         done
13684                 done
13685                 case "$val" in
13686                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13687                         case "$d_fd_set" in
13688                                 $define) dflt="fd_set *" ;;
13689                                 *)              dflt="int *" ;;
13690                         esac
13691                         . ./myread
13692                         val=$ans
13693                         ;;
13694                 esac
13695                 selecttype="$val"
13696                 ;;
13697         *)      : no select, so pick a harmless default
13698                 selecttype='int *'
13699                 ;;
13700         esac
13701         ;;
13702 esac
13703
13704 : check for the select 'width'
13705 case "$selectminbits" in
13706 '') case "$d_select" in
13707         $define)
13708                 $cat <<EOM
13709
13710 Checking to see on how many bits at a time your select() operates...
13711 EOM
13712                 $cat >try.c <<EOCP
13713 #include <sys/types.h>
13714 #$i_time I_TIME
13715 #$i_systime I_SYS_TIME
13716 #$i_systimek I_SYS_TIME_KERNEL
13717 #ifdef I_TIME
13718 #   include <time.h>
13719 #endif
13720 #ifdef I_SYS_TIME
13721 #   ifdef I_SYS_TIME_KERNEL
13722 #       define KERNEL
13723 #   endif
13724 #   include <sys/time.h>
13725 #   ifdef I_SYS_TIME_KERNEL
13726 #       undef KERNEL
13727 #   endif
13728 #endif
13729 #$i_sysselct I_SYS_SELECT
13730 #ifdef I_SYS_SELECT
13731 #include <sys/select.h>
13732 #endif
13733 #$d_socket HAS_SOCKET
13734 #ifdef HAS_SOCKET
13735 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13736 #endif
13737 #include <stdio.h>
13738 $selecttype b;
13739 #define S sizeof(*(b))
13740 #define MINBITS 64
13741 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13742 #define NBITS  (NBYTES * 8)
13743 int main() {
13744     char s[NBYTES];
13745     struct timeval t;
13746     int i;
13747     FILE* fp;
13748     int fd;
13749
13750     fclose(stdin);
13751     fp = fopen("try.c", "r");
13752     if (fp == 0)
13753       exit(1);
13754     fd = fileno(fp);
13755     if (fd < 0)
13756       exit(2);
13757     b = ($selecttype)s;
13758     for (i = 0; i < NBITS; i++)
13759         FD_SET(i, b);
13760     t.tv_sec  = 0;
13761     t.tv_usec = 0;
13762     select(fd + 1, b, 0, 0, &t);
13763     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13764     printf("%d\n", i + 1);
13765     return 0;
13766 }
13767 EOCP
13768                 set try
13769                 if eval $compile_ok; then
13770                         selectminbits=`./try`
13771                         case "$selectminbits" in
13772                         '')     cat >&4 <<EOM
13773 Cannot figure out on how many bits at a time your select() operates.
13774 I'll play safe and guess it is 32 bits.
13775 EOM
13776                                 selectminbits=32
13777                                 bits="32 bits"
13778                                 ;;
13779                         1)      bits="1 bit" ;;
13780                         *)      bits="$selectminbits bits" ;;
13781                         esac
13782                         echo "Your select() operates on $bits at a time." >&4
13783                 else
13784                         rp='What is the minimum number of bits your select() operates on?'
13785                         case "$byteorder" in
13786                         1234|12345678)  dflt=32 ;;
13787                         *)              dflt=1  ;;
13788                         esac
13789                         . ./myread
13790                         val=$ans
13791                         selectminbits="$val"
13792                 fi
13793                 $rm -f try.* try
13794                 ;;
13795         *)      : no select, so pick a harmless default
13796                 selectminbits='32'
13797                 ;;
13798         esac
13799         ;;
13800 esac
13801
13802 : Trace out the files included by signal.h, then look for SIGxxx names.
13803 : Remove SIGARRAYSIZE used by HPUX.
13804 : Remove SIGSTKSIZE used by Linux.
13805 : Remove SIGSTKSZ used by Posix.
13806 : Remove SIGTYP void lines used by OS2.
13807 : Some cpps, like os390, dont give the file name anywhere
13808 if [ "X$fieldn" = X ]; then
13809         : Just make some guesses.  We check them later.
13810         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13811 else
13812         xxx=`echo '#include <signal.h>' |
13813         $cppstdin $cppminus $cppflags 2>/dev/null |
13814         $grep '^[       ]*#.*include' | 
13815         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13816 fi
13817 : Check this list of files to be sure we have parsed the cpp output ok.
13818 : This will also avoid potentially non-existent files, such 
13819 : as ../foo/bar.h
13820 xxxfiles=''
13821 for xx in $xxx /dev/null ; do
13822         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13823 done
13824 : If we have found no files, at least try signal.h
13825 case "$xxxfiles" in
13826 '')     xxxfiles=`./findhdr signal.h` ;;
13827 esac
13828 xxx=`awk '
13829 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13830         print substr($2, 4, 20)
13831 }
13832 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13833         print substr($3, 4, 20)
13834 }' $xxxfiles`
13835 : Append some common names just in case the awk scan failed.
13836 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13837 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13838 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13839 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13840 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13841
13842 : generate a few handy files for later
13843 $cat > signal.c <<'EOCP'
13844 #include <sys/types.h>
13845 #include <signal.h>
13846 #include <stdio.h>
13847 int main() {
13848
13849 /* Strange style to avoid deeply-nested #if/#else/#endif */
13850 #ifndef NSIG
13851 #  ifdef _NSIG
13852 #    define NSIG (_NSIG)
13853 #  endif
13854 #endif
13855
13856 #ifndef NSIG
13857 #  ifdef SIGMAX
13858 #    define NSIG (SIGMAX+1)
13859 #  endif
13860 #endif
13861
13862 #ifndef NSIG
13863 #  ifdef SIG_MAX
13864 #    define NSIG (SIG_MAX+1)
13865 #  endif
13866 #endif
13867
13868 #ifndef NSIG
13869 #  ifdef MAXSIG
13870 #    define NSIG (MAXSIG+1)
13871 #  endif
13872 #endif
13873
13874 #ifndef NSIG
13875 #  ifdef MAX_SIG
13876 #    define NSIG (MAX_SIG+1)
13877 #  endif
13878 #endif
13879
13880 #ifndef NSIG
13881 #  ifdef SIGARRAYSIZE
13882 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13883 #  endif
13884 #endif
13885
13886 #ifndef NSIG
13887 #  ifdef _sys_nsig
13888 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13889 #  endif
13890 #endif
13891
13892 /* Default to some arbitrary number that's big enough to get most
13893    of the common signals.
13894 */
13895 #ifndef NSIG
13896 #    define NSIG 50
13897 #endif
13898
13899 printf("NSIG %d\n", NSIG);
13900
13901 #ifndef JUST_NSIG
13902
13903 EOCP
13904
13905 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13906 {
13907         printf "#ifdef SIG"; printf $1; printf "\n"
13908         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13909         printf $1; printf ");\n"
13910         printf "#endif\n"
13911 }
13912 END {
13913         printf "#endif /* JUST_NSIG */\n";
13914         printf "exit(0);\n}\n";
13915 }
13916 ' >>signal.c
13917 $cat >signal.awk <<'EOP'
13918 BEGIN { ndups = 0 }
13919 $1 ~ /^NSIG$/ { nsig = $2 }
13920 ($1 !~ /^NSIG$/) && (NF == 2) {
13921     if ($2 > maxsig) { maxsig = $2 }
13922     if (sig_name[$2]) {
13923         dup_name[ndups] = $1
13924         dup_num[ndups] = $2
13925         ndups++ 
13926     }
13927     else {
13928         sig_name[$2] = $1
13929         sig_num[$2] = $2
13930     }
13931 }
13932 END { 
13933     if (nsig == 0) {
13934         nsig = maxsig + 1
13935     }
13936     printf("NSIG %d\n", nsig);
13937     for (n = 1; n < nsig; n++) {
13938         if (sig_name[n]) {
13939             printf("%s %d\n", sig_name[n], sig_num[n])
13940         }
13941         else {
13942             printf("NUM%d %d\n", n, n) 
13943         }
13944     }
13945     for (n = 0; n < ndups; n++) {
13946         printf("%s %d\n", dup_name[n], dup_num[n])
13947     }
13948 }
13949 EOP
13950 $cat >signal_cmd <<EOS
13951 $startsh
13952 if $test -s signal.lst; then
13953     echo "Using your existing signal.lst file"
13954         exit 0
13955 fi
13956 xxx="$xxx"
13957 EOS
13958 $cat >>signal_cmd <<'EOS'
13959
13960 set signal
13961 if eval $compile_ok; then
13962         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13963 else
13964         echo "(I can't seem be able to compile the whole test program)" >&4
13965         echo "(I'll try it in little pieces.)" >&4
13966         set signal -DJUST_NSIG
13967         if eval $compile_ok; then
13968                 ./signal$_exe > signal.nsg
13969                 $cat signal.nsg
13970         else
13971                 echo "I can't seem to figure out how many signals you have." >&4
13972                 echo "Guessing 50." >&4
13973                 echo 'NSIG 50' > signal.nsg
13974         fi
13975         : Now look at all the signal names, one at a time.
13976         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13977                 $cat > signal.c <<EOCP
13978 #include <sys/types.h>
13979 #include <signal.h>
13980 #include <stdio.h>
13981 int main() {
13982 printf("$xx %d\n", SIG${xx});
13983 return 0;
13984 }
13985 EOCP
13986                 set signal
13987                 if eval $compile; then
13988                         echo "SIG${xx} found."
13989                         ./signal$_exe  >> signal.ls1
13990                 else
13991                         echo "SIG${xx} NOT found."
13992                 fi
13993         done
13994         if $test -s signal.ls1; then
13995                 $cat signal.nsg signal.ls1 |
13996                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13997         fi
13998
13999 fi
14000 if $test -s signal.lst; then
14001         :
14002 else
14003         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14004         echo 'kill -l' >signal
14005         set X `csh -f <signal`
14006         $rm -f signal
14007         shift
14008         case $# in
14009         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14010         esac
14011         echo $@ | $tr ' ' $trnl | \
14012             $awk '{ printf "%s %d\n", $1, ++s; }
14013                   END { printf "NSIG %d\n", ++s }' >signal.lst
14014 fi
14015 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14016 EOS
14017 chmod a+x signal_cmd
14018 $eunicefix signal_cmd
14019
14020 : generate list of signal names
14021 echo " "
14022 case "$sig_name_init" in
14023 '') doinit=yes ;;
14024 *)  case "$sig_num_init" in
14025     ''|*,*) doinit=yes ;;
14026     esac ;;
14027 esac
14028 case "$doinit" in
14029 yes)
14030         echo "Generating a list of signal names and numbers..." >&4
14031         . ./signal_cmd
14032         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14033         sig_name=`$awk 'BEGIN { printf "ZERO " }
14034                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14035         sig_num=`$awk  'BEGIN { printf "0 " }
14036                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14037         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14038                              !/^NSIG/   { printf "\"%s\", ", $1 }
14039                              END        { printf "0\n" }' signal.lst`
14040         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14041                              !/^NSIG/   { printf "%d, ", $2}
14042                              END        { printf "0\n"}' signal.lst`
14043         ;;
14044 esac
14045 echo "The following $sig_count signals are available:"
14046 echo " "
14047 echo $sig_name | $awk \
14048 'BEGIN { linelen = 0 }
14049 {
14050         for (i = 1; i <= NF; i++) {
14051                 name = "SIG" $i " "
14052                 linelen = linelen + length(name)
14053                 if (linelen > 70) {
14054                         printf "\n"
14055                         linelen = length(name)
14056                 }
14057                 printf "%s", name
14058         }
14059         printf "\n"
14060 }'
14061 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14062
14063 echo " "
14064 case "$sizetype" in
14065 *_t) zzz="$sizetype"    ;;
14066 *)   zzz="filesize"     ;;
14067 esac
14068 echo "Checking the size of $zzz..." >&4 
14069 cat > try.c <<EOCP
14070 #include <sys/types.h>
14071 #include <stdio.h>
14072 int main() {
14073     printf("%d\n", (int)sizeof($sizetype));
14074     exit(0);
14075 }
14076 EOCP
14077 set try
14078 if eval $compile_ok; then
14079         yyy=`./try`
14080         case "$yyy" in
14081         '')     sizesize=4
14082                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14083                 ;;
14084         *)      sizesize=$yyy
14085                 echo "Your $zzz size is $sizesize bytes."
14086                 ;;
14087         esac
14088 else
14089         sizesize=4
14090         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14091 fi
14092
14093
14094 : check for socklen_t
14095 echo " "
14096 echo "Checking to see if you have socklen_t..." >&4
14097 $cat >try.c <<EOCP
14098 #include <sys/types.h>
14099 #$d_socket HAS_SOCKET
14100 #ifdef HAS_SOCKET
14101 #include <sys/socket.h>
14102 #endif
14103 int main() { socklen_t x = 16; }
14104 EOCP
14105 set try
14106 if eval $compile; then
14107         val="$define"
14108         echo "You have socklen_t."
14109 else
14110         val="$undef"
14111         echo "You do not have socklen_t."
14112         case "$sizetype" in
14113         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14114         esac
14115 fi
14116 $rm -f try try.*
14117 set d_socklen_t
14118 eval $setvar
14119
14120 : check for type of the size argument to socket calls
14121 case "$d_socket" in
14122 "$define")
14123         $cat <<EOM
14124
14125 Checking to see what type is the last argument of accept().
14126 EOM
14127         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14128         yyy=''
14129         case "$d_socklen_t" in
14130         "$define") yyy="$yyy socklen_t"
14131         esac
14132         yyy="$yyy $sizetype int long unsigned"
14133         for xxx in $yyy; do
14134                 case "$socksizetype" in
14135                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14136                         if ./protochk "$try" $hdrs; then
14137                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14138                                 socksizetype="$xxx"
14139                         fi
14140                         ;;
14141                 esac
14142         done
14143 : In case none of those worked, prompt the user.
14144         case "$socksizetype" in
14145         '')     rp='What is the type for socket address structure sizes?'
14146                 dflt='int'
14147                 . ./myread
14148                 socksizetype=$ans
14149                 ;;
14150         esac
14151         ;;
14152 *)      : no sockets, so pick relatively harmless default
14153         socksizetype='int'
14154         ;;
14155 esac
14156
14157 : see what type is used for signed size_t
14158 set ssize_t ssizetype int stdio.h sys/types.h
14159 eval $typedef
14160 dflt="$ssizetype"
14161 $cat > ssize.c <<EOM
14162 #include <stdio.h>
14163 #include <sys/types.h>
14164 #define Size_t $sizetype
14165 #define SSize_t $dflt
14166 int main()
14167 {
14168         if (sizeof(Size_t) == sizeof(SSize_t))
14169                 printf("$dflt\n");
14170         else if (sizeof(Size_t) == sizeof(int))
14171                 printf("int\n");
14172         else 
14173                 printf("long\n");
14174         exit(0);
14175 }
14176 EOM
14177 echo " "
14178 set ssize
14179 if eval $compile_ok && ./ssize > /dev/null; then
14180         ssizetype=`./ssize`
14181         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14182 else
14183         $cat >&4 <<EOM
14184 Help! I can't compile and run the ssize_t test program: please enlighten me!
14185 (This is probably a misconfiguration in your system or libraries, and
14186 you really ought to fix it.  Still, I'll try anyway.)
14187
14188 I need a type that is the same size as $sizetype, but is guaranteed to
14189 be signed.  Common values are ssize_t, int and long.
14190
14191 EOM
14192         rp="What signed type is the same size as $sizetype?"
14193         . ./myread
14194         ssizetype="$ans"
14195 fi
14196 $rm -f ssize ssize.*
14197
14198 : see what type of char stdio uses.
14199 echo " "
14200 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14201         echo "Your stdio uses unsigned chars." >&4
14202         stdchar="unsigned char"
14203 else
14204         echo "Your stdio uses signed chars." >&4
14205         stdchar="char"
14206 fi
14207
14208 : see if time exists
14209 echo " "
14210 if test "X$d_time" = X -o X"$timetype" = X; then
14211     if set time val -f d_time; eval $csym; $val; then
14212                 echo 'time() found.' >&4
14213                 val="$define"
14214                 rp="What is the type returned by time() on this system?"
14215                 set time_t timetype long stdio.h sys/types.h
14216                 eval $typedef_ask
14217     else
14218                 echo 'time() not found, hope that will do.' >&4
14219                 val="$undef"
14220                 timetype='int';
14221     fi
14222     set d_time
14223     eval $setvar
14224 fi
14225
14226 : see what type uids are declared as in the kernel
14227 echo " "
14228 echo "Looking for the type for user ids returned by getuid()."
14229 set uid_t uidtype xxx stdio.h sys/types.h
14230 eval $typedef
14231 case "$uidtype" in
14232 xxx)
14233         xxx=`./findhdr sys/user.h`
14234         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14235         case $1 in
14236         unsigned) dflt="$1 $2" ;;
14237         *) dflt="$1" ;;
14238         esac
14239         ;;
14240 *) dflt="$uidtype";;
14241 esac
14242 case "$uidtype" in
14243 uid_t)  echo "uid_t found." ;;
14244 *)      rp="What is the type for user ids returned by getuid()?"
14245         . ./myread
14246         uidtype="$ans"
14247         ;;
14248 esac
14249
14250 echo " "
14251 case "$uidtype" in
14252 *_t) zzz="$uidtype"     ;;
14253 *)   zzz="uid"          ;;
14254 esac
14255 echo "Checking the size of $zzz..." >&4 
14256 cat > try.c <<EOCP
14257 #include <sys/types.h>
14258 #include <stdio.h>
14259 int main() {
14260     printf("%d\n", (int)sizeof($uidtype));
14261     exit(0);
14262 }
14263 EOCP
14264 set try
14265 if eval $compile_ok; then
14266         yyy=`./try`
14267         case "$yyy" in
14268         '')     uidsize=4
14269                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14270                 ;;
14271         *)      uidsize=$yyy
14272                 echo "Your $zzz is $uidsize bytes long."
14273                 ;;
14274         esac
14275 else
14276         uidsize=4
14277         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14278 fi
14279
14280 echo " "
14281 case "$uidtype" in
14282 *_t) zzz="$uidtype"     ;;
14283 *)   zzz="uid"          ;;
14284 esac
14285 echo "Checking the sign of $zzz..." >&4
14286 cat > try.c <<EOCP
14287 #include <sys/types.h>
14288 #include <stdio.h>
14289 int main() {
14290         $uidtype foo = -1;
14291         if (foo < 0)
14292                 printf("-1\n");
14293         else
14294                 printf("1\n");
14295 }
14296 EOCP
14297 set try
14298 if eval $compile; then
14299         yyy=`./try`
14300         case "$yyy" in
14301         '')     uidsign=1
14302                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14303                 ;;
14304         *)      uidsign=$yyy
14305                 case "$uidsign" in
14306                  1) echo "Your $zzz is unsigned." ;;
14307                 -1) echo "Your $zzz is signed."   ;;
14308                 esac
14309                 ;;
14310         esac
14311 else
14312         uidsign=1
14313         echo "(I can't compile the test program--guessing unsigned.)" >&4
14314 fi
14315
14316
14317
14318 echo " "
14319 $echo "Checking the format string to be used for uids..." >&4
14320
14321 case "$uidsign" in
14322 -1)     if $test X"$uidsize" = X"$ivsize"; then
14323                 uidformat="$ivdformat"
14324         else
14325                 if $test X"$uidsize" = X"$longsize"; then
14326                         uidformat='"ld"'
14327                 else
14328                         if $test X"$uidsize" = X"$intsize"; then
14329                                 uidformat='"d"'
14330                         else
14331                                 if $test X"$uidsize" = X"$shortsize"; then
14332                                         uidformat='"hd"'
14333                                 fi
14334                         fi
14335                 fi
14336         fi
14337         ;;
14338 *)      if $test X"$uidsize" = X"$uvsize"; then
14339                 uidformat="$uvuformat"
14340         else
14341                 if $test X"$uidsize" = X"$longsize"; then
14342                         uidformat='"lu"'
14343                 else
14344                         if $test X"$uidsize" = X"$intsize"; then
14345                                 uidformat='"u"'
14346                         else
14347                                 if $test X"$uidsize" = X"$shortsize"; then
14348                                         uidformat='"hu"'
14349                                 fi
14350                         fi
14351                 fi
14352         fi
14353         ;;
14354 esac
14355
14356 : see if dbm.h is available
14357 : see if dbmclose exists
14358 set dbmclose d_dbmclose
14359 eval $inlibc
14360
14361 case "$d_dbmclose" in
14362 $define)
14363         set dbm.h i_dbm
14364         eval $inhdr
14365         case "$i_dbm" in
14366         $define)
14367                 val="$undef"
14368                 set i_rpcsvcdbm
14369                 eval $setvar
14370                 ;;
14371         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14372                 eval $inhdr
14373                 ;;
14374         esac
14375         ;;
14376 *)      echo "We won't be including <dbm.h>"
14377         val="$undef"
14378         set i_dbm
14379         eval $setvar
14380         val="$undef"
14381         set i_rpcsvcdbm
14382         eval $setvar
14383         ;;
14384 esac
14385
14386 : see if this is a sys/file.h system
14387 val=''
14388 set sys/file.h val
14389 eval $inhdr
14390
14391 : do we need to include sys/file.h ?
14392 case "$val" in
14393 "$define")
14394         echo " "
14395         if $h_sysfile; then
14396                 val="$define"
14397                 echo "We'll be including <sys/file.h>." >&4
14398         else
14399                 val="$undef"
14400                 echo "We won't be including <sys/file.h>." >&4
14401         fi
14402         ;;
14403 *)
14404         h_sysfile=false
14405         ;;
14406 esac
14407 set i_sysfile
14408 eval $setvar
14409
14410 : see if fcntl.h is there
14411 val=''
14412 set fcntl.h val
14413 eval $inhdr
14414
14415 : see if we can include fcntl.h
14416 case "$val" in
14417 "$define")
14418         echo " "
14419         if $h_fcntl; then
14420                 val="$define"
14421                 echo "We'll be including <fcntl.h>." >&4
14422         else
14423                 val="$undef"
14424                 if $h_sysfile; then
14425         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14426                 else
14427                         echo "We won't be including <fcntl.h>." >&4
14428                 fi
14429         fi
14430         ;;
14431 *)
14432         h_fcntl=false
14433         val="$undef"
14434         ;;
14435 esac
14436 set i_fcntl
14437 eval $setvar
14438
14439 : see if this is a iconv.h system
14440 set iconv.h i_iconv
14441 eval $inhdr
14442
14443 : see if this is a ieeefp.h system
14444 set ieeefp.h i_ieeefp
14445 eval $inhdr
14446
14447 : see if this is a libutil.h system
14448 set libutil.h i_libutil
14449 eval $inhdr
14450
14451 : see if locale.h is available
14452 set locale.h i_locale
14453 eval $inhdr
14454
14455 : see if mach cthreads are available
14456 if test "X$usethreads" = "X$define"; then
14457         set mach/cthreads.h i_machcthr
14458         eval $inhdr
14459 else
14460         i_machcthr="$undef"
14461 fi
14462
14463
14464
14465 : see if this is a math.h system
14466 set math.h i_math
14467 eval $inhdr
14468
14469 : see if this is a mntent.h system
14470 set mntent.h i_mntent
14471 eval $inhdr
14472
14473 : see if ndbm.h is available
14474 set ndbm.h t_ndbm
14475 eval $inhdr
14476 case "$t_ndbm" in
14477 $define)
14478         : see if dbm_open exists
14479         set dbm_open d_dbm_open
14480         eval $inlibc
14481         case "$d_dbm_open" in
14482         $undef)
14483                 t_ndbm="$undef"
14484                 echo "We won't be including <ndbm.h>"
14485                 ;;
14486         esac
14487         ;;
14488 esac
14489 val="$t_ndbm"
14490 set i_ndbm
14491 eval $setvar
14492
14493 : see if net/errno.h is available
14494 val=''
14495 set net/errno.h val
14496 eval $inhdr
14497
14498 : Unfortunately, it causes problems on some systems.  Arrgh.
14499 case "$val" in
14500 $define)
14501         cat > try.c <<'EOM'
14502 #include <stdio.h>
14503 #include <errno.h>
14504 #include <net/errno.h>
14505 int func()
14506 {
14507         return ENOTSOCK;
14508 }
14509 EOM
14510         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14511                 echo "We'll be including <net/errno.h>." >&4
14512         else
14513                 echo "We won't be including <net/errno.h>." >&4
14514                 val="$undef"
14515         fi
14516         $rm -f try.* try
14517         ;;
14518 esac
14519 set i_neterrno
14520 eval $setvar
14521
14522 : see if netinet/tcp.h is available
14523 set netinet/tcp.h i_netinettcp
14524 eval $inhdr
14525
14526 : see if this is a poll.h system
14527 set poll.h i_poll
14528 eval $inhdr
14529
14530 : see if this is a prot.h system
14531 set prot.h i_prot
14532 eval $inhdr
14533
14534 echo " "
14535 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14536 $cat <<'EOSH' > Cppsym.know
14537 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14538 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14539 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14540 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14541 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14542 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14543 bull c cadmus clipper CMU COFF COMPILER_VERSION
14544 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14545 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14546 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14547 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14548 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14549 H3050R H3050RX hbullx20 hcx host_mips
14550 hp200 hp300 hp700 HP700 hp800 hp9000
14551 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14552 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14553 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14554 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14555 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14556 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14557 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14558 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14559 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14560 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14561 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14562 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14563 MATH_HAS_NO_SIDE_EFFECTS
14564 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14565 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14566 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14567 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14568 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14569 NetBSD news1500 news1700 news1800 news1900 news3700
14570 news700 news800 news900 NeXT NLS ns16000 ns32000
14571 ns32016 ns32332 ns32k nsc32000
14572 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14573 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14574 pc532 pdp11 PGC PIC plexus PORTAR posix
14575 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14576 POSIX_C_SOURCE POSIX_SOURCE POWER
14577 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14578 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14579 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14580 sony sony_news sonyrisc sparc sparclite spectrum
14581 stardent stdc STDC_EXT stratos sun sun3 sun386
14582 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14583 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14584 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14585 sysV68 sysV88 Tek4132 Tek4300 titan
14586 tower tower32 tower32_200 tower32_600 tower32_700
14587 tower32_800 tower32_850 tss
14588 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14589 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14590 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14591 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14592 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14593 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14594 z8000
14595 EOSH
14596 # Maybe put other stuff here too.
14597 cat <<EOSH >>Cppsym.know
14598 $osname
14599 EOSH
14600 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14601 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14602 $cat Cppsym.know > Cppsym.c
14603 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14604 $rm -f Cppsym.a Cppsym.b Cppsym.c
14605 cat <<EOSH > Cppsym
14606 $startsh
14607 if $test \$# -gt 0; then
14608     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14609     if $test -s Cppsym.got; then
14610         $rm -f Cppsym.got
14611         exit 0
14612     fi
14613     $rm -f Cppsym.got
14614     exit 1
14615 else
14616     $tr " " "$trnl" | ./Cppsym.try
14617     exit 0
14618 fi
14619 EOSH
14620 chmod +x Cppsym
14621 $eunicefix Cppsym
14622 cat <<EOSH > Cppsym.try
14623 $startsh
14624 cat <<'EOCP' > try.c
14625 #include <stdio.h>
14626 int main() {
14627 EOCP
14628 $awk \\
14629 EOSH
14630 cat <<'EOSH' >> Cppsym.try
14631 'length($1) > 0 {
14632     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
14633     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
14634     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
14635     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
14636 }'       >> try.c
14637 echo '}' >> try.c
14638 EOSH
14639 cat <<EOSH >> Cppsym.try
14640 ccflags="$ccflags"
14641 case "$osname-$gccversion" in
14642 irix-) ccflags="\$ccflags -woff 1178" ;;
14643 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14644 esac
14645 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14646 EOSH
14647 chmod +x Cppsym.try
14648 $eunicefix Cppsym.try
14649 ./Cppsym < Cppsym.know > Cppsym.true
14650 : now check the C compiler for additional symbols
14651 postprocess_cc_v=''
14652 case "$osname" in
14653 aix) postprocess_cc_v="|$tr , ' '" ;;
14654 esac
14655 $cat >ccsym <<EOS
14656 $startsh
14657 $cat >tmp.c <<EOF
14658 extern int foo;
14659 EOF
14660 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14661 do
14662         case "\$i" in
14663         -D*) echo "\$i" | $sed 's/^-D//';;
14664         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14665         esac
14666 done
14667 $rm -f try.c
14668 EOS
14669 postprocess_cc_v=''
14670 chmod +x ccsym
14671 $eunicefix ccsym
14672 ./ccsym > ccsym1.raw
14673 if $test -s ccsym1.raw; then
14674        $sort ccsym1.raw | $uniq >ccsym.raw
14675 else
14676        mv ccsym1.raw ccsym.raw
14677 fi
14678
14679 $awk '/\=/ { print $0; next }
14680         { print $0"=1" }' ccsym.raw >ccsym.list
14681 $awk '/\=/ { print $0; next }
14682         { print $0"=1" }' Cppsym.true >ccsym.true
14683 $comm -13 ccsym.true ccsym.list >ccsym.own
14684 $comm -12 ccsym.true ccsym.list >ccsym.com
14685 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14686 also=''
14687 if $test -z ccsym.raw; then
14688         echo "Your C compiler doesn't seem to define any symbols!" >&4
14689         echo " "
14690         echo "However, your C preprocessor defines the following symbols:"
14691         $cat Cppsym.true
14692         ccsymbols=''
14693         cppsymbols=`$cat Cppsym.true`
14694         cppsymbols=`echo $cppsymbols`
14695         cppccsymbols="$cppsymbols"
14696 else
14697         if $test -s ccsym.com; then
14698                 echo "Your C compiler and pre-processor define these symbols:"
14699                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14700                 also='also '
14701                 symbols='ones'
14702                 cppccsymbols=`$cat ccsym.com`
14703                 cppccsymbols=`echo $cppccsymbols`
14704                 $test "$silent" || sleep 1
14705         fi
14706         if $test -s ccsym.cpp; then
14707                 $test "$also" && echo " "
14708                 echo "Your C pre-processor ${also}defines the following symbols:"
14709                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14710                 also='further '
14711                 cppsymbols=`$cat ccsym.cpp`
14712                 cppsymbols=`echo $cppsymbols`
14713                 $test "$silent" || sleep 1
14714         fi
14715         if $test -s ccsym.own; then
14716                 $test "$also" && echo " "
14717                 echo "Your C compiler ${also}defines the following cpp symbols:"
14718                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14719                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14720                 ccsymbols=`$cat ccsym.own`
14721                 ccsymbols=`echo $ccsymbols`
14722                 $test "$silent" || sleep 1
14723         fi
14724 fi
14725 $rm -f ccsym* Cppsym.*
14726
14727 : see if this is a termio system
14728 val="$undef"
14729 val2="$undef"
14730 val3="$undef"
14731 if $test `./findhdr termios.h`; then
14732         set tcsetattr i_termios
14733         eval $inlibc
14734         val3="$i_termios"
14735 fi
14736 echo " "
14737 case "$val3" in
14738 "$define") echo "You have POSIX termios.h... good!" >&4;;
14739 *) if ./Cppsym pyr; then
14740                 case "`/bin/universe`" in
14741                 ucb) if $test `./findhdr sgtty.h`; then
14742                                 val2="$define"
14743                                 echo "<sgtty.h> found." >&4
14744                         else
14745                                 echo "System is pyramid with BSD universe."
14746                                 echo "<sgtty.h> not found--you could have problems." >&4
14747                         fi;;
14748                 *) if $test `./findhdr termio.h`; then
14749                                 val="$define"
14750                                 echo "<termio.h> found." >&4
14751                         else
14752                                 echo "System is pyramid with USG universe."
14753                                 echo "<termio.h> not found--you could have problems." >&4
14754                         fi;;
14755                 esac
14756         elif ./usg; then
14757                 if $test `./findhdr termio.h`; then
14758                         echo "<termio.h> found." >&4
14759                         val="$define"
14760                 elif $test `./findhdr sgtty.h`; then
14761                         echo "<sgtty.h> found." >&4
14762                         val2="$define"
14763                 else
14764 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14765                 fi
14766         else
14767                 if $test `./findhdr sgtty.h`; then
14768                         echo "<sgtty.h> found." >&4
14769                         val2="$define"
14770                 elif $test `./findhdr termio.h`; then
14771                         echo "<termio.h> found." >&4
14772                         val="$define"
14773                 else
14774 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14775                 fi
14776         fi;;
14777 esac
14778 set i_termio; eval $setvar
14779 val=$val2; set i_sgtty; eval $setvar
14780 val=$val3; set i_termios; eval $setvar
14781
14782 : see if this is a shadow.h system
14783 set shadow.h i_shadow
14784 eval $inhdr
14785
14786 : see if this is a socks.h system
14787 set socks.h i_socks
14788 eval $inhdr
14789
14790 : see if stdarg is available
14791 echo " "
14792 if $test `./findhdr stdarg.h`; then
14793         echo "<stdarg.h> found." >&4
14794         valstd="$define"
14795 else
14796         echo "<stdarg.h> NOT found." >&4
14797         valstd="$undef"
14798 fi
14799
14800 : see if varags is available
14801 echo " "
14802 if $test `./findhdr varargs.h`; then
14803         echo "<varargs.h> found." >&4
14804 else
14805         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14806 fi
14807
14808 : set up the varargs testing programs
14809 $cat > varargs.c <<EOP
14810 #ifdef I_STDARG
14811 #include <stdarg.h>
14812 #endif
14813 #ifdef I_VARARGS
14814 #include <varargs.h>
14815 #endif
14816
14817 #ifdef I_STDARG
14818 int f(char *p, ...)
14819 #else
14820 int f(va_alist)
14821 va_dcl
14822 #endif
14823 {
14824         va_list ap;
14825 #ifndef I_STDARG
14826         char *p;
14827 #endif
14828 #ifdef I_STDARG
14829         va_start(ap,p);
14830 #else
14831         va_start(ap);
14832         p = va_arg(ap, char *);
14833 #endif
14834         va_end(ap);
14835 }
14836 EOP
14837 $cat > varargs <<EOP
14838 $startsh
14839 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14840         echo "true"
14841 else
14842         echo "false"
14843 fi
14844 $rm -f varargs$_o
14845 EOP
14846 chmod +x varargs
14847
14848 : now check which varargs header should be included
14849 echo " "
14850 i_varhdr=''
14851 case "$valstd" in
14852 "$define")
14853         if `./varargs I_STDARG`; then
14854                 val='stdarg.h'
14855         elif `./varargs I_VARARGS`; then
14856                 val='varargs.h'
14857         fi
14858         ;;
14859 *)
14860         if `./varargs I_VARARGS`; then
14861                 val='varargs.h'
14862         fi
14863         ;;
14864 esac
14865 case "$val" in
14866 '')
14867 echo "I could not find the definition for va_dcl... You have problems..." >&4
14868         val="$undef"; set i_stdarg; eval $setvar
14869         val="$undef"; set i_varargs; eval $setvar
14870         ;;
14871 *) 
14872         set i_varhdr
14873         eval $setvar
14874         case "$i_varhdr" in
14875         stdarg.h)
14876                 val="$define"; set i_stdarg; eval $setvar
14877                 val="$undef"; set i_varargs; eval $setvar
14878                 ;;
14879         varargs.h)
14880                 val="$undef"; set i_stdarg; eval $setvar
14881                 val="$define"; set i_varargs; eval $setvar
14882                 ;;
14883         esac
14884         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14885 esac
14886 $rm -f varargs*
14887
14888 : see if stddef is available
14889 set stddef.h i_stddef
14890 eval $inhdr
14891
14892 : see if this is a sunmath.h system
14893 set sunmath.h i_sunmath
14894 eval $inhdr
14895
14896 : see if sys/access.h is available
14897 set sys/access.h i_sysaccess
14898 eval $inhdr
14899
14900 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14901 set sys/filio.h i_sysfilio
14902 eval $inhdr
14903 echo " "
14904 if $test `./findhdr sys/ioctl.h`; then
14905         val="$define"
14906         echo '<sys/ioctl.h> found.' >&4
14907 else
14908         val="$undef"
14909         if $test $i_sysfilio = "$define"; then
14910             echo '<sys/ioctl.h> NOT found.' >&4
14911         else
14912                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14913                 $test $i_termio = "$define" && xxx="termio.h"
14914                 $test $i_termios = "$define" && xxx="termios.h"
14915 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14916         fi
14917 fi
14918 set i_sysioctl
14919 eval $setvar
14920
14921
14922 : see if this is a syslog.h system
14923 set syslog.h i_syslog
14924 eval $inhdr
14925
14926
14927 : see if this is a sys/mode.h system
14928 set sys/mode.h i_sysmode
14929 eval $inhdr
14930
14931 : see if sys/resource.h has to be included
14932 set sys/resource.h i_sysresrc
14933 eval $inhdr
14934
14935 : see if sys/security.h is available
14936 set sys/security.h i_syssecrt
14937 eval $inhdr
14938
14939 : see if this is a sys/statvfs.h system
14940 set sys/statvfs.h i_sysstatvfs
14941 eval $inhdr
14942
14943 : see if this is a sys/uio.h system
14944 set sys/uio.h i_sysuio
14945 eval $inhdr
14946
14947 : see if this is a sys/un.h system
14948 set sys/un.h i_sysun
14949 eval $inhdr
14950
14951
14952 : see if this is a sys/utsname.h system
14953 set sys/utsname.h i_sysutsname
14954 eval $inhdr
14955
14956 : see if this is a syswait system
14957 set sys/wait.h i_syswait
14958 eval $inhdr
14959
14960 : see if this is a ustat.h system
14961 set ustat.h i_ustat
14962 eval $inhdr
14963
14964 : see if this is an utime system
14965 set utime.h i_utime
14966 eval $inhdr
14967
14968 : see if this is a values.h system
14969 set values.h i_values
14970 eval $inhdr
14971
14972 : see if this is a vfork system
14973 case "$d_vfork" in
14974 "$define")
14975         set vfork.h i_vfork
14976         eval $inhdr
14977         ;;
14978 *)
14979         i_vfork="$undef"
14980         ;;
14981 esac
14982
14983 : see if gdbm.h is available
14984 set gdbm.h t_gdbm
14985 eval $inhdr
14986 case "$t_gdbm" in
14987 $define)
14988         : see if gdbm_open exists
14989         set gdbm_open d_gdbm_open
14990         eval $inlibc
14991         case "$d_gdbm_open" in
14992         $undef)
14993                 t_gdbm="$undef"
14994                 echo "We won't be including <gdbm.h>"
14995                 ;;
14996         esac
14997         ;;
14998 esac
14999 val="$t_gdbm"
15000 set i_gdbm
15001 eval $setvar
15002
15003 echo " "
15004 echo "Looking for extensions..." >&4
15005 : If we are using the old config.sh, known_extensions may contain
15006 : old or inaccurate or duplicate values.
15007 known_extensions=''
15008 nonxs_extensions=''
15009 : We do not use find because it might not be available.
15010 : We do not just use MANIFEST because the user may have dropped
15011 : some additional extensions into the source tree and expect them
15012 : to be built.
15013
15014 : Function to recursively find available extensions, ignoring DynaLoader
15015 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15016 find_extensions='
15017     for xxx in *; do
15018        case "$xxx" in
15019            DynaLoader|dynaload) ;;
15020            *)
15021            if $test -f $xxx/$xxx.xs; then
15022                known_extensions="$known_extensions $1$xxx";
15023            elif $test -f $xxx/Makefile.PL; then
15024                nonxs_extensions="$nonxs_extensions $1$xxx";
15025            else
15026                if $test -d $xxx -a $# -lt 10; then
15027                    set $1$xxx/ $*;
15028                    cd $xxx;
15029                    eval $find_extensions;
15030                    cd ..;
15031                    shift;
15032                fi;
15033            fi
15034            ;;
15035        esac;
15036     done'
15037 tdir=`pwd`
15038 cd $rsrc/ext
15039 set X
15040 shift
15041 eval $find_extensions
15042 set X $nonxs_extensions
15043 shift
15044 nonxs_extensions="$*"
15045 set X $known_extensions
15046 shift
15047 known_extensions="$*"
15048 cd $tdir
15049
15050 : Now see which are supported on this system.
15051 avail_ext=''
15052 for xxx in $known_extensions ; do
15053         case "$xxx" in
15054         DB_File|db_file)
15055                 case "$i_db" in
15056                 $define) avail_ext="$avail_ext $xxx" ;;
15057                 esac
15058                 ;;
15059         GDBM_File|gdbm_fil)
15060                 case "$i_gdbm" in 
15061                 $define) avail_ext="$avail_ext $xxx" ;;
15062                 esac
15063                 ;;
15064         NDBM_File|ndbm_fil)
15065                 case "$i_ndbm" in
15066                 $define)
15067                     case "$osname-$use64bitint" in
15068                     hpux-define)
15069                         case "$libs" in
15070                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15071                         esac
15072                         ;;
15073                     *) avail_ext="$avail_ext $xxx" ;;
15074                     esac
15075                     ;;
15076                 esac
15077                 ;;
15078         ODBM_File|odbm_fil) 
15079                 case "${i_dbm}${i_rpcsvcdbm}" in
15080                 *"${define}"*)
15081                     case "$osname-$use64bitint" in
15082                     hpux-define)
15083                         case "$libs" in
15084                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15085                         esac
15086                         ;;
15087                     *) avail_ext="$avail_ext $xxx" ;;
15088                     esac
15089                     ;;
15090                 esac
15091                 ;;
15092         POSIX|posix)
15093                 case "$useposix" in
15094                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15095                 esac
15096                 ;;
15097         Opcode|opcode)
15098                 case "$useopcode" in
15099                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15100                 esac
15101                 ;;
15102         Socket|socket)
15103                 case "$d_socket" in 
15104                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15105                 esac
15106                 ;;
15107         Sys/Syslog|sys/syslog)
15108                 : XXX syslog requires socket
15109                 case "$d_socket" in 
15110                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15111                 esac
15112                 ;;
15113         Thread|thread)
15114                 case "$usethreads" in 
15115                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15116                 esac
15117                 ;;
15118         IPC/SysV|ipc/sysv)
15119                 : XXX Do we need a useipcsysv variable here
15120                 case "${d_msg}${d_sem}${d_shm}" in 
15121                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15122                 esac
15123                 ;;
15124         *)      avail_ext="$avail_ext $xxx"
15125                 ;;
15126         esac
15127 done
15128
15129 set X $avail_ext
15130 shift
15131 avail_ext="$*"
15132
15133 : Now see which nonxs extensions are supported on this system.
15134 : For now assume all are.
15135 nonxs_ext=''
15136 for xxx in $nonxs_extensions ; do
15137         case "$xxx" in
15138         *)      nonxs_ext="$nonxs_ext $xxx"
15139                 ;;
15140         esac
15141 done
15142
15143 set X $nonxs_ext
15144 shift
15145 nonxs_ext="$*"
15146
15147 case $usedl in
15148 $define)
15149         $cat <<EOM
15150 A number of extensions are supplied with $package.  You may choose to
15151 compile these extensions for dynamic loading (the default), compile
15152 them into the $package executable (static loading), or not include
15153 them at all.  Answer "none" to include no extensions.
15154 Note that DynaLoader is always built and need not be mentioned here.
15155
15156 EOM
15157         case "$dynamic_ext" in
15158         '') dflt="$avail_ext" ;;
15159         *)      dflt="$dynamic_ext"
15160                 # Perhaps we are reusing an old out-of-date config.sh.
15161                 case "$hint" in
15162                 previous)
15163                         if test X"$dynamic_ext" != X"$avail_ext"; then
15164                                 $cat <<EOM
15165 NOTICE:  Your previous config.sh list may be incorrect. 
15166 The extensions now available to you are 
15167         ${avail_ext}
15168 but the default list from your previous config.sh is
15169         ${dynamic_ext} 
15170
15171 EOM
15172                         fi
15173                         ;;
15174                 esac
15175                 ;;
15176         esac
15177         case "$dflt" in
15178         '')     dflt=none;;
15179         esac
15180         rp="What extensions do you wish to load dynamically?"
15181         . ./myread
15182         case "$ans" in
15183         none) dynamic_ext=' ' ;;
15184         *) dynamic_ext="$ans" ;;
15185         esac
15186
15187         case "$static_ext" in
15188         '')
15189                 : Exclude those already listed in dynamic linking
15190                 dflt=''
15191                 for xxx in $avail_ext; do
15192                         case " $dynamic_ext " in
15193                         *" $xxx "*) ;;
15194                         *) dflt="$dflt $xxx" ;;
15195                         esac
15196                 done
15197                 set X $dflt
15198                 shift
15199                 dflt="$*"
15200                 ;;
15201         *)  dflt="$static_ext" 
15202                 ;;
15203         esac
15204
15205         case "$dflt" in
15206         '')     dflt=none;;
15207         esac
15208         rp="What extensions do you wish to load statically?"
15209         . ./myread
15210         case "$ans" in
15211         none) static_ext=' ' ;;
15212         *) static_ext="$ans" ;;
15213         esac
15214         ;;
15215 *)
15216         $cat <<EOM
15217 A number of extensions are supplied with $package.  Answer "none" 
15218 to include no extensions. 
15219 Note that DynaLoader is always built and need not be mentioned here.
15220
15221 EOM
15222         case "$static_ext" in
15223         '') dflt="$avail_ext" ;;
15224         *)      dflt="$static_ext"
15225                 # Perhaps we are reusing an old out-of-date config.sh.
15226                 case "$hint" in
15227                 previous)
15228                         if test X"$static_ext" != X"$avail_ext"; then
15229                                 $cat <<EOM
15230 NOTICE:  Your previous config.sh list may be incorrect. 
15231 The extensions now available to you are 
15232         ${avail_ext}
15233 but the default list from your previous config.sh is
15234         ${static_ext} 
15235
15236 EOM
15237                         fi
15238                         ;;
15239                 esac
15240                 ;;
15241         esac
15242         : Exclude those that are not xs extensions
15243         case "$dflt" in
15244         '')     dflt=none;;
15245         esac
15246         rp="What extensions do you wish to include?"
15247         . ./myread
15248         case "$ans" in
15249         none) static_ext=' ' ;;
15250         *) static_ext="$ans" ;;
15251         esac
15252         ;;
15253 esac
15254
15255 set X $dynamic_ext $static_ext $nonxs_ext
15256 shift
15257 extensions="$*"
15258
15259 : Remove build directory name from cppstdin so it can be used from
15260 : either the present location or the final installed location.
15261 echo " "
15262 : Get out of the UU directory to get correct path name.
15263 cd ..
15264 case "$cppstdin" in
15265 `pwd`/cppstdin)
15266         echo "Stripping down cppstdin path name"
15267         cppstdin=cppstdin
15268         ;;
15269 esac
15270 cd UU
15271
15272 : end of configuration questions
15273 echo " "
15274 echo "End of configuration questions."
15275 echo " "
15276
15277 : back to where it started
15278 if test -d ../UU; then
15279         cd ..
15280 fi
15281
15282 : configuration may be patched via a 'config.over' file
15283 if $test -f config.over; then
15284         echo " "
15285         dflt=y
15286         rp='I see a config.over file.  Do you wish to load it?'
15287         . UU/myread
15288         case "$ans" in
15289         n*) echo "OK, I'll ignore it.";;
15290         *)      . ./config.over
15291                 echo "Configuration override changes have been loaded."
15292                 ;;
15293         esac
15294 fi
15295
15296 : in case they want portability, strip down executable paths
15297 case "$d_portable" in
15298 "$define")
15299         echo " "
15300         echo "Stripping down executable paths..." >&4
15301         for file in $loclist $trylist; do
15302                 eval temp=\$$file
15303                 eval $file=`basename $temp`
15304         done
15305         ;;
15306 esac
15307
15308 : create config.sh file
15309 echo " "
15310 echo "Creating config.sh..." >&4
15311 $spitshell <<EOT >config.sh
15312 $startsh
15313 #
15314 # This file was produced by running the Configure script. It holds all the
15315 # definitions figured out by Configure. Should you modify one of these values,
15316 # do not forget to propagate your changes by running "Configure -der". You may
15317 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15318 #
15319
15320 # Package name      : $package
15321 # Source directory  : $src
15322 # Configuration time: $cf_time
15323 # Configured by     : $cf_by
15324 # Target system     : $myuname
15325
15326 Author='$Author'
15327 Date='$Date'
15328 Header='$Header'
15329 Id='$Id'
15330 Locker='$Locker'
15331 Log='$Log'
15332 Mcc='$Mcc'
15333 RCSfile='$RCSfile'
15334 Revision='$Revision'
15335 Source='$Source'
15336 State='$State'
15337 _a='$_a'
15338 _exe='$_exe'
15339 _o='$_o'
15340 afs='$afs'
15341 alignbytes='$alignbytes'
15342 ansi2knr='$ansi2knr'
15343 aphostname='$aphostname'
15344 api_revision='$api_revision'
15345 api_subversion='$api_subversion'
15346 api_version='$api_version'
15347 api_versionstring='$api_versionstring'
15348 ar='$ar'
15349 archlib='$archlib'
15350 archlibexp='$archlibexp'
15351 archname64='$archname64'
15352 archname='$archname'
15353 archobjs='$archobjs'
15354 awk='$awk'
15355 baserev='$baserev'
15356 bash='$bash'
15357 bin='$bin'
15358 bincompat5005='$bincompat5005'
15359 binexp='$binexp'
15360 bison='$bison'
15361 byacc='$byacc'
15362 byteorder='$byteorder'
15363 c='$c'
15364 castflags='$castflags'
15365 cat='$cat'
15366 cc='$cc'
15367 cccdlflags='$cccdlflags'
15368 ccdlflags='$ccdlflags'
15369 ccflags='$ccflags'
15370 ccflags_uselargefiles='$ccflags_uselargefiles'
15371 ccsymbols='$ccsymbols'
15372 cf_by='$cf_by'
15373 cf_email='$cf_email'
15374 cf_time='$cf_time'
15375 charsize='$charsize'
15376 chgrp='$chgrp'
15377 chmod='$chmod'
15378 chown='$chown'
15379 clocktype='$clocktype'
15380 comm='$comm'
15381 compress='$compress'
15382 contains='$contains'
15383 cp='$cp'
15384 cpio='$cpio'
15385 cpp='$cpp'
15386 cpp_stuff='$cpp_stuff'
15387 cppccsymbols='$cppccsymbols'
15388 cppflags='$cppflags'
15389 cpplast='$cpplast'
15390 cppminus='$cppminus'
15391 cpprun='$cpprun'
15392 cppstdin='$cppstdin'
15393 cppsymbols='$cppsymbols'
15394 crosscompile='$crosscompile'
15395 cryptlib='$cryptlib'
15396 csh='$csh'
15397 d_Gconvert='$d_Gconvert'
15398 d_PRIEldbl='$d_PRIEldbl'
15399 d_PRIFldbl='$d_PRIFldbl'
15400 d_PRIGldbl='$d_PRIGldbl'
15401 d_PRIX64='$d_PRIX64'
15402 d_PRId64='$d_PRId64'
15403 d_PRIeldbl='$d_PRIeldbl'
15404 d_PRIfldbl='$d_PRIfldbl'
15405 d_PRIgldbl='$d_PRIgldbl'
15406 d_PRIi64='$d_PRIi64'
15407 d_PRIo64='$d_PRIo64'
15408 d_PRIu64='$d_PRIu64'
15409 d_PRIx64='$d_PRIx64'
15410 d_access='$d_access'
15411 d_accessx='$d_accessx'
15412 d_alarm='$d_alarm'
15413 d_archlib='$d_archlib'
15414 d_atolf='$d_atolf'
15415 d_atoll='$d_atoll'
15416 d_attribut='$d_attribut'
15417 d_bcmp='$d_bcmp'
15418 d_bcopy='$d_bcopy'
15419 d_bincompat5005='$d_bincompat5005'
15420 d_bsd='$d_bsd'
15421 d_bsdgetpgrp='$d_bsdgetpgrp'
15422 d_bsdsetpgrp='$d_bsdsetpgrp'
15423 d_bzero='$d_bzero'
15424 d_casti32='$d_casti32'
15425 d_castneg='$d_castneg'
15426 d_charvspr='$d_charvspr'
15427 d_chown='$d_chown'
15428 d_chroot='$d_chroot'
15429 d_chsize='$d_chsize'
15430 d_closedir='$d_closedir'
15431 d_const='$d_const'
15432 d_crypt='$d_crypt'
15433 d_csh='$d_csh'
15434 d_cuserid='$d_cuserid'
15435 d_dbl_dig='$d_dbl_dig'
15436 d_difftime='$d_difftime'
15437 d_dirnamlen='$d_dirnamlen'
15438 d_dlerror='$d_dlerror'
15439 d_dlopen='$d_dlopen'
15440 d_dlsymun='$d_dlsymun'
15441 d_dosuid='$d_dosuid'
15442 d_drand48proto='$d_drand48proto'
15443 d_dup2='$d_dup2'
15444 d_eaccess='$d_eaccess'
15445 d_endgrent='$d_endgrent'
15446 d_endhent='$d_endhent'
15447 d_endnent='$d_endnent'
15448 d_endpent='$d_endpent'
15449 d_endpwent='$d_endpwent'
15450 d_endsent='$d_endsent'
15451 d_eofnblk='$d_eofnblk'
15452 d_eunice='$d_eunice'
15453 d_fchmod='$d_fchmod'
15454 d_fchown='$d_fchown'
15455 d_fcntl='$d_fcntl'
15456 d_fd_macros='$d_fd_macros'
15457 d_fd_set='$d_fd_set'
15458 d_fds_bits='$d_fds_bits'
15459 d_fgetpos='$d_fgetpos'
15460 d_flexfnam='$d_flexfnam'
15461 d_flock='$d_flock'
15462 d_fork='$d_fork'
15463 d_fpathconf='$d_fpathconf'
15464 d_fpos64_t='$d_fpos64_t'
15465 d_frexpl='$d_frexpl'
15466 d_fs_data_s='$d_fs_data_s'
15467 d_fseeko='$d_fseeko'
15468 d_fsetpos='$d_fsetpos'
15469 d_fstatfs='$d_fstatfs'
15470 d_fstatvfs='$d_fstatvfs'
15471 d_ftello='$d_ftello'
15472 d_ftime='$d_ftime'
15473 d_getcwd='$d_getcwd'
15474 d_getespwnam='$d_getespwnam'
15475 d_getfsstat='$d_getfsstat'
15476 d_getgrent='$d_getgrent'
15477 d_getgrps='$d_getgrps'
15478 d_gethbyaddr='$d_gethbyaddr'
15479 d_gethbyname='$d_gethbyname'
15480 d_gethent='$d_gethent'
15481 d_gethname='$d_gethname'
15482 d_gethostprotos='$d_gethostprotos'
15483 d_getlogin='$d_getlogin'
15484 d_getmnt='$d_getmnt'
15485 d_getmntent='$d_getmntent'
15486 d_getnbyaddr='$d_getnbyaddr'
15487 d_getnbyname='$d_getnbyname'
15488 d_getnent='$d_getnent'
15489 d_getnetprotos='$d_getnetprotos'
15490 d_getpbyname='$d_getpbyname'
15491 d_getpbynumber='$d_getpbynumber'
15492 d_getpent='$d_getpent'
15493 d_getpgid='$d_getpgid'
15494 d_getpgrp2='$d_getpgrp2'
15495 d_getpgrp='$d_getpgrp'
15496 d_getppid='$d_getppid'
15497 d_getprior='$d_getprior'
15498 d_getprotoprotos='$d_getprotoprotos'
15499 d_getprpwnam='$d_getprpwnam'
15500 d_getpwent='$d_getpwent'
15501 d_getsbyname='$d_getsbyname'
15502 d_getsbyport='$d_getsbyport'
15503 d_getsent='$d_getsent'
15504 d_getservprotos='$d_getservprotos'
15505 d_getspnam='$d_getspnam'
15506 d_gettimeod='$d_gettimeod'
15507 d_gnulibc='$d_gnulibc'
15508 d_grpasswd='$d_grpasswd'
15509 d_hasmntopt='$d_hasmntopt'
15510 d_htonl='$d_htonl'
15511 d_iconv='$d_iconv'
15512 d_index='$d_index'
15513 d_inetaton='$d_inetaton'
15514 d_int64_t='$d_int64_t'
15515 d_isascii='$d_isascii'
15516 d_isnan='$d_isnan'
15517 d_isnanl='$d_isnanl'
15518 d_killpg='$d_killpg'
15519 d_lchown='$d_lchown'
15520 d_ldbl_dig='$d_ldbl_dig'
15521 d_link='$d_link'
15522 d_locconv='$d_locconv'
15523 d_lockf='$d_lockf'
15524 d_longdbl='$d_longdbl'
15525 d_longlong='$d_longlong'
15526 d_lseekproto='$d_lseekproto'
15527 d_lstat='$d_lstat'
15528 d_madvise='$d_madvise'
15529 d_mblen='$d_mblen'
15530 d_mbstowcs='$d_mbstowcs'
15531 d_mbtowc='$d_mbtowc'
15532 d_memchr='$d_memchr'
15533 d_memcmp='$d_memcmp'
15534 d_memcpy='$d_memcpy'
15535 d_memmove='$d_memmove'
15536 d_memset='$d_memset'
15537 d_mkdir='$d_mkdir'
15538 d_mkdtemp='$d_mkdtemp'
15539 d_mkfifo='$d_mkfifo'
15540 d_mkstemp='$d_mkstemp'
15541 d_mkstemps='$d_mkstemps'
15542 d_mktime='$d_mktime'
15543 d_mmap='$d_mmap'
15544 d_modfl='$d_modfl'
15545 d_mprotect='$d_mprotect'
15546 d_msg='$d_msg'
15547 d_msg_ctrunc='$d_msg_ctrunc'
15548 d_msg_dontroute='$d_msg_dontroute'
15549 d_msg_oob='$d_msg_oob'
15550 d_msg_peek='$d_msg_peek'
15551 d_msg_proxy='$d_msg_proxy'
15552 d_msgctl='$d_msgctl'
15553 d_msgget='$d_msgget'
15554 d_msgrcv='$d_msgrcv'
15555 d_msgsnd='$d_msgsnd'
15556 d_msync='$d_msync'
15557 d_munmap='$d_munmap'
15558 d_mymalloc='$d_mymalloc'
15559 d_nice='$d_nice'
15560 d_nv_preserves_uv='$d_nv_preserves_uv'
15561 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15562 d_off64_t='$d_off64_t'
15563 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15564 d_oldpthreads='$d_oldpthreads'
15565 d_oldsock='$d_oldsock'
15566 d_open3='$d_open3'
15567 d_pathconf='$d_pathconf'
15568 d_pause='$d_pause'
15569 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15570 d_phostname='$d_phostname'
15571 d_pipe='$d_pipe'
15572 d_poll='$d_poll'
15573 d_portable='$d_portable'
15574 d_printf_exp_digits='$d_printf_exp_digits'
15575 d_pthread_yield='$d_pthread_yield'
15576 d_pwage='$d_pwage'
15577 d_pwchange='$d_pwchange'
15578 d_pwclass='$d_pwclass'
15579 d_pwcomment='$d_pwcomment'
15580 d_pwexpire='$d_pwexpire'
15581 d_pwgecos='$d_pwgecos'
15582 d_pwpasswd='$d_pwpasswd'
15583 d_pwquota='$d_pwquota'
15584 d_qgcvt='$d_qgcvt'
15585 d_quad='$d_quad'
15586 d_readdir='$d_readdir'
15587 d_readlink='$d_readlink'
15588 d_rename='$d_rename'
15589 d_rewinddir='$d_rewinddir'
15590 d_rmdir='$d_rmdir'
15591 d_safebcpy='$d_safebcpy'
15592 d_safemcpy='$d_safemcpy'
15593 d_sanemcmp='$d_sanemcmp'
15594 d_sched_yield='$d_sched_yield'
15595 d_scm_rights='$d_scm_rights'
15596 d_seekdir='$d_seekdir'
15597 d_select='$d_select'
15598 d_sem='$d_sem'
15599 d_semctl='$d_semctl'
15600 d_semctl_semid_ds='$d_semctl_semid_ds'
15601 d_semctl_semun='$d_semctl_semun'
15602 d_semget='$d_semget'
15603 d_semop='$d_semop'
15604 d_setegid='$d_setegid'
15605 d_seteuid='$d_seteuid'
15606 d_setgrent='$d_setgrent'
15607 d_setgrps='$d_setgrps'
15608 d_sethent='$d_sethent'
15609 d_setlinebuf='$d_setlinebuf'
15610 d_setlocale='$d_setlocale'
15611 d_setnent='$d_setnent'
15612 d_setpent='$d_setpent'
15613 d_setpgid='$d_setpgid'
15614 d_setpgrp2='$d_setpgrp2'
15615 d_setpgrp='$d_setpgrp'
15616 d_setprior='$d_setprior'
15617 d_setproctitle='$d_setproctitle'
15618 d_setpwent='$d_setpwent'
15619 d_setregid='$d_setregid'
15620 d_setresgid='$d_setresgid'
15621 d_setresuid='$d_setresuid'
15622 d_setreuid='$d_setreuid'
15623 d_setrgid='$d_setrgid'
15624 d_setruid='$d_setruid'
15625 d_setsent='$d_setsent'
15626 d_setsid='$d_setsid'
15627 d_setvbuf='$d_setvbuf'
15628 d_sfio='$d_sfio'
15629 d_shm='$d_shm'
15630 d_shmat='$d_shmat'
15631 d_shmatprototype='$d_shmatprototype'
15632 d_shmctl='$d_shmctl'
15633 d_shmdt='$d_shmdt'
15634 d_shmget='$d_shmget'
15635 d_sigaction='$d_sigaction'
15636 d_sigsetjmp='$d_sigsetjmp'
15637 d_socket='$d_socket'
15638 d_socklen_t='$d_socklen_t'
15639 d_sockpair='$d_sockpair'
15640 d_sqrtl='$d_sqrtl'
15641 d_statblks='$d_statblks'
15642 d_statfs_f_flags='$d_statfs_f_flags'
15643 d_statfs_s='$d_statfs_s'
15644 d_statvfs='$d_statvfs'
15645 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15646 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15647 d_stdio_stream_array='$d_stdio_stream_array'
15648 d_stdiobase='$d_stdiobase'
15649 d_stdstdio='$d_stdstdio'
15650 d_strchr='$d_strchr'
15651 d_strcoll='$d_strcoll'
15652 d_strctcpy='$d_strctcpy'
15653 d_strerrm='$d_strerrm'
15654 d_strerror='$d_strerror'
15655 d_strtod='$d_strtod'
15656 d_strtol='$d_strtol'
15657 d_strtold='$d_strtold'
15658 d_strtoll='$d_strtoll'
15659 d_strtoul='$d_strtoul'
15660 d_strtoull='$d_strtoull'
15661 d_strtouq='$d_strtouq'
15662 d_strxfrm='$d_strxfrm'
15663 d_suidsafe='$d_suidsafe'
15664 d_symlink='$d_symlink'
15665 d_syscall='$d_syscall'
15666 d_sysconf='$d_sysconf'
15667 d_sysernlst='$d_sysernlst'
15668 d_syserrlst='$d_syserrlst'
15669 d_system='$d_system'
15670 d_tcgetpgrp='$d_tcgetpgrp'
15671 d_tcsetpgrp='$d_tcsetpgrp'
15672 d_telldir='$d_telldir'
15673 d_telldirproto='$d_telldirproto'
15674 d_time='$d_time'
15675 d_times='$d_times'
15676 d_truncate='$d_truncate'
15677 d_tzname='$d_tzname'
15678 d_umask='$d_umask'
15679 d_uname='$d_uname'
15680 d_union_semun='$d_union_semun'
15681 d_ustat='$d_ustat'
15682 d_vendorarch='$d_vendorarch'
15683 d_vendorbin='$d_vendorbin'
15684 d_vendorlib='$d_vendorlib'
15685 d_vfork='$d_vfork'
15686 d_void_closedir='$d_void_closedir'
15687 d_voidsig='$d_voidsig'
15688 d_voidtty='$d_voidtty'
15689 d_volatile='$d_volatile'
15690 d_vprintf='$d_vprintf'
15691 d_wait4='$d_wait4'
15692 d_waitpid='$d_waitpid'
15693 d_wcstombs='$d_wcstombs'
15694 d_wctomb='$d_wctomb'
15695 d_xenix='$d_xenix'
15696 date='$date'
15697 db_hashtype='$db_hashtype'
15698 db_prefixtype='$db_prefixtype'
15699 defvoidused='$defvoidused'
15700 direntrytype='$direntrytype'
15701 dlext='$dlext'
15702 dlsrc='$dlsrc'
15703 doublesize='$doublesize'
15704 drand01='$drand01'
15705 dynamic_ext='$dynamic_ext'
15706 eagain='$eagain'
15707 ebcdic='$ebcdic'
15708 echo='$echo'
15709 egrep='$egrep'
15710 emacs='$emacs'
15711 eunicefix='$eunicefix'
15712 exe_ext='$exe_ext'
15713 expr='$expr'
15714 extensions='$extensions'
15715 fflushNULL='$fflushNULL'
15716 fflushall='$fflushall'
15717 find='$find'
15718 firstmakefile='$firstmakefile'
15719 flex='$flex'
15720 fpossize='$fpossize'
15721 fpostype='$fpostype'
15722 freetype='$freetype'
15723 full_ar='$full_ar'
15724 full_csh='$full_csh'
15725 full_sed='$full_sed'
15726 gccosandvers='$gccosandvers'
15727 gccversion='$gccversion'
15728 gidformat='$gidformat'
15729 gidsign='$gidsign'
15730 gidsize='$gidsize'
15731 gidtype='$gidtype'
15732 glibpth='$glibpth'
15733 grep='$grep'
15734 groupcat='$groupcat'
15735 groupstype='$groupstype'
15736 gzip='$gzip'
15737 h_fcntl='$h_fcntl'
15738 h_sysfile='$h_sysfile'
15739 hint='$hint'
15740 hostcat='$hostcat'
15741 huge='$huge'
15742 i16size='$i16size'
15743 i16type='$i16type'
15744 i32size='$i32size'
15745 i32type='$i32type'
15746 i64size='$i64size'
15747 i64type='$i64type'
15748 i8size='$i8size'
15749 i8type='$i8type'
15750 i_arpainet='$i_arpainet'
15751 i_bsdioctl='$i_bsdioctl'
15752 i_db='$i_db'
15753 i_dbm='$i_dbm'
15754 i_dirent='$i_dirent'
15755 i_dld='$i_dld'
15756 i_dlfcn='$i_dlfcn'
15757 i_fcntl='$i_fcntl'
15758 i_float='$i_float'
15759 i_gdbm='$i_gdbm'
15760 i_grp='$i_grp'
15761 i_iconv='$i_iconv'
15762 i_ieeefp='$i_ieeefp'
15763 i_inttypes='$i_inttypes'
15764 i_libutil='$i_libutil'
15765 i_limits='$i_limits'
15766 i_locale='$i_locale'
15767 i_machcthr='$i_machcthr'
15768 i_malloc='$i_malloc'
15769 i_math='$i_math'
15770 i_memory='$i_memory'
15771 i_mntent='$i_mntent'
15772 i_ndbm='$i_ndbm'
15773 i_netdb='$i_netdb'
15774 i_neterrno='$i_neterrno'
15775 i_netinettcp='$i_netinettcp'
15776 i_niin='$i_niin'
15777 i_poll='$i_poll'
15778 i_prot='$i_prot'
15779 i_pthread='$i_pthread'
15780 i_pwd='$i_pwd'
15781 i_rpcsvcdbm='$i_rpcsvcdbm'
15782 i_sfio='$i_sfio'
15783 i_sgtty='$i_sgtty'
15784 i_shadow='$i_shadow'
15785 i_socks='$i_socks'
15786 i_stdarg='$i_stdarg'
15787 i_stddef='$i_stddef'
15788 i_stdlib='$i_stdlib'
15789 i_string='$i_string'
15790 i_sunmath='$i_sunmath'
15791 i_sysaccess='$i_sysaccess'
15792 i_sysdir='$i_sysdir'
15793 i_sysfile='$i_sysfile'
15794 i_sysfilio='$i_sysfilio'
15795 i_sysin='$i_sysin'
15796 i_sysioctl='$i_sysioctl'
15797 i_syslog='$i_syslog'
15798 i_sysmman='$i_sysmman'
15799 i_sysmode='$i_sysmode'
15800 i_sysmount='$i_sysmount'
15801 i_sysndir='$i_sysndir'
15802 i_sysparam='$i_sysparam'
15803 i_sysresrc='$i_sysresrc'
15804 i_syssecrt='$i_syssecrt'
15805 i_sysselct='$i_sysselct'
15806 i_syssockio='$i_syssockio'
15807 i_sysstat='$i_sysstat'
15808 i_sysstatfs='$i_sysstatfs'
15809 i_sysstatvfs='$i_sysstatvfs'
15810 i_systime='$i_systime'
15811 i_systimek='$i_systimek'
15812 i_systimes='$i_systimes'
15813 i_systypes='$i_systypes'
15814 i_sysuio='$i_sysuio'
15815 i_sysun='$i_sysun'
15816 i_sysutsname='$i_sysutsname'
15817 i_sysvfs='$i_sysvfs'
15818 i_syswait='$i_syswait'
15819 i_termio='$i_termio'
15820 i_termios='$i_termios'
15821 i_time='$i_time'
15822 i_unistd='$i_unistd'
15823 i_ustat='$i_ustat'
15824 i_utime='$i_utime'
15825 i_values='$i_values'
15826 i_varargs='$i_varargs'
15827 i_varhdr='$i_varhdr'
15828 i_vfork='$i_vfork'
15829 ignore_versioned_solibs='$ignore_versioned_solibs'
15830 inc_version_list='$inc_version_list'
15831 inc_version_list_init='$inc_version_list_init'
15832 incpath='$incpath'
15833 inews='$inews'
15834 installarchlib='$installarchlib'
15835 installbin='$installbin'
15836 installman1dir='$installman1dir'
15837 installman3dir='$installman3dir'
15838 installprefix='$installprefix'
15839 installprefixexp='$installprefixexp'
15840 installprivlib='$installprivlib'
15841 installscript='$installscript'
15842 installsitearch='$installsitearch'
15843 installsitebin='$installsitebin'
15844 installsitelib='$installsitelib'
15845 installstyle='$installstyle'
15846 installusrbinperl='$installusrbinperl'
15847 installvendorarch='$installvendorarch'
15848 installvendorbin='$installvendorbin'
15849 installvendorlib='$installvendorlib'
15850 intsize='$intsize'
15851 ivdformat='$ivdformat'
15852 ivsize='$ivsize'
15853 ivtype='$ivtype'
15854 known_extensions='$known_extensions'
15855 ksh='$ksh'
15856 large='$large'
15857 ld='$ld'
15858 lddlflags='$lddlflags'
15859 ldflags='$ldflags'
15860 ldflags_uselargefiles='$ldflags_uselargefiles'
15861 ldlibpthname='$ldlibpthname'
15862 less='$less'
15863 lib_ext='$lib_ext'
15864 libc='$libc'
15865 libperl='$libperl'
15866 libpth='$libpth'
15867 libs='$libs'
15868 libsdirs='$libsdirs'
15869 libsfiles='$libsfiles'
15870 libsfound='$libsfound'
15871 libspath='$libspath'
15872 libswanted='$libswanted'
15873 libswanted_uselargefiles='$libswanted_uselargefiles'
15874 line='$line'
15875 lint='$lint'
15876 lkflags='$lkflags'
15877 ln='$ln'
15878 lns='$lns'
15879 locincpth='$locincpth'
15880 loclibpth='$loclibpth'
15881 longdblsize='$longdblsize'
15882 longlongsize='$longlongsize'
15883 longsize='$longsize'
15884 lp='$lp'
15885 lpr='$lpr'
15886 ls='$ls'
15887 lseeksize='$lseeksize'
15888 lseektype='$lseektype'
15889 mail='$mail'
15890 mailx='$mailx'
15891 make='$make'
15892 make_set_make='$make_set_make'
15893 mallocobj='$mallocobj'
15894 mallocsrc='$mallocsrc'
15895 malloctype='$malloctype'
15896 man1dir='$man1dir'
15897 man1direxp='$man1direxp'
15898 man1ext='$man1ext'
15899 man3dir='$man3dir'
15900 man3direxp='$man3direxp'
15901 man3ext='$man3ext'
15902 medium='$medium'
15903 mips_type='$mips_type'
15904 mkdir='$mkdir'
15905 mmaptype='$mmaptype'
15906 models='$models'
15907 modetype='$modetype'
15908 more='$more'
15909 multiarch='$multiarch'
15910 mv='$mv'
15911 myarchname='$myarchname'
15912 mydomain='$mydomain'
15913 myhostname='$myhostname'
15914 myuname='$myuname'
15915 n='$n'
15916 netdb_hlen_type='$netdb_hlen_type'
15917 netdb_host_type='$netdb_host_type'
15918 netdb_name_type='$netdb_name_type'
15919 netdb_net_type='$netdb_net_type'
15920 nm='$nm'
15921 nm_opt='$nm_opt'
15922 nm_so_opt='$nm_so_opt'
15923 nonxs_ext='$nonxs_ext'
15924 nroff='$nroff'
15925 nvsize='$nvsize'
15926 nvtype='$nvtype'
15927 o_nonblock='$o_nonblock'
15928 obj_ext='$obj_ext'
15929 old_pthread_create_joinable='$old_pthread_create_joinable'
15930 optimize='$optimize'
15931 orderlib='$orderlib'
15932 osname='$osname'
15933 osvers='$osvers'
15934 otherlibdirs='$otherlibdirs'
15935 package='$package'
15936 pager='$pager'
15937 passcat='$passcat'
15938 patchlevel='$patchlevel'
15939 path_sep='$path_sep'
15940 perl5='$perl5'
15941 perl='$perl'
15942 perladmin='$perladmin'
15943 perlpath='$perlpath'
15944 pg='$pg'
15945 phostname='$phostname'
15946 pidtype='$pidtype'
15947 plibpth='$plibpth'
15948 pm_apiversion='$pm_apiversion'
15949 pmake='$pmake'
15950 pr='$pr'
15951 prefix='$prefix'
15952 prefixexp='$prefixexp'
15953 privlib='$privlib'
15954 privlibexp='$privlibexp'
15955 prototype='$prototype'
15956 ptrsize='$ptrsize'
15957 quadkind='$quadkind'
15958 quadtype='$quadtype'
15959 randbits='$randbits'
15960 randfunc='$randfunc'
15961 randseedtype='$randseedtype'
15962 ranlib='$ranlib'
15963 rd_nodata='$rd_nodata'
15964 revision='$revision'
15965 rm='$rm'
15966 rmail='$rmail'
15967 runnm='$runnm'
15968 sPRIEldbl='$sPRIEldbl'
15969 sPRIFldbl='$sPRIFldbl'
15970 sPRIGldbl='$sPRIGldbl'
15971 sPRIX64='$sPRIX64'
15972 sPRId64='$sPRId64'
15973 sPRIeldbl='$sPRIeldbl'
15974 sPRIfldbl='$sPRIfldbl'
15975 sPRIgldbl='$sPRIgldbl'
15976 sPRIi64='$sPRIi64'
15977 sPRIo64='$sPRIo64'
15978 sPRIu64='$sPRIu64'
15979 sPRIx64='$sPRIx64'
15980 sched_yield='$sched_yield'
15981 scriptdir='$scriptdir'
15982 scriptdirexp='$scriptdirexp'
15983 sed='$sed'
15984 seedfunc='$seedfunc'
15985 selectminbits='$selectminbits'
15986 selecttype='$selecttype'
15987 sendmail='$sendmail'
15988 sh='$sh'
15989 shar='$shar'
15990 sharpbang='$sharpbang'
15991 shmattype='$shmattype'
15992 shortsize='$shortsize'
15993 shrpenv='$shrpenv'
15994 shsharp='$shsharp'
15995 sig_count='$sig_count'
15996 sig_name='$sig_name'
15997 sig_name_init='$sig_name_init'
15998 sig_num='$sig_num'
15999 sig_num_init='$sig_num_init'
16000 signal_t='$signal_t'
16001 sitearch='$sitearch'
16002 sitearchexp='$sitearchexp'
16003 sitebin='$sitebin'
16004 sitebinexp='$sitebinexp'
16005 sitelib='$sitelib'
16006 sitelib_stem='$sitelib_stem'
16007 sitelibexp='$sitelibexp'
16008 siteprefix='$siteprefix'
16009 siteprefixexp='$siteprefixexp'
16010 sizesize='$sizesize'
16011 sizetype='$sizetype'
16012 sleep='$sleep'
16013 smail='$smail'
16014 small='$small'
16015 so='$so'
16016 sockethdr='$sockethdr'
16017 socketlib='$socketlib'
16018 socksizetype='$socksizetype'
16019 sort='$sort'
16020 spackage='$spackage'
16021 spitshell='$spitshell'
16022 split='$split'
16023 src='$src'
16024 ssizetype='$ssizetype'
16025 startperl='$startperl'
16026 startsh='$startsh'
16027 static_ext='$static_ext'
16028 stdchar='$stdchar'
16029 stdio_base='$stdio_base'
16030 stdio_bufsiz='$stdio_bufsiz'
16031 stdio_cnt='$stdio_cnt'
16032 stdio_filbuf='$stdio_filbuf'
16033 stdio_ptr='$stdio_ptr'
16034 stdio_stream_array='$stdio_stream_array'
16035 strings='$strings'
16036 submit='$submit'
16037 subversion='$subversion'
16038 sysman='$sysman'
16039 tail='$tail'
16040 tar='$tar'
16041 tbl='$tbl'
16042 tee='$tee'
16043 test='$test'
16044 timeincl='$timeincl'
16045 timetype='$timetype'
16046 touch='$touch'
16047 tr='$tr'
16048 trnl='$trnl'
16049 troff='$troff'
16050 u16size='$u16size'
16051 u16type='$u16type'
16052 u32size='$u32size'
16053 u32type='$u32type'
16054 u64size='$u64size'
16055 u64type='$u64type'
16056 u8size='$u8size'
16057 u8type='$u8type'
16058 uidformat='$uidformat'
16059 uidsign='$uidsign'
16060 uidsize='$uidsize'
16061 uidtype='$uidtype'
16062 uname='$uname'
16063 uniq='$uniq'
16064 uquadtype='$uquadtype'
16065 use5005threads='$use5005threads'
16066 use64bitall='$use64bitall'
16067 use64bitint='$use64bitint'
16068 usedl='$usedl'
16069 useithreads='$useithreads'
16070 uselargefiles='$uselargefiles'
16071 uselongdouble='$uselongdouble'
16072 usemorebits='$usemorebits'
16073 usemultiplicity='$usemultiplicity'
16074 usemymalloc='$usemymalloc'
16075 usenm='$usenm'
16076 useopcode='$useopcode'
16077 useperlio='$useperlio'
16078 useposix='$useposix'
16079 usesfio='$usesfio'
16080 useshrplib='$useshrplib'
16081 usesocks='$usesocks'
16082 usethreads='$usethreads'
16083 usevendorprefix='$usevendorprefix'
16084 usevfork='$usevfork'
16085 usrinc='$usrinc'
16086 uuname='$uuname'
16087 uvoformat='$uvoformat'
16088 uvsize='$uvsize'
16089 uvtype='$uvtype'
16090 uvuformat='$uvuformat'
16091 uvxformat='$uvxformat'
16092 vendorarch='$vendorarch'
16093 vendorarchexp='$vendorarchexp'
16094 vendorbin='$vendorbin'
16095 vendorbinexp='$vendorbinexp'
16096 vendorlib='$vendorlib'
16097 vendorlib_stem='$vendorlib_stem'
16098 vendorlibexp='$vendorlibexp'
16099 vendorprefix='$vendorprefix'
16100 vendorprefixexp='$vendorprefixexp'
16101 version='$version'
16102 vi='$vi'
16103 voidflags='$voidflags'
16104 xlibpth='$xlibpth'
16105 xs_apiversion='$xs_apiversion'
16106 zcat='$zcat'
16107 zip='$zip'
16108 EOT
16109
16110 : Add in command line options if available
16111 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16112
16113 : add special variables
16114 $test -f $src/patchlevel.h && \
16115 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16116 echo "CONFIGDOTSH=true" >>config.sh
16117
16118 : propagate old symbols
16119 if $test -f UU/config.sh; then
16120         <UU/config.sh sort | uniq >UU/oldconfig.sh
16121         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16122         sort | uniq -u >UU/oldsyms
16123         set X `cat UU/oldsyms`
16124         shift
16125         case $# in
16126         0) ;;
16127         *)
16128                 cat <<EOM
16129 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16130 EOM
16131                 echo "# Variables propagated from previous config.sh file." >>config.sh
16132                 for sym in `cat UU/oldsyms`; do
16133                         echo "    Propagating $hint variable "'$'"$sym..."
16134                         eval 'tmp="$'"${sym}"'"'
16135                         echo "$tmp" | \
16136                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16137                 done
16138                 ;;
16139         esac
16140 fi
16141
16142 : Finish up by extracting the .SH files
16143 case "$alldone" in
16144 exit)
16145         $rm -rf UU
16146         echo "Done."
16147         exit 0
16148         ;;
16149 cont)
16150         ;;
16151 '')
16152         dflt=''
16153         nostick=true
16154         $cat <<EOM
16155
16156 If you'd like to make any changes to the config.sh file before I begin
16157 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16158
16159 EOM
16160         rp="Press return or use a shell escape to edit config.sh:"
16161         . UU/myread
16162         nostick=''
16163         case "$ans" in
16164         '') ;;
16165         *) : in case they cannot read
16166                 sh 1>&4 -c "$ans";;
16167         esac
16168         ;;
16169 esac
16170
16171 : if this fails, just run all the .SH files by hand
16172 . ./config.sh
16173
16174 echo " "
16175 exec 1>&4
16176 . ./UU/extract
16177
16178 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16179         dflt=y
16180         case "$silent" in
16181         true) ;;
16182         *)
16183                 $cat <<EOM
16184
16185 Now you need to generate make dependencies by running "$make depend".
16186 You might prefer to run it in background: "$make depend > makedepend.out &"
16187 It can take a while, so you might not want to run it right now.
16188
16189 EOM
16190                 ;;
16191         esac
16192         rp="Run $make depend now?"
16193         . UU/myread
16194         case "$ans" in
16195         y*)
16196                 $make depend && echo "Now you must run a $make."
16197                 ;;
16198         *)
16199                 echo "You must run '$make depend' then '$make'."
16200                 ;;
16201         esac
16202 elif test -f [Mm]akefile; then
16203         echo " "
16204         echo "Now you must run a $make."
16205 else
16206         echo "Done."
16207 fi
16208
16209 if $test -f Policy.sh; then
16210     $cat <<EOM
16211
16212 If you compile $package on a different machine or from a different object
16213 directory, copy the Policy.sh file from this object directory to the
16214 new one before you run Configure -- this will help you with most of
16215 the policy defaults.
16216
16217 EOM
16218 fi
16219 if $test -f config.msg; then
16220     echo "Hmm.  I also noted the following information while running:"
16221     echo " "
16222     $cat config.msg >&4
16223     $rm -f config.msg
16224 fi
16225 $rm -f kit*isdone ark*isdone
16226 $rm -rf UU
16227
16228 : End of Configure
16229