unsigned is a more reasonable socksizetype default (from
[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 Sat Mar 18 23:12:11 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_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getpwent=''
396 d_getsent=''
397 d_getservprotos=''
398 d_getspent=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_killpg=''
410 d_lchown=''
411 d_ldbl_dig=''
412 d_link=''
413 d_locconv=''
414 d_lockf=''
415 d_longdbl=''
416 longdblsize=''
417 d_longlong=''
418 longlongsize=''
419 d_lseekproto=''
420 d_lstat=''
421 d_madvise=''
422 d_mblen=''
423 d_mbstowcs=''
424 d_mbtowc=''
425 d_memchr=''
426 d_memcmp=''
427 d_memcpy=''
428 d_memmove=''
429 d_memset=''
430 d_mkdir=''
431 d_mkdtemp=''
432 d_mkfifo=''
433 d_mkstemp=''
434 d_mkstemps=''
435 d_mktime=''
436 d_mmap=''
437 mmaptype=''
438 d_mprotect=''
439 d_msg=''
440 d_msgctl=''
441 d_msgget=''
442 d_msgrcv=''
443 d_msgsnd=''
444 d_msync=''
445 d_munmap=''
446 d_nice=''
447 d_off64_t=''
448 d_open3=''
449 d_fpathconf=''
450 d_pathconf=''
451 d_pause=''
452 d_pipe=''
453 d_poll=''
454 d_portable=''
455 d_old_pthread_create_joinable=''
456 old_pthread_create_joinable=''
457 d_pthread_yield=''
458 d_sched_yield=''
459 sched_yield=''
460 d_qgcvt=''
461 d_readdir=''
462 d_rewinddir=''
463 d_seekdir=''
464 d_telldir=''
465 d_readlink=''
466 d_rename=''
467 d_rmdir=''
468 d_safebcpy=''
469 d_safemcpy=''
470 d_sanemcmp=''
471 d_select=''
472 d_sem=''
473 d_semctl=''
474 d_semget=''
475 d_semop=''
476 d_setegid=''
477 d_seteuid=''
478 d_setgrent=''
479 d_setgrps=''
480 d_sethent=''
481 d_setlinebuf=''
482 d_setlocale=''
483 d_setnent=''
484 d_setpent=''
485 d_setpgid=''
486 d_setpgrp2=''
487 d_bsdsetpgrp=''
488 d_setpgrp=''
489 d_setprior=''
490 d_setpwent=''
491 d_setregid=''
492 d_setresgid=''
493 d_setresuid=''
494 d_setreuid=''
495 d_setrgid=''
496 d_setruid=''
497 d_setsent=''
498 d_setsid=''
499 d_setspent=''
500 d_setvbuf=''
501 d_sfio=''
502 usesfio=''
503 d_shm=''
504 d_shmat=''
505 d_shmatprototype=''
506 shmattype=''
507 d_shmctl=''
508 d_shmdt=''
509 d_shmget=''
510 d_sigaction=''
511 d_sigsetjmp=''
512 d_msg_ctrunc=''
513 d_msg_dontroute=''
514 d_msg_oob=''
515 d_msg_peek=''
516 d_msg_proxy=''
517 d_oldsock=''
518 d_scm_rights=''
519 d_socket=''
520 d_sockpair=''
521 sockethdr=''
522 socketlib=''
523 d_socklen_t=''
524 d_sqrtl=''
525 d_statblks=''
526 d_statfs_f_flags=''
527 d_statfs_s=''
528 d_fstatvfs=''
529 d_statvfs=''
530 d_stdio_cnt_lval=''
531 d_stdio_ptr_lval=''
532 d_stdiobase=''
533 d_stdstdio=''
534 stdio_base=''
535 stdio_bufsiz=''
536 stdio_cnt=''
537 stdio_filbuf=''
538 stdio_ptr=''
539 d_index=''
540 d_strchr=''
541 d_strcoll=''
542 d_strctcpy=''
543 d_strerrm=''
544 d_strerror=''
545 d_sysernlst=''
546 d_syserrlst=''
547 d_strtod=''
548 d_strtol=''
549 d_strtold=''
550 d_strtoll=''
551 d_strtoul=''
552 d_strtoull=''
553 d_strtouq=''
554 d_strxfrm=''
555 d_symlink=''
556 d_syscall=''
557 d_sysconf=''
558 d_system=''
559 d_tcgetpgrp=''
560 d_tcsetpgrp=''
561 d_telldirproto=''
562 d_time=''
563 timetype=''
564 clocktype=''
565 d_times=''
566 d_truncate=''
567 d_tzname=''
568 d_umask=''
569 d_semctl_semid_ds=''
570 d_semctl_semun=''
571 d_union_semun=''
572 d_ustat=''
573 d_vfork=''
574 usevfork=''
575 d_voidsig=''
576 signal_t=''
577 d_volatile=''
578 d_charvspr=''
579 d_vprintf=''
580 d_wait4=''
581 d_waitpid=''
582 d_wcstombs=''
583 d_wctomb=''
584 dlext=''
585 cccdlflags=''
586 ccdlflags=''
587 dlsrc=''
588 ld=''
589 lddlflags=''
590 usedl=''
591 doublesize=''
592 ebcdic=''
593 fflushNULL=''
594 fflushall=''
595 fpossize=''
596 fpostype=''
597 gidformat=''
598 gidsign=''
599 gidsize=''
600 gidtype=''
601 groupstype=''
602 h_fcntl=''
603 h_sysfile=''
604 i_arpainet=''
605 db_hashtype=''
606 db_prefixtype=''
607 i_db=''
608 i_dbm=''
609 i_rpcsvcdbm=''
610 d_dirnamlen=''
611 direntrytype=''
612 i_dirent=''
613 i_dld=''
614 i_dlfcn=''
615 i_fcntl=''
616 i_float=''
617 i_gdbm=''
618 d_grpasswd=''
619 i_grp=''
620 i_iconv=''
621 i_ieeefp=''
622 i_inttypes=''
623 i_limits=''
624 i_locale=''
625 i_machcthr=''
626 i_malloc=''
627 i_math=''
628 i_memory=''
629 i_mntent=''
630 i_ndbm=''
631 i_netdb=''
632 i_neterrno=''
633 i_netinettcp=''
634 i_niin=''
635 i_sysin=''
636 i_poll=''
637 i_pthread=''
638 d_pwage=''
639 d_pwchange=''
640 d_pwclass=''
641 d_pwcomment=''
642 d_pwexpire=''
643 d_pwgecos=''
644 d_pwpasswd=''
645 d_pwquota=''
646 i_pwd=''
647 i_sfio=''
648 i_shadow=''
649 i_socks=''
650 i_stddef=''
651 i_stdlib=''
652 i_string=''
653 strings=''
654 i_sunmath=''
655 i_sysaccess=''
656 i_sysdir=''
657 i_sysfile=''
658 d_voidtty=''
659 i_bsdioctl=''
660 i_sysfilio=''
661 i_sysioctl=''
662 i_syssockio=''
663 i_syslog=''
664 i_sysmman=''
665 i_sysmode=''
666 i_sysmount=''
667 i_sysndir=''
668 i_sysparam=''
669 i_sysresrc=''
670 i_syssecrt=''
671 i_sysselct=''
672 i_sysstat=''
673 i_sysstatfs=''
674 i_sysstatvfs=''
675 i_systimes=''
676 i_systypes=''
677 i_sysuio=''
678 i_sysun=''
679 i_sysutsname=''
680 i_sysvfs=''
681 i_syswait=''
682 i_sgtty=''
683 i_termio=''
684 i_termios=''
685 i_systime=''
686 i_systimek=''
687 i_time=''
688 timeincl=''
689 i_unistd=''
690 i_ustat=''
691 i_utime=''
692 i_values=''
693 i_stdarg=''
694 i_varargs=''
695 i_varhdr=''
696 i_vfork=''
697 inc_version_list=''
698 inc_version_list_init=''
699 installprefix=''
700 installprefixexp=''
701 installstyle=''
702 installusrbinperl=''
703 intsize=''
704 longsize=''
705 shortsize=''
706 libc=''
707 ldlibpthname=''
708 libperl=''
709 shrpenv=''
710 useshrplib=''
711 glibpth=''
712 libpth=''
713 loclibpth=''
714 plibpth=''
715 xlibpth=''
716 ignore_versioned_solibs=''
717 libs=''
718 libsdirs=''
719 libsfiles=''
720 libsfound=''
721 libspath=''
722 lns=''
723 d_PRIEldbl=''
724 d_PRIFldbl=''
725 d_PRIGldbl=''
726 d_PRIeldbl=''
727 d_PRIfldbl=''
728 d_PRIgldbl=''
729 sPRIEldbl=''
730 sPRIFldbl=''
731 sPRIGldbl=''
732 sPRIeldbl=''
733 sPRIfldbl=''
734 sPRIgldbl=''
735 lseeksize=''
736 lseektype=''
737 make_set_make=''
738 d_mymalloc=''
739 freetype=''
740 mallocobj=''
741 mallocsrc=''
742 malloctype=''
743 usemymalloc=''
744 installman1dir=''
745 man1dir=''
746 man1direxp=''
747 man1ext=''
748 installman3dir=''
749 man3dir=''
750 man3direxp=''
751 man3ext=''
752 huge=''
753 large=''
754 medium=''
755 models=''
756 small=''
757 split=''
758 modetype=''
759 multiarch=''
760 mydomain=''
761 myhostname=''
762 phostname=''
763 c=''
764 n=''
765 d_eofnblk=''
766 eagain=''
767 o_nonblock=''
768 rd_nodata=''
769 netdb_hlen_type=''
770 netdb_host_type=''
771 netdb_name_type=''
772 netdb_net_type=''
773 groupcat=''
774 hostcat=''
775 passcat=''
776 orderlib=''
777 ranlib=''
778 package=''
779 spackage=''
780 pager=''
781 api_revision=''
782 api_subversion=''
783 api_version=''
784 api_versionstring=''
785 patchlevel=''
786 revision=''
787 subversion=''
788 version=''
789 perl5=''
790 perladmin=''
791 perlpath=''
792 d_nv_preserves_uv=''
793 i16size=''
794 i16type=''
795 i32size=''
796 i32type=''
797 i64size=''
798 i64type=''
799 i8size=''
800 i8type=''
801 ivsize=''
802 ivtype=''
803 nvsize=''
804 nvtype=''
805 u16size=''
806 u16type=''
807 u32size=''
808 u32type=''
809 u64size=''
810 u64type=''
811 u8size=''
812 u8type=''
813 uvsize=''
814 uvtype=''
815 ivdformat=''
816 uvoformat=''
817 uvuformat=''
818 uvxformat=''
819 pidtype=''
820 prefix=''
821 prefixexp=''
822 installprivlib=''
823 privlib=''
824 privlibexp=''
825 prototype=''
826 ptrsize=''
827 d_PRIX64=''
828 d_PRId64=''
829 d_PRIi64=''
830 d_PRIo64=''
831 d_PRIu64=''
832 d_PRIx64=''
833 sPRIX64=''
834 sPRId64=''
835 sPRIi64=''
836 sPRIo64=''
837 sPRIu64=''
838 sPRIx64=''
839 d_quad=''
840 quadkind=''
841 quadtype=''
842 uquadtype=''
843 drand01=''
844 randbits=''
845 randfunc=''
846 randseedtype=''
847 seedfunc=''
848 installscript=''
849 scriptdir=''
850 scriptdirexp=''
851 selectminbits=''
852 selecttype=''
853 sh=''
854 sig_count=''
855 sig_name=''
856 sig_name_init=''
857 sig_num=''
858 sig_num_init=''
859 installsitearch=''
860 sitearch=''
861 sitearchexp=''
862 installsitebin=''
863 sitebin=''
864 sitebinexp=''
865 installsitelib=''
866 sitelib=''
867 sitelib_stem=''
868 sitelibexp=''
869 siteprefix=''
870 siteprefixexp=''
871 sizesize=''
872 sizetype=''
873 so=''
874 socksizetype=''
875 sharpbang=''
876 shsharp=''
877 spitshell=''
878 src=''
879 ssizetype=''
880 startperl=''
881 startsh=''
882 stdchar=''
883 d_stdio_stream_array=''
884 stdio_stream_array=''
885 sysman=''
886 trnl=''
887 uidformat=''
888 uidsign=''
889 uidsize=''
890 uidtype=''
891 archname64=''
892 use64bitall=''
893 use64bitint=''
894 uselargefiles=''
895 uselongdouble=''
896 usemorebits=''
897 usemultiplicity=''
898 nm_opt=''
899 nm_so_opt=''
900 runnm=''
901 usenm=''
902 useperlio=''
903 usesocks=''
904 d_oldpthreads=''
905 use5005threads=''
906 useithreads=''
907 usethreads=''
908 incpath=''
909 mips_type=''
910 usrinc=''
911 d_vendorarch=''
912 installvendorarch=''
913 vendorarch=''
914 vendorarchexp=''
915 d_vendorbin=''
916 installvendorbin=''
917 vendorbin=''
918 vendorbinexp=''
919 d_vendorlib=''
920 installvendorlib=''
921 vendorlib=''
922 vendorlib_stem=''
923 vendorlibexp=''
924 usevendorprefix=''
925 vendorprefix=''
926 vendorprefixexp=''
927 defvoidused=''
928 voidflags=''
929 pm_apiversion=''
930 xs_apiversion=''
931 CONFIG=''
932
933 define='define'
934 undef='undef'
935 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
936 rmlist=''
937
938 : We must find out about Eunice early
939 eunicefix=':'
940 if test -f /etc/unixtovms; then
941         eunicefix=/etc/unixtovms
942 fi
943 if test -f /etc/unixtovms.exe; then
944         eunicefix=/etc/unixtovms.exe
945 fi
946
947 i_whoami=''
948 : set useposix=false in your hint file to disable the POSIX extension.
949 useposix=true
950 : set useopcode=false in your hint file to disable the Opcode extension.
951 useopcode=true
952 : Trailing extension.  Override this in a hint file, if needed.
953 _exe=''
954 : Extra object files, if any, needed on this platform.
955 archobjs=''
956 : Possible local include directories to search.
957 : Set locincpth to "" in a hint file to defeat local include searches.
958 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
959 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
960 :
961 : no include file wanted by default
962 inclwanted=''
963
964 groupstype=''
965 : change the next line if compiling for Xenix/286 on Xenix/386
966 xlibpth='/usr/lib/386 /lib/386'
967 : Possible local library directories to search.
968 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
969 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
970
971 : general looking path for locating libraries
972 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
973 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
974 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
975 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
976 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
977
978 : Private path used by Configure to find libraries.  Its value
979 : is prepended to libpth. This variable takes care of special
980 : machines, like the mips.  Usually, it should be empty.
981 plibpth=''
982
983 : default library list
984 libswanted=''
985 : some systems want to use only the non-versioned libso:s
986 ignore_versioned_solibs=''
987 : set usemultiplicity on the Configure command line to enable multiplicity.
988 : set usesocks on the Configure command line to enable socks.
989 : set usethreads on the Configure command line to enable threads.
990 : full support for void wanted by default
991 defvoidused=15
992
993 : List of libraries we want.
994 : If anyone needs -lnet, put it in a hint file.
995 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
996 libswanted="$libswanted dld ld sun m c cposix posix"
997 libswanted="$libswanted ndir dir crypt sec"
998 libswanted="$libswanted ucb bsd BSD PW x iconv"
999 : We probably want to search /usr/shlib before most other libraries.
1000 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1001 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1002 glibpth="/usr/shlib $glibpth"
1003 : Do not use vfork unless overridden by a hint file.
1004 usevfork=false
1005
1006 : Find the basic shell for Bourne shell scripts
1007 case "$sh" in
1008 '')
1009         case "$SYSTYPE" in
1010         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1011         *) xxx='/bin/sh';;
1012         esac
1013         if test -f "$xxx"; then
1014                 sh="$xxx"
1015         else
1016                 : Build up a list and do a single loop so we can 'break' out.
1017                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1018                 for xxx in sh bash ksh pdksh ash; do
1019                         for p in $pth; do
1020                                 try="$try ${p}/${xxx}"
1021                         done
1022                 done
1023                 for xxx in $try; do
1024                         if test -f "$xxx"; then
1025                                 sh="$xxx";
1026                                 break
1027                         elif test -f "$xxx.exe"; then
1028                                 sh="$xxx";
1029                                 break
1030                         fi
1031                 done
1032         fi
1033         ;;
1034 esac
1035
1036 case "$sh" in
1037 '')     cat <<EOM >&2
1038 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1039
1040 Usually it's in /bin/sh.  How did you even get this far?
1041 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1042 we'll try to straighten this all out.
1043 EOM
1044         exit 1
1045         ;;
1046 esac
1047
1048 : see if sh knows # comments
1049 if `$sh -c '#' >/dev/null 2>&1`; then
1050         shsharp=true
1051         spitshell=cat
1052         xcat=/bin/cat
1053         test -f $xcat || xcat=/usr/bin/cat
1054         echo "#!$xcat" >try
1055         $eunicefix try
1056         chmod +x try
1057         ./try > today
1058         if test -s today; then
1059                 sharpbang='#!'
1060         else
1061                 echo "#! $xcat" > try
1062                 $eunicefix try
1063                 chmod +x try
1064                 ./try > today
1065                 if test -s today; then
1066                         sharpbang='#! '
1067                 else
1068                         sharpbang=': use '
1069                 fi
1070         fi
1071 else
1072         echo " "
1073         echo "Your $sh doesn't grok # comments--I will strip them later on."
1074         shsharp=false
1075         cd ..
1076         echo "exec grep -v '^[  ]*#'" >spitshell
1077         chmod +x spitshell
1078         $eunicefix spitshell
1079         spitshell=`pwd`/spitshell
1080         cd UU
1081         echo "I presume that if # doesn't work, #! won't work either!"
1082         sharpbang=': use '
1083 fi
1084 rm -f try today
1085
1086 : figure out how to guarantee sh startup
1087 case "$startsh" in
1088 '') startsh=${sharpbang}${sh} ;;
1089 *)
1090 esac
1091 cat >try <<EOSS
1092 $startsh
1093 set abc
1094 test "$?abc" != 1
1095 EOSS
1096
1097 chmod +x try
1098 $eunicefix try
1099 if ./try; then
1100         : echo "Yup, it does."
1101 else
1102         echo "Hmm... '$startsh' does not guarantee sh startup..."
1103         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1104 fi
1105 rm -f try
1106
1107
1108 : Save command line options in file UU/cmdline.opt for later use in
1109 : generating config.sh.
1110 cat > cmdline.opt <<EOSH
1111 # Configure command line arguments.
1112 config_arg0='$0'
1113 config_args='$*'
1114 config_argc=$#
1115 EOSH
1116 argn=1
1117 for arg in "$@"; do
1118         cat >>cmdline.opt <<EOSH
1119 config_arg$argn='$arg'
1120 EOSH
1121         argn=`expr $argn + 1`
1122 done
1123
1124 : produce awk script to parse command line options
1125 cat >options.awk <<'EOF'
1126 BEGIN {
1127         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1128
1129         len = length(optstr);
1130         for (i = 1; i <= len; i++) {
1131                 c = substr(optstr, i, 1);
1132                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1133                 if (a == ":") {
1134                         arg[c] = 1;
1135                         i++;
1136                 }
1137                 opt[c] = 1;
1138         }
1139 }
1140 {
1141         expect = 0;
1142         str = $0;
1143         if (substr(str, 1, 1) != "-") {
1144                 printf("'%s'\n", str);
1145                 next;
1146         }
1147         len = length($0);
1148         for (i = 2; i <= len; i++) {
1149                 c = substr(str, i, 1);
1150                 if (!opt[c]) {
1151                         printf("-%s\n", substr(str, i));
1152                         next;
1153                 }
1154                 printf("-%s\n", c);
1155                 if (arg[c]) {
1156                         if (i < len)
1157                                 printf("'%s'\n", substr(str, i + 1));
1158                         else
1159                                 expect = 1;
1160                         next;
1161                 }
1162         }
1163 }
1164 END {
1165         if (expect)
1166                 print "?";
1167 }
1168 EOF
1169
1170 : process the command line options
1171 set X `for arg in "$@"; do echo "X$arg"; done |
1172         sed -e s/X// | awk -f options.awk`
1173 eval "set $*"
1174 shift
1175 rm -f options.awk
1176
1177 : set up default values
1178 fastread=''
1179 reuseval=false
1180 config_sh=''
1181 alldone=''
1182 error=''
1183 silent=''
1184 extractsh=''
1185 override=''
1186 knowitall=''
1187 rm -f optdef.sh posthint.sh
1188 cat >optdef.sh <<EOS
1189 $startsh
1190 EOS
1191
1192
1193 : option parsing
1194 while test $# -gt 0; do
1195         case "$1" in
1196         -d) shift; fastread=yes;;
1197         -e) shift; alldone=cont;;
1198         -f)
1199                 shift
1200                 cd ..
1201                 if test -r "$1"; then
1202                         config_sh="$1"
1203                 else
1204                         echo "$me: cannot read config file $1." >&2
1205                         error=true
1206                 fi
1207                 cd UU
1208                 shift;;
1209         -h) shift; error=true;;
1210         -r) shift; reuseval=true;;
1211         -s) shift; silent=true; realsilent=true;;
1212         -E) shift; alldone=exit;;
1213         -K) shift; knowitall=true;;
1214         -O) shift; override=true;;
1215         -S) shift; silent=true; extractsh=true;;
1216         -D)
1217                 shift
1218                 case "$1" in
1219                 *=)
1220                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1221                         echo "$me: ignoring -D $1" >&2
1222                         ;;
1223                 *=*) echo "$1" | \
1224                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1225                 *) echo "$1='define'" >> optdef.sh;;
1226                 esac
1227                 shift
1228                 ;;
1229         -U)
1230                 shift
1231                 case "$1" in
1232                 *=) echo "$1" >> optdef.sh;;
1233                 *=*)
1234                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1235                         echo "$me: ignoring -U $1" >&2
1236                         ;;
1237                 *) echo "$1='undef'" >> optdef.sh;;
1238                 esac
1239                 shift
1240                 ;;
1241         -A)
1242             shift
1243             xxx=''
1244             yyy="$1"
1245             zzz=''
1246             uuu=undef
1247             case "$yyy" in
1248             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1249                  case "$zzz" in
1250                  *:*) zzz='' ;;
1251                  *)   xxx=append
1252                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1253                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1254                  esac
1255                  ;;
1256             esac
1257             case "$xxx" in
1258             '')  case "$yyy" in
1259                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1260                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1261                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1262                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1263                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1264                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1265                  esac
1266                  ;;       
1267             esac
1268             case "$xxx" in
1269             append)
1270                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1271             clear)
1272                 echo "$yyy=''"                  >> posthint.sh ;;
1273             define)
1274                 case "$zzz" in
1275                 '') zzz=define ;;
1276                 esac
1277                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1278             eval)
1279                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1280             prepend)
1281                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1282             undef)
1283                 case "$zzz" in
1284                 '') zzz="$uuu" ;;
1285                 esac
1286                 echo "$yyy=$zzz"                >> posthint.sh ;;
1287             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1288             esac
1289             shift
1290             ;;
1291         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1292             exit 0;;
1293         --) break;;
1294         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1295         *) break;;
1296         esac
1297 done
1298
1299 case "$error" in
1300 true)
1301         cat >&2 <<EOM
1302 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1303                  [-U symbol] [-U symbol=] [-A command:symbol...]
1304   -d : use defaults for all answers.
1305   -e : go on without questioning past the production of config.sh.
1306   -f : specify an alternate default configuration file.
1307   -h : print this help message and exit (with an error status).
1308   -r : reuse C symbols value if possible (skips costly nm extraction).
1309   -s : silent mode, only echoes questions and essential information.
1310   -D : define symbol to have some value:
1311          -D symbol         symbol gets the value 'define'
1312          -D symbol=value   symbol gets the value 'value'
1313   -E : stop at the end of questions, after having produced config.sh.
1314   -K : do not use unless you know what you are doing.
1315   -O : let -D and -U override definitions from loaded configuration file.
1316   -S : perform variable substitutions on all .SH files (can mix with -f)
1317   -U : undefine symbol:
1318          -U symbol    symbol gets the value 'undef'
1319          -U symbol=   symbol gets completely empty
1320   -A : manipulate symbol after the platform specific hints have been applied:
1321          -A symbol=value                append " "value to symbol
1322          -A append:symbol=value         append value to symbol
1323          -A define:symbol=value         define symbol to have value
1324          -A clear:symbol                define symbol to be ''
1325          -A define:symbol               define symbol to be 'define'
1326          -A eval:symbol=value           define symbol to be eval of value
1327          -A prepend:symbol=value        prepend value to symbol
1328          -A undef:symbol                define symbol to be 'undef'
1329          -A undef:symbol=               define symbol to be ''
1330   -V : print version number and exit (with a zero status).
1331 EOM
1332         exit 1
1333         ;;
1334 esac
1335
1336 : Sanity checks
1337 case "$fastread$alldone" in
1338 yescont|yesexit) ;;
1339 *)
1340         if test ! -t 0; then
1341                 echo "Say 'sh Configure', not 'sh <Configure'"
1342                 exit 1
1343         fi
1344         ;;
1345 esac
1346
1347 exec 4>&1
1348 case "$silent" in
1349 true) exec 1>/dev/null;;
1350 esac
1351
1352 : run the defines and the undefines, if any, but leave the file out there...
1353 touch optdef.sh
1354 . ./optdef.sh
1355 : create the posthint manipulation script and leave the file out there...
1356 touch posthint.sh
1357
1358 : set package name
1359 package=perl5
1360 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1361 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1362 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1363 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1364 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1365 esac
1366
1367 : Some greps do not return status, grrr.
1368 echo "grimblepritz" >grimble
1369 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1370         contains=contains
1371 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1372         contains=grep
1373 else
1374         contains=contains
1375 fi
1376 rm -f grimble
1377 : the following should work in any shell
1378 case "$contains" in
1379 contains*)
1380         echo " "
1381         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1382         cat >contains <<'EOSS'
1383 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1384 EOSS
1385 chmod +x contains
1386 esac
1387
1388 : Find the path to the source tree
1389 case "$src" in
1390 '') case "$0" in
1391     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1392          case "$src" in
1393          /*)    ;;
1394          *)     src=`cd ../$src && pwd` ;;
1395          esac
1396          ;;
1397     *)   src='.';;
1398     esac;;
1399 esac
1400 case "$src" in
1401 '')     src=/
1402         rsrc=/
1403         ;;
1404 /*) rsrc="$src";;
1405 *) rsrc="../$src";;
1406 esac
1407 if test -f $rsrc/Configure && \
1408         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1409 then
1410    : found it, so we are ok.
1411 else
1412         rsrc=''
1413         for src in . .. ../.. ../../.. ../../../..; do
1414                 if test -f ../$src/Configure && \
1415                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1416                 then
1417                         rsrc=../$src
1418                         break
1419                 fi
1420         done
1421 fi
1422 case "$rsrc" in
1423 '')
1424         cat <<EOM >&4
1425
1426 Sorry, I can't seem to locate the source dir for $package.  Please start
1427 Configure with an explicit path -- i.e. /some/path/Configure.
1428
1429 EOM
1430         exit 1
1431         ;;
1432 ../.)   rsrc='..';;
1433 *)
1434         echo " "
1435         echo "Sources for $package found in \"$src\"." >&4
1436         ;;
1437 esac
1438
1439 : script used to extract .SH files with variable substitutions
1440 cat >extract <<'EOS'
1441 CONFIGDOTSH=true
1442 echo "Doing variable substitutions on .SH files..."
1443 if test -f $src/MANIFEST; then
1444         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1445 else
1446         echo "(Looking for .SH files under the source directory.)"
1447         set x `(cd $src; find . -name "*.SH" -print)`
1448 fi
1449 shift
1450 case $# in
1451 0) set x `(cd $src; echo *.SH)`; shift;;
1452 esac
1453 if test ! -f $src/$1; then
1454         shift
1455 fi
1456 mkdir_p='
1457 name=$1;
1458 create="";
1459 while test $name; do
1460         if test ! -d "$name"; then
1461                 create="$name $create";
1462                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1463                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1464         else
1465                 name="";
1466         fi;
1467 done;
1468 for file in $create; do
1469         mkdir $file;
1470 done
1471 '
1472 for file in $*; do
1473         case "$src" in
1474         ".")
1475                 case "$file" in
1476                 */*)
1477                         dir=`expr X$file : 'X\(.*\)/'`
1478                         file=`expr X$file : 'X.*/\(.*\)'`
1479                         (cd $dir && . ./$file)
1480                         ;;
1481                 *)
1482                         . ./$file
1483                         ;;
1484                 esac
1485                 ;;
1486         *)
1487                 case "$file" in
1488                 */*)
1489                         dir=`expr X$file : 'X\(.*\)/'`
1490                         file=`expr X$file : 'X.*/\(.*\)'`
1491                         (set x $dir; shift; eval $mkdir_p)
1492                         sh <$src/$dir/$file
1493                         ;;
1494                 *)
1495                         sh <$src/$file
1496                         ;;
1497                 esac
1498                 ;;
1499         esac
1500 done
1501 if test -f $src/config_h.SH; then
1502         if test ! -f config.h; then
1503         : oops, they left it out of MANIFEST, probably, so do it anyway.
1504         . $src/config_h.SH
1505         fi
1506 fi
1507 EOS
1508
1509 : extract files and exit if asked to do so
1510 case "$extractsh" in
1511 true)
1512         case "$realsilent" in
1513         true) ;;
1514         *) exec 1>&4;;
1515         esac
1516         case "$config_sh" in
1517         '') config_sh='config.sh';;
1518         esac
1519         echo " "
1520         echo "Fetching answers from $config_sh..."
1521         cd ..
1522         . $config_sh
1523         test "$override" && . ./optdef.sh
1524         echo " "
1525         . UU/extract
1526         rm -rf UU
1527         echo "Done."
1528         exit 0
1529         ;;
1530 esac
1531
1532 : Eunice requires " " instead of "", can you believe it
1533 echo " "
1534 : Here we go...
1535 echo "Beginning of configuration questions for $package."
1536
1537 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1538
1539 : first determine how to suppress newline on echo command
1540 echo " "
1541 echo "Checking echo to see how to suppress newlines..."
1542 (echo "hi there\c" ; echo " ") >.echotmp
1543 if $contains c .echotmp >/dev/null 2>&1 ; then
1544         echo "...using -n."
1545         n='-n'
1546         c=''
1547 else
1548         cat <<'EOM'
1549 ...using \c
1550 EOM
1551         n=''
1552         c='\c'
1553 fi
1554 echo $n "The star should be here-->$c"
1555 echo '*'
1556 rm -f .echotmp
1557
1558 : Now test for existence of everything in MANIFEST
1559 echo " "
1560 if test -f $rsrc/MANIFEST; then
1561         echo "First let's make sure your kit is complete.  Checking..." >&4
1562         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1563         rm -f missing
1564         tmppwd=`pwd`
1565         for filelist in x??; do
1566                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1567         done
1568         if test -s missing; then
1569                 cat missing >&4
1570                 cat >&4 <<'EOM'
1571
1572 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1573
1574 You have the option of continuing the configuration process, despite the
1575 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1576 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1577 and contact the author (perlbug@perl.com).
1578
1579 EOM
1580                 echo $n "Continue? [n] $c" >&4
1581                 read ans
1582                 case "$ans" in
1583                 y*)
1584                         echo "Continuing..." >&4
1585                         rm -f missing
1586                         ;;
1587                 *)
1588                         echo "ABORTING..." >&4
1589                         kill $$
1590                         ;;
1591                 esac
1592         else
1593                 echo "Looks good..."
1594         fi
1595 else
1596         echo "There is no MANIFEST file.  I hope your kit is complete !"
1597 fi
1598 rm -f missing x??
1599
1600 echo " "
1601 : Find the appropriate value for a newline for tr
1602 if test -n "$DJGPP"; then
1603        trnl='\012'
1604 fi
1605 if test X"$trnl" = X; then
1606         case "`echo foo|tr '\n' x 2>/dev/null`" in
1607         foox) trnl='\n' ;;
1608         esac
1609 fi
1610 if test X"$trnl" = X; then
1611         case "`echo foo|tr '\012' x 2>/dev/null`" in
1612         foox) trnl='\012' ;;
1613         esac
1614 fi
1615 if test X"$trnl" = X; then
1616         cat <<EOM >&2
1617
1618 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1619
1620 EOM
1621         exit 1
1622 fi
1623
1624 : compute the number of columns on the terminal for proper question formatting
1625 case "$COLUMNS" in
1626 '') COLUMNS='80';;
1627 esac
1628
1629 : set up the echo used in my read
1630 myecho="case \"\$xxxm\" in
1631 '') echo $n \"\$rp $c\" >&4;;
1632 *) case \"\$rp\" in
1633         '') echo $n \"[\$xxxm] $c\";;
1634         *)
1635                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1636                         echo \"\$rp\" >&4
1637                         echo $n \"[\$xxxm] $c\" >&4
1638                 else
1639                         echo $n \"\$rp [\$xxxm] $c\" >&4
1640                 fi
1641                 ;;
1642         esac;;
1643 esac"
1644
1645 : now set up to do reads with possible shell escape and default assignment
1646 cat <<EOSC >myread
1647 $startsh
1648 xxxm=\$dflt
1649 $myecho
1650 ans='!'
1651 case "\$fastread" in
1652 yes) case "\$dflt" in
1653         '') ;;
1654         *) ans='';
1655                 case "\$silent-\$rp" in
1656                 true-) ;;
1657                 *) echo " " >&4;;
1658                 esac;;
1659         esac;;
1660 *) case "\$silent" in
1661         true) case "\$rp" in
1662                 '') ans='';;
1663                 esac;;
1664         esac;;
1665 esac
1666 while expr "X\$ans" : "X!" >/dev/null; do
1667         read answ
1668         set x \$xxxm
1669         shift
1670         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1671         case  "\$answ" in
1672         "!")
1673                 sh 1>&4
1674                 echo " "
1675                 $myecho
1676                 ;;
1677         !*)
1678                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1679                 shift
1680                 sh 1>&4 -c "\$*"
1681                 echo " "
1682                 $myecho
1683                 ;;
1684         "\$ans")
1685                 case "\$ans" in
1686                 \\&*)
1687                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1688                         shift
1689                         case "\$1" in
1690                         -d)
1691                                 fastread=yes
1692                                 echo "(OK, I'll run with -d after this question.)" >&4
1693                                 ;;
1694                         -*)
1695                                 echo "*** Sorry, \$1 not supported yet." >&4
1696                                 ;;
1697                         esac
1698                         $myecho
1699                         ans=!
1700                         ;;
1701                 esac;;
1702         *)
1703                 case "\$aok" in
1704                 y)
1705                         echo "*** Substitution done -- please confirm."
1706                         xxxm="\$ans"
1707                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1708                         xxxm="\$ans"
1709                         ans=!
1710                         ;;
1711                 *)
1712                         echo "*** Error -- try again."
1713                         ans=!
1714                         ;;
1715                 esac
1716                 $myecho
1717                 ;;
1718         esac
1719         case "\$ans\$xxxm\$nostick" in
1720         '')
1721                 ans=!
1722                 $myecho
1723                 ;;
1724         esac
1725 done
1726 case "\$ans" in
1727 '') ans="\$xxxm";;
1728 esac
1729 EOSC
1730
1731 : create .config dir to save info across Configure sessions
1732 test -d ../.config || mkdir ../.config
1733 cat >../.config/README <<EOF
1734 This directory created by Configure to save information that should
1735 persist across sessions for $package.
1736
1737 You may safely delete it if you wish.
1738 EOF
1739
1740 : general instructions
1741 needman=true
1742 firsttime=true
1743 user=`(logname) 2>/dev/null`
1744 case "$user" in
1745 '') user=`whoami 2>&1`;;
1746 esac
1747 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1748         firsttime=false
1749         echo " "
1750         rp='Would you like to see the instructions?'
1751         dflt=n
1752         . ./myread
1753         case "$ans" in
1754         [yY]*) ;;
1755         *) needman=false;;
1756         esac
1757 fi
1758 if $needman; then
1759         cat <<EOH
1760
1761 This installation shell script will examine your system and ask you questions
1762 to determine how the perl5 package should be installed. If you get
1763 stuck on a question, you may use a ! shell escape to start a subshell or
1764 execute a command.  Many of the questions will have default answers in square
1765 brackets; typing carriage return will give you the default.
1766
1767 On some of the questions which ask for file or directory names you are allowed
1768 to use the ~name construct to specify the login directory belonging to "name",
1769 even if you don't have a shell which knows about that.  Questions where this is
1770 allowed will be marked "(~name ok)".
1771
1772 EOH
1773         rp=''
1774         dflt='Type carriage return to continue'
1775         . ./myread
1776         cat <<'EOH'
1777
1778 The prompter used in this script allows you to use shell variables and
1779 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1780 in the default answer, as if the default line was a set of arguments given to a
1781 script shell.  This means you may also use $* to repeat the whole default line,
1782 so you do not have to re-type everything to add something to the default.
1783
1784 Everytime there is a substitution, you will have to confirm.  If there is an
1785 error (e.g. an unmatched backtick), the default answer will remain unchanged
1786 and you will be prompted again.
1787
1788 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1789 the questions and use the computed defaults (or the previous answers if there
1790 was already a config.sh file). Type 'Configure -h' for a list of options.
1791 You may also start interactively and then answer '& -d' at any prompt to turn
1792 on the non-interactive behaviour for the remainder of the execution.
1793
1794 EOH
1795         . ./myread
1796         cat <<EOH
1797
1798 Much effort has been expended to ensure that this shell script will run on any
1799 Unix system.  If despite that it blows up on yours, your best bet is to edit
1800 Configure and run it again.  If you can't run Configure for some reason,
1801 you'll have to generate a config.sh file by hand.  Whatever problems you
1802 have, let me (perlbug@perl.com) know how I blew it.
1803
1804 This installation script affects things in two ways:
1805
1806 1) it may do direct variable substitutions on some of the files included
1807    in this kit.
1808 2) it builds a config.h file for inclusion in C programs.  You may edit
1809    any of these files as the need arises after running this script.
1810
1811 If you make a mistake on a question, there is no easy way to back up to it
1812 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1813 files.  Configure will offer to let you do this before it runs the SH files.
1814
1815 EOH
1816         dflt='Type carriage return to continue'
1817         . ./myread
1818         case "$firsttime" in
1819         true) echo $user >>../.config/instruct;;
1820         esac
1821 fi
1822
1823 : find out where common programs are
1824 echo " "
1825 echo "Locating common programs..." >&4
1826 cat <<EOSC >loc
1827 $startsh
1828 case \$# in
1829 0) exit 1;;
1830 esac
1831 thing=\$1
1832 shift
1833 dflt=\$1
1834 shift
1835 for dir in \$*; do
1836         case "\$thing" in
1837         .)
1838         if test -d \$dir/\$thing; then
1839                 echo \$dir
1840                 exit 0
1841         fi
1842         ;;
1843         *)
1844         for thisthing in \$dir/\$thing; do
1845                 : just loop through to pick last item
1846         done
1847         if test -f \$thisthing; then
1848                 echo \$thisthing
1849                 exit 0
1850         elif test -f \$dir/\$thing.exe; then
1851                 if test -n "$DJGPP"; then
1852                         echo \$dir/\$thing.exe
1853                 else
1854                         : on Eunice apparently
1855                         echo \$dir/\$thing
1856                 fi
1857                 exit 0
1858         fi
1859         ;;
1860         esac
1861 done
1862 echo \$dflt
1863 exit 1
1864 EOSC
1865 chmod +x loc
1866 $eunicefix loc
1867 loclist="
1868 awk
1869 cat
1870 comm
1871 cp
1872 echo
1873 expr
1874 grep
1875 ls
1876 make
1877 mkdir
1878 rm
1879 sed
1880 sort
1881 touch
1882 tr
1883 uniq
1884 "
1885 trylist="
1886 Mcc
1887 ar
1888 byacc
1889 cpp
1890 csh
1891 date
1892 egrep
1893 gzip
1894 less
1895 ln
1896 more
1897 nm
1898 nroff
1899 pg
1900 test
1901 uname
1902 zip
1903 "
1904 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1905 pth="$pth /lib /usr/lib"
1906 for file in $loclist; do
1907         eval xxx=\$$file
1908         case "$xxx" in
1909         /*|?:[\\/]*)
1910                 if test -f "$xxx"; then
1911                         : ok
1912                 else
1913                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1914                         xxx=`./loc $file $file $pth`
1915                 fi
1916                 ;;
1917         '') xxx=`./loc $file $file $pth`;;
1918         *) xxx=`./loc $xxx $xxx $pth`;;
1919         esac
1920         eval $file=$xxx
1921         eval _$file=$xxx
1922         case "$xxx" in
1923         /*)
1924                 echo $file is in $xxx.
1925                 ;;
1926         ?:[\\/]*)
1927                 echo $file is in $xxx.
1928                 ;;
1929         *)
1930                 echo "I don't know where '$file' is, and my life depends on it." >&4
1931                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1932                 exit 1
1933                 ;;
1934         esac
1935 done
1936 echo " "
1937 echo "Don't worry if any of the following aren't found..."
1938 say=offhand
1939 for file in $trylist; do
1940         eval xxx=\$$file
1941         case "$xxx" in
1942         /*|?:[\\/]*)
1943                 if test -f "$xxx"; then
1944                         : ok
1945                 else
1946                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1947                         xxx=`./loc $file $file $pth`
1948                 fi
1949                 ;;
1950         '') xxx=`./loc $file $file $pth`;;
1951         *) xxx=`./loc $xxx $xxx $pth`;;
1952         esac
1953         eval $file=$xxx
1954         eval _$file=$xxx
1955         case "$xxx" in
1956         /*)
1957                 echo $file is in $xxx.
1958                 ;;
1959         ?:[\\/]*)
1960                 echo $file is in $xxx.
1961                 ;;
1962         *)
1963                 echo "I don't see $file out there, $say."
1964                 say=either
1965                 ;;
1966         esac
1967 done
1968 case "$egrep" in
1969 egrep)
1970         echo "Substituting grep for egrep."
1971         egrep=$grep
1972         ;;
1973 esac
1974 case "$ln" in
1975 ln)
1976         echo "Substituting cp for ln."
1977         ln=$cp
1978         ;;
1979 esac
1980 case "$test" in
1981 test)
1982         echo "Hopefully test is built into your sh."
1983         ;;
1984 *)
1985         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1986                 echo "Using the test built into your sh."
1987                 test=test
1988                 _test=test
1989         fi
1990         ;;
1991 esac
1992 case "$echo" in
1993 echo)
1994         echo "Hopefully echo is built into your sh."
1995         ;;
1996 '') ;;
1997 *)
1998         echo " "
1999 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2000         $echo $n "hi there$c" >foo1
2001         echo $n "hi there$c" >foo2
2002         if cmp foo1 foo2 >/dev/null 2>&1; then
2003                 echo "They are compatible.  In fact, they may be identical."
2004         else
2005                 case "$n" in
2006                 '-n') n='' c='\c';;
2007                 *) n='-n' c='';;
2008                 esac
2009                 cat <<FOO
2010 They are not compatible!  You are probably running ksh on a non-USG system.
2011 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2012 have echo built in and we may have to run some Bourne shell scripts.  That
2013 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2014
2015 FOO
2016                 $echo $n "The star should be here-->$c"
2017                 $echo "*"
2018         fi
2019         $rm -f foo1 foo2
2020         ;;
2021 esac
2022
2023 : determine whether symbolic links are supported
2024 echo " "
2025 $touch blurfl
2026 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2027         echo "Symbolic links are supported." >&4
2028         lns="$ln -s"
2029 else
2030         echo "Symbolic links are NOT supported." >&4
2031         lns="$ln"
2032 fi
2033 $rm -f blurfl sym
2034
2035 : see whether [:lower:] and [:upper:] are supported character classes
2036 echo " "
2037 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2038 ABYZ)
2039         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2040         up='[:upper:]'
2041         low='[:lower:]'
2042         ;;
2043 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2044         # (0xc9 and 0xd1), therefore that is a nice testing point.
2045         if test "X$up" = X -o "X$low" = X; then
2046             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2047             ij) up='[A-Z]'
2048                 low='[a-z]'
2049                 ;;
2050             esac
2051         fi
2052         if test "X$up" = X -o "X$low" = X; then
2053             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2054             ij) up='A-Z'
2055                 low='a-z'
2056                 ;;
2057             esac
2058         fi
2059         if test "X$up" = X -o "X$low" = X; then
2060             case "`echo IJ | od -x 2>/dev/null`" in
2061             *C9D1*|*c9d1*)
2062                 echo "Hey, this might be EBCDIC." >&4
2063                 if test "X$up" = X -o "X$low" = X; then
2064                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2065                     ij) up='[A-IJ-RS-Z]'
2066                         low='[a-ij-rs-z]'
2067                         ;;
2068                     esac
2069                 fi
2070                 if test "X$up" = X -o "X$low" = X; then
2071                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2072                     ij) up='A-IJ-RS-Z'
2073                         low='a-ij-rs-z'
2074                         ;;
2075                     esac
2076                 fi
2077                 ;;
2078             esac
2079         fi
2080 esac
2081 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2082 ij)
2083     echo "Using $up and $low to convert case." >&4
2084     ;;
2085 *)
2086     echo "I don't know how to translate letters from upper to lower case." >&4
2087     echo "Your tr is not acting any way I know of." >&4
2088     exit 1
2089     ;;
2090 esac
2091 : set up the translation script tr, must be called with ./tr of course
2092 cat >tr <<EOSC
2093 $startsh
2094 case "\$1\$2" in
2095 '[A-Z][a-z]') exec $tr '$up' '$low';;
2096 '[a-z][A-Z]') exec $tr '$low' '$up';;
2097 esac
2098 exec $tr "\$@"
2099 EOSC
2100 chmod +x tr
2101 $eunicefix tr
2102
2103 : Try to determine whether config.sh was made on this system
2104 case "$config_sh" in
2105 '')
2106 myuname=`$uname -a 2>/dev/null`
2107 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2108 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2109 # because the A-Z/a-z are not consecutive.
2110 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2111         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2112 newmyuname="$myuname"
2113 dflt=n
2114 case "$knowitall" in
2115 '')
2116         if test -f ../config.sh; then
2117                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2118                         eval "`grep myuname= ../config.sh`"
2119                 fi
2120                 if test "X$myuname" = "X$newmyuname"; then
2121                         dflt=y
2122                 fi
2123         fi
2124         ;;
2125 *) dflt=y;;
2126 esac
2127
2128 : Get old answers from old config file if Configure was run on the
2129 : same system, otherwise use the hints.
2130 hint=default
2131 cd ..
2132 if test -f config.sh; then
2133         echo " "
2134         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2135         . UU/myread
2136         case "$ans" in
2137         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2138         *)  echo "Fetching default answers from your old config.sh file..." >&4
2139                 tmp_n="$n"
2140                 tmp_c="$c"
2141                 tmp_sh="$sh"
2142                 . ./config.sh
2143                 cp config.sh UU
2144                 n="$tmp_n"
2145                 c="$tmp_c"
2146                 : Older versions did not always set $sh.  Catch re-use of such
2147                 : an old config.sh.
2148                 case "$sh" in
2149                 '') sh="$tmp_sh" ;;
2150                 esac
2151                 hint=previous
2152                 ;;
2153         esac
2154 fi
2155 if test ! -f config.sh; then
2156         $cat <<EOM
2157
2158 First time through, eh?  I have some defaults handy for some systems
2159 that need some extra help getting the Configure answers right:
2160
2161 EOM
2162         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2163         dflt=''
2164         : Half the following guesses are probably wrong... If you have better
2165         : tests or hints, please send them to perlbug@perl.com
2166         : The metaconfig authors would also appreciate a copy...
2167         $test -f /irix && osname=irix
2168         $test -f /xenix && osname=sco_xenix
2169         $test -f /dynix && osname=dynix
2170         $test -f /dnix && osname=dnix
2171         $test -f /lynx.os && osname=lynxos
2172         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2173         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2174         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2175         $test -f /bin/mips && /bin/mips && osname=mips
2176         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2177                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2178         $test -d /usr/apollo/bin && osname=apollo
2179         $test -f /etc/saf/_sactab && osname=svr4
2180         $test -d /usr/include/minix && osname=minix
2181         if $test -d /MachTen -o -d /MachTen_Folder; then
2182                 osname=machten
2183                 if $test -x /sbin/version; then
2184                         osvers=`/sbin/version | $awk '{print $2}' |
2185                         $sed -e 's/[A-Za-z]$//'`
2186                 elif $test -x /usr/etc/version; then
2187                         osvers=`/usr/etc/version | $awk '{print $2}' |
2188                         $sed -e 's/[A-Za-z]$//'`
2189                 else
2190                         osvers="$2.$3"
2191                 fi
2192         fi
2193
2194         $test -f /sys/posix.dll &&
2195                 $test -f /usr/bin/what &&
2196                 set X `/usr/bin/what /sys/posix.dll` &&
2197                 $test "$3" = UWIN &&
2198                 osname=uwin &&
2199                 osvers="$5"
2200
2201         if $test -f $uname; then
2202                 set X $myuname
2203                 shift
2204
2205                 case "$5" in
2206                 fps*) osname=fps ;;
2207                 mips*)
2208                         case "$4" in
2209                         umips) osname=umips ;;
2210                         *) osname=mips ;;
2211                         esac;;
2212                 [23]100) osname=mips ;;
2213                 next*) osname=next ;;
2214                 i386*)
2215                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2216                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2217                                 osname='sco'
2218                                 osvers=$tmp
2219                         elif $test -f /etc/kconfig; then
2220                                 osname=isc
2221                                 if test "$lns" = "$ln -s"; then
2222                                         osvers=4
2223                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2224                                         osvers=3
2225                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2226                                         osvers=2
2227                                 fi
2228                         fi
2229                         tmp=''
2230                         ;;
2231                 pc*)
2232                         if test -n "$DJGPP"; then
2233                                 osname=dos
2234                                 osvers=djgpp
2235                         fi
2236                         ;;
2237                 esac
2238
2239                 case "$1" in
2240                 aix) osname=aix
2241                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2242                         case "$tmp" in
2243                         'not found') osvers="$4"."$3" ;;
2244                         '<3240'|'<>3240') osvers=3.2.0 ;;
2245                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2246                         '=3250'|'>3250') osvers=3.2.5 ;;
2247                         *) osvers=$tmp;;
2248                         esac
2249                         ;;
2250                 bsd386) osname=bsd386
2251                         osvers=`$uname -r`
2252                         ;;
2253                 cygwin*) osname=cygwin
2254                         osvers="$3"
2255                         ;;
2256                 *dc.osx) osname=dcosx
2257                         osvers="$3"
2258                         ;;
2259                 dnix) osname=dnix
2260                         osvers="$3"
2261                         ;;
2262                 domainos) osname=apollo
2263                         osvers="$3"
2264                         ;;
2265                 dgux) osname=dgux 
2266                         osvers="$3"
2267                         ;;
2268                 dynixptx*) osname=dynixptx
2269                         osvers=`echo "$4"|sed 's/^v//'`
2270                         ;;
2271                 freebsd) osname=freebsd 
2272                         osvers="$3" ;;
2273                 genix) osname=genix ;;
2274                 hp*) osname=hpux 
2275                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2276                         ;;
2277                 irix*) osname=irix
2278                         case "$3" in
2279                         4*) osvers=4 ;;
2280                         5*) osvers=5 ;;
2281                         *)      osvers="$3" ;;
2282                         esac
2283                         ;;
2284                 linux) osname=linux
2285                         case "$3" in
2286                         *)      osvers="$3" ;;
2287                         esac
2288                         ;;
2289                 MiNT) osname=mint
2290                         ;;
2291                 netbsd*) osname=netbsd
2292                         osvers="$3"
2293                         ;;
2294                 news-os) osvers="$3"
2295                         case "$3" in
2296                         4*) osname=newsos4 ;;
2297                         *) osname=newsos ;;
2298                         esac
2299                         ;;
2300                 next*) osname=next ;;
2301                 POSIX-BC | posix-bc ) osname=posix-bc
2302                         osvers="$3"
2303                         ;;
2304                 powerux | power_ux | powermax_os | powermaxos | \
2305                 powerunix | power_unix) osname=powerux
2306                         osvers="$3"
2307                         ;;
2308                 qnx) osname=qnx
2309                         osvers="$4"
2310                         ;;
2311                 solaris) osname=solaris
2312                         case "$3" in
2313                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2314                         *)      osvers="$3" ;;
2315                         esac
2316                         ;;
2317                 sunos) osname=sunos
2318                         case "$3" in
2319                         5*) osname=solaris
2320                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2321                         *)      osvers="$3" ;;
2322                         esac
2323                         ;;
2324                 titanos) osname=titanos
2325                         case "$3" in
2326                         1*) osvers=1 ;;
2327                         2*) osvers=2 ;;
2328                         3*) osvers=3 ;;
2329                         4*) osvers=4 ;;
2330                         *)      osvers="$3" ;;
2331                         esac
2332                         ;;
2333                 ultrix) osname=ultrix
2334                         osvers="$3"
2335                         ;;
2336                 osf1|mls+)      case "$5" in
2337                                 alpha)
2338                                         osname=dec_osf
2339                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2340                                         ;;
2341                         hp*)    osname=hp_osf1  ;;
2342                         mips)   osname=mips_osf1 ;;
2343                         esac
2344                         ;;
2345                 unixware) osname=svr5
2346                         osvers="$4"
2347                         ;;
2348                 uts) osname=uts
2349                         osvers="$3"
2350                         ;;
2351                 $2) case "$osname" in
2352                         *isc*) ;;
2353                         *freebsd*) ;;
2354                         svr*)
2355                                 : svr4.x or possibly later
2356                                 case "svr$3" in 
2357                                 ${osname}*)
2358                                         osname=svr$3
2359                                         osvers=$4
2360                                         ;;
2361                                 esac
2362                                 case "$osname" in
2363                                 svr4.0)
2364                                         : Check for ESIX
2365                                         if test -f /stand/boot ; then
2366                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2367                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2368                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2369                                                         if test -n "$isesix"; then
2370                                                                 osname=esix4
2371                                                         fi
2372                                                 fi
2373                                         fi
2374                                         ;;
2375                                 esac
2376                                 ;;
2377                         *)      if test -f /etc/systemid; then
2378                                         osname=sco
2379                                         set `echo $3 | $sed 's/\./ /g'` $4
2380                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2381                                                 osvers=$1.$2.$3
2382                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2383                                                 osvers=$1.$2
2384                                         elif $test -f $src/hints/sco_$1.sh; then
2385                                                 osvers=$1
2386                                         fi
2387                                 else
2388                                         case "$osname" in
2389                                         '') : Still unknown.  Probably a generic Sys V.
2390                                                 osname="sysv"
2391                                                 osvers="$3"
2392                                                 ;;
2393                                         esac
2394                                 fi
2395                                 ;;
2396                         esac
2397                         ;;
2398                 *)      case "$osname" in
2399                         '') : Still unknown.  Probably a generic BSD.
2400                                 osname="$1"
2401                                 osvers="$3"
2402                                 ;;
2403                         esac
2404                         ;;
2405                 esac
2406         else
2407                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2408                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2409                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2410                                 osname=news_os
2411                         fi
2412                         $rm -f UU/kernel.what
2413                 elif test -d c:/.; then
2414                         set X $myuname
2415                         osname=os2
2416                         osvers="$5"
2417                 fi
2418         fi
2419         
2420         : Now look for a hint file osname_osvers, unless one has been
2421         : specified already.
2422         case "$hintfile" in
2423         ''|' ')
2424                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2425                 : Also try without trailing minor version numbers.
2426                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2427                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2428                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2429                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2430                 case "$file" in
2431                 '') dflt=none ;;
2432                 *)  case "$osvers" in
2433                         '') dflt=$file
2434                                 ;;
2435                         *)  if $test -f $src/hints/$file.sh ; then
2436                                         dflt=$file
2437                                 elif $test -f $src/hints/$xfile.sh ; then
2438                                         dflt=$xfile
2439                                 elif $test -f $src/hints/$xxfile.sh ; then
2440                                         dflt=$xxfile
2441                                 elif $test -f $src/hints/$xxxfile.sh ; then
2442                                         dflt=$xxxfile
2443                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2444                                         dflt=$xxxxfile
2445                                 elif $test -f "$src/hints/${osname}.sh" ; then
2446                                         dflt="${osname}"
2447                                 else
2448                                         dflt=none
2449                                 fi
2450                                 ;;
2451                         esac
2452                         ;;
2453                 esac
2454                 if $test -f Policy.sh ; then
2455                         case "$dflt" in
2456                         *Policy*) ;;
2457                         none) dflt="Policy" ;;
2458                         *) dflt="Policy $dflt" ;;
2459                         esac
2460                 fi
2461                 ;;
2462         *)
2463                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2464                 ;;
2465         esac
2466
2467         if $test -f Policy.sh ; then
2468                 $cat <<EOM
2469
2470 There's also a Policy hint file available, which should make the
2471 site-specific (policy) questions easier to answer.
2472 EOM
2473
2474         fi
2475
2476         $cat <<EOM
2477
2478 You may give one or more space-separated answers, or "none" if appropriate.
2479 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2480 is a good thing.  DO NOT give a wrong version or a wrong OS.
2481
2482 EOM
2483
2484         rp="Which of these apply, if any?"
2485         . UU/myread
2486         tans=$ans
2487         for file in $tans; do
2488                 if $test X$file = XPolicy -a -f Policy.sh; then
2489                         . Policy.sh
2490                         $cat Policy.sh >> UU/config.sh
2491                 elif $test -f $src/hints/$file.sh; then
2492                         . $src/hints/$file.sh
2493                         $cat $src/hints/$file.sh >> UU/config.sh
2494                 elif $test X$tans = X -o X$tans = Xnone ; then
2495                         : nothing
2496                 else
2497                         : Give one chance to correct a possible typo.
2498                         echo "$file.sh does not exist"
2499                         dflt=$file
2500                         rp="hint to use instead?"
2501                         . UU/myread
2502                         for file in $ans; do
2503                                 if $test -f "$src/hints/$file.sh"; then
2504                                         . $src/hints/$file.sh
2505                                         $cat $src/hints/$file.sh >> UU/config.sh
2506                                 elif $test X$ans = X -o X$ans = Xnone ; then
2507                                         : nothing
2508                                 else
2509                                         echo "$file.sh does not exist -- ignored."
2510                                 fi
2511                         done
2512                 fi
2513         done
2514
2515         hint=recommended
2516         : Remember our hint file for later.
2517         if $test -f "$src/hints/$file.sh" ; then
2518                 hintfile="$file"
2519         else
2520                 hintfile=''
2521         fi
2522 fi
2523 cd UU
2524 ;;
2525 *)
2526         echo " "
2527         echo "Fetching default answers from $config_sh..." >&4
2528         tmp_n="$n"
2529         tmp_c="$c"
2530         cd ..
2531         cp $config_sh config.sh 2>/dev/null
2532         chmod +w config.sh
2533         . ./config.sh
2534         cd UU
2535         cp ../config.sh .
2536         n="$tmp_n"
2537         c="$tmp_c"
2538         hint=previous
2539         ;;
2540 esac
2541 test "$override" && . ./optdef.sh
2542 myuname="$newmyuname"
2543
2544 : Restore computed paths
2545 for file in $loclist $trylist; do
2546         eval $file="\$_$file"
2547 done
2548
2549 cat << EOM
2550
2551 Configure uses the operating system name and version to set some defaults.
2552 The default value is probably right if the name rings a bell. Otherwise,
2553 since spelling matters for me, either accept the default or answer "none"
2554 to leave it blank.
2555
2556 EOM
2557 case "$osname" in
2558         ''|' ')
2559                 case "$hintfile" in
2560                 ''|' '|none) dflt=none ;;
2561                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2562                 esac
2563                 ;;
2564         *) dflt="$osname" ;;
2565 esac
2566 rp="Operating system name?"
2567 . ./myread
2568 case "$ans" in
2569 none)  osname='' ;;
2570 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2571 esac
2572 echo " "
2573 case "$osvers" in
2574         ''|' ')
2575                 case "$hintfile" in
2576                 ''|' '|none) dflt=none ;;
2577                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2578                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2579                         case "$dflt" in
2580                         ''|' ') dflt=none ;;
2581                         esac
2582                         ;;
2583                 esac
2584                 ;;
2585         *) dflt="$osvers" ;;
2586 esac
2587 rp="Operating system version?"
2588 . ./myread
2589 case "$ans" in
2590 none)  osvers='' ;;
2591 *) osvers="$ans" ;;
2592 esac
2593
2594
2595 . ./posthint.sh
2596
2597 : who configured the system
2598 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2599 cf_by=`(logname) 2>/dev/null`
2600 case "$cf_by" in
2601 "")
2602         cf_by=`(whoami) 2>/dev/null`
2603         case "$cf_by" in
2604         "") cf_by=unknown ;;
2605         esac ;;
2606 esac
2607
2608 : set up the script used to warn in case of inconsistency
2609 cat <<EOS >whoa
2610 $startsh
2611 EOS
2612 cat <<'EOSC' >>whoa
2613 dflt=y
2614 echo " "
2615 echo "*** WHOA THERE!!! ***" >&4
2616 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2617 rp="    Keep the $hint value?"
2618 . ./myread
2619 case "$ans" in
2620 y) td=$was; tu=$was;;
2621 esac
2622 EOSC
2623
2624 : function used to set $1 to $val
2625 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2626 case "$val$was" in
2627 $define$undef) . ./whoa; eval "$var=\$td";;
2628 $undef$define) . ./whoa; eval "$var=\$tu";;
2629 *) eval "$var=$val";;
2630 esac'
2631
2632 case "$usethreads" in
2633 $define|true|[yY]*)     dflt='y';;
2634 *) dflt='n';;
2635 esac
2636 cat <<EOM
2637
2638 Perl can be built to take advantage of threads on some systems.
2639 To do so, Configure can be run with -Dusethreads.
2640
2641 Note that threading is a highly experimental feature, and
2642 some known race conditions still remain.  If you choose to try
2643 it, be very sure to not actually deploy it for production
2644 purposes.  README.threads has more details, and is required
2645 reading if you enable threads.
2646
2647 If this doesn't make any sense to you, just accept the default '$dflt'.
2648 EOM
2649 rp='Build a threading Perl?'
2650 . ./myread
2651 case "$ans" in
2652 y|Y)    val="$define" ;;
2653 *)      val="$undef" ;;
2654 esac
2655 set usethreads
2656 eval $setvar
2657
2658 case "$usethreads" in
2659 $define)
2660         $cat <<EOM
2661
2662 As of 5.5.640, Perl has two different internal threading implementations,
2663 the 5.005 version (5005threads) and an interpreter-based version
2664 (ithreads) that has one interpreter per thread.  Both are very 
2665 experimental.  This arrangement exists to help developers work out
2666 which one is better.
2667
2668 If you're a casual user, you probably don't want interpreter-threads
2669 at this time.  There doesn't yet exist a way to create threads from
2670 within Perl in this model, i.e., "use Thread;" will NOT work.
2671 EOM
2672         : Default to ithreads unless overridden on command line or with
2673         : old config.sh
2674         dflt='y'
2675         case "$use5005threads" in
2676                 $define|true|[yY]*) dflt='n';;
2677         esac
2678         case "$useithreads" in
2679                 $undef|false|[nN]*) dflt='n';;
2680         esac
2681         rp='Use interpreter-based ithreads?'
2682         . ./myread
2683         case "$ans" in
2684         y|Y)    val="$define" ;;
2685         *)      val="$undef" ;;
2686         esac
2687         set useithreads
2688         eval $setvar
2689         : Now set use5005threads to the opposite value.
2690         case "$useithreads" in
2691         $define) val="$undef" ;;
2692         *) val="$define" ;;
2693         esac
2694         set use5005threads
2695         eval $setvar
2696         ;;
2697 *)
2698         useithreads="$undef"
2699         use5005threads="$undef"
2700         ;;
2701 esac
2702
2703 case "$d_oldpthreads" in
2704 '')     : Configure tests would be welcome here.  For now, assume undef.
2705         val="$undef" ;;
2706 *)      val="$d_oldpthreads" ;;
2707 esac
2708 set d_oldpthreads
2709 eval $setvar
2710
2711
2712 case "$usethreads" in
2713 "$define"|true|[yY]*)
2714 : Look for a hint-file generated 'call-back-unit'.  If the
2715 : user has specified that a threading perl is to be built,
2716 : we may need to set or change some other defaults.
2717         if $test -f usethreads.cbu; then
2718                 echo "Your platform has some specific hints for threaded builds, using them..."
2719                 . ./usethreads.cbu
2720         else
2721                 $cat <<EOM
2722 (Your platform doesn't have any specific hints for threaded builds.
2723  Assuming POSIX threads, then.)
2724 EOM
2725         fi
2726         ;;
2727 esac
2728
2729 cat <<EOM
2730
2731 Perl can be built so that multiple Perl interpreters can coexist
2732 within the same Perl executable.
2733 EOM
2734
2735 case "$useithreads" in
2736 $define)
2737         cat <<EOM
2738 This multiple interpreter support is required for interpreter-based threads.
2739 EOM
2740         val="$define"
2741         ;;
2742 *)      case "$usemultiplicity" in
2743         $define|true|[yY]*)     dflt='y';;
2744         *) dflt='n';;
2745         esac
2746         echo " "
2747         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2748         rp='Build Perl for multiplicity?'
2749         . ./myread
2750         case "$ans" in
2751         y|Y)    val="$define" ;;
2752         *)      val="$undef" ;;
2753         esac
2754         ;;
2755 esac
2756 set usemultiplicity
2757 eval $setvar
2758
2759 : determine where manual pages are on this system
2760 echo " "
2761 case "$sysman" in
2762 '') 
2763         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2764         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2765         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2766         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2767         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2768         sysman=`./loc . /usr/man/man1 $syspath`
2769         ;;
2770 esac
2771 if $test -d "$sysman"; then
2772         echo "System manual is in $sysman." >&4
2773 else
2774         echo "Could not find manual pages in source form." >&4
2775 fi
2776
2777 : see what memory models we can support
2778 case "$models" in
2779 '')
2780         $cat >pdp11.c <<'EOP'
2781 int main() {
2782 #ifdef pdp11
2783         exit(0);
2784 #else
2785         exit(1);
2786 #endif
2787 }
2788 EOP
2789         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2790         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2791                 dflt='unsplit split'
2792         else
2793                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2794                 case "$tans" in
2795                 X) dflt='none';;
2796                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2797                                 dflt='small'
2798                         else
2799                                 dflt=''
2800                         fi
2801                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2802                                 dflt="$dflt medium"
2803                         fi
2804                         if $test -d /lib/large || $test -d /usr/lib/large; then
2805                                 dflt="$dflt large"
2806                         fi
2807                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2808                                 dflt="$dflt huge"
2809                         fi
2810                 esac
2811         fi;;
2812 *) dflt="$models";;
2813 esac
2814 $cat <<EOM
2815  
2816 Some systems have different model sizes.  On most systems they are called
2817 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2818 split.  If your system doesn't support different memory models, say "none".
2819 If you wish to force everything to one memory model, say "none" here and
2820 put the appropriate flags later when it asks you for other cc and ld flags.
2821 Venix systems may wish to put "none" and let the compiler figure things out.
2822 (In the following question multiple model names should be space separated.)
2823
2824 The default for most systems is "none".
2825
2826 EOM
2827 rp="Which memory models are supported?"
2828 . ./myread
2829 models="$ans"
2830
2831 case "$models" in
2832 none)
2833         small=''
2834         medium=''
2835         large=''
2836         huge=''
2837         unsplit=''
2838         split=''
2839         ;;
2840 *split)
2841         case "$split" in
2842         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2843                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2844                         dflt='-i'
2845                 else
2846                         dflt='none'
2847                 fi;;
2848         *) dflt="$split";;
2849         esac
2850         rp="What flag indicates separate I and D space?"
2851         . ./myread
2852         tans="$ans"
2853         case "$tans" in
2854         none) tans='';;
2855         esac
2856         split="$tans"
2857         unsplit='';;
2858 *large*|*small*|*medium*|*huge*)
2859         case "$models" in
2860         *large*)
2861                 case "$large" in
2862                 '') dflt='-Ml';;
2863                 *) dflt="$large";;
2864                 esac
2865         rp="What flag indicates large model?"
2866         . ./myread
2867         tans="$ans"
2868         case "$tans" in
2869         none) tans='';
2870         esac
2871         large="$tans";;
2872         *) large='';;
2873         esac
2874         case "$models" in
2875         *huge*) case "$huge" in
2876                 '') dflt='-Mh';;
2877                 *) dflt="$huge";;
2878                 esac
2879                 rp="What flag indicates huge model?"
2880                 . ./myread
2881                 tans="$ans"
2882                 case "$tans" in
2883                 none) tans='';
2884                 esac
2885                 huge="$tans";;
2886         *) huge="$large";;
2887         esac
2888         case "$models" in
2889         *medium*) case "$medium" in
2890                 '') dflt='-Mm';;
2891                 *) dflt="$medium";;
2892                 esac
2893                 rp="What flag indicates medium model?"
2894                 . ./myread
2895                 tans="$ans"
2896                 case "$tans" in
2897                 none) tans='';
2898                 esac
2899                 medium="$tans";;
2900         *) medium="$large";;
2901         esac
2902         case "$models" in
2903         *small*) case "$small" in
2904                 '') dflt='none';;
2905                 *) dflt="$small";;
2906                 esac
2907                 rp="What flag indicates small model?"
2908                 . ./myread
2909                 tans="$ans"
2910                 case "$tans" in
2911                 none) tans='';
2912                 esac
2913                 small="$tans";;
2914         *) small='';;
2915         esac
2916         ;;
2917 *)
2918         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2919         ;;
2920 esac
2921 $rm -f pdp11.* pdp11
2922
2923 : make some quick guesses about what we are up against
2924 echo " "
2925 $echo $n "Hmm...  $c"
2926 echo exit 1 >bsd
2927 echo exit 1 >usg
2928 echo exit 1 >v7
2929 echo exit 1 >osf1
2930 echo exit 1 >eunice
2931 echo exit 1 >xenix
2932 echo exit 1 >venix
2933 echo exit 1 >os2
2934 d_bsd="$undef"
2935 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2936 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2937 then
2938         echo "Looks kind of like an OSF/1 system, but we'll see..."
2939         echo exit 0 >osf1
2940 elif test `echo abc | tr a-z A-Z` = Abc ; then
2941         xxx=`./loc addbib blurfl $pth`
2942         if $test -f $xxx; then
2943         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2944                 echo exit 0 >bsd
2945                 echo exit 0 >usg
2946         else
2947                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2948                         echo "Looks kind of like an extended USG system, but we'll see..."
2949                 else
2950                         echo "Looks kind of like a USG system, but we'll see..."
2951                 fi
2952                 echo exit 0 >usg
2953         fi
2954 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2955         echo "Looks kind of like a BSD system, but we'll see..."
2956         d_bsd="$define"
2957         echo exit 0 >bsd
2958 else
2959         echo "Looks kind of like a Version 7 system, but we'll see..."
2960         echo exit 0 >v7
2961 fi
2962 case "$eunicefix" in
2963 *unixtovms*)
2964         $cat <<'EOI'
2965 There is, however, a strange, musty smell in the air that reminds me of
2966 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2967 EOI
2968         echo exit 0 >eunice
2969         d_eunice="$define"
2970 : it so happens the Eunice I know will not run shell scripts in Unix format
2971         ;;
2972 *)
2973         echo " "
2974         echo "Congratulations.  You aren't running Eunice."
2975         d_eunice="$undef"
2976         ;;
2977 esac
2978 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2979 case "$p_" in
2980 :) ;;
2981 *)
2982         $cat <<'EOI'
2983 I have the feeling something is not exactly right, however...don't tell me...
2984 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2985 EOI
2986         echo exit 0 >os2
2987         ;;
2988 esac
2989 if test -f /xenix; then
2990         echo "Actually, this looks more like a XENIX system..."
2991         echo exit 0 >xenix
2992         d_xenix="$define"
2993 else
2994         echo " "
2995         echo "It's not Xenix..."
2996         d_xenix="$undef"
2997 fi
2998 chmod +x xenix
2999 $eunicefix xenix
3000 if test -f /venix; then
3001         echo "Actually, this looks more like a VENIX system..."
3002         echo exit 0 >venix
3003 else
3004         echo " "
3005         if ./xenix; then
3006                 : null
3007         else
3008                 echo "Nor is it Venix..."
3009         fi
3010 fi
3011 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3012 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3013 $rm -f foo
3014
3015 : see if we need a special compiler
3016 echo " "
3017 if ./usg; then
3018         case "$cc" in
3019         '') case "$Mcc" in
3020                 /*) dflt='Mcc';;
3021                 *) case "$large" in
3022                         -M*) dflt='cc';;
3023                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3024                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3025                                                 dflt='cc'
3026                                         else
3027                                                 dflt='cc -M'
3028                                         fi
3029                                 else
3030                                         dflt='cc'
3031                                 fi;;
3032                         esac;;
3033                 esac;;
3034         *)  dflt="$cc";;
3035         esac
3036         case "$dflt" in
3037         *M*)    $cat <<'EOM'
3038 On some older systems the default C compiler will not resolve multiple global
3039 references that happen to have the same name.  On some such systems the "Mcc"
3040 command may be used to force these to be resolved.  On other systems a "cc -M"
3041 command is required.  (Note that the -M flag on other systems indicates a
3042 memory model to use!) If you have the Gnu C compiler, you might wish to use
3043 that instead.
3044
3045 EOM
3046         ;;
3047         esac
3048         rp="Use which C compiler?"
3049         . ./myread
3050         cc="$ans"
3051 else
3052         case "$cc" in
3053         '') dflt=cc;;
3054         *) dflt="$cc";;
3055         esac
3056         rp="Use which C compiler?"
3057         . ./myread
3058         cc="$ans"
3059 fi
3060 : Look for a hint-file generated 'call-back-unit'.  Now that the
3061 : user has specified the compiler, we may need to set or change some
3062 : other defaults.
3063 if $test -f cc.cbu; then
3064     . ./cc.cbu
3065 fi
3066 echo " "
3067 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3068 $cat >gccvers.c <<EOM
3069 #include <stdio.h>
3070 int main() {
3071 #ifdef __GNUC__
3072 #ifdef __VERSION__
3073         printf("%s\n", __VERSION__);
3074 #else
3075         printf("%s\n", "1");
3076 #endif
3077 #endif
3078         exit(0);
3079 }
3080 EOM
3081 if $cc $ldflags -o gccvers gccvers.c; then
3082         gccversion=`./gccvers`
3083         case "$gccversion" in
3084         '') echo "You are not using GNU cc." ;;
3085         *)  echo "You are using GNU cc $gccversion."
3086             ;;
3087         esac
3088 else
3089         echo " "
3090         echo "*** WHOA THERE!!! ***" >&4
3091         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3092         case "$knowitall" in
3093         '')
3094         echo "    You'd better start hunting for one and let me know about it." >&4
3095                 exit 1
3096                 ;;
3097         esac
3098 fi
3099 $rm -f gccvers*
3100 case "$gccversion" in
3101 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3102 esac
3103
3104 : decide how portable to be.  Allow command line overrides.
3105 case "$d_portable" in
3106 "$undef") ;;
3107 *)      d_portable="$define" ;;
3108 esac
3109
3110 : set up shell script to do ~ expansion
3111 cat >filexp <<EOSS
3112 $startsh
3113 : expand filename
3114 case "\$1" in
3115  ~/*|~)
3116         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3117         ;;
3118  ~*)
3119         if $test -f /bin/csh; then
3120                 /bin/csh -f -c "glob \$1"
3121                 failed=\$?
3122                 echo ""
3123                 exit \$failed
3124         else
3125                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3126                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3127                 if $test ! -d "\$dir"; then
3128                         me=\`basename \$0\`
3129                         echo "\$me: can't locate home directory for: \$name" >&2
3130                         exit 1
3131                 fi
3132                 case "\$1" in
3133                 */*)
3134                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3135                         ;;
3136                 *)
3137                         echo \$dir
3138                         ;;
3139                 esac
3140         fi
3141         ;;
3142 *)
3143         echo \$1
3144         ;;
3145 esac
3146 EOSS
3147 chmod +x filexp
3148 $eunicefix filexp
3149
3150 : now set up to get a file name
3151 cat <<EOS >getfile
3152 $startsh
3153 EOS
3154 cat <<'EOSC' >>getfile
3155 tilde=''
3156 fullpath=''
3157 already=''
3158 skip=''
3159 none_ok=''
3160 exp_file=''
3161 nopath_ok=''
3162 orig_rp="$rp"
3163 orig_dflt="$dflt"
3164 case "$gfpth" in
3165 '') gfpth='.' ;;
3166 esac
3167
3168 case "$fn" in
3169 *\(*)
3170         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3171         fn=`echo $fn | sed 's/(.*)//'`
3172         ;;
3173 esac
3174
3175 case "$fn" in
3176 *:*)
3177         loc_file=`expr $fn : '.*:\(.*\)'`
3178         fn=`expr $fn : '\(.*\):.*'`
3179         ;;
3180 esac
3181
3182 case "$fn" in
3183 *~*) tilde=true;;
3184 esac
3185 case "$fn" in
3186 */*) fullpath=true;;
3187 esac
3188 case "$fn" in
3189 *+*) skip=true;;
3190 esac
3191 case "$fn" in
3192 *n*) none_ok=true;;
3193 esac
3194 case "$fn" in
3195 *e*) exp_file=true;;
3196 esac
3197 case "$fn" in
3198 *p*) nopath_ok=true;;
3199 esac
3200
3201 case "$fn" in
3202 *f*) type='File';;
3203 *d*) type='Directory';;
3204 *l*) type='Locate';;
3205 esac
3206
3207 what="$type"
3208 case "$what" in
3209 Locate) what='File';;
3210 esac
3211
3212 case "$exp_file" in
3213 '')
3214         case "$d_portable" in
3215         "$define") ;;
3216         *) exp_file=true;;
3217         esac
3218         ;;
3219 esac
3220
3221 cd ..
3222 while test "$type"; do
3223         redo=''
3224         rp="$orig_rp"
3225         dflt="$orig_dflt"
3226         case "$tilde" in
3227         true) rp="$rp (~name ok)";;
3228         esac
3229         . UU/myread
3230         if test -f UU/getfile.ok && \
3231                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3232         then
3233                 value="$ans"
3234                 ansexp="$ans"
3235                 break
3236         fi
3237         case "$ans" in
3238         none)
3239                 value=''
3240                 ansexp=''
3241                 case "$none_ok" in
3242                 true) type='';;
3243                 esac
3244                 ;;
3245         *)
3246                 case "$tilde" in
3247                 '') value="$ans"
3248                         ansexp="$ans";;
3249                 *)
3250                         value=`UU/filexp $ans`
3251                         case $? in
3252                         0)
3253                                 if test "$ans" != "$value"; then
3254                                         echo "(That expands to $value on this system.)"
3255                                 fi
3256                                 ;;
3257                         *) value="$ans";;
3258                         esac
3259                         ansexp="$value"
3260                         case "$exp_file" in
3261                         '') value="$ans";;
3262                         esac
3263                         ;;
3264                 esac
3265                 case "$fullpath" in
3266                 true)
3267                         case "$ansexp" in
3268                         /*) value="$ansexp" ;;
3269                         *)
3270                                 redo=true
3271                                 case "$already" in
3272                                 true)
3273                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3274                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3275                                         ;;
3276                                 *)
3277                                 echo "Please give a full path name, starting with slash." >&4
3278                                         case "$tilde" in
3279                                         true)
3280                                 echo "Note that using ~name is ok provided it expands well." >&4
3281                                                 already=true
3282                                                 ;;
3283                                         esac
3284                                 esac
3285                                 ;;
3286                         esac
3287                         ;;
3288                 esac
3289                 case "$redo" in
3290                 '')
3291                         case "$type" in
3292                         File)
3293                                 for fp in $gfpth; do
3294                                         if test "X$fp" = X.; then
3295                                             pf="$ansexp"
3296                                         else    
3297                                             pf="$fp/$ansexp"
3298                                         fi
3299                                         if test -f "$pf"; then
3300                                                 type=''
3301                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3302                                         then
3303                                                 echo "($value is not a plain file, but that's ok.)"
3304                                                 type=''
3305                                         fi
3306                                         if test X"$type" = X; then
3307                                             value="$pf"
3308                                             break
3309                                         fi
3310                                 done
3311                                 ;;
3312                         Directory)
3313                                 for fp in $gfpth; do
3314                                         if test "X$fp" = X.; then
3315                                             dir="$ans"
3316                                             direxp="$ansexp"
3317                                         else    
3318                                             dir="$fp/$ans"
3319                                             direxp="$fp/$ansexp"
3320                                         fi
3321                                         if test -d "$direxp"; then
3322                                                 type=''
3323                                                 value="$dir"
3324                                                 break
3325                                         fi
3326                                 done
3327                                 ;;
3328                         Locate)
3329                                 if test -d "$ansexp"; then
3330                                         echo "(Looking for $loc_file in directory $value.)"
3331                                         value="$value/$loc_file"
3332                                         ansexp="$ansexp/$loc_file"
3333                                 fi
3334                                 if test -f "$ansexp"; then
3335                                         type=''
3336                                 fi
3337                                 case "$nopath_ok" in
3338                                 true)   case "$value" in
3339                                         */*) ;;
3340                                         *)      echo "Assuming $value will be in people's path."
3341                                                 type=''
3342                                                 ;;
3343                                         esac
3344                                         ;;
3345                                 esac
3346                                 ;;
3347                         esac
3348
3349                         case "$skip" in
3350                         true) type='';
3351                         esac
3352
3353                         case "$type" in
3354                         '') ;;
3355                         *)
3356                                 if test "$fastread" = yes; then
3357                                         dflt=y
3358                                 else
3359                                         dflt=n
3360                                 fi
3361                                 rp="$what $value doesn't exist.  Use that name anyway?"
3362                                 . UU/myread
3363                                 dflt=''
3364                                 case "$ans" in
3365                                 y*) type='';;
3366                                 *) echo " ";;
3367                                 esac
3368                                 ;;
3369                         esac
3370                         ;;
3371                 esac
3372                 ;;
3373         esac
3374 done
3375 cd UU
3376 ans="$value"
3377 rp="$orig_rp"
3378 dflt="$orig_dflt"
3379 rm -f getfile.ok
3380 test "X$gfpthkeep" != Xy && gfpth=""
3381 EOSC
3382
3383 : What should the include directory be ?
3384 echo " "
3385 $echo $n "Hmm...  $c"
3386 dflt='/usr/include'
3387 incpath=''
3388 mips_type=''
3389 if $test -f /bin/mips && /bin/mips; then
3390         echo "Looks like a MIPS system..."
3391         $cat >usr.c <<'EOCP'
3392 #ifdef SYSTYPE_BSD43
3393 /bsd43
3394 #endif
3395 EOCP
3396         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3397                 dflt='/bsd43/usr/include'
3398                 incpath='/bsd43'
3399                 mips_type='BSD 4.3'
3400         else
3401                 mips_type='System V'
3402         fi
3403         $rm -f usr.c usr.out
3404         echo "and you're compiling with the $mips_type compiler and libraries."
3405         xxx_prompt=y
3406         echo "exit 0" >mips
3407 else
3408         echo "Doesn't look like a MIPS system."
3409         xxx_prompt=n
3410         echo "exit 1" >mips
3411 fi
3412 chmod +x mips
3413 $eunicefix mips
3414 case "$usrinc" in
3415 '') ;;
3416 *) dflt="$usrinc";;
3417 esac
3418 case "$xxx_prompt" in
3419 y)      fn=d/
3420         echo " "
3421         rp='Where are the include files you want to use?'
3422         . ./getfile
3423         usrinc="$ans"
3424         ;;
3425 *)      usrinc="$dflt"
3426         ;;
3427 esac
3428
3429 : see how we invoke the C preprocessor
3430 echo " "
3431 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3432 cat <<'EOT' >testcpp.c
3433 #define ABC abc
3434 #define XYZ xyz
3435 ABC.XYZ
3436 EOT
3437 cd ..
3438 if test ! -f cppstdin; then
3439         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3440                 # AIX cc -E doesn't show the absolute headerfile
3441                 # locations but we'll cheat by using the -M flag.
3442                 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
3443         else
3444                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3445         fi
3446 else
3447         echo "Keeping your $hint cppstdin wrapper."
3448 fi
3449 chmod 755 cppstdin
3450 wrapper=`pwd`/cppstdin
3451 ok='false'
3452 cd UU
3453
3454 if $test "X$cppstdin" != "X" && \
3455         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3456         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3457 then
3458         echo "You used to use $cppstdin $cppminus so we'll use that again."
3459         case "$cpprun" in
3460         '') echo "But let's see if we can live without a wrapper..." ;;
3461         *)
3462                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3463                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3464                 then
3465                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3466                         ok='true'
3467                 else
3468                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3469                 fi
3470                 ;;
3471         esac
3472 else
3473         case "$cppstdin" in
3474         '') ;;
3475         *)
3476                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3477                 ;;
3478         esac
3479 fi
3480
3481 if $ok; then
3482         : nothing
3483 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3484         $cc -E <testcpp.c >testcpp.out 2>&1; \
3485         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3486         echo "Yup, it does."
3487         x_cpp="$cc -E"
3488         x_minus='';
3489 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3490         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3491         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3492         echo "Yup, it does."
3493         x_cpp="$cc -E"
3494         x_minus='-';
3495 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3496         $cc -P <testcpp.c >testcpp.out 2>&1; \
3497         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3498         echo "Yipee, that works!"
3499         x_cpp="$cc -P"
3500         x_minus='';
3501 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3502         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3503         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3504         echo "At long last!"
3505         x_cpp="$cc -P"
3506         x_minus='-';
3507 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3508         $cpp <testcpp.c >testcpp.out 2>&1; \
3509         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3510         echo "It works!"
3511         x_cpp="$cpp"
3512         x_minus='';
3513 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3514         $cpp - <testcpp.c >testcpp.out 2>&1; \
3515         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3516         echo "Hooray, it works!  I was beginning to wonder."
3517         x_cpp="$cpp"
3518         x_minus='-';
3519 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3520         $wrapper <testcpp.c >testcpp.out 2>&1; \
3521         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3522         x_cpp="$wrapper"
3523         x_minus=''
3524         echo "Eureka!"
3525 else
3526         dflt=''
3527         rp="No dice.  I can't find a C preprocessor.  Name one:"
3528         . ./myread
3529         x_cpp="$ans"
3530         x_minus=''
3531         $x_cpp <testcpp.c >testcpp.out 2>&1
3532         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3533                 echo "OK, that will do." >&4
3534         else
3535 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3536                 exit 1
3537         fi
3538 fi
3539
3540 case "$ok" in
3541 false)
3542         cppstdin="$x_cpp"
3543         cppminus="$x_minus"
3544         cpprun="$x_cpp"
3545         cpplast="$x_minus"
3546         set X $x_cpp
3547         shift
3548         case "$1" in
3549         "$cpp")
3550                 echo "Perhaps can we force $cc -E using a wrapper..."
3551                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3552                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3553                 then
3554                         echo "Yup, we can."
3555                         cppstdin="$wrapper"
3556                         cppminus='';
3557                 else
3558                         echo "Nope, we'll have to live without it..."
3559                 fi
3560                 ;;
3561         esac
3562         case "$cpprun" in
3563         "$wrapper")
3564                 cpprun=''
3565                 cpplast=''
3566                 ;;
3567         esac
3568         ;;
3569 esac
3570
3571 case "$cppstdin" in
3572 "$wrapper"|'cppstdin') ;;
3573 *) $rm -f $wrapper;;
3574 esac
3575 $rm -f testcpp.c testcpp.out
3576
3577 : Set private lib path
3578 case "$plibpth" in
3579 '') if ./mips; then
3580                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3581         fi;;
3582 esac
3583 case "$libpth" in
3584 ' ') dlist='';;
3585 '') dlist="$loclibpth $plibpth $glibpth";;
3586 *) dlist="$libpth";;
3587 esac
3588
3589 : Now check and see which directories actually exist, avoiding duplicates
3590 libpth=''
3591 for xxx in $dlist
3592 do
3593     if $test -d $xxx; then
3594                 case " $libpth " in
3595                 *" $xxx "*) ;;
3596                 *) libpth="$libpth $xxx";;
3597                 esac
3598     fi
3599 done
3600 $cat <<'EOM'
3601
3602 Some systems have incompatible or broken versions of libraries.  Among
3603 the directories listed in the question below, please remove any you
3604 know not to be holding relevant libraries, and add any that are needed.
3605 Say "none" for none.
3606
3607 EOM
3608 case "$libpth" in
3609 '') dflt='none';;
3610 *)
3611         set X $libpth
3612         shift
3613         dflt=${1+"$@"}
3614         ;;
3615 esac
3616 rp="Directories to use for library searches?"
3617 . ./myread
3618 case "$ans" in
3619 none) libpth=' ';;
3620 *) libpth="$ans";;
3621 esac
3622
3623 : compute shared library extension
3624 case "$so" in
3625 '')
3626         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3627                 dflt='sl'
3628         else
3629                 dflt='so'
3630         fi
3631         ;;
3632 *) dflt="$so";;
3633 esac
3634 $cat <<EOM
3635
3636 On some systems, shared libraries may be available.  Answer 'none' if
3637 you want to suppress searching of shared libraries for the remainder
3638 of this configuration.
3639
3640 EOM
3641 rp='What is the file extension used for shared libraries?'
3642 . ./myread
3643 so="$ans"
3644
3645 : Define several unixisms.
3646 : Hints files or command line option can be used to override them.
3647 : The convoluted testing is in case hints files set either the old
3648 : or the new name.
3649 case "$_exe" in
3650 '')     case "$exe_ext" in
3651     '') ;;
3652         *)      _exe="$exe_ext" ;;
3653         esac
3654         ;;
3655 esac
3656 case "$_a" in
3657 '')     case "$lib_ext" in
3658     '') _a='.a';;
3659         *)      _a="$lib_ext" ;;
3660         esac
3661         ;;
3662 esac
3663 case "$_o" in
3664 '') case "$obj_ext" in
3665         '')     _o='.o';;
3666         *)      _o="$obj_ext";;
3667         esac
3668         ;;
3669 esac
3670 case "$p_" in
3671 '') case "$path_sep" in
3672         '')     p_=':';;
3673         *)      p_="$path_sep";;
3674         esac
3675         ;;
3676 esac
3677 exe_ext=$_exe
3678 lib_ext=$_a
3679 obj_ext=$_o
3680 path_sep=$p_
3681
3682 : Which makefile gets called first.  This is used by make depend.
3683 case "$firstmakefile" in
3684 '') firstmakefile='makefile';;
3685 esac
3686
3687 case "$usesocks" in
3688 $define|true|[yY]*)     dflt='y';;
3689 *) dflt='n';;
3690 esac
3691 cat <<EOM
3692
3693 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3694 Configure must be run with -Dusesocks.
3695
3696 If this doesn't make any sense to you, just accept the default '$dflt'.
3697 EOM
3698 rp='Build Perl for SOCKS?'
3699 . ./myread
3700 case "$ans" in
3701 y|Y)    val="$define" ;;     
3702 *)      val="$undef" ;;
3703 esac
3704 set usesocks
3705 eval $setvar
3706
3707 : Looking for optional libraries
3708 echo " "
3709 echo "Checking for optional libraries..." >&4
3710 case "$libs" in
3711 ' '|'') dflt='';;
3712 *) dflt="$libs";;
3713 esac
3714 case "$libswanted" in
3715 '') libswanted='c_s';;
3716 esac
3717 case "$usesocks" in
3718 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3719 esac
3720 libsfound=''
3721 libsfiles=''
3722 libsdirs=''
3723 libspath=''
3724 for thisdir in $libpth $xlibpth; do
3725   test -d $thisdir && libspath="$libspath $thisdir"
3726 done
3727 for thislib in $libswanted; do
3728         for thisdir in $libspath; do
3729             xxx=''
3730             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3731                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3732                 $test -f "$xxx" && eval $libscheck
3733                 $test -f "$xxx" && libstyle=shared
3734             fi
3735             if test ! -f "$xxx"; then
3736                 xxx=$thisdir/lib$thislib.$so
3737                 $test -f "$xxx" && eval $libscheck
3738                 $test -f "$xxx" && libstyle=shared
3739             fi  
3740             if test ! -f "$xxx"; then
3741                 xxx=$thisdir/lib$thislib$_a
3742                 $test -f "$xxx" && eval $libscheck
3743                 $test -f "$xxx" && libstyle=static
3744             fi
3745             if test ! -f "$xxx"; then
3746                 xxx=$thisdir/$thislib$_a
3747                 $test -f "$xxx" && eval $libscheck
3748                 $test -f "$xxx" && libstyle=static
3749             fi
3750             if test ! -f "$xxx"; then
3751                 xxx=$thisdir/lib${thislib}_s$_a
3752                 $test -f "$xxx" && eval $libscheck
3753                 $test -f "$xxx" && libstyle=static
3754                 $test -f "$xxx" && thislib=${thislib}_s
3755             fi
3756             if test ! -f "$xxx"; then
3757                 xxx=$thisdir/Slib$thislib$_a
3758                 $test -f "$xxx" && eval $libscheck
3759                 $test -f "$xxx" && libstyle=static
3760             fi
3761             if $test -f "$xxx"; then
3762                 case "$libstyle" in
3763                 shared) echo "Found -l$thislib (shared)." ;;
3764                 static) echo "Found -l$thislib." ;;
3765                 *)      echo "Found -l$thislib ($libstyle)." ;;
3766                 esac
3767                 case " $dflt " in
3768                 *"-l$thislib "*);;
3769                 *) dflt="$dflt -l$thislib"
3770                    libsfound="$libsfound $xxx"
3771                    yyy=`basename $xxx`
3772                    libsfiles="$libsfiles $yyy"
3773                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3774                    case " $libsdirs " in
3775                    *" $yyy "*) ;;
3776                    *) libsdirs="$libsdirs $yyy" ;;
3777                    esac
3778                    ;;
3779                 esac
3780                 break
3781             fi  
3782         done
3783         if $test ! -f "$xxx"; then
3784             echo "No -l$thislib."
3785         fi
3786 done
3787 set X $dflt
3788 shift
3789 dflt="$*"
3790 case "$libs" in
3791 '') dflt="$dflt";;
3792 *) dflt="$libs";;
3793 esac
3794 case "$dflt" in
3795 ' '|'') dflt='none';;
3796 esac
3797
3798 $cat <<EOM
3799
3800 In order to compile $package on your machine, a number of libraries
3801 are usually needed.  Include any other special libraries here as well.
3802 Say "none" for none.  The default list is almost always right.
3803 EOM
3804
3805 echo " "
3806 rp="What libraries to use?"
3807 . ./myread
3808 case "$ans" in
3809 none) libs=' ';;
3810 *) libs="$ans";;
3811 esac
3812
3813 : determine optimization, if desired, or use for debug flag also
3814 case "$optimize" in
3815 ' '|$undef) dflt='none';;
3816 '') dflt='-O';;
3817 *) dflt="$optimize";;
3818 esac
3819 $cat <<EOH
3820
3821 By default, $package compiles with the -O flag to use the optimizer.
3822 Alternately, you might want to use the symbolic debugger, which uses
3823 the -g flag (on traditional Unix systems).  Either flag can be
3824 specified here.  To use neither flag, specify the word "none".
3825
3826 EOH
3827 rp="What optimizer/debugger flag should be used?"
3828 . ./myread
3829 optimize="$ans"
3830 case "$optimize" in
3831 'none') optimize=" ";;
3832 esac
3833
3834 dflt=''
3835 : We will not override a previous value, but we might want to
3836 : augment a hint file
3837 case "$hint" in
3838 default|recommended)
3839         case "$gccversion" in
3840         1*) dflt='-fpcc-struct-return' ;;
3841         esac
3842         case "$optimize" in
3843         *-g*) dflt="$dflt -DDEBUGGING";;
3844         esac
3845         case "$gccversion" in
3846         2*) if test -d /etc/conf/kconfig.d &&
3847                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3848                 then
3849                         dflt="$dflt -posix"
3850                 fi
3851                 ;;
3852         esac
3853         case "$gccversion" in
3854         1*) ;;
3855         2.[0-8]*) ;;
3856         ?*)     echo " "
3857                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3858                 echo 'int main(void) { return 0; }' > gcctest.c
3859                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3860                         echo "Yes, it does." 2>&1
3861                         case "$ccflags" in
3862                         *strict-aliasing*) 
3863                                 echo "Leaving current flags $ccflags alone." 2>&1
3864                                 ;;
3865                         *) dflt="$dflt -fno-strict-aliasing" ;;
3866                         esac
3867                 else
3868                         echo "Nope, it doesn't, but that's ok." 2>&1
3869                 fi
3870                 ;;
3871         esac
3872         ;;
3873 esac
3874
3875 case "$mips_type" in
3876 *BSD*|'') inclwanted="$locincpth $usrinc";;
3877 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3878 esac
3879 for thisincl in $inclwanted; do
3880         if $test -d $thisincl; then
3881                 if $test x$thisincl != x$usrinc; then
3882                         case "$dflt" in
3883                         *$thisincl*);;
3884                         *) dflt="$dflt -I$thisincl";;
3885                         esac
3886                 fi
3887         fi
3888 done
3889
3890 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3891         xxx=true;
3892 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3893         xxx=true;
3894 else
3895         xxx=false;
3896 fi;
3897 if $xxx; then
3898         case "$dflt" in
3899         *$2*);;
3900         *) dflt="$dflt -D$2";;
3901         esac;
3902 fi'
3903
3904 set signal.h LANGUAGE_C; eval $inctest
3905
3906 case "$usesocks" in
3907 $define)
3908         ccflags="$ccflags -DSOCKS"
3909         ;;
3910 esac
3911
3912 case "$hint" in
3913 default|recommended) dflt="$ccflags $dflt" ;;
3914 *) dflt="$ccflags";;
3915 esac
3916
3917 case "$dflt" in
3918 ''|' ') dflt=none;;
3919 esac
3920 $cat <<EOH
3921
3922 Your C compiler may want other flags.  For this question you should include
3923 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3924 but you should NOT include libraries or ld flags like -lwhatever.  If you
3925 want $package to honor its debug switch, you should include -DDEBUGGING here.
3926 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3927
3928 To use no flags, specify the word "none".
3929
3930 EOH
3931 set X $dflt
3932 shift
3933 dflt=${1+"$@"}
3934 rp="Any additional cc flags?"
3935 . ./myread
3936 case "$ans" in
3937 none) ccflags='';;
3938 *) ccflags="$ans";;
3939 esac
3940
3941 : the following weeds options from ccflags that are of no interest to cpp
3942 cppflags="$ccflags"
3943 case "$gccversion" in
3944 1*) cppflags="$cppflags -D__GNUC__"
3945 esac
3946 case "$mips_type" in
3947 '');;
3948 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3949 esac
3950 case "$cppflags" in
3951 '');;
3952 *)
3953         echo " "
3954         echo "Let me guess what the preprocessor flags are..." >&4
3955         set X $cppflags
3956         shift
3957         cppflags=''
3958         $cat >cpp.c <<'EOM'
3959 #define BLURFL foo
3960
3961 BLURFL xx LFRULB
3962 EOM
3963         previous=''
3964         for flag in $*
3965         do
3966                 case "$flag" in
3967                 -*) ftry="$flag";;
3968                 *) ftry="$previous $flag";;
3969                 esac
3970                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3971                         >cpp1.out 2>/dev/null && \
3972                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3973                         >cpp2.out 2>/dev/null && \
3974                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3975                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3976                 then
3977                         cppflags="$cppflags $ftry"
3978                         previous=''
3979                 else
3980                         previous="$flag"
3981                 fi
3982         done
3983         set X $cppflags
3984         shift
3985         cppflags=${1+"$@"}
3986         case "$cppflags" in
3987         *-*)  echo "They appear to be: $cppflags";;
3988         esac
3989         $rm -f cpp.c cpp?.out
3990         ;;
3991 esac
3992
3993 : flags used in final linking phase
3994 case "$ldflags" in
3995 '') if ./venix; then
3996                 dflt='-i -z'
3997         else
3998                 dflt=''
3999         fi
4000         case "$ccflags" in
4001         *-posix*) dflt="$dflt -posix" ;;
4002         esac
4003         ;;
4004 *) dflt="$ldflags";;
4005 esac
4006
4007 : Try to guess additional flags to pick up local libraries.
4008 for thislibdir in $libpth; do
4009         case " $loclibpth " in
4010         *" $thislibdir "*)
4011                 case "$dflt " in 
4012                 *"-L$thislibdir "*) ;;
4013                 *)  dflt="$dflt -L$thislibdir" ;;
4014                 esac
4015                 ;;
4016         esac
4017 done
4018
4019 case "$dflt" in
4020 '') dflt='none' ;;
4021 esac
4022
4023 $cat <<EOH
4024
4025 Your C linker may need flags.  For this question you should
4026 include -L/whatever and any other flags used by the C linker, but you
4027 should NOT include libraries like -lwhatever.
4028
4029 Make sure you include the appropriate -L/path flags if your C linker
4030 does not normally search all of the directories you specified above,
4031 namely
4032         $libpth
4033 To use no flags, specify the word "none".
4034
4035 EOH
4036
4037 rp="Any additional ld flags (NOT including libraries)?"
4038 . ./myread
4039 case "$ans" in
4040 none) ldflags='';;
4041 *) ldflags="$ans";;
4042 esac
4043 rmlist="$rmlist pdp11"
4044
4045 : coherency check
4046 echo " "
4047 echo "Checking your choice of C compiler and flags for coherency..." >&4
4048 $cat > try.c <<'EOF'
4049 #include <stdio.h>
4050 int main() { printf("Ok\n"); exit(0); }
4051 EOF
4052 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4053 shift
4054 $cat >try.msg <<'EOM'
4055 I've tried to compile and run the following simple program:
4056
4057 EOM
4058 $cat try.c >> try.msg
4059
4060 $cat >> try.msg <<EOM
4061
4062 I used the command:
4063
4064         $*
4065         ./try
4066
4067 and I got the following output:
4068
4069 EOM
4070 dflt=y
4071 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4072         if sh -c './try' >>try.msg 2>&1; then
4073                 xxx=`./try`
4074                 case "$xxx" in
4075                 "Ok") dflt=n ;;
4076                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4077                         case " $libs " in
4078                         *" -lsfio "*)
4079                                 cat >> try.msg <<'EOQS'
4080 If $libs contains -lsfio, and sfio is mis-configured, then it
4081 sometimes (apparently) runs and exits with a 0 status, but with no
4082 output!  It may have to do with sfio's use of _exit vs. exit.
4083
4084 EOQS
4085                                 rp="You have a big problem.  Shall I abort Configure"
4086                                 dflt=y
4087                                 ;;
4088                         esac
4089                         ;;
4090                 esac
4091         else
4092                 echo "The program compiled OK, but exited with status $?." >>try.msg
4093                 rp="You have a problem.  Shall I abort Configure"
4094                 dflt=y
4095         fi
4096 else
4097         echo "I can't compile the test program." >>try.msg
4098         rp="You have a BIG problem.  Shall I abort Configure"
4099         dflt=y
4100 fi
4101 case "$dflt" in
4102 y)
4103         $cat try.msg >&4
4104         case "$knowitall" in
4105         '')
4106                 echo "(The supplied flags or libraries might be incorrect.)"
4107                 ;;
4108         *) dflt=n;;
4109         esac
4110         echo " "
4111         . ./myread
4112         case "$ans" in
4113         n*|N*) ;;
4114         *)      echo "Ok.  Stopping Configure." >&4
4115                 exit 1
4116                 ;;
4117         esac
4118         ;;
4119 n) echo "OK, that should do.";;
4120 esac
4121 $rm -f try try.* core
4122
4123 : define an is-a-typedef? function
4124 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4125 case "$inclist" in
4126 "") inclist="sys/types.h";;
4127 esac;
4128 eval "varval=\$$var";
4129 case "$varval" in
4130 "")
4131         $rm -f temp.c;
4132         for inc in $inclist; do
4133                 echo "#include <$inc>" >>temp.c;
4134         done;
4135         echo "#ifdef $type" >> temp.c;
4136         echo "printf(\"We have $type\");" >> temp.c;
4137         echo "#endif" >> temp.c;
4138         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4139         if $contains $type temp.E >/dev/null 2>&1; then
4140                 eval "$var=\$type";
4141         else
4142                 eval "$var=\$def";
4143         fi;
4144         $rm -f temp.?;;
4145 *) eval "$var=\$varval";;
4146 esac'
4147
4148 : define an is-a-typedef? function that prompts if the type is not available.
4149 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4150 case "$inclist" in
4151 "") inclist="sys/types.h";;
4152 esac;
4153 eval "varval=\$$var";
4154 case "$varval" in
4155 "")
4156         $rm -f temp.c;
4157         for inc in $inclist; do
4158                 echo "#include <$inc>" >>temp.c;
4159         done;
4160         echo "#ifdef $type" >> temp.c;
4161         echo "printf(\"We have $type\");" >> temp.c;
4162         echo "#endif" >> temp.c;
4163         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4164         echo " " ;
4165         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4166         if $contains $type temp.E >/dev/null 2>&1; then
4167                 echo "$type found." >&4;
4168                 eval "$var=\$type";
4169         else
4170                 echo "$type NOT found." >&4;
4171                 dflt="$def";
4172                 . ./myread ;
4173                 eval "$var=\$ans";
4174         fi;
4175         $rm -f temp.?;;
4176 *) eval "$var=\$varval";;
4177 esac'
4178
4179 : define a shorthand compile call
4180 compile='
4181 mc_file=$1;
4182 shift;
4183 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4184 : define a shorthand compile call for compilations that should be ok.
4185 compile_ok='
4186 mc_file=$1;
4187 shift;
4188 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4189
4190 : check for lengths of integral types
4191 echo " "
4192 case "$intsize" in
4193 '')
4194         echo "Checking to see how big your integers are..." >&4
4195         $cat >intsize.c <<'EOCP'
4196 #include <stdio.h>
4197 int main()
4198 {
4199         printf("intsize=%d;\n", (int)sizeof(int));
4200         printf("longsize=%d;\n", (int)sizeof(long));
4201         printf("shortsize=%d;\n", (int)sizeof(short));
4202         exit(0);
4203 }
4204 EOCP
4205         set intsize
4206         if eval $compile_ok && ./intsize > /dev/null; then
4207                 eval `./intsize`
4208                 echo "Your integers are $intsize bytes long."
4209                 echo "Your long integers are $longsize bytes long."
4210                 echo "Your short integers are $shortsize bytes long."
4211         else
4212                 $cat >&4 <<EOM
4213 !
4214 Help! I can't compile and run the intsize test program: please enlighten me!
4215 (This is probably a misconfiguration in your system or libraries, and
4216 you really ought to fix it.  Still, I'll try anyway.)
4217 !
4218 EOM
4219                 dflt=4
4220                 rp="What is the size of an integer (in bytes)?"
4221                 . ./myread
4222                 intsize="$ans"
4223                 dflt=$intsize
4224                 rp="What is the size of a long integer (in bytes)?"
4225                 . ./myread
4226                 longsize="$ans"
4227                 dflt=2
4228                 rp="What is the size of a short integer (in bytes)?"
4229                 . ./myread
4230                 shortsize="$ans"
4231         fi
4232         ;;
4233 esac
4234 $rm -f intsize intsize.*
4235
4236 : see what type lseek is declared as in the kernel
4237 rp="What is the type used for lseek's offset on this system?"
4238 set off_t lseektype long stdio.h sys/types.h
4239 eval $typedef_ask
4240
4241 echo " "
4242 echo "Checking to see how big your file offsets are..." >&4
4243 $cat >try.c <<EOCP
4244 #include <sys/types.h>
4245 #include <stdio.h>
4246 int main()
4247 {
4248     printf("%d\n", (int)sizeof($lseektype));
4249     return(0); 
4250 }
4251 EOCP
4252 set try
4253 if eval $compile_ok; then
4254         lseeksize=`./try`
4255         echo "Your file offsets are $lseeksize bytes long."
4256 else
4257         dflt=$longsize
4258         echo " "
4259         echo "(I can't seem to compile the test program.  Guessing...)"
4260         rp="What is the size of your file offsets (in bytes)?"
4261         . ./myread
4262         lseeksize="$ans"
4263 fi
4264 $rm -f try.c try
4265
4266 : see what type file positions are declared as in the library
4267 rp="What is the type for file position used by fsetpos()?"
4268 set fpos_t fpostype long stdio.h sys/types.h
4269 eval $typedef_ask
4270
4271 echo " "
4272 case "$fpostype" in
4273 *_t) zzz="$fpostype"    ;;
4274 *)   zzz="fpos_t"       ;;
4275 esac
4276 echo "Checking the size of $zzz..." >&4 
4277 cat > try.c <<EOCP
4278 #include <sys/types.h>
4279 #include <stdio.h>
4280 int main() {
4281     printf("%d\n", (int)sizeof($fpostype));
4282     exit(0);
4283 }
4284 EOCP
4285 set try
4286 if eval $compile_ok; then
4287         yyy=`./try`
4288         case "$yyy" in
4289         '')     fpossize=4
4290                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4291                 ;;
4292         *)      fpossize=$yyy
4293                 echo "Your $zzz is $fpossize bytes long."
4294                 ;;
4295         esac
4296 else
4297         dflt="$longsize"
4298         echo " " >&4
4299         echo "(I can't compile the test program.  Guessing...)" >&4
4300         rp="What is the size of your file positions (in bytes)?"
4301         . ./myread
4302         fpossize="$ans"
4303 fi
4304
4305
4306
4307 # Backward compatibility (uselfs is deprecated).
4308 case "$uselfs" in
4309 "$define"|true|[yY]*)
4310         cat <<EOM >&4
4311
4312 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4313 EOM
4314         uselargefiles="$define"
4315         ;;
4316 esac                          
4317
4318 case "$lseeksize:$fpossize" in
4319 8:8) cat <<EOM
4320
4321 You can have files larger than 2 gigabytes.
4322 EOM
4323    val="$define" ;;
4324 *)    case "$uselargefiles" in
4325    "$undef"|false|[nN]*) dflt='n' ;;
4326    *)   dflt='y' ;;
4327    esac
4328    cat <<EOM
4329
4330 Perl can be built to understand large files (files larger than 2 gigabytes)
4331 on some systems.  To do so, Configure can be run with -Duselargefiles.
4332
4333 If this doesn't make any sense to you, just accept the default '$dflt'.
4334 EOM
4335    rp='Try to understand large files, if available?'
4336    . ./myread
4337    case "$ans" in
4338    y|Y)         val="$define" ;;
4339    *)           val="$undef"  ;;
4340    esac
4341    ;;
4342 esac
4343 set uselargefiles
4344 eval $setvar
4345 case "$uselargefiles" in
4346 "$define")
4347 : Look for a hint-file generated 'call-back-unit'.  If the
4348 : user has specified that a large files perl is to be built,
4349 : we may need to set or change some other defaults.
4350         if $test -f uselargefiles.cbu; then
4351                 echo "Your platform has some specific hints for large file builds, using them..."
4352                 . ./uselargefiles.cbu
4353                 echo " "
4354                 echo "Rechecking to see how big your file offsets are..." >&4
4355                 $cat >try.c <<EOCP
4356 #include <sys/types.h>
4357 #include <stdio.h>
4358 int main()
4359 {
4360     printf("%d\n", (int)sizeof($lseektype));
4361     return(0); 
4362 }
4363 EOCP
4364                 set try
4365                 if eval $compile_ok; then
4366                         lseeksize=`./try`
4367                         $echo "Your file offsets are now $lseeksize bytes long."
4368                 else
4369                         dflt="$lseeksize"
4370                         echo " "
4371                         echo "(I can't seem to compile the test program.  Guessing...)"
4372                         rp="What is the size of your file offsets (in bytes)?"
4373                         . ./myread
4374                         lseeksize="$ans"
4375                 fi
4376                 case "$fpostype" in
4377                 *_t) zzz="$fpostype"    ;;
4378                 *)   zzz="fpos_t"       ;;
4379                 esac
4380                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4381                 $cat > try.c <<EOCP
4382 #include <sys/types.h>
4383 #include <stdio.h>
4384 int main() {
4385     printf("%d\n", (int)sizeof($fpostype));
4386     exit(0);
4387 }
4388 EOCP
4389                 set try
4390                 if eval $compile_ok; then
4391                         yyy=`./try`
4392                         dflt="$lseeksize"
4393                         case "$yyy" in
4394                         '')     echo " "
4395                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4396                                 ;;
4397                         *)      fpossize=$yyy
4398                                 echo " $fpossize bytes." >&4
4399                                 ;;
4400                         esac
4401                 else
4402                         dflt="$fpossize"
4403                         echo " "
4404                         echo "(I can't compile the test program.  Guessing...)" >&4
4405                         rp="What is the size of your file positions (in bytes)?"
4406                         . ./myread
4407                         fpossize="$ans"
4408                 fi
4409                 $rm -f try.c try
4410         fi
4411         ;;
4412 esac
4413
4414
4415 case "$usemorebits" in
4416 "$define"|true|[yY]*)
4417         use64bitint="$define"
4418         uselongdouble="$define"
4419         usemorebits="$define"
4420         ;;
4421 *)      usemorebits="$undef"
4422         ;;
4423 esac
4424
4425
4426 case "$uselonglong" in
4427 "$define"|true|[yY]*)
4428         cat <<EOM >&4
4429
4430 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4431 EOM
4432         use64bitint="$define"
4433         ;;
4434 esac                          
4435 case "$use64bits" in
4436 "$define"|true|[yY]*)
4437         cat <<EOM >&4
4438
4439 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4440 EOM
4441         use64bitint="$define"
4442         ;;
4443 esac                          
4444 case "$use64bitints" in
4445 "$define"|true|[yY]*)
4446         cat <<EOM >&4
4447
4448 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4449 EOM
4450         use64bitint="$define"
4451         ;;
4452 esac                          
4453 case "$use64bitsint" in
4454 "$define"|true|[yY]*)
4455         cat <<EOM >&4
4456
4457 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4458 EOM
4459         use64bitint="$define"
4460         ;;
4461 esac                          
4462 case "$uselonglongs" in
4463 "$define"|true|[yY]*)
4464         cat <<EOM >&4
4465
4466 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4467 EOM
4468         use64bitint="$define"
4469         ;;
4470 esac                          
4471 case "$use64bitsall" in
4472 "$define"|true|[yY]*)
4473         cat <<EOM >&4
4474
4475 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4476 EOM
4477         use64bitall="$define"
4478         ;;
4479 esac                          
4480
4481 case "$ccflags" in
4482 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4483 esac
4484 case "$use64bitall" in
4485 "$define"|true|[yY]*) use64bitint="$define" ;;
4486 esac
4487
4488 case "$longsize" in
4489 8) cat <<EOM
4490
4491 You have natively 64-bit long integers.
4492 EOM
4493    val="$define"
4494    ;;
4495 *) case "$use64bitint" in
4496    "$define"|true|[yY]*) dflt='y';;
4497    *) dflt='n';;
4498    esac
4499    cat <<EOM
4500
4501 Perl can be built to take advantage of 64-bit integer types
4502 on some systems.  To do so, Configure can be run with -Duse64bitint.
4503 Choosing this option will most probably introduce binary incompatibilities.
4504
4505 If this doesn't make any sense to you, just accept the default '$dflt'.
4506 EOM
4507    rp='Try to use 64-bit integers, if available?'
4508    . ./myread
4509    case "$ans" in
4510    [yY]*) val="$define" ;;
4511    *)     val="$undef"  ;;
4512    esac
4513    ;;
4514 esac
4515 set use64bitint
4516 eval $setvar
4517
4518 case "$use64bitall" in
4519 "$define"|true|[yY]*) dflt='y' ;;
4520 *) case "$longsize" in
4521    8) dflt='y' ;;
4522    *) dflt='n' ;;
4523    esac
4524    ;;
4525 esac    
4526 cat <<EOM
4527
4528 You may also choose to try maximal 64-bitness.  It means using as much
4529 64-bitness as possible on the platform.  This in turn means even more
4530 binary incompatibilities.  On the other hand, your platform may not
4531 have any more 64-bitness available than what you already have chosen.
4532
4533 If this doesn't make any sense to you, just accept the default '$dflt'.
4534 EOM
4535 rp='Try to use maximal 64-bit support, if available?'
4536 . ./myread
4537 case "$ans" in
4538 [yY]*) val="$define" ;;
4539 *)     val="$undef"  ;;
4540 esac
4541 set use64bitall
4542 eval $setvar
4543 case "$use64bitall" in
4544 "$define")
4545         case "$use64bitint" in
4546         "$undef")
4547                 cat <<EOM
4548
4549 Since you have chosen a maximally 64-bit build, I'm also turning on
4550 the use of 64-bit integers.
4551 EOM
4552                 use64bitint="$define" ;;
4553         esac
4554         ;;
4555 esac
4556
4557 case "$use64bitint" in
4558 "$define"|true|[yY]*)
4559 : Look for a hint-file generated 'call-back-unit'.  If the
4560 : user has specified that a 64-bit perl is to be built,
4561 : we may need to set or change some other defaults.
4562         if $test -f use64bitint.cbu; then
4563                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4564                 . ./use64bitint.cbu
4565         fi
4566         case "$longsize" in
4567         4) case "$archname64" in
4568            '') archname64=64int ;;
4569            esac
4570            ;;
4571         esac
4572         ;;
4573 esac
4574
4575 case "$use64bitall" in
4576 "$define"|true|[yY]*)
4577 : Look for a hint-file generated 'call-back-unit'.  If the
4578 : user has specified that a maximally 64-bit perl is to be built,
4579 : we may need to set or change some other defaults.
4580         if $test -f use64bitall.cbu; then
4581                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4582                 . ./use64bitall.cbu
4583         fi
4584         case "$longsize" in
4585         4) case "$archname64" in
4586            ''|64int) archname64=64all ;;
4587            esac
4588            ;;
4589         esac
4590         ;;
4591 esac
4592
4593 : determine the architecture name
4594 echo " "
4595 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4596         tarch=`arch`"-$osname"
4597 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4598         if uname -m > tmparch 2>&1 ; then
4599                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4600                         -e 's/$/'"-$osname/" tmparch`
4601         else
4602                 tarch="$osname"
4603         fi
4604         $rm -f tmparch
4605 else
4606         tarch="$osname"
4607 fi
4608 case "$myarchname" in
4609 ''|"$tarch") ;;
4610 *)
4611         echo "(Your architecture name used to be $myarchname.)"
4612         archname=''
4613         ;;
4614 esac
4615 myarchname="$tarch"
4616 case "$archname" in
4617 '') dflt="$tarch";;
4618 *) dflt="$archname";;
4619 esac
4620 rp='What is your architecture name'
4621 . ./myread
4622 archname="$ans"
4623 case "$usethreads" in
4624 $define)
4625         echo "Threads selected." >&4
4626         case "$archname" in
4627         *-thread*) echo "...and architecture name already has -thread." >&4
4628                 ;;
4629         *)      archname="$archname-thread"
4630                 echo "...setting architecture name to $archname." >&4
4631                 ;;
4632         esac
4633         ;;
4634 esac
4635 case "$usemultiplicity" in
4636 $define)
4637         echo "Multiplicity selected." >&4
4638         case "$archname" in
4639         *-multi*) echo "...and architecture name already has -multi." >&4
4640                 ;;
4641         *)      archname="$archname-multi"
4642                 echo "...setting architecture name to $archname." >&4
4643                 ;;
4644         esac
4645         ;;
4646 esac
4647 case "$use64bitint" in
4648 $define)
4649         case "$archname64" in
4650         '')
4651                 ;;
4652         *)
4653                 case "$archname" in
4654                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4655                         ;;
4656                 *)      archname="$archname-$archname64"
4657                         echo "...setting architecture name to $archname." >&4
4658                         ;;
4659                 esac
4660                 ;;
4661         esac
4662 esac
4663
4664 : determine root of directory hierarchy where package will be installed.
4665 case "$prefix" in
4666 '')
4667         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4668         ;;
4669 *)
4670         dflt="$prefix"
4671         ;;
4672 esac
4673 $cat <<EOM
4674
4675 By default, $package will be installed in $dflt/bin, manual pages
4676 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4677 installation directories. Typically this is something like /usr/local.
4678 If you wish to have binaries under /usr/bin but other parts of the
4679 installation under /usr/local, that's ok: you will be prompted
4680 separately for each of the installation directories, the prefix being
4681 only used to set the defaults.
4682
4683 EOM
4684 fn=d~
4685 rp='Installation prefix to use?'
4686 . ./getfile
4687 oldprefix=''
4688 case "$prefix" in
4689 '') ;;
4690 *)
4691         case "$ans" in
4692         "$prefix") ;;
4693         *) oldprefix="$prefix";;
4694         esac
4695         ;;
4696 esac
4697 prefix="$ans"
4698 prefixexp="$ansexp"
4699
4700 : is AFS running?
4701 echo " "
4702 case "$afs" in
4703 $define|true)   afs=true ;;
4704 $undef|false)   afs=false ;;
4705 *)      if test -d /afs; then
4706                 afs=true
4707         else
4708                 afs=false
4709         fi
4710         ;;
4711 esac
4712 if $afs; then
4713         echo "AFS may be running... I'll be extra cautious then..." >&4
4714 else
4715         echo "AFS does not seem to be running..." >&4
4716 fi
4717
4718 : determine installation prefix for where package is to be installed.
4719 if $afs; then 
4720 $cat <<EOM
4721
4722 Since you are running AFS, I need to distinguish the directory in which
4723 files will reside from the directory in which they are installed (and from
4724 which they are presumably copied to the former directory by occult means).
4725
4726 EOM
4727         case "$installprefix" in
4728         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4729         *) dflt="$installprefix";;
4730         esac
4731 else
4732 $cat <<EOM
4733
4734 In some special cases, particularly when building $package for distribution,
4735 it is convenient to distinguish between the directory in which files should 
4736 be installed from the directory ($prefix) in which they 
4737 will eventually reside.  For most users, these two directories are the same.
4738
4739 EOM
4740         case "$installprefix" in
4741         '') dflt=$prefix ;;
4742         *) dflt=$installprefix;;
4743         esac
4744 fi
4745 fn=d~
4746 rp='What installation prefix should I use for installing files?'
4747 . ./getfile
4748 installprefix="$ans"
4749 installprefixexp="$ansexp"
4750
4751 : set the prefixit variable, to compute a suitable default value
4752 prefixit='case "$3" in
4753 ""|none)
4754         case "$oldprefix" in
4755         "") eval "$1=\"\$$2\"";;
4756         *)
4757                 case "$3" in
4758                 "") eval "$1=";;
4759                 none)
4760                         eval "tp=\"\$$2\"";
4761                         case "$tp" in
4762                         ""|" ") eval "$1=\"\$$2\"";;
4763                         *) eval "$1=";;
4764                         esac;;
4765                 esac;;
4766         esac;;
4767 *)
4768         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4769         case "$tp" in
4770         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4771         /*-$oldprefix/*|\~*-$oldprefix/*)
4772                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4773         *) eval "$1=\"\$$2\"";;
4774         esac;;
4775 esac'
4776
4777
4778 : get the patchlevel
4779 echo " "
4780 echo "Getting the current patchlevel..." >&4
4781 if $test -r $rsrc/patchlevel.h;then
4782         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4783         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4784         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4785         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4786         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4787         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4788 else
4789         revision=0
4790         patchlevel=0
4791         subversion=0
4792         api_revision=0
4793         api_version=0
4794         api_subversion=0
4795 fi
4796 $echo $n "(You have $package revision $revision" $c
4797 $echo $n " patchlevel $patchlevel" $c
4798 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4799 echo ".)"
4800 case "$osname" in
4801 dos|vms)
4802         : XXX Should be a Configure test for double-dots in filenames.
4803         version=`echo $revision $patchlevel $subversion | \
4804                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4805         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4806                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4807         ;;
4808 *)
4809         version=`echo $revision $patchlevel $subversion | \
4810                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4811         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4812                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4813         ;;
4814 esac
4815 : Special case the 5.005_xx maintenance series, which used 5.005
4816 : without any subversion label as a subdirectory in $sitelib
4817 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4818         api_versionstring='5.005'
4819 fi
4820
4821 : determine installation style
4822 : For now, try to deduce it from prefix unless it is already set.
4823 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4824 case "$installstyle" in
4825 '')     case "$prefix" in
4826                 *perl*) dflt='lib';;
4827                 *) dflt='lib/perl5' ;;
4828         esac
4829         ;;
4830 *)      dflt="$installstyle" ;;
4831 esac
4832 : Probably not worth prompting for this since we prompt for all
4833 : the directories individually, and the prompt would be too long and
4834 : confusing anyway.
4835 installstyle=$dflt
4836
4837 : determine where private library files go
4838 : Usual default is /usr/local/lib/perl5/$version.
4839 : Also allow things like /opt/perl/lib/$version, since 
4840 : /opt/perl/lib/perl5... would be redundant.
4841 : The default "style" setting is made in installstyle.U
4842 case "$installstyle" in
4843 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4844 *)       set dflt privlib lib/$version ;;
4845 esac
4846 eval $prefixit
4847 $cat <<EOM
4848
4849 There are some auxiliary files for $package that need to be put into a
4850 private library directory that is accessible by everyone.
4851
4852 EOM
4853 fn=d~+
4854 rp='Pathname where the private library files will reside?'
4855 . ./getfile
4856 privlib="$ans"
4857 privlibexp="$ansexp"
4858 : Change installation prefix, if necessary.
4859 if $test X"$prefix" != X"$installprefix"; then
4860         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4861 else
4862         installprivlib="$privlibexp"
4863 fi
4864
4865 : set the prefixup variable, to restore leading tilda escape
4866 prefixup='case "$prefixexp" in
4867 "$prefix") ;;
4868 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4869 esac'
4870
4871 : determine where public architecture dependent libraries go
4872 set archlib archlib
4873 eval $prefixit
4874 : privlib default is /usr/local/lib/$package/$version
4875 : archlib default is /usr/local/lib/$package/$version/$archname
4876 : privlib may have an optional trailing /share.
4877 tdflt=`echo $privlib | $sed 's,/share$,,'`
4878 tdflt=$tdflt/$archname
4879 case "$archlib" in
4880 '')     dflt=$tdflt
4881         ;;
4882 *)      dflt="$archlib"
4883     ;;
4884 esac
4885 $cat <<EOM
4886
4887 $spackage contains architecture-dependent library files.  If you are
4888 sharing libraries in a heterogeneous environment, you might store
4889 these files in a separate location.  Otherwise, you can just include
4890 them with the rest of the public library files.
4891
4892 EOM
4893 fn=d+~
4894 rp='Where do you want to put the public architecture-dependent libraries?'
4895 . ./getfile
4896 archlib="$ans"
4897 archlibexp="$ansexp"
4898 if $test X"$archlib" = X"$privlib"; then
4899         d_archlib="$undef"
4900 else
4901         d_archlib="$define"
4902 fi
4903 : Change installation prefix, if necessary.
4904 if $test X"$prefix" != X"$installprefix"; then
4905         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4906 else
4907         installarchlib="$archlibexp"
4908 fi
4909
4910
4911 : Binary compatibility with 5.005 is not possible for builds
4912 : with advanced features
4913 case "$usethreads$usemultiplicity" in
4914 *define*)
4915         bincompat5005="$undef"
4916         d_bincompat5005="$undef"
4917         ;;
4918 *)      $cat <<EOM
4919
4920 This version of Perl can be compiled for binary compatibility with 5.005.
4921 If you decide to do so, you will be able to continue using most of the
4922 extensions that were compiled for Perl 5.005.
4923
4924 EOM
4925         case "$bincompat5005$d_bincompat5005" in
4926         *"$undef"*) dflt=n ;;
4927         *) dflt=y ;;
4928         esac
4929         rp='Binary compatibility with Perl 5.005?'
4930         . ./myread
4931         case "$ans" in
4932         y*) val="$define" ;;
4933         *)  val="$undef" ;;
4934         esac
4935         set d_bincompat5005
4936         eval $setvar
4937         case "$d_bincompat5005" in
4938         "$define")
4939                 bincompat5005="$define"
4940                 ;;
4941         *)      bincompat5005="$undef"
4942                 d_bincompat5005="$undef"
4943                 ;;
4944         esac
4945         ;;
4946 esac
4947
4948
4949 : see if setuid scripts can be secure
4950 $cat <<EOM
4951
4952 Some kernels have a bug that prevents setuid #! scripts from being
4953 secure.  Some sites have disabled setuid #! scripts because of this.
4954
4955 First let's decide if your kernel supports secure setuid #! scripts.
4956 (If setuid #! scripts would be secure but have been disabled anyway,
4957 don't say that they are secure if asked.)
4958
4959 EOM
4960
4961 val="$undef"
4962 if $test -d /dev/fd; then
4963         echo "#!$ls" >reflect
4964         chmod +x,u+s reflect
4965         ./reflect >flect 2>&1
4966         if $contains "/dev/fd" flect >/dev/null; then
4967                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4968                 val="$define"
4969         else
4970                 $cat <<EOM
4971 If you are not sure if they are secure, I can check but I'll need a
4972 username and password different from the one you are using right now.
4973 If you don't have such a username or don't want me to test, simply
4974 enter 'none'.
4975
4976 EOM
4977                 rp='Other username to test security of setuid scripts with?'
4978                 dflt='none'
4979                 . ./myread
4980                 case "$ans" in
4981                 n|none)
4982                         case "$d_suidsafe" in
4983                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4984                                 dflt=n;;
4985                         "$undef")
4986                                 echo "Well, the $hint value is *not* secure." >&4
4987                                 dflt=n;;
4988                         *)      echo "Well, the $hint value *is* secure." >&4
4989                                 dflt=y;;
4990                         esac
4991                         ;;
4992                 *)
4993                         $rm -f reflect flect
4994                         echo "#!$ls" >reflect
4995                         chmod +x,u+s reflect
4996                         echo >flect
4997                         chmod a+w flect
4998                         echo '"su" will (probably) prompt you for '"$ans's password."
4999                         su $ans -c './reflect >flect'
5000                         if $contains "/dev/fd" flect >/dev/null; then
5001                                 echo "Okay, it looks like setuid scripts are secure." >&4
5002                                 dflt=y
5003                         else
5004                                 echo "I don't think setuid scripts are secure." >&4
5005                                 dflt=n
5006                         fi
5007                         ;;
5008                 esac
5009                 rp='Does your kernel have *secure* setuid scripts?'
5010                 . ./myread
5011                 case "$ans" in
5012                 [yY]*)  val="$define";;
5013                 *)      val="$undef";;
5014                 esac
5015         fi
5016 else
5017         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5018         echo "(That's for file descriptors, not floppy disks.)"
5019         val="$undef"
5020 fi
5021 set d_suidsafe
5022 eval $setvar
5023
5024 $rm -f reflect flect
5025
5026 : now see if they want to do setuid emulation
5027 echo " "
5028 val="$undef"
5029 case "$d_suidsafe" in
5030 "$define")
5031         val="$undef"
5032         echo "No need to emulate SUID scripts since they are secure here." >& 4
5033         ;;
5034 *)
5035         $cat <<EOM
5036 Some systems have disabled setuid scripts, especially systems where
5037 setuid scripts cannot be secure.  On systems where setuid scripts have
5038 been disabled, the setuid/setgid bits on scripts are currently
5039 useless.  It is possible for $package to detect those bits and emulate
5040 setuid/setgid in a secure fashion.  This emulation will only work if
5041 setuid scripts have been disabled in your kernel.
5042
5043 EOM
5044         case "$d_dosuid" in
5045         "$define") dflt=y ;;
5046         *) dflt=n ;;
5047         esac
5048         rp="Do you want to do setuid/setgid emulation?"
5049         . ./myread
5050         case "$ans" in
5051         [yY]*)  val="$define";;
5052         *)      val="$undef";;
5053         esac
5054         ;;
5055 esac
5056 set d_dosuid
5057 eval $setvar
5058
5059 : determine filename position in cpp output
5060 echo " "
5061 echo "Computing filename position in cpp output for #include directives..." >&4
5062 echo '#include <stdio.h>' > foo.c
5063 $cat >fieldn <<EOF
5064 $startsh
5065 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5066 $grep '^[       ]*#.*stdio\.h' | \
5067 while read cline; do
5068         pos=1
5069         set \$cline
5070         while $test \$# -gt 0; do
5071                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5072                         echo "\$pos"
5073                         exit 0
5074                 fi
5075                 shift
5076                 pos=\`expr \$pos + 1\`
5077         done
5078 done
5079 EOF
5080 chmod +x fieldn
5081 fieldn=`./fieldn`
5082 $rm -f foo.c fieldn
5083 case $fieldn in
5084 '') pos='???';;
5085 1) pos=first;;
5086 2) pos=second;;
5087 3) pos=third;;
5088 *) pos="${fieldn}th";;
5089 esac
5090 echo "Your cpp writes the filename in the $pos field of the line."
5091
5092 : locate header file
5093 $cat >findhdr <<EOF
5094 $startsh
5095 wanted=\$1
5096 name=''
5097 for usrincdir in $usrinc
5098 do
5099         if test -f \$usrincdir/\$wanted; then
5100                 echo "\$usrincdir/\$wanted"
5101                 exit 0
5102         fi
5103 done
5104 awkprg='{ print \$$fieldn }'
5105 echo "#include <\$wanted>" > foo\$\$.c
5106 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5107 $grep "^[       ]*#.*\$wanted" | \
5108 while read cline; do
5109         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5110         case "\$name" in
5111         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5112         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5113         *) exit 2;;
5114         esac;
5115 done;
5116 #
5117 # status = 0: grep returned 0 lines, case statement not executed
5118 # status = 1: headerfile found
5119 # status = 2: while loop executed, no headerfile found
5120 #
5121 status=\$?
5122 $rm -f foo\$\$.c;
5123 if test \$status -eq 1; then
5124         exit 0;
5125 fi
5126 exit 1
5127 EOF
5128 chmod +x findhdr
5129
5130 : define an alternate in-header-list? function
5131 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5132 cont=true; xxf="echo \"<\$1> found.\" >&4";
5133 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5134 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5135 esac;
5136 case $# in 4) instead=instead;; *) instead="at last";; esac;
5137 while $test "$cont"; do
5138         xxx=`./findhdr $1`
5139         var=$2; eval "was=\$$2";
5140         if $test "$xxx" && $test -r "$xxx";
5141         then eval $xxf;
5142         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5143                 cont="";
5144         else eval $xxnf;
5145         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5146         set $yyy; shift; shift; yyy=$@;
5147         case $# in 0) cont="";;
5148         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5149                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5150         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5151                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5152         esac;
5153 done;
5154 while $test "$yyy";
5155 do set $yyy; var=$2; eval "was=\$$2";
5156         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5157         set $yyy; shift; shift; yyy=$@;
5158 done'
5159
5160 : see if this is a malloc.h system
5161 set malloc.h i_malloc
5162 eval $inhdr
5163
5164 : see if stdlib is available
5165 set stdlib.h i_stdlib
5166 eval $inhdr
5167
5168 : determine which malloc to compile in
5169 echo " "
5170 case "$usemymalloc" in
5171 ''|[yY]*|true|$define)  dflt='y' ;;
5172 *)      dflt='n' ;;
5173 esac
5174 rp="Do you wish to attempt to use the malloc that comes with $package?"
5175 . ./myread
5176 usemymalloc="$ans"
5177 case "$ans" in
5178 y*|true)
5179         usemymalloc='y'
5180         mallocsrc='malloc.c'
5181         mallocobj="malloc$_o"
5182         d_mymalloc="$define"
5183         case "$libs" in
5184         *-lmalloc*)
5185                 : Remove malloc from list of libraries to use
5186                 echo "Removing unneeded -lmalloc from library list" >&4
5187                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5188                 shift
5189                 libs="$*"
5190                 echo "libs = $libs" >&4
5191                 ;;
5192         esac
5193         ;;
5194 *)
5195         usemymalloc='n'
5196         mallocsrc=''
5197         mallocobj=''
5198         d_mymalloc="$undef"
5199         ;;
5200 esac
5201
5202 : compute the return types of malloc and free
5203 echo " "
5204 $cat >malloc.c <<END
5205 #$i_malloc I_MALLOC
5206 #$i_stdlib I_STDLIB
5207 #include <stdio.h>
5208 #include <sys/types.h>
5209 #ifdef I_MALLOC
5210 #include <malloc.h>
5211 #endif
5212 #ifdef I_STDLIB
5213 #include <stdlib.h>
5214 #endif
5215 #ifdef TRY_MALLOC
5216 void *malloc();
5217 #endif
5218 #ifdef TRY_FREE
5219 void free();
5220 #endif
5221 END
5222 case "$malloctype" in
5223 '')
5224         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5225                 malloctype='void *'
5226         else
5227                 malloctype='char *'
5228         fi
5229         ;;
5230 esac
5231 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5232
5233 case "$freetype" in
5234 '')
5235         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5236                 freetype='void'
5237         else
5238                 freetype='int'
5239         fi
5240         ;;
5241 esac
5242 echo "Your system uses $freetype free(), it would seem." >&4
5243 $rm -f malloc.[co]
5244 $cat <<EOM
5245
5246 The installation process will also create a directory for
5247 vendor-supplied add-ons.  Vendors who supply perl with their system
5248 may find it convenient to place all vendor-supplied files in this
5249 directory rather than in the main distribution directory.  This will
5250 ease upgrades between binary-compatible maintenance versions of perl.
5251
5252 Of course you may also use these directories in whatever way you see
5253 fit.  For example, you might use them to access modules shared over a
5254 company-wide network.
5255
5256 The default answer should be fine for most people.
5257 This causes further questions about vendor add-ons to be skipped
5258 and no vendor-specific directories will be configured for perl.
5259
5260 EOM
5261 rp='Do you want to configure vendor-specific add-on directories?'
5262 case "$usevendorprefix" in
5263 define|true|[yY]*) dflt=y ;;
5264 *)      : User may have set vendorprefix directly on Configure command line.
5265         case "$vendorprefix" in
5266         ''|' ') dflt=n ;;
5267         *)      dflt=y ;;
5268         esac
5269         ;;
5270 esac
5271 . ./myread
5272 case "$ans" in
5273 [yY]*)  fn=d~+
5274         rp='Installation prefix to use for vendor-supplied add-ons?'
5275         case "$vendorprefix" in
5276         '') dflt='' ;;
5277         *)  dflt=$vendorprefix ;;
5278         esac
5279         . ./getfile
5280         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5281         oldvendorprefix=''
5282         case "$vendorprefix" in
5283         '') ;;
5284         *)      case "$ans" in
5285                 "$prefix") ;;
5286                 *) oldvendorprefix="$prefix";;
5287                 esac
5288                 ;;
5289         esac
5290         usevendorprefix="$define"
5291         vendorprefix="$ans"
5292         vendorprefixexp="$ansexp"
5293         ;;
5294 *)      usevendorprefix="$undef"
5295         vendorprefix=''
5296         vendorprefixexp=''
5297         ;;
5298 esac
5299
5300 case "$vendorprefix" in
5301 '')     d_vendorlib="$undef"
5302         vendorlib=''
5303         vendorlibexp=''
5304         ;;
5305 *)      d_vendorlib="$define"
5306         : determine where vendor-supplied modules go.
5307         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5308         case "$vendorlib" in
5309         '')
5310                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5311                 case "$installstyle" in
5312                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5313                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5314                 esac
5315                 ;;
5316         *)      dflt="$vendorlib"
5317                 ;;
5318         esac
5319         fn=d~+
5320         rp='Pathname for the vendor-supplied library files?'
5321         . ./getfile
5322         vendorlib="$ans"
5323         vendorlibexp="$ansexp"
5324         ;;
5325 esac
5326 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5327 : Change installation prefix, if necessary.
5328 if $test X"$prefix" != X"$installprefix"; then
5329         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5330 else
5331         installvendorlib="$vendorlibexp"
5332 fi
5333
5334 case "$vendorprefix" in
5335 '')     d_vendorarch="$undef"
5336         vendorarch=''
5337         vendorarchexp=''
5338         ;;
5339 *)      d_vendorarch="$define"
5340         : determine where vendor-supplied architecture-dependent libraries go.
5341         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5342         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5343         : vendorlib may have an optional trailing /share.
5344         case "$vendorarch" in
5345         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5346                 dflt="$dflt/$archname"
5347                 ;;
5348         *)      dflt="$vendorarch" ;;
5349         esac
5350         fn=d~+
5351         rp='Pathname for vendor-supplied architecture-dependent files?'
5352         . ./getfile
5353         vendorarch="$ans"
5354         vendorarchexp="$ansexp"
5355         ;;
5356 esac
5357 : Change installation prefix, if necessary.
5358 if $test X"$prefix" != X"$installprefix"; then
5359         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5360 else
5361         installvendorarch="$vendorarchexp"
5362 fi
5363
5364 : Cruising for prototypes
5365 echo " "
5366 echo "Checking out function prototypes..." >&4
5367 $cat >prototype.c <<'EOCP'
5368 int main(int argc, char *argv[]) {
5369         exit(0);}
5370 EOCP
5371 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5372         echo "Your C compiler appears to support function prototypes."
5373         val="$define"
5374 else
5375         echo "Your C compiler doesn't seem to understand function prototypes."
5376         val="$undef"
5377 fi
5378 set prototype
5379 eval $setvar
5380 $rm -f prototype*
5381
5382 case "$prototype" in
5383 "$define") ;;
5384 *)      ansi2knr='ansi2knr'
5385         echo " "
5386         cat <<EOM >&4
5387
5388 $me:  FATAL ERROR:
5389 This version of $package can only be compiled by a compiler that 
5390 understands function prototypes.  Unfortunately, your C compiler 
5391         $cc $ccflags
5392 doesn't seem to understand them.  Sorry about that.
5393
5394 If GNU cc is available for your system, perhaps you could try that instead.  
5395
5396 Eventually, we hope to support building Perl with pre-ANSI compilers.
5397 If you would like to help in that effort, please contact <perlbug@perl.org>.
5398
5399 Aborting Configure now.
5400 EOM
5401         exit 2
5402         ;;
5403 esac
5404
5405 : determine where public executables go
5406 echo " "
5407 set dflt bin bin
5408 eval $prefixit
5409 fn=d~
5410 rp='Pathname where the public executables will reside?'
5411 . ./getfile
5412 if $test "X$ansexp" != "X$binexp"; then
5413         installbin=''
5414 fi
5415 bin="$ans"
5416 binexp="$ansexp"
5417 : Change installation prefix, if necessary.
5418 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5419 if $test X"$prefix" != X"$installprefix"; then
5420         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5421 else
5422         installbin="$binexp"
5423 fi
5424
5425 : Find perl5.005 or later.
5426 echo "Looking for a previously installed perl5.005 or later... "
5427 case "$perl5" in
5428 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5429                 : Check if this perl is recent and can load a simple module
5430                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5431                         perl5=$tdir/perl
5432                         break;
5433                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5434                         perl5=$tdir/perl
5435                         break;
5436                 fi
5437         done
5438         ;;
5439 *)      perl5="$perl5"
5440         ;;
5441 esac
5442 case "$perl5" in
5443 '')     echo "None found.  That's ok.";;
5444 *)      echo "Using $perl5." ;;
5445 esac
5446
5447 $cat <<EOM
5448
5449 After $package is installed, you may wish to install various
5450 add-on modules and utilities.  Typically, these add-ons will
5451 be installed under $prefix with the rest
5452 of this package.  However, you may wish to install such add-ons
5453 elsewhere under a different prefix.
5454
5455 If you do not wish to put everything under a single prefix, that's
5456 ok.  You will be prompted for the individual locations; this siteprefix
5457 is only used to suggest the defaults.
5458
5459 The default should be fine for most people.
5460
5461 EOM
5462 fn=d~+
5463 rp='Installation prefix to use for add-on modules and utilities?'
5464 : XXX Here might be another good place for an installstyle setting.
5465 case "$siteprefix" in
5466 '') dflt=$prefix ;;
5467 *)  dflt=$siteprefix ;;
5468 esac
5469 . ./getfile
5470 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5471 oldsiteprefix=''
5472 case "$siteprefix" in
5473 '') ;;
5474 *)      case "$ans" in
5475         "$prefix") ;;
5476         *) oldsiteprefix="$prefix";;
5477         esac
5478         ;;
5479 esac
5480 siteprefix="$ans"
5481 siteprefixexp="$ansexp"
5482
5483 : determine where site specific libraries go.
5484 : Usual default is /usr/local/lib/perl5/site_perl/$version
5485 : The default "style" setting is made in installstyle.U
5486 : XXX No longer works with Prefixit stuff.
5487 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5488 case "$sitelib" in
5489 '') case "$installstyle" in
5490         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5491         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5492         esac
5493         ;;
5494 *)      dflt="$sitelib"
5495         ;;
5496 esac
5497 $cat <<EOM
5498
5499 The installation process will create a directory for
5500 site-specific extensions and modules.  Most users find it convenient
5501 to place all site-specific files in this directory rather than in the
5502 main distribution directory.
5503
5504 EOM
5505 fn=d~+
5506 rp='Pathname for the site-specific library files?'
5507 . ./getfile
5508 sitelib="$ans"
5509 sitelibexp="$ansexp"
5510 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5511 : Change installation prefix, if necessary.
5512 if $test X"$prefix" != X"$installprefix"; then
5513         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5514 else
5515         installsitelib="$sitelibexp"
5516 fi
5517
5518 : Determine list of previous versions to include in @INC
5519 $cat > getverlist <<EOPL
5520 #!$perl5 -w
5521 use File::Basename;
5522 \$api_versionstring = "$api_versionstring";
5523 \$version = "$version";
5524 \$sitelib = "$sitelib";
5525 \$archname = "$archname";
5526 EOPL
5527         $cat >> getverlist <<'EOPL'
5528 # Can't have leading @ because metaconfig interprets it as a command!
5529 ;@inc_version_list=();
5530 $stem=dirname($sitelib);
5531 # XXX Redo to do opendir/readdir? 
5532 if (-d $stem) {
5533     chdir($stem);
5534     ;@candidates = glob("5.*");
5535 }
5536 else {
5537     ;@candidates = ();
5538 }
5539
5540 # XXX ToDo:  These comparisons must be reworked when two-digit
5541 # subversions come along, so that 5.7.10 compares as greater than
5542 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5543 # widespread that we can use the built-in version vectors rather
5544 # than reinventing them here.  For 5.6.0, however, we must
5545 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5546 foreach $d (@candidates) {
5547     if ($d lt $version) {
5548         if ($d ge $api_versionstring) {
5549             unshift(@inc_version_list, "$d/$archname", $d);
5550         }
5551         elsif ($d ge "5.005") {
5552             unshift(@inc_version_list, $d);
5553         }
5554     }
5555     else {
5556         # Skip newer version.  I.e. don't look in
5557         # 5.7.0 if we're installing 5.6.1.
5558     }
5559 }
5560
5561 if (@inc_version_list) {
5562     print join(' ', @inc_version_list);
5563 }
5564 else {
5565     # Blank space to preserve value for next Configure run.
5566     print " ";
5567 }
5568 EOPL
5569 chmod +x getverlist
5570 case "$inc_version_list" in
5571 '')     if test -x "$perl5"; then
5572                 dflt=`$perl5 getverlist`
5573         else
5574                 dflt='none'
5575         fi
5576         ;;
5577 $undef) dflt='none' ;;
5578 *)  dflt="$inc_version_list" ;;
5579 esac
5580 case "$dflt" in
5581 ''|' ') dflt=none ;;
5582 esac
5583 $cat <<'EOM'
5584
5585 In order to ease the process of upgrading, this version of perl 
5586 can be configured to use modules built and installed with earlier 
5587 versions of perl that were installed under $prefix.  Specify here
5588 the list of earlier versions that this version of perl should check.
5589 If Configure detected no earlier versions of perl installed under
5590 $prefix, then the list will be empty.  Answer 'none' to tell perl
5591 to not search earlier versions.
5592
5593 The default should almost always be sensible, so if you're not sure,
5594 just accept the default.
5595 EOM
5596
5597 rp='List of earlier versions to include in @INC?'
5598 . ./myread
5599 case "$ans" in
5600 [Nn]one|''|' ') inc_version_list=' ' ;;
5601 *) inc_version_list="$ans" ;;
5602 esac
5603 case "$inc_version_list" in
5604 ''|' ') 
5605         inc_version_list_init='0';;
5606 *)      inc_version_list_init=`echo $inc_version_list |
5607                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5608         ;;
5609 esac
5610 $rm -f getverlist
5611
5612 : determine whether to install perl also as /usr/bin/perl
5613
5614 echo " "
5615 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5616         $cat <<EOM
5617 Many scripts expect perl to be installed as /usr/bin/perl.
5618 I can install the perl you are about to compile also as /usr/bin/perl
5619 (in addition to $installbin/perl).
5620 EOM
5621         case "$installusrbinperl" in
5622         "$undef"|[nN]*) dflt='n';;
5623         *)              dflt='y';;
5624         esac
5625         rp="Do you want to install perl as /usr/bin/perl?"
5626         . ./myread
5627         case "$ans" in
5628         [yY]*)  val="$define";;
5629         *)      val="$undef" ;;
5630         esac
5631 else
5632         val="$undef"
5633 fi
5634 set installusrbinperl
5635 eval $setvar
5636
5637 echo " "
5638 echo "Checking for GNU C Library..." >&4
5639 cat >gnulibc.c <<EOM
5640 #include <stdio.h>
5641 int main()
5642 {
5643 #ifdef __GLIBC__
5644     exit(0);
5645 #else
5646     exit(1);
5647 #endif
5648 }
5649 EOM
5650 set gnulibc
5651 if eval $compile_ok && ./gnulibc; then
5652         val="$define"
5653         echo "You are using the GNU C Library"
5654 else
5655         val="$undef"
5656         echo "You are not using the GNU C Library"
5657 fi
5658 $rm -f gnulibc*
5659 set d_gnulibc
5660 eval $setvar
5661
5662 : see if nm is to be used to determine whether a symbol is defined or not
5663 case "$usenm" in
5664 '')
5665         dflt=''
5666         case "$d_gnulibc" in
5667         "$define")
5668                 echo " "
5669                 echo "nm probably won't work on the GNU C Library." >&4
5670                 dflt=n
5671                 ;;
5672         esac
5673         case "$dflt" in
5674         '') 
5675                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5676                         echo " "
5677                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5678                         echo "'nm' won't be sufficient on this sytem." >&4
5679                         dflt=n
5680                 fi
5681                 ;;
5682         esac
5683         case "$dflt" in
5684         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5685                 if $test $dflt -gt 20; then
5686                         dflt=y
5687                 else
5688                         dflt=n
5689                 fi
5690                 ;;
5691         esac
5692         ;;
5693 *)
5694         case "$usenm" in
5695         true|$define) dflt=y;;
5696         *) dflt=n;;
5697         esac
5698         ;;
5699 esac
5700 $cat <<EOM
5701
5702 I can use $nm to extract the symbols from your C libraries. This
5703 is a time consuming task which may generate huge output on the disk (up
5704 to 3 megabytes) but that should make the symbols extraction faster. The
5705 alternative is to skip the 'nm' extraction part and to compile a small
5706 test program instead to determine whether each symbol is present. If
5707 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5708 this may be the best solution.
5709
5710 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5711
5712 EOM
5713 rp="Shall I use $nm to extract C symbols from the libraries?"
5714 . ./myread
5715 case "$ans" in
5716 [Nn]*) usenm=false;;
5717 *) usenm=true;;
5718 esac
5719
5720 runnm=$usenm
5721 case "$reuseval" in
5722 true) runnm=false;;
5723 esac
5724
5725 : nm options which may be necessary
5726 case "$nm_opt" in
5727 '') if $test -f /mach_boot; then
5728                 nm_opt=''       # Mach
5729         elif $test -d /usr/ccs/lib; then
5730                 nm_opt='-p'     # Solaris (and SunOS?)
5731         elif $test -f /dgux; then
5732                 nm_opt='-p'     # DG-UX
5733         elif $test -f /lib64/rld; then
5734                 nm_opt='-p'     # 64-bit Irix
5735         else
5736                 nm_opt=''
5737         fi;;
5738 esac
5739
5740 : nm options which may be necessary for shared libraries but illegal
5741 : for archive libraries.  Thank you, Linux.
5742 case "$nm_so_opt" in
5743 '')     case "$myuname" in
5744         *linux*)
5745                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5746                         nm_so_opt='--dynamic'
5747                 fi
5748                 ;;
5749         esac
5750         ;;
5751 esac
5752
5753 case "$runnm" in
5754 true)
5755 : get list of predefined functions in a handy place
5756 echo " "
5757 case "$libc" in
5758 '') libc=unknown
5759         case "$libs" in
5760         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5761         esac
5762         ;;
5763 esac
5764 libnames='';
5765 case "$libs" in
5766 '') ;;
5767 *)  for thislib in $libs; do
5768         case "$thislib" in
5769         -lc|-lc_s)
5770                 : Handle C library specially below.
5771                 ;;
5772         -l*)
5773                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5774                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5775                         :
5776                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5777                         :
5778                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5779                         :
5780                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5781                         :
5782                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5783                         :
5784                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5785                         :
5786                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5787                         :
5788                 else
5789                         try=''
5790                 fi
5791                 libnames="$libnames $try"
5792                 ;;
5793         *) libnames="$libnames $thislib" ;;
5794         esac
5795         done
5796         ;;
5797 esac
5798 xxx=normal
5799 case "$libc" in
5800 unknown)
5801         set /lib/libc.$so
5802         for xxx in $libpth; do
5803                 $test -r $1 || set $xxx/libc.$so
5804                 : The messy sed command sorts on library version numbers.
5805                 $test -r $1 || \
5806                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5807                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5808                                 h
5809                                 s/[0-9][0-9]*/0000&/g
5810                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5811                                 G
5812                                 s/\n/ /' | \
5813                          sort | $sed -e 's/^.* //'`
5814                 eval set \$$#
5815         done
5816         $test -r $1 || set /usr/ccs/lib/libc.$so
5817         $test -r $1 || set /lib/libsys_s$_a
5818         ;;
5819 *)
5820         set blurfl
5821         ;;
5822 esac
5823 if $test -r "$1"; then
5824         echo "Your (shared) C library seems to be in $1."
5825         libc="$1"
5826 elif $test -r /lib/libc && $test -r /lib/clib; then
5827         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5828         xxx=apollo
5829         libc='/lib/clib /lib/libc'
5830         if $test -r /lib/syslib; then
5831                 echo "(Your math library is in /lib/syslib.)"
5832                 libc="$libc /lib/syslib"
5833         fi
5834 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5835         echo "Your C library seems to be in $libc, as you said before."
5836 elif $test -r $incpath/usr/lib/libc$_a; then
5837         libc=$incpath/usr/lib/libc$_a;
5838         echo "Your C library seems to be in $libc.  That's fine."
5839 elif $test -r /lib/libc$_a; then
5840         libc=/lib/libc$_a;
5841         echo "Your C library seems to be in $libc.  You're normal."
5842 else
5843         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5844                 :
5845         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5846                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5847         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5848                 :
5849         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5850                 :
5851         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5852                 :
5853         else
5854                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5855         fi
5856         if $test -r "$tans"; then
5857                 echo "Your C library seems to be in $tans, of all places."
5858                 libc=$tans
5859         else
5860                 libc='blurfl'
5861         fi
5862 fi
5863 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5864         dflt="$libc"
5865         cat <<EOM
5866
5867 If the guess above is wrong (which it might be if you're using a strange
5868 compiler, or your machine supports multiple models), you can override it here.
5869
5870 EOM
5871 else
5872         dflt=''
5873         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5874         cat >&4 <<EOM
5875 I can't seem to find your C library.  I've looked in the following places:
5876
5877 EOM
5878         $sed 's/^/      /' libpath
5879         cat <<EOM
5880
5881 None of these seems to contain your C library. I need to get its name...
5882
5883 EOM
5884 fi
5885 fn=f
5886 rp='Where is your C library?'
5887 . ./getfile
5888 libc="$ans"
5889
5890 echo " "
5891 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5892 set X `cat libnames`
5893 shift
5894 xxx=files
5895 case $# in 1) xxx=file; esac
5896 echo "Extracting names from the following $xxx for later perusal:" >&4
5897 echo " "
5898 $sed 's/^/      /' libnames >&4
5899 echo " "
5900 $echo $n "This may take a while...$c" >&4
5901
5902 for file in $*; do
5903         case $file in
5904         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5905         *) $nm $nm_opt $file 2>/dev/null;;
5906         esac
5907 done >libc.tmp
5908
5909 $echo $n ".$c"
5910 $grep fprintf libc.tmp > libc.ptf
5911 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5912 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5913 xxx='[ADTSIW]'
5914 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5915         eval $xscan;\
5916         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5917                 eval $xrun
5918 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5919         eval $xscan;\
5920         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5921                 eval $xrun
5922 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5923         eval $xscan;\
5924         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5925                 eval $xrun
5926 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5927         eval $xscan;\
5928         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5929                 eval $xrun
5930 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5931         eval $xscan;\
5932         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5933                 eval $xrun
5934 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5935         eval $xscan;\
5936         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5937                 eval $xrun
5938 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5939                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5940         eval $xscan;\
5941         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5942                 eval $xrun
5943 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5944         eval $xscan;\
5945         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5946                 eval $xrun
5947 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5948         eval $xscan;\
5949         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5950                 eval $xrun
5951 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5952         eval $xscan;\
5953         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5954                 eval $xrun
5955 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5956         eval $xscan;\
5957         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5958                 eval $xrun
5959 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5960         eval $xscan;\
5961         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5962                 eval $xrun
5963 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5964         eval $xscan;\
5965         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5966                 eval $xrun
5967 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5968         eval $xscan;\
5969         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5970                 eval $xrun
5971 else
5972         $nm -p $* 2>/dev/null >libc.tmp
5973         $grep fprintf libc.tmp > libc.ptf
5974         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5975                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5976         then
5977                 nm_opt='-p'
5978                 eval $xrun
5979         else
5980                 echo " "
5981                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5982                 com=''
5983                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5984                         for thisname in $libnames $libc; do
5985                                 $ar t $thisname >>libc.tmp
5986                         done
5987                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5988                         echo "Ok." >&4
5989                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5990                         # Repeat libc to extract forwarders to DLL entries too
5991                         for thisname in $libnames $libc; do
5992                                 $ar tv $thisname >>libc.tmp
5993                                 # Revision 50 of EMX has bug in $ar.
5994                                 # it will not extract forwarders to DLL entries
5995                                 # Use emximp which will extract exactly them.
5996                                 emximp -o tmp.imp $thisname \
5997                                     2>/dev/null && \
5998                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5999                                     < tmp.imp >>libc.tmp
6000                                 $rm tmp.imp
6001                         done
6002                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6003                         echo "Ok." >&4
6004                 else
6005                         echo "$ar didn't seem to work right." >&4
6006                         echo "Maybe this is a Cray...trying bld instead..." >&4
6007                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6008                         then
6009                                 for thisname in $libnames; do
6010                                         bld t $libnames | \
6011                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6012                                         $ar t $thisname >>libc.tmp
6013                                 done
6014                                 echo "Ok." >&4
6015                         else
6016                                 echo "That didn't work either.  Giving up." >&4
6017                                 exit 1
6018                         fi
6019                 fi
6020         fi
6021 fi
6022 nm_extract="$com"
6023 if $test -f /lib/syscalls.exp; then
6024         echo " "
6025         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6026         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6027 fi
6028 ;;
6029 esac
6030 $rm -f libnames libpath
6031
6032 : see if dld is available
6033 set dld.h i_dld
6034 eval $inhdr
6035
6036 : is a C symbol defined?
6037 csym='tlook=$1;
6038 case "$3" in
6039 -v) tf=libc.tmp; tc=""; tdc="";;
6040 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6041 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6042 esac;
6043 tx=yes;
6044 case "$reuseval-$4" in
6045 true-) ;;
6046 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6047 esac;
6048 case "$tx" in
6049 yes)
6050         case "$runnm" in
6051         true)
6052                 if $contains $tlook $tf >/dev/null 2>&1;
6053                 then tval=true;
6054                 else tval=false;
6055                 fi;;
6056         *)
6057                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6058                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6059                 then tval=true;
6060                 else tval=false;
6061                 fi;
6062                 $rm -f t t.c;;
6063         esac;;
6064 *)
6065         case "$tval" in
6066         $define) tval=true;;
6067         *) tval=false;;
6068         esac;;
6069 esac;
6070 eval "$2=$tval"'
6071
6072 : define an is-in-libc? function
6073 inlibc='echo " "; td=$define; tu=$undef;
6074 sym=$1; var=$2; eval "was=\$$2";
6075 tx=yes;
6076 case "$reuseval$was" in
6077 true) ;;
6078 true*) tx=no;;
6079 esac;
6080 case "$tx" in
6081 yes)
6082         set $sym tres -f;
6083         eval $csym;
6084         case "$tres" in
6085         true)
6086                 echo "$sym() found." >&4;
6087                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6088         *)
6089                 echo "$sym() NOT found." >&4;
6090                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6091         esac;;
6092 *)
6093         case "$was" in
6094         $define) echo "$sym() found." >&4;;
6095         *) echo "$sym() NOT found." >&4;;
6096         esac;;
6097 esac'
6098
6099 : see if dlopen exists
6100 xxx_runnm="$runnm"
6101 runnm=false
6102 set dlopen d_dlopen
6103 eval $inlibc
6104 runnm="$xxx_runnm"
6105
6106 : determine which dynamic loading, if any, to compile in
6107 echo " "
6108 dldir="ext/DynaLoader"
6109 case "$usedl" in
6110 $define|y|true)
6111         dflt='y'
6112         usedl="$define"
6113         ;;
6114 $undef|n|false)
6115         dflt='n'
6116         usedl="$undef"
6117         ;;
6118 *) 
6119         dflt='n'
6120         case "$d_dlopen" in
6121             $define) dflt='y' ;;
6122         esac
6123         case "$i_dld" in
6124             $define) dflt='y' ;;
6125         esac
6126         : Does a dl_xxx.xs file exist for this operating system
6127         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6128         ;;
6129 esac
6130 rp="Do you wish to use dynamic loading?"
6131 . ./myread
6132 usedl="$ans"
6133 case "$ans" in
6134 y*) usedl="$define"
6135         case "$dlsrc" in
6136         '')
6137                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6138                         dflt="$dldir/dl_${osname}.xs"
6139                 elif $test "$d_dlopen" = "$define" ; then
6140                         dflt="$dldir/dl_dlopen.xs"
6141                 elif $test "$i_dld" = "$define" ; then
6142                         dflt="$dldir/dl_dld.xs"
6143                 else
6144                         dflt=''
6145                 fi
6146                 ;;
6147         *)      dflt="$dldir/$dlsrc"
6148                 ;;
6149         esac
6150     echo "The following dynamic loading files are available:"
6151         : Can not go over to $dldir because getfile has path hard-coded in.
6152         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6153         rp="Source file to use for dynamic loading"
6154         fn="fne"
6155         gfpth="$src"
6156         . ./getfile
6157         usedl="$define"
6158         : emulate basename
6159         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6160
6161         $cat << EOM
6162
6163 Some systems may require passing special flags to $cc -c to
6164 compile modules that will be used to create a shared library.
6165 To use no flags, say "none".
6166
6167 EOM
6168     case "$cccdlflags" in
6169     '') case "$gccversion" in
6170                 '') case "$osname" in
6171                         hpux)   dflt='+z' ;;
6172                         next)   dflt='none' ;;
6173                         irix*)  dflt='-KPIC' ;;
6174                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6175                         sunos)  dflt='-pic' ;;
6176                         *)      dflt='none' ;;
6177                     esac
6178                         ;;
6179                 *)  case "$osname" in
6180                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6181                         *)      dflt='-fpic' ;;
6182                     esac ;;
6183             esac ;;
6184         ' ') dflt='none' ;;
6185     *)  dflt="$cccdlflags" ;;
6186     esac
6187     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6188     . ./myread
6189     case "$ans" in
6190     none) cccdlflags=' ' ;;
6191     *) cccdlflags="$ans" ;;
6192     esac
6193
6194     cat << EOM
6195
6196 Some systems use ld to create libraries that can be dynamically loaded,
6197 while other systems (such as those using ELF) use $cc.
6198
6199 EOM
6200         case "$ld" in
6201         '')     $cat >try.c <<'EOM'
6202 /* Test for whether ELF binaries are produced */
6203 #include <fcntl.h>
6204 #include <stdlib.h>
6205 int main() {
6206         char b[4];
6207         int i = open("a.out",O_RDONLY);
6208         if(i == -1) 
6209                 exit(1); /* fail */
6210         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6211                 exit(0); /* succeed (yes, it's ELF) */
6212         else
6213                 exit(1); /* fail */
6214 }
6215 EOM
6216                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6217                         cat <<EOM
6218 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6219 EOM
6220                         dflt="$cc"
6221                 else
6222                         echo "I'll use ld to build dynamic libraries."
6223                         dflt='ld'
6224                 fi
6225                 rm -f try.c a.out
6226                 ;;
6227         *)      dflt="$ld"
6228                 ;;
6229         esac
6230
6231     rp="What command should be used to create dynamic libraries?"
6232     . ./myread
6233         ld="$ans"
6234
6235     cat << EOM
6236
6237 Some systems may require passing special flags to $ld to create a
6238 library that can be dynamically loaded.  If your ld flags include
6239 -L/other/path options to locate libraries outside your loader's normal
6240 search path, you may need to specify those -L options here as well.  To
6241 use no flags, say "none".
6242
6243 EOM
6244     case "$lddlflags" in
6245     '') case "$osname" in
6246                         beos) dflt='-nostart' ;;
6247                         hpux) dflt='-b';
6248                               case "$gccversion" in
6249                               '') dflt="$dflt +vnocompatwarnings" ;;
6250                               esac
6251                               ;;        
6252                         linux|irix*)    dflt='-shared' ;;
6253                         next)  dflt='none' ;;
6254                         solaris) dflt='-G' ;;
6255                         sunos) dflt='-assert nodefinitions' ;;
6256                         svr4*|esix*) dflt="-G $ldflags" ;;
6257                 *)     dflt='none' ;;
6258                         esac
6259                         ;;
6260     *) dflt="$lddlflags" ;;
6261     esac
6262
6263         : Try to guess additional flags to pick up local libraries.
6264         : Be careful not to append to a plain 'none'
6265         case "$dflt" in
6266         none) dflt='' ;;
6267         esac
6268         for thisflag in $ldflags; do
6269                 case "$thisflag" in
6270                 -L*)
6271                         case " $dflt " in
6272                         *" $thisflag "*) ;;
6273                         *) dflt="$dflt $thisflag" ;;
6274                         esac
6275                         ;;
6276                 esac
6277         done
6278
6279         case "$dflt" in
6280         ''|' ') dflt='none' ;;
6281         esac
6282
6283     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6284     . ./myread
6285     case "$ans" in
6286     none) lddlflags=' ' ;;
6287     *) lddlflags="$ans" ;;
6288     esac
6289
6290         cat <<EOM
6291
6292 Some systems may require passing special flags to $cc to indicate that
6293 the resulting executable will use dynamic linking.  To use no flags,
6294 say "none".
6295
6296 EOM
6297     case "$ccdlflags" in
6298     '') case "$osname" in
6299                 hpux)   dflt='-Wl,-E' ;;
6300                 linux)  dflt='-rdynamic' ;;
6301                 next)   dflt='none' ;;
6302                 sunos)  dflt='none' ;;
6303                 *)      dflt='none' ;;
6304             esac ;;
6305     ' ')  dflt='none' ;;
6306     *)  dflt="$ccdlflags" ;;
6307     esac
6308     rp="Any special flags to pass to $cc to use dynamic linking?"
6309     . ./myread
6310     case "$ans" in
6311     none) ccdlflags=' ' ;;
6312     *) ccdlflags="$ans" ;;
6313     esac
6314     ;;
6315 *)  usedl="$undef"
6316         ld='ld'
6317     dlsrc='dl_none.xs'
6318     lddlflags=''
6319     ccdlflags=''
6320     ;;
6321 esac
6322
6323 also=''
6324 case "$usedl" in
6325 $undef)
6326         # No dynamic loading being used, so don't bother even to prompt.
6327         useshrplib='false'
6328         ;;
6329 *)      case "$useshrplib" in
6330         '')     case "$osname" in
6331                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6332                         dflt=y
6333                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6334                         ;;
6335                 next*)
6336                         case "$osvers" in
6337                         4*)     dflt=y
6338                                 also='Building a shared libperl is needed for MAB support.'
6339                                 ;;
6340                         *)      dflt=n
6341                                 ;;
6342                         esac
6343                         ;;
6344                 *)      dflt=n
6345                         ;;
6346                 esac
6347                 ;;
6348         $define|true|[Yy]*)
6349                 dflt=y
6350                 ;;
6351         *)      dflt=n
6352                 ;;
6353         esac
6354         $cat << EOM
6355
6356 The perl executable is normally obtained by linking perlmain.c with
6357 libperl${_a}, any static extensions (usually just DynaLoader), and
6358 any other libraries needed on this system (such as -lm, etc.).  Since
6359 your system supports dynamic loading, it is probably possible to build
6360 a shared libperl.$so.  If you will have more than one executable linked
6361 to libperl.$so, this will significantly reduce the size of each
6362 executable, but it may have a noticeable affect on performance.  The
6363 default is probably sensible for your system.
6364 $also
6365
6366 EOM
6367         rp="Build a shared libperl.$so (y/n)"
6368         . ./myread
6369         case "$ans" in
6370         true|$define|[Yy]*)
6371                 useshrplib='true'  ;;
6372         *)      useshrplib='false' ;;
6373         esac
6374         ;;
6375 esac
6376
6377 case "$useshrplib" in
6378 true)
6379         case "$libperl" in
6380         '')
6381                 # Figure out a good name for libperl.so.  Since it gets stored in
6382                 # a version-specific architecture-dependent library, the version
6383                 # number isn't really that important, except for making cc/ld happy.
6384                 #
6385                 # A name such as libperl.so.3.1
6386                 majmin="libperl.$so.$patchlevel.$subversion"
6387                 # A name such as libperl.so.301
6388                 majonly=`echo $patchlevel $subversion |
6389                         $awk '{printf "%d%02d", $1, $2}'`
6390                 majonly=libperl.$so.$majonly
6391                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6392                 # rely on figuring it out from the naming of libc.
6393                 case "${osname}${osvers}" in
6394                 next4*)
6395                         dflt=libperl.5.$so
6396                         # XXX How handle the --version stuff for MAB?
6397                         ;;
6398                 linux*)  # ld won't link with a bare -lperl otherwise.
6399                         dflt=libperl.$so
6400                         ;;
6401                 cygwin*) # include version
6402                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6403                         ;;
6404                 *)      # Try to guess based on whether libc has major.minor.
6405                         case "$libc" in
6406                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6407                         *libc.$so.[0-9]*) dflt=$majonly ;;
6408                         *)      dflt=libperl.$so ;;
6409                         esac
6410                         ;;
6411                 esac
6412                 ;;
6413         *)      dflt=$libperl
6414                 ;;
6415         esac
6416         cat << EOM
6417
6418 I need to select a good name for the shared libperl.  If your system uses
6419 library names with major and minor numbers, then you might want something
6420 like $majmin.  Alternatively, if your system uses a single version
6421 number for shared libraries, then you might want to use $majonly.
6422 Or, your system might be quite happy with a simple libperl.$so.
6423
6424 Since the shared libperl will get installed into a version-specific
6425 architecture-dependent directory, the version number of the shared perl
6426 library probably isn't important, so the default should be o.k.
6427
6428 EOM
6429         rp='What name do you want to give to the shared libperl?'
6430         . ./myread
6431         libperl=$ans
6432         echo "Ok, I'll use $libperl"
6433         ;;
6434 *)
6435         libperl="libperl${_a}"
6436         ;;
6437 esac
6438
6439 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6440 case "$shrpdir" in
6441 '') ;;
6442 *)      $cat >&4 <<EOM
6443 WARNING:  Use of the shrpdir variable for the installation location of
6444 the shared $libperl is not supported.  It was never documented and
6445 will not work in this version.  Let me (perlbug@perl.com)
6446 know of any problems this may cause.
6447
6448 EOM
6449         case "$shrpdir" in
6450         "$archlibexp/CORE")
6451                 $cat >&4 <<EOM
6452 But your current setting of $shrpdir is
6453 the default anyway, so it's harmless.
6454 EOM
6455                 ;;
6456         *)
6457                 $cat >&4 <<EOM
6458 Further, your current attempted setting of $shrpdir
6459 conflicts with the value of $archlibexp/CORE
6460 that installperl will use.
6461 EOM
6462                 ;;
6463         esac
6464         ;;
6465 esac
6466
6467 # How will the perl executable find the installed shared $libperl?
6468 # Add $xxx to ccdlflags.
6469 # If we can't figure out a command-line option, use $shrpenv to
6470 # set env LD_RUN_PATH.  The main perl makefile uses this.
6471 shrpdir=$archlibexp/CORE
6472 xxx=''
6473 tmp_shrpenv=''
6474 if "$useshrplib"; then
6475     case "$osname" in 
6476         aix)
6477                 # We'll set it in Makefile.SH...
6478                 ;;
6479         solaris|netbsd)
6480                 xxx="-R $shrpdir"
6481                 ;;
6482         freebsd)
6483                 xxx="-Wl,-R$shrpdir"
6484                 ;;
6485         linux|irix*|dec_osf)
6486                 xxx="-Wl,-rpath,$shrpdir"
6487                 ;;
6488         next)
6489                 # next doesn't like the default...
6490                 ;;
6491         beos)
6492                 # beos doesn't like the default, either.
6493                 ;;
6494         hpux*)
6495                 # hpux doesn't like the default, either.
6496                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6497                 ;;
6498         *)
6499                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6500                 ;;
6501         esac
6502         case "$xxx" in
6503         '') ;;
6504         *)      
6505                 # Only add $xxx if it isn't already in ccdlflags.
6506                 case " $ccdlflags " in
6507                 *" $xxx "*)     ;;
6508                 *)      ccdlflags="$ccdlflags $xxx"
6509                         cat <<EOM >&4
6510
6511 Adding $xxx to the flags
6512 passed to $ld so that the perl executable will find the 
6513 installed shared $libperl.
6514
6515 EOM
6516                         ;;
6517                 esac
6518                 ;;
6519         esac
6520 fi
6521 # Fix ccdlflags in AIX for building external extensions.
6522 # (For building Perl itself bare -bE:perl.exp is needed,
6523 #  Makefile.SH takes care of this.)
6524 case "$osname" in
6525 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6526 esac
6527 # Respect a hint or command-line value.
6528 case "$shrpenv" in
6529 '') shrpenv="$tmp_shrpenv" ;;
6530 esac
6531 case "$ldlibpthname" in
6532 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6533 none)   ldlibpthname='' ;;
6534 esac
6535
6536 : determine where manual pages go
6537 set man1dir man1dir none
6538 eval $prefixit
6539 $cat <<EOM
6540
6541 $spackage has manual pages available in source form.
6542 EOM
6543 case "$nroff" in
6544 nroff)
6545         echo "However, you don't have nroff, so they're probably useless to you."
6546         case "$man1dir" in
6547         '') man1dir="none";;
6548         esac;;
6549 esac
6550 echo "If you don't want the manual sources installed, answer 'none'."
6551 case "$man1dir" in
6552 ' ') dflt=none
6553         ;;
6554 '')
6555         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6556         lookpath="$lookpath $prefixexp/man/p_man/man1"
6557         lookpath="$lookpath $prefixexp/man/u_man/man1"
6558         lookpath="$lookpath $prefixexp/man/man.1"
6559         case "$sysman" in
6560         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6561         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6562         esac
6563         set dflt
6564         eval $prefixup
6565         ;;
6566 *)  dflt="$man1dir"
6567         ;;
6568 esac
6569 echo " "
6570 fn=dn+~
6571 rp="Where do the main $spackage manual pages (source) go?"
6572 . ./getfile
6573 if $test "X$man1direxp" != "X$ansexp"; then
6574         installman1dir=''
6575 fi
6576 man1dir="$ans"
6577 man1direxp="$ansexp"
6578 case "$man1dir" in
6579 '')     man1dir=' '
6580         installman1dir='';;
6581 esac
6582
6583 : Change installation prefix, if necessary.
6584 if $test X"$prefix" != X"$installprefix"; then
6585         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6586 else
6587         installman1dir="$man1direxp"
6588 fi
6589
6590 : What suffix to use on installed man pages
6591
6592 case "$man1dir" in
6593 ' ')
6594         man1ext='0'
6595         ;;
6596 *)
6597         rp="What suffix should be used for the main $spackage man pages?"
6598         case "$man1ext" in
6599         '')     case "$man1dir" in
6600                 *1)  dflt=1 ;;
6601                 *1p) dflt=1p ;;
6602                 *1pm) dflt=1pm ;;
6603                 *l) dflt=l;;
6604                 *n) dflt=n;;
6605                 *o) dflt=o;;
6606                 *p) dflt=p;;
6607                 *C) dflt=C;;
6608                 *L) dflt=L;;
6609                 *L1) dflt=L1;;
6610                 *) dflt=1;;
6611                 esac
6612                 ;;
6613         *)      dflt="$man1ext";;
6614         esac
6615         . ./myread
6616         man1ext="$ans"
6617         ;;
6618 esac
6619
6620 : see if we can have long filenames
6621 echo " "
6622 first=123456789abcdef
6623 $rm -f $first
6624 if (echo hi >$first) 2>/dev/null; then
6625         if $test -f 123456789abcde; then
6626                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6627                 val="$undef"
6628         else
6629                 echo 'You can have filenames longer than 14 characters.'>&4
6630                 val="$define"
6631         fi
6632 else
6633         $cat <<'EOM'
6634 You can't have filenames longer than 14 chars.
6635 You can't even think about them!
6636 EOM
6637         val="$undef"
6638 fi 
6639 set d_flexfnam
6640 eval $setvar
6641 $rm -rf 123456789abcde*
6642
6643 : determine where library module manual pages go
6644 set man3dir man3dir none
6645 eval $prefixit
6646 $cat <<EOM
6647
6648 $spackage has manual pages for many of the library modules.
6649 EOM
6650
6651 case "$nroff" in
6652 nroff)
6653         $cat <<'EOM'
6654 However, you don't have nroff, so they're probably useless to you.
6655 EOM
6656         case "$man3dir" in
6657         '') man3dir="none";;
6658         esac;;
6659 esac
6660
6661 case "$d_flexfnam" in
6662 undef)
6663         $cat <<'EOM'
6664 However, your system can't handle the long file names like File::Basename.3. 
6665 EOM
6666         case "$man3dir" in
6667         '') man3dir="none";;
6668         esac;;
6669 esac
6670
6671 echo "If you don't want the manual sources installed, answer 'none'."
6672 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6673 case "$man3dir" in
6674 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6675         if $test -d "$privlib/man/man3"; then
6676                 cat <<EOM >&4
6677
6678 WARNING:  Previous versions of perl installed man3 pages into
6679 $privlib/man/man3.  This version will suggest a 
6680 new default of $dflt.  
6681 EOM
6682                 tdflt=$dflt
6683                 dflt='n'
6684                 rp='Do you wish to preserve the old behavior?(y/n)'
6685                 . ./myread
6686                 case "$ans" in
6687                 y*) dflt="$privlib/man/man3" ;;
6688                 *)  dflt=$tdflt ;;
6689                 esac
6690     fi
6691         ;;
6692 *)      dflt="$man3dir" ;;
6693 esac
6694 case "$dflt" in
6695 ' ') dflt=none ;;
6696 esac
6697 echo " "
6698 fn=dn+~
6699 rp="Where do the $package library man pages (source) go?"
6700 . ./getfile
6701 man3dir="$ans"
6702 man3direxp="$ansexp"
6703 case "$man3dir" in
6704 '')     man3dir=' '
6705         installman3dir='';;
6706 esac
6707
6708 : Change installation prefix, if necessary.
6709 if $test X"$prefix" != X"$installprefix"; then
6710         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6711 else
6712         installman3dir="$man3direxp"
6713 fi
6714
6715 : What suffix to use on installed man pages
6716 case "$man3dir" in
6717 ' ')
6718         man3ext='0'
6719         ;;
6720 *)
6721         rp="What suffix should be used for the $package library man pages?"
6722         case "$man3ext" in
6723         '')     case "$man3dir" in
6724                 *3)  dflt=3 ;;
6725                 *3p) dflt=3p ;;
6726                 *3pm) dflt=3pm ;;
6727                 *l) dflt=l;;
6728                 *n) dflt=n;;
6729                 *o) dflt=o;;
6730                 *p) dflt=p;;
6731                 *C) dflt=C;;
6732                 *L) dflt=L;;
6733                 *L3) dflt=L3;;
6734                 *) dflt=3;;
6735                 esac
6736                 ;;
6737         *)      dflt="$man3ext";;
6738         esac
6739         . ./myread
6740         man3ext="$ans"
6741         ;;
6742 esac
6743
6744 : see if we have to deal with yellow pages, now NIS.
6745 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6746         if $test -f /usr/etc/nibindd; then
6747                 echo " "
6748                 echo "I'm fairly confident you're on a NeXT."
6749                 echo " "
6750                 rp='Do you get the hosts file via NetInfo?'
6751                 dflt=y
6752                 case "$hostcat" in
6753                 nidump*) ;;
6754                 '') ;;
6755                 *) dflt=n;;
6756                 esac
6757                 . ./myread
6758                 case "$ans" in
6759                 y*) hostcat='nidump hosts .';;
6760                 *)      case "$hostcat" in
6761                         nidump*) hostcat='';;
6762                         esac
6763                         ;;
6764                 esac
6765         fi
6766         case "$hostcat" in
6767         nidump*) ;;
6768         *)
6769                 case "$hostcat" in
6770                 *ypcat*) dflt=y;;
6771                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6772                                 dflt=y
6773                         else
6774                                 dflt=n
6775                         fi;;
6776                 *) dflt=n;;
6777                 esac
6778                 echo " "
6779                 rp='Are you getting the hosts file via yellow pages?'
6780                 . ./myread
6781                 case "$ans" in
6782                 y*) hostcat='ypcat hosts';;
6783                 *) hostcat='cat /etc/hosts';;
6784                 esac
6785                 ;;
6786         esac
6787 fi
6788 case "$hostcat" in
6789 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6790 esac
6791 case "$groupcat" in
6792 '') test -f /etc/group && groupcat='cat /etc/group';;
6793 esac
6794 case "$passcat" in
6795 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6796 esac
6797
6798 : now get the host name
6799 echo " "
6800 echo "Figuring out host name..." >&4
6801 case "$myhostname" in
6802 '') cont=true
6803         echo 'Maybe "hostname" will work...'
6804         if tans=`sh -c hostname 2>&1` ; then
6805                 myhostname=$tans
6806                 phostname=hostname
6807                 cont=''
6808         fi
6809         ;;
6810 *) cont='';;
6811 esac
6812 if $test "$cont"; then
6813         if ./xenix; then
6814                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6815                 if tans=`cat /etc/systemid 2>&1` ; then
6816                         myhostname=$tans
6817                         phostname='cat /etc/systemid'
6818                         echo "Whadyaknow.  Xenix always was a bit strange..."
6819                         cont=''
6820                 fi
6821         elif $test -r /etc/systemid; then
6822                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6823         fi
6824 fi
6825 if $test "$cont"; then
6826         echo 'No, maybe "uuname -l" will work...'
6827         if tans=`sh -c 'uuname -l' 2>&1` ; then
6828                 myhostname=$tans
6829                 phostname='uuname -l'
6830         else
6831                 echo 'Strange.  Maybe "uname -n" will work...'
6832                 if tans=`sh -c 'uname -n' 2>&1` ; then
6833                         myhostname=$tans
6834                         phostname='uname -n'
6835                 else
6836                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6837                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6838                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6839                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6840                         else
6841                                 case "$myhostname" in
6842                                 '') echo "Does this machine have an identity crisis or something?"
6843                                         phostname='';;
6844                                 *)
6845                                         echo "Well, you said $myhostname before..."
6846                                         phostname='echo $myhostname';;
6847                                 esac
6848                         fi
6849                 fi
6850         fi
6851 fi
6852 : you do not want to know about this
6853 set $myhostname
6854 myhostname=$1
6855
6856 : verify guess
6857 if $test "$myhostname" ; then
6858         dflt=y
6859         rp='Your host name appears to be "'$myhostname'".'" Right?"
6860         . ./myread
6861         case "$ans" in
6862         y*) ;;
6863         *) myhostname='';;
6864         esac
6865 fi
6866
6867 : bad guess or no guess
6868 while $test "X$myhostname" = X ; do
6869         dflt=''
6870         rp="Please type the (one word) name of your host:"
6871         . ./myread
6872         myhostname="$ans"
6873 done
6874
6875 : translate upper to lower if necessary
6876 case "$myhostname" in
6877 *[A-Z]*)
6878         echo "(Normalizing case in your host name)"
6879         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6880         ;;
6881 esac
6882
6883 case "$myhostname" in
6884 *.*)
6885         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6886         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6887         echo "(Trimming domain name from host name--host name is now $myhostname)"
6888         ;;
6889 *) case "$mydomain" in
6890         '')
6891                 {
6892                         test "X$hostcat" = "Xypcat hosts" &&
6893                         ypmatch "$myhostname" hosts 2>/dev/null |\
6894                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6895                         $test -s hosts
6896                 } || {
6897                         test "X$hostcat" != "X" &&
6898                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6899                                         /[       ]$myhostname[  . ]/p" > hosts
6900                 }
6901                 tmp_re="[       . ]"
6902                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6903                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6904                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6905                         hosts | $sort | $uniq | \
6906                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6907                 case `$echo X$dflt` in
6908                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6909                         dflt=.
6910                         ;;
6911                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6912                         ;;
6913                 esac
6914                 case "$dflt" in
6915                 .)
6916                         tans=`./loc resolv.conf X /etc /usr/etc`
6917                         if $test -f "$tans"; then
6918                                 echo "(Attempting domain name extraction from $tans)"
6919                                 dflt=.`$sed -n -e 's/   / /g' \
6920                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6921                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6922                                 case "$dflt" in
6923                                 .) dflt=.`$sed -n -e 's/        / /g' \
6924                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6925                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6926                                         ;;
6927                                 esac
6928                         fi
6929                         ;;
6930                 esac
6931                 case "$dflt" in
6932                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6933                         dflt=.`sh -c domainname 2>/dev/null`
6934                         case "$dflt" in
6935                         '') dflt='.';;
6936                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6937                         esac
6938                         ;;
6939                 esac
6940                 case "$dflt" in
6941                 .) echo "(Lost all hope -- silly guess then)"
6942                         dflt='.uucp'
6943                         ;;
6944                 esac
6945                 $rm -f hosts
6946                 ;;
6947         *) dflt="$mydomain";;
6948         esac;;
6949 esac
6950 echo " "
6951 rp="What is your domain name?"
6952 . ./myread
6953 tans="$ans"
6954 case "$ans" in
6955 '') ;;
6956 .*) ;;
6957 *) tans=".$tans";;
6958 esac
6959 mydomain="$tans"
6960
6961 : translate upper to lower if necessary
6962 case "$mydomain" in
6963 *[A-Z]*)
6964         echo "(Normalizing case in your domain name)"
6965         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6966         ;;
6967 esac
6968
6969 : a little sanity check here
6970 case "$phostname" in
6971 '') ;;
6972 *)
6973         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6974         $myhostname$mydomain|$myhostname) ;;
6975         *)
6976                 case "$phostname" in
6977                 sed*)
6978                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6979                         ;;
6980                 *)
6981                         echo "(That doesn't agree with your $phostname command, by the way.)"
6982                         ;;
6983                 esac
6984         ;;
6985         esac
6986         ;;
6987 esac
6988
6989 $cat <<EOM
6990
6991 I need to get your e-mail address in Internet format if possible, i.e.
6992 something like user@host.domain. Please answer accurately since I have
6993 no easy means to double check it. The default value provided below
6994 is most probably close to reality but may not be valid from outside
6995 your organization...
6996
6997 EOM
6998 cont=x
6999 while test "$cont"; do
7000         case "$cf_email" in
7001         '') dflt="$cf_by@$myhostname$mydomain";;
7002         *) dflt="$cf_email";;
7003         esac
7004         rp='What is your e-mail address?'
7005         . ./myread
7006         cf_email="$ans"
7007         case "$cf_email" in
7008         *@*.*) cont='' ;;
7009         *)
7010                 rp='Address does not look like an Internet one.  Use it anyway?'
7011                 case "$fastread" in
7012                 yes) dflt=y ;;
7013                 *) dflt=n ;;
7014                 esac
7015                 . ./myread
7016                 case "$ans" in
7017                 y*) cont='' ;;
7018                 *) echo " " ;;
7019                 esac
7020                 ;;
7021         esac
7022 done
7023
7024 $cat <<EOM
7025
7026 If you or somebody else will be maintaining perl at your site, please
7027 fill in the correct e-mail address here so that they may be contacted
7028 if necessary. Currently, the "perlbug" program included with perl
7029 will send mail to this address in addition to perlbug@perl.com. You may
7030 enter "none" for no administrator.
7031
7032 EOM
7033 case "$perladmin" in
7034 '') dflt="$cf_email";;
7035 *) dflt="$perladmin";;
7036 esac
7037 rp='Perl administrator e-mail address'
7038 . ./myread
7039 perladmin="$ans"
7040
7041 : figure out how to guarantee perl startup
7042 case "$startperl" in
7043 '')
7044         case "$sharpbang" in
7045         *!)
7046                 $cat <<EOH
7047
7048 I can use the #! construct to start perl on your system. This will
7049 make startup of perl scripts faster, but may cause problems if you
7050 want to share those scripts and perl is not in a standard place
7051 ($binexp/perl) on all your platforms. The alternative is to force
7052 a shell by starting the script with a single ':' character.
7053
7054 EOH
7055                 dflt="$binexp/perl"
7056                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7057                 . ./myread
7058                 case "$ans" in
7059                 none)   startperl=": # use perl";;
7060                 *)      startperl="#!$ans"
7061                         if $test 30 -lt `echo "$ans" | wc -c`; then
7062                                 $cat >&4 <<EOM
7063
7064 WARNING:  Some systems limit the #! command to 32 characters.
7065 If you experience difficulty running Perl scripts with #!, try
7066 installing Perl in a directory with a shorter pathname.
7067
7068 EOM
7069                         fi ;;
7070                 esac
7071                 ;;
7072         *) startperl=": # use perl"
7073                 ;;
7074         esac
7075         ;;
7076 esac
7077 echo "I'll use $startperl to start perl scripts."
7078
7079 : figure best path for perl in scripts
7080 case "$perlpath" in
7081 '')
7082         perlpath="$binexp/perl"
7083         case "$startperl" in
7084         *!*) ;;
7085         *)
7086                 $cat <<EOH
7087
7088 I will use the "eval 'exec'" idiom to start Perl on your system.
7089 I can use the full path of your Perl binary for this purpose, but
7090 doing so may cause problems if you want to share those scripts and
7091 Perl is not always in a standard place ($binexp/perl).
7092
7093 EOH
7094                 dflt="$binexp/perl"
7095                 rp="What path shall I use in \"eval 'exec'\"?"
7096                 . ./myread
7097                 perlpath="$ans"
7098                 ;;
7099         esac
7100         ;;
7101 esac
7102 case "$startperl" in
7103 *!*)    ;;
7104 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7105 esac
7106
7107 : determine where public executable scripts go
7108 set scriptdir scriptdir
7109 eval $prefixit
7110 case "$scriptdir" in
7111 '')
7112         dflt="$bin"
7113         : guess some guesses
7114         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7115         $test -d /usr/share/bin     && dflt=/usr/share/bin
7116         $test -d /usr/local/script  && dflt=/usr/local/script
7117         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7118         $test -d $prefixexp/script  && dflt=$prefixexp/script
7119         set dflt
7120         eval $prefixup
7121         ;;
7122 *)  dflt="$scriptdir"
7123         ;;
7124 esac
7125 $cat <<EOM
7126  
7127 Some installations have a separate directory just for executable scripts so
7128 that they can mount it across multiple architectures but keep the scripts in
7129 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7130 Or you might just lump your scripts in with all your other executables.
7131  
7132 EOM
7133 fn=d~
7134 rp='Where do you keep publicly executable scripts?'
7135 . ./getfile
7136 if $test "X$ansexp" != "X$scriptdirexp"; then
7137         installscript=''
7138 fi
7139 scriptdir="$ans"
7140 scriptdirexp="$ansexp"
7141 : Change installation prefix, if necessary.
7142 if $test X"$prefix" != X"$installprefix"; then
7143         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7144 else
7145         installscript="$scriptdirexp"
7146 fi
7147
7148 : determine where site specific architecture-dependent libraries go.
7149 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7150 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7151 : sitelib may have an optional trailing /share.
7152 case "$sitearch" in
7153 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7154         dflt="$dflt/$archname"
7155         ;;
7156 *)      dflt="$sitearch"
7157         ;;
7158 esac
7159 set sitearch sitearch none
7160 eval $prefixit
7161 $cat <<EOM
7162
7163 The installation process will also create a directory for
7164 architecture-dependent site-specific extensions and modules.
7165
7166 EOM
7167 fn=d~+
7168 rp='Pathname for the site-specific architecture-dependent library files?'
7169 . ./getfile
7170 sitearch="$ans"
7171 sitearchexp="$ansexp"
7172 : Change installation prefix, if necessary.
7173 if $test X"$prefix" != X"$installprefix"; then
7174         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7175 else
7176         installsitearch="$sitearchexp"
7177 fi
7178
7179 : determine where add-on public executables go
7180 case "$sitebin" in
7181 '')     dflt=$siteprefix/bin ;;
7182 *)      dflt=$sitebin ;;
7183 esac
7184 fn=d~
7185 rp='Pathname where the add-on public executables should be installed?'
7186 . ./getfile
7187 sitebin="$ans"
7188 sitebinexp="$ansexp"
7189 : Change installation prefix, if necessary.
7190 if $test X"$prefix" != X"$installprefix"; then
7191         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7192 else
7193         installsitebin="$sitebinexp"
7194 fi
7195
7196 : see if sqrtl exists
7197 set sqrtl d_sqrtl
7198 eval $inlibc
7199
7200 case "$ccflags" in
7201 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7202 esac
7203
7204 case "$uselongdouble" in
7205 $define|true|[yY]*)     dflt='y';;
7206 *) dflt='n';;
7207 esac
7208 cat <<EOM
7209
7210 Perl can be built to take advantage of long doubles which
7211 (if available) may give more accuracy and range for floating point numbers.
7212
7213 If this doesn't make any sense to you, just accept the default '$dflt'.
7214 EOM
7215 rp='Try to use long doubles if available?'
7216 . ./myread
7217 case "$ans" in
7218 y|Y)    val="$define"   ;;
7219 *)      val="$undef"    ;;
7220 esac
7221 set uselongdouble
7222 eval $setvar
7223
7224 case "$uselongdouble" in
7225 true|[yY]*) uselongdouble="$define" ;;
7226 esac
7227
7228 case "$uselongdouble" in
7229 $define)
7230 : Look for a hint-file generated 'call-back-unit'.  If the
7231 : user has specified that long doubles should be used,
7232 : we may need to set or change some other defaults.
7233         if $test -f uselongdouble.cbu; then
7234                 echo "Your platform has some specific hints for long doubles, using them..."
7235                 . ./uselongdouble.cbu
7236         else
7237                 $cat <<EOM
7238 (Your platform doesn't have any specific hints for long doubles.)
7239 EOM
7240         fi
7241         ;;
7242 esac
7243
7244 case "$uselongdouble:$d_sqrtl" in
7245 $define:$undef)
7246                 $cat <<EOM >&4
7247
7248 *** You requested the use of long doubles but you do not seem to have
7249 *** the mathematic functions for long doubles.  I'm disabling the use
7250 *** of long doubles.
7251
7252 EOM
7253         uselongdouble=$undef
7254         ;;
7255 esac
7256
7257 case "$useperlio" in
7258 $define|true|[yY]*)     dflt='y';;
7259 *) dflt='n';;
7260 esac
7261 cat <<EOM
7262
7263 Previous version of $package used the standard IO mechanisms as defined
7264 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7265 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7266 the default.  This abstraction layer can use AT&T's sfio (if you already
7267 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7268 problems with some extension modules.  Using PerlIO with stdio is safe,
7269 but it is slower than plain stdio and therefore is not the default.
7270
7271 If this doesn't make any sense to you, just accept the default '$dflt'.
7272 EOM
7273 rp='Use the experimental PerlIO abstraction layer?'
7274 . ./myread
7275 case "$ans" in
7276 y|Y) 
7277         val="$define"
7278         ;;     
7279 *)      
7280         echo "Ok, doing things the stdio way"
7281         val="$undef"
7282         ;;
7283 esac
7284 set useperlio
7285 eval $setvar 
7286
7287 case "$vendorprefix" in
7288 '')     d_vendorbin="$undef"
7289         vendorbin=''
7290         vendorbinexp=''
7291         ;;
7292 *)      d_vendorbin="$define"
7293         : determine where vendor-supplied executables go.
7294         case "$vendorbin" in
7295         '') dflt=$vendorprefix/bin ;;
7296         *)      dflt="$vendorbin" ;;
7297         esac
7298         fn=d~+
7299         rp='Pathname for the vendor-supplied executables directory?'
7300         . ./getfile
7301         vendorbin="$ans"
7302         vendorbinexp="$ansexp"
7303         ;;
7304 esac
7305 : Change installation prefix, if necessary.
7306 if $test X"$prefix" != X"$installprefix"; then
7307         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7308 else
7309         installvendorbin="$vendorbinexp"
7310 fi
7311
7312 : see if qgcvt exists
7313 set qgcvt d_qgcvt
7314 eval $inlibc
7315
7316 : check for length of double
7317 echo " "
7318 case "$doublesize" in
7319 '')
7320         echo "Checking to see how big your double precision numbers are..." >&4
7321         $cat >try.c <<'EOCP'
7322 #include <stdio.h>
7323 int main()
7324 {
7325     printf("%d\n", (int)sizeof(double));
7326     exit(0);
7327 }
7328 EOCP
7329         set try
7330         if eval $compile_ok; then
7331                 doublesize=`./try`
7332                 echo "Your double is $doublesize bytes long."
7333         else
7334                 dflt='8'
7335                 echo "(I can't seem to compile the test program.  Guessing...)"
7336                 rp="What is the size of a double precision number (in bytes)?"
7337                 . ./myread
7338                 doublesize="$ans"
7339         fi
7340         ;;
7341 esac
7342 $rm -f try.c try
7343
7344 : check for long doubles
7345 echo " "
7346 echo "Checking to see if you have long double..." >&4
7347 echo 'int main() { long double x = 7.0; }' > try.c
7348 set try
7349 if eval $compile; then
7350         val="$define"
7351         echo "You have long double."
7352 else
7353         val="$undef"
7354         echo "You do not have long double."
7355 fi
7356 $rm try.*
7357 set d_longdbl
7358 eval $setvar
7359
7360 : check for length of long double
7361 case "${d_longdbl}${longdblsize}" in
7362 $define)
7363         echo " "
7364         echo "Checking to see how big your long doubles are..." >&4
7365         $cat >try.c <<'EOCP'
7366 #include <stdio.h>
7367 int main()
7368 {
7369         printf("%d\n", sizeof(long double));
7370 }
7371 EOCP
7372         set try
7373         set try
7374         if eval $compile; then
7375                 longdblsize=`./try$exe_ext`
7376                 echo "Your long doubles are $longdblsize bytes long."
7377         else
7378                 dflt='8'
7379                 echo " "
7380                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7381                 rp="What is the size of a long double (in bytes)?"
7382                 . ./myread
7383                 longdblsize="$ans"
7384         fi
7385         if $test "X$doublesize" = "X$longdblsize"; then
7386                 echo "(That isn't any different from an ordinary double.)"
7387         fi      
7388         ;;
7389 esac
7390 $rm -f try.* try
7391
7392 echo " "
7393
7394 if $test X"$d_longdbl" = X"$define"; then
7395
7396 echo "Checking how to print long doubles..." >&4
7397
7398 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7399         $cat >try.c <<'EOCP'
7400 #include <sys/types.h>
7401 #include <stdio.h>
7402 int main() {
7403   double d = 123.456;
7404   printf("%.3f\n", d);
7405 }
7406 EOCP
7407         set try
7408         if eval $compile; then
7409                 yyy=`./try$exe_ext`
7410                 case "$yyy" in
7411                 123.456)
7412                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7413                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7414                         echo "We will use %f."
7415                         ;;
7416                 esac
7417         fi
7418 fi
7419
7420 if $test X"$sPRIfldbl" = X; then
7421         $cat >try.c <<'EOCP'
7422 #include <sys/types.h>
7423 #include <stdio.h>
7424 int main() {
7425   long double d = 123.456;
7426   printf("%.3llf\n", d);
7427 }
7428 EOCP
7429         set try
7430         if eval $compile; then
7431                 yyy=`./try$exe_ext`
7432                 case "$yyy" in
7433                 123.456)
7434                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7435                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7436                         echo "We will use %llf."
7437                         ;;
7438                 esac
7439         fi
7440 fi
7441
7442 if $test X"$sPRIfldbl" = X; then
7443         $cat >try.c <<'EOCP'
7444 #include <sys/types.h>
7445 #include <stdio.h>
7446 int main() {
7447   long double d = 123.456;
7448   printf("%.3Lf\n", d);
7449 }
7450 EOCP
7451         set try
7452         if eval $compile; then
7453                 yyy=`./try$exe_ext`
7454                 case "$yyy" in
7455                 123.456)
7456                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7457                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7458                         echo "We will use %Lf."
7459                         ;;
7460                 esac
7461         fi
7462 fi
7463
7464 if $test X"$sPRIfldbl" = X; then
7465         $cat >try.c <<'EOCP'
7466 #include <sys/types.h>
7467 #include <stdio.h>
7468 int main() {
7469   long double d = 123.456;
7470   printf("%.3lf\n", d);
7471 }
7472 EOCP
7473         set try
7474         if eval $compile; then
7475                 yyy=`./try$exe_ext`
7476                 case "$yyy" in
7477                 123.456)
7478                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7479                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7480                         echo "We will use %lf."
7481                         ;;
7482                 esac
7483         fi
7484 fi
7485
7486 if $test X"$sPRIfldbl" = X; then
7487         echo "Cannot figure out how to print long doubles." >&4
7488 fi
7489
7490 $rm -f try try.*
7491
7492 fi # d_longdbl
7493
7494 case "$sPRIfldbl" in
7495 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7496         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7497         ;;
7498 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7499         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7500         ;;
7501 esac
7502
7503 : Check how to convert floats to strings.
7504 if test "X$d_Gconvert" = X; then
7505         echo " "
7506         echo "Checking for an efficient way to convert floats to strings."
7507         echo " " > try.c
7508         case "$uselongdouble" in
7509         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7510         esac
7511         case "$d_longdbl" in
7512         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7513         esac
7514         case "$d_PRIgldbl" in
7515         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7516         esac
7517         $cat >>try.c <<EOP
7518 #ifdef TRY_gconvert
7519 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7520 char *myname = "gconvert";
7521 #endif
7522 #ifdef TRY_gcvt
7523 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7524 char *myname = "gcvt";
7525 #endif
7526 #ifdef TRY_qgcvt
7527 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7528 char *myname = "qgcvt";
7529 #define DOUBLETYPE long double
7530 #endif
7531 #ifdef TRY_sprintf
7532 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7533 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7534 #else
7535 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7536 #endif
7537 char *myname = "sprintf";
7538 #endif
7539
7540 #ifndef DOUBLETYPE
7541 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7542 #define DOUBLETYPE long double
7543 #else
7544 #define DOUBLETYPE double
7545 #endif
7546 #endif
7547
7548 #include <stdio.h>
7549
7550 #define I_STDLIB $i_stdlib
7551 #ifdef I_STDLIB
7552 #include <stdlib.h>
7553 #endif
7554
7555 int
7556 checkit(expect, got)
7557 char *expect;
7558 char *got;
7559 {
7560     if (strcmp(expect, got)) {
7561                 printf("%s oddity:  Expected %s, got %s\n",
7562                         myname, expect, got);
7563                 exit(1);
7564         }
7565 }
7566
7567 int main()
7568
7569         char buf[64]; 
7570         buf[63] = '\0';
7571
7572         /* This must be 1st test on (which?) platform */
7573         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7574         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7575         checkit("0.1", buf);
7576
7577         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7578         checkit("1", buf);
7579
7580         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7581         checkit("1.1", buf);
7582
7583         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7584         checkit("1.01", buf);
7585
7586         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7587         checkit("1.001", buf);
7588
7589         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7590         checkit("1.0001", buf);
7591
7592         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7593         checkit("1.00001", buf);
7594
7595         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7596         checkit("1.000001", buf);
7597
7598         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7599         checkit("0", buf);
7600
7601         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7602         checkit("-1", buf);
7603
7604         /* Some Linux gcvt's give 1.e+5 here. */
7605         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7606         checkit("100000", buf);
7607         
7608         /* Some Linux gcvt's give -1.e+5 here. */
7609         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7610         checkit("-100000", buf);
7611
7612         exit(0);
7613 }
7614 EOP
7615         case "$d_Gconvert" in
7616         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7617         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7618         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7619         *) xxx_list='gconvert gcvt sprintf' ;;
7620         esac
7621
7622         case "$d_longdbl$uselongdouble$d_qgcvt" in
7623         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7624         esac
7625
7626         for xxx_convert in $xxx_list; do
7627                 echo "Trying $xxx_convert..."
7628                 $rm -f try try$_o
7629                 set try -DTRY_$xxx_convert
7630                 if eval $compile; then
7631                         echo "$xxx_convert() found." >&4
7632                         if ./try; then
7633                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7634                                 break;
7635                         else
7636                                 echo "...But $xxx_convert didn't work as I expected."
7637                         fi
7638                 else
7639                         echo "$xxx_convert NOT found." >&4
7640                 fi
7641         done
7642                 
7643         case "$xxx_convert" in
7644         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7645         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7646         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7647         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7648            "$define$define$define")
7649               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7650            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7651            esac
7652            ;;  
7653         esac
7654 fi
7655
7656 : Initialize h_fcntl
7657 h_fcntl=false
7658
7659 : Initialize h_sysfile
7660 h_sysfile=false
7661
7662 : access call always available on UNIX
7663 set access d_access
7664 eval $inlibc
7665
7666 : locate the flags for 'access()'
7667 case "$d_access" in
7668 "$define")
7669         echo " "
7670         $cat >access.c <<'EOCP'
7671 #include <sys/types.h>
7672 #ifdef I_FCNTL
7673 #include <fcntl.h>
7674 #endif
7675 #ifdef I_SYS_FILE
7676 #include <sys/file.h>
7677 #endif
7678 #ifdef I_UNISTD
7679 #include <unistd.h>
7680 #endif
7681 int main() {
7682         exit(R_OK);
7683 }
7684 EOCP
7685         : check sys/file.h first, no particular reason here
7686         if $test `./findhdr sys/file.h` && \
7687                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7688                 h_sysfile=true;
7689                 echo "<sys/file.h> defines the *_OK access constants." >&4
7690         elif $test `./findhdr fcntl.h` && \
7691                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7692                 h_fcntl=true;
7693                 echo "<fcntl.h> defines the *_OK access constants." >&4
7694         elif $test `./findhdr unistd.h` && \
7695                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7696                 echo "<unistd.h> defines the *_OK access constants." >&4
7697         else
7698                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7699         fi
7700         ;;
7701 esac
7702 $rm -f access*
7703
7704 : see if accessx exists
7705 set accessx d_accessx
7706 eval $inlibc
7707
7708 : see if alarm exists
7709 set alarm d_alarm
7710 eval $inlibc
7711
7712 : see if atolf exists
7713 set atolf d_atolf
7714 eval $inlibc
7715
7716 : see if atoll exists
7717 set atoll d_atoll
7718 eval $inlibc
7719
7720 : Look for GNU-cc style attribute checking
7721 echo " "
7722 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7723 $cat >attrib.c <<'EOCP'
7724 #include <stdio.h>
7725 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7726 EOCP
7727 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7728         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7729                 echo "Your C compiler doesn't fully support __attribute__."
7730                 val="$undef"
7731         else
7732                 echo "Your C compiler supports __attribute__."
7733                 val="$define"
7734         fi
7735 else
7736         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7737         val="$undef"
7738 fi
7739 set d_attribut
7740 eval $setvar
7741 $rm -f attrib*
7742
7743 : see if bcmp exists
7744 set bcmp d_bcmp
7745 eval $inlibc
7746
7747 : see if bcopy exists
7748 set bcopy d_bcopy
7749 eval $inlibc
7750
7751 : see if this is a unistd.h system
7752 set unistd.h i_unistd
7753 eval $inhdr
7754
7755 : see if getpgrp exists
7756 set getpgrp d_getpgrp
7757 eval $inlibc
7758
7759 case "$d_getpgrp" in
7760 "$define")
7761         echo " "
7762         echo "Checking to see which flavor of getpgrp is in use..."
7763         $cat >set.c <<EOP
7764 #$i_unistd I_UNISTD
7765 #include <sys/types.h>
7766 #ifdef I_UNISTD
7767 #  include <unistd.h>
7768 #endif
7769 int main()
7770 {
7771         if (getuid() == 0) {
7772                 printf("(I see you are running Configure as super-user...)\n");
7773                 setuid(1);
7774         }
7775 #ifdef TRY_BSD_PGRP
7776         if (getpgrp(1) == 0)
7777                 exit(0);
7778 #else
7779         if (getpgrp() > 0)
7780                 exit(0);
7781 #endif
7782         exit(1);
7783 }
7784 EOP
7785         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7786                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7787                 val="$define"
7788         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7789                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7790                 val="$undef"
7791         else
7792                 echo "I can't seem to compile and run the test program."
7793                 if ./usg; then
7794                         xxx="a USG one, i.e. you use getpgrp()."
7795                 else
7796                         # SVR4 systems can appear rather BSD-ish.
7797                         case "$i_unistd" in
7798                         $undef)
7799                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7800                                 val="$define"
7801                                 ;;
7802                         $define)
7803                                 xxx="probably a USG one, i.e. you use getpgrp()."
7804                                 val="$undef"
7805                                 ;;
7806                         esac
7807                 fi
7808                 echo "Assuming your getpgrp is $xxx" >&4
7809         fi
7810         ;;
7811 *) val="$undef";;
7812 esac
7813 set d_bsdgetpgrp
7814 eval $setvar
7815 $rm -f set set.c
7816
7817 : see if setpgrp exists
7818 set setpgrp d_setpgrp
7819 eval $inlibc
7820
7821 case "$d_setpgrp" in
7822 "$define")
7823         echo " "
7824         echo "Checking to see which flavor of setpgrp is in use..."
7825         $cat >set.c <<EOP
7826 #$i_unistd I_UNISTD
7827 #include <sys/types.h>
7828 #ifdef I_UNISTD
7829 #  include <unistd.h>
7830 #endif
7831 int main()
7832 {
7833         if (getuid() == 0) {
7834                 printf("(I see you are running Configure as super-user...)\n");
7835                 setuid(1);
7836         }
7837 #ifdef TRY_BSD_PGRP
7838         if (-1 == setpgrp(1, 1))
7839                 exit(0);
7840 #else
7841         if (setpgrp() != -1)
7842                 exit(0);
7843 #endif
7844         exit(1);
7845 }
7846 EOP
7847         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7848                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7849                 val="$define"
7850         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7851                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7852                 val="$undef"
7853         else
7854                 echo "(I can't seem to compile and run the test program.)"
7855                 if ./usg; then
7856                         xxx="a USG one, i.e. you use setpgrp()."
7857                 else
7858                         # SVR4 systems can appear rather BSD-ish.
7859                         case "$i_unistd" in
7860                         $undef)
7861                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7862                                 val="$define"
7863                                 ;;
7864                         $define)
7865                                 xxx="probably a USG one, i.e. you use setpgrp()."
7866                                 val="$undef"
7867                                 ;;
7868                         esac
7869                 fi
7870                 echo "Assuming your setpgrp is $xxx" >&4
7871         fi
7872         ;;
7873 *) val="$undef";;
7874 esac
7875 set d_bsdsetpgrp
7876 eval $setvar
7877 $rm -f set set.c
7878 : see if bzero exists
7879 set bzero d_bzero
7880 eval $inlibc
7881
7882 : see if signal is declared as pointer to function returning int or void
7883 echo " "
7884 xxx=`./findhdr signal.h`
7885 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7886 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7887         echo "You have int (*signal())() instead of void." >&4
7888         val="$undef"
7889 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7890         echo "You have void (*signal())()." >&4
7891         val="$define"
7892 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7893         echo "You have int (*signal())() instead of void." >&4
7894         val="$undef"
7895 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7896         echo "You have void (*signal())()." >&4
7897         val="$define"
7898 else
7899         case "$d_voidsig" in
7900         '')
7901         echo "I can't determine whether signal handler returns void or int..." >&4
7902                 dflt=void
7903                 rp="What type does your signal handler return?"
7904                 . ./myread
7905                 case "$ans" in
7906                 v*) val="$define";;
7907                 *) val="$undef";;
7908                 esac;;
7909         "$define")
7910                 echo "As you already told me, signal handler returns void." >&4
7911                 val="$define"
7912                 ;;
7913         *)      echo "As you already told me, signal handler returns int." >&4
7914                 val="$undef"
7915                 ;;
7916         esac
7917 fi
7918 set d_voidsig
7919 eval $setvar
7920 case "$d_voidsig" in
7921 "$define") signal_t="void";;
7922 *) signal_t="int";;
7923 esac
7924 $rm -f $$.tmp
7925
7926 : check for ability to cast large floats to 32-bit ints.
7927 echo " "
7928 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7929 if $test "$intsize" -ge 4; then
7930         xxx=int
7931 else
7932         xxx=long
7933 fi
7934 $cat >try.c <<EOCP
7935 #include <stdio.h>
7936 #include <sys/types.h>
7937 #include <signal.h>
7938 $signal_t blech(s) int s; { exit(3); }
7939 int main()
7940 {
7941         $xxx i32;
7942         double f, g;
7943         int result = 0;
7944         char str[16];
7945         signal(SIGFPE, blech);
7946
7947         /* Don't let compiler optimize the test away.  Store the number 
7948            in a writable string for gcc to pass to sscanf under HP/UX.
7949         */
7950         sprintf(str, "2147483647");
7951         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7952         g = 10 * f;
7953         i32  = ($xxx) g;
7954
7955         /* x86 processors will probably give 0x8000 0000, which is a
7956        sign change.  We don't want that.  We want to mimic SPARC
7957            behavior here, which is to preserve the sign and give
7958            back 0x7fff ffff.
7959         */
7960         if (i32 != ($xxx) f)
7961                 result |= 1;
7962         exit(result);
7963 }
7964 EOCP
7965 set try
7966 if eval $compile_ok; then
7967         ./try
7968         yyy=$?
7969 else
7970         echo "(I can't seem to compile the test program--assuming it can't)"
7971         yyy=1
7972 fi
7973 case "$yyy" in
7974 0)      val="$define"
7975         echo "Yup, it can."
7976         ;;
7977 *)      val="$undef"
7978         echo "Nope, it can't."
7979         ;;
7980 esac
7981 set d_casti32
7982 eval $setvar
7983 $rm -f try try.*
7984
7985 : check for ability to cast negative floats to unsigned
7986 echo " "
7987 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7988 $cat >try.c <<EOCP
7989 #include <stdio.h>
7990 #include <sys/types.h>
7991 #include <signal.h>
7992 $signal_t blech(s) int s; { exit(7); }
7993 $signal_t blech_in_list(s) int s; { exit(4); }
7994 unsigned long dummy_long(p) unsigned long p; { return p; }
7995 unsigned int dummy_int(p) unsigned int p; { return p; }
7996 unsigned short dummy_short(p) unsigned short p; { return p; }
7997 int main()
7998 {
7999         double f;
8000         unsigned long along;
8001         unsigned int aint;
8002         unsigned short ashort;
8003         int result = 0;
8004         char str[16];
8005         
8006         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8007            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8008            optimized the whole file away
8009         */
8010         /* Store the number in a writable string for gcc to pass to 
8011            sscanf under HP/UX.
8012         */
8013         sprintf(str, "-123");
8014         sscanf(str, "%lf", &f);  /* f = -123.; */
8015
8016         signal(SIGFPE, blech);
8017         along = (unsigned long)f;
8018         aint = (unsigned int)f;
8019         ashort = (unsigned short)f;
8020         if (along != (unsigned long)-123)
8021                 result |= 1;
8022         if (aint != (unsigned int)-123)
8023                 result |= 1;
8024         if (ashort != (unsigned short)-123)
8025                 result |= 1;
8026         sprintf(str, "1073741824.");
8027         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8028         f = f + f;
8029         along = 0;
8030         along = (unsigned long)f;
8031         if (along != 0x80000000)
8032                 result |= 2;
8033         f -= 1.;
8034         along = 0;
8035         along = (unsigned long)f;
8036         if (along != 0x7fffffff)
8037                 result |= 1;
8038         f += 2.;
8039         along = 0;
8040         along = (unsigned long)f;
8041         if (along != 0x80000001)
8042                 result |= 2;
8043         if (result)
8044                 exit(result);
8045         signal(SIGFPE, blech_in_list);
8046         sprintf(str, "123.");
8047         sscanf(str, "%lf", &f);  /* f = 123.; */
8048         along = dummy_long((unsigned long)f);
8049         aint = dummy_int((unsigned int)f);
8050         ashort = dummy_short((unsigned short)f);
8051         if (along != (unsigned long)123)
8052                 result |= 4;
8053         if (aint != (unsigned int)123)
8054                 result |= 4;
8055         if (ashort != (unsigned short)123)
8056                 result |= 4;
8057         exit(result);
8058
8059 }
8060 EOCP
8061 set try
8062 if eval $compile_ok; then
8063         ./try
8064         castflags=$?
8065 else
8066         echo "(I can't seem to compile the test program--assuming it can't)"
8067         castflags=7
8068 fi
8069 case "$castflags" in
8070 0)      val="$define"
8071         echo "Yup, it can."
8072         ;;
8073 *)      val="$undef"
8074         echo "Nope, it can't."
8075         ;;
8076 esac
8077 set d_castneg
8078 eval $setvar
8079 $rm -f try.*
8080
8081 : see if vprintf exists
8082 echo " "
8083 if set vprintf val -f d_vprintf; eval $csym; $val; then
8084         echo 'vprintf() found.' >&4
8085         val="$define"
8086         $cat >vprintf.c <<'EOF'
8087 #include <varargs.h>
8088
8089 int main() { xxx("foo"); }
8090
8091 xxx(va_alist)
8092 va_dcl
8093 {
8094         va_list args;
8095         char buf[10];
8096
8097         va_start(args);
8098         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8099 }
8100 EOF
8101         set vprintf
8102         if eval $compile && ./vprintf; then
8103                 echo "Your vsprintf() returns (int)." >&4
8104                 val2="$undef"
8105         else
8106                 echo "Your vsprintf() returns (char*)." >&4
8107                 val2="$define"
8108         fi
8109 else
8110         echo 'vprintf() NOT found.' >&4
8111                 val="$undef"
8112                 val2="$undef"
8113 fi
8114 set d_vprintf
8115 eval $setvar
8116 val=$val2
8117 set d_charvspr
8118 eval $setvar
8119
8120 : see if chown exists
8121 set chown d_chown
8122 eval $inlibc
8123
8124 : see if chroot exists
8125 set chroot d_chroot
8126 eval $inlibc
8127
8128 : see if chsize exists
8129 set chsize d_chsize
8130 eval $inlibc
8131
8132 : check for const keyword
8133 echo " "
8134 echo 'Checking to see if your C compiler knows about "const"...' >&4
8135 $cat >const.c <<'EOCP'
8136 typedef struct spug { int drokk; } spug;
8137 int main()
8138 {
8139         const char *foo;
8140         const spug y;
8141 }
8142 EOCP
8143 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8144         val="$define"
8145         echo "Yup, it does."
8146 else
8147         val="$undef"
8148         echo "Nope, it doesn't."
8149 fi
8150 set d_const
8151 eval $setvar
8152
8153 : see if crypt exists
8154 echo " "
8155 if set crypt val -f d_crypt; eval $csym; $val; then
8156         echo 'crypt() found.' >&4
8157         val="$define"
8158         cryptlib=''
8159 else
8160         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8161         if $test -z "$cryptlib"; then
8162                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8163         else
8164                 cryptlib=-lcrypt
8165         fi
8166         if $test -z "$cryptlib"; then
8167                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8168         else
8169                 cryptlib=-lcrypt
8170         fi
8171         if $test -z "$cryptlib"; then
8172                 cryptlib=`./loc libcrypt$_a "" $libpth`
8173         else
8174                 cryptlib=-lcrypt
8175         fi
8176         if $test -z "$cryptlib"; then
8177                 echo 'crypt() NOT found.' >&4
8178                 val="$undef"
8179         else
8180                 val="$define"
8181         fi
8182 fi
8183 set d_crypt
8184 eval $setvar
8185
8186 : get csh whereabouts
8187 case "$csh" in
8188 'csh') val="$undef" ;;
8189 *) val="$define" ;;
8190 esac
8191 set d_csh
8192 eval $setvar
8193 : Respect a hint or command line value for full_csh.
8194 case "$full_csh" in
8195 '') full_csh=$csh ;;
8196 esac
8197
8198 : see if cuserid exists
8199 set cuserid d_cuserid
8200 eval $inlibc
8201
8202 : see if this is a limits.h system
8203 set limits.h i_limits
8204 eval $inhdr
8205
8206 : see if this is a float.h system
8207 set float.h i_float
8208 eval $inhdr
8209
8210 : See if number of significant digits in a double precision number is known
8211 echo " "
8212 $cat >dbl_dig.c <<EOM
8213 #$i_limits I_LIMITS
8214 #$i_float I_FLOAT
8215 #ifdef I_LIMITS
8216 #include <limits.h>
8217 #endif
8218 #ifdef I_FLOAT
8219 #include <float.h>
8220 #endif
8221 #ifdef DBL_DIG
8222 printf("Contains DBL_DIG");
8223 #endif
8224 EOM
8225 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8226 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8227         echo "DBL_DIG found." >&4
8228         val="$define"
8229 else
8230         echo "DBL_DIG NOT found." >&4
8231         val="$undef"
8232 fi
8233 $rm -f dbl_dig.?
8234 set d_dbl_dig
8235 eval $setvar
8236
8237 : see if difftime exists
8238 set difftime d_difftime
8239 eval $inlibc
8240
8241 : see if this is a dirent system
8242 echo " "
8243 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8244         val="$define"
8245         echo "<dirent.h> found." >&4
8246 else
8247         val="$undef"
8248         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8249                 echo "<sys/dir.h> found." >&4
8250                 echo " "
8251         else
8252                 xinc=`./findhdr sys/ndir.h`
8253         fi
8254         echo "<dirent.h> NOT found." >&4
8255 fi
8256 set i_dirent
8257 eval $setvar
8258
8259 : Look for type of directory structure.
8260 echo " "
8261 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8262
8263 case "$direntrytype" in
8264 ''|' ')
8265         case "$i_dirent" in
8266         $define) guess1='struct dirent' ;;
8267         *) guess1='struct direct'  ;;
8268         esac
8269         ;;
8270 *)      guess1="$direntrytype"
8271         ;;
8272 esac
8273
8274 case "$guess1" in
8275 'struct dirent') guess2='struct direct' ;;
8276 *) guess2='struct dirent' ;;
8277 esac
8278                 
8279 if $contains "$guess1" try.c >/dev/null 2>&1; then
8280         direntrytype="$guess1"
8281         echo "Your directory entries are $direntrytype." >&4
8282 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8283         direntrytype="$guess2"
8284         echo "Your directory entries seem to be $direntrytype." >&4
8285 else
8286         echo "I don't recognize your system's directory entries." >&4
8287         rp="What type is used for directory entries on this system?"
8288         dflt="$guess1"
8289         . ./myread
8290         direntrytype="$ans"
8291 fi
8292 $rm -f try.c
8293
8294
8295 : see if the directory entry stores field length
8296 echo " "
8297 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8298 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8299         echo "Good, your directory entry keeps length information in d_namlen." >&4
8300         val="$define"
8301 else
8302         echo "Your directory entry does not know about the d_namlen field." >&4
8303         val="$undef"
8304 fi
8305 set d_dirnamlen
8306 eval $setvar
8307 $rm -f try.c
8308
8309 : see if dlerror exists
8310 xxx_runnm="$runnm"
8311 runnm=false
8312 set dlerror d_dlerror
8313 eval $inlibc
8314 runnm="$xxx_runnm"
8315
8316 : see if dlfcn is available
8317 set dlfcn.h i_dlfcn
8318 eval $inhdr
8319
8320 case "$usedl" in
8321 $define|y|true)
8322         $cat << EOM
8323
8324 On a few systems, the dynamically loaded modules that perl generates and uses
8325 will need a different extension than shared libs. The default will probably
8326 be appropriate.
8327
8328 EOM
8329         case "$dlext" in
8330         '')     dflt="$so" ;;
8331         *)      dflt="$dlext" ;;
8332         esac
8333         rp='What is the extension of dynamically loaded modules'
8334         . ./myread
8335         dlext="$ans"
8336         ;;
8337 *)
8338         dlext="none"
8339         ;;
8340 esac
8341
8342 : Check if dlsym need a leading underscore
8343 echo " "
8344 val="$undef"
8345
8346 case "$dlsrc" in
8347 dl_dlopen.xs)
8348         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8349         $cat >dyna.c <<'EOM'
8350 fred () { }
8351 EOM
8352
8353 $cat >fred.c<<EOM
8354
8355 #include <stdio.h>
8356 #$i_dlfcn I_DLFCN
8357 #ifdef I_DLFCN
8358 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8359 #else
8360 #include <sys/types.h>
8361 #include <nlist.h>
8362 #include <link.h>
8363 #endif
8364
8365 extern int fred() ;
8366
8367 int main()
8368 {
8369     void * handle ;
8370     void * symbol ;
8371 #ifndef RTLD_LAZY
8372     int mode = 1 ;
8373 #else
8374     int mode = RTLD_LAZY ;
8375 #endif
8376     handle = dlopen("./dyna.$dlext", mode) ;
8377     if (handle == NULL) {
8378         printf ("1\n") ;
8379         fflush (stdout) ;
8380         exit(0);
8381     }
8382     symbol = dlsym(handle, "fred") ;
8383     if (symbol == NULL) {
8384         /* try putting a leading underscore */
8385         symbol = dlsym(handle, "_fred") ;
8386         if (symbol == NULL) {
8387             printf ("2\n") ;
8388             fflush (stdout) ;
8389             exit(0);
8390         }
8391         printf ("3\n") ;
8392     }
8393     else
8394         printf ("4\n") ;
8395     fflush (stdout) ;
8396     exit(0);
8397 }
8398 EOM
8399         : Call the object file tmp-dyna.o in case dlext=o.
8400         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8401                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8402                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8403                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8404                 xxx=`./fred`
8405                 case $xxx in
8406                 1)      echo "Test program failed using dlopen." >&4
8407                         echo "Perhaps you should not use dynamic loading." >&4;;
8408                 2)      echo "Test program failed using dlsym." >&4
8409                         echo "Perhaps you should not use dynamic loading." >&4;;
8410                 3)      echo "dlsym needs a leading underscore" >&4
8411                         val="$define" ;;
8412                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8413                 esac
8414         else
8415                 echo "I can't compile and run the test program." >&4
8416                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8417         fi
8418         ;;
8419 esac
8420                 
8421 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8422
8423 set d_dlsymun
8424 eval $setvar
8425
8426 hasproto='varname=$1; func=$2; shift; shift;
8427 while $test $# -ge 2; do
8428         case "$1" in
8429         $define) echo "#include <$2>";;
8430         esac ;
8431     shift 2;
8432 done > try.c;
8433 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8434 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8435         echo "$func() prototype found.";
8436         val="$define";
8437 else
8438         echo "$func() prototype NOT found.";
8439         val="$undef";
8440 fi;
8441 set $varname;
8442 eval $setvar;
8443 $rm -f try.c tryout.c'
8444
8445 : see if prototype for drand48 is available
8446 echo " "
8447 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8448 eval $hasproto
8449
8450 : see if dup2 exists
8451 set dup2 d_dup2
8452 eval $inlibc
8453
8454 : see if eaccess exists
8455 set eaccess d_eaccess
8456 eval $inlibc
8457
8458 : see if endgrent exists
8459 set endgrent d_endgrent
8460 eval $inlibc
8461
8462 : see if endhostent exists
8463 set endhostent d_endhent
8464 eval $inlibc
8465
8466 : see if endnetent exists
8467 set endnetent d_endnent
8468 eval $inlibc
8469
8470 : see if endprotoent exists
8471 set endprotoent d_endpent
8472 eval $inlibc
8473
8474 : see if endpwent exists
8475 set endpwent d_endpwent
8476 eval $inlibc
8477
8478 : see if endservent exists
8479 set endservent d_endsent
8480 eval $inlibc
8481
8482 : see if endspent exists
8483 set endspent d_endspent
8484 eval $inlibc
8485
8486 : Locate the flags for 'open()'
8487 echo " "
8488 $cat >open3.c <<'EOCP'
8489 #include <sys/types.h>
8490 #ifdef I_FCNTL
8491 #include <fcntl.h>
8492 #endif
8493 #ifdef I_SYS_FILE
8494 #include <sys/file.h>
8495 #endif
8496 int main() {
8497         if(O_RDONLY);
8498 #ifdef O_TRUNC
8499         exit(0);
8500 #else
8501         exit(1);
8502 #endif
8503 }
8504 EOCP
8505 : check sys/file.h first to get FREAD on Sun
8506 if $test `./findhdr sys/file.h` && \
8507                 set open3 -DI_SYS_FILE && eval $compile; then
8508         h_sysfile=true;
8509         echo "<sys/file.h> defines the O_* constants..." >&4
8510         if ./open3; then
8511                 echo "and you have the 3 argument form of open()." >&4
8512                 val="$define"
8513         else
8514                 echo "but not the 3 argument form of open().  Oh, well." >&4
8515                 val="$undef"
8516         fi
8517 elif $test `./findhdr fcntl.h` && \
8518                 set open3 -DI_FCNTL && eval $compile; then
8519         h_fcntl=true;
8520         echo "<fcntl.h> defines the O_* constants..." >&4
8521         if ./open3; then
8522                 echo "and you have the 3 argument form of open()." >&4
8523                 val="$define"
8524         else
8525                 echo "but not the 3 argument form of open().  Oh, well." >&4
8526                 val="$undef"
8527         fi
8528 else
8529         val="$undef"
8530         echo "I can't find the O_* constant definitions!  You got problems." >&4
8531 fi
8532 set d_open3
8533 eval $setvar
8534 $rm -f open3*
8535
8536 : see which of string.h or strings.h is needed
8537 echo " "
8538 strings=`./findhdr string.h`
8539 if $test "$strings" && $test -r "$strings"; then
8540         echo "Using <string.h> instead of <strings.h>." >&4
8541         val="$define"
8542 else
8543         val="$undef"
8544         strings=`./findhdr strings.h`
8545         if $test "$strings" && $test -r "$strings"; then
8546                 echo "Using <strings.h> instead of <string.h>." >&4
8547         else
8548                 echo "No string header found -- You'll surely have problems." >&4
8549         fi
8550 fi
8551 set i_string
8552 eval $setvar
8553 case "$i_string" in
8554 "$undef") strings=`./findhdr strings.h`;;
8555 *)        strings=`./findhdr string.h`;;
8556 esac
8557
8558 : check for non-blocking I/O stuff
8559 case "$h_sysfile" in
8560 true) echo "#include <sys/file.h>" > head.c;;
8561 *)
8562         case "$h_fcntl" in
8563         true) echo "#include <fcntl.h>" > head.c;;
8564         *) echo "#include <sys/fcntl.h>" > head.c;;
8565         esac
8566         ;;
8567 esac
8568 echo " "
8569 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8570 case "$o_nonblock" in
8571 '')
8572         $cat head.c > try.c
8573         $cat >>try.c <<'EOCP'
8574 #include <stdio.h>
8575 int main() {
8576 #ifdef O_NONBLOCK
8577         printf("O_NONBLOCK\n");
8578         exit(0);
8579 #endif
8580 #ifdef O_NDELAY
8581         printf("O_NDELAY\n");
8582         exit(0);
8583 #endif
8584 #ifdef FNDELAY
8585         printf("FNDELAY\n");
8586         exit(0);
8587 #endif
8588         exit(0);
8589 }
8590 EOCP
8591         set try
8592         if eval $compile_ok; then
8593                 o_nonblock=`./try`
8594                 case "$o_nonblock" in
8595                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8596                 *) echo "Seems like we can use $o_nonblock.";;
8597                 esac
8598         else
8599                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8600         fi
8601         ;;
8602 *) echo "Using $hint value $o_nonblock.";;
8603 esac
8604 $rm -f try try.* .out core
8605
8606 echo " "
8607 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8608 case "$eagain" in
8609 '')
8610         $cat head.c > try.c
8611         $cat >>try.c <<EOCP
8612 #include <errno.h>
8613 #include <sys/types.h>
8614 #include <signal.h>
8615 #include <stdio.h> 
8616 #define MY_O_NONBLOCK $o_nonblock
8617 #ifndef errno  /* XXX need better Configure test */
8618 extern int errno;
8619 #endif
8620 #$i_unistd I_UNISTD
8621 #ifdef I_UNISTD
8622 #include <unistd.h>
8623 #endif
8624 #$i_string I_STRING
8625 #ifdef I_STRING
8626 #include <string.h>
8627 #else
8628 #include <strings.h>
8629 #endif
8630 $signal_t blech(x) int x; { exit(3); }
8631 EOCP
8632         $cat >> try.c <<'EOCP'
8633 int main()
8634 {
8635         int pd[2];
8636         int pu[2];
8637         char buf[1];
8638         char string[100];
8639
8640         pipe(pd);       /* Down: child -> parent */
8641         pipe(pu);       /* Up: parent -> child */
8642         if (0 != fork()) {
8643                 int ret;
8644                 close(pd[1]);   /* Parent reads from pd[0] */
8645                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8646                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8647                         exit(1);
8648                 signal(SIGALRM, blech);
8649                 alarm(5);
8650                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8651                         exit(2);
8652                 sprintf(string, "%d\n", ret);
8653                 write(2, string, strlen(string));
8654                 alarm(0);
8655 #ifdef EAGAIN
8656                 if (errno == EAGAIN) {
8657                         printf("EAGAIN\n");
8658                         goto ok;
8659                 }
8660 #endif
8661 #ifdef EWOULDBLOCK
8662                 if (errno == EWOULDBLOCK)
8663                         printf("EWOULDBLOCK\n");
8664 #endif
8665         ok:
8666                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8667                 sleep(2);                               /* Give it time to close our pipe */
8668                 alarm(5);
8669                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8670                 alarm(0);
8671                 sprintf(string, "%d\n", ret);
8672                 write(3, string, strlen(string));
8673                 exit(0);
8674         }
8675
8676         close(pd[0]);                   /* We write to pd[1] */
8677         close(pu[1]);                   /* We read from pu[0] */
8678         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8679         close(pd[1]);                   /* Pipe pd is now fully closed! */
8680         exit(0);                                /* Bye bye, thank you for playing! */
8681 }
8682 EOCP
8683         set try
8684         if eval $compile_ok; then
8685                 echo "$startsh" >mtry
8686                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8687                 chmod +x mtry
8688                 ./mtry >/dev/null 2>&1
8689                 case $? in
8690                 0) eagain=`$cat try.out`;;
8691                 1) echo "Could not perform non-blocking setting!";;
8692                 2) echo "I did a successful read() for something that was not there!";;
8693                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8694                 *) echo "Something terribly wrong happened during testing.";;
8695                 esac
8696                 rd_nodata=`$cat try.ret`
8697                 echo "A read() system call with no data present returns $rd_nodata."
8698                 case "$rd_nodata" in
8699                 0|-1) ;;
8700                 *)
8701                         echo "(That's peculiar, fixing that to be -1.)"
8702                         rd_nodata=-1
8703                         ;;
8704                 esac
8705                 case "$eagain" in
8706                 '')
8707                         echo "Forcing errno EAGAIN on read() with no data available."
8708                         eagain=EAGAIN
8709                         ;;
8710                 *)
8711                         echo "Your read() sets errno to $eagain when no data is available."
8712                         ;;
8713                 esac
8714                 status=`$cat try.err`
8715                 case "$status" in
8716                 0) echo "And it correctly returns 0 to signal EOF.";;
8717                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8718                 *) echo "However, your read() returns '$status' on EOF??";;
8719                 esac
8720                 val="$define"
8721                 if test "$status" = "$rd_nodata"; then
8722                         echo "WARNING: you can't distinguish between EOF and no data!"
8723                         val="$undef"
8724                 fi
8725         else
8726                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8727                 eagain=EAGAIN
8728         fi
8729         set d_eofnblk
8730         eval $setvar
8731         ;;
8732 *)
8733         echo "Using $hint value $eagain."
8734         echo "Your read() returns $rd_nodata when no data is present."
8735         case "$d_eofnblk" in
8736         "$define") echo "And you can see EOF because read() returns 0.";;
8737         "$undef") echo "But you can't see EOF status from read() returned value.";;
8738         *)
8739                 echo "(Assuming you can't see EOF status from read anyway.)"
8740                 d_eofnblk=$undef
8741                 ;;
8742         esac
8743         ;;
8744 esac
8745 $rm -f try try.* .out core head.c mtry
8746
8747 : see if fchmod exists
8748 set fchmod d_fchmod
8749 eval $inlibc
8750
8751 : see if fchown exists
8752 set fchown d_fchown
8753 eval $inlibc
8754
8755 : see if this is an fcntl system
8756 set fcntl d_fcntl
8757 eval $inlibc
8758
8759 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8760 while $test $# -ge 2; do
8761         case "$1" in
8762         $define) echo "#include <$2>";;
8763         esac ;
8764     shift 2;
8765 done > try.c;
8766 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8767 set try;
8768 if eval $compile; then
8769         val="$define";
8770 else
8771         val="$undef";
8772 fi;
8773 set $varname;
8774 eval $setvar;
8775 $rm -f try.c try.o'
8776
8777 socketlib=''
8778 sockethdr=''
8779 : see whether socket exists
8780 echo " "
8781 $echo $n "Hmm... $c" >&4
8782 if set socket val -f d_socket; eval $csym; $val; then
8783         echo "Looks like you have Berkeley networking support." >&4
8784         d_socket="$define"
8785         if set setsockopt val -f; eval $csym; $val; then
8786                 d_oldsock="$undef"
8787         else
8788                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8789                 d_oldsock="$define"
8790         fi
8791 else
8792         if $contains socklib libc.list >/dev/null 2>&1; then
8793                 echo "Looks like you have Berkeley networking support." >&4
8794                 d_socket="$define"
8795                 : we will have to assume that it supports the 4.2 BSD interface
8796                 d_oldsock="$undef"
8797         else
8798                 echo "You don't have Berkeley networking in libc$_a..." >&4
8799                 if test "X$d_socket" = "X$define"; then
8800                    echo "...but you seem to believe that you have sockets." >&4
8801                 else
8802                         for net in net socket
8803                         do
8804                                 if test -f /usr/lib/lib$net$_a; then
8805                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8806                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8807                                         if $contains socket libc.list >/dev/null 2>&1; then
8808                                                 d_socket="$define"
8809                                                 socketlib="-l$net"
8810                                                 case "$net" in
8811                                                 net)
8812                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8813                                                         sockethdr="-I/usr/netinclude"
8814                                                         ;;
8815                                                 esac
8816                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8817                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8818                                                         d_oldsock="$undef"
8819                                                 else
8820                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8821                                                         d_oldsock="$define"
8822                                                 fi
8823                                                 break
8824                                         fi
8825                                 fi
8826                         done
8827                         if test "X$d_socket" != "X$define"; then
8828                            echo "or anywhere else I see." >&4
8829                            d_socket="$undef"
8830                            d_oldsock="$undef"
8831                         fi
8832                 fi
8833         fi
8834 fi
8835
8836 : see if socketpair exists
8837 set socketpair d_sockpair
8838 eval $inlibc
8839
8840
8841 echo " "
8842 echo "Checking the availability of certain socket constants..." >& 4
8843 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8844         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8845         $cat >try.c <<EOF
8846 #include <sys/types.h>
8847 #include <sys/socket.h>
8848 int main() {
8849     int i = $ENUM;
8850 }
8851 EOF
8852         val="$undef"
8853         set try; if eval $compile; then
8854                 val="$define"
8855         fi
8856         set d_${enum}; eval $setvar
8857         $rm -f try.c try
8858 done
8859
8860 : see if sys/select.h has to be included
8861 set sys/select.h i_sysselct
8862 eval $inhdr
8863
8864 : see if we should include time.h, sys/time.h, or both
8865 echo " "
8866 if test "X$timeincl" = X; then
8867         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8868         $echo $n "I'm now running the test program...$c"
8869         $cat >try.c <<'EOCP'
8870 #include <sys/types.h>
8871 #ifdef I_TIME
8872 #include <time.h>
8873 #endif
8874 #ifdef I_SYSTIME
8875 #ifdef SYSTIMEKERNEL
8876 #define KERNEL
8877 #endif
8878 #include <sys/time.h>
8879 #endif
8880 #ifdef I_SYSSELECT
8881 #include <sys/select.h>
8882 #endif
8883 int main()
8884 {
8885         struct tm foo;
8886 #ifdef S_TIMEVAL
8887         struct timeval bar;
8888 #endif
8889 #ifdef S_TIMEZONE
8890         struct timezone tzp;
8891 #endif
8892         if (foo.tm_sec == foo.tm_sec)
8893                 exit(0);
8894 #ifdef S_TIMEVAL
8895         if (bar.tv_sec == bar.tv_sec)
8896                 exit(0);
8897 #endif
8898         exit(1);
8899 }
8900 EOCP
8901         flags=''
8902         for s_timezone in '-DS_TIMEZONE' ''; do
8903         sysselect=''
8904         for s_timeval in '-DS_TIMEVAL' ''; do
8905         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8906         for i_time in '' '-DI_TIME'; do
8907         for i_systime in '-DI_SYSTIME' ''; do
8908                 case "$flags" in
8909                 '') $echo $n ".$c"
8910                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8911                         if eval $compile; then
8912                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8913                                 shift
8914                                 flags="$*"
8915                                 echo " "
8916                                 $echo $n "Succeeded with $flags$c"
8917                         fi
8918                         ;;
8919                 esac
8920         done
8921         done
8922         done
8923         done
8924         done
8925         timeincl=''
8926         echo " "
8927         case "$flags" in
8928         *SYSTIMEKERNEL*) i_systimek="$define"
8929                 timeincl=`./findhdr sys/time.h`
8930                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8931         *) i_systimek="$undef";;
8932         esac
8933         case "$flags" in
8934         *I_TIME*) i_time="$define"
8935                 timeincl=`./findhdr time.h`" $timeincl"
8936                 echo "We'll include <time.h>." >&4;;
8937         *) i_time="$undef";;
8938         esac
8939         case "$flags" in
8940         *I_SYSTIME*) i_systime="$define"
8941                 timeincl=`./findhdr sys/time.h`" $timeincl"
8942                 echo "We'll include <sys/time.h>." >&4;;
8943         *) i_systime="$undef";;
8944         esac
8945         $rm -f try.c try
8946 fi
8947
8948 : check for fd_set items
8949 $cat <<EOM
8950
8951 Checking to see how well your C compiler handles fd_set and friends ...
8952 EOM
8953 $cat >fd_set.c <<EOCP
8954 #$i_systime I_SYS_TIME
8955 #$i_sysselct I_SYS_SELECT
8956 #$d_socket HAS_SOCKET
8957 #include <sys/types.h>
8958 #ifdef HAS_SOCKET
8959 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8960 #endif
8961 #ifdef I_SYS_TIME
8962 #include <sys/time.h>
8963 #endif
8964 #ifdef I_SYS_SELECT
8965 #include <sys/select.h>
8966 #endif
8967 int main() {
8968         fd_set fds;
8969
8970 #ifdef TRYBITS
8971         if(fds.fds_bits);
8972 #endif
8973
8974 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8975         exit(0);
8976 #else
8977         exit(1);
8978 #endif
8979 }
8980 EOCP
8981 set fd_set -DTRYBITS
8982 if eval $compile; then
8983         d_fds_bits="$define"
8984         d_fd_set="$define"
8985         echo "Well, your system knows about the normal fd_set typedef..." >&4
8986         if ./fd_set; then
8987                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8988                 d_fd_macros="$define"
8989         else
8990                 $cat >&4 <<'EOM'
8991 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8992 EOM
8993                 d_fd_macros="$undef"
8994         fi
8995 else
8996         $cat <<'EOM'
8997 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8998 EOM
8999         set fd_set
9000         if eval $compile; then
9001                 d_fds_bits="$undef"
9002                 d_fd_set="$define"
9003                 echo "Well, your system has some sort of fd_set available..." >&4
9004                 if ./fd_set; then
9005                         echo "and you have the normal fd_set macros." >&4
9006                         d_fd_macros="$define"
9007                 else
9008                         $cat <<'EOM'
9009 but not the normal fd_set macros!  Gross!  More work for me...
9010 EOM
9011                         d_fd_macros="$undef"
9012                 fi
9013         else
9014         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9015                 d_fd_set="$undef"
9016                 d_fds_bits="$undef"
9017                 d_fd_macros="$undef"
9018         fi
9019 fi
9020 $rm -f fd_set*
9021
9022 : see if fgetpos exists
9023 set fgetpos d_fgetpos
9024 eval $inlibc
9025
9026 : see if flock exists
9027 set flock d_flock
9028 eval $inlibc
9029
9030 : see if fork exists
9031 set fork d_fork
9032 eval $inlibc
9033
9034 : see if pathconf exists
9035 set pathconf d_pathconf
9036 eval $inlibc
9037
9038 : see if fpathconf exists
9039 set fpathconf d_fpathconf
9040 eval $inlibc
9041
9042
9043 : check for fpos64_t
9044 echo " "
9045 echo "Checking to see if you have fpos64_t..." >&4
9046 $cat >try.c <<EOCP
9047 #include <stdio.h>
9048 int main() { fpos64_t x = 7; }
9049 EOCP
9050 set try
9051 if eval $compile; then
9052         val="$define"
9053         echo "You have fpos64_t."
9054 else
9055         val="$undef"
9056         echo "You do not have fpos64_t."
9057         case "$fpossize" in
9058         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9059         esac
9060 fi
9061 $rm -f try.* try
9062 set d_fpos64_t
9063 eval $setvar
9064
9065 hasstruct='varname=$1; struct=$2; shift; shift;
9066 while $test $# -ge 2; do
9067         case "$1" in
9068         $define) echo "#include <$2>";;
9069         esac ;
9070     shift 2;
9071 done > try.c;
9072 echo "int main () { struct $struct foo; }" >> try.c;
9073 set try;
9074 if eval $compile; then
9075         val="$define";
9076 else
9077         val="$undef";
9078 fi;
9079 set $varname;
9080 eval $setvar;
9081 $rm -f try.c try.o'
9082
9083 : see if this is a sys/param system
9084 set sys/param.h i_sysparam
9085 eval $inhdr
9086
9087 : see if this is a sys/mount.h system
9088 set sys/mount.h i_sysmount
9089 eval $inhdr
9090
9091 : see if sys/types.h has to be included
9092 set sys/types.h i_systypes
9093 eval $inhdr
9094
9095
9096 echo " "
9097 echo "Checking to see if your system supports struct fs_data..." >&4
9098 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9099 eval $hasstruct
9100 case "$d_fs_data_s" in
9101 "$define")      echo "Yes, it does."   ;;
9102 *)              echo "No, it doesn't." ;;
9103 esac
9104
9105 : see if fseeko exists
9106 set fseeko d_fseeko
9107 eval $inlibc
9108 case "$longsize" in
9109 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9110 esac
9111
9112 : see if fsetpos exists
9113 set fsetpos d_fsetpos
9114 eval $inlibc
9115
9116
9117 : see if fstatfs exists
9118 set fstatfs d_fstatfs
9119 eval $inlibc
9120
9121
9122 : see if statvfs exists
9123 set statvfs d_statvfs
9124 eval $inlibc
9125
9126 : see if fstatvfs exists
9127 set fstatvfs d_fstatvfs
9128 eval $inlibc
9129
9130
9131 : see if ftello exists
9132 set ftello d_ftello
9133 eval $inlibc
9134 case "$longsize" in
9135 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9136 esac
9137
9138 : see if getcwd exists
9139 set getcwd d_getcwd
9140 eval $inlibc
9141
9142
9143 : see if getfsstat exists
9144 set getfsstat d_getfsstat
9145 eval $inlibc
9146
9147 : see if getgrent exists
9148 set getgrent d_getgrent
9149 eval $inlibc
9150
9151 : see if gethostbyaddr exists
9152 set gethostbyaddr d_gethbyaddr
9153 eval $inlibc
9154
9155 : see if gethostbyname exists
9156 set gethostbyname d_gethbyname
9157 eval $inlibc
9158
9159 : see if gethostent exists
9160 set gethostent d_gethent
9161 eval $inlibc
9162
9163 : see how we will look up host name
9164 echo " "
9165 call=''
9166 if set gethostname val -f d_gethname; eval $csym; $val; then
9167         echo 'gethostname() found.' >&4
9168         d_gethname="$define"
9169         call=gethostname
9170 fi
9171 if set uname val -f d_uname; eval $csym; $val; then
9172         if ./xenix; then
9173                 $cat <<'EOM'
9174 uname() was found, but you're running xenix, and older versions of xenix
9175 have a broken uname(). If you don't really know whether your xenix is old
9176 enough to have a broken system call, use the default answer.
9177
9178 EOM
9179                 dflt=y
9180                 case "$d_uname" in
9181                 "$define") dflt=n;;
9182                 esac
9183                 rp='Is your uname() broken?'
9184                 . ./myread
9185                 case "$ans" in
9186                 n*) d_uname="$define"; call=uname;;
9187                 esac
9188         else
9189                 echo 'uname() found.' >&4
9190                 d_uname="$define"
9191                 case "$call" in
9192                 '') call=uname ;;
9193                 esac
9194         fi
9195 fi
9196 case "$d_gethname" in
9197 '') d_gethname="$undef";;
9198 esac
9199 case "$d_uname" in
9200 '') d_uname="$undef";;
9201 esac
9202 case "$d_uname$d_gethname" in
9203 *define*)
9204         dflt=n
9205         cat <<EOM
9206  
9207 Every now and then someone has a $call() that lies about the hostname
9208 but can't be fixed for political or economic reasons.  If you wish, I can
9209 pretend $call() isn't there and maybe compute hostname at run-time
9210 thanks to the '$phostname' command.
9211
9212 EOM
9213         rp="Shall I ignore $call() from now on?"
9214         . ./myread
9215         case "$ans" in
9216         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9217         esac;;
9218 esac
9219 case "$phostname" in
9220 '') aphostname='';;
9221 *) case "$aphostname" in
9222         /*) ;;
9223         *) set X $phostname
9224                 shift
9225                 file=$1
9226                 shift
9227                 file=`./loc $file $file $pth`
9228                 aphostname=`echo $file $*`
9229                 ;;
9230         esac
9231         ;;
9232 esac
9233 case "$d_uname$d_gethname" in
9234 *define*) ;;
9235 *)
9236         case "$phostname" in
9237         '')
9238                 echo "There will be no way for $package to get your hostname." >&4;;
9239         *)
9240         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9241                 ;;
9242         esac;;
9243 esac
9244 case "$d_phostname" in
9245 '') d_phostname="$undef";;
9246 esac
9247
9248 : see if this is a netdb.h system
9249 set netdb.h i_netdb
9250 eval $inhdr
9251
9252 : see if prototypes for various gethostxxx netdb.h functions are available
9253 echo " "
9254 set d_gethostprotos gethostent $i_netdb netdb.h
9255 eval $hasproto
9256
9257 : see if getlogin exists
9258 set getlogin d_getlogin
9259 eval $inlibc
9260
9261 : see if getmnt exists
9262 set getmnt d_getmnt
9263 eval $inlibc
9264
9265 : see if getmntent exists
9266 set getmntent d_getmntent
9267 eval $inlibc
9268
9269 : see if getnetbyaddr exists
9270 set getnetbyaddr d_getnbyaddr
9271 eval $inlibc
9272
9273 : see if getnetbyname exists
9274 set getnetbyname d_getnbyname
9275 eval $inlibc
9276
9277 : see if getnetent exists
9278 set getnetent d_getnent
9279 eval $inlibc
9280
9281 : see if prototypes for various getnetxxx netdb.h functions are available
9282 echo " "
9283 set d_getnetprotos getnetent $i_netdb netdb.h
9284 eval $hasproto
9285
9286
9287 : see if getprotobyname exists
9288 set getprotobyname d_getpbyname
9289 eval $inlibc
9290
9291 : see if getprotobynumber exists
9292 set getprotobynumber d_getpbynumber
9293 eval $inlibc
9294
9295 : see if getprotoent exists
9296 set getprotoent d_getpent
9297 eval $inlibc
9298
9299 : see if getpgid exists
9300 set getpgid d_getpgid
9301 eval $inlibc
9302
9303 : see if getpgrp2 exists
9304 set getpgrp2 d_getpgrp2
9305 eval $inlibc
9306
9307 : see if getppid exists
9308 set getppid d_getppid
9309 eval $inlibc
9310
9311 : see if getpriority exists
9312 set getpriority d_getprior
9313 eval $inlibc
9314
9315 : see if prototypes for various getprotoxxx netdb.h functions are available
9316 echo " "
9317 set d_getprotoprotos getprotoent $i_netdb netdb.h
9318 eval $hasproto
9319
9320 : see if getpwent exists
9321 set getpwent d_getpwent
9322 eval $inlibc
9323
9324
9325 : see if getservbyname exists
9326 set getservbyname d_getsbyname
9327 eval $inlibc
9328
9329 : see if getservbyport exists
9330 set getservbyport d_getsbyport
9331 eval $inlibc
9332
9333 : see if getservent exists
9334 set getservent d_getsent
9335 eval $inlibc
9336
9337 : see if prototypes for various getservxxx netdb.h functions are available
9338 echo " "
9339 set d_getservprotos getservent $i_netdb netdb.h
9340 eval $hasproto
9341
9342 : see if getspent exists
9343 set getspent d_getspent
9344 eval $inlibc
9345
9346 : see if getspnam exists
9347 set getspnam d_getspnam
9348 eval $inlibc
9349
9350 : see if gettimeofday or ftime exists
9351 set gettimeofday d_gettimeod
9352 eval $inlibc
9353 case "$d_gettimeod" in
9354 "$undef")
9355         set ftime d_ftime 
9356         eval $inlibc
9357         ;;
9358 *)
9359         val="$undef"; set d_ftime; eval $setvar
9360         ;;
9361 esac
9362 case "$d_gettimeod$d_ftime" in
9363 "$undef$undef")
9364         echo " "
9365         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9366         ;;
9367 esac
9368
9369 : see if this is an grp system
9370 set grp.h i_grp
9371 eval $inhdr
9372
9373 case "$i_grp" in
9374 $define)
9375         xxx=`./findhdr grp.h`
9376         $cppstdin $cppflags $cppminus < $xxx >$$.h
9377
9378         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9379                 val="$define"
9380         else
9381                 val="$undef"
9382         fi
9383         set d_grpasswd
9384         eval $setvar
9385
9386         $rm -f $$.h
9387         ;;
9388 *)
9389         val="$undef";
9390         set d_grpasswd; eval $setvar
9391         ;;
9392 esac
9393
9394 : see if hasmntopt exists
9395 set hasmntopt d_hasmntopt
9396 eval $inlibc
9397
9398 : see if this is a netinet/in.h or sys/in.h system
9399 set netinet/in.h i_niin sys/in.h i_sysin
9400 eval $inhdr
9401
9402 : see if arpa/inet.h has to be included
9403 set arpa/inet.h i_arpainet
9404 eval $inhdr
9405
9406 : see if htonl --and friends-- exists
9407 val=''
9408 set htonl val
9409 eval $inlibc
9410
9411 : Maybe they are macros.
9412 case "$val" in
9413 $undef)
9414         $cat >htonl.c <<EOM
9415 #include <stdio.h>
9416 #include <sys/types.h>
9417 #$i_niin I_NETINET_IN
9418 #$i_sysin I_SYS_IN
9419 #$i_arpainet I_ARPA_INET
9420 #ifdef I_NETINET_IN
9421 #include <netinet/in.h>
9422 #endif
9423 #ifdef I_SYS_IN
9424 #include <sys/in.h>
9425 #endif
9426 #ifdef I_ARPA_INET
9427 #include <arpa/inet.h>
9428 #endif
9429 #ifdef htonl
9430 printf("Defined as a macro.");
9431 #endif
9432 EOM
9433         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9434         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9435                 val="$define"
9436                 echo "But it seems to be defined as a macro." >&4
9437         fi
9438         $rm -f htonl.?
9439         ;;
9440 esac
9441 set d_htonl
9442 eval $setvar
9443
9444 : see if iconv exists
9445 set iconv d_iconv
9446 eval $inlibc
9447
9448 : index or strchr
9449 echo " "
9450 if set index val -f; eval $csym; $val; then
9451         if set strchr val -f d_strchr; eval $csym; $val; then
9452                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9453                         val="$define"
9454                         vali="$undef"
9455                         echo "strchr() found." >&4
9456                 else
9457                         val="$undef"
9458                         vali="$define"
9459                         echo "index() found." >&4
9460                 fi
9461         else
9462                 val="$undef"
9463                 vali="$define"
9464                 echo "index() found." >&4
9465         fi
9466 else
9467         if set strchr val -f d_strchr; eval $csym; $val; then
9468                 val="$define"
9469                 vali="$undef"
9470                 echo "strchr() found." >&4
9471         else
9472                 echo "No index() or strchr() found!" >&4
9473                 val="$undef"
9474                 vali="$undef"
9475         fi
9476 fi
9477 set d_strchr; eval $setvar
9478 val="$vali"
9479 set d_index; eval $setvar
9480
9481 : check whether inet_aton exists
9482 set inet_aton d_inetaton
9483 eval $inlibc
9484
9485 : see if inttypes.h is available
9486 : we want a real compile instead of Inhdr because some systems
9487 : have an inttypes.h which includes non-existent headers
9488 echo " "
9489 $cat >try.c <<EOCP
9490 #include <inttypes.h>
9491 int main() {
9492         static int32_t foo32 = 0x12345678;
9493 }
9494 EOCP
9495 set try
9496 if eval $compile; then
9497         echo "<inttypes.h> found." >&4
9498         val="$define"
9499 else
9500         echo "<inttypes.h> NOT found." >&4
9501         val="$undef"
9502 fi
9503 $rm -f try.c try
9504 set i_inttypes
9505 eval $setvar
9506
9507 : check for int64_t
9508 echo " "
9509 echo "Checking to see if you have int64_t..." >&4
9510 $cat >try.c <<EOCP
9511 #include <sys/types.h>
9512 #$i_inttypes I_INTTYPES
9513 #ifdef I_INTTYPES
9514 #include <inttypes.h>
9515 #endif
9516 int main() { int64_t x = 7; }
9517 EOCP
9518 set try
9519 if eval $compile; then
9520         val="$define"
9521         echo "You have int64_t."
9522 else
9523         val="$undef"
9524         echo "You do not have int64_t."
9525 fi
9526 $rm -f try try.*
9527 set d_int64_t
9528 eval $setvar
9529
9530 : Look for isascii
9531 echo " "
9532 $cat >isascii.c <<'EOCP'
9533 #include <stdio.h>
9534 #include <ctype.h>
9535 int main() {
9536         int c = 'A';
9537         if (isascii(c))
9538                 exit(0);
9539         else
9540                 exit(1);
9541 }
9542 EOCP
9543 set isascii
9544 if eval $compile; then
9545         echo "isascii() found." >&4
9546         val="$define"
9547 else
9548         echo "isascii() NOT found." >&4
9549         val="$undef"
9550 fi
9551 set d_isascii
9552 eval $setvar
9553 $rm -f isascii*
9554
9555 : see if killpg exists
9556 set killpg d_killpg
9557 eval $inlibc
9558
9559 : see if lchown exists
9560 echo " "
9561 $cat > try.c <<'EOCP'
9562 /* System header to define __stub macros and hopefully few prototypes,
9563     which can conflict with char lchown(); below.  */
9564 #include <assert.h>
9565 /* Override any gcc2 internal prototype to avoid an error.  */
9566 /* We use char because int might match the return type of a gcc2
9567    builtin and then its argument prototype would still apply.  */
9568 char lchown();
9569 int main() {
9570     /*  The GNU C library defines this for functions which it implements
9571         to always fail with ENOSYS.  Some functions are actually named
9572         something starting with __ and the normal name is an alias.  */
9573 #if defined (__stub_lchown) || defined (__stub___lchown)
9574 choke me
9575 #else
9576 lchown();
9577 #endif
9578 ; return 0; }
9579 EOCP
9580 set try
9581 if eval $compile; then
9582     $echo "lchown() found." >&4
9583     val="$define"
9584 else
9585     $echo "lchown() NOT found." >&4
9586     val="$undef"
9587 fi
9588 set d_lchown
9589 eval $setvar
9590
9591 : See if number of significant digits in a double precision number is known
9592 echo " "
9593 $cat >ldbl_dig.c <<EOM
9594 #$i_limits I_LIMITS
9595 #$i_float I_FLOAT
9596 #ifdef I_LIMITS
9597 #include <limits.h>
9598 #endif
9599 #ifdef I_FLOAT
9600 #include <float.h>
9601 #endif
9602 #ifdef LDBL_DIG
9603 printf("Contains LDBL_DIG");
9604 #endif
9605 EOM
9606 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9607 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9608         echo "LDBL_DIG found." >&4
9609         val="$define"
9610 else
9611         echo "LDBL_DIG NOT found." >&4
9612         val="$undef"
9613 fi
9614 $rm -f ldbl_dig.?
9615 set d_ldbl_dig
9616 eval $setvar
9617
9618 : see if link exists
9619 set link d_link
9620 eval $inlibc
9621
9622 : see if localeconv exists
9623 set localeconv d_locconv
9624 eval $inlibc
9625
9626 : see if lockf exists
9627 set lockf d_lockf
9628 eval $inlibc
9629
9630 : check for long long
9631 echo " "
9632 echo "Checking to see if you have long long..." >&4
9633 echo 'int main() { long long x = 7; return 0; }' > try.c
9634 set try
9635 if eval $compile; then
9636         val="$define"
9637         echo "You have have long long."
9638 else
9639         val="$undef"
9640         echo "You do not have long long."
9641 fi
9642 $rm try.*
9643 set d_longlong
9644 eval $setvar
9645
9646 : check for length of long long
9647 case "${d_longlong}${longlongsize}" in
9648 $define)
9649         echo " "
9650         echo "Checking to see how big your long longs are..." >&4
9651         $cat >try.c <<'EOCP'
9652 #include <stdio.h>
9653 int main()
9654 {
9655     printf("%d\n", (int)sizeof(long long));
9656     return(0);
9657 }
9658 EOCP
9659         set try
9660         if eval $compile_ok; then
9661                 longlongsize=`./try$exe_ext`
9662                 echo "Your long longs are $longlongsize bytes long."
9663         else
9664                 dflt='8'
9665                 echo " "
9666                 echo "(I can't seem to compile the test program.  Guessing...)"
9667                 rp="What is the size of a long long (in bytes)?"
9668                 . ./myread
9669                 longlongsize="$ans"
9670         fi
9671         if $test "X$longsize" = "X$longlongsize"; then
9672                 echo "(That isn't any different from an ordinary long.)"
9673         fi      
9674         ;;
9675 esac
9676 $rm -f try.* try
9677
9678 : see if prototype for lseek is available
9679 echo " "
9680 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9681 eval $hasproto
9682
9683 : see if lstat exists
9684 set lstat d_lstat
9685 eval $inlibc
9686
9687 : see if madvise exists
9688 set madvise d_madvise
9689 eval $inlibc
9690
9691 : see if mblen exists
9692 set mblen d_mblen
9693 eval $inlibc
9694
9695 : see if mbstowcs exists
9696 set mbstowcs d_mbstowcs
9697 eval $inlibc
9698
9699 : see if mbtowc exists
9700 set mbtowc d_mbtowc
9701 eval $inlibc
9702
9703 : see if memchr exists
9704 set memchr d_memchr
9705 eval $inlibc
9706
9707 : see if memcmp exists
9708 set memcmp d_memcmp
9709 eval $inlibc
9710
9711 : see if memcpy exists
9712 set memcpy d_memcpy
9713 eval $inlibc
9714
9715 : see if memmove exists
9716 set memmove d_memmove
9717 eval $inlibc
9718
9719 : see if memset exists
9720 set memset d_memset
9721 eval $inlibc
9722
9723 : see if mkdir exists
9724 set mkdir d_mkdir
9725 eval $inlibc
9726
9727 : see if mkdtemp exists
9728 set mkdtemp d_mkdtemp
9729 eval $inlibc
9730
9731 : see if mkfifo exists
9732 set mkfifo d_mkfifo
9733 eval $inlibc
9734
9735 : see if mkstemp exists
9736 set mkstemp d_mkstemp
9737 eval $inlibc
9738
9739 : see if mkstemps exists
9740 set mkstemps d_mkstemps
9741 eval $inlibc
9742
9743 : see if mktime exists
9744 set mktime d_mktime
9745 eval $inlibc
9746
9747 : see if this is a sys/mman.h system
9748 set sys/mman.h i_sysmman
9749 eval $inhdr
9750
9751 : see if mmap exists
9752 set mmap d_mmap
9753 eval $inlibc
9754 : see what shmat returns
9755 : default to something harmless
9756 mmaptype='void *'
9757 case "$i_sysmman$d_mmap" in
9758 "$define$define")
9759         $cat >mmap.c <<'END'
9760 #include <sys/mman.h>
9761 void *mmap();
9762 END
9763         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9764                 mmaptype='void *'
9765         else
9766                 mmaptype='caddr_t'
9767         fi
9768         echo "and it returns ($mmaptype)." >&4
9769         ;;
9770 esac
9771
9772
9773
9774 : see if mprotect exists
9775 set mprotect d_mprotect
9776 eval $inlibc
9777
9778 : see if msgctl exists
9779 set msgctl d_msgctl
9780 eval $inlibc
9781
9782 : see if msgget exists
9783 set msgget d_msgget
9784 eval $inlibc
9785
9786 : see if msgsnd exists
9787 set msgsnd d_msgsnd
9788 eval $inlibc
9789
9790 : see if msgrcv exists
9791 set msgrcv d_msgrcv
9792 eval $inlibc
9793
9794 : see how much of the 'msg*(2)' library is present.
9795 h_msg=true
9796 echo " "
9797 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9798 *"$undef"*) h_msg=false;;
9799 esac
9800 case "$osname" in
9801 freebsd)
9802     case "`ipcs 2>&1`" in
9803     "SVID messages"*"not configured"*)
9804         echo "Your $osname does not have the msg*(2) configured." >&4
9805         h_msg=false
9806         val="$undef"
9807         set msgctl d_msgctl
9808         eval $setvar
9809         set msgget d_msgget
9810         eval $setvar
9811         set msgsnd d_msgsnd
9812         eval $setvar
9813         set msgrcv d_msgrcv
9814         eval $setvar
9815         ;;
9816     esac
9817     ;;
9818 esac
9819 : we could also check for sys/ipc.h ...
9820 if $h_msg && $test `./findhdr sys/msg.h`; then
9821         echo "You have the full msg*(2) library." >&4
9822         val="$define"
9823 else
9824         echo "You don't have the full msg*(2) library." >&4
9825         val="$undef"
9826 fi
9827 set d_msg
9828 eval $setvar
9829
9830 : see if msync exists
9831 set msync d_msync
9832 eval $inlibc
9833
9834 : see if munmap exists
9835 set munmap d_munmap
9836 eval $inlibc
9837
9838 : see if nice exists
9839 set nice d_nice
9840 eval $inlibc
9841
9842
9843 echo " "
9844 echo "Checking which 64-bit integer type we could use..." >&4
9845
9846 case "$intsize" in
9847 8) val=int
9848    set quadtype
9849    eval $setvar
9850    val='"unsigned int"'
9851    set uquadtype
9852    eval $setvar
9853    quadkind=1
9854    ;;
9855 *) case "$longsize" in
9856    8) val=long
9857       set quadtype
9858       eval $setvar
9859       val='"unsigned long"'
9860       set uquadtype
9861       eval $setvar
9862       quadkind=2
9863       ;;
9864    *) case "$d_longlong:$longlongsize" in
9865       define:8)
9866         val='"long long"'
9867         set quadtype
9868         eval $setvar
9869         val='"unsigned long long"'
9870         set uquadtype
9871         eval $setvar
9872         quadkind=3
9873         ;;
9874       *) case "$d_int64_t" in
9875          define)
9876            val=int64_t
9877            set quadtype
9878            eval $setvar
9879            val=uint64_t
9880            set uquadtype
9881            eval $setvar
9882            quadkind=4
9883            ;;
9884          esac
9885          ;;
9886       esac
9887       ;;
9888    esac
9889    ;;
9890 esac
9891
9892 case "$quadtype" in
9893 '')     echo "Alas, no 64-bit integer types in sight." >&4
9894         d_quad="$undef"
9895         ;;
9896 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9897             verb="will"
9898         else
9899             verb="could"
9900         fi
9901         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9902         d_quad="$define"
9903         ;;
9904 esac
9905
9906 : check for length of character
9907 echo " "
9908 case "$charsize" in
9909 '')
9910         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9911         $cat >try.c <<'EOCP'
9912 #include <stdio.h>
9913 int main()
9914 {
9915     printf("%d\n", (int)sizeof(char));
9916     exit(0);
9917 }
9918 EOCP
9919         set try
9920         if eval $compile_ok; then
9921                 dflt=`./try`
9922         else
9923                 dflt='1'
9924                 echo "(I can't seem to compile the test program.  Guessing...)"
9925         fi
9926         ;;
9927 *)
9928         dflt="$charsize"
9929         ;;
9930 esac
9931 rp="What is the size of a character (in bytes)?"
9932 . ./myread
9933 charsize="$ans"
9934 $rm -f try.c try
9935
9936
9937 echo " "
9938 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9939
9940 case "$use64bitint:$d_quad:$quadtype" in
9941 define:define:?*)
9942         ivtype="$quadtype"
9943         uvtype="$uquadtype"
9944         ivsize=8
9945         uvsize=8
9946         ;;
9947 *)      ivtype="long"
9948         uvtype="unsigned long"
9949         ivsize=$longsize
9950         uvsize=$longsize
9951         ;;
9952 esac
9953
9954 case "$uselongdouble:$d_longdbl" in
9955 define:define)
9956         nvtype="long double"
9957         nvsize=$longdblsize
9958         ;;
9959 *)      nvtype=double
9960         nvsize=$doublesize
9961         ;;
9962 esac
9963
9964 $echo "(IV will be "$ivtype", $ivsize bytes)"
9965 $echo "(UV will be "$uvtype", $uvsize bytes)"
9966 $echo "(NV will be "$nvtype", $nvsize bytes)"
9967
9968 $cat >try.c <<EOCP
9969 #$i_inttypes I_INTTYPES
9970 #ifdef I_INTTYPES
9971 #include <inttypes.h>
9972 #endif
9973 #include <stdio.h>
9974 int main() {
9975 #ifdef INT8
9976    int8_t i =  INT8_MAX;
9977   uint8_t u = UINT8_MAX;
9978   printf("int8_t\n");
9979 #endif
9980 #ifdef INT16
9981    int16_t i =  INT16_MAX;
9982   uint16_t i = UINT16_MAX;
9983   printf("int16_t\n");
9984 #endif
9985 #ifdef INT32
9986    int32_t i =  INT32_MAX;
9987   uint32_t u = UINT32_MAX;
9988   printf("int32_t\n");
9989 #endif
9990 }
9991 EOCP
9992
9993 case "$i8type" in
9994 '')     case "$charsize" in
9995         1)      i8type=char
9996                 u8type="unsigned char"
9997                 i8size=$charsize
9998                 u8size=$charsize
9999                 ;;
10000         esac
10001         ;;
10002 esac
10003 case "$i8type" in
10004 '')     set try -DINT8
10005         if eval $compile; then
10006                 case "`./try$exe_ext`" in
10007                 int8_t) i8type=int8_t
10008                         u8type=uint8_t
10009                         i8size=1
10010                         u8size=1
10011                         ;;
10012                 esac
10013         fi
10014         ;;
10015 esac
10016 case "$i8type" in
10017 '')     if $test $charsize -ge 1; then
10018                 i8type=char
10019                 u8type="unsigned char"
10020                 i8size=$charsize
10021                 u8size=$charsize
10022         fi
10023         ;;
10024 esac
10025
10026 case "$i16type" in
10027 '')     case "$shortsize" in
10028         2)      i16type=short
10029                 u16type="unsigned short"
10030                 i16size=$shortsize
10031                 u16size=$shortsize
10032                 ;;
10033         esac
10034         ;;
10035 esac
10036 case "$i16type" in
10037 '')     set try -DINT16
10038         if eval $compile; then
10039                 case "`./try$exe_ext`" in
10040                 int16_t)
10041                         i16type=int16_t
10042                         u16type=uint16_t
10043                         i16size=2
10044                         u16size=2
10045                         ;;
10046                 esac
10047         fi
10048         ;;
10049 esac
10050 case "$i16type" in
10051 '')     if $test $shortsize -ge 2; then
10052                 i16type=short
10053                 u16type="unsigned short"
10054                 i16size=$shortsize
10055                 u16size=$shortsize
10056         fi
10057         ;;
10058 esac
10059
10060 case "$i32type" in
10061 '')     case "$longsize" in
10062         4)      i32type=long
10063                 u32type="unsigned long"
10064                 i32size=$longsize
10065                 u32size=$longsize
10066                 ;;
10067         *)      case "$intsize" in
10068                 4)      i32type=int
10069                         u32type="unsigned int"
10070                         i32size=$intsize
10071                         u32size=$intsize
10072                         ;;
10073                 esac
10074                 ;;
10075         esac
10076         ;;
10077 esac
10078 case "$i32type" in
10079 '')     set try -DINT32
10080         if eval $compile; then
10081                 case "`./try$exe_ext`" in
10082                 int32_t)
10083                         i32type=int32_t
10084                         u32type=uint32_t
10085                         i32size=4
10086                         u32size=4
10087                         ;;
10088                 esac
10089         fi
10090         ;;
10091 esac
10092 case "$i32type" in
10093 '')     if $test $intsize -ge 4; then
10094                 i32type=int
10095                 u32type="unsigned int"
10096                 i32size=$intsize
10097                 u32size=$intsize
10098         fi
10099         ;;
10100 esac
10101
10102 case "$i64type" in
10103 '')     case "$d_quad:$quadtype" in
10104         define:?*)
10105                 i64type="$quadtype"
10106                 u64type="$uquadtype"
10107                 i64size=8
10108                 u64size=8
10109                 ;;
10110         esac
10111         ;;
10112 esac
10113
10114 $echo "Checking whether your NVs can preserve your UVs..." >&4
10115 $cat <<EOP >try.c
10116 #include <stdio.h>
10117 int main() {
10118     $uvtype k = ($uvtype)~0, l;
10119     $nvtype d;
10120     l = k;
10121     d = ($nvtype)l;
10122     l = ($uvtype)d;
10123     if (l == k)
10124        printf("preserve\n");
10125     exit(0);
10126 }
10127 EOP
10128 set try
10129 if eval $compile; then
10130         case "`./try$exe_ext`" in
10131         preserve) d_nv_preserves_uv="$define" ;;
10132         esac
10133 fi      
10134 case "$d_nv_preserves_uv" in
10135 $define) $echo "Yes, they can."  2>&1 ;;
10136 *)       $echo "No, they can't." 2>&1
10137          d_nv_preserves_uv="$undef"
10138          ;;
10139 esac
10140
10141 $rm -f try.* try
10142
10143
10144 : check for off64_t
10145 echo " "
10146 echo "Checking to see if you have off64_t..." >&4
10147 $cat >try.c <<EOCP
10148 #include <sys/types.h>
10149 #include <unistd.h>
10150 int main() { off64_t x = 7; }
10151 EOCP
10152 set try
10153 if eval $compile; then
10154         val="$define"
10155         echo "You have off64_t."
10156 else
10157         val="$undef"
10158         echo "You do not have off64_t."
10159         case "$lseeksize" in
10160         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10161         esac
10162 fi
10163 $rm -f try.* try
10164 set d_off64_t
10165 eval $setvar
10166
10167 : see if POSIX threads are available
10168 set pthread.h i_pthread
10169 eval $inhdr
10170
10171
10172
10173
10174 : how to create joinable pthreads
10175 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10176         echo " "
10177         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10178         $cat >try.c <<'EOCP'
10179 #include <pthread.h>
10180 int main() {
10181     int detachstate = JOINABLE;
10182 }
10183 EOCP
10184         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10185         if eval $compile; then
10186                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10187                 val="$undef" # Yes, undef.
10188                 set d_old_pthread_create_joinable
10189                 eval $setvar
10190                 val=""
10191                 set old_pthread_create_joinable
10192                 eval $setvar
10193         else
10194                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10195                 if eval $compile; then
10196                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10197                         val="$define"
10198                         set d_old_pthread_create_joinable
10199                         eval $setvar
10200                         val=PTHREAD_CREATE_UNDETACHED
10201                         set old_pthread_create_joinable
10202                         eval $setvar
10203                 else            
10204                         set try -DJOINABLE=__UNDETACHED
10205                         if eval $compile; then
10206                                 echo "You seem to use __UNDETACHED." >&4
10207                                 val="$define"
10208                                 set d_old_pthread_create_joinable
10209                                 eval $setvar
10210                                 val=__UNDETACHED
10211                                 set old_pthread_create_joinable
10212                                 eval $setvar
10213                         else
10214                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10215                                 val="$define"
10216                                 set d_old_pthread_create_joinable
10217                                 eval $setvar
10218                                 val=0
10219                                 set old_pthread_create_joinable
10220                                 eval $setvar
10221                         fi
10222                 fi
10223         fi
10224         $rm -f try try.*
10225 else
10226     d_old_pthread_create_joinable="$undef"
10227     old_pthread_create_joinable=""
10228 fi
10229
10230 : see if pause exists
10231 set pause d_pause
10232 eval $inlibc
10233
10234 : see if pipe exists
10235 set pipe d_pipe
10236 eval $inlibc
10237
10238 : see if poll exists
10239 set poll d_poll
10240 eval $inlibc
10241
10242
10243 : see whether the various POSIXish _yields exist
10244 $cat >try.c <<EOP
10245 #include <pthread.h>
10246 #include <stdio.h>
10247 int main() {
10248 #ifdef SCHED_YIELD
10249         sched_yield();
10250 #else
10251 #ifdef PTHREAD_YIELD
10252         pthread_yield();
10253 #else
10254 #ifdef PTHREAD_YIELD_NULL
10255         pthread_yield(NULL);
10256 #endif
10257 #endif
10258 #endif
10259 }
10260 EOP
10261 : see if sched_yield exists
10262 set try -DSCHED_YIELD
10263 if eval $compile; then
10264     val="$define"
10265     sched_yield='sched_yield()'
10266 else
10267     val="$undef"
10268 fi
10269 case "$usethreads" in
10270 $define)
10271         case "$val" in
10272         $define) echo 'sched_yield() found.' >&4        ;;
10273         *)       echo 'sched_yield() NOT found.' >&4    ;;
10274         esac
10275 esac
10276 set d_sched_yield
10277 eval $setvar
10278
10279 : see if pthread_yield exists
10280 set try -DPTHREAD_YIELD
10281 if eval $compile; then
10282     val="$define"
10283     case "$sched_yield" in
10284     '') sched_yield='pthread_yield()' ;;
10285     esac
10286 else
10287     set try -DPTHREAD_YIELD_NULL
10288     if eval $compile; then
10289         val="$define"
10290         case "$sched_yield" in
10291         '') sched_yield='pthread_yield(NULL)' ;;
10292         esac
10293     else
10294         val="$undef"
10295     fi
10296 fi
10297 case "$usethreads" in
10298 $define)
10299         case "$val" in
10300         $define) echo 'pthread_yield() found.' >&4      ;;
10301         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10302         esac
10303         ;;
10304 esac
10305 set d_pthread_yield
10306 eval $setvar
10307
10308 case "$sched_yield" in
10309 '') sched_yield=undef ;;
10310 esac
10311
10312 $rm -f try try.*
10313
10314 : see if this is a pwd.h system
10315 set pwd.h i_pwd
10316 eval $inhdr
10317
10318 case "$i_pwd" in
10319 $define)
10320         xxx=`./findhdr pwd.h`
10321         $cppstdin $cppflags $cppminus < $xxx >$$.h
10322
10323         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10324                 val="$define"
10325         else
10326                 val="$undef"
10327         fi
10328         set d_pwquota
10329         eval $setvar
10330
10331         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10332                 val="$define"
10333         else
10334                 val="$undef"
10335         fi
10336         set d_pwage
10337         eval $setvar
10338
10339         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10340                 val="$define"
10341         else
10342                 val="$undef"
10343         fi
10344         set d_pwchange
10345         eval $setvar
10346
10347         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10348                 val="$define"
10349         else
10350                 val="$undef"
10351         fi
10352         set d_pwclass
10353         eval $setvar
10354
10355         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10356                 val="$define"
10357         else
10358                 val="$undef"
10359         fi
10360         set d_pwexpire
10361         eval $setvar
10362
10363         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10364                 val="$define"
10365         else
10366                 val="$undef"
10367         fi
10368         set d_pwcomment
10369         eval $setvar
10370
10371         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10372                 val="$define"
10373         else
10374                 val="$undef"
10375         fi
10376         set d_pwgecos
10377         eval $setvar
10378
10379         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10380                 val="$define"
10381         else
10382                 val="$undef"
10383         fi
10384         set d_pwpasswd
10385         eval $setvar
10386
10387         $rm -f $$.h
10388         ;;
10389 *)
10390         val="$undef"; 
10391         set d_pwquota; eval $setvar
10392         set d_pwage; eval $setvar
10393         set d_pwchange; eval $setvar
10394         set d_pwclass; eval $setvar
10395         set d_pwexpire; eval $setvar
10396         set d_pwcomment; eval $setvar
10397         set d_pwgecos; eval $setvar
10398         set d_pwpasswd; eval $setvar
10399         ;;
10400 esac
10401
10402 : see if readdir and friends exist
10403 set readdir d_readdir
10404 eval $inlibc
10405 set seekdir d_seekdir
10406 eval $inlibc
10407 set telldir d_telldir
10408 eval $inlibc
10409 set rewinddir d_rewinddir
10410 eval $inlibc
10411
10412 : see if readlink exists
10413 set readlink d_readlink
10414 eval $inlibc
10415
10416 : see if rename exists
10417 set rename d_rename
10418 eval $inlibc
10419
10420 : see if rmdir exists
10421 set rmdir d_rmdir
10422 eval $inlibc
10423
10424 : see if memory.h is available.
10425 val=''
10426 set memory.h val
10427 eval $inhdr
10428
10429 : See if it conflicts with string.h
10430 case "$val" in
10431 $define)
10432         case "$strings" in
10433         '') ;;
10434         *)
10435                 $cppstdin $cppflags $cppminus < $strings > mem.h
10436                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10437                         echo " "
10438                         echo "We won't be including <memory.h>."
10439                         val="$undef"
10440                 fi
10441                 $rm -f mem.h
10442                 ;;
10443         esac
10444 esac
10445 set i_memory
10446 eval $setvar
10447
10448 : can bcopy handle overlapping blocks?
10449 val="$undef"
10450 case "$d_bcopy" in
10451 "$define")
10452         echo " "
10453         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10454         $cat >try.c <<EOCP
10455 #$i_memory I_MEMORY
10456 #$i_stdlib I_STDLIB
10457 #$i_string I_STRING
10458 #$i_unistd I_UNISTD
10459 EOCP
10460         $cat >>try.c <<'EOCP'
10461 #include <stdio.h>
10462 #ifdef I_MEMORY
10463 #  include <memory.h>
10464 #endif
10465 #ifdef I_STDLIB
10466 #  include <stdlib.h>
10467 #endif
10468 #ifdef I_STRING
10469 #  include <string.h>
10470 #else
10471 #  include <strings.h>
10472 #endif
10473 #ifdef I_UNISTD
10474 #  include <unistd.h>  /* Needed for NetBSD */
10475 #endif
10476 int main()
10477 {
10478 char buf[128], abc[128];
10479 char *b;
10480 int len;
10481 int off;
10482 int align;
10483
10484 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10485
10486 for (align = 7; align >= 0; align--) {
10487         for (len = 36; len; len--) {
10488                 b = buf+align;
10489                 bcopy(abc, b, len);
10490                 for (off = 1; off <= len; off++) {
10491                         bcopy(b, b+off, len);
10492                         bcopy(b+off, b, len);
10493                         if (bcmp(b, abc, len))
10494                                 exit(1);
10495                 }
10496         }
10497 }
10498 exit(0);
10499 }
10500 EOCP
10501         set try
10502         if eval $compile_ok; then
10503                 if ./try 2>/dev/null; then
10504                         echo "Yes, it can."
10505                         val="$define"
10506                 else
10507                         echo "It can't, sorry."
10508                         case "$d_memmove" in
10509                         "$define") echo "But that's Ok since you have memmove()." ;;
10510                         esac
10511                 fi
10512         else
10513                 echo "(I can't compile the test program, so we'll assume not...)"
10514                 case "$d_memmove" in
10515                 "$define") echo "But that's Ok since you have memmove()." ;;
10516                 esac
10517         fi
10518         ;;
10519 esac
10520 $rm -f try.* try core
10521 set d_safebcpy
10522 eval $setvar
10523
10524 : can memcpy handle overlapping blocks?
10525 val="$undef"
10526 case "$d_memcpy" in
10527 "$define")
10528         echo " "
10529         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10530         $cat >try.c <<EOCP
10531 #$i_memory I_MEMORY
10532 #$i_stdlib I_STDLIB
10533 #$i_string I_STRING
10534 #$i_unistd I_UNISTD
10535 EOCP
10536         $cat >>try.c <<'EOCP'
10537 #include <stdio.h>
10538 #ifdef I_MEMORY
10539 #  include <memory.h>
10540 #endif
10541 #ifdef I_STDLIB
10542 #  include <stdlib.h>
10543 #endif
10544 #ifdef I_STRING
10545 #  include <string.h>
10546 #else
10547 #  include <strings.h>
10548 #endif
10549 #ifdef I_UNISTD
10550 #  include <unistd.h>  /* Needed for NetBSD */
10551 #endif
10552 int main()
10553 {
10554 char buf[128], abc[128];
10555 char *b;
10556 int len;
10557 int off;
10558 int align;
10559
10560 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10561    try to store the string in read-only memory. */
10562 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10563
10564 for (align = 7; align >= 0; align--) {
10565         for (len = 36; len; len--) {
10566                 b = buf+align;
10567                 memcpy(b, abc, len);
10568                 for (off = 1; off <= len; off++) {
10569                         memcpy(b+off, b, len);
10570                         memcpy(b, b+off, len);
10571                         if (memcmp(b, abc, len))
10572                                 exit(1);
10573                 }
10574         }
10575 }
10576 exit(0);
10577 }
10578 EOCP
10579         set try
10580         if eval $compile_ok; then
10581                 if ./try 2>/dev/null; then
10582                         echo "Yes, it can."
10583                         val="$define"
10584                 else
10585                         echo "It can't, sorry."
10586                         case "$d_memmove" in
10587                         "$define") echo "But that's Ok since you have memmove()." ;;
10588                         esac
10589                 fi
10590         else
10591                 echo "(I can't compile the test program, so we'll assume not...)"
10592                 case "$d_memmove" in
10593                 "$define") echo "But that's Ok since you have memmove()." ;;
10594                 esac
10595         fi
10596         ;;
10597 esac
10598 $rm -f try.* try core
10599 set d_safemcpy
10600 eval $setvar
10601
10602 : can memcmp be trusted to compare relative magnitude?
10603 val="$undef"
10604 case "$d_memcmp" in
10605 "$define")
10606         echo " "
10607         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10608         $cat >try.c <<EOCP
10609 #$i_memory I_MEMORY
10610 #$i_stdlib I_STDLIB
10611 #$i_string I_STRING
10612 #$i_unistd I_UNISTD
10613 EOCP
10614         $cat >>try.c <<'EOCP'
10615 #include <stdio.h>
10616 #ifdef I_MEMORY
10617 #  include <memory.h>
10618 #endif
10619 #ifdef I_STDLIB
10620 #  include <stdlib.h>
10621 #endif
10622 #ifdef I_STRING
10623 #  include <string.h>
10624 #else
10625 #  include <strings.h>
10626 #endif
10627 #ifdef I_UNISTD
10628 #  include <unistd.h>  /* Needed for NetBSD */
10629 #endif
10630 int main()
10631 {
10632 char a = -1;
10633 char b = 0;
10634 if ((a < b) && memcmp(&a, &b, 1) < 0)
10635         exit(1);
10636 exit(0);
10637 }
10638 EOCP
10639         set try
10640         if eval $compile_ok; then
10641                 if ./try 2>/dev/null; then
10642                         echo "Yes, it can."
10643                         val="$define"
10644                 else
10645                         echo "No, it can't (it uses signed chars)."
10646                 fi
10647         else
10648                 echo "(I can't compile the test program, so we'll assume not...)"
10649         fi
10650         ;;
10651 esac
10652 $rm -f try.* try core
10653 set d_sanemcmp
10654 eval $setvar
10655
10656 : see if select exists
10657 set select d_select
10658 eval $inlibc
10659
10660 : see if semctl exists
10661 set semctl d_semctl
10662 eval $inlibc
10663
10664 : see if semget exists
10665 set semget d_semget
10666 eval $inlibc
10667
10668 : see if semop exists
10669 set semop d_semop
10670 eval $inlibc
10671
10672 : see how much of the 'sem*(2)' library is present.
10673 h_sem=true
10674 echo " "
10675 case "$d_semctl$d_semget$d_semop" in
10676 *"$undef"*) h_sem=false;;
10677 esac
10678 case "$osname" in
10679 freebsd)
10680     case "`ipcs 2>&1`" in
10681     "SVID messages"*"not configured"*)
10682         echo "Your $osname does not have the sem*(2) configured." >&4
10683         h_sem=false
10684         val="$undef"
10685         set semctl d_semctl
10686         eval $setvar
10687         set semget d_semget
10688         eval $setvar
10689         set semop d_semop
10690         eval $setvar
10691         ;;
10692     esac
10693     ;;
10694 esac
10695 : we could also check for sys/ipc.h ...
10696 if $h_sem && $test `./findhdr sys/sem.h`; then
10697         echo "You have the full sem*(2) library." >&4
10698         val="$define"
10699 else
10700         echo "You don't have the full sem*(2) library." >&4
10701         val="$undef"
10702 fi
10703 set d_sem
10704 eval $setvar
10705
10706 : see whether sys/sem.h defines union semun
10707 echo " "
10708 $cat > try.c <<'END'
10709 #include <sys/types.h>
10710 #include <sys/ipc.h>
10711 #include <sys/sem.h>
10712 int main () { union semun semun; semun.buf = 0; }
10713 END
10714 set try
10715 if eval $compile; then
10716     echo "You have union semun in <sys/sem.h>." >&4
10717     val="$define"
10718 else
10719     echo "You do not have union semun in <sys/sem.h>." >&4
10720     val="$undef"
10721 fi
10722 $rm -f try try.c try.h
10723 set d_union_semun
10724 eval $setvar
10725
10726 : see how to do semctl IPC_STAT
10727 case "$d_sem" in
10728 $define)
10729     : see whether semctl IPC_STAT can use union semun
10730     echo " "
10731     $cat > try.h <<END
10732 #ifndef S_IRUSR
10733 #   ifdef S_IREAD
10734 #       define S_IRUSR S_IREAD
10735 #       define S_IWUSR S_IWRITE
10736 #       define S_IXUSR S_IEXEC
10737 #   else
10738 #       define S_IRUSR 0400
10739 #       define S_IWUSR 0200
10740 #       define S_IXUSR 0100
10741 #   endif
10742 #   define S_IRGRP (S_IRUSR>>3)
10743 #   define S_IWGRP (S_IWUSR>>3)
10744 #   define S_IXGRP (S_IXUSR>>3)
10745 #   define S_IROTH (S_IRUSR>>6)
10746 #   define S_IWOTH (S_IWUSR>>6)
10747 #   define S_IXOTH (S_IXUSR>>6)
10748 #endif
10749 #ifndef S_IRWXU
10750 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10751 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10752 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10753 #endif
10754 END
10755
10756     $cat > try.c <<END
10757 #include <sys/types.h>
10758 #include <sys/ipc.h>
10759 #include <sys/sem.h>
10760 #include <sys/stat.h>
10761 #include <stdio.h>
10762 #include <errno.h>
10763 #include "try.h"
10764 #ifndef errno
10765 extern int errno;
10766 #endif
10767 #$d_union_semun HAS_UNION_SEMUN
10768 int main() {
10769     union semun
10770 #ifndef HAS_UNION_SEMUN
10771     {
10772         int val;
10773         struct semid_ds *buf;
10774         unsigned short *array;
10775     }
10776 #endif
10777     arg;
10778     int sem, st;
10779
10780 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10781     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10782     if (sem > -1) {
10783         struct semid_ds argbuf;
10784         arg.buf = &argbuf;
10785 #       ifdef IPC_STAT
10786         st = semctl(sem, 0, IPC_STAT, arg);
10787         if (st == 0)
10788             printf("semun\n");
10789         else
10790 #       endif /* IPC_STAT */
10791             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10792 #       ifdef IPC_RMID
10793         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10794 #       endif /* IPC_RMID */
10795             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10796     } else
10797 #endif /* IPC_PRIVATE && ... */
10798         printf("semget failed: errno = %d\n", errno);
10799   return 0;
10800 }
10801 END
10802     val="$undef"
10803     set try
10804     if eval $compile; then
10805         xxx=`./try`
10806         case "$xxx" in
10807         semun) val="$define" ;;
10808         esac
10809     fi
10810     $rm -f try try.c
10811     set d_semctl_semun
10812     eval $setvar
10813     case "$d_semctl_semun" in
10814     $define)
10815         echo "You can use union semun for semctl IPC_STAT." >&4
10816         also='also'
10817         ;;
10818     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10819         also=''
10820         ;;
10821     esac
10822
10823     : see whether semctl IPC_STAT can use struct semid_ds pointer
10824     $cat > try.c <<'END'
10825 #include <sys/types.h>
10826 #include <sys/ipc.h>
10827 #include <sys/sem.h>
10828 #include <sys/stat.h>
10829 #include "try.h"
10830 #include <stdio.h>
10831 #include <errno.h>
10832 #ifndef errno
10833 extern int errno;
10834 #endif
10835 int main() {
10836     struct semid_ds arg;
10837     int sem, st;
10838
10839 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10840     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10841     if (sem > -1) {
10842 #       ifdef IPC_STAT
10843         st = semctl(sem, 0, IPC_STAT, &arg);
10844         if (st == 0)
10845             printf("semid_ds\n");
10846         else
10847 #       endif /* IPC_STAT */
10848             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10849 #       ifdef IPC_RMID
10850         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10851 #       endif /* IPC_RMID */
10852             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10853     } else
10854 #endif /* IPC_PRIVATE && ... */
10855         printf("semget failed: errno = %d\n", errno);
10856
10857     return 0;
10858 }
10859 END
10860     val="$undef"
10861     set try
10862     if eval $compile; then
10863         xxx=`./try`
10864         case "$xxx" in
10865         semid_ds) val="$define" ;;
10866         esac
10867     fi
10868     $rm -f try try.c
10869     set d_semctl_semid_ds
10870     eval $setvar
10871     case "$d_semctl_semid_ds" in
10872     $define)
10873         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10874         ;;
10875     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10876         ;;
10877     esac
10878     $rm -f try.h
10879     ;;
10880 *)  val="$undef"
10881
10882     # We do not have the full sem*(2) library, so assume we can not
10883     # use either.
10884
10885     set d_semctl_semun
10886     eval $setvar
10887
10888     set d_semctl_semid_ds
10889     eval $setvar
10890     ;;
10891 esac
10892
10893 : see if setegid exists
10894 set setegid d_setegid
10895 eval $inlibc
10896
10897 : see if seteuid exists
10898 set seteuid d_seteuid
10899 eval $inlibc
10900
10901 : see if setgrent exists
10902 set setgrent d_setgrent
10903 eval $inlibc
10904
10905 : see if sethostent exists
10906 set sethostent d_sethent
10907 eval $inlibc
10908
10909 : see if setlinebuf exists
10910 set setlinebuf d_setlinebuf
10911 eval $inlibc
10912
10913 : see if setlocale exists
10914 set setlocale d_setlocale
10915 eval $inlibc
10916
10917 : see if setnetent exists
10918 set setnetent d_setnent
10919 eval $inlibc
10920
10921 : see if setprotoent exists
10922 set setprotoent d_setpent
10923 eval $inlibc
10924
10925 : see if setpgid exists
10926 set setpgid d_setpgid
10927 eval $inlibc
10928
10929 : see if setpgrp2 exists
10930 set setpgrp2 d_setpgrp2
10931 eval $inlibc
10932
10933 : see if setpriority exists
10934 set setpriority d_setprior
10935 eval $inlibc
10936
10937 : see if setpwent exists
10938 set setpwent d_setpwent
10939 eval $inlibc
10940
10941 : see if setregid exists
10942 set setregid d_setregid
10943 eval $inlibc
10944 set setresgid d_setresgid
10945 eval $inlibc
10946
10947 : see if setreuid exists
10948 set setreuid d_setreuid
10949 eval $inlibc
10950 set setresuid d_setresuid
10951 eval $inlibc
10952
10953 : see if setrgid exists
10954 set setrgid d_setrgid
10955 eval $inlibc
10956
10957 : see if setruid exists
10958 set setruid d_setruid
10959 eval $inlibc
10960
10961 : see if setservent exists
10962 set setservent d_setsent
10963 eval $inlibc
10964
10965 : see if setsid exists
10966 set setsid d_setsid
10967 eval $inlibc
10968
10969 : see if setspent exists
10970 set setspent d_setspent
10971 eval $inlibc
10972
10973 : see if setvbuf exists
10974 set setvbuf d_setvbuf
10975 eval $inlibc
10976
10977 : see if sfio.h is available
10978 set sfio.h i_sfio
10979 eval $inhdr
10980
10981
10982 : see if sfio library is available
10983 case "$i_sfio" in
10984 $define)
10985         val=''
10986         set sfreserve val
10987         eval $inlibc
10988         ;;
10989 *)
10990         val="$undef"
10991         ;;
10992 esac
10993 : Ok, but do we want to use it.
10994 case "$val" in
10995 $define)
10996         case "$usesfio" in
10997         true|$define|[yY]*) dflt='y';;
10998         *) dflt='n';;
10999         esac
11000         echo "$package can use the sfio library, but it is experimental."
11001         rp="You seem to have sfio available, do you want to try using it?"
11002         . ./myread
11003         case "$ans" in
11004         y|Y) ;;
11005         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11006                 val="$undef"
11007                 : Remove sfio from list of libraries to use
11008                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11009                 shift
11010                 libs="$*"
11011                 echo "libs = $libs" >&4
11012                 ;;
11013         esac
11014         ;;
11015 *)      case "$usesfio" in
11016         true|$define|[yY]*)
11017                 echo "Sorry, cannot find sfio on this machine" >&4
11018                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11019                 ;;
11020         esac
11021         ;;
11022 esac
11023 set d_sfio
11024 eval $setvar
11025 case "$d_sfio" in
11026 $define) usesfio='true';;
11027 *) usesfio='false';;
11028 esac
11029
11030 : see if shmctl exists
11031 set shmctl d_shmctl
11032 eval $inlibc
11033
11034 : see if shmget exists
11035 set shmget d_shmget
11036 eval $inlibc
11037
11038 : see if shmat exists
11039 set shmat d_shmat
11040 eval $inlibc
11041 : see what shmat returns
11042 case "$d_shmat" in
11043 "$define")
11044         $cat >shmat.c <<'END'
11045 #include <sys/shm.h>
11046 void *shmat();
11047 END
11048         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11049                 shmattype='void *'
11050         else
11051                 shmattype='char *'
11052         fi
11053         echo "and it returns ($shmattype)." >&4
11054         : see if a prototype for shmat is available
11055         xxx=`./findhdr sys/shm.h`
11056         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11057         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11058                 val="$define"
11059         else
11060                 val="$undef"
11061         fi
11062         $rm -f shmat.[co]
11063         ;;
11064 *)
11065         val="$undef"
11066         ;;
11067 esac
11068 set d_shmatprototype
11069 eval $setvar
11070
11071 : see if shmdt exists
11072 set shmdt d_shmdt
11073 eval $inlibc
11074
11075 : see how much of the 'shm*(2)' library is present.
11076 h_shm=true
11077 echo " "
11078 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11079 *"$undef"*) h_shm=false;;
11080 esac
11081 case "$osname" in
11082 freebsd)
11083     case "`ipcs 2>&1`" in
11084     "SVID shared memory"*"not configured"*)
11085         echo "Your $osname does not have the shm*(2) configured." >&4
11086         h_shm=false
11087         val="$undef"
11088         set shmctl d_shmctl
11089         evat $setvar
11090         set shmget d_shmget
11091         evat $setvar
11092         set shmat d_shmat
11093         evat $setvar
11094         set shmdt d_shmdt
11095         evat $setvar
11096         ;;
11097     esac
11098     ;;
11099 esac
11100 : we could also check for sys/ipc.h ...
11101 if $h_shm && $test `./findhdr sys/shm.h`; then
11102         echo "You have the full shm*(2) library." >&4
11103         val="$define"
11104 else
11105         echo "You don't have the full shm*(2) library." >&4
11106         val="$undef"
11107 fi
11108 set d_shm
11109 eval $setvar
11110
11111 echo " "
11112 : see if we have sigaction
11113 if set sigaction val -f d_sigaction; eval $csym; $val; then
11114         echo 'sigaction() found.' >&4
11115         $cat > try.c <<'EOP'
11116 #include <stdio.h>
11117 #include <sys/types.h>
11118 #include <signal.h>
11119 int main()
11120 {
11121     struct sigaction act, oact;
11122     act.sa_flags = 0;
11123     oact.sa_handler = 0;
11124     /* so that act and oact are used */
11125     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11126 }
11127 EOP
11128         set try
11129         if eval $compile_ok; then
11130                 val="$define"
11131         else
11132                 echo "But you don't seem to have a useable struct sigaction." >&4
11133                 val="$undef"
11134         fi
11135 else
11136         echo 'sigaction NOT found.' >&4
11137         val="$undef"
11138 fi
11139 set d_sigaction; eval $setvar
11140 $rm -f try try$_o try.c
11141
11142 : see if sigsetjmp exists
11143 echo " "
11144 case "$d_sigsetjmp" in
11145 '')
11146         $cat >try.c <<'EOP'
11147 #include <setjmp.h>
11148 sigjmp_buf env;
11149 int set = 1;
11150 int main()
11151 {
11152         if (sigsetjmp(env,1))
11153                 exit(set);
11154         set = 0;
11155         siglongjmp(env, 1);
11156         exit(1);
11157 }
11158 EOP
11159         set try
11160         if eval $compile; then
11161                 if ./try >/dev/null 2>&1; then
11162                         echo "POSIX sigsetjmp found." >&4
11163                         val="$define"
11164                 else
11165                         $cat >&4 <<EOM
11166 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11167 I'll ignore them.
11168 EOM
11169                         val="$undef"
11170                 fi
11171         else
11172                 echo "sigsetjmp not found." >&4
11173                 val="$undef"
11174         fi
11175         ;;
11176 *) val="$d_sigsetjmp"
11177         case "$d_sigsetjmp" in
11178         $define) echo "POSIX sigsetjmp found." >&4;;
11179         $undef) echo "sigsetjmp not found." >&4;;
11180         esac
11181         ;;
11182 esac
11183 set d_sigsetjmp
11184 eval $setvar
11185 $rm -f try.c try
11186
11187 : see if sys/stat.h is available
11188 set sys/stat.h i_sysstat
11189 eval $inhdr
11190
11191
11192 : see if stat knows about block sizes
11193 echo " "
11194 echo "Checking to see if your struct stat has st_blocks field..." >&4
11195 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11196 eval $hasfield
11197
11198
11199 : see if this is a sys/vfs.h system
11200 set sys/vfs.h i_sysvfs
11201 eval $inhdr
11202
11203
11204 : see if this is a sys/statfs.h system
11205 set sys/statfs.h i_sysstatfs
11206 eval $inhdr
11207
11208
11209 echo " "
11210 echo "Checking to see if your system supports struct statfs..." >&4
11211 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
11212 eval $hasstruct
11213 case "$d_statfs_s" in
11214 "$define")      echo "Yes, it does."   ;;
11215 *)              echo "No, it doesn't." ;;
11216 esac
11217
11218
11219
11220 : see if struct statfs knows about f_flags
11221 case "$d_statfs_s" in
11222 define) 
11223         echo " "
11224         echo "Checking to see if your struct statfs has f_flags field..." >&4
11225         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
11226         eval $hasfield
11227         ;;
11228 *)      val="$undef"
11229         set d_statfs_f_flags
11230         eval $setvar
11231         ;;
11232 esac
11233 case "$d_statfs_f_flags" in
11234 "$define")      echo "Yes, it does."   ;;
11235 *)              echo "No, it doesn't." ;;
11236 esac
11237
11238 : see if _ptr and _cnt from stdio act std
11239 echo " "
11240 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11241         echo "(Looks like you have stdio.h from Linux.)"
11242         case "$stdio_ptr" in
11243         '') stdio_ptr='((fp)->_IO_read_ptr)'
11244                 ptr_lval=$define
11245                 ;;
11246         *)      ptr_lval=$d_stdio_ptr_lval;;
11247         esac
11248         case "$stdio_cnt" in
11249         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11250                 cnt_lval=$undef
11251                 ;;
11252         *)      cnt_lval=$d_stdio_cnt_lval;;
11253         esac
11254         case "$stdio_base" in
11255         '') stdio_base='((fp)->_IO_read_base)';;
11256         esac
11257         case "$stdio_bufsiz" in
11258         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11259         esac
11260 else
11261         case "$stdio_ptr" in
11262         '') stdio_ptr='((fp)->_ptr)'
11263                 ptr_lval=$define
11264                 ;;
11265         *)      ptr_lval=$d_stdio_ptr_lval;;
11266         esac
11267         case "$stdio_cnt" in
11268         '') stdio_cnt='((fp)->_cnt)'
11269                 cnt_lval=$define
11270                 ;;
11271         *)      cnt_lval=$d_stdio_cnt_lval;;
11272         esac
11273         case "$stdio_base" in
11274         '') stdio_base='((fp)->_base)';;
11275         esac
11276         case "$stdio_bufsiz" in
11277         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11278         esac
11279 fi
11280 : test whether _ptr and _cnt really work
11281 echo "Checking how std your stdio is..." >&4
11282 $cat >try.c <<EOP
11283 #include <stdio.h>
11284 #define FILE_ptr(fp)    $stdio_ptr
11285 #define FILE_cnt(fp)    $stdio_cnt
11286 int main() {
11287         FILE *fp = fopen("try.c", "r");
11288         char c = getc(fp);
11289         if (
11290                 18 <= FILE_cnt(fp) &&
11291                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11292         )
11293                 exit(0);
11294         exit(1);
11295 }
11296 EOP
11297 val="$undef"
11298 set try
11299 if eval $compile; then
11300         if ./try; then
11301                 echo "Your stdio acts pretty std."
11302                 val="$define"
11303         else
11304                 echo "Your stdio isn't very std."
11305         fi
11306 else
11307         echo "Your stdio doesn't appear very std."
11308 fi
11309 $rm -f try.c try
11310 set d_stdstdio
11311 eval $setvar
11312
11313 : Can _ptr be used as an lvalue?
11314 case "$d_stdstdio$ptr_lval" in
11315 $define$define) val=$define ;;
11316 *) val=$undef ;;
11317 esac
11318 set d_stdio_ptr_lval
11319 eval $setvar
11320
11321 : Can _cnt be used as an lvalue?
11322 case "$d_stdstdio$cnt_lval" in
11323 $define$define) val=$define ;;
11324 *) val=$undef ;;
11325 esac
11326 set d_stdio_cnt_lval
11327 eval $setvar
11328
11329 : see if _base is also standard
11330 val="$undef"
11331 case "$d_stdstdio" in
11332 $define)
11333         $cat >try.c <<EOP
11334 #include <stdio.h>
11335 #define FILE_base(fp)   $stdio_base
11336 #define FILE_bufsiz(fp) $stdio_bufsiz
11337 int main() {
11338         FILE *fp = fopen("try.c", "r");
11339         char c = getc(fp);
11340         if (
11341                 19 <= FILE_bufsiz(fp) &&
11342                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11343         )
11344                 exit(0);
11345         exit(1);
11346 }
11347 EOP
11348         set try
11349         if eval $compile; then
11350                 if ./try; then
11351                         echo "And its _base field acts std."
11352                         val="$define"
11353                 else
11354                         echo "But its _base field isn't std."
11355                 fi
11356         else
11357                 echo "However, it seems to be lacking the _base field."
11358         fi
11359         $rm -f try.c try
11360         ;;
11361 esac
11362 set d_stdiobase
11363 eval $setvar
11364
11365 $cat >&4 <<EOM
11366 Checking how to access stdio streams by file descriptor number...
11367 EOM
11368 case "$stdio_stream_array" in
11369 '')     $cat >try.c <<EOCP
11370 #include <stdio.h>
11371 int main() {
11372   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11373     printf("yes\n");
11374 }
11375 EOCP
11376         for s in _iob __iob __sF
11377         do
11378                 set try -DSTDIO_STREAM_ARRAY=$s
11379                 if eval $compile; then
11380                         case "`./try$exe_ext`" in
11381                         yes)    stdio_stream_array=$s; break ;;
11382                         esac
11383                 fi
11384         done
11385         $rm -f try.* try$exe_ext
11386 esac
11387 case "$stdio_stream_array" in
11388 '')     $cat >&4 <<EOM
11389 I can't figure out how to access stdio streams by file descriptor number.
11390 EOM
11391         d_stdio_stream_array="$undef"
11392         ;;
11393 *)      $cat >&4 <<EOM
11394 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11395 EOM
11396         d_stdio_stream_array="$define"
11397         ;;
11398 esac
11399
11400 : see if strcoll exists
11401 set strcoll d_strcoll
11402 eval $inlibc
11403
11404 : check for structure copying
11405 echo " "
11406 echo "Checking to see if your C compiler can copy structs..." >&4
11407 $cat >try.c <<'EOCP'
11408 int main()
11409 {
11410         struct blurfl {
11411                 int dyick;
11412         } foo, bar;
11413
11414         foo = bar;
11415 }
11416 EOCP
11417 if $cc -c try.c >/dev/null 2>&1 ; then
11418         val="$define"
11419         echo "Yup, it can."
11420 else
11421         val="$undef"
11422         echo "Nope, it can't."
11423 fi
11424 set d_strctcpy
11425 eval $setvar
11426 $rm -f try.*
11427
11428 : see if strerror and/or sys_errlist[] exist
11429 echo " "
11430 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11431     if set strerror val -f d_strerror; eval $csym; $val; then
11432                 echo 'strerror() found.' >&4
11433                 d_strerror="$define"
11434                 d_strerrm='strerror(e)'
11435                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11436                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11437                         d_syserrlst="$define"
11438                 else
11439                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11440                         d_syserrlst="$undef"
11441                 fi
11442     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11443                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11444                 echo 'strerror() found in string header.' >&4
11445                 d_strerror="$define"
11446                 d_strerrm='strerror(e)'
11447                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11448                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11449                                 d_syserrlst="$define"
11450                 else
11451                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11452                         d_syserrlst="$undef"
11453                 fi
11454     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11455                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11456                 d_strerror="$undef"
11457                 d_syserrlst="$define"
11458                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11459     else
11460                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11461                 d_strerror="$undef"
11462                 d_syserrlst="$undef"
11463                 d_strerrm='"unknown"'
11464     fi
11465 fi
11466
11467 : see if strtod exists
11468 set strtod d_strtod
11469 eval $inlibc
11470
11471 : see if strtol exists
11472 set strtol d_strtol
11473 eval $inlibc
11474
11475 : see if strtold exists
11476 set strtold d_strtold
11477 eval $inlibc
11478
11479 : see if strtoll exists
11480 set strtoll d_strtoll
11481 eval $inlibc
11482
11483 case "$d_longlong-$d_strtoll" in
11484 "$define-$define")
11485         $cat <<EOM
11486 Checking whether your strtoll() works okay...
11487 EOM
11488         $cat >try.c <<'EOCP'
11489 #include <errno.h>
11490 #ifdef __hpux
11491 #define strtoll __strtoll
11492 #endif
11493 #include <stdio.h>
11494 extern long long int strtoll(char *s, char **, int); 
11495 static int bad = 0;
11496 int check(char *s, long long ell, int een) {
11497         long long gll;
11498         errno = 0;
11499         gll = strtoll(s, 0, 10);
11500         if (!((gll == ell) && (errno == een)))
11501                 bad++;
11502 }
11503 int main() {
11504         check(" 1",                                      1LL, 0);
11505         check(" 0",                                      0LL, 0);
11506         check("-1",                                     -1LL, 0);
11507         check("-9223372036854775808", -9223372036854775808LL, 0);
11508         check("-9223372036854775808", -9223372036854775808LL, 0);
11509         check(" 9223372036854775807",  9223372036854775807LL, 0);
11510         check("-9223372036854775808", -9223372036854775808LL, 0);
11511         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11512         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11513         if (!bad)
11514                 printf("ok\n");
11515 }
11516 EOCP
11517         set try
11518         if eval $compile; then
11519                 case "`./try`" in
11520                 ok) echo "Your strtoll() seems to be working okay." ;;
11521                 *) cat <<EOM >&4
11522 Your strtoll() doesn't seem to be working okay.
11523 EOM
11524                    d_strtoll="$undef"
11525                    ;;
11526                 esac
11527         fi
11528         ;;
11529 esac
11530
11531 : see if strtoul exists
11532 set strtoul d_strtoul
11533 eval $inlibc
11534
11535 : see if strtoull exists
11536 set strtoull d_strtoull
11537 eval $inlibc
11538
11539 case "$d_longlong-$d_strtoull" in
11540 "$define-$define")
11541         $cat <<EOM
11542 Checking whether your strtoull() works okay...
11543 EOM
11544         $cat >try.c <<'EOCP'
11545 #include <errno.h>
11546 #ifdef __hpux
11547 #define strtoull __strtoull
11548 #endif
11549 #include <stdio.h>
11550 extern unsigned long long int strtoull(char *s, char **, int); 
11551 static int bad = 0;
11552 int check(char *s, long long eull, int een) {
11553         long long gull;
11554         errno = 0;
11555         gull = strtoull(s, 0, 10);
11556         if (!((gull == eull) && (errno == een)))
11557                 bad++;
11558 }
11559 int main() {
11560         check(" 1",                                       1LL, 0);
11561         check(" 0",                                       0LL, 0);
11562         check("18446744073709551615", 18446744073709551615ULL, 0);
11563         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11564         if (!bad)
11565                 printf("ok\n");
11566 }
11567 EOCP
11568         set try
11569         if eval $compile; then
11570                 case "`./try`" in
11571                 ok) echo "Your strtoull() seems to be working okay." ;;
11572                 *) cat <<EOM >&4
11573 Your strtoull() doesn't seem to be working okay.
11574 EOM
11575                    d_strtoull="$undef"
11576                    ;;
11577                 esac
11578         fi
11579         ;;
11580 esac
11581
11582 : see if strtouq exists
11583 set strtouq d_strtouq
11584 eval $inlibc
11585
11586 : see if strxfrm exists
11587 set strxfrm d_strxfrm
11588 eval $inlibc
11589
11590 : see if symlink exists
11591 set symlink d_symlink
11592 eval $inlibc
11593
11594 : see if syscall exists
11595 set syscall d_syscall
11596 eval $inlibc
11597
11598 : see if sysconf exists
11599 set sysconf d_sysconf
11600 eval $inlibc
11601
11602 : see if system exists
11603 set system d_system
11604 eval $inlibc
11605
11606 : see if tcgetpgrp exists
11607 set tcgetpgrp d_tcgetpgrp
11608 eval $inlibc
11609
11610 : see if tcsetpgrp exists
11611 set tcsetpgrp d_tcsetpgrp
11612 eval $inlibc
11613
11614 : see if prototype for telldir is available
11615 echo " "
11616 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11617 eval $hasproto
11618
11619 : see if this is a sys/times.h system
11620 set sys/times.h i_systimes
11621 eval $inhdr
11622
11623 : see if times exists
11624 echo " "
11625 if set times val -f d_times; eval $csym; $val; then
11626         echo 'times() found.' >&4
11627         d_times="$define"
11628         inc=''
11629         case "$i_systimes" in
11630         "$define") inc='sys/times.h';;
11631         esac
11632         rp="What is the type returned by times() on this system?"
11633         set clock_t clocktype long stdio.h sys/types.h $inc
11634         eval $typedef_ask
11635 else
11636         echo 'times() NOT found, hope that will do.' >&4
11637         d_times="$undef"
11638         clocktype='int'
11639 fi
11640
11641 : see if truncate exists
11642 set truncate d_truncate
11643 eval $inlibc
11644
11645 : see if tzname[] exists
11646 echo " "
11647 if set tzname val -a d_tzname; eval $csym; $val; then
11648         val="$define"
11649         echo 'tzname[] found.' >&4
11650 else
11651         val="$undef"
11652         echo 'tzname[] NOT found.' >&4
11653 fi
11654 set d_tzname
11655 eval $setvar
11656
11657 : see if umask exists
11658 set umask d_umask
11659 eval $inlibc
11660
11661 : see if ustat exists
11662 set ustat d_ustat
11663 eval $inlibc
11664
11665 : backward compatibility for d_hvfork
11666 if test X$d_hvfork != X; then
11667         d_vfork="$d_hvfork"
11668         d_hvfork=''
11669 fi
11670 : see if there is a vfork
11671 val=''
11672 set vfork val
11673 eval $inlibc
11674
11675 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11676 : perl on Solaris 2.x, and probably elsewhere.
11677 case "$val" in
11678 $define)
11679         echo " "
11680         case "$usevfork" in
11681         false) dflt='n';;
11682         *) dflt='y';;
11683         esac
11684         cat <<'EOM'
11685  
11686 Perl can only use a vfork() that doesn't suffer from strict
11687 restrictions on calling functions or modifying global data in
11688 the child.  For example, glibc-2.1 contains such a vfork()
11689 that is unsuitable.  If your system provides a proper fork()
11690 call, chances are that you do NOT want perl to use vfork().
11691
11692 EOM
11693         rp="Do you still want to use vfork()?"
11694         . ./myread
11695         case "$ans" in
11696         y|Y) ;;
11697         *)
11698                 echo "Ok, we won't use vfork()."
11699                 val="$undef"
11700                 ;;
11701         esac
11702         ;;
11703 esac
11704 set d_vfork
11705 eval $setvar
11706 case "$d_vfork" in
11707 $define) usevfork='true';;
11708 *) usevfork='false';;
11709 esac
11710
11711 : see if this is an sysdir system
11712 set sys/dir.h i_sysdir
11713 eval $inhdr
11714
11715 : see if this is an sysndir system
11716 set sys/ndir.h i_sysndir
11717 eval $inhdr
11718
11719 : see if closedir exists
11720 set closedir d_closedir
11721 eval $inlibc
11722
11723 case "$d_closedir" in
11724 "$define")
11725         echo " "
11726         echo "Checking whether closedir() returns a status..." >&4
11727         cat > closedir.c <<EOM
11728 #$i_dirent I_DIRENT             /**/
11729 #$i_sysdir I_SYS_DIR            /**/
11730 #$i_sysndir I_SYS_NDIR          /**/
11731 #$i_systypes I_SYS_TYPES        /**/
11732
11733 #if defined(I_SYS_TYPES)
11734 #include <sys/types.h>
11735 #endif
11736 #if defined(I_DIRENT)
11737 #include <dirent.h>
11738 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11739 #include <sys/dir.h>
11740 #endif
11741 #else
11742 #ifdef I_SYS_NDIR
11743 #include <sys/ndir.h>
11744 #else
11745 #ifdef I_SYS_DIR
11746 #ifdef hp9000s500
11747 #include <ndir.h>       /* may be wrong in the future */
11748 #else
11749 #include <sys/dir.h>
11750 #endif
11751 #endif
11752 #endif
11753 #endif 
11754 int main() { return closedir(opendir(".")); }
11755 EOM
11756         set closedir
11757         if eval $compile_ok; then
11758                 if ./closedir > /dev/null 2>&1 ; then
11759                         echo "Yes, it does."
11760                         val="$undef"
11761                 else
11762                         echo "No, it doesn't."
11763                         val="$define"
11764                 fi
11765         else
11766                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11767                 val="$define"
11768         fi
11769         ;;
11770 *)
11771         val="$undef";
11772         ;;
11773 esac
11774 set d_void_closedir
11775 eval $setvar
11776 $rm -f closedir*
11777 : check for volatile keyword
11778 echo " "
11779 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11780 $cat >try.c <<'EOCP'
11781 int main()
11782 {
11783         typedef struct _goo_struct goo_struct;
11784         goo_struct * volatile goo = ((goo_struct *)0);
11785         struct _goo_struct {
11786                 long long_int;
11787                 int reg_int;
11788                 char char_var;
11789         };
11790         typedef unsigned short foo_t;
11791         char *volatile foo;
11792         volatile int bar;
11793         volatile foo_t blech;
11794         foo = foo;
11795 }
11796 EOCP
11797 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11798         val="$define"
11799         echo "Yup, it does."
11800 else
11801         val="$undef"
11802         echo "Nope, it doesn't."
11803 fi
11804 set d_volatile
11805 eval $setvar
11806 $rm -f try.*
11807
11808 : see if there is a wait4
11809 set wait4 d_wait4
11810 eval $inlibc
11811
11812 : see if waitpid exists
11813 set waitpid d_waitpid
11814 eval $inlibc
11815
11816 : see if wcstombs exists
11817 set wcstombs d_wcstombs
11818 eval $inlibc
11819
11820 : see if wctomb exists
11821 set wctomb d_wctomb
11822 eval $inlibc
11823
11824 : preserve RCS keywords in files with variable substitution, grrr
11825 Date='$Date'
11826 Id='$Id'
11827 Log='$Log'
11828 RCSfile='$RCSfile'
11829 Revision='$Revision'
11830
11831 case "$crosscompile" in
11832 ''|[nN]*) crosscompile="$undef" ;;
11833 esac
11834
11835 case "$osname" in
11836 next|rhapsody|darwin) multiarch="$define" ;;
11837 esac
11838 case "$multiarch" in
11839 ''|[nN]*) multiarch="$undef" ;;
11840 esac
11841
11842 : check for alignment requirements
11843 echo " "
11844 case "$crosscompile$multiarch" in
11845 *$define*)
11846         $cat <<EOM
11847 You seem to be either cross-compiling or doing a multiarchitecture build,
11848 skipping the memory alignment check.
11849
11850 EOM
11851         case "$alignbytes" in
11852         '') alignbytes=8 ;;
11853         esac
11854         ;;
11855 *)
11856         case "$alignbytes" in
11857         '') echo "Checking alignment constraints..." >&4
11858                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11859                         $cat >try.c <<'EOCP'
11860 typedef long double NV;
11861 EOCP
11862                 else
11863                         $cat >try.c <<'EOCP'
11864 typedef double NV;
11865 EOCP
11866                 fi
11867                 $cat >>try.c <<'EOCP'
11868 #include <stdio.h>
11869 struct foobar {
11870         char foo;
11871         NV bar;
11872 } try_algn;
11873 int main()
11874 {
11875     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11876     return(0);
11877 }
11878 EOCP
11879                 set try
11880                 if eval $compile_ok; then
11881                         dflt=`./try`
11882                 else
11883                         dflt='8'
11884                         echo "(I can't seem to compile the test program...)"
11885                 fi
11886                 ;;
11887         *) dflt="$alignbytes"
11888                 ;;
11889         esac
11890         rp="Doubles must be aligned on a how-many-byte boundary?"
11891         . ./myread
11892         alignbytes="$ans"
11893         $rm -f try.c try
11894         ;;
11895 esac
11896
11897
11898 : set the base revision
11899 baserev=5.0
11900
11901 : check for ordering of bytes in a long
11902 echo " "
11903 case "$crosscompile$multiarch" in
11904 *$define*)
11905         $cat <<EOM
11906 You seem to be either cross-compiling or doing a multiarchitecture build,
11907 skipping the byteorder check.
11908
11909 EOM
11910         byteorder='0xffff'
11911         ;;
11912 *)
11913         case "$byteorder" in
11914         '')
11915                 $cat <<'EOM'
11916 In the following, larger digits indicate more significance.  A big-endian
11917 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11918 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11919 machines may have weird orders like 3412.  A Cray will report 87654321,
11920 an Alpha will report 12345678. If the test program works the default is
11921 probably right.
11922 I'm now running the test program...
11923 EOM
11924                 $cat >try.c <<'EOCP'
11925 #include <stdio.h>
11926 int main()
11927 {
11928         int i;
11929         union {
11930                 unsigned long l;
11931                 char c[sizeof(long)];
11932         } u;
11933
11934         if (sizeof(long) > 4)
11935                 u.l = (0x08070605L << 32) | 0x04030201L;
11936         else
11937                 u.l = 0x04030201L;
11938         for (i = 0; i < sizeof(long); i++)
11939                 printf("%c", u.c[i]+'0');
11940         printf("\n");
11941         exit(0);
11942 }
11943 EOCP
11944                 xxx_prompt=y
11945                 set try
11946                 if eval $compile && ./try > /dev/null; then
11947                         dflt=`./try`
11948                         case "$dflt" in
11949                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11950                                 echo "(The test program ran ok.)"
11951                                 echo "byteorder=$dflt"
11952                                 xxx_prompt=n
11953                         ;;
11954                         ????|????????) echo "(The test program ran ok.)" ;;
11955                         *) echo "(The test program didn't run right for some reason.)" ;;
11956                         esac
11957                 else
11958                         dflt='4321'
11959                         cat <<'EOM'
11960 (I can't seem to compile the test program.  Guessing big-endian...)
11961 EOM
11962                 fi
11963                 case "$xxx_prompt" in
11964                 y)
11965                         rp="What is the order of bytes in a long?"
11966                         . ./myread
11967                         byteorder="$ans"
11968                         ;;
11969                 *)      byteorder=$dflt
11970                         ;;
11971                 esac
11972                 ;;
11973         esac
11974         $rm -f try.c try
11975         ;;
11976 esac
11977
11978
11979 : how do we catenate cpp tokens here?
11980 echo " "
11981 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11982 $cat >cpp_stuff.c <<'EOCP'
11983 #define RCAT(a,b)a/**/b
11984 #define ACAT(a,b)a ## b
11985 RCAT(Rei,ser)
11986 ACAT(Cir,cus)
11987 EOCP
11988 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11989 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11990         echo "Oh!  Smells like ANSI's been here." >&4
11991         echo "We can catify or stringify, separately or together!"
11992         cpp_stuff=42
11993 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11994         echo "Ah, yes!  The good old days!" >&4
11995         echo "However, in the good old days we don't know how to stringify and"
11996         echo "catify at the same time."
11997         cpp_stuff=1
11998 else
11999         $cat >&4 <<EOM
12000 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12001 to have to edit the values of CAT[2-5] in config.h...
12002 EOM
12003         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12004 fi
12005 $rm -f cpp_stuff.*
12006
12007 : see if this is a db.h system
12008 set db.h i_db
12009 eval $inhdr
12010
12011 case "$i_db" in
12012 $define)
12013         : Check db version.
12014         echo " "
12015         echo "Checking Berkeley DB version ..." >&4
12016         $cat >try.c <<EOCP
12017 #$d_const HASCONST
12018 #ifndef HASCONST
12019 #define const
12020 #endif
12021 #include <sys/types.h>
12022 #include <stdio.h>
12023 #include <db.h>
12024 int main()
12025 {
12026 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12027     int Major, Minor, Patch ;
12028     unsigned long Version ;
12029     (void)db_version(&Major, &Minor, &Patch) ;
12030     printf("You have Berkeley DB Version 2 or greater\n");
12031
12032     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12033                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12034     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12035                 Major, Minor, Patch) ;
12036
12037     /* check that db.h & libdb are compatible */
12038     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12039         printf("db.h and libdb are incompatible\n") ;
12040         exit(3);        
12041     }
12042
12043     printf("db.h and libdb are compatible\n") ;
12044
12045     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12046                 + DB_VERSION_PATCH ;
12047
12048     /* needs to be >= 2.3.4 */
12049     if (Version < 2003004) {
12050     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12051         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12052         exit(2);        
12053     }
12054
12055     exit(0);
12056 #else
12057 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12058     printf("You have Berkeley DB Version 1\n");
12059     exit(0);    /* DB version < 2: the coast is clear. */
12060 #else
12061     exit(1);    /* <db.h> not Berkeley DB? */
12062 #endif
12063 #endif
12064 }
12065 EOCP
12066         set try
12067         if eval $compile_ok && ./try; then
12068                 echo 'Looks OK.' >&4
12069         else
12070                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12071                 i_db=$undef
12072                 case " $libs " in
12073                 *"-ldb "*)
12074                         : Remove db from list of libraries to use
12075                         echo "Removing unusable -ldb from library list" >&4
12076                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12077                         shift
12078                         libs="$*"
12079                         echo "libs = $libs" >&4
12080                         ;;
12081                 esac
12082         fi
12083         $rm -f try.*
12084         ;;
12085 esac
12086
12087 case "$i_db" in
12088 define)
12089         : Check the return type needed for hash 
12090         echo " "
12091         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12092         $cat >try.c <<EOCP
12093 #$d_const HASCONST
12094 #ifndef HASCONST
12095 #define const
12096 #endif
12097 #include <sys/types.h>
12098 #include <db.h>
12099
12100 #ifndef DB_VERSION_MAJOR
12101 u_int32_t hash_cb (ptr, size)
12102 const void *ptr;
12103 size_t size;
12104 {
12105 }
12106 HASHINFO info;
12107 int main()
12108 {
12109         info.hash = hash_cb;
12110 }
12111 #endif
12112 EOCP
12113         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12114                 if $contains warning try.out >>/dev/null 2>&1 ; then
12115                         db_hashtype='int'
12116                 else
12117                         db_hashtype='u_int32_t'
12118                 fi
12119         else
12120                 : XXX Maybe we should just give up here.
12121                 db_hashtype=u_int32_t
12122                 $cat try.out >&4
12123                 echo "Help:  I can't seem to compile the db test program." >&4
12124                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12125         fi
12126         $rm -f try.*
12127         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12128         ;;
12129 *)      db_hashtype=u_int32_t
12130         ;;
12131 esac
12132 case "$i_db" in
12133 define)
12134         : Check the return type needed for prefix 
12135         echo " "
12136         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12137         cat >try.c <<EOCP
12138 #$d_const HASCONST
12139 #ifndef HASCONST
12140 #define const
12141 #endif
12142 #include <sys/types.h>
12143 #include <db.h>
12144
12145 #ifndef DB_VERSION_MAJOR
12146 size_t prefix_cb (key1, key2)
12147 const DBT *key1;
12148 const DBT *key2;
12149 {
12150 }
12151 BTREEINFO info;
12152 int main()
12153 {
12154         info.prefix = prefix_cb;
12155 }
12156 #endif
12157 EOCP
12158         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12159                 if $contains warning try.out >>/dev/null 2>&1 ; then
12160                         db_prefixtype='int'
12161                 else
12162                         db_prefixtype='size_t'
12163                 fi
12164         else
12165                 db_prefixtype='size_t'
12166                 : XXX Maybe we should just give up here.
12167                 $cat try.out >&4
12168                 echo "Help:  I can't seem to compile the db test program." >&4
12169                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12170         fi
12171         $rm -f try.*
12172         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12173         ;;
12174 *)      db_prefixtype='size_t'
12175         ;;
12176 esac
12177
12178 : check for void type
12179 echo " "
12180 echo "Checking to see how well your C compiler groks the void type..." >&4
12181 case "$voidflags" in
12182 '')
12183         $cat >try.c <<'EOCP'
12184 #if TRY & 1
12185 void sub() {
12186 #else
12187 sub() {
12188 #endif
12189         extern void moo();      /* function returning void */
12190         void (*goo)();          /* ptr to func returning void */
12191 #if TRY & 8
12192         void *hue;              /* generic ptr */
12193 #endif
12194 #if TRY & 2
12195         void (*foo[10])();
12196 #endif
12197
12198 #if TRY & 4
12199         if(goo == moo) {
12200                 exit(0);
12201         }
12202 #endif
12203         exit(0);
12204 }
12205 int main() { sub(); }
12206 EOCP
12207         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12208                 voidflags=$defvoidused
12209         echo "Good.  It appears to support void to the level $package wants.">&4
12210                 if $contains warning .out >/dev/null 2>&1; then
12211                         echo "However, you might get some warnings that look like this:"
12212                         $cat .out
12213                 fi
12214         else
12215 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12216                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12217                         echo "It supports 1..."
12218                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12219                                 echo "It also supports 2..."
12220                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12221                                         voidflags=7
12222                                         echo "And it supports 4 but not 8 definitely."
12223                                 else
12224                                         echo "It doesn't support 4..."
12225                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12226                                                 voidflags=11
12227                                                 echo "But it supports 8."
12228                                         else
12229                                                 voidflags=3
12230                                                 echo "Neither does it support 8."
12231                                         fi
12232                                 fi
12233                         else
12234                                 echo "It does not support 2..."
12235                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12236                                         voidflags=13
12237                                         echo "But it supports 4 and 8."
12238                                 else
12239                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12240                                                 voidflags=5
12241                                                 echo "And it supports 4 but has not heard about 8."
12242                                         else
12243                                                 echo "However it supports 8 but not 4."
12244                                         fi
12245                                 fi
12246                         fi
12247                 else
12248                         echo "There is no support at all for void."
12249                         voidflags=0
12250                 fi
12251         fi
12252 esac
12253 case "$voidflags" in
12254 "$defvoidused") ;;
12255 *)      $cat >&4 <<'EOM'
12256   Support flag bits are:
12257     1: basic void declarations.
12258     2: arrays of pointers to functions returning void.
12259     4: operations between pointers to and addresses of void functions.
12260     8: generic void pointers.
12261 EOM
12262         dflt="$voidflags";
12263         rp="Your void support flags add up to what?"
12264         . ./myread
12265         voidflags="$ans"
12266         ;;
12267 esac
12268 $rm -f try.* .out
12269
12270
12271 : How can we generate normalized random numbers ?
12272 echo " "
12273 echo "Looking for a random number function..." >&4
12274 case "$randfunc" in
12275 '')
12276         if set drand48 val -f; eval $csym; $val; then
12277                 dflt="drand48"
12278                 echo "Good, found drand48()." >&4
12279         elif set random val -f; eval $csym; $val; then
12280                 dflt="random"
12281                 echo "OK, found random()." >&4
12282         else
12283                 dflt="rand"
12284                 echo "Yick, looks like I have to use rand()." >&4
12285         fi
12286         echo " "
12287         ;;
12288 *)
12289         dflt="$randfunc"
12290         ;;
12291 esac
12292 cont=true
12293
12294 case "$ccflags" in
12295 *-Dmy_rand=*|*-Dmy_srand=*)
12296         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12297         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12298         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12299         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12300         ;;
12301 esac
12302
12303 while $test "$cont"; do
12304         rp="Use which function to generate random numbers?"
12305         . ./myread
12306         if $test "$ans" = "$dflt"; then
12307                 : null
12308         else
12309                 randbits=''
12310         fi
12311         randfunc="$ans"
12312         if set $ans val -f; eval $csym; $val; then
12313                 cont=''
12314         else
12315                 dflt=y
12316                 rp="I cannot find function $ans. Use that name anyway?"
12317                 . ./myread
12318                 dflt=rand
12319                 case "$ans" in
12320                         [yY]*) cont='';;
12321                 esac
12322         fi
12323         case "$cont" in
12324         '')
12325                 case "$randfunc" in
12326                 drand48)
12327                         drand01="drand48()"
12328                         seedfunc="srand48"
12329                         randbits=48
12330                         randseedtype=long
12331                         ;;
12332                 rand|random)
12333                         case "$randbits" in
12334                         '')
12335 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12336                                 $cat >try.c <<EOCP
12337 #$i_unistd I_UNISTD
12338 #$i_stdlib I_STDLIB
12339 #include <stdio.h>
12340 #ifdef I_UNISTD
12341 #  include <unistd.h>
12342 #endif
12343 #ifdef I_STDLIB
12344 #  include <stdlib.h>
12345 #endif
12346 int main()
12347 {
12348         register int i;
12349         register unsigned long tmp;
12350         register unsigned long max = 0L;
12351
12352         for (i = 1000; i; i--) {
12353                 tmp = (unsigned long) $randfunc();
12354                 if (tmp > max) max = tmp;
12355         }
12356         for (i = 0; max; i++)
12357                 max /= 2;
12358         printf("%d\n",i);
12359 }
12360 EOCP
12361                                 set try
12362                                 if eval $compile_ok; then
12363                                         dflt=`try`
12364                                 else
12365                                         dflt='?'
12366                                         echo "(I can't seem to compile the test program...)"
12367                                 fi
12368                                 ;;
12369                         *)
12370                                 dflt="$randbits"
12371                                 ;;
12372                         esac
12373                         rp="How many bits does your $randfunc() function produce?"
12374                         . ./myread
12375                         randbits="$ans"
12376                         $rm -f try.c try
12377                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12378                         seedfunc="s$randfunc"
12379                         randseedtype=unsigned
12380                         ;;
12381                 *)
12382                         dflt="31"
12383                         rp="How many bits does your $randfunc() function produce?"
12384                         . ./myread
12385                         randbits="$ans"
12386                         seedfunc="s$randfunc"
12387                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12388                         if set $seedfunc val -f; eval $csym; $val; then
12389                                 echo "(Using $seedfunc() to seed random generator)"
12390                         else
12391                                 echo "(Warning: no $seedfunc() to seed random generator)"
12392                                 seedfunc=rand
12393                         fi
12394                         randseedtype=unsigned
12395                         ;;
12396                 esac
12397                 ;;
12398         esac
12399 done
12400
12401 echo " "
12402 echo "Determining whether or not we are on an EBCDIC system..." >&4
12403 $cat >tebcdic.c <<'EOM'
12404 int main()
12405 {
12406   if ('M'==0xd4) return 0;
12407   return 1;
12408 }
12409 EOM
12410
12411 val=$undef
12412 set tebcdic
12413 if eval $compile_ok; then
12414         if ./tebcdic; then
12415                 echo "You have EBCDIC." >&4
12416                 val="$define"
12417         else
12418                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12419         fi
12420 else
12421         echo "I'm unable to compile the test program." >&4
12422         echo "I'll assume ASCII or some ISO Latin." >&4
12423 fi
12424 $rm -f tebcdic.c tebcdic
12425 set ebcdic
12426 eval $setvar
12427
12428 echo " "
12429 $cat >&4 <<EOM
12430 Checking how to flush all pending stdio output...
12431 EOM
12432 # I only know how to find the first 32 possibly open files on SunOS.
12433 # See also hints/sunos_4_1.sh and util.c  --AD
12434 case "$osname" in
12435 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12436 esac
12437 $cat >>try.c <<EOCP
12438 #include <stdio.h>
12439 #$i_unistd I_UNISTD
12440 #ifdef I_UNISTD
12441 # include <unistd.h>
12442 #endif
12443 #$d_sysconf HAS_SYSCONF
12444 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12445 #ifdef HAS_STDIO_STREAM_ARRAY
12446 # define STDIO_STREAM_ARRAY $stdio_stream_array
12447 #endif
12448 int main() {
12449   FILE* p = fopen("try.out", "w");
12450 #ifdef TRY_FPUTC
12451   fputc('x', p);
12452 #else
12453 # ifdef TRY_FPRINTF
12454   fprintf(p, "x");
12455 # endif
12456 #endif
12457 #ifdef TRY_FFLUSH_NULL
12458   fflush(NULL);
12459 #endif
12460 #ifdef TRY_FFLUSH_ALL
12461   {
12462     long open_max = -1;
12463 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12464     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12465 # else
12466 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12467     open_max = sysconf(_SC_OPEN_MAX);
12468 #  else
12469 #   ifdef FOPEN_MAX
12470     open_max = FOPEN_MAX;
12471 #   else
12472 #    ifdef OPEN_MAX
12473     open_max = OPEN_MAX;
12474 #    else
12475 #     ifdef _NFILE
12476     open_max = _NFILE;
12477 #     endif
12478 #    endif
12479 #   endif
12480 #  endif
12481 # endif 
12482 # ifdef HAS_STDIO_STREAM_ARRAY
12483     if (open_max > 0) {
12484       long i;
12485       for (i = 0; i < open_max; i++)
12486             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12487                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12488                 STDIO_STREAM_ARRAY[i]._flag)
12489                 fflush(&STDIO_STREAM_ARRAY[i]);
12490     }   
12491   }
12492 # endif
12493 #endif
12494   _exit(42);
12495 }
12496 EOCP
12497 : first we have to find out how _not_ to flush
12498 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12499     output=''
12500     set try -DTRY_FPUTC
12501     if eval $compile; then
12502             $rm -f try.out
12503             ./try$exe_ext 2>/dev/null
12504             if $test ! -s try.out -a "X$?" = X42; then
12505                 output=-DTRY_FPUTC
12506             fi
12507     fi
12508     case "$output" in
12509     '')
12510             set try -DTRY_FPRINTF
12511             $rm -f try.out
12512             if eval $compile; then
12513                     $rm -f try.out
12514                     ./try$exe_ext 2>/dev/null
12515                     if $test ! -s try.out -a "X$?" = X42; then
12516                         output=-DTRY_FPRINTF
12517                     fi
12518             fi
12519         ;;
12520     esac
12521 fi
12522 : check for fflush NULL behaviour
12523 case "$fflushNULL" in
12524 '')     set try -DTRY_FFLUSH_NULL $output
12525         if eval $compile; then
12526                 $rm -f try.out
12527                 ./try$exe_ext 2>/dev/null
12528                 code="$?"
12529                 if $test -s try.out -a "X$code" = X42; then
12530                         fflushNULL="`$cat try.out`"
12531                 else
12532                         if $test "X$code" != X42; then
12533                                 $cat >&4 <<EOM
12534 (If this test failed, don't worry, we'll try another method shortly.)
12535 EOM
12536                         fi
12537                 fi
12538         fi
12539         $rm -f core try.core core.try.*
12540         case "$fflushNULL" in
12541         x)      $cat >&4 <<EOM
12542 Your fflush(NULL) works okay for output streams.
12543 Let's see if it clobbers input pipes...
12544 EOM
12545 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12546 # bug that improperly flushes the input end of pipes.  So we avoid the
12547 # autoflush on fork/system/exec support for now. :-(
12548 $cat >tryp.c <<EOCP
12549 #include <stdio.h>
12550 int
12551 main(int argc, char **argv)
12552 {
12553     char buf[1024];
12554     int i;
12555     char *bp = buf;
12556     while (1) {
12557         while ((i = getc(stdin)) != -1
12558                && (*bp++ = i) != '\n'
12559                && bp < &buf[1024])
12560         /* DO NOTHING */ ;
12561         *bp = '\0';
12562         fprintf(stdout, "%s", buf);
12563         fflush(NULL);
12564         if (i == -1)
12565             return 0;
12566         bp = buf;
12567     }
12568 }
12569 EOCP
12570                 fflushNULL="$define"
12571                 set tryp
12572                 if eval $compile; then
12573                     $rm -f tryp.out
12574                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12575                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12576                        $cat >&4 <<EOM
12577 fflush(NULL) seems to behave okay with input streams.
12578 EOM
12579                         fflushNULL="$define"
12580                     else
12581                         $cat >&4 <<EOM
12582 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12583 EOM
12584                         fflushNULL="$undef"
12585                     fi
12586                 fi
12587                 $rm -f core tryp.c tryp.core core.tryp.*
12588                 ;;
12589         '')     $cat >&4 <<EOM
12590 Your fflush(NULL) isn't working (contrary to ANSI C).
12591 EOM
12592                 fflushNULL="$undef"
12593                 ;;
12594         *)      $cat >&4 <<EOM
12595 Cannot figure out whether your fflush(NULL) works or not.
12596 I'm assuming it doesn't (contrary to ANSI C).
12597 EOM
12598                 fflushNULL="$undef"
12599                 ;;
12600         esac
12601         ;;
12602 $define|true|[yY]*)
12603         fflushNULL="$define"
12604         ;;
12605 *)
12606         fflushNULL="$undef"
12607         ;;
12608 esac
12609 : check explicit looping only if NULL did not work, and if the pipe
12610 : bug does not show up on an explicit flush too
12611 case "$fflushNULL" in
12612 "$undef")
12613         $cat >tryp.c <<EOCP
12614 #include <stdio.h>
12615 int
12616 main(int argc, char **argv)
12617 {
12618     char buf[1024];
12619     int i;
12620     char *bp = buf;
12621     while (1) {
12622         while ((i = getc(stdin)) != -1
12623                && (*bp++ = i) != '\n'
12624                && bp < &buf[1024])
12625         /* DO NOTHING */ ;
12626         *bp = '\0';
12627         fprintf(stdout, "%s", buf);
12628         fflush(stdin);
12629         if (i == -1)
12630             return 0;
12631         bp = buf;
12632     }
12633 }
12634 EOCP
12635         set tryp
12636         if eval $compile; then
12637             $rm -f tryp.out
12638             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12639             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12640                $cat >&4 <<EOM
12641 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12642 EOM
12643                 : now check for fflushall behaviour
12644                 case "$fflushall" in
12645                 '')     set try -DTRY_FFLUSH_ALL $output
12646                         if eval $compile; then
12647                                 $cat >&4 <<EOM
12648 (Now testing the other method--but note that this also may fail.)
12649 EOM
12650                                 $rm -f try.out
12651                                 ./try$exe_ext 2>/dev/null
12652                                 if $test -s try.out -a "X$?" = X42; then
12653                                         fflushall="`$cat try.out`"
12654                                 fi
12655                         fi
12656                         $rm -f core try.core core.try.*
12657                         case "$fflushall" in
12658                         x)      $cat >&4 <<EOM
12659 Whew. Flushing explicitly all the stdio streams works.
12660 EOM
12661                                 fflushall="$define"
12662                                 ;;
12663                         '')     $cat >&4 <<EOM
12664 Sigh. Flushing explicitly all the stdio streams doesn't work.
12665 EOM
12666                                 fflushall="$undef"
12667                                 ;;
12668                         *)      $cat >&4 <<EOM
12669 Cannot figure out whether flushing stdio streams explicitly works or not.
12670 I'm assuming it doesn't.
12671 EOM
12672                                 fflushall="$undef"
12673                                 ;;
12674                         esac
12675                         ;;
12676                 "$define"|true|[yY]*)
12677                         fflushall="$define"
12678                         ;;
12679                 *)
12680                         fflushall="$undef"
12681                         ;;
12682                 esac
12683             else
12684                 $cat >&4 <<EOM
12685 All is futile.  Even fflush(stdin) clobbers input pipes!
12686 EOM
12687                 fflushall="$undef"
12688             fi
12689         else
12690             fflushall="$undef"
12691         fi
12692         $rm -f core tryp.c tryp.core core.tryp.*
12693         ;;
12694 *)      fflushall="$undef"
12695         ;;
12696 esac
12697
12698 case "$fflushNULL$fflushall" in
12699 undefundef)
12700         $cat <<EOM
12701 OK, I give up.  I cannot figure out how to flush pending stdio output.
12702 We won't be flushing handles at all before fork/exec/popen.
12703 EOM
12704         ;;
12705 esac
12706 $rm -f try.* try$exe_ext
12707
12708 : Store the full pathname to the ar program for use in the C program
12709 : Respect a hint or command line value for full_ar.
12710 case "$full_ar" in
12711 '') full_ar=$ar ;;
12712 esac
12713
12714 : Store the full pathname to the sed program for use in the C program
12715 full_sed=$sed
12716
12717 : see what type gids are declared as in the kernel
12718 echo " "
12719 echo "Looking for the type for group ids returned by getgid()."
12720 set gid_t gidtype xxx stdio.h sys/types.h
12721 eval $typedef
12722 case "$gidtype" in
12723 xxx)
12724         xxx=`./findhdr sys/user.h`
12725         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12726         case $1 in
12727         unsigned) dflt="$1 $2" ;;
12728         *) dflt="$1" ;;
12729         esac
12730         ;;
12731 *) dflt="$gidtype";;
12732 esac
12733 case "$gidtype" in
12734 gid_t) echo "gid_t found." ;;
12735 *)      rp="What is the type for group ids returned by getgid()?"
12736         . ./myread
12737         gidtype="$ans"
12738         ;;
12739 esac
12740
12741 echo " "
12742 case "$gidtype" in
12743 *_t) zzz="$gidtype"     ;;
12744 *)   zzz="gid"          ;;
12745 esac
12746 echo "Checking the size of $zzz..." >&4 
12747 cat > try.c <<EOCP
12748 #include <sys/types.h>
12749 #include <stdio.h>
12750 int main() {
12751     printf("%d\n", (int)sizeof($gidtype));
12752     exit(0);
12753 }
12754 EOCP
12755 set try
12756 if eval $compile_ok; then
12757         yyy=`./try`
12758         case "$yyy" in
12759         '')     gidsize=4
12760                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12761                 ;;
12762         *)      gidsize=$yyy
12763                 echo "Your $zzz is $gidsize bytes long."
12764                 ;;
12765         esac
12766 else
12767         gidsize=4
12768         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12769 fi
12770
12771
12772 echo " "
12773 case "$gidtype" in
12774 *_t) zzz="$gidtype"     ;;
12775 *)   zzz="gid"          ;;
12776 esac
12777 echo "Checking the sign of $zzz..." >&4 
12778 cat > try.c <<EOCP
12779 #include <sys/types.h>
12780 #include <stdio.h>
12781 int main() {
12782         $gidtype foo = -1;
12783         if (foo < 0)
12784                 printf("-1\n");
12785         else
12786                 printf("1\n");
12787 }
12788 EOCP
12789 set try
12790 if eval $compile; then
12791         yyy=`./try`
12792         case "$yyy" in
12793         '')     gidsign=1
12794                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12795                 ;;
12796         *)      gidsign=$yyy
12797                 case "$gidsign" in
12798                  1) echo "Your $zzz is unsigned." ;;
12799                 -1) echo "Your $zzz is signed."   ;;
12800                 esac
12801                 ;;
12802         esac
12803 else
12804         gidsign=1
12805         echo "(I can't compile the test program--guessing unsigned.)" >&4
12806 fi
12807
12808
12809 echo " "
12810
12811 if $test X"$quadtype" != X; then
12812
12813 echo "Checking how to print 64-bit integers..." >&4
12814
12815 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12816         $cat >try.c <<'EOCP'
12817 #include <sys/types.h>
12818 #include <stdio.h>
12819 int main() {
12820   int q = 12345678901;
12821   printf("%ld\n", q);
12822 }
12823 EOCP
12824         set try
12825         if eval $compile; then
12826                 yyy=`./try$exe_ext`
12827                 case "$yyy" in
12828                 12345678901)
12829                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12830                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12831                         echo "We will use %d."
12832                         ;;
12833                 esac
12834         fi
12835 fi
12836
12837 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12838         $cat >try.c <<'EOCP'
12839 #include <sys/types.h>
12840 #include <stdio.h>
12841 int main() {
12842   long q = 12345678901;
12843   printf("%ld\n", q);
12844 }
12845 EOCP
12846         set try
12847         if eval $compile; then
12848                 yyy=`./try$exe_ext`
12849                 case "$yyy" in
12850                 12345678901)
12851                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12852                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12853                         echo "We will use %ld."
12854                         ;;
12855                 esac
12856         fi
12857 fi
12858
12859 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12860         $cat >try.c <<'EOCP'
12861 #include <sys/types.h>
12862 #include <inttypes.h>
12863 #include <stdio.h>
12864 int main() {
12865   int64_t q = 12345678901;
12866   printf("%" PRId64 "\n", q);
12867 }
12868 EOCP
12869         set try
12870         if eval $compile; then
12871                 yyy=`./try$exe_ext`
12872                 case "$yyy" in
12873                 12345678901)
12874                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12875                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12876                         echo "We will use the C9X style."
12877                         ;;
12878                 esac
12879         fi
12880 fi
12881
12882 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12883         $cat >try.c <<'EOCP'
12884 #include <sys/types.h>
12885 #include <stdio.h>
12886 int main() {
12887   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12888   printf("%lld\n", q);
12889 }
12890 EOCP
12891         set try
12892         if eval $compile; then
12893                 yyy=`./try$exe_ext`
12894                 case "$yyy" in
12895                 12345678901)
12896                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12897                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12898                         echo "We will use the %lld style."
12899                         ;;
12900                 esac
12901         fi
12902 fi
12903
12904 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12905         $cat >try.c <<EOCP
12906 #include <sys/types.h>
12907 #include <stdio.h>
12908 int main() {
12909   $quadtype q = 12345678901;
12910   printf("%Ld\n", q);
12911 }
12912 EOCP
12913         set try
12914         if eval $compile; then
12915                 yyy=`./try$exe_ext`
12916                 case "$yyy" in
12917                 12345678901)
12918                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12919                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12920                         echo "We will use %Ld."
12921                         ;;
12922                 esac
12923         fi
12924 fi
12925
12926 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12927         $cat >try.c <<EOCP
12928 #include <sys/types.h>
12929 #include <stdio.h>
12930 int main() {
12931   $quadtype q = 12345678901;
12932   printf("%qd\n", q);
12933 }
12934 EOCP
12935         set try
12936         if eval $compile; then
12937                 yyy=`./try$exe_ext`
12938                 case "$yyy" in
12939                 12345678901)
12940                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12941                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12942                         echo "We will use %qd."
12943                         ;;
12944                 esac
12945         fi
12946 fi
12947
12948 if $test X"$sPRId64" = X; then
12949         echo "Cannot figure out how to print 64-bit integers." >&4
12950 fi
12951
12952 $rm -f try try.*
12953
12954 fi
12955
12956 case "$sPRId64" in
12957 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12958         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12959         ;;
12960 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12961         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12962         ;;
12963 esac
12964
12965
12966 echo " "
12967 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12968
12969 if $test X"$ivsize" = X8; then
12970         ivdformat="$sPRId64"
12971         uvuformat="$sPRIu64"
12972         uvoformat="$sPRIo64"
12973         uvxformat="$sPRIx64"
12974 else
12975         if $test X"$ivsize" = X"$longsize"; then
12976                 ivdformat='"ld"'
12977                 uvuformat='"lu"'
12978                 uvoformat='"lo"'
12979                 uvxformat='"lx"'
12980         else
12981                 if $test X"$ivsize" = X"$intsize"; then
12982                         ivdformat='"d"'
12983                         uvuformat='"u"'
12984                         uvoformat='"o"'
12985                         uvxformat='"x"'
12986                 else
12987                         : far out
12988                         if $test X"$ivsize" = X"$shortsize"; then
12989                                 ivdformat='"hd"'
12990                                 uvuformat='"hu"'
12991                                 uvoformat='"ho"'
12992                                 uvxformat='"hx"'
12993                         fi
12994                 fi
12995         fi
12996 fi
12997
12998 case "$ivdformat" in
12999 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13000     exit 1
13001     ;;
13002 esac
13003
13004
13005 echo " "
13006 $echo "Checking the format string to be used for gids..." >&4
13007
13008 case "$gidsign" in
13009 -1)     if $test X"$gidsize" = X"$ivsize"; then
13010                 gidformat="$ivdformat"
13011         else
13012                 if $test X"$gidsize" = X"$longsize"; then
13013                         gidformat='"ld"'
13014                 else
13015                         if $test X"$gidsize" = X"$intsize"; then
13016                                 gidformat='"d"'
13017                         else
13018                                 if $test X"$gidsize" = X"$shortsize"; then
13019                                         gidformat='"hd"'
13020                                 fi
13021                         fi
13022                 fi
13023         fi
13024         ;;
13025 *)      if $test X"$gidsize" = X"$uvsize"; then
13026                 gidformat="$uvuformat"
13027         else
13028                 if $test X"$gidsize" = X"$longsize"; then
13029                         gidformat='"lu"'
13030                 else
13031                         if $test X"$gidsize" = X"$intsize"; then
13032                                 gidformat='"u"'
13033                         else
13034                                 if $test X"$gidsize" = X"$shortsize"; then
13035                                         gidformat='"hu"'
13036                                 fi
13037                         fi
13038                 fi
13039         fi
13040         ;;
13041 esac
13042
13043 : see if getgroups exists
13044 set getgroups d_getgrps
13045 eval $inlibc
13046
13047 : see if setgroups exists
13048 set setgroups d_setgrps
13049 eval $inlibc
13050
13051
13052 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13053 echo " "
13054 case "$d_getgrps$d_setgrps" in
13055 *define*)
13056         case "$groupstype" in
13057         '') dflt="$gidtype" ;;
13058         *)  dflt="$groupstype" ;;
13059         esac
13060         $cat <<EOM
13061 What type of pointer is the second argument to getgroups() and setgroups()?
13062 Usually this is the same as group ids, $gidtype, but not always.
13063
13064 EOM
13065         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13066         . ./myread
13067         groupstype="$ans"
13068         ;;
13069 *)  groupstype="$gidtype";;
13070 esac
13071
13072 echo " "
13073 echo "Checking if your $make program sets \$(MAKE)..." >&4
13074 case "$make_set_make" in
13075 '')
13076         $sed 's/^X //' > testmake.mak << 'EOF'
13077 Xall:
13078 X       @echo 'maketemp="$(MAKE)"'
13079 EOF
13080         case "`$make -f testmake.mak 2>/dev/null`" in
13081         *maketemp=*) make_set_make='#' ;;
13082         *)      make_set_make="MAKE=$make" ;;
13083         esac
13084         $rm -f testmake.mak
13085         ;;
13086 esac
13087 case "$make_set_make" in
13088 '#') echo "Yup, it does.";;
13089 *) echo "Nope, it doesn't.";;
13090 esac
13091
13092 : see what type is used for mode_t
13093 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13094 set mode_t modetype int stdio.h sys/types.h
13095 eval $typedef_ask
13096
13097 : define a fucntion to check prototypes
13098 $cat > protochk <<EOSH
13099 $startsh
13100 cc="$cc"
13101 optimize="$optimize"
13102 ccflags="$ccflags"
13103 prototype="$prototype"
13104 define="$define"
13105 rm=$rm
13106 EOSH
13107
13108 $cat >> protochk <<'EOSH'
13109
13110 $rm -f try.c
13111 foo="$1"
13112 shift
13113 while test $# -ge 2; do
13114         case "$1" in
13115                 $define) echo "#include <$2>" >> try.c ;;
13116                 literal) echo "$2" >> try.c ;;
13117         esac
13118     shift 2
13119 done
13120 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13121 cat >> try.c <<'EOCP'
13122 #ifdef CAN_PROTOTYPE
13123 #define _(args) args
13124 #else
13125 #define _(args) ()
13126 #endif
13127 EOCP
13128 echo "$foo" >> try.c
13129 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13130 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13131 status=$?
13132 $rm -f try.[co]
13133 exit $status
13134 EOSH
13135 chmod +x protochk
13136 $eunicefix protochk
13137
13138 : see what type is used for size_t
13139 rp="What is the type used for the length parameter for string functions?"
13140 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13141 eval $typedef_ask
13142
13143 : check for type of arguments to gethostbyaddr. 
13144 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13145         case "$d_gethbyaddr" in
13146         $define)
13147                 $cat <<EOM
13148
13149 Checking to see what type of arguments are accepted by gethostbyaddr().
13150 EOM
13151                 hdrs="$define sys/types.h
13152                         $d_socket sys/socket.h 
13153                         $i_niin netinet/in.h 
13154                         $i_netdb netdb.h
13155                         $i_unistd unistd.h"
13156                 : The first arg can 'char *' or 'void *'
13157                 : The second arg is some of integral type
13158                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13159                         for yyy in size_t long int; do
13160                                 case "$netdb_host_type" in
13161                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13162                                         if ./protochk "$try" $hdrs; then
13163                                                 echo "Your system accepts $xxx for the first arg."
13164                                                 echo "...and $yyy for the second arg."
13165                                                 netdb_host_type="$xxx"
13166                                                 netdb_hlen_type="$yyy"
13167                                         fi
13168                                         ;;
13169                                 esac
13170                         done
13171                 done
13172                 : In case none of those worked, prompt the user.
13173                 case "$netdb_host_type" in
13174                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13175                         dflt='char *'
13176                         . ./myread
13177                         netdb_host_type=$ans
13178                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13179                         dflt="$sizetype"
13180                         . ./myread
13181                         netdb_hlen_type=$ans
13182                         ;;
13183                 esac
13184                 ;;
13185         *)      : no gethostbyaddr, so pick harmless defaults
13186                 netdb_host_type='char *'
13187                 netdb_hlen_type="$sizetype"
13188                 ;;
13189         esac
13190         # Remove the "const" if needed. -- but then we'll have a 
13191         # prototype clash!
13192         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13193 fi
13194
13195 : check for type of argument to gethostbyname. 
13196 if test "X$netdb_name_type" = X ; then
13197         case "$d_gethbyname" in
13198         $define)
13199                 $cat <<EOM
13200
13201 Checking to see what type of argument is accepted by gethostbyname().
13202 EOM
13203                 hdrs="$define sys/types.h
13204                         $d_socket sys/socket.h 
13205                         $i_niin netinet/in.h 
13206                         $i_netdb netdb.h
13207                         $i_unistd unistd.h"
13208                 for xxx in "const char *" "char *"; do
13209                         case "$netdb_name_type" in
13210                         '')     try="extern struct hostent *gethostbyname($xxx);"
13211                                 if ./protochk "$try" $hdrs; then
13212                                         echo "Your system accepts $xxx."
13213                                         netdb_name_type="$xxx"
13214                                 fi
13215                                 ;;
13216                         esac
13217                 done
13218                 : In case none of those worked, prompt the user.
13219                 case "$netdb_name_type" in
13220                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13221                         dflt='char *'
13222                         . ./myread
13223                         netdb_name_type=$ans
13224                         ;;
13225                 esac
13226                 ;;
13227         *)      : no gethostbyname, so pick harmless default
13228                 netdb_name_type='char *'
13229                 ;;
13230         esac
13231 fi
13232
13233 : check for type of 1st argument to getnetbyaddr. 
13234 if test "X$netdb_net_type" = X ; then
13235         case "$d_getnbyaddr" in
13236         $define)
13237                 $cat <<EOM
13238
13239 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13240 EOM
13241                 hdrs="$define sys/types.h
13242                         $d_socket sys/socket.h 
13243                         $i_niin netinet/in.h 
13244                         $i_netdb netdb.h
13245                         $i_unistd unistd.h"
13246                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13247                         case "$netdb_net_type" in
13248                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13249                                 if ./protochk "$try" $hdrs; then
13250                                         echo "Your system accepts $xxx."
13251                                         netdb_net_type="$xxx"
13252                                 fi
13253                                 ;;
13254                         esac
13255                 done
13256                 : In case none of those worked, prompt the user.
13257                 case "$netdb_net_type" in
13258                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13259                         dflt='long'
13260                         . ./myread
13261                         netdb_net_type=$ans
13262                         ;;
13263                 esac
13264                 ;;
13265         *)      : no getnetbyaddr, so pick harmless default
13266                 netdb_net_type='long'
13267                 ;;
13268         esac
13269 fi
13270 : locate the preferred pager for this system
13271 case "$pager" in
13272 '')
13273         dflt=''
13274         case "$pg" in
13275         /*) dflt=$pg;;
13276         esac
13277         case "$more" in
13278         /*) dflt=$more;;
13279         esac
13280         case "$less" in
13281         /*) dflt=$less;;
13282         esac
13283         case "$dflt" in
13284         '') dflt=/usr/ucb/more;;
13285         esac
13286         ;;
13287 *) dflt="$pager";;
13288 esac
13289 echo " "
13290 fn=f/
13291 rp='What pager is used on your system?'
13292 . ./getfile
13293 pager="$ans"
13294
13295 : see what type pids are declared as in the kernel
13296 rp="What is the type of process ids on this system?"
13297 set pid_t pidtype int stdio.h sys/types.h
13298 eval $typedef_ask
13299
13300 : Find earliest binary compatible site_perl subdirectory perl can use.
13301 case "$bincompat5005" in
13302 "$define") xs_apiversion='5.005' ;;
13303 *) xs_apiversion=$version ;;   # The current site_perl version.
13304 esac
13305 : Find earliest pure perl site_perl subdirectory perl can use.
13306 : The versioned directories started at 5.005.
13307 pm_apiversion='5.005'
13308
13309 : check for length of pointer
13310 echo " "
13311 case "$ptrsize" in
13312 '')
13313         echo "Checking to see how big your pointers are..." >&4
13314         if test "$voidflags" -gt 7; then
13315                 echo '#define VOID_PTR char *' > try.c
13316         else
13317                 echo '#define VOID_PTR void *' > try.c
13318         fi
13319         $cat >>try.c <<'EOCP'
13320 #include <stdio.h>
13321 int main()
13322 {
13323     printf("%d\n", (int)sizeof(VOID_PTR));
13324     exit(0);
13325 }
13326 EOCP
13327         set try
13328         if eval $compile_ok; then
13329                 ptrsize=`./try`
13330                 echo "Your pointers are $ptrsize bytes long."
13331         else
13332                 dflt='4'
13333                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13334                 rp="What is the size of a pointer (in bytes)?"
13335                 . ./myread
13336                 ptrsize="$ans"
13337         fi
13338         ;;
13339 esac
13340 $rm -f try.c try
13341
13342 : see if ar generates random libraries by itself
13343 echo " "
13344 echo "Checking how to generate random libraries on your machine..." >&4
13345 echo 'int bar1() { return bar2(); }' > bar1.c
13346 echo 'int bar2() { return 2; }' > bar2.c
13347 $cat > foo.c <<'EOP'
13348 int main() { printf("%d\n", bar1()); exit(0); }
13349 EOP
13350 $cc $ccflags -c bar1.c >/dev/null 2>&1
13351 $cc $ccflags -c bar2.c >/dev/null 2>&1
13352 $cc $ccflags -c foo.c >/dev/null 2>&1
13353 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13354 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13355         ./foobar >/dev/null 2>&1; then
13356         echo "$ar appears to generate random libraries itself."
13357         orderlib=false
13358         ranlib=":"
13359 elif $ar ts bar$_a >/dev/null 2>&1 &&
13360         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13361         ./foobar >/dev/null 2>&1; then
13362                 echo "a table of contents needs to be added with '$ar ts'."
13363                 orderlib=false
13364                 ranlib="$ar ts"
13365 else
13366         case "$ranlib" in
13367         :) ranlib='';;
13368         '')
13369                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13370                 $test -f $ranlib || ranlib=''
13371                 ;;
13372         esac
13373         if $test -n "$ranlib"; then
13374                 echo "your system has '$ranlib'; we'll use that."
13375                 orderlib=false
13376         else
13377                 echo "your system doesn't seem to support random libraries"
13378                 echo "so we'll use lorder and tsort to order the libraries."
13379                 orderlib=true
13380                 ranlib=":"
13381         fi
13382 fi
13383 $rm -f foo* bar* 
13384
13385 : check for type of arguments to select. 
13386 case "$selecttype" in
13387 '') case "$d_select" in
13388         $define)
13389                 echo " "
13390                 $cat <<EOM
13391 Checking to see what type of arguments are accepted by select().
13392 EOM
13393                 hdrs="$define sys/types.h
13394                         $i_systime sys/time.h 
13395                         $i_sysselct sys/select.h
13396                         $d_socket sys/socket.h"
13397                 : The first arg can be int, unsigned, or size_t
13398                 : The last arg may or may not be 'const'
13399                 val=''
13400                 : void pointer has been seen but using that
13401                 : breaks the selectminbits test
13402                 for xxx in 'fd_set *' 'int *'; do
13403                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13404                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13405                                         case "$val" in
13406                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13407                                                 if ./protochk "$try" $hdrs; then
13408                                                         echo "Your system accepts $xxx."
13409                                                         val="$xxx"
13410                                                 fi
13411                                                 ;;
13412                                         esac
13413                                 done
13414                         done
13415                 done
13416                 case "$val" in
13417                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13418                         case "$d_fd_set" in
13419                                 $define) dflt="fd_set *" ;;
13420                                 *)              dflt="int *" ;;
13421                         esac
13422                         . ./myread
13423                         val=$ans
13424                         ;;
13425                 esac
13426                 selecttype="$val"
13427                 ;;
13428         *)      : no select, so pick a harmless default
13429                 selecttype='int *'
13430                 ;;
13431         esac
13432         ;;
13433 esac
13434
13435 : check for the select 'width'
13436 case "$selectminbits" in
13437 '') case "$d_select" in
13438         $define)
13439                 $cat <<EOM
13440
13441 Checking to see on how many bits at a time your select() operates...
13442 EOM
13443                 $cat >try.c <<EOCP
13444 #include <sys/types.h>
13445 #$i_time I_TIME
13446 #$i_systime I_SYS_TIME
13447 #$i_systimek I_SYS_TIME_KERNEL
13448 #ifdef I_TIME
13449 #   include <time.h>
13450 #endif
13451 #ifdef I_SYS_TIME
13452 #   ifdef I_SYS_TIME_KERNEL
13453 #       define KERNEL
13454 #   endif
13455 #   include <sys/time.h>
13456 #   ifdef I_SYS_TIME_KERNEL
13457 #       undef KERNEL
13458 #   endif
13459 #endif
13460 #$i_sysselct I_SYS_SELECT
13461 #ifdef I_SYS_SELECT
13462 #include <sys/select.h>
13463 #endif
13464 #$d_socket HAS_SOCKET
13465 #ifdef HAS_SOCKET
13466 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13467 #endif
13468 #include <stdio.h>
13469 $selecttype b;
13470 #define S sizeof(*(b))
13471 #define MINBITS 64
13472 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13473 #define NBITS  (NBYTES * 8)
13474 int main() {
13475     char s[NBYTES];
13476     struct timeval t;
13477     int i;
13478     FILE* fp;
13479     int fd;
13480
13481     fclose(stdin);
13482     fp = fopen("try.c", "r");
13483     if (fp == 0)
13484       exit(1);
13485     fd = fileno(fp);
13486     if (fd < 0)
13487       exit(2);
13488     b = ($selecttype)s;
13489     for (i = 0; i < NBITS; i++)
13490         FD_SET(i, b);
13491     t.tv_sec  = 0;
13492     t.tv_usec = 0;
13493     select(fd + 1, b, 0, 0, &t);
13494     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13495     printf("%d\n", i + 1);
13496     return 0;
13497 }
13498 EOCP
13499                 set try
13500                 if eval $compile_ok; then
13501                         selectminbits=`./try`
13502                         case "$selectminbits" in
13503                         '')     cat >&4 <<EOM
13504 Cannot figure out on how many bits at a time your select() operates.
13505 I'll play safe and guess it is 32 bits.
13506 EOM
13507                                 selectminbits=32
13508                                 bits="32 bits"
13509                                 ;;
13510                         1)      bits="1 bit" ;;
13511                         *)      bits="$selectminbits bits" ;;
13512                         esac
13513                         echo "Your select() operates on $bits at a time." >&4
13514                 else
13515                         rp='What is the minimum number of bits your select() operates on?'
13516                         case "$byteorder" in
13517                         1234|12345678)  dflt=32 ;;
13518                         *)              dflt=1  ;;
13519                         esac
13520                         . ./myread
13521                         val=$ans
13522                         selectminbits="$val"
13523                 fi
13524                 $rm -f try.* try
13525                 ;;
13526         *)      : no select, so pick a harmless default
13527                 selectminbits='32'
13528                 ;;
13529         esac
13530         ;;
13531 esac
13532
13533 : Trace out the files included by signal.h, then look for SIGxxx names.
13534 : Remove SIGARRAYSIZE used by HPUX.
13535 : Remove SIGSTKSIZE used by Linux.
13536 : Remove SIGSTKSZ used by Posix.
13537 : Remove SIGTYP void lines used by OS2.
13538 : Some cpps, like os390, dont give the file name anywhere
13539 if [ "X$fieldn" = X ]; then
13540         : Just make some guesses.  We check them later.
13541         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13542 else
13543         xxx=`echo '#include <signal.h>' |
13544         $cppstdin $cppminus $cppflags 2>/dev/null |
13545         $grep '^[       ]*#.*include' | 
13546         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13547 fi
13548 : Check this list of files to be sure we have parsed the cpp output ok.
13549 : This will also avoid potentially non-existent files, such 
13550 : as ../foo/bar.h
13551 xxxfiles=''
13552 for xx in $xxx /dev/null ; do
13553         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13554 done
13555 : If we have found no files, at least try signal.h
13556 case "$xxxfiles" in
13557 '')     xxxfiles=`./findhdr signal.h` ;;
13558 esac
13559 xxx=`awk '
13560 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13561         print substr($2, 4, 20)
13562 }
13563 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13564         print substr($3, 4, 20)
13565 }' $xxxfiles`
13566 : Append some common names just in case the awk scan failed.
13567 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13568 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13569 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13570 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13571 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13572
13573 : generate a few handy files for later
13574 $cat > signal.c <<'EOCP'
13575 #include <sys/types.h>
13576 #include <signal.h>
13577 #include <stdio.h>
13578 int main() {
13579
13580 /* Strange style to avoid deeply-nested #if/#else/#endif */
13581 #ifndef NSIG
13582 #  ifdef _NSIG
13583 #    define NSIG (_NSIG)
13584 #  endif
13585 #endif
13586
13587 #ifndef NSIG
13588 #  ifdef SIGMAX
13589 #    define NSIG (SIGMAX+1)
13590 #  endif
13591 #endif
13592
13593 #ifndef NSIG
13594 #  ifdef SIG_MAX
13595 #    define NSIG (SIG_MAX+1)
13596 #  endif
13597 #endif
13598
13599 #ifndef NSIG
13600 #  ifdef MAXSIG
13601 #    define NSIG (MAXSIG+1)
13602 #  endif
13603 #endif
13604
13605 #ifndef NSIG
13606 #  ifdef MAX_SIG
13607 #    define NSIG (MAX_SIG+1)
13608 #  endif
13609 #endif
13610
13611 #ifndef NSIG
13612 #  ifdef SIGARRAYSIZE
13613 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13614 #  endif
13615 #endif
13616
13617 #ifndef NSIG
13618 #  ifdef _sys_nsig
13619 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13620 #  endif
13621 #endif
13622
13623 /* Default to some arbitrary number that's big enough to get most
13624    of the common signals.
13625 */
13626 #ifndef NSIG
13627 #    define NSIG 50
13628 #endif
13629
13630 printf("NSIG %d\n", NSIG);
13631
13632 #ifndef JUST_NSIG
13633
13634 EOCP
13635
13636 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13637 {
13638         printf "#ifdef SIG"; printf $1; printf "\n"
13639         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13640         printf $1; printf ");\n"
13641         printf "#endif\n"
13642 }
13643 END {
13644         printf "#endif /* JUST_NSIG */\n";
13645         printf "exit(0);\n}\n";
13646 }
13647 ' >>signal.c
13648 $cat >signal.awk <<'EOP'
13649 BEGIN { ndups = 0 }
13650 $1 ~ /^NSIG$/ { nsig = $2 }
13651 ($1 !~ /^NSIG$/) && (NF == 2) {
13652     if ($2 > maxsig) { maxsig = $2 }
13653     if (sig_name[$2]) {
13654         dup_name[ndups] = $1
13655         dup_num[ndups] = $2
13656         ndups++ 
13657     }
13658     else {
13659         sig_name[$2] = $1
13660         sig_num[$2] = $2
13661     }
13662 }
13663 END { 
13664     if (nsig == 0) {
13665         nsig = maxsig + 1
13666     }
13667     printf("NSIG %d\n", nsig);
13668     for (n = 1; n < nsig; n++) {
13669         if (sig_name[n]) {
13670             printf("%s %d\n", sig_name[n], sig_num[n])
13671         }
13672         else {
13673             printf("NUM%d %d\n", n, n) 
13674         }
13675     }
13676     for (n = 0; n < ndups; n++) {
13677         printf("%s %d\n", dup_name[n], dup_num[n])
13678     }
13679 }
13680 EOP
13681 $cat >signal_cmd <<EOS
13682 $startsh
13683 if $test -s signal.lst; then
13684     echo "Using your existing signal.lst file"
13685         exit 0
13686 fi
13687 xxx="$xxx"
13688 EOS
13689 $cat >>signal_cmd <<'EOS'
13690
13691 set signal
13692 if eval $compile_ok; then
13693         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13694 else
13695         echo "(I can't seem be able to compile the whole test program)" >&4
13696         echo "(I'll try it in little pieces.)" >&4
13697         set signal -DJUST_NSIG
13698         if eval $compile_ok; then
13699                 ./signal$_exe > signal.nsg
13700                 $cat signal.nsg
13701         else
13702                 echo "I can't seem to figure out how many signals you have." >&4
13703                 echo "Guessing 50." >&4
13704                 echo 'NSIG 50' > signal.nsg
13705         fi
13706         : Now look at all the signal names, one at a time.
13707         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13708                 $cat > signal.c <<EOCP
13709 #include <sys/types.h>
13710 #include <signal.h>
13711 #include <stdio.h>
13712 int main() {
13713 printf("$xx %d\n", SIG${xx});
13714 return 0;
13715 }
13716 EOCP
13717                 set signal
13718                 if eval $compile; then
13719                         echo "SIG${xx} found."
13720                         ./signal$_exe  >> signal.ls1
13721                 else
13722                         echo "SIG${xx} NOT found."
13723                 fi
13724         done
13725         if $test -s signal.ls1; then
13726                 $cat signal.nsg signal.ls1 |
13727                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13728         fi
13729
13730 fi
13731 if $test -s signal.lst; then
13732         :
13733 else
13734         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13735         echo 'kill -l' >signal
13736         set X `csh -f <signal`
13737         $rm -f signal
13738         shift
13739         case $# in
13740         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13741         esac
13742         echo $@ | $tr ' ' $trnl | \
13743             $awk '{ printf "%s %d\n", $1, ++s; }
13744                   END { printf "NSIG %d\n", ++s }' >signal.lst
13745 fi
13746 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13747 EOS
13748 chmod a+x signal_cmd
13749 $eunicefix signal_cmd
13750
13751 : generate list of signal names
13752 echo " "
13753 case "$sig_name_init" in
13754 '') doinit=yes ;;
13755 *)  case "$sig_num_init" in
13756     ''|*,*) doinit=yes ;;
13757     esac ;;
13758 esac
13759 case "$doinit" in
13760 yes)
13761         echo "Generating a list of signal names and numbers..." >&4
13762         . ./signal_cmd
13763         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13764         sig_name=`$awk 'BEGIN { printf "ZERO " }
13765                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13766         sig_num=`$awk  'BEGIN { printf "0 " }
13767                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13768         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13769                              !/^NSIG/   { printf "\"%s\", ", $1 }
13770                              END        { printf "0\n" }' signal.lst`
13771         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13772                              !/^NSIG/   { printf "%d, ", $2}
13773                              END        { printf "0\n"}' signal.lst`
13774         ;;
13775 esac
13776 echo "The following $sig_count signals are available:"
13777 echo " "
13778 echo $sig_name | $awk \
13779 'BEGIN { linelen = 0 }
13780 {
13781         for (i = 1; i <= NF; i++) {
13782                 name = "SIG" $i " "
13783                 linelen = linelen + length(name)
13784                 if (linelen > 70) {
13785                         printf "\n"
13786                         linelen = length(name)
13787                 }
13788                 printf "%s", name
13789         }
13790         printf "\n"
13791 }'
13792 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13793
13794 echo " "
13795 case "$sizetype" in
13796 *_t) zzz="$sizetype"    ;;
13797 *)   zzz="filesize"     ;;
13798 esac
13799 echo "Checking the size of $zzz..." >&4 
13800 cat > try.c <<EOCP
13801 #include <sys/types.h>
13802 #include <stdio.h>
13803 int main() {
13804     printf("%d\n", (int)sizeof($sizetype));
13805     exit(0);
13806 }
13807 EOCP
13808 set try
13809 if eval $compile_ok; then
13810         yyy=`./try`
13811         case "$yyy" in
13812         '')     sizesize=4
13813                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13814                 ;;
13815         *)      sizesize=$yyy
13816                 echo "Your $zzz size is $sizesize bytes."
13817                 ;;
13818         esac
13819 else
13820         sizesize=4
13821         echo "(I can't compile the test program--guessing $sizesize.)" >&4
13822 fi
13823
13824
13825 : check for socklen_t
13826 echo " "
13827 echo "Checking to see if you have socklen_t..." >&4
13828 $cat >try.c <<EOCP
13829 #include <sys/types.h>
13830 #$d_socket HAS_SOCKET
13831 #ifdef HAS_SOCKET
13832 #include <sys/socket.h>
13833 #endif
13834 int main() { socklen_t x = 16; }
13835 EOCP
13836 set try
13837 if eval $compile; then
13838         val="$define"
13839         echo "You have socklen_t."
13840 else
13841         val="$undef"
13842         echo "You do not have socklen_t."
13843         case "$sizetype" in
13844         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
13845         esac
13846 fi
13847 $rm -f try try.*
13848 set d_socklen_t
13849 eval $setvar
13850
13851 : check for type of the size argument to socket calls
13852 case "$d_socket" in
13853 "$define")
13854         $cat <<EOM
13855
13856 Checking to see what type is the last argument of accept().
13857 EOM
13858         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13859         yyy=''
13860         case "$d_socklen_t" in
13861         "$define") yyy="$yyy socklen_t"
13862         esac
13863         yyy="$yyy $sizetype int long"
13864         for xxx in $yyy; do
13865                 case "$socksizetype" in
13866                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13867                         if ./protochk "$try" $hdrs; then
13868                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13869                                 socksizetype="$xxx"
13870                         fi
13871                         ;;
13872                 esac
13873         done
13874 : In case none of those worked, prompt the user.
13875         case "$socksizetype" in
13876         '')     rp='What is the type for socket address structure sizes?'
13877                 dflt='int'
13878                 . ./myread
13879                 socksizetype=$ans
13880                 ;;
13881         esac
13882         ;;
13883 *)      : no sockets, so pick relatively harmless defaults
13884         socksizetype='unsigned'
13885         ;;
13886 esac
13887
13888 : see what type is used for signed size_t
13889 set ssize_t ssizetype int stdio.h sys/types.h
13890 eval $typedef
13891 dflt="$ssizetype"
13892 $cat > ssize.c <<EOM
13893 #include <stdio.h>
13894 #include <sys/types.h>
13895 #define Size_t $sizetype
13896 #define SSize_t $dflt
13897 int main()
13898 {
13899         if (sizeof(Size_t) == sizeof(SSize_t))
13900                 printf("$dflt\n");
13901         else if (sizeof(Size_t) == sizeof(int))
13902                 printf("int\n");
13903         else 
13904                 printf("long\n");
13905         exit(0);
13906 }
13907 EOM
13908 echo " "
13909 set ssize
13910 if eval $compile_ok && ./ssize > /dev/null; then
13911         ssizetype=`./ssize`
13912         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13913 else
13914         $cat >&4 <<EOM
13915 Help! I can't compile and run the ssize_t test program: please enlighten me!
13916 (This is probably a misconfiguration in your system or libraries, and
13917 you really ought to fix it.  Still, I'll try anyway.)
13918
13919 I need a type that is the same size as $sizetype, but is guaranteed to
13920 be signed.  Common values are ssize_t, int and long.
13921
13922 EOM
13923         rp="What signed type is the same size as $sizetype?"
13924         . ./myread
13925         ssizetype="$ans"
13926 fi
13927 $rm -f ssize ssize.*
13928
13929 : see what type of char stdio uses.
13930 echo " "
13931 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13932         echo "Your stdio uses unsigned chars." >&4
13933         stdchar="unsigned char"
13934 else
13935         echo "Your stdio uses signed chars." >&4
13936         stdchar="char"
13937 fi
13938
13939 : see if time exists
13940 echo " "
13941 if test "X$d_time" = X -o X"$timetype" = X; then
13942     if set time val -f d_time; eval $csym; $val; then
13943                 echo 'time() found.' >&4
13944                 val="$define"
13945                 rp="What is the type returned by time() on this system?"
13946                 set time_t timetype long stdio.h sys/types.h
13947                 eval $typedef_ask
13948     else
13949                 echo 'time() not found, hope that will do.' >&4
13950                 val="$undef"
13951                 timetype='int';
13952     fi
13953     set d_time
13954     eval $setvar
13955 fi
13956
13957 : see what type uids are declared as in the kernel
13958 echo " "
13959 echo "Looking for the type for user ids returned by getuid()."
13960 set uid_t uidtype xxx stdio.h sys/types.h
13961 eval $typedef
13962 case "$uidtype" in
13963 xxx)
13964         xxx=`./findhdr sys/user.h`
13965         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13966         case $1 in
13967         unsigned) dflt="$1 $2" ;;
13968         *) dflt="$1" ;;
13969         esac
13970         ;;
13971 *) dflt="$uidtype";;
13972 esac
13973 case "$uidtype" in
13974 uid_t)  echo "uid_t found." ;;
13975 *)      rp="What is the type for user ids returned by getuid()?"
13976         . ./myread
13977         uidtype="$ans"
13978         ;;
13979 esac
13980
13981 echo " "
13982 case "$uidtype" in
13983 *_t) zzz="$uidtype"     ;;
13984 *)   zzz="uid"          ;;
13985 esac
13986 echo "Checking the size of $zzz..." >&4 
13987 cat > try.c <<EOCP
13988 #include <sys/types.h>
13989 #include <stdio.h>
13990 int main() {
13991     printf("%d\n", (int)sizeof($uidtype));
13992     exit(0);
13993 }
13994 EOCP
13995 set try
13996 if eval $compile_ok; then
13997         yyy=`./try`
13998         case "$yyy" in
13999         '')     uidsize=4
14000                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14001                 ;;
14002         *)      uidsize=$yyy
14003                 echo "Your $zzz is $uidsize bytes long."
14004                 ;;
14005         esac
14006 else
14007         uidsize=4
14008         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14009 fi
14010
14011 echo " "
14012 case "$uidtype" in
14013 *_t) zzz="$uidtype"     ;;
14014 *)   zzz="uid"          ;;
14015 esac
14016 echo "Checking the sign of $zzz..." >&4
14017 cat > try.c <<EOCP
14018 #include <sys/types.h>
14019 #include <stdio.h>
14020 int main() {
14021         $uidtype foo = -1;
14022         if (foo < 0)
14023                 printf("-1\n");
14024         else
14025                 printf("1\n");
14026 }
14027 EOCP
14028 set try
14029 if eval $compile; then
14030         yyy=`./try`
14031         case "$yyy" in
14032         '')     uidsign=1
14033                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14034                 ;;
14035         *)      uidsign=$yyy
14036                 case "$uidsign" in
14037                  1) echo "Your $zzz is unsigned." ;;
14038                 -1) echo "Your $zzz is signed."   ;;
14039                 esac
14040                 ;;
14041         esac
14042 else
14043         uidsign=1
14044         echo "(I can't compile the test program--guessing unsigned.)" >&4
14045 fi
14046
14047
14048
14049 echo " "
14050 $echo "Checking the format string to be used for uids..." >&4
14051
14052 case "$uidsign" in
14053 -1)     if $test X"$uidsize" = X"$ivsize"; then
14054                 uidformat="$ivdformat"
14055         else
14056                 if $test X"$uidsize" = X"$longsize"; then
14057                         uidformat='"ld"'
14058                 else
14059                         if $test X"$uidsize" = X"$intsize"; then
14060                                 uidformat='"d"'
14061                         else
14062                                 if $test X"$uidsize" = X"$shortsize"; then
14063                                         uidformat='"hd"'
14064                                 fi
14065                         fi
14066                 fi
14067         fi
14068         ;;
14069 *)      if $test X"$uidsize" = X"$uvsize"; then
14070                 uidformat="$uvuformat"
14071         else
14072                 if $test X"$uidsize" = X"$longsize"; then
14073                         uidformat='"lu"'
14074                 else
14075                         if $test X"$uidsize" = X"$intsize"; then
14076                                 uidformat='"u"'
14077                         else
14078                                 if $test X"$uidsize" = X"$shortsize"; then
14079                                         uidformat='"hu"'
14080                                 fi
14081                         fi
14082                 fi
14083         fi
14084         ;;
14085 esac
14086
14087 : see if dbm.h is available
14088 : see if dbmclose exists
14089 set dbmclose d_dbmclose
14090 eval $inlibc
14091
14092 case "$d_dbmclose" in
14093 $define)
14094         set dbm.h i_dbm
14095         eval $inhdr
14096         case "$i_dbm" in
14097         $define)
14098                 val="$undef"
14099                 set i_rpcsvcdbm
14100                 eval $setvar
14101                 ;;
14102         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14103                 eval $inhdr
14104                 ;;
14105         esac
14106         ;;
14107 *)      echo "We won't be including <dbm.h>"
14108         val="$undef"
14109         set i_dbm
14110         eval $setvar
14111         val="$undef"
14112         set i_rpcsvcdbm
14113         eval $setvar
14114         ;;
14115 esac
14116
14117 : see if this is a sys/file.h system
14118 val=''
14119 set sys/file.h val
14120 eval $inhdr
14121
14122 : do we need to include sys/file.h ?
14123 case "$val" in
14124 "$define")
14125         echo " "
14126         if $h_sysfile; then
14127                 val="$define"
14128                 echo "We'll be including <sys/file.h>." >&4
14129         else
14130                 val="$undef"
14131                 echo "We won't be including <sys/file.h>." >&4
14132         fi
14133         ;;
14134 *)
14135         h_sysfile=false
14136         ;;
14137 esac
14138 set i_sysfile
14139 eval $setvar
14140
14141 : see if fcntl.h is there
14142 val=''
14143 set fcntl.h val
14144 eval $inhdr
14145
14146 : see if we can include fcntl.h
14147 case "$val" in
14148 "$define")
14149         echo " "
14150         if $h_fcntl; then
14151                 val="$define"
14152                 echo "We'll be including <fcntl.h>." >&4
14153         else
14154                 val="$undef"
14155                 if $h_sysfile; then
14156         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14157                 else
14158                         echo "We won't be including <fcntl.h>." >&4
14159                 fi
14160         fi
14161         ;;
14162 *)
14163         h_fcntl=false
14164         val="$undef"
14165         ;;
14166 esac
14167 set i_fcntl
14168 eval $setvar
14169
14170 : see if this is a iconv.h system
14171 set iconv.h i_iconv
14172 eval $inhdr
14173
14174 : see if this is a ieeefp.h system
14175 set ieeefp.h i_ieeefp
14176 eval $inhdr
14177
14178 : see if locale.h is available
14179 set locale.h i_locale
14180 eval $inhdr
14181
14182 : see if mach cthreads are available
14183 if test "X$usethreads" = "X$define"; then
14184         set mach/cthreads.h i_machcthr
14185         eval $inhdr
14186 else
14187         i_machcthr="$undef"
14188 fi
14189
14190
14191
14192 : see if this is a math.h system
14193 set math.h i_math
14194 eval $inhdr
14195
14196 : see if this is a mntent.h system
14197 set mntent.h i_mntent
14198 eval $inhdr
14199
14200 : see if ndbm.h is available
14201 set ndbm.h t_ndbm
14202 eval $inhdr
14203 case "$t_ndbm" in
14204 $define)
14205         : see if dbm_open exists
14206         set dbm_open d_dbm_open
14207         eval $inlibc
14208         case "$d_dbm_open" in
14209         $undef)
14210                 t_ndbm="$undef"
14211                 echo "We won't be including <ndbm.h>"
14212                 ;;
14213         esac
14214         ;;
14215 esac
14216 val="$t_ndbm"
14217 set i_ndbm
14218 eval $setvar
14219
14220 : see if net/errno.h is available
14221 val=''
14222 set net/errno.h val
14223 eval $inhdr
14224
14225 : Unfortunately, it causes problems on some systems.  Arrgh.
14226 case "$val" in
14227 $define)
14228         cat > try.c <<'EOM'
14229 #include <stdio.h>
14230 #include <errno.h>
14231 #include <net/errno.h>
14232 int func()
14233 {
14234         return ENOTSOCK;
14235 }
14236 EOM
14237         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14238                 echo "We'll be including <net/errno.h>." >&4
14239         else
14240                 echo "We won't be including <net/errno.h>." >&4
14241                 val="$undef"
14242         fi
14243         $rm -f try.* try
14244         ;;
14245 esac
14246 set i_neterrno
14247 eval $setvar
14248
14249 : see if netinet/tcp.h is available
14250 set netinet/tcp.h i_netinettcp
14251 eval $inhdr
14252
14253 : see if this is a poll.h system
14254 set poll.h i_poll
14255 eval $inhdr
14256
14257 echo " "
14258 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14259 $cat <<'EOSH' > Cppsym.know
14260 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14261 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14262 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14263 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14264 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14265 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14266 bull c cadmus clipper CMU COFF COMPILER_VERSION
14267 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14268 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14269 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14270 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14271 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14272 H3050R H3050RX hbullx20 hcx host_mips
14273 hp200 hp300 hp700 HP700 hp800 hp9000
14274 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14275 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14276 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14277 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14278 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14279 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14280 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14281 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14282 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14283 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14284 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14285 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14286 MATH_HAS_NO_SIDE_EFFECTS
14287 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14288 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14289 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14290 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14291 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14292 NetBSD news1500 news1700 news1800 news1900 news3700
14293 news700 news800 news900 NeXT NLS ns16000 ns32000
14294 ns32016 ns32332 ns32k nsc32000
14295 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14296 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14297 pc532 pdp11 PGC PIC plexus PORTAR posix
14298 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14299 POSIX_C_SOURCE POSIX_SOURCE POWER
14300 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14301 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14302 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14303 sony sony_news sonyrisc sparc sparclite spectrum
14304 stardent stdc STDC_EXT stratos sun sun3 sun386
14305 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14306 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14307 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14308 sysV68 sysV88 Tek4132 Tek4300 titan
14309 tower tower32 tower32_200 tower32_600 tower32_700
14310 tower32_800 tower32_850 tss
14311 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14312 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14313 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14314 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14315 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14316 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14317 z8000
14318 EOSH
14319 # Maybe put other stuff here too.
14320 cat <<EOSH >>Cppsym.know
14321 $osname
14322 EOSH
14323 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14324 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14325 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14326 $rm -f Cppsym.a Cppsym.b
14327 cat <<EOSH > Cppsym
14328 $startsh
14329 if $test \$# -gt 0; then
14330     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14331     if $test -s Cppsym.got; then
14332         $rm -f Cppsym.got
14333         exit 0
14334     fi
14335     $rm -f Cppsym.got
14336     exit 1
14337 else
14338     $tr " " "$trnl" | ./Cppsym.try
14339     exit 0
14340 fi
14341 EOSH
14342 chmod +x Cppsym
14343 $eunicefix Cppsym
14344 cat <<EOSH > Cppsym.try
14345 $startsh
14346 cat <<'EOCP' > try.c
14347 #include <stdio.h>
14348 int main() {
14349 EOCP
14350 $awk \\
14351 EOSH
14352 cat <<'EOSH' >> Cppsym.try
14353 'length($1) > 0 {
14354     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
14355     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
14356     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
14357     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
14358 }'       >> try.c
14359 echo '}' >> try.c
14360 EOSH
14361 cat <<EOSH >> Cppsym.try
14362 ccflags="$ccflags"
14363 case "$osname-$gccversion" in
14364 irix-) ccflags="\$ccflags -woff 1178" ;;
14365 esac
14366 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14367 EOSH
14368 chmod +x Cppsym.try
14369 $eunicefix Cppsym.try
14370 ./Cppsym < Cppsym.know > Cppsym.true
14371 : now check the C compiler for additional symbols
14372 postprocess_cc_v=''
14373 case "$osname" in
14374 aix) postprocess_cc_v="|$tr , ' '" ;;
14375 esac
14376 $cat >ccsym <<EOS
14377 $startsh
14378 $cat >tmp.c <<EOF
14379 extern int foo;
14380 EOF
14381 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14382 do
14383         case "\$i" in
14384         -D*) echo "\$i" | $sed 's/^-D//';;
14385         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14386         esac
14387 done
14388 $rm -f try.c
14389 EOS
14390 postprocess_cc_v=''
14391 chmod +x ccsym
14392 $eunicefix ccsym
14393 ./ccsym > ccsym1.raw
14394 if $test -s ccsym1.raw; then
14395        $sort ccsym1.raw | $uniq >ccsym.raw
14396 else
14397        mv ccsym1.raw ccsym.raw
14398 fi
14399
14400 $awk '/\=/ { print $0; next }
14401         { print $0"=1" }' ccsym.raw >ccsym.list
14402 $awk '/\=/ { print $0; next }
14403         { print $0"=1" }' Cppsym.true >ccsym.true
14404 $comm -13 ccsym.true ccsym.list >ccsym.own
14405 $comm -12 ccsym.true ccsym.list >ccsym.com
14406 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14407 also=''
14408 if $test -z ccsym.raw; then
14409         echo "Your C compiler doesn't seem to define any symbols!" >&4
14410         echo " "
14411         echo "However, your C preprocessor defines the following symbols:"
14412         $cat Cppsym.true
14413         ccsymbols=''
14414         cppsymbols=`$cat Cppsym.true`
14415         cppsymbols=`echo $cppsymbols`
14416         cppccsymbols="$cppsymbols"
14417 else
14418         if $test -s ccsym.com; then
14419                 echo "Your C compiler and pre-processor define these symbols:"
14420                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14421                 also='also '
14422                 symbols='ones'
14423                 cppccsymbols=`$cat ccsym.com`
14424                 cppccsymbols=`echo $cppccsymbols`
14425                 $test "$silent" || sleep 1
14426         fi
14427         if $test -s ccsym.cpp; then
14428                 $test "$also" && echo " "
14429                 echo "Your C pre-processor ${also}defines the following symbols:"
14430                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14431                 also='further '
14432                 cppsymbols=`$cat ccsym.cpp`
14433                 cppsymbols=`echo $cppsymbols`
14434                 $test "$silent" || sleep 1
14435         fi
14436         if $test -s ccsym.own; then
14437                 $test "$also" && echo " "
14438                 echo "Your C compiler ${also}defines the following cpp symbols:"
14439                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14440                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14441                 ccsymbols=`$cat ccsym.own`
14442                 ccsymbols=`echo $ccsymbols`
14443                 $test "$silent" || sleep 1
14444         fi
14445 fi
14446 $rm -f ccsym*
14447
14448 : see if this is a termio system
14449 val="$undef"
14450 val2="$undef"
14451 val3="$undef"
14452 if $test `./findhdr termios.h`; then
14453         set tcsetattr i_termios
14454         eval $inlibc
14455         val3="$i_termios"
14456 fi
14457 echo " "
14458 case "$val3" in
14459 "$define") echo "You have POSIX termios.h... good!" >&4;;
14460 *) if ./Cppsym pyr; then
14461                 case "`/bin/universe`" in
14462                 ucb) if $test `./findhdr sgtty.h`; then
14463                                 val2="$define"
14464                                 echo "<sgtty.h> found." >&4
14465                         else
14466                                 echo "System is pyramid with BSD universe."
14467                                 echo "<sgtty.h> not found--you could have problems." >&4
14468                         fi;;
14469                 *) if $test `./findhdr termio.h`; then
14470                                 val="$define"
14471                                 echo "<termio.h> found." >&4
14472                         else
14473                                 echo "System is pyramid with USG universe."
14474                                 echo "<termio.h> not found--you could have problems." >&4
14475                         fi;;
14476                 esac
14477         elif ./usg; then
14478                 if $test `./findhdr termio.h`; then
14479                         echo "<termio.h> found." >&4
14480                         val="$define"
14481                 elif $test `./findhdr sgtty.h`; then
14482                         echo "<sgtty.h> found." >&4
14483                         val2="$define"
14484                 else
14485 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14486                 fi
14487         else
14488                 if $test `./findhdr sgtty.h`; then
14489                         echo "<sgtty.h> found." >&4
14490                         val2="$define"
14491                 elif $test `./findhdr termio.h`; then
14492                         echo "<termio.h> found." >&4
14493                         val="$define"
14494                 else
14495 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14496                 fi
14497         fi;;
14498 esac
14499 set i_termio; eval $setvar
14500 val=$val2; set i_sgtty; eval $setvar
14501 val=$val3; set i_termios; eval $setvar
14502
14503 : see if this is a shadow.h system
14504 set shadow.h i_shadow
14505 eval $inhdr
14506
14507 : see if this is a socks.h system
14508 set socks.h i_socks
14509 eval $inhdr
14510
14511 : see if stdarg is available
14512 echo " "
14513 if $test `./findhdr stdarg.h`; then
14514         echo "<stdarg.h> found." >&4
14515         valstd="$define"
14516 else
14517         echo "<stdarg.h> NOT found." >&4
14518         valstd="$undef"
14519 fi
14520
14521 : see if varags is available
14522 echo " "
14523 if $test `./findhdr varargs.h`; then
14524         echo "<varargs.h> found." >&4
14525 else
14526         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14527 fi
14528
14529 : set up the varargs testing programs
14530 $cat > varargs.c <<EOP
14531 #ifdef I_STDARG
14532 #include <stdarg.h>
14533 #endif
14534 #ifdef I_VARARGS
14535 #include <varargs.h>
14536 #endif
14537
14538 #ifdef I_STDARG
14539 int f(char *p, ...)
14540 #else
14541 int f(va_alist)
14542 va_dcl
14543 #endif
14544 {
14545         va_list ap;
14546 #ifndef I_STDARG
14547         char *p;
14548 #endif
14549 #ifdef I_STDARG
14550         va_start(ap,p);
14551 #else
14552         va_start(ap);
14553         p = va_arg(ap, char *);
14554 #endif
14555         va_end(ap);
14556 }
14557 EOP
14558 $cat > varargs <<EOP
14559 $startsh
14560 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14561         echo "true"
14562 else
14563         echo "false"
14564 fi
14565 $rm -f varargs$_o
14566 EOP
14567 chmod +x varargs
14568
14569 : now check which varargs header should be included
14570 echo " "
14571 i_varhdr=''
14572 case "$valstd" in
14573 "$define")
14574         if `./varargs I_STDARG`; then
14575                 val='stdarg.h'
14576         elif `./varargs I_VARARGS`; then
14577                 val='varargs.h'
14578         fi
14579         ;;
14580 *)
14581         if `./varargs I_VARARGS`; then
14582                 val='varargs.h'
14583         fi
14584         ;;
14585 esac
14586 case "$val" in
14587 '')
14588 echo "I could not find the definition for va_dcl... You have problems..." >&4
14589         val="$undef"; set i_stdarg; eval $setvar
14590         val="$undef"; set i_varargs; eval $setvar
14591         ;;
14592 *) 
14593         set i_varhdr
14594         eval $setvar
14595         case "$i_varhdr" in
14596         stdarg.h)
14597                 val="$define"; set i_stdarg; eval $setvar
14598                 val="$undef"; set i_varargs; eval $setvar
14599                 ;;
14600         varargs.h)
14601                 val="$undef"; set i_stdarg; eval $setvar
14602                 val="$define"; set i_varargs; eval $setvar
14603                 ;;
14604         esac
14605         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14606 esac
14607 $rm -f varargs*
14608
14609 : see if stddef is available
14610 set stddef.h i_stddef
14611 eval $inhdr
14612
14613 : see if this is a sunmath.h system
14614 set sunmath.h i_sunmath
14615 eval $inhdr
14616
14617 : see if sys/access.h is available
14618 set sys/access.h i_sysaccess
14619 eval $inhdr
14620
14621 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14622 set sys/filio.h i_sysfilio
14623 eval $inhdr
14624 echo " "
14625 if $test `./findhdr sys/ioctl.h`; then
14626         val="$define"
14627         echo '<sys/ioctl.h> found.' >&4
14628 else
14629         val="$undef"
14630         if $test $i_sysfilio = "$define"; then
14631             echo '<sys/ioctl.h> NOT found.' >&4
14632         else
14633                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14634                 $test $i_termio = "$define" && xxx="termio.h"
14635                 $test $i_termios = "$define" && xxx="termios.h"
14636 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14637         fi
14638 fi
14639 set i_sysioctl
14640 eval $setvar
14641
14642
14643 : see if this is a syslog.h system
14644 set syslog.h i_syslog
14645 eval $inhdr
14646
14647
14648 : see if this is a sys/mode.h system
14649 set sys/mode.h i_sysmode
14650 eval $inhdr
14651
14652 : see if sys/resource.h has to be included
14653 set sys/resource.h i_sysresrc
14654 eval $inhdr
14655
14656 : see if sys/security.h is available
14657 set sys/security.h i_syssecrt
14658 eval $inhdr
14659
14660 : see if this is a sys/statvfs.h system
14661 set sys/statvfs.h i_sysstatvfs
14662 eval $inhdr
14663
14664 : see if this is a sys/uio.h system
14665 set sys/uio.h i_sysuio
14666 eval $inhdr
14667
14668 : see if this is a sys/un.h system
14669 set sys/un.h i_sysun
14670 eval $inhdr
14671
14672
14673 : see if this is a sys/utsname.h system
14674 set sys/utsname.h i_sysutsname
14675 eval $inhdr
14676
14677 : see if this is a syswait system
14678 set sys/wait.h i_syswait
14679 eval $inhdr
14680
14681 : see if this is a ustat.h system
14682 set ustat.h i_ustat
14683 eval $inhdr
14684
14685 : see if this is an utime system
14686 set utime.h i_utime
14687 eval $inhdr
14688
14689 : see if this is a values.h system
14690 set values.h i_values
14691 eval $inhdr
14692
14693 : see if this is a vfork system
14694 case "$d_vfork" in
14695 "$define")
14696         set vfork.h i_vfork
14697         eval $inhdr
14698         ;;
14699 *)
14700         i_vfork="$undef"
14701         ;;
14702 esac
14703
14704 : see if gdbm.h is available
14705 set gdbm.h t_gdbm
14706 eval $inhdr
14707 case "$t_gdbm" in
14708 $define)
14709         : see if gdbm_open exists
14710         set gdbm_open d_gdbm_open
14711         eval $inlibc
14712         case "$d_gdbm_open" in
14713         $undef)
14714                 t_gdbm="$undef"
14715                 echo "We won't be including <gdbm.h>"
14716                 ;;
14717         esac
14718         ;;
14719 esac
14720 val="$t_gdbm"
14721 set i_gdbm
14722 eval $setvar
14723
14724 echo " "
14725 echo "Looking for extensions..." >&4
14726 : If we are using the old config.sh, known_extensions may contain
14727 : old or inaccurate or duplicate values.
14728 known_extensions=''
14729 nonxs_extensions=''
14730 : We do not use find because it might not be available.
14731 : We do not just use MANIFEST because the user may have dropped
14732 : some additional extensions into the source tree and expect them
14733 : to be built.
14734
14735 : Function to recursively find available extensions, ignoring DynaLoader
14736 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14737 find_extensions='
14738     for xxx in *; do
14739        case "$xxx" in
14740            DynaLoader|dynaload) ;;
14741            *)
14742            if $test -f $xxx/$xxx.xs; then
14743                known_extensions="$known_extensions $1$xxx";
14744            elif $test -f $xxx/Makefile.PL; then
14745                nonxs_extensions="$nonxs_extensions $1$xxx";
14746            else
14747                if $test -d $xxx -a $# -lt 10; then
14748                    set $1$xxx/ $*;
14749                    cd $xxx;
14750                    eval $find_extensions;
14751                    cd ..;
14752                    shift;
14753                fi;
14754            fi
14755            ;;
14756        esac;
14757     done'
14758 tdir=`pwd`
14759 cd $rsrc/ext
14760 set X
14761 shift
14762 eval $find_extensions
14763 set X $nonxs_extensions
14764 shift
14765 nonxs_extensions="$*"
14766 set X $known_extensions
14767 shift
14768 known_extensions="$*"
14769 cd $tdir
14770
14771 : Now see which are supported on this system.
14772 avail_ext=''
14773 for xxx in $known_extensions ; do
14774         case "$xxx" in
14775         DB_File|db_file)
14776                 case "$i_db" in
14777                 $define) avail_ext="$avail_ext $xxx" ;;
14778                 esac
14779                 ;;
14780         GDBM_File|gdbm_fil)
14781                 case "$i_gdbm" in 
14782                 $define) avail_ext="$avail_ext $xxx" ;;
14783                 esac
14784                 ;;
14785         NDBM_File|ndbm_fil)
14786                 case "$i_ndbm" in
14787                 $define)
14788                     case "$osname-$use64bitint" in
14789                     hpux-define)
14790                         case "$libs" in
14791                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14792                         esac
14793                         ;;
14794                     *) avail_ext="$avail_ext $xxx" ;;
14795                     esac
14796                     ;;
14797                 esac
14798                 ;;
14799         ODBM_File|odbm_fil) 
14800                 case "${i_dbm}${i_rpcsvcdbm}" in
14801                 *"${define}"*)
14802                     case "$osname-$use64bitint" in
14803                     hpux-define)
14804                         case "$libs" in
14805                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14806                         esac
14807                         ;;
14808                     *) avail_ext="$avail_ext $xxx" ;;
14809                     esac
14810                     ;;
14811                 esac
14812                 ;;
14813         POSIX|posix)
14814                 case "$useposix" in
14815                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14816                 esac
14817                 ;;
14818         Opcode|opcode)
14819                 case "$useopcode" in
14820                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14821                 esac
14822                 ;;
14823         Socket|socket)
14824                 case "$d_socket" in 
14825                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14826                 esac
14827                 ;;
14828         Thread|thread)
14829                 case "$usethreads" in 
14830                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14831                 esac
14832                 ;;
14833         IPC/SysV|ipc/sysv)
14834                 : XXX Do we need a useipcsysv variable here
14835                 case "${d_msg}${d_sem}${d_shm}" in 
14836                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14837                 esac
14838                 ;;
14839         *)      avail_ext="$avail_ext $xxx"
14840                 ;;
14841         esac
14842 done
14843
14844 set X $avail_ext
14845 shift
14846 avail_ext="$*"
14847
14848 : Now see which nonxs extensions are supported on this system.
14849 : For now assume all are.
14850 nonxs_ext=''
14851 for xxx in $nonxs_extensions ; do
14852         case "$xxx" in
14853         *)      nonxs_ext="$nonxs_ext $xxx"
14854                 ;;
14855         esac
14856 done
14857
14858 set X $nonxs_ext
14859 shift
14860 nonxs_ext="$*"
14861
14862 case $usedl in
14863 $define)
14864         $cat <<EOM
14865 A number of extensions are supplied with $package.  You may choose to
14866 compile these extensions for dynamic loading (the default), compile
14867 them into the $package executable (static loading), or not include
14868 them at all.  Answer "none" to include no extensions.
14869 Note that DynaLoader is always built and need not be mentioned here.
14870
14871 EOM
14872         case "$dynamic_ext" in
14873         '') dflt="$avail_ext" ;;
14874         *)      dflt="$dynamic_ext"
14875                 # Perhaps we are reusing an old out-of-date config.sh.
14876                 case "$hint" in
14877                 previous)
14878                         if test X"$dynamic_ext" != X"$avail_ext"; then
14879                                 $cat <<EOM
14880 NOTICE:  Your previous config.sh list may be incorrect. 
14881 The extensions now available to you are 
14882         ${avail_ext}
14883 but the default list from your previous config.sh is
14884         ${dynamic_ext} 
14885
14886 EOM
14887                         fi
14888                         ;;
14889                 esac
14890                 ;;
14891         esac
14892         case "$dflt" in
14893         '')     dflt=none;;
14894         esac
14895         rp="What extensions do you wish to load dynamically?"
14896         . ./myread
14897         case "$ans" in
14898         none) dynamic_ext=' ' ;;
14899         *) dynamic_ext="$ans" ;;
14900         esac
14901
14902         case "$static_ext" in
14903         '')
14904                 : Exclude those already listed in dynamic linking
14905                 dflt=''
14906                 for xxx in $avail_ext; do
14907                         case " $dynamic_ext " in
14908                         *" $xxx "*) ;;
14909                         *) dflt="$dflt $xxx" ;;
14910                         esac
14911                 done
14912                 set X $dflt
14913                 shift
14914                 dflt="$*"
14915                 ;;
14916         *)  dflt="$static_ext" 
14917                 ;;
14918         esac
14919
14920         case "$dflt" in
14921         '')     dflt=none;;
14922         esac
14923         rp="What extensions do you wish to load statically?"
14924         . ./myread
14925         case "$ans" in
14926         none) static_ext=' ' ;;
14927         *) static_ext="$ans" ;;
14928         esac
14929         ;;
14930 *)
14931         $cat <<EOM
14932 A number of extensions are supplied with $package.  Answer "none" 
14933 to include no extensions. 
14934 Note that DynaLoader is always built and need not be mentioned here.
14935
14936 EOM
14937         case "$static_ext" in
14938         '') dflt="$avail_ext" ;;
14939         *)      dflt="$static_ext"
14940                 # Perhaps we are reusing an old out-of-date config.sh.
14941                 case "$hint" in
14942                 previous)
14943                         if test X"$static_ext" != X"$avail_ext"; then
14944                                 $cat <<EOM
14945 NOTICE:  Your previous config.sh list may be incorrect. 
14946 The extensions now available to you are 
14947         ${avail_ext}
14948 but the default list from your previous config.sh is
14949         ${static_ext} 
14950
14951 EOM
14952                         fi
14953                         ;;
14954                 esac
14955                 ;;
14956         esac
14957         : Exclude those that are not xs extensions
14958         case "$dflt" in
14959         '')     dflt=none;;
14960         esac
14961         rp="What extensions do you wish to include?"
14962         . ./myread
14963         case "$ans" in
14964         none) static_ext=' ' ;;
14965         *) static_ext="$ans" ;;
14966         esac
14967         ;;
14968 esac
14969
14970 set X $dynamic_ext $static_ext $nonxs_ext
14971 shift
14972 extensions="$*"
14973
14974 : Remove build directory name from cppstdin so it can be used from
14975 : either the present location or the final installed location.
14976 echo " "
14977 : Get out of the UU directory to get correct path name.
14978 cd ..
14979 case "$cppstdin" in
14980 `pwd`/cppstdin)
14981         echo "Stripping down cppstdin path name"
14982         cppstdin=cppstdin
14983         ;;
14984 esac
14985 cd UU
14986
14987 : end of configuration questions
14988 echo " "
14989 echo "End of configuration questions."
14990 echo " "
14991
14992 : back to where it started
14993 if test -d ../UU; then
14994         cd ..
14995 fi
14996
14997 : configuration may be patched via a 'config.over' file
14998 if $test -f config.over; then
14999         echo " "
15000         dflt=y
15001         rp='I see a config.over file.  Do you wish to load it?'
15002         . UU/myread
15003         case "$ans" in
15004         n*) echo "OK, I'll ignore it.";;
15005         *)      . ./config.over
15006                 echo "Configuration override changes have been loaded."
15007                 ;;
15008         esac
15009 fi
15010
15011 : in case they want portability, strip down executable paths
15012 case "$d_portable" in
15013 "$define")
15014         echo " "
15015         echo "Stripping down executable paths..." >&4
15016         for file in $loclist $trylist; do
15017                 eval temp=\$$file
15018                 eval $file=`basename $temp`
15019         done
15020         ;;
15021 esac
15022
15023 : create config.sh file
15024 echo " "
15025 echo "Creating config.sh..." >&4
15026 $spitshell <<EOT >config.sh
15027 $startsh
15028 #
15029 # This file was produced by running the Configure script. It holds all the
15030 # definitions figured out by Configure. Should you modify one of these values,
15031 # do not forget to propagate your changes by running "Configure -der". You may
15032 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15033 #
15034
15035 # Package name      : $package
15036 # Source directory  : $src
15037 # Configuration time: $cf_time
15038 # Configured by     : $cf_by
15039 # Target system     : $myuname
15040
15041 Author='$Author'
15042 Date='$Date'
15043 Header='$Header'
15044 Id='$Id'
15045 Locker='$Locker'
15046 Log='$Log'
15047 Mcc='$Mcc'
15048 RCSfile='$RCSfile'
15049 Revision='$Revision'
15050 Source='$Source'
15051 State='$State'
15052 _a='$_a'
15053 _exe='$_exe'
15054 _o='$_o'
15055 afs='$afs'
15056 alignbytes='$alignbytes'
15057 ansi2knr='$ansi2knr'
15058 aphostname='$aphostname'
15059 api_revision='$api_revision'
15060 api_subversion='$api_subversion'
15061 api_version='$api_version'
15062 api_versionstring='$api_versionstring'
15063 ar='$ar'
15064 archlib='$archlib'
15065 archlibexp='$archlibexp'
15066 archname64='$archname64'
15067 archname='$archname'
15068 archobjs='$archobjs'
15069 awk='$awk'
15070 baserev='$baserev'
15071 bash='$bash'
15072 bin='$bin'
15073 bincompat5005='$bincompat5005'
15074 binexp='$binexp'
15075 bison='$bison'
15076 byacc='$byacc'
15077 byteorder='$byteorder'
15078 c='$c'
15079 castflags='$castflags'
15080 cat='$cat'
15081 cc='$cc'
15082 cccdlflags='$cccdlflags'
15083 ccdlflags='$ccdlflags'
15084 ccflags='$ccflags'
15085 ccsymbols='$ccsymbols'
15086 cf_by='$cf_by'
15087 cf_email='$cf_email'
15088 cf_time='$cf_time'
15089 charsize='$charsize'
15090 chgrp='$chgrp'
15091 chmod='$chmod'
15092 chown='$chown'
15093 clocktype='$clocktype'
15094 comm='$comm'
15095 compress='$compress'
15096 contains='$contains'
15097 cp='$cp'
15098 cpio='$cpio'
15099 cpp='$cpp'
15100 cpp_stuff='$cpp_stuff'
15101 cppccsymbols='$cppccsymbols'
15102 cppflags='$cppflags'
15103 cpplast='$cpplast'
15104 cppminus='$cppminus'
15105 cpprun='$cpprun'
15106 cppstdin='$cppstdin'
15107 cppsymbols='$cppsymbols'
15108 crosscompile='$crosscompile'
15109 cryptlib='$cryptlib'
15110 csh='$csh'
15111 d_Gconvert='$d_Gconvert'
15112 d_PRIEldbl='$d_PRIEldbl'
15113 d_PRIFldbl='$d_PRIFldbl'
15114 d_PRIGldbl='$d_PRIGldbl'
15115 d_PRIX64='$d_PRIX64'
15116 d_PRId64='$d_PRId64'
15117 d_PRIeldbl='$d_PRIeldbl'
15118 d_PRIfldbl='$d_PRIfldbl'
15119 d_PRIgldbl='$d_PRIgldbl'
15120 d_PRIi64='$d_PRIi64'
15121 d_PRIo64='$d_PRIo64'
15122 d_PRIu64='$d_PRIu64'
15123 d_PRIx64='$d_PRIx64'
15124 d_access='$d_access'
15125 d_accessx='$d_accessx'
15126 d_alarm='$d_alarm'
15127 d_archlib='$d_archlib'
15128 d_atolf='$d_atolf'
15129 d_atoll='$d_atoll'
15130 d_attribut='$d_attribut'
15131 d_bcmp='$d_bcmp'
15132 d_bcopy='$d_bcopy'
15133 d_bincompat5005='$d_bincompat5005'
15134 d_bsd='$d_bsd'
15135 d_bsdgetpgrp='$d_bsdgetpgrp'
15136 d_bsdsetpgrp='$d_bsdsetpgrp'
15137 d_bzero='$d_bzero'
15138 d_casti32='$d_casti32'
15139 d_castneg='$d_castneg'
15140 d_charvspr='$d_charvspr'
15141 d_chown='$d_chown'
15142 d_chroot='$d_chroot'
15143 d_chsize='$d_chsize'
15144 d_closedir='$d_closedir'
15145 d_const='$d_const'
15146 d_crypt='$d_crypt'
15147 d_csh='$d_csh'
15148 d_cuserid='$d_cuserid'
15149 d_dbl_dig='$d_dbl_dig'
15150 d_difftime='$d_difftime'
15151 d_dirnamlen='$d_dirnamlen'
15152 d_dlerror='$d_dlerror'
15153 d_dlopen='$d_dlopen'
15154 d_dlsymun='$d_dlsymun'
15155 d_dosuid='$d_dosuid'
15156 d_drand48proto='$d_drand48proto'
15157 d_dup2='$d_dup2'
15158 d_eaccess='$d_eaccess'
15159 d_endgrent='$d_endgrent'
15160 d_endhent='$d_endhent'
15161 d_endnent='$d_endnent'
15162 d_endpent='$d_endpent'
15163 d_endpwent='$d_endpwent'
15164 d_endsent='$d_endsent'
15165 d_endspent='$d_endspent'
15166 d_eofnblk='$d_eofnblk'
15167 d_eunice='$d_eunice'
15168 d_fchmod='$d_fchmod'
15169 d_fchown='$d_fchown'
15170 d_fcntl='$d_fcntl'
15171 d_fd_macros='$d_fd_macros'
15172 d_fd_set='$d_fd_set'
15173 d_fds_bits='$d_fds_bits'
15174 d_fgetpos='$d_fgetpos'
15175 d_flexfnam='$d_flexfnam'
15176 d_flock='$d_flock'
15177 d_fork='$d_fork'
15178 d_fpathconf='$d_fpathconf'
15179 d_fpos64_t='$d_fpos64_t'
15180 d_fs_data_s='$d_fs_data_s'
15181 d_fseeko='$d_fseeko'
15182 d_fsetpos='$d_fsetpos'
15183 d_fstatfs='$d_fstatfs'
15184 d_fstatvfs='$d_fstatvfs'
15185 d_ftello='$d_ftello'
15186 d_ftime='$d_ftime'
15187 d_getcwd='$d_getcwd'
15188 d_getfsstat='$d_getfsstat'
15189 d_getgrent='$d_getgrent'
15190 d_getgrps='$d_getgrps'
15191 d_gethbyaddr='$d_gethbyaddr'
15192 d_gethbyname='$d_gethbyname'
15193 d_gethent='$d_gethent'
15194 d_gethname='$d_gethname'
15195 d_gethostprotos='$d_gethostprotos'
15196 d_getlogin='$d_getlogin'
15197 d_getmnt='$d_getmnt'
15198 d_getmntent='$d_getmntent'
15199 d_getnbyaddr='$d_getnbyaddr'
15200 d_getnbyname='$d_getnbyname'
15201 d_getnent='$d_getnent'
15202 d_getnetprotos='$d_getnetprotos'
15203 d_getpbyname='$d_getpbyname'
15204 d_getpbynumber='$d_getpbynumber'
15205 d_getpent='$d_getpent'
15206 d_getpgid='$d_getpgid'
15207 d_getpgrp2='$d_getpgrp2'
15208 d_getpgrp='$d_getpgrp'
15209 d_getppid='$d_getppid'
15210 d_getprior='$d_getprior'
15211 d_getprotoprotos='$d_getprotoprotos'
15212 d_getpwent='$d_getpwent'
15213 d_getsbyname='$d_getsbyname'
15214 d_getsbyport='$d_getsbyport'
15215 d_getsent='$d_getsent'
15216 d_getservprotos='$d_getservprotos'
15217 d_getspent='$d_getspent'
15218 d_getspnam='$d_getspnam'
15219 d_gettimeod='$d_gettimeod'
15220 d_gnulibc='$d_gnulibc'
15221 d_grpasswd='$d_grpasswd'
15222 d_hasmntopt='$d_hasmntopt'
15223 d_htonl='$d_htonl'
15224 d_iconv='$d_iconv'
15225 d_index='$d_index'
15226 d_inetaton='$d_inetaton'
15227 d_int64_t='$d_int64_t'
15228 d_isascii='$d_isascii'
15229 d_killpg='$d_killpg'
15230 d_lchown='$d_lchown'
15231 d_ldbl_dig='$d_ldbl_dig'
15232 d_link='$d_link'
15233 d_locconv='$d_locconv'
15234 d_lockf='$d_lockf'
15235 d_longdbl='$d_longdbl'
15236 d_longlong='$d_longlong'
15237 d_lseekproto='$d_lseekproto'
15238 d_lstat='$d_lstat'
15239 d_madvise='$d_madvise'
15240 d_mblen='$d_mblen'
15241 d_mbstowcs='$d_mbstowcs'
15242 d_mbtowc='$d_mbtowc'
15243 d_memchr='$d_memchr'
15244 d_memcmp='$d_memcmp'
15245 d_memcpy='$d_memcpy'
15246 d_memmove='$d_memmove'
15247 d_memset='$d_memset'
15248 d_mkdir='$d_mkdir'
15249 d_mkdtemp='$d_mkdtemp'
15250 d_mkfifo='$d_mkfifo'
15251 d_mkstemp='$d_mkstemp'
15252 d_mkstemps='$d_mkstemps'
15253 d_mktime='$d_mktime'
15254 d_mmap='$d_mmap'
15255 d_mprotect='$d_mprotect'
15256 d_msg='$d_msg'
15257 d_msg_ctrunc='$d_msg_ctrunc'
15258 d_msg_dontroute='$d_msg_dontroute'
15259 d_msg_oob='$d_msg_oob'
15260 d_msg_peek='$d_msg_peek'
15261 d_msg_proxy='$d_msg_proxy'
15262 d_msgctl='$d_msgctl'
15263 d_msgget='$d_msgget'
15264 d_msgrcv='$d_msgrcv'
15265 d_msgsnd='$d_msgsnd'
15266 d_msync='$d_msync'
15267 d_munmap='$d_munmap'
15268 d_mymalloc='$d_mymalloc'
15269 d_nice='$d_nice'
15270 d_nv_preserves_uv='$d_nv_preserves_uv'
15271 d_off64_t='$d_off64_t'
15272 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15273 d_oldpthreads='$d_oldpthreads'
15274 d_oldsock='$d_oldsock'
15275 d_open3='$d_open3'
15276 d_pathconf='$d_pathconf'
15277 d_pause='$d_pause'
15278 d_phostname='$d_phostname'
15279 d_pipe='$d_pipe'
15280 d_poll='$d_poll'
15281 d_portable='$d_portable'
15282 d_pthread_yield='$d_pthread_yield'
15283 d_pwage='$d_pwage'
15284 d_pwchange='$d_pwchange'
15285 d_pwclass='$d_pwclass'
15286 d_pwcomment='$d_pwcomment'
15287 d_pwexpire='$d_pwexpire'
15288 d_pwgecos='$d_pwgecos'
15289 d_pwpasswd='$d_pwpasswd'
15290 d_pwquota='$d_pwquota'
15291 d_qgcvt='$d_qgcvt'
15292 d_quad='$d_quad'
15293 d_readdir='$d_readdir'
15294 d_readlink='$d_readlink'
15295 d_rename='$d_rename'
15296 d_rewinddir='$d_rewinddir'
15297 d_rmdir='$d_rmdir'
15298 d_safebcpy='$d_safebcpy'
15299 d_safemcpy='$d_safemcpy'
15300 d_sanemcmp='$d_sanemcmp'
15301 d_sched_yield='$d_sched_yield'
15302 d_scm_rights='$d_scm_rights'
15303 d_seekdir='$d_seekdir'
15304 d_select='$d_select'
15305 d_sem='$d_sem'
15306 d_semctl='$d_semctl'
15307 d_semctl_semid_ds='$d_semctl_semid_ds'
15308 d_semctl_semun='$d_semctl_semun'
15309 d_semget='$d_semget'
15310 d_semop='$d_semop'
15311 d_setegid='$d_setegid'
15312 d_seteuid='$d_seteuid'
15313 d_setgrent='$d_setgrent'
15314 d_setgrps='$d_setgrps'
15315 d_sethent='$d_sethent'
15316 d_setlinebuf='$d_setlinebuf'
15317 d_setlocale='$d_setlocale'
15318 d_setnent='$d_setnent'
15319 d_setpent='$d_setpent'
15320 d_setpgid='$d_setpgid'
15321 d_setpgrp2='$d_setpgrp2'
15322 d_setpgrp='$d_setpgrp'
15323 d_setprior='$d_setprior'
15324 d_setpwent='$d_setpwent'
15325 d_setregid='$d_setregid'
15326 d_setresgid='$d_setresgid'
15327 d_setresuid='$d_setresuid'
15328 d_setreuid='$d_setreuid'
15329 d_setrgid='$d_setrgid'
15330 d_setruid='$d_setruid'
15331 d_setsent='$d_setsent'
15332 d_setsid='$d_setsid'
15333 d_setspent='$d_setspent'
15334 d_setvbuf='$d_setvbuf'
15335 d_sfio='$d_sfio'
15336 d_shm='$d_shm'
15337 d_shmat='$d_shmat'
15338 d_shmatprototype='$d_shmatprototype'
15339 d_shmctl='$d_shmctl'
15340 d_shmdt='$d_shmdt'
15341 d_shmget='$d_shmget'
15342 d_sigaction='$d_sigaction'
15343 d_sigsetjmp='$d_sigsetjmp'
15344 d_socket='$d_socket'
15345 d_socklen_t='$d_socklen_t'
15346 d_sockpair='$d_sockpair'
15347 d_sqrtl='$d_sqrtl'
15348 d_statblks='$d_statblks'
15349 d_statfs_f_flags='$d_statfs_f_flags'
15350 d_statfs_s='$d_statfs_s'
15351 d_statvfs='$d_statvfs'
15352 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15353 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15354 d_stdio_stream_array='$d_stdio_stream_array'
15355 d_stdiobase='$d_stdiobase'
15356 d_stdstdio='$d_stdstdio'
15357 d_strchr='$d_strchr'
15358 d_strcoll='$d_strcoll'
15359 d_strctcpy='$d_strctcpy'
15360 d_strerrm='$d_strerrm'
15361 d_strerror='$d_strerror'
15362 d_strtod='$d_strtod'
15363 d_strtol='$d_strtol'
15364 d_strtold='$d_strtold'
15365 d_strtoll='$d_strtoll'
15366 d_strtoul='$d_strtoul'
15367 d_strtoull='$d_strtoull'
15368 d_strtouq='$d_strtouq'
15369 d_strxfrm='$d_strxfrm'
15370 d_suidsafe='$d_suidsafe'
15371 d_symlink='$d_symlink'
15372 d_syscall='$d_syscall'
15373 d_sysconf='$d_sysconf'
15374 d_sysernlst='$d_sysernlst'
15375 d_syserrlst='$d_syserrlst'
15376 d_system='$d_system'
15377 d_tcgetpgrp='$d_tcgetpgrp'
15378 d_tcsetpgrp='$d_tcsetpgrp'
15379 d_telldir='$d_telldir'
15380 d_telldirproto='$d_telldirproto'
15381 d_time='$d_time'
15382 d_times='$d_times'
15383 d_truncate='$d_truncate'
15384 d_tzname='$d_tzname'
15385 d_umask='$d_umask'
15386 d_uname='$d_uname'
15387 d_union_semun='$d_union_semun'
15388 d_ustat='$d_ustat'
15389 d_vendorarch='$d_vendorarch'
15390 d_vendorbin='$d_vendorbin'
15391 d_vendorlib='$d_vendorlib'
15392 d_vfork='$d_vfork'
15393 d_void_closedir='$d_void_closedir'
15394 d_voidsig='$d_voidsig'
15395 d_voidtty='$d_voidtty'
15396 d_volatile='$d_volatile'
15397 d_vprintf='$d_vprintf'
15398 d_wait4='$d_wait4'
15399 d_waitpid='$d_waitpid'
15400 d_wcstombs='$d_wcstombs'
15401 d_wctomb='$d_wctomb'
15402 d_xenix='$d_xenix'
15403 date='$date'
15404 db_hashtype='$db_hashtype'
15405 db_prefixtype='$db_prefixtype'
15406 defvoidused='$defvoidused'
15407 direntrytype='$direntrytype'
15408 dlext='$dlext'
15409 dlsrc='$dlsrc'
15410 doublesize='$doublesize'
15411 drand01='$drand01'
15412 dynamic_ext='$dynamic_ext'
15413 eagain='$eagain'
15414 ebcdic='$ebcdic'
15415 echo='$echo'
15416 egrep='$egrep'
15417 emacs='$emacs'
15418 eunicefix='$eunicefix'
15419 exe_ext='$exe_ext'
15420 expr='$expr'
15421 extensions='$extensions'
15422 fflushNULL='$fflushNULL'
15423 fflushall='$fflushall'
15424 find='$find'
15425 firstmakefile='$firstmakefile'
15426 flex='$flex'
15427 fpossize='$fpossize'
15428 fpostype='$fpostype'
15429 freetype='$freetype'
15430 full_ar='$full_ar'
15431 full_csh='$full_csh'
15432 full_sed='$full_sed'
15433 gccversion='$gccversion'
15434 gidformat='$gidformat'
15435 gidsign='$gidsign'
15436 gidsize='$gidsize'
15437 gidtype='$gidtype'
15438 glibpth='$glibpth'
15439 grep='$grep'
15440 groupcat='$groupcat'
15441 groupstype='$groupstype'
15442 gzip='$gzip'
15443 h_fcntl='$h_fcntl'
15444 h_sysfile='$h_sysfile'
15445 hint='$hint'
15446 hostcat='$hostcat'
15447 huge='$huge'
15448 i16size='$i16size'
15449 i16type='$i16type'
15450 i32size='$i32size'
15451 i32type='$i32type'
15452 i64size='$i64size'
15453 i64type='$i64type'
15454 i8size='$i8size'
15455 i8type='$i8type'
15456 i_arpainet='$i_arpainet'
15457 i_bsdioctl='$i_bsdioctl'
15458 i_db='$i_db'
15459 i_dbm='$i_dbm'
15460 i_dirent='$i_dirent'
15461 i_dld='$i_dld'
15462 i_dlfcn='$i_dlfcn'
15463 i_fcntl='$i_fcntl'
15464 i_float='$i_float'
15465 i_gdbm='$i_gdbm'
15466 i_grp='$i_grp'
15467 i_iconv='$i_iconv'
15468 i_ieeefp='$i_ieeefp'
15469 i_inttypes='$i_inttypes'
15470 i_limits='$i_limits'
15471 i_locale='$i_locale'
15472 i_machcthr='$i_machcthr'
15473 i_malloc='$i_malloc'
15474 i_math='$i_math'
15475 i_memory='$i_memory'
15476 i_mntent='$i_mntent'
15477 i_ndbm='$i_ndbm'
15478 i_netdb='$i_netdb'
15479 i_neterrno='$i_neterrno'
15480 i_netinettcp='$i_netinettcp'
15481 i_niin='$i_niin'
15482 i_poll='$i_poll'
15483 i_pthread='$i_pthread'
15484 i_pwd='$i_pwd'
15485 i_rpcsvcdbm='$i_rpcsvcdbm'
15486 i_sfio='$i_sfio'
15487 i_sgtty='$i_sgtty'
15488 i_shadow='$i_shadow'
15489 i_socks='$i_socks'
15490 i_stdarg='$i_stdarg'
15491 i_stddef='$i_stddef'
15492 i_stdlib='$i_stdlib'
15493 i_string='$i_string'
15494 i_sunmath='$i_sunmath'
15495 i_sysaccess='$i_sysaccess'
15496 i_sysdir='$i_sysdir'
15497 i_sysfile='$i_sysfile'
15498 i_sysfilio='$i_sysfilio'
15499 i_sysin='$i_sysin'
15500 i_sysioctl='$i_sysioctl'
15501 i_syslog='$i_syslog'
15502 i_sysmman='$i_sysmman'
15503 i_sysmode='$i_sysmode'
15504 i_sysmount='$i_sysmount'
15505 i_sysndir='$i_sysndir'
15506 i_sysparam='$i_sysparam'
15507 i_sysresrc='$i_sysresrc'
15508 i_syssecrt='$i_syssecrt'
15509 i_sysselct='$i_sysselct'
15510 i_syssockio='$i_syssockio'
15511 i_sysstat='$i_sysstat'
15512 i_sysstatfs='$i_sysstatfs'
15513 i_sysstatvfs='$i_sysstatvfs'
15514 i_systime='$i_systime'
15515 i_systimek='$i_systimek'
15516 i_systimes='$i_systimes'
15517 i_systypes='$i_systypes'
15518 i_sysuio='$i_sysuio'
15519 i_sysun='$i_sysun'
15520 i_sysutsname='$i_sysutsname'
15521 i_sysvfs='$i_sysvfs'
15522 i_syswait='$i_syswait'
15523 i_termio='$i_termio'
15524 i_termios='$i_termios'
15525 i_time='$i_time'
15526 i_unistd='$i_unistd'
15527 i_ustat='$i_ustat'
15528 i_utime='$i_utime'
15529 i_values='$i_values'
15530 i_varargs='$i_varargs'
15531 i_varhdr='$i_varhdr'
15532 i_vfork='$i_vfork'
15533 ignore_versioned_solibs='$ignore_versioned_solibs'
15534 inc_version_list='$inc_version_list'
15535 inc_version_list_init='$inc_version_list_init'
15536 incpath='$incpath'
15537 inews='$inews'
15538 installarchlib='$installarchlib'
15539 installbin='$installbin'
15540 installman1dir='$installman1dir'
15541 installman3dir='$installman3dir'
15542 installprefix='$installprefix'
15543 installprefixexp='$installprefixexp'
15544 installprivlib='$installprivlib'
15545 installscript='$installscript'
15546 installsitearch='$installsitearch'
15547 installsitebin='$installsitebin'
15548 installsitelib='$installsitelib'
15549 installstyle='$installstyle'
15550 installusrbinperl='$installusrbinperl'
15551 installvendorarch='$installvendorarch'
15552 installvendorbin='$installvendorbin'
15553 installvendorlib='$installvendorlib'
15554 intsize='$intsize'
15555 ivdformat='$ivdformat'
15556 ivsize='$ivsize'
15557 ivtype='$ivtype'
15558 known_extensions='$known_extensions'
15559 ksh='$ksh'
15560 large='$large'
15561 ld='$ld'
15562 lddlflags='$lddlflags'
15563 ldflags='$ldflags'
15564 ldlibpthname='$ldlibpthname'
15565 less='$less'
15566 lib_ext='$lib_ext'
15567 libc='$libc'
15568 libperl='$libperl'
15569 libpth='$libpth'
15570 libs='$libs'
15571 libsdirs='$libsdirs'
15572 libsfiles='$libsfiles'
15573 libsfound='$libsfound'
15574 libspath='$libspath'
15575 libswanted='$libswanted'
15576 line='$line'
15577 lint='$lint'
15578 lkflags='$lkflags'
15579 ln='$ln'
15580 lns='$lns'
15581 locincpth='$locincpth'
15582 loclibpth='$loclibpth'
15583 longdblsize='$longdblsize'
15584 longlongsize='$longlongsize'
15585 longsize='$longsize'
15586 lp='$lp'
15587 lpr='$lpr'
15588 ls='$ls'
15589 lseeksize='$lseeksize'
15590 lseektype='$lseektype'
15591 mail='$mail'
15592 mailx='$mailx'
15593 make='$make'
15594 make_set_make='$make_set_make'
15595 mallocobj='$mallocobj'
15596 mallocsrc='$mallocsrc'
15597 malloctype='$malloctype'
15598 man1dir='$man1dir'
15599 man1direxp='$man1direxp'
15600 man1ext='$man1ext'
15601 man3dir='$man3dir'
15602 man3direxp='$man3direxp'
15603 man3ext='$man3ext'
15604 medium='$medium'
15605 mips_type='$mips_type'
15606 mkdir='$mkdir'
15607 mmaptype='$mmaptype'
15608 models='$models'
15609 modetype='$modetype'
15610 more='$more'
15611 multiarch='$multiarch'
15612 mv='$mv'
15613 myarchname='$myarchname'
15614 mydomain='$mydomain'
15615 myhostname='$myhostname'
15616 myuname='$myuname'
15617 n='$n'
15618 netdb_hlen_type='$netdb_hlen_type'
15619 netdb_host_type='$netdb_host_type'
15620 netdb_name_type='$netdb_name_type'
15621 netdb_net_type='$netdb_net_type'
15622 nm='$nm'
15623 nm_opt='$nm_opt'
15624 nm_so_opt='$nm_so_opt'
15625 nonxs_ext='$nonxs_ext'
15626 nroff='$nroff'
15627 nvsize='$nvsize'
15628 nvtype='$nvtype'
15629 o_nonblock='$o_nonblock'
15630 obj_ext='$obj_ext'
15631 old_pthread_create_joinable='$old_pthread_create_joinable'
15632 optimize='$optimize'
15633 orderlib='$orderlib'
15634 osname='$osname'
15635 osvers='$osvers'
15636 package='$package'
15637 pager='$pager'
15638 passcat='$passcat'
15639 patchlevel='$patchlevel'
15640 path_sep='$path_sep'
15641 perl5='$perl5'
15642 perl='$perl'
15643 perladmin='$perladmin'
15644 perlpath='$perlpath'
15645 pg='$pg'
15646 phostname='$phostname'
15647 pidtype='$pidtype'
15648 plibpth='$plibpth'
15649 pm_apiversion='$pm_apiversion'
15650 pmake='$pmake'
15651 pr='$pr'
15652 prefix='$prefix'
15653 prefixexp='$prefixexp'
15654 privlib='$privlib'
15655 privlibexp='$privlibexp'
15656 prototype='$prototype'
15657 ptrsize='$ptrsize'
15658 quadkind='$quadkind'
15659 quadtype='$quadtype'
15660 randbits='$randbits'
15661 randfunc='$randfunc'
15662 randseedtype='$randseedtype'
15663 ranlib='$ranlib'
15664 rd_nodata='$rd_nodata'
15665 revision='$revision'
15666 rm='$rm'
15667 rmail='$rmail'
15668 runnm='$runnm'
15669 sPRIEldbl='$sPRIEldbl'
15670 sPRIFldbl='$sPRIFldbl'
15671 sPRIGldbl='$sPRIGldbl'
15672 sPRIX64='$sPRIX64'
15673 sPRId64='$sPRId64'
15674 sPRIeldbl='$sPRIeldbl'
15675 sPRIfldbl='$sPRIfldbl'
15676 sPRIgldbl='$sPRIgldbl'
15677 sPRIi64='$sPRIi64'
15678 sPRIo64='$sPRIo64'
15679 sPRIu64='$sPRIu64'
15680 sPRIx64='$sPRIx64'
15681 sched_yield='$sched_yield'
15682 scriptdir='$scriptdir'
15683 scriptdirexp='$scriptdirexp'
15684 sed='$sed'
15685 seedfunc='$seedfunc'
15686 selectminbits='$selectminbits'
15687 selecttype='$selecttype'
15688 sendmail='$sendmail'
15689 sh='$sh'
15690 shar='$shar'
15691 sharpbang='$sharpbang'
15692 shmattype='$shmattype'
15693 shortsize='$shortsize'
15694 shrpenv='$shrpenv'
15695 shsharp='$shsharp'
15696 sig_count='$sig_count'
15697 sig_name='$sig_name'
15698 sig_name_init='$sig_name_init'
15699 sig_num='$sig_num'
15700 sig_num_init='$sig_num_init'
15701 signal_t='$signal_t'
15702 sitearch='$sitearch'
15703 sitearchexp='$sitearchexp'
15704 sitebin='$sitebin'
15705 sitebinexp='$sitebinexp'
15706 sitelib='$sitelib'
15707 sitelib_stem='$sitelib_stem'
15708 sitelibexp='$sitelibexp'
15709 siteprefix='$siteprefix'
15710 siteprefixexp='$siteprefixexp'
15711 sizesize='$sizesize'
15712 sizetype='$sizetype'
15713 sleep='$sleep'
15714 smail='$smail'
15715 small='$small'
15716 so='$so'
15717 sockethdr='$sockethdr'
15718 socketlib='$socketlib'
15719 socksizetype='$socksizetype'
15720 sort='$sort'
15721 spackage='$spackage'
15722 spitshell='$spitshell'
15723 split='$split'
15724 src='$src'
15725 ssizetype='$ssizetype'
15726 startperl='$startperl'
15727 startsh='$startsh'
15728 static_ext='$static_ext'
15729 stdchar='$stdchar'
15730 stdio_base='$stdio_base'
15731 stdio_bufsiz='$stdio_bufsiz'
15732 stdio_cnt='$stdio_cnt'
15733 stdio_filbuf='$stdio_filbuf'
15734 stdio_ptr='$stdio_ptr'
15735 stdio_stream_array='$stdio_stream_array'
15736 strings='$strings'
15737 submit='$submit'
15738 subversion='$subversion'
15739 sysman='$sysman'
15740 tail='$tail'
15741 tar='$tar'
15742 tbl='$tbl'
15743 tee='$tee'
15744 test='$test'
15745 timeincl='$timeincl'
15746 timetype='$timetype'
15747 touch='$touch'
15748 tr='$tr'
15749 trnl='$trnl'
15750 troff='$troff'
15751 u16size='$u16size'
15752 u16type='$u16type'
15753 u32size='$u32size'
15754 u32type='$u32type'
15755 u64size='$u64size'
15756 u64type='$u64type'
15757 u8size='$u8size'
15758 u8type='$u8type'
15759 uidformat='$uidformat'
15760 uidsign='$uidsign'
15761 uidsize='$uidsize'
15762 uidtype='$uidtype'
15763 uname='$uname'
15764 uniq='$uniq'
15765 uquadtype='$uquadtype'
15766 use5005threads='$use5005threads'
15767 use64bitall='$use64bitall'
15768 use64bitint='$use64bitint'
15769 usedl='$usedl'
15770 useithreads='$useithreads'
15771 uselargefiles='$uselargefiles'
15772 uselongdouble='$uselongdouble'
15773 usemorebits='$usemorebits'
15774 usemultiplicity='$usemultiplicity'
15775 usemymalloc='$usemymalloc'
15776 usenm='$usenm'
15777 useopcode='$useopcode'
15778 useperlio='$useperlio'
15779 useposix='$useposix'
15780 usesfio='$usesfio'
15781 useshrplib='$useshrplib'
15782 usesocks='$usesocks'
15783 usethreads='$usethreads'
15784 usevendorprefix='$usevendorprefix'
15785 usevfork='$usevfork'
15786 usrinc='$usrinc'
15787 uuname='$uuname'
15788 uvoformat='$uvoformat'
15789 uvsize='$uvsize'
15790 uvtype='$uvtype'
15791 uvuformat='$uvuformat'
15792 uvxformat='$uvxformat'
15793 vendorarch='$vendorarch'
15794 vendorarchexp='$vendorarchexp'
15795 vendorbin='$vendorbin'
15796 vendorbinexp='$vendorbinexp'
15797 vendorlib='$vendorlib'
15798 vendorlib_stem='$vendorlib_stem'
15799 vendorlibexp='$vendorlibexp'
15800 vendorprefix='$vendorprefix'
15801 vendorprefixexp='$vendorprefixexp'
15802 version='$version'
15803 vi='$vi'
15804 voidflags='$voidflags'
15805 xlibpth='$xlibpth'
15806 xs_apiversion='$xs_apiversion'
15807 zcat='$zcat'
15808 zip='$zip'
15809 EOT
15810
15811 : Add in command line options if available
15812 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15813
15814 : add special variables
15815 $test -f $src/patchlevel.h && \
15816 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15817 echo "CONFIGDOTSH=true" >>config.sh
15818
15819 : propagate old symbols
15820 if $test -f UU/config.sh; then
15821         <UU/config.sh sort | uniq >UU/oldconfig.sh
15822         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15823         sort | uniq -u >UU/oldsyms
15824         set X `cat UU/oldsyms`
15825         shift
15826         case $# in
15827         0) ;;
15828         *)
15829                 cat <<EOM
15830 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15831 EOM
15832                 echo "# Variables propagated from previous config.sh file." >>config.sh
15833                 for sym in `cat UU/oldsyms`; do
15834                         echo "    Propagating $hint variable "'$'"$sym..."
15835                         eval 'tmp="$'"${sym}"'"'
15836                         echo "$tmp" | \
15837                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15838                 done
15839                 ;;
15840         esac
15841 fi
15842
15843 : Finish up by extracting the .SH files
15844 case "$alldone" in
15845 exit)
15846         $rm -rf UU
15847         echo "Done."
15848         exit 0
15849         ;;
15850 cont)
15851         ;;
15852 '')
15853         dflt=''
15854         nostick=true
15855         $cat <<EOM
15856
15857 If you'd like to make any changes to the config.sh file before I begin
15858 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15859
15860 EOM
15861         rp="Press return or use a shell escape to edit config.sh:"
15862         . UU/myread
15863         nostick=''
15864         case "$ans" in
15865         '') ;;
15866         *) : in case they cannot read
15867                 sh 1>&4 -c "$ans";;
15868         esac
15869         ;;
15870 esac
15871
15872 : if this fails, just run all the .SH files by hand
15873 . ./config.sh
15874
15875 echo " "
15876 exec 1>&4
15877 . ./UU/extract
15878
15879 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15880         dflt=y
15881         case "$silent" in
15882         true) ;;
15883         *)
15884                 $cat <<EOM
15885
15886 Now you need to generate make dependencies by running "$make depend".
15887 You might prefer to run it in background: "$make depend > makedepend.out &"
15888 It can take a while, so you might not want to run it right now.
15889
15890 EOM
15891                 ;;
15892         esac
15893         rp="Run $make depend now?"
15894         . UU/myread
15895         case "$ans" in
15896         y*)
15897                 $make depend && echo "Now you must run a $make."
15898                 ;;
15899         *)
15900                 echo "You must run '$make depend' then '$make'."
15901                 ;;
15902         esac
15903 elif test -f [Mm]akefile; then
15904         echo " "
15905         echo "Now you must run a $make."
15906 else
15907         echo "Done."
15908 fi
15909
15910 if $test -f Policy.sh; then
15911     $cat <<EOM
15912
15913 If you compile $package on a different machine or from a different object
15914 directory, copy the Policy.sh file from this object directory to the
15915 new one before you run Configure -- this will help you with most of
15916 the policy defaults.
15917
15918 EOM
15919 fi
15920 if $test -f config.msg; then
15921     echo "Hmm.  I also noted the following information while running:"
15922     echo " "
15923     $cat config.msg >&4
15924     $rm -f config.msg
15925 fi
15926 $rm -f kit*isdone ark*isdone
15927 $rm -rf UU
15928
15929 : End of Configure
15930