Megalopatch for Configure: Andy's new installation schemes;
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Fri Feb 25 07:45:17 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fpos64_t=''
358 d_fs_data_s=''
359 d_fseeko=''
360 d_fsetpos=''
361 d_fstatfs=''
362 d_ftello=''
363 d_ftime=''
364 d_gettimeod=''
365 d_Gconvert=''
366 d_getcwd=''
367 d_getgrent=''
368 d_getgrps=''
369 d_gethbyaddr=''
370 d_gethbyname=''
371 d_gethent=''
372 aphostname=''
373 d_gethname=''
374 d_phostname=''
375 d_uname=''
376 d_gethostprotos=''
377 d_getlogin=''
378 d_getmnt=''
379 d_getmntent=''
380 d_getnbyaddr=''
381 d_getnbyname=''
382 d_getnent=''
383 d_getnetprotos=''
384 d_getpent=''
385 d_getpgid=''
386 d_getpgrp2=''
387 d_bsdgetpgrp=''
388 d_getpgrp=''
389 d_getppid=''
390 d_getprior=''
391 d_getpbyname=''
392 d_getpbynumber=''
393 d_getprotoprotos=''
394 d_getpwent=''
395 d_getsent=''
396 d_getservprotos=''
397 d_getspent=''
398 d_getspnam=''
399 d_getsbyname=''
400 d_getsbyport=''
401 d_gnulibc=''
402 d_hasmntopt=''
403 d_htonl=''
404 d_iconv=''
405 d_inetaton=''
406 d_int64_t=''
407 d_isascii=''
408 d_killpg=''
409 d_lchown=''
410 d_ldbl_dig=''
411 d_link=''
412 d_locconv=''
413 d_lockf=''
414 d_longdbl=''
415 longdblsize=''
416 d_longlong=''
417 longlongsize=''
418 d_lseekproto=''
419 d_lstat=''
420 d_mblen=''
421 d_mbstowcs=''
422 d_mbtowc=''
423 d_memchr=''
424 d_memcmp=''
425 d_memcpy=''
426 d_memmove=''
427 d_memset=''
428 d_mkdir=''
429 d_mkdtemp=''
430 d_mkfifo=''
431 d_mkstemp=''
432 d_mkstemps=''
433 d_mktime=''
434 d_mmap=''
435 mmaptype=''
436 d_mprotect=''
437 d_msg=''
438 d_msgctl=''
439 d_msgget=''
440 d_msgrcv=''
441 d_msgsnd=''
442 d_msync=''
443 d_munmap=''
444 d_nice=''
445 d_off64_t=''
446 d_open3=''
447 d_fpathconf=''
448 d_pathconf=''
449 d_pause=''
450 d_pipe=''
451 d_poll=''
452 d_portable=''
453 d_old_pthread_create_joinable=''
454 old_pthread_create_joinable=''
455 d_pthread_yield=''
456 d_sched_yield=''
457 sched_yield=''
458 d_readdir=''
459 d_rewinddir=''
460 d_seekdir=''
461 d_telldir=''
462 d_readlink=''
463 d_rename=''
464 d_rmdir=''
465 d_safebcpy=''
466 d_safemcpy=''
467 d_sanemcmp=''
468 d_select=''
469 d_sem=''
470 d_semctl=''
471 d_semget=''
472 d_semop=''
473 d_setegid=''
474 d_seteuid=''
475 d_setgrent=''
476 d_setgrps=''
477 d_sethent=''
478 d_setlinebuf=''
479 d_setlocale=''
480 d_setnent=''
481 d_setpent=''
482 d_setpgid=''
483 d_setpgrp2=''
484 d_bsdsetpgrp=''
485 d_setpgrp=''
486 d_setprior=''
487 d_setpwent=''
488 d_setregid=''
489 d_setresgid=''
490 d_setresuid=''
491 d_setreuid=''
492 d_setrgid=''
493 d_setruid=''
494 d_setsent=''
495 d_setsid=''
496 d_setspent=''
497 d_setvbuf=''
498 d_sfio=''
499 usesfio=''
500 d_shm=''
501 d_shmat=''
502 d_shmatprototype=''
503 shmattype=''
504 d_shmctl=''
505 d_shmdt=''
506 d_shmget=''
507 d_sigaction=''
508 d_sigsetjmp=''
509 d_msg_ctrunc=''
510 d_msg_dontroute=''
511 d_msg_oob=''
512 d_msg_peek=''
513 d_msg_proxy=''
514 d_oldsock=''
515 d_scm_rights=''
516 d_socket=''
517 d_sockpair=''
518 sockethdr=''
519 socketlib=''
520 d_socklen_t=''
521 d_sqrtl=''
522 d_statblks=''
523 d_statfs_f_flags=''
524 d_statfs_s=''
525 d_fstatvfs=''
526 d_statvfs=''
527 d_stdio_cnt_lval=''
528 d_stdio_ptr_lval=''
529 d_stdiobase=''
530 d_stdstdio=''
531 stdio_base=''
532 stdio_bufsiz=''
533 stdio_cnt=''
534 stdio_filbuf=''
535 stdio_ptr=''
536 d_index=''
537 d_strchr=''
538 d_strcoll=''
539 d_strctcpy=''
540 d_strerrm=''
541 d_strerror=''
542 d_sysernlst=''
543 d_syserrlst=''
544 d_strtod=''
545 d_strtol=''
546 d_strtold=''
547 d_strtoll=''
548 d_strtoul=''
549 d_strtoull=''
550 d_strtouq=''
551 d_strxfrm=''
552 d_symlink=''
553 d_syscall=''
554 d_sysconf=''
555 d_system=''
556 d_tcgetpgrp=''
557 d_tcsetpgrp=''
558 d_telldirproto=''
559 d_time=''
560 timetype=''
561 clocktype=''
562 d_times=''
563 d_truncate=''
564 d_tzname=''
565 d_umask=''
566 d_semctl_semid_ds=''
567 d_semctl_semun=''
568 d_union_semun=''
569 d_ustat=''
570 d_vfork=''
571 usevfork=''
572 d_voidsig=''
573 signal_t=''
574 d_volatile=''
575 d_charvspr=''
576 d_vprintf=''
577 d_wait4=''
578 d_waitpid=''
579 d_wcstombs=''
580 d_wctomb=''
581 dlext=''
582 cccdlflags=''
583 ccdlflags=''
584 dlsrc=''
585 ld=''
586 lddlflags=''
587 usedl=''
588 doublesize=''
589 ebcdic=''
590 fflushNULL=''
591 fflushall=''
592 fpossize=''
593 fpostype=''
594 gidformat=''
595 gidsign=''
596 gidsize=''
597 gidtype=''
598 groupstype=''
599 h_fcntl=''
600 h_sysfile=''
601 i_arpainet=''
602 db_hashtype=''
603 db_prefixtype=''
604 i_db=''
605 i_dbm=''
606 i_rpcsvcdbm=''
607 d_dirnamlen=''
608 direntrytype=''
609 i_dirent=''
610 i_dld=''
611 i_dlfcn=''
612 i_fcntl=''
613 i_float=''
614 i_gdbm=''
615 d_grpasswd=''
616 i_grp=''
617 i_iconv=''
618 i_inttypes=''
619 i_limits=''
620 i_locale=''
621 i_machcthr=''
622 i_malloc=''
623 i_math=''
624 i_memory=''
625 i_mntent=''
626 i_ndbm=''
627 i_netdb=''
628 i_neterrno=''
629 i_netinettcp=''
630 i_niin=''
631 i_sysin=''
632 i_poll=''
633 i_pthread=''
634 d_pwage=''
635 d_pwchange=''
636 d_pwclass=''
637 d_pwcomment=''
638 d_pwexpire=''
639 d_pwgecos=''
640 d_pwpasswd=''
641 d_pwquota=''
642 i_pwd=''
643 i_sfio=''
644 i_shadow=''
645 i_socks=''
646 i_stddef=''
647 i_stdlib=''
648 i_string=''
649 strings=''
650 i_sysaccess=''
651 i_sysdir=''
652 i_sysfile=''
653 d_voidtty=''
654 i_bsdioctl=''
655 i_sysfilio=''
656 i_sysioctl=''
657 i_syssockio=''
658 i_syslog=''
659 i_sysmman=''
660 i_sysmode=''
661 i_sysmount=''
662 i_sysndir=''
663 i_sysparam=''
664 i_sysresrc=''
665 i_syssecrt=''
666 i_sysselct=''
667 i_sysstat=''
668 i_sysstatfs=''
669 i_sysstatvfs=''
670 i_systimes=''
671 i_systypes=''
672 i_sysuio=''
673 i_sysun=''
674 i_sysutsname=''
675 i_sysvfs=''
676 i_syswait=''
677 i_sgtty=''
678 i_termio=''
679 i_termios=''
680 i_systime=''
681 i_systimek=''
682 i_time=''
683 timeincl=''
684 i_unistd=''
685 i_ustat=''
686 i_utime=''
687 i_values=''
688 i_stdarg=''
689 i_varargs=''
690 i_varhdr=''
691 i_vfork=''
692 inc_version_list=''
693 inc_version_list_init=''
694 installprefix=''
695 installprefixexp=''
696 installstyle=''
697 installusrbinperl=''
698 intsize=''
699 longsize=''
700 shortsize=''
701 libc=''
702 ldlibpthname=''
703 libperl=''
704 shrpenv=''
705 useshrplib=''
706 glibpth=''
707 libpth=''
708 loclibpth=''
709 plibpth=''
710 xlibpth=''
711 ignore_versioned_solibs=''
712 libs=''
713 libsdirs=''
714 libsfiles=''
715 libsfound=''
716 libspath=''
717 lns=''
718 d_PRIEldbl=''
719 d_PRIFldbl=''
720 d_PRIGldbl=''
721 d_PRIeldbl=''
722 d_PRIfldbl=''
723 d_PRIgldbl=''
724 sPRIEldbl=''
725 sPRIFldbl=''
726 sPRIGldbl=''
727 sPRIeldbl=''
728 sPRIfldbl=''
729 sPRIgldbl=''
730 lseeksize=''
731 lseektype=''
732 make_set_make=''
733 d_mymalloc=''
734 freetype=''
735 mallocobj=''
736 mallocsrc=''
737 malloctype=''
738 usemymalloc=''
739 installman1dir=''
740 man1dir=''
741 man1direxp=''
742 man1ext=''
743 installman3dir=''
744 man3dir=''
745 man3direxp=''
746 man3ext=''
747 huge=''
748 large=''
749 medium=''
750 models=''
751 small=''
752 split=''
753 modetype=''
754 multiarch=''
755 mydomain=''
756 myhostname=''
757 phostname=''
758 c=''
759 n=''
760 d_eofnblk=''
761 eagain=''
762 o_nonblock=''
763 rd_nodata=''
764 netdb_hlen_type=''
765 netdb_host_type=''
766 netdb_name_type=''
767 netdb_net_type=''
768 groupcat=''
769 hostcat=''
770 passcat=''
771 orderlib=''
772 ranlib=''
773 package=''
774 spackage=''
775 pager=''
776 api_revision=''
777 api_subversion=''
778 api_version=''
779 api_versionstring=''
780 patchlevel=''
781 revision=''
782 subversion=''
783 version=''
784 perl5=''
785 perladmin=''
786 perlpath=''
787 d_nv_preserves_uv=''
788 i16size=''
789 i16type=''
790 i32size=''
791 i32type=''
792 i64size=''
793 i64type=''
794 i8size=''
795 i8type=''
796 ivsize=''
797 ivtype=''
798 nvsize=''
799 nvtype=''
800 u16size=''
801 u16type=''
802 u32size=''
803 u32type=''
804 u64size=''
805 u64type=''
806 u8size=''
807 u8type=''
808 uvsize=''
809 uvtype=''
810 ivdformat=''
811 uvoformat=''
812 uvuformat=''
813 uvxformat=''
814 pidtype=''
815 prefix=''
816 prefixexp=''
817 installprivlib=''
818 privlib=''
819 privlibexp=''
820 prototype=''
821 ptrsize=''
822 d_PRIX64=''
823 d_PRId64=''
824 d_PRIi64=''
825 d_PRIo64=''
826 d_PRIu64=''
827 d_PRIx64=''
828 sPRIX64=''
829 sPRId64=''
830 sPRIi64=''
831 sPRIo64=''
832 sPRIu64=''
833 sPRIx64=''
834 d_quad=''
835 quadkind=''
836 quadtype=''
837 uquadtype=''
838 drand01=''
839 randbits=''
840 randfunc=''
841 randseedtype=''
842 seedfunc=''
843 installscript=''
844 scriptdir=''
845 scriptdirexp=''
846 selectminbits=''
847 selecttype=''
848 sh=''
849 sig_count=''
850 sig_name=''
851 sig_name_init=''
852 sig_num=''
853 sig_num_init=''
854 installsitearch=''
855 sitearch=''
856 sitearchexp=''
857 installsitebin=''
858 sitebin=''
859 sitebinexp=''
860 installsitelib=''
861 sitelib=''
862 sitelibexp=''
863 siteprefix=''
864 siteprefixexp=''
865 sizetype=''
866 so=''
867 sharpbang=''
868 shsharp=''
869 spitshell=''
870 src=''
871 ssizetype=''
872 startperl=''
873 startsh=''
874 stdchar=''
875 d_stdio_stream_array=''
876 stdio_stream_array=''
877 sysman=''
878 trnl=''
879 uidformat=''
880 uidsign=''
881 uidsize=''
882 uidtype=''
883 archname64=''
884 use64bits=''
885 usefull64bits=''
886 uselargefiles=''
887 uselongdouble=''
888 usemorebits=''
889 usemultiplicity=''
890 nm_opt=''
891 nm_so_opt=''
892 runnm=''
893 usenm=''
894 useperlio=''
895 usesocks=''
896 d_oldpthreads=''
897 use5005threads=''
898 useithreads=''
899 usethreads=''
900 incpath=''
901 mips_type=''
902 usrinc=''
903 d_vendorbin=''
904 installvendorbin=''
905 vendorbin=''
906 vendorbinexp=''
907 d_vendorlib=''
908 installvendorlib=''
909 vendorlib=''
910 vendorlibexp=''
911 usevendorprefix=''
912 vendorprefix=''
913 vendorprefixexp=''
914 defvoidused=''
915 voidflags=''
916 pm_apiversion=''
917 xs_apiversion=''
918 CONFIG=''
919
920 define='define'
921 undef='undef'
922 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
923 rmlist=''
924
925 : We must find out about Eunice early
926 eunicefix=':'
927 if test -f /etc/unixtovms; then
928         eunicefix=/etc/unixtovms
929 fi
930 if test -f /etc/unixtovms.exe; then
931         eunicefix=/etc/unixtovms.exe
932 fi
933
934 i_whoami=''
935 : set useposix=false in your hint file to disable the POSIX extension.
936 useposix=true
937 : set useopcode=false in your hint file to disable the Opcode extension.
938 useopcode=true
939 : Trailing extension.  Override this in a hint file, if needed.
940 _exe=''
941 : Extra object files, if any, needed on this platform.
942 archobjs=''
943 : Possible local include directories to search.
944 : Set locincpth to "" in a hint file to defeat local include searches.
945 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
946 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
947 :
948 : no include file wanted by default
949 inclwanted=''
950
951 groupstype=''
952 : change the next line if compiling for Xenix/286 on Xenix/386
953 xlibpth='/usr/lib/386 /lib/386'
954 : Possible local library directories to search.
955 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
956 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
957
958 : general looking path for locating libraries
959 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
960 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
961 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
962 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
963 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
964
965 : Private path used by Configure to find libraries.  Its value
966 : is prepended to libpth. This variable takes care of special
967 : machines, like the mips.  Usually, it should be empty.
968 plibpth=''
969
970 : default library list
971 libswanted=''
972 : some systems want to use only the non-versioned libso:s
973 ignore_versioned_solibs=''
974 : set usemultiplicity on the Configure command line to enable multiplicity.
975 : set usesocks on the Configure command line to enable socks.
976 : set usethreads on the Configure command line to enable threads.
977 : full support for void wanted by default
978 defvoidused=15
979
980 : List of libraries we want.
981 : If anyone needs -lnet, put it in a hint file.
982 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
983 libswanted="$libswanted dld ld sun m c cposix posix"
984 libswanted="$libswanted ndir dir crypt sec"
985 libswanted="$libswanted ucb bsd BSD PW x"
986 : We probably want to search /usr/shlib before most other libraries.
987 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
988 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
989 glibpth="/usr/shlib $glibpth"
990 : Do not use vfork unless overridden by a hint file.
991 usevfork=false
992
993 : Find the basic shell for Bourne shell scripts
994 case "$sh" in
995 '')
996         case "$SYSTYPE" in
997         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
998         *) xxx='/bin/sh';;
999         esac
1000         if test -f "$xxx"; then
1001                 sh="$xxx"
1002         else
1003                 : Build up a list and do a single loop so we can 'break' out.
1004                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1005                 for xxx in sh bash ksh pdksh ash; do
1006                         for p in $pth; do
1007                                 try="$try ${p}/${xxx}"
1008                         done
1009                 done
1010                 for xxx in $try; do
1011                         if test -f "$xxx"; then
1012                                 sh="$xxx";
1013                                 break
1014                         elif test -f "$xxx.exe"; then
1015                                 sh="$xxx";
1016                                 break
1017                         fi
1018                 done
1019         fi
1020         ;;
1021 esac
1022
1023 case "$sh" in
1024 '')     cat <<EOM >&2
1025 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1026
1027 Usually it's in /bin/sh.  How did you even get this far?
1028 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1029 we'll try to straighten this all out.
1030 EOM
1031         exit 1
1032         ;;
1033 esac
1034
1035 : see if sh knows # comments
1036 if `$sh -c '#' >/dev/null 2>&1`; then
1037         shsharp=true
1038         spitshell=cat
1039         xcat=/bin/cat
1040         test -f $xcat || xcat=/usr/bin/cat
1041         echo "#!$xcat" >try
1042         $eunicefix try
1043         chmod +x try
1044         ./try > today
1045         if test -s today; then
1046                 sharpbang='#!'
1047         else
1048                 echo "#! $xcat" > try
1049                 $eunicefix try
1050                 chmod +x try
1051                 ./try > today
1052                 if test -s today; then
1053                         sharpbang='#! '
1054                 else
1055                         sharpbang=': use '
1056                 fi
1057         fi
1058 else
1059         echo " "
1060         echo "Your $sh doesn't grok # comments--I will strip them later on."
1061         shsharp=false
1062         cd ..
1063         echo "exec grep -v '^[  ]*#'" >spitshell
1064         chmod +x spitshell
1065         $eunicefix spitshell
1066         spitshell=`pwd`/spitshell
1067         cd UU
1068         echo "I presume that if # doesn't work, #! won't work either!"
1069         sharpbang=': use '
1070 fi
1071 rm -f try today
1072
1073 : figure out how to guarantee sh startup
1074 case "$startsh" in
1075 '') startsh=${sharpbang}${sh} ;;
1076 *)
1077 esac
1078 cat >try <<EOSS
1079 $startsh
1080 set abc
1081 test "$?abc" != 1
1082 EOSS
1083
1084 chmod +x try
1085 $eunicefix try
1086 if ./try; then
1087         : echo "Yup, it does."
1088 else
1089         echo "Hmm... '$startsh' does not guarantee sh startup..."
1090         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1091 fi
1092 rm -f try
1093
1094
1095 : Save command line options in file UU/cmdline.opt for later use in
1096 : generating config.sh.
1097 cat > cmdline.opt <<EOSH
1098 # Configure command line arguments.
1099 config_arg0='$0'
1100 config_args='$*'
1101 config_argc=$#
1102 EOSH
1103 argn=1
1104 for arg in "$@"; do
1105         cat >>cmdline.opt <<EOSH
1106 config_arg$argn='$arg'
1107 EOSH
1108         argn=`expr $argn + 1`
1109 done
1110
1111 : produce awk script to parse command line options
1112 cat >options.awk <<'EOF'
1113 BEGIN {
1114         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1115
1116         len = length(optstr);
1117         for (i = 1; i <= len; i++) {
1118                 c = substr(optstr, i, 1);
1119                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1120                 if (a == ":") {
1121                         arg[c] = 1;
1122                         i++;
1123                 }
1124                 opt[c] = 1;
1125         }
1126 }
1127 {
1128         expect = 0;
1129         str = $0;
1130         if (substr(str, 1, 1) != "-") {
1131                 printf("'%s'\n", str);
1132                 next;
1133         }
1134         len = length($0);
1135         for (i = 2; i <= len; i++) {
1136                 c = substr(str, i, 1);
1137                 if (!opt[c]) {
1138                         printf("-%s\n", substr(str, i));
1139                         next;
1140                 }
1141                 printf("-%s\n", c);
1142                 if (arg[c]) {
1143                         if (i < len)
1144                                 printf("'%s'\n", substr(str, i + 1));
1145                         else
1146                                 expect = 1;
1147                         next;
1148                 }
1149         }
1150 }
1151 END {
1152         if (expect)
1153                 print "?";
1154 }
1155 EOF
1156
1157 : process the command line options
1158 set X `for arg in "$@"; do echo "X$arg"; done |
1159         sed -e s/X// | awk -f options.awk`
1160 eval "set $*"
1161 shift
1162 rm -f options.awk
1163
1164 : set up default values
1165 fastread=''
1166 reuseval=false
1167 config_sh=''
1168 alldone=''
1169 error=''
1170 silent=''
1171 extractsh=''
1172 override=''
1173 knowitall=''
1174 rm -f optdef.sh posthint.sh
1175 cat >optdef.sh <<EOS
1176 $startsh
1177 EOS
1178
1179
1180 : option parsing
1181 while test $# -gt 0; do
1182         case "$1" in
1183         -d) shift; fastread=yes;;
1184         -e) shift; alldone=cont;;
1185         -f)
1186                 shift
1187                 cd ..
1188                 if test -r "$1"; then
1189                         config_sh="$1"
1190                 else
1191                         echo "$me: cannot read config file $1." >&2
1192                         error=true
1193                 fi
1194                 cd UU
1195                 shift;;
1196         -h) shift; error=true;;
1197         -r) shift; reuseval=true;;
1198         -s) shift; silent=true; realsilent=true;;
1199         -E) shift; alldone=exit;;
1200         -K) shift; knowitall=true;;
1201         -O) shift; override=true;;
1202         -S) shift; silent=true; extractsh=true;;
1203         -D)
1204                 shift
1205                 case "$1" in
1206                 *=)
1207                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1208                         echo "$me: ignoring -D $1" >&2
1209                         ;;
1210                 *=*) echo "$1" | \
1211                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1212                 *) echo "$1='define'" >> optdef.sh;;
1213                 esac
1214                 shift
1215                 ;;
1216         -U)
1217                 shift
1218                 case "$1" in
1219                 *=) echo "$1" >> optdef.sh;;
1220                 *=*)
1221                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1222                         echo "$me: ignoring -U $1" >&2
1223                         ;;
1224                 *) echo "$1='undef'" >> optdef.sh;;
1225                 esac
1226                 shift
1227                 ;;
1228         -A)
1229             shift
1230             xxx=''
1231             yyy="$1"
1232             zzz=''
1233             uuu=undef
1234             case "$yyy" in
1235             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1236                  case "$zzz" in
1237                  *:*) zzz='' ;;
1238                  *)   xxx=append
1239                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1240                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1241                  esac
1242                  ;;
1243             esac
1244             case "$xxx" in
1245             '')  case "$yyy" in
1246                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1247                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1248                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1249                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1250                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1251                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1252                  esac
1253                  ;;       
1254             esac
1255             case "$xxx" in
1256             append)
1257                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1258             clear)
1259                 echo "$yyy=''"                  >> posthint.sh ;;
1260             define)
1261                 case "$zzz" in
1262                 '') zzz=define ;;
1263                 esac
1264                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1265             eval)
1266                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1267             prepend)
1268                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1269             undef)
1270                 case "$zzz" in
1271                 '') zzz="$uuu" ;;
1272                 esac
1273                 echo "$yyy=$zzz"                >> posthint.sh ;;
1274             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1275             esac
1276             shift
1277             ;;
1278         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1279             exit 0;;
1280         --) break;;
1281         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1282         *) break;;
1283         esac
1284 done
1285
1286 case "$error" in
1287 true)
1288         cat >&2 <<EOM
1289 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1290                  [-U symbol] [-U symbol=] [-A command:symbol...]
1291   -d : use defaults for all answers.
1292   -e : go on without questioning past the production of config.sh.
1293   -f : specify an alternate default configuration file.
1294   -h : print this help message and exit (with an error status).
1295   -r : reuse C symbols value if possible (skips costly nm extraction).
1296   -s : silent mode, only echoes questions and essential information.
1297   -D : define symbol to have some value:
1298          -D symbol         symbol gets the value 'define'
1299          -D symbol=value   symbol gets the value 'value'
1300   -E : stop at the end of questions, after having produced config.sh.
1301   -K : do not use unless you know what you are doing.
1302   -O : let -D and -U override definitions from loaded configuration file.
1303   -S : perform variable substitutions on all .SH files (can mix with -f)
1304   -U : undefine symbol:
1305          -U symbol    symbol gets the value 'undef'
1306          -U symbol=   symbol gets completely empty
1307   -A : manipulate symbol after the platform specific hints have been applied:
1308          -A symbol=value                append " "value to symbol
1309          -A append:symbol=value         append value to symbol
1310          -A define:symbol=value         define symbol to have value
1311          -A clear:symbol                define symbol to be ''
1312          -A define:symbol               define symbol to be 'define'
1313          -A eval:symbol=value           define symbol to be eval of value
1314          -A prepend:symbol=value        prepend value to symbol
1315          -A undef:symbol                define symbol to be 'undef'
1316          -A undef:symbol=               define symbol to be ''
1317   -V : print version number and exit (with a zero status).
1318 EOM
1319         exit 1
1320         ;;
1321 esac
1322
1323 : Sanity checks
1324 case "$fastread$alldone" in
1325 yescont|yesexit) ;;
1326 *)
1327         if test ! -t 0; then
1328                 echo "Say 'sh Configure', not 'sh <Configure'"
1329                 exit 1
1330         fi
1331         ;;
1332 esac
1333
1334 exec 4>&1
1335 case "$silent" in
1336 true) exec 1>/dev/null;;
1337 esac
1338
1339 : run the defines and the undefines, if any, but leave the file out there...
1340 touch optdef.sh
1341 . ./optdef.sh
1342 : create the posthint manipulation script and leave the file out there...
1343 touch posthint.sh
1344
1345 : set package name
1346 package=perl5
1347 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1348 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1349 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1350 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1351 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1352 esac
1353
1354 : Some greps do not return status, grrr.
1355 echo "grimblepritz" >grimble
1356 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1357         contains=contains
1358 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1359         contains=grep
1360 else
1361         contains=contains
1362 fi
1363 rm -f grimble
1364 : the following should work in any shell
1365 case "$contains" in
1366 contains*)
1367         echo " "
1368         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1369         cat >contains <<'EOSS'
1370 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1371 EOSS
1372 chmod +x contains
1373 esac
1374
1375 : Find the path to the source tree
1376 case "$src" in
1377 '') case "$0" in
1378     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1379          case "$src" in
1380          /*)    ;;
1381          *)     src=`cd ../$src && pwd` ;;
1382          esac
1383          ;;
1384     *)   src='.';;
1385     esac;;
1386 esac
1387 case "$src" in
1388 '')     src=/
1389         rsrc=/
1390         ;;
1391 /*) rsrc="$src";;
1392 *) rsrc="../$src";;
1393 esac
1394 if test -f $rsrc/Configure && \
1395         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1396 then
1397    : found it, so we are ok.
1398 else
1399         rsrc=''
1400         for src in . .. ../.. ../../.. ../../../..; do
1401                 if test -f ../$src/Configure && \
1402                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1403                 then
1404                         rsrc=../$src
1405                         break
1406                 fi
1407         done
1408 fi
1409 case "$rsrc" in
1410 '')
1411         cat <<EOM >&4
1412
1413 Sorry, I can't seem to locate the source dir for $package.  Please start
1414 Configure with an explicit path -- i.e. /some/path/Configure.
1415
1416 EOM
1417         exit 1
1418         ;;
1419 ../.)   rsrc='..';;
1420 *)
1421         echo " "
1422         echo "Sources for $package found in \"$src\"." >&4
1423         ;;
1424 esac
1425
1426 : script used to extract .SH files with variable substitutions
1427 cat >extract <<'EOS'
1428 CONFIGDOTSH=true
1429 echo "Doing variable substitutions on .SH files..."
1430 if test -f $src/MANIFEST; then
1431         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1432 else
1433         echo "(Looking for .SH files under the source directory.)"
1434         set x `(cd $src; find . -name "*.SH" -print)`
1435 fi
1436 shift
1437 case $# in
1438 0) set x `(cd $src; echo *.SH)`; shift;;
1439 esac
1440 if test ! -f $src/$1; then
1441         shift
1442 fi
1443 mkdir_p='
1444 name=$1;
1445 create="";
1446 while test $name; do
1447         if test ! -d "$name"; then
1448                 create="$name $create";
1449                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1450                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1451         else
1452                 name="";
1453         fi;
1454 done;
1455 for file in $create; do
1456         mkdir $file;
1457 done
1458 '
1459 for file in $*; do
1460         case "$src" in
1461         ".")
1462                 case "$file" in
1463                 */*)
1464                         dir=`expr X$file : 'X\(.*\)/'`
1465                         file=`expr X$file : 'X.*/\(.*\)'`
1466                         (cd $dir && . ./$file)
1467                         ;;
1468                 *)
1469                         . ./$file
1470                         ;;
1471                 esac
1472                 ;;
1473         *)
1474                 case "$file" in
1475                 */*)
1476                         dir=`expr X$file : 'X\(.*\)/'`
1477                         file=`expr X$file : 'X.*/\(.*\)'`
1478                         (set x $dir; shift; eval $mkdir_p)
1479                         sh <$src/$dir/$file
1480                         ;;
1481                 *)
1482                         sh <$src/$file
1483                         ;;
1484                 esac
1485                 ;;
1486         esac
1487 done
1488 if test -f $src/config_h.SH; then
1489         if test ! -f config.h; then
1490         : oops, they left it out of MANIFEST, probably, so do it anyway.
1491         . $src/config_h.SH
1492         fi
1493 fi
1494 EOS
1495
1496 : extract files and exit if asked to do so
1497 case "$extractsh" in
1498 true)
1499         case "$realsilent" in
1500         true) ;;
1501         *) exec 1>&4;;
1502         esac
1503         case "$config_sh" in
1504         '') config_sh='config.sh';;
1505         esac
1506         echo " "
1507         echo "Fetching answers from $config_sh..."
1508         cd ..
1509         . $config_sh
1510         test "$override" && . ./optdef.sh
1511         echo " "
1512         . UU/extract
1513         rm -rf UU
1514         echo "Done."
1515         exit 0
1516         ;;
1517 esac
1518
1519 : Eunice requires " " instead of "", can you believe it
1520 echo " "
1521 : Here we go...
1522 echo "Beginning of configuration questions for $package."
1523
1524 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1525
1526 : first determine how to suppress newline on echo command
1527 echo " "
1528 echo "Checking echo to see how to suppress newlines..."
1529 (echo "hi there\c" ; echo " ") >.echotmp
1530 if $contains c .echotmp >/dev/null 2>&1 ; then
1531         echo "...using -n."
1532         n='-n'
1533         c=''
1534 else
1535         cat <<'EOM'
1536 ...using \c
1537 EOM
1538         n=''
1539         c='\c'
1540 fi
1541 echo $n "The star should be here-->$c"
1542 echo '*'
1543 rm -f .echotmp
1544
1545 : Now test for existence of everything in MANIFEST
1546 echo " "
1547 if test -f $rsrc/MANIFEST; then
1548         echo "First let's make sure your kit is complete.  Checking..." >&4
1549         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1550         rm -f missing
1551         tmppwd=`pwd`
1552         for filelist in x??; do
1553                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1554         done
1555         if test -s missing; then
1556                 cat missing >&4
1557                 cat >&4 <<'EOM'
1558
1559 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1560
1561 You have the option of continuing the configuration process, despite the
1562 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1563 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1564 and contact the author (perlbug@perl.com).
1565
1566 EOM
1567                 echo $n "Continue? [n] $c" >&4
1568                 read ans
1569                 case "$ans" in
1570                 y*)
1571                         echo "Continuing..." >&4
1572                         rm -f missing
1573                         ;;
1574                 *)
1575                         echo "ABORTING..." >&4
1576                         kill $$
1577                         ;;
1578                 esac
1579         else
1580                 echo "Looks good..."
1581         fi
1582 else
1583         echo "There is no MANIFEST file.  I hope your kit is complete !"
1584 fi
1585 rm -f missing x??
1586
1587 echo " "
1588 : Find the appropriate value for a newline for tr
1589 if test -n "$DJGPP"; then
1590        trnl='\012'
1591 fi
1592 if test X"$trnl" = X; then
1593         case "`echo foo|tr '\n' x 2>/dev/null`" in
1594         foox) trnl='\n' ;;
1595         esac
1596 fi
1597 if test X"$trnl" = X; then
1598         case "`echo foo|tr '\012' x 2>/dev/null`" in
1599         foox) trnl='\012' ;;
1600         esac
1601 fi
1602 if test X"$trnl" = X; then
1603         cat <<EOM >&2
1604
1605 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1606
1607 EOM
1608         exit 1
1609 fi
1610
1611 : compute the number of columns on the terminal for proper question formatting
1612 case "$COLUMNS" in
1613 '') COLUMNS='80';;
1614 esac
1615
1616 : set up the echo used in my read
1617 myecho="case \"\$xxxm\" in
1618 '') echo $n \"\$rp $c\" >&4;;
1619 *) case \"\$rp\" in
1620         '') echo $n \"[\$xxxm] $c\";;
1621         *)
1622                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1623                         echo \"\$rp\" >&4
1624                         echo $n \"[\$xxxm] $c\" >&4
1625                 else
1626                         echo $n \"\$rp [\$xxxm] $c\" >&4
1627                 fi
1628                 ;;
1629         esac;;
1630 esac"
1631
1632 : now set up to do reads with possible shell escape and default assignment
1633 cat <<EOSC >myread
1634 $startsh
1635 xxxm=\$dflt
1636 $myecho
1637 ans='!'
1638 case "\$fastread" in
1639 yes) case "\$dflt" in
1640         '') ;;
1641         *) ans='';
1642                 case "\$silent-\$rp" in
1643                 true-) ;;
1644                 *) echo " " >&4;;
1645                 esac;;
1646         esac;;
1647 *) case "\$silent" in
1648         true) case "\$rp" in
1649                 '') ans='';;
1650                 esac;;
1651         esac;;
1652 esac
1653 while expr "X\$ans" : "X!" >/dev/null; do
1654         read answ
1655         set x \$xxxm
1656         shift
1657         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1658         case  "\$answ" in
1659         "!")
1660                 sh 1>&4
1661                 echo " "
1662                 $myecho
1663                 ;;
1664         !*)
1665                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1666                 shift
1667                 sh 1>&4 -c "\$*"
1668                 echo " "
1669                 $myecho
1670                 ;;
1671         "\$ans")
1672                 case "\$ans" in
1673                 \\&*)
1674                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1675                         shift
1676                         case "\$1" in
1677                         -d)
1678                                 fastread=yes
1679                                 echo "(OK, I'll run with -d after this question.)" >&4
1680                                 ;;
1681                         -*)
1682                                 echo "*** Sorry, \$1 not supported yet." >&4
1683                                 ;;
1684                         esac
1685                         $myecho
1686                         ans=!
1687                         ;;
1688                 esac;;
1689         *)
1690                 case "\$aok" in
1691                 y)
1692                         echo "*** Substitution done -- please confirm."
1693                         xxxm="\$ans"
1694                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1695                         xxxm="\$ans"
1696                         ans=!
1697                         ;;
1698                 *)
1699                         echo "*** Error -- try again."
1700                         ans=!
1701                         ;;
1702                 esac
1703                 $myecho
1704                 ;;
1705         esac
1706         case "\$ans\$xxxm\$nostick" in
1707         '')
1708                 ans=!
1709                 $myecho
1710                 ;;
1711         esac
1712 done
1713 case "\$ans" in
1714 '') ans="\$xxxm";;
1715 esac
1716 EOSC
1717
1718 : create .config dir to save info across Configure sessions
1719 test -d ../.config || mkdir ../.config
1720 cat >../.config/README <<EOF
1721 This directory created by Configure to save information that should
1722 persist across sessions for $package.
1723
1724 You may safely delete it if you wish.
1725 EOF
1726
1727 : general instructions
1728 needman=true
1729 firsttime=true
1730 user=`(logname) 2>/dev/null`
1731 case "$user" in
1732 '') user=`whoami 2>&1`;;
1733 esac
1734 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1735         firsttime=false
1736         echo " "
1737         rp='Would you like to see the instructions?'
1738         dflt=n
1739         . ./myread
1740         case "$ans" in
1741         [yY]*) ;;
1742         *) needman=false;;
1743         esac
1744 fi
1745 if $needman; then
1746         cat <<EOH
1747
1748 This installation shell script will examine your system and ask you questions
1749 to determine how the perl5 package should be installed. If you get
1750 stuck on a question, you may use a ! shell escape to start a subshell or
1751 execute a command.  Many of the questions will have default answers in square
1752 brackets; typing carriage return will give you the default.
1753
1754 On some of the questions which ask for file or directory names you are allowed
1755 to use the ~name construct to specify the login directory belonging to "name",
1756 even if you don't have a shell which knows about that.  Questions where this is
1757 allowed will be marked "(~name ok)".
1758
1759 EOH
1760         rp=''
1761         dflt='Type carriage return to continue'
1762         . ./myread
1763         cat <<'EOH'
1764
1765 The prompter used in this script allows you to use shell variables and
1766 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1767 in the default answer, as if the default line was a set of arguments given to a
1768 script shell.  This means you may also use $* to repeat the whole default line,
1769 so you do not have to re-type everything to add something to the default.
1770
1771 Everytime there is a substitution, you will have to confirm.  If there is an
1772 error (e.g. an unmatched backtick), the default answer will remain unchanged
1773 and you will be prompted again.
1774
1775 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1776 the questions and use the computed defaults (or the previous answers if there
1777 was already a config.sh file). Type 'Configure -h' for a list of options.
1778 You may also start interactively and then answer '& -d' at any prompt to turn
1779 on the non-interactive behaviour for the remainder of the execution.
1780
1781 EOH
1782         . ./myread
1783         cat <<EOH
1784
1785 Much effort has been expended to ensure that this shell script will run on any
1786 Unix system.  If despite that it blows up on yours, your best bet is to edit
1787 Configure and run it again.  If you can't run Configure for some reason,
1788 you'll have to generate a config.sh file by hand.  Whatever problems you
1789 have, let me (perlbug@perl.com) know how I blew it.
1790
1791 This installation script affects things in two ways:
1792
1793 1) it may do direct variable substitutions on some of the files included
1794    in this kit.
1795 2) it builds a config.h file for inclusion in C programs.  You may edit
1796    any of these files as the need arises after running this script.
1797
1798 If you make a mistake on a question, there is no easy way to back up to it
1799 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1800 files.  Configure will offer to let you do this before it runs the SH files.
1801
1802 EOH
1803         dflt='Type carriage return to continue'
1804         . ./myread
1805         case "$firsttime" in
1806         true) echo $user >>../.config/instruct;;
1807         esac
1808 fi
1809
1810 : find out where common programs are
1811 echo " "
1812 echo "Locating common programs..." >&4
1813 cat <<EOSC >loc
1814 $startsh
1815 case \$# in
1816 0) exit 1;;
1817 esac
1818 thing=\$1
1819 shift
1820 dflt=\$1
1821 shift
1822 for dir in \$*; do
1823         case "\$thing" in
1824         .)
1825         if test -d \$dir/\$thing; then
1826                 echo \$dir
1827                 exit 0
1828         fi
1829         ;;
1830         *)
1831         for thisthing in \$dir/\$thing; do
1832                 : just loop through to pick last item
1833         done
1834         if test -f \$thisthing; then
1835                 echo \$thisthing
1836                 exit 0
1837         elif test -f \$dir/\$thing.exe; then
1838                 if test -n "$DJGPP"; then
1839                         echo \$dir/\$thing.exe
1840                 else
1841                         : on Eunice apparently
1842                         echo \$dir/\$thing
1843                 fi
1844                 exit 0
1845         fi
1846         ;;
1847         esac
1848 done
1849 echo \$dflt
1850 exit 1
1851 EOSC
1852 chmod +x loc
1853 $eunicefix loc
1854 loclist="
1855 awk
1856 cat
1857 comm
1858 cp
1859 echo
1860 expr
1861 grep
1862 ls
1863 make
1864 mkdir
1865 rm
1866 sed
1867 sort
1868 touch
1869 tr
1870 uniq
1871 "
1872 trylist="
1873 Mcc
1874 ar
1875 byacc
1876 cpp
1877 csh
1878 date
1879 egrep
1880 gzip
1881 less
1882 ln
1883 more
1884 nm
1885 nroff
1886 pg
1887 test
1888 uname
1889 zip
1890 "
1891 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1892 pth="$pth /lib /usr/lib"
1893 for file in $loclist; do
1894         eval xxx=\$$file
1895         case "$xxx" in
1896         /*|?:[\\/]*)
1897                 if test -f "$xxx"; then
1898                         : ok
1899                 else
1900                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1901                         xxx=`./loc $file $file $pth`
1902                 fi
1903                 ;;
1904         '') xxx=`./loc $file $file $pth`;;
1905         *) xxx=`./loc $xxx $xxx $pth`;;
1906         esac
1907         eval $file=$xxx
1908         eval _$file=$xxx
1909         case "$xxx" in
1910         /*)
1911                 echo $file is in $xxx.
1912                 ;;
1913         ?:[\\/]*)
1914                 echo $file is in $xxx.
1915                 ;;
1916         *)
1917                 echo "I don't know where '$file' is, and my life depends on it." >&4
1918                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1919                 exit 1
1920                 ;;
1921         esac
1922 done
1923 echo " "
1924 echo "Don't worry if any of the following aren't found..."
1925 say=offhand
1926 for file in $trylist; do
1927         eval xxx=\$$file
1928         case "$xxx" in
1929         /*|?:[\\/]*)
1930                 if test -f "$xxx"; then
1931                         : ok
1932                 else
1933                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1934                         xxx=`./loc $file $file $pth`
1935                 fi
1936                 ;;
1937         '') xxx=`./loc $file $file $pth`;;
1938         *) xxx=`./loc $xxx $xxx $pth`;;
1939         esac
1940         eval $file=$xxx
1941         eval _$file=$xxx
1942         case "$xxx" in
1943         /*)
1944                 echo $file is in $xxx.
1945                 ;;
1946         ?:[\\/]*)
1947                 echo $file is in $xxx.
1948                 ;;
1949         *)
1950                 echo "I don't see $file out there, $say."
1951                 say=either
1952                 ;;
1953         esac
1954 done
1955 case "$egrep" in
1956 egrep)
1957         echo "Substituting grep for egrep."
1958         egrep=$grep
1959         ;;
1960 esac
1961 case "$ln" in
1962 ln)
1963         echo "Substituting cp for ln."
1964         ln=$cp
1965         ;;
1966 esac
1967 case "$test" in
1968 test)
1969         echo "Hopefully test is built into your sh."
1970         ;;
1971 *)
1972         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1973                 echo "Using the test built into your sh."
1974                 test=test
1975                 _test=test
1976         fi
1977         ;;
1978 esac
1979 case "$echo" in
1980 echo)
1981         echo "Hopefully echo is built into your sh."
1982         ;;
1983 '') ;;
1984 *)
1985         echo " "
1986 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1987         $echo $n "hi there$c" >foo1
1988         echo $n "hi there$c" >foo2
1989         if cmp foo1 foo2 >/dev/null 2>&1; then
1990                 echo "They are compatible.  In fact, they may be identical."
1991         else
1992                 case "$n" in
1993                 '-n') n='' c='\c';;
1994                 *) n='-n' c='';;
1995                 esac
1996                 cat <<FOO
1997 They are not compatible!  You are probably running ksh on a non-USG system.
1998 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1999 have echo built in and we may have to run some Bourne shell scripts.  That
2000 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2001
2002 FOO
2003                 $echo $n "The star should be here-->$c"
2004                 $echo "*"
2005         fi
2006         $rm -f foo1 foo2
2007         ;;
2008 esac
2009
2010 : determine whether symbolic links are supported
2011 echo " "
2012 $touch blurfl
2013 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2014         echo "Symbolic links are supported." >&4
2015         lns="$ln -s"
2016 else
2017         echo "Symbolic links are NOT supported." >&4
2018         lns="$ln"
2019 fi
2020 $rm -f blurfl sym
2021
2022 : see whether [:lower:] and [:upper:] are supported character classes
2023 echo " "
2024 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2025 ABYZ)
2026         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2027         up='[:upper:]'
2028         low='[:lower:]'
2029         ;;
2030 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2031         # (0xc9 and 0xd1), therefore that is a nice testing point.
2032         if test "X$up" = X -o "X$low" = X; then
2033             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2034             ij) up='[A-Z]'
2035                 low='[a-z]'
2036                 ;;
2037             esac
2038         fi
2039         if test "X$up" = X -o "X$low" = X; then
2040             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2041             ij) up='A-Z'
2042                 low='a-z'
2043                 ;;
2044             esac
2045         fi
2046         if test "X$up" = X -o "X$low" = X; then
2047             case "`echo IJ | od -x 2>/dev/null`" in
2048             *C9D1*|*c9d1*)
2049                 echo "Hey, this might be EBCDIC." >&4
2050                 if test "X$up" = X -o "X$low" = X; then
2051                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2052                     ij) up='[A-IJ-RS-Z]'
2053                         low='[a-ij-rs-z]'
2054                         ;;
2055                     esac
2056                 fi
2057                 if test "X$up" = X -o "X$low" = X; then
2058                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2059                     ij) up='A-IJ-RS-Z'
2060                         low='a-ij-rs-z'
2061                         ;;
2062                     esac
2063                 fi
2064                 ;;
2065             esac
2066         fi
2067 esac
2068 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2069 ij)
2070     echo "Using $up and $low to convert case." >&4
2071     ;;
2072 *)
2073     echo "I don't know how to translate letters from upper to lower case." >&4
2074     echo "Your tr is not acting any way I know of." >&4
2075     exit 1
2076     ;;
2077 esac
2078 : set up the translation script tr, must be called with ./tr of course
2079 cat >tr <<EOSC
2080 $startsh
2081 case "\$1\$2" in
2082 '[A-Z][a-z]') exec $tr '$up' '$low';;
2083 '[a-z][A-Z]') exec $tr '$low' '$up';;
2084 esac
2085 exec $tr "\$@"
2086 EOSC
2087 chmod +x tr
2088 $eunicefix tr
2089
2090 : Try to determine whether config.sh was made on this system
2091 case "$config_sh" in
2092 '')
2093 myuname=`$uname -a 2>/dev/null`
2094 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2095 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2096 # because the A-Z/a-z are not consecutive.
2097 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2098         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2099 newmyuname="$myuname"
2100 dflt=n
2101 case "$knowitall" in
2102 '')
2103         if test -f ../config.sh; then
2104                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2105                         eval "`grep myuname= ../config.sh`"
2106                 fi
2107                 if test "X$myuname" = "X$newmyuname"; then
2108                         dflt=y
2109                 fi
2110         fi
2111         ;;
2112 *) dflt=y;;
2113 esac
2114
2115 : Get old answers from old config file if Configure was run on the
2116 : same system, otherwise use the hints.
2117 hint=default
2118 cd ..
2119 if test -f config.sh; then
2120         echo " "
2121         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2122         . UU/myread
2123         case "$ans" in
2124         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2125         *)  echo "Fetching default answers from your old config.sh file..." >&4
2126                 tmp_n="$n"
2127                 tmp_c="$c"
2128                 tmp_sh="$sh"
2129                 . ./config.sh
2130                 cp config.sh UU
2131                 n="$tmp_n"
2132                 c="$tmp_c"
2133                 : Older versions did not always set $sh.  Catch re-use of such
2134                 : an old config.sh.
2135                 case "$sh" in
2136                 '') sh="$tmp_sh" ;;
2137                 esac
2138                 hint=previous
2139                 ;;
2140         esac
2141 fi
2142 if test ! -f config.sh; then
2143         $cat <<EOM
2144
2145 First time through, eh?  I have some defaults handy for some systems
2146 that need some extra help getting the Configure answers right:
2147
2148 EOM
2149         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2150         dflt=''
2151         : Half the following guesses are probably wrong... If you have better
2152         : tests or hints, please send them to perlbug@perl.com
2153         : The metaconfig authors would also appreciate a copy...
2154         $test -f /irix && osname=irix
2155         $test -f /xenix && osname=sco_xenix
2156         $test -f /dynix && osname=dynix
2157         $test -f /dnix && osname=dnix
2158         $test -f /lynx.os && osname=lynxos
2159         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2160         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2161         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2162         $test -f /bin/mips && /bin/mips && osname=mips
2163         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2164                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2165         $test -d /usr/apollo/bin && osname=apollo
2166         $test -f /etc/saf/_sactab && osname=svr4
2167         $test -d /usr/include/minix && osname=minix
2168         if $test -d /MachTen -o -d /MachTen_Folder; then
2169                 osname=machten
2170                 if $test -x /sbin/version; then
2171                         osvers=`/sbin/version | $awk '{print $2}' |
2172                         $sed -e 's/[A-Za-z]$//'`
2173                 elif $test -x /usr/etc/version; then
2174                         osvers=`/usr/etc/version | $awk '{print $2}' |
2175                         $sed -e 's/[A-Za-z]$//'`
2176                 else
2177                         osvers="$2.$3"
2178                 fi
2179         fi
2180
2181         $test -f /sys/posix.dll &&
2182                 $test -f /usr/bin/what &&
2183                 set X `/usr/bin/what /sys/posix.dll` &&
2184                 $test "$3" = UWIN &&
2185                 osname=uwin &&
2186                 osvers="$5"
2187
2188         if $test -f $uname; then
2189                 set X $myuname
2190                 shift
2191
2192                 case "$5" in
2193                 fps*) osname=fps ;;
2194                 mips*)
2195                         case "$4" in
2196                         umips) osname=umips ;;
2197                         *) osname=mips ;;
2198                         esac;;
2199                 [23]100) osname=mips ;;
2200                 next*) osname=next ;;
2201                 i386*)
2202                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2203                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2204                                 osname='sco'
2205                                 osvers=$tmp
2206                         elif $test -f /etc/kconfig; then
2207                                 osname=isc
2208                                 if test "$lns" = "$ln -s"; then
2209                                         osvers=4
2210                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2211                                         osvers=3
2212                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2213                                         osvers=2
2214                                 fi
2215                         fi
2216                         tmp=''
2217                         ;;
2218                 pc*)
2219                         if test -n "$DJGPP"; then
2220                                 osname=dos
2221                                 osvers=djgpp
2222                         fi
2223                         ;;
2224                 esac
2225
2226                 case "$1" in
2227                 aix) osname=aix
2228                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2229                         case "$tmp" in
2230                         'not found') osvers="$4"."$3" ;;
2231                         '<3240'|'<>3240') osvers=3.2.0 ;;
2232                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2233                         '=3250'|'>3250') osvers=3.2.5 ;;
2234                         *) osvers=$tmp;;
2235                         esac
2236                         ;;
2237                 bsd386) osname=bsd386
2238                         osvers=`$uname -r`
2239                         ;;
2240                 cygwin*) osname=cygwin
2241                         osvers="$3"
2242                         ;;
2243                 *dc.osx) osname=dcosx
2244                         osvers="$3"
2245                         ;;
2246                 dnix) osname=dnix
2247                         osvers="$3"
2248                         ;;
2249                 domainos) osname=apollo
2250                         osvers="$3"
2251                         ;;
2252                 dgux) osname=dgux 
2253                         osvers="$3"
2254                         ;;
2255                 dynixptx*) osname=dynixptx
2256                         osvers=`echo "$4"|sed 's/^v//'`
2257                         ;;
2258                 freebsd) osname=freebsd 
2259                         osvers="$3" ;;
2260                 genix) osname=genix ;;
2261                 hp*) osname=hpux 
2262                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2263                         ;;
2264                 irix*) osname=irix
2265                         case "$3" in
2266                         4*) osvers=4 ;;
2267                         5*) osvers=5 ;;
2268                         *)      osvers="$3" ;;
2269                         esac
2270                         ;;
2271                 linux) osname=linux
2272                         case "$3" in
2273                         *)      osvers="$3" ;;
2274                         esac
2275                         ;;
2276                 MiNT) osname=mint
2277                         ;;
2278                 netbsd*) osname=netbsd
2279                         osvers="$3"
2280                         ;;
2281                 news-os) osvers="$3"
2282                         case "$3" in
2283                         4*) osname=newsos4 ;;
2284                         *) osname=newsos ;;
2285                         esac
2286                         ;;
2287                 next*) osname=next ;;
2288                 POSIX-BC | posix-bc ) osname=posix-bc
2289                         osvers="$3"
2290                         ;;
2291                 powerux | power_ux | powermax_os | powermaxos | \
2292                 powerunix | power_unix) osname=powerux
2293                         osvers="$3"
2294                         ;;
2295                 qnx) osname=qnx
2296                         osvers="$4"
2297                         ;;
2298                 solaris) osname=solaris
2299                         case "$3" in
2300                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2301                         *)      osvers="$3" ;;
2302                         esac
2303                         ;;
2304                 sunos) osname=sunos
2305                         case "$3" in
2306                         5*) osname=solaris
2307                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2308                         *)      osvers="$3" ;;
2309                         esac
2310                         ;;
2311                 titanos) osname=titanos
2312                         case "$3" in
2313                         1*) osvers=1 ;;
2314                         2*) osvers=2 ;;
2315                         3*) osvers=3 ;;
2316                         4*) osvers=4 ;;
2317                         *)      osvers="$3" ;;
2318                         esac
2319                         ;;
2320                 ultrix) osname=ultrix
2321                         osvers="$3"
2322                         ;;
2323                 osf1|mls+)      case "$5" in
2324                                 alpha)
2325                                         osname=dec_osf
2326                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2327                                         ;;
2328                         hp*)    osname=hp_osf1  ;;
2329                         mips)   osname=mips_osf1 ;;
2330                         esac
2331                         ;;
2332                 unixware) osname=svr5
2333                         osvers="$4"
2334                         ;;
2335                 uts) osname=uts
2336                         osvers="$3"
2337                         ;;
2338                 $2) case "$osname" in
2339                         *isc*) ;;
2340                         *freebsd*) ;;
2341                         svr*)
2342                                 : svr4.x or possibly later
2343                                 case "svr$3" in 
2344                                 ${osname}*)
2345                                         osname=svr$3
2346                                         osvers=$4
2347                                         ;;
2348                                 esac
2349                                 case "$osname" in
2350                                 svr4.0)
2351                                         : Check for ESIX
2352                                         if test -f /stand/boot ; then
2353                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2354                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2355                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2356                                                         if test -n "$isesix"; then
2357                                                                 osname=esix4
2358                                                         fi
2359                                                 fi
2360                                         fi
2361                                         ;;
2362                                 esac
2363                                 ;;
2364                         *)      if test -f /etc/systemid; then
2365                                         osname=sco
2366                                         set `echo $3 | $sed 's/\./ /g'` $4
2367                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2368                                                 osvers=$1.$2.$3
2369                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2370                                                 osvers=$1.$2
2371                                         elif $test -f $src/hints/sco_$1.sh; then
2372                                                 osvers=$1
2373                                         fi
2374                                 else
2375                                         case "$osname" in
2376                                         '') : Still unknown.  Probably a generic Sys V.
2377                                                 osname="sysv"
2378                                                 osvers="$3"
2379                                                 ;;
2380                                         esac
2381                                 fi
2382                                 ;;
2383                         esac
2384                         ;;
2385                 *)      case "$osname" in
2386                         '') : Still unknown.  Probably a generic BSD.
2387                                 osname="$1"
2388                                 osvers="$3"
2389                                 ;;
2390                         esac
2391                         ;;
2392                 esac
2393         else
2394                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2395                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2396                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2397                                 osname=news_os
2398                         fi
2399                         $rm -f UU/kernel.what
2400                 elif test -d c:/.; then
2401                         set X $myuname
2402                         osname=os2
2403                         osvers="$5"
2404                 fi
2405         fi
2406         
2407         : Now look for a hint file osname_osvers, unless one has been
2408         : specified already.
2409         case "$hintfile" in
2410         ''|' ')
2411                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2412                 : Also try without trailing minor version numbers.
2413                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2414                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2415                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2416                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2417                 case "$file" in
2418                 '') dflt=none ;;
2419                 *)  case "$osvers" in
2420                         '') dflt=$file
2421                                 ;;
2422                         *)  if $test -f $src/hints/$file.sh ; then
2423                                         dflt=$file
2424                                 elif $test -f $src/hints/$xfile.sh ; then
2425                                         dflt=$xfile
2426                                 elif $test -f $src/hints/$xxfile.sh ; then
2427                                         dflt=$xxfile
2428                                 elif $test -f $src/hints/$xxxfile.sh ; then
2429                                         dflt=$xxxfile
2430                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2431                                         dflt=$xxxxfile
2432                                 elif $test -f "$src/hints/${osname}.sh" ; then
2433                                         dflt="${osname}"
2434                                 else
2435                                         dflt=none
2436                                 fi
2437                                 ;;
2438                         esac
2439                         ;;
2440                 esac
2441                 if $test -f Policy.sh ; then
2442                         case "$dflt" in
2443                         *Policy*) ;;
2444                         none) dflt="Policy" ;;
2445                         *) dflt="Policy $dflt" ;;
2446                         esac
2447                 fi
2448                 ;;
2449         *)
2450                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2451                 ;;
2452         esac
2453
2454         if $test -f Policy.sh ; then
2455                 $cat <<EOM
2456
2457 There's also a Policy hint file available, which should make the
2458 site-specific (policy) questions easier to answer.
2459 EOM
2460
2461         fi
2462
2463         $cat <<EOM
2464
2465 You may give one or more space-separated answers, or "none" if appropriate.
2466 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2467 is a good thing.  DO NOT give a wrong version or a wrong OS.
2468
2469 EOM
2470
2471         rp="Which of these apply, if any?"
2472         . UU/myread
2473         tans=$ans
2474         for file in $tans; do
2475                 if $test X$file = XPolicy -a -f Policy.sh; then
2476                         . Policy.sh
2477                         $cat Policy.sh >> UU/config.sh
2478                 elif $test -f $src/hints/$file.sh; then
2479                         . $src/hints/$file.sh
2480                         $cat $src/hints/$file.sh >> UU/config.sh
2481                 elif $test X$tans = X -o X$tans = Xnone ; then
2482                         : nothing
2483                 else
2484                         : Give one chance to correct a possible typo.
2485                         echo "$file.sh does not exist"
2486                         dflt=$file
2487                         rp="hint to use instead?"
2488                         . UU/myread
2489                         for file in $ans; do
2490                                 if $test -f "$src/hints/$file.sh"; then
2491                                         . $src/hints/$file.sh
2492                                         $cat $src/hints/$file.sh >> UU/config.sh
2493                                 elif $test X$ans = X -o X$ans = Xnone ; then
2494                                         : nothing
2495                                 else
2496                                         echo "$file.sh does not exist -- ignored."
2497                                 fi
2498                         done
2499                 fi
2500         done
2501
2502         hint=recommended
2503         : Remember our hint file for later.
2504         if $test -f "$src/hints/$file.sh" ; then
2505                 hintfile="$file"
2506         else
2507                 hintfile=''
2508         fi
2509 fi
2510 cd UU
2511 ;;
2512 *)
2513         echo " "
2514         echo "Fetching default answers from $config_sh..." >&4
2515         tmp_n="$n"
2516         tmp_c="$c"
2517         cd ..
2518         cp $config_sh config.sh 2>/dev/null
2519         chmod +w config.sh
2520         . ./config.sh
2521         cd UU
2522         cp ../config.sh .
2523         n="$tmp_n"
2524         c="$tmp_c"
2525         hint=previous
2526         ;;
2527 esac
2528 test "$override" && . ./optdef.sh
2529 myuname="$newmyuname"
2530
2531 : Restore computed paths
2532 for file in $loclist $trylist; do
2533         eval $file="\$_$file"
2534 done
2535
2536 cat << EOM
2537
2538 Configure uses the operating system name and version to set some defaults.
2539 The default value is probably right if the name rings a bell. Otherwise,
2540 since spelling matters for me, either accept the default or answer "none"
2541 to leave it blank.
2542
2543 EOM
2544 case "$osname" in
2545         ''|' ')
2546                 case "$hintfile" in
2547                 ''|' '|none) dflt=none ;;
2548                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2549                 esac
2550                 ;;
2551         *) dflt="$osname" ;;
2552 esac
2553 rp="Operating system name?"
2554 . ./myread
2555 case "$ans" in
2556 none)  osname='' ;;
2557 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2558 esac
2559 echo " "
2560 case "$osvers" in
2561         ''|' ')
2562                 case "$hintfile" in
2563                 ''|' '|none) dflt=none ;;
2564                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2565                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2566                         case "$dflt" in
2567                         ''|' ') dflt=none ;;
2568                         esac
2569                         ;;
2570                 esac
2571                 ;;
2572         *) dflt="$osvers" ;;
2573 esac
2574 rp="Operating system version?"
2575 . ./myread
2576 case "$ans" in
2577 none)  osvers='' ;;
2578 *) osvers="$ans" ;;
2579 esac
2580
2581
2582 . ./posthint.sh
2583
2584 : who configured the system
2585 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2586 cf_by=`(logname) 2>/dev/null`
2587 case "$cf_by" in
2588 "")
2589         cf_by=`(whoami) 2>/dev/null`
2590         case "$cf_by" in
2591         "") cf_by=unknown ;;
2592         esac ;;
2593 esac
2594
2595 : set up the script used to warn in case of inconsistency
2596 cat <<EOS >whoa
2597 $startsh
2598 EOS
2599 cat <<'EOSC' >>whoa
2600 dflt=y
2601 echo " "
2602 echo "*** WHOA THERE!!! ***" >&4
2603 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2604 rp="    Keep the $hint value?"
2605 . ./myread
2606 case "$ans" in
2607 y) td=$was; tu=$was;;
2608 esac
2609 EOSC
2610
2611 : function used to set $1 to $val
2612 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2613 case "$val$was" in
2614 $define$undef) . ./whoa; eval "$var=\$td";;
2615 $undef$define) . ./whoa; eval "$var=\$tu";;
2616 *) eval "$var=$val";;
2617 esac'
2618
2619 case "$usethreads" in
2620 $define|true|[yY]*)     dflt='y';;
2621 *) dflt='n';;
2622 esac
2623 cat <<EOM
2624
2625 Perl can be built to take advantage of threads on some systems.
2626 To do so, Configure can be run with -Dusethreads.
2627
2628 Note that threading is a highly experimental feature, and
2629 some known race conditions still remain.  If you choose to try
2630 it, be very sure to not actually deploy it for production
2631 purposes.  README.threads has more details, and is required
2632 reading if you enable threads.
2633
2634 If this doesn't make any sense to you, just accept the default '$dflt'.
2635 EOM
2636 rp='Build a threading Perl?'
2637 . ./myread
2638 case "$ans" in
2639 y|Y)    val="$define" ;;
2640 *)      val="$undef" ;;
2641 esac
2642 set usethreads
2643 eval $setvar
2644
2645 case "$usethreads" in
2646 $define)
2647         $cat <<EOM
2648
2649 As of 5.5.640, Perl has two different internal threading implementations,
2650 the 5.005 version (5005threads) and an interpreter-based version
2651 (ithreads) that has one interpreter per thread.  Both are very 
2652 experimental.  This arrangement exists to help developers work out
2653 which one is better.
2654
2655 If you're a casual user, you probably don't want interpreter-threads
2656 at this time.  There doesn't yet exist a way to create threads from
2657 within Perl in this model, i.e., "use Thread;" will NOT work.
2658 EOM
2659         : Default to ithreads unless overridden on command line or with
2660         : old config.sh
2661         dflt='y'
2662         case "$use5005threads" in
2663                 $define|true|[yY]*) dflt='n';;
2664         esac
2665         case "$useithreads" in
2666                 $undef|false|[nN]*) dflt='n';;
2667         esac
2668         rp='Use interpreter-based ithreads?'
2669         . ./myread
2670         case "$ans" in
2671         y|Y)    val="$define" ;;
2672         *)      val="$undef" ;;
2673         esac
2674         set useithreads
2675         eval $setvar
2676         : Now set use5005threads to the opposite value.
2677         case "$useithreads" in
2678         $define) val="$undef" ;;
2679         *) val="$define" ;;
2680         esac
2681         set use5005threads
2682         eval $setvar
2683         ;;
2684 *)
2685         useithreads="$undef"
2686         use5005threads="$undef"
2687         ;;
2688 esac
2689
2690 case "$d_oldpthreads" in
2691 '')     : Configure tests would be welcome here.  For now, assume undef.
2692         val="$undef" ;;
2693 *)      val="$d_oldpthreads" ;;
2694 esac
2695 set d_oldpthreads
2696 eval $setvar
2697
2698
2699 case "$usethreads" in
2700 "$define"|true|[yY]*)
2701 : Look for a hint-file generated 'call-back-unit'.  If the
2702 : user has specified that a threading perl is to be built,
2703 : we may need to set or change some other defaults.
2704         if $test -f usethreads.cbu; then
2705                 echo "Your platform has some specific hints for threaded builds, using them..."
2706                 . ./usethreads.cbu
2707         else
2708                 $cat <<EOM
2709 (Your platform doesn't have any specific hints for threaded builds.
2710  Assuming POSIX threads, then.)
2711 EOM
2712         fi
2713         ;;
2714 esac
2715
2716 cat <<EOM
2717
2718 Perl can be built so that multiple Perl interpreters can coexist
2719 within the same Perl executable.
2720 EOM
2721
2722 case "$useithreads" in
2723 $define)
2724         cat <<EOM
2725 This multiple interpreter support is required for interpreter-based threads.
2726 EOM
2727         val="$define"
2728         ;;
2729 *)      case "$usemultiplicity" in
2730         $define|true|[yY]*)     dflt='y';;
2731         *) dflt='n';;
2732         esac
2733         echo " "
2734         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2735         rp='Build Perl for multiplicity?'
2736         . ./myread
2737         case "$ans" in
2738         y|Y)    val="$define" ;;
2739         *)      val="$undef" ;;
2740         esac
2741         ;;
2742 esac
2743 set usemultiplicity
2744 eval $setvar
2745
2746 : determine where manual pages are on this system
2747 echo " "
2748 case "$sysman" in
2749 '') 
2750         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2751         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2752         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2753         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2754         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2755         sysman=`./loc . /usr/man/man1 $syspath`
2756         ;;
2757 esac
2758 if $test -d "$sysman"; then
2759         echo "System manual is in $sysman." >&4
2760 else
2761         echo "Could not find manual pages in source form." >&4
2762 fi
2763
2764 : see what memory models we can support
2765 case "$models" in
2766 '')
2767         $cat >pdp11.c <<'EOP'
2768 int main() {
2769 #ifdef pdp11
2770         exit(0);
2771 #else
2772         exit(1);
2773 #endif
2774 }
2775 EOP
2776         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2777         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2778                 dflt='unsplit split'
2779         else
2780                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2781                 case "$tans" in
2782                 X) dflt='none';;
2783                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2784                                 dflt='small'
2785                         else
2786                                 dflt=''
2787                         fi
2788                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2789                                 dflt="$dflt medium"
2790                         fi
2791                         if $test -d /lib/large || $test -d /usr/lib/large; then
2792                                 dflt="$dflt large"
2793                         fi
2794                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2795                                 dflt="$dflt huge"
2796                         fi
2797                 esac
2798         fi;;
2799 *) dflt="$models";;
2800 esac
2801 $cat <<EOM
2802  
2803 Some systems have different model sizes.  On most systems they are called
2804 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2805 split.  If your system doesn't support different memory models, say "none".
2806 If you wish to force everything to one memory model, say "none" here and
2807 put the appropriate flags later when it asks you for other cc and ld flags.
2808 Venix systems may wish to put "none" and let the compiler figure things out.
2809 (In the following question multiple model names should be space separated.)
2810
2811 The default for most systems is "none".
2812
2813 EOM
2814 rp="Which memory models are supported?"
2815 . ./myread
2816 models="$ans"
2817
2818 case "$models" in
2819 none)
2820         small=''
2821         medium=''
2822         large=''
2823         huge=''
2824         unsplit=''
2825         split=''
2826         ;;
2827 *split)
2828         case "$split" in
2829         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2830                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2831                         dflt='-i'
2832                 else
2833                         dflt='none'
2834                 fi;;
2835         *) dflt="$split";;
2836         esac
2837         rp="What flag indicates separate I and D space?"
2838         . ./myread
2839         tans="$ans"
2840         case "$tans" in
2841         none) tans='';;
2842         esac
2843         split="$tans"
2844         unsplit='';;
2845 *large*|*small*|*medium*|*huge*)
2846         case "$models" in
2847         *large*)
2848                 case "$large" in
2849                 '') dflt='-Ml';;
2850                 *) dflt="$large";;
2851                 esac
2852         rp="What flag indicates large model?"
2853         . ./myread
2854         tans="$ans"
2855         case "$tans" in
2856         none) tans='';
2857         esac
2858         large="$tans";;
2859         *) large='';;
2860         esac
2861         case "$models" in
2862         *huge*) case "$huge" in
2863                 '') dflt='-Mh';;
2864                 *) dflt="$huge";;
2865                 esac
2866                 rp="What flag indicates huge model?"
2867                 . ./myread
2868                 tans="$ans"
2869                 case "$tans" in
2870                 none) tans='';
2871                 esac
2872                 huge="$tans";;
2873         *) huge="$large";;
2874         esac
2875         case "$models" in
2876         *medium*) case "$medium" in
2877                 '') dflt='-Mm';;
2878                 *) dflt="$medium";;
2879                 esac
2880                 rp="What flag indicates medium model?"
2881                 . ./myread
2882                 tans="$ans"
2883                 case "$tans" in
2884                 none) tans='';
2885                 esac
2886                 medium="$tans";;
2887         *) medium="$large";;
2888         esac
2889         case "$models" in
2890         *small*) case "$small" in
2891                 '') dflt='none';;
2892                 *) dflt="$small";;
2893                 esac
2894                 rp="What flag indicates small model?"
2895                 . ./myread
2896                 tans="$ans"
2897                 case "$tans" in
2898                 none) tans='';
2899                 esac
2900                 small="$tans";;
2901         *) small='';;
2902         esac
2903         ;;
2904 *)
2905         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2906         ;;
2907 esac
2908 $rm -f pdp11.* pdp11
2909
2910 : make some quick guesses about what we are up against
2911 echo " "
2912 $echo $n "Hmm...  $c"
2913 echo exit 1 >bsd
2914 echo exit 1 >usg
2915 echo exit 1 >v7
2916 echo exit 1 >osf1
2917 echo exit 1 >eunice
2918 echo exit 1 >xenix
2919 echo exit 1 >venix
2920 echo exit 1 >os2
2921 d_bsd="$undef"
2922 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2923 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2924 then
2925         echo "Looks kind of like an OSF/1 system, but we'll see..."
2926         echo exit 0 >osf1
2927 elif test `echo abc | tr a-z A-Z` = Abc ; then
2928         xxx=`./loc addbib blurfl $pth`
2929         if $test -f $xxx; then
2930         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2931                 echo exit 0 >bsd
2932                 echo exit 0 >usg
2933         else
2934                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2935                         echo "Looks kind of like an extended USG system, but we'll see..."
2936                 else
2937                         echo "Looks kind of like a USG system, but we'll see..."
2938                 fi
2939                 echo exit 0 >usg
2940         fi
2941 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2942         echo "Looks kind of like a BSD system, but we'll see..."
2943         d_bsd="$define"
2944         echo exit 0 >bsd
2945 else
2946         echo "Looks kind of like a Version 7 system, but we'll see..."
2947         echo exit 0 >v7
2948 fi
2949 case "$eunicefix" in
2950 *unixtovms*)
2951         $cat <<'EOI'
2952 There is, however, a strange, musty smell in the air that reminds me of
2953 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2954 EOI
2955         echo exit 0 >eunice
2956         d_eunice="$define"
2957 : it so happens the Eunice I know will not run shell scripts in Unix format
2958         ;;
2959 *)
2960         echo " "
2961         echo "Congratulations.  You aren't running Eunice."
2962         d_eunice="$undef"
2963         ;;
2964 esac
2965 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2966 case "$p_" in
2967 :) ;;
2968 *)
2969         $cat <<'EOI'
2970 I have the feeling something is not exactly right, however...don't tell me...
2971 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2972 EOI
2973         echo exit 0 >os2
2974         ;;
2975 esac
2976 if test -f /xenix; then
2977         echo "Actually, this looks more like a XENIX system..."
2978         echo exit 0 >xenix
2979         d_xenix="$define"
2980 else
2981         echo " "
2982         echo "It's not Xenix..."
2983         d_xenix="$undef"
2984 fi
2985 chmod +x xenix
2986 $eunicefix xenix
2987 if test -f /venix; then
2988         echo "Actually, this looks more like a VENIX system..."
2989         echo exit 0 >venix
2990 else
2991         echo " "
2992         if ./xenix; then
2993                 : null
2994         else
2995                 echo "Nor is it Venix..."
2996         fi
2997 fi
2998 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2999 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3000 $rm -f foo
3001
3002 : see if we need a special compiler
3003 echo " "
3004 if ./usg; then
3005         case "$cc" in
3006         '') case "$Mcc" in
3007                 /*) dflt='Mcc';;
3008                 *) case "$large" in
3009                         -M*) dflt='cc';;
3010                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3011                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3012                                                 dflt='cc'
3013                                         else
3014                                                 dflt='cc -M'
3015                                         fi
3016                                 else
3017                                         dflt='cc'
3018                                 fi;;
3019                         esac;;
3020                 esac;;
3021         *)  dflt="$cc";;
3022         esac
3023         case "$dflt" in
3024         *M*)    $cat <<'EOM'
3025 On some older systems the default C compiler will not resolve multiple global
3026 references that happen to have the same name.  On some such systems the "Mcc"
3027 command may be used to force these to be resolved.  On other systems a "cc -M"
3028 command is required.  (Note that the -M flag on other systems indicates a
3029 memory model to use!) If you have the Gnu C compiler, you might wish to use
3030 that instead.
3031
3032 EOM
3033         ;;
3034         esac
3035         rp="Use which C compiler?"
3036         . ./myread
3037         cc="$ans"
3038 else
3039         case "$cc" in
3040         '') dflt=cc;;
3041         *) dflt="$cc";;
3042         esac
3043         rp="Use which C compiler?"
3044         . ./myread
3045         cc="$ans"
3046 fi
3047 : Look for a hint-file generated 'call-back-unit'.  Now that the
3048 : user has specified the compiler, we may need to set or change some
3049 : other defaults.
3050 if $test -f cc.cbu; then
3051     . ./cc.cbu
3052 fi
3053 echo " "
3054 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3055 $cat >gccvers.c <<EOM
3056 #include <stdio.h>
3057 int main() {
3058 #ifdef __GNUC__
3059 #ifdef __VERSION__
3060         printf("%s\n", __VERSION__);
3061 #else
3062         printf("%s\n", "1");
3063 #endif
3064 #endif
3065         exit(0);
3066 }
3067 EOM
3068 if $cc $ldflags -o gccvers gccvers.c; then
3069         gccversion=`./gccvers`
3070         case "$gccversion" in
3071         '') echo "You are not using GNU cc." ;;
3072         *)  echo "You are using GNU cc $gccversion."
3073             ;;
3074         esac
3075 else
3076         echo " "
3077         echo "*** WHOA THERE!!! ***" >&4
3078         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3079         case "$knowitall" in
3080         '')
3081         echo "    You'd better start hunting for one and let me know about it." >&4
3082                 exit 1
3083                 ;;
3084         esac
3085 fi
3086 $rm -f gccvers*
3087 case "$gccversion" in
3088 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3089 esac
3090
3091 : decide how portable to be.  Allow command line overrides.
3092 case "$d_portable" in
3093 "$undef") ;;
3094 *)      d_portable="$define" ;;
3095 esac
3096
3097 : set up shell script to do ~ expansion
3098 cat >filexp <<EOSS
3099 $startsh
3100 : expand filename
3101 case "\$1" in
3102  ~/*|~)
3103         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3104         ;;
3105  ~*)
3106         if $test -f /bin/csh; then
3107                 /bin/csh -f -c "glob \$1"
3108                 failed=\$?
3109                 echo ""
3110                 exit \$failed
3111         else
3112                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3113                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3114                 if $test ! -d "\$dir"; then
3115                         me=\`basename \$0\`
3116                         echo "\$me: can't locate home directory for: \$name" >&2
3117                         exit 1
3118                 fi
3119                 case "\$1" in
3120                 */*)
3121                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3122                         ;;
3123                 *)
3124                         echo \$dir
3125                         ;;
3126                 esac
3127         fi
3128         ;;
3129 *)
3130         echo \$1
3131         ;;
3132 esac
3133 EOSS
3134 chmod +x filexp
3135 $eunicefix filexp
3136
3137 : now set up to get a file name
3138 cat <<EOS >getfile
3139 $startsh
3140 EOS
3141 cat <<'EOSC' >>getfile
3142 tilde=''
3143 fullpath=''
3144 already=''
3145 skip=''
3146 none_ok=''
3147 exp_file=''
3148 nopath_ok=''
3149 orig_rp="$rp"
3150 orig_dflt="$dflt"
3151 case "$gfpth" in
3152 '') gfpth='.' ;;
3153 esac
3154
3155 case "$fn" in
3156 *\(*)
3157         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3158         fn=`echo $fn | sed 's/(.*)//'`
3159         ;;
3160 esac
3161
3162 case "$fn" in
3163 *:*)
3164         loc_file=`expr $fn : '.*:\(.*\)'`
3165         fn=`expr $fn : '\(.*\):.*'`
3166         ;;
3167 esac
3168
3169 case "$fn" in
3170 *~*) tilde=true;;
3171 esac
3172 case "$fn" in
3173 */*) fullpath=true;;
3174 esac
3175 case "$fn" in
3176 *+*) skip=true;;
3177 esac
3178 case "$fn" in
3179 *n*) none_ok=true;;
3180 esac
3181 case "$fn" in
3182 *e*) exp_file=true;;
3183 esac
3184 case "$fn" in
3185 *p*) nopath_ok=true;;
3186 esac
3187
3188 case "$fn" in
3189 *f*) type='File';;
3190 *d*) type='Directory';;
3191 *l*) type='Locate';;
3192 esac
3193
3194 what="$type"
3195 case "$what" in
3196 Locate) what='File';;
3197 esac
3198
3199 case "$exp_file" in
3200 '')
3201         case "$d_portable" in
3202         "$define") ;;
3203         *) exp_file=true;;
3204         esac
3205         ;;
3206 esac
3207
3208 cd ..
3209 while test "$type"; do
3210         redo=''
3211         rp="$orig_rp"
3212         dflt="$orig_dflt"
3213         case "$tilde" in
3214         true) rp="$rp (~name ok)";;
3215         esac
3216         . UU/myread
3217         if test -f UU/getfile.ok && \
3218                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3219         then
3220                 value="$ans"
3221                 ansexp="$ans"
3222                 break
3223         fi
3224         case "$ans" in
3225         none)
3226                 value=''
3227                 ansexp=''
3228                 case "$none_ok" in
3229                 true) type='';;
3230                 esac
3231                 ;;
3232         *)
3233                 case "$tilde" in
3234                 '') value="$ans"
3235                         ansexp="$ans";;
3236                 *)
3237                         value=`UU/filexp $ans`
3238                         case $? in
3239                         0)
3240                                 if test "$ans" != "$value"; then
3241                                         echo "(That expands to $value on this system.)"
3242                                 fi
3243                                 ;;
3244                         *) value="$ans";;
3245                         esac
3246                         ansexp="$value"
3247                         case "$exp_file" in
3248                         '') value="$ans";;
3249                         esac
3250                         ;;
3251                 esac
3252                 case "$fullpath" in
3253                 true)
3254                         case "$ansexp" in
3255                         /*) value="$ansexp" ;;
3256                         *)
3257                                 redo=true
3258                                 case "$already" in
3259                                 true)
3260                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3261                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3262                                         ;;
3263                                 *)
3264                                 echo "Please give a full path name, starting with slash." >&4
3265                                         case "$tilde" in
3266                                         true)
3267                                 echo "Note that using ~name is ok provided it expands well." >&4
3268                                                 already=true
3269                                                 ;;
3270                                         esac
3271                                 esac
3272                                 ;;
3273                         esac
3274                         ;;
3275                 esac
3276                 case "$redo" in
3277                 '')
3278                         case "$type" in
3279                         File)
3280                                 for fp in $gfpth; do
3281                                         if test "X$fp" = X.; then
3282                                             pf="$ansexp"
3283                                         else    
3284                                             pf="$fp/$ansexp"
3285                                         fi
3286                                         if test -f "$pf"; then
3287                                                 type=''
3288                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3289                                         then
3290                                                 echo "($value is not a plain file, but that's ok.)"
3291                                                 type=''
3292                                         fi
3293                                         if test X"$type" = X; then
3294                                             value="$pf"
3295                                             break
3296                                         fi
3297                                 done
3298                                 ;;
3299                         Directory)
3300                                 for fp in $gfpth; do
3301                                         if test "X$fp" = X.; then
3302                                             pf="$ansexp"
3303                                         else    
3304                                             pf="$fp/$ansexp"
3305                                         fi
3306                                         if test -d "$pf"; then
3307                                                 type=''
3308                                                 value="$pf"
3309                                                 break
3310                                         fi
3311                                 done
3312                                 ;;
3313                         Locate)
3314                                 if test -d "$ansexp"; then
3315                                         echo "(Looking for $loc_file in directory $value.)"
3316                                         value="$value/$loc_file"
3317                                         ansexp="$ansexp/$loc_file"
3318                                 fi
3319                                 if test -f "$ansexp"; then
3320                                         type=''
3321                                 fi
3322                                 case "$nopath_ok" in
3323                                 true)   case "$value" in
3324                                         */*) ;;
3325                                         *)      echo "Assuming $value will be in people's path."
3326                                                 type=''
3327                                                 ;;
3328                                         esac
3329                                         ;;
3330                                 esac
3331                                 ;;
3332                         esac
3333
3334                         case "$skip" in
3335                         true) type='';
3336                         esac
3337
3338                         case "$type" in
3339                         '') ;;
3340                         *)
3341                                 if test "$fastread" = yes; then
3342                                         dflt=y
3343                                 else
3344                                         dflt=n
3345                                 fi
3346                                 rp="$what $value doesn't exist.  Use that name anyway?"
3347                                 . UU/myread
3348                                 dflt=''
3349                                 case "$ans" in
3350                                 y*) type='';;
3351                                 *) echo " ";;
3352                                 esac
3353                                 ;;
3354                         esac
3355                         ;;
3356                 esac
3357                 ;;
3358         esac
3359 done
3360 cd UU
3361 ans="$value"
3362 rp="$orig_rp"
3363 dflt="$orig_dflt"
3364 rm -f getfile.ok
3365 test "X$gfpthkeep" != Xy && gfpth=""
3366 EOSC
3367
3368 : What should the include directory be ?
3369 echo " "
3370 $echo $n "Hmm...  $c"
3371 dflt='/usr/include'
3372 incpath=''
3373 mips_type=''
3374 if $test -f /bin/mips && /bin/mips; then
3375         echo "Looks like a MIPS system..."
3376         $cat >usr.c <<'EOCP'
3377 #ifdef SYSTYPE_BSD43
3378 /bsd43
3379 #endif
3380 EOCP
3381         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3382                 dflt='/bsd43/usr/include'
3383                 incpath='/bsd43'
3384                 mips_type='BSD 4.3'
3385         else
3386                 mips_type='System V'
3387         fi
3388         $rm -f usr.c usr.out
3389         echo "and you're compiling with the $mips_type compiler and libraries."
3390         xxx_prompt=y
3391         echo "exit 0" >mips
3392 else
3393         echo "Doesn't look like a MIPS system."
3394         xxx_prompt=n
3395         echo "exit 1" >mips
3396 fi
3397 chmod +x mips
3398 $eunicefix mips
3399 case "$usrinc" in
3400 '') ;;
3401 *) dflt="$usrinc";;
3402 esac
3403 case "$xxx_prompt" in
3404 y)      fn=d/
3405         echo " "
3406         rp='Where are the include files you want to use?'
3407         . ./getfile
3408         usrinc="$ans"
3409         ;;
3410 *)      usrinc="$dflt"
3411         ;;
3412 esac
3413
3414 : see how we invoke the C preprocessor
3415 echo " "
3416 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3417 cat <<'EOT' >testcpp.c
3418 #define ABC abc
3419 #define XYZ xyz
3420 ABC.XYZ
3421 EOT
3422 cd ..
3423 if test ! -f cppstdin; then
3424         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3425                 # AIX cc -E doesn't show the absolute headerfile
3426                 # locations but we'll cheat by using the -M flag.
3427                 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
3428         else
3429                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3430         fi
3431 else
3432         echo "Keeping your $hint cppstdin wrapper."
3433 fi
3434 chmod 755 cppstdin
3435 wrapper=`pwd`/cppstdin
3436 ok='false'
3437 cd UU
3438
3439 if $test "X$cppstdin" != "X" && \
3440         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3441         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3442 then
3443         echo "You used to use $cppstdin $cppminus so we'll use that again."
3444         case "$cpprun" in
3445         '') echo "But let's see if we can live without a wrapper..." ;;
3446         *)
3447                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3448                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3449                 then
3450                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3451                         ok='true'
3452                 else
3453                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3454                 fi
3455                 ;;
3456         esac
3457 else
3458         case "$cppstdin" in
3459         '') ;;
3460         *)
3461                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3462                 ;;
3463         esac
3464 fi
3465
3466 if $ok; then
3467         : nothing
3468 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3469         $cc -E <testcpp.c >testcpp.out 2>&1; \
3470         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3471         echo "Yup, it does."
3472         x_cpp="$cc -E"
3473         x_minus='';
3474 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3475         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3476         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3477         echo "Yup, it does."
3478         x_cpp="$cc -E"
3479         x_minus='-';
3480 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3481         $cc -P <testcpp.c >testcpp.out 2>&1; \
3482         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3483         echo "Yipee, that works!"
3484         x_cpp="$cc -P"
3485         x_minus='';
3486 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3487         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3488         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3489         echo "At long last!"
3490         x_cpp="$cc -P"
3491         x_minus='-';
3492 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3493         $cpp <testcpp.c >testcpp.out 2>&1; \
3494         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3495         echo "It works!"
3496         x_cpp="$cpp"
3497         x_minus='';
3498 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3499         $cpp - <testcpp.c >testcpp.out 2>&1; \
3500         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3501         echo "Hooray, it works!  I was beginning to wonder."
3502         x_cpp="$cpp"
3503         x_minus='-';
3504 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3505         $wrapper <testcpp.c >testcpp.out 2>&1; \
3506         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3507         x_cpp="$wrapper"
3508         x_minus=''
3509         echo "Eureka!"
3510 else
3511         dflt=''
3512         rp="No dice.  I can't find a C preprocessor.  Name one:"
3513         . ./myread
3514         x_cpp="$ans"
3515         x_minus=''
3516         $x_cpp <testcpp.c >testcpp.out 2>&1
3517         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3518                 echo "OK, that will do." >&4
3519         else
3520 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3521                 exit 1
3522         fi
3523 fi
3524
3525 case "$ok" in
3526 false)
3527         cppstdin="$x_cpp"
3528         cppminus="$x_minus"
3529         cpprun="$x_cpp"
3530         cpplast="$x_minus"
3531         set X $x_cpp
3532         shift
3533         case "$1" in
3534         "$cpp")
3535                 echo "Perhaps can we force $cc -E using a wrapper..."
3536                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3537                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3538                 then
3539                         echo "Yup, we can."
3540                         cppstdin="$wrapper"
3541                         cppminus='';
3542                 else
3543                         echo "Nope, we'll have to live without it..."
3544                 fi
3545                 ;;
3546         esac
3547         case "$cpprun" in
3548         "$wrapper")
3549                 cpprun=''
3550                 cpplast=''
3551                 ;;
3552         esac
3553         ;;
3554 esac
3555
3556 case "$cppstdin" in
3557 "$wrapper"|'cppstdin') ;;
3558 *) $rm -f $wrapper;;
3559 esac
3560 $rm -f testcpp.c testcpp.out
3561
3562 : Set private lib path
3563 case "$plibpth" in
3564 '') if ./mips; then
3565                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3566         fi;;
3567 esac
3568 case "$libpth" in
3569 ' ') dlist='';;
3570 '') dlist="$loclibpth $plibpth $glibpth";;
3571 *) dlist="$libpth";;
3572 esac
3573
3574 : Now check and see which directories actually exist, avoiding duplicates
3575 libpth=''
3576 for xxx in $dlist
3577 do
3578     if $test -d $xxx; then
3579                 case " $libpth " in
3580                 *" $xxx "*) ;;
3581                 *) libpth="$libpth $xxx";;
3582                 esac
3583     fi
3584 done
3585 $cat <<'EOM'
3586
3587 Some systems have incompatible or broken versions of libraries.  Among
3588 the directories listed in the question below, please remove any you
3589 know not to be holding relevant libraries, and add any that are needed.
3590 Say "none" for none.
3591
3592 EOM
3593 case "$libpth" in
3594 '') dflt='none';;
3595 *)
3596         set X $libpth
3597         shift
3598         dflt=${1+"$@"}
3599         ;;
3600 esac
3601 rp="Directories to use for library searches?"
3602 . ./myread
3603 case "$ans" in
3604 none) libpth=' ';;
3605 *) libpth="$ans";;
3606 esac
3607
3608 : compute shared library extension
3609 case "$so" in
3610 '')
3611         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3612                 dflt='sl'
3613         else
3614                 dflt='so'
3615         fi
3616         ;;
3617 *) dflt="$so";;
3618 esac
3619 $cat <<EOM
3620
3621 On some systems, shared libraries may be available.  Answer 'none' if
3622 you want to suppress searching of shared libraries for the remainder
3623 of this configuration.
3624
3625 EOM
3626 rp='What is the file extension used for shared libraries?'
3627 . ./myread
3628 so="$ans"
3629
3630 : Define several unixisms.
3631 : Hints files or command line option can be used to override them.
3632 : The convoluted testing is in case hints files set either the old
3633 : or the new name.
3634 case "$_exe" in
3635 '')     case "$exe_ext" in
3636     '') ;;
3637         *)      _exe="$exe_ext" ;;
3638         esac
3639         ;;
3640 esac
3641 case "$_a" in
3642 '')     case "$lib_ext" in
3643     '') _a='.a';;
3644         *)      _a="$lib_ext" ;;
3645         esac
3646         ;;
3647 esac
3648 case "$_o" in
3649 '') case "$obj_ext" in
3650         '')     _o='.o';;
3651         *)      _o="$obj_ext";;
3652         esac
3653         ;;
3654 esac
3655 case "$p_" in
3656 '') case "$path_sep" in
3657         '')     p_=':';;
3658         *)      p_="$path_sep";;
3659         esac
3660         ;;
3661 esac
3662 exe_ext=$_exe
3663 lib_ext=$_a
3664 obj_ext=$_o
3665 path_sep=$p_
3666
3667 : Which makefile gets called first.  This is used by make depend.
3668 case "$firstmakefile" in
3669 '') firstmakefile='makefile';;
3670 esac
3671
3672 case "$usesocks" in
3673 $define|true|[yY]*)     dflt='y';;
3674 *) dflt='n';;
3675 esac
3676 cat <<EOM
3677
3678 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3679 Configure must be run with -Dusesocks.
3680
3681 If this doesn't make any sense to you, just accept the default '$dflt'.
3682 EOM
3683 rp='Build Perl for SOCKS?'
3684 . ./myread
3685 case "$ans" in
3686 y|Y)    val="$define" ;;     
3687 *)      val="$undef" ;;
3688 esac
3689 set usesocks
3690 eval $setvar
3691
3692 : Looking for optional libraries
3693 echo " "
3694 echo "Checking for optional libraries..." >&4
3695 case "$libs" in
3696 ' '|'') dflt='';;
3697 *) dflt="$libs";;
3698 esac
3699 case "$libswanted" in
3700 '') libswanted='c_s';;
3701 esac
3702 case "$usesocks" in
3703 $define)
3704         libswanted="$libswanted socks5 socks5_sh"
3705         ;;
3706 esac
3707 libsfound=''
3708 libsfiles=''
3709 libsdirs=''
3710 libspath=''
3711 for thisdir in $libpth $xlibpth; do
3712   test -d $thisdir && libspath="$libspath $thisdir"
3713 done
3714 for thislib in $libswanted; do
3715         for thisdir in $libspath; do
3716             xxx=''
3717             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3718                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3719                 $test -f "$xxx" && eval $libscheck
3720                 $test -f "$xxx" && libstyle=shared
3721             fi
3722             if test ! -f "$xxx"; then
3723                 xxx=$thisdir/lib$thislib.$so
3724                 $test -f "$xxx" && eval $libscheck
3725                 $test -f "$xxx" && libstyle=shared
3726             fi  
3727             if test ! -f "$xxx"; then
3728                 xxx=$thisdir/lib$thislib$_a
3729                 $test -f "$xxx" && eval $libscheck
3730                 $test -f "$xxx" && libstyle=static
3731             fi
3732             if test ! -f "$xxx"; then
3733                 xxx=$thisdir/$thislib$_a
3734                 $test -f "$xxx" && eval $libscheck
3735                 $test -f "$xxx" && libstyle=static
3736             fi
3737             if test ! -f "$xxx"; then
3738                 xxx=$thisdir/lib${thislib}_s$_a
3739                 $test -f "$xxx" && eval $libscheck
3740                 $test -f "$xxx" && libstyle=static
3741             fi
3742             if test ! -f "$xxx"; then
3743                 xxx=$thisdir/Slib$thislib$_a
3744                 $test -f "$xxx" && eval $libscheck
3745                 $test -f "$xxx" && libstyle=static
3746             fi
3747             if $test -f "$xxx"; then
3748                 case "$libstyle" in
3749                 shared) echo "Found -l$thislib (shared)." ;;
3750                 static) echo "Found -l$thislib." ;;
3751                 *)      echo "Found -l$thislib ($libstyle)." ;;
3752                 esac
3753                 case " $dflt " in
3754                 *"-l$thislib "*);;
3755                 *) dflt="$dflt -l$thislib"
3756                    libsfound="$libsfound $xxx"
3757                    yyy=`basename $xxx`
3758                    libsfiles="$libsfiles $yyy"
3759                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3760                    case " $libsdirs " in
3761                    *" $yyy "*) ;;
3762                    *) libsdirs="$libsdirs $yyy" ;;
3763                    esac
3764                    ;;
3765                 esac
3766                 break
3767             fi  
3768         done
3769         if $test ! -f "$xxx"; then
3770             echo "No -l$thislib."
3771         fi
3772 done
3773 set X $dflt
3774 shift
3775 dflt="$*"
3776 case "$libs" in
3777 '') dflt="$dflt";;
3778 *) dflt="$libs";;
3779 esac
3780 case "$dflt" in
3781 ' '|'') dflt='none';;
3782 esac
3783
3784 $cat <<EOM
3785
3786 In order to compile $package on your machine, a number of libraries
3787 are usually needed.  Include any other special libraries here as well.
3788 Say "none" for none.  The default list is almost always right.
3789 EOM
3790
3791 echo " "
3792 rp="What libraries to use?"
3793 . ./myread
3794 case "$ans" in
3795 none) libs=' ';;
3796 *) libs="$ans";;
3797 esac
3798
3799 : determine optimization, if desired, or use for debug flag also
3800 case "$optimize" in
3801 ' '|$undef) dflt='none';;
3802 '') dflt='-O';;
3803 *) dflt="$optimize";;
3804 esac
3805 $cat <<EOH
3806
3807 By default, $package compiles with the -O flag to use the optimizer.
3808 Alternately, you might want to use the symbolic debugger, which uses
3809 the -g flag (on traditional Unix systems).  Either flag can be
3810 specified here.  To use neither flag, specify the word "none".
3811
3812 EOH
3813 rp="What optimizer/debugger flag should be used?"
3814 . ./myread
3815 optimize="$ans"
3816 case "$optimize" in
3817 'none') optimize=" ";;
3818 esac
3819
3820 dflt=''
3821 : We will not override a previous value, but we might want to
3822 : augment a hint file
3823 case "$hint" in
3824 default|recommended)
3825         case "$gccversion" in
3826         1*) dflt='-fpcc-struct-return' ;;
3827         esac
3828         case "$optimize" in
3829         *-g*) dflt="$dflt -DDEBUGGING";;
3830         esac
3831         case "$gccversion" in
3832         2*) if test -d /etc/conf/kconfig.d &&
3833                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3834                 then
3835                         dflt="$dflt -posix"
3836                 fi
3837                 ;;
3838         esac
3839         case "$gccversion" in
3840         1*) ;;
3841         2.[0-8]*) ;;
3842         ?*)     echo " "
3843                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3844                 echo 'int main(void) { return 0; }' > gcctest.c
3845                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3846                         echo "Yes, it does." 2>&1
3847                         case "$ccflags" in
3848                         *strict-aliasing*) 
3849                                 echo "Leaving current flags $ccflags alone." 2>&1
3850                                 ;;
3851                         *) dflt="$dflt -fno-strict-aliasing" ;;
3852                         esac
3853                 else
3854                         echo "Nope, it doesn't, but that's ok." 2>&1
3855                 fi
3856                 ;;
3857         esac
3858         ;;
3859 esac
3860
3861 case "$mips_type" in
3862 *BSD*|'') inclwanted="$locincpth $usrinc";;
3863 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3864 esac
3865 for thisincl in $inclwanted; do
3866         if $test -d $thisincl; then
3867                 if $test x$thisincl != x$usrinc; then
3868                         case "$dflt" in
3869                         *$thisincl*);;
3870                         *) dflt="$dflt -I$thisincl";;
3871                         esac
3872                 fi
3873         fi
3874 done
3875
3876 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3877         xxx=true;
3878 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3879         xxx=true;
3880 else
3881         xxx=false;
3882 fi;
3883 if $xxx; then
3884         case "$dflt" in
3885         *$2*);;
3886         *) dflt="$dflt -D$2";;
3887         esac;
3888 fi'
3889
3890 set signal.h LANGUAGE_C; eval $inctest
3891
3892 case "$usesocks" in
3893 $define)
3894         ccflags="$ccflags -DSOCKS"
3895         ;;
3896 esac
3897
3898 case "$hint" in
3899 default|recommended) dflt="$ccflags $dflt" ;;
3900 *) dflt="$ccflags";;
3901 esac
3902
3903 case "$dflt" in
3904 ''|' ') dflt=none;;
3905 esac
3906 $cat <<EOH
3907
3908 Your C compiler may want other flags.  For this question you should include
3909 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3910 but you should NOT include libraries or ld flags like -lwhatever.  If you
3911 want $package to honor its debug switch, you should include -DDEBUGGING here.
3912 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3913
3914 To use no flags, specify the word "none".
3915
3916 EOH
3917 set X $dflt
3918 shift
3919 dflt=${1+"$@"}
3920 rp="Any additional cc flags?"
3921 . ./myread
3922 case "$ans" in
3923 none) ccflags='';;
3924 *) ccflags="$ans";;
3925 esac
3926
3927 : the following weeds options from ccflags that are of no interest to cpp
3928 cppflags="$ccflags"
3929 case "$gccversion" in
3930 1*) cppflags="$cppflags -D__GNUC__"
3931 esac
3932 case "$mips_type" in
3933 '');;
3934 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3935 esac
3936 case "$cppflags" in
3937 '');;
3938 *)
3939         echo " "
3940         echo "Let me guess what the preprocessor flags are..." >&4
3941         set X $cppflags
3942         shift
3943         cppflags=''
3944         $cat >cpp.c <<'EOM'
3945 #define BLURFL foo
3946
3947 BLURFL xx LFRULB
3948 EOM
3949         previous=''
3950         for flag in $*
3951         do
3952                 case "$flag" in
3953                 -*) ftry="$flag";;
3954                 *) ftry="$previous $flag";;
3955                 esac
3956                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3957                         >cpp1.out 2>/dev/null && \
3958                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3959                         >cpp2.out 2>/dev/null && \
3960                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3961                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3962                 then
3963                         cppflags="$cppflags $ftry"
3964                         previous=''
3965                 else
3966                         previous="$flag"
3967                 fi
3968         done
3969         set X $cppflags
3970         shift
3971         cppflags=${1+"$@"}
3972         case "$cppflags" in
3973         *-*)  echo "They appear to be: $cppflags";;
3974         esac
3975         $rm -f cpp.c cpp?.out
3976         ;;
3977 esac
3978
3979 : flags used in final linking phase
3980 case "$ldflags" in
3981 '') if ./venix; then
3982                 dflt='-i -z'
3983         else
3984                 dflt=''
3985         fi
3986         case "$ccflags" in
3987         *-posix*) dflt="$dflt -posix" ;;
3988         esac
3989         ;;
3990 *) dflt="$ldflags";;
3991 esac
3992
3993 : Try to guess additional flags to pick up local libraries.
3994 for thislibdir in $libpth; do
3995         case " $loclibpth " in
3996         *" $thislibdir "*)
3997                 case "$dflt " in 
3998                 *"-L$thislibdir "*) ;;
3999                 *)  dflt="$dflt -L$thislibdir" ;;
4000                 esac
4001                 ;;
4002         esac
4003 done
4004
4005 case "$dflt" in
4006 '') dflt='none' ;;
4007 esac
4008
4009 $cat <<EOH
4010
4011 Your C linker may need flags.  For this question you should
4012 include -L/whatever and any other flags used by the C linker, but you
4013 should NOT include libraries like -lwhatever.
4014
4015 Make sure you include the appropriate -L/path flags if your C linker
4016 does not normally search all of the directories you specified above,
4017 namely
4018         $libpth
4019 To use no flags, specify the word "none".
4020
4021 EOH
4022
4023 rp="Any additional ld flags (NOT including libraries)?"
4024 . ./myread
4025 case "$ans" in
4026 none) ldflags='';;
4027 *) ldflags="$ans";;
4028 esac
4029 rmlist="$rmlist pdp11"
4030
4031 : coherency check
4032 echo " "
4033 echo "Checking your choice of C compiler and flags for coherency..." >&4
4034 $cat > try.c <<'EOF'
4035 #include <stdio.h>
4036 int main() { printf("Ok\n"); exit(0); }
4037 EOF
4038 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4039 shift
4040 $cat >try.msg <<'EOM'
4041 I've tried to compile and run the following simple program:
4042
4043 EOM
4044 $cat try.c >> try.msg
4045
4046 $cat >> try.msg <<EOM
4047
4048 I used the command:
4049
4050         $*
4051         ./try
4052
4053 and I got the following output:
4054
4055 EOM
4056 dflt=y
4057 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4058         if sh -c './try' >>try.msg 2>&1; then
4059                 xxx=`./try`
4060                 case "$xxx" in
4061                 "Ok") dflt=n ;;
4062                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4063                         case " $libs " in
4064                         *" -lsfio "*)
4065                                 cat >> try.msg <<'EOQS'
4066 If $libs contains -lsfio, and sfio is mis-configured, then it
4067 sometimes (apparently) runs and exits with a 0 status, but with no
4068 output!  It may have to do with sfio's use of _exit vs. exit.
4069
4070 EOQS
4071                                 rp="You have a big problem.  Shall I abort Configure"
4072                                 dflt=y
4073                                 ;;
4074                         esac
4075                         ;;
4076                 esac
4077         else
4078                 echo "The program compiled OK, but exited with status $?." >>try.msg
4079                 rp="You have a problem.  Shall I abort Configure"
4080                 dflt=y
4081         fi
4082 else
4083         echo "I can't compile the test program." >>try.msg
4084         rp="You have a BIG problem.  Shall I abort Configure"
4085         dflt=y
4086 fi
4087 case "$dflt" in
4088 y)
4089         $cat try.msg >&4
4090         case "$knowitall" in
4091         '')
4092                 echo "(The supplied flags or libraries might be incorrect.)"
4093                 ;;
4094         *) dflt=n;;
4095         esac
4096         echo " "
4097         . ./myread
4098         case "$ans" in
4099         n*|N*) ;;
4100         *)      echo "Ok.  Stopping Configure." >&4
4101                 exit 1
4102                 ;;
4103         esac
4104         ;;
4105 n) echo "OK, that should do.";;
4106 esac
4107 $rm -f try try.* core
4108
4109 : define an is-a-typedef? function
4110 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4111 case "$inclist" in
4112 "") inclist="sys/types.h";;
4113 esac;
4114 eval "varval=\$$var";
4115 case "$varval" in
4116 "")
4117         $rm -f temp.c;
4118         for inc in $inclist; do
4119                 echo "#include <$inc>" >>temp.c;
4120         done;
4121         echo "#ifdef $type" >> temp.c;
4122         echo "printf(\"We have $type\");" >> temp.c;
4123         echo "#endif" >> temp.c;
4124         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4125         if $contains $type temp.E >/dev/null 2>&1; then
4126                 eval "$var=\$type";
4127         else
4128                 eval "$var=\$def";
4129         fi;
4130         $rm -f temp.?;;
4131 *) eval "$var=\$varval";;
4132 esac'
4133
4134 : define an is-a-typedef? function that prompts if the type is not available.
4135 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4136 case "$inclist" in
4137 "") inclist="sys/types.h";;
4138 esac;
4139 eval "varval=\$$var";
4140 case "$varval" in
4141 "")
4142         $rm -f temp.c;
4143         for inc in $inclist; do
4144                 echo "#include <$inc>" >>temp.c;
4145         done;
4146         echo "#ifdef $type" >> temp.c;
4147         echo "printf(\"We have $type\");" >> temp.c;
4148         echo "#endif" >> temp.c;
4149         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4150         echo " " ;
4151         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4152         if $contains $type temp.E >/dev/null 2>&1; then
4153                 echo "$type found." >&4;
4154                 eval "$var=\$type";
4155         else
4156                 echo "$type NOT found." >&4;
4157                 dflt="$def";
4158                 . ./myread ;
4159                 eval "$var=\$ans";
4160         fi;
4161         $rm -f temp.?;;
4162 *) eval "$var=\$varval";;
4163 esac'
4164
4165 : define a shorthand compile call
4166 compile='
4167 mc_file=$1;
4168 shift;
4169 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4170 : define a shorthand compile call for compilations that should be ok.
4171 compile_ok='
4172 mc_file=$1;
4173 shift;
4174 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4175
4176 : check for lengths of integral types
4177 echo " "
4178 case "$intsize" in
4179 '')
4180         echo "Checking to see how big your integers are..." >&4
4181         $cat >intsize.c <<'EOCP'
4182 #include <stdio.h>
4183 int main()
4184 {
4185         printf("intsize=%d;\n", (int)sizeof(int));
4186         printf("longsize=%d;\n", (int)sizeof(long));
4187         printf("shortsize=%d;\n", (int)sizeof(short));
4188         exit(0);
4189 }
4190 EOCP
4191         set intsize
4192         if eval $compile_ok && ./intsize > /dev/null; then
4193                 eval `./intsize`
4194                 echo "Your integers are $intsize bytes long."
4195                 echo "Your long integers are $longsize bytes long."
4196                 echo "Your short integers are $shortsize bytes long."
4197         else
4198                 $cat >&4 <<EOM
4199 !
4200 Help! I can't compile and run the intsize test program: please enlighten me!
4201 (This is probably a misconfiguration in your system or libraries, and
4202 you really ought to fix it.  Still, I'll try anyway.)
4203 !
4204 EOM
4205                 dflt=4
4206                 rp="What is the size of an integer (in bytes)?"
4207                 . ./myread
4208                 intsize="$ans"
4209                 dflt=$intsize
4210                 rp="What is the size of a long integer (in bytes)?"
4211                 . ./myread
4212                 longsize="$ans"
4213                 dflt=2
4214                 rp="What is the size of a short integer (in bytes)?"
4215                 . ./myread
4216                 shortsize="$ans"
4217         fi
4218         ;;
4219 esac
4220 $rm -f intsize intsize.*
4221
4222 : see what type lseek is declared as in the kernel
4223 rp="What is the type used for lseek's offset on this system?"
4224 set off_t lseektype long stdio.h sys/types.h
4225 eval $typedef_ask
4226
4227 echo " "
4228 echo "Checking to see how big your file offsets are..." >&4
4229 $cat >try.c <<EOCP
4230 #include <sys/types.h>
4231 #include <stdio.h>
4232 int main()
4233 {
4234     printf("%d\n", (int)sizeof($lseektype));
4235     return(0); 
4236 }
4237 EOCP
4238 set try
4239 if eval $compile_ok; then
4240         lseeksize=`./try`
4241         echo "Your file offsets are $lseeksize bytes long."
4242 else
4243         dflt=$longsize
4244         echo " "
4245         echo "(I can't seem to compile the test program.  Guessing...)"
4246         rp="What is the size of your file offsets (in bytes)?"
4247         . ./myread
4248         lseeksize="$ans"
4249 fi
4250 $rm -f try.c try
4251
4252 : see what type file positions are declared as in the library
4253 rp="What is the type for file position used by fsetpos()?"
4254 set fpos_t fpostype long stdio.h sys/types.h
4255 eval $typedef_ask
4256
4257 echo " "
4258 case "$fpostype" in
4259 *_t) zzz="$fpostype"    ;;
4260 *)   zzz="fpos_t"       ;;
4261 esac
4262 echo "Checking the size of $zzz..." >&4 
4263 cat > try.c <<EOCP
4264 #include <sys/types.h>
4265 #include <stdio.h>
4266 int main() {
4267     printf("%d\n", (int)sizeof($fpostype));
4268     exit(0);
4269 }
4270 EOCP
4271 set try
4272 if eval $compile_ok; then
4273         yyy=`./try`
4274         case "$yyy" in
4275         '')     fpossize=4
4276                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4277                 ;;
4278         *)      fpossize=$yyy
4279                 echo "Your $zzz is bytes long." >&4
4280                 ;;
4281         esac
4282 else
4283         dflt="$longsize"
4284         echo " " >&4
4285         echo "(I can't compile the test program.  Guessing...)" >&4
4286         rp="What is the size of your file positions (in bytes)?"
4287         . ./myread
4288         fpossize="$ans"
4289 fi
4290
4291
4292
4293 case "$lseeksize:$fpossize" in
4294 8:8) cat <<EOM
4295
4296 You can have files larger than 2 gigabytes.
4297 EOM
4298    val="$define" ;;
4299 *)    case "$uselargefiles" in
4300    "$undef"|false|[nN]*) dflt='n' ;;
4301    *)   dflt='y' ;;
4302    esac
4303    cat <<EOM
4304
4305 Perl can be built to understand large files (files larger than 2 gigabytes)
4306 on some systems.  To do so, Configure can be run with -Duselargefiles.
4307
4308 If this doesn't make any sense to you, just accept the default '$dflt'.
4309 EOM
4310    rp='Try to understand large files, if available?'
4311    . ./myread
4312    case "$ans" in
4313    y|Y)         val="$define" ;;
4314    *)           val="$undef"  ;;
4315    esac
4316    ;;
4317 esac
4318 set uselargefiles
4319 eval $setvar
4320 case "$uselargefiles" in
4321 "$define")
4322 : Look for a hint-file generated 'call-back-unit'.  If the
4323 : user has specified that a large files perl is to be built,
4324 : we may need to set or change some other defaults.
4325         if $test -f uselfs.cbu; then
4326                 echo "Your platform has some specific hints for large file builds, using them..."
4327                 . ./uselfs.cbu
4328                 echo " "
4329                 echo "Rechecking to see how big your file offsets are..." >&4
4330                 $cat >try.c <<EOCP
4331 #include <sys/types.h>
4332 #include <stdio.h>
4333 int main()
4334 {
4335     printf("%d\n", (int)sizeof($lseektype));
4336     return(0); 
4337 }
4338 EOCP
4339                 set try
4340                 if eval $compile_ok; then
4341                         lseeksize=`./try`
4342                         $echo "Your file offsets are now $lseeksize bytes long."
4343                 else
4344                         dflt="$lseeksize"
4345                         echo " "
4346                         echo "(I can't seem to compile the test program.  Guessing...)"
4347                         rp="What is the size of your file offsets (in bytes)?"
4348                         . ./myread
4349                         lseeksize="$ans"
4350                 fi
4351                 case "$fpostype" in
4352                 *_t) zzz="$fpostype"    ;;
4353                 *)   zzz="fpos_t"       ;;
4354                 esac
4355                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4356                 $cat > try.c <<EOCP
4357 #include <sys/types.h>
4358 #include <stdio.h>
4359 int main() {
4360     printf("%d\n", (int)sizeof($fpostype));
4361     exit(0);
4362 }
4363 EOCP
4364                 set try
4365                 if eval $compile_ok; then
4366                         yyy=`./try`
4367                         dflt="$lseeksize"
4368                         case "$yyy" in
4369                         '')     echo " "
4370                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4371                                 ;;
4372                         *)      fpossize=$yyy
4373                                 echo " $fpossize bytes." >&4
4374                                 ;;
4375                         esac
4376                 else
4377                         dflt="$fpossize"
4378                         echo " "
4379                         echo "(I can't compile the test program.  Guessing...)" >&4
4380                         rp="What is the size of your file positions (in bytes)?"
4381                         . ./myread
4382                         fpossize="$ans"
4383                 fi
4384                 $rm -f try.c try
4385         fi
4386         ;;
4387 esac
4388
4389
4390 case "$usemorebits" in
4391 "$define"|true|[yY]*)
4392         use64bits="$define"
4393         uselongdouble="$define"
4394         usemorebits="$define"
4395         ;;
4396 *)      usemorebits="$undef"
4397         ;;
4398 esac
4399
4400
4401 # Backward compatibility (uselonglong is deprecated).
4402 case "$uselonglong" in
4403 "$define"|true|[yY]*)
4404         cat <<EOM >&4
4405
4406 *** Configure -Duselonglong is deprecated, using the -Duse64bits instead.
4407
4408 EOM
4409         use64bits="$define"
4410         ;;
4411 esac                          
4412 case "$ccflags" in
4413 *-DUSE_LONG_LONG*|*-DUSE_64_BITS*|*-DUSE_FULL_64_BITS*) use64bits="$define";;
4414 esac
4415 case "$usefull64bits" in
4416 "$define"|true|[yY]*) use64bits="$define" ;;
4417 esac
4418
4419 case "$longsize" in
4420 8) cat <<EOM
4421
4422 You have natively 64-bit long integers.
4423 EOM
4424    val="$define"
4425    ;;
4426 *) case "$use64bits" in
4427    "$define"|true|[yY]*) dflt='y';;
4428    *) dflt='n';;
4429    esac
4430    cat <<EOM
4431
4432 Perl can be built to take advantage of 64-bit integer types
4433 on some systems.  To do so, Configure can be run with -Duse64bits.
4434 Choosing this option will most probably introduce binary incompatibilities.
4435
4436 If this doesn't make any sense to you, just accept the default '$dflt'.
4437 EOM
4438    rp='Try to use 64-bit integers, if available?'
4439    . ./myread
4440    case "$ans" in
4441    [yY]*) val="$define" ;;
4442    *)     val="$undef"  ;;
4443    esac
4444    ;;
4445 esac
4446 set use64bits
4447 eval $setvar
4448
4449 case "$usefull64bits" in
4450 "$define"|true|[yY]*) val="$define" ;;
4451 *)      case "$use64bits" in
4452         "$define")      case "$longsize" in
4453                         4)      dflt='n'
4454                                 cat <<EOM
4455
4456 Since you chose 64-bitness you may want to try maximal 64-bitness.
4457 What you have chosen is minimal 64-bitness which means just enough
4458 to get 64-bit integers.  The maximal means using as much 64-bitness
4459 as is possible on the platform.  This in turn means even more binary
4460 incompatibilities.  On the other hand, your platform may not have
4461 any more maximal 64-bitness than what you already have chosen.
4462
4463 If this doesn't make any sense to you, just accept the default '$dflt'.
4464 EOM
4465                                 rp='Try to use full 64-bit support, if available?'
4466                                 . ./myread
4467                                 case "$ans" in
4468                                 [yY]*) val="$define" ;;
4469                                 *)     val="$undef"  ;;
4470                                 esac
4471                                 ;;
4472                         8) val="$define" ;;
4473                         *) val="$undef" ;;
4474                         esac
4475                         ;;
4476         *)      val="$undef" ;;
4477         esac
4478         ;;
4479 esac 
4480 set usefull64bits
4481 eval $setvar
4482
4483 case "$use64bits" in
4484 "$define"|true|[yY]*)
4485 : Look for a hint-file generated 'call-back-unit'.  If the
4486 : user has specified that a 64-bit perl is to be built,
4487 : we may need to set or change some other defaults.
4488         if $test -f use64bits.cbu; then
4489                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4490                 . ./use64bits.cbu
4491         fi
4492         case "$longsize" in
4493         4) case "$ccflags" in
4494            *-DUSE_64_BITS*) ;;
4495            *) ccflags="$ccflags -DUSE_64_BITS";;
4496            esac
4497            case "$archname64" in
4498            '') archname64=64 ;;
4499            esac
4500            ;;
4501         esac
4502         ;;
4503 esac
4504
4505 case "$usefull64bits" in
4506 "$define"|true|[yY]*)
4507 : Look for a hint-file generated 'call-back-unit'.  If the
4508 : user has specified that a full 64-bit perl is to be built,
4509 : we may need to set or change some other defaults.
4510         if $test -f usefull64bits.cbu; then
4511                 echo "Your platform has some specific hints for full 64-bit builds, using them..."
4512                 . ./usefull64bits.cbu
4513         fi
4514         case "$longsize" in
4515         4) case "$ccflags" in
4516            *-DUSE_FULL_64_BITS*) ;;
4517            *) ccflags="$ccflags -DUSE_FULL_64_BITS";;
4518            esac
4519            case "$archname64" in
4520            ''|64) archname64=full64 ;;
4521            esac
4522            ;;
4523         esac
4524         ;;
4525 esac
4526
4527 : determine the architecture name
4528 echo " "
4529 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4530         tarch=`arch`"-$osname"
4531 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4532         if uname -m > tmparch 2>&1 ; then
4533                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4534                         -e 's/$/'"-$osname/" tmparch`
4535         else
4536                 tarch="$osname"
4537         fi
4538         $rm -f tmparch
4539 else
4540         tarch="$osname"
4541 fi
4542 case "$myarchname" in
4543 ''|"$tarch") ;;
4544 *)
4545         echo "(Your architecture name used to be $myarchname.)"
4546         archname=''
4547         ;;
4548 esac
4549 myarchname="$tarch"
4550 case "$archname" in
4551 '') dflt="$tarch";;
4552 *) dflt="$archname";;
4553 esac
4554 rp='What is your architecture name'
4555 . ./myread
4556 archname="$ans"
4557 case "$usethreads" in
4558 $define)
4559         echo "Threads selected." >&4
4560         case "$archname" in
4561         *-thread*) echo "...and architecture name already has -thread." >&4
4562                 ;;
4563         *)      archname="$archname-thread"
4564                 echo "...setting architecture name to $archname." >&4
4565                 ;;
4566         esac
4567         ;;
4568 esac
4569 case "$usemultiplicity" in
4570 $define)
4571         echo "Multiplicity selected." >&4
4572         case "$archname" in
4573         *-multi*) echo "...and architecture name already has -multi." >&4
4574                 ;;
4575         *)      archname="$archname-multi"
4576                 echo "...setting architecture name to $archname." >&4
4577                 ;;
4578         esac
4579         ;;
4580 esac
4581 case "$use64bits" in
4582 $define)
4583         case "$archname64" in
4584         '')
4585                 ;;
4586         *)
4587                 case "$archname" in
4588                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4589                         ;;
4590                 *)      archname="$archname-$archname64"
4591                         echo "...setting architecture name to $archname." >&4
4592                         ;;
4593                 esac
4594                 ;;
4595         esac
4596 esac
4597
4598 : determine root of directory hierarchy where package will be installed.
4599 case "$prefix" in
4600 '')
4601         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4602         ;;
4603 *)
4604         dflt="$prefix"
4605         ;;
4606 esac
4607 $cat <<EOM
4608
4609 By default, $package will be installed in $dflt/bin, manual pages
4610 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4611 installation directories. Typically this is something like /usr/local.
4612 If you wish to have binaries under /usr/bin but other parts of the
4613 installation under /usr/local, that's ok: you will be prompted
4614 separately for each of the installation directories, the prefix being
4615 only used to set the defaults.
4616
4617 EOM
4618 fn=d~
4619 rp='Installation prefix to use?'
4620 . ./getfile
4621 oldprefix=''
4622 case "$prefix" in
4623 '') ;;
4624 *)
4625         case "$ans" in
4626         "$prefix") ;;
4627         *) oldprefix="$prefix";;
4628         esac
4629         ;;
4630 esac
4631 prefix="$ans"
4632 prefixexp="$ansexp"
4633
4634 : is AFS running?
4635 echo " "
4636 case "$afs" in
4637 $define|true)   afs=true ;;
4638 $undef|false)   afs=false ;;
4639 *)      if test -d /afs; then
4640                 afs=true
4641         else
4642                 afs=false
4643         fi
4644         ;;
4645 esac
4646 if $afs; then
4647         echo "AFS may be running... I'll be extra cautious then..." >&4
4648 else
4649         echo "AFS does not seem to be running..." >&4
4650 fi
4651
4652 : determine installation prefix for where package is to be installed.
4653 if $afs; then 
4654 $cat <<EOM
4655
4656 Since you are running AFS, I need to distinguish the directory in which
4657 files will reside from the directory in which they are installed (and from
4658 which they are presumably copied to the former directory by occult means).
4659
4660 EOM
4661         case "$installprefix" in
4662         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4663         *) dflt="$installprefix";;
4664         esac
4665 else
4666 $cat <<EOM
4667
4668 In some special cases, particularly when building $package for distribution,
4669 it is convenient to distinguish between the directory in which files should 
4670 be installed from the directory ($prefix) in which they 
4671 will eventually reside.  For most users, these two directories are the same.
4672
4673 EOM
4674         case "$installprefix" in
4675         '') dflt=$prefix ;;
4676         *) dflt=$installprefix;;
4677         esac
4678 fi
4679 fn=d~
4680 rp='What installation prefix should I use for installing files?'
4681 . ./getfile
4682 installprefix="$ans"
4683 installprefixexp="$ansexp"
4684
4685 : set the prefixit variable, to compute a suitable default value
4686 prefixit='case "$3" in
4687 ""|none)
4688         case "$oldprefix" in
4689         "") eval "$1=\"\$$2\"";;
4690         *)
4691                 case "$3" in
4692                 "") eval "$1=";;
4693                 none)
4694                         eval "tp=\"\$$2\"";
4695                         case "$tp" in
4696                         ""|" ") eval "$1=\"\$$2\"";;
4697                         *) eval "$1=";;
4698                         esac;;
4699                 esac;;
4700         esac;;
4701 *)
4702         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4703         case "$tp" in
4704         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4705         /*-$oldprefix/*|\~*-$oldprefix/*)
4706                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4707         *) eval "$1=\"\$$2\"";;
4708         esac;;
4709 esac'
4710
4711
4712 : get the patchlevel
4713 echo " "
4714 echo "Getting the current patchlevel..." >&4
4715 if $test -r $rsrc/patchlevel.h;then
4716         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4717         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4718         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4719         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4720         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4721         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4722 else
4723         revision=0
4724         patchlevel=0
4725         subversion=0
4726         api_revision=0
4727         api_version=0
4728         api_subversion=0
4729 fi
4730 $echo $n "(You have $package revision $revision" $c
4731 $echo $n " patchlevel $patchlevel" $c
4732 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4733 echo ".)"
4734 case "$osname" in
4735 dos|vms)
4736         : XXX Should be a Configure test for double-dots in filenames.
4737         version=`echo $revision $patchlevel $subversion | \
4738                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4739         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4740                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4741         ;;
4742 *)
4743         version=`echo $revision $patchlevel $subversion | \
4744                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4745         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4746                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4747         ;;
4748 esac
4749 : Special case the 5.005_xx maintenance series, which used 5.005
4750 : without any subversion label as a subdirectory in $sitelib
4751 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4752         api_versionstring='5.005'
4753 fi
4754
4755 : determine installation style
4756 : For now, try to deduce it from prefix unless it is already set.
4757 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4758 case "$installstyle" in
4759 '')     case "$prefix" in
4760                 *perl*) dflt='lib';;
4761                 *) dflt='lib/perl5' ;;
4762         esac
4763         ;;
4764 *)      dflt='lib/perl5' ;;
4765 esac
4766 : Probably not worth prompting for this since we prompt for all
4767 : the directories individually, and the prompt would be too long and
4768 : confusing anyway.
4769 installstyle=$dflt
4770
4771 : determine where private library files go
4772 : Usual default is /usr/local/lib/perl5/$version.
4773 : Also allow things like /opt/perl/lib/$version, since 
4774 : /opt/perl/lib/perl5... would be redundant.
4775 : The default "style" setting is made in installstyle.U
4776 case "$installstyle" in
4777 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4778 *)       set dflt privlib lib/$version ;;
4779 esac
4780 eval $prefixit
4781 $cat <<EOM
4782
4783 There are some auxiliary files for $package that need to be put into a
4784 private library directory that is accessible by everyone.
4785
4786 EOM
4787 fn=d~+
4788 rp='Pathname where the private library files will reside?'
4789 . ./getfile
4790 privlib="$ans"
4791 privlibexp="$ansexp"
4792 : Change installation prefix, if necessary.
4793 if $test X"$prefix" != X"$installprefix"; then
4794         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4795 else
4796         installprivlib="$privlibexp"
4797 fi
4798
4799 : set the prefixup variable, to restore leading tilda escape
4800 prefixup='case "$prefixexp" in
4801 "$prefix") ;;
4802 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4803 esac'
4804
4805 : determine where public architecture dependent libraries go
4806 set archlib archlib
4807 eval $prefixit
4808 : privlib default is /usr/local/lib/$package/$version
4809 : archlib default is /usr/local/lib/$package/$version/$archname
4810 : privlib may have an optional trailing /share.
4811 tdflt=`echo $privlib | $sed 's,/share$,,'`
4812 tdflt=$tdflt/$archname
4813 case "$archlib" in
4814 '')     dflt=$tdflt
4815         ;;
4816 *)      dflt="$archlib"
4817     ;;
4818 esac
4819 $cat <<EOM
4820
4821 $spackage contains architecture-dependent library files.  If you are
4822 sharing libraries in a heterogeneous environment, you might store
4823 these files in a separate location.  Otherwise, you can just include
4824 them with the rest of the public library files.
4825
4826 EOM
4827 fn=d+~
4828 rp='Where do you want to put the public architecture-dependent libraries?'
4829 . ./getfile
4830 archlib="$ans"
4831 archlibexp="$ansexp"
4832 if $test X"$archlib" = X"$privlib"; then
4833         d_archlib="$undef"
4834 else
4835         d_archlib="$define"
4836 fi
4837 : Change installation prefix, if necessary.
4838 if $test X"$prefix" != X"$installprefix"; then
4839         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4840 else
4841         installarchlib="$archlibexp"
4842 fi
4843
4844
4845 : Binary compatibility with 5.005 is not possible for builds
4846 : with advanced features
4847 case "$usethreads$usemultiplicity" in
4848 *define*)
4849         bincompat5005="$undef"
4850         d_bincompat5005="$undef"
4851         ;;
4852 *)      $cat <<EOM
4853
4854 Perl 5.006 can be compiled for binary compatibility with 5.005.
4855 If you decide to do so, you will be able to continue using most
4856 of the extensions that were compiled for Perl 5.005.
4857
4858 EOM
4859         case "$bincompat5005$d_bincompat5005" in
4860         *"$undef"*) dflt=n ;;
4861         *) dflt=y ;;
4862         esac
4863         rp='Binary compatibility with Perl 5.005?'
4864         . ./myread
4865         case "$ans" in
4866         y*) val="$define" ;;
4867         *)  val="$undef" ;;
4868         esac
4869         set d_bincompat5005
4870         eval $setvar
4871         case "$d_bincompat5005" in
4872         "$define")
4873                 bincompat5005="$define"
4874                 ;;
4875         *)      bincompat5005="$undef"
4876                 d_bincompat5005="$undef"
4877                 ;;
4878         esac
4879         ;;
4880 esac
4881
4882
4883 : see if setuid scripts can be secure
4884 $cat <<EOM
4885
4886 Some kernels have a bug that prevents setuid #! scripts from being
4887 secure.  Some sites have disabled setuid #! scripts because of this.
4888
4889 First let's decide if your kernel supports secure setuid #! scripts.
4890 (If setuid #! scripts would be secure but have been disabled anyway,
4891 don't say that they are secure if asked.)
4892
4893 EOM
4894
4895 val="$undef"
4896 if $test -d /dev/fd; then
4897         echo "#!$ls" >reflect
4898         chmod +x,u+s reflect
4899         ./reflect >flect 2>&1
4900         if $contains "/dev/fd" flect >/dev/null; then
4901                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4902                 val="$define"
4903         else
4904                 $cat <<EOM
4905 If you are not sure if they are secure, I can check but I'll need a
4906 username and password different from the one you are using right now.
4907 If you don't have such a username or don't want me to test, simply
4908 enter 'none'.
4909
4910 EOM
4911                 rp='Other username to test security of setuid scripts with?'
4912                 dflt='none'
4913                 . ./myread
4914                 case "$ans" in
4915                 n|none)
4916                         case "$d_suidsafe" in
4917                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4918                                 dflt=n;;
4919                         "$undef")
4920                                 echo "Well, the $hint value is *not* secure." >&4
4921                                 dflt=n;;
4922                         *)      echo "Well, the $hint value *is* secure." >&4
4923                                 dflt=y;;
4924                         esac
4925                         ;;
4926                 *)
4927                         $rm -f reflect flect
4928                         echo "#!$ls" >reflect
4929                         chmod +x,u+s reflect
4930                         echo >flect
4931                         chmod a+w flect
4932                         echo '"su" will (probably) prompt you for '"$ans's password."
4933                         su $ans -c './reflect >flect'
4934                         if $contains "/dev/fd" flect >/dev/null; then
4935                                 echo "Okay, it looks like setuid scripts are secure." >&4
4936                                 dflt=y
4937                         else
4938                                 echo "I don't think setuid scripts are secure." >&4
4939                                 dflt=n
4940                         fi
4941                         ;;
4942                 esac
4943                 rp='Does your kernel have *secure* setuid scripts?'
4944                 . ./myread
4945                 case "$ans" in
4946                 [yY]*)  val="$define";;
4947                 *)      val="$undef";;
4948                 esac
4949         fi
4950 else
4951         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4952         echo "(That's for file descriptors, not floppy disks.)"
4953         val="$undef"
4954 fi
4955 set d_suidsafe
4956 eval $setvar
4957
4958 $rm -f reflect flect
4959
4960 : now see if they want to do setuid emulation
4961 echo " "
4962 val="$undef"
4963 case "$d_suidsafe" in
4964 "$define")
4965         val="$undef"
4966         echo "No need to emulate SUID scripts since they are secure here." >& 4
4967         ;;
4968 *)
4969         $cat <<EOM
4970 Some systems have disabled setuid scripts, especially systems where
4971 setuid scripts cannot be secure.  On systems where setuid scripts have
4972 been disabled, the setuid/setgid bits on scripts are currently
4973 useless.  It is possible for $package to detect those bits and emulate
4974 setuid/setgid in a secure fashion.  This emulation will only work if
4975 setuid scripts have been disabled in your kernel.
4976
4977 EOM
4978         case "$d_dosuid" in
4979         "$define") dflt=y ;;
4980         *) dflt=n ;;
4981         esac
4982         rp="Do you want to do setuid/setgid emulation?"
4983         . ./myread
4984         case "$ans" in
4985         [yY]*)  val="$define";;
4986         *)      val="$undef";;
4987         esac
4988         ;;
4989 esac
4990 set d_dosuid
4991 eval $setvar
4992
4993 : determine filename position in cpp output
4994 echo " "
4995 echo "Computing filename position in cpp output for #include directives..." >&4
4996 echo '#include <stdio.h>' > foo.c
4997 $cat >fieldn <<EOF
4998 $startsh
4999 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5000 $grep '^[       ]*#.*stdio\.h' | \
5001 while read cline; do
5002         pos=1
5003         set \$cline
5004         while $test \$# -gt 0; do
5005                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5006                         echo "\$pos"
5007                         exit 0
5008                 fi
5009                 shift
5010                 pos=\`expr \$pos + 1\`
5011         done
5012 done
5013 EOF
5014 chmod +x fieldn
5015 fieldn=`./fieldn`
5016 $rm -f foo.c fieldn
5017 case $fieldn in
5018 '') pos='???';;
5019 1) pos=first;;
5020 2) pos=second;;
5021 3) pos=third;;
5022 *) pos="${fieldn}th";;
5023 esac
5024 echo "Your cpp writes the filename in the $pos field of the line."
5025
5026 : locate header file
5027 $cat >findhdr <<EOF
5028 $startsh
5029 wanted=\$1
5030 name=''
5031 for usrincdir in $usrinc
5032 do
5033         if test -f \$usrincdir/\$wanted; then
5034                 echo "\$usrincdir/\$wanted"
5035                 exit 0
5036         fi
5037 done
5038 awkprg='{ print \$$fieldn }'
5039 echo "#include <\$wanted>" > foo\$\$.c
5040 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5041 $grep "^[       ]*#.*\$wanted" | \
5042 while read cline; do
5043         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5044         case "\$name" in
5045         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5046         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5047         *) exit 2;;
5048         esac;
5049 done;
5050 #
5051 # status = 0: grep returned 0 lines, case statement not executed
5052 # status = 1: headerfile found
5053 # status = 2: while loop executed, no headerfile found
5054 #
5055 status=\$?
5056 $rm -f foo\$\$.c;
5057 if test \$status -eq 1; then
5058         exit 0;
5059 fi
5060 exit 1
5061 EOF
5062 chmod +x findhdr
5063
5064 : define an alternate in-header-list? function
5065 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5066 cont=true; xxf="echo \"<\$1> found.\" >&4";
5067 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5068 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5069 esac;
5070 case $# in 4) instead=instead;; *) instead="at last";; esac;
5071 while $test "$cont"; do
5072         xxx=`./findhdr $1`
5073         var=$2; eval "was=\$$2";
5074         if $test "$xxx" && $test -r "$xxx";
5075         then eval $xxf;
5076         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5077                 cont="";
5078         else eval $xxnf;
5079         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5080         set $yyy; shift; shift; yyy=$@;
5081         case $# in 0) cont="";;
5082         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5083                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5084         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5085                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5086         esac;
5087 done;
5088 while $test "$yyy";
5089 do set $yyy; var=$2; eval "was=\$$2";
5090         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5091         set $yyy; shift; shift; yyy=$@;
5092 done'
5093
5094 : see if this is a malloc.h system
5095 set malloc.h i_malloc
5096 eval $inhdr
5097
5098 : see if stdlib is available
5099 set stdlib.h i_stdlib
5100 eval $inhdr
5101
5102 : determine which malloc to compile in
5103 echo " "
5104 case "$usemymalloc" in
5105 ''|[yY]*|true|$define)  dflt='y' ;;
5106 *)      dflt='n' ;;
5107 esac
5108 rp="Do you wish to attempt to use the malloc that comes with $package?"
5109 . ./myread
5110 usemymalloc="$ans"
5111 case "$ans" in
5112 y*|true)
5113         usemymalloc='y'
5114         mallocsrc='malloc.c'
5115         mallocobj="malloc$_o"
5116         d_mymalloc="$define"
5117         case "$libs" in
5118         *-lmalloc*)
5119                 : Remove malloc from list of libraries to use
5120                 echo "Removing unneeded -lmalloc from library list" >&4
5121                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5122                 shift
5123                 libs="$*"
5124                 echo "libs = $libs" >&4
5125                 ;;
5126         esac
5127         ;;
5128 *)
5129         usemymalloc='n'
5130         mallocsrc=''
5131         mallocobj=''
5132         d_mymalloc="$undef"
5133         ;;
5134 esac
5135
5136 : compute the return types of malloc and free
5137 echo " "
5138 $cat >malloc.c <<END
5139 #$i_malloc I_MALLOC
5140 #$i_stdlib I_STDLIB
5141 #include <stdio.h>
5142 #include <sys/types.h>
5143 #ifdef I_MALLOC
5144 #include <malloc.h>
5145 #endif
5146 #ifdef I_STDLIB
5147 #include <stdlib.h>
5148 #endif
5149 #ifdef TRY_MALLOC
5150 void *malloc();
5151 #endif
5152 #ifdef TRY_FREE
5153 void free();
5154 #endif
5155 END
5156 case "$malloctype" in
5157 '')
5158         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5159                 malloctype='void *'
5160         else
5161                 malloctype='char *'
5162         fi
5163         ;;
5164 esac
5165 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5166
5167 case "$freetype" in
5168 '')
5169         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5170                 freetype='void'
5171         else
5172                 freetype='int'
5173         fi
5174         ;;
5175 esac
5176 echo "Your system uses $freetype free(), it would seem." >&4
5177 $rm -f malloc.[co]
5178 $cat <<EOM
5179
5180 The installation process will also create a directory for
5181 vendor-supplied add-ons.  Vendors who supply perl with their system
5182 may find it convenient to place all vendor-supplied files in this
5183 directory rather than in the main distribution directory.  This will
5184 ease upgrades between binary-compatible maintenance versions of perl.
5185
5186 Of course you may also use these directories in whatever way you see
5187 fit.  For example, you might use them to access modules shared over a
5188 company-wide network.
5189
5190 The default answer should be fine for most people.
5191 This causes further questions about vendor add-ons to be skipped
5192 and no vendor-specific directories will be configured for perl.
5193
5194 EOM
5195 rp='Do you want to configure vendor-specific add-on directories?'
5196 case "$usevendorprefix" in
5197 define|true|[yY]*) dflt=y ;;
5198 *)      : User may have set vendorprefix directly on Configure command line.
5199         case "$vendorprefix" in
5200         ''|' ') dflt=n ;;
5201         *)      dflt=y ;;
5202         esac
5203         ;;
5204 esac
5205 . ./myread
5206 case "$ans" in
5207 [yY]*)  fn=d~+
5208         rp='Installation prefix to use for vendor-supplied add-ons?'
5209         case "$vendorprefix" in
5210         '') dflt='' ;;
5211         *)  dflt=$vendorprefix ;;
5212         esac
5213         . ./getfile
5214         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5215         oldvendorprefix=''
5216         case "$vendorprefix" in
5217         '') ;;
5218         *)      case "$ans" in
5219                 "$prefix") ;;
5220                 *) oldvendorprefix="$prefix";;
5221                 esac
5222                 ;;
5223         esac
5224         usevendorprefix="$define"
5225         vendorprefix="$ans"
5226         vendorprefixexp="$ansexp"
5227         ;;
5228 *)      usevendorprefix="$undef"
5229         vendorprefix=''
5230         vendorprefixexp=''
5231         ;;
5232 esac
5233
5234 case "$vendorprefix" in
5235 '')     d_vendorlib="$undef"
5236         vendorlib=''
5237         vendorlibexp=''
5238         ;;
5239 *)      d_vendorlib="$define"
5240         : determine where vendor-supplied modules go.
5241         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5242         case "$vendorlib" in
5243         '')
5244                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5245                 case "$installstyle" in
5246                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5247                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5248                 esac
5249                 ;;
5250         *)      dflt="$vendorlib"
5251                 ;;
5252         esac
5253         fn=d~+
5254         rp='Pathname for the vendor-supplied library files?'
5255         . ./getfile
5256         vendorlib="$ans"
5257         vendorlibexp="$ansexp"
5258         ;;
5259 esac
5260 : Change installation prefix, if necessary.
5261 if $test X"$prefix" != X"$installprefix"; then
5262         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5263 else
5264         installvendorlib="$vendorlibexp"
5265 fi
5266
5267 : Cruising for prototypes
5268 echo " "
5269 echo "Checking out function prototypes..." >&4
5270 $cat >prototype.c <<'EOCP'
5271 int main(int argc, char *argv[]) {
5272         exit(0);}
5273 EOCP
5274 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5275         echo "Your C compiler appears to support function prototypes."
5276         val="$define"
5277 else
5278         echo "Your C compiler doesn't seem to understand function prototypes."
5279         val="$undef"
5280 fi
5281 set prototype
5282 eval $setvar
5283 $rm -f prototype*
5284
5285 case "$prototype" in
5286 "$define") ;;
5287 *)      ansi2knr='ansi2knr'
5288         echo " "
5289         cat <<EOM >&4
5290
5291 $me:  FATAL ERROR:
5292 This version of $package can only be compiled by a compiler that 
5293 understands function prototypes.  Unfortunately, your C compiler 
5294         $cc $ccflags
5295 doesn't seem to understand them.  Sorry about that.
5296
5297 If GNU cc is available for your system, perhaps you could try that instead.  
5298
5299 Eventually, we hope to support building Perl with pre-ANSI compilers.
5300 If you would like to help in that effort, please contact <perlbug@perl.org>.
5301
5302 Aborting Configure now.
5303 EOM
5304         exit 2
5305         ;;
5306 esac
5307
5308 : determine where public executables go
5309 echo " "
5310 set dflt bin bin
5311 eval $prefixit
5312 fn=d~
5313 rp='Pathname where the public executables will reside?'
5314 . ./getfile
5315 if $test "X$ansexp" != "X$binexp"; then
5316         installbin=''
5317 fi
5318 bin="$ans"
5319 binexp="$ansexp"
5320 : Change installation prefix, if necessary.
5321 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5322 if $test X"$prefix" != X"$installprefix"; then
5323         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5324 else
5325         installbin="$binexp"
5326 fi
5327
5328 : Find perl5.005 or later.
5329 echo "Looking for a previously installed perl5.005 or later... "
5330 case "$perl5" in
5331 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5332                 : Check if this perl is recent and can load a simple module
5333                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5334                         perl5=$tdir/perl
5335                         break;
5336                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5337                         perl5=$tdir/perl
5338                         break;
5339                 fi
5340         done
5341         ;;
5342 *)      perl5="$perl5"
5343         ;;
5344 esac
5345 case "$perl5" in
5346 '')     echo "None found.  That's ok.";;
5347 *)      echo "Using $perl5." ;;
5348 esac
5349
5350 $cat <<EOM
5351
5352 After $package is installed, you may wish to install various
5353 add-on modules and utilities.  Typically, these add-ons will
5354 be installed under $prefix with the rest
5355 of this package.  However, you may wish to install such add-ons
5356 elsewhere under a different prefix.
5357
5358 If you do not wish to put everything under a single prefix, that's
5359 ok.  You will be prompted for the individual locations; this siteprefix
5360 is only used to suggest the defaults.
5361
5362 The default should be fine for most people.
5363
5364 EOM
5365 fn=d~+
5366 rp='Installation prefix to use for add-on modules and utilities?'
5367 : XXX Here might be another good place for an installstyle setting.
5368 case "$siteprefix" in
5369 '') dflt=$prefix ;;
5370 *)  dflt=$siteprefix ;;
5371 esac
5372 . ./getfile
5373 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5374 oldsiteprefix=''
5375 case "$siteprefix" in
5376 '') ;;
5377 *)      case "$ans" in
5378         "$prefix") ;;
5379         *) oldsiteprefix="$prefix";;
5380         esac
5381         ;;
5382 esac
5383 siteprefix="$ans"
5384 siteprefixexp="$ansexp"
5385
5386 : determine where site specific libraries go.
5387 : Usual default is /usr/local/lib/perl5/site_perl/$version
5388 : The default "style" setting is made in installstyle.U
5389 : XXX No longer works with Prefixit stuff.
5390 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5391 case "$sitelib" in
5392 '') case "$installstyle" in
5393         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5394         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5395         esac
5396         ;;
5397 *)      dflt="$sitelib"
5398         ;;
5399 esac
5400 $cat <<EOM
5401
5402 The installation process will create a directory for
5403 site-specific extensions and modules.  Most users find it convenient
5404 to place all site-specific files in this directory rather than in the
5405 main distribution directory.
5406
5407 EOM
5408 fn=d~+
5409 rp='Pathname for the site-specific library files?'
5410 . ./getfile
5411 sitelib="$ans"
5412 sitelibexp="$ansexp"
5413 : Change installation prefix, if necessary.
5414 if $test X"$prefix" != X"$installprefix"; then
5415         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5416 else
5417         installsitelib="$sitelibexp"
5418 fi
5419
5420 : Determine list of previous versions to include in @INC
5421 $cat > getverlist <<EOPL
5422 #!$perl5 -w
5423 use File::Basename;
5424 \$api_versionstring = "$api_versionstring";
5425 \$version = "$version";
5426 \$sitelib = "$sitelib";
5427 \$archname = "$archname";
5428 EOPL
5429         $cat >> getverlist <<'EOPL'
5430 # Can't have leading @ because metaconfig interprets it as a command!
5431 ;@inc_version_list=();
5432 $stem=dirname($sitelib);
5433 # XXX Redo to do opendir/readdir? 
5434 if (-d $stem) {
5435     chdir($stem);
5436     ;@candidates = glob("5.*");
5437 }
5438 else {
5439     ;@candidates = ();
5440 }
5441
5442 # XXX ToDo:  These comparisons must be reworked when two-digit
5443 # subversions come along, so that 5.7.10 compares as greater than
5444 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5445 # widespread that we can use the built-in version vectors rather
5446 # than reinventing them here.  For 5.6.0, however, we must
5447 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5448 foreach $d (@candidates) {
5449     if ($d lt $version) {
5450         if ($d ge $api_versionstring) {
5451             unshift(@inc_version_list, "$d/$archname", $d);
5452         }
5453         elsif ($d ge "5.005") {
5454             unshift(@inc_version_list, $d);
5455         }
5456     }
5457     else {
5458         # Skip newer version.  I.e. don't look in
5459         # 5.7.0 if we're installing 5.6.1.
5460     }
5461 }
5462
5463 if (@inc_version_list) {
5464     print join(' ', @inc_version_list);
5465 }
5466 else {
5467     # Blank space to preserve value for next Configure run.
5468     print " ";
5469 }
5470 EOPL
5471 chmod +x getverlist
5472 case "$inc_version_list" in
5473 '')     if test -x "$perl5"; then
5474                 dflt=`$perl5 getverlist`
5475         else
5476                 dflt='none'
5477         fi
5478         ;;
5479 $undef) dflt='none' ;;
5480 *)  dflt="$inc_version_list" ;;
5481 esac
5482 case "$dflt" in
5483 ''|' ') dflt=none ;;
5484 esac
5485 $cat <<'EOM'
5486
5487 In order to ease the process of upgrading, this version of perl 
5488 can be configured to use modules built and installed with earlier 
5489 versions of perl that were installed under $prefix.  Specify here
5490 the list of earlier versions that this version of perl should check.
5491 If Configure detected no earlier versions of perl installed under
5492 $prefix, then the list will be empty.  Answer 'none' to tell perl
5493 to not search earlier versions.
5494
5495 The default should almost always be sensible, so if you're not sure,
5496 just accept the default.
5497 EOM
5498
5499 rp='List of earlier versions to include in @INC?'
5500 . ./myread
5501 case "$ans" in
5502 [Nn]one|''|' ') inc_version_list=' ' ;;
5503 *) inc_version_list="$ans" ;;
5504 esac
5505 case "$inc_version_list" in
5506 ''|' ') 
5507         inc_version_list_init='0';;
5508 *)      inc_version_list_init=`echo $inc_version_list |
5509                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5510         ;;
5511 esac
5512 $rm -f getverlist
5513
5514 : determine whether to install perl also as /usr/bin/perl
5515
5516 echo " "
5517 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5518         $cat <<EOM
5519 Many scripts expect to perl to be installed as /usr/bin/perl.
5520 I can install the perl you are about to compile also as /usr/bin/perl
5521 (in addition to $installbin/perl).
5522 EOM
5523         case "$installusrbinperl" in
5524         "$undef"|[nN]*) dflt='n';;
5525         *)              dflt='y';;
5526         esac
5527         rp="Do you want to install perl as /usr/bin/perl?"
5528         . ./myread
5529         case "$ans" in
5530         [yY]*)  val="$define";;
5531         *)      val="$undef" ;;
5532         esac
5533 else
5534         val="$undef"
5535 fi
5536 set installusrbinperl
5537 eval $setvar
5538
5539 echo " "
5540 echo "Checking for GNU C Library..." >&4
5541 cat >gnulibc.c <<EOM
5542 #include <stdio.h>
5543 int main()
5544 {
5545 #ifdef __GLIBC__
5546     exit(0);
5547 #else
5548     exit(1);
5549 #endif
5550 }
5551 EOM
5552 set gnulibc
5553 if eval $compile_ok && ./gnulibc; then
5554         val="$define"
5555         echo "You are using the GNU C Library"
5556 else
5557         val="$undef"
5558         echo "You are not using the GNU C Library"
5559 fi
5560 $rm -f gnulibc*
5561 set d_gnulibc
5562 eval $setvar
5563
5564 : see if nm is to be used to determine whether a symbol is defined or not
5565 case "$usenm" in
5566 '')
5567         dflt=''
5568         case "$d_gnulibc" in
5569         "$define")
5570                 echo " "
5571                 echo "nm probably won't work on the GNU C Library." >&4
5572                 dflt=n
5573                 ;;
5574         esac
5575         case "$dflt" in
5576         '') 
5577                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5578                         echo " "
5579                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5580                         echo "'nm' won't be sufficient on this sytem." >&4
5581                         dflt=n
5582                 fi
5583                 ;;
5584         esac
5585         case "$dflt" in
5586         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5587                 if $test $dflt -gt 20; then
5588                         dflt=y
5589                 else
5590                         dflt=n
5591                 fi
5592                 ;;
5593         esac
5594         ;;
5595 *)
5596         case "$usenm" in
5597         true|$define) dflt=y;;
5598         *) dflt=n;;
5599         esac
5600         ;;
5601 esac
5602 $cat <<EOM
5603
5604 I can use $nm to extract the symbols from your C libraries. This
5605 is a time consuming task which may generate huge output on the disk (up
5606 to 3 megabytes) but that should make the symbols extraction faster. The
5607 alternative is to skip the 'nm' extraction part and to compile a small
5608 test program instead to determine whether each symbol is present. If
5609 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5610 this may be the best solution.
5611
5612 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5613
5614 EOM
5615 rp="Shall I use $nm to extract C symbols from the libraries?"
5616 . ./myread
5617 case "$ans" in
5618 [Nn]*) usenm=false;;
5619 *) usenm=true;;
5620 esac
5621
5622 runnm=$usenm
5623 case "$reuseval" in
5624 true) runnm=false;;
5625 esac
5626
5627 : nm options which may be necessary
5628 case "$nm_opt" in
5629 '') if $test -f /mach_boot; then
5630                 nm_opt=''       # Mach
5631         elif $test -d /usr/ccs/lib; then
5632                 nm_opt='-p'     # Solaris (and SunOS?)
5633         elif $test -f /dgux; then
5634                 nm_opt='-p'     # DG-UX
5635         elif $test -f /lib64/rld; then
5636                 nm_opt='-p'     # 64-bit Irix
5637         else
5638                 nm_opt=''
5639         fi;;
5640 esac
5641
5642 : nm options which may be necessary for shared libraries but illegal
5643 : for archive libraries.  Thank you, Linux.
5644 case "$nm_so_opt" in
5645 '')     case "$myuname" in
5646         *linux*)
5647                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5648                         nm_so_opt='--dynamic'
5649                 fi
5650                 ;;
5651         esac
5652         ;;
5653 esac
5654
5655 case "$runnm" in
5656 true)
5657 : get list of predefined functions in a handy place
5658 echo " "
5659 case "$libc" in
5660 '') libc=unknown
5661         case "$libs" in
5662         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5663         esac
5664         ;;
5665 esac
5666 libnames='';
5667 case "$libs" in
5668 '') ;;
5669 *)  for thislib in $libs; do
5670         case "$thislib" in
5671         -lc|-lc_s)
5672                 : Handle C library specially below.
5673                 ;;
5674         -l*)
5675                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5676                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5677                         :
5678                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5679                         :
5680                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5681                         :
5682                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5683                         :
5684                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5685                         :
5686                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5687                         :
5688                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5689                         :
5690                 else
5691                         try=''
5692                 fi
5693                 libnames="$libnames $try"
5694                 ;;
5695         *) libnames="$libnames $thislib" ;;
5696         esac
5697         done
5698         ;;
5699 esac
5700 xxx=normal
5701 case "$libc" in
5702 unknown)
5703         set /lib/libc.$so
5704         for xxx in $libpth; do
5705                 $test -r $1 || set $xxx/libc.$so
5706                 : The messy sed command sorts on library version numbers.
5707                 $test -r $1 || \
5708                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5709                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5710                                 h
5711                                 s/[0-9][0-9]*/0000&/g
5712                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5713                                 G
5714                                 s/\n/ /' | \
5715                          sort | $sed -e 's/^.* //'`
5716                 eval set \$$#
5717         done
5718         $test -r $1 || set /usr/ccs/lib/libc.$so
5719         $test -r $1 || set /lib/libsys_s$_a
5720         ;;
5721 *)
5722         set blurfl
5723         ;;
5724 esac
5725 if $test -r "$1"; then
5726         echo "Your (shared) C library seems to be in $1."
5727         libc="$1"
5728 elif $test -r /lib/libc && $test -r /lib/clib; then
5729         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5730         xxx=apollo
5731         libc='/lib/clib /lib/libc'
5732         if $test -r /lib/syslib; then
5733                 echo "(Your math library is in /lib/syslib.)"
5734                 libc="$libc /lib/syslib"
5735         fi
5736 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5737         echo "Your C library seems to be in $libc, as you said before."
5738 elif $test -r $incpath/usr/lib/libc$_a; then
5739         libc=$incpath/usr/lib/libc$_a;
5740         echo "Your C library seems to be in $libc.  That's fine."
5741 elif $test -r /lib/libc$_a; then
5742         libc=/lib/libc$_a;
5743         echo "Your C library seems to be in $libc.  You're normal."
5744 else
5745         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5746                 :
5747         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5748                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5749         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5750                 :
5751         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5752                 :
5753         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5754                 :
5755         else
5756                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5757         fi
5758         if $test -r "$tans"; then
5759                 echo "Your C library seems to be in $tans, of all places."
5760                 libc=$tans
5761         else
5762                 libc='blurfl'
5763         fi
5764 fi
5765 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5766         dflt="$libc"
5767         cat <<EOM
5768
5769 If the guess above is wrong (which it might be if you're using a strange
5770 compiler, or your machine supports multiple models), you can override it here.
5771
5772 EOM
5773 else
5774         dflt=''
5775         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5776         cat >&4 <<EOM
5777 I can't seem to find your C library.  I've looked in the following places:
5778
5779 EOM
5780         $sed 's/^/      /' libpath
5781         cat <<EOM
5782
5783 None of these seems to contain your C library. I need to get its name...
5784
5785 EOM
5786 fi
5787 fn=f
5788 rp='Where is your C library?'
5789 . ./getfile
5790 libc="$ans"
5791
5792 echo " "
5793 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5794 set X `cat libnames`
5795 shift
5796 xxx=files
5797 case $# in 1) xxx=file; esac
5798 echo "Extracting names from the following $xxx for later perusal:" >&4
5799 echo " "
5800 $sed 's/^/      /' libnames >&4
5801 echo " "
5802 $echo $n "This may take a while...$c" >&4
5803
5804 for file in $*; do
5805         case $file in
5806         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5807         *) $nm $nm_opt $file 2>/dev/null;;
5808         esac
5809 done >libc.tmp
5810
5811 $echo $n ".$c"
5812 $grep fprintf libc.tmp > libc.ptf
5813 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5814 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5815 xxx='[ADTSIW]'
5816 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5817         eval $xscan;\
5818         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5819                 eval $xrun
5820 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5821         eval $xscan;\
5822         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5823                 eval $xrun
5824 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5825         eval $xscan;\
5826         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5827                 eval $xrun
5828 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5829         eval $xscan;\
5830         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5831                 eval $xrun
5832 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5833         eval $xscan;\
5834         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5835                 eval $xrun
5836 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5837         eval $xscan;\
5838         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5839                 eval $xrun
5840 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5841                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5842         eval $xscan;\
5843         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5844                 eval $xrun
5845 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5846         eval $xscan;\
5847         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5848                 eval $xrun
5849 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5850         eval $xscan;\
5851         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5852                 eval $xrun
5853 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5854         eval $xscan;\
5855         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5856                 eval $xrun
5857 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5858         eval $xscan;\
5859         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5860                 eval $xrun
5861 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5862         eval $xscan;\
5863         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5864                 eval $xrun
5865 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5866         eval $xscan;\
5867         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5868                 eval $xrun
5869 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5870         eval $xscan;\
5871         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5872                 eval $xrun
5873 else
5874         $nm -p $* 2>/dev/null >libc.tmp
5875         $grep fprintf libc.tmp > libc.ptf
5876         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5877                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5878         then
5879                 nm_opt='-p'
5880                 eval $xrun
5881         else
5882                 echo " "
5883                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5884                 com=''
5885                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5886                         for thisname in $libnames $libc; do
5887                                 $ar t $thisname >>libc.tmp
5888                         done
5889                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5890                         echo "Ok." >&4
5891                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5892                         # Repeat libc to extract forwarders to DLL entries too
5893                         for thisname in $libnames $libc; do
5894                                 $ar tv $thisname >>libc.tmp
5895                                 # Revision 50 of EMX has bug in $ar.
5896                                 # it will not extract forwarders to DLL entries
5897                                 # Use emximp which will extract exactly them.
5898                                 emximp -o tmp.imp $thisname \
5899                                     2>/dev/null && \
5900                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5901                                     < tmp.imp >>libc.tmp
5902                                 $rm tmp.imp
5903                         done
5904                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5905                         echo "Ok." >&4
5906                 else
5907                         echo "$ar didn't seem to work right." >&4
5908                         echo "Maybe this is a Cray...trying bld instead..." >&4
5909                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5910                         then
5911                                 for thisname in $libnames; do
5912                                         bld t $libnames | \
5913                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5914                                         $ar t $thisname >>libc.tmp
5915                                 done
5916                                 echo "Ok." >&4
5917                         else
5918                                 echo "That didn't work either.  Giving up." >&4
5919                                 exit 1
5920                         fi
5921                 fi
5922         fi
5923 fi
5924 nm_extract="$com"
5925 if $test -f /lib/syscalls.exp; then
5926         echo " "
5927         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5928         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5929 fi
5930 ;;
5931 esac
5932 $rm -f libnames libpath
5933
5934 : see if dld is available
5935 set dld.h i_dld
5936 eval $inhdr
5937
5938 : is a C symbol defined?
5939 csym='tlook=$1;
5940 case "$3" in
5941 -v) tf=libc.tmp; tc=""; tdc="";;
5942 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5943 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5944 esac;
5945 tx=yes;
5946 case "$reuseval-$4" in
5947 true-) ;;
5948 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5949 esac;
5950 case "$tx" in
5951 yes)
5952         case "$runnm" in
5953         true)
5954                 if $contains $tlook $tf >/dev/null 2>&1;
5955                 then tval=true;
5956                 else tval=false;
5957                 fi;;
5958         *)
5959                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5960                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5961                 then tval=true;
5962                 else tval=false;
5963                 fi;
5964                 $rm -f t t.c;;
5965         esac;;
5966 *)
5967         case "$tval" in
5968         $define) tval=true;;
5969         *) tval=false;;
5970         esac;;
5971 esac;
5972 eval "$2=$tval"'
5973
5974 : define an is-in-libc? function
5975 inlibc='echo " "; td=$define; tu=$undef;
5976 sym=$1; var=$2; eval "was=\$$2";
5977 tx=yes;
5978 case "$reuseval$was" in
5979 true) ;;
5980 true*) tx=no;;
5981 esac;
5982 case "$tx" in
5983 yes)
5984         set $sym tres -f;
5985         eval $csym;
5986         case "$tres" in
5987         true)
5988                 echo "$sym() found." >&4;
5989                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5990         *)
5991                 echo "$sym() NOT found." >&4;
5992                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5993         esac;;
5994 *)
5995         case "$was" in
5996         $define) echo "$sym() found." >&4;;
5997         *) echo "$sym() NOT found." >&4;;
5998         esac;;
5999 esac'
6000
6001 : see if dlopen exists
6002 xxx_runnm="$runnm"
6003 runnm=false
6004 set dlopen d_dlopen
6005 eval $inlibc
6006 runnm="$xxx_runnm"
6007
6008 : determine which dynamic loading, if any, to compile in
6009 echo " "
6010 dldir="ext/DynaLoader"
6011 case "$usedl" in
6012 $define|y|true)
6013         dflt='y'
6014         usedl="$define"
6015         ;;
6016 $undef|n|false)
6017         dflt='n'
6018         usedl="$undef"
6019         ;;
6020 *) 
6021         dflt='n'
6022         case "$d_dlopen" in
6023             $define) dflt='y' ;;
6024         esac
6025         case "$i_dld" in
6026             $define) dflt='y' ;;
6027         esac
6028         : Does a dl_xxx.xs file exist for this operating system
6029         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6030         ;;
6031 esac
6032 rp="Do you wish to use dynamic loading?"
6033 . ./myread
6034 usedl="$ans"
6035 case "$ans" in
6036 y*) usedl="$define"
6037         case "$dlsrc" in
6038         '')
6039                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6040                         dflt="$dldir/dl_${osname}.xs"
6041                 elif $test "$d_dlopen" = "$define" ; then
6042                         dflt="$dldir/dl_dlopen.xs"
6043                 elif $test "$i_dld" = "$define" ; then
6044                         dflt="$dldir/dl_dld.xs"
6045                 else
6046                         dflt=''
6047                 fi
6048                 ;;
6049         *)      dflt="$dldir/$dlsrc"
6050                 ;;
6051         esac
6052     echo "The following dynamic loading files are available:"
6053         : Can not go over to $dldir because getfile has path hard-coded in.
6054         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6055         rp="Source file to use for dynamic loading"
6056         fn="fne"
6057         gfpth="$src"
6058         . ./getfile
6059         usedl="$define"
6060         : emulate basename
6061         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6062
6063         $cat << EOM
6064
6065 Some systems may require passing special flags to $cc -c to
6066 compile modules that will be used to create a shared library.
6067 To use no flags, say "none".
6068
6069 EOM
6070     case "$cccdlflags" in
6071     '') case "$gccversion" in
6072                 '') case "$osname" in
6073                         hpux)   dflt='+z' ;;
6074                         next)   dflt='none' ;;
6075                         irix*)  dflt='-KPIC' ;;
6076                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6077                         sunos)  dflt='-pic' ;;
6078                         *)      dflt='none' ;;
6079                     esac
6080                         ;;
6081                 *)  case "$osname" in
6082                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6083                         *)      dflt='-fpic' ;;
6084                     esac ;;
6085             esac ;;
6086         ' ') dflt='none' ;;
6087     *)  dflt="$cccdlflags" ;;
6088     esac
6089     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6090     . ./myread
6091     case "$ans" in
6092     none) cccdlflags=' ' ;;
6093     *) cccdlflags="$ans" ;;
6094     esac
6095
6096     cat << EOM
6097
6098 Some systems use ld to create libraries that can be dynamically loaded,
6099 while other systems (such as those using ELF) use $cc.
6100
6101 EOM
6102         case "$ld" in
6103         '')     $cat >try.c <<'EOM'
6104 /* Test for whether ELF binaries are produced */
6105 #include <fcntl.h>
6106 #include <stdlib.h>
6107 int main() {
6108         char b[4];
6109         int i = open("a.out",O_RDONLY);
6110         if(i == -1) 
6111                 exit(1); /* fail */
6112         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6113                 exit(0); /* succeed (yes, it's ELF) */
6114         else
6115                 exit(1); /* fail */
6116 }
6117 EOM
6118                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6119                         cat <<EOM
6120 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6121 EOM
6122                         dflt="$cc"
6123                 else
6124                         echo "I'll use ld to build dynamic libraries."
6125                         dflt='ld'
6126                 fi
6127                 rm -f try.c a.out
6128                 ;;
6129         *)      dflt="$ld"
6130                 ;;
6131         esac
6132
6133     rp="What command should be used to create dynamic libraries?"
6134     . ./myread
6135         ld="$ans"
6136
6137     cat << EOM
6138
6139 Some systems may require passing special flags to $ld to create a
6140 library that can be dynamically loaded.  If your ld flags include
6141 -L/other/path options to locate libraries outside your loader's normal
6142 search path, you may need to specify those -L options here as well.  To
6143 use no flags, say "none".
6144
6145 EOM
6146     case "$lddlflags" in
6147     '') case "$osname" in
6148                         beos) dflt='-nostart' ;;
6149                         hpux)  dflt='-b +vnocompatwarnings' ;;
6150                         linux|irix*)    dflt='-shared' ;;
6151                         next)  dflt='none' ;;
6152                         solaris) dflt='-G' ;;
6153                         sunos) dflt='-assert nodefinitions' ;;
6154                         svr4*|esix*) dflt="-G $ldflags" ;;
6155                 *)     dflt='none' ;;
6156                         esac
6157                         ;;
6158     *) dflt="$lddlflags" ;;
6159     esac
6160
6161         : Try to guess additional flags to pick up local libraries.
6162         : Be careful not to append to a plain 'none'
6163         case "$dflt" in
6164         none) dflt='' ;;
6165         esac
6166         for thisflag in $ldflags; do
6167                 case "$thisflag" in
6168                 -L*)
6169                         case " $dflt " in
6170                         *" $thisflag "*) ;;
6171                         *) dflt="$dflt $thisflag" ;;
6172                         esac
6173                         ;;
6174                 esac
6175         done
6176
6177         case "$dflt" in
6178         ''|' ') dflt='none' ;;
6179         esac
6180
6181     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6182     . ./myread
6183     case "$ans" in
6184     none) lddlflags=' ' ;;
6185     *) lddlflags="$ans" ;;
6186     esac
6187
6188         cat <<EOM
6189
6190 Some systems may require passing special flags to $cc to indicate that
6191 the resulting executable will use dynamic linking.  To use no flags,
6192 say "none".
6193
6194 EOM
6195     case "$ccdlflags" in
6196     '') case "$osname" in
6197                 hpux)   dflt='-Wl,-E' ;;
6198                 linux)  dflt='-rdynamic' ;;
6199                 next)   dflt='none' ;;
6200                 sunos)  dflt='none' ;;
6201                 *)      dflt='none' ;;
6202             esac ;;
6203     ' ')  dflt='none' ;;
6204     *)  dflt="$ccdlflags" ;;
6205     esac
6206     rp="Any special flags to pass to $cc to use dynamic linking?"
6207     . ./myread
6208     case "$ans" in
6209     none) ccdlflags=' ' ;;
6210     *) ccdlflags="$ans" ;;
6211     esac
6212     ;;
6213 *)  usedl="$undef"
6214         ld='ld'
6215     dlsrc='dl_none.xs'
6216     lddlflags=''
6217     ccdlflags=''
6218     ;;
6219 esac
6220
6221 also=''
6222 case "$usedl" in
6223 $undef)
6224         # No dynamic loading being used, so don't bother even to prompt.
6225         useshrplib='false'
6226         ;;
6227 *)      case "$useshrplib" in
6228         '')     case "$osname" in
6229                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6230                         dflt=y
6231                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6232                         ;;
6233                 next*)
6234                         case "$osvers" in
6235                         4*)     dflt=y
6236                                 also='Building a shared libperl is needed for MAB support.'
6237                                 ;;
6238                         *)      dflt=n
6239                                 ;;
6240                         esac
6241                         ;;
6242                 *)      dflt=n
6243                         ;;
6244                 esac
6245                 ;;
6246         $define|true|[Yy]*)
6247                 dflt=y
6248                 ;;
6249         *)      dflt=n
6250                 ;;
6251         esac
6252         $cat << EOM
6253
6254 The perl executable is normally obtained by linking perlmain.c with
6255 libperl${_a}, any static extensions (usually just DynaLoader), and
6256 any other libraries needed on this system (such as -lm, etc.).  Since
6257 your system supports dynamic loading, it is probably possible to build
6258 a shared libperl.$so.  If you will have more than one executable linked
6259 to libperl.$so, this will significantly reduce the size of each
6260 executable, but it may have a noticeable affect on performance.  The
6261 default is probably sensible for your system.
6262 $also
6263
6264 EOM
6265         rp="Build a shared libperl.$so (y/n)"
6266         . ./myread
6267         case "$ans" in
6268         true|$define|[Yy]*)
6269                 useshrplib='true'  ;;
6270         *)      useshrplib='false' ;;
6271         esac
6272         ;;
6273 esac
6274
6275 case "$useshrplib" in
6276 true)
6277         case "$libperl" in
6278         '')
6279                 # Figure out a good name for libperl.so.  Since it gets stored in
6280                 # a version-specific architecture-dependent library, the version
6281                 # number isn't really that important, except for making cc/ld happy.
6282                 #
6283                 # A name such as libperl.so.3.1
6284                 majmin="libperl.$so.$patchlevel.$subversion"
6285                 # A name such as libperl.so.301
6286                 majonly=`echo $patchlevel $subversion |
6287                         $awk '{printf "%d%02d", $1, $2}'`
6288                 majonly=libperl.$so.$majonly
6289                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6290                 # rely on figuring it out from the naming of libc.
6291                 case "${osname}${osvers}" in
6292                 next4*)
6293                         dflt=libperl.5.$so
6294                         # XXX How handle the --version stuff for MAB?
6295                         ;;
6296                 linux*)  # ld won't link with a bare -lperl otherwise.
6297                         dflt=libperl.$so
6298                         ;;
6299                 cygwin*) # include version
6300                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6301                         ;;
6302                 *)      # Try to guess based on whether libc has major.minor.
6303                         case "$libc" in
6304                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6305                         *libc.$so.[0-9]*) dflt=$majonly ;;
6306                         *)      dflt=libperl.$so ;;
6307                         esac
6308                         ;;
6309                 esac
6310                 ;;
6311         *)      dflt=$libperl
6312                 ;;
6313         esac
6314         cat << EOM
6315
6316 I need to select a good name for the shared libperl.  If your system uses
6317 library names with major and minor numbers, then you might want something
6318 like $majmin.  Alternatively, if your system uses a single version
6319 number for shared libraries, then you might want to use $majonly.
6320 Or, your system might be quite happy with a simple libperl.$so.
6321
6322 Since the shared libperl will get installed into a version-specific
6323 architecture-dependent directory, the version number of the shared perl
6324 library probably isn't important, so the default should be o.k.
6325
6326 EOM
6327         rp='What name do you want to give to the shared libperl?'
6328         . ./myread
6329         libperl=$ans
6330         echo "Ok, I'll use $libperl"
6331         ;;
6332 *)
6333         libperl="libperl${_a}"
6334         ;;
6335 esac
6336
6337 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6338 case "$shrpdir" in
6339 '') ;;
6340 *)      $cat >&4 <<EOM
6341 WARNING:  Use of the shrpdir variable for the installation location of
6342 the shared $libperl is not supported.  It was never documented and
6343 will not work in this version.  Let me (perlbug@perl.com)
6344 know of any problems this may cause.
6345
6346 EOM
6347         case "$shrpdir" in
6348         "$archlibexp/CORE")
6349                 $cat >&4 <<EOM
6350 But your current setting of $shrpdir is
6351 the default anyway, so it's harmless.
6352 EOM
6353                 ;;
6354         *)
6355                 $cat >&4 <<EOM
6356 Further, your current attempted setting of $shrpdir
6357 conflicts with the value of $archlibexp/CORE
6358 that installperl will use.
6359 EOM
6360                 ;;
6361         esac
6362         ;;
6363 esac
6364
6365 # How will the perl executable find the installed shared $libperl?
6366 # Add $xxx to ccdlflags.
6367 # If we can't figure out a command-line option, use $shrpenv to
6368 # set env LD_RUN_PATH.  The main perl makefile uses this.
6369 shrpdir=$archlibexp/CORE
6370 xxx=''
6371 tmp_shrpenv=''
6372 if "$useshrplib"; then
6373     case "$osname" in 
6374         aix)
6375                 # We'll set it in Makefile.SH...
6376                 ;;
6377         solaris|netbsd)
6378                 xxx="-R $shrpdir"
6379                 ;;
6380         freebsd)
6381                 xxx="-Wl,-R$shrpdir"
6382                 ;;
6383         linux|irix*|dec_osf)
6384                 xxx="-Wl,-rpath,$shrpdir"
6385                 ;;
6386         next)
6387                 # next doesn't like the default...
6388                 ;;
6389         beos)
6390                 # beos doesn't like the default, either.
6391                 ;;
6392         hpux*)
6393                 # hpux doesn't like the default, either.
6394                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6395                 ;;
6396         *)
6397                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6398                 ;;
6399         esac
6400         case "$xxx" in
6401         '') ;;
6402         *)      
6403                 # Only add $xxx if it isn't already in ccdlflags.
6404                 case " $ccdlflags " in
6405                 *" $xxx "*)     ;;
6406                 *)      ccdlflags="$ccdlflags $xxx"
6407                         cat <<EOM >&4
6408
6409 Adding $xxx to the flags
6410 passed to $ld so that the perl executable will find the 
6411 installed shared $libperl.
6412
6413 EOM
6414                         ;;
6415                 esac
6416                 ;;
6417         esac
6418 fi
6419 # Fix ccdlflags in AIX for building external extensions.
6420 # (For building Perl itself bare -bE:perl.exp is needed,
6421 #  Makefile.SH takes care of this.)
6422 case "$osname" in
6423 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6424 esac
6425 # Respect a hint or command-line value.
6426 case "$shrpenv" in
6427 '') shrpenv="$tmp_shrpenv" ;;
6428 esac
6429 case "$ldlibpthname" in
6430 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6431 none)   ldlibpthname='' ;;
6432 esac
6433
6434 : determine where manual pages go
6435 set man1dir man1dir none
6436 eval $prefixit
6437 $cat <<EOM
6438
6439 $spackage has manual pages available in source form.
6440 EOM
6441 case "$nroff" in
6442 nroff)
6443         echo "However, you don't have nroff, so they're probably useless to you."
6444         case "$man1dir" in
6445         '') man1dir="none";;
6446         esac;;
6447 esac
6448 echo "If you don't want the manual sources installed, answer 'none'."
6449 case "$man1dir" in
6450 ' ') dflt=none
6451         ;;
6452 '')
6453         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6454         lookpath="$lookpath $prefixexp/man/p_man/man1"
6455         lookpath="$lookpath $prefixexp/man/u_man/man1"
6456         lookpath="$lookpath $prefixexp/man/man.1"
6457         case "$sysman" in
6458         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6459         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6460         esac
6461         set dflt
6462         eval $prefixup
6463         ;;
6464 *)  dflt="$man1dir"
6465         ;;
6466 esac
6467 echo " "
6468 fn=dn+~
6469 rp="Where do the main $spackage manual pages (source) go?"
6470 . ./getfile
6471 if $test "X$man1direxp" != "X$ansexp"; then
6472         installman1dir=''
6473 fi
6474 man1dir="$ans"
6475 man1direxp="$ansexp"
6476 case "$man1dir" in
6477 '')     man1dir=' '
6478         installman1dir='';;
6479 esac
6480
6481 : Change installation prefix, if necessary.
6482 if $test X"$prefix" != X"$installprefix"; then
6483         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6484 else
6485         installman1dir="$man1direxp"
6486 fi
6487
6488 : What suffix to use on installed man pages
6489
6490 case "$man1dir" in
6491 ' ')
6492         man1ext='0'
6493         ;;
6494 *)
6495         rp="What suffix should be used for the main $spackage man pages?"
6496         case "$man1ext" in
6497         '')     case "$man1dir" in
6498                 *1)  dflt=1 ;;
6499                 *1p) dflt=1p ;;
6500                 *1pm) dflt=1pm ;;
6501                 *l) dflt=l;;
6502                 *n) dflt=n;;
6503                 *o) dflt=o;;
6504                 *p) dflt=p;;
6505                 *C) dflt=C;;
6506                 *L) dflt=L;;
6507                 *L1) dflt=L1;;
6508                 *) dflt=1;;
6509                 esac
6510                 ;;
6511         *)      dflt="$man1ext";;
6512         esac
6513         . ./myread
6514         man1ext="$ans"
6515         ;;
6516 esac
6517
6518 : see if we can have long filenames
6519 echo " "
6520 rmlist="$rmlist /tmp/cf$$"
6521 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6522 first=123456789abcdef
6523 second=/tmp/cf$$/$first
6524 $rm -f $first $second
6525 if (echo hi >$first) 2>/dev/null; then
6526         if $test -f 123456789abcde; then
6527                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6528                 val="$undef"
6529         else
6530                 if (echo hi >$second) 2>/dev/null; then
6531                         if $test -f /tmp/cf$$/123456789abcde; then
6532                                 $cat <<'EOM'
6533 That's peculiar... You can have filenames longer than 14 characters, but only
6534 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6535 I shall consider your system cannot support long filenames at all.
6536 EOM
6537                                 val="$undef"
6538                         else
6539                                 echo 'You can have filenames longer than 14 characters.' >&4
6540                                 val="$define"
6541                         fi
6542                 else
6543                         $cat <<'EOM'
6544 How confusing! Some of your filesystems are sane enough to allow filenames
6545 longer than 14 characters but some others like /tmp can't even think about them.
6546 So, for now on, I shall assume your kernel does not allow them at all.
6547 EOM
6548                         val="$undef"
6549                 fi
6550         fi
6551 else
6552         $cat <<'EOM'
6553 You can't have filenames longer than 14 chars.  You can't even think about them!
6554 EOM
6555         val="$undef"
6556 fi 
6557 set d_flexfnam
6558 eval $setvar
6559 $rm -rf /tmp/cf$$ 123456789abcde*
6560
6561 : determine where library module manual pages go
6562 set man3dir man3dir none
6563 eval $prefixit
6564 $cat <<EOM
6565
6566 $spackage has manual pages for many of the library modules.
6567 EOM
6568
6569 case "$nroff" in
6570 nroff)
6571         $cat <<'EOM'
6572 However, you don't have nroff, so they're probably useless to you.
6573 EOM
6574         case "$man3dir" in
6575         '') man3dir="none";;
6576         esac;;
6577 esac
6578
6579 case "$d_flexfnam" in
6580 undef)
6581         $cat <<'EOM'
6582 However, your system can't handle the long file names like File::Basename.3. 
6583 EOM
6584         case "$man3dir" in
6585         '') man3dir="none";;
6586         esac;;
6587 esac
6588
6589 echo "If you don't want the manual sources installed, answer 'none'."
6590 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6591 case "$man3dir" in
6592 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6593         if $test -d "$privlib/man/man3"; then
6594                 cat <<EOM >&4
6595
6596 WARNING:  Previous versions of perl installed man3 pages into
6597 $privlib/man/man3.  This version will suggest a 
6598 new default of $dflt.  
6599 EOM
6600                 tdflt=$dflt
6601                 dflt='n'
6602                 rp='Do you wish to preserve the old behavior?(y/n)'
6603                 . ./myread
6604                 case "$ans" in
6605                 y*) dflt="$privlib/man/man3" ;;
6606                 *)  dflt=$tdflt ;;
6607                 esac
6608     fi
6609         ;;
6610 ' ') dflt=none;;
6611 *)      dflt="$man3dir" ;;
6612 esac
6613 echo " "
6614 fn=dn+~
6615 rp="Where do the $package library man pages (source) go?"
6616 . ./getfile
6617 man3dir="$ans"
6618 man3direxp="$ansexp"
6619 case "$man1dir" in
6620 '')     man3dir=' '
6621         installman3dir='';;
6622 esac
6623
6624 : Change installation prefix, if necessary.
6625 if $test X"$prefix" != X"$installprefix"; then
6626         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6627 else
6628         installman3dir="$man3direxp"
6629 fi
6630
6631 : What suffix to use on installed man pages
6632 case "$man3dir" in
6633 ' ')
6634         man3ext='0'
6635         ;;
6636 *)
6637         rp="What suffix should be used for the $package library man pages?"
6638         case "$man3ext" in
6639         '')     case "$man3dir" in
6640                 *3)  dflt=3 ;;
6641                 *3p) dflt=3p ;;
6642                 *3pm) dflt=3pm ;;
6643                 *l) dflt=l;;
6644                 *n) dflt=n;;
6645                 *o) dflt=o;;
6646                 *p) dflt=p;;
6647                 *C) dflt=C;;
6648                 *L) dflt=L;;
6649                 *L3) dflt=L3;;
6650                 *) dflt=3;;
6651                 esac
6652                 ;;
6653         *)      dflt="$man3ext";;
6654         esac
6655         . ./myread
6656         man3ext="$ans"
6657         ;;
6658 esac
6659
6660 : see if we have to deal with yellow pages, now NIS.
6661 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6662         if $test -f /usr/etc/nibindd; then
6663                 echo " "
6664                 echo "I'm fairly confident you're on a NeXT."
6665                 echo " "
6666                 rp='Do you get the hosts file via NetInfo?'
6667                 dflt=y
6668                 case "$hostcat" in
6669                 nidump*) ;;
6670                 '') ;;
6671                 *) dflt=n;;
6672                 esac
6673                 . ./myread
6674                 case "$ans" in
6675                 y*) hostcat='nidump hosts .';;
6676                 *)      case "$hostcat" in
6677                         nidump*) hostcat='';;
6678                         esac
6679                         ;;
6680                 esac
6681         fi
6682         case "$hostcat" in
6683         nidump*) ;;
6684         *)
6685                 case "$hostcat" in
6686                 *ypcat*) dflt=y;;
6687                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6688                                 dflt=y
6689                         else
6690                                 dflt=n
6691                         fi;;
6692                 *) dflt=n;;
6693                 esac
6694                 echo " "
6695                 rp='Are you getting the hosts file via yellow pages?'
6696                 . ./myread
6697                 case "$ans" in
6698                 y*) hostcat='ypcat hosts';;
6699                 *) hostcat='cat /etc/hosts';;
6700                 esac
6701                 ;;
6702         esac
6703 fi
6704 case "$hostcat" in
6705 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6706 esac
6707 case "$groupcat" in
6708 '') test -f /etc/group && groupcat='cat /etc/group';;
6709 esac
6710 case "$passcat" in
6711 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6712 esac
6713
6714 : now get the host name
6715 echo " "
6716 echo "Figuring out host name..." >&4
6717 case "$myhostname" in
6718 '') cont=true
6719         echo 'Maybe "hostname" will work...'
6720         if tans=`sh -c hostname 2>&1` ; then
6721                 myhostname=$tans
6722                 phostname=hostname
6723                 cont=''
6724         fi
6725         ;;
6726 *) cont='';;
6727 esac
6728 if $test "$cont"; then
6729         if ./xenix; then
6730                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6731                 if tans=`cat /etc/systemid 2>&1` ; then
6732                         myhostname=$tans
6733                         phostname='cat /etc/systemid'
6734                         echo "Whadyaknow.  Xenix always was a bit strange..."
6735                         cont=''
6736                 fi
6737         elif $test -r /etc/systemid; then
6738                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6739         fi
6740 fi
6741 if $test "$cont"; then
6742         echo 'No, maybe "uuname -l" will work...'
6743         if tans=`sh -c 'uuname -l' 2>&1` ; then
6744                 myhostname=$tans
6745                 phostname='uuname -l'
6746         else
6747                 echo 'Strange.  Maybe "uname -n" will work...'
6748                 if tans=`sh -c 'uname -n' 2>&1` ; then
6749                         myhostname=$tans
6750                         phostname='uname -n'
6751                 else
6752                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6753                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6754                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6755                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6756                         else
6757                                 case "$myhostname" in
6758                                 '') echo "Does this machine have an identity crisis or something?"
6759                                         phostname='';;
6760                                 *)
6761                                         echo "Well, you said $myhostname before..."
6762                                         phostname='echo $myhostname';;
6763                                 esac
6764                         fi
6765                 fi
6766         fi
6767 fi
6768 : you do not want to know about this
6769 set $myhostname
6770 myhostname=$1
6771
6772 : verify guess
6773 if $test "$myhostname" ; then
6774         dflt=y
6775         rp='Your host name appears to be "'$myhostname'".'" Right?"
6776         . ./myread
6777         case "$ans" in
6778         y*) ;;
6779         *) myhostname='';;
6780         esac
6781 fi
6782
6783 : bad guess or no guess
6784 while $test "X$myhostname" = X ; do
6785         dflt=''
6786         rp="Please type the (one word) name of your host:"
6787         . ./myread
6788         myhostname="$ans"
6789 done
6790
6791 : translate upper to lower if necessary
6792 case "$myhostname" in
6793 *[A-Z]*)
6794         echo "(Normalizing case in your host name)"
6795         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6796         ;;
6797 esac
6798
6799 case "$myhostname" in
6800 *.*)
6801         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6802         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6803         echo "(Trimming domain name from host name--host name is now $myhostname)"
6804         ;;
6805 *) case "$mydomain" in
6806         '')
6807                 {
6808                         test "X$hostcat" = "Xypcat hosts" &&
6809                         ypmatch "$myhostname" hosts 2>/dev/null |\
6810                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6811                         $test -s hosts
6812                 } || {
6813                         test "X$hostcat" != "X" &&
6814                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6815                                         /[       ]$myhostname[  . ]/p" > hosts
6816                 }
6817                 tmp_re="[       . ]"
6818                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6819                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6820                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6821                         hosts | $sort | $uniq | \
6822                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6823                 case `$echo X$dflt` in
6824                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6825                         dflt=.
6826                         ;;
6827                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6828                         ;;
6829                 esac
6830                 case "$dflt" in
6831                 .)
6832                         tans=`./loc resolv.conf X /etc /usr/etc`
6833                         if $test -f "$tans"; then
6834                                 echo "(Attempting domain name extraction from $tans)"
6835                                 dflt=.`$sed -n -e 's/   / /g' \
6836                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6837                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6838                                 case "$dflt" in
6839                                 .) dflt=.`$sed -n -e 's/        / /g' \
6840                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6841                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6842                                         ;;
6843                                 esac
6844                         fi
6845                         ;;
6846                 esac
6847                 case "$dflt" in
6848                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6849                         dflt=.`sh -c domainname 2>/dev/null`
6850                         case "$dflt" in
6851                         '') dflt='.';;
6852                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6853                         esac
6854                         ;;
6855                 esac
6856                 case "$dflt" in
6857                 .) echo "(Lost all hope -- silly guess then)"
6858                         dflt='.uucp'
6859                         ;;
6860                 esac
6861                 $rm -f hosts
6862                 ;;
6863         *) dflt="$mydomain";;
6864         esac;;
6865 esac
6866 echo " "
6867 rp="What is your domain name?"
6868 . ./myread
6869 tans="$ans"
6870 case "$ans" in
6871 '') ;;
6872 .*) ;;
6873 *) tans=".$tans";;
6874 esac
6875 mydomain="$tans"
6876
6877 : translate upper to lower if necessary
6878 case "$mydomain" in
6879 *[A-Z]*)
6880         echo "(Normalizing case in your domain name)"
6881         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6882         ;;
6883 esac
6884
6885 : a little sanity check here
6886 case "$phostname" in
6887 '') ;;
6888 *)
6889         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6890         $myhostname$mydomain|$myhostname) ;;
6891         *)
6892                 case "$phostname" in
6893                 sed*)
6894                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6895                         ;;
6896                 *)
6897                         echo "(That doesn't agree with your $phostname command, by the way.)"
6898                         ;;
6899                 esac
6900         ;;
6901         esac
6902         ;;
6903 esac
6904
6905 $cat <<EOM
6906
6907 I need to get your e-mail address in Internet format if possible, i.e.
6908 something like user@host.domain. Please answer accurately since I have
6909 no easy means to double check it. The default value provided below
6910 is most probably close to reality but may not be valid from outside
6911 your organization...
6912
6913 EOM
6914 cont=x
6915 while test "$cont"; do
6916         case "$cf_email" in
6917         '') dflt="$cf_by@$myhostname$mydomain";;
6918         *) dflt="$cf_email";;
6919         esac
6920         rp='What is your e-mail address?'
6921         . ./myread
6922         cf_email="$ans"
6923         case "$cf_email" in
6924         *@*.*) cont='' ;;
6925         *)
6926                 rp='Address does not look like an Internet one.  Use it anyway?'
6927                 case "$fastread" in
6928                 yes) dflt=y ;;
6929                 *) dflt=n ;;
6930                 esac
6931                 . ./myread
6932                 case "$ans" in
6933                 y*) cont='' ;;
6934                 *) echo " " ;;
6935                 esac
6936                 ;;
6937         esac
6938 done
6939
6940 $cat <<EOM
6941
6942 If you or somebody else will be maintaining perl at your site, please
6943 fill in the correct e-mail address here so that they may be contacted
6944 if necessary. Currently, the "perlbug" program included with perl
6945 will send mail to this address in addition to perlbug@perl.com. You may
6946 enter "none" for no administrator.
6947
6948 EOM
6949 case "$perladmin" in
6950 '') dflt="$cf_email";;
6951 *) dflt="$perladmin";;
6952 esac
6953 rp='Perl administrator e-mail address'
6954 . ./myread
6955 perladmin="$ans"
6956
6957 : figure out how to guarantee perl startup
6958 case "$startperl" in
6959 '')
6960         case "$sharpbang" in
6961         *!)
6962                 $cat <<EOH
6963
6964 I can use the #! construct to start perl on your system. This will
6965 make startup of perl scripts faster, but may cause problems if you
6966 want to share those scripts and perl is not in a standard place
6967 ($binexp/perl) on all your platforms. The alternative is to force
6968 a shell by starting the script with a single ':' character.
6969
6970 EOH
6971                 dflt="$binexp/perl"
6972                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6973                 . ./myread
6974                 case "$ans" in
6975                 none)   startperl=": # use perl";;
6976                 *)      startperl="#!$ans"
6977                         if $test 30 -lt `echo "$ans" | wc -c`; then
6978                                 $cat >&4 <<EOM
6979
6980 WARNING:  Some systems limit the #! command to 32 characters.
6981 If you experience difficulty running Perl scripts with #!, try
6982 installing Perl in a directory with a shorter pathname.
6983
6984 EOM
6985                         fi ;;
6986                 esac
6987                 ;;
6988         *) startperl=": # use perl"
6989                 ;;
6990         esac
6991         ;;
6992 esac
6993 echo "I'll use $startperl to start perl scripts."
6994
6995 : figure best path for perl in scripts
6996 case "$perlpath" in
6997 '')
6998         perlpath="$binexp/perl"
6999         case "$startperl" in
7000         *!*) ;;
7001         *)
7002                 $cat <<EOH
7003
7004 I will use the "eval 'exec'" idiom to start Perl on your system.
7005 I can use the full path of your Perl binary for this purpose, but
7006 doing so may cause problems if you want to share those scripts and
7007 Perl is not always in a standard place ($binexp/perl).
7008
7009 EOH
7010                 dflt="$binexp/perl"
7011                 rp="What path shall I use in \"eval 'exec'\"?"
7012                 . ./myread
7013                 perlpath="$ans"
7014                 ;;
7015         esac
7016         ;;
7017 esac
7018 case "$startperl" in
7019 *!*)    ;;
7020 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7021 esac
7022
7023 : determine where public executable scripts go
7024 set scriptdir scriptdir
7025 eval $prefixit
7026 case "$scriptdir" in
7027 '')
7028         dflt="$bin"
7029         : guess some guesses
7030         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7031         $test -d /usr/share/bin     && dflt=/usr/share/bin
7032         $test -d /usr/local/script  && dflt=/usr/local/script
7033         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7034         $test -d $prefixexp/script  && dflt=$prefixexp/script
7035         set dflt
7036         eval $prefixup
7037         ;;
7038 *)  dflt="$scriptdir"
7039         ;;
7040 esac
7041 $cat <<EOM
7042  
7043 Some installations have a separate directory just for executable scripts so
7044 that they can mount it across multiple architectures but keep the scripts in
7045 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7046 Or you might just lump your scripts in with all your other executables.
7047  
7048 EOM
7049 fn=d~
7050 rp='Where do you keep publicly executable scripts?'
7051 . ./getfile
7052 if $test "X$ansexp" != "X$scriptdirexp"; then
7053         installscript=''
7054 fi
7055 scriptdir="$ans"
7056 scriptdirexp="$ansexp"
7057 : Change installation prefix, if necessary.
7058 if $test X"$prefix" != X"$installprefix"; then
7059         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7060 else
7061         installscript="$scriptdirexp"
7062 fi
7063
7064 : determine where site specific architecture-dependent libraries go.
7065 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7066 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7067 : sitelib may have an optional trailing /share.
7068 case "$sitearch" in
7069 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7070         dflt="$dflt/$archname"
7071         ;;
7072 *)      dflt="$sitearch"
7073         ;;
7074 esac
7075 set sitearch sitearch none
7076 eval $prefixit
7077 $cat <<EOM
7078
7079 The installation process will also create a directory for
7080 architecture-dependent site-specific extensions and modules.
7081
7082 EOM
7083 fn=d~+
7084 rp='Pathname for the site-specific architecture-dependent library files?'
7085 . ./getfile
7086 sitearch="$ans"
7087 sitearchexp="$ansexp"
7088 : Change installation prefix, if necessary.
7089 if $test X"$prefix" != X"$installprefix"; then
7090         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7091 else
7092         installsitearch="$sitearchexp"
7093 fi
7094
7095 : determine where add-on public executables go
7096 case "$sitebin" in
7097 '')     dflt=$siteprefix/bin ;;
7098 *)      dflt=$sitebin ;;
7099 esac
7100 fn=d~
7101 rp='Pathname where the add-on public executables should be installed?'
7102 . ./getfile
7103 sitebin="$ans"
7104 sitebinexp="$ansexp"
7105 : Change installation prefix, if necessary.
7106 if $test X"$prefix" != X"$installprefix"; then
7107         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7108 else
7109         installsitebin="$sitebinexp"
7110 fi
7111
7112 : see if sqrtl exists
7113 set sqrtl d_sqrtl
7114 eval $inlibc
7115
7116 case "$ccflags" in
7117 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7118 esac
7119
7120 case "$uselongdouble" in
7121 $define|true|[yY]*)     dflt='y';;
7122 *) dflt='n';;
7123 esac
7124 cat <<EOM
7125
7126 Perl can be built to take advantage of long doubles which
7127 (if available) may give more accuracy and range for floating point numbers.
7128
7129 If this doesn't make any sense to you, just accept the default '$dflt'.
7130 EOM
7131 rp='Try to use long doubles if available?'
7132 . ./myread
7133 case "$ans" in
7134 y|Y)    val="$define"   ;;
7135 *)      val="$undef"    ;;
7136 esac
7137 set uselongdouble
7138 eval $setvar
7139
7140 case "$uselongdouble" in
7141 true|[yY]*) uselongdouble="$define" ;;
7142 esac
7143
7144 case "$uselongdouble" in
7145 $define)
7146 : Look for a hint-file generated 'call-back-unit'.  If the
7147 : user has specified that long doubles should be used,
7148 : we may need to set or change some other defaults.
7149         if $test -f uselongdouble.cbu; then
7150                 echo "Your platform has some specific hints for long doubles, using them..."
7151                 . ./uselongdouble.cbu
7152         else
7153                 $cat <<EOM
7154 (Your platform doesn't have any specific hints for long doubles.)
7155 EOM
7156         fi
7157         ;;
7158 esac
7159
7160 case "$uselongdouble:$d_sqrtl" in
7161 $define:$undef)
7162                 $cat <<EOM >&4
7163
7164 You requested the use of long doubles but you do not seem to have
7165 the mathematic functions for long doubles.  I'm disabling the use
7166 of long doubles.
7167 EOM
7168         uselongdouble=$undef
7169         ;;
7170 esac
7171
7172 case "$useperlio" in
7173 $define|true|[yY]*)     dflt='y';;
7174 *) dflt='n';;
7175 esac
7176 cat <<EOM
7177
7178 Previous version of $package used the standard IO mechanisms as defined
7179 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7180 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7181 the default.  This abstraction layer can use AT&T's sfio (if you already
7182 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7183 problems with some extension modules.  Using PerlIO with stdio is safe,
7184 but it is slower than plain stdio and therefore is not the default.
7185
7186 If this doesn't make any sense to you, just accept the default '$dflt'.
7187 EOM
7188 rp='Use the experimental PerlIO abstraction layer?'
7189 . ./myread
7190 case "$ans" in
7191 y|Y) 
7192         val="$define"
7193         ;;     
7194 *)      
7195         echo "Ok, doing things the stdio way"
7196         val="$undef"
7197         ;;
7198 esac
7199 set useperlio
7200 eval $setvar 
7201
7202 case "$vendorprefix" in
7203 '')     d_vendorbin="$undef"
7204         vendorbin=''
7205         vendorbinexp=''
7206         ;;
7207 *)      d_vendorbin="$define"
7208         : determine where vendor-supplied executables go.
7209         case "$vendorbin" in
7210         '') dflt=$vendorprefix/bin ;;
7211         *)      dflt="$vendorbin" ;;
7212         esac
7213         fn=d~+
7214         rp='Pathname for the vendor-supplied executables directory?'
7215         . ./getfile
7216         vendorbin="$ans"
7217         vendorbinexp="$ansexp"
7218         ;;
7219 esac
7220 : Change installation prefix, if necessary.
7221 if $test X"$prefix" != X"$installprefix"; then
7222         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7223 else
7224         installvendorbin="$vendorbinexp"
7225 fi
7226
7227 : check for length of double
7228 echo " "
7229 case "$doublesize" in
7230 '')
7231         echo "Checking to see how big your double precision numbers are..." >&4
7232         $cat >try.c <<'EOCP'
7233 #include <stdio.h>
7234 int main()
7235 {
7236     printf("%d\n", (int)sizeof(double));
7237     exit(0);
7238 }
7239 EOCP
7240         set try
7241         if eval $compile_ok; then
7242                 doublesize=`./try`
7243                 echo "Your double is $doublesize bytes long."
7244         else
7245                 dflt='8'
7246                 echo "(I can't seem to compile the test program.  Guessing...)"
7247                 rp="What is the size of a double precision number (in bytes)?"
7248                 . ./myread
7249                 doublesize="$ans"
7250         fi
7251         ;;
7252 esac
7253 $rm -f try.c try
7254
7255 : check for long doubles
7256 echo " "
7257 echo "Checking to see if you have long double..." >&4
7258 echo 'int main() { long double x = 7.0; }' > try.c
7259 set try
7260 if eval $compile; then
7261         val="$define"
7262         echo "You have long double."
7263 else
7264         val="$undef"
7265         echo "You do not have long double."
7266 fi
7267 $rm try.*
7268 set d_longdbl
7269 eval $setvar
7270
7271 : check for length of long double
7272 case "${d_longdbl}${longdblsize}" in
7273 $define)
7274         echo " "
7275         echo "Checking to see how big your long doubles are..." >&4
7276         $cat >try.c <<'EOCP'
7277 #include <stdio.h>
7278 int main()
7279 {
7280         printf("%d\n", sizeof(long double));
7281 }
7282 EOCP
7283         set try
7284         set try
7285         if eval $compile; then
7286                 longdblsize=`./try$exe_ext`
7287                 echo "Your long doubles are $longdblsize bytes long."
7288         else
7289                 dflt='8'
7290                 echo " "
7291                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7292                 rp="What is the size of a long double (in bytes)?"
7293                 . ./myread
7294                 longdblsize="$ans"
7295         fi
7296         if $test "X$doublesize" = "X$longdblsize"; then
7297                 echo "(That isn't any different from an ordinary double.)"
7298         fi      
7299         ;;
7300 esac
7301 $rm -f try.* try
7302
7303 : Check how to convert floats to strings.
7304 if test "X$d_Gconvert" = X; then
7305         echo " "
7306         echo "Checking for an efficient way to convert floats to strings."
7307         $cat >try.c <<EOP
7308 #ifdef TRY_gconvert
7309 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7310 char *myname = "gconvert";
7311 #endif
7312 #ifdef TRY_gcvt
7313 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7314 char *myname = "gcvt";
7315 #endif
7316 #ifdef TRY_qgcvt
7317 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7318 char *myname = "qgcvt";
7319 #define DOUBLETYPE long double
7320 #endif
7321 #ifdef TRY_sprintf
7322 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7323 char *myname = "sprintf";
7324 #endif
7325
7326 #ifndef DOUBLETYPE
7327 #define DOUBLETYPE double
7328 #endif
7329
7330 #include <stdio.h>
7331
7332 #define I_STDLIB $i_stdlib
7333 #ifdef I_STDLIB
7334 #include <stdlib.h>
7335 #endif
7336
7337 int
7338 checkit(expect, got)
7339 char *expect;
7340 char *got;
7341 {
7342     if (strcmp(expect, got)) {
7343                 printf("%s oddity:  Expected %s, got %s\n",
7344                         myname, expect, got);
7345                 exit(1);
7346         }
7347 }
7348
7349 int main()
7350
7351         char buf[64]; 
7352         buf[63] = '\0';
7353
7354         /* This must be 1st test on (which?) platform */
7355         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7356         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7357         checkit("0.1", buf);
7358
7359         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7360         checkit("1", buf);
7361
7362         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7363         checkit("0", buf);
7364
7365         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7366         checkit("-1", buf);
7367
7368         /* Some Linux gcvt's give 1.e+5 here. */
7369         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7370         checkit("100000", buf);
7371         
7372         /* Some Linux gcvt's give -1.e+5 here. */
7373         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7374         checkit("-100000", buf);
7375
7376         exit(0);
7377 }
7378 EOP
7379         case "$d_Gconvert" in
7380         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7381         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7382         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7383         *) xxx_list='gconvert gcvt sprintf' ;;
7384         esac
7385
7386         case "$d_longdbl$uselongdouble" in
7387         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7388         esac
7389
7390         for xxx_convert in $xxx_list; do
7391                 echo "Trying $xxx_convert..."
7392                 $rm -f try try$_o
7393                 set try -DTRY_$xxx_convert
7394                 if eval $compile; then
7395                         echo "$xxx_convert() found." >&4
7396                         if ./try; then
7397                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7398                                 break;
7399                         else
7400                                 echo "...But $xxx_convert didn't work as I expected."
7401                         fi
7402                 else
7403                         echo "$xxx_convert NOT found." >&4
7404                 fi
7405         done
7406                 
7407         case "$xxx_convert" in
7408         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7409         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7410         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7411         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7412         esac
7413 fi
7414
7415 echo " "
7416
7417 if $test X"$d_longdbl" = X"$define"; then
7418
7419 echo "Checking how to print long doubles..." >&4
7420
7421 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7422         $cat >try.c <<'EOCP'
7423 #include <sys/types.h>
7424 #include <stdio.h>
7425 int main() {
7426   double d = 123.456;
7427   printf("%.3f\n", d);
7428 }
7429 EOCP
7430         set try
7431         if eval $compile; then
7432                 yyy=`./try$exe_ext`
7433                 case "$yyy" in
7434                 123.456)
7435                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7436                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7437                         echo "We will use %f."
7438                         ;;
7439                 esac
7440         fi
7441 fi
7442
7443 if $test X"$sPRIfldbl" = X; then
7444         $cat >try.c <<'EOCP'
7445 #include <sys/types.h>
7446 #include <stdio.h>
7447 int main() {
7448   long double d = 123.456;
7449   printf("%.3llf\n", d);
7450 }
7451 EOCP
7452         set try
7453         if eval $compile; then
7454                 yyy=`./try$exe_ext`
7455                 case "$yyy" in
7456                 123.456)
7457                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7458                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7459                         echo "We will use %llf."
7460                         ;;
7461                 esac
7462         fi
7463 fi
7464
7465 if $test X"$sPRIfldbl" = X; then
7466         $cat >try.c <<'EOCP'
7467 #include <sys/types.h>
7468 #include <stdio.h>
7469 int main() {
7470   long double d = 123.456;
7471   printf("%.3Lf\n", d);
7472 }
7473 EOCP
7474         set try
7475         if eval $compile; then
7476                 yyy=`./try$exe_ext`
7477                 case "$yyy" in
7478                 123.456)
7479                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7480                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7481                         echo "We will use %Lf."
7482                         ;;
7483                 esac
7484         fi
7485 fi
7486
7487 if $test X"$sPRIfldbl" = X; then
7488         $cat >try.c <<'EOCP'
7489 #include <sys/types.h>
7490 #include <stdio.h>
7491 int main() {
7492   long double d = 123.456;
7493   printf("%.3lf\n", d);
7494 }
7495 EOCP
7496         set try
7497         if eval $compile; then
7498                 yyy=`./try$exe_ext`
7499                 case "$yyy" in
7500                 123.456)
7501                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7502                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7503                         echo "We will use %lf."
7504                         ;;
7505                 esac
7506         fi
7507 fi
7508
7509 if $test X"$sPRIfldbl" = X; then
7510         echo "Cannot figure out how to print long doubles." >&4
7511 fi
7512
7513 $rm -f try try.*
7514
7515 fi # d_longdbl
7516
7517 case "$sPRIfldbl" in
7518 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7519         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7520         ;;
7521 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7522         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7523         ;;
7524 esac
7525
7526 : Initialize h_fcntl
7527 h_fcntl=false
7528
7529 : Initialize h_sysfile
7530 h_sysfile=false
7531
7532 : access call always available on UNIX
7533 set access d_access
7534 eval $inlibc
7535
7536 : locate the flags for 'access()'
7537 case "$d_access" in
7538 "$define")
7539         echo " "
7540         $cat >access.c <<'EOCP'
7541 #include <sys/types.h>
7542 #ifdef I_FCNTL
7543 #include <fcntl.h>
7544 #endif
7545 #ifdef I_SYS_FILE
7546 #include <sys/file.h>
7547 #endif
7548 #ifdef I_UNISTD
7549 #include <unistd.h>
7550 #endif
7551 int main() {
7552         exit(R_OK);
7553 }
7554 EOCP
7555         : check sys/file.h first, no particular reason here
7556         if $test `./findhdr sys/file.h` && \
7557                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7558                 h_sysfile=true;
7559                 echo "<sys/file.h> defines the *_OK access constants." >&4
7560         elif $test `./findhdr fcntl.h` && \
7561                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7562                 h_fcntl=true;
7563                 echo "<fcntl.h> defines the *_OK access constants." >&4
7564         elif $test `./findhdr unistd.h` && \
7565                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7566                 echo "<unistd.h> defines the *_OK access constants." >&4
7567         else
7568                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7569         fi
7570         ;;
7571 esac
7572 $rm -f access*
7573
7574 : see if accessx exists
7575 set accessx d_accessx
7576 eval $inlibc
7577
7578 : see if alarm exists
7579 set alarm d_alarm
7580 eval $inlibc
7581
7582 : see if atolf exists
7583 set atolf d_atolf
7584 eval $inlibc
7585
7586 : see if atoll exists
7587 set atoll d_atoll
7588 eval $inlibc
7589
7590 : Look for GNU-cc style attribute checking
7591 echo " "
7592 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7593 $cat >attrib.c <<'EOCP'
7594 #include <stdio.h>
7595 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7596 EOCP
7597 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7598         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7599                 echo "Your C compiler doesn't fully support __attribute__."
7600                 val="$undef"
7601         else
7602                 echo "Your C compiler supports __attribute__."
7603                 val="$define"
7604         fi
7605 else
7606         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7607         val="$undef"
7608 fi
7609 set d_attribut
7610 eval $setvar
7611 $rm -f attrib*
7612
7613 : see if bcmp exists
7614 set bcmp d_bcmp
7615 eval $inlibc
7616
7617 : see if bcopy exists
7618 set bcopy d_bcopy
7619 eval $inlibc
7620
7621 : see if this is a unistd.h system
7622 set unistd.h i_unistd
7623 eval $inhdr
7624
7625 : see if getpgrp exists
7626 set getpgrp d_getpgrp
7627 eval $inlibc
7628
7629 case "$d_getpgrp" in
7630 "$define")
7631         echo " "
7632         echo "Checking to see which flavor of getpgrp is in use..."
7633         $cat >set.c <<EOP
7634 #$i_unistd I_UNISTD
7635 #include <sys/types.h>
7636 #ifdef I_UNISTD
7637 #  include <unistd.h>
7638 #endif
7639 int main()
7640 {
7641         if (getuid() == 0) {
7642                 printf("(I see you are running Configure as super-user...)\n");
7643                 setuid(1);
7644         }
7645 #ifdef TRY_BSD_PGRP
7646         if (getpgrp(1) == 0)
7647                 exit(0);
7648 #else
7649         if (getpgrp() > 0)
7650                 exit(0);
7651 #endif
7652         exit(1);
7653 }
7654 EOP
7655         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7656                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7657                 val="$define"
7658         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7659                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7660                 val="$undef"
7661         else
7662                 echo "I can't seem to compile and run the test program."
7663                 if ./usg; then
7664                         xxx="a USG one, i.e. you use getpgrp()."
7665                 else
7666                         # SVR4 systems can appear rather BSD-ish.
7667                         case "$i_unistd" in
7668                         $undef)
7669                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7670                                 val="$define"
7671                                 ;;
7672                         $define)
7673                                 xxx="probably a USG one, i.e. you use getpgrp()."
7674                                 val="$undef"
7675                                 ;;
7676                         esac
7677                 fi
7678                 echo "Assuming your getpgrp is $xxx" >&4
7679         fi
7680         ;;
7681 *) val="$undef";;
7682 esac
7683 set d_bsdgetpgrp
7684 eval $setvar
7685 $rm -f set set.c
7686
7687 : see if setpgrp exists
7688 set setpgrp d_setpgrp
7689 eval $inlibc
7690
7691 case "$d_setpgrp" in
7692 "$define")
7693         echo " "
7694         echo "Checking to see which flavor of setpgrp is in use..."
7695         $cat >set.c <<EOP
7696 #$i_unistd I_UNISTD
7697 #include <sys/types.h>
7698 #ifdef I_UNISTD
7699 #  include <unistd.h>
7700 #endif
7701 int main()
7702 {
7703         if (getuid() == 0) {
7704                 printf("(I see you are running Configure as super-user...)\n");
7705                 setuid(1);
7706         }
7707 #ifdef TRY_BSD_PGRP
7708         if (-1 == setpgrp(1, 1))
7709                 exit(0);
7710 #else
7711         if (setpgrp() != -1)
7712                 exit(0);
7713 #endif
7714         exit(1);
7715 }
7716 EOP
7717         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7718                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7719                 val="$define"
7720         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7721                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7722                 val="$undef"
7723         else
7724                 echo "(I can't seem to compile and run the test program.)"
7725                 if ./usg; then
7726                         xxx="a USG one, i.e. you use setpgrp()."
7727                 else
7728                         # SVR4 systems can appear rather BSD-ish.
7729                         case "$i_unistd" in
7730                         $undef)
7731                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7732                                 val="$define"
7733                                 ;;
7734                         $define)
7735                                 xxx="probably a USG one, i.e. you use setpgrp()."
7736                                 val="$undef"
7737                                 ;;
7738                         esac
7739                 fi
7740                 echo "Assuming your setpgrp is $xxx" >&4
7741         fi
7742         ;;
7743 *) val="$undef";;
7744 esac
7745 set d_bsdsetpgrp
7746 eval $setvar
7747 $rm -f set set.c
7748 : see if bzero exists
7749 set bzero d_bzero
7750 eval $inlibc
7751
7752 : see if signal is declared as pointer to function returning int or void
7753 echo " "
7754 xxx=`./findhdr signal.h`
7755 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7756 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7757         echo "You have int (*signal())() instead of void." >&4
7758         val="$undef"
7759 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7760         echo "You have void (*signal())()." >&4
7761         val="$define"
7762 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7763         echo "You have int (*signal())() instead of void." >&4
7764         val="$undef"
7765 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7766         echo "You have void (*signal())()." >&4
7767         val="$define"
7768 else
7769         case "$d_voidsig" in
7770         '')
7771         echo "I can't determine whether signal handler returns void or int..." >&4
7772                 dflt=void
7773                 rp="What type does your signal handler return?"
7774                 . ./myread
7775                 case "$ans" in
7776                 v*) val="$define";;
7777                 *) val="$undef";;
7778                 esac;;
7779         "$define")
7780                 echo "As you already told me, signal handler returns void." >&4
7781                 val="$define"
7782                 ;;
7783         *)      echo "As you already told me, signal handler returns int." >&4
7784                 val="$undef"
7785                 ;;
7786         esac
7787 fi
7788 set d_voidsig
7789 eval $setvar
7790 case "$d_voidsig" in
7791 "$define") signal_t="void";;
7792 *) signal_t="int";;
7793 esac
7794 $rm -f $$.tmp
7795
7796 : check for ability to cast large floats to 32-bit ints.
7797 echo " "
7798 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7799 if $test "$intsize" -ge 4; then
7800         xxx=int
7801 else
7802         xxx=long
7803 fi
7804 $cat >try.c <<EOCP
7805 #include <stdio.h>
7806 #include <sys/types.h>
7807 #include <signal.h>
7808 $signal_t blech(s) int s; { exit(3); }
7809 int main()
7810 {
7811         $xxx i32;
7812         double f, g;
7813         int result = 0;
7814         char str[16];
7815         signal(SIGFPE, blech);
7816
7817         /* Don't let compiler optimize the test away.  Store the number 
7818            in a writable string for gcc to pass to sscanf under HP/UX.
7819         */
7820         sprintf(str, "2147483647");
7821         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7822         g = 10 * f;
7823         i32  = ($xxx) g;
7824
7825         /* x86 processors will probably give 0x8000 0000, which is a
7826        sign change.  We don't want that.  We want to mimic SPARC
7827            behavior here, which is to preserve the sign and give
7828            back 0x7fff ffff.
7829         */
7830         if (i32 != ($xxx) f)
7831                 result |= 1;
7832         exit(result);
7833 }
7834 EOCP
7835 set try
7836 if eval $compile_ok; then
7837         ./try
7838         yyy=$?
7839 else
7840         echo "(I can't seem to compile the test program--assuming it can't)"
7841         yyy=1
7842 fi
7843 case "$yyy" in
7844 0)      val="$define"
7845         echo "Yup, it can."
7846         ;;
7847 *)      val="$undef"
7848         echo "Nope, it can't."
7849         ;;
7850 esac
7851 set d_casti32
7852 eval $setvar
7853 $rm -f try try.*
7854
7855 : check for ability to cast negative floats to unsigned
7856 echo " "
7857 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7858 $cat >try.c <<EOCP
7859 #include <stdio.h>
7860 #include <sys/types.h>
7861 #include <signal.h>
7862 $signal_t blech(s) int s; { exit(7); }
7863 $signal_t blech_in_list(s) int s; { exit(4); }
7864 unsigned long dummy_long(p) unsigned long p; { return p; }
7865 unsigned int dummy_int(p) unsigned int p; { return p; }
7866 unsigned short dummy_short(p) unsigned short p; { return p; }
7867 int main()
7868 {
7869         double f;
7870         unsigned long along;
7871         unsigned int aint;
7872         unsigned short ashort;
7873         int result = 0;
7874         char str[16];
7875         
7876         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7877            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7878            optimized the whole file away
7879         */
7880         /* Store the number in a writable string for gcc to pass to 
7881            sscanf under HP/UX.
7882         */
7883         sprintf(str, "-123");
7884         sscanf(str, "%lf", &f);  /* f = -123.; */
7885
7886         signal(SIGFPE, blech);
7887         along = (unsigned long)f;
7888         aint = (unsigned int)f;
7889         ashort = (unsigned short)f;
7890         if (along != (unsigned long)-123)
7891                 result |= 1;
7892         if (aint != (unsigned int)-123)
7893                 result |= 1;
7894         if (ashort != (unsigned short)-123)
7895                 result |= 1;
7896         sprintf(str, "1073741824.");
7897         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7898         f = f + f;
7899         along = 0;
7900         along = (unsigned long)f;
7901         if (along != 0x80000000)
7902                 result |= 2;
7903         f -= 1.;
7904         along = 0;
7905         along = (unsigned long)f;
7906         if (along != 0x7fffffff)
7907                 result |= 1;
7908         f += 2.;
7909         along = 0;
7910         along = (unsigned long)f;
7911         if (along != 0x80000001)
7912                 result |= 2;
7913         if (result)
7914                 exit(result);
7915         signal(SIGFPE, blech_in_list);
7916         sprintf(str, "123.");
7917         sscanf(str, "%lf", &f);  /* f = 123.; */
7918         along = dummy_long((unsigned long)f);
7919         aint = dummy_int((unsigned int)f);
7920         ashort = dummy_short((unsigned short)f);
7921         if (along != (unsigned long)123)
7922                 result |= 4;
7923         if (aint != (unsigned int)123)
7924                 result |= 4;
7925         if (ashort != (unsigned short)123)
7926                 result |= 4;
7927         exit(result);
7928
7929 }
7930 EOCP
7931 set try
7932 if eval $compile_ok; then
7933         ./try
7934         castflags=$?
7935 else
7936         echo "(I can't seem to compile the test program--assuming it can't)"
7937         castflags=7
7938 fi
7939 case "$castflags" in
7940 0)      val="$define"
7941         echo "Yup, it can."
7942         ;;
7943 *)      val="$undef"
7944         echo "Nope, it can't."
7945         ;;
7946 esac
7947 set d_castneg
7948 eval $setvar
7949 $rm -f try.*
7950
7951 : see if vprintf exists
7952 echo " "
7953 if set vprintf val -f d_vprintf; eval $csym; $val; then
7954         echo 'vprintf() found.' >&4
7955         val="$define"
7956         $cat >vprintf.c <<'EOF'
7957 #include <varargs.h>
7958
7959 int main() { xxx("foo"); }
7960
7961 xxx(va_alist)
7962 va_dcl
7963 {
7964         va_list args;
7965         char buf[10];
7966
7967         va_start(args);
7968         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7969 }
7970 EOF
7971         set vprintf
7972         if eval $compile && ./vprintf; then
7973                 echo "Your vsprintf() returns (int)." >&4
7974                 val2="$undef"
7975         else
7976                 echo "Your vsprintf() returns (char*)." >&4
7977                 val2="$define"
7978         fi
7979 else
7980         echo 'vprintf() NOT found.' >&4
7981                 val="$undef"
7982                 val2="$undef"
7983 fi
7984 set d_vprintf
7985 eval $setvar
7986 val=$val2
7987 set d_charvspr
7988 eval $setvar
7989
7990 : see if chown exists
7991 set chown d_chown
7992 eval $inlibc
7993
7994 : see if chroot exists
7995 set chroot d_chroot
7996 eval $inlibc
7997
7998 : see if chsize exists
7999 set chsize d_chsize
8000 eval $inlibc
8001
8002 : check for const keyword
8003 echo " "
8004 echo 'Checking to see if your C compiler knows about "const"...' >&4
8005 $cat >const.c <<'EOCP'
8006 typedef struct spug { int drokk; } spug;
8007 int main()
8008 {
8009         const char *foo;
8010         const spug y;
8011 }
8012 EOCP
8013 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8014         val="$define"
8015         echo "Yup, it does."
8016 else
8017         val="$undef"
8018         echo "Nope, it doesn't."
8019 fi
8020 set d_const
8021 eval $setvar
8022
8023 : see if crypt exists
8024 echo " "
8025 if set crypt val -f d_crypt; eval $csym; $val; then
8026         echo 'crypt() found.' >&4
8027         val="$define"
8028         cryptlib=''
8029 else
8030         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8031         if $test -z "$cryptlib"; then
8032                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8033         else
8034                 cryptlib=-lcrypt
8035         fi
8036         if $test -z "$cryptlib"; then
8037                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8038         else
8039                 cryptlib=-lcrypt
8040         fi
8041         if $test -z "$cryptlib"; then
8042                 cryptlib=`./loc libcrypt$_a "" $libpth`
8043         else
8044                 cryptlib=-lcrypt
8045         fi
8046         if $test -z "$cryptlib"; then
8047                 echo 'crypt() NOT found.' >&4
8048                 val="$undef"
8049         else
8050                 val="$define"
8051         fi
8052 fi
8053 set d_crypt
8054 eval $setvar
8055
8056 : get csh whereabouts
8057 case "$csh" in
8058 'csh') val="$undef" ;;
8059 *) val="$define" ;;
8060 esac
8061 set d_csh
8062 eval $setvar
8063 : Respect a hint or command line value for full_csh.
8064 case "$full_csh" in
8065 '') full_csh=$csh ;;
8066 esac
8067
8068 : see if cuserid exists
8069 set cuserid d_cuserid
8070 eval $inlibc
8071
8072 : see if this is a limits.h system
8073 set limits.h i_limits
8074 eval $inhdr
8075
8076 : see if this is a float.h system
8077 set float.h i_float
8078 eval $inhdr
8079
8080 : See if number of significant digits in a double precision number is known
8081 echo " "
8082 $cat >dbl_dig.c <<EOM
8083 #$i_limits I_LIMITS
8084 #$i_float I_FLOAT
8085 #ifdef I_LIMITS
8086 #include <limits.h>
8087 #endif
8088 #ifdef I_FLOAT
8089 #include <float.h>
8090 #endif
8091 #ifdef DBL_DIG
8092 printf("Contains DBL_DIG");
8093 #endif
8094 EOM
8095 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8096 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8097         echo "DBL_DIG found." >&4
8098         val="$define"
8099 else
8100         echo "DBL_DIG NOT found." >&4
8101         val="$undef"
8102 fi
8103 $rm -f dbl_dig.?
8104 set d_dbl_dig
8105 eval $setvar
8106
8107 : see if difftime exists
8108 set difftime d_difftime
8109 eval $inlibc
8110
8111 : see if this is a dirent system
8112 echo " "
8113 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8114         val="$define"
8115         echo "<dirent.h> found." >&4
8116 else
8117         val="$undef"
8118         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8119                 echo "<sys/dir.h> found." >&4
8120                 echo " "
8121         else
8122                 xinc=`./findhdr sys/ndir.h`
8123         fi
8124         echo "<dirent.h> NOT found." >&4
8125 fi
8126 set i_dirent
8127 eval $setvar
8128
8129 : Look for type of directory structure.
8130 echo " "
8131 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8132
8133 case "$direntrytype" in
8134 ''|' ')
8135         case "$i_dirent" in
8136         $define) guess1='struct dirent' ;;
8137         *) guess1='struct direct'  ;;
8138         esac
8139         ;;
8140 *)      guess1="$direntrytype"
8141         ;;
8142 esac
8143
8144 case "$guess1" in
8145 'struct dirent') guess2='struct direct' ;;
8146 *) guess2='struct dirent' ;;
8147 esac
8148                 
8149 if $contains "$guess1" try.c >/dev/null 2>&1; then
8150         direntrytype="$guess1"
8151         echo "Your directory entries are $direntrytype." >&4
8152 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8153         direntrytype="$guess2"
8154         echo "Your directory entries seem to be $direntrytype." >&4
8155 else
8156         echo "I don't recognize your system's directory entries." >&4
8157         rp="What type is used for directory entries on this system?"
8158         dflt="$guess1"
8159         . ./myread
8160         direntrytype="$ans"
8161 fi
8162 $rm -f try.c
8163
8164
8165 : see if the directory entry stores field length
8166 echo " "
8167 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8168 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8169         echo "Good, your directory entry keeps length information in d_namlen." >&4
8170         val="$define"
8171 else
8172         echo "Your directory entry does not know about the d_namlen field." >&4
8173         val="$undef"
8174 fi
8175 set d_dirnamlen
8176 eval $setvar
8177 $rm -f try.c
8178
8179 : see if dlerror exists
8180 xxx_runnm="$runnm"
8181 runnm=false
8182 set dlerror d_dlerror
8183 eval $inlibc
8184 runnm="$xxx_runnm"
8185
8186 : see if dlfcn is available
8187 set dlfcn.h i_dlfcn
8188 eval $inhdr
8189
8190 case "$usedl" in
8191 $define|y|true)
8192         $cat << EOM
8193
8194 On a few systems, the dynamically loaded modules that perl generates and uses
8195 will need a different extension than shared libs. The default will probably
8196 be appropriate.
8197
8198 EOM
8199         case "$dlext" in
8200         '')     dflt="$so" ;;
8201         *)      dflt="$dlext" ;;
8202         esac
8203         rp='What is the extension of dynamically loaded modules'
8204         . ./myread
8205         dlext="$ans"
8206         ;;
8207 *)
8208         dlext="none"
8209         ;;
8210 esac
8211
8212 : Check if dlsym need a leading underscore
8213 echo " "
8214 val="$undef"
8215
8216 case "$dlsrc" in
8217 dl_dlopen.xs)
8218         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8219         $cat >dyna.c <<'EOM'
8220 fred () { }
8221 EOM
8222
8223 $cat >fred.c<<EOM
8224
8225 #include <stdio.h>
8226 #$i_dlfcn I_DLFCN
8227 #ifdef I_DLFCN
8228 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8229 #else
8230 #include <sys/types.h>
8231 #include <nlist.h>
8232 #include <link.h>
8233 #endif
8234
8235 extern int fred() ;
8236
8237 int main()
8238 {
8239     void * handle ;
8240     void * symbol ;
8241 #ifndef RTLD_LAZY
8242     int mode = 1 ;
8243 #else
8244     int mode = RTLD_LAZY ;
8245 #endif
8246     handle = dlopen("./dyna.$dlext", mode) ;
8247     if (handle == NULL) {
8248         printf ("1\n") ;
8249         fflush (stdout) ;
8250         exit(0);
8251     }
8252     symbol = dlsym(handle, "fred") ;
8253     if (symbol == NULL) {
8254         /* try putting a leading underscore */
8255         symbol = dlsym(handle, "_fred") ;
8256         if (symbol == NULL) {
8257             printf ("2\n") ;
8258             fflush (stdout) ;
8259             exit(0);
8260         }
8261         printf ("3\n") ;
8262     }
8263     else
8264         printf ("4\n") ;
8265     fflush (stdout) ;
8266     exit(0);
8267 }
8268 EOM
8269         : Call the object file tmp-dyna.o in case dlext=o.
8270         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8271                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8272                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8273                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8274                 xxx=`./fred`
8275                 case $xxx in
8276                 1)      echo "Test program failed using dlopen." >&4
8277                         echo "Perhaps you should not use dynamic loading." >&4;;
8278                 2)      echo "Test program failed using dlsym." >&4
8279                         echo "Perhaps you should not use dynamic loading." >&4;;
8280                 3)      echo "dlsym needs a leading underscore" >&4
8281                         val="$define" ;;
8282                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8283                 esac
8284         else
8285                 echo "I can't compile and run the test program." >&4
8286                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8287         fi
8288         ;;
8289 esac
8290                 
8291 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8292
8293 set d_dlsymun
8294 eval $setvar
8295
8296 hasproto='varname=$1; func=$2; shift; shift;
8297 while $test $# -ge 2; do
8298         case "$1" in
8299         $define) echo "#include <$2>";;
8300         esac ;
8301     shift 2;
8302 done > try.c;
8303 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8304 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8305         echo "$func() prototype found.";
8306         val="$define";
8307 else
8308         echo "$func() prototype NOT found.";
8309         val="$undef";
8310 fi;
8311 set $varname;
8312 eval $setvar;
8313 $rm -f try.c tryout.c'
8314
8315 : see if prototype for drand48 is available
8316 echo " "
8317 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8318 eval $hasproto
8319
8320 : see if dup2 exists
8321 set dup2 d_dup2
8322 eval $inlibc
8323
8324 : see if eaccess exists
8325 set eaccess d_eaccess
8326 eval $inlibc
8327
8328 : see if endgrent exists
8329 set endgrent d_endgrent
8330 eval $inlibc
8331
8332 : see if endhostent exists
8333 set endhostent d_endhent
8334 eval $inlibc
8335
8336 : see if endnetent exists
8337 set endnetent d_endnent
8338 eval $inlibc
8339
8340 : see if endprotoent exists
8341 set endprotoent d_endpent
8342 eval $inlibc
8343
8344 : see if endpwent exists
8345 set endpwent d_endpwent
8346 eval $inlibc
8347
8348 : see if endservent exists
8349 set endservent d_endsent
8350 eval $inlibc
8351
8352 : see if endspent exists
8353 set endspent d_endspent
8354 eval $inlibc
8355
8356 : Locate the flags for 'open()'
8357 echo " "
8358 $cat >open3.c <<'EOCP'
8359 #include <sys/types.h>
8360 #ifdef I_FCNTL
8361 #include <fcntl.h>
8362 #endif
8363 #ifdef I_SYS_FILE
8364 #include <sys/file.h>
8365 #endif
8366 int main() {
8367         if(O_RDONLY);
8368 #ifdef O_TRUNC
8369         exit(0);
8370 #else
8371         exit(1);
8372 #endif
8373 }
8374 EOCP
8375 : check sys/file.h first to get FREAD on Sun
8376 if $test `./findhdr sys/file.h` && \
8377                 set open3 -DI_SYS_FILE && eval $compile; then
8378         h_sysfile=true;
8379         echo "<sys/file.h> defines the O_* constants..." >&4
8380         if ./open3; then
8381                 echo "and you have the 3 argument form of open()." >&4
8382                 val="$define"
8383         else
8384                 echo "but not the 3 argument form of open().  Oh, well." >&4
8385                 val="$undef"
8386         fi
8387 elif $test `./findhdr fcntl.h` && \
8388                 set open3 -DI_FCNTL && eval $compile; then
8389         h_fcntl=true;
8390         echo "<fcntl.h> defines the O_* constants..." >&4
8391         if ./open3; then
8392                 echo "and you have the 3 argument form of open()." >&4
8393                 val="$define"
8394         else
8395                 echo "but not the 3 argument form of open().  Oh, well." >&4
8396                 val="$undef"
8397         fi
8398 else
8399         val="$undef"
8400         echo "I can't find the O_* constant definitions!  You got problems." >&4
8401 fi
8402 set d_open3
8403 eval $setvar
8404 $rm -f open3*
8405
8406 : see which of string.h or strings.h is needed
8407 echo " "
8408 strings=`./findhdr string.h`
8409 if $test "$strings" && $test -r "$strings"; then
8410         echo "Using <string.h> instead of <strings.h>." >&4
8411         val="$define"
8412 else
8413         val="$undef"
8414         strings=`./findhdr strings.h`
8415         if $test "$strings" && $test -r "$strings"; then
8416                 echo "Using <strings.h> instead of <string.h>." >&4
8417         else
8418                 echo "No string header found -- You'll surely have problems." >&4
8419         fi
8420 fi
8421 set i_string
8422 eval $setvar
8423 case "$i_string" in
8424 "$undef") strings=`./findhdr strings.h`;;
8425 *)        strings=`./findhdr string.h`;;
8426 esac
8427
8428 : check for non-blocking I/O stuff
8429 case "$h_sysfile" in
8430 true) echo "#include <sys/file.h>" > head.c;;
8431 *)
8432         case "$h_fcntl" in
8433         true) echo "#include <fcntl.h>" > head.c;;
8434         *) echo "#include <sys/fcntl.h>" > head.c;;
8435         esac
8436         ;;
8437 esac
8438 echo " "
8439 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8440 case "$o_nonblock" in
8441 '')
8442         $cat head.c > try.c
8443         $cat >>try.c <<'EOCP'
8444 #include <stdio.h>
8445 int main() {
8446 #ifdef O_NONBLOCK
8447         printf("O_NONBLOCK\n");
8448         exit(0);
8449 #endif
8450 #ifdef O_NDELAY
8451         printf("O_NDELAY\n");
8452         exit(0);
8453 #endif
8454 #ifdef FNDELAY
8455         printf("FNDELAY\n");
8456         exit(0);
8457 #endif
8458         exit(0);
8459 }
8460 EOCP
8461         set try
8462         if eval $compile_ok; then
8463                 o_nonblock=`./try`
8464                 case "$o_nonblock" in
8465                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8466                 *) echo "Seems like we can use $o_nonblock.";;
8467                 esac
8468         else
8469                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8470         fi
8471         ;;
8472 *) echo "Using $hint value $o_nonblock.";;
8473 esac
8474 $rm -f try try.* .out core
8475
8476 echo " "
8477 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8478 case "$eagain" in
8479 '')
8480         $cat head.c > try.c
8481         $cat >>try.c <<EOCP
8482 #include <errno.h>
8483 #include <sys/types.h>
8484 #include <signal.h>
8485 #include <stdio.h> 
8486 #define MY_O_NONBLOCK $o_nonblock
8487 #ifndef errno  /* XXX need better Configure test */
8488 extern int errno;
8489 #endif
8490 #$i_unistd I_UNISTD
8491 #ifdef I_UNISTD
8492 #include <unistd.h>
8493 #endif
8494 #ifdef $i_string
8495 #include <string.h>
8496 #else
8497 #include <strings.h>
8498 #endif
8499 $signal_t blech(x) int x; { exit(3); }
8500 EOCP
8501         $cat >> try.c <<'EOCP'
8502 int main()
8503 {
8504         int pd[2];
8505         int pu[2];
8506         char buf[1];
8507         char string[100];
8508
8509         pipe(pd);       /* Down: child -> parent */
8510         pipe(pu);       /* Up: parent -> child */
8511         if (0 != fork()) {
8512                 int ret;
8513                 close(pd[1]);   /* Parent reads from pd[0] */
8514                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8515                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8516                         exit(1);
8517                 signal(SIGALRM, blech);
8518                 alarm(5);
8519                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8520                         exit(2);
8521                 sprintf(string, "%d\n", ret);
8522                 write(2, string, strlen(string));
8523                 alarm(0);
8524 #ifdef EAGAIN
8525                 if (errno == EAGAIN) {
8526                         printf("EAGAIN\n");
8527                         goto ok;
8528                 }
8529 #endif
8530 #ifdef EWOULDBLOCK
8531                 if (errno == EWOULDBLOCK)
8532                         printf("EWOULDBLOCK\n");
8533 #endif
8534         ok:
8535                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8536                 sleep(2);                               /* Give it time to close our pipe */
8537                 alarm(5);
8538                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8539                 alarm(0);
8540                 sprintf(string, "%d\n", ret);
8541                 write(3, string, strlen(string));
8542                 exit(0);
8543         }
8544
8545         close(pd[0]);                   /* We write to pd[1] */
8546         close(pu[1]);                   /* We read from pu[0] */
8547         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8548         close(pd[1]);                   /* Pipe pd is now fully closed! */
8549         exit(0);                                /* Bye bye, thank you for playing! */
8550 }
8551 EOCP
8552         set try
8553         if eval $compile_ok; then
8554                 echo "$startsh" >mtry
8555                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8556                 chmod +x mtry
8557                 ./mtry >/dev/null 2>&1
8558                 case $? in
8559                 0) eagain=`$cat try.out`;;
8560                 1) echo "Could not perform non-blocking setting!";;
8561                 2) echo "I did a successful read() for something that was not there!";;
8562                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8563                 *) echo "Something terribly wrong happened during testing.";;
8564                 esac
8565                 rd_nodata=`$cat try.ret`
8566                 echo "A read() system call with no data present returns $rd_nodata."
8567                 case "$rd_nodata" in
8568                 0|-1) ;;
8569                 *)
8570                         echo "(That's peculiar, fixing that to be -1.)"
8571                         rd_nodata=-1
8572                         ;;
8573                 esac
8574                 case "$eagain" in
8575                 '')
8576                         echo "Forcing errno EAGAIN on read() with no data available."
8577                         eagain=EAGAIN
8578                         ;;
8579                 *)
8580                         echo "Your read() sets errno to $eagain when no data is available."
8581                         ;;
8582                 esac
8583                 status=`$cat try.err`
8584                 case "$status" in
8585                 0) echo "And it correctly returns 0 to signal EOF.";;
8586                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8587                 *) echo "However, your read() returns '$status' on EOF??";;
8588                 esac
8589                 val="$define"
8590                 if test "$status" = "$rd_nodata"; then
8591                         echo "WARNING: you can't distinguish between EOF and no data!"
8592                         val="$undef"
8593                 fi
8594         else
8595                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8596                 eagain=EAGAIN
8597         fi
8598         set d_eofnblk
8599         eval $setvar
8600         ;;
8601 *)
8602         echo "Using $hint value $eagain."
8603         echo "Your read() returns $rd_nodata when no data is present."
8604         case "$d_eofnblk" in
8605         "$define") echo "And you can see EOF because read() returns 0.";;
8606         "$undef") echo "But you can't see EOF status from read() returned value.";;
8607         *)
8608                 echo "(Assuming you can't see EOF status from read anyway.)"
8609                 d_eofnblk=$undef
8610                 ;;
8611         esac
8612         ;;
8613 esac
8614 $rm -f try try.* .out core head.c mtry
8615
8616 : see if fchmod exists
8617 set fchmod d_fchmod
8618 eval $inlibc
8619
8620 : see if fchown exists
8621 set fchown d_fchown
8622 eval $inlibc
8623
8624 : see if this is an fcntl system
8625 set fcntl d_fcntl
8626 eval $inlibc
8627
8628 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8629 while $test $# -ge 2; do
8630         case "$1" in
8631         $define) echo "#include <$2>";;
8632         esac ;
8633     shift 2;
8634 done > try.c;
8635 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8636 set try;
8637 if eval $compile; then
8638         val="$define";
8639 else
8640         val="$undef";
8641 fi;
8642 set $varname;
8643 eval $setvar;
8644 $rm -f try.c try.o'
8645
8646 socketlib=''
8647 sockethdr=''
8648 : see whether socket exists
8649 echo " "
8650 $echo $n "Hmm... $c" >&4
8651 if set socket val -f d_socket; eval $csym; $val; then
8652         echo "Looks like you have Berkeley networking support." >&4
8653         d_socket="$define"
8654         if set setsockopt val -f; eval $csym; $val; then
8655                 d_oldsock="$undef"
8656         else
8657                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8658                 d_oldsock="$define"
8659         fi
8660 else
8661         if $contains socklib libc.list >/dev/null 2>&1; then
8662                 echo "Looks like you have Berkeley networking support." >&4
8663                 d_socket="$define"
8664                 : we will have to assume that it supports the 4.2 BSD interface
8665                 d_oldsock="$undef"
8666         else
8667                 echo "You don't have Berkeley networking in libc$_a..." >&4
8668                 if test "X$d_socket" = "X$define"; then
8669                    echo "...but you seem to believe that you have sockets." >&4
8670                 else
8671                         for net in net socket
8672                         do
8673                                 if test -f /usr/lib/lib$net$_a; then
8674                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8675                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8676                                         if $contains socket libc.list >/dev/null 2>&1; then
8677                                                 d_socket="$define"
8678                                                 socketlib="-l$net"
8679                                                 case "$net" in
8680                                                 net)
8681                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8682                                                         sockethdr="-I/usr/netinclude"
8683                                                         ;;
8684                                                 esac
8685                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8686                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8687                                                         d_oldsock="$undef"
8688                                                 else
8689                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8690                                                         d_oldsock="$define"
8691                                                 fi
8692                                                 break
8693                                         fi
8694                                 fi
8695                         done
8696                         if test "X$d_socket" != "X$define"; then
8697                            echo "or anywhere else I see." >&4
8698                            d_socket="$undef"
8699                            d_oldsock="$undef"
8700                         fi
8701                 fi
8702         fi
8703 fi
8704
8705 : see if socketpair exists
8706 set socketpair d_sockpair
8707 eval $inlibc
8708
8709
8710 echo " "
8711 echo "Checking the availability of certain socket constants..." >& 4
8712 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8713         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8714         $cat >try.c <<EOF
8715 #include <sys/types.h>
8716 #include <sys/socket.h>
8717 int main() {
8718     int i = $ENUM;
8719 }
8720 EOF
8721         val="$undef"
8722         set try; if eval $compile; then
8723                 val="$define"
8724         fi
8725         set d_${enum}; eval $setvar
8726         $rm -f try.c try
8727 done
8728
8729 : see if sys/select.h has to be included
8730 set sys/select.h i_sysselct
8731 eval $inhdr
8732
8733 : see if we should include time.h, sys/time.h, or both
8734 echo " "
8735 if test "X$timeincl" = X; then
8736         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8737         $echo $n "I'm now running the test program...$c"
8738         $cat >try.c <<'EOCP'
8739 #include <sys/types.h>
8740 #ifdef I_TIME
8741 #include <time.h>
8742 #endif
8743 #ifdef I_SYSTIME
8744 #ifdef SYSTIMEKERNEL
8745 #define KERNEL
8746 #endif
8747 #include <sys/time.h>
8748 #endif
8749 #ifdef I_SYSSELECT
8750 #include <sys/select.h>
8751 #endif
8752 int main()
8753 {
8754         struct tm foo;
8755 #ifdef S_TIMEVAL
8756         struct timeval bar;
8757 #endif
8758 #ifdef S_TIMEZONE
8759         struct timezone tzp;
8760 #endif
8761         if (foo.tm_sec == foo.tm_sec)
8762                 exit(0);
8763 #ifdef S_TIMEVAL
8764         if (bar.tv_sec == bar.tv_sec)
8765                 exit(0);
8766 #endif
8767         exit(1);
8768 }
8769 EOCP
8770         flags=''
8771         for s_timezone in '-DS_TIMEZONE' ''; do
8772         sysselect=''
8773         for s_timeval in '-DS_TIMEVAL' ''; do
8774         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8775         for i_time in '' '-DI_TIME'; do
8776         for i_systime in '-DI_SYSTIME' ''; do
8777                 case "$flags" in
8778                 '') $echo $n ".$c"
8779                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8780                         if eval $compile; then
8781                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8782                                 shift
8783                                 flags="$*"
8784                                 echo " "
8785                                 $echo $n "Succeeded with $flags$c"
8786                         fi
8787                         ;;
8788                 esac
8789         done
8790         done
8791         done
8792         done
8793         done
8794         timeincl=''
8795         echo " "
8796         case "$flags" in
8797         *SYSTIMEKERNEL*) i_systimek="$define"
8798                 timeincl=`./findhdr sys/time.h`
8799                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8800         *) i_systimek="$undef";;
8801         esac
8802         case "$flags" in
8803         *I_TIME*) i_time="$define"
8804                 timeincl=`./findhdr time.h`" $timeincl"
8805                 echo "We'll include <time.h>." >&4;;
8806         *) i_time="$undef";;
8807         esac
8808         case "$flags" in
8809         *I_SYSTIME*) i_systime="$define"
8810                 timeincl=`./findhdr sys/time.h`" $timeincl"
8811                 echo "We'll include <sys/time.h>." >&4;;
8812         *) i_systime="$undef";;
8813         esac
8814         $rm -f try.c try
8815 fi
8816
8817 : check for fd_set items
8818 $cat <<EOM
8819
8820 Checking to see how well your C compiler handles fd_set and friends ...
8821 EOM
8822 $cat >fd_set.c <<EOCP
8823 #$i_systime I_SYS_TIME
8824 #$i_sysselct I_SYS_SELECT
8825 #$d_socket HAS_SOCKET
8826 #include <sys/types.h>
8827 #ifdef HAS_SOCKET
8828 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8829 #endif
8830 #ifdef I_SYS_TIME
8831 #include <sys/time.h>
8832 #endif
8833 #ifdef I_SYS_SELECT
8834 #include <sys/select.h>
8835 #endif
8836 int main() {
8837         fd_set fds;
8838
8839 #ifdef TRYBITS
8840         if(fds.fds_bits);
8841 #endif
8842
8843 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8844         exit(0);
8845 #else
8846         exit(1);
8847 #endif
8848 }
8849 EOCP
8850 set fd_set -DTRYBITS
8851 if eval $compile; then
8852         d_fds_bits="$define"
8853         d_fd_set="$define"
8854         echo "Well, your system knows about the normal fd_set typedef..." >&4
8855         if ./fd_set; then
8856                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8857                 d_fd_macros="$define"
8858         else
8859                 $cat >&4 <<'EOM'
8860 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8861 EOM
8862                 d_fd_macros="$undef"
8863         fi
8864 else
8865         $cat <<'EOM'
8866 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8867 EOM
8868         set fd_set
8869         if eval $compile; then
8870                 d_fds_bits="$undef"
8871                 d_fd_set="$define"
8872                 echo "Well, your system has some sort of fd_set available..." >&4
8873                 if ./fd_set; then
8874                         echo "and you have the normal fd_set macros." >&4
8875                         d_fd_macros="$define"
8876                 else
8877                         $cat <<'EOM'
8878 but not the normal fd_set macros!  Gross!  More work for me...
8879 EOM
8880                         d_fd_macros="$undef"
8881                 fi
8882         else
8883         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8884                 d_fd_set="$undef"
8885                 d_fds_bits="$undef"
8886                 d_fd_macros="$undef"
8887         fi
8888 fi
8889 $rm -f fd_set*
8890
8891 : see if fgetpos exists
8892 set fgetpos d_fgetpos
8893 eval $inlibc
8894
8895 : see if flock exists
8896 set flock d_flock
8897 eval $inlibc
8898
8899 : see if fork exists
8900 set fork d_fork
8901 eval $inlibc
8902
8903 : see if pathconf exists
8904 set pathconf d_pathconf
8905 eval $inlibc
8906
8907 : see if fpathconf exists
8908 set fpathconf d_fpathconf
8909 eval $inlibc
8910
8911
8912 : check for fpos64_t
8913 echo " "
8914 echo "Checking to see if you have fpos64_t..." >&4
8915 $cat >try.c <<EOCP
8916 #include <stdio.h>
8917 int main() { fpos64_t x = 7; }
8918 EOCP
8919 set try
8920 if eval $compile; then
8921         val="$define"
8922         echo "You have fpos64_t."
8923 else
8924         val="$undef"
8925         echo "You do not have fpos64_t."
8926         case "$fpossize" in
8927         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8928         esac
8929 fi
8930 $rm -f try.* try
8931 set d_fpos64_t
8932 eval $setvar
8933
8934 hasstruct='varname=$1; struct=$2; shift; shift;
8935 while $test $# -ge 2; do
8936         case "$1" in
8937         $define) echo "#include <$2>";;
8938         esac ;
8939     shift 2;
8940 done > try.c;
8941 echo "int main () { struct $struct foo; }" >> try.c;
8942 set try;
8943 if eval $compile; then
8944         val="$define";
8945 else
8946         val="$undef";
8947 fi;
8948 set $varname;
8949 eval $setvar;
8950 $rm -f try.c try.o'
8951
8952 : see if this is a sys/param system
8953 set sys/param.h i_sysparam
8954 eval $inhdr
8955
8956 : see if this is a sys/mount.h system
8957 set sys/mount.h i_sysmount
8958 eval $inhdr
8959
8960 : see if sys/types.h has to be included
8961 set sys/types.h i_systypes
8962 eval $inhdr
8963
8964
8965 echo " "
8966 echo "Checking to see if your system supports struct fs_data..." >&4
8967 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8968 eval $hasstruct
8969 case "$d_fs_data_s" in
8970 "$define")      echo "Yes, it does."   ;;
8971 *)              echo "No, it doesn't." ;;
8972 esac
8973
8974 : see if fseeko exists
8975 set fseeko d_fseeko
8976 eval $inlibc
8977 case "$longsize" in
8978 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8979 esac
8980
8981 : see if fsetpos exists
8982 set fsetpos d_fsetpos
8983 eval $inlibc
8984
8985
8986 : see if fstatfs exists
8987 set fstatfs d_fstatfs
8988 eval $inlibc
8989
8990
8991 : see if statvfs exists
8992 set statvfs d_statvfs
8993 eval $inlibc
8994
8995 : see if fstatvfs exists
8996 set fstatvfs d_fstatvfs
8997 eval $inlibc
8998
8999
9000 : see if ftello exists
9001 set ftello d_ftello
9002 eval $inlibc
9003 case "$longsize" in
9004 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9005 esac
9006
9007 : see if getcwd exists
9008 set getcwd d_getcwd
9009 eval $inlibc
9010
9011 : see if getgrent exists
9012 set getgrent d_getgrent
9013 eval $inlibc
9014
9015 : see if gethostbyaddr exists
9016 set gethostbyaddr d_gethbyaddr
9017 eval $inlibc
9018
9019 : see if gethostbyname exists
9020 set gethostbyname d_gethbyname
9021 eval $inlibc
9022
9023 : see if gethostent exists
9024 set gethostent d_gethent
9025 eval $inlibc
9026
9027 : see how we will look up host name
9028 echo " "
9029 call=''
9030 if set gethostname val -f d_gethname; eval $csym; $val; then
9031         echo 'gethostname() found.' >&4
9032         d_gethname="$define"
9033         call=gethostname
9034 fi
9035 if set uname val -f d_uname; eval $csym; $val; then
9036         if ./xenix; then
9037                 $cat <<'EOM'
9038 uname() was found, but you're running xenix, and older versions of xenix
9039 have a broken uname(). If you don't really know whether your xenix is old
9040 enough to have a broken system call, use the default answer.
9041
9042 EOM
9043                 dflt=y
9044                 case "$d_uname" in
9045                 "$define") dflt=n;;
9046                 esac
9047                 rp='Is your uname() broken?'
9048                 . ./myread
9049                 case "$ans" in
9050                 n*) d_uname="$define"; call=uname;;
9051                 esac
9052         else
9053                 echo 'uname() found.' >&4
9054                 d_uname="$define"
9055                 case "$call" in
9056                 '') call=uname ;;
9057                 esac
9058         fi
9059 fi
9060 case "$d_gethname" in
9061 '') d_gethname="$undef";;
9062 esac
9063 case "$d_uname" in
9064 '') d_uname="$undef";;
9065 esac
9066 case "$d_uname$d_gethname" in
9067 *define*)
9068         dflt=n
9069         cat <<EOM
9070  
9071 Every now and then someone has a $call() that lies about the hostname
9072 but can't be fixed for political or economic reasons.  If you wish, I can
9073 pretend $call() isn't there and maybe compute hostname at run-time
9074 thanks to the '$phostname' command.
9075
9076 EOM
9077         rp="Shall I ignore $call() from now on?"
9078         . ./myread
9079         case "$ans" in
9080         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9081         esac;;
9082 esac
9083 case "$phostname" in
9084 '') aphostname='';;
9085 *) case "$aphostname" in
9086         /*) ;;
9087         *) set X $phostname
9088                 shift
9089                 file=$1
9090                 shift
9091                 file=`./loc $file $file $pth`
9092                 aphostname=`echo $file $*`
9093                 ;;
9094         esac
9095         ;;
9096 esac
9097 case "$d_uname$d_gethname" in
9098 *define*) ;;
9099 *)
9100         case "$phostname" in
9101         '')
9102                 echo "There will be no way for $package to get your hostname." >&4;;
9103         *)
9104         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9105                 ;;
9106         esac;;
9107 esac
9108 case "$d_phostname" in
9109 '') d_phostname="$undef";;
9110 esac
9111
9112 : see if this is a netdb.h system
9113 set netdb.h i_netdb
9114 eval $inhdr
9115
9116 : see if prototypes for various gethostxxx netdb.h functions are available
9117 echo " "
9118 set d_gethostprotos gethostent $i_netdb netdb.h
9119 eval $hasproto
9120
9121 : see if getlogin exists
9122 set getlogin d_getlogin
9123 eval $inlibc
9124
9125 : see if getmnt exists
9126 set getmnt d_getmnt
9127 eval $inlibc
9128
9129 : see if getmntent exists
9130 set getmntent d_getmntent
9131 eval $inlibc
9132
9133 : see if getnetbyaddr exists
9134 set getnetbyaddr d_getnbyaddr
9135 eval $inlibc
9136
9137 : see if getnetbyname exists
9138 set getnetbyname d_getnbyname
9139 eval $inlibc
9140
9141 : see if getnetent exists
9142 set getnetent d_getnent
9143 eval $inlibc
9144
9145 : see if prototypes for various getnetxxx netdb.h functions are available
9146 echo " "
9147 set d_getnetprotos getnetent $i_netdb netdb.h
9148 eval $hasproto
9149
9150
9151 : see if getprotobyname exists
9152 set getprotobyname d_getpbyname
9153 eval $inlibc
9154
9155 : see if getprotobynumber exists
9156 set getprotobynumber d_getpbynumber
9157 eval $inlibc
9158
9159 : see if getprotoent exists
9160 set getprotoent d_getpent
9161 eval $inlibc
9162
9163 : see if getpgid exists
9164 set getpgid d_getpgid
9165 eval $inlibc
9166
9167 : see if getpgrp2 exists
9168 set getpgrp2 d_getpgrp2
9169 eval $inlibc
9170
9171 : see if getppid exists
9172 set getppid d_getppid
9173 eval $inlibc
9174
9175 : see if getpriority exists
9176 set getpriority d_getprior
9177 eval $inlibc
9178
9179 : see if prototypes for various getprotoxxx netdb.h functions are available
9180 echo " "
9181 set d_getprotoprotos getprotoent $i_netdb netdb.h
9182 eval $hasproto
9183
9184 : see if getpwent exists
9185 set getpwent d_getpwent
9186 eval $inlibc
9187
9188
9189 : see if getservbyname exists
9190 set getservbyname d_getsbyname
9191 eval $inlibc
9192
9193 : see if getservbyport exists
9194 set getservbyport d_getsbyport
9195 eval $inlibc
9196
9197 : see if getservent exists
9198 set getservent d_getsent
9199 eval $inlibc
9200
9201 : see if prototypes for various getservxxx netdb.h functions are available
9202 echo " "
9203 set d_getservprotos getservent $i_netdb netdb.h
9204 eval $hasproto
9205
9206 : see if getspent exists
9207 set getspent d_getspent
9208 eval $inlibc
9209
9210 : see if getspnam exists
9211 set getspnam d_getspnam
9212 eval $inlibc
9213
9214 : see if gettimeofday or ftime exists
9215 set gettimeofday d_gettimeod
9216 eval $inlibc
9217 case "$d_gettimeod" in
9218 "$undef")
9219         set ftime d_ftime 
9220         eval $inlibc
9221         ;;
9222 *)
9223         val="$undef"; set d_ftime; eval $setvar
9224         ;;
9225 esac
9226 case "$d_gettimeod$d_ftime" in
9227 "$undef$undef")
9228         echo " "
9229         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9230         ;;
9231 esac
9232
9233 : see if this is an grp system
9234 set grp.h i_grp
9235 eval $inhdr
9236
9237 case "$i_grp" in
9238 $define)
9239         xxx=`./findhdr grp.h`
9240         $cppstdin $cppflags $cppminus < $xxx >$$.h
9241
9242         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9243                 val="$define"
9244         else
9245                 val="$undef"
9246         fi
9247         set d_grpasswd
9248         eval $setvar
9249
9250         $rm -f $$.h
9251         ;;
9252 *)
9253         val="$undef";
9254         set d_grpasswd; eval $setvar
9255         ;;
9256 esac
9257
9258 : see if hasmntopt exists
9259 set hasmntopt d_hasmntopt
9260 eval $inlibc
9261
9262 : see if this is a netinet/in.h or sys/in.h system
9263 set netinet/in.h i_niin sys/in.h i_sysin
9264 eval $inhdr
9265
9266 : see if arpa/inet.h has to be included
9267 set arpa/inet.h i_arpainet
9268 eval $inhdr
9269
9270 : see if htonl --and friends-- exists
9271 val=''
9272 set htonl val
9273 eval $inlibc
9274
9275 : Maybe they are macros.
9276 case "$val" in
9277 $undef)
9278         $cat >htonl.c <<EOM
9279 #include <stdio.h>
9280 #include <sys/types.h>
9281 #$i_niin I_NETINET_IN
9282 #$i_sysin I_SYS_IN
9283 #$i_arpainet I_ARPA_INET
9284 #ifdef I_NETINET_IN
9285 #include <netinet/in.h>
9286 #endif
9287 #ifdef I_SYS_IN
9288 #include <sys/in.h>
9289 #endif
9290 #ifdef I_ARPA_INET
9291 #include <arpa/inet.h>
9292 #endif
9293 #ifdef htonl
9294 printf("Defined as a macro.");
9295 #endif
9296 EOM
9297         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9298         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9299                 val="$define"
9300                 echo "But it seems to be defined as a macro." >&4
9301         fi
9302         $rm -f htonl.?
9303         ;;
9304 esac
9305 set d_htonl
9306 eval $setvar
9307
9308 : see if iconv exists
9309 set iconv d_iconv
9310 eval $inlibc
9311
9312 : index or strchr
9313 echo " "
9314 if set index val -f; eval $csym; $val; then
9315         if set strchr val -f d_strchr; eval $csym; $val; then
9316                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9317                         val="$define"
9318                         vali="$undef"
9319                         echo "strchr() found." >&4
9320                 else
9321                         val="$undef"
9322                         vali="$define"
9323                         echo "index() found." >&4
9324                 fi
9325         else
9326                 val="$undef"
9327                 vali="$define"
9328                 echo "index() found." >&4
9329         fi
9330 else
9331         if set strchr val -f d_strchr; eval $csym; $val; then
9332                 val="$define"
9333                 vali="$undef"
9334                 echo "strchr() found." >&4
9335         else
9336                 echo "No index() or strchr() found!" >&4
9337                 val="$undef"
9338                 vali="$undef"
9339         fi
9340 fi
9341 set d_strchr; eval $setvar
9342 val="$vali"
9343 set d_index; eval $setvar
9344
9345 : check whether inet_aton exists
9346 set inet_aton d_inetaton
9347 eval $inlibc
9348
9349 : see if inttypes.h is available
9350 : we want a real compile instead of Inhdr because some systems
9351 : have an inttypes.h which includes non-existent headers
9352 echo " "
9353 $cat >try.c <<EOCP
9354 #include <inttypes.h>
9355 int main() {
9356         static int32_t foo32 = 0x12345678;
9357 }
9358 EOCP
9359 set try
9360 if eval $compile; then
9361         echo "<inttypes.h> found." >&4
9362         val="$define"
9363 else
9364         echo "<inttypes.h> NOT found." >&4
9365         val="$undef"
9366 fi
9367 $rm -f try.c try
9368 set i_inttypes
9369 eval $setvar
9370
9371 : check for int64_t
9372 echo " "
9373 echo "Checking to see if you have int64_t..." >&4
9374 $cat >try.c <<EOCP
9375 #include <sys/types.h>
9376 #$i_inttypes I_INTTYPES
9377 #ifdef I_INTTYPES
9378 #include <inttypes.h>
9379 #endif
9380 int main() { int64_t x = 7; }
9381 EOCP
9382 set try
9383 if eval $compile; then
9384         val="$define"
9385         echo "You have int64_t."
9386 else
9387         val="$undef"
9388         echo "You do not have int64_t."
9389 fi
9390 $rm -f try try.*
9391 set d_int64_t
9392 eval $setvar
9393
9394 : Look for isascii
9395 echo " "
9396 $cat >isascii.c <<'EOCP'
9397 #include <stdio.h>
9398 #include <ctype.h>
9399 int main() {
9400         int c = 'A';
9401         if (isascii(c))
9402                 exit(0);
9403         else
9404                 exit(1);
9405 }
9406 EOCP
9407 set isascii
9408 if eval $compile; then
9409         echo "isascii() found." >&4
9410         val="$define"
9411 else
9412         echo "isascii() NOT found." >&4
9413         val="$undef"
9414 fi
9415 set d_isascii
9416 eval $setvar
9417 $rm -f isascii*
9418
9419 : see if killpg exists
9420 set killpg d_killpg
9421 eval $inlibc
9422
9423 : see if lchown exists
9424 echo " "
9425 $cat > try.c <<'EOCP'
9426 /* System header to define __stub macros and hopefully few prototypes,
9427     which can conflict with char lchown(); below.  */
9428 #include <assert.h>
9429 /* Override any gcc2 internal prototype to avoid an error.  */
9430 /* We use char because int might match the return type of a gcc2
9431    builtin and then its argument prototype would still apply.  */
9432 char lchown();
9433 int main() {
9434     /*  The GNU C library defines this for functions which it implements
9435         to always fail with ENOSYS.  Some functions are actually named
9436         something starting with __ and the normal name is an alias.  */
9437 #if defined (__stub_lchown) || defined (__stub___lchown)
9438 choke me
9439 #else
9440 lchown();
9441 #endif
9442 ; return 0; }
9443 EOCP
9444 set try
9445 if eval $compile; then
9446     $echo "lchown() found." >&4
9447     val="$define"
9448 else
9449     $echo "lchown() NOT found." >&4
9450     val="$undef"
9451 fi
9452 set d_lchown
9453 eval $setvar
9454
9455 : See if number of significant digits in a double precision number is known
9456 echo " "
9457 $cat >ldbl_dig.c <<EOM
9458 #$i_limits I_LIMITS
9459 #$i_float I_FLOAT
9460 #ifdef I_LIMITS
9461 #include <limits.h>
9462 #endif
9463 #ifdef I_FLOAT
9464 #include <float.h>
9465 #endif
9466 #ifdef LDBL_DIG
9467 printf("Contains LDBL_DIG");
9468 #endif
9469 EOM
9470 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9471 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9472         echo "LDBL_DIG found." >&4
9473         val="$define"
9474 else
9475         echo "LDBL_DIG NOT found." >&4
9476         val="$undef"
9477 fi
9478 $rm -f ldbl_dig.?
9479 set d_ldbl_dig
9480 eval $setvar
9481
9482 : see if link exists
9483 set link d_link
9484 eval $inlibc
9485
9486 : see if localeconv exists
9487 set localeconv d_locconv
9488 eval $inlibc
9489
9490 : see if lockf exists
9491 set lockf d_lockf
9492 eval $inlibc
9493
9494 : check for long long
9495 echo " "
9496 echo "Checking to see if you have long long..." >&4
9497 echo 'int main() { long long x = 7; return 0; }' > try.c
9498 set try
9499 if eval $compile; then
9500         val="$define"
9501         echo "You have have long long."
9502 else
9503         val="$undef"
9504         echo "You do not have long long."
9505 fi
9506 $rm try.*
9507 set d_longlong
9508 eval $setvar
9509
9510 : check for length of long long
9511 case "${d_longlong}${longlongsize}" in
9512 $define)
9513         echo " "
9514         echo "Checking to see how big your long longs are..." >&4
9515         $cat >try.c <<'EOCP'
9516 #include <stdio.h>
9517 int main()
9518 {
9519     printf("%d\n", (int)sizeof(long long));
9520     return(0);
9521 }
9522 EOCP
9523         set try
9524         if eval $compile_ok; then
9525                 longlongsize=`./try$exe_ext`
9526                 echo "Your long longs are $longlongsize bytes long."
9527         else
9528                 dflt='8'
9529                 echo " "
9530                 echo "(I can't seem to compile the test program.  Guessing...)"
9531                 rp="What is the size of a long long (in bytes)?"
9532                 . ./myread
9533                 longlongsize="$ans"
9534         fi
9535         if $test "X$longsize" = "X$longlongsize"; then
9536                 echo "(That isn't any different from an ordinary long.)"
9537         fi      
9538         ;;
9539 esac
9540 $rm -f try.* try
9541
9542 : see if prototype for lseek is available
9543 echo " "
9544 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9545 eval $hasproto
9546
9547 : see if lstat exists
9548 set lstat d_lstat
9549 eval $inlibc
9550
9551 : see if mblen exists
9552 set mblen d_mblen
9553 eval $inlibc
9554
9555 : see if mbstowcs exists
9556 set mbstowcs d_mbstowcs
9557 eval $inlibc
9558
9559 : see if mbtowc exists
9560 set mbtowc d_mbtowc
9561 eval $inlibc
9562
9563 : see if memchr exists
9564 set memchr d_memchr
9565 eval $inlibc
9566
9567 : see if memcmp exists
9568 set memcmp d_memcmp
9569 eval $inlibc
9570
9571 : see if memcpy exists
9572 set memcpy d_memcpy
9573 eval $inlibc
9574
9575 : see if memmove exists
9576 set memmove d_memmove
9577 eval $inlibc
9578
9579 : see if memset exists
9580 set memset d_memset
9581 eval $inlibc
9582
9583 : see if mkdir exists
9584 set mkdir d_mkdir
9585 eval $inlibc
9586
9587 : see if mkdtemp exists
9588 set mkdtemp d_mkdtemp
9589 eval $inlibc
9590
9591 : see if mkfifo exists
9592 set mkfifo d_mkfifo
9593 eval $inlibc
9594
9595 : see if mkstemp exists
9596 set mkstemp d_mkstemp
9597 eval $inlibc
9598
9599 : see if mkstemps exists
9600 set mkstemps d_mkstemps
9601 eval $inlibc
9602
9603 : see if mktime exists
9604 set mktime d_mktime
9605 eval $inlibc
9606
9607 : see if this is a sys/mman.h system
9608 set sys/mman.h i_sysmman
9609 eval $inhdr
9610
9611 : see if mmap exists
9612 set mmap d_mmap
9613 eval $inlibc
9614 : see what shmat returns
9615 : default to something harmless
9616 mmaptype='void *'
9617 case "$i_sysmman$d_mmap" in
9618 "$define$define")
9619         $cat >mmap.c <<'END'
9620 #include <sys/mman.h>
9621 void *mmap();
9622 END
9623         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9624                 mmaptype='void *'
9625         else
9626                 mmaptype='caddr_t'
9627         fi
9628         echo "and it returns ($mmaptype)." >&4
9629         ;;
9630 esac
9631
9632
9633
9634 : see if mprotect exists
9635 set mprotect d_mprotect
9636 eval $inlibc
9637
9638 : see if msgctl exists
9639 set msgctl d_msgctl
9640 eval $inlibc
9641
9642 : see if msgget exists
9643 set msgget d_msgget
9644 eval $inlibc
9645
9646 : see if msgsnd exists
9647 set msgsnd d_msgsnd
9648 eval $inlibc
9649
9650 : see if msgrcv exists
9651 set msgrcv d_msgrcv
9652 eval $inlibc
9653
9654 : see how much of the 'msg*(2)' library is present.
9655 h_msg=true
9656 echo " "
9657 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9658 *"$undef"*) h_msg=false;;
9659 esac
9660 case "$osname" in
9661 freebsd)
9662     case "`ipcs 2>&1`" in
9663     "SVID messages"*"not configured"*)
9664         echo "Your $osname does not have the msg*(2) configured." >&4
9665         h_msg=false
9666         val="$undef"
9667         set msgctl d_msgctl
9668         eval $setvar
9669         set msgget d_msgget
9670         eval $setvar
9671         set msgsnd d_msgsnd
9672         eval $setvar
9673         set msgrcv d_msgrcv
9674         eval $setvar
9675         ;;
9676     esac
9677     ;;
9678 esac
9679 : we could also check for sys/ipc.h ...
9680 if $h_msg && $test `./findhdr sys/msg.h`; then
9681         echo "You have the full msg*(2) library." >&4
9682         val="$define"
9683 else
9684         echo "You don't have the full msg*(2) library." >&4
9685         val="$undef"
9686 fi
9687 set d_msg
9688 eval $setvar
9689
9690 : see if msync exists
9691 set msync d_msync
9692 eval $inlibc
9693
9694 : see if munmap exists
9695 set munmap d_munmap
9696 eval $inlibc
9697
9698 : see if nice exists
9699 set nice d_nice
9700 eval $inlibc
9701
9702
9703 echo " "
9704 echo "Checking which 64-bit integer type we could use..." >&4
9705
9706 case "$intsize" in
9707 8) val=int
9708    set quadtype
9709    eval $setvar
9710    val='"unsigned int"'
9711    set uquadtype
9712    eval $setvar
9713    quadkind=1
9714    ;;
9715 *) case "$longsize" in
9716    8) val=long
9717       set quadtype
9718       eval $setvar
9719       val='"unsigned long"'
9720       set uquadtype
9721       eval $setvar
9722       quadkind=2
9723       ;;
9724    *) case "$d_longlong:$longlongsize" in
9725       define:8)
9726         val='"long long"'
9727         set quadtype
9728         eval $setvar
9729         val='"unsigned long long"'
9730         set uquadtype
9731         eval $setvar
9732         quadkind=3
9733         ;;
9734       *) case "$d_int64_t" in
9735          define)
9736            val=int64_t
9737            set quadtype
9738            eval $setvar
9739            val=uint64_t
9740            set uquadtype
9741            eval $setvar
9742            quadkind=4
9743            ;;
9744          esac
9745          ;;
9746       esac
9747       ;;
9748    esac
9749    ;;
9750 esac
9751
9752 case "$quadtype" in
9753 '')     echo "Alas, no 64-bit integer types in sight." >&4
9754         d_quad="$undef"
9755         ;;
9756 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9757             verb="will"
9758         else
9759             verb="could"
9760         fi
9761         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9762         d_quad="$define"
9763         ;;
9764 esac
9765
9766 : check for length of character
9767 echo " "
9768 case "$charsize" in
9769 '')
9770         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9771         $cat >try.c <<'EOCP'
9772 #include <stdio.h>
9773 int main()
9774 {
9775     printf("%d\n", (int)sizeof(char));
9776     exit(0);
9777 }
9778 EOCP
9779         set try
9780         if eval $compile_ok; then
9781                 dflt=`./try`
9782         else
9783                 dflt='1'
9784                 echo "(I can't seem to compile the test program.  Guessing...)"
9785         fi
9786         ;;
9787 *)
9788         dflt="$charsize"
9789         ;;
9790 esac
9791 rp="What is the size of a character (in bytes)?"
9792 . ./myread
9793 charsize="$ans"
9794 $rm -f try.c try
9795
9796
9797 echo " "
9798 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9799
9800 case "$use64bits:$d_quad:$quadtype" in
9801 define:define:?*)
9802         ivtype="$quadtype"
9803         uvtype="$uquadtype"
9804         ivsize=8
9805         uvsize=8
9806         ;;
9807 *)      ivtype="long"
9808         uvtype="unsigned long"
9809         ivsize=$longsize
9810         uvsize=$longsize
9811         ;;
9812 esac
9813
9814 case "$uselongdouble:$d_longdbl" in
9815 define:define)
9816         nvtype="long double"
9817         nvsize=$longdblsize
9818         ;;
9819 *)      nvtype=double
9820         nvsize=$doublesize
9821         ;;
9822 esac
9823
9824 $echo "(IV will be "$ivtype", $ivsize bytes)"
9825 $echo "(UV will be "$uvtype", $uvsize bytes)"
9826 $echo "(NV will be "$nvtype", $nvsize bytes)"
9827
9828 $cat >try.c <<EOCP
9829 #$i_inttypes I_INTTYPES
9830 #ifdef I_INTTYPES
9831 #include <inttypes.h>
9832 #endif
9833 #include <stdio.h>
9834 int main() {
9835 #ifdef INT8
9836    int8_t i =  INT8_MAX;
9837   uint8_t u = UINT8_MAX;
9838   printf("int8_t\n");
9839 #endif
9840 #ifdef INT16
9841    int16_t i =  INT16_MAX;
9842   uint16_t i = UINT16_MAX;
9843   printf("int16_t\n");
9844 #endif
9845 #ifdef INT32
9846    int32_t i =  INT32_MAX;
9847   uint32_t u = UINT32_MAX;
9848   printf("int32_t\n");
9849 #endif
9850 }
9851 EOCP
9852
9853 case "$i8type" in
9854 '')     case "$charsize" in
9855         1)      i8type=char
9856                 u8type="unsigned char"
9857                 i8size=$charsize
9858                 u8size=$charsize
9859                 ;;
9860         esac
9861         ;;
9862 esac
9863 case "$i8type" in
9864 '')     set try -DINT8
9865         if eval $compile; then
9866                 case "`./try$exe_ext`" in
9867                 int8_t) i8type=int8_t
9868                         u8type=uint8_t
9869                         i8size=1
9870                         u8size=1
9871                         ;;
9872                 esac
9873         fi
9874         ;;
9875 esac
9876 case "$i8type" in
9877 '')     if $test $charsize -ge 1; then
9878                 i8type=char
9879                 u8type="unsigned char"
9880                 i8size=$charsize
9881                 u8size=$charsize
9882         fi
9883         ;;
9884 esac
9885
9886 case "$i16type" in
9887 '')     case "$shortsize" in
9888         2)      i16type=short
9889                 u16type="unsigned short"
9890                 i16size=$shortsize
9891                 u16size=$shortsize
9892                 ;;
9893         esac
9894         ;;
9895 esac
9896 case "$i16type" in
9897 '')     set try -DINT16
9898         if eval $compile; then
9899                 case "`./try$exe_ext`" in
9900                 int16_t)
9901                         i16type=int16_t
9902                         u16type=uint16_t
9903                         i16size=2
9904                         u16size=2
9905                         ;;
9906                 esac
9907         fi
9908         ;;
9909 esac
9910 case "$i16type" in
9911 '')     if $test $shortsize -ge 2; then
9912                 i16type=short
9913                 u16type="unsigned short"
9914                 i16size=$shortsize
9915                 u16size=$shortsize
9916         fi
9917         ;;
9918 esac
9919
9920 case "$i32type" in
9921 '')     case "$longsize" in
9922         4)      i32type=long
9923                 u32type="unsigned long"
9924                 i32size=$longsize
9925                 u32size=$longsize
9926                 ;;
9927         *)      case "$intsize" in
9928                 4)      i32type=int
9929                         u32type="unsigned int"
9930                         i32size=$intsize
9931                         u32size=$intsize
9932                         ;;
9933                 esac
9934                 ;;
9935         esac
9936         ;;
9937 esac
9938 case "$i32type" in
9939 '')     set try -DINT32
9940         if eval $compile; then
9941                 case "`./try$exe_ext`" in
9942                 int32_t)
9943                         i32type=int32_t
9944                         u32type=uint32_t
9945                         i32size=4
9946                         u32size=4
9947                         ;;
9948                 esac
9949         fi
9950         ;;
9951 esac
9952 case "$i32type" in
9953 '')     if $test $intsize -ge 4; then
9954                 i32type=int
9955                 u32type="unsigned int"
9956                 i32size=$intsize
9957                 u32size=$intsize
9958         fi
9959         ;;
9960 esac
9961
9962 case "$i64type" in
9963 '')     case "$d_quad:$quadtype" in
9964         define:?*)
9965                 i64type="$quadtype"
9966                 u64type="$uquadtype"
9967                 i64size=8
9968                 u64size=8
9969                 ;;
9970         esac
9971         ;;
9972 esac
9973
9974 $echo "Checking whether your NVs can preserve your UVs..." >&4
9975 $cat <<EOP >try.c
9976 #include <stdio.h>
9977 int main() {
9978     $uvtype k = ($uvtype)~0, l;
9979     $nvtype d;
9980     l = k;
9981     d = ($nvtype)l;
9982     l = ($uvtype)d;
9983     if (l == k)
9984        printf("preserve\n");
9985     exit(0);
9986 }
9987 EOP
9988 set try
9989 if eval $compile; then
9990         case "`./try$exe_ext`" in
9991         preserve) d_nv_preserves_uv="$define" ;;
9992         esac
9993 fi      
9994 case "$d_nv_preserves_uv" in
9995 $define) $echo "Yes, they can."  2>&1 ;;
9996 *)       $echo "No, they can't." 2>&1
9997          d_nv_preserves_uv="$undef"
9998          ;;
9999 esac
10000
10001 $rm -f try.* try
10002
10003
10004 : check for off64_t
10005 echo " "
10006 echo "Checking to see if you have off64_t..." >&4
10007 $cat >try.c <<EOCP
10008 #include <sys/types.h>
10009 #include <unistd.h>
10010 int main() { off64_t x = 7; }
10011 EOCP
10012 set try
10013 if eval $compile; then
10014         val="$define"
10015         echo "You have off64_t."
10016 else
10017         val="$undef"
10018         echo "You do not have off64_t."
10019         case "$lseeksize" in
10020         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10021         esac
10022 fi
10023 $rm -f try.* try
10024 set d_off64_t
10025 eval $setvar
10026
10027 : see if POSIX threads are available
10028 set pthread.h i_pthread
10029 eval $inhdr
10030
10031
10032
10033
10034 : how to create joinable pthreads
10035 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10036         echo " "
10037         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10038         $cat >try.c <<'EOCP'
10039 #include <pthread.h>
10040 int main() {
10041     int detachstate = JOINABLE;
10042 }
10043 EOCP
10044         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10045         if eval $compile; then
10046                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10047                 val="$undef" # Yes, undef.
10048                 set d_old_pthread_create_joinable
10049                 eval $setvar
10050                 val=""
10051                 set old_pthread_create_joinable
10052                 eval $setvar
10053         else
10054                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10055                 if eval $compile; then
10056                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10057                         val="$define"
10058                         set d_old_pthread_create_joinable
10059                         eval $setvar
10060                         val=PTHREAD_CREATE_UNDETACHED
10061                         set old_pthread_create_joinable
10062                         eval $setvar
10063                 else            
10064                         set try -DJOINABLE=__UNDETACHED
10065                         if eval $compile; then
10066                                 echo "You seem to use __UNDETACHED." >&4
10067                                 val="$define"
10068                                 set d_old_pthread_create_joinable
10069                                 eval $setvar
10070                                 val=__UNDETACHED
10071                                 set old_pthread_create_joinable
10072                                 eval $setvar
10073                         else
10074                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10075                                 val="$define"
10076                                 set d_old_pthread_create_joinable
10077                                 eval $setvar
10078                                 val=0
10079                                 set old_pthread_create_joinable
10080                                 eval $setvar
10081                         fi
10082                 fi
10083         fi
10084         $rm -f try try.*
10085 else
10086     d_old_pthread_create_joinable="$undef"
10087     old_pthread_create_joinable=""
10088 fi
10089
10090 : see if pause exists
10091 set pause d_pause
10092 eval $inlibc
10093
10094 : see if pipe exists
10095 set pipe d_pipe
10096 eval $inlibc
10097
10098 : see if poll exists
10099 set poll d_poll
10100 eval $inlibc
10101
10102
10103 : see whether the various POSIXish _yields exist
10104 $cat >try.c <<EOP
10105 #include <pthread.h>
10106 #include <stdio.h>
10107 int main() {
10108 #ifdef SCHED_YIELD
10109         sched_yield();
10110 #else
10111 #ifdef PTHREAD_YIELD
10112         pthread_yield();
10113 #else
10114 #ifdef PTHREAD_YIELD_NULL
10115         pthread_yield(NULL);
10116 #endif
10117 #endif
10118 #endif
10119 }
10120 EOP
10121 : see if sched_yield exists
10122 set try -DSCHED_YIELD
10123 if eval $compile; then
10124     val="$define"
10125     sched_yield='sched_yield()'
10126 else
10127     val="$undef"
10128 fi
10129 case "$usethreads" in
10130 $define)
10131         case "$val" in
10132         $define) echo 'sched_yield() found.' >&4        ;;
10133         *)       echo 'sched_yield() NOT found.' >&4    ;;
10134         esac
10135 esac
10136 set d_sched_yield
10137 eval $setvar
10138
10139 : see if pthread_yield exists
10140 set try -DPTHREAD_YIELD
10141 if eval $compile; then
10142     val="$define"
10143     case "$sched_yield" in
10144     '') sched_yield='pthread_yield()' ;;
10145     esac
10146 else
10147     set try -DPTHREAD_YIELD_NULL
10148     if eval $compile; then
10149         val="$define"
10150         case "$sched_yield" in
10151         '') sched_yield='pthread_yield(NULL)' ;;
10152         esac
10153     else
10154         val="$undef"
10155     fi
10156 fi
10157 case "$usethreads" in
10158 $define)
10159         case "$val" in
10160         $define) echo 'pthread_yield() found.' >&4      ;;
10161         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10162         esac
10163         ;;
10164 esac
10165 set d_pthread_yield
10166 eval $setvar
10167
10168 case "$sched_yield" in
10169 '') sched_yield=undef ;;
10170 esac
10171
10172 $rm -f try try.*
10173
10174 : see if this is a pwd.h system
10175 set pwd.h i_pwd
10176 eval $inhdr
10177
10178 case "$i_pwd" in
10179 $define)
10180         xxx=`./findhdr pwd.h`
10181         $cppstdin $cppflags $cppminus < $xxx >$$.h
10182
10183         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10184                 val="$define"
10185         else
10186                 val="$undef"
10187         fi
10188         set d_pwquota
10189         eval $setvar
10190
10191         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10192                 val="$define"
10193         else
10194                 val="$undef"
10195         fi
10196         set d_pwage
10197         eval $setvar
10198
10199         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10200                 val="$define"
10201         else
10202                 val="$undef"
10203         fi
10204         set d_pwchange
10205         eval $setvar
10206
10207         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10208                 val="$define"
10209         else
10210                 val="$undef"
10211         fi
10212         set d_pwclass
10213         eval $setvar
10214
10215         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10216                 val="$define"
10217         else
10218                 val="$undef"
10219         fi
10220         set d_pwexpire
10221         eval $setvar
10222
10223         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10224                 val="$define"
10225         else
10226                 val="$undef"
10227         fi
10228         set d_pwcomment
10229         eval $setvar
10230
10231         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10232                 val="$define"
10233         else
10234                 val="$undef"
10235         fi
10236         set d_pwgecos
10237         eval $setvar
10238
10239         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10240                 val="$define"
10241         else
10242                 val="$undef"
10243         fi
10244         set d_pwpasswd
10245         eval $setvar
10246
10247         $rm -f $$.h
10248         ;;
10249 *)
10250         val="$undef"; 
10251         set d_pwquota; eval $setvar
10252         set d_pwage; eval $setvar
10253         set d_pwchange; eval $setvar
10254         set d_pwclass; eval $setvar
10255         set d_pwexpire; eval $setvar
10256         set d_pwcomment; eval $setvar
10257         set d_pwgecos; eval $setvar
10258         set d_pwpasswd; eval $setvar
10259         ;;
10260 esac
10261
10262 : see if readdir and friends exist
10263 set readdir d_readdir
10264 eval $inlibc
10265 set seekdir d_seekdir
10266 eval $inlibc
10267 set telldir d_telldir
10268 eval $inlibc
10269 set rewinddir d_rewinddir
10270 eval $inlibc
10271
10272 : see if readlink exists
10273 set readlink d_readlink
10274 eval $inlibc
10275
10276 : see if rename exists
10277 set rename d_rename
10278 eval $inlibc
10279
10280 : see if rmdir exists
10281 set rmdir d_rmdir
10282 eval $inlibc
10283
10284 : see if memory.h is available.
10285 val=''
10286 set memory.h val
10287 eval $inhdr
10288
10289 : See if it conflicts with string.h
10290 case "$val" in
10291 $define)
10292         case "$strings" in
10293         '') ;;
10294         *)
10295                 $cppstdin $cppflags $cppminus < $strings > mem.h
10296                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10297                         echo " "
10298                         echo "We won't be including <memory.h>."
10299                         val="$undef"
10300                 fi
10301                 $rm -f mem.h
10302                 ;;
10303         esac
10304 esac
10305 set i_memory
10306 eval $setvar
10307
10308 : can bcopy handle overlapping blocks?
10309 val="$undef"
10310 case "$d_bcopy" in
10311 "$define")
10312         echo " "
10313         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10314         $cat >try.c <<EOCP
10315 #$i_memory I_MEMORY
10316 #$i_stdlib I_STDLIB
10317 #$i_string I_STRING
10318 #$i_unistd I_UNISTD
10319 EOCP
10320         $cat >>try.c <<'EOCP'
10321 #include <stdio.h>
10322 #ifdef I_MEMORY
10323 #  include <memory.h>
10324 #endif
10325 #ifdef I_STDLIB
10326 #  include <stdlib.h>
10327 #endif
10328 #ifdef I_STRING
10329 #  include <string.h>
10330 #else
10331 #  include <strings.h>
10332 #endif
10333 #ifdef I_UNISTD
10334 #  include <unistd.h>  /* Needed for NetBSD */
10335 #endif
10336 int main()
10337 {
10338 char buf[128], abc[128];
10339 char *b;
10340 int len;
10341 int off;
10342 int align;
10343
10344 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10345
10346 for (align = 7; align >= 0; align--) {
10347         for (len = 36; len; len--) {
10348                 b = buf+align;
10349                 bcopy(abc, b, len);
10350                 for (off = 1; off <= len; off++) {
10351                         bcopy(b, b+off, len);
10352                         bcopy(b+off, b, len);
10353                         if (bcmp(b, abc, len))
10354                                 exit(1);
10355                 }
10356         }
10357 }
10358 exit(0);
10359 }
10360 EOCP
10361         set try
10362         if eval $compile_ok; then
10363                 if ./try 2>/dev/null; then
10364                         echo "Yes, it can."
10365                         val="$define"
10366                 else
10367                         echo "It can't, sorry."
10368                         case "$d_memmove" in
10369                         "$define") echo "But that's Ok since you have memmove()." ;;
10370                         esac
10371                 fi
10372         else
10373                 echo "(I can't compile the test program, so we'll assume not...)"
10374                 case "$d_memmove" in
10375                 "$define") echo "But that's Ok since you have memmove()." ;;
10376                 esac
10377         fi
10378         ;;
10379 esac
10380 $rm -f try.* try core
10381 set d_safebcpy
10382 eval $setvar
10383
10384 : can memcpy handle overlapping blocks?
10385 val="$undef"
10386 case "$d_memcpy" in
10387 "$define")
10388         echo " "
10389         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10390         $cat >try.c <<EOCP
10391 #$i_memory I_MEMORY
10392 #$i_stdlib I_STDLIB
10393 #$i_string I_STRING
10394 #$i_unistd I_UNISTD
10395 EOCP
10396         $cat >>try.c <<'EOCP'
10397 #include <stdio.h>
10398 #ifdef I_MEMORY
10399 #  include <memory.h>
10400 #endif
10401 #ifdef I_STDLIB
10402 #  include <stdlib.h>
10403 #endif
10404 #ifdef I_STRING
10405 #  include <string.h>
10406 #else
10407 #  include <strings.h>
10408 #endif
10409 #ifdef I_UNISTD
10410 #  include <unistd.h>  /* Needed for NetBSD */
10411 #endif
10412 int main()
10413 {
10414 char buf[128], abc[128];
10415 char *b;
10416 int len;
10417 int off;
10418 int align;
10419
10420 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10421    try to store the string in read-only memory. */
10422 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10423
10424 for (align = 7; align >= 0; align--) {
10425         for (len = 36; len; len--) {
10426                 b = buf+align;
10427                 memcpy(b, abc, len);
10428                 for (off = 1; off <= len; off++) {
10429                         memcpy(b+off, b, len);
10430                         memcpy(b, b+off, len);
10431                         if (memcmp(b, abc, len))
10432                                 exit(1);
10433                 }
10434         }
10435 }
10436 exit(0);
10437 }
10438 EOCP
10439         set try
10440         if eval $compile_ok; then
10441                 if ./try 2>/dev/null; then
10442                         echo "Yes, it can."
10443                         val="$define"
10444                 else
10445                         echo "It can't, sorry."
10446                         case "$d_memmove" in
10447                         "$define") echo "But that's Ok since you have memmove()." ;;
10448                         esac
10449                 fi
10450         else
10451                 echo "(I can't compile the test program, so we'll assume not...)"
10452                 case "$d_memmove" in
10453                 "$define") echo "But that's Ok since you have memmove()." ;;
10454                 esac
10455         fi
10456         ;;
10457 esac
10458 $rm -f try.* try core
10459 set d_safemcpy
10460 eval $setvar
10461
10462 : can memcmp be trusted to compare relative magnitude?
10463 val="$undef"
10464 case "$d_memcmp" in
10465 "$define")
10466         echo " "
10467         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10468         $cat >try.c <<EOCP
10469 #$i_memory I_MEMORY
10470 #$i_stdlib I_STDLIB
10471 #$i_string I_STRING
10472 #$i_unistd I_UNISTD
10473 EOCP
10474         $cat >>try.c <<'EOCP'
10475 #include <stdio.h>
10476 #ifdef I_MEMORY
10477 #  include <memory.h>
10478 #endif
10479 #ifdef I_STDLIB
10480 #  include <stdlib.h>
10481 #endif
10482 #ifdef I_STRING
10483 #  include <string.h>
10484 #else
10485 #  include <strings.h>
10486 #endif
10487 #ifdef I_UNISTD
10488 #  include <unistd.h>  /* Needed for NetBSD */
10489 #endif
10490 int main()
10491 {
10492 char a = -1;
10493 char b = 0;
10494 if ((a < b) && memcmp(&a, &b, 1) < 0)
10495         exit(1);
10496 exit(0);
10497 }
10498 EOCP
10499         set try
10500         if eval $compile_ok; then
10501                 if ./try 2>/dev/null; then
10502                         echo "Yes, it can."
10503                         val="$define"
10504                 else
10505                         echo "No, it can't (it uses signed chars)."
10506                 fi
10507         else
10508                 echo "(I can't compile the test program, so we'll assume not...)"
10509         fi
10510         ;;
10511 esac
10512 $rm -f try.* try core
10513 set d_sanemcmp
10514 eval $setvar
10515
10516 : see if select exists
10517 set select d_select
10518 eval $inlibc
10519
10520 : see if semctl exists
10521 set semctl d_semctl
10522 eval $inlibc
10523
10524 : see if semget exists
10525 set semget d_semget
10526 eval $inlibc
10527
10528 : see if semop exists
10529 set semop d_semop
10530 eval $inlibc
10531
10532 : see how much of the 'sem*(2)' library is present.
10533 h_sem=true
10534 echo " "
10535 case "$d_semctl$d_semget$d_semop" in
10536 *"$undef"*) h_sem=false;;
10537 esac
10538 case "$osname" in
10539 freebsd)
10540     case "`ipcs 2>&1`" in
10541     "SVID messages"*"not configured"*)
10542         echo "Your $osname does not have the sem*(2) configured." >&4
10543         h_sem=false
10544         val="$undef"
10545         set semctl d_semctl
10546         eval $setvar
10547         set semget d_semget
10548         eval $setvar
10549         set semop d_semop
10550         eval $setvar
10551         ;;
10552     esac
10553     ;;
10554 esac
10555 : we could also check for sys/ipc.h ...
10556 if $h_sem && $test `./findhdr sys/sem.h`; then
10557         echo "You have the full sem*(2) library." >&4
10558         val="$define"
10559 else
10560         echo "You don't have the full sem*(2) library." >&4
10561         val="$undef"
10562 fi
10563 set d_sem
10564 eval $setvar
10565
10566 : see whether sys/sem.h defines union semun
10567 echo " "
10568 $cat > try.c <<'END'
10569 #include <sys/types.h>
10570 #include <sys/ipc.h>
10571 #include <sys/sem.h>
10572 int main () { union semun semun; semun.buf = 0; }
10573 END
10574 set try
10575 if eval $compile; then
10576     echo "You have union semun in <sys/sem.h>." >&4
10577     val="$define"
10578 else
10579     echo "You do not have union semun in <sys/sem.h>." >&4
10580     val="$undef"
10581 fi
10582 $rm -f try try.c try.h
10583 set d_union_semun
10584 eval $setvar
10585
10586 : see how to do semctl IPC_STAT
10587 case "$d_sem" in
10588 $define)
10589     : see whether semctl IPC_STAT can use union semun
10590     echo " "
10591     $cat > try.h <<END
10592 #ifndef S_IRUSR
10593 #   ifdef S_IREAD
10594 #       define S_IRUSR S_IREAD
10595 #       define S_IWUSR S_IWRITE
10596 #       define S_IXUSR S_IEXEC
10597 #   else
10598 #       define S_IRUSR 0400
10599 #       define S_IWUSR 0200
10600 #       define S_IXUSR 0100
10601 #   endif
10602 #   define S_IRGRP (S_IRUSR>>3)
10603 #   define S_IWGRP (S_IWUSR>>3)
10604 #   define S_IXGRP (S_IXUSR>>3)
10605 #   define S_IROTH (S_IRUSR>>6)
10606 #   define S_IWOTH (S_IWUSR>>6)
10607 #   define S_IXOTH (S_IXUSR>>6)
10608 #endif
10609 #ifndef S_IRWXU
10610 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10611 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10612 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10613 #endif
10614 END
10615
10616     $cat > try.c <<END
10617 #include <sys/types.h>
10618 #include <sys/ipc.h>
10619 #include <sys/sem.h>
10620 #include <sys/stat.h>
10621 #include <stdio.h>
10622 #include <errno.h>
10623 #include "try.h"
10624 #ifndef errno
10625 extern int errno;
10626 #endif
10627 #$d_union_semun HAS_UNION_SEMUN
10628 int main() {
10629     union semun
10630 #ifndef HAS_UNION_SEMUN
10631     {
10632         int val;
10633         struct semid_ds *buf;
10634         unsigned short *array;
10635     }
10636 #endif
10637     arg;
10638     int sem, st;
10639
10640 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10641     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10642     if (sem > -1) {
10643         struct semid_ds argbuf;
10644         arg.buf = &argbuf;
10645 #       ifdef IPC_STAT
10646         st = semctl(sem, 0, IPC_STAT, arg);
10647         if (st == 0)
10648             printf("semun\n");
10649         else
10650 #       endif /* IPC_STAT */
10651             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10652 #       ifdef IPC_RMID
10653         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10654 #       endif /* IPC_RMID */
10655             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10656     } else
10657 #endif /* IPC_PRIVATE && ... */
10658         printf("semget failed: errno = %d\n", errno);
10659   return 0;
10660 }
10661 END
10662     val="$undef"
10663     set try
10664     if eval $compile; then
10665         xxx=`./try`
10666         case "$xxx" in
10667         semun) val="$define" ;;
10668         esac
10669     fi
10670     $rm -f try try.c
10671     set d_semctl_semun
10672     eval $setvar
10673     case "$d_semctl_semun" in
10674     $define)
10675         echo "You can use union semun for semctl IPC_STAT." >&4
10676         also='also'
10677         ;;
10678     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10679         also=''
10680         ;;
10681     esac
10682
10683     : see whether semctl IPC_STAT can use struct semid_ds pointer
10684     $cat > try.c <<'END'
10685 #include <sys/types.h>
10686 #include <sys/ipc.h>
10687 #include <sys/sem.h>
10688 #include <sys/stat.h>
10689 #include "try.h"
10690 #include <stdio.h>
10691 #include <errno.h>
10692 #ifndef errno
10693 extern int errno;
10694 #endif
10695 int main() {
10696     struct semid_ds arg;
10697     int sem, st;
10698
10699 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10700     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10701     if (sem > -1) {
10702 #       ifdef IPC_STAT
10703         st = semctl(sem, 0, IPC_STAT, &arg);
10704         if (st == 0)
10705             printf("semid_ds\n");
10706         else
10707 #       endif /* IPC_STAT */
10708             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10709 #       ifdef IPC_RMID
10710         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10711 #       endif /* IPC_RMID */
10712             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10713     } else
10714 #endif /* IPC_PRIVATE && ... */
10715         printf("semget failed: errno = %d\n", errno);
10716
10717     return 0;
10718 }
10719 END
10720     val="$undef"
10721     set try
10722     if eval $compile; then
10723         xxx=`./try`
10724         case "$xxx" in
10725         semid_ds) val="$define" ;;
10726         esac
10727     fi
10728     $rm -f try try.c
10729     set d_semctl_semid_ds
10730     eval $setvar
10731     case "$d_semctl_semid_ds" in
10732     $define)
10733         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10734         ;;
10735     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10736         ;;
10737     esac
10738     $rm -f try.h
10739     ;;
10740 *)  val="$undef"
10741
10742     # We do not have the full sem*(2) library, so assume we can not
10743     # use either.
10744
10745     set d_semctl_semun
10746     eval $setvar
10747
10748     set d_semctl_semid_ds
10749     eval $setvar
10750     ;;
10751 esac
10752
10753 : see if setegid exists
10754 set setegid d_setegid
10755 eval $inlibc
10756
10757 : see if seteuid exists
10758 set seteuid d_seteuid
10759 eval $inlibc
10760
10761 : see if setgrent exists
10762 set setgrent d_setgrent
10763 eval $inlibc
10764
10765 : see if sethostent exists
10766 set sethostent d_sethent
10767 eval $inlibc
10768
10769 : see if setlinebuf exists
10770 set setlinebuf d_setlinebuf
10771 eval $inlibc
10772
10773 : see if setlocale exists
10774 set setlocale d_setlocale
10775 eval $inlibc
10776
10777 : see if setnetent exists
10778 set setnetent d_setnent
10779 eval $inlibc
10780
10781 : see if setprotoent exists
10782 set setprotoent d_setpent
10783 eval $inlibc
10784
10785 : see if setpgid exists
10786 set setpgid d_setpgid
10787 eval $inlibc
10788
10789 : see if setpgrp2 exists
10790 set setpgrp2 d_setpgrp2
10791 eval $inlibc
10792
10793 : see if setpriority exists
10794 set setpriority d_setprior
10795 eval $inlibc
10796
10797 : see if setpwent exists
10798 set setpwent d_setpwent
10799 eval $inlibc
10800
10801 : see if setregid exists
10802 set setregid d_setregid
10803 eval $inlibc
10804 set setresgid d_setresgid
10805 eval $inlibc
10806
10807 : see if setreuid exists
10808 set setreuid d_setreuid
10809 eval $inlibc
10810 set setresuid d_setresuid
10811 eval $inlibc
10812
10813 : see if setrgid exists
10814 set setrgid d_setrgid
10815 eval $inlibc
10816
10817 : see if setruid exists
10818 set setruid d_setruid
10819 eval $inlibc
10820
10821 : see if setservent exists
10822 set setservent d_setsent
10823 eval $inlibc
10824
10825 : see if setsid exists
10826 set setsid d_setsid
10827 eval $inlibc
10828
10829 : see if setspent exists
10830 set setspent d_setspent
10831 eval $inlibc
10832
10833 : see if setvbuf exists
10834 set setvbuf d_setvbuf
10835 eval $inlibc
10836
10837 : see if sfio.h is available
10838 set sfio.h i_sfio
10839 eval $inhdr
10840
10841
10842 : see if sfio library is available
10843 case "$i_sfio" in
10844 $define)
10845         val=''
10846         set sfreserve val
10847         eval $inlibc
10848         ;;
10849 *)
10850         val="$undef"
10851         ;;
10852 esac
10853 : Ok, but do we want to use it.
10854 case "$val" in
10855 $define)
10856         case "$usesfio" in
10857         true|$define|[yY]*) dflt='y';;
10858         *) dflt='n';;
10859         esac
10860         echo "$package can use the sfio library, but it is experimental."
10861         rp="You seem to have sfio available, do you want to try using it?"
10862         . ./myread
10863         case "$ans" in
10864         y|Y) ;;
10865         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10866                 val="$undef"
10867                 : Remove sfio from list of libraries to use
10868                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10869                 shift
10870                 libs="$*"
10871                 echo "libs = $libs" >&4
10872                 ;;
10873         esac
10874         ;;
10875 *)      case "$usesfio" in
10876         true|$define|[yY]*)
10877                 echo "Sorry, cannot find sfio on this machine" >&4
10878                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10879                 ;;
10880         esac
10881         ;;
10882 esac
10883 set d_sfio
10884 eval $setvar
10885 case "$d_sfio" in
10886 $define) usesfio='true';;
10887 *) usesfio='false';;
10888 esac
10889
10890 : see if shmctl exists
10891 set shmctl d_shmctl
10892 eval $inlibc
10893
10894 : see if shmget exists
10895 set shmget d_shmget
10896 eval $inlibc
10897
10898 : see if shmat exists
10899 set shmat d_shmat
10900 eval $inlibc
10901 : see what shmat returns
10902 case "$d_shmat" in
10903 "$define")
10904         $cat >shmat.c <<'END'
10905 #include <sys/shm.h>
10906 void *shmat();
10907 END
10908         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10909                 shmattype='void *'
10910         else
10911                 shmattype='char *'
10912         fi
10913         echo "and it returns ($shmattype)." >&4
10914         : see if a prototype for shmat is available
10915         xxx=`./findhdr sys/shm.h`
10916         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10917         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10918                 val="$define"
10919         else
10920                 val="$undef"
10921         fi
10922         $rm -f shmat.[co]
10923         ;;
10924 *)
10925         val="$undef"
10926         ;;
10927 esac
10928 set d_shmatprototype
10929 eval $setvar
10930
10931 : see if shmdt exists
10932 set shmdt d_shmdt
10933 eval $inlibc
10934
10935 : see how much of the 'shm*(2)' library is present.
10936 h_shm=true
10937 echo " "
10938 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10939 *"$undef"*) h_shm=false;;
10940 esac
10941 case "$osname" in
10942 freebsd)
10943     case "`ipcs 2>&1`" in
10944     "SVID shared memory"*"not configured"*)
10945         echo "Your $osname does not have the shm*(2) configured." >&4
10946         h_shm=false
10947         val="$undef"
10948         set shmctl d_shmctl
10949         evat $setvar
10950         set shmget d_shmget
10951         evat $setvar
10952         set shmat d_shmat
10953         evat $setvar
10954         set shmdt d_shmdt
10955         evat $setvar
10956         ;;
10957     esac
10958     ;;
10959 esac
10960 : we could also check for sys/ipc.h ...
10961 if $h_shm && $test `./findhdr sys/shm.h`; then
10962         echo "You have the full shm*(2) library." >&4
10963         val="$define"
10964 else
10965         echo "You don't have the full shm*(2) library." >&4
10966         val="$undef"
10967 fi
10968 set d_shm
10969 eval $setvar
10970
10971 echo " "
10972 : see if we have sigaction
10973 if set sigaction val -f d_sigaction; eval $csym; $val; then
10974         echo 'sigaction() found.' >&4
10975         $cat > try.c <<'EOP'
10976 #include <stdio.h>
10977 #include <sys/types.h>
10978 #include <signal.h>
10979 int main()
10980 {
10981     struct sigaction act, oact;
10982     act.sa_flags = 0;
10983     oact.sa_handler = 0;
10984     /* so that act and oact are used */
10985     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10986 }
10987 EOP
10988         set try
10989         if eval $compile_ok; then
10990                 val="$define"
10991         else
10992                 echo "But you don't seem to have a useable struct sigaction." >&4
10993                 val="$undef"
10994         fi
10995 else
10996         echo 'sigaction NOT found.' >&4
10997         val="$undef"
10998 fi
10999 set d_sigaction; eval $setvar
11000 $rm -f try try$_o try.c
11001
11002 : see if sigsetjmp exists
11003 echo " "
11004 case "$d_sigsetjmp" in
11005 '')
11006         $cat >try.c <<'EOP'
11007 #include <setjmp.h>
11008 sigjmp_buf env;
11009 int set = 1;
11010 int main()
11011 {
11012         if (sigsetjmp(env,1))
11013                 exit(set);
11014         set = 0;
11015         siglongjmp(env, 1);
11016         exit(1);
11017 }
11018 EOP
11019         set try
11020         if eval $compile; then
11021                 if ./try >/dev/null 2>&1; then
11022                         echo "POSIX sigsetjmp found." >&4
11023                         val="$define"
11024                 else
11025                         $cat >&4 <<EOM
11026 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11027 I'll ignore them.
11028 EOM
11029                         val="$undef"
11030                 fi
11031         else
11032                 echo "sigsetjmp not found." >&4
11033                 val="$undef"
11034         fi
11035         ;;
11036 *) val="$d_sigsetjmp"
11037         case "$d_sigsetjmp" in
11038         $define) echo "POSIX sigsetjmp found." >&4;;
11039         $undef) echo "sigsetjmp not found." >&4;;
11040         esac
11041         ;;
11042 esac
11043 set d_sigsetjmp
11044 eval $setvar
11045 $rm -f try.c try
11046
11047 : see what type is used for size_t
11048 rp="What is the type used for the length parameter for string functions?"
11049 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11050 eval $typedef_ask
11051
11052 : check for socklen_t
11053 echo " "
11054 echo "Checking to see if you have socklen_t..." >&4
11055 $cat >try.c <<EOCP
11056 #include <sys/types.h>
11057 #$d_socket HAS_SOCKET
11058 #ifdef HAS_SOCKET
11059 #include <sys/socket.h>
11060 #endif
11061 int main() { socklen_t x = 16; }
11062 EOCP
11063 set try
11064 if eval $compile; then
11065         val="$define"
11066         echo "You have socklen_t."
11067 else
11068         val="$undef"
11069         echo "You do not have socklen_t."
11070         case "$sizetype" in
11071         size_t) echo "(You do have size_t, that might work.)" ;;
11072         esac
11073 fi
11074 $rm -f try try.*
11075 set d_socklen_t
11076 eval $setvar
11077
11078 : see if sys/stat.h is available
11079 set sys/stat.h i_sysstat
11080 eval $inhdr
11081
11082
11083 : see if stat knows about block sizes
11084 echo " "
11085 echo "Checking to see if your struct stat has st_blocks field..." >&4
11086 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11087 eval $hasfield
11088
11089
11090 : see if this is a sys/vfs.h system
11091 set sys/vfs.h i_sysvfs
11092 eval $inhdr
11093
11094
11095 : see if this is a sys/statfs.h system
11096 set sys/statfs.h i_sysstatfs
11097 eval $inhdr
11098
11099
11100 echo " "
11101 echo "Checking to see if your system supports struct statfs..." >&4
11102 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
11103 eval $hasstruct
11104 case "$d_statfs_s" in
11105 "$define")      echo "Yes, it does."   ;;
11106 *)              echo "No, it doesn't." ;;
11107 esac
11108
11109
11110
11111 : see if struct statfs knows about f_flags
11112 case "$d_statfs_s" in
11113 define) 
11114         echo " "
11115         echo "Checking to see if your struct statfs has f_flags field..." >&4
11116         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
11117         eval $hasfield
11118         ;;
11119 *)      val="$undef"
11120         set d_statfs_f_flags
11121         eval $setvar
11122         ;;
11123 esac
11124 case "$d_statfs_f_flags" in
11125 "$define")      echo "Yes, it does."   ;;
11126 *)              echo "No, it doesn't." ;;
11127 esac
11128
11129 : see if _ptr and _cnt from stdio act std
11130 echo " "
11131 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11132         echo "(Looks like you have stdio.h from Linux.)"
11133         case "$stdio_ptr" in
11134         '') stdio_ptr='((fp)->_IO_read_ptr)'
11135                 ptr_lval=$define
11136                 ;;
11137         *)      ptr_lval=$d_stdio_ptr_lval;;
11138         esac
11139         case "$stdio_cnt" in
11140         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11141                 cnt_lval=$undef
11142                 ;;
11143         *)      cnt_lval=$d_stdio_cnt_lval;;
11144         esac
11145         case "$stdio_base" in
11146         '') stdio_base='((fp)->_IO_read_base)';;
11147         esac
11148         case "$stdio_bufsiz" in
11149         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11150         esac
11151 else
11152         case "$stdio_ptr" in
11153         '') stdio_ptr='((fp)->_ptr)'
11154                 ptr_lval=$define
11155                 ;;
11156         *)      ptr_lval=$d_stdio_ptr_lval;;
11157         esac
11158         case "$stdio_cnt" in
11159         '') stdio_cnt='((fp)->_cnt)'
11160                 cnt_lval=$define
11161                 ;;
11162         *)      cnt_lval=$d_stdio_cnt_lval;;
11163         esac
11164         case "$stdio_base" in
11165         '') stdio_base='((fp)->_base)';;
11166         esac
11167         case "$stdio_bufsiz" in
11168         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11169         esac
11170 fi
11171 : test whether _ptr and _cnt really work
11172 echo "Checking how std your stdio is..." >&4
11173 $cat >try.c <<EOP
11174 #include <stdio.h>
11175 #define FILE_ptr(fp)    $stdio_ptr
11176 #define FILE_cnt(fp)    $stdio_cnt
11177 int main() {
11178         FILE *fp = fopen("try.c", "r");
11179         char c = getc(fp);
11180         if (
11181                 18 <= FILE_cnt(fp) &&
11182                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11183         )
11184                 exit(0);
11185         exit(1);
11186 }
11187 EOP
11188 val="$undef"
11189 set try
11190 if eval $compile; then
11191         if ./try; then
11192                 echo "Your stdio acts pretty std."
11193                 val="$define"
11194         else
11195                 echo "Your stdio isn't very std."
11196         fi
11197 else
11198         echo "Your stdio doesn't appear very std."
11199 fi
11200 $rm -f try.c try
11201 set d_stdstdio
11202 eval $setvar
11203
11204 : Can _ptr be used as an lvalue?
11205 case "$d_stdstdio$ptr_lval" in
11206 $define$define) val=$define ;;
11207 *) val=$undef ;;
11208 esac
11209 set d_stdio_ptr_lval
11210 eval $setvar
11211
11212 : Can _cnt be used as an lvalue?
11213 case "$d_stdstdio$cnt_lval" in
11214 $define$define) val=$define ;;
11215 *) val=$undef ;;
11216 esac
11217 set d_stdio_cnt_lval
11218 eval $setvar
11219
11220 : see if _base is also standard
11221 val="$undef"
11222 case "$d_stdstdio" in
11223 $define)
11224         $cat >try.c <<EOP
11225 #include <stdio.h>
11226 #define FILE_base(fp)   $stdio_base
11227 #define FILE_bufsiz(fp) $stdio_bufsiz
11228 int main() {
11229         FILE *fp = fopen("try.c", "r");
11230         char c = getc(fp);
11231         if (
11232                 19 <= FILE_bufsiz(fp) &&
11233                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11234         )
11235                 exit(0);
11236         exit(1);
11237 }
11238 EOP
11239         set try
11240         if eval $compile; then
11241                 if ./try; then
11242                         echo "And its _base field acts std."
11243                         val="$define"
11244                 else
11245                         echo "But its _base field isn't std."
11246                 fi
11247         else
11248                 echo "However, it seems to be lacking the _base field."
11249         fi
11250         $rm -f try.c try
11251         ;;
11252 esac
11253 set d_stdiobase
11254 eval $setvar
11255
11256 $cat >&4 <<EOM
11257 Checking how to access stdio streams by file descriptor number...
11258 EOM
11259 case "$stdio_stream_array" in
11260 '')     $cat >try.c <<EOCP
11261 #include <stdio.h>
11262 int main() {
11263   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11264     printf("yes\n");
11265 }
11266 EOCP
11267         for s in _iob __iob __sF
11268         do
11269                 set try -DSTDIO_STREAM_ARRAY=$s
11270                 if eval $compile; then
11271                         case "`./try$exe_ext`" in
11272                         yes)    stdio_stream_array=$s; break ;;
11273                         esac
11274                 fi
11275         done
11276         $rm -f try.* try$exe_ext
11277 esac
11278 case "$stdio_stream_array" in
11279 '')     $cat >&4 <<EOM
11280 I can't figure out how to access stdio streams by file descriptor number.
11281 EOM
11282         d_stdio_stream_array="$undef"
11283         ;;
11284 *)      $cat >&4 <<EOM
11285 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11286 EOM
11287         d_stdio_stream_array="$define"
11288         ;;
11289 esac
11290
11291 : see if strcoll exists
11292 set strcoll d_strcoll
11293 eval $inlibc
11294
11295 : check for structure copying
11296 echo " "
11297 echo "Checking to see if your C compiler can copy structs..." >&4
11298 $cat >try.c <<'EOCP'
11299 int main()
11300 {
11301         struct blurfl {
11302                 int dyick;
11303         } foo, bar;
11304
11305         foo = bar;
11306 }
11307 EOCP
11308 if $cc -c try.c >/dev/null 2>&1 ; then
11309         val="$define"
11310         echo "Yup, it can."
11311 else
11312         val="$undef"
11313         echo "Nope, it can't."
11314 fi
11315 set d_strctcpy
11316 eval $setvar
11317 $rm -f try.*
11318
11319 : see if strerror and/or sys_errlist[] exist
11320 echo " "
11321 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11322     if set strerror val -f d_strerror; eval $csym; $val; then
11323                 echo 'strerror() found.' >&4
11324                 d_strerror="$define"
11325                 d_strerrm='strerror(e)'
11326                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11327                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11328                         d_syserrlst="$define"
11329                 else
11330                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11331                         d_syserrlst="$undef"
11332                 fi
11333     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11334                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11335                 echo 'strerror() found in string header.' >&4
11336                 d_strerror="$define"
11337                 d_strerrm='strerror(e)'
11338                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11339                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11340                                 d_syserrlst="$define"
11341                 else
11342                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11343                         d_syserrlst="$undef"
11344                 fi
11345     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11346                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11347                 d_strerror="$undef"
11348                 d_syserrlst="$define"
11349                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11350     else
11351                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11352                 d_strerror="$undef"
11353                 d_syserrlst="$undef"
11354                 d_strerrm='"unknown"'
11355     fi
11356 fi
11357
11358 : see if strtod exists
11359 set strtod d_strtod
11360 eval $inlibc
11361
11362 : see if strtol exists
11363 set strtol d_strtol
11364 eval $inlibc
11365
11366 : see if strtold exists
11367 set strtold d_strtold
11368 eval $inlibc
11369
11370 : see if strtoll exists
11371 set strtoll d_strtoll
11372 eval $inlibc
11373
11374 : see if strtoul exists
11375 set strtoul d_strtoul
11376 eval $inlibc
11377
11378 : see if strtoull exists
11379 set strtoull d_strtoull
11380 eval $inlibc
11381
11382 : see if strtouq exists
11383 set strtouq d_strtouq
11384 eval $inlibc
11385
11386 : see if strxfrm exists
11387 set strxfrm d_strxfrm
11388 eval $inlibc
11389
11390 : see if symlink exists
11391 set symlink d_symlink
11392 eval $inlibc
11393
11394 : see if syscall exists
11395 set syscall d_syscall
11396 eval $inlibc
11397
11398 : see if sysconf exists
11399 set sysconf d_sysconf
11400 eval $inlibc
11401
11402 : see if system exists
11403 set system d_system
11404 eval $inlibc
11405
11406 : see if tcgetpgrp exists
11407 set tcgetpgrp d_tcgetpgrp
11408 eval $inlibc
11409
11410 : see if tcsetpgrp exists
11411 set tcsetpgrp d_tcsetpgrp
11412 eval $inlibc
11413
11414 : see if prototype for telldir is available
11415 echo " "
11416 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11417 eval $hasproto
11418
11419 : see if this is a sys/times.h system
11420 set sys/times.h i_systimes
11421 eval $inhdr
11422
11423 : see if times exists
11424 echo " "
11425 if set times val -f d_times; eval $csym; $val; then
11426         echo 'times() found.' >&4
11427         d_times="$define"
11428         inc=''
11429         case "$i_systimes" in
11430         "$define") inc='sys/times.h';;
11431         esac
11432         rp="What is the type returned by times() on this system?"
11433         set clock_t clocktype long stdio.h sys/types.h $inc
11434         eval $typedef_ask
11435 else
11436         echo 'times() NOT found, hope that will do.' >&4
11437         d_times="$undef"
11438         clocktype='int'
11439 fi
11440
11441 : see if truncate exists
11442 set truncate d_truncate
11443 eval $inlibc
11444
11445 : see if tzname[] exists
11446 echo " "
11447 if set tzname val -a d_tzname; eval $csym; $val; then
11448         val="$define"
11449         echo 'tzname[] found.' >&4
11450 else
11451         val="$undef"
11452         echo 'tzname[] NOT found.' >&4
11453 fi
11454 set d_tzname
11455 eval $setvar
11456
11457 : see if umask exists
11458 set umask d_umask
11459 eval $inlibc
11460
11461 : see if ustat exists
11462 set ustat d_ustat
11463 eval $inlibc
11464
11465 : backward compatibility for d_hvfork
11466 if test X$d_hvfork != X; then
11467         d_vfork="$d_hvfork"
11468         d_hvfork=''
11469 fi
11470 : see if there is a vfork
11471 val=''
11472 set vfork val
11473 eval $inlibc
11474
11475 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11476 : perl on Solaris 2.x, and probably elsewhere.
11477 case "$val" in
11478 $define)
11479         echo " "
11480         case "$usevfork" in
11481         false) dflt='n';;
11482         *) dflt='y';;
11483         esac
11484         cat <<'EOM'
11485  
11486 Perl can only use a vfork() that doesn't suffer from strict
11487 restrictions on calling functions or modifying global data in
11488 the child.  For example, glibc-2.1 contains such a vfork()
11489 that is unsuitable.  If your system provides a proper fork()
11490 call, chances are that you do NOT want perl to use vfork().
11491
11492 EOM
11493         rp="Do you still want to use vfork()?"
11494         . ./myread
11495         case "$ans" in
11496         y|Y) ;;
11497         *)
11498                 echo "Ok, we won't use vfork()."
11499                 val="$undef"
11500                 ;;
11501         esac
11502         ;;
11503 esac
11504 set d_vfork
11505 eval $setvar
11506 case "$d_vfork" in
11507 $define) usevfork='true';;
11508 *) usevfork='false';;
11509 esac
11510
11511 : see if this is an sysdir system
11512 set sys/dir.h i_sysdir
11513 eval $inhdr
11514
11515 : see if this is an sysndir system
11516 set sys/ndir.h i_sysndir
11517 eval $inhdr
11518
11519 : see if closedir exists
11520 set closedir d_closedir
11521 eval $inlibc
11522
11523 case "$d_closedir" in
11524 "$define")
11525         echo " "
11526         echo "Checking whether closedir() returns a status..." >&4
11527         cat > closedir.c <<EOM
11528 #$i_dirent I_DIRENT             /**/
11529 #$i_sysdir I_SYS_DIR            /**/
11530 #$i_sysndir I_SYS_NDIR          /**/
11531 #$i_systypes I_SYS_TYPES        /**/
11532
11533 #if defined(I_SYS_TYPES)
11534 #include <sys/types.h>
11535 #endif
11536 #if defined(I_DIRENT)
11537 #include <dirent.h>
11538 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11539 #include <sys/dir.h>
11540 #endif
11541 #else
11542 #ifdef I_SYS_NDIR
11543 #include <sys/ndir.h>
11544 #else
11545 #ifdef I_SYS_DIR
11546 #ifdef hp9000s500
11547 #include <ndir.h>       /* may be wrong in the future */
11548 #else
11549 #include <sys/dir.h>
11550 #endif
11551 #endif
11552 #endif
11553 #endif 
11554 int main() { return closedir(opendir(".")); }
11555 EOM
11556         set closedir
11557         if eval $compile_ok; then
11558                 if ./closedir > /dev/null 2>&1 ; then
11559                         echo "Yes, it does."
11560                         val="$undef"
11561                 else
11562                         echo "No, it doesn't."
11563                         val="$define"
11564                 fi
11565         else
11566                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11567                 val="$define"
11568         fi
11569         ;;
11570 *)
11571         val="$undef";
11572         ;;
11573 esac
11574 set d_void_closedir
11575 eval $setvar
11576 $rm -f closedir*
11577 : check for volatile keyword
11578 echo " "
11579 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11580 $cat >try.c <<'EOCP'
11581 int main()
11582 {
11583         typedef struct _goo_struct goo_struct;
11584         goo_struct * volatile goo = ((goo_struct *)0);
11585         struct _goo_struct {
11586                 long long_int;
11587                 int reg_int;
11588                 char char_var;
11589         };
11590         typedef unsigned short foo_t;
11591         char *volatile foo;
11592         volatile int bar;
11593         volatile foo_t blech;
11594         foo = foo;
11595 }
11596 EOCP
11597 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11598         val="$define"
11599         echo "Yup, it does."
11600 else
11601         val="$undef"
11602         echo "Nope, it doesn't."
11603 fi
11604 set d_volatile
11605 eval $setvar
11606 $rm -f try.*
11607
11608 : see if there is a wait4
11609 set wait4 d_wait4
11610 eval $inlibc
11611
11612 : see if waitpid exists
11613 set waitpid d_waitpid
11614 eval $inlibc
11615
11616 : see if wcstombs exists
11617 set wcstombs d_wcstombs
11618 eval $inlibc
11619
11620 : see if wctomb exists
11621 set wctomb d_wctomb
11622 eval $inlibc
11623
11624 : preserve RCS keywords in files with variable substitution, grrr
11625 Date='$Date'
11626 Id='$Id'
11627 Log='$Log'
11628 RCSfile='$RCSfile'
11629 Revision='$Revision'
11630
11631 case "$crosscompile" in
11632 ''|[nN]*) crosscompile="$undef" ;;
11633 esac
11634
11635 case "$osname" in
11636 next|rhapsody) multiarch="$define" ;;
11637 esac
11638 case "$multiarch" in
11639 ''|[nN]*) multiarch="$undef" ;;
11640 esac
11641
11642 : check for alignment requirements
11643 echo " "
11644 case "$crosscompile$multiarch" in
11645 *$define*)
11646         $cat <<EOM
11647 You seem to be either cross-compiling or doing a multiarchitecture build,
11648 skipping the memory alignment check.
11649
11650 EOM
11651         case "$alignbytes" in
11652         '') alignbytes=8 ;;
11653         esac
11654         ;;
11655 *)
11656         case "$alignbytes" in
11657         '') echo "Checking alignment constraints..." >&4
11658                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11659                         $cat >try.c <<'EOCP'
11660 typedef long double NV;
11661 EOCP
11662                 else
11663                         $cat >try.c <<'EOCP'
11664 typedef double NV;
11665 EOCP
11666                 fi
11667                 $cat >>try.c <<'EOCP'
11668 #include <stdio.h>
11669 struct foobar {
11670         char foo;
11671         NV bar;
11672 } try_algn;
11673 int main()
11674 {
11675     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11676     return(0);
11677 }
11678 EOCP
11679                 set try
11680                 if eval $compile_ok; then
11681                         dflt=`./try`
11682                 else
11683                         dflt='8'
11684                         echo "(I can't seem to compile the test program...)"
11685                 fi
11686                 ;;
11687         *) dflt="$alignbytes"
11688                 ;;
11689         esac
11690         rp="Doubles must be aligned on a how-many-byte boundary?"
11691         . ./myread
11692         alignbytes="$ans"
11693         $rm -f try.c try
11694         ;;
11695 esac
11696
11697
11698 : set the base revision
11699 baserev=5.0
11700
11701 : check for ordering of bytes in a long
11702 echo " "
11703 case "$crosscompile$multiarch" in
11704 *$define*)
11705         $cat <<EOM
11706 You seem to be either cross-compiling or doing a multiarchitecture build,
11707 skipping the byteorder check.
11708
11709 EOM
11710         byteorder='0xffff'
11711         ;;
11712 *)
11713         case "$byteorder" in
11714         '')
11715                 $cat <<'EOM'
11716 In the following, larger digits indicate more significance.  A big-endian
11717 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11718 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11719 machines may have weird orders like 3412.  A Cray will report 87654321,
11720 an Alpha will report 12345678. If the test program works the default is
11721 probably right.
11722 I'm now running the test program...
11723 EOM
11724                 $cat >try.c <<'EOCP'
11725 #include <stdio.h>
11726 int main()
11727 {
11728         int i;
11729         union {
11730                 unsigned long l;
11731                 char c[sizeof(long)];
11732         } u;
11733
11734         if (sizeof(long) > 4)
11735                 u.l = (0x08070605L << 32) | 0x04030201L;
11736         else
11737                 u.l = 0x04030201L;
11738         for (i = 0; i < sizeof(long); i++)
11739                 printf("%c", u.c[i]+'0');
11740         printf("\n");
11741         exit(0);
11742 }
11743 EOCP
11744                 xxx_prompt=y
11745                 set try
11746                 if eval $compile && ./try > /dev/null; then
11747                         dflt=`./try`
11748                         case "$dflt" in
11749                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11750                                 echo "(The test program ran ok.)"
11751                                 echo "byteorder=$dflt"
11752                                 xxx_prompt=n
11753                         ;;
11754                         ????|????????) echo "(The test program ran ok.)" ;;
11755                         *) echo "(The test program didn't run right for some reason.)" ;;
11756                         esac
11757                 else
11758                         dflt='4321'
11759                         cat <<'EOM'
11760 (I can't seem to compile the test program.  Guessing big-endian...)
11761 EOM
11762                 fi
11763                 case "$xxx_prompt" in
11764                 y)
11765                         rp="What is the order of bytes in a long?"
11766                         . ./myread
11767                         byteorder="$ans"
11768                         ;;
11769                 *)      byteorder=$dflt
11770                         ;;
11771                 esac
11772                 ;;
11773         esac
11774         $rm -f try.c try
11775         ;;
11776 esac
11777
11778
11779 : how do we catenate cpp tokens here?
11780 echo " "
11781 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11782 $cat >cpp_stuff.c <<'EOCP'
11783 #define RCAT(a,b)a/**/b
11784 #define ACAT(a,b)a ## b
11785 RCAT(Rei,ser)
11786 ACAT(Cir,cus)
11787 EOCP
11788 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11789 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11790         echo "Oh!  Smells like ANSI's been here." >&4
11791         echo "We can catify or stringify, separately or together!"
11792         cpp_stuff=42
11793 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11794         echo "Ah, yes!  The good old days!" >&4
11795         echo "However, in the good old days we don't know how to stringify and"
11796         echo "catify at the same time."
11797         cpp_stuff=1
11798 else
11799         $cat >&4 <<EOM
11800 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11801 to have to edit the values of CAT[2-5] in config.h...
11802 EOM
11803         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11804 fi
11805 $rm -f cpp_stuff.*
11806
11807 : see if this is a db.h system
11808 set db.h i_db
11809 eval $inhdr
11810
11811 case "$i_db" in
11812 $define)
11813         : Check db version.
11814         echo " "
11815         echo "Checking Berkeley DB version ..." >&4
11816         $cat >try.c <<EOCP
11817 #$d_const HASCONST
11818 #ifndef HASCONST
11819 #define const
11820 #endif
11821 #include <sys/types.h>
11822 #include <stdio.h>
11823 #include <db.h>
11824 int main()
11825 {
11826 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11827     int Major, Minor, Patch ;
11828     unsigned long Version ;
11829     (void)db_version(&Major, &Minor, &Patch) ;
11830     printf("You have Berkeley DB Version 2 or greater\n");
11831
11832     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11833                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11834     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11835                 Major, Minor, Patch) ;
11836
11837     /* check that db.h & libdb are compatible */
11838     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11839         printf("db.h and libdb are incompatible\n") ;
11840         exit(3);        
11841     }
11842
11843     printf("db.h and libdb are compatible\n") ;
11844
11845     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11846                 + DB_VERSION_PATCH ;
11847
11848     /* needs to be >= 2.3.4 */
11849     if (Version < 2003004) {
11850     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11851         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11852         exit(2);        
11853     }
11854
11855     exit(0);
11856 #else
11857 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11858     printf("You have Berkeley DB Version 1\n");
11859     exit(0);    /* DB version < 2: the coast is clear. */
11860 #else
11861     exit(1);    /* <db.h> not Berkeley DB? */
11862 #endif
11863 #endif
11864 }
11865 EOCP
11866         set try
11867         if eval $compile_ok && ./try; then
11868                 echo 'Looks OK.' >&4
11869         else
11870                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11871                 i_db=$undef
11872                 case " $libs " in
11873                 *"-ldb "*)
11874                         : Remove db from list of libraries to use
11875                         echo "Removing unusable -ldb from library list" >&4
11876                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11877                         shift
11878                         libs="$*"
11879                         echo "libs = $libs" >&4
11880                         ;;
11881                 esac
11882         fi
11883         $rm -f try.*
11884         ;;
11885 esac
11886
11887 case "$i_db" in
11888 define)
11889         : Check the return type needed for hash 
11890         echo " "
11891         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11892         $cat >try.c <<EOCP
11893 #$d_const HASCONST
11894 #ifndef HASCONST
11895 #define const
11896 #endif
11897 #include <sys/types.h>
11898 #include <db.h>
11899
11900 #ifndef DB_VERSION_MAJOR
11901 u_int32_t hash_cb (ptr, size)
11902 const void *ptr;
11903 size_t size;
11904 {
11905 }
11906 HASHINFO info;
11907 int main()
11908 {
11909         info.hash = hash_cb;
11910 }
11911 #endif
11912 EOCP
11913         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11914                 if $contains warning try.out >>/dev/null 2>&1 ; then
11915                         db_hashtype='int'
11916                 else
11917                         db_hashtype='u_int32_t'
11918                 fi
11919         else
11920                 : XXX Maybe we should just give up here.
11921                 db_hashtype=u_int32_t
11922                 $cat try.out >&4
11923                 echo "Help:  I can't seem to compile the db test program." >&4
11924                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11925         fi
11926         $rm -f try.*
11927         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11928         ;;
11929 *)      db_hashtype=u_int32_t
11930         ;;
11931 esac
11932 case "$i_db" in
11933 define)
11934         : Check the return type needed for prefix 
11935         echo " "
11936         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11937         cat >try.c <<EOCP
11938 #$d_const HASCONST
11939 #ifndef HASCONST
11940 #define const
11941 #endif
11942 #include <sys/types.h>
11943 #include <db.h>
11944
11945 #ifndef DB_VERSION_MAJOR
11946 size_t prefix_cb (key1, key2)
11947 const DBT *key1;
11948 const DBT *key2;
11949 {
11950 }
11951 BTREEINFO info;
11952 int main()
11953 {
11954         info.prefix = prefix_cb;
11955 }
11956 #endif
11957 EOCP
11958         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11959                 if $contains warning try.out >>/dev/null 2>&1 ; then
11960                         db_prefixtype='int'
11961                 else
11962                         db_prefixtype='size_t'
11963                 fi
11964         else
11965                 db_prefixtype='size_t'
11966                 : XXX Maybe we should just give up here.
11967                 $cat try.out >&4
11968                 echo "Help:  I can't seem to compile the db test program." >&4
11969                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11970         fi
11971         $rm -f try.*
11972         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11973         ;;
11974 *)      db_prefixtype='size_t'
11975         ;;
11976 esac
11977
11978 : check for void type
11979 echo " "
11980 echo "Checking to see how well your C compiler groks the void type..." >&4
11981 case "$voidflags" in
11982 '')
11983         $cat >try.c <<'EOCP'
11984 #if TRY & 1
11985 void sub() {
11986 #else
11987 sub() {
11988 #endif
11989         extern void moo();      /* function returning void */
11990         void (*goo)();          /* ptr to func returning void */
11991 #if TRY & 8
11992         void *hue;              /* generic ptr */
11993 #endif
11994 #if TRY & 2
11995         void (*foo[10])();
11996 #endif
11997
11998 #if TRY & 4
11999         if(goo == moo) {
12000                 exit(0);
12001         }
12002 #endif
12003         exit(0);
12004 }
12005 int main() { sub(); }
12006 EOCP
12007         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12008                 voidflags=$defvoidused
12009         echo "Good.  It appears to support void to the level $package wants.">&4
12010                 if $contains warning .out >/dev/null 2>&1; then
12011                         echo "However, you might get some warnings that look like this:"
12012                         $cat .out
12013                 fi
12014         else
12015 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12016                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12017                         echo "It supports 1..."
12018                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12019                                 echo "It also supports 2..."
12020                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12021                                         voidflags=7
12022                                         echo "And it supports 4 but not 8 definitely."
12023                                 else
12024                                         echo "It doesn't support 4..."
12025                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12026                                                 voidflags=11
12027                                                 echo "But it supports 8."
12028                                         else
12029                                                 voidflags=3
12030                                                 echo "Neither does it support 8."
12031                                         fi
12032                                 fi
12033                         else
12034                                 echo "It does not support 2..."
12035                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12036                                         voidflags=13
12037                                         echo "But it supports 4 and 8."
12038                                 else
12039                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12040                                                 voidflags=5
12041                                                 echo "And it supports 4 but has not heard about 8."
12042                                         else
12043                                                 echo "However it supports 8 but not 4."
12044                                         fi
12045                                 fi
12046                         fi
12047                 else
12048                         echo "There is no support at all for void."
12049                         voidflags=0
12050                 fi
12051         fi
12052 esac
12053 case "$voidflags" in
12054 "$defvoidused") ;;
12055 *)      $cat >&4 <<'EOM'
12056   Support flag bits are:
12057     1: basic void declarations.
12058     2: arrays of pointers to functions returning void.
12059     4: operations between pointers to and addresses of void functions.
12060     8: generic void pointers.
12061 EOM
12062         dflt="$voidflags";
12063         rp="Your void support flags add up to what?"
12064         . ./myread
12065         voidflags="$ans"
12066         ;;
12067 esac
12068 $rm -f try.* .out
12069
12070
12071 : How can we generate normalized random numbers ?
12072 echo " "
12073 echo "Looking for a random number function..." >&4
12074 case "$randfunc" in
12075 '')
12076         if set drand48 val -f; eval $csym; $val; then
12077                 dflt="drand48"
12078                 echo "Good, found drand48()." >&4
12079         elif set random val -f; eval $csym; $val; then
12080                 dflt="random"
12081                 echo "OK, found random()." >&4
12082         else
12083                 dflt="rand"
12084                 echo "Yick, looks like I have to use rand()." >&4
12085         fi
12086         echo " "
12087         ;;
12088 *)
12089         dflt="$randfunc"
12090         ;;
12091 esac
12092 cont=true
12093
12094 case "$ccflags" in
12095 *-Dmy_rand=*|*-Dmy_srand=*)
12096         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12097         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12098         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12099         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12100         ;;
12101 esac
12102
12103 while $test "$cont"; do
12104         rp="Use which function to generate random numbers?"
12105         . ./myread
12106         if $test "$ans" = "$dflt"; then
12107                 : null
12108         else
12109                 randbits=''
12110         fi
12111         randfunc="$ans"
12112         if set $ans val -f; eval $csym; $val; then
12113                 cont=''
12114         else
12115                 dflt=y
12116                 rp="I cannot find function $ans. Use that name anyway?"
12117                 . ./myread
12118                 dflt=rand
12119                 case "$ans" in
12120                         [yY]*) cont='';;
12121                 esac
12122         fi
12123         case "$cont" in
12124         '')
12125                 case "$randfunc" in
12126                 drand48)
12127                         drand01="drand48()"
12128                         seedfunc="srand48"
12129                         randbits=48
12130                         randseedtype=long
12131                         ;;
12132                 rand|random)
12133                         case "$randbits" in
12134                         '')
12135 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12136                                 $cat >try.c <<EOCP
12137 #$i_unistd I_UNISTD
12138 #$i_stdlib I_STDLIB
12139 #include <stdio.h>
12140 #ifdef I_UNISTD
12141 #  include <unistd.h>
12142 #endif
12143 #ifdef I_STDLIB
12144 #  include <stdlib.h>
12145 #endif
12146 int main()
12147 {
12148         register int i;
12149         register unsigned long tmp;
12150         register unsigned long max = 0L;
12151
12152         for (i = 1000; i; i--) {
12153                 tmp = (unsigned long) $randfunc();
12154                 if (tmp > max) max = tmp;
12155         }
12156         for (i = 0; max; i++)
12157                 max /= 2;
12158         printf("%d\n",i);
12159 }
12160 EOCP
12161                                 set try
12162                                 if eval $compile_ok; then
12163                                         dflt=`try`
12164                                 else
12165                                         dflt='?'
12166                                         echo "(I can't seem to compile the test program...)"
12167                                 fi
12168                                 ;;
12169                         *)
12170                                 dflt="$randbits"
12171                                 ;;
12172                         esac
12173                         rp="How many bits does your $randfunc() function produce?"
12174                         . ./myread
12175                         randbits="$ans"
12176                         $rm -f try.c try
12177                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12178                         seedfunc="s$randfunc"
12179                         randseedtype=unsigned
12180                         ;;
12181                 *)
12182                         dflt="31"
12183                         rp="How many bits does your $randfunc() function produce?"
12184                         . ./myread
12185                         randbits="$ans"
12186                         seedfunc="s$randfunc"
12187                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12188                         if set $seedfunc val -f; eval $csym; $val; then
12189                                 echo "(Using $seedfunc() to seed random generator)"
12190                         else
12191                                 echo "(Warning: no $seedfunc() to seed random generator)"
12192                                 seedfunc=rand
12193                         fi
12194                         randseedtype=unsigned
12195                         ;;
12196                 esac
12197                 ;;
12198         esac
12199 done
12200
12201 echo " "
12202 echo "Determining whether or not we are on an EBCDIC system..." >&4
12203 $cat >tebcdic.c <<'EOM'
12204 int main()
12205 {
12206   if ('M'==0xd4) return 0;
12207   return 1;
12208 }
12209 EOM
12210
12211 val=$undef
12212 set tebcdic
12213 if eval $compile_ok; then
12214         if ./tebcdic; then
12215                 echo "You have EBCDIC." >&4
12216                 val="$define"
12217         else
12218                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12219         fi
12220 else
12221         echo "I'm unable to compile the test program." >&4
12222         echo "I'll assume ASCII or some ISO Latin." >&4
12223 fi
12224 $rm -f tebcdic.c tebcdic
12225 set ebcdic
12226 eval $setvar
12227
12228 echo " "
12229 $cat >&4 <<EOM
12230 Checking how to flush all pending stdio output...
12231 EOM
12232 # I only know how to find the first 32 possibly open files on SunOS.
12233 # See also hints/sunos_4_1.sh and util.c  --AD
12234 case "$osname" in
12235 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12236 esac
12237 $cat >>try.c <<EOCP
12238 #include <stdio.h>
12239 #$i_unistd I_UNISTD
12240 #ifdef I_UNISTD
12241 # include <unistd.h>
12242 #endif
12243 #$d_sysconf HAS_SYSCONF
12244 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12245 #ifdef HAS_STDIO_STREAM_ARRAY
12246 # define STDIO_STREAM_ARRAY $stdio_stream_array
12247 #endif
12248 int main() {
12249   FILE* p = fopen("try.out", "w");
12250 #ifdef TRY_FPUTC
12251   fputc('x', p);
12252 #else
12253 # ifdef TRY_FPRINTF
12254   fprintf(p, "x");
12255 # endif
12256 #endif
12257 #ifdef TRY_FFLUSH_NULL
12258   fflush(NULL);
12259 #endif
12260 #ifdef TRY_FFLUSH_ALL
12261   {
12262     long open_max = -1;
12263 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12264     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12265 # else
12266 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12267     open_max = sysconf(_SC_OPEN_MAX);
12268 #  else
12269 #   ifdef FOPEN_MAX
12270     open_max = FOPEN_MAX;
12271 #   else
12272 #    ifdef OPEN_MAX
12273     open_max = OPEN_MAX;
12274 #    else
12275 #     ifdef _NFILE
12276     open_max = _NFILE;
12277 #     endif
12278 #    endif
12279 #   endif
12280 #  endif
12281 # endif 
12282 # ifdef HAS_STDIO_STREAM_ARRAY
12283     if (open_max > 0) {
12284       long i;
12285       for (i = 0; i < open_max; i++)
12286             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12287                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12288                 STDIO_STREAM_ARRAY[i]._flag)
12289                 fflush(&STDIO_STREAM_ARRAY[i]);
12290     }   
12291   }
12292 # endif
12293 #endif
12294   _exit(42);
12295 }
12296 EOCP
12297 : first we have to find out how _not_ to flush
12298 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12299     output=''
12300     set try -DTRY_FPUTC
12301     if eval $compile; then
12302             $rm -f try.out
12303             ./try$exe_ext 2>/dev/null
12304             if $test ! -s try.out -a "X$?" = X42; then
12305                 output=-DTRY_FPUTC
12306             fi
12307     fi
12308     case "$output" in
12309     '')
12310             set try -DTRY_FPRINTF
12311             $rm -f try.out
12312             if eval $compile; then
12313                     $rm -f try.out
12314                     ./try$exe_ext 2>/dev/null
12315                     if $test ! -s try.out -a "X$?" = X42; then
12316                         output=-DTRY_FPRINTF
12317                     fi
12318             fi
12319         ;;
12320     esac
12321 fi
12322 : check for fflush NULL behaviour
12323 case "$fflushNULL" in
12324 '')     set try -DTRY_FFLUSH_NULL $output
12325         if eval $compile; then
12326                 $rm -f try.out
12327                 ./try$exe_ext 2>/dev/null
12328                 code="$?"
12329                 if $test -s try.out -a "X$code" = X42; then
12330                         fflushNULL="`$cat try.out`"
12331                 else
12332                         if $test "X$code" != X42; then
12333                                 $cat >&4 <<EOM
12334 (If this test failed, don't worry, we'll try another method shortly.)
12335 EOM
12336                         fi
12337                 fi
12338         fi
12339         $rm -f core try.core core.try.*
12340         case "$fflushNULL" in
12341         x)      $cat >&4 <<EOM
12342 Your fflush(NULL) works okay.
12343 EOM
12344                 fflushNULL="$define"
12345                 ;;
12346         '')     $cat >&4 <<EOM
12347 Your fflush(NULL) isn't working (contrary to ANSI C).
12348 EOM
12349                 fflushNULL="$undef"
12350                 ;;
12351         *)      $cat >&4 <<EOM
12352 Cannot figure out whether your fflush(NULL) works or not.
12353 I'm assuming it doesn't (contrary to ANSI C).
12354 EOM
12355                 fflushNULL="$undef"
12356                 ;;
12357         esac
12358         ;;
12359 $define|true|[yY]*)
12360         fflushNULL="$define"
12361         ;;
12362 *)
12363         fflushNULL="$undef"
12364         ;;
12365 esac
12366 : check explicit looping only if NULL did not work
12367 case "$fflushNULL" in
12368 "$undef")
12369         : check for fflush all behaviour
12370         case "$fflushall" in
12371         '')     set try -DTRY_FFLUSH_ALL $output
12372                 if eval $compile; then
12373                         $cat >&4 <<EOM
12374 (Now testing the other method--but note that also this may fail.)
12375 EOM
12376                         $rm -f try.out
12377                         ./try$exe_ext 2>/dev/null
12378                         if $test -s try.out -a "X$?" = X42; then
12379                                 fflushall="`$cat try.out`"
12380                         fi
12381                 fi
12382                 $rm -f core try.core core.try.*
12383                 case "$fflushall" in
12384                 x)      $cat >&4 <<EOM
12385 Whew. Flushing explicitly all the stdio streams works.
12386 EOM
12387                         fflushall="$define"
12388                         ;;
12389                 '')     $cat >&4 <<EOM
12390 Sigh. Flushing explicitly all the stdio streams doesn't work.
12391 EOM
12392                         fflushall="$undef"
12393                         ;;
12394                 *)      $cat >&4 <<EOM
12395 Cannot figure out whether flushing stdio streams explicitly works or not.
12396 I'm assuming it doesn't.
12397 EOM
12398                         fflushall="$undef"
12399                         ;;
12400                 esac
12401                 ;;
12402         "$define"|true|[yY]*)
12403                 fflushall="$define"
12404                 ;;
12405         *)
12406                 fflushall="$undef"
12407                 ;;
12408         esac
12409         ;;
12410 *)      fflushall="$undef"      
12411         ;;
12412 esac
12413 case "$fflushNULL$fflushall" in
12414 undefundef)
12415         $cat <<EOM
12416 I cannot figure out how to flush pending stdio output.
12417 EOM
12418         ;;
12419 esac
12420 $rm -f try.* try$exe_ext
12421
12422 : Store the full pathname to the ar program for use in the C program
12423 : Respect a hint or command line value for full_ar.
12424 case "$full_ar" in
12425 '') full_ar=$ar ;;
12426 esac
12427
12428 : Store the full pathname to the sed program for use in the C program
12429 full_sed=$sed
12430
12431 : see what type gids are declared as in the kernel
12432 echo " "
12433 echo "Looking for the type for group ids returned by getgid()."
12434 set gid_t gidtype xxx stdio.h sys/types.h
12435 eval $typedef
12436 case "$gidtype" in
12437 xxx)
12438         xxx=`./findhdr sys/user.h`
12439         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12440         case $1 in
12441         unsigned) dflt="$1 $2" ;;
12442         *) dflt="$1" ;;
12443         esac
12444         ;;
12445 *) dflt="$gidtype";;
12446 esac
12447 case "$gidtype" in
12448 gid_t) echo "gid_t found." ;;
12449 *)      rp="What is the type for group ids returned by getgid()?"
12450         . ./myread
12451         gidtype="$ans"
12452         ;;
12453 esac
12454
12455 echo " "
12456 case "$gidtype" in
12457 *_t) zzz="$gidtype"     ;;
12458 *)   zzz="gid"          ;;
12459 esac
12460 echo "Checking the size of $zzz..." >&4 
12461 cat > try.c <<EOCP
12462 #include <sys/types.h>
12463 #include <stdio.h>
12464 int main() {
12465     printf("%d\n", (int)sizeof($gidtype));
12466     exit(0);
12467 }
12468 EOCP
12469 set try
12470 if eval $compile_ok; then
12471         yyy=`./try`
12472         case "$yyy" in
12473         '')     gidsize=4
12474                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12475                 ;;
12476         *)      gidsize=$yyy
12477                 echo "Your $zzz is $gidsize bytes long."
12478                 ;;
12479         esac
12480 else
12481         gidsize=4
12482         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12483 fi
12484
12485
12486 echo " "
12487 case "$gidtype" in
12488 *_t) zzz="$gidtype"     ;;
12489 *)   zzz="gid"          ;;
12490 esac
12491 echo "Checking the sign of $zzz..." >&4 
12492 cat > try.c <<EOCP
12493 #include <sys/types.h>
12494 #include <stdio.h>
12495 int main() {
12496         $gidtype foo = -1;
12497         if (foo < 0)
12498                 printf("-1\n");
12499         else
12500                 printf("1\n");
12501 }
12502 EOCP
12503 set try
12504 if eval $compile; then
12505         yyy=`./try`
12506         case "$yyy" in
12507         '')     gidsign=1
12508                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12509                 ;;
12510         *)      gidsign=$yyy
12511                 case "$gidsign" in
12512                  1) echo "Your $zzz is unsigned." ;;
12513                 -1) echo "Your $zzz is signed."   ;;
12514                 esac
12515                 ;;
12516         esac
12517 else
12518         gidsign=1
12519         echo "(I can't compile the test program--guessing unsigned.)" >&4
12520 fi
12521
12522
12523 echo " "
12524
12525 if $test X"$quadtype" != X; then
12526
12527 echo "Checking how to print 64-bit integers..." >&4
12528
12529 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12530         $cat >try.c <<'EOCP'
12531 #include <sys/types.h>
12532 #include <stdio.h>
12533 int main() {
12534   int q = 12345678901;
12535   printf("%ld\n", q);
12536 }
12537 EOCP
12538         set try
12539         if eval $compile; then
12540                 yyy=`./try$exe_ext`
12541                 case "$yyy" in
12542                 12345678901)
12543                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12544                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12545                         echo "We will use %d."
12546                         ;;
12547                 esac
12548         fi
12549 fi
12550
12551 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12552         $cat >try.c <<'EOCP'
12553 #include <sys/types.h>
12554 #include <stdio.h>
12555 int main() {
12556   long q = 12345678901;
12557   printf("%ld\n", q);
12558 }
12559 EOCP
12560         set try
12561         if eval $compile; then
12562                 yyy=`./try$exe_ext`
12563                 case "$yyy" in
12564                 12345678901)
12565                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12566                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12567                         echo "We will use %ld."
12568                         ;;
12569                 esac
12570         fi
12571 fi
12572
12573 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12574         $cat >try.c <<'EOCP'
12575 #include <sys/types.h>
12576 #include <inttypes.h>
12577 #include <stdio.h>
12578 int main() {
12579   int64_t q = 12345678901;
12580   printf("%" PRId64 "\n", q);
12581 }
12582 EOCP
12583         set try
12584         if eval $compile; then
12585                 yyy=`./try$exe_ext`
12586                 case "$yyy" in
12587                 12345678901)
12588                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12589                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12590                         echo "We will use the C9X style."
12591                         ;;
12592                 esac
12593         fi
12594 fi
12595
12596 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12597         $cat >try.c <<'EOCP'
12598 #include <sys/types.h>
12599 #include <stdio.h>
12600 int main() {
12601   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12602   printf("%lld\n", q);
12603 }
12604 EOCP
12605         set try
12606         if eval $compile; then
12607                 yyy=`./try$exe_ext`
12608                 case "$yyy" in
12609                 12345678901)
12610                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12611                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12612                         echo "We will use the %lld style."
12613                         ;;
12614                 esac
12615         fi
12616 fi
12617
12618 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12619         $cat >try.c <<EOCP
12620 #include <sys/types.h>
12621 #include <stdio.h>
12622 int main() {
12623   $quadtype q = 12345678901;
12624   printf("%Ld\n", q);
12625 }
12626 EOCP
12627         set try
12628         if eval $compile; then
12629                 yyy=`./try$exe_ext`
12630                 case "$yyy" in
12631                 12345678901)
12632                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12633                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12634                         echo "We will use %Ld."
12635                         ;;
12636                 esac
12637         fi
12638 fi
12639
12640 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12641         $cat >try.c <<EOCP
12642 #include <sys/types.h>
12643 #include <stdio.h>
12644 int main() {
12645   $quadtype q = 12345678901;
12646   printf("%qd\n", q);
12647 }
12648 EOCP
12649         set try
12650         if eval $compile; then
12651                 yyy=`./try$exe_ext`
12652                 case "$yyy" in
12653                 12345678901)
12654                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12655                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12656                         echo "We will use %qd."
12657                         ;;
12658                 esac
12659         fi
12660 fi
12661
12662 if $test X"$sPRId64" = X; then
12663         echo "Cannot figure out how to print 64-bit integers." >&4
12664 fi
12665
12666 $rm -f try try.*
12667
12668 fi
12669
12670 case "$sPRId64" in
12671 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12672         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12673         ;;
12674 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12675         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12676         ;;
12677 esac
12678
12679
12680 echo " "
12681 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12682
12683 if $test X"$ivsize" = X8; then
12684         ivdformat="$sPRId64"
12685         uvuformat="$sPRIu64"
12686         uvoformat="$sPRIo64"
12687         uvxformat="$sPRIx64"
12688 else
12689         if $test X"$ivsize" = X"$longsize"; then
12690                 ivdformat='"ld"'
12691                 uvuformat='"lu"'
12692                 uvoformat='"lo"'
12693                 uvxformat='"lx"'
12694         else
12695                 if $test X"$ivsize" = X"$intsize"; then
12696                         ivdformat='"d"'
12697                         uvuformat='"u"'
12698                         uvoformat='"o"'
12699                         uvxformat='"x"'
12700                 else
12701                         : far out
12702                         if $test X"$ivsize" = X"$shortsize"; then
12703                                 ivdformat='"hd"'
12704                                 uvuformat='"hu"'
12705                                 uvoformat='"ho"'
12706                                 uvxformat='"hx"'
12707                         fi
12708                 fi
12709         fi
12710 fi
12711
12712 case "$ivdformat" in
12713 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12714     exit 1
12715     ;;
12716 esac
12717
12718
12719 echo " "
12720 $echo "Checking the format string to be used for gids..." >&4
12721
12722 case "$gidsign" in
12723 -1)     if $test X"$gidsize" = X"$ivsize"; then
12724                 gidformat="$ivdformat"
12725         else
12726                 if $test X"$gidsize" = X"$longsize"; then
12727                         gidformat='"ld"'
12728                 else
12729                         if $test X"$gidsize" = X"$intsize"; then
12730                                 gidformat='"d"'
12731                         else
12732                                 if $test X"$gidsize" = X"$shortsize"; then
12733                                         gidformat='"hd"'
12734                                 fi
12735                         fi
12736                 fi
12737         fi
12738         ;;
12739 *)      if $test X"$gidsize" = X"$uvsize"; then
12740                 gidformat="$uvuformat"
12741         else
12742                 if $test X"$gidsize" = X"$longsize"; then
12743                         gidformat='"lu"'
12744                 else
12745                         if $test X"$gidsize" = X"$intsize"; then
12746                                 gidformat='"u"'
12747                         else
12748                                 if $test X"$gidsize" = X"$shortsize"; then
12749                                         gidformat='"hu"'
12750                                 fi
12751                         fi
12752                 fi
12753         fi
12754         ;;
12755 esac
12756
12757 : see if getgroups exists
12758 set getgroups d_getgrps
12759 eval $inlibc
12760
12761 : see if setgroups exists
12762 set setgroups d_setgrps
12763 eval $inlibc
12764
12765
12766 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12767 echo " "
12768 case "$d_getgrps$d_setgrps" in
12769 *define*)
12770         case "$groupstype" in
12771         '') dflt="$gidtype" ;;
12772         *)  dflt="$groupstype" ;;
12773         esac
12774         $cat <<EOM
12775 What type of pointer is the second argument to getgroups() and setgroups()?
12776 Usually this is the same as group ids, $gidtype, but not always.
12777
12778 EOM
12779         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12780         . ./myread
12781         groupstype="$ans"
12782         ;;
12783 *)  groupstype="$gidtype";;
12784 esac
12785
12786 echo " "
12787 echo "Checking if your $make program sets \$(MAKE)..." >&4
12788 case "$make_set_make" in
12789 '')
12790         $sed 's/^X //' > testmake.mak << 'EOF'
12791 Xall:
12792 X       @echo 'maketemp="$(MAKE)"'
12793 EOF
12794         case "`$make -f testmake.mak 2>/dev/null`" in
12795         *maketemp=*) make_set_make='#' ;;
12796         *)      make_set_make="MAKE=$make" ;;
12797         esac
12798         $rm -f testmake.mak
12799         ;;
12800 esac
12801 case "$make_set_make" in
12802 '#') echo "Yup, it does.";;
12803 *) echo "Nope, it doesn't.";;
12804 esac
12805
12806 : see what type is used for mode_t
12807 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12808 set mode_t modetype int stdio.h sys/types.h
12809 eval $typedef_ask
12810
12811 : define a fucntion to check prototypes
12812 $cat > protochk <<EOSH
12813 $startsh
12814 cc="$cc"
12815 optimize="$optimize"
12816 ccflags="$ccflags"
12817 prototype="$prototype"
12818 define="$define"
12819 rm=$rm
12820 EOSH
12821
12822 $cat >> protochk <<'EOSH'
12823
12824 $rm -f try.c
12825 foo="$1"
12826 shift
12827 while test $# -ge 2; do
12828         case "$1" in
12829                 $define) echo "#include <$2>" >> try.c ;;
12830                 literal) echo "$2" >> try.c ;;
12831         esac
12832     shift 2
12833 done
12834 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12835 cat >> try.c <<'EOCP'
12836 #ifdef CAN_PROTOTYPE
12837 #define _(args) args
12838 #else
12839 #define _(args) ()
12840 #endif
12841 EOCP
12842 echo "$foo" >> try.c
12843 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12844 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12845 status=$?
12846 $rm -f try.[co]
12847 exit $status
12848 EOSH
12849 chmod +x protochk
12850 $eunicefix protochk
12851
12852 : check for type of arguments to gethostbyaddr. 
12853 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12854         case "$d_gethbyaddr" in
12855         $define)
12856                 $cat <<EOM
12857
12858 Checking to see what type of arguments are accepted by gethostbyaddr().
12859 EOM
12860                 hdrs="$define sys/types.h
12861                         $d_socket sys/socket.h 
12862                         $i_niin netinet/in.h 
12863                         $i_netdb netdb.h
12864                         $i_unistd unistd.h"
12865                 : The first arg can 'char *' or 'void *'
12866                 : The second arg is some of integral type
12867                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12868                         for yyy in size_t long int; do
12869                                 case "$netdb_host_type" in
12870                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12871                                         if ./protochk "$try" $hdrs; then
12872                                                 echo "Your system accepts $xxx for the first arg."
12873                                                 echo "...and $yyy for the second arg."
12874                                                 netdb_host_type="$xxx"
12875                                                 netdb_hlen_type="$yyy"
12876                                         fi
12877                                         ;;
12878                                 esac
12879                         done
12880                 done
12881                 : In case none of those worked, prompt the user.
12882                 case "$netdb_host_type" in
12883                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12884                         dflt='char *'
12885                         . ./myread
12886                         netdb_host_type=$ans
12887                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12888                         dflt="$sizetype"
12889                         . ./myread
12890                         netdb_hlen_type=$ans
12891                         ;;
12892                 esac
12893                 ;;
12894         *)      : no gethostbyaddr, so pick harmless defaults
12895                 netdb_host_type='char *'
12896                 netdb_hlen_type="$sizetype"
12897                 ;;
12898         esac
12899         # Remove the "const" if needed. -- but then we'll have a 
12900         # prototype clash!
12901         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12902 fi
12903
12904 : check for type of argument to gethostbyname. 
12905 if test "X$netdb_name_type" = X ; then
12906         case "$d_gethbyname" in
12907         $define)
12908                 $cat <<EOM
12909
12910 Checking to see what type of argument is accepted by gethostbyname().
12911 EOM
12912                 hdrs="$define sys/types.h
12913                         $d_socket sys/socket.h 
12914                         $i_niin netinet/in.h 
12915                         $i_netdb netdb.h
12916                         $i_unistd unistd.h"
12917                 for xxx in "const char *" "char *"; do
12918                         case "$netdb_name_type" in
12919                         '')     try="extern struct hostent *gethostbyname($xxx);"
12920                                 if ./protochk "$try" $hdrs; then
12921                                         echo "Your system accepts $xxx."
12922                                         netdb_name_type="$xxx"
12923                                 fi
12924                                 ;;
12925                         esac
12926                 done
12927                 : In case none of those worked, prompt the user.
12928                 case "$netdb_name_type" in
12929                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12930                         dflt='char *'
12931                         . ./myread
12932                         netdb_name_type=$ans
12933                         ;;
12934                 esac
12935                 ;;
12936         *)      : no gethostbyname, so pick harmless default
12937                 netdb_name_type='char *'
12938                 ;;
12939         esac
12940 fi
12941
12942 : check for type of 1st argument to getnetbyaddr. 
12943 if test "X$netdb_net_type" = X ; then
12944         case "$d_getnbyaddr" in
12945         $define)
12946                 $cat <<EOM
12947
12948 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12949 EOM
12950                 hdrs="$define sys/types.h
12951                         $d_socket sys/socket.h 
12952                         $i_niin netinet/in.h 
12953                         $i_netdb netdb.h
12954                         $i_unistd unistd.h"
12955                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12956                         case "$netdb_net_type" in
12957                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12958                                 if ./protochk "$try" $hdrs; then
12959                                         echo "Your system accepts $xxx."
12960                                         netdb_net_type="$xxx"
12961                                 fi
12962                                 ;;
12963                         esac
12964                 done
12965                 : In case none of those worked, prompt the user.
12966                 case "$netdb_net_type" in
12967                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12968                         dflt='long'
12969                         . ./myread
12970                         netdb_net_type=$ans
12971                         ;;
12972                 esac
12973                 ;;
12974         *)      : no getnetbyaddr, so pick harmless default
12975                 netdb_net_type='long'
12976                 ;;
12977         esac
12978 fi
12979 : locate the preferred pager for this system
12980 case "$pager" in
12981 '')
12982         dflt=''
12983         case "$pg" in
12984         /*) dflt=$pg;;
12985         esac
12986         case "$more" in
12987         /*) dflt=$more;;
12988         esac
12989         case "$less" in
12990         /*) dflt=$less;;
12991         esac
12992         case "$dflt" in
12993         '') dflt=/usr/ucb/more;;
12994         esac
12995         ;;
12996 *) dflt="$pager";;
12997 esac
12998 echo " "
12999 fn=f/
13000 rp='What pager is used on your system?'
13001 . ./getfile
13002 pager="$ans"
13003
13004 : see what type pids are declared as in the kernel
13005 rp="What is the type of process ids on this system?"
13006 set pid_t pidtype int stdio.h sys/types.h
13007 eval $typedef_ask
13008
13009 : Find earliest binary compatible site_perl subdirectory perl can use.
13010 case "$bincompat5005" in
13011 "$define") xs_apiversion='5.005' ;;
13012 *) xs_apiversion=$version ;;   # The current site_perl version.
13013 esac
13014 : Find earliest pure perl site_perl subdirectory perl can use.
13015 : The versioned directories started at 5.005.
13016 pm_apiversion='5.005'
13017
13018 : check for length of pointer
13019 echo " "
13020 case "$ptrsize" in
13021 '')
13022         echo "Checking to see how big your pointers are..." >&4
13023         if test "$voidflags" -gt 7; then
13024                 echo '#define VOID_PTR char *' > try.c
13025         else
13026                 echo '#define VOID_PTR void *' > try.c
13027         fi
13028         $cat >>try.c <<'EOCP'
13029 #include <stdio.h>
13030 int main()
13031 {
13032     printf("%d\n", (int)sizeof(VOID_PTR));
13033     exit(0);
13034 }
13035 EOCP
13036         set try
13037         if eval $compile_ok; then
13038                 ptrsize=`./try`
13039                 echo "Your pointers are $ptrsize bytes long."
13040         else
13041                 dflt='4'
13042                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13043                 rp="What is the size of a pointer (in bytes)?"
13044                 . ./myread
13045                 ptrsize="$ans"
13046         fi
13047         ;;
13048 esac
13049 $rm -f try.c try
13050
13051 : see if ar generates random libraries by itself
13052 echo " "
13053 echo "Checking how to generate random libraries on your machine..." >&4
13054 echo 'int bar1() { return bar2(); }' > bar1.c
13055 echo 'int bar2() { return 2; }' > bar2.c
13056 $cat > foo.c <<'EOP'
13057 int main() { printf("%d\n", bar1()); exit(0); }
13058 EOP
13059 $cc $ccflags -c bar1.c >/dev/null 2>&1
13060 $cc $ccflags -c bar2.c >/dev/null 2>&1
13061 $cc $ccflags -c foo.c >/dev/null 2>&1
13062 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13063 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13064         ./foobar >/dev/null 2>&1; then
13065         echo "$ar appears to generate random libraries itself."
13066         orderlib=false
13067         ranlib=":"
13068 elif $ar ts bar$_a >/dev/null 2>&1 &&
13069         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13070         ./foobar >/dev/null 2>&1; then
13071                 echo "a table of contents needs to be added with '$ar ts'."
13072                 orderlib=false
13073                 ranlib="$ar ts"
13074 else
13075         case "$ranlib" in
13076         :) ranlib='';;
13077         '')
13078                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13079                 $test -f $ranlib || ranlib=''
13080                 ;;
13081         esac
13082         if $test -n "$ranlib"; then
13083                 echo "your system has '$ranlib'; we'll use that."
13084                 orderlib=false
13085         else
13086                 echo "your system doesn't seem to support random libraries"
13087                 echo "so we'll use lorder and tsort to order the libraries."
13088                 orderlib=true
13089                 ranlib=":"
13090         fi
13091 fi
13092 $rm -f foo* bar* 
13093
13094 : check for type of arguments to select. 
13095 case "$selecttype" in
13096 '') case "$d_select" in
13097         $define)
13098                 echo " "
13099                 $cat <<EOM
13100 Checking to see what type of arguments are accepted by select().
13101 EOM
13102                 hdrs="$define sys/types.h
13103                         $i_systime sys/time.h 
13104                         $i_sysselct sys/select.h
13105                         $d_socket sys/socket.h"
13106                 : The first arg can be int, unsigned, or size_t
13107                 : The last arg may or may not be 'const'
13108                 val=''
13109                 : void pointer has been seen but using that
13110                 : breaks the selectminbits test
13111                 for xxx in 'fd_set *' 'int *'; do
13112                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13113                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13114                                         case "$val" in
13115                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13116                                                 if ./protochk "$try" $hdrs; then
13117                                                         echo "Your system accepts $xxx."
13118                                                         val="$xxx"
13119                                                 fi
13120                                                 ;;
13121                                         esac
13122                                 done
13123                         done
13124                 done
13125                 case "$val" in
13126                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13127                         case "$d_fd_set" in
13128                                 $define) dflt="fd_set *" ;;
13129                                 *)              dflt="int *" ;;
13130                         esac
13131                         . ./myread
13132                         val=$ans
13133                         ;;
13134                 esac
13135                 selecttype="$val"
13136                 ;;
13137         *)      : no select, so pick a harmless default
13138                 selecttype='int *'
13139                 ;;
13140         esac
13141         ;;
13142 esac
13143
13144 : check for the select 'width'
13145 case "$selectminbits" in
13146 '') case "$d_select" in
13147         $define)
13148                 $cat <<EOM
13149
13150 Checking to see on how many bits at a time your select() operates...
13151 EOM
13152                 $cat >try.c <<EOCP
13153 #include <sys/types.h>
13154 #$i_time I_TIME
13155 #$i_systime I_SYS_TIME
13156 #$i_systimek I_SYS_TIME_KERNEL
13157 #ifdef I_TIME
13158 #   include <time.h>
13159 #endif
13160 #ifdef I_SYS_TIME
13161 #   ifdef I_SYS_TIME_KERNEL
13162 #       define KERNEL
13163 #   endif
13164 #   include <sys/time.h>
13165 #   ifdef I_SYS_TIME_KERNEL
13166 #       undef KERNEL
13167 #   endif
13168 #endif
13169 #$i_sysselct I_SYS_SELECT
13170 #ifdef I_SYS_SELECT
13171 #include <sys/select.h>
13172 #endif
13173 #$d_socket HAS_SOCKET
13174 #ifdef HAS_SOCKET
13175 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13176 #endif
13177 #include <stdio.h>
13178 $selecttype b;
13179 #define S sizeof(*(b))
13180 #define MINBITS 64
13181 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13182 #define NBITS  (NBYTES * 8)
13183 int main() {
13184     char s[NBYTES];
13185     struct timeval t;
13186     int i;
13187     FILE* fp;
13188     int fd;
13189
13190     fclose(stdin);
13191     fp = fopen("try.c", "r");
13192     if (fp == 0)
13193       exit(1);
13194     fd = fileno(fp);
13195     if (fd < 0)
13196       exit(2);
13197     b = ($selecttype)s;
13198     for (i = 0; i < NBITS; i++)
13199         FD_SET(i, b);
13200     t.tv_sec  = 0;
13201     t.tv_usec = 0;
13202     select(fd + 1, b, 0, 0, &t);
13203     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13204     printf("%d\n", i + 1);
13205     return 0;
13206 }
13207 EOCP
13208                 set try
13209                 if eval $compile_ok; then
13210                         selectminbits=`./try`
13211                         case "$selectminbits" in
13212                         '')     cat >&4 <<EOM
13213 Cannot figure out on how many bits at a time your select() operates.
13214 I'll play safe and guess it is 32 bits.
13215 EOM
13216                                 selectminbits=32
13217                                 bits="32 bits"
13218                                 ;;
13219                         1)      bits="1 bit" ;;
13220                         *)      bits="$selectminbits bits" ;;
13221                         esac
13222                         echo "Your select() operates on $bits at a time." >&4
13223                 else
13224                         rp='What is the minimum number of bits your select() operates on?'
13225                         case "$byteorder" in
13226                         1234|12345678)  dflt=32 ;;
13227                         *)              dflt=1  ;;
13228                         esac
13229                         . ./myread
13230                         val=$ans
13231                         selectminbits="$val"
13232                 fi
13233                 $rm -f try.* try
13234                 ;;
13235         *)      : no select, so pick a harmless default
13236                 selectminbits='32'
13237                 ;;
13238         esac
13239         ;;
13240 esac
13241
13242 : Trace out the files included by signal.h, then look for SIGxxx names.
13243 : Remove SIGARRAYSIZE used by HPUX.
13244 : Remove SIGSTKSIZE used by Linux.
13245 : Remove SIGSTKSZ used by Posix.
13246 : Remove SIGTYP void lines used by OS2.
13247 : Some cpps, like os390, dont give the file name anywhere
13248 if [ "X$fieldn" = X ]; then
13249         : Just make some guesses.  We check them later.
13250         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13251 else
13252         xxx=`echo '#include <signal.h>' |
13253         $cppstdin $cppminus $cppflags 2>/dev/null |
13254         $grep '^[       ]*#.*include' | 
13255         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13256 fi
13257 : Check this list of files to be sure we have parsed the cpp output ok.
13258 : This will also avoid potentially non-existent files, such 
13259 : as ../foo/bar.h
13260 xxxfiles=''
13261 for xx in $xxx /dev/null ; do
13262         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13263 done
13264 : If we have found no files, at least try signal.h
13265 case "$xxxfiles" in
13266 '')     xxxfiles=`./findhdr signal.h` ;;
13267 esac
13268 xxx=`awk '
13269 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13270         print substr($2, 4, 20)
13271 }
13272 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13273         print substr($3, 4, 20)
13274 }' $xxxfiles`
13275 : Append some common names just in case the awk scan failed.
13276 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13277 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13278 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13279 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13280 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13281
13282 : generate a few handy files for later
13283 $cat > signal.c <<'EOCP'
13284 #include <sys/types.h>
13285 #include <signal.h>
13286 #include <stdio.h>
13287 int main() {
13288
13289 /* Strange style to avoid deeply-nested #if/#else/#endif */
13290 #ifndef NSIG
13291 #  ifdef _NSIG
13292 #    define NSIG (_NSIG)
13293 #  endif
13294 #endif
13295
13296 #ifndef NSIG
13297 #  ifdef SIGMAX
13298 #    define NSIG (SIGMAX+1)
13299 #  endif
13300 #endif
13301
13302 #ifndef NSIG
13303 #  ifdef SIG_MAX
13304 #    define NSIG (SIG_MAX+1)
13305 #  endif
13306 #endif
13307
13308 #ifndef NSIG
13309 #  ifdef MAXSIG
13310 #    define NSIG (MAXSIG+1)
13311 #  endif
13312 #endif
13313
13314 #ifndef NSIG
13315 #  ifdef MAX_SIG
13316 #    define NSIG (MAX_SIG+1)
13317 #  endif
13318 #endif
13319
13320 #ifndef NSIG
13321 #  ifdef SIGARRAYSIZE
13322 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13323 #  endif
13324 #endif
13325
13326 #ifndef NSIG
13327 #  ifdef _sys_nsig
13328 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13329 #  endif
13330 #endif
13331
13332 /* Default to some arbitrary number that's big enough to get most
13333    of the common signals.
13334 */
13335 #ifndef NSIG
13336 #    define NSIG 50
13337 #endif
13338
13339 printf("NSIG %d\n", NSIG);
13340
13341 #ifndef JUST_NSIG
13342
13343 EOCP
13344
13345 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13346 {
13347         printf "#ifdef SIG"; printf $1; printf "\n"
13348         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13349         printf $1; printf ");\n"
13350         printf "#endif\n"
13351 }
13352 END {
13353         printf "#endif /* JUST_NSIG */\n";
13354         printf "exit(0);\n}\n";
13355 }
13356 ' >>signal.c
13357 $cat >signal.awk <<'EOP'
13358 BEGIN { ndups = 0 }
13359 $1 ~ /^NSIG$/ { nsig = $2 }
13360 ($1 !~ /^NSIG$/) && (NF == 2) {
13361     if ($2 > maxsig) { maxsig = $2 }
13362     if (sig_name[$2]) {
13363         dup_name[ndups] = $1
13364         dup_num[ndups] = $2
13365         ndups++ 
13366     }
13367     else {
13368         sig_name[$2] = $1
13369         sig_num[$2] = $2
13370     }
13371 }
13372 END { 
13373     if (nsig == 0) {
13374         nsig = maxsig + 1
13375     }
13376     printf("NSIG %d\n", nsig);
13377     for (n = 1; n < nsig; n++) {
13378         if (sig_name[n]) {
13379             printf("%s %d\n", sig_name[n], sig_num[n])
13380         }
13381         else {
13382             printf("NUM%d %d\n", n, n) 
13383         }
13384     }
13385     for (n = 0; n < ndups; n++) {
13386         printf("%s %d\n", dup_name[n], dup_num[n])
13387     }
13388 }
13389 EOP
13390 $cat >signal_cmd <<EOS
13391 $startsh
13392 if $test -s signal.lst; then
13393     echo "Using your existing signal.lst file"
13394         exit 0
13395 fi
13396 xxx="$xxx"
13397 EOS
13398 $cat >>signal_cmd <<'EOS'
13399
13400 set signal
13401 if eval $compile_ok; then
13402         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13403 else
13404         echo "(I can't seem be able to compile the whole test program)" >&4
13405         echo "(I'll try it in little pieces.)" >&4
13406         set signal -DJUST_NSIG
13407         if eval $compile_ok; then
13408                 ./signal$_exe > signal.nsg
13409                 $cat signal.nsg
13410         else
13411                 echo "I can't seem to figure out how many signals you have." >&4
13412                 echo "Guessing 50." >&4
13413                 echo 'NSIG 50' > signal.nsg
13414         fi
13415         : Now look at all the signal names, one at a time.
13416         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13417                 $cat > signal.c <<EOCP
13418 #include <sys/types.h>
13419 #include <signal.h>
13420 #include <stdio.h>
13421 int main() {
13422 printf("$xx %d\n", SIG${xx});
13423 return 0;
13424 }
13425 EOCP
13426                 set signal
13427                 if eval $compile; then
13428                         echo "SIG${xx} found."
13429                         ./signal$_exe  >> signal.ls1
13430                 else
13431                         echo "SIG${xx} NOT found."
13432                 fi
13433         done
13434         if $test -s signal.ls1; then
13435                 $cat signal.nsg signal.ls1 |
13436                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13437         fi
13438
13439 fi
13440 if $test -s signal.lst; then
13441         :
13442 else
13443         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13444         echo 'kill -l' >signal
13445         set X `csh -f <signal`
13446         $rm -f signal
13447         shift
13448         case $# in
13449         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13450         esac
13451         echo $@ | $tr ' ' $trnl | \
13452             $awk '{ printf "%s %d\n", $1, ++s; }
13453                   END { printf "NSIG %d\n", ++s }' >signal.lst
13454 fi
13455 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13456 EOS
13457 chmod a+x signal_cmd
13458 $eunicefix signal_cmd
13459
13460 : generate list of signal names
13461 echo " "
13462 case "$sig_name_init" in
13463 '') doinit=yes ;;
13464 *)  case "$sig_num_init" in
13465     ''|*,*) doinit=yes ;;
13466     esac ;;
13467 esac
13468 case "$doinit" in
13469 yes)
13470         echo "Generating a list of signal names and numbers..." >&4
13471         . ./signal_cmd
13472         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13473         sig_name=`$awk 'BEGIN { printf "ZERO " }
13474                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13475         sig_num=`$awk  'BEGIN { printf "0 " }
13476                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13477         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13478                              !/^NSIG/   { printf "\"%s\", ", $1 }
13479                              END        { printf "0\n" }' signal.lst`
13480         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13481                              !/^NSIG/   { printf "%d, ", $2}
13482                              END        { printf "0\n"}' signal.lst`
13483         ;;
13484 esac
13485 echo "The following $sig_count signals are available:"
13486 echo " "
13487 echo $sig_name | $awk \
13488 'BEGIN { linelen = 0 }
13489 {
13490         for (i = 1; i <= NF; i++) {
13491                 name = "SIG" $i " "
13492                 linelen = linelen + length(name)
13493                 if (linelen > 70) {
13494                         printf "\n"
13495                         linelen = length(name)
13496                 }
13497                 printf "%s", name
13498         }
13499         printf "\n"
13500 }'
13501 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13502
13503 : see what type is used for signed size_t
13504 set ssize_t ssizetype int stdio.h sys/types.h
13505 eval $typedef
13506 dflt="$ssizetype"
13507 $cat > ssize.c <<EOM
13508 #include <stdio.h>
13509 #include <sys/types.h>
13510 #define Size_t $sizetype
13511 #define SSize_t $dflt
13512 int main()
13513 {
13514         if (sizeof(Size_t) == sizeof(SSize_t))
13515                 printf("$dflt\n");
13516         else if (sizeof(Size_t) == sizeof(int))
13517                 printf("int\n");
13518         else 
13519                 printf("long\n");
13520         exit(0);
13521 }
13522 EOM
13523 echo " "
13524 set ssize
13525 if eval $compile_ok && ./ssize > /dev/null; then
13526         ssizetype=`./ssize`
13527         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13528 else
13529         $cat >&4 <<EOM
13530 Help! I can't compile and run the ssize_t test program: please enlighten me!
13531 (This is probably a misconfiguration in your system or libraries, and
13532 you really ought to fix it.  Still, I'll try anyway.)
13533
13534 I need a type that is the same size as $sizetype, but is guaranteed to
13535 be signed.  Common values are ssize_t, int and long.
13536
13537 EOM
13538         rp="What signed type is the same size as $sizetype?"
13539         . ./myread
13540         ssizetype="$ans"
13541 fi
13542 $rm -f ssize ssize.*
13543
13544 : see what type of char stdio uses.
13545 echo " "
13546 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13547         echo "Your stdio uses unsigned chars." >&4
13548         stdchar="unsigned char"
13549 else
13550         echo "Your stdio uses signed chars." >&4
13551         stdchar="char"
13552 fi
13553
13554 : see if time exists
13555 echo " "
13556 if test "X$d_time" = X -o X"$timetype" = X; then
13557     if set time val -f d_time; eval $csym; $val; then
13558                 echo 'time() found.' >&4
13559                 val="$define"
13560                 rp="What is the type returned by time() on this system?"
13561                 set time_t timetype long stdio.h sys/types.h
13562                 eval $typedef_ask
13563     else
13564                 echo 'time() not found, hope that will do.' >&4
13565                 val="$undef"
13566                 timetype='int';
13567     fi
13568     set d_time
13569     eval $setvar
13570 fi
13571
13572 : see what type uids are declared as in the kernel
13573 echo " "
13574 echo "Looking for the type for user ids returned by getuid()."
13575 set uid_t uidtype xxx stdio.h sys/types.h
13576 eval $typedef
13577 case "$uidtype" in
13578 xxx)
13579         xxx=`./findhdr sys/user.h`
13580         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13581         case $1 in
13582         unsigned) dflt="$1 $2" ;;
13583         *) dflt="$1" ;;
13584         esac
13585         ;;
13586 *) dflt="$uidtype";;
13587 esac
13588 case "$uidtype" in
13589 uid_t)  echo "uid_t found." ;;
13590 *)      rp="What is the type for user ids returned by getuid()?"
13591         . ./myread
13592         uidtype="$ans"
13593         ;;
13594 esac
13595
13596 echo " "
13597 case "$uidtype" in
13598 *_t) zzz="$uidtype"     ;;
13599 *)   zzz="uid"          ;;
13600 esac
13601 echo "Checking the size of $zzz..." >&4 
13602 cat > try.c <<EOCP
13603 #include <sys/types.h>
13604 #include <stdio.h>
13605 int main() {
13606     printf("%d\n", (int)sizeof($uidtype));
13607     exit(0);
13608 }
13609 EOCP
13610 set try
13611 if eval $compile_ok; then
13612         yyy=`./try`
13613         case "$yyy" in
13614         '')     uidsize=4
13615                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13616                 ;;
13617         *)      uidsize=$yyy
13618                 echo "Your $zzz is $uidsize bytes long."
13619                 ;;
13620         esac
13621 else
13622         uidsize=4
13623         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13624 fi
13625
13626 echo " "
13627 case "$uidtype" in
13628 *_t) zzz="$uidtype"     ;;
13629 *)   zzz="uid"          ;;
13630 esac
13631 echo "Checking the sign of $zzz..." >&4
13632 cat > try.c <<EOCP
13633 #include <sys/types.h>
13634 #include <stdio.h>
13635 int main() {
13636         $uidtype foo = -1;
13637         if (foo < 0)
13638                 printf("-1\n");
13639         else
13640                 printf("1\n");
13641 }
13642 EOCP
13643 set try
13644 if eval $compile; then
13645         yyy=`./try`
13646         case "$yyy" in
13647         '')     uidsign=1
13648                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13649                 ;;
13650         *)      uidsign=$yyy
13651                 case "$uidsign" in
13652                  1) echo "Your $zzz is unsigned." ;;
13653                 -1) echo "Your $zzz is signed."   ;;
13654                 esac
13655                 ;;
13656         esac
13657 else
13658         uidsign=1
13659         echo "(I can't compile the test program--guessing unsigned.)" >&4
13660 fi
13661
13662
13663
13664 echo " "
13665 $echo "Checking the format string to be used for uids..." >&4
13666
13667 case "$uidsign" in
13668 -1)     if $test X"$uidsize" = X"$ivsize"; then
13669                 uidformat="$ivdformat"
13670         else
13671                 if $test X"$uidsize" = X"$longsize"; then
13672                         uidformat='"ld"'
13673                 else
13674                         if $test X"$uidsize" = X"$intsize"; then
13675                                 uidformat='"d"'
13676                         else
13677                                 if $test X"$uidsize" = X"$shortsize"; then
13678                                         uidformat='"hd"'
13679                                 fi
13680                         fi
13681                 fi
13682         fi
13683         ;;
13684 *)      if $test X"$uidsize" = X"$uvsize"; then
13685                 uidformat="$uvuformat"
13686         else
13687                 if $test X"$uidsize" = X"$longsize"; then
13688                         uidformat='"lu"'
13689                 else
13690                         if $test X"$uidsize" = X"$intsize"; then
13691                                 uidformat='"u"'
13692                         else
13693                                 if $test X"$uidsize" = X"$shortsize"; then
13694                                         uidformat='"hu"'
13695                                 fi
13696                         fi
13697                 fi
13698         fi
13699         ;;
13700 esac
13701
13702 : see if dbm.h is available
13703 : see if dbmclose exists
13704 set dbmclose d_dbmclose
13705 eval $inlibc
13706
13707 case "$d_dbmclose" in
13708 $define)
13709         set dbm.h i_dbm
13710         eval $inhdr
13711         case "$i_dbm" in
13712         $define)
13713                 val="$undef"
13714                 set i_rpcsvcdbm
13715                 eval $setvar
13716                 ;;
13717         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13718                 eval $inhdr
13719                 ;;
13720         esac
13721         ;;
13722 *)      echo "We won't be including <dbm.h>"
13723         val="$undef"
13724         set i_dbm
13725         eval $setvar
13726         val="$undef"
13727         set i_rpcsvcdbm
13728         eval $setvar
13729         ;;
13730 esac
13731
13732 : see if this is a sys/file.h system
13733 val=''
13734 set sys/file.h val
13735 eval $inhdr
13736
13737 : do we need to include sys/file.h ?
13738 case "$val" in
13739 "$define")
13740         echo " "
13741         if $h_sysfile; then
13742                 val="$define"
13743                 echo "We'll be including <sys/file.h>." >&4
13744         else
13745                 val="$undef"
13746                 echo "We won't be including <sys/file.h>." >&4
13747         fi
13748         ;;
13749 *)
13750         h_sysfile=false
13751         ;;
13752 esac
13753 set i_sysfile
13754 eval $setvar
13755
13756 : see if fcntl.h is there
13757 val=''
13758 set fcntl.h val
13759 eval $inhdr
13760
13761 : see if we can include fcntl.h
13762 case "$val" in
13763 "$define")
13764         echo " "
13765         if $h_fcntl; then
13766                 val="$define"
13767                 echo "We'll be including <fcntl.h>." >&4
13768         else
13769                 val="$undef"
13770                 if $h_sysfile; then
13771         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13772                 else
13773                         echo "We won't be including <fcntl.h>." >&4
13774                 fi
13775         fi
13776         ;;
13777 *)
13778         h_fcntl=false
13779         val="$undef"
13780         ;;
13781 esac
13782 set i_fcntl
13783 eval $setvar
13784
13785 : see if this is a iconv.h system
13786 set iconv.h i_iconv
13787 eval $inhdr
13788
13789 : see if locale.h is available
13790 set locale.h i_locale
13791 eval $inhdr
13792
13793 : see if mach cthreads are available
13794 if test "X$usethreads" = "X$define"; then
13795         set mach/cthreads.h i_machcthr
13796         eval $inhdr
13797 else
13798         i_machcthr="$undef"
13799 fi
13800
13801
13802
13803 : see if this is a math.h system
13804 set math.h i_math
13805 eval $inhdr
13806
13807 : see if this is a mntent.h system
13808 set mntent.h i_mntent
13809 eval $inhdr
13810
13811 : see if ndbm.h is available
13812 set ndbm.h t_ndbm
13813 eval $inhdr
13814 case "$t_ndbm" in
13815 $define)
13816         : see if dbm_open exists
13817         set dbm_open d_dbm_open
13818         eval $inlibc
13819         case "$d_dbm_open" in
13820         $undef)
13821                 t_ndbm="$undef"
13822                 echo "We won't be including <ndbm.h>"
13823                 ;;
13824         esac
13825         ;;
13826 esac
13827 val="$t_ndbm"
13828 set i_ndbm
13829 eval $setvar
13830
13831 : see if net/errno.h is available
13832 val=''
13833 set net/errno.h val
13834 eval $inhdr
13835
13836 : Unfortunately, it causes problems on some systems.  Arrgh.
13837 case "$val" in
13838 $define)
13839         cat > try.c <<'EOM'
13840 #include <stdio.h>
13841 #include <errno.h>
13842 #include <net/errno.h>
13843 int func()
13844 {
13845         return ENOTSOCK;
13846 }
13847 EOM
13848         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13849                 echo "We'll be including <net/errno.h>." >&4
13850         else
13851                 echo "We won't be including <net/errno.h>." >&4
13852                 val="$undef"
13853         fi
13854         $rm -f try.* try
13855         ;;
13856 esac
13857 set i_neterrno
13858 eval $setvar
13859
13860 : see if netinet/tcp.h is available
13861 set netinet/tcp.h i_netinettcp
13862 eval $inhdr
13863
13864 : see if this is a poll.h system
13865 set poll.h i_poll
13866 eval $inhdr
13867
13868 echo " "
13869 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13870 $cat <<'EOSH' > Cppsym.know
13871 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13872 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13873 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13874 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13875 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13876 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13877 bull c cadmus clipper CMU COFF COMPILER_VERSION
13878 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13879 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13880 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13881 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13882 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13883 H3050R H3050RX hbullx20 hcx host_mips
13884 hp200 hp300 hp700 HP700 hp800 hp9000
13885 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13886 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13887 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13888 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13889 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13890 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13891 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13892 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13893 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13894 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13895 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13896 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13897 MATH_HAS_NO_SIDE_EFFECTS
13898 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13899 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13900 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13901 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13902 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13903 NetBSD news1500 news1700 news1800 news1900 news3700
13904 news700 news800 news900 NeXT NLS ns16000 ns32000
13905 ns32016 ns32332 ns32k nsc32000
13906 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13907 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13908 pc532 pdp11 PGC PIC plexus PORTAR posix
13909 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13910 POSIX_C_SOURCE POSIX_SOURCE POWER
13911 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13912 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13913 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13914 sony sony_news sonyrisc sparc sparclite spectrum
13915 stardent stdc STDC_EXT stratos sun sun3 sun386
13916 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13917 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13918 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13919 sysV68 sysV88 Tek4132 Tek4300 titan
13920 tower tower32 tower32_200 tower32_600 tower32_700
13921 tower32_800 tower32_850 tss
13922 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13923 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13924 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13925 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13926 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13927 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13928 z8000
13929 EOSH
13930 # Maybe put other stuff here too.
13931 cat <<EOSH >>Cppsym.know
13932 $osname
13933 EOSH
13934 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13935 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13936 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13937 $rm -f Cppsym.a Cppsym.b
13938 cat <<EOSH > Cppsym
13939 $startsh
13940 if $test \$# -gt 0; then
13941     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13942     if $test -s Cppsym.got; then
13943         $rm -f Cppsym.got
13944         exit 0
13945     fi
13946     $rm -f Cppsym.got
13947     exit 1
13948 else
13949     $tr " " "$trnl" | ./Cppsym.try
13950     exit 0
13951 fi
13952 EOSH
13953 chmod +x Cppsym
13954 $eunicefix Cppsym
13955 cat <<EOSH > Cppsym.try
13956 $startsh
13957 cat <<'EOCP' > try.c
13958 #include <stdio.h>
13959 int main() {
13960 EOCP
13961 $awk \\
13962 EOSH
13963 cat <<'EOSH' >> Cppsym.try
13964 'length($1) > 0 {
13965     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
13966     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
13967     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
13968     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
13969 }'       >> try.c
13970 echo '}' >> try.c
13971 EOSH
13972 cat <<EOSH >> Cppsym.try
13973 cc="$cc"
13974 optimize="$optimize"
13975 ccflags="$ccflags"
13976 ldflags="$ldflags"
13977 libs="$libs"
13978 exe_ext="$exe_ext"
13979 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
13980 EOSH
13981 chmod +x Cppsym.try
13982 $eunicefix Cppsym.try
13983 ./Cppsym < Cppsym.know > Cppsym.true
13984 : now check the C compiler for additional symbols
13985 postprocess_cc_v=''
13986 case "$osname" in
13987 aix) postprocess_cc_v="|$tr , ' '" ;;
13988 esac
13989 $cat >ccsym <<EOS
13990 $startsh
13991 $cat >tmp.c <<EOF
13992 extern int foo;
13993 EOF
13994 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13995 do
13996         case "\$i" in
13997         -D*) echo "\$i" | $sed 's/^-D//';;
13998         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13999         esac
14000 done
14001 $rm -f try.c
14002 EOS
14003 postprocess_cc_v=''
14004 chmod +x ccsym
14005 $eunicefix ccsym
14006 ./ccsym > ccsym1.raw
14007 if $test -s ccsym1.raw; then
14008        $sort ccsym1.raw | $uniq >ccsym.raw
14009 else
14010        mv ccsym1.raw ccsym.raw
14011 fi
14012
14013 $awk '/\=/ { print $0; next }
14014         { print $0"=1" }' ccsym.raw >ccsym.list
14015 $awk '/\=/ { print $0; next }
14016         { print $0"=1" }' Cppsym.true >ccsym.true
14017 $comm -13 ccsym.true ccsym.list >ccsym.own
14018 $comm -12 ccsym.true ccsym.list >ccsym.com
14019 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14020 also=''
14021 if $test -z ccsym.raw; then
14022         echo "Your C compiler doesn't seem to define any symbols!" >&4
14023         echo " "
14024         echo "However, your C preprocessor defines the following symbols:"
14025         $cat Cppsym.true
14026         ccsymbols=''
14027         cppsymbols=`$cat Cppsym.true`
14028         cppsymbols=`echo $cppsymbols`
14029         cppccsymbols="$cppsymbols"
14030 else
14031         if $test -s ccsym.com; then
14032                 echo "Your C compiler and pre-processor define these symbols:"
14033                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14034                 also='also '
14035                 symbols='ones'
14036                 cppccsymbols=`$cat ccsym.com`
14037                 cppccsymbols=`echo $cppccsymbols`
14038                 $test "$silent" || sleep 1
14039         fi
14040         if $test -s ccsym.cpp; then
14041                 $test "$also" && echo " "
14042                 echo "Your C pre-processor ${also}defines the following symbols:"
14043                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14044                 also='further '
14045                 cppsymbols=`$cat ccsym.cpp`
14046                 cppsymbols=`echo $cppsymbols`
14047                 $test "$silent" || sleep 1
14048         fi
14049         if $test -s ccsym.own; then
14050                 $test "$also" && echo " "
14051                 echo "Your C compiler ${also}defines the following cpp symbols:"
14052                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14053                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14054                 ccsymbols=`$cat ccsym.own`
14055                 ccsymbols=`echo $ccsymbols`
14056                 $test "$silent" || sleep 1
14057         fi
14058 fi
14059 $rm -f ccsym*
14060
14061 : see if this is a termio system
14062 val="$undef"
14063 val2="$undef"
14064 val3="$undef"
14065 if $test `./findhdr termios.h`; then
14066         set tcsetattr i_termios
14067         eval $inlibc
14068         val3="$i_termios"
14069 fi
14070 echo " "
14071 case "$val3" in
14072 "$define") echo "You have POSIX termios.h... good!" >&4;;
14073 *) if ./Cppsym pyr; then
14074                 case "`/bin/universe`" in
14075                 ucb) if $test `./findhdr sgtty.h`; then
14076                                 val2="$define"
14077                                 echo "<sgtty.h> found." >&4
14078                         else
14079                                 echo "System is pyramid with BSD universe."
14080                                 echo "<sgtty.h> not found--you could have problems." >&4
14081                         fi;;
14082                 *) if $test `./findhdr termio.h`; then
14083                                 val="$define"
14084                                 echo "<termio.h> found." >&4
14085                         else
14086                                 echo "System is pyramid with USG universe."
14087                                 echo "<termio.h> not found--you could have problems." >&4
14088                         fi;;
14089                 esac
14090         elif ./usg; then
14091                 if $test `./findhdr termio.h`; then
14092                         echo "<termio.h> found." >&4
14093                         val="$define"
14094                 elif $test `./findhdr sgtty.h`; then
14095                         echo "<sgtty.h> found." >&4
14096                         val2="$define"
14097                 else
14098 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14099                 fi
14100         else
14101                 if $test `./findhdr sgtty.h`; then
14102                         echo "<sgtty.h> found." >&4
14103                         val2="$define"
14104                 elif $test `./findhdr termio.h`; then
14105                         echo "<termio.h> found." >&4
14106                         val="$define"
14107                 else
14108 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14109                 fi
14110         fi;;
14111 esac
14112 set i_termio; eval $setvar
14113 val=$val2; set i_sgtty; eval $setvar
14114 val=$val3; set i_termios; eval $setvar
14115
14116 : see if this is a shadow.h system
14117 set shadow.h i_shadow
14118 eval $inhdr
14119
14120 : see if this is a socks.h system
14121 set socks.h i_socks
14122 eval $inhdr
14123
14124 : see if stdarg is available
14125 echo " "
14126 if $test `./findhdr stdarg.h`; then
14127         echo "<stdarg.h> found." >&4
14128         valstd="$define"
14129 else
14130         echo "<stdarg.h> NOT found." >&4
14131         valstd="$undef"
14132 fi
14133
14134 : see if varags is available
14135 echo " "
14136 if $test `./findhdr varargs.h`; then
14137         echo "<varargs.h> found." >&4
14138 else
14139         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14140 fi
14141
14142 : set up the varargs testing programs
14143 $cat > varargs.c <<EOP
14144 #ifdef I_STDARG
14145 #include <stdarg.h>
14146 #endif
14147 #ifdef I_VARARGS
14148 #include <varargs.h>
14149 #endif
14150
14151 #ifdef I_STDARG
14152 int f(char *p, ...)
14153 #else
14154 int f(va_alist)
14155 va_dcl
14156 #endif
14157 {
14158         va_list ap;
14159 #ifndef I_STDARG
14160         char *p;
14161 #endif
14162 #ifdef I_STDARG
14163         va_start(ap,p);
14164 #else
14165         va_start(ap);
14166         p = va_arg(ap, char *);
14167 #endif
14168         va_end(ap);
14169 }
14170 EOP
14171 $cat > varargs <<EOP
14172 $startsh
14173 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14174         echo "true"
14175 else
14176         echo "false"
14177 fi
14178 $rm -f varargs$_o
14179 EOP
14180 chmod +x varargs
14181
14182 : now check which varargs header should be included
14183 echo " "
14184 i_varhdr=''
14185 case "$valstd" in
14186 "$define")
14187         if `./varargs I_STDARG`; then
14188                 val='stdarg.h'
14189         elif `./varargs I_VARARGS`; then
14190                 val='varargs.h'
14191         fi
14192         ;;
14193 *)
14194         if `./varargs I_VARARGS`; then
14195                 val='varargs.h'
14196         fi
14197         ;;
14198 esac
14199 case "$val" in
14200 '')
14201 echo "I could not find the definition for va_dcl... You have problems..." >&4
14202         val="$undef"; set i_stdarg; eval $setvar
14203         val="$undef"; set i_varargs; eval $setvar
14204         ;;
14205 *) 
14206         set i_varhdr
14207         eval $setvar
14208         case "$i_varhdr" in
14209         stdarg.h)
14210                 val="$define"; set i_stdarg; eval $setvar
14211                 val="$undef"; set i_varargs; eval $setvar
14212                 ;;
14213         varargs.h)
14214                 val="$undef"; set i_stdarg; eval $setvar
14215                 val="$define"; set i_varargs; eval $setvar
14216                 ;;
14217         esac
14218         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14219 esac
14220 $rm -f varargs*
14221
14222 : see if stddef is available
14223 set stddef.h i_stddef
14224 eval $inhdr
14225
14226 : see if sys/access.h is available
14227 set sys/access.h i_sysaccess
14228 eval $inhdr
14229
14230 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14231 set sys/filio.h i_sysfilio
14232 eval $inhdr
14233 echo " "
14234 if $test `./findhdr sys/ioctl.h`; then
14235         val="$define"
14236         echo '<sys/ioctl.h> found.' >&4
14237 else
14238         val="$undef"
14239         if $test $i_sysfilio = "$define"; then
14240             echo '<sys/ioctl.h> NOT found.' >&4
14241         else
14242                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14243                 $test $i_termio = "$define" && xxx="termio.h"
14244                 $test $i_termios = "$define" && xxx="termios.h"
14245 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14246         fi
14247 fi
14248 set i_sysioctl
14249 eval $setvar
14250
14251
14252 : see if this is a syslog.h system
14253 set syslog.h i_syslog
14254 eval $inhdr
14255
14256
14257 : see if this is a sys/mode.h system
14258 set sys/mode.h i_sysmode
14259 eval $inhdr
14260
14261 : see if sys/resource.h has to be included
14262 set sys/resource.h i_sysresrc
14263 eval $inhdr
14264
14265 : see if sys/security.h is available
14266 set sys/security.h i_syssecrt
14267 eval $inhdr
14268
14269 : see if this is a sys/statvfs.h system
14270 set sys/statvfs.h i_sysstatvfs
14271 eval $inhdr
14272
14273 : see if this is a sys/uio.h system
14274 set sys/uio.h i_sysuio
14275 eval $inhdr
14276
14277 : see if this is a sys/un.h system
14278 set sys/un.h i_sysun
14279 eval $inhdr
14280
14281
14282 : see if this is a sys/utsname.h system
14283 set sys/utsname.h i_sysutsname
14284 eval $inhdr
14285
14286 : see if this is a syswait system
14287 set sys/wait.h i_syswait
14288 eval $inhdr
14289
14290 : see if this is a ustat.h system
14291 set ustat.h i_ustat
14292 eval $inhdr
14293
14294 : see if this is an utime system
14295 set utime.h i_utime
14296 eval $inhdr
14297
14298 : see if this is a values.h system
14299 set values.h i_values
14300 eval $inhdr
14301
14302 : see if this is a vfork system
14303 case "$d_vfork" in
14304 "$define")
14305         set vfork.h i_vfork
14306         eval $inhdr
14307         ;;
14308 *)
14309         i_vfork="$undef"
14310         ;;
14311 esac
14312
14313 : see if gdbm.h is available
14314 set gdbm.h t_gdbm
14315 eval $inhdr
14316 case "$t_gdbm" in
14317 $define)
14318         : see if gdbm_open exists
14319         set gdbm_open d_gdbm_open
14320         eval $inlibc
14321         case "$d_gdbm_open" in
14322         $undef)
14323                 t_gdbm="$undef"
14324                 echo "We won't be including <gdbm.h>"
14325                 ;;
14326         esac
14327         ;;
14328 esac
14329 val="$t_gdbm"
14330 set i_gdbm
14331 eval $setvar
14332
14333 echo " "
14334 echo "Looking for extensions..." >&4
14335 : If we are using the old config.sh, known_extensions may contain
14336 : old or inaccurate or duplicate values.
14337 known_extensions=''
14338 nonxs_extensions=''
14339 : We do not use find because it might not be available.
14340 : We do not just use MANIFEST because the user may have dropped
14341 : some additional extensions into the source tree and expect them
14342 : to be built.
14343
14344 : Function to recursively find available extensions, ignoring DynaLoader
14345 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14346 find_extensions='
14347     for xxx in *; do
14348        case "$xxx" in
14349            DynaLoader|dynaload) ;;
14350            *)
14351            if $test -f $xxx/$xxx.xs; then
14352                known_extensions="$known_extensions $1$xxx";
14353            elif $test -f $xxx/Makefile.PL; then
14354                nonxs_extensions="$nonxs_extensions $1$xxx";
14355            else
14356                if $test -d $xxx -a $# -lt 10; then
14357                    set $1$xxx/ $*;
14358                    cd $xxx;
14359                    eval $find_extensions;
14360                    cd ..;
14361                    shift;
14362                fi;
14363            fi
14364            ;;
14365        esac;
14366     done'
14367 tdir=`pwd`
14368 cd $rsrc/ext
14369 set X
14370 shift
14371 eval $find_extensions
14372 set X $nonxs_extensions
14373 shift
14374 nonxs_extensions="$*"
14375 set X $known_extensions
14376 shift
14377 known_extensions="$*"
14378 cd $tdir
14379
14380 : Now see which are supported on this system.
14381 avail_ext=''
14382 for xxx in $known_extensions ; do
14383         case "$xxx" in
14384         DB_File|db_file)
14385                 case "$i_db" in
14386                 $define) avail_ext="$avail_ext $xxx" ;;
14387                 esac
14388                 ;;
14389         GDBM_File|gdbm_fil)
14390                 case "$i_gdbm" in 
14391                 $define) avail_ext="$avail_ext $xxx" ;;
14392                 esac
14393                 ;;
14394         NDBM_File|ndbm_fil)
14395                 case "$i_ndbm" in
14396                 $define)
14397                     case "$osname-$use64bits" in
14398                     hpux-define)
14399                         case "$libs" in
14400                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14401                         esac
14402                         ;;
14403                     *) avail_ext="$avail_ext $xxx" ;;
14404                     esac
14405                     ;;
14406                 esac
14407                 ;;
14408         ODBM_File|odbm_fil) 
14409                 case "${i_dbm}${i_rpcsvcdbm}" in
14410                 *"${define}"*)
14411                     case "$osname-$use64bits" in
14412                     hpux-define)
14413                         case "$libs" in
14414                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14415                         esac
14416                         ;;
14417                     *) avail_ext="$avail_ext $xxx" ;;
14418                     esac
14419                     ;;
14420                 esac
14421                 ;;
14422         POSIX|posix)
14423                 case "$useposix" in
14424                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14425                 esac
14426                 ;;
14427         Opcode|opcode)
14428                 case "$useopcode" in
14429                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14430                 esac
14431                 ;;
14432         Socket|socket)
14433                 case "$d_socket" in 
14434                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14435                 esac
14436                 ;;
14437         Thread|thread)
14438                 case "$usethreads" in 
14439                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14440                 esac
14441                 ;;
14442         IPC/SysV|ipc/sysv)
14443                 : XXX Do we need a useipcsysv variable here
14444                 case "${d_msg}${d_sem}${d_shm}" in 
14445                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14446                 esac
14447                 ;;
14448         *)      avail_ext="$avail_ext $xxx"
14449                 ;;
14450         esac
14451 done
14452
14453 set X $avail_ext
14454 shift
14455 avail_ext="$*"
14456
14457 : Now see which nonxs extensions are supported on this system.
14458 : For now assume all are.
14459 nonxs_ext=''
14460 for xxx in $nonxs_extensions ; do
14461         case "$xxx" in
14462         *)      nonxs_ext="$nonxs_ext $xxx"
14463                 ;;
14464         esac
14465 done
14466
14467 set X $nonxs_ext
14468 shift
14469 nonxs_ext="$*"
14470
14471 case $usedl in
14472 $define)
14473         $cat <<EOM
14474 A number of extensions are supplied with $package.  You may choose to
14475 compile these extensions for dynamic loading (the default), compile
14476 them into the $package executable (static loading), or not include
14477 them at all.  Answer "none" to include no extensions.
14478 Note that DynaLoader is always built and need not be mentioned here.
14479
14480 EOM
14481         case "$dynamic_ext" in
14482         '') dflt="$avail_ext" ;;
14483         *)      dflt="$dynamic_ext"
14484                 # Perhaps we are reusing an old out-of-date config.sh.
14485                 case "$hint" in
14486                 previous)
14487                         if test X"$dynamic_ext" != X"$avail_ext"; then
14488                                 $cat <<EOM
14489 NOTICE:  Your previous config.sh list may be incorrect. 
14490 The extensions now available to you are 
14491         ${avail_ext}
14492 but the default list from your previous config.sh is
14493         ${dynamic_ext} 
14494
14495 EOM
14496                         fi
14497                         ;;
14498                 esac
14499                 ;;
14500         esac
14501         case "$dflt" in
14502         '')     dflt=none;;
14503         esac
14504         rp="What extensions do you wish to load dynamically?"
14505         . ./myread
14506         case "$ans" in
14507         none) dynamic_ext=' ' ;;
14508         *) dynamic_ext="$ans" ;;
14509         esac
14510
14511         case "$static_ext" in
14512         '')
14513                 : Exclude those already listed in dynamic linking
14514                 dflt=''
14515                 for xxx in $avail_ext; do
14516                         case " $dynamic_ext " in
14517                         *" $xxx "*) ;;
14518                         *) dflt="$dflt $xxx" ;;
14519                         esac
14520                 done
14521                 set X $dflt
14522                 shift
14523                 dflt="$*"
14524                 ;;
14525         *)  dflt="$static_ext" 
14526                 ;;
14527         esac
14528
14529         case "$dflt" in
14530         '')     dflt=none;;
14531         esac
14532         rp="What extensions do you wish to load statically?"
14533         . ./myread
14534         case "$ans" in
14535         none) static_ext=' ' ;;
14536         *) static_ext="$ans" ;;
14537         esac
14538         ;;
14539 *)
14540         $cat <<EOM
14541 A number of extensions are supplied with $package.  Answer "none" 
14542 to include no extensions. 
14543 Note that DynaLoader is always built and need not be mentioned here.
14544
14545 EOM
14546         case "$static_ext" in
14547         '') dflt="$avail_ext" ;;
14548         *)      dflt="$static_ext"
14549                 # Perhaps we are reusing an old out-of-date config.sh.
14550                 case "$hint" in
14551                 previous)
14552                         if test X"$static_ext" != X"$avail_ext"; then
14553                                 $cat <<EOM
14554 NOTICE:  Your previous config.sh list may be incorrect. 
14555 The extensions now available to you are 
14556         ${avail_ext}
14557 but the default list from your previous config.sh is
14558         ${static_ext} 
14559
14560 EOM
14561                         fi
14562                         ;;
14563                 esac
14564                 ;;
14565         esac
14566         : Exclude those that are not xs extensions
14567         case "$dflt" in
14568         '')     dflt=none;;
14569         esac
14570         rp="What extensions do you wish to include?"
14571         . ./myread
14572         case "$ans" in
14573         none) static_ext=' ' ;;
14574         *) static_ext="$ans" ;;
14575         esac
14576         ;;
14577 esac
14578
14579 set X $dynamic_ext $static_ext $nonxs_ext
14580 shift
14581 extensions="$*"
14582
14583 : Remove build directory name from cppstdin so it can be used from
14584 : either the present location or the final installed location.
14585 echo " "
14586 : Get out of the UU directory to get correct path name.
14587 cd ..
14588 case "$cppstdin" in
14589 `pwd`/cppstdin)
14590         echo "Stripping down cppstdin path name"
14591         cppstdin=cppstdin
14592         ;;
14593 esac
14594 cd UU
14595
14596 : end of configuration questions
14597 echo " "
14598 echo "End of configuration questions."
14599 echo " "
14600
14601 : back to where it started
14602 if test -d ../UU; then
14603         cd ..
14604 fi
14605
14606 : configuration may be patched via a 'config.over' file
14607 if $test -f config.over; then
14608         echo " "
14609         dflt=y
14610         rp='I see a config.over file.  Do you wish to load it?'
14611         . UU/myread
14612         case "$ans" in
14613         n*) echo "OK, I'll ignore it.";;
14614         *)      . ./config.over
14615                 echo "Configuration override changes have been loaded."
14616                 ;;
14617         esac
14618 fi
14619
14620 : in case they want portability, strip down executable paths
14621 case "$d_portable" in
14622 "$define")
14623         echo " "
14624         echo "Stripping down executable paths..." >&4
14625         for file in $loclist $trylist; do
14626                 eval temp=\$$file
14627                 eval $file=`basename $temp`
14628         done
14629         ;;
14630 esac
14631
14632 : create config.sh file
14633 echo " "
14634 echo "Creating config.sh..." >&4
14635 $spitshell <<EOT >config.sh
14636 $startsh
14637 #
14638 # This file was produced by running the Configure script. It holds all the
14639 # definitions figured out by Configure. Should you modify one of these values,
14640 # do not forget to propagate your changes by running "Configure -der". You may
14641 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14642 #
14643
14644 # Package name      : $package
14645 # Source directory  : $src
14646 # Configuration time: $cf_time
14647 # Configured by     : $cf_by
14648 # Target system     : $myuname
14649
14650 Author='$Author'
14651 Date='$Date'
14652 Header='$Header'
14653 Id='$Id'
14654 Locker='$Locker'
14655 Log='$Log'
14656 Mcc='$Mcc'
14657 RCSfile='$RCSfile'
14658 Revision='$Revision'
14659 Source='$Source'
14660 State='$State'
14661 _a='$_a'
14662 _exe='$_exe'
14663 _o='$_o'
14664 afs='$afs'
14665 alignbytes='$alignbytes'
14666 ansi2knr='$ansi2knr'
14667 aphostname='$aphostname'
14668 api_revision='$api_revision'
14669 api_subversion='$api_subversion'
14670 api_version='$api_version'
14671 api_versionstring='$api_versionstring'
14672 ar='$ar'
14673 archlib='$archlib'
14674 archlibexp='$archlibexp'
14675 archname64='$archname64'
14676 archname='$archname'
14677 archobjs='$archobjs'
14678 awk='$awk'
14679 baserev='$baserev'
14680 bash='$bash'
14681 bin='$bin'
14682 bincompat5005='$bincompat5005'
14683 binexp='$binexp'
14684 bison='$bison'
14685 byacc='$byacc'
14686 byteorder='$byteorder'
14687 c='$c'
14688 castflags='$castflags'
14689 cat='$cat'
14690 cc='$cc'
14691 cccdlflags='$cccdlflags'
14692 ccdlflags='$ccdlflags'
14693 ccflags='$ccflags'
14694 ccsymbols='$ccsymbols'
14695 cf_by='$cf_by'
14696 cf_email='$cf_email'
14697 cf_time='$cf_time'
14698 charsize='$charsize'
14699 chgrp='$chgrp'
14700 chmod='$chmod'
14701 chown='$chown'
14702 clocktype='$clocktype'
14703 comm='$comm'
14704 compress='$compress'
14705 contains='$contains'
14706 cp='$cp'
14707 cpio='$cpio'
14708 cpp='$cpp'
14709 cpp_stuff='$cpp_stuff'
14710 cppccsymbols='$cppccsymbols'
14711 cppflags='$cppflags'
14712 cpplast='$cpplast'
14713 cppminus='$cppminus'
14714 cpprun='$cpprun'
14715 cppstdin='$cppstdin'
14716 cppsymbols='$cppsymbols'
14717 crosscompile='$crosscompile'
14718 cryptlib='$cryptlib'
14719 csh='$csh'
14720 d_Gconvert='$d_Gconvert'
14721 d_PRIEldbl='$d_PRIEldbl'
14722 d_PRIFldbl='$d_PRIFldbl'
14723 d_PRIGldbl='$d_PRIGldbl'
14724 d_PRIX64='$d_PRIX64'
14725 d_PRId64='$d_PRId64'
14726 d_PRIeldbl='$d_PRIeldbl'
14727 d_PRIfldbl='$d_PRIfldbl'
14728 d_PRIgldbl='$d_PRIgldbl'
14729 d_PRIi64='$d_PRIi64'
14730 d_PRIo64='$d_PRIo64'
14731 d_PRIu64='$d_PRIu64'
14732 d_PRIx64='$d_PRIx64'
14733 d_access='$d_access'
14734 d_accessx='$d_accessx'
14735 d_alarm='$d_alarm'
14736 d_archlib='$d_archlib'
14737 d_atolf='$d_atolf'
14738 d_atoll='$d_atoll'
14739 d_attribut='$d_attribut'
14740 d_bcmp='$d_bcmp'
14741 d_bcopy='$d_bcopy'
14742 d_bincompat5005='$d_bincompat5005'
14743 d_bsd='$d_bsd'
14744 d_bsdgetpgrp='$d_bsdgetpgrp'
14745 d_bsdsetpgrp='$d_bsdsetpgrp'
14746 d_bzero='$d_bzero'
14747 d_casti32='$d_casti32'
14748 d_castneg='$d_castneg'
14749 d_charvspr='$d_charvspr'
14750 d_chown='$d_chown'
14751 d_chroot='$d_chroot'
14752 d_chsize='$d_chsize'
14753 d_closedir='$d_closedir'
14754 d_const='$d_const'
14755 d_crypt='$d_crypt'
14756 d_csh='$d_csh'
14757 d_cuserid='$d_cuserid'
14758 d_dbl_dig='$d_dbl_dig'
14759 d_difftime='$d_difftime'
14760 d_dirnamlen='$d_dirnamlen'
14761 d_dlerror='$d_dlerror'
14762 d_dlopen='$d_dlopen'
14763 d_dlsymun='$d_dlsymun'
14764 d_dosuid='$d_dosuid'
14765 d_drand48proto='$d_drand48proto'
14766 d_dup2='$d_dup2'
14767 d_eaccess='$d_eaccess'
14768 d_endgrent='$d_endgrent'
14769 d_endhent='$d_endhent'
14770 d_endnent='$d_endnent'
14771 d_endpent='$d_endpent'
14772 d_endpwent='$d_endpwent'
14773 d_endsent='$d_endsent'
14774 d_endspent='$d_endspent'
14775 d_eofnblk='$d_eofnblk'
14776 d_eunice='$d_eunice'
14777 d_fchmod='$d_fchmod'
14778 d_fchown='$d_fchown'
14779 d_fcntl='$d_fcntl'
14780 d_fd_macros='$d_fd_macros'
14781 d_fd_set='$d_fd_set'
14782 d_fds_bits='$d_fds_bits'
14783 d_fgetpos='$d_fgetpos'
14784 d_flexfnam='$d_flexfnam'
14785 d_flock='$d_flock'
14786 d_fork='$d_fork'
14787 d_fpathconf='$d_fpathconf'
14788 d_fpos64_t='$d_fpos64_t'
14789 d_fs_data_s='$d_fs_data_s'
14790 d_fseeko='$d_fseeko'
14791 d_fsetpos='$d_fsetpos'
14792 d_fstatfs='$d_fstatfs'
14793 d_fstatvfs='$d_fstatvfs'
14794 d_ftello='$d_ftello'
14795 d_ftime='$d_ftime'
14796 d_getcwd='$d_getcwd'
14797 d_getgrent='$d_getgrent'
14798 d_getgrps='$d_getgrps'
14799 d_gethbyaddr='$d_gethbyaddr'
14800 d_gethbyname='$d_gethbyname'
14801 d_gethent='$d_gethent'
14802 d_gethname='$d_gethname'
14803 d_gethostprotos='$d_gethostprotos'
14804 d_getlogin='$d_getlogin'
14805 d_getmnt='$d_getmnt'
14806 d_getmntent='$d_getmntent'
14807 d_getnbyaddr='$d_getnbyaddr'
14808 d_getnbyname='$d_getnbyname'
14809 d_getnent='$d_getnent'
14810 d_getnetprotos='$d_getnetprotos'
14811 d_getpbyname='$d_getpbyname'
14812 d_getpbynumber='$d_getpbynumber'
14813 d_getpent='$d_getpent'
14814 d_getpgid='$d_getpgid'
14815 d_getpgrp2='$d_getpgrp2'
14816 d_getpgrp='$d_getpgrp'
14817 d_getppid='$d_getppid'
14818 d_getprior='$d_getprior'
14819 d_getprotoprotos='$d_getprotoprotos'
14820 d_getpwent='$d_getpwent'
14821 d_getsbyname='$d_getsbyname'
14822 d_getsbyport='$d_getsbyport'
14823 d_getsent='$d_getsent'
14824 d_getservprotos='$d_getservprotos'
14825 d_getspent='$d_getspent'
14826 d_getspnam='$d_getspnam'
14827 d_gettimeod='$d_gettimeod'
14828 d_gnulibc='$d_gnulibc'
14829 d_grpasswd='$d_grpasswd'
14830 d_hasmntopt='$d_hasmntopt'
14831 d_htonl='$d_htonl'
14832 d_iconv='$d_iconv'
14833 d_index='$d_index'
14834 d_inetaton='$d_inetaton'
14835 d_int64_t='$d_int64_t'
14836 d_isascii='$d_isascii'
14837 d_killpg='$d_killpg'
14838 d_lchown='$d_lchown'
14839 d_ldbl_dig='$d_ldbl_dig'
14840 d_link='$d_link'
14841 d_locconv='$d_locconv'
14842 d_lockf='$d_lockf'
14843 d_longdbl='$d_longdbl'
14844 d_longlong='$d_longlong'
14845 d_lseekproto='$d_lseekproto'
14846 d_lstat='$d_lstat'
14847 d_mblen='$d_mblen'
14848 d_mbstowcs='$d_mbstowcs'
14849 d_mbtowc='$d_mbtowc'
14850 d_memchr='$d_memchr'
14851 d_memcmp='$d_memcmp'
14852 d_memcpy='$d_memcpy'
14853 d_memmove='$d_memmove'
14854 d_memset='$d_memset'
14855 d_mkdir='$d_mkdir'
14856 d_mkdtemp='$d_mkdtemp'
14857 d_mkfifo='$d_mkfifo'
14858 d_mkstemp='$d_mkstemp'
14859 d_mkstemps='$d_mkstemps'
14860 d_mktime='$d_mktime'
14861 d_mmap='$d_mmap'
14862 d_mprotect='$d_mprotect'
14863 d_msg='$d_msg'
14864 d_msg_ctrunc='$d_msg_ctrunc'
14865 d_msg_dontroute='$d_msg_dontroute'
14866 d_msg_oob='$d_msg_oob'
14867 d_msg_peek='$d_msg_peek'
14868 d_msg_proxy='$d_msg_proxy'
14869 d_msgctl='$d_msgctl'
14870 d_msgget='$d_msgget'
14871 d_msgrcv='$d_msgrcv'
14872 d_msgsnd='$d_msgsnd'
14873 d_msync='$d_msync'
14874 d_munmap='$d_munmap'
14875 d_mymalloc='$d_mymalloc'
14876 d_nice='$d_nice'
14877 d_nv_preserves_uv='$d_nv_preserves_uv'
14878 d_off64_t='$d_off64_t'
14879 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14880 d_oldpthreads='$d_oldpthreads'
14881 d_oldsock='$d_oldsock'
14882 d_open3='$d_open3'
14883 d_pathconf='$d_pathconf'
14884 d_pause='$d_pause'
14885 d_phostname='$d_phostname'
14886 d_pipe='$d_pipe'
14887 d_poll='$d_poll'
14888 d_portable='$d_portable'
14889 d_pthread_yield='$d_pthread_yield'
14890 d_pwage='$d_pwage'
14891 d_pwchange='$d_pwchange'
14892 d_pwclass='$d_pwclass'
14893 d_pwcomment='$d_pwcomment'
14894 d_pwexpire='$d_pwexpire'
14895 d_pwgecos='$d_pwgecos'
14896 d_pwpasswd='$d_pwpasswd'
14897 d_pwquota='$d_pwquota'
14898 d_quad='$d_quad'
14899 d_readdir='$d_readdir'
14900 d_readlink='$d_readlink'
14901 d_rename='$d_rename'
14902 d_rewinddir='$d_rewinddir'
14903 d_rmdir='$d_rmdir'
14904 d_safebcpy='$d_safebcpy'
14905 d_safemcpy='$d_safemcpy'
14906 d_sanemcmp='$d_sanemcmp'
14907 d_sched_yield='$d_sched_yield'
14908 d_scm_rights='$d_scm_rights'
14909 d_seekdir='$d_seekdir'
14910 d_select='$d_select'
14911 d_sem='$d_sem'
14912 d_semctl='$d_semctl'
14913 d_semctl_semid_ds='$d_semctl_semid_ds'
14914 d_semctl_semun='$d_semctl_semun'
14915 d_semget='$d_semget'
14916 d_semop='$d_semop'
14917 d_setegid='$d_setegid'
14918 d_seteuid='$d_seteuid'
14919 d_setgrent='$d_setgrent'
14920 d_setgrps='$d_setgrps'
14921 d_sethent='$d_sethent'
14922 d_setlinebuf='$d_setlinebuf'
14923 d_setlocale='$d_setlocale'
14924 d_setnent='$d_setnent'
14925 d_setpent='$d_setpent'
14926 d_setpgid='$d_setpgid'
14927 d_setpgrp2='$d_setpgrp2'
14928 d_setpgrp='$d_setpgrp'
14929 d_setprior='$d_setprior'
14930 d_setpwent='$d_setpwent'
14931 d_setregid='$d_setregid'
14932 d_setresgid='$d_setresgid'
14933 d_setresuid='$d_setresuid'
14934 d_setreuid='$d_setreuid'
14935 d_setrgid='$d_setrgid'
14936 d_setruid='$d_setruid'
14937 d_setsent='$d_setsent'
14938 d_setsid='$d_setsid'
14939 d_setspent='$d_setspent'
14940 d_setvbuf='$d_setvbuf'
14941 d_sfio='$d_sfio'
14942 d_shm='$d_shm'
14943 d_shmat='$d_shmat'
14944 d_shmatprototype='$d_shmatprototype'
14945 d_shmctl='$d_shmctl'
14946 d_shmdt='$d_shmdt'
14947 d_shmget='$d_shmget'
14948 d_sigaction='$d_sigaction'
14949 d_sigsetjmp='$d_sigsetjmp'
14950 d_socket='$d_socket'
14951 d_socklen_t='$d_socklen_t'
14952 d_sockpair='$d_sockpair'
14953 d_sqrtl='$d_sqrtl'
14954 d_statblks='$d_statblks'
14955 d_statfs_f_flags='$d_statfs_f_flags'
14956 d_statfs_s='$d_statfs_s'
14957 d_statvfs='$d_statvfs'
14958 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14959 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14960 d_stdio_stream_array='$d_stdio_stream_array'
14961 d_stdiobase='$d_stdiobase'
14962 d_stdstdio='$d_stdstdio'
14963 d_strchr='$d_strchr'
14964 d_strcoll='$d_strcoll'
14965 d_strctcpy='$d_strctcpy'
14966 d_strerrm='$d_strerrm'
14967 d_strerror='$d_strerror'
14968 d_strtod='$d_strtod'
14969 d_strtol='$d_strtol'
14970 d_strtold='$d_strtold'
14971 d_strtoll='$d_strtoll'
14972 d_strtoul='$d_strtoul'
14973 d_strtoull='$d_strtoull'
14974 d_strtouq='$d_strtouq'
14975 d_strxfrm='$d_strxfrm'
14976 d_suidsafe='$d_suidsafe'
14977 d_symlink='$d_symlink'
14978 d_syscall='$d_syscall'
14979 d_sysconf='$d_sysconf'
14980 d_sysernlst='$d_sysernlst'
14981 d_syserrlst='$d_syserrlst'
14982 d_system='$d_system'
14983 d_tcgetpgrp='$d_tcgetpgrp'
14984 d_tcsetpgrp='$d_tcsetpgrp'
14985 d_telldir='$d_telldir'
14986 d_telldirproto='$d_telldirproto'
14987 d_time='$d_time'
14988 d_times='$d_times'
14989 d_truncate='$d_truncate'
14990 d_tzname='$d_tzname'
14991 d_umask='$d_umask'
14992 d_uname='$d_uname'
14993 d_union_semun='$d_union_semun'
14994 d_ustat='$d_ustat'
14995 d_vendorbin='$d_vendorbin'
14996 d_vendorlib='$d_vendorlib'
14997 d_vfork='$d_vfork'
14998 d_void_closedir='$d_void_closedir'
14999 d_voidsig='$d_voidsig'
15000 d_voidtty='$d_voidtty'
15001 d_volatile='$d_volatile'
15002 d_vprintf='$d_vprintf'
15003 d_wait4='$d_wait4'
15004 d_waitpid='$d_waitpid'
15005 d_wcstombs='$d_wcstombs'
15006 d_wctomb='$d_wctomb'
15007 d_xenix='$d_xenix'
15008 date='$date'
15009 db_hashtype='$db_hashtype'
15010 db_prefixtype='$db_prefixtype'
15011 defvoidused='$defvoidused'
15012 direntrytype='$direntrytype'
15013 dlext='$dlext'
15014 dlsrc='$dlsrc'
15015 doublesize='$doublesize'
15016 drand01='$drand01'
15017 dynamic_ext='$dynamic_ext'
15018 eagain='$eagain'
15019 ebcdic='$ebcdic'
15020 echo='$echo'
15021 egrep='$egrep'
15022 emacs='$emacs'
15023 eunicefix='$eunicefix'
15024 exe_ext='$exe_ext'
15025 expr='$expr'
15026 extensions='$extensions'
15027 fflushNULL='$fflushNULL'
15028 fflushall='$fflushall'
15029 find='$find'
15030 firstmakefile='$firstmakefile'
15031 flex='$flex'
15032 fpossize='$fpossize'
15033 fpostype='$fpostype'
15034 freetype='$freetype'
15035 full_ar='$full_ar'
15036 full_csh='$full_csh'
15037 full_sed='$full_sed'
15038 gccversion='$gccversion'
15039 gidformat='$gidformat'
15040 gidsign='$gidsign'
15041 gidsize='$gidsize'
15042 gidtype='$gidtype'
15043 glibpth='$glibpth'
15044 grep='$grep'
15045 groupcat='$groupcat'
15046 groupstype='$groupstype'
15047 gzip='$gzip'
15048 h_fcntl='$h_fcntl'
15049 h_sysfile='$h_sysfile'
15050 hint='$hint'
15051 hostcat='$hostcat'
15052 huge='$huge'
15053 i16size='$i16size'
15054 i16type='$i16type'
15055 i32size='$i32size'
15056 i32type='$i32type'
15057 i64size='$i64size'
15058 i64type='$i64type'
15059 i8size='$i8size'
15060 i8type='$i8type'
15061 i_arpainet='$i_arpainet'
15062 i_bsdioctl='$i_bsdioctl'
15063 i_db='$i_db'
15064 i_dbm='$i_dbm'
15065 i_dirent='$i_dirent'
15066 i_dld='$i_dld'
15067 i_dlfcn='$i_dlfcn'
15068 i_fcntl='$i_fcntl'
15069 i_float='$i_float'
15070 i_gdbm='$i_gdbm'
15071 i_grp='$i_grp'
15072 i_iconv='$i_iconv'
15073 i_inttypes='$i_inttypes'
15074 i_limits='$i_limits'
15075 i_locale='$i_locale'
15076 i_machcthr='$i_machcthr'
15077 i_malloc='$i_malloc'
15078 i_math='$i_math'
15079 i_memory='$i_memory'
15080 i_mntent='$i_mntent'
15081 i_ndbm='$i_ndbm'
15082 i_netdb='$i_netdb'
15083 i_neterrno='$i_neterrno'
15084 i_netinettcp='$i_netinettcp'
15085 i_niin='$i_niin'
15086 i_poll='$i_poll'
15087 i_pthread='$i_pthread'
15088 i_pwd='$i_pwd'
15089 i_rpcsvcdbm='$i_rpcsvcdbm'
15090 i_sfio='$i_sfio'
15091 i_sgtty='$i_sgtty'
15092 i_shadow='$i_shadow'
15093 i_socks='$i_socks'
15094 i_stdarg='$i_stdarg'
15095 i_stddef='$i_stddef'
15096 i_stdlib='$i_stdlib'
15097 i_string='$i_string'
15098 i_sysaccess='$i_sysaccess'
15099 i_sysdir='$i_sysdir'
15100 i_sysfile='$i_sysfile'
15101 i_sysfilio='$i_sysfilio'
15102 i_sysin='$i_sysin'
15103 i_sysioctl='$i_sysioctl'
15104 i_syslog='$i_syslog'
15105 i_sysmman='$i_sysmman'
15106 i_sysmode='$i_sysmode'
15107 i_sysmount='$i_sysmount'
15108 i_sysndir='$i_sysndir'
15109 i_sysparam='$i_sysparam'
15110 i_sysresrc='$i_sysresrc'
15111 i_syssecrt='$i_syssecrt'
15112 i_sysselct='$i_sysselct'
15113 i_syssockio='$i_syssockio'
15114 i_sysstat='$i_sysstat'
15115 i_sysstatfs='$i_sysstatfs'
15116 i_sysstatvfs='$i_sysstatvfs'
15117 i_systime='$i_systime'
15118 i_systimek='$i_systimek'
15119 i_systimes='$i_systimes'
15120 i_systypes='$i_systypes'
15121 i_sysuio='$i_sysuio'
15122 i_sysun='$i_sysun'
15123 i_sysutsname='$i_sysutsname'
15124 i_sysvfs='$i_sysvfs'
15125 i_syswait='$i_syswait'
15126 i_termio='$i_termio'
15127 i_termios='$i_termios'
15128 i_time='$i_time'
15129 i_unistd='$i_unistd'
15130 i_ustat='$i_ustat'
15131 i_utime='$i_utime'
15132 i_values='$i_values'
15133 i_varargs='$i_varargs'
15134 i_varhdr='$i_varhdr'
15135 i_vfork='$i_vfork'
15136 ignore_versioned_solibs='$ignore_versioned_solibs'
15137 inc_version_list='$inc_version_list'
15138 inc_version_list_init='$inc_version_list_init'
15139 incpath='$incpath'
15140 inews='$inews'
15141 installarchlib='$installarchlib'
15142 installbin='$installbin'
15143 installman1dir='$installman1dir'
15144 installman3dir='$installman3dir'
15145 installprefix='$installprefix'
15146 installprefixexp='$installprefixexp'
15147 installprivlib='$installprivlib'
15148 installscript='$installscript'
15149 installsitearch='$installsitearch'
15150 installsitebin='$installsitebin'
15151 installsitelib='$installsitelib'
15152 installstyle='$installstyle'
15153 installusrbinperl='$installusrbinperl'
15154 installvendorbin='$installvendorbin'
15155 installvendorlib='$installvendorlib'
15156 intsize='$intsize'
15157 ivdformat='$ivdformat'
15158 ivsize='$ivsize'
15159 ivtype='$ivtype'
15160 known_extensions='$known_extensions'
15161 ksh='$ksh'
15162 large='$large'
15163 ld='$ld'
15164 lddlflags='$lddlflags'
15165 ldflags='$ldflags'
15166 ldlibpthname='$ldlibpthname'
15167 less='$less'
15168 lib_ext='$lib_ext'
15169 libc='$libc'
15170 libperl='$libperl'
15171 libpth='$libpth'
15172 libs='$libs'
15173 libsdirs='$libsdirs'
15174 libsfiles='$libsfiles'
15175 libsfound='$libsfound'
15176 libspath='$libspath'
15177 libswanted='$libswanted'
15178 line='$line'
15179 lint='$lint'
15180 lkflags='$lkflags'
15181 ln='$ln'
15182 lns='$lns'
15183 locincpth='$locincpth'
15184 loclibpth='$loclibpth'
15185 longdblsize='$longdblsize'
15186 longlongsize='$longlongsize'
15187 longsize='$longsize'
15188 lp='$lp'
15189 lpr='$lpr'
15190 ls='$ls'
15191 lseeksize='$lseeksize'
15192 lseektype='$lseektype'
15193 mail='$mail'
15194 mailx='$mailx'
15195 make='$make'
15196 make_set_make='$make_set_make'
15197 mallocobj='$mallocobj'
15198 mallocsrc='$mallocsrc'
15199 malloctype='$malloctype'
15200 man1dir='$man1dir'
15201 man1direxp='$man1direxp'
15202 man1ext='$man1ext'
15203 man3dir='$man3dir'
15204 man3direxp='$man3direxp'
15205 man3ext='$man3ext'
15206 medium='$medium'
15207 mips_type='$mips_type'
15208 mkdir='$mkdir'
15209 mmaptype='$mmaptype'
15210 models='$models'
15211 modetype='$modetype'
15212 more='$more'
15213 multiarch='$multiarch'
15214 mv='$mv'
15215 myarchname='$myarchname'
15216 mydomain='$mydomain'
15217 myhostname='$myhostname'
15218 myuname='$myuname'
15219 n='$n'
15220 netdb_hlen_type='$netdb_hlen_type'
15221 netdb_host_type='$netdb_host_type'
15222 netdb_name_type='$netdb_name_type'
15223 netdb_net_type='$netdb_net_type'
15224 nm='$nm'
15225 nm_opt='$nm_opt'
15226 nm_so_opt='$nm_so_opt'
15227 nonxs_ext='$nonxs_ext'
15228 nroff='$nroff'
15229 nvsize='$nvsize'
15230 nvtype='$nvtype'
15231 o_nonblock='$o_nonblock'
15232 obj_ext='$obj_ext'
15233 old_pthread_create_joinable='$old_pthread_create_joinable'
15234 optimize='$optimize'
15235 orderlib='$orderlib'
15236 osname='$osname'
15237 osvers='$osvers'
15238 package='$package'
15239 pager='$pager'
15240 passcat='$passcat'
15241 patchlevel='$patchlevel'
15242 path_sep='$path_sep'
15243 perl5='$perl5'
15244 perl='$perl'
15245 perladmin='$perladmin'
15246 perlpath='$perlpath'
15247 pg='$pg'
15248 phostname='$phostname'
15249 pidtype='$pidtype'
15250 plibpth='$plibpth'
15251 pm_apiversion='$pm_apiversion'
15252 pmake='$pmake'
15253 pr='$pr'
15254 prefix='$prefix'
15255 prefixexp='$prefixexp'
15256 privlib='$privlib'
15257 privlibexp='$privlibexp'
15258 prototype='$prototype'
15259 ptrsize='$ptrsize'
15260 quadkind='$quadkind'
15261 quadtype='$quadtype'
15262 randbits='$randbits'
15263 randfunc='$randfunc'
15264 randseedtype='$randseedtype'
15265 ranlib='$ranlib'
15266 rd_nodata='$rd_nodata'
15267 revision='$revision'
15268 rm='$rm'
15269 rmail='$rmail'
15270 runnm='$runnm'
15271 sPRIEldbl='$sPRIEldbl'
15272 sPRIFldbl='$sPRIFldbl'
15273 sPRIGldbl='$sPRIGldbl'
15274 sPRIX64='$sPRIX64'
15275 sPRId64='$sPRId64'
15276 sPRIeldbl='$sPRIeldbl'
15277 sPRIfldbl='$sPRIfldbl'
15278 sPRIgldbl='$sPRIgldbl'
15279 sPRIi64='$sPRIi64'
15280 sPRIo64='$sPRIo64'
15281 sPRIu64='$sPRIu64'
15282 sPRIx64='$sPRIx64'
15283 sched_yield='$sched_yield'
15284 scriptdir='$scriptdir'
15285 scriptdirexp='$scriptdirexp'
15286 sed='$sed'
15287 seedfunc='$seedfunc'
15288 selectminbits='$selectminbits'
15289 selecttype='$selecttype'
15290 sendmail='$sendmail'
15291 sh='$sh'
15292 shar='$shar'
15293 sharpbang='$sharpbang'
15294 shmattype='$shmattype'
15295 shortsize='$shortsize'
15296 shrpenv='$shrpenv'
15297 shsharp='$shsharp'
15298 sig_count='$sig_count'
15299 sig_name='$sig_name'
15300 sig_name_init='$sig_name_init'
15301 sig_num='$sig_num'
15302 sig_num_init='$sig_num_init'
15303 signal_t='$signal_t'
15304 sitearch='$sitearch'
15305 sitearchexp='$sitearchexp'
15306 sitebin='$sitebin'
15307 sitebinexp='$sitebinexp'
15308 sitelib='$sitelib'
15309 sitelibexp='$sitelibexp'
15310 siteprefix='$siteprefix'
15311 siteprefixexp='$siteprefixexp'
15312 sizetype='$sizetype'
15313 sleep='$sleep'
15314 smail='$smail'
15315 small='$small'
15316 so='$so'
15317 sockethdr='$sockethdr'
15318 socketlib='$socketlib'
15319 sort='$sort'
15320 spackage='$spackage'
15321 spitshell='$spitshell'
15322 split='$split'
15323 src='$src'
15324 ssizetype='$ssizetype'
15325 startperl='$startperl'
15326 startsh='$startsh'
15327 static_ext='$static_ext'
15328 stdchar='$stdchar'
15329 stdio_base='$stdio_base'
15330 stdio_bufsiz='$stdio_bufsiz'
15331 stdio_cnt='$stdio_cnt'
15332 stdio_filbuf='$stdio_filbuf'
15333 stdio_ptr='$stdio_ptr'
15334 stdio_stream_array='$stdio_stream_array'
15335 strings='$strings'
15336 submit='$submit'
15337 subversion='$subversion'
15338 sysman='$sysman'
15339 tail='$tail'
15340 tar='$tar'
15341 tbl='$tbl'
15342 tee='$tee'
15343 test='$test'
15344 timeincl='$timeincl'
15345 timetype='$timetype'
15346 touch='$touch'
15347 tr='$tr'
15348 trnl='$trnl'
15349 troff='$troff'
15350 u16size='$u16size'
15351 u16type='$u16type'
15352 u32size='$u32size'
15353 u32type='$u32type'
15354 u64size='$u64size'
15355 u64type='$u64type'
15356 u8size='$u8size'
15357 u8type='$u8type'
15358 uidformat='$uidformat'
15359 uidsign='$uidsign'
15360 uidsize='$uidsize'
15361 uidtype='$uidtype'
15362 uname='$uname'
15363 uniq='$uniq'
15364 uquadtype='$uquadtype'
15365 use5005threads='$use5005threads'
15366 use64bits='$use64bits'
15367 usedl='$usedl'
15368 usefull64bits='$usefull64bits'
15369 useithreads='$useithreads'
15370 uselargefiles='$uselargefiles'
15371 uselongdouble='$uselongdouble'
15372 usemorebits='$usemorebits'
15373 usemultiplicity='$usemultiplicity'
15374 usemymalloc='$usemymalloc'
15375 usenm='$usenm'
15376 useopcode='$useopcode'
15377 useperlio='$useperlio'
15378 useposix='$useposix'
15379 usesfio='$usesfio'
15380 useshrplib='$useshrplib'
15381 usesocks='$usesocks'
15382 usethreads='$usethreads'
15383 usevendorprefix='$usevendorprefix'
15384 usevfork='$usevfork'
15385 usrinc='$usrinc'
15386 uuname='$uuname'
15387 uvoformat='$uvoformat'
15388 uvsize='$uvsize'
15389 uvtype='$uvtype'
15390 uvuformat='$uvuformat'
15391 uvxformat='$uvxformat'
15392 vendorbin='$vendorbin'
15393 vendorbinexp='$vendorbinexp'
15394 vendorlib='$vendorlib'
15395 vendorlibexp='$vendorlibexp'
15396 vendorprefix='$vendorprefix'
15397 vendorprefixexp='$vendorprefixexp'
15398 version='$version'
15399 vi='$vi'
15400 voidflags='$voidflags'
15401 xlibpth='$xlibpth'
15402 xs_apiversion='$xs_apiversion'
15403 zcat='$zcat'
15404 zip='$zip'
15405 EOT
15406
15407 : Add in command line options if available
15408 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15409
15410 : add special variables
15411 $test -f $src/patchlevel.h && \
15412 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15413 echo "CONFIGDOTSH=true" >>config.sh
15414
15415 : propagate old symbols
15416 if $test -f UU/config.sh; then
15417         <UU/config.sh sort | uniq >UU/oldconfig.sh
15418         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15419         sort | uniq -u >UU/oldsyms
15420         set X `cat UU/oldsyms`
15421         shift
15422         case $# in
15423         0) ;;
15424         *)
15425                 cat <<EOM
15426 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15427 EOM
15428                 echo "# Variables propagated from previous config.sh file." >>config.sh
15429                 for sym in `cat UU/oldsyms`; do
15430                         echo "    Propagating $hint variable "'$'"$sym..."
15431                         eval 'tmp="$'"${sym}"'"'
15432                         echo "$tmp" | \
15433                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15434                 done
15435                 ;;
15436         esac
15437 fi
15438
15439 : Finish up by extracting the .SH files
15440 case "$alldone" in
15441 exit)
15442         $rm -rf UU
15443         echo "Done."
15444         exit 0
15445         ;;
15446 cont)
15447         ;;
15448 '')
15449         dflt=''
15450         nostick=true
15451         $cat <<EOM
15452
15453 If you'd like to make any changes to the config.sh file before I begin
15454 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15455
15456 EOM
15457         rp="Press return or use a shell escape to edit config.sh:"
15458         . UU/myread
15459         nostick=''
15460         case "$ans" in
15461         '') ;;
15462         *) : in case they cannot read
15463                 sh 1>&4 -c "$ans";;
15464         esac
15465         ;;
15466 esac
15467
15468 : if this fails, just run all the .SH files by hand
15469 . ./config.sh
15470
15471 echo " "
15472 exec 1>&4
15473 . ./UU/extract
15474
15475 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15476         dflt=y
15477         case "$silent" in
15478         true) ;;
15479         *)
15480                 $cat <<EOM
15481
15482 Now you need to generate make dependencies by running "$make depend".
15483 You might prefer to run it in background: "$make depend > makedepend.out &"
15484 It can take a while, so you might not want to run it right now.
15485
15486 EOM
15487                 ;;
15488         esac
15489         rp="Run $make depend now?"
15490         . UU/myread
15491         case "$ans" in
15492         y*)
15493                 $make depend && echo "Now you must run a $make."
15494                 ;;
15495         *)
15496                 echo "You must run '$make depend' then '$make'."
15497                 ;;
15498         esac
15499 elif test -f [Mm]akefile; then
15500         echo " "
15501         echo "Now you must run a $make."
15502 else
15503         echo "Done."
15504 fi
15505
15506 if $test -f Policy.sh; then
15507     $cat <<EOM
15508
15509 If you compile $package on a different machine or from a different object
15510 directory, copy the Policy.sh file from this object directory to the
15511 new one before you run Configure -- this will help you with most of
15512 the policy defaults.
15513
15514 EOM
15515 fi
15516 if $test -f config.msg; then
15517     echo "Hmm.  I also noted the following information while running:"
15518     echo " "
15519     $cat config.msg >&4
15520     $rm -f config.msg
15521 fi
15522 $rm -f kit*isdone ark*isdone
15523 $rm -rf UU
15524
15525 : End of Configure
15526