stuff for caller and _ in Safe::
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Fri Dec 15 04:41:40 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >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 >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 c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ 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 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_const=''
328 cryptlib=''
329 d_crypt=''
330 d_csh=''
331 full_csh=''
332 d_cuserid=''
333 d_dbl_dig=''
334 d_difftime=''
335 d_dlerror=''
336 d_dlopen=''
337 d_dlsymun=''
338 d_dosuid=''
339 d_suidsafe=''
340 d_drand48proto=''
341 d_dup2=''
342 d_eaccess=''
343 d_endgrent=''
344 d_endhent=''
345 d_endnent=''
346 d_endpent=''
347 d_endpwent=''
348 d_endsent=''
349 d_fchmod=''
350 d_fchown=''
351 d_fcntl=''
352 d_fcntl_can_lock=''
353 d_fd_macros=''
354 d_fd_set=''
355 d_fds_bits=''
356 d_fgetpos=''
357 d_flexfnam=''
358 d_flock=''
359 d_fork=''
360 d_fpos64_t=''
361 d_frexpl=''
362 d_fs_data_s=''
363 d_fseeko=''
364 d_fsetpos=''
365 d_fstatfs=''
366 d_fsync=''
367 d_ftello=''
368 d_ftime=''
369 d_gettimeod=''
370 d_Gconvert=''
371 d_getcwd=''
372 d_getespwnam=''
373 d_getfsstat=''
374 d_getgrent=''
375 d_getgrps=''
376 d_gethbyaddr=''
377 d_gethbyname=''
378 d_gethent=''
379 aphostname=''
380 d_gethname=''
381 d_phostname=''
382 d_uname=''
383 d_gethostprotos=''
384 d_getlogin=''
385 d_getmnt=''
386 d_getmntent=''
387 d_getnbyaddr=''
388 d_getnbyname=''
389 d_getnent=''
390 d_getnetprotos=''
391 d_getpagsz=''
392 d_getpent=''
393 d_getpgid=''
394 d_getpgrp2=''
395 d_bsdgetpgrp=''
396 d_getpgrp=''
397 d_getppid=''
398 d_getprior=''
399 d_getpbyname=''
400 d_getpbynumber=''
401 d_getprotoprotos=''
402 d_getprpwnam=''
403 d_getpwent=''
404 d_getsent=''
405 d_getservprotos=''
406 d_getspnam=''
407 d_getsbyname=''
408 d_getsbyport=''
409 d_gnulibc=''
410 d_hasmntopt=''
411 d_htonl=''
412 d_iconv=''
413 d_inetaton=''
414 d_int64_t=''
415 d_isascii=''
416 d_isnan=''
417 d_isnanl=''
418 d_killpg=''
419 d_lchown=''
420 d_ldbl_dig=''
421 d_link=''
422 d_locconv=''
423 d_lockf=''
424 d_longdbl=''
425 longdblsize=''
426 d_longlong=''
427 longlongsize=''
428 d_lseekproto=''
429 d_lstat=''
430 d_madvise=''
431 d_mblen=''
432 d_mbstowcs=''
433 d_mbtowc=''
434 d_memchr=''
435 d_memcmp=''
436 d_memcpy=''
437 d_memmove=''
438 d_memset=''
439 d_mkdir=''
440 d_mkdtemp=''
441 d_mkfifo=''
442 d_mkstemp=''
443 d_mkstemps=''
444 d_mktime=''
445 d_mmap=''
446 mmaptype=''
447 d_modfl=''
448 d_mprotect=''
449 d_msg=''
450 d_msgctl=''
451 d_msgget=''
452 d_msgrcv=''
453 d_msgsnd=''
454 d_msync=''
455 d_munmap=''
456 d_nice=''
457 d_off64_t=''
458 d_open3=''
459 d_fpathconf=''
460 d_pathconf=''
461 d_pause=''
462 d_pipe=''
463 d_poll=''
464 d_portable=''
465 d_old_pthread_create_joinable=''
466 old_pthread_create_joinable=''
467 d_pthread_yield=''
468 d_sched_yield=''
469 sched_yield=''
470 d_qgcvt=''
471 d_readdir=''
472 d_rewinddir=''
473 d_seekdir=''
474 d_telldir=''
475 d_readlink=''
476 d_rename=''
477 d_rmdir=''
478 d_safebcpy=''
479 d_safemcpy=''
480 d_sanemcmp=''
481 d_sbrkproto=''
482 d_select=''
483 d_sem=''
484 d_semctl=''
485 d_semget=''
486 d_semop=''
487 d_setegid=''
488 d_seteuid=''
489 d_setgrent=''
490 d_setgrps=''
491 d_sethent=''
492 d_setlinebuf=''
493 d_setlocale=''
494 d_setnent=''
495 d_setpent=''
496 d_setpgid=''
497 d_setpgrp2=''
498 d_bsdsetpgrp=''
499 d_setpgrp=''
500 d_setprior=''
501 d_setproctitle=''
502 d_setpwent=''
503 d_setregid=''
504 d_setresgid=''
505 d_setresuid=''
506 d_setreuid=''
507 d_setrgid=''
508 d_setruid=''
509 d_setsent=''
510 d_setsid=''
511 d_setvbuf=''
512 d_sfio=''
513 usesfio=''
514 d_shm=''
515 d_shmat=''
516 d_shmatprototype=''
517 shmattype=''
518 d_shmctl=''
519 d_shmdt=''
520 d_shmget=''
521 d_sigaction=''
522 d_sigsetjmp=''
523 d_msg_ctrunc=''
524 d_msg_dontroute=''
525 d_msg_oob=''
526 d_msg_peek=''
527 d_msg_proxy=''
528 d_oldsock=''
529 d_scm_rights=''
530 d_socket=''
531 d_sockpair=''
532 sockethdr=''
533 socketlib=''
534 d_socklen_t=''
535 d_socks5_init=''
536 d_sqrtl=''
537 d_statblks=''
538 d_statfs_f_flags=''
539 d_statfs_s=''
540 d_fstatvfs=''
541 d_statvfs=''
542 d_stdio_cnt_lval=''
543 d_stdio_ptr_lval=''
544 d_stdio_ptr_lval_nochange_cnt=''
545 d_stdio_ptr_lval_sets_cnt=''
546 d_stdiobase=''
547 d_stdstdio=''
548 stdio_base=''
549 stdio_bufsiz=''
550 stdio_cnt=''
551 stdio_filbuf=''
552 stdio_ptr=''
553 d_index=''
554 d_strchr=''
555 d_strcoll=''
556 d_strctcpy=''
557 d_strerrm=''
558 d_strerror=''
559 d_sysernlst=''
560 d_syserrlst=''
561 d_strtod=''
562 d_strtol=''
563 d_strtold=''
564 d_strtoll=''
565 d_strtoq=''
566 d_strtoul=''
567 d_strtoull=''
568 d_strtouq=''
569 d_strxfrm=''
570 d_symlink=''
571 d_syscall=''
572 d_sysconf=''
573 d_system=''
574 d_tcgetpgrp=''
575 d_tcsetpgrp=''
576 d_telldirproto=''
577 d_time=''
578 timetype=''
579 clocktype=''
580 d_times=''
581 d_truncate=''
582 d_tzname=''
583 d_umask=''
584 d_semctl_semid_ds=''
585 d_semctl_semun=''
586 d_union_semun=''
587 d_ustat=''
588 d_vfork=''
589 usevfork=''
590 d_voidsig=''
591 signal_t=''
592 d_volatile=''
593 d_charvspr=''
594 d_vprintf=''
595 d_wait4=''
596 d_waitpid=''
597 d_wcstombs=''
598 d_wctomb=''
599 dlext=''
600 cccdlflags=''
601 ccdlflags=''
602 dlsrc=''
603 ld=''
604 lddlflags=''
605 usedl=''
606 doublesize=''
607 ebcdic=''
608 fflushNULL=''
609 fflushall=''
610 fpossize=''
611 fpostype=''
612 gccosandvers=''
613 gccversion=''
614 gidformat=''
615 gidsign=''
616 gidsize=''
617 gidtype=''
618 groupstype=''
619 h_fcntl=''
620 h_sysfile=''
621 i_arpainet=''
622 db_hashtype=''
623 db_prefixtype=''
624 i_db=''
625 i_dbm=''
626 i_rpcsvcdbm=''
627 d_dirnamlen=''
628 direntrytype=''
629 i_dirent=''
630 i_dld=''
631 i_dlfcn=''
632 i_fcntl=''
633 i_float=''
634 i_gdbm=''
635 d_grpasswd=''
636 i_grp=''
637 i_iconv=''
638 i_ieeefp=''
639 i_inttypes=''
640 i_libutil=''
641 i_limits=''
642 i_locale=''
643 i_machcthr=''
644 i_malloc=''
645 i_math=''
646 i_memory=''
647 i_mntent=''
648 i_ndbm=''
649 i_netdb=''
650 i_neterrno=''
651 i_netinettcp=''
652 i_niin=''
653 i_sysin=''
654 i_poll=''
655 i_prot=''
656 i_pthread=''
657 d_pwage=''
658 d_pwchange=''
659 d_pwclass=''
660 d_pwcomment=''
661 d_pwexpire=''
662 d_pwgecos=''
663 d_pwpasswd=''
664 d_pwquota=''
665 i_pwd=''
666 i_sfio=''
667 i_shadow=''
668 i_socks=''
669 i_stddef=''
670 i_stdlib=''
671 i_string=''
672 strings=''
673 i_sunmath=''
674 i_sysaccess=''
675 i_sysdir=''
676 i_sysfile=''
677 d_voidtty=''
678 i_bsdioctl=''
679 i_sysfilio=''
680 i_sysioctl=''
681 i_syssockio=''
682 i_syslog=''
683 i_sysmman=''
684 i_sysmode=''
685 i_sysmount=''
686 i_sysndir=''
687 i_sysparam=''
688 i_sysresrc=''
689 i_syssecrt=''
690 i_sysselct=''
691 i_sysstat=''
692 i_sysstatfs=''
693 i_sysstatvfs=''
694 i_systimes=''
695 i_systypes=''
696 i_sysuio=''
697 i_sysun=''
698 i_sysutsname=''
699 i_sysvfs=''
700 i_syswait=''
701 i_sgtty=''
702 i_termio=''
703 i_termios=''
704 i_systime=''
705 i_systimek=''
706 i_time=''
707 timeincl=''
708 i_unistd=''
709 i_ustat=''
710 i_utime=''
711 i_values=''
712 i_stdarg=''
713 i_varargs=''
714 i_varhdr=''
715 i_vfork=''
716 inc_version_list=''
717 inc_version_list_init=''
718 installprefix=''
719 installprefixexp=''
720 installstyle=''
721 installusrbinperl=''
722 intsize=''
723 longsize=''
724 shortsize=''
725 libc=''
726 ldlibpthname=''
727 libperl=''
728 shrpenv=''
729 useshrplib=''
730 glibpth=''
731 libpth=''
732 loclibpth=''
733 plibpth=''
734 xlibpth=''
735 ignore_versioned_solibs=''
736 libs=''
737 libsdirs=''
738 libsfiles=''
739 libsfound=''
740 libspath=''
741 lns=''
742 d_PRIEUldbl=''
743 d_PRIFUldbl=''
744 d_PRIGUldbl=''
745 d_PRIeldbl=''
746 d_PRIfldbl=''
747 d_PRIgldbl=''
748 d_SCNfldbl=''
749 sPRIEUldbl=''
750 sPRIFUldbl=''
751 sPRIGUldbl=''
752 sPRIeldbl=''
753 sPRIfldbl=''
754 sPRIgldbl=''
755 sSCNfldbl=''
756 lseeksize=''
757 lseektype=''
758 make_set_make=''
759 d_mymalloc=''
760 freetype=''
761 mallocobj=''
762 mallocsrc=''
763 malloctype=''
764 usemymalloc=''
765 installman1dir=''
766 man1dir=''
767 man1direxp=''
768 man1ext=''
769 installman3dir=''
770 man3dir=''
771 man3direxp=''
772 man3ext=''
773 modetype=''
774 multiarch=''
775 mydomain=''
776 myhostname=''
777 phostname=''
778 c=''
779 n=''
780 d_eofnblk=''
781 eagain=''
782 o_nonblock=''
783 rd_nodata=''
784 need_va_copy=''
785 netdb_hlen_type=''
786 netdb_host_type=''
787 netdb_name_type=''
788 netdb_net_type=''
789 groupcat=''
790 hostcat=''
791 passcat=''
792 orderlib=''
793 ranlib=''
794 d_perl_otherlibdirs=''
795 otherlibdirs=''
796 package=''
797 spackage=''
798 pager=''
799 api_revision=''
800 api_subversion=''
801 api_version=''
802 api_versionstring=''
803 patchlevel=''
804 revision=''
805 subversion=''
806 version=''
807 perl5=''
808 perladmin=''
809 perlpath=''
810 d_nv_preserves_uv=''
811 d_nv_preserves_uv_bits=''
812 i16size=''
813 i16type=''
814 i32size=''
815 i32type=''
816 i64size=''
817 i64type=''
818 i8size=''
819 i8type=''
820 ivsize=''
821 ivtype=''
822 nvsize=''
823 nvtype=''
824 u16size=''
825 u16type=''
826 u32size=''
827 u32type=''
828 u64size=''
829 u64type=''
830 u8size=''
831 u8type=''
832 uvsize=''
833 uvtype=''
834 ivdformat=''
835 nvEUformat=''
836 nvFUformat=''
837 nvGUformat=''
838 nveformat=''
839 nvfformat=''
840 nvgformat=''
841 uvXUformat=''
842 uvoformat=''
843 uvuformat=''
844 uvxformat=''
845 pidtype=''
846 prefix=''
847 prefixexp=''
848 installprivlib=''
849 privlib=''
850 privlibexp=''
851 prototype=''
852 ptrsize=''
853 d_PRIXU64=''
854 d_PRId64=''
855 d_PRIi64=''
856 d_PRIo64=''
857 d_PRIu64=''
858 d_PRIx64=''
859 sPRIXU64=''
860 sPRId64=''
861 sPRIi64=''
862 sPRIo64=''
863 sPRIu64=''
864 sPRIx64=''
865 d_quad=''
866 quadkind=''
867 quadtype=''
868 uquadtype=''
869 drand01=''
870 randbits=''
871 randfunc=''
872 randseedtype=''
873 seedfunc=''
874 installscript=''
875 scriptdir=''
876 scriptdirexp=''
877 selectminbits=''
878 selecttype=''
879 sh=''
880 sig_count=''
881 sig_name=''
882 sig_name_init=''
883 sig_num=''
884 sig_num_init=''
885 installsitearch=''
886 sitearch=''
887 sitearchexp=''
888 installsitebin=''
889 sitebin=''
890 sitebinexp=''
891 installsitelib=''
892 sitelib=''
893 sitelib_stem=''
894 sitelibexp=''
895 siteprefix=''
896 siteprefixexp=''
897 sizesize=''
898 sizetype=''
899 so=''
900 socksizetype=''
901 sharpbang=''
902 shsharp=''
903 spitshell=''
904 src=''
905 ssizetype=''
906 startperl=''
907 startsh=''
908 stdchar=''
909 d_stdio_stream_array=''
910 stdio_stream_array=''
911 sysman=''
912 trnl=''
913 uidformat=''
914 uidsign=''
915 uidsize=''
916 uidtype=''
917 archname64=''
918 use64bitall=''
919 use64bitint=''
920 ccflags_uselargefiles=''
921 ldflags_uselargefiles=''
922 libswanted_uselargefiles=''
923 uselargefiles=''
924 uselongdouble=''
925 usemorebits=''
926 usemultiplicity=''
927 nm_opt=''
928 nm_so_opt=''
929 runnm=''
930 usenm=''
931 useperlio=''
932 usesocks=''
933 d_oldpthreads=''
934 use5005threads=''
935 useithreads=''
936 usethreads=''
937 incpath=''
938 mips_type=''
939 usrinc=''
940 d_vendorarch=''
941 installvendorarch=''
942 vendorarch=''
943 vendorarchexp=''
944 d_vendorbin=''
945 installvendorbin=''
946 vendorbin=''
947 vendorbinexp=''
948 d_vendorlib=''
949 installvendorlib=''
950 vendorlib=''
951 vendorlib_stem=''
952 vendorlibexp=''
953 usevendorprefix=''
954 vendorprefix=''
955 vendorprefixexp=''
956 versiononly=''
957 defvoidused=''
958 voidflags=''
959 pm_apiversion=''
960 xs_apiversion=''
961 CONFIG=''
962
963 define='define'
964 undef='undef'
965 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
966 rmlist=''
967
968 : We must find out about Eunice early
969 eunicefix=':'
970 if test -f /etc/unixtovms; then
971         eunicefix=/etc/unixtovms
972 fi
973 if test -f /etc/unixtovms.exe; then
974         eunicefix=/etc/unixtovms.exe
975 fi
976
977 i_whoami=''
978 ccname=''
979 ccversion=''
980 perllibs=''
981 : set useposix=false in your hint file to disable the POSIX extension.
982 useposix=true
983 : set useopcode=false in your hint file to disable the Opcode extension.
984 useopcode=true
985 : Trailing extension.  Override this in a hint file, if needed.
986 _exe=''
987 : Extra object files, if any, needed on this platform.
988 archobjs=''
989 archname=''
990 : Possible local include directories to search.
991 : Set locincpth to "" in a hint file to defeat local include searches.
992 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
993 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
994 :
995 : no include file wanted by default
996 inclwanted=''
997
998 groupstype=''
999 : change the next line if compiling for Xenix/286 on Xenix/386
1000 xlibpth='/usr/lib/386 /lib/386'
1001 : Possible local library directories to search.
1002 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1003 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1004
1005 : general looking path for locating libraries
1006 glibpth="/lib /usr/lib $xlibpth"
1007 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1008 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1009 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1010
1011 : Private path used by Configure to find libraries.  Its value
1012 : is prepended to libpth. This variable takes care of special
1013 : machines, like the mips.  Usually, it should be empty.
1014 plibpth=''
1015
1016 : default library list
1017 libswanted=''
1018 : some systems want to use only the non-versioned libso:s
1019 ignore_versioned_solibs=''
1020 archname64=''
1021 ccflags_uselargefiles=''
1022 ldflags_uselargefiles=''
1023 libswanted_uselargefiles=''
1024 : set usemultiplicity on the Configure command line to enable multiplicity.
1025 : set usesocks on the Configure command line to enable socks.
1026 : set usethreads on the Configure command line to enable threads.
1027 : full support for void wanted by default
1028 defvoidused=15
1029
1030 : List of libraries we want.
1031 : If anyone needs -lnet, put it in a hint file.
1032 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1033 libswanted="$libswanted dld ld sun m c cposix posix"
1034 libswanted="$libswanted ndir dir crypt sec"
1035 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1036 : We probably want to search /usr/shlib before most other libraries.
1037 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1038 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1039 glibpth="/usr/shlib $glibpth"
1040 : Do not use vfork unless overridden by a hint file.
1041 usevfork=false
1042
1043 : Find the basic shell for Bourne shell scripts
1044 case "$sh" in
1045 '')
1046         case "$SYSTYPE" in
1047         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1048         *) xxx='/bin/sh';;
1049         esac
1050         if test -f "$xxx"; then
1051                 sh="$xxx"
1052         else
1053                 : Build up a list and do a single loop so we can 'break' out.
1054                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1055                 for xxx in sh bash ksh pdksh ash; do
1056                         for p in $pth; do
1057                                 try="$try ${p}/${xxx}"
1058                         done
1059                 done
1060                 for xxx in $try; do
1061                         if test -f "$xxx"; then
1062                                 sh="$xxx";
1063                                 break
1064                         elif test -f "$xxx.exe"; then
1065                                 sh="$xxx";
1066                                 break
1067                         fi
1068                 done
1069         fi
1070         ;;
1071 esac
1072
1073 case "$sh" in
1074 '')     cat <<EOM >&2
1075 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1076
1077 Usually it's in /bin/sh.  How did you even get this far?
1078 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1079 we'll try to straighten this all out.
1080 EOM
1081         exit 1
1082         ;;
1083 esac
1084
1085 : see if sh knows # comments
1086 if `$sh -c '#' >/dev/null 2>&1`; then
1087         shsharp=true
1088         spitshell=cat
1089         xcat=/bin/cat
1090         test -f $xcat || xcat=/usr/bin/cat
1091         echo "#!$xcat" >try
1092         $eunicefix try
1093         chmod +x try
1094         ./try > today
1095         if test -s today; then
1096                 sharpbang='#!'
1097         else
1098                 echo "#! $xcat" > try
1099                 $eunicefix try
1100                 chmod +x try
1101                 ./try > today
1102                 if test -s today; then
1103                         sharpbang='#! '
1104                 else
1105                         sharpbang=': use '
1106                 fi
1107         fi
1108 else
1109         echo " "
1110         echo "Your $sh doesn't grok # comments--I will strip them later on."
1111         shsharp=false
1112         cd ..
1113         echo "exec grep -v '^[  ]*#'" >spitshell
1114         chmod +x spitshell
1115         $eunicefix spitshell
1116         spitshell=`pwd`/spitshell
1117         cd UU
1118         echo "I presume that if # doesn't work, #! won't work either!"
1119         sharpbang=': use '
1120 fi
1121 rm -f try today
1122
1123 : figure out how to guarantee sh startup
1124 case "$startsh" in
1125 '') startsh=${sharpbang}${sh} ;;
1126 *)
1127 esac
1128 cat >try <<EOSS
1129 $startsh
1130 set abc
1131 test "$?abc" != 1
1132 EOSS
1133
1134 chmod +x try
1135 $eunicefix try
1136 if ./try; then
1137         : echo "Yup, it does."
1138 else
1139         echo "Hmm... '$startsh' does not guarantee sh startup..."
1140         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1141 fi
1142 rm -f try
1143
1144
1145 : Save command line options in file UU/cmdline.opt for later use in
1146 : generating config.sh.
1147 cat > cmdline.opt <<EOSH
1148 # Configure command line arguments.
1149 config_arg0='$0'
1150 config_args='$*'
1151 config_argc=$#
1152 EOSH
1153 argn=1
1154 for arg in "$@"; do
1155         cat >>cmdline.opt <<EOSH
1156 config_arg$argn='$arg'
1157 EOSH
1158         argn=`expr $argn + 1`
1159 done
1160
1161 : produce awk script to parse command line options
1162 cat >options.awk <<'EOF'
1163 BEGIN {
1164         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1165
1166         len = length(optstr);
1167         for (i = 1; i <= len; i++) {
1168                 c = substr(optstr, i, 1);
1169                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1170                 if (a == ":") {
1171                         arg[c] = 1;
1172                         i++;
1173                 }
1174                 opt[c] = 1;
1175         }
1176 }
1177 {
1178         expect = 0;
1179         str = $0;
1180         if (substr(str, 1, 1) != "-") {
1181                 printf("'%s'\n", str);
1182                 next;
1183         }
1184         len = length($0);
1185         for (i = 2; i <= len; i++) {
1186                 c = substr(str, i, 1);
1187                 if (!opt[c]) {
1188                         printf("-%s\n", substr(str, i));
1189                         next;
1190                 }
1191                 printf("-%s\n", c);
1192                 if (arg[c]) {
1193                         if (i < len)
1194                                 printf("'%s'\n", substr(str, i + 1));
1195                         else
1196                                 expect = 1;
1197                         next;
1198                 }
1199         }
1200 }
1201 END {
1202         if (expect)
1203                 print "?";
1204 }
1205 EOF
1206
1207 : process the command line options
1208 set X `for arg in "$@"; do echo "X$arg"; done |
1209         sed -e s/X// | awk -f options.awk`
1210 eval "set $*"
1211 shift
1212 rm -f options.awk
1213
1214 : set up default values
1215 fastread=''
1216 reuseval=false
1217 config_sh=''
1218 alldone=''
1219 error=''
1220 silent=''
1221 extractsh=''
1222 override=''
1223 knowitall=''
1224 rm -f optdef.sh posthint.sh
1225 cat >optdef.sh <<EOS
1226 $startsh
1227 EOS
1228
1229
1230 : option parsing
1231 while test $# -gt 0; do
1232         case "$1" in
1233         -d) shift; fastread=yes;;
1234         -e) shift; alldone=cont;;
1235         -f)
1236                 shift
1237                 cd ..
1238                 if test -r "$1"; then
1239                         config_sh="$1"
1240                 else
1241                         echo "$me: cannot read config file $1." >&2
1242                         error=true
1243                 fi
1244                 cd UU
1245                 shift;;
1246         -h) shift; error=true;;
1247         -r) shift; reuseval=true;;
1248         -s) shift; silent=true; realsilent=true;;
1249         -E) shift; alldone=exit;;
1250         -K) shift; knowitall=true;;
1251         -O) shift; override=true;;
1252         -S) shift; silent=true; extractsh=true;;
1253         -D)
1254                 shift
1255                 case "$1" in
1256                 *=)
1257                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1258                         echo "$me: ignoring -D $1" >&2
1259                         ;;
1260                 *=*) echo "$1" | \
1261                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1262                 *) echo "$1='define'" >> optdef.sh;;
1263                 esac
1264                 shift
1265                 ;;
1266         -U)
1267                 shift
1268                 case "$1" in
1269                 *=) echo "$1" >> optdef.sh;;
1270                 *=*)
1271                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1272                         echo "$me: ignoring -U $1" >&2
1273                         ;;
1274                 *) echo "$1='undef'" >> optdef.sh;;
1275                 esac
1276                 shift
1277                 ;;
1278         -A)
1279             shift
1280             xxx=''
1281             yyy="$1"
1282             zzz=''
1283             uuu=undef
1284             case "$yyy" in
1285             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1286                  case "$zzz" in
1287                  *:*) zzz='' ;;
1288                  *)   xxx=append
1289                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1290                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1291                  esac
1292                  ;;
1293             esac
1294             case "$xxx" in
1295             '')  case "$yyy" in
1296                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1297                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1298                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1299                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1300                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1301                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1302                  esac
1303                  ;;       
1304             esac
1305             case "$xxx" in
1306             append)
1307                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1308             clear)
1309                 echo "$yyy=''"                  >> posthint.sh ;;
1310             define)
1311                 case "$zzz" in
1312                 '') zzz=define ;;
1313                 esac
1314                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1315             eval)
1316                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1317             prepend)
1318                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1319             undef)
1320                 case "$zzz" in
1321                 '') zzz="$uuu" ;;
1322                 esac
1323                 echo "$yyy=$zzz"                >> posthint.sh ;;
1324             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1325             esac
1326             shift
1327             ;;
1328         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1329             exit 0;;
1330         --) break;;
1331         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1332         *) break;;
1333         esac
1334 done
1335
1336 case "$error" in
1337 true)
1338         cat >&2 <<EOM
1339 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1340                  [-U symbol] [-U symbol=] [-A command:symbol...]
1341   -d : use defaults for all answers.
1342   -e : go on without questioning past the production of config.sh.
1343   -f : specify an alternate default configuration file.
1344   -h : print this help message and exit (with an error status).
1345   -r : reuse C symbols value if possible (skips costly nm extraction).
1346   -s : silent mode, only echoes questions and essential information.
1347   -D : define symbol to have some value:
1348          -D symbol         symbol gets the value 'define'
1349          -D symbol=value   symbol gets the value 'value'
1350   -E : stop at the end of questions, after having produced config.sh.
1351   -K : do not use unless you know what you are doing.
1352   -O : let -D and -U override definitions from loaded configuration file.
1353   -S : perform variable substitutions on all .SH files (can mix with -f)
1354   -U : undefine symbol:
1355          -U symbol    symbol gets the value 'undef'
1356          -U symbol=   symbol gets completely empty
1357   -A : manipulate symbol after the platform specific hints have been applied:
1358          -A symbol=value                append " "value to symbol
1359          -A append:symbol=value         append value to symbol
1360          -A define:symbol=value         define symbol to have value
1361          -A clear:symbol                define symbol to be ''
1362          -A define:symbol               define symbol to be 'define'
1363          -A eval:symbol=value           define symbol to be eval of value
1364          -A prepend:symbol=value        prepend value to symbol
1365          -A undef:symbol                define symbol to be 'undef'
1366          -A undef:symbol=               define symbol to be ''
1367   -V : print version number and exit (with a zero status).
1368 EOM
1369         exit 1
1370         ;;
1371 esac
1372
1373 : Sanity checks
1374 case "$fastread$alldone" in
1375 yescont|yesexit) ;;
1376 *)
1377         case "$extractsh" in
1378         true) ;;
1379         *)
1380                 if test ! -t 0; then
1381                         echo "Say 'sh Configure', not 'sh <Configure'"
1382                         exit 1
1383                 fi
1384                 ;;
1385         esac
1386         ;;
1387 esac
1388
1389 exec 4>&1
1390 case "$silent" in
1391 true) exec 1>/dev/null;;
1392 esac
1393
1394 : run the defines and the undefines, if any, but leave the file out there...
1395 touch optdef.sh
1396 . ./optdef.sh
1397 : create the posthint manipulation script and leave the file out there...
1398 touch posthint.sh
1399
1400 : set package name
1401 package=perl5
1402 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1403 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1404 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1405 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1406 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1407 esac
1408
1409 : Some greps do not return status, grrr.
1410 echo "grimblepritz" >grimble
1411 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1412         contains=contains
1413 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1414         contains=grep
1415 else
1416         contains=contains
1417 fi
1418 rm -f grimble
1419 : the following should work in any shell
1420 case "$contains" in
1421 contains*)
1422         echo " "
1423         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1424         cat >contains <<'EOSS'
1425 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1426 EOSS
1427 chmod +x contains
1428 esac
1429
1430 : Find the path to the source tree
1431 case "$src" in
1432 '') case "$0" in
1433     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1434          case "$src" in
1435          /*)    ;;
1436          *)     src=`cd ../$src && pwd` ;;
1437          esac
1438          ;;
1439     *)   src='.';;
1440     esac;;
1441 esac
1442 case "$src" in
1443 '')     src=/
1444         rsrc=/
1445         ;;
1446 /*) rsrc="$src";;
1447 *) rsrc="../$src";;
1448 esac
1449 if test -f $rsrc/Configure && \
1450         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1451 then
1452    : found it, so we are ok.
1453 else
1454         rsrc=''
1455         for src in . .. ../.. ../../.. ../../../..; do
1456                 if test -f ../$src/Configure && \
1457                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1458                 then
1459                         rsrc=../$src
1460                         break
1461                 fi
1462         done
1463 fi
1464 case "$rsrc" in
1465 '')
1466         cat <<EOM >&4
1467
1468 Sorry, I can't seem to locate the source dir for $package.  Please start
1469 Configure with an explicit path -- i.e. /some/path/Configure.
1470
1471 EOM
1472         exit 1
1473         ;;
1474 ../.)   rsrc='..';;
1475 *)
1476         echo " "
1477         echo "Sources for $package found in \"$src\"." >&4
1478         ;;
1479 esac
1480
1481 : script used to extract .SH files with variable substitutions
1482 cat >extract <<'EOS'
1483 CONFIGDOTSH=true
1484 echo "Doing variable substitutions on .SH files..."
1485 if test -f $src/MANIFEST; then
1486         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1487 else
1488         echo "(Looking for .SH files under the source directory.)"
1489         set x `(cd $src; find . -name "*.SH" -print)`
1490 fi
1491 shift
1492 case $# in
1493 0) set x `(cd $src; echo *.SH)`; shift;;
1494 esac
1495 if test ! -f $src/$1; then
1496         shift
1497 fi
1498 mkdir_p='
1499 name=$1;
1500 create="";
1501 while test $name; do
1502         if test ! -d "$name"; then
1503                 create="$name $create";
1504                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1505                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1506         else
1507                 name="";
1508         fi;
1509 done;
1510 for file in $create; do
1511         mkdir $file;
1512 done
1513 '
1514 for file in $*; do
1515         case "$src" in
1516         ".")
1517                 case "$file" in
1518                 */*)
1519                         dir=`expr X$file : 'X\(.*\)/'`
1520                         file=`expr X$file : 'X.*/\(.*\)'`
1521                         (cd $dir && . ./$file)
1522                         ;;
1523                 *)
1524                         . ./$file
1525                         ;;
1526                 esac
1527                 ;;
1528         *)
1529                 case "$file" in
1530                 */*)
1531                         dir=`expr X$file : 'X\(.*\)/'`
1532                         file=`expr X$file : 'X.*/\(.*\)'`
1533                         (set x $dir; shift; eval $mkdir_p)
1534                         sh <$src/$dir/$file
1535                         ;;
1536                 *)
1537                         sh <$src/$file
1538                         ;;
1539                 esac
1540                 ;;
1541         esac
1542 done
1543 if test -f $src/config_h.SH; then
1544         if test ! -f config.h; then
1545         : oops, they left it out of MANIFEST, probably, so do it anyway.
1546         . $src/config_h.SH
1547         fi
1548 fi
1549 EOS
1550
1551 : extract files and exit if asked to do so
1552 case "$extractsh" in
1553 true)
1554         case "$realsilent" in
1555         true) ;;
1556         *) exec 1>&4;;
1557         esac
1558         case "$config_sh" in
1559         '') config_sh='config.sh';;
1560         esac
1561         echo " "
1562         echo "Fetching answers from $config_sh..."
1563         cd ..
1564         . $config_sh
1565         test "$override" && . ./optdef.sh
1566         echo " "
1567         . UU/extract
1568         rm -rf UU
1569         echo "Done."
1570         exit 0
1571         ;;
1572 esac
1573
1574 : Eunice requires " " instead of "", can you believe it
1575 echo " "
1576 : Here we go...
1577 echo "Beginning of configuration questions for $package."
1578
1579 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1580
1581 : first determine how to suppress newline on echo command
1582 echo " "
1583 echo "Checking echo to see how to suppress newlines..."
1584 (echo "hi there\c" ; echo " ") >.echotmp
1585 if $contains c .echotmp >/dev/null 2>&1 ; then
1586         echo "...using -n."
1587         n='-n'
1588         c=''
1589 else
1590         cat <<'EOM'
1591 ...using \c
1592 EOM
1593         n=''
1594         c='\c'
1595 fi
1596 echo $n "The star should be here-->$c"
1597 echo '*'
1598 rm -f .echotmp
1599
1600 : Now test for existence of everything in MANIFEST
1601 echo " "
1602 if test -f $rsrc/MANIFEST; then
1603         echo "First let's make sure your kit is complete.  Checking..." >&4
1604         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1605         rm -f missing
1606         tmppwd=`pwd`
1607         for filelist in x??; do
1608                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1609         done
1610         if test -s missing; then
1611                 cat missing >&4
1612                 cat >&4 <<'EOM'
1613
1614 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1615
1616 You have the option of continuing the configuration process, despite the
1617 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1618 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1619 and contact the author (perlbug@perl.org).
1620
1621 EOM
1622                 echo $n "Continue? [n] $c" >&4
1623                 read ans
1624                 case "$ans" in
1625                 y*)
1626                         echo "Continuing..." >&4
1627                         rm -f missing
1628                         ;;
1629                 *)
1630                         echo "ABORTING..." >&4
1631                         kill $$
1632                         ;;
1633                 esac
1634         else
1635                 echo "Looks good..."
1636         fi
1637 else
1638         echo "There is no MANIFEST file.  I hope your kit is complete !"
1639 fi
1640 rm -f missing x??
1641
1642 echo " "
1643 : Find the appropriate value for a newline for tr
1644 if test -n "$DJGPP"; then
1645        trnl='\012'
1646 fi
1647 if test X"$trnl" = X; then
1648         case "`echo foo|tr '\n' x 2>/dev/null`" in
1649         foox) trnl='\n' ;;
1650         esac
1651 fi
1652 if test X"$trnl" = X; then
1653         case "`echo foo|tr '\012' x 2>/dev/null`" in
1654         foox) trnl='\012' ;;
1655         esac
1656 fi
1657 if test X"$trnl" = X; then
1658         cat <<EOM >&2
1659
1660 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1661
1662 EOM
1663         exit 1
1664 fi
1665
1666 : compute the number of columns on the terminal for proper question formatting
1667 case "$COLUMNS" in
1668 '') COLUMNS='80';;
1669 esac
1670
1671 : set up the echo used in my read
1672 myecho="case \"\$xxxm\" in
1673 '') echo $n \"\$rp $c\" >&4;;
1674 *) case \"\$rp\" in
1675         '') echo $n \"[\$xxxm] $c\";;
1676         *)
1677                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1678                         echo \"\$rp\" >&4
1679                         echo $n \"[\$xxxm] $c\" >&4
1680                 else
1681                         echo $n \"\$rp [\$xxxm] $c\" >&4
1682                 fi
1683                 ;;
1684         esac;;
1685 esac"
1686
1687 : now set up to do reads with possible shell escape and default assignment
1688 cat <<EOSC >myread
1689 $startsh
1690 xxxm=\$dflt
1691 $myecho
1692 ans='!'
1693 case "\$fastread" in
1694 yes) case "\$dflt" in
1695         '') ;;
1696         *) ans='';
1697                 case "\$silent-\$rp" in
1698                 true-) ;;
1699                 *) echo " " >&4;;
1700                 esac;;
1701         esac;;
1702 *) case "\$silent" in
1703         true) case "\$rp" in
1704                 '') ans='';;
1705                 esac;;
1706         esac;;
1707 esac
1708 while expr "X\$ans" : "X!" >/dev/null; do
1709         read answ
1710         set x \$xxxm
1711         shift
1712         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1713         case  "\$answ" in
1714         "!")
1715                 sh 1>&4
1716                 echo " "
1717                 $myecho
1718                 ;;
1719         !*)
1720                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1721                 shift
1722                 sh 1>&4 -c "\$*"
1723                 echo " "
1724                 $myecho
1725                 ;;
1726         "\$ans")
1727                 case "\$ans" in
1728                 \\&*)
1729                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1730                         shift
1731                         case "\$1" in
1732                         -d)
1733                                 fastread=yes
1734                                 echo "(OK, I'll run with -d after this question.)" >&4
1735                                 ;;
1736                         -*)
1737                                 echo "*** Sorry, \$1 not supported yet." >&4
1738                                 ;;
1739                         esac
1740                         $myecho
1741                         ans=!
1742                         ;;
1743                 esac;;
1744         *)
1745                 case "\$aok" in
1746                 y)
1747                         echo "*** Substitution done -- please confirm."
1748                         xxxm="\$ans"
1749                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1750                         xxxm="\$ans"
1751                         ans=!
1752                         ;;
1753                 *)
1754                         echo "*** Error -- try again."
1755                         ans=!
1756                         ;;
1757                 esac
1758                 $myecho
1759                 ;;
1760         esac
1761         case "\$ans\$xxxm\$nostick" in
1762         '')
1763                 ans=!
1764                 $myecho
1765                 ;;
1766         esac
1767 done
1768 case "\$ans" in
1769 '') ans="\$xxxm";;
1770 esac
1771 EOSC
1772
1773 : create .config dir to save info across Configure sessions
1774 test -d ../.config || mkdir ../.config
1775 cat >../.config/README <<EOF
1776 This directory created by Configure to save information that should
1777 persist across sessions for $package.
1778
1779 You may safely delete it if you wish.
1780 EOF
1781
1782 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1783 case "$usedevel" in
1784 $define|true|[yY]*) ;;
1785 *) case "$xversion" in
1786    *[13579])
1787         cat >&4 <<EOH
1788 *** WHOA THERE!!! ***
1789
1790     This is an UNSTABLE DEVELOPMENT release.
1791     The version of this $package distribution is $xversion, that is, odd,
1792     (as opposed to even) and that signifies a development release.
1793     If you want a maintenance release, you want an even-numbered version.
1794
1795     Do ***NOT*** install this into production use.
1796     Data corruption and crashes are possible.
1797
1798     It is most seriously suggested that you do not continue any further
1799     unless you want to help in developing and debugging Perl.
1800
1801 EOH
1802         rp='Do you really want to continue?'
1803         dflt='n'
1804         . ./myread
1805         case "$ans" in
1806         [yY]) echo >&4 "Okay, continuing." ;;
1807         *) echo >&4 "Okay, bye."
1808            exit 1
1809            ;;
1810         esac
1811         ;;
1812     esac
1813     ;;
1814 esac
1815
1816 : general instructions
1817 needman=true
1818 firsttime=true
1819 user=`(logname) 2>/dev/null`
1820 case "$user" in
1821 '') user=`whoami 2>&1`;;
1822 esac
1823 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1824         firsttime=false
1825         echo " "
1826         rp='Would you like to see the instructions?'
1827         dflt=n
1828         . ./myread
1829         case "$ans" in
1830         [yY]*) ;;
1831         *) needman=false;;
1832         esac
1833 fi
1834 if $needman; then
1835         cat <<EOH
1836
1837 This installation shell script will examine your system and ask you questions
1838 to determine how the perl5 package should be installed. If you get
1839 stuck on a question, you may use a ! shell escape to start a subshell or
1840 execute a command.  Many of the questions will have default answers in square
1841 brackets; typing carriage return will give you the default.
1842
1843 On some of the questions which ask for file or directory names you are allowed
1844 to use the ~name construct to specify the login directory belonging to "name",
1845 even if you don't have a shell which knows about that.  Questions where this is
1846 allowed will be marked "(~name ok)".
1847
1848 EOH
1849         rp=''
1850         dflt='Type carriage return to continue'
1851         . ./myread
1852         cat <<'EOH'
1853
1854 The prompter used in this script allows you to use shell variables and
1855 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1856 in the default answer, as if the default line was a set of arguments given to a
1857 script shell.  This means you may also use $* to repeat the whole default line,
1858 so you do not have to re-type everything to add something to the default.
1859
1860 Everytime there is a substitution, you will have to confirm.  If there is an
1861 error (e.g. an unmatched backtick), the default answer will remain unchanged
1862 and you will be prompted again.
1863
1864 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1865 the questions and use the computed defaults (or the previous answers if there
1866 was already a config.sh file). Type 'Configure -h' for a list of options.
1867 You may also start interactively and then answer '& -d' at any prompt to turn
1868 on the non-interactive behaviour for the remainder of the execution.
1869
1870 EOH
1871         . ./myread
1872         cat <<EOH
1873
1874 Much effort has been expended to ensure that this shell script will run on any
1875 Unix system.  If despite that it blows up on yours, your best bet is to edit
1876 Configure and run it again.  If you can't run Configure for some reason,
1877 you'll have to generate a config.sh file by hand.  Whatever problems you
1878 have, let me (perlbug@perl.org) know how I blew it.
1879
1880 This installation script affects things in two ways:
1881
1882 1) it may do direct variable substitutions on some of the files included
1883    in this kit.
1884 2) it builds a config.h file for inclusion in C programs.  You may edit
1885    any of these files as the need arises after running this script.
1886
1887 If you make a mistake on a question, there is no easy way to back up to it
1888 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1889 files.  Configure will offer to let you do this before it runs the SH files.
1890
1891 EOH
1892         dflt='Type carriage return to continue'
1893         . ./myread
1894         case "$firsttime" in
1895         true) echo $user >>../.config/instruct;;
1896         esac
1897 fi
1898
1899 : find out where common programs are
1900 echo " "
1901 echo "Locating common programs..." >&4
1902 cat <<EOSC >loc
1903 $startsh
1904 case \$# in
1905 0) exit 1;;
1906 esac
1907 thing=\$1
1908 shift
1909 dflt=\$1
1910 shift
1911 for dir in \$*; do
1912         case "\$thing" in
1913         .)
1914         if test -d \$dir/\$thing; then
1915                 echo \$dir
1916                 exit 0
1917         fi
1918         ;;
1919         *)
1920         for thisthing in \$dir/\$thing; do
1921                 : just loop through to pick last item
1922         done
1923         if test -f \$thisthing; then
1924                 echo \$thisthing
1925                 exit 0
1926         elif test -f \$dir/\$thing.exe; then
1927                 if test -n "$DJGPP"; then
1928                         echo \$dir/\$thing.exe
1929                 else
1930                         : on Eunice apparently
1931                         echo \$dir/\$thing
1932                 fi
1933                 exit 0
1934         fi
1935         ;;
1936         esac
1937 done
1938 echo \$dflt
1939 exit 1
1940 EOSC
1941 chmod +x loc
1942 $eunicefix loc
1943 loclist="
1944 awk
1945 cat
1946 comm
1947 cp
1948 echo
1949 expr
1950 grep
1951 ls
1952 make
1953 mkdir
1954 rm
1955 sed
1956 sort
1957 touch
1958 tr
1959 uniq
1960 "
1961 trylist="
1962 Mcc
1963 ar
1964 byacc
1965 cpp
1966 csh
1967 date
1968 egrep
1969 gzip
1970 less
1971 ln
1972 more
1973 nm
1974 nroff
1975 pg
1976 test
1977 uname
1978 zip
1979 "
1980 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1981 pth="$pth /lib /usr/lib"
1982 for file in $loclist; do
1983         eval xxx=\$$file
1984         case "$xxx" in
1985         /*|?:[\\/]*)
1986                 if test -f "$xxx"; then
1987                         : ok
1988                 else
1989                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1990                         xxx=`./loc $file $file $pth`
1991                 fi
1992                 ;;
1993         '') xxx=`./loc $file $file $pth`;;
1994         *) xxx=`./loc $xxx $xxx $pth`;;
1995         esac
1996         eval $file=$xxx
1997         eval _$file=$xxx
1998         case "$xxx" in
1999         /*)
2000                 echo $file is in $xxx.
2001                 ;;
2002         ?:[\\/]*)
2003                 echo $file is in $xxx.
2004                 ;;
2005         *)
2006                 echo "I don't know where '$file' is, and my life depends on it." >&4
2007                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2008                 exit 1
2009                 ;;
2010         esac
2011 done
2012 echo " "
2013 echo "Don't worry if any of the following aren't found..."
2014 say=offhand
2015 for file in $trylist; do
2016         eval xxx=\$$file
2017         case "$xxx" in
2018         /*|?:[\\/]*)
2019                 if test -f "$xxx"; then
2020                         : ok
2021                 else
2022                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2023                         xxx=`./loc $file $file $pth`
2024                 fi
2025                 ;;
2026         '') xxx=`./loc $file $file $pth`;;
2027         *) xxx=`./loc $xxx $xxx $pth`;;
2028         esac
2029         eval $file=$xxx
2030         eval _$file=$xxx
2031         case "$xxx" in
2032         /*)
2033                 echo $file is in $xxx.
2034                 ;;
2035         ?:[\\/]*)
2036                 echo $file is in $xxx.
2037                 ;;
2038         *)
2039                 echo "I don't see $file out there, $say."
2040                 say=either
2041                 ;;
2042         esac
2043 done
2044 case "$egrep" in
2045 egrep)
2046         echo "Substituting grep for egrep."
2047         egrep=$grep
2048         ;;
2049 esac
2050 case "$ln" in
2051 ln)
2052         echo "Substituting cp for ln."
2053         ln=$cp
2054         ;;
2055 esac
2056 case "$test" in
2057 test)
2058         echo "Hopefully test is built into your sh."
2059         ;;
2060 *)
2061         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2062                 echo "Using the test built into your sh."
2063                 test=test
2064                 _test=test
2065         fi
2066         ;;
2067 esac
2068 case "$echo" in
2069 echo)
2070         echo "Hopefully echo is built into your sh."
2071         ;;
2072 '') ;;
2073 *)
2074         echo " "
2075 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2076         $echo $n "hi there$c" >foo1
2077         echo $n "hi there$c" >foo2
2078         if cmp foo1 foo2 >/dev/null 2>&1; then
2079                 echo "They are compatible.  In fact, they may be identical."
2080         else
2081                 case "$n" in
2082                 '-n') n='' c='\c';;
2083                 *) n='-n' c='';;
2084                 esac
2085                 cat <<FOO
2086 They are not compatible!  You are probably running ksh on a non-USG system.
2087 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2088 have echo built in and we may have to run some Bourne shell scripts.  That
2089 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2090
2091 FOO
2092                 $echo $n "The star should be here-->$c"
2093                 $echo "*"
2094         fi
2095         $rm -f foo1 foo2
2096         ;;
2097 esac
2098
2099 cat <<EOS >checkcc
2100 $startsh
2101 EOS
2102 cat <<'EOSC' >>checkcc
2103 case "$cc" in
2104 '') ;;
2105 *)  $rm -f try try.*
2106     $cat >try.c <<EOM
2107 int main(int argc, char *argv[]) {
2108   return 0;
2109 }
2110 EOM
2111     if $cc -o try $ccflags try.c; then
2112        :
2113     else
2114         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2115         despair=yes
2116         trygcc=yes
2117         case "$cc" in
2118         *gcc*) trygcc=no ;;
2119         esac
2120         case "`$cc -v -c try.c 2>&1`" in
2121         *gcc*) trygcc=no ;;
2122         esac
2123         if $test X"$trygcc" = Xyes; then
2124             if gcc -o try -c try.c; then
2125                 echo " "
2126                 echo "You seem to have a working gcc, though." >&4
2127                 rp="Would you like to use it?"
2128                 dflt=y
2129                 if $test -f myread; then
2130                     . ./myread
2131                 else
2132                     if $test -f UU/myread; then
2133                         . ./UU/myread
2134                     else
2135                         echo "Cannot find myread, sorry.  Aborting." >&2
2136                         exit 1
2137                     fi
2138                 fi  
2139                 case "$ans" in
2140                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2141                 esac
2142             fi
2143         fi
2144         if $test X"$despair" = Xyes; then
2145             $cat >&4 <<EOM
2146 You need to find a working C compiler.
2147 Either (purchase and) install the C compiler supplied by your OS vendor,
2148 or for a free C compiler try http://gcc.gnu.org/
2149 I cannot continue any further, aborting.
2150 EOM
2151             exit 1
2152         fi
2153     fi
2154     $rm -f try try.*
2155     ;;
2156 esac
2157 EOSC
2158
2159 : determine whether symbolic links are supported
2160 echo " "
2161 $touch blurfl
2162 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2163         echo "Symbolic links are supported." >&4
2164         lns="$ln -s"
2165 else
2166         echo "Symbolic links are NOT supported." >&4
2167         lns="$ln"
2168 fi
2169 $rm -f blurfl sym
2170
2171 : see whether [:lower:] and [:upper:] are supported character classes
2172 echo " "
2173 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2174 ABYZ)
2175         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2176         up='[:upper:]'
2177         low='[:lower:]'
2178         ;;
2179 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2180         # (0xc9 and 0xd1), therefore that is a nice testing point.
2181         if test "X$up" = X -o "X$low" = X; then
2182             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2183             ij) up='[A-Z]'
2184                 low='[a-z]'
2185                 ;;
2186             esac
2187         fi
2188         if test "X$up" = X -o "X$low" = X; then
2189             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2190             ij) up='A-Z'
2191                 low='a-z'
2192                 ;;
2193             esac
2194         fi
2195         if test "X$up" = X -o "X$low" = X; then
2196             case "`echo IJ | od -x 2>/dev/null`" in
2197             *C9D1*|*c9d1*)
2198                 echo "Hey, this might be EBCDIC." >&4
2199                 if test "X$up" = X -o "X$low" = X; then
2200                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2201                     ij) up='[A-IJ-RS-Z]'
2202                         low='[a-ij-rs-z]'
2203                         ;;
2204                     esac
2205                 fi
2206                 if test "X$up" = X -o "X$low" = X; then
2207                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2208                     ij) up='A-IJ-RS-Z'
2209                         low='a-ij-rs-z'
2210                         ;;
2211                     esac
2212                 fi
2213                 ;;
2214             esac
2215         fi
2216 esac
2217 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2218 ij)
2219     echo "Using $up and $low to convert case." >&4
2220     ;;
2221 *)
2222     echo "I don't know how to translate letters from upper to lower case." >&4
2223     echo "Your tr is not acting any way I know of." >&4
2224     exit 1
2225     ;;
2226 esac
2227 : set up the translation script tr, must be called with ./tr of course
2228 cat >tr <<EOSC
2229 $startsh
2230 case "\$1\$2" in
2231 '[A-Z][a-z]') exec $tr '$up' '$low';;
2232 '[a-z][A-Z]') exec $tr '$low' '$up';;
2233 esac
2234 exec $tr "\$@"
2235 EOSC
2236 chmod +x tr
2237 $eunicefix tr
2238
2239 : Try to determine whether config.sh was made on this system
2240 case "$config_sh" in
2241 '')
2242 myuname=`$uname -a 2>/dev/null`
2243 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2244 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2245 # because the A-Z/a-z are not consecutive.
2246 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2247         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2248 newmyuname="$myuname"
2249 dflt=n
2250 case "$knowitall" in
2251 '')
2252         if test -f ../config.sh; then
2253                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2254                         eval "`grep myuname= ../config.sh`"
2255                 fi
2256                 if test "X$myuname" = "X$newmyuname"; then
2257                         dflt=y
2258                 fi
2259         fi
2260         ;;
2261 *) dflt=y;;
2262 esac
2263
2264 : Get old answers from old config file if Configure was run on the
2265 : same system, otherwise use the hints.
2266 hint=default
2267 cd ..
2268 if test -f config.sh; then
2269         echo " "
2270         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2271         . UU/myread
2272         case "$ans" in
2273         n*|N*) echo "OK, I'll ignore it."
2274                 mv config.sh config.sh.old
2275                 myuname="$newmyuname"
2276                 ;;
2277         *)  echo "Fetching default answers from your old config.sh file..." >&4
2278                 tmp_n="$n"
2279                 tmp_c="$c"
2280                 tmp_sh="$sh"
2281                 . ./config.sh
2282                 cp config.sh UU
2283                 n="$tmp_n"
2284                 c="$tmp_c"
2285                 : Older versions did not always set $sh.  Catch re-use of such
2286                 : an old config.sh.
2287                 case "$sh" in
2288                 '') sh="$tmp_sh" ;;
2289                 esac
2290                 hint=previous
2291                 ;;
2292         esac
2293 fi
2294 . ./UU/checkcc
2295 if test ! -f config.sh; then
2296         $cat <<EOM
2297
2298 First time through, eh?  I have some defaults handy for some systems
2299 that need some extra help getting the Configure answers right:
2300
2301 EOM
2302         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2303         dflt=''
2304         : Half the following guesses are probably wrong... If you have better
2305         : tests or hints, please send them to perlbug@perl.org
2306         : The metaconfig authors would also appreciate a copy...
2307         $test -f /irix && osname=irix
2308         $test -f /xenix && osname=sco_xenix
2309         $test -f /dynix && osname=dynix
2310         $test -f /dnix && osname=dnix
2311         $test -f /lynx.os && osname=lynxos
2312         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2313         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2314         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2315         $test -f /bin/mips && /bin/mips && osname=mips
2316         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2317                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2318         $test -d /usr/apollo/bin && osname=apollo
2319         $test -f /etc/saf/_sactab && osname=svr4
2320         $test -d /usr/include/minix && osname=minix
2321         if $test -d /MachTen -o -d /MachTen_Folder; then
2322                 osname=machten
2323                 if $test -x /sbin/version; then
2324                         osvers=`/sbin/version | $awk '{print $2}' |
2325                         $sed -e 's/[A-Za-z]$//'`
2326                 elif $test -x /usr/etc/version; then
2327                         osvers=`/usr/etc/version | $awk '{print $2}' |
2328                         $sed -e 's/[A-Za-z]$//'`
2329                 else
2330                         osvers="$2.$3"
2331                 fi
2332         fi
2333
2334         $test -f /sys/posix.dll &&
2335                 $test -f /usr/bin/what &&
2336                 set X `/usr/bin/what /sys/posix.dll` &&
2337                 $test "$3" = UWIN &&
2338                 osname=uwin &&
2339                 osvers="$5"
2340
2341         if $test -f $uname; then
2342                 set X $myuname
2343                 shift
2344
2345                 case "$5" in
2346                 fps*) osname=fps ;;
2347                 mips*)
2348                         case "$4" in
2349                         umips) osname=umips ;;
2350                         *) osname=mips ;;
2351                         esac;;
2352                 [23]100) osname=mips ;;
2353                 next*) osname=next ;;
2354                 i386*)
2355                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2356                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2357                                 osname='sco'
2358                                 osvers=$tmp
2359                         elif $test -f /etc/kconfig; then
2360                                 osname=isc
2361                                 if test "$lns" = "$ln -s"; then
2362                                         osvers=4
2363                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2364                                         osvers=3
2365                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2366                                         osvers=2
2367                                 fi
2368                         fi
2369                         tmp=''
2370                         ;;
2371                 pc*)
2372                         if test -n "$DJGPP"; then
2373                                 osname=dos
2374                                 osvers=djgpp
2375                         fi
2376                         ;;
2377                 esac
2378
2379                 case "$1" in
2380                 aix) osname=aix
2381                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2382                         case "$tmp" in
2383                         'not found') osvers="$4"."$3" ;;
2384                         '<3240'|'<>3240') osvers=3.2.0 ;;
2385                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2386                         '=3250'|'>3250') osvers=3.2.5 ;;
2387                         *) osvers=$tmp;;
2388                         esac
2389                         ;;
2390                 bsd386) osname=bsd386
2391                         osvers=`$uname -r`
2392                         ;;
2393                 cygwin*) osname=cygwin
2394                         osvers="$3"
2395                         ;;
2396                 *dc.osx) osname=dcosx
2397                         osvers="$3"
2398                         ;;
2399                 dnix) osname=dnix
2400                         osvers="$3"
2401                         ;;
2402                 domainos) osname=apollo
2403                         osvers="$3"
2404                         ;;
2405                 dgux) osname=dgux 
2406                         osvers="$3"
2407                         ;;
2408                 dynixptx*) osname=dynixptx
2409                         osvers=`echo "$4"|sed 's/^v//'`
2410                         ;;
2411                 freebsd) osname=freebsd 
2412                         osvers="$3" ;;
2413                 genix) osname=genix ;;
2414                 hp*) osname=hpux 
2415                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2416                         ;;
2417                 irix*) osname=irix
2418                         case "$3" in
2419                         4*) osvers=4 ;;
2420                         5*) osvers=5 ;;
2421                         *)      osvers="$3" ;;
2422                         esac
2423                         ;;
2424                 linux) osname=linux
2425                         case "$3" in
2426                         *)      osvers="$3" ;;
2427                         esac
2428                         ;;
2429                 MiNT) osname=mint
2430                         ;;
2431                 netbsd*) osname=netbsd
2432                         osvers="$3"
2433                         ;;
2434                 news-os) osvers="$3"
2435                         case "$3" in
2436                         4*) osname=newsos4 ;;
2437                         *) osname=newsos ;;
2438                         esac
2439                         ;;
2440                 next*) osname=next ;;
2441                 nonstop-ux) osname=nonstopux ;;
2442                 POSIX-BC | posix-bc ) osname=posix-bc
2443                         osvers="$3"
2444                         ;;
2445                 powerux | power_ux | powermax_os | powermaxos | \
2446                 powerunix | power_unix) osname=powerux
2447                         osvers="$3"
2448                         ;;
2449                 qnx) osname=qnx
2450                         osvers="$4"
2451                         ;;
2452                 solaris) osname=solaris
2453                         case "$3" in
2454                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2455                         *)      osvers="$3" ;;
2456                         esac
2457                         ;;
2458                 sunos) osname=sunos
2459                         case "$3" in
2460                         5*) osname=solaris
2461                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2462                         *)      osvers="$3" ;;
2463                         esac
2464                         ;;
2465                 titanos) osname=titanos
2466                         case "$3" in
2467                         1*) osvers=1 ;;
2468                         2*) osvers=2 ;;
2469                         3*) osvers=3 ;;
2470                         4*) osvers=4 ;;
2471                         *)      osvers="$3" ;;
2472                         esac
2473                         ;;
2474                 ultrix) osname=ultrix
2475                         osvers="$3"
2476                         ;;
2477                 osf1|mls+)      case "$5" in
2478                                 alpha)
2479                                         osname=dec_osf
2480                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2481                                         case "$osvers" in
2482                                         [1-9].[0-9]*) ;;
2483                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2484                                         esac
2485                                         ;;
2486                         hp*)    osname=hp_osf1  ;;
2487                         mips)   osname=mips_osf1 ;;
2488                         esac
2489                         ;;
2490                 unixware) osname=svr5
2491                         osvers="$4"
2492                         ;;
2493                 uts) osname=uts
2494                         osvers="$3"
2495                         ;;
2496                 $2) case "$osname" in
2497                         *isc*) ;;
2498                         *freebsd*) ;;
2499                         svr*)
2500                                 : svr4.x or possibly later
2501                                 case "svr$3" in 
2502                                 ${osname}*)
2503                                         osname=svr$3
2504                                         osvers=$4
2505                                         ;;
2506                                 esac
2507                                 case "$osname" in
2508                                 svr4.0)
2509                                         : Check for ESIX
2510                                         if test -f /stand/boot ; then
2511                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2512                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2513                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2514                                                         if test -n "$isesix"; then
2515                                                                 osname=esix4
2516                                                         fi
2517                                                 fi
2518                                         fi
2519                                         ;;
2520                                 esac
2521                                 ;;
2522                         *)      if test -f /etc/systemid; then
2523                                         osname=sco
2524                                         set `echo $3 | $sed 's/\./ /g'` $4
2525                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2526                                                 osvers=$1.$2.$3
2527                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2528                                                 osvers=$1.$2
2529                                         elif $test -f $src/hints/sco_$1.sh; then
2530                                                 osvers=$1
2531                                         fi
2532                                 else
2533                                         case "$osname" in
2534                                         '') : Still unknown.  Probably a generic Sys V.
2535                                                 osname="sysv"
2536                                                 osvers="$3"
2537                                                 ;;
2538                                         esac
2539                                 fi
2540                                 ;;
2541                         esac
2542                         ;;
2543                 *)      case "$osname" in
2544                         '') : Still unknown.  Probably a generic BSD.
2545                                 osname="$1"
2546                                 osvers="$3"
2547                                 ;;
2548                         esac
2549                         ;;
2550                 esac
2551         else
2552                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2553                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2554                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2555                                 osname=news_os
2556                         fi
2557                         $rm -f UU/kernel.what
2558                 elif test -d c:/.; then
2559                         set X $myuname
2560                         osname=os2
2561                         osvers="$5"
2562                 fi
2563         fi
2564         
2565         : Now look for a hint file osname_osvers, unless one has been
2566         : specified already.
2567         case "$hintfile" in
2568         ''|' ')
2569                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2570                 : Also try without trailing minor version numbers.
2571                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2572                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2573                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2574                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2575                 case "$file" in
2576                 '') dflt=none ;;
2577                 *)  case "$osvers" in
2578                         '') dflt=$file
2579                                 ;;
2580                         *)  if $test -f $src/hints/$file.sh ; then
2581                                         dflt=$file
2582                                 elif $test -f $src/hints/$xfile.sh ; then
2583                                         dflt=$xfile
2584                                 elif $test -f $src/hints/$xxfile.sh ; then
2585                                         dflt=$xxfile
2586                                 elif $test -f $src/hints/$xxxfile.sh ; then
2587                                         dflt=$xxxfile
2588                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2589                                         dflt=$xxxxfile
2590                                 elif $test -f "$src/hints/${osname}.sh" ; then
2591                                         dflt="${osname}"
2592                                 else
2593                                         dflt=none
2594                                 fi
2595                                 ;;
2596                         esac
2597                         ;;
2598                 esac
2599                 if $test -f Policy.sh ; then
2600                         case "$dflt" in
2601                         *Policy*) ;;
2602                         none) dflt="Policy" ;;
2603                         *) dflt="Policy $dflt" ;;
2604                         esac
2605                 fi
2606                 ;;
2607         *)
2608                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2609                 ;;
2610         esac
2611
2612         if $test -f Policy.sh ; then
2613                 $cat <<EOM
2614
2615 There's also a Policy hint file available, which should make the
2616 site-specific (policy) questions easier to answer.
2617 EOM
2618
2619         fi
2620
2621         $cat <<EOM
2622
2623 You may give one or more space-separated answers, or "none" if appropriate.
2624 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2625 is a good thing.  DO NOT give a wrong version or a wrong OS.
2626
2627 EOM
2628
2629         rp="Which of these apply, if any?"
2630         . UU/myread
2631         tans=$ans
2632         for file in $tans; do
2633                 if $test X$file = XPolicy -a -f Policy.sh; then
2634                         . Policy.sh
2635                         $cat Policy.sh >> UU/config.sh
2636                 elif $test -f $src/hints/$file.sh; then
2637                         . $src/hints/$file.sh
2638                         $cat $src/hints/$file.sh >> UU/config.sh
2639                 elif $test X$tans = X -o X$tans = Xnone ; then
2640                         : nothing
2641                 else
2642                         : Give one chance to correct a possible typo.
2643                         echo "$file.sh does not exist"
2644                         dflt=$file
2645                         rp="hint to use instead?"
2646                         . UU/myread
2647                         for file in $ans; do
2648                                 if $test -f "$src/hints/$file.sh"; then
2649                                         . $src/hints/$file.sh
2650                                         $cat $src/hints/$file.sh >> UU/config.sh
2651                                 elif $test X$ans = X -o X$ans = Xnone ; then
2652                                         : nothing
2653                                 else
2654                                         echo "$file.sh does not exist -- ignored."
2655                                 fi
2656                         done
2657                 fi
2658         done
2659
2660         hint=recommended
2661         : Remember our hint file for later.
2662         if $test -f "$src/hints/$file.sh" ; then
2663                 hintfile="$file"
2664         else
2665                 hintfile=''
2666         fi
2667 fi
2668 cd UU
2669 ;;
2670 *)
2671         echo " "
2672         echo "Fetching default answers from $config_sh..." >&4
2673         tmp_n="$n"
2674         tmp_c="$c"
2675         cd ..
2676         cp $config_sh config.sh 2>/dev/null
2677         chmod +w config.sh
2678         . ./config.sh
2679         cd UU
2680         cp ../config.sh .
2681         n="$tmp_n"
2682         c="$tmp_c"
2683         hint=previous
2684         ;;
2685 esac
2686 test "$override" && . ./optdef.sh
2687
2688 : Restore computed paths
2689 for file in $loclist $trylist; do
2690         eval $file="\$_$file"
2691 done
2692
2693 cat << EOM
2694
2695 Configure uses the operating system name and version to set some defaults.
2696 The default value is probably right if the name rings a bell. Otherwise,
2697 since spelling matters for me, either accept the default or answer "none"
2698 to leave it blank.
2699
2700 EOM
2701 case "$osname" in
2702         ''|' ')
2703                 case "$hintfile" in
2704                 ''|' '|none) dflt=none ;;
2705                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2706                 esac
2707                 ;;
2708         *) dflt="$osname" ;;
2709 esac
2710 rp="Operating system name?"
2711 . ./myread
2712 case "$ans" in
2713 none)  osname='' ;;
2714 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2715 esac
2716 echo " "
2717 case "$osvers" in
2718         ''|' ')
2719                 case "$hintfile" in
2720                 ''|' '|none) dflt=none ;;
2721                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2722                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2723                         case "$dflt" in
2724                         ''|' ') dflt=none ;;
2725                         esac
2726                         ;;
2727                 esac
2728                 ;;
2729         *) dflt="$osvers" ;;
2730 esac
2731 rp="Operating system version?"
2732 . ./myread
2733 case "$ans" in
2734 none)  osvers='' ;;
2735 *) osvers="$ans" ;;
2736 esac
2737
2738
2739 . ./posthint.sh
2740
2741 : who configured the system
2742 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2743 cf_by=`(logname) 2>/dev/null`
2744 case "$cf_by" in
2745 "")
2746         cf_by=`(whoami) 2>/dev/null`
2747         case "$cf_by" in
2748         "") cf_by=unknown ;;
2749         esac ;;
2750 esac
2751
2752 : set up the script used to warn in case of inconsistency
2753 cat <<EOS >whoa
2754 $startsh
2755 EOS
2756 cat <<'EOSC' >>whoa
2757 dflt=y
2758 echo " "
2759 echo "*** WHOA THERE!!! ***" >&4
2760 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2761 rp="    Keep the $hint value?"
2762 . ./myread
2763 case "$ans" in
2764 y) td=$was; tu=$was;;
2765 esac
2766 EOSC
2767
2768 : function used to set $1 to $val
2769 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2770 case "$val$was" in
2771 $define$undef) . ./whoa; eval "$var=\$td";;
2772 $undef$define) . ./whoa; eval "$var=\$tu";;
2773 *) eval "$var=$val";;
2774 esac'
2775
2776 case "$usethreads" in
2777 $define|true|[yY]*)     dflt='y';;
2778 *) dflt='n';;
2779 esac
2780 cat <<EOM
2781
2782 Perl can be built to take advantage of threads on some systems.
2783 To do so, Configure can be run with -Dusethreads.
2784
2785 Note that threading is a highly experimental feature, and
2786 some known race conditions still remain.  If you choose to try
2787 it, be very sure to not actually deploy it for production
2788 purposes.  README.threads has more details, and is required
2789 reading if you enable threads.
2790
2791 If this doesn't make any sense to you, just accept the default '$dflt'.
2792 EOM
2793 rp='Build a threading Perl?'
2794 . ./myread
2795 case "$ans" in
2796 y|Y)    val="$define" ;;
2797 *)      val="$undef" ;;
2798 esac
2799 set usethreads
2800 eval $setvar
2801
2802 case "$usethreads" in
2803 $define)
2804         $cat <<EOM
2805
2806 As of 5.5.640, Perl has two different internal threading implementations,
2807 the 5.005 version (5005threads) and an interpreter-based version
2808 (ithreads) that has one interpreter per thread.  Both are very 
2809 experimental.  This arrangement exists to help developers work out
2810 which one is better.
2811
2812 If you're a casual user, you probably don't want interpreter-threads
2813 at this time.  There doesn't yet exist a way to create threads from
2814 within Perl in this model, i.e., "use Thread;" will NOT work.
2815 EOM
2816         : Default to ithreads unless overridden on command line or with
2817         : old config.sh
2818         dflt='y'
2819         case "$use5005threads" in
2820                 $define|true|[yY]*) dflt='n';;
2821         esac
2822         case "$useithreads" in
2823                 $undef|false|[nN]*) dflt='n';;
2824         esac
2825         rp='Use interpreter-based ithreads?'
2826         . ./myread
2827         case "$ans" in
2828         y|Y)    val="$define" ;;
2829         *)      val="$undef" ;;
2830         esac
2831         set useithreads
2832         eval $setvar
2833         : Now set use5005threads to the opposite value.
2834         case "$useithreads" in
2835         $define) val="$undef" ;;
2836         *) val="$define" ;;
2837         esac
2838         set use5005threads
2839         eval $setvar
2840         ;;
2841 *)
2842         useithreads="$undef"
2843         use5005threads="$undef"
2844         ;;
2845 esac
2846
2847 case "$d_oldpthreads" in
2848 '')     : Configure tests would be welcome here.  For now, assume undef.
2849         val="$undef" ;;
2850 *)      val="$d_oldpthreads" ;;
2851 esac
2852 set d_oldpthreads
2853 eval $setvar
2854
2855
2856 case "$usethreads" in
2857 "$define"|true|[yY]*)
2858 : Look for a hint-file generated 'call-back-unit'.  If the
2859 : user has specified that a threading perl is to be built,
2860 : we may need to set or change some other defaults.
2861         if $test -f usethreads.cbu; then
2862                 echo "Your platform has some specific hints for threaded builds, using them..."
2863                 . ./usethreads.cbu
2864         else
2865                 $cat <<EOM
2866 (Your platform doesn't have any specific hints for threaded builds.
2867  Assuming POSIX threads, then.)
2868 EOM
2869         fi
2870         ;;
2871 esac
2872
2873 cat <<EOM
2874
2875 Perl can be built so that multiple Perl interpreters can coexist
2876 within the same Perl executable.
2877 EOM
2878
2879 case "$useithreads" in
2880 $define)
2881         cat <<EOM
2882 This multiple interpreter support is required for interpreter-based threads.
2883 EOM
2884         val="$define"
2885         ;;
2886 *)      case "$usemultiplicity" in
2887         $define|true|[yY]*)     dflt='y';;
2888         *) dflt='n';;
2889         esac
2890         echo " "
2891         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2892         rp='Build Perl for multiplicity?'
2893         . ./myread
2894         case "$ans" in
2895         y|Y)    val="$define" ;;
2896         *)      val="$undef" ;;
2897         esac
2898         ;;
2899 esac
2900 set usemultiplicity
2901 eval $setvar
2902
2903 : make some quick guesses about what we are up against
2904 echo " "
2905 $echo $n "Hmm...  $c"
2906 echo exit 1 >bsd
2907 echo exit 1 >usg
2908 echo exit 1 >v7
2909 echo exit 1 >osf1
2910 echo exit 1 >eunice
2911 echo exit 1 >xenix
2912 echo exit 1 >venix
2913 echo exit 1 >os2
2914 d_bsd="$undef"
2915 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2916 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2917 then
2918         echo "Looks kind of like an OSF/1 system, but we'll see..."
2919         echo exit 0 >osf1
2920 elif test `echo abc | $tr a-z A-Z` = Abc ; then
2921         xxx=`./loc addbib blurfl $pth`
2922         if $test -f $xxx; then
2923         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2924                 echo exit 0 >bsd
2925                 echo exit 0 >usg
2926         else
2927                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2928                         echo "Looks kind of like an extended USG system, but we'll see..."
2929                 else
2930                         echo "Looks kind of like a USG system, but we'll see..."
2931                 fi
2932                 echo exit 0 >usg
2933         fi
2934 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2935         echo "Looks kind of like a BSD system, but we'll see..."
2936         d_bsd="$define"
2937         echo exit 0 >bsd
2938 else
2939         echo "Looks kind of like a Version 7 system, but we'll see..."
2940         echo exit 0 >v7
2941 fi
2942 case "$eunicefix" in
2943 *unixtovms*)
2944         $cat <<'EOI'
2945 There is, however, a strange, musty smell in the air that reminds me of
2946 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2947 EOI
2948         echo exit 0 >eunice
2949         d_eunice="$define"
2950 : it so happens the Eunice I know will not run shell scripts in Unix format
2951         ;;
2952 *)
2953         echo " "
2954         echo "Congratulations.  You aren't running Eunice."
2955         d_eunice="$undef"
2956         ;;
2957 esac
2958 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2959 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2960 : semicolon as a patch separator
2961 case "$p_" in
2962 :) ;;
2963 *)
2964         $cat <<'EOI'
2965 I have the feeling something is not exactly right, however...don't tell me...
2966 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2967 (Or you may be running DOS with DJGPP.)
2968 EOI
2969         echo exit 0 >os2
2970         ;;
2971 esac
2972 if test -f /xenix; then
2973         echo "Actually, this looks more like a XENIX system..."
2974         echo exit 0 >xenix
2975         d_xenix="$define"
2976 else
2977         echo " "
2978         echo "It's not Xenix..."
2979         d_xenix="$undef"
2980 fi
2981 chmod +x xenix
2982 $eunicefix xenix
2983 if test -f /venix; then
2984         echo "Actually, this looks more like a VENIX system..."
2985         echo exit 0 >venix
2986 else
2987         echo " "
2988         if ./xenix; then
2989                 : null
2990         else
2991                 echo "Nor is it Venix..."
2992         fi
2993 fi
2994 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2995 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2996 $rm -f foo
2997
2998 case "$cc" in
2999 '') dflt=cc;;
3000 *) dflt="$cc";;
3001 esac
3002 rp="Use which C compiler?"
3003 . ./myread
3004 cc="$ans"
3005 : Look for a hint-file generated 'call-back-unit'.  Now that the
3006 : user has specified the compiler, we may need to set or change some
3007 : other defaults.
3008 if $test -f cc.cbu; then
3009     . ./cc.cbu
3010 fi
3011 . ./checkcc
3012
3013 echo " "
3014 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3015 $cat >gccvers.c <<EOM
3016 #include <stdio.h>
3017 int main() {
3018 #ifdef __GNUC__
3019 #ifdef __VERSION__
3020         printf("%s\n", __VERSION__);
3021 #else
3022         printf("%s\n", "1");
3023 #endif
3024 #endif
3025         exit(0);
3026 }
3027 EOM
3028 if $cc -o gccvers $ldflags gccvers.c; then
3029         gccversion=`./gccvers`
3030         case "$gccversion" in
3031         '') echo "You are not using GNU cc." ;;
3032         *)  echo "You are using GNU cc $gccversion."
3033             ccname=gcc  
3034             ;;
3035         esac
3036 else
3037         echo " "
3038         echo "*** WHOA THERE!!! ***" >&4
3039         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3040         case "$knowitall" in
3041         '')
3042         echo "    You'd better start hunting for one and let me know about it." >&4
3043                 exit 1
3044                 ;;
3045         esac
3046 fi
3047 $rm -f gccvers*
3048 case "$gccversion" in
3049 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3050 esac
3051 case "$gccversion" in
3052 '') gccosandvers='' ;;
3053 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3054    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3055    gccshortvers=''
3056    case "$gccosandvers" in
3057    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3058    $osname$osvers) ;; # looking good
3059    $osname*) cat <<EOM >&4
3060
3061 *** WHOA THERE!!! ***
3062
3063     Your gcc has not been compiled for the exact release of
3064     your operating system ($gccosandvers versus $osname$osvers).
3065
3066     In general it is a good idea to keep gcc synchronized with
3067     the operating system because otherwise serious problems
3068     may ensue when trying to compile software, like Perl.
3069
3070     I'm trying to be optimistic here, though, and will continue.
3071     If later during the configuration and build icky compilation
3072     problems appear (headerfile conflicts being the most common
3073     manifestation), I suggest reinstalling the gcc to match
3074     your operating system release.
3075
3076 EOM
3077       ;;
3078    *) gccosandvers='' ;; # failed to parse, better be silent
3079    esac
3080    ;;
3081 esac
3082 case "$ccname" in
3083 '') ccname="$cc" ;;
3084 esac
3085
3086 : see how we invoke the C preprocessor
3087 echo " "
3088 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3089 cat <<'EOT' >testcpp.c
3090 #define ABC abc
3091 #define XYZ xyz
3092 ABC.XYZ
3093 EOT
3094 cd ..
3095 if test ! -f cppstdin; then
3096         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3097                 # AIX cc -E doesn't show the absolute headerfile
3098                 # locations but we'll cheat by using the -M flag.
3099                 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
3100         else
3101                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3102         fi
3103 else
3104         echo "Keeping your $hint cppstdin wrapper."
3105 fi
3106 chmod 755 cppstdin
3107 wrapper=`pwd`/cppstdin
3108 ok='false'
3109 cd UU
3110
3111 if $test "X$cppstdin" != "X" && \
3112         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3113         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3114 then
3115         echo "You used to use $cppstdin $cppminus so we'll use that again."
3116         case "$cpprun" in
3117         '') echo "But let's see if we can live without a wrapper..." ;;
3118         *)
3119                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3120                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3121                 then
3122                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3123                         ok='true'
3124                 else
3125                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3126                 fi
3127                 ;;
3128         esac
3129 else
3130         case "$cppstdin" in
3131         '') ;;
3132         *)
3133                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3134                 ;;
3135         esac
3136 fi
3137
3138 if $ok; then
3139         : nothing
3140 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3141         $cc -E <testcpp.c >testcpp.out 2>&1; \
3142         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3143         echo "Yup, it does."
3144         x_cpp="$cc -E"
3145         x_minus='';
3146 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3147         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3148         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3149         echo "Yup, it does."
3150         x_cpp="$cc -E"
3151         x_minus='-';
3152 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3153         $cc -P <testcpp.c >testcpp.out 2>&1; \
3154         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3155         echo "Yipee, that works!"
3156         x_cpp="$cc -P"
3157         x_minus='';
3158 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3159         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3160         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3161         echo "At long last!"
3162         x_cpp="$cc -P"
3163         x_minus='-';
3164 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3165         $cpp <testcpp.c >testcpp.out 2>&1; \
3166         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3167         echo "It works!"
3168         x_cpp="$cpp"
3169         x_minus='';
3170 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3171         $cpp - <testcpp.c >testcpp.out 2>&1; \
3172         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3173         echo "Hooray, it works!  I was beginning to wonder."
3174         x_cpp="$cpp"
3175         x_minus='-';
3176 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3177         $wrapper <testcpp.c >testcpp.out 2>&1; \
3178         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3179         x_cpp="$wrapper"
3180         x_minus=''
3181         echo "Eureka!"
3182 else
3183         dflt=''
3184         rp="No dice.  I can't find a C preprocessor.  Name one:"
3185         . ./myread
3186         x_cpp="$ans"
3187         x_minus=''
3188         $x_cpp <testcpp.c >testcpp.out 2>&1
3189         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3190                 echo "OK, that will do." >&4
3191         else
3192 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3193                 exit 1
3194         fi
3195 fi
3196
3197 case "$ok" in
3198 false)
3199         cppstdin="$x_cpp"
3200         cppminus="$x_minus"
3201         cpprun="$x_cpp"
3202         cpplast="$x_minus"
3203         set X $x_cpp
3204         shift
3205         case "$1" in
3206         "$cpp")
3207                 echo "Perhaps can we force $cc -E using a wrapper..."
3208                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3209                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3210                 then
3211                         echo "Yup, we can."
3212                         cppstdin="$wrapper"
3213                         cppminus='';
3214                 else
3215                         echo "Nope, we'll have to live without it..."
3216                 fi
3217                 ;;
3218         esac
3219         case "$cpprun" in
3220         "$wrapper")
3221                 cpprun=''
3222                 cpplast=''
3223                 ;;
3224         esac
3225         ;;
3226 esac
3227
3228 case "$cppstdin" in
3229 "$wrapper"|'cppstdin') ;;
3230 *) $rm -f $wrapper;;
3231 esac
3232 $rm -f testcpp.c testcpp.out
3233
3234 : decide how portable to be.  Allow command line overrides.
3235 case "$d_portable" in
3236 "$undef") ;;
3237 *)      d_portable="$define" ;;
3238 esac
3239
3240 : set up shell script to do ~ expansion
3241 cat >filexp <<EOSS
3242 $startsh
3243 : expand filename
3244 case "\$1" in
3245  ~/*|~)
3246         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3247         ;;
3248  ~*)
3249         if $test -f /bin/csh; then
3250                 /bin/csh -f -c "glob \$1"
3251                 failed=\$?
3252                 echo ""
3253                 exit \$failed
3254         else
3255                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3256                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3257                 if $test ! -d "\$dir"; then
3258                         me=\`basename \$0\`
3259                         echo "\$me: can't locate home directory for: \$name" >&2
3260                         exit 1
3261                 fi
3262                 case "\$1" in
3263                 */*)
3264                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3265                         ;;
3266                 *)
3267                         echo \$dir
3268                         ;;
3269                 esac
3270         fi
3271         ;;
3272 *)
3273         echo \$1
3274         ;;
3275 esac
3276 EOSS
3277 chmod +x filexp
3278 $eunicefix filexp
3279
3280 : now set up to get a file name
3281 cat <<EOS >getfile
3282 $startsh
3283 EOS
3284 cat <<'EOSC' >>getfile
3285 tilde=''
3286 fullpath=''
3287 already=''
3288 skip=''
3289 none_ok=''
3290 exp_file=''
3291 nopath_ok=''
3292 orig_rp="$rp"
3293 orig_dflt="$dflt"
3294 case "$gfpth" in
3295 '') gfpth='.' ;;
3296 esac
3297
3298 case "$fn" in
3299 *\(*)
3300         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3301         fn=`echo $fn | sed 's/(.*)//'`
3302         ;;
3303 esac
3304
3305 case "$fn" in
3306 *:*)
3307         loc_file=`expr $fn : '.*:\(.*\)'`
3308         fn=`expr $fn : '\(.*\):.*'`
3309         ;;
3310 esac
3311
3312 case "$fn" in
3313 *~*) tilde=true;;
3314 esac
3315 case "$fn" in
3316 */*) fullpath=true;;
3317 esac
3318 case "$fn" in
3319 *+*) skip=true;;
3320 esac
3321 case "$fn" in
3322 *n*) none_ok=true;;
3323 esac
3324 case "$fn" in
3325 *e*) exp_file=true;;
3326 esac
3327 case "$fn" in
3328 *p*) nopath_ok=true;;
3329 esac
3330
3331 case "$fn" in
3332 *f*) type='File';;
3333 *d*) type='Directory';;
3334 *l*) type='Locate';;
3335 esac
3336
3337 what="$type"
3338 case "$what" in
3339 Locate) what='File';;
3340 esac
3341
3342 case "$exp_file" in
3343 '')
3344         case "$d_portable" in
3345         "$define") ;;
3346         *) exp_file=true;;
3347         esac
3348         ;;
3349 esac
3350
3351 cd ..
3352 while test "$type"; do
3353         redo=''
3354         rp="$orig_rp"
3355         dflt="$orig_dflt"
3356         case "$tilde" in
3357         true) rp="$rp (~name ok)";;
3358         esac
3359         . UU/myread
3360         if test -f UU/getfile.ok && \
3361                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3362         then
3363                 value="$ans"
3364                 ansexp="$ans"
3365                 break
3366         fi
3367         case "$ans" in
3368         none)
3369                 value=''
3370                 ansexp=''
3371                 case "$none_ok" in
3372                 true) type='';;
3373                 esac
3374                 ;;
3375         *)
3376                 case "$tilde" in
3377                 '') value="$ans"
3378                         ansexp="$ans";;
3379                 *)
3380                         value=`UU/filexp $ans`
3381                         case $? in
3382                         0)
3383                                 if test "$ans" != "$value"; then
3384                                         echo "(That expands to $value on this system.)"
3385                                 fi
3386                                 ;;
3387                         *) value="$ans";;
3388                         esac
3389                         ansexp="$value"
3390                         case "$exp_file" in
3391                         '') value="$ans";;
3392                         esac
3393                         ;;
3394                 esac
3395                 case "$fullpath" in
3396                 true)
3397                         case "$ansexp" in
3398                         /*) value="$ansexp" ;;
3399                         [a-zA-Z]:/*) value="$ansexp" ;;
3400                         *)
3401                                 redo=true
3402                                 case "$already" in
3403                                 true)
3404                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3405                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3406                                         ;;
3407                                 *)
3408                                 echo "Please give a full path name, starting with slash." >&4
3409                                         case "$tilde" in
3410                                         true)
3411                                 echo "Note that using ~name is ok provided it expands well." >&4
3412                                                 already=true
3413                                                 ;;
3414                                         esac
3415                                 esac
3416                                 ;;
3417                         esac
3418                         ;;
3419                 esac
3420                 case "$redo" in
3421                 '')
3422                         case "$type" in
3423                         File)
3424                                 for fp in $gfpth; do
3425                                         if test "X$fp" = X.; then
3426                                             pf="$ansexp"
3427                                         else    
3428                                             pf="$fp/$ansexp"
3429                                         fi
3430                                         if test -f "$pf"; then
3431                                                 type=''
3432                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3433                                         then
3434                                                 echo "($value is not a plain file, but that's ok.)"
3435                                                 type=''
3436                                         fi
3437                                         if test X"$type" = X; then
3438                                             value="$pf"
3439                                             break
3440                                         fi
3441                                 done
3442                                 ;;
3443                         Directory)
3444                                 for fp in $gfpth; do
3445                                         if test "X$fp" = X.; then
3446                                             dir="$ans"
3447                                             direxp="$ansexp"
3448                                         else    
3449                                             dir="$fp/$ansexp"
3450                                             direxp="$fp/$ansexp"
3451                                         fi
3452                                         if test -d "$direxp"; then
3453                                                 type=''
3454                                                 value="$dir"
3455                                                 break
3456                                         fi
3457                                 done
3458                                 ;;
3459                         Locate)
3460                                 if test -d "$ansexp"; then
3461                                         echo "(Looking for $loc_file in directory $value.)"
3462                                         value="$value/$loc_file"
3463                                         ansexp="$ansexp/$loc_file"
3464                                 fi
3465                                 if test -f "$ansexp"; then
3466                                         type=''
3467                                 fi
3468                                 case "$nopath_ok" in
3469                                 true)   case "$value" in
3470                                         */*) ;;
3471                                         *)      echo "Assuming $value will be in people's path."
3472                                                 type=''
3473                                                 ;;
3474                                         esac
3475                                         ;;
3476                                 esac
3477                                 ;;
3478                         esac
3479
3480                         case "$skip" in
3481                         true) type='';
3482                         esac
3483
3484                         case "$type" in
3485                         '') ;;
3486                         *)
3487                                 if test "$fastread" = yes; then
3488                                         dflt=y
3489                                 else
3490                                         dflt=n
3491                                 fi
3492                                 rp="$what $value doesn't exist.  Use that name anyway?"
3493                                 . UU/myread
3494                                 dflt=''
3495                                 case "$ans" in
3496                                 y*) type='';;
3497                                 *) echo " ";;
3498                                 esac
3499                                 ;;
3500                         esac
3501                         ;;
3502                 esac
3503                 ;;
3504         esac
3505 done
3506 cd UU
3507 ans="$value"
3508 rp="$orig_rp"
3509 dflt="$orig_dflt"
3510 rm -f getfile.ok
3511 test "X$gfpthkeep" != Xy && gfpth=""
3512 EOSC
3513
3514 : What should the include directory be ?
3515 echo " "
3516 $echo $n "Hmm...  $c"
3517 dflt='/usr/include'
3518 incpath=''
3519 mips_type=''
3520 if $test -f /bin/mips && /bin/mips; then
3521         echo "Looks like a MIPS system..."
3522         $cat >usr.c <<'EOCP'
3523 #ifdef SYSTYPE_BSD43
3524 /bsd43
3525 #endif
3526 EOCP
3527         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3528                 dflt='/bsd43/usr/include'
3529                 incpath='/bsd43'
3530                 mips_type='BSD 4.3'
3531         else
3532                 mips_type='System V'
3533         fi
3534         $rm -f usr.c usr.out
3535         echo "and you're compiling with the $mips_type compiler and libraries."
3536         xxx_prompt=y
3537         echo "exit 0" >mips
3538 else
3539         echo "Doesn't look like a MIPS system."
3540         xxx_prompt=n
3541         echo "exit 1" >mips
3542 fi
3543 chmod +x mips
3544 $eunicefix mips
3545 case "$usrinc" in
3546 '') ;;
3547 *) dflt="$usrinc";;
3548 esac
3549 case "$xxx_prompt" in
3550 y)      fn=d/
3551         echo " "
3552         rp='Where are the include files you want to use?'
3553         . ./getfile
3554         usrinc="$ans"
3555         ;;
3556 *)      usrinc="$dflt"
3557         ;;
3558 esac
3559
3560 : Set private lib path
3561 case "$plibpth" in
3562 '') if ./mips; then
3563                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3564         fi;;
3565 esac
3566 case "$libpth" in
3567 ' ') dlist='';;
3568 '') dlist="$loclibpth $plibpth $glibpth";;
3569 *) dlist="$libpth";;
3570 esac
3571
3572 : Now check and see which directories actually exist, avoiding duplicates
3573 libpth=''
3574 for xxx in $dlist
3575 do
3576     if $test -d $xxx; then
3577                 case " $libpth " in
3578                 *" $xxx "*) ;;
3579                 *) libpth="$libpth $xxx";;
3580                 esac
3581     fi
3582 done
3583 $cat <<'EOM'
3584
3585 Some systems have incompatible or broken versions of libraries.  Among
3586 the directories listed in the question below, please remove any you
3587 know not to be holding relevant libraries, and add any that are needed.
3588 Say "none" for none.
3589
3590 EOM
3591 case "$libpth" in
3592 '') dflt='none';;
3593 *)
3594         set X $libpth
3595         shift
3596         dflt=${1+"$@"}
3597         ;;
3598 esac
3599 rp="Directories to use for library searches?"
3600 . ./myread
3601 case "$ans" in
3602 none) libpth=' ';;
3603 *) libpth="$ans";;
3604 esac
3605
3606 : compute shared library extension
3607 case "$so" in
3608 '')
3609         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3610                 dflt='sl'
3611         else
3612                 dflt='so'
3613         fi
3614         ;;
3615 *) dflt="$so";;
3616 esac
3617 $cat <<EOM
3618
3619 On some systems, shared libraries may be available.  Answer 'none' if
3620 you want to suppress searching of shared libraries for the remainder
3621 of this configuration.
3622
3623 EOM
3624 rp='What is the file extension used for shared libraries?'
3625 . ./myread
3626 so="$ans"
3627
3628 : Define several unixisms.
3629 : Hints files or command line option can be used to override them.
3630 : The convoluted testing is in case hints files set either the old
3631 : or the new name.
3632 case "$_exe" in
3633 '')     case "$exe_ext" in
3634     '') ;;
3635         *)      _exe="$exe_ext" ;;
3636         esac
3637         ;;
3638 esac
3639 case "$_a" in
3640 '')     case "$lib_ext" in
3641     '') _a='.a';;
3642         *)      _a="$lib_ext" ;;
3643         esac
3644         ;;
3645 esac
3646 case "$_o" in
3647 '') case "$obj_ext" in
3648         '')     _o='.o';;
3649         *)      _o="$obj_ext";;
3650         esac
3651         ;;
3652 esac
3653 case "$p_" in
3654 '') case "$path_sep" in
3655         '')     p_=':';;
3656         *)      p_="$path_sep";;
3657         esac
3658         ;;
3659 esac
3660 exe_ext=$_exe
3661 lib_ext=$_a
3662 obj_ext=$_o
3663 path_sep=$p_
3664
3665 : Which makefile gets called first.  This is used by make depend.
3666 case "$firstmakefile" in
3667 '') firstmakefile='makefile';;
3668 esac
3669
3670 case "$usesocks" in
3671 $define|true|[yY]*)     dflt='y';;
3672 *) dflt='n';;
3673 esac
3674 cat <<EOM
3675
3676 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3677 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3678 to use the PerlIO abstraction layer, this will be implicitly selected.
3679
3680 If this doesn't make any sense to you, just accept the default '$dflt'.
3681 EOM
3682 rp='Build Perl for SOCKS?'
3683 . ./myread
3684 case "$ans" in
3685 y|Y)    val="$define" ;;     
3686 *)      val="$undef" ;;
3687 esac
3688 set usesocks
3689 eval $setvar
3690
3691 case "$usesocks" in
3692 $define|true|[yY]*) useperlio="$define";;
3693 esac
3694
3695 : Looking for optional libraries
3696 echo " "
3697 echo "Checking for optional libraries..." >&4
3698 case "$libs" in
3699 ' '|'') dflt='';;
3700 *) dflt="$libs";;
3701 esac
3702 case "$libswanted" in
3703 '') libswanted='c_s';;
3704 esac
3705 case "$usesocks" in
3706 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3707 esac
3708 libsfound=''
3709 libsfiles=''
3710 libsdirs=''
3711 libspath=''
3712 for thisdir in $libpth $xlibpth; do
3713   test -d $thisdir && libspath="$libspath $thisdir"
3714 done
3715 for thislib in $libswanted; do
3716         for thisdir in $libspath; do
3717             xxx=''
3718             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3719                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3720                 $test -f "$xxx" && eval $libscheck
3721                 $test -f "$xxx" && libstyle=shared
3722             fi
3723             if test ! -f "$xxx"; then
3724                 xxx=$thisdir/lib$thislib.$so
3725                 $test -f "$xxx" && eval $libscheck
3726                 $test -f "$xxx" && libstyle=shared
3727             fi  
3728             if test ! -f "$xxx"; then
3729                 xxx=$thisdir/lib$thislib$_a
3730                 $test -f "$xxx" && eval $libscheck
3731                 $test -f "$xxx" && libstyle=static
3732             fi
3733             if test ! -f "$xxx"; then
3734                 xxx=$thisdir/$thislib$_a
3735                 $test -f "$xxx" && eval $libscheck
3736                 $test -f "$xxx" && libstyle=static
3737             fi
3738             if test ! -f "$xxx"; then
3739                 xxx=$thisdir/lib${thislib}_s$_a
3740                 $test -f "$xxx" && eval $libscheck
3741                 $test -f "$xxx" && libstyle=static
3742                 $test -f "$xxx" && thislib=${thislib}_s
3743             fi
3744             if test ! -f "$xxx"; then
3745                 xxx=$thisdir/Slib$thislib$_a
3746                 $test -f "$xxx" && eval $libscheck
3747                 $test -f "$xxx" && libstyle=static
3748             fi
3749             if $test -f "$xxx"; then
3750                 case "$libstyle" in
3751                 shared) echo "Found -l$thislib (shared)." ;;
3752                 static) echo "Found -l$thislib." ;;
3753                 *)      echo "Found -l$thislib ($libstyle)." ;;
3754                 esac
3755                 case " $dflt " in
3756                 *"-l$thislib "*);;
3757                 *) dflt="$dflt -l$thislib"
3758                    libsfound="$libsfound $xxx"
3759                    yyy=`basename $xxx`
3760                    libsfiles="$libsfiles $yyy"
3761                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3762                    case " $libsdirs " in
3763                    *" $yyy "*) ;;
3764                    *) libsdirs="$libsdirs $yyy" ;;
3765                    esac
3766                    ;;
3767                 esac
3768                 break
3769             fi  
3770         done
3771         if $test ! -f "$xxx"; then
3772             echo "No -l$thislib."
3773         fi
3774 done
3775 set X $dflt
3776 shift
3777 dflt="$*"
3778 case "$libs" in
3779 '') dflt="$dflt";;
3780 *) dflt="$libs";;
3781 esac
3782 case "$dflt" in
3783 ' '|'') dflt='none';;
3784 esac
3785
3786 $cat <<EOM
3787
3788 In order to compile $package on your machine, a number of libraries
3789 are usually needed.  Include any other special libraries here as well.
3790 Say "none" for none.  The default list is almost always right.
3791 EOM
3792
3793 echo " "
3794 rp="What libraries to use?"
3795 . ./myread
3796 case "$ans" in
3797 none) libs=' ';;
3798 *) libs="$ans";;
3799 esac
3800
3801 : determine optimization, if desired, or use for debug flag also
3802 case "$optimize" in
3803 ' '|$undef) dflt='none';;
3804 '') dflt='-O';;
3805 *) dflt="$optimize";;
3806 esac
3807 $cat <<EOH
3808
3809 By default, $package compiles with the -O flag to use the optimizer.
3810 Alternately, you might want to use the symbolic debugger, which uses
3811 the -g flag (on traditional Unix systems).  Either flag can be
3812 specified here.  To use neither flag, specify the word "none".
3813
3814 EOH
3815 rp="What optimizer/debugger flag should be used?"
3816 . ./myread
3817 optimize="$ans"
3818 case "$optimize" in
3819 'none') optimize=" ";;
3820 esac
3821
3822 dflt=''
3823 : We will not override a previous value, but we might want to
3824 : augment a hint file
3825 case "$hint" in
3826 default|recommended)
3827         case "$gccversion" in
3828         1*) dflt='-fpcc-struct-return' ;;
3829         esac
3830         case "$optimize" in
3831         *-g*) dflt="$dflt -DDEBUGGING";;
3832         esac
3833         case "$gccversion" in
3834         2*) if test -d /etc/conf/kconfig.d &&
3835                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3836                 then
3837                         dflt="$dflt -posix"
3838                 fi
3839                 ;;
3840         esac
3841         case "$gccversion" in
3842         1*) ;;
3843         2.[0-8]*) ;;
3844         ?*)     echo " "
3845                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3846                 echo 'int main(void) { return 0; }' > gcctest.c
3847                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3848                         echo "Yes, it does." 2>&1
3849                         case "$ccflags" in
3850                         *strict-aliasing*) 
3851                                 echo "Leaving current flags $ccflags alone." 2>&1
3852                                 ;;
3853                         *) dflt="$dflt -fno-strict-aliasing" ;;
3854                         esac
3855                 else
3856                         echo "Nope, it doesn't, but that's ok." 2>&1
3857                 fi
3858                 ;;
3859         esac
3860         ;;
3861 esac
3862
3863 case "$mips_type" in
3864 *BSD*|'') inclwanted="$locincpth $usrinc";;
3865 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3866 esac
3867 for thisincl in $inclwanted; do
3868         if $test -d $thisincl; then
3869                 if $test x$thisincl != x$usrinc; then
3870                         case "$dflt" in
3871                         *" -I$thisincl "*);;
3872                         *) dflt="$dflt -I$thisincl ";;
3873                         esac
3874                 fi
3875         fi
3876 done
3877
3878 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3879         xxx=true;
3880 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3881         xxx=true;
3882 else
3883         xxx=false;
3884 fi;
3885 if $xxx; then
3886         case "$dflt" in
3887         *$2*);;
3888         *) dflt="$dflt -D$2";;
3889         esac;
3890 fi'
3891
3892 set signal.h LANGUAGE_C; eval $inctest
3893
3894 case "$usesocks" in
3895 $define)
3896         ccflags="$ccflags -DSOCKS"
3897         ;;
3898 esac
3899
3900 case "$hint" in
3901 default|recommended) dflt="$ccflags $dflt" ;;
3902 *) dflt="$ccflags";;
3903 esac
3904
3905 case "$dflt" in
3906 ''|' ') dflt=none;;
3907 esac
3908
3909 $cat <<EOH
3910
3911 Your C compiler may want other flags.  For this question you should include
3912 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3913 but you should NOT include libraries or ld flags like -lwhatever.  If you
3914 want $package to honor its debug switch, you should include -DDEBUGGING here.
3915 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3916
3917 To use no flags, specify the word "none".
3918
3919 EOH
3920 set X $dflt
3921 shift
3922 dflt=${1+"$@"}
3923 rp="Any additional cc flags?"
3924 . ./myread
3925 case "$ans" in
3926 none) ccflags='';;
3927 *) ccflags="$ans";;
3928 esac
3929
3930 : the following weeds options from ccflags that are of no interest to cpp
3931 cppflags="$ccflags"
3932 case "$gccversion" in
3933 1*) cppflags="$cppflags -D__GNUC__"
3934 esac
3935 case "$mips_type" in
3936 '');;
3937 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3938 esac
3939 case "$cppflags" in
3940 '');;
3941 *)
3942         echo " "
3943         echo "Let me guess what the preprocessor flags are..." >&4
3944         set X $cppflags
3945         shift
3946         cppflags=''
3947         $cat >cpp.c <<'EOM'
3948 #define BLURFL foo
3949
3950 BLURFL xx LFRULB
3951 EOM
3952         previous=''
3953         for flag in $*
3954         do
3955                 case "$flag" in
3956                 -*) ftry="$flag";;
3957                 *) ftry="$previous $flag";;
3958                 esac
3959                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3960                         >cpp1.out 2>/dev/null && \
3961                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3962                         >cpp2.out 2>/dev/null && \
3963                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3964                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3965                 then
3966                         cppflags="$cppflags $ftry"
3967                         previous=''
3968                 else
3969                         previous="$flag"
3970                 fi
3971         done
3972         set X $cppflags
3973         shift
3974         cppflags=${1+"$@"}
3975         case "$cppflags" in
3976         *-*)  echo "They appear to be: $cppflags";;
3977         esac
3978         $rm -f cpp.c cpp?.out
3979         ;;
3980 esac
3981
3982 : flags used in final linking phase
3983 case "$ldflags" in
3984 '') if ./venix; then
3985                 dflt='-i -z'
3986         else
3987                 dflt=''
3988         fi
3989         case "$ccflags" in
3990         *-posix*) dflt="$dflt -posix" ;;
3991         esac
3992         ;;
3993 *) dflt="$ldflags";;
3994 esac
3995
3996 : Try to guess additional flags to pick up local libraries.
3997 for thislibdir in $libpth; do
3998         case " $loclibpth " in
3999         *" $thislibdir "*)
4000                 case "$dflt " in 
4001                 *"-L$thislibdir "*) ;;
4002                 *)  dflt="$dflt -L$thislibdir" ;;
4003                 esac
4004                 ;;
4005         esac
4006 done
4007
4008 case "$dflt" in
4009 '') dflt='none' ;;
4010 esac
4011
4012 $cat <<EOH
4013
4014 Your C linker may need flags.  For this question you should
4015 include -L/whatever and any other flags used by the C linker, but you
4016 should NOT include libraries like -lwhatever.
4017
4018 Make sure you include the appropriate -L/path flags if your C linker
4019 does not normally search all of the directories you specified above,
4020 namely
4021         $libpth
4022 To use no flags, specify the word "none".
4023
4024 EOH
4025
4026 rp="Any additional ld flags (NOT including libraries)?"
4027 . ./myread
4028 case "$ans" in
4029 none) ldflags='';;
4030 *) ldflags="$ans";;
4031 esac
4032 rmlist="$rmlist pdp11"
4033
4034 : coherency check
4035 echo " "
4036 echo "Checking your choice of C compiler and flags for coherency..." >&4
4037 $cat > try.c <<'EOF'
4038 #include <stdio.h>
4039 int main() { printf("Ok\n"); exit(0); }
4040 EOF
4041 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4042 shift
4043 $cat >try.msg <<'EOM'
4044 I've tried to compile and run the following simple program:
4045
4046 EOM
4047 $cat try.c >> try.msg
4048
4049 $cat >> try.msg <<EOM
4050
4051 I used the command:
4052
4053         $*
4054         ./try
4055
4056 and I got the following output:
4057
4058 EOM
4059 dflt=y
4060 if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4061         if sh -c './try' >>try.msg 2>&1; then
4062                 xxx=`./try`
4063                 case "$xxx" in
4064                 "Ok") dflt=n ;;
4065                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4066                         case " $libs " in
4067                         *" -lsfio "*)
4068                                 cat >> try.msg <<'EOQS'
4069 If $libs contains -lsfio, and sfio is mis-configured, then it
4070 sometimes (apparently) runs and exits with a 0 status, but with no
4071 output!  It may have to do with sfio's use of _exit vs. exit.
4072
4073 EOQS
4074                                 rp="You have a big problem.  Shall I abort Configure"
4075                                 dflt=y
4076                                 ;;
4077                         esac
4078                         ;;
4079                 esac
4080         else
4081                 echo "The program compiled OK, but exited with status $?." >>try.msg
4082                 rp="You have a problem.  Shall I abort Configure"
4083                 dflt=y
4084         fi
4085 else
4086         echo "I can't compile the test program." >>try.msg
4087         rp="You have a BIG problem.  Shall I abort Configure"
4088         dflt=y
4089 fi
4090 case "$dflt" in
4091 y)
4092         $cat try.msg >&4
4093         case "$knowitall" in
4094         '')
4095                 echo "(The supplied flags or libraries might be incorrect.)"
4096                 ;;
4097         *) dflt=n;;
4098         esac
4099         echo " "
4100         . ./myread
4101         case "$ans" in
4102         n*|N*) ;;
4103         *)      echo "Ok.  Stopping Configure." >&4
4104                 exit 1
4105                 ;;
4106         esac
4107         ;;
4108 n) echo "OK, that should do.";;
4109 esac
4110 $rm -f try try.* core
4111
4112 : define an is-a-typedef? function
4113 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4114 case "$inclist" in
4115 "") inclist="sys/types.h";;
4116 esac;
4117 eval "varval=\$$var";
4118 case "$varval" in
4119 "")
4120         $rm -f temp.c;
4121         for inc in $inclist; do
4122                 echo "#include <$inc>" >>temp.c;
4123         done;
4124         echo "#ifdef $type" >> temp.c;
4125         echo "printf(\"We have $type\");" >> temp.c;
4126         echo "#endif" >> temp.c;
4127         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4128         if $contains $type temp.E >/dev/null 2>&1; then
4129                 eval "$var=\$type";
4130         else
4131                 eval "$var=\$def";
4132         fi;
4133         $rm -f temp.?;;
4134 *) eval "$var=\$varval";;
4135 esac'
4136
4137 : define an is-a-typedef? function that prompts if the type is not available.
4138 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4139 case "$inclist" in
4140 "") inclist="sys/types.h";;
4141 esac;
4142 eval "varval=\$$var";
4143 case "$varval" in
4144 "")
4145         $rm -f temp.c;
4146         for inc in $inclist; do
4147                 echo "#include <$inc>" >>temp.c;
4148         done;
4149         echo "#ifdef $type" >> temp.c;
4150         echo "printf(\"We have $type\");" >> temp.c;
4151         echo "#endif" >> temp.c;
4152         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4153         echo " " ;
4154         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4155         if $contains $type temp.E >/dev/null 2>&1; then
4156                 echo "$type found." >&4;
4157                 eval "$var=\$type";
4158         else
4159                 echo "$type NOT found." >&4;
4160                 dflt="$def";
4161                 . ./myread ;
4162                 eval "$var=\$ans";
4163         fi;
4164         $rm -f temp.?;;
4165 *) eval "$var=\$varval";;
4166 esac'
4167
4168 : define a shorthand compile call
4169 compile='
4170 mc_file=$1;
4171 shift;
4172 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4173 : define a shorthand compile call for compilations that should be ok.
4174 compile_ok='
4175 mc_file=$1;
4176 shift;
4177 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4178
4179 : check for lengths of integral types
4180 echo " "
4181 case "$intsize" in
4182 '')
4183         echo "Checking to see how big your integers are..." >&4
4184         $cat >intsize.c <<'EOCP'
4185 #include <stdio.h>
4186 int main()
4187 {
4188         printf("intsize=%d;\n", (int)sizeof(int));
4189         printf("longsize=%d;\n", (int)sizeof(long));
4190         printf("shortsize=%d;\n", (int)sizeof(short));
4191         exit(0);
4192 }
4193 EOCP
4194         set intsize
4195         if eval $compile_ok && ./intsize > /dev/null; then
4196                 eval `./intsize`
4197                 echo "Your integers are $intsize bytes long."
4198                 echo "Your long integers are $longsize bytes long."
4199                 echo "Your short integers are $shortsize bytes long."
4200         else
4201                 $cat >&4 <<EOM
4202 !
4203 Help! I can't compile and run the intsize test program: please enlighten me!
4204 (This is probably a misconfiguration in your system or libraries, and
4205 you really ought to fix it.  Still, I'll try anyway.)
4206 !
4207 EOM
4208                 dflt=4
4209                 rp="What is the size of an integer (in bytes)?"
4210                 . ./myread
4211                 intsize="$ans"
4212                 dflt=$intsize
4213                 rp="What is the size of a long integer (in bytes)?"
4214                 . ./myread
4215                 longsize="$ans"
4216                 dflt=2
4217                 rp="What is the size of a short integer (in bytes)?"
4218                 . ./myread
4219                 shortsize="$ans"
4220         fi
4221         ;;
4222 esac
4223 $rm -f intsize intsize.*
4224
4225 : see what type lseek is declared as in the kernel
4226 rp="What is the type used for lseek's offset on this system?"
4227 set off_t lseektype long stdio.h sys/types.h
4228 eval $typedef_ask
4229
4230 echo " "
4231 echo "Checking to see how big your file offsets are..." >&4
4232 $cat >try.c <<EOCP
4233 #include <sys/types.h>
4234 #include <stdio.h>
4235 int main()
4236 {
4237     printf("%d\n", (int)sizeof($lseektype));
4238     return(0); 
4239 }
4240 EOCP
4241 set try
4242 if eval $compile_ok; then
4243         lseeksize=`./try`
4244         echo "Your file offsets are $lseeksize bytes long."
4245 else
4246         dflt=$longsize
4247         echo " "
4248         echo "(I can't seem to compile the test program.  Guessing...)"
4249         rp="What is the size of your file offsets (in bytes)?"
4250         . ./myread
4251         lseeksize="$ans"
4252 fi
4253 $rm -f try.c try
4254
4255 : see what type file positions are declared as in the library
4256 rp="What is the type for file position used by fsetpos()?"
4257 set fpos_t fpostype long stdio.h sys/types.h
4258 eval $typedef_ask
4259
4260 echo " "
4261 case "$fpostype" in
4262 *_t) zzz="$fpostype"    ;;
4263 *)   zzz="fpos_t"       ;;
4264 esac
4265 echo "Checking the size of $zzz..." >&4 
4266 cat > try.c <<EOCP
4267 #include <sys/types.h>
4268 #include <stdio.h>
4269 int main() {
4270     printf("%d\n", (int)sizeof($fpostype));
4271     exit(0);
4272 }
4273 EOCP
4274 set try
4275 if eval $compile_ok; then
4276         yyy=`./try`
4277         case "$yyy" in
4278         '')     fpossize=4
4279                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4280                 ;;
4281         *)      fpossize=$yyy
4282                 echo "Your $zzz is $fpossize bytes long."
4283                 ;;
4284         esac
4285 else
4286         dflt="$longsize"
4287         echo " " >&4
4288         echo "(I can't compile the test program.  Guessing...)" >&4
4289         rp="What is the size of your file positions (in bytes)?"
4290         . ./myread
4291         fpossize="$ans"
4292 fi
4293
4294
4295
4296 # Backward compatibility (uselfs is deprecated).
4297 case "$uselfs" in
4298 "$define"|true|[yY]*)
4299         cat <<EOM >&4
4300
4301 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4302 EOM
4303         uselargefiles="$define"
4304         ;;
4305 esac                          
4306
4307 case "$lseeksize:$fpossize" in
4308 8:8) cat <<EOM
4309
4310 You can have files larger than 2 gigabytes.
4311 EOM
4312    val="$define" ;;
4313 *)    case "$uselargefiles" in
4314    "$undef"|false|[nN]*) dflt='n' ;;
4315    *)   dflt='y' ;;
4316    esac
4317    cat <<EOM
4318
4319 Perl can be built to understand large files (files larger than 2 gigabytes)
4320 on some systems.  To do so, Configure can be run with -Duselargefiles.
4321
4322 If this doesn't make any sense to you, just accept the default '$dflt'.
4323 EOM
4324    rp='Try to understand large files, if available?'
4325    . ./myread
4326    case "$ans" in
4327    y|Y)         val="$define" ;;
4328    *)           val="$undef"  ;;
4329    esac
4330    ;;
4331 esac
4332 set uselargefiles
4333 eval $setvar
4334 case "$uselargefiles" in
4335 "$define")
4336 : Look for a hint-file generated 'call-back-unit'.  If the
4337 : user has specified that a large files perl is to be built,
4338 : we may need to set or change some other defaults.
4339         if $test -f uselargefiles.cbu; then
4340                 echo "Your platform has some specific hints for large file builds, using them..."
4341                 . ./uselargefiles.cbu
4342                 echo " "
4343                 echo "Rechecking to see how big your file offsets are..." >&4
4344                 $cat >try.c <<EOCP
4345 #include <sys/types.h>
4346 #include <stdio.h>
4347 int main()
4348 {
4349     printf("%d\n", (int)sizeof($lseektype));
4350     return(0); 
4351 }
4352 EOCP
4353                 set try
4354                 if eval $compile_ok; then
4355                         lseeksize=`./try`
4356                         $echo "Your file offsets are now $lseeksize bytes long."
4357                 else
4358                         dflt="$lseeksize"
4359                         echo " "
4360                         echo "(I can't seem to compile the test program.  Guessing...)"
4361                         rp="What is the size of your file offsets (in bytes)?"
4362                         . ./myread
4363                         lseeksize="$ans"
4364                 fi
4365                 case "$fpostype" in
4366                 *_t) zzz="$fpostype"    ;;
4367                 *)   zzz="fpos_t"       ;;
4368                 esac
4369                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4370                 $cat > try.c <<EOCP
4371 #include <sys/types.h>
4372 #include <stdio.h>
4373 int main() {
4374     printf("%d\n", (int)sizeof($fpostype));
4375     exit(0);
4376 }
4377 EOCP
4378                 set try
4379                 if eval $compile_ok; then
4380                         yyy=`./try`
4381                         dflt="$lseeksize"
4382                         case "$yyy" in
4383                         '')     echo " "
4384                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4385                                 ;;
4386                         *)      fpossize=$yyy
4387                                 echo " $fpossize bytes." >&4
4388                                 ;;
4389                         esac
4390                 else
4391                         dflt="$fpossize"
4392                         echo " "
4393                         echo "(I can't compile the test program.  Guessing...)" >&4
4394                         rp="What is the size of your file positions (in bytes)?"
4395                         . ./myread
4396                         fpossize="$ans"
4397                 fi
4398                 $rm -f try.c try
4399         fi
4400         ;;
4401 esac
4402
4403
4404 case "$usemorebits" in
4405 "$define"|true|[yY]*)
4406         use64bitint="$define"
4407         uselongdouble="$define"
4408         usemorebits="$define"
4409         ;;
4410 *)      usemorebits="$undef"
4411         ;;
4412 esac
4413
4414
4415 case "$uselonglong" in
4416 "$define"|true|[yY]*)
4417         cat <<EOM >&4
4418
4419 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4420 EOM
4421         use64bitint="$define"
4422         ;;
4423 esac                          
4424 case "$use64bits" in
4425 "$define"|true|[yY]*)
4426         cat <<EOM >&4
4427
4428 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4429 EOM
4430         use64bitint="$define"
4431         ;;
4432 esac                          
4433 case "$use64bitints" in
4434 "$define"|true|[yY]*)
4435         cat <<EOM >&4
4436
4437 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4438 EOM
4439         use64bitint="$define"
4440         ;;
4441 esac                          
4442 case "$use64bitsint" in
4443 "$define"|true|[yY]*)
4444         cat <<EOM >&4
4445
4446 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4447 EOM
4448         use64bitint="$define"
4449         ;;
4450 esac                          
4451 case "$uselonglongs" in
4452 "$define"|true|[yY]*)
4453         cat <<EOM >&4
4454
4455 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4456 EOM
4457         use64bitint="$define"
4458         ;;
4459 esac                          
4460 case "$use64bitsall" in
4461 "$define"|true|[yY]*)
4462         cat <<EOM >&4
4463
4464 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4465 EOM
4466         use64bitall="$define"
4467         ;;
4468 esac                          
4469
4470 case "$ccflags" in
4471 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4472 esac
4473 case "$use64bitall" in
4474 "$define"|true|[yY]*) use64bitint="$define" ;;
4475 esac
4476
4477 case "$longsize" in
4478 8) cat <<EOM
4479
4480 You have natively 64-bit long integers.
4481 EOM
4482    val="$define"
4483    ;;
4484 *) case "$use64bitint" in
4485    "$define"|true|[yY]*) dflt='y';;
4486    *) dflt='n';;
4487    esac
4488    cat <<EOM
4489
4490 Perl can be built to take advantage of 64-bit integer types
4491 on some systems.  To do so, Configure can be run with -Duse64bitint.
4492 Choosing this option will most probably introduce binary incompatibilities.
4493
4494 If this doesn't make any sense to you, just accept the default '$dflt'.
4495 EOM
4496    rp='Try to use 64-bit integers, if available?'
4497    . ./myread
4498    case "$ans" in
4499    [yY]*) val="$define" ;;
4500    *)     val="$undef"  ;;
4501    esac
4502    ;;
4503 esac
4504 set use64bitint
4505 eval $setvar
4506
4507 case "$use64bitall" in
4508 "$define"|true|[yY]*) dflt='y' ;;
4509 *) case "$longsize" in
4510    8) dflt='y' ;;
4511    *) dflt='n' ;;
4512    esac
4513    ;;
4514 esac    
4515 cat <<EOM
4516
4517 You may also choose to try maximal 64-bitness.  It means using as much
4518 64-bitness as possible on the platform.  This in turn means even more
4519 binary incompatibilities.  On the other hand, your platform may not
4520 have any more 64-bitness available than what you already have chosen.
4521
4522 If this doesn't make any sense to you, just accept the default '$dflt'.
4523 EOM
4524 rp='Try to use maximal 64-bit support, if available?'
4525 . ./myread
4526 case "$ans" in
4527 [yY]*) val="$define" ;;
4528 *)     val="$undef"  ;;
4529 esac
4530 set use64bitall
4531 eval $setvar
4532 case "$use64bitall" in
4533 "$define")
4534         case "$use64bitint" in
4535         "$undef")
4536                 cat <<EOM
4537
4538 Since you have chosen a maximally 64-bit build, I'm also turning on
4539 the use of 64-bit integers.
4540 EOM
4541                 use64bitint="$define" ;;
4542         esac
4543         ;;
4544 esac
4545
4546 case "$use64bitint" in
4547 "$define"|true|[yY]*)
4548 : Look for a hint-file generated 'call-back-unit'.  If the
4549 : user has specified that a 64-bit perl is to be built,
4550 : we may need to set or change some other defaults.
4551         if $test -f use64bitint.cbu; then
4552                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4553                 . ./use64bitint.cbu
4554         fi
4555         case "$longsize" in
4556         4) case "$archname64" in
4557            '') archname64=64int ;;
4558            esac
4559            ;;
4560         esac
4561         ;;
4562 esac
4563
4564 case "$use64bitall" in
4565 "$define"|true|[yY]*)
4566 : Look for a hint-file generated 'call-back-unit'.  If the
4567 : user has specified that a maximally 64-bit perl is to be built,
4568 : we may need to set or change some other defaults.
4569         if $test -f use64bitall.cbu; then
4570                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4571                 . ./use64bitall.cbu
4572         fi
4573         case "$longsize" in
4574         4) case "$archname64" in
4575            ''|64int) archname64=64all ;;
4576            esac
4577            ;;
4578         esac
4579         ;;
4580 esac
4581
4582 echo " "
4583 echo "Checking for GNU C Library..." >&4
4584 cat >gnulibc.c <<EOM
4585 #include <stdio.h>
4586 int main()
4587 {
4588 #ifdef __GLIBC__
4589     exit(0);
4590 #else
4591     exit(1);
4592 #endif
4593 }
4594 EOM
4595 set gnulibc
4596 if eval $compile_ok && ./gnulibc; then
4597         val="$define"
4598         echo "You are using the GNU C Library"
4599 else
4600         val="$undef"
4601         echo "You are not using the GNU C Library"
4602 fi
4603 $rm -f gnulibc*
4604 set d_gnulibc
4605 eval $setvar
4606
4607 : see if nm is to be used to determine whether a symbol is defined or not
4608 case "$usenm" in
4609 '')
4610         dflt=''
4611         case "$d_gnulibc" in
4612         "$define")
4613                 echo " "
4614                 echo "nm probably won't work on the GNU C Library." >&4
4615                 dflt=n
4616                 ;;
4617         esac
4618         case "$dflt" in
4619         '') 
4620                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4621                         echo " "
4622                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4623                         echo "'nm' won't be sufficient on this sytem." >&4
4624                         dflt=n
4625                 fi
4626                 ;;
4627         esac
4628         case "$dflt" in
4629         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4630                 if $test $dflt -gt 20; then
4631                         dflt=y
4632                 else
4633                         dflt=n
4634                 fi
4635                 ;;
4636         esac
4637         ;;
4638 *)
4639         case "$usenm" in
4640         true|$define) dflt=y;;
4641         *) dflt=n;;
4642         esac
4643         ;;
4644 esac
4645 $cat <<EOM
4646
4647 I can use $nm to extract the symbols from your C libraries. This
4648 is a time consuming task which may generate huge output on the disk (up
4649 to 3 megabytes) but that should make the symbols extraction faster. The
4650 alternative is to skip the 'nm' extraction part and to compile a small
4651 test program instead to determine whether each symbol is present. If
4652 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4653 this may be the best solution.
4654
4655 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4656
4657 EOM
4658 rp="Shall I use $nm to extract C symbols from the libraries?"
4659 . ./myread
4660 case "$ans" in
4661 [Nn]*) usenm=false;;
4662 *) usenm=true;;
4663 esac
4664
4665 runnm=$usenm
4666 case "$reuseval" in
4667 true) runnm=false;;
4668 esac
4669
4670 : nm options which may be necessary
4671 case "$nm_opt" in
4672 '') if $test -f /mach_boot; then
4673                 nm_opt=''       # Mach
4674         elif $test -d /usr/ccs/lib; then
4675                 nm_opt='-p'     # Solaris (and SunOS?)
4676         elif $test -f /dgux; then
4677                 nm_opt='-p'     # DG-UX
4678         elif $test -f /lib64/rld; then
4679                 nm_opt='-p'     # 64-bit Irix
4680         else
4681                 nm_opt=''
4682         fi;;
4683 esac
4684
4685 : nm options which may be necessary for shared libraries but illegal
4686 : for archive libraries.  Thank you, Linux.
4687 case "$nm_so_opt" in
4688 '')     case "$myuname" in
4689         *linux*)
4690                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4691                         nm_so_opt='--dynamic'
4692                 fi
4693                 ;;
4694         esac
4695         ;;
4696 esac
4697
4698 case "$runnm" in
4699 true)
4700 : get list of predefined functions in a handy place
4701 echo " "
4702 case "$libc" in
4703 '') libc=unknown
4704         case "$libs" in
4705         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4706         esac
4707         ;;
4708 esac
4709 libnames='';
4710 case "$libs" in
4711 '') ;;
4712 *)  for thislib in $libs; do
4713         case "$thislib" in
4714         -lc|-lc_s)
4715                 : Handle C library specially below.
4716                 ;;
4717         -l*)
4718                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4719                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4720                         :
4721                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4722                         :
4723                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4724                         :
4725                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4726                         :
4727                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4728                         :
4729                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4730                         :
4731                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4732                         :
4733                 else
4734                         try=''
4735                 fi
4736                 libnames="$libnames $try"
4737                 ;;
4738         *) libnames="$libnames $thislib" ;;
4739         esac
4740         done
4741         ;;
4742 esac
4743 xxx=normal
4744 case "$libc" in
4745 unknown)
4746         set /lib/libc.$so
4747         for xxx in $libpth; do
4748                 $test -r $1 || set $xxx/libc.$so
4749                 : The messy sed command sorts on library version numbers.
4750                 $test -r $1 || \
4751                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4752                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4753                                 h
4754                                 s/[0-9][0-9]*/0000&/g
4755                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4756                                 G
4757                                 s/\n/ /' | \
4758                          $sort | $sed -e 's/^.* //'`
4759                 eval set \$$#
4760         done
4761         $test -r $1 || set /usr/ccs/lib/libc.$so
4762         $test -r $1 || set /lib/libsys_s$_a
4763         ;;
4764 *)
4765         set blurfl
4766         ;;
4767 esac
4768 if $test -r "$1"; then
4769         echo "Your (shared) C library seems to be in $1."
4770         libc="$1"
4771 elif $test -r /lib/libc && $test -r /lib/clib; then
4772         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4773         xxx=apollo
4774         libc='/lib/clib /lib/libc'
4775         if $test -r /lib/syslib; then
4776                 echo "(Your math library is in /lib/syslib.)"
4777                 libc="$libc /lib/syslib"
4778         fi
4779 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4780         echo "Your C library seems to be in $libc, as you said before."
4781 elif $test -r $incpath/usr/lib/libc$_a; then
4782         libc=$incpath/usr/lib/libc$_a;
4783         echo "Your C library seems to be in $libc.  That's fine."
4784 elif $test -r /lib/libc$_a; then
4785         libc=/lib/libc$_a;
4786         echo "Your C library seems to be in $libc.  You're normal."
4787 else
4788         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4789                 :
4790         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4791                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4792         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4793                 :
4794         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4795                 :
4796         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4797                 :
4798         else
4799                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4800         fi
4801         if $test -r "$tans"; then
4802                 echo "Your C library seems to be in $tans, of all places."
4803                 libc=$tans
4804         else
4805                 libc='blurfl'
4806         fi
4807 fi
4808 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4809         dflt="$libc"
4810         cat <<EOM
4811
4812 If the guess above is wrong (which it might be if you're using a strange
4813 compiler, or your machine supports multiple models), you can override it here.
4814
4815 EOM
4816 else
4817         dflt=''
4818         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4819         cat >&4 <<EOM
4820 I can't seem to find your C library.  I've looked in the following places:
4821
4822 EOM
4823         $sed 's/^/      /' libpath
4824         cat <<EOM
4825
4826 None of these seems to contain your C library. I need to get its name...
4827
4828 EOM
4829 fi
4830 fn=f
4831 rp='Where is your C library?'
4832 . ./getfile
4833 libc="$ans"
4834
4835 echo " "
4836 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4837 set X `cat libnames`
4838 shift
4839 xxx=files
4840 case $# in 1) xxx=file; esac
4841 echo "Extracting names from the following $xxx for later perusal:" >&4
4842 echo " "
4843 $sed 's/^/      /' libnames >&4
4844 echo " "
4845 $echo $n "This may take a while...$c" >&4
4846
4847 for file in $*; do
4848         case $file in
4849         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4850         *) $nm $nm_opt $file 2>/dev/null;;
4851         esac
4852 done >libc.tmp
4853
4854 $echo $n ".$c"
4855 $grep fprintf libc.tmp > libc.ptf
4856 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4857 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4858 xxx='[ADTSIW]'
4859 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4860         eval $xscan;\
4861         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4862                 eval $xrun
4863 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4864         eval $xscan;\
4865         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4866                 eval $xrun
4867 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4868         eval $xscan;\
4869         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4870                 eval $xrun
4871 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4872         eval $xscan;\
4873         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4874                 eval $xrun
4875 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4876         eval $xscan;\
4877         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4878                 eval $xrun
4879 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4880         eval $xscan;\
4881         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4882                 eval $xrun
4883 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4884                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4885         eval $xscan;\
4886         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4887                 eval $xrun
4888 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4889         eval $xscan;\
4890         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4891                 eval $xrun
4892 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4893         eval $xscan;\
4894         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4895                 eval $xrun
4896 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4897         eval $xscan;\
4898         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4899                 eval $xrun
4900 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4901         eval $xscan;\
4902         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4903                 eval $xrun
4904 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4905         eval $xscan;\
4906         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4907                 eval $xrun
4908 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4909         eval $xscan;\
4910         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4911                 eval $xrun
4912 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4913         eval $xscan;\
4914         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4915                 eval $xrun
4916 else
4917         $nm -p $* 2>/dev/null >libc.tmp
4918         $grep fprintf libc.tmp > libc.ptf
4919         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4920                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4921         then
4922                 nm_opt='-p'
4923                 eval $xrun
4924         else
4925                 echo " "
4926                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4927                 com=''
4928                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4929                         for thisname in $libnames $libc; do
4930                                 $ar t $thisname >>libc.tmp
4931                         done
4932                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4933                         echo "Ok." >&4
4934                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4935                         # Repeat libc to extract forwarders to DLL entries too
4936                         for thisname in $libnames $libc; do
4937                                 $ar tv $thisname >>libc.tmp
4938                                 # Revision 50 of EMX has bug in $ar.
4939                                 # it will not extract forwarders to DLL entries
4940                                 # Use emximp which will extract exactly them.
4941                                 emximp -o tmp.imp $thisname \
4942                                     2>/dev/null && \
4943                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4944                                     < tmp.imp >>libc.tmp
4945                                 $rm tmp.imp
4946                         done
4947                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4948                         echo "Ok." >&4
4949                 else
4950                         echo "$ar didn't seem to work right." >&4
4951                         echo "Maybe this is a Cray...trying bld instead..." >&4
4952                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4953                         then
4954                                 for thisname in $libnames; do
4955                                         bld t $libnames | \
4956                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4957                                         $ar t $thisname >>libc.tmp
4958                                 done
4959                                 echo "Ok." >&4
4960                         else
4961                                 echo "That didn't work either.  Giving up." >&4
4962                                 exit 1
4963                         fi
4964                 fi
4965         fi
4966 fi
4967 nm_extract="$com"
4968 if $test -f /lib/syscalls.exp; then
4969         echo " "
4970         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4971         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4972 fi
4973 ;;
4974 esac
4975 $rm -f libnames libpath
4976
4977 : is a C symbol defined?
4978 csym='tlook=$1;
4979 case "$3" in
4980 -v) tf=libc.tmp; tc=""; tdc="";;
4981 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4982 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4983 esac;
4984 tx=yes;
4985 case "$reuseval-$4" in
4986 true-) ;;
4987 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4988 esac;
4989 case "$tx" in
4990 yes)
4991         case "$runnm" in
4992         true)
4993                 if $contains $tlook $tf >/dev/null 2>&1;
4994                 then tval=true;
4995                 else tval=false;
4996                 fi;;
4997         *)
4998                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4999                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5000                 then tval=true;
5001                 else tval=false;
5002                 fi;
5003                 $rm -f t t.c;;
5004         esac;;
5005 *)
5006         case "$tval" in
5007         $define) tval=true;;
5008         *) tval=false;;
5009         esac;;
5010 esac;
5011 eval "$2=$tval"'
5012
5013 : define an is-in-libc? function
5014 inlibc='echo " "; td=$define; tu=$undef;
5015 sym=$1; var=$2; eval "was=\$$2";
5016 tx=yes;
5017 case "$reuseval$was" in
5018 true) ;;
5019 true*) tx=no;;
5020 esac;
5021 case "$tx" in
5022 yes)
5023         set $sym tres -f;
5024         eval $csym;
5025         case "$tres" in
5026         true)
5027                 echo "$sym() found." >&4;
5028                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5029         *)
5030                 echo "$sym() NOT found." >&4;
5031                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5032         esac;;
5033 *)
5034         case "$was" in
5035         $define) echo "$sym() found." >&4;;
5036         *) echo "$sym() NOT found." >&4;;
5037         esac;;
5038 esac'
5039
5040 : see if sqrtl exists
5041 set sqrtl d_sqrtl
5042 eval $inlibc
5043
5044 case "$ccflags" in
5045 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5046 esac
5047
5048 case "$uselongdouble" in
5049 $define|true|[yY]*)     dflt='y';;
5050 *) dflt='n';;
5051 esac
5052 cat <<EOM
5053
5054 Perl can be built to take advantage of long doubles which
5055 (if available) may give more accuracy and range for floating point numbers.
5056
5057 If this doesn't make any sense to you, just accept the default '$dflt'.
5058 EOM
5059 rp='Try to use long doubles if available?'
5060 . ./myread
5061 case "$ans" in
5062 y|Y)    val="$define"   ;;
5063 *)      val="$undef"    ;;
5064 esac
5065 set uselongdouble
5066 eval $setvar
5067
5068 case "$uselongdouble" in
5069 true|[yY]*) uselongdouble="$define" ;;
5070 esac
5071
5072 case "$uselongdouble" in
5073 $define)
5074 : Look for a hint-file generated 'call-back-unit'.  If the
5075 : user has specified that long doubles should be used,
5076 : we may need to set or change some other defaults.
5077         if $test -f uselongdouble.cbu; then
5078                 echo "Your platform has some specific hints for long doubles, using them..."
5079                 . ./uselongdouble.cbu
5080         else
5081                 $cat <<EOM
5082 (Your platform doesn't have any specific hints for long doubles.)
5083 EOM
5084         fi
5085         ;;
5086 esac
5087
5088 case "$uselongdouble:$d_sqrtl" in
5089 $define:$undef)
5090                 $cat <<EOM >&4
5091
5092 *** You requested the use of long doubles but you do not seem to have
5093 *** the mathematic functions for long doubles.  I'm disabling the use
5094 *** of long doubles.
5095
5096 EOM
5097         uselongdouble=$undef
5098         ;;
5099 esac
5100
5101 : check for length of double
5102 echo " "
5103 case "$doublesize" in
5104 '')
5105         echo "Checking to see how big your double precision numbers are..." >&4
5106         $cat >try.c <<'EOCP'
5107 #include <stdio.h>
5108 int main()
5109 {
5110     printf("%d\n", (int)sizeof(double));
5111     exit(0);
5112 }
5113 EOCP
5114         set try
5115         if eval $compile_ok; then
5116                 doublesize=`./try`
5117                 echo "Your double is $doublesize bytes long."
5118         else
5119                 dflt='8'
5120                 echo "(I can't seem to compile the test program.  Guessing...)"
5121                 rp="What is the size of a double precision number (in bytes)?"
5122                 . ./myread
5123                 doublesize="$ans"
5124         fi
5125         ;;
5126 esac
5127 $rm -f try.c try
5128
5129 : check for long doubles
5130 echo " "
5131 echo "Checking to see if you have long double..." >&4
5132 echo 'int main() { long double x = 7.0; }' > try.c
5133 set try
5134 if eval $compile; then
5135         val="$define"
5136         echo "You have long double."
5137 else
5138         val="$undef"
5139         echo "You do not have long double."
5140 fi
5141 $rm try.*
5142 set d_longdbl
5143 eval $setvar
5144
5145 : check for length of long double
5146 case "${d_longdbl}${longdblsize}" in
5147 $define)
5148         echo " "
5149         echo "Checking to see how big your long doubles are..." >&4
5150         $cat >try.c <<'EOCP'
5151 #include <stdio.h>
5152 int main()
5153 {
5154         printf("%d\n", sizeof(long double));
5155 }
5156 EOCP
5157         set try
5158         set try
5159         if eval $compile; then
5160                 longdblsize=`./try$exe_ext`
5161                 echo "Your long doubles are $longdblsize bytes long."
5162         else
5163                 dflt='8'
5164                 echo " "
5165                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5166                 rp="What is the size of a long double (in bytes)?"
5167                 . ./myread
5168                 longdblsize="$ans"
5169         fi
5170         if $test "X$doublesize" = "X$longdblsize"; then
5171                 echo "(That isn't any different from an ordinary double.)"
5172         fi      
5173         ;;
5174 esac
5175 $rm -f try.* try
5176
5177 : determine the architecture name
5178 echo " "
5179 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5180         tarch=`arch`"-$osname"
5181 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5182         if uname -m > tmparch 2>&1 ; then
5183                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5184                         -e 's/$/'"-$osname/" tmparch`
5185         else
5186                 tarch="$osname"
5187         fi
5188         $rm -f tmparch
5189 else
5190         tarch="$osname"
5191 fi
5192 case "$myarchname" in
5193 ''|"$tarch") ;;
5194 *)
5195         echo "(Your architecture name used to be $myarchname.)"
5196         archname=''
5197         ;;
5198 esac
5199 myarchname="$tarch"
5200 case "$archname" in
5201 '') dflt="$tarch";;
5202 *) dflt="$archname";;
5203 esac
5204 rp='What is your architecture name'
5205 . ./myread
5206 archname="$ans"
5207 case "$usethreads" in
5208 $define)
5209         echo "Threads selected." >&4
5210         case "$archname" in
5211         *-thread*) echo "...and architecture name already has -thread." >&4
5212                 ;;
5213         *)      archname="$archname-thread"
5214                 echo "...setting architecture name to $archname." >&4
5215                 ;;
5216         esac
5217         ;;
5218 esac
5219 case "$usemultiplicity" in
5220 $define)
5221         echo "Multiplicity selected." >&4
5222         case "$archname" in
5223         *-multi*) echo "...and architecture name already has -multi." >&4
5224                 ;;
5225         *)      archname="$archname-multi"
5226                 echo "...setting architecture name to $archname." >&4
5227                 ;;
5228         esac
5229         ;;
5230 esac
5231 case "$use64bitint$use64bitall" in
5232 *"$define"*)
5233         case "$archname64" in
5234         '')
5235                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5236                 ;;
5237         *)
5238                 case "$use64bitint" in
5239                 "$define") echo "64 bit integers selected." >&4 ;;
5240                 esac
5241                 case "$use64bitall" in
5242                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5243                 esac
5244                 case "$archname" in
5245                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5246                         ;;
5247                 *)      archname="$archname-$archname64"
5248                         echo "...setting architecture name to $archname." >&4
5249                         ;;
5250                 esac
5251                 ;;
5252         esac
5253 esac
5254 case "$uselongdouble" in
5255 $define)
5256         echo "Long doubles selected." >&4
5257         case "$longdblsize" in
5258         $doublesize)
5259                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5260                 ;;
5261         *)
5262                 case "$archname" in
5263                 *-ld*) echo "...and architecture name already has -ld." >&4
5264                         ;;
5265                 *)      archname="$archname-ld"
5266                         echo "...setting architecture name to $archname." >&4
5267                         ;;
5268                 esac
5269                 ;;
5270         esac
5271         ;;
5272 esac
5273
5274 : determine root of directory hierarchy where package will be installed.
5275 case "$prefix" in
5276 '')
5277         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5278         ;;
5279 *)
5280         dflt="$prefix"
5281         ;;
5282 esac
5283 $cat <<EOM
5284
5285 By default, $package will be installed in $dflt/bin, manual pages
5286 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5287 installation directories. Typically this is something like /usr/local.
5288 If you wish to have binaries under /usr/bin but other parts of the
5289 installation under /usr/local, that's ok: you will be prompted
5290 separately for each of the installation directories, the prefix being
5291 only used to set the defaults.
5292
5293 EOM
5294 fn=d~
5295 rp='Installation prefix to use?'
5296 . ./getfile
5297 oldprefix=''
5298 case "$prefix" in
5299 '') ;;
5300 *)
5301         case "$ans" in
5302         "$prefix") ;;
5303         *) oldprefix="$prefix";;
5304         esac
5305         ;;
5306 esac
5307 prefix="$ans"
5308 prefixexp="$ansexp"
5309
5310 : is AFS running?
5311 echo " "
5312 case "$afs" in
5313 $define|true)   afs=true ;;
5314 $undef|false)   afs=false ;;
5315 *)      if test -d /afs; then
5316                 afs=true
5317         else
5318                 afs=false
5319         fi
5320         ;;
5321 esac
5322 if $afs; then
5323         echo "AFS may be running... I'll be extra cautious then..." >&4
5324 else
5325         echo "AFS does not seem to be running..." >&4
5326 fi
5327
5328 : determine installation prefix for where package is to be installed.
5329 if $afs; then 
5330 $cat <<EOM
5331
5332 Since you are running AFS, I need to distinguish the directory in which
5333 files will reside from the directory in which they are installed (and from
5334 which they are presumably copied to the former directory by occult means).
5335
5336 EOM
5337         case "$installprefix" in
5338         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5339         *) dflt="$installprefix";;
5340         esac
5341 else
5342 $cat <<EOM
5343
5344 In some special cases, particularly when building $package for distribution,
5345 it is convenient to distinguish between the directory in which files should 
5346 be installed from the directory ($prefix) in which they 
5347 will eventually reside.  For most users, these two directories are the same.
5348
5349 EOM
5350         case "$installprefix" in
5351         '') dflt=$prefix ;;
5352         *) dflt=$installprefix;;
5353         esac
5354 fi
5355 fn=d~
5356 rp='What installation prefix should I use for installing files?'
5357 . ./getfile
5358 installprefix="$ans"
5359 installprefixexp="$ansexp"
5360
5361 : set the prefixit variable, to compute a suitable default value
5362 prefixit='case "$3" in
5363 ""|none)
5364         case "$oldprefix" in
5365         "") eval "$1=\"\$$2\"";;
5366         *)
5367                 case "$3" in
5368                 "") eval "$1=";;
5369                 none)
5370                         eval "tp=\"\$$2\"";
5371                         case "$tp" in
5372                         ""|" ") eval "$1=\"\$$2\"";;
5373                         *) eval "$1=";;
5374                         esac;;
5375                 esac;;
5376         esac;;
5377 *)
5378         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5379         case "$tp" in
5380         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5381         /*-$oldprefix/*|\~*-$oldprefix/*)
5382                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5383         *) eval "$1=\"\$$2\"";;
5384         esac;;
5385 esac'
5386
5387
5388 : get the patchlevel
5389 echo " "
5390 echo "Getting the current patchlevel..." >&4
5391 if $test -r $rsrc/patchlevel.h;then
5392         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5393         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5394         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5395         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5396         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5397         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5398 else
5399         revision=0
5400         patchlevel=0
5401         subversion=0
5402         api_revision=0
5403         api_version=0
5404         api_subversion=0
5405 fi
5406 $echo "(You have $package version $patchlevel subversion $subversion.)"
5407 case "$osname" in
5408 dos|vms)
5409         : XXX Should be a Configure test for double-dots in filenames.
5410         version=`echo $revision $patchlevel $subversion | \
5411                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5412         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5413                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5414         ;;
5415 *)
5416         version=`echo $revision $patchlevel $subversion | \
5417                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5418         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5419                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5420         ;;
5421 esac
5422 : Special case the 5.005_xx maintenance series, which used 5.005
5423 : without any subversion label as a subdirectory in $sitelib
5424 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5425         api_versionstring='5.005'
5426 fi
5427
5428 : determine installation style
5429 : For now, try to deduce it from prefix unless it is already set.
5430 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5431 case "$installstyle" in
5432 '')     case "$prefix" in
5433                 *perl*) dflt='lib';;
5434                 *) dflt='lib/perl5' ;;
5435         esac
5436         ;;
5437 *)      dflt="$installstyle" ;;
5438 esac
5439 : Probably not worth prompting for this since we prompt for all
5440 : the directories individually, and the prompt would be too long and
5441 : confusing anyway.
5442 installstyle=$dflt
5443
5444 : determine where private library files go
5445 : Usual default is /usr/local/lib/perl5/$version.
5446 : Also allow things like /opt/perl/lib/$version, since 
5447 : /opt/perl/lib/perl5... would be redundant.
5448 : The default "style" setting is made in installstyle.U
5449 case "$installstyle" in
5450 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5451 *)       set dflt privlib lib/$version ;;
5452 esac
5453 eval $prefixit
5454 $cat <<EOM
5455
5456 There are some auxiliary files for $package that need to be put into a
5457 private library directory that is accessible by everyone.
5458
5459 EOM
5460 fn=d~+
5461 rp='Pathname where the private library files will reside?'
5462 . ./getfile
5463 privlib="$ans"
5464 privlibexp="$ansexp"
5465 : Change installation prefix, if necessary.
5466 if $test X"$prefix" != X"$installprefix"; then
5467         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5468 else
5469         installprivlib="$privlibexp"
5470 fi
5471
5472 : set the prefixup variable, to restore leading tilda escape
5473 prefixup='case "$prefixexp" in
5474 "$prefix") ;;
5475 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5476 esac'
5477
5478 : determine where public architecture dependent libraries go
5479 set archlib archlib
5480 eval $prefixit
5481 : privlib default is /usr/local/lib/$package/$version
5482 : archlib default is /usr/local/lib/$package/$version/$archname
5483 : privlib may have an optional trailing /share.
5484 tdflt=`echo $privlib | $sed 's,/share$,,'`
5485 tdflt=$tdflt/$archname
5486 case "$archlib" in
5487 '')     dflt=$tdflt
5488         ;;
5489 *)      dflt="$archlib"
5490     ;;
5491 esac
5492 $cat <<EOM
5493
5494 $spackage contains architecture-dependent library files.  If you are
5495 sharing libraries in a heterogeneous environment, you might store
5496 these files in a separate location.  Otherwise, you can just include
5497 them with the rest of the public library files.
5498
5499 EOM
5500 fn=d+~
5501 rp='Where do you want to put the public architecture-dependent libraries?'
5502 . ./getfile
5503 archlib="$ans"
5504 archlibexp="$ansexp"
5505 if $test X"$archlib" = X"$privlib"; then
5506         d_archlib="$undef"
5507 else
5508         d_archlib="$define"
5509 fi
5510 : Change installation prefix, if necessary.
5511 if $test X"$prefix" != X"$installprefix"; then
5512         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5513 else
5514         installarchlib="$archlibexp"
5515 fi
5516
5517
5518 : Binary compatibility with 5.005 is not possible for builds
5519 : with advanced features
5520 case "$usethreads$usemultiplicity" in
5521 *define*)
5522         bincompat5005="$undef"
5523         d_bincompat5005="$undef"
5524         ;;
5525 *)      $cat <<EOM
5526
5527 This version of Perl can be compiled for binary compatibility with 5.005.
5528 If you decide to do so, you will be able to continue using most of the
5529 extensions that were compiled for Perl 5.005.
5530
5531 EOM
5532         case "$bincompat5005$d_bincompat5005" in
5533         *"$undef"*) dflt=n ;;
5534         *) dflt=y ;;
5535         esac
5536         rp='Binary compatibility with Perl 5.005?'
5537         . ./myread
5538         case "$ans" in
5539         y*) val="$define" ;;
5540         *)  val="$undef" ;;
5541         esac
5542         set d_bincompat5005
5543         eval $setvar
5544         case "$d_bincompat5005" in
5545         "$define")
5546                 bincompat5005="$define"
5547                 ;;
5548         *)      bincompat5005="$undef"
5549                 d_bincompat5005="$undef"
5550                 ;;
5551         esac
5552         ;;
5553 esac
5554
5555
5556 : see if setuid scripts can be secure
5557 $cat <<EOM
5558
5559 Some kernels have a bug that prevents setuid #! scripts from being
5560 secure.  Some sites have disabled setuid #! scripts because of this.
5561
5562 First let's decide if your kernel supports secure setuid #! scripts.
5563 (If setuid #! scripts would be secure but have been disabled anyway,
5564 don't say that they are secure if asked.)
5565
5566 EOM
5567
5568 val="$undef"
5569 if $test -d /dev/fd; then
5570         echo "#!$ls" >reflect
5571         chmod +x,u+s reflect
5572         ./reflect >flect 2>&1
5573         if $contains "/dev/fd" flect >/dev/null; then
5574                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5575                 val="$define"
5576         else
5577                 $cat <<EOM
5578 If you are not sure if they are secure, I can check but I'll need a
5579 username and password different from the one you are using right now.
5580 If you don't have such a username or don't want me to test, simply
5581 enter 'none'.
5582
5583 EOM
5584                 rp='Other username to test security of setuid scripts with?'
5585                 dflt='none'
5586                 . ./myread
5587                 case "$ans" in
5588                 n|none)
5589                         case "$d_suidsafe" in
5590                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5591                                 dflt=n;;
5592                         "$undef")
5593                                 echo "Well, the $hint value is *not* secure." >&4
5594                                 dflt=n;;
5595                         *)      echo "Well, the $hint value *is* secure." >&4
5596                                 dflt=y;;
5597                         esac
5598                         ;;
5599                 *)
5600                         $rm -f reflect flect
5601                         echo "#!$ls" >reflect
5602                         chmod +x,u+s reflect
5603                         echo >flect
5604                         chmod a+w flect
5605                         echo '"su" will (probably) prompt you for '"$ans's password."
5606                         su $ans -c './reflect >flect'
5607                         if $contains "/dev/fd" flect >/dev/null; then
5608                                 echo "Okay, it looks like setuid scripts are secure." >&4
5609                                 dflt=y
5610                         else
5611                                 echo "I don't think setuid scripts are secure." >&4
5612                                 dflt=n
5613                         fi
5614                         ;;
5615                 esac
5616                 rp='Does your kernel have *secure* setuid scripts?'
5617                 . ./myread
5618                 case "$ans" in
5619                 [yY]*)  val="$define";;
5620                 *)      val="$undef";;
5621                 esac
5622         fi
5623 else
5624         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5625         echo "(That's for file descriptors, not floppy disks.)"
5626         val="$undef"
5627 fi
5628 set d_suidsafe
5629 eval $setvar
5630
5631 $rm -f reflect flect
5632
5633 : now see if they want to do setuid emulation
5634 echo " "
5635 val="$undef"
5636 case "$d_suidsafe" in
5637 "$define")
5638         val="$undef"
5639         echo "No need to emulate SUID scripts since they are secure here." >& 4
5640         ;;
5641 *)
5642         $cat <<EOM
5643 Some systems have disabled setuid scripts, especially systems where
5644 setuid scripts cannot be secure.  On systems where setuid scripts have
5645 been disabled, the setuid/setgid bits on scripts are currently
5646 useless.  It is possible for $package to detect those bits and emulate
5647 setuid/setgid in a secure fashion.  This emulation will only work if
5648 setuid scripts have been disabled in your kernel.
5649
5650 EOM
5651         case "$d_dosuid" in
5652         "$define") dflt=y ;;
5653         *) dflt=n ;;
5654         esac
5655         rp="Do you want to do setuid/setgid emulation?"
5656         . ./myread
5657         case "$ans" in
5658         [yY]*)  val="$define";;
5659         *)      val="$undef";;
5660         esac
5661         ;;
5662 esac
5663 set d_dosuid
5664 eval $setvar
5665
5666 : determine filename position in cpp output
5667 echo " "
5668 echo "Computing filename position in cpp output for #include directives..." >&4
5669 echo '#include <stdio.h>' > foo.c
5670 $cat >fieldn <<EOF
5671 $startsh
5672 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5673 $grep '^[       ]*#.*stdio\.h' | \
5674 while read cline; do
5675         pos=1
5676         set \$cline
5677         while $test \$# -gt 0; do
5678                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5679                         echo "\$pos"
5680                         exit 0
5681                 fi
5682                 shift
5683                 pos=\`expr \$pos + 1\`
5684         done
5685 done
5686 EOF
5687 chmod +x fieldn
5688 fieldn=`./fieldn`
5689 $rm -f foo.c fieldn
5690 case $fieldn in
5691 '') pos='???';;
5692 1) pos=first;;
5693 2) pos=second;;
5694 3) pos=third;;
5695 *) pos="${fieldn}th";;
5696 esac
5697 echo "Your cpp writes the filename in the $pos field of the line."
5698
5699 : locate header file
5700 $cat >findhdr <<EOF
5701 $startsh
5702 wanted=\$1
5703 name=''
5704 for usrincdir in $usrinc
5705 do
5706         if test -f \$usrincdir/\$wanted; then
5707                 echo "\$usrincdir/\$wanted"
5708                 exit 0
5709         fi
5710 done
5711 awkprg='{ print \$$fieldn }'
5712 echo "#include <\$wanted>" > foo\$\$.c
5713 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5714 $grep "^[       ]*#.*\$wanted" | \
5715 while read cline; do
5716         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5717         case "\$name" in
5718         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5719         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5720         *) exit 2;;
5721         esac;
5722 done;
5723 #
5724 # status = 0: grep returned 0 lines, case statement not executed
5725 # status = 1: headerfile found
5726 # status = 2: while loop executed, no headerfile found
5727 #
5728 status=\$?
5729 $rm -f foo\$\$.c;
5730 if test \$status -eq 1; then
5731         exit 0;
5732 fi
5733 exit 1
5734 EOF
5735 chmod +x findhdr
5736
5737 : define an alternate in-header-list? function
5738 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5739 cont=true; xxf="echo \"<\$1> found.\" >&4";
5740 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5741 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5742 esac;
5743 case $# in 4) instead=instead;; *) instead="at last";; esac;
5744 while $test "$cont"; do
5745         xxx=`./findhdr $1`
5746         var=$2; eval "was=\$$2";
5747         if $test "$xxx" && $test -r "$xxx";
5748         then eval $xxf;
5749         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5750                 cont="";
5751         else eval $xxnf;
5752         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5753         set $yyy; shift; shift; yyy=$@;
5754         case $# in 0) cont="";;
5755         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5756                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5757         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5758                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5759         esac;
5760 done;
5761 while $test "$yyy";
5762 do set $yyy; var=$2; eval "was=\$$2";
5763         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5764         set $yyy; shift; shift; yyy=$@;
5765 done'
5766
5767 : see if this is a malloc.h system
5768 set malloc.h i_malloc
5769 eval $inhdr
5770
5771 : see if stdlib is available
5772 set stdlib.h i_stdlib
5773 eval $inhdr
5774
5775 : determine which malloc to compile in
5776 echo " "
5777 case "$usemymalloc" in
5778 ''|[yY]*|true|$define)  dflt='y' ;;
5779 *)      dflt='n' ;;
5780 esac
5781 rp="Do you wish to attempt to use the malloc that comes with $package?"
5782 . ./myread
5783 usemymalloc="$ans"
5784 case "$ans" in
5785 y*|true)
5786         usemymalloc='y'
5787         mallocsrc='malloc.c'
5788         mallocobj="malloc$_o"
5789         d_mymalloc="$define"
5790         case "$libs" in
5791         *-lmalloc*)
5792                 : Remove malloc from list of libraries to use
5793                 echo "Removing unneeded -lmalloc from library list" >&4
5794                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5795                 shift
5796                 libs="$*"
5797                 echo "libs = $libs" >&4
5798                 ;;
5799         esac
5800         ;;
5801 *)
5802         usemymalloc='n'
5803         mallocsrc=''
5804         mallocobj=''
5805         d_mymalloc="$undef"
5806         ;;
5807 esac
5808
5809 : compute the return types of malloc and free
5810 echo " "
5811 $cat >malloc.c <<END
5812 #$i_malloc I_MALLOC
5813 #$i_stdlib I_STDLIB
5814 #include <stdio.h>
5815 #include <sys/types.h>
5816 #ifdef I_MALLOC
5817 #include <malloc.h>
5818 #endif
5819 #ifdef I_STDLIB
5820 #include <stdlib.h>
5821 #endif
5822 #ifdef TRY_MALLOC
5823 void *malloc();
5824 #endif
5825 #ifdef TRY_FREE
5826 void free();
5827 #endif
5828 END
5829 case "$malloctype" in
5830 '')
5831         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5832                 malloctype='void *'
5833         else
5834                 malloctype='char *'
5835         fi
5836         ;;
5837 esac
5838 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5839
5840 case "$freetype" in
5841 '')
5842         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5843                 freetype='void'
5844         else
5845                 freetype='int'
5846         fi
5847         ;;
5848 esac
5849 echo "Your system uses $freetype free(), it would seem." >&4
5850 $rm -f malloc.[co]
5851 $cat <<EOM
5852
5853 After $package is installed, you may wish to install various
5854 add-on modules and utilities.  Typically, these add-ons will
5855 be installed under $prefix with the rest
5856 of this package.  However, you may wish to install such add-ons
5857 elsewhere under a different prefix.
5858
5859 If you do not wish to put everything under a single prefix, that's
5860 ok.  You will be prompted for the individual locations; this siteprefix
5861 is only used to suggest the defaults.
5862
5863 The default should be fine for most people.
5864
5865 EOM
5866 fn=d~+
5867 rp='Installation prefix to use for add-on modules and utilities?'
5868 : XXX Here might be another good place for an installstyle setting.
5869 case "$siteprefix" in
5870 '') dflt=$prefix ;;
5871 *)  dflt=$siteprefix ;;
5872 esac
5873 . ./getfile
5874 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5875 oldsiteprefix=''
5876 case "$siteprefix" in
5877 '') ;;
5878 *)      case "$ans" in
5879         "$prefix") ;;
5880         *) oldsiteprefix="$prefix";;
5881         esac
5882         ;;
5883 esac
5884 siteprefix="$ans"
5885 siteprefixexp="$ansexp"
5886
5887 : determine where site specific libraries go.
5888 : Usual default is /usr/local/lib/perl5/site_perl/$version
5889 : The default "style" setting is made in installstyle.U
5890 : XXX No longer works with Prefixit stuff.
5891 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5892 case "$sitelib" in
5893 '') case "$installstyle" in
5894         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5895         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5896         esac
5897         ;;
5898 *)      dflt="$sitelib"
5899         ;;
5900 esac
5901 $cat <<EOM
5902
5903 The installation process will create a directory for
5904 site-specific extensions and modules.  Most users find it convenient
5905 to place all site-specific files in this directory rather than in the
5906 main distribution directory.
5907
5908 EOM
5909 fn=d~+
5910 rp='Pathname for the site-specific library files?'
5911 . ./getfile
5912 sitelib="$ans"
5913 sitelibexp="$ansexp"
5914 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5915 : Change installation prefix, if necessary.
5916 if $test X"$prefix" != X"$installprefix"; then
5917         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5918 else
5919         installsitelib="$sitelibexp"
5920 fi
5921
5922 : determine where site specific architecture-dependent libraries go.
5923 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5924 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5925 : sitelib may have an optional trailing /share.
5926 case "$sitearch" in
5927 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5928         dflt="$dflt/$archname"
5929         ;;
5930 *)      dflt="$sitearch"
5931         ;;
5932 esac
5933 set sitearch sitearch none
5934 eval $prefixit
5935 $cat <<EOM
5936
5937 The installation process will also create a directory for
5938 architecture-dependent site-specific extensions and modules.
5939
5940 EOM
5941 fn=d~+
5942 rp='Pathname for the site-specific architecture-dependent library files?'
5943 . ./getfile
5944 sitearch="$ans"
5945 sitearchexp="$ansexp"
5946 : Change installation prefix, if necessary.
5947 if $test X"$prefix" != X"$installprefix"; then
5948         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5949 else
5950         installsitearch="$sitearchexp"
5951 fi
5952
5953 $cat <<EOM
5954
5955 The installation process will also create a directory for
5956 vendor-supplied add-ons.  Vendors who supply perl with their system
5957 may find it convenient to place all vendor-supplied files in this
5958 directory rather than in the main distribution directory.  This will
5959 ease upgrades between binary-compatible maintenance versions of perl.
5960
5961 Of course you may also use these directories in whatever way you see
5962 fit.  For example, you might use them to access modules shared over a
5963 company-wide network.
5964
5965 The default answer should be fine for most people.
5966 This causes further questions about vendor add-ons to be skipped
5967 and no vendor-specific directories will be configured for perl.
5968
5969 EOM
5970 rp='Do you want to configure vendor-specific add-on directories?'
5971 case "$usevendorprefix" in
5972 define|true|[yY]*) dflt=y ;;
5973 *)      : User may have set vendorprefix directly on Configure command line.
5974         case "$vendorprefix" in
5975         ''|' ') dflt=n ;;
5976         *)      dflt=y ;;
5977         esac
5978         ;;
5979 esac
5980 . ./myread
5981 case "$ans" in
5982 [yY]*)  fn=d~+
5983         rp='Installation prefix to use for vendor-supplied add-ons?'
5984         case "$vendorprefix" in
5985         '') dflt='' ;;
5986         *)  dflt=$vendorprefix ;;
5987         esac
5988         . ./getfile
5989         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5990         oldvendorprefix=''
5991         case "$vendorprefix" in
5992         '') ;;
5993         *)      case "$ans" in
5994                 "$prefix") ;;
5995                 *) oldvendorprefix="$prefix";;
5996                 esac
5997                 ;;
5998         esac
5999         usevendorprefix="$define"
6000         vendorprefix="$ans"
6001         vendorprefixexp="$ansexp"
6002         ;;
6003 *)      usevendorprefix="$undef"
6004         vendorprefix=''
6005         vendorprefixexp=''
6006         ;;
6007 esac
6008
6009 case "$vendorprefix" in
6010 '')     d_vendorlib="$undef"
6011         vendorlib=''
6012         vendorlibexp=''
6013         ;;
6014 *)      d_vendorlib="$define"
6015         : determine where vendor-supplied modules go.
6016         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6017         case "$vendorlib" in
6018         '')
6019                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6020                 case "$installstyle" in
6021                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6022                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6023                 esac
6024                 ;;
6025         *)      dflt="$vendorlib"
6026                 ;;
6027         esac
6028         fn=d~+
6029         rp='Pathname for the vendor-supplied library files?'
6030         . ./getfile
6031         vendorlib="$ans"
6032         vendorlibexp="$ansexp"
6033         ;;
6034 esac
6035 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6036 : Change installation prefix, if necessary.
6037 if $test X"$prefix" != X"$installprefix"; then
6038         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6039 else
6040         installvendorlib="$vendorlibexp"
6041 fi
6042
6043 case "$vendorprefix" in
6044 '')     d_vendorarch="$undef"
6045         vendorarch=''
6046         vendorarchexp=''
6047         ;;
6048 *)      d_vendorarch="$define"
6049         : determine where vendor-supplied architecture-dependent libraries go.
6050         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6051         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6052         : vendorlib may have an optional trailing /share.
6053         case "$vendorarch" in
6054         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6055                 dflt="$dflt/$archname"
6056                 ;;
6057         *)      dflt="$vendorarch" ;;
6058         esac
6059         fn=d~+
6060         rp='Pathname for vendor-supplied architecture-dependent files?'
6061         . ./getfile
6062         vendorarch="$ans"
6063         vendorarchexp="$ansexp"
6064         ;;
6065 esac
6066 : Change installation prefix, if necessary.
6067 if $test X"$prefix" != X"$installprefix"; then
6068         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6069 else
6070         installvendorarch="$vendorarchexp"
6071 fi
6072
6073 : Final catch-all directories to search
6074 $cat <<EOM
6075
6076 Lastly, you can have perl look in other directories for extensions and
6077 modules in addition to those already specified.
6078 These directories will be searched after 
6079         $sitearch 
6080         $sitelib 
6081 EOM
6082 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6083 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6084 echo ' '
6085 case "$otherlibdirs" in
6086 ''|' ') dflt='none' ;;
6087 *)      dflt="$otherlibdirs" ;;
6088 esac
6089 $cat <<EOM
6090 Enter a colon-separated set of extra paths to include in perl's @INC
6091 search path, or enter 'none' for no extra paths.
6092
6093 EOM
6094
6095 rp='Colon-separated list of additional directories for perl to search?'
6096 . ./myread
6097 case "$ans" in
6098 ' '|''|none)    otherlibdirs=' ' ;;     
6099 *)      otherlibdirs="$ans" ;;
6100 esac
6101 case "$otherlibdirs" in
6102 ' ') val=$undef ;;
6103 *)      val=$define ;;
6104 esac
6105 set d_perl_otherlibdirs
6106 eval $setvar
6107
6108 : Cruising for prototypes
6109 echo " "
6110 echo "Checking out function prototypes..." >&4
6111 $cat >prototype.c <<'EOCP'
6112 int main(int argc, char *argv[]) {
6113         exit(0);}
6114 EOCP
6115 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6116         echo "Your C compiler appears to support function prototypes."
6117         val="$define"
6118 else
6119         echo "Your C compiler doesn't seem to understand function prototypes."
6120         val="$undef"
6121 fi
6122 set prototype
6123 eval $setvar
6124 $rm -f prototype*
6125
6126 case "$prototype" in
6127 "$define") ;;
6128 *)      ansi2knr='ansi2knr'
6129         echo " "
6130         cat <<EOM >&4
6131
6132 $me:  FATAL ERROR:
6133 This version of $package can only be compiled by a compiler that 
6134 understands function prototypes.  Unfortunately, your C compiler 
6135         $cc $ccflags
6136 doesn't seem to understand them.  Sorry about that.
6137
6138 If GNU cc is available for your system, perhaps you could try that instead.  
6139
6140 Eventually, we hope to support building Perl with pre-ANSI compilers.
6141 If you would like to help in that effort, please contact <perlbug@perl.org>.
6142
6143 Aborting Configure now.
6144 EOM
6145         exit 2
6146         ;;
6147 esac
6148
6149 : determine where public executables go
6150 echo " "
6151 set dflt bin bin
6152 eval $prefixit
6153 fn=d~
6154 rp='Pathname where the public executables will reside?'
6155 . ./getfile
6156 if $test "X$ansexp" != "X$binexp"; then
6157         installbin=''
6158 fi
6159 bin="$ans"
6160 binexp="$ansexp"
6161 : Change installation prefix, if necessary.
6162 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6163 if $test X"$prefix" != X"$installprefix"; then
6164         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6165 else
6166         installbin="$binexp"
6167 fi
6168
6169 : Find perl5.005 or later.
6170 echo "Looking for a previously installed perl5.005 or later... "
6171 case "$perl5" in
6172 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6173                 : Check if this perl is recent and can load a simple module
6174                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6175                         perl5=$tdir/perl
6176                         break;
6177                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6178                         perl5=$tdir/perl
6179                         break;
6180                 fi
6181         done
6182         ;;
6183 *)      perl5="$perl5"
6184         ;;
6185 esac
6186 case "$perl5" in
6187 '')     echo "None found.  That's ok.";;
6188 *)      echo "Using $perl5." ;;
6189 esac
6190
6191 : Determine list of previous versions to include in @INC
6192 $cat > getverlist <<EOPL
6193 #!$perl5 -w
6194 use File::Basename;
6195 \$api_versionstring = "$api_versionstring";
6196 \$version = "$version";
6197 \$stem = "$sitelib_stem";
6198 \$archname = "$archname";
6199 EOPL
6200         $cat >> getverlist <<'EOPL'
6201 # Can't have leading @ because metaconfig interprets it as a command!
6202 ;@inc_version_list=();
6203 # XXX Redo to do opendir/readdir? 
6204 if (-d $stem) {
6205     chdir($stem);
6206     ;@candidates = glob("5.*");
6207 }
6208 else {
6209     ;@candidates = ();
6210 }
6211
6212 # XXX ToDo:  These comparisons must be reworked when two-digit
6213 # subversions come along, so that 5.7.10 compares as greater than
6214 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6215 # widespread that we can use the built-in version vectors rather
6216 # than reinventing them here.  For 5.6.0, however, we must
6217 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6218 foreach $d (@candidates) {
6219     if ($d lt $version) {
6220         if ($d ge $api_versionstring) {
6221             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6222         }
6223         elsif ($d ge "5.005") {
6224             unshift(@inc_version_list, grep { -d } $d);
6225         }
6226     }
6227     else {
6228         # Skip newer version.  I.e. don't look in
6229         # 5.7.0 if we're installing 5.6.1.
6230     }
6231 }
6232
6233 if (@inc_version_list) {
6234     print join(' ', @inc_version_list);
6235 }
6236 else {
6237     # Blank space to preserve value for next Configure run.
6238     print " ";
6239 }
6240 EOPL
6241 chmod +x getverlist
6242 case "$inc_version_list" in
6243 '')     if test -x "$perl5"; then
6244                 dflt=`$perl5 getverlist`
6245         else
6246                 dflt='none'
6247         fi
6248         ;;
6249 $undef) dflt='none' ;;
6250 *)  dflt="$inc_version_list" ;;
6251 esac
6252 case "$dflt" in
6253 ''|' ') dflt=none ;;
6254 esac
6255 case "$dflt" in
6256 5.005) case "$bincompat5005" in
6257        $define|true|[yY]*) ;;
6258        *) dflt=none ;;
6259        esac
6260        ;;
6261 esac
6262 $cat <<'EOM'
6263
6264 In order to ease the process of upgrading, this version of perl 
6265 can be configured to use modules built and installed with earlier 
6266 versions of perl that were installed under $prefix.  Specify here
6267 the list of earlier versions that this version of perl should check.
6268 If Configure detected no earlier versions of perl installed under
6269 $prefix, then the list will be empty.  Answer 'none' to tell perl
6270 to not search earlier versions.
6271
6272 The default should almost always be sensible, so if you're not sure,
6273 just accept the default.
6274 EOM
6275
6276 rp='List of earlier versions to include in @INC?'
6277 . ./myread
6278 case "$ans" in
6279 [Nn]one|''|' ') inc_version_list=' ' ;;
6280 *) inc_version_list="$ans" ;;
6281 esac
6282 case "$inc_version_list" in
6283 ''|' ') 
6284         inc_version_list_init='0';;
6285 *)      inc_version_list_init=`echo $inc_version_list |
6286                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6287         ;;
6288 esac
6289 $rm -f getverlist
6290
6291 : determine whether to install perl also as /usr/bin/perl
6292
6293 echo " "
6294 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6295         $cat <<EOM
6296 Many scripts expect perl to be installed as /usr/bin/perl.
6297 I can install the perl you are about to compile also as /usr/bin/perl
6298 (in addition to $installbin/perl).
6299 EOM
6300         case "$installusrbinperl" in
6301         "$undef"|[nN]*) dflt='n';;
6302         *)              dflt='y';;
6303         esac
6304         rp="Do you want to install perl as /usr/bin/perl?"
6305         . ./myread
6306         case "$ans" in
6307         [yY]*)  val="$define";;
6308         *)      val="$undef" ;;
6309         esac
6310 else
6311         val="$undef"
6312 fi
6313 set installusrbinperl
6314 eval $setvar
6315
6316 : see if dld is available
6317 set dld.h i_dld
6318 eval $inhdr
6319
6320 : see if dlopen exists
6321 xxx_runnm="$runnm"
6322 runnm=false
6323 set dlopen d_dlopen
6324 eval $inlibc
6325 runnm="$xxx_runnm"
6326
6327 : determine which dynamic loading, if any, to compile in
6328 echo " "
6329 dldir="ext/DynaLoader"
6330 case "$usedl" in
6331 $define|y|true)
6332         dflt='y'
6333         usedl="$define"
6334         ;;
6335 $undef|n|false)
6336         dflt='n'
6337         usedl="$undef"
6338         ;;
6339 *) 
6340         dflt='n'
6341         case "$d_dlopen" in
6342             $define) dflt='y' ;;
6343         esac
6344         case "$i_dld" in
6345             $define) dflt='y' ;;
6346         esac
6347         : Does a dl_xxx.xs file exist for this operating system
6348         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6349         ;;
6350 esac
6351 rp="Do you wish to use dynamic loading?"
6352 . ./myread
6353 usedl="$ans"
6354 case "$ans" in
6355 y*) usedl="$define"
6356         case "$dlsrc" in
6357         '')
6358                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6359                         dflt="$dldir/dl_${osname}.xs"
6360                 elif $test "$d_dlopen" = "$define" ; then
6361                         dflt="$dldir/dl_dlopen.xs"
6362                 elif $test "$i_dld" = "$define" ; then
6363                         dflt="$dldir/dl_dld.xs"
6364                 else
6365                         dflt=''
6366                 fi
6367                 ;;
6368         *)      dflt="$dldir/$dlsrc"
6369                 ;;
6370         esac
6371     echo "The following dynamic loading files are available:"
6372         : Can not go over to $dldir because getfile has path hard-coded in.
6373         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6374         rp="Source file to use for dynamic loading"
6375         fn="fne"
6376         gfpth="$src"
6377         . ./getfile
6378         usedl="$define"
6379         : emulate basename
6380         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6381
6382         $cat << EOM
6383
6384 Some systems may require passing special flags to $cc -c to
6385 compile modules that will be used to create a shared library.
6386 To use no flags, say "none".
6387
6388 EOM
6389     case "$cccdlflags" in
6390     '') case "$gccversion" in
6391                 '') case "$osname" in
6392                         hpux)   dflt='+z' ;;
6393                         next)   dflt='none' ;;
6394                         irix*)  dflt='-KPIC' ;;
6395                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6396                         sunos)  dflt='-pic' ;;
6397                         *)      dflt='none' ;;
6398                     esac
6399                         ;;
6400                 *)  case "$osname" in
6401                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6402                         *)      dflt='-fpic' ;;
6403                     esac ;;
6404             esac ;;
6405         ' ') dflt='none' ;;
6406     *)  dflt="$cccdlflags" ;;
6407     esac
6408     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6409     . ./myread
6410     case "$ans" in
6411     none) cccdlflags=' ' ;;
6412     *) cccdlflags="$ans" ;;
6413     esac
6414
6415     cat << EOM
6416
6417 Some systems use ld to create libraries that can be dynamically loaded,
6418 while other systems (such as those using ELF) use $cc.
6419
6420 EOM
6421         case "$ld" in
6422         '')     $cat >try.c <<'EOM'
6423 /* Test for whether ELF binaries are produced */
6424 #include <fcntl.h>
6425 #include <stdlib.h>
6426 int main() {
6427         char b[4];
6428         int i = open("a.out",O_RDONLY);
6429         if(i == -1) 
6430                 exit(1); /* fail */
6431         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6432                 exit(0); /* succeed (yes, it's ELF) */
6433         else
6434                 exit(1); /* fail */
6435 }
6436 EOM
6437                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6438                         cat <<EOM
6439 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6440 EOM
6441                         dflt="$cc"
6442                 else
6443                         echo "I'll use ld to build dynamic libraries."
6444                         dflt='ld'
6445                 fi
6446                 rm -f try.c a.out
6447                 ;;
6448         *)      dflt="$ld"
6449                 ;;
6450         esac
6451
6452     rp="What command should be used to create dynamic libraries?"
6453     . ./myread
6454         ld="$ans"
6455
6456     cat << EOM
6457
6458 Some systems may require passing special flags to $ld to create a
6459 library that can be dynamically loaded.  If your ld flags include
6460 -L/other/path options to locate libraries outside your loader's normal
6461 search path, you may need to specify those -L options here as well.  To
6462 use no flags, say "none".
6463
6464 EOM
6465     case "$lddlflags" in
6466     '') case "$osname" in
6467                         beos) dflt='-nostart' ;;
6468                         hpux) dflt='-b';
6469                               case "$gccversion" in
6470                               '') dflt="$dflt +vnocompatwarnings" ;;
6471                               esac
6472                               ;;        
6473                         linux|irix*)    dflt='-shared' ;;
6474                         next)  dflt='none' ;;
6475                         solaris) dflt='-G' ;;
6476                         sunos) dflt='-assert nodefinitions' ;;
6477                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6478                 *)     dflt='none' ;;
6479                         esac
6480                         ;;
6481     *) dflt="$lddlflags" ;;
6482     esac
6483
6484         : Try to guess additional flags to pick up local libraries.
6485         : Be careful not to append to a plain 'none'
6486         case "$dflt" in
6487         none) dflt='' ;;
6488         esac
6489         for thisflag in $ldflags; do
6490                 case "$thisflag" in
6491                 -L*|-R*)
6492                         case " $dflt " in
6493                         *" $thisflag "*) ;;
6494                         *) dflt="$dflt $thisflag" ;;
6495                         esac
6496                         ;;
6497                 esac
6498         done
6499
6500         case "$dflt" in
6501         ''|' ') dflt='none' ;;
6502         esac
6503
6504     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6505     . ./myread
6506     case "$ans" in
6507     none) lddlflags=' ' ;;
6508     *) lddlflags="$ans" ;;
6509     esac
6510
6511         cat <<EOM
6512
6513 Some systems may require passing special flags to $cc to indicate that
6514 the resulting executable will use dynamic linking.  To use no flags,
6515 say "none".
6516
6517 EOM
6518     case "$ccdlflags" in
6519     '') case "$osname" in
6520                 hpux)   dflt='-Wl,-E' ;;
6521                 linux)  dflt='-rdynamic' ;;
6522                 next)   dflt='none' ;;
6523                 sunos)  dflt='none' ;;
6524                 *)      dflt='none' ;;
6525             esac ;;
6526     ' ')  dflt='none' ;;
6527     *)  dflt="$ccdlflags" ;;
6528     esac
6529     rp="Any special flags to pass to $cc to use dynamic linking?"
6530     . ./myread
6531     case "$ans" in
6532     none) ccdlflags=' ' ;;
6533     *) ccdlflags="$ans" ;;
6534     esac
6535     ;;
6536 *)  usedl="$undef"
6537         ld='ld'
6538     dlsrc='dl_none.xs'
6539     lddlflags=''
6540     ccdlflags=''
6541     ;;
6542 esac
6543
6544 also=''
6545 case "$usedl" in
6546 $undef)
6547         # No dynamic loading being used, so don't bother even to prompt.
6548         useshrplib='false'
6549         ;;
6550 *)      case "$useshrplib" in
6551         '')     case "$osname" in
6552                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6553                         dflt=y
6554                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6555                         ;;
6556                 next*)
6557                         case "$osvers" in
6558                         4*)     dflt=y
6559                                 also='Building a shared libperl is needed for MAB support.'
6560                                 ;;
6561                         *)      dflt=n
6562                                 ;;
6563                         esac
6564                         ;;
6565                 *)      dflt=n
6566                         ;;
6567                 esac
6568                 ;;
6569         $define|true|[Yy]*)
6570                 dflt=y
6571                 ;;
6572         *)      dflt=n
6573                 ;;
6574         esac
6575         $cat << EOM
6576
6577 The perl executable is normally obtained by linking perlmain.c with
6578 libperl${_a}, any static extensions (usually just DynaLoader), and
6579 any other libraries needed on this system (such as -lm, etc.).  Since
6580 your system supports dynamic loading, it is probably possible to build
6581 a shared libperl.$so.  If you will have more than one executable linked
6582 to libperl.$so, this will significantly reduce the size of each
6583 executable, but it may have a noticeable affect on performance.  The
6584 default is probably sensible for your system.
6585 $also
6586
6587 EOM
6588         rp="Build a shared libperl.$so (y/n)"
6589         . ./myread
6590         case "$ans" in
6591         true|$define|[Yy]*)
6592                 useshrplib='true'  ;;
6593         *)      useshrplib='false' ;;
6594         esac
6595         ;;
6596 esac
6597
6598 case "$useshrplib" in
6599 true)
6600         case "$libperl" in
6601         '')
6602                 # Figure out a good name for libperl.so.  Since it gets stored in
6603                 # a version-specific architecture-dependent library, the version
6604                 # number isn't really that important, except for making cc/ld happy.
6605                 #
6606                 # A name such as libperl.so.3.1
6607                 majmin="libperl.$so.$patchlevel.$subversion"
6608                 # A name such as libperl.so.301
6609                 majonly=`echo $patchlevel $subversion |
6610                         $awk '{printf "%d%02d", $1, $2}'`
6611                 majonly=libperl.$so.$majonly
6612                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6613                 # rely on figuring it out from the naming of libc.
6614                 case "${osname}${osvers}" in
6615                 next4*)
6616                         dflt=libperl.5.$so
6617                         # XXX How handle the --version stuff for MAB?
6618                         ;;
6619                 linux*)  # ld won't link with a bare -lperl otherwise.
6620                         dflt=libperl.$so
6621                         ;;
6622                 cygwin*) # include version
6623                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6624                         ;;
6625                 *)      # Try to guess based on whether libc has major.minor.
6626                         case "$libc" in
6627                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6628                         *libc.$so.[0-9]*) dflt=$majonly ;;
6629                         *)      dflt=libperl.$so ;;
6630                         esac
6631                         ;;
6632                 esac
6633                 ;;
6634         *)      dflt=$libperl
6635                 ;;
6636         esac
6637         cat << EOM
6638
6639 I need to select a good name for the shared libperl.  If your system uses
6640 library names with major and minor numbers, then you might want something
6641 like $majmin.  Alternatively, if your system uses a single version
6642 number for shared libraries, then you might want to use $majonly.
6643 Or, your system might be quite happy with a simple libperl.$so.
6644
6645 Since the shared libperl will get installed into a version-specific
6646 architecture-dependent directory, the version number of the shared perl
6647 library probably isn't important, so the default should be o.k.
6648
6649 EOM
6650         rp='What name do you want to give to the shared libperl?'
6651         . ./myread
6652         libperl=$ans
6653         echo "Ok, I'll use $libperl"
6654         ;;
6655 *)
6656         libperl="libperl${_a}"
6657         ;;
6658 esac
6659
6660 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6661 case "$shrpdir" in
6662 '') ;;
6663 *)      $cat >&4 <<EOM
6664 WARNING:  Use of the shrpdir variable for the installation location of
6665 the shared $libperl is not supported.  It was never documented and
6666 will not work in this version.  Let me (perlbug@perl.org)
6667 know of any problems this may cause.
6668
6669 EOM
6670         case "$shrpdir" in
6671         "$archlibexp/CORE")
6672                 $cat >&4 <<EOM
6673 But your current setting of $shrpdir is
6674 the default anyway, so it's harmless.
6675 EOM
6676                 ;;
6677         *)
6678                 $cat >&4 <<EOM
6679 Further, your current attempted setting of $shrpdir
6680 conflicts with the value of $archlibexp/CORE
6681 that installperl will use.
6682 EOM
6683                 ;;
6684         esac
6685         ;;
6686 esac
6687
6688 # How will the perl executable find the installed shared $libperl?
6689 # Add $xxx to ccdlflags.
6690 # If we can't figure out a command-line option, use $shrpenv to
6691 # set env LD_RUN_PATH.  The main perl makefile uses this.
6692 shrpdir=$archlibexp/CORE
6693 xxx=''
6694 tmp_shrpenv=''
6695 if "$useshrplib"; then
6696     case "$osname" in 
6697         aix)
6698                 # We'll set it in Makefile.SH...
6699                 ;;
6700         solaris|netbsd)
6701                 xxx="-R $shrpdir"
6702                 ;;
6703         freebsd)
6704                 xxx="-Wl,-R$shrpdir"
6705                 ;;
6706         linux|irix*|dec_osf)
6707                 xxx="-Wl,-rpath,$shrpdir"
6708                 ;;
6709         next)
6710                 # next doesn't like the default...
6711                 ;;
6712         beos)
6713                 # beos doesn't like the default, either.
6714                 ;;
6715         hpux*)
6716                 # hpux doesn't like the default, either.
6717                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6718                 ;;
6719         *)
6720                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6721                 ;;
6722         esac
6723         case "$xxx" in
6724         '') ;;
6725         *)      
6726                 # Only add $xxx if it isn't already in ccdlflags.
6727                 case " $ccdlflags " in
6728                 *" $xxx "*)     ;;
6729                 *)      ccdlflags="$ccdlflags $xxx"
6730                         cat <<EOM >&4
6731
6732 Adding $xxx to the flags
6733 passed to $ld so that the perl executable will find the 
6734 installed shared $libperl.
6735
6736 EOM
6737                         ;;
6738                 esac
6739                 ;;
6740         esac
6741 fi
6742 # Fix ccdlflags in AIX for building external extensions.
6743 # (For building Perl itself bare -bE:perl.exp is needed,
6744 #  Makefile.SH takes care of this.)
6745 case "$osname" in
6746 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6747 esac
6748 # Respect a hint or command-line value.
6749 case "$shrpenv" in
6750 '') shrpenv="$tmp_shrpenv" ;;
6751 esac
6752 case "$ldlibpthname" in
6753 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6754 none)   ldlibpthname='' ;;
6755 esac
6756
6757 : determine where manual pages are on this system
6758 echo " "
6759 case "$sysman" in
6760 '') 
6761         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6762         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6763         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6764         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6765         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6766         sysman=`./loc . /usr/man/man1 $syspath`
6767         ;;
6768 esac
6769 if $test -d "$sysman"; then
6770         echo "System manual is in $sysman." >&4
6771 else
6772         echo "Could not find manual pages in source form." >&4
6773 fi
6774
6775 : determine where manual pages go
6776 set man1dir man1dir none
6777 eval $prefixit
6778 $cat <<EOM
6779
6780 $spackage has manual pages available in source form.
6781 EOM
6782 case "$nroff" in
6783 nroff)
6784         echo "However, you don't have nroff, so they're probably useless to you."
6785         case "$man1dir" in
6786         '') man1dir="none";;
6787         esac;;
6788 esac
6789 echo "If you don't want the manual sources installed, answer 'none'."
6790 case "$man1dir" in
6791 ' ') dflt=none
6792         ;;
6793 '')
6794         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6795         lookpath="$lookpath $prefixexp/man/p_man/man1"
6796         lookpath="$lookpath $prefixexp/man/u_man/man1"
6797         lookpath="$lookpath $prefixexp/man/man.1"
6798         case "$sysman" in
6799         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6800         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6801         esac
6802         set dflt
6803         eval $prefixup
6804         ;;
6805 *)  dflt="$man1dir"
6806         ;;
6807 esac
6808 echo " "
6809 fn=dn+~
6810 rp="Where do the main $spackage manual pages (source) go?"
6811 . ./getfile
6812 if $test "X$man1direxp" != "X$ansexp"; then
6813         installman1dir=''
6814 fi
6815 man1dir="$ans"
6816 man1direxp="$ansexp"
6817 case "$man1dir" in
6818 '')     man1dir=' '
6819         installman1dir='';;
6820 esac
6821
6822 : Change installation prefix, if necessary.
6823 if $test X"$prefix" != X"$installprefix"; then
6824         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6825 else
6826         installman1dir="$man1direxp"
6827 fi
6828
6829 : What suffix to use on installed man pages
6830
6831 case "$man1dir" in
6832 ' ')
6833         man1ext='0'
6834         ;;
6835 *)
6836         rp="What suffix should be used for the main $spackage man pages?"
6837         case "$man1ext" in
6838         '')     case "$man1dir" in
6839                 *1)  dflt=1 ;;
6840                 *1p) dflt=1p ;;
6841                 *1pm) dflt=1pm ;;
6842                 *l) dflt=l;;
6843                 *n) dflt=n;;
6844                 *o) dflt=o;;
6845                 *p) dflt=p;;
6846                 *C) dflt=C;;
6847                 *L) dflt=L;;
6848                 *L1) dflt=L1;;
6849                 *) dflt=1;;
6850                 esac
6851                 ;;
6852         *)      dflt="$man1ext";;
6853         esac
6854         . ./myread
6855         man1ext="$ans"
6856         ;;
6857 esac
6858
6859 : see if we can have long filenames
6860 echo " "
6861 first=123456789abcdef
6862 $rm -f $first
6863 if (echo hi >$first) 2>/dev/null; then
6864         if $test -f 123456789abcde; then
6865                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6866                 val="$undef"
6867         else
6868                 echo 'You can have filenames longer than 14 characters.'>&4
6869                 val="$define"
6870         fi
6871 else
6872         $cat <<'EOM'
6873 You can't have filenames longer than 14 chars.
6874 You can't even think about them!
6875 EOM
6876         val="$undef"
6877 fi 
6878 set d_flexfnam
6879 eval $setvar
6880 $rm -rf 123456789abcde*
6881
6882 : determine where library module manual pages go
6883 set man3dir man3dir none
6884 eval $prefixit
6885 $cat <<EOM
6886
6887 $spackage has manual pages for many of the library modules.
6888 EOM
6889
6890 case "$nroff" in
6891 nroff)
6892         $cat <<'EOM'
6893 However, you don't have nroff, so they're probably useless to you.
6894 EOM
6895         case "$man3dir" in
6896         '') man3dir="none";;
6897         esac;;
6898 esac
6899
6900 case "$d_flexfnam" in
6901 undef)
6902         $cat <<'EOM'
6903 However, your system can't handle the long file names like File::Basename.3. 
6904 EOM
6905         case "$man3dir" in
6906         '') man3dir="none";;
6907         esac;;
6908 esac
6909
6910 echo "If you don't want the manual sources installed, answer 'none'."
6911 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6912 case "$man3dir" in
6913 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6914         if $test -d "$privlib/man/man3"; then
6915                 cat <<EOM >&4
6916
6917 WARNING:  Previous versions of perl installed man3 pages into
6918 $privlib/man/man3.  This version will suggest a 
6919 new default of $dflt.  
6920 EOM
6921                 tdflt=$dflt
6922                 dflt='n'
6923                 rp='Do you wish to preserve the old behavior?(y/n)'
6924                 . ./myread
6925                 case "$ans" in
6926                 y*) dflt="$privlib/man/man3" ;;
6927                 *)  dflt=$tdflt ;;
6928                 esac
6929     fi
6930         ;;
6931 *)      dflt="$man3dir" ;;
6932 esac
6933 case "$dflt" in
6934 ' ') dflt=none ;;
6935 esac
6936 echo " "
6937 fn=dn+~
6938 rp="Where do the $package library man pages (source) go?"
6939 . ./getfile
6940 man3dir="$ans"
6941 man3direxp="$ansexp"
6942 case "$man3dir" in
6943 '')     man3dir=' '
6944         installman3dir='';;
6945 esac
6946
6947 : Change installation prefix, if necessary.
6948 if $test X"$prefix" != X"$installprefix"; then
6949         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6950 else
6951         installman3dir="$man3direxp"
6952 fi
6953
6954 : What suffix to use on installed man pages
6955 case "$man3dir" in
6956 ' ')
6957         man3ext='0'
6958         ;;
6959 *)
6960         rp="What suffix should be used for the $package library man pages?"
6961         case "$man3ext" in
6962         '')     case "$man3dir" in
6963                 *3)  dflt=3 ;;
6964                 *3p) dflt=3p ;;
6965                 *3pm) dflt=3pm ;;
6966                 *l) dflt=l;;
6967                 *n) dflt=n;;
6968                 *o) dflt=o;;
6969                 *p) dflt=p;;
6970                 *C) dflt=C;;
6971                 *L) dflt=L;;
6972                 *L3) dflt=L3;;
6973                 *) dflt=3;;
6974                 esac
6975                 ;;
6976         *)      dflt="$man3ext";;
6977         esac
6978         . ./myread
6979         man3ext="$ans"
6980         ;;
6981 esac
6982
6983 : see if we have to deal with yellow pages, now NIS.
6984 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6985         if $test -f /usr/etc/nibindd; then
6986                 echo " "
6987                 echo "I'm fairly confident you're on a NeXT."
6988                 echo " "
6989                 rp='Do you get the hosts file via NetInfo?'
6990                 dflt=y
6991                 case "$hostcat" in
6992                 nidump*) ;;
6993                 '') ;;
6994                 *) dflt=n;;
6995                 esac
6996                 . ./myread
6997                 case "$ans" in
6998                 y*) hostcat='nidump hosts .';;
6999                 *)      case "$hostcat" in
7000                         nidump*) hostcat='';;
7001                         esac
7002                         ;;
7003                 esac
7004         fi
7005         case "$hostcat" in
7006         nidump*) ;;
7007         *)
7008                 case "$hostcat" in
7009                 *ypcat*) dflt=y;;
7010                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7011                                 dflt=y
7012                         else
7013                                 dflt=n
7014                         fi;;
7015                 *) dflt=n;;
7016                 esac
7017                 echo " "
7018                 rp='Are you getting the hosts file via yellow pages?'
7019                 . ./myread
7020                 case "$ans" in
7021                 y*) hostcat='ypcat hosts';;
7022                 *) hostcat='cat /etc/hosts';;
7023                 esac
7024                 ;;
7025         esac
7026 fi
7027 case "$hostcat" in
7028 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7029 esac
7030 case "$groupcat" in
7031 '') test -f /etc/group && groupcat='cat /etc/group';;
7032 esac
7033 case "$passcat" in
7034 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7035 esac
7036
7037 : now get the host name
7038 echo " "
7039 echo "Figuring out host name..." >&4
7040 case "$myhostname" in
7041 '') cont=true
7042         echo 'Maybe "hostname" will work...'
7043         if tans=`sh -c hostname 2>&1` ; then
7044                 myhostname=$tans
7045                 phostname=hostname
7046                 cont=''
7047         fi
7048         ;;
7049 *) cont='';;
7050 esac
7051 if $test "$cont"; then
7052         if ./xenix; then
7053                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7054                 if tans=`cat /etc/systemid 2>&1` ; then
7055                         myhostname=$tans
7056                         phostname='cat /etc/systemid'
7057                         echo "Whadyaknow.  Xenix always was a bit strange..."
7058                         cont=''
7059                 fi
7060         elif $test -r /etc/systemid; then
7061                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7062         fi
7063 fi
7064 if $test "$cont"; then
7065         echo 'No, maybe "uuname -l" will work...'
7066         if tans=`sh -c 'uuname -l' 2>&1` ; then
7067                 myhostname=$tans
7068                 phostname='uuname -l'
7069         else
7070                 echo 'Strange.  Maybe "uname -n" will work...'
7071                 if tans=`sh -c 'uname -n' 2>&1` ; then
7072                         myhostname=$tans
7073                         phostname='uname -n'
7074                 else
7075                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7076                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7077                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7078                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7079                         else
7080                                 case "$myhostname" in
7081                                 '') echo "Does this machine have an identity crisis or something?"
7082                                         phostname='';;
7083                                 *)
7084                                         echo "Well, you said $myhostname before..."
7085                                         phostname='echo $myhostname';;
7086                                 esac
7087                         fi
7088                 fi
7089         fi
7090 fi
7091 : you do not want to know about this
7092 set $myhostname
7093 myhostname=$1
7094
7095 : verify guess
7096 if $test "$myhostname" ; then
7097         dflt=y
7098         rp='Your host name appears to be "'$myhostname'".'" Right?"
7099         . ./myread
7100         case "$ans" in
7101         y*) ;;
7102         *) myhostname='';;
7103         esac
7104 fi
7105
7106 : bad guess or no guess
7107 while $test "X$myhostname" = X ; do
7108         dflt=''
7109         rp="Please type the (one word) name of your host:"
7110         . ./myread
7111         myhostname="$ans"
7112 done
7113
7114 : translate upper to lower if necessary
7115 case "$myhostname" in
7116 *[A-Z]*)
7117         echo "(Normalizing case in your host name)"
7118         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7119         ;;
7120 esac
7121
7122 case "$myhostname" in
7123 *.*)
7124         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7125         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7126         echo "(Trimming domain name from host name--host name is now $myhostname)"
7127         ;;
7128 *) case "$mydomain" in
7129         '')
7130                 {
7131                         test "X$hostcat" = "Xypcat hosts" &&
7132                         ypmatch "$myhostname" hosts 2>/dev/null |\
7133                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7134                         $test -s hosts
7135                 } || {
7136                         test "X$hostcat" != "X" &&
7137                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7138                                         /[       ]$myhostname[  . ]/p" > hosts
7139                 }
7140                 tmp_re="[       . ]"
7141                 if $test -f hosts; then
7142                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7143                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7144                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7145                                 hosts | $sort | $uniq | \
7146                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7147                         case `$echo X$dflt` in
7148                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7149                                 dflt=.
7150                                 ;;
7151                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7152                                 ;;
7153                         esac
7154                 else
7155                         echo "(I cannot locate a hosts database anywhere)"
7156                         dflt=.
7157                 fi
7158                 case "$dflt" in
7159                 .)
7160                         tans=`./loc resolv.conf X /etc /usr/etc`
7161                         if $test -f "$tans"; then
7162                                 echo "(Attempting domain name extraction from $tans)"
7163                                 dflt=.`$sed -n -e 's/   / /g' \
7164                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7165                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7166                                 case "$dflt" in
7167                                 .) dflt=.`$sed -n -e 's/        / /g' \
7168                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7169                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7170                                         ;;
7171                                 esac
7172                         fi
7173                         ;;
7174                 esac
7175                 case "$dflt" in
7176                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7177                         dflt=.`sh -c domainname 2>/dev/null`
7178                         case "$dflt" in
7179                         '') dflt='.';;
7180                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7181                         esac
7182                         ;;
7183                 esac
7184                 case "$dflt" in
7185                 .) echo "(Lost all hope -- silly guess then)"
7186                         dflt='.uucp'
7187                         ;;
7188                 esac
7189                 $rm -f hosts
7190                 ;;
7191         *) dflt="$mydomain";;
7192         esac;;
7193 esac
7194 echo " "
7195 rp="What is your domain name?"
7196 . ./myread
7197 tans="$ans"
7198 case "$ans" in
7199 '') ;;
7200 .*) ;;
7201 *) tans=".$tans";;
7202 esac
7203 mydomain="$tans"
7204
7205 : translate upper to lower if necessary
7206 case "$mydomain" in
7207 *[A-Z]*)
7208         echo "(Normalizing case in your domain name)"
7209         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7210         ;;
7211 esac
7212
7213 : a little sanity check here
7214 case "$phostname" in
7215 '') ;;
7216 *)
7217         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7218         $myhostname$mydomain|$myhostname) ;;
7219         *)
7220                 case "$phostname" in
7221                 sed*)
7222                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7223                         ;;
7224                 *)
7225                         echo "(That doesn't agree with your $phostname command, by the way.)"
7226                         ;;
7227                 esac
7228         ;;
7229         esac
7230         ;;
7231 esac
7232
7233 $cat <<EOM
7234
7235 I need to get your e-mail address in Internet format if possible, i.e.
7236 something like user@host.domain. Please answer accurately since I have
7237 no easy means to double check it. The default value provided below
7238 is most probably close to reality but may not be valid from outside
7239 your organization...
7240
7241 EOM
7242 cont=x
7243 while test "$cont"; do
7244         case "$cf_email" in
7245         '') dflt="$cf_by@$myhostname$mydomain";;
7246         *) dflt="$cf_email";;
7247         esac
7248         rp='What is your e-mail address?'
7249         . ./myread
7250         cf_email="$ans"
7251         case "$cf_email" in
7252         *@*.*) cont='' ;;
7253         *)
7254                 rp='Address does not look like an Internet one.  Use it anyway?'
7255                 case "$fastread" in
7256                 yes) dflt=y ;;
7257                 *) dflt=n ;;
7258                 esac
7259                 . ./myread
7260                 case "$ans" in
7261                 y*) cont='' ;;
7262                 *) echo " " ;;
7263                 esac
7264                 ;;
7265         esac
7266 done
7267
7268 $cat <<EOM
7269
7270 If you or somebody else will be maintaining perl at your site, please
7271 fill in the correct e-mail address here so that they may be contacted
7272 if necessary. Currently, the "perlbug" program included with perl
7273 will send mail to this address in addition to perlbug@perl.org. You may
7274 enter "none" for no administrator.
7275
7276 EOM
7277 case "$perladmin" in
7278 '') dflt="$cf_email";;
7279 *) dflt="$perladmin";;
7280 esac
7281 rp='Perl administrator e-mail address'
7282 . ./myread
7283 perladmin="$ans"
7284
7285 : determine whether to only install version-specific parts.
7286 echo " "
7287 $cat <<EOM
7288 Do you want to install only the version-specific parts of the perl
7289 distribution?  Usually you do *not* want to do this.
7290 EOM
7291 case "$versiononly" in
7292 "$define"|[Yy]*|true) dflt='y' ;;
7293 *) dflt='n';
7294 esac
7295 rp="Do you want to install only the version-specific parts of perl?"
7296 . ./myread
7297 case "$ans" in
7298 [yY]*)  val="$define";;
7299 *)      val="$undef" ;;
7300 esac
7301 set versiononly
7302 eval $setvar
7303
7304 : figure out how to guarantee perl startup
7305 case "$startperl" in
7306 '')
7307         case "$sharpbang" in
7308         *!)
7309                 $cat <<EOH
7310
7311 I can use the #! construct to start perl on your system. This will
7312 make startup of perl scripts faster, but may cause problems if you
7313 want to share those scripts and perl is not in a standard place
7314 ($binexp/perl) on all your platforms. The alternative is to force
7315 a shell by starting the script with a single ':' character.
7316
7317 EOH
7318                 case "$versiononly" in
7319                 "$define")      dflt="$binexp/perl$version";;  
7320                 *)              dflt="$binexp/perl";;
7321                 esac
7322                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7323                 . ./myread
7324                 case "$ans" in
7325                 none)   startperl=": # use perl";;
7326                 *)      startperl="#!$ans"
7327                         if $test 30 -lt `echo "$ans" | wc -c`; then
7328                                 $cat >&4 <<EOM
7329
7330 WARNING:  Some systems limit the #! command to 32 characters.
7331 If you experience difficulty running Perl scripts with #!, try
7332 installing Perl in a directory with a shorter pathname.
7333
7334 EOM
7335                         fi ;;
7336                 esac
7337                 ;;
7338         *) startperl=": # use perl"
7339                 ;;
7340         esac
7341         ;;
7342 esac
7343 echo "I'll use $startperl to start perl scripts."
7344
7345 : figure best path for perl in scripts
7346 case "$perlpath" in
7347 '')
7348         perlpath="$binexp/perl"
7349         case "$startperl" in
7350         *!*) ;;
7351         *)
7352                 $cat <<EOH
7353
7354 I will use the "eval 'exec'" idiom to start Perl on your system.
7355 I can use the full path of your Perl binary for this purpose, but
7356 doing so may cause problems if you want to share those scripts and
7357 Perl is not always in a standard place ($binexp/perl).
7358
7359 EOH
7360                 dflt="$binexp/perl"
7361                 rp="What path shall I use in \"eval 'exec'\"?"
7362                 . ./myread
7363                 perlpath="$ans"
7364                 ;;
7365         esac
7366         ;;
7367 esac
7368 case "$startperl" in
7369 *!*)    ;;
7370 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7371 esac
7372
7373 : determine where public executable scripts go
7374 set scriptdir scriptdir
7375 eval $prefixit
7376 case "$scriptdir" in
7377 '')
7378         dflt="$bin"
7379         : guess some guesses
7380         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7381         $test -d /usr/share/bin     && dflt=/usr/share/bin
7382         $test -d /usr/local/script  && dflt=/usr/local/script
7383         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7384         $test -d $prefixexp/script  && dflt=$prefixexp/script
7385         set dflt
7386         eval $prefixup
7387         ;;
7388 *)  dflt="$scriptdir"
7389         ;;
7390 esac
7391 $cat <<EOM
7392  
7393 Some installations have a separate directory just for executable scripts so
7394 that they can mount it across multiple architectures but keep the scripts in
7395 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7396 Or you might just lump your scripts in with all your other executables.
7397  
7398 EOM
7399 fn=d~
7400 rp='Where do you keep publicly executable scripts?'
7401 . ./getfile
7402 if $test "X$ansexp" != "X$scriptdirexp"; then
7403         installscript=''
7404 fi
7405 scriptdir="$ans"
7406 scriptdirexp="$ansexp"
7407 : Change installation prefix, if necessary.
7408 if $test X"$prefix" != X"$installprefix"; then
7409         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7410 else
7411         installscript="$scriptdirexp"
7412 fi
7413
7414 : determine where add-on public executables go
7415 case "$sitebin" in
7416 '')     dflt=$siteprefix/bin ;;
7417 *)      dflt=$sitebin ;;
7418 esac
7419 fn=d~
7420 rp='Pathname where the add-on public executables should be installed?'
7421 . ./getfile
7422 sitebin="$ans"
7423 sitebinexp="$ansexp"
7424 : Change installation prefix, if necessary.
7425 if $test X"$prefix" != X"$installprefix"; then
7426         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7427 else
7428         installsitebin="$sitebinexp"
7429 fi
7430
7431 case "$useperlio" in
7432 $define|true|[yY]*)     dflt='y';;
7433 *) dflt='n';;
7434 esac
7435 cat <<EOM
7436
7437 Previous version of $package used the standard IO mechanisms as
7438 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
7439 alternate IO mechanisms via the PerlIO abstraction layer, but the
7440 stdio mechanism is still the default.  This abstraction layer can
7441 use AT&T's sfio (if you already have sfio installed) or regular stdio.
7442 Using PerlIO with sfio may cause problems with some extension modules.
7443
7444 If this doesn't make any sense to you, just accept the default '$dflt'.
7445 EOM
7446 rp='Use the experimental PerlIO abstraction layer?'
7447 . ./myread
7448 case "$ans" in
7449 y|Y) 
7450         val="$define"
7451         ;;     
7452 *)      
7453         echo "Ok, doing things the stdio way."
7454         val="$undef"
7455         ;;
7456 esac
7457 set useperlio
7458 eval $setvar 
7459
7460 case "$usesocks" in
7461 $define|true|[yY]*)
7462         case "$useperlio" in
7463         $define|true|[yY]*) ;;
7464         *)      cat >&4 <<EOM
7465
7466 You are using the SOCKS proxy protocol library which means that you
7467 should also use the PerlIO layer.  You may be headed for trouble.
7468
7469 EOM
7470                 ;;
7471         esac
7472         ;;
7473 esac
7474
7475         
7476 case "$vendorprefix" in
7477 '')     d_vendorbin="$undef"
7478         vendorbin=''
7479         vendorbinexp=''
7480         ;;
7481 *)      d_vendorbin="$define"
7482         : determine where vendor-supplied executables go.
7483         case "$vendorbin" in
7484         '') dflt=$vendorprefix/bin ;;
7485         *)      dflt="$vendorbin" ;;
7486         esac
7487         fn=d~+
7488         rp='Pathname for the vendor-supplied executables directory?'
7489         . ./getfile
7490         vendorbin="$ans"
7491         vendorbinexp="$ansexp"
7492         ;;
7493 esac
7494 : Change installation prefix, if necessary.
7495 if $test X"$prefix" != X"$installprefix"; then
7496         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7497 else
7498         installvendorbin="$vendorbinexp"
7499 fi
7500
7501 : see if qgcvt exists
7502 set qgcvt d_qgcvt
7503 eval $inlibc
7504
7505 echo " "
7506
7507 if $test X"$d_longdbl" = X"$define"; then
7508
7509 echo "Checking how to print long doubles..." >&4
7510
7511 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7512         $cat >try.c <<'EOCP'
7513 #include <sys/types.h>
7514 #include <stdio.h>
7515 int main() {
7516   double d = 123.456;
7517   printf("%.3f\n", d);
7518 }
7519 EOCP
7520         set try
7521         if eval $compile; then
7522                 yyy=`./try$exe_ext`
7523                 case "$yyy" in
7524                 123.456)
7525                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7526                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7527                         echo "We will use %f."
7528                         ;;
7529                 esac
7530         fi
7531 fi
7532
7533 if $test X"$sPRIfldbl" = X; then
7534         $cat >try.c <<'EOCP'
7535 #include <sys/types.h>
7536 #include <stdio.h>
7537 int main() {
7538   long double d = 123.456;
7539   printf("%.3llf\n", d);
7540 }
7541 EOCP
7542         set try
7543         if eval $compile; then
7544                 yyy=`./try$exe_ext`
7545                 case "$yyy" in
7546                 123.456)
7547                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7548                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7549                         echo "We will use %llf."
7550                         ;;
7551                 esac
7552         fi
7553 fi
7554
7555 if $test X"$sPRIfldbl" = X; then
7556         $cat >try.c <<'EOCP'
7557 #include <sys/types.h>
7558 #include <stdio.h>
7559 int main() {
7560   long double d = 123.456;
7561   printf("%.3Lf\n", d);
7562 }
7563 EOCP
7564         set try
7565         if eval $compile; then
7566                 yyy=`./try$exe_ext`
7567                 case "$yyy" in
7568                 123.456)
7569                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7570                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7571                         echo "We will use %Lf."
7572                         ;;
7573                 esac
7574         fi
7575 fi
7576
7577 if $test X"$sPRIfldbl" = X; then
7578         $cat >try.c <<'EOCP'
7579 #include <sys/types.h>
7580 #include <stdio.h>
7581 int main() {
7582   long double d = 123.456;
7583   printf("%.3lf\n", d);
7584 }
7585 EOCP
7586         set try
7587         if eval $compile; then
7588                 yyy=`./try$exe_ext`
7589                 case "$yyy" in
7590                 123.456)
7591                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7592                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7593                         echo "We will use %lf."
7594                         ;;
7595                 esac
7596         fi
7597 fi
7598
7599 if $test X"$sPRIfldbl" = X; then
7600         echo "Cannot figure out how to print long doubles." >&4
7601 else
7602         sSCNfldbl=$sPRIfldbl    # expect consistency
7603 fi
7604
7605 $rm -f try try.*
7606
7607 fi # d_longdbl
7608
7609 case "$sPRIfldbl" in
7610 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7611         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7612         d_SCNfldbl="$undef";
7613         ;;
7614 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7615         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7616         d_SCNfldbl="$define";
7617         ;;
7618 esac
7619
7620 : Check how to convert floats to strings.
7621 echo " "
7622 echo "Checking for an efficient way to convert floats to strings."
7623 echo " " > try.c
7624 case "$uselongdouble" in
7625 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7626 esac
7627 case "$d_longdbl" in
7628 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7629 esac
7630 case "$d_PRIgldbl" in
7631 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7632 esac
7633 $cat >>try.c <<EOP
7634 #ifdef TRY_gconvert
7635 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7636 char *myname = "gconvert";
7637 #endif
7638 #ifdef TRY_gcvt
7639 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7640 char *myname = "gcvt";
7641 #endif
7642 #ifdef TRY_qgcvt
7643 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7644 char *myname = "qgcvt";
7645 #define DOUBLETYPE long double
7646 #endif
7647 #ifdef TRY_sprintf
7648 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7649 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7650 #else
7651 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7652 #endif
7653 char *myname = "sprintf";
7654 #endif
7655
7656 #ifndef DOUBLETYPE
7657 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7658 #define DOUBLETYPE long double
7659 #else
7660 #define DOUBLETYPE double
7661 #endif
7662 #endif
7663
7664 #include <stdio.h>
7665
7666 #define I_STDLIB $i_stdlib
7667 #ifdef I_STDLIB
7668 #include <stdlib.h>
7669 #endif
7670
7671 int
7672 checkit(expect, got)
7673 char *expect;
7674 char *got;
7675 {
7676     if (strcmp(expect, got)) {
7677                 printf("%s oddity:  Expected %s, got %s\n",
7678                         myname, expect, got);
7679                 exit(1);
7680         }
7681 }
7682
7683 int main()
7684
7685         char buf[64]; 
7686         buf[63] = '\0';
7687
7688         /* This must be 1st test on (which?) platform */
7689         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7690         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7691         checkit("0.1", buf);
7692
7693         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7694         checkit("1", buf);
7695
7696         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7697         checkit("1.1", buf);
7698
7699         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7700         checkit("1.01", buf);
7701
7702         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7703         checkit("1.001", buf);
7704
7705         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7706         checkit("1.0001", buf);
7707
7708         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7709         checkit("1.00001", buf);
7710
7711         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7712         checkit("1.000001", buf);
7713
7714         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7715         checkit("0", buf);
7716
7717         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7718         checkit("-1", buf);
7719
7720         /* Some Linux gcvt's give 1.e+5 here. */
7721         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7722         checkit("100000", buf);
7723         
7724         /* Some Linux gcvt's give -1.e+5 here. */
7725         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7726         checkit("-100000", buf);
7727
7728         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7729         checkit("123.456", buf);
7730
7731         exit(0);
7732 }
7733 EOP
7734 case "$d_Gconvert" in
7735 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7736 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7737 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7738 *) xxx_list='gconvert gcvt sprintf' ;;
7739 esac
7740
7741 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7742 "$define$define$define")
7743     # for long doubles prefer first qgcvt, then sprintf
7744     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7745     xxx_list="sprintf $xxx_list"
7746     case "$d_qgcvt" in
7747     "$define") xxx_list="qgcvt $xxx_list" ;;
7748     esac
7749     ;;
7750 esac
7751
7752 for xxx_convert in $xxx_list; do
7753         echo "Trying $xxx_convert..."
7754         $rm -f try try$_o
7755         set try -DTRY_$xxx_convert
7756         if eval $compile; then
7757                 echo "$xxx_convert() found." >&4
7758                 if ./try; then
7759                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7760                         break;
7761                 else
7762                         echo "...But $xxx_convert didn't work as I expected."
7763                 fi
7764         else
7765                 echo "$xxx_convert NOT found." >&4
7766         fi
7767 done
7768         
7769 case "$xxx_convert" in
7770 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7771 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7772 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7773 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7774    "$define$define$define")
7775       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7776    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7777    esac
7778    ;;  
7779 esac
7780
7781 : see if _fwalk exists
7782 set fwalk d__fwalk
7783 eval $inlibc
7784
7785 : Initialize h_fcntl
7786 h_fcntl=false
7787
7788 : Initialize h_sysfile
7789 h_sysfile=false
7790
7791 : access call always available on UNIX
7792 set access d_access
7793 eval $inlibc
7794
7795 : locate the flags for 'access()'
7796 case "$d_access" in
7797 "$define")
7798         echo " "
7799         $cat >access.c <<'EOCP'
7800 #include <sys/types.h>
7801 #ifdef I_FCNTL
7802 #include <fcntl.h>
7803 #endif
7804 #ifdef I_SYS_FILE
7805 #include <sys/file.h>
7806 #endif
7807 #ifdef I_UNISTD
7808 #include <unistd.h>
7809 #endif
7810 int main() {
7811         exit(R_OK);
7812 }
7813 EOCP
7814         : check sys/file.h first, no particular reason here
7815         if $test `./findhdr sys/file.h` && \
7816                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7817                 h_sysfile=true;
7818                 echo "<sys/file.h> defines the *_OK access constants." >&4
7819         elif $test `./findhdr fcntl.h` && \
7820                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7821                 h_fcntl=true;
7822                 echo "<fcntl.h> defines the *_OK access constants." >&4
7823         elif $test `./findhdr unistd.h` && \
7824                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7825                 echo "<unistd.h> defines the *_OK access constants." >&4
7826         else
7827                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7828         fi
7829         ;;
7830 esac
7831 $rm -f access*
7832
7833 : see if accessx exists
7834 set accessx d_accessx
7835 eval $inlibc
7836
7837 : see if alarm exists
7838 set alarm d_alarm
7839 eval $inlibc
7840
7841 : see if atolf exists
7842 set atolf d_atolf
7843 eval $inlibc
7844
7845 : see if atoll exists
7846 set atoll d_atoll
7847 eval $inlibc
7848
7849 : Look for GNU-cc style attribute checking
7850 echo " "
7851 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7852 $cat >attrib.c <<'EOCP'
7853 #include <stdio.h>
7854 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7855 EOCP
7856 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7857         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7858                 echo "Your C compiler doesn't fully support __attribute__."
7859                 val="$undef"
7860         else
7861                 echo "Your C compiler supports __attribute__."
7862                 val="$define"
7863         fi
7864 else
7865         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7866         val="$undef"
7867 fi
7868 set d_attribut
7869 eval $setvar
7870 $rm -f attrib*
7871
7872 : see if bcmp exists
7873 set bcmp d_bcmp
7874 eval $inlibc
7875
7876 : see if bcopy exists
7877 set bcopy d_bcopy
7878 eval $inlibc
7879
7880 : see if this is a unistd.h system
7881 set unistd.h i_unistd
7882 eval $inhdr
7883
7884 : see if getpgrp exists
7885 set getpgrp d_getpgrp
7886 eval $inlibc
7887
7888 case "$d_getpgrp" in
7889 "$define")
7890         echo " "
7891         echo "Checking to see which flavor of getpgrp is in use..."
7892         $cat >set.c <<EOP
7893 #$i_unistd I_UNISTD
7894 #include <sys/types.h>
7895 #ifdef I_UNISTD
7896 #  include <unistd.h>
7897 #endif
7898 int main()
7899 {
7900         if (getuid() == 0) {
7901                 printf("(I see you are running Configure as super-user...)\n");
7902                 setuid(1);
7903         }
7904 #ifdef TRY_BSD_PGRP
7905         if (getpgrp(1) == 0)
7906                 exit(0);
7907 #else
7908         if (getpgrp() > 0)
7909                 exit(0);
7910 #endif
7911         exit(1);
7912 }
7913 EOP
7914         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7915                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7916                 val="$define"
7917         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7918                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7919                 val="$undef"
7920         else
7921                 echo "I can't seem to compile and run the test program."
7922                 if ./usg; then
7923                         xxx="a USG one, i.e. you use getpgrp()."
7924                 else
7925                         # SVR4 systems can appear rather BSD-ish.
7926                         case "$i_unistd" in
7927                         $undef)
7928                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7929                                 val="$define"
7930                                 ;;
7931                         $define)
7932                                 xxx="probably a USG one, i.e. you use getpgrp()."
7933                                 val="$undef"
7934                                 ;;
7935                         esac
7936                 fi
7937                 echo "Assuming your getpgrp is $xxx" >&4
7938         fi
7939         ;;
7940 *) val="$undef";;
7941 esac
7942 set d_bsdgetpgrp
7943 eval $setvar
7944 $rm -f set set.c
7945
7946 : see if setpgrp exists
7947 set setpgrp d_setpgrp
7948 eval $inlibc
7949
7950 case "$d_setpgrp" in
7951 "$define")
7952         echo " "
7953         echo "Checking to see which flavor of setpgrp is in use..."
7954         $cat >set.c <<EOP
7955 #$i_unistd I_UNISTD
7956 #include <sys/types.h>
7957 #ifdef I_UNISTD
7958 #  include <unistd.h>
7959 #endif
7960 int main()
7961 {
7962         if (getuid() == 0) {
7963                 printf("(I see you are running Configure as super-user...)\n");
7964                 setuid(1);
7965         }
7966 #ifdef TRY_BSD_PGRP
7967         if (-1 == setpgrp(1, 1))
7968                 exit(0);
7969 #else
7970         if (setpgrp() != -1)
7971                 exit(0);
7972 #endif
7973         exit(1);
7974 }
7975 EOP
7976         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7977                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7978                 val="$define"
7979         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7980                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7981                 val="$undef"
7982         else
7983                 echo "(I can't seem to compile and run the test program.)"
7984                 if ./usg; then
7985                         xxx="a USG one, i.e. you use setpgrp()."
7986                 else
7987                         # SVR4 systems can appear rather BSD-ish.
7988                         case "$i_unistd" in
7989                         $undef)
7990                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7991                                 val="$define"
7992                                 ;;
7993                         $define)
7994                                 xxx="probably a USG one, i.e. you use setpgrp()."
7995                                 val="$undef"
7996                                 ;;
7997                         esac
7998                 fi
7999                 echo "Assuming your setpgrp is $xxx" >&4
8000         fi
8001         ;;
8002 *) val="$undef";;
8003 esac
8004 set d_bsdsetpgrp
8005 eval $setvar
8006 $rm -f set set.c
8007 : see if bzero exists
8008 set bzero d_bzero
8009 eval $inlibc
8010
8011 : see if signal is declared as pointer to function returning int or void
8012 echo " "
8013 xxx=`./findhdr signal.h`
8014 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8015 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8016         echo "You have int (*signal())() instead of void." >&4
8017         val="$undef"
8018 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8019         echo "You have void (*signal())()." >&4
8020         val="$define"
8021 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8022         echo "You have int (*signal())() instead of void." >&4
8023         val="$undef"
8024 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8025         echo "You have void (*signal())()." >&4
8026         val="$define"
8027 else
8028         case "$d_voidsig" in
8029         '')
8030         echo "I can't determine whether signal handler returns void or int..." >&4
8031                 dflt=void
8032                 rp="What type does your signal handler return?"
8033                 . ./myread
8034                 case "$ans" in
8035                 v*) val="$define";;
8036                 *) val="$undef";;
8037                 esac;;
8038         "$define")
8039                 echo "As you already told me, signal handler returns void." >&4
8040                 val="$define"
8041                 ;;
8042         *)      echo "As you already told me, signal handler returns int." >&4
8043                 val="$undef"
8044                 ;;
8045         esac
8046 fi
8047 set d_voidsig
8048 eval $setvar
8049 case "$d_voidsig" in
8050 "$define") signal_t="void";;
8051 *) signal_t="int";;
8052 esac
8053 $rm -f $$.tmp
8054
8055 : check for ability to cast large floats to 32-bit ints.
8056 echo " "
8057 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8058 if $test "$intsize" -ge 4; then
8059         xxx=int
8060 else
8061         xxx=long
8062 fi
8063 $cat >try.c <<EOCP
8064 #include <stdio.h>
8065 #include <sys/types.h>
8066 #include <signal.h>
8067 $signal_t blech(s) int s; { exit(3); }
8068 int main()
8069 {
8070         $xxx i32;
8071         double f, g;
8072         int result = 0;
8073         char str[16];
8074         signal(SIGFPE, blech);
8075
8076         /* Don't let compiler optimize the test away.  Store the number 
8077            in a writable string for gcc to pass to sscanf under HP/UX.
8078         */
8079         sprintf(str, "2147483647");
8080         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8081         g = 10 * f;
8082         i32  = ($xxx) g;
8083
8084         /* x86 processors will probably give 0x8000 0000, which is a
8085        sign change.  We don't want that.  We want to mimic SPARC
8086            behavior here, which is to preserve the sign and give
8087            back 0x7fff ffff.
8088         */
8089         if (i32 != ($xxx) f)
8090                 result |= 1;
8091         exit(result);
8092 }
8093 EOCP
8094 set try
8095 if eval $compile_ok; then
8096         ./try
8097         yyy=$?
8098 else
8099         echo "(I can't seem to compile the test program--assuming it can't)"
8100         yyy=1
8101 fi
8102 case "$yyy" in
8103 0)      val="$define"
8104         echo "Yup, it can."
8105         ;;
8106 *)      val="$undef"
8107         echo "Nope, it can't."
8108         ;;
8109 esac
8110 set d_casti32
8111 eval $setvar
8112 $rm -f try try.*
8113
8114 : check for ability to cast negative floats to unsigned
8115 echo " "
8116 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8117 $cat >try.c <<EOCP
8118 #include <stdio.h>
8119 #include <sys/types.h>
8120 #include <signal.h>
8121 $signal_t blech(s) int s; { exit(7); }
8122 $signal_t blech_in_list(s) int s; { exit(4); }
8123 unsigned long dummy_long(p) unsigned long p; { return p; }
8124 unsigned int dummy_int(p) unsigned int p; { return p; }
8125 unsigned short dummy_short(p) unsigned short p; { return p; }
8126 int main()
8127 {
8128         double f;
8129         unsigned long along;
8130         unsigned int aint;
8131         unsigned short ashort;
8132         int result = 0;
8133         char str[16];
8134         
8135         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8136            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8137            optimized the whole file away
8138         */
8139         /* Store the number in a writable string for gcc to pass to 
8140            sscanf under HP/UX.
8141         */
8142         sprintf(str, "-123");
8143         sscanf(str, "%lf", &f);  /* f = -123.; */
8144
8145         signal(SIGFPE, blech);
8146         along = (unsigned long)f;
8147         aint = (unsigned int)f;
8148         ashort = (unsigned short)f;
8149         if (along != (unsigned long)-123)
8150                 result |= 1;
8151         if (aint != (unsigned int)-123)
8152                 result |= 1;
8153         if (ashort != (unsigned short)-123)
8154                 result |= 1;
8155         sprintf(str, "1073741824.");
8156         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8157         f = f + f;
8158         along = 0;
8159         along = (unsigned long)f;
8160         if (along != 0x80000000)
8161                 result |= 2;
8162         f -= 1.;
8163         along = 0;
8164         along = (unsigned long)f;
8165         if (along != 0x7fffffff)
8166                 result |= 1;
8167         f += 2.;
8168         along = 0;
8169         along = (unsigned long)f;
8170         if (along != 0x80000001)
8171                 result |= 2;
8172         if (result)
8173                 exit(result);
8174         signal(SIGFPE, blech_in_list);
8175         sprintf(str, "123.");
8176         sscanf(str, "%lf", &f);  /* f = 123.; */
8177         along = dummy_long((unsigned long)f);
8178         aint = dummy_int((unsigned int)f);
8179         ashort = dummy_short((unsigned short)f);
8180         if (along != (unsigned long)123)
8181                 result |= 4;
8182         if (aint != (unsigned int)123)
8183                 result |= 4;
8184         if (ashort != (unsigned short)123)
8185                 result |= 4;
8186         exit(result);
8187
8188 }
8189 EOCP
8190 set try
8191 if eval $compile_ok; then
8192         ./try
8193         castflags=$?
8194 else
8195         echo "(I can't seem to compile the test program--assuming it can't)"
8196         castflags=7
8197 fi
8198 case "$castflags" in
8199 0)      val="$define"
8200         echo "Yup, it can."
8201         ;;
8202 *)      val="$undef"
8203         echo "Nope, it can't."
8204         ;;
8205 esac
8206 set d_castneg
8207 eval $setvar
8208 $rm -f try.*
8209
8210 : see if vprintf exists
8211 echo " "
8212 if set vprintf val -f d_vprintf; eval $csym; $val; then
8213         echo 'vprintf() found.' >&4
8214         val="$define"
8215         $cat >vprintf.c <<'EOF'
8216 #include <varargs.h>
8217
8218 int main() { xxx("foo"); }
8219
8220 xxx(va_alist)
8221 va_dcl
8222 {
8223         va_list args;
8224         char buf[10];
8225
8226         va_start(args);
8227         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8228 }
8229 EOF
8230         set vprintf
8231         if eval $compile && ./vprintf; then
8232                 echo "Your vsprintf() returns (int)." >&4
8233                 val2="$undef"
8234         else
8235                 echo "Your vsprintf() returns (char*)." >&4
8236                 val2="$define"
8237         fi
8238 else
8239         echo 'vprintf() NOT found.' >&4
8240                 val="$undef"
8241                 val2="$undef"
8242 fi
8243 set d_vprintf
8244 eval $setvar
8245 val=$val2
8246 set d_charvspr
8247 eval $setvar
8248
8249 : see if chown exists
8250 set chown d_chown
8251 eval $inlibc
8252
8253 : see if chroot exists
8254 set chroot d_chroot
8255 eval $inlibc
8256
8257 : see if chsize exists
8258 set chsize d_chsize
8259 eval $inlibc
8260
8261 : check for const keyword
8262 echo " "
8263 echo 'Checking to see if your C compiler knows about "const"...' >&4
8264 $cat >const.c <<'EOCP'
8265 typedef struct spug { int drokk; } spug;
8266 int main()
8267 {
8268         const char *foo;
8269         const spug y;
8270 }
8271 EOCP
8272 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8273         val="$define"
8274         echo "Yup, it does."
8275 else
8276         val="$undef"
8277         echo "Nope, it doesn't."
8278 fi
8279 set d_const
8280 eval $setvar
8281
8282 : see if crypt exists
8283 echo " "
8284 if set crypt val -f d_crypt; eval $csym; $val; then
8285         echo 'crypt() found.' >&4
8286         val="$define"
8287         cryptlib=''
8288 else
8289         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8290         if $test -z "$cryptlib"; then
8291                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8292         else
8293                 cryptlib=-lcrypt
8294         fi
8295         if $test -z "$cryptlib"; then
8296                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8297         else
8298                 cryptlib=-lcrypt
8299         fi
8300         if $test -z "$cryptlib"; then
8301                 cryptlib=`./loc libcrypt$_a "" $libpth`
8302         else
8303                 cryptlib=-lcrypt
8304         fi
8305         if $test -z "$cryptlib"; then
8306                 echo 'crypt() NOT found.' >&4
8307                 val="$undef"
8308         else
8309                 val="$define"
8310         fi
8311 fi
8312 set d_crypt
8313 eval $setvar
8314
8315 : get csh whereabouts
8316 case "$csh" in
8317 'csh') val="$undef" ;;
8318 *) val="$define" ;;
8319 esac
8320 set d_csh
8321 eval $setvar
8322 : Respect a hint or command line value for full_csh.
8323 case "$full_csh" in
8324 '') full_csh=$csh ;;
8325 esac
8326
8327 : see if cuserid exists
8328 set cuserid d_cuserid
8329 eval $inlibc
8330
8331 : see if this is a limits.h system
8332 set limits.h i_limits
8333 eval $inhdr
8334
8335 : see if this is a float.h system
8336 set float.h i_float
8337 eval $inhdr
8338
8339 : See if number of significant digits in a double precision number is known
8340 echo " "
8341 $cat >dbl_dig.c <<EOM
8342 #$i_limits I_LIMITS
8343 #$i_float I_FLOAT
8344 #ifdef I_LIMITS
8345 #include <limits.h>
8346 #endif
8347 #ifdef I_FLOAT
8348 #include <float.h>
8349 #endif
8350 #ifdef DBL_DIG
8351 printf("Contains DBL_DIG");
8352 #endif
8353 EOM
8354 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8355 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8356         echo "DBL_DIG found." >&4
8357         val="$define"
8358 else
8359         echo "DBL_DIG NOT found." >&4
8360         val="$undef"
8361 fi
8362 $rm -f dbl_dig.?
8363 set d_dbl_dig
8364 eval $setvar
8365
8366 : see if difftime exists
8367 set difftime d_difftime
8368 eval $inlibc
8369
8370 : see if this is a dirent system
8371 echo " "
8372 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8373         val="$define"
8374         echo "<dirent.h> found." >&4
8375 else
8376         val="$undef"
8377         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8378                 echo "<sys/dir.h> found." >&4
8379                 echo " "
8380         else
8381                 xinc=`./findhdr sys/ndir.h`
8382         fi
8383         echo "<dirent.h> NOT found." >&4
8384 fi
8385 set i_dirent
8386 eval $setvar
8387
8388 : Look for type of directory structure.
8389 echo " "
8390 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8391
8392 case "$direntrytype" in
8393 ''|' ')
8394         case "$i_dirent" in
8395         $define) guess1='struct dirent' ;;
8396         *) guess1='struct direct'  ;;
8397         esac
8398         ;;
8399 *)      guess1="$direntrytype"
8400         ;;
8401 esac
8402
8403 case "$guess1" in
8404 'struct dirent') guess2='struct direct' ;;
8405 *) guess2='struct dirent' ;;
8406 esac
8407                 
8408 if $contains "$guess1" try.c >/dev/null 2>&1; then
8409         direntrytype="$guess1"
8410         echo "Your directory entries are $direntrytype." >&4
8411 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8412         direntrytype="$guess2"
8413         echo "Your directory entries seem to be $direntrytype." >&4
8414 else
8415         echo "I don't recognize your system's directory entries." >&4
8416         rp="What type is used for directory entries on this system?"
8417         dflt="$guess1"
8418         . ./myread
8419         direntrytype="$ans"
8420 fi
8421 $rm -f try.c
8422
8423
8424 : see if the directory entry stores field length
8425 echo " "
8426 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8427 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8428         echo "Good, your directory entry keeps length information in d_namlen." >&4
8429         val="$define"
8430 else
8431         echo "Your directory entry does not know about the d_namlen field." >&4
8432         val="$undef"
8433 fi
8434 set d_dirnamlen
8435 eval $setvar
8436 $rm -f try.c
8437
8438 : see if dlerror exists
8439 xxx_runnm="$runnm"
8440 runnm=false
8441 set dlerror d_dlerror
8442 eval $inlibc
8443 runnm="$xxx_runnm"
8444
8445 : see if dlfcn is available
8446 set dlfcn.h i_dlfcn
8447 eval $inhdr
8448
8449 case "$usedl" in
8450 $define|y|true)
8451         $cat << EOM
8452
8453 On a few systems, the dynamically loaded modules that perl generates and uses
8454 will need a different extension than shared libs. The default will probably
8455 be appropriate.
8456
8457 EOM
8458         case "$dlext" in
8459         '')     dflt="$so" ;;
8460         *)      dflt="$dlext" ;;
8461         esac
8462         rp='What is the extension of dynamically loaded modules'
8463         . ./myread
8464         dlext="$ans"
8465         ;;
8466 *)
8467         dlext="none"
8468         ;;
8469 esac
8470
8471 : Check if dlsym need a leading underscore
8472 echo " "
8473 val="$undef"
8474
8475 case "$dlsrc" in
8476 dl_dlopen.xs)
8477         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8478         $cat >dyna.c <<'EOM'
8479 fred () { }
8480 EOM
8481
8482 $cat >fred.c<<EOM
8483
8484 #include <stdio.h>
8485 #$i_dlfcn I_DLFCN
8486 #ifdef I_DLFCN
8487 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8488 #else
8489 #include <sys/types.h>
8490 #include <nlist.h>
8491 #include <link.h>
8492 #endif
8493
8494 extern int fred() ;
8495
8496 int main()
8497 {
8498     void * handle ;
8499     void * symbol ;
8500 #ifndef RTLD_LAZY
8501     int mode = 1 ;
8502 #else
8503     int mode = RTLD_LAZY ;
8504 #endif
8505     handle = dlopen("./dyna.$dlext", mode) ;
8506     if (handle == NULL) {
8507         printf ("1\n") ;
8508         fflush (stdout) ;
8509         exit(0);
8510     }
8511     symbol = dlsym(handle, "fred") ;
8512     if (symbol == NULL) {
8513         /* try putting a leading underscore */
8514         symbol = dlsym(handle, "_fred") ;
8515         if (symbol == NULL) {
8516             printf ("2\n") ;
8517             fflush (stdout) ;
8518             exit(0);
8519         }
8520         printf ("3\n") ;
8521     }
8522     else
8523         printf ("4\n") ;
8524     fflush (stdout) ;
8525     exit(0);
8526 }
8527 EOM
8528         : Call the object file tmp-dyna.o in case dlext=o.
8529         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8530                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8531                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8532                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8533                 xxx=`./fred`
8534                 case $xxx in
8535                 1)      echo "Test program failed using dlopen." >&4
8536                         echo "Perhaps you should not use dynamic loading." >&4;;
8537                 2)      echo "Test program failed using dlsym." >&4
8538                         echo "Perhaps you should not use dynamic loading." >&4;;
8539                 3)      echo "dlsym needs a leading underscore" >&4
8540                         val="$define" ;;
8541                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8542                 esac
8543         else
8544                 echo "I can't compile and run the test program." >&4
8545                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8546         fi
8547         ;;
8548 esac
8549                 
8550 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8551
8552 set d_dlsymun
8553 eval $setvar
8554
8555 hasproto='varname=$1; func=$2; shift; shift;
8556 while $test $# -ge 2; do
8557         case "$1" in
8558         $define) echo "#include <$2>";;
8559         esac ;
8560     shift 2;
8561 done > try.c;
8562 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8563 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8564         echo "$func() prototype found.";
8565         val="$define";
8566 else
8567         echo "$func() prototype NOT found.";
8568         val="$undef";
8569 fi;
8570 set $varname;
8571 eval $setvar;
8572 $rm -f try.c tryout.c'
8573
8574 : see if prototype for drand48 is available
8575 echo " "
8576 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8577 eval $hasproto
8578
8579 : see if dup2 exists
8580 set dup2 d_dup2
8581 eval $inlibc
8582
8583 : see if eaccess exists
8584 set eaccess d_eaccess
8585 eval $inlibc
8586
8587 : see if endgrent exists
8588 set endgrent d_endgrent
8589 eval $inlibc
8590
8591 : see if endhostent exists
8592 set endhostent d_endhent
8593 eval $inlibc
8594
8595 : see if endnetent exists
8596 set endnetent d_endnent
8597 eval $inlibc
8598
8599 : see if endprotoent exists
8600 set endprotoent d_endpent
8601 eval $inlibc
8602
8603 : see if endpwent exists
8604 set endpwent d_endpwent
8605 eval $inlibc
8606
8607 : see if endservent exists
8608 set endservent d_endsent
8609 eval $inlibc
8610
8611 : Locate the flags for 'open()'
8612 echo " "
8613 $cat >open3.c <<'EOCP'
8614 #include <sys/types.h>
8615 #ifdef I_FCNTL
8616 #include <fcntl.h>
8617 #endif
8618 #ifdef I_SYS_FILE
8619 #include <sys/file.h>
8620 #endif
8621 int main() {
8622         if(O_RDONLY);
8623 #ifdef O_TRUNC
8624         exit(0);
8625 #else
8626         exit(1);
8627 #endif
8628 }
8629 EOCP
8630 : check sys/file.h first to get FREAD on Sun
8631 if $test `./findhdr sys/file.h` && \
8632                 set open3 -DI_SYS_FILE && eval $compile; then
8633         h_sysfile=true;
8634         echo "<sys/file.h> defines the O_* constants..." >&4
8635         if ./open3; then
8636                 echo "and you have the 3 argument form of open()." >&4
8637                 val="$define"
8638         else
8639                 echo "but not the 3 argument form of open().  Oh, well." >&4
8640                 val="$undef"
8641         fi
8642 elif $test `./findhdr fcntl.h` && \
8643                 set open3 -DI_FCNTL && eval $compile; then
8644         h_fcntl=true;
8645         echo "<fcntl.h> defines the O_* constants..." >&4
8646         if ./open3; then
8647                 echo "and you have the 3 argument form of open()." >&4
8648                 val="$define"
8649         else
8650                 echo "but not the 3 argument form of open().  Oh, well." >&4
8651                 val="$undef"
8652         fi
8653 else
8654         val="$undef"
8655         echo "I can't find the O_* constant definitions!  You got problems." >&4
8656 fi
8657 set d_open3
8658 eval $setvar
8659 $rm -f open3*
8660
8661 : see which of string.h or strings.h is needed
8662 echo " "
8663 strings=`./findhdr string.h`
8664 if $test "$strings" && $test -r "$strings"; then
8665         echo "Using <string.h> instead of <strings.h>." >&4
8666         val="$define"
8667 else
8668         val="$undef"
8669         strings=`./findhdr strings.h`
8670         if $test "$strings" && $test -r "$strings"; then
8671                 echo "Using <strings.h> instead of <string.h>." >&4
8672         else
8673                 echo "No string header found -- You'll surely have problems." >&4
8674         fi
8675 fi
8676 set i_string
8677 eval $setvar
8678 case "$i_string" in
8679 "$undef") strings=`./findhdr strings.h`;;
8680 *)        strings=`./findhdr string.h`;;
8681 esac
8682
8683 : check for non-blocking I/O stuff
8684 case "$h_sysfile" in
8685 true) echo "#include <sys/file.h>" > head.c;;
8686 *)
8687         case "$h_fcntl" in
8688         true) echo "#include <fcntl.h>" > head.c;;
8689         *) echo "#include <sys/fcntl.h>" > head.c;;
8690         esac
8691         ;;
8692 esac
8693 echo " "
8694 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8695 case "$o_nonblock" in
8696 '')
8697         $cat head.c > try.c
8698         $cat >>try.c <<'EOCP'
8699 #include <stdio.h>
8700 int main() {
8701 #ifdef O_NONBLOCK
8702         printf("O_NONBLOCK\n");
8703         exit(0);
8704 #endif
8705 #ifdef O_NDELAY
8706         printf("O_NDELAY\n");
8707         exit(0);
8708 #endif
8709 #ifdef FNDELAY
8710         printf("FNDELAY\n");
8711         exit(0);
8712 #endif
8713         exit(0);
8714 }
8715 EOCP
8716         set try
8717         if eval $compile_ok; then
8718                 o_nonblock=`./try`
8719                 case "$o_nonblock" in
8720                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8721                 *) echo "Seems like we can use $o_nonblock.";;
8722                 esac
8723         else
8724                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8725         fi
8726         ;;
8727 *) echo "Using $hint value $o_nonblock.";;
8728 esac
8729 $rm -f try try.* .out core
8730
8731 echo " "
8732 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8733 case "$eagain" in
8734 '')
8735         $cat head.c > try.c
8736         $cat >>try.c <<EOCP
8737 #include <errno.h>
8738 #include <sys/types.h>
8739 #include <signal.h>
8740 #include <stdio.h> 
8741 #define MY_O_NONBLOCK $o_nonblock
8742 #ifndef errno  /* XXX need better Configure test */
8743 extern int errno;
8744 #endif
8745 #$i_unistd I_UNISTD
8746 #ifdef I_UNISTD
8747 #include <unistd.h>
8748 #endif
8749 #$i_string I_STRING
8750 #ifdef I_STRING
8751 #include <string.h>
8752 #else
8753 #include <strings.h>
8754 #endif
8755 $signal_t blech(x) int x; { exit(3); }
8756 EOCP
8757         $cat >> try.c <<'EOCP'
8758 int main()
8759 {
8760         int pd[2];
8761         int pu[2];
8762         char buf[1];
8763         char string[100];
8764
8765         pipe(pd);       /* Down: child -> parent */
8766         pipe(pu);       /* Up: parent -> child */
8767         if (0 != fork()) {
8768                 int ret;
8769                 close(pd[1]);   /* Parent reads from pd[0] */
8770                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8771                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8772                         exit(1);
8773                 signal(SIGALRM, blech);
8774                 alarm(5);
8775                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8776                         exit(2);
8777                 sprintf(string, "%d\n", ret);
8778                 write(2, string, strlen(string));
8779                 alarm(0);
8780 #ifdef EAGAIN
8781                 if (errno == EAGAIN) {
8782                         printf("EAGAIN\n");
8783                         goto ok;
8784                 }
8785 #endif
8786 #ifdef EWOULDBLOCK
8787                 if (errno == EWOULDBLOCK)
8788                         printf("EWOULDBLOCK\n");
8789 #endif
8790         ok:
8791                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8792                 sleep(2);                               /* Give it time to close our pipe */
8793                 alarm(5);
8794                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8795                 alarm(0);
8796                 sprintf(string, "%d\n", ret);
8797                 write(3, string, strlen(string));
8798                 exit(0);
8799         }
8800
8801         close(pd[0]);                   /* We write to pd[1] */
8802         close(pu[1]);                   /* We read from pu[0] */
8803         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8804         close(pd[1]);                   /* Pipe pd is now fully closed! */
8805         exit(0);                                /* Bye bye, thank you for playing! */
8806 }
8807 EOCP
8808         set try
8809         if eval $compile_ok; then
8810                 echo "$startsh" >mtry
8811                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8812                 chmod +x mtry
8813                 ./mtry >/dev/null 2>&1
8814                 case $? in
8815                 0) eagain=`$cat try.out`;;
8816                 1) echo "Could not perform non-blocking setting!";;
8817                 2) echo "I did a successful read() for something that was not there!";;
8818                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8819                 *) echo "Something terribly wrong happened during testing.";;
8820                 esac
8821                 rd_nodata=`$cat try.ret`
8822                 echo "A read() system call with no data present returns $rd_nodata."
8823                 case "$rd_nodata" in
8824                 0|-1) ;;
8825                 *)
8826                         echo "(That's peculiar, fixing that to be -1.)"
8827                         rd_nodata=-1
8828                         ;;
8829                 esac
8830                 case "$eagain" in
8831                 '')
8832                         echo "Forcing errno EAGAIN on read() with no data available."
8833                         eagain=EAGAIN
8834                         ;;
8835                 *)
8836                         echo "Your read() sets errno to $eagain when no data is available."
8837                         ;;
8838                 esac
8839                 status=`$cat try.err`
8840                 case "$status" in
8841                 0) echo "And it correctly returns 0 to signal EOF.";;
8842                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8843                 *) echo "However, your read() returns '$status' on EOF??";;
8844                 esac
8845                 val="$define"
8846                 if test "$status" = "$rd_nodata"; then
8847                         echo "WARNING: you can't distinguish between EOF and no data!"
8848                         val="$undef"
8849                 fi
8850         else
8851                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8852                 eagain=EAGAIN
8853         fi
8854         set d_eofnblk
8855         eval $setvar
8856         ;;
8857 *)
8858         echo "Using $hint value $eagain."
8859         echo "Your read() returns $rd_nodata when no data is present."
8860         case "$d_eofnblk" in
8861         "$define") echo "And you can see EOF because read() returns 0.";;
8862         "$undef") echo "But you can't see EOF status from read() returned value.";;
8863         *)
8864                 echo "(Assuming you can't see EOF status from read anyway.)"
8865                 d_eofnblk=$undef
8866                 ;;
8867         esac
8868         ;;
8869 esac
8870 $rm -f try try.* .out core head.c mtry
8871
8872 : see if fchmod exists
8873 set fchmod d_fchmod
8874 eval $inlibc
8875
8876 : see if fchown exists
8877 set fchown d_fchown
8878 eval $inlibc
8879
8880 : see if this is an fcntl system
8881 set fcntl d_fcntl
8882 eval $inlibc
8883
8884 echo " "
8885 : See if fcntl-based locking works.
8886 $cat >try.c <<'EOCP'
8887 #include <stdlib.h>
8888 #include <unistd.h>
8889 #include <fcntl.h>
8890 int main() {
8891 #if defined(F_SETLK) && defined(F_SETLKW)
8892      struct flock flock;
8893      int retval, fd;
8894      fd = open("try.c", O_RDONLY);
8895      flock.l_type = F_RDLCK;
8896      flock.l_whence = SEEK_SET;
8897      flock.l_start = flock.l_len = 0;
8898      retval = fcntl(fd, F_SETLK, &flock);
8899      close(fd);
8900      (retval < 0 ? exit(2) : exit(0));
8901 #else
8902      exit(2);
8903 #endif
8904 }
8905 EOCP
8906 echo "Checking if fcntl-based file locking works... "
8907 case "$d_fcntl" in
8908 "$define")
8909         set try
8910         if eval $compile_ok; then
8911                 if ./try; then
8912                         echo "Yes, it seems to work."
8913                         val="$define"
8914                 else
8915                         echo "Nope, it didn't work."
8916                         val="$undef"
8917                 fi
8918         else
8919                 echo "I'm unable to compile the test program, so I'll assume not."
8920                 val="$undef"
8921         fi
8922         ;;
8923 *) val="$undef";
8924         echo "Nope, since you don't even have fcntl()."
8925         ;;
8926 esac
8927 set d_fcntl_can_lock
8928 eval $setvar
8929 $rm -f try*
8930
8931
8932 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8933 while $test $# -ge 2; do
8934         case "$1" in
8935         $define) echo "#include <$2>";;
8936         esac ;
8937     shift 2;
8938 done > try.c;
8939 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8940 set try;
8941 if eval $compile; then
8942         val="$define";
8943 else
8944         val="$undef";
8945 fi;
8946 set $varname;
8947 eval $setvar;
8948 $rm -f try.c try.o'
8949
8950 socketlib=''
8951 sockethdr=''
8952 : see whether socket exists
8953 echo " "
8954 $echo $n "Hmm... $c" >&4
8955 if set socket val -f d_socket; eval $csym; $val; then
8956         echo "Looks like you have Berkeley networking support." >&4
8957         d_socket="$define"
8958         if set setsockopt val -f; eval $csym; $val; then
8959                 d_oldsock="$undef"
8960         else
8961                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8962                 d_oldsock="$define"
8963         fi
8964 else
8965         if $contains socklib libc.list >/dev/null 2>&1; then
8966                 echo "Looks like you have Berkeley networking support." >&4
8967                 d_socket="$define"
8968                 : we will have to assume that it supports the 4.2 BSD interface
8969                 d_oldsock="$undef"
8970         else
8971                 echo "You don't have Berkeley networking in libc$_a..." >&4
8972                 if test "X$d_socket" = "X$define"; then
8973                    echo "...but you seem to believe that you have sockets." >&4
8974                 else
8975                         for net in net socket
8976                         do
8977                                 if test -f /usr/lib/lib$net$_a; then
8978                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8979                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8980                                         if $contains socket libc.list >/dev/null 2>&1; then
8981                                                 d_socket="$define"
8982                                                 socketlib="-l$net"
8983                                                 case "$net" in
8984                                                 net)
8985                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8986                                                         sockethdr="-I/usr/netinclude"
8987                                                         ;;
8988                                                 esac
8989                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8990                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8991                                                         d_oldsock="$undef"
8992                                                 else
8993                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8994                                                         d_oldsock="$define"
8995                                                 fi
8996                                                 break
8997                                         fi
8998                                 fi
8999                         done
9000                         if test "X$d_socket" != "X$define"; then
9001                            echo "or anywhere else I see." >&4
9002                            d_socket="$undef"
9003                            d_oldsock="$undef"
9004                         fi
9005                 fi
9006         fi
9007 fi
9008
9009 : see if socketpair exists
9010 set socketpair d_sockpair
9011 eval $inlibc
9012
9013
9014 echo " "
9015 echo "Checking the availability of certain socket constants..." >& 4
9016 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9017         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9018         $cat >try.c <<EOF
9019 #include <sys/types.h>
9020 #include <sys/socket.h>
9021 int main() {
9022     int i = $ENUM;
9023 }
9024 EOF
9025         val="$undef"
9026         set try; if eval $compile; then
9027                 val="$define"
9028         fi
9029         set d_${enum}; eval $setvar
9030         $rm -f try.c try
9031 done
9032
9033 : see if sys/select.h has to be included
9034 set sys/select.h i_sysselct
9035 eval $inhdr
9036
9037 : see if we should include time.h, sys/time.h, or both
9038 echo " "
9039 if test "X$timeincl" = X; then
9040         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9041         $echo $n "I'm now running the test program...$c"
9042         $cat >try.c <<'EOCP'
9043 #include <sys/types.h>
9044 #ifdef I_TIME
9045 #include <time.h>
9046 #endif
9047 #ifdef I_SYSTIME
9048 #ifdef SYSTIMEKERNEL
9049 #define KERNEL
9050 #endif
9051 #include <sys/time.h>
9052 #endif
9053 #ifdef I_SYSSELECT
9054 #include <sys/select.h>
9055 #endif
9056 int main()
9057 {
9058         struct tm foo;
9059 #ifdef S_TIMEVAL
9060         struct timeval bar;
9061 #endif
9062 #ifdef S_TIMEZONE
9063         struct timezone tzp;
9064 #endif
9065         if (foo.tm_sec == foo.tm_sec)
9066                 exit(0);
9067 #ifdef S_TIMEVAL
9068         if (bar.tv_sec == bar.tv_sec)
9069                 exit(0);
9070 #endif
9071         exit(1);
9072 }
9073 EOCP
9074         flags=''
9075         for s_timezone in '-DS_TIMEZONE' ''; do
9076         sysselect=''
9077         for s_timeval in '-DS_TIMEVAL' ''; do
9078         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9079         for i_time in '' '-DI_TIME'; do
9080         for i_systime in '-DI_SYSTIME' ''; do
9081                 case "$flags" in
9082                 '') $echo $n ".$c"
9083                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9084                         if eval $compile; then
9085                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9086                                 shift
9087                                 flags="$*"
9088                                 echo " "
9089                                 $echo $n "Succeeded with $flags$c"
9090                         fi
9091                         ;;
9092                 esac
9093         done
9094         done
9095         done
9096         done
9097         done
9098         timeincl=''
9099         echo " "
9100         case "$flags" in
9101         *SYSTIMEKERNEL*) i_systimek="$define"
9102                 timeincl=`./findhdr sys/time.h`
9103                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9104         *) i_systimek="$undef";;
9105         esac
9106         case "$flags" in
9107         *I_TIME*) i_time="$define"
9108                 timeincl=`./findhdr time.h`" $timeincl"
9109                 echo "We'll include <time.h>." >&4;;
9110         *) i_time="$undef";;
9111         esac
9112         case "$flags" in
9113         *I_SYSTIME*) i_systime="$define"
9114                 timeincl=`./findhdr sys/time.h`" $timeincl"
9115                 echo "We'll include <sys/time.h>." >&4;;
9116         *) i_systime="$undef";;
9117         esac
9118         $rm -f try.c try
9119 fi
9120
9121 : check for fd_set items
9122 $cat <<EOM
9123
9124 Checking to see how well your C compiler handles fd_set and friends ...
9125 EOM
9126 $cat >fd_set.c <<EOCP
9127 #$i_systime I_SYS_TIME
9128 #$i_sysselct I_SYS_SELECT
9129 #$d_socket HAS_SOCKET
9130 #include <sys/types.h>
9131 #ifdef HAS_SOCKET
9132 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9133 #endif
9134 #ifdef I_SYS_TIME
9135 #include <sys/time.h>
9136 #endif
9137 #ifdef I_SYS_SELECT
9138 #include <sys/select.h>
9139 #endif
9140 int main() {
9141         fd_set fds;
9142
9143 #ifdef TRYBITS
9144         if(fds.fds_bits);
9145 #endif
9146
9147 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9148         exit(0);
9149 #else
9150         exit(1);
9151 #endif
9152 }
9153 EOCP
9154 set fd_set -DTRYBITS
9155 if eval $compile; then
9156         d_fds_bits="$define"
9157         d_fd_set="$define"
9158         echo "Well, your system knows about the normal fd_set typedef..." >&4
9159         if ./fd_set; then
9160                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9161                 d_fd_macros="$define"
9162         else
9163                 $cat >&4 <<'EOM'
9164 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9165 EOM
9166                 d_fd_macros="$undef"
9167         fi
9168 else
9169         $cat <<'EOM'
9170 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9171 EOM
9172         set fd_set
9173         if eval $compile; then
9174                 d_fds_bits="$undef"
9175                 d_fd_set="$define"
9176                 echo "Well, your system has some sort of fd_set available..." >&4
9177                 if ./fd_set; then
9178                         echo "and you have the normal fd_set macros." >&4
9179                         d_fd_macros="$define"
9180                 else
9181                         $cat <<'EOM'
9182 but not the normal fd_set macros!  Gross!  More work for me...
9183 EOM
9184                         d_fd_macros="$undef"
9185                 fi
9186         else
9187         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9188                 d_fd_set="$undef"
9189                 d_fds_bits="$undef"
9190                 d_fd_macros="$undef"
9191         fi
9192 fi
9193 $rm -f fd_set*
9194
9195 : see if fgetpos exists
9196 set fgetpos d_fgetpos
9197 eval $inlibc
9198
9199 : see if flock exists
9200 set flock d_flock
9201 eval $inlibc
9202
9203 : see if fork exists
9204 set fork d_fork
9205 eval $inlibc
9206
9207 : see if pathconf exists
9208 set pathconf d_pathconf
9209 eval $inlibc
9210
9211 : see if fpathconf exists
9212 set fpathconf d_fpathconf
9213 eval $inlibc
9214
9215
9216 : check for fpos64_t
9217 echo " "
9218 echo "Checking to see if you have fpos64_t..." >&4
9219 $cat >try.c <<EOCP
9220 #include <stdio.h>
9221 int main() { fpos64_t x = 7; }
9222 EOCP
9223 set try
9224 if eval $compile; then
9225         val="$define"
9226         echo "You have fpos64_t."
9227 else
9228         val="$undef"
9229         echo "You do not have fpos64_t."
9230         case "$fpossize" in
9231         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9232         esac
9233 fi
9234 $rm -f try.* try
9235 set d_fpos64_t
9236 eval $setvar
9237
9238 : see if frexpl exists
9239 set frexpl d_frexpl
9240 eval $inlibc
9241
9242 hasstruct='varname=$1; struct=$2; shift; shift;
9243 while $test $# -ge 2; do
9244         case "$1" in
9245         $define) echo "#include <$2>";;
9246         esac ;
9247     shift 2;
9248 done > try.c;
9249 echo "int main () { struct $struct foo; }" >> try.c;
9250 set try;
9251 if eval $compile; then
9252         val="$define";
9253 else
9254         val="$undef";
9255 fi;
9256 set $varname;
9257 eval $setvar;
9258 $rm -f try.c try.o'
9259
9260 : see if this is a sys/param system
9261 set sys/param.h i_sysparam
9262 eval $inhdr
9263
9264 : see if this is a sys/mount.h system
9265 set sys/mount.h i_sysmount
9266 eval $inhdr
9267
9268 : see if sys/types.h has to be included
9269 set sys/types.h i_systypes
9270 eval $inhdr
9271
9272
9273 echo " "
9274 echo "Checking to see if your system supports struct fs_data..." >&4
9275 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9276 eval $hasstruct
9277 case "$d_fs_data_s" in
9278 "$define")      echo "Yes, it does."   ;;
9279 *)              echo "No, it doesn't." ;;
9280 esac
9281
9282 : see if fseeko exists
9283 set fseeko d_fseeko
9284 eval $inlibc
9285 case "$longsize" in
9286 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9287 esac
9288
9289 : see if fsetpos exists
9290 set fsetpos d_fsetpos
9291 eval $inlibc
9292
9293
9294 : see if fstatfs exists
9295 set fstatfs d_fstatfs
9296 eval $inlibc
9297
9298
9299 : see if statvfs exists
9300 set statvfs d_statvfs
9301 eval $inlibc
9302
9303 : see if fstatvfs exists
9304 set fstatvfs d_fstatvfs
9305 eval $inlibc
9306
9307
9308 : see if fsync exists
9309 set fsync d_fsync
9310 eval $inlibc
9311
9312 : see if ftello exists
9313 set ftello d_ftello
9314 eval $inlibc
9315 case "$longsize" in
9316 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9317 esac
9318
9319 : see if getcwd exists
9320 set getcwd d_getcwd
9321 eval $inlibc
9322
9323 : see if getespwnam exists
9324 set getespwnam d_getespwnam
9325 eval $inlibc
9326
9327
9328 : see if getfsstat exists
9329 set getfsstat d_getfsstat
9330 eval $inlibc
9331
9332 : see if getgrent exists
9333 set getgrent d_getgrent
9334 eval $inlibc
9335
9336 : see if gethostbyaddr exists
9337 set gethostbyaddr d_gethbyaddr
9338 eval $inlibc
9339
9340 : see if gethostbyname exists
9341 set gethostbyname d_gethbyname
9342 eval $inlibc
9343
9344 : see if gethostent exists
9345 set gethostent d_gethent
9346 eval $inlibc
9347
9348 : see how we will look up host name
9349 echo " "
9350 call=''
9351 if set gethostname val -f d_gethname; eval $csym; $val; then
9352         echo 'gethostname() found.' >&4
9353         d_gethname="$define"
9354         call=gethostname
9355 fi
9356 if set uname val -f d_uname; eval $csym; $val; then
9357         if ./xenix; then
9358                 $cat <<'EOM'
9359 uname() was found, but you're running xenix, and older versions of xenix
9360 have a broken uname(). If you don't really know whether your xenix is old
9361 enough to have a broken system call, use the default answer.
9362
9363 EOM
9364                 dflt=y
9365                 case "$d_uname" in
9366                 "$define") dflt=n;;
9367                 esac
9368                 rp='Is your uname() broken?'
9369                 . ./myread
9370                 case "$ans" in
9371                 n*) d_uname="$define"; call=uname;;
9372                 esac
9373         else
9374                 echo 'uname() found.' >&4
9375                 d_uname="$define"
9376                 case "$call" in
9377                 '') call=uname ;;
9378                 esac
9379         fi
9380 fi
9381 case "$d_gethname" in
9382 '') d_gethname="$undef";;
9383 esac
9384 case "$d_uname" in
9385 '') d_uname="$undef";;
9386 esac
9387 case "$d_uname$d_gethname" in
9388 *define*)
9389         dflt=n
9390         cat <<EOM
9391  
9392 Every now and then someone has a $call() that lies about the hostname
9393 but can't be fixed for political or economic reasons.  If you wish, I can
9394 pretend $call() isn't there and maybe compute hostname at run-time
9395 thanks to the '$phostname' command.
9396
9397 EOM
9398         rp="Shall I ignore $call() from now on?"
9399         . ./myread
9400         case "$ans" in
9401         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9402         esac;;
9403 esac
9404 case "$phostname" in
9405 '') aphostname='';;
9406 *) case "$aphostname" in
9407         /*) ;;
9408         *) set X $phostname
9409                 shift
9410                 file=$1
9411                 shift
9412                 file=`./loc $file $file $pth`
9413                 aphostname=`echo $file $*`
9414                 ;;
9415         esac
9416         ;;
9417 esac
9418 case "$d_uname$d_gethname" in
9419 *define*) ;;
9420 *)
9421         case "$phostname" in
9422         '')
9423                 echo "There will be no way for $package to get your hostname." >&4;;
9424         *)
9425         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9426                 ;;
9427         esac;;
9428 esac
9429 case "$d_phostname" in
9430 '') d_phostname="$undef";;
9431 esac
9432
9433 : see if this is a netdb.h system
9434 set netdb.h i_netdb
9435 eval $inhdr
9436
9437 : see if prototypes for various gethostxxx netdb.h functions are available
9438 echo " "
9439 set d_gethostprotos gethostent $i_netdb netdb.h
9440 eval $hasproto
9441
9442 : see if getlogin exists
9443 set getlogin d_getlogin
9444 eval $inlibc
9445
9446 : see if getmnt exists
9447 set getmnt d_getmnt
9448 eval $inlibc
9449
9450 : see if getmntent exists
9451 set getmntent d_getmntent
9452 eval $inlibc
9453
9454 : see if getnetbyaddr exists
9455 set getnetbyaddr d_getnbyaddr
9456 eval $inlibc
9457
9458 : see if getnetbyname exists
9459 set getnetbyname d_getnbyname
9460 eval $inlibc
9461
9462 : see if getnetent exists
9463 set getnetent d_getnent
9464 eval $inlibc
9465
9466 : see if prototypes for various getnetxxx netdb.h functions are available
9467 echo " "
9468 set d_getnetprotos getnetent $i_netdb netdb.h
9469 eval $hasproto
9470
9471 : see if getpagesize exists
9472 set getpagesize d_getpagsz
9473 eval $inlibc
9474
9475
9476 : see if getprotobyname exists
9477 set getprotobyname d_getpbyname
9478 eval $inlibc
9479
9480 : see if getprotobynumber exists
9481 set getprotobynumber d_getpbynumber
9482 eval $inlibc
9483
9484 : see if getprotoent exists
9485 set getprotoent d_getpent
9486 eval $inlibc
9487
9488 : see if getpgid exists
9489 set getpgid d_getpgid
9490 eval $inlibc
9491
9492 : see if getpgrp2 exists
9493 set getpgrp2 d_getpgrp2
9494 eval $inlibc
9495
9496 : see if getppid exists
9497 set getppid d_getppid
9498 eval $inlibc
9499
9500 : see if getpriority exists
9501 set getpriority d_getprior
9502 eval $inlibc
9503
9504 : see if prototypes for various getprotoxxx netdb.h functions are available
9505 echo " "
9506 set d_getprotoprotos getprotoent $i_netdb netdb.h
9507 eval $hasproto
9508
9509 : see if getprpwnam exists
9510 set getprpwnam d_getprpwnam
9511 eval $inlibc
9512
9513 : see if getpwent exists
9514 set getpwent d_getpwent
9515 eval $inlibc
9516
9517
9518 : see if getservbyname exists
9519 set getservbyname d_getsbyname
9520 eval $inlibc
9521
9522 : see if getservbyport exists
9523 set getservbyport d_getsbyport
9524 eval $inlibc
9525
9526 : see if getservent exists
9527 set getservent d_getsent
9528 eval $inlibc
9529
9530 : see if prototypes for various getservxxx netdb.h functions are available
9531 echo " "
9532 set d_getservprotos getservent $i_netdb netdb.h
9533 eval $hasproto
9534
9535 : see if getspnam exists
9536 set getspnam d_getspnam
9537 eval $inlibc
9538
9539 : see if gettimeofday or ftime exists
9540 set gettimeofday d_gettimeod
9541 eval $inlibc
9542 case "$d_gettimeod" in
9543 "$undef")
9544         set ftime d_ftime 
9545         eval $inlibc
9546         ;;
9547 *)
9548         val="$undef"; set d_ftime; eval $setvar
9549         ;;
9550 esac
9551 case "$d_gettimeod$d_ftime" in
9552 "$undef$undef")
9553         echo " "
9554         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9555         ;;
9556 esac
9557
9558 : see if this is an grp system
9559 set grp.h i_grp
9560 eval $inhdr
9561
9562 case "$i_grp" in
9563 $define)
9564         xxx=`./findhdr grp.h`
9565         $cppstdin $cppflags $cppminus < $xxx >$$.h
9566
9567         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9568                 val="$define"
9569         else
9570                 val="$undef"
9571         fi
9572         set d_grpasswd
9573         eval $setvar
9574
9575         $rm -f $$.h
9576         ;;
9577 *)
9578         val="$undef";
9579         set d_grpasswd; eval $setvar
9580         ;;
9581 esac
9582
9583 : see if hasmntopt exists
9584 set hasmntopt d_hasmntopt
9585 eval $inlibc
9586
9587 : see if this is a netinet/in.h or sys/in.h system
9588 set netinet/in.h i_niin sys/in.h i_sysin
9589 eval $inhdr
9590
9591 : see if arpa/inet.h has to be included
9592 set arpa/inet.h i_arpainet
9593 eval $inhdr
9594
9595 : see if htonl --and friends-- exists
9596 val=''
9597 set htonl val
9598 eval $inlibc
9599
9600 : Maybe they are macros.
9601 case "$val" in
9602 $undef)
9603         $cat >htonl.c <<EOM
9604 #include <stdio.h>
9605 #include <sys/types.h>
9606 #$i_niin I_NETINET_IN
9607 #$i_sysin I_SYS_IN
9608 #$i_arpainet I_ARPA_INET
9609 #ifdef I_NETINET_IN
9610 #include <netinet/in.h>
9611 #endif
9612 #ifdef I_SYS_IN
9613 #include <sys/in.h>
9614 #endif
9615 #ifdef I_ARPA_INET
9616 #include <arpa/inet.h>
9617 #endif
9618 #ifdef htonl
9619 printf("Defined as a macro.");
9620 #endif
9621 EOM
9622         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9623         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9624                 val="$define"
9625                 echo "But it seems to be defined as a macro." >&4
9626         fi
9627         $rm -f htonl.?
9628         ;;
9629 esac
9630 set d_htonl
9631 eval $setvar
9632
9633 : see if iconv exists
9634 set iconv d_iconv
9635 eval $inlibc
9636
9637 : index or strchr
9638 echo " "
9639 if set index val -f; eval $csym; $val; then
9640         if set strchr val -f d_strchr; eval $csym; $val; then
9641                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9642                         val="$define"
9643                         vali="$undef"
9644                         echo "strchr() found." >&4
9645                 else
9646                         val="$undef"
9647                         vali="$define"
9648                         echo "index() found." >&4
9649                 fi
9650         else
9651                 val="$undef"
9652                 vali="$define"
9653                 echo "index() found." >&4
9654         fi
9655 else
9656         if set strchr val -f d_strchr; eval $csym; $val; then
9657                 val="$define"
9658                 vali="$undef"
9659                 echo "strchr() found." >&4
9660         else
9661                 echo "No index() or strchr() found!" >&4
9662                 val="$undef"
9663                 vali="$undef"
9664         fi
9665 fi
9666 set d_strchr; eval $setvar
9667 val="$vali"
9668 set d_index; eval $setvar
9669
9670 : check whether inet_aton exists
9671 set inet_aton d_inetaton
9672 eval $inlibc
9673
9674 : see if inttypes.h is available
9675 : we want a real compile instead of Inhdr because some systems
9676 : have an inttypes.h which includes non-existent headers
9677 echo " "
9678 $cat >try.c <<EOCP
9679 #include <inttypes.h>
9680 int main() {
9681         static int32_t foo32 = 0x12345678;
9682 }
9683 EOCP
9684 set try
9685 if eval $compile; then
9686         echo "<inttypes.h> found." >&4
9687         val="$define"
9688 else
9689         echo "<inttypes.h> NOT found." >&4
9690         val="$undef"
9691 fi
9692 $rm -f try.c try
9693 set i_inttypes
9694 eval $setvar
9695
9696 : check for int64_t
9697 echo " "
9698 echo "Checking to see if you have int64_t..." >&4
9699 $cat >try.c <<EOCP
9700 #include <sys/types.h>
9701 #$i_inttypes I_INTTYPES
9702 #ifdef I_INTTYPES
9703 #include <inttypes.h>
9704 #endif
9705 int main() { int64_t x = 7; }
9706 EOCP
9707 set try
9708 if eval $compile; then
9709         val="$define"
9710         echo "You have int64_t."
9711 else
9712         val="$undef"
9713         echo "You do not have int64_t."
9714 fi
9715 $rm -f try try.*
9716 set d_int64_t
9717 eval $setvar
9718
9719 : Look for isascii
9720 echo " "
9721 $cat >isascii.c <<'EOCP'
9722 #include <stdio.h>
9723 #include <ctype.h>
9724 int main() {
9725         int c = 'A';
9726         if (isascii(c))
9727                 exit(0);
9728         else
9729                 exit(1);
9730 }
9731 EOCP
9732 set isascii
9733 if eval $compile; then
9734         echo "isascii() found." >&4
9735         val="$define"
9736 else
9737         echo "isascii() NOT found." >&4
9738         val="$undef"
9739 fi
9740 set d_isascii
9741 eval $setvar
9742 $rm -f isascii*
9743
9744 : see if isnan exists
9745 set isnan d_isnan
9746 eval $inlibc
9747
9748 : see if isnanl exists
9749 set isnanl d_isnanl
9750 eval $inlibc
9751
9752 : see if killpg exists
9753 set killpg d_killpg
9754 eval $inlibc
9755
9756 : see if lchown exists
9757 echo " "
9758 $cat > try.c <<'EOCP'
9759 /* System header to define __stub macros and hopefully few prototypes,
9760     which can conflict with char lchown(); below.  */
9761 #include <assert.h>
9762 /* Override any gcc2 internal prototype to avoid an error.  */
9763 /* We use char because int might match the return type of a gcc2
9764    builtin and then its argument prototype would still apply.  */
9765 char lchown();
9766 int main() {
9767     /*  The GNU C library defines this for functions which it implements
9768         to always fail with ENOSYS.  Some functions are actually named
9769         something starting with __ and the normal name is an alias.  */
9770 #if defined (__stub_lchown) || defined (__stub___lchown)
9771 choke me
9772 #else
9773 lchown();
9774 #endif
9775 ; return 0; }
9776 EOCP
9777 set try
9778 if eval $compile; then
9779     $echo "lchown() found." >&4
9780     val="$define"
9781 else
9782     $echo "lchown() NOT found." >&4
9783     val="$undef"
9784 fi
9785 set d_lchown
9786 eval $setvar
9787
9788 : See if number of significant digits in a double precision number is known
9789 echo " "
9790 $cat >ldbl_dig.c <<EOM
9791 #$i_limits I_LIMITS
9792 #$i_float I_FLOAT
9793 #ifdef I_LIMITS
9794 #include <limits.h>
9795 #endif
9796 #ifdef I_FLOAT
9797 #include <float.h>
9798 #endif
9799 #ifdef LDBL_DIG
9800 printf("Contains LDBL_DIG");
9801 #endif
9802 EOM
9803 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9804 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9805         echo "LDBL_DIG found." >&4
9806         val="$define"
9807 else
9808         echo "LDBL_DIG NOT found." >&4
9809         val="$undef"
9810 fi
9811 $rm -f ldbl_dig.?
9812 set d_ldbl_dig
9813 eval $setvar
9814
9815 : see if link exists
9816 set link d_link
9817 eval $inlibc
9818
9819 : see if localeconv exists
9820 set localeconv d_locconv
9821 eval $inlibc
9822
9823 : see if lockf exists
9824 set lockf d_lockf
9825 eval $inlibc
9826
9827 : check for long long
9828 echo " "
9829 echo "Checking to see if you have long long..." >&4
9830 echo 'int main() { long long x = 7; return 0; }' > try.c
9831 set try
9832 if eval $compile; then
9833         val="$define"
9834         echo "You have long long."
9835 else
9836         val="$undef"
9837         echo "You do not have long long."
9838 fi
9839 $rm try.*
9840 set d_longlong
9841 eval $setvar
9842
9843 : check for length of long long
9844 case "${d_longlong}${longlongsize}" in
9845 $define)
9846         echo " "
9847         echo "Checking to see how big your long longs are..." >&4
9848         $cat >try.c <<'EOCP'
9849 #include <stdio.h>
9850 int main()
9851 {
9852     printf("%d\n", (int)sizeof(long long));
9853     return(0);
9854 }
9855 EOCP
9856         set try
9857         if eval $compile_ok; then
9858                 longlongsize=`./try$exe_ext`
9859                 echo "Your long longs are $longlongsize bytes long."
9860         else
9861                 dflt='8'
9862                 echo " "
9863                 echo "(I can't seem to compile the test program.  Guessing...)"
9864                 rp="What is the size of a long long (in bytes)?"
9865                 . ./myread
9866                 longlongsize="$ans"
9867         fi
9868         if $test "X$longsize" = "X$longlongsize"; then
9869                 echo "(That isn't any different from an ordinary long.)"
9870         fi      
9871         ;;
9872 esac
9873 $rm -f try.* try
9874
9875 : see if prototype for lseek is available
9876 echo " "
9877 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9878 eval $hasproto
9879
9880 : see if lstat exists
9881 set lstat d_lstat
9882 eval $inlibc
9883
9884 : see if madvise exists
9885 set madvise d_madvise
9886 eval $inlibc
9887
9888 : see if mblen exists
9889 set mblen d_mblen
9890 eval $inlibc
9891
9892 : see if mbstowcs exists
9893 set mbstowcs d_mbstowcs
9894 eval $inlibc
9895
9896 : see if mbtowc exists
9897 set mbtowc d_mbtowc
9898 eval $inlibc
9899
9900 : see if memchr exists
9901 set memchr d_memchr
9902 eval $inlibc
9903
9904 : see if memcmp exists
9905 set memcmp d_memcmp
9906 eval $inlibc
9907
9908 : see if memcpy exists
9909 set memcpy d_memcpy
9910 eval $inlibc
9911
9912 : see if memmove exists
9913 set memmove d_memmove
9914 eval $inlibc
9915
9916 : see if memset exists
9917 set memset d_memset
9918 eval $inlibc
9919
9920 : see if mkdir exists
9921 set mkdir d_mkdir
9922 eval $inlibc
9923
9924 : see if mkdtemp exists
9925 set mkdtemp d_mkdtemp
9926 eval $inlibc
9927
9928 : see if mkfifo exists
9929 set mkfifo d_mkfifo
9930 eval $inlibc
9931
9932 : see if mkstemp exists
9933 set mkstemp d_mkstemp
9934 eval $inlibc
9935
9936 : see if mkstemps exists
9937 set mkstemps d_mkstemps
9938 eval $inlibc
9939
9940 : see if mktime exists
9941 set mktime d_mktime
9942 eval $inlibc
9943
9944 : see if this is a sys/mman.h system
9945 set sys/mman.h i_sysmman
9946 eval $inhdr
9947
9948 : see if mmap exists
9949 set mmap d_mmap
9950 eval $inlibc
9951 : see what shmat returns
9952 : default to something harmless
9953 mmaptype='void *'
9954 case "$i_sysmman$d_mmap" in
9955 "$define$define")
9956         $cat >mmap.c <<'END'
9957 #include <sys/mman.h>
9958 void *mmap();
9959 END
9960         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9961                 mmaptype='void *'
9962         else
9963                 mmaptype='caddr_t'
9964         fi
9965         echo "and it returns ($mmaptype)." >&4
9966         ;;
9967 esac
9968
9969
9970
9971 : see if modfl exists
9972 set modfl d_modfl
9973 eval $inlibc
9974
9975 : see if mprotect exists
9976 set mprotect d_mprotect
9977 eval $inlibc
9978
9979 : see if msgctl exists
9980 set msgctl d_msgctl
9981 eval $inlibc
9982
9983 : see if msgget exists
9984 set msgget d_msgget
9985 eval $inlibc
9986
9987 : see if msgsnd exists
9988 set msgsnd d_msgsnd
9989 eval $inlibc
9990
9991 : see if msgrcv exists
9992 set msgrcv d_msgrcv
9993 eval $inlibc
9994
9995 : see how much of the 'msg*(2)' library is present.
9996 h_msg=true
9997 echo " "
9998 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9999 *"$undef"*) h_msg=false;;
10000 esac
10001 case "$osname" in
10002 freebsd)
10003     case "`ipcs 2>&1`" in
10004     "SVID messages"*"not configured"*)
10005         echo "Your $osname does not have the msg*(2) configured." >&4
10006         h_msg=false
10007         val="$undef"
10008         set msgctl d_msgctl
10009         eval $setvar
10010         set msgget d_msgget
10011         eval $setvar
10012         set msgsnd d_msgsnd
10013         eval $setvar
10014         set msgrcv d_msgrcv
10015         eval $setvar
10016         ;;
10017     esac
10018     ;;
10019 esac
10020 : we could also check for sys/ipc.h ...
10021 if $h_msg && $test `./findhdr sys/msg.h`; then
10022         echo "You have the full msg*(2) library." >&4
10023         val="$define"
10024 else
10025         echo "You don't have the full msg*(2) library." >&4
10026         val="$undef"
10027 fi
10028 set d_msg
10029 eval $setvar
10030
10031 : see if msync exists
10032 set msync d_msync
10033 eval $inlibc
10034
10035 : see if munmap exists
10036 set munmap d_munmap
10037 eval $inlibc
10038
10039 : see if nice exists
10040 set nice d_nice
10041 eval $inlibc
10042
10043
10044 echo " "
10045 echo "Checking which 64-bit integer type we could use..." >&4
10046
10047 case "$intsize" in
10048 8) val=int
10049    set quadtype
10050    eval $setvar
10051    val='"unsigned int"'
10052    set uquadtype
10053    eval $setvar
10054    quadkind=1
10055    ;;
10056 *) case "$longsize" in
10057    8) val=long
10058       set quadtype
10059       eval $setvar
10060       val='"unsigned long"'
10061       set uquadtype
10062       eval $setvar
10063       quadkind=2
10064       ;;
10065    *) case "$d_longlong:$longlongsize" in
10066       define:8)
10067         val='"long long"'
10068         set quadtype
10069         eval $setvar
10070         val='"unsigned long long"'
10071         set uquadtype
10072         eval $setvar
10073         quadkind=3
10074         ;;
10075       *) case "$d_int64_t" in
10076          define)
10077            val=int64_t
10078            set quadtype
10079            eval $setvar
10080            val=uint64_t
10081            set uquadtype
10082            eval $setvar
10083            quadkind=4
10084            ;;
10085          esac
10086          ;;
10087       esac
10088       ;;
10089    esac
10090    ;;
10091 esac
10092
10093 case "$quadtype" in
10094 '')     echo "Alas, no 64-bit integer types in sight." >&4
10095         d_quad="$undef"
10096         ;;
10097 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10098             verb="will"
10099         else
10100             verb="could"
10101         fi
10102         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10103         d_quad="$define"
10104         ;;
10105 esac
10106
10107 : check for length of character
10108 echo " "
10109 case "$charsize" in
10110 '')
10111         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10112         $cat >try.c <<'EOCP'
10113 #include <stdio.h>
10114 int main()
10115 {
10116     printf("%d\n", (int)sizeof(char));
10117     exit(0);
10118 }
10119 EOCP
10120         set try
10121         if eval $compile_ok; then
10122                 dflt=`./try`
10123         else
10124                 dflt='1'
10125                 echo "(I can't seem to compile the test program.  Guessing...)"
10126         fi
10127         ;;
10128 *)
10129         dflt="$charsize"
10130         ;;
10131 esac
10132 rp="What is the size of a character (in bytes)?"
10133 . ./myread
10134 charsize="$ans"
10135 $rm -f try.c try
10136
10137 : check for volatile keyword
10138 echo " "
10139 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10140 $cat >try.c <<'EOCP'
10141 int main()
10142 {
10143         typedef struct _goo_struct goo_struct;
10144         goo_struct * volatile goo = ((goo_struct *)0);
10145         struct _goo_struct {
10146                 long long_int;
10147                 int reg_int;
10148                 char char_var;
10149         };
10150         typedef unsigned short foo_t;
10151         char *volatile foo;
10152         volatile int bar;
10153         volatile foo_t blech;
10154         foo = foo;
10155 }
10156 EOCP
10157 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10158         val="$define"
10159         echo "Yup, it does."
10160 else
10161         val="$undef"
10162         echo "Nope, it doesn't."
10163 fi
10164 set d_volatile
10165 eval $setvar
10166 $rm -f try.*
10167
10168
10169 echo " "
10170 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10171
10172 case "$use64bitint:$d_quad:$quadtype" in
10173 define:define:?*)
10174         ivtype="$quadtype"
10175         uvtype="$uquadtype"
10176         ivsize=8
10177         uvsize=8
10178         ;;
10179 *)      ivtype="long"
10180         uvtype="unsigned long"
10181         ivsize=$longsize
10182         uvsize=$longsize
10183         ;;
10184 esac
10185
10186 case "$uselongdouble:$d_longdbl" in
10187 define:define)
10188         nvtype="long double"
10189         nvsize=$longdblsize
10190         ;;
10191 *)      nvtype=double
10192         nvsize=$doublesize
10193         ;;
10194 esac
10195
10196 $echo "(IV will be "$ivtype", $ivsize bytes)"
10197 $echo "(UV will be "$uvtype", $uvsize bytes)"
10198 $echo "(NV will be "$nvtype", $nvsize bytes)"
10199
10200 $cat >try.c <<EOCP
10201 #$i_inttypes I_INTTYPES
10202 #ifdef I_INTTYPES
10203 #include <inttypes.h>
10204 #endif
10205 #include <stdio.h>
10206 int main() {
10207 #ifdef INT8
10208    int8_t i =  INT8_MAX;
10209   uint8_t u = UINT8_MAX;
10210   printf("int8_t\n");
10211 #endif
10212 #ifdef INT16
10213    int16_t i =  INT16_MAX;
10214   uint16_t i = UINT16_MAX;
10215   printf("int16_t\n");
10216 #endif
10217 #ifdef INT32
10218    int32_t i =  INT32_MAX;
10219   uint32_t u = UINT32_MAX;
10220   printf("int32_t\n");
10221 #endif
10222 }
10223 EOCP
10224
10225 case "$i8type" in
10226 '')     case "$charsize" in
10227         1)      i8type=char
10228                 u8type="unsigned char"
10229                 i8size=$charsize
10230                 u8size=$charsize
10231                 ;;
10232         esac
10233         ;;
10234 esac
10235 case "$i8type" in
10236 '')     set try -DINT8
10237         if eval $compile; then
10238                 case "`./try$exe_ext`" in
10239                 int8_t) i8type=int8_t
10240                         u8type=uint8_t
10241                         i8size=1
10242                         u8size=1
10243                         ;;
10244                 esac
10245         fi
10246         ;;
10247 esac
10248 case "$i8type" in
10249 '')     if $test $charsize -ge 1; then
10250                 i8type=char
10251                 u8type="unsigned char"
10252                 i8size=$charsize
10253                 u8size=$charsize
10254         fi
10255         ;;
10256 esac
10257
10258 case "$i16type" in
10259 '')     case "$shortsize" in
10260         2)      i16type=short
10261                 u16type="unsigned short"
10262                 i16size=$shortsize
10263                 u16size=$shortsize
10264                 ;;
10265         esac
10266         ;;
10267 esac
10268 case "$i16type" in
10269 '')     set try -DINT16
10270         if eval $compile; then
10271                 case "`./try$exe_ext`" in
10272                 int16_t)
10273                         i16type=int16_t
10274                         u16type=uint16_t
10275                         i16size=2
10276                         u16size=2
10277                         ;;
10278                 esac
10279         fi
10280         ;;
10281 esac
10282 case "$i16type" in
10283 '')     if $test $shortsize -ge 2; then
10284                 i16type=short
10285                 u16type="unsigned short"
10286                 i16size=$shortsize
10287                 u16size=$shortsize
10288         fi
10289         ;;
10290 esac
10291
10292 case "$i32type" in
10293 '')     case "$longsize" in
10294         4)      i32type=long
10295                 u32type="unsigned long"
10296                 i32size=$longsize
10297                 u32size=$longsize
10298                 ;;
10299         *)      case "$intsize" in
10300                 4)      i32type=int
10301                         u32type="unsigned int"
10302                         i32size=$intsize
10303                         u32size=$intsize
10304                         ;;
10305                 esac
10306                 ;;
10307         esac
10308         ;;
10309 esac
10310 case "$i32type" in
10311 '')     set try -DINT32
10312         if eval $compile; then
10313                 case "`./try$exe_ext`" in
10314                 int32_t)
10315                         i32type=int32_t
10316                         u32type=uint32_t
10317                         i32size=4
10318                         u32size=4
10319                         ;;
10320                 esac
10321         fi
10322         ;;
10323 esac
10324 case "$i32type" in
10325 '')     if $test $intsize -ge 4; then
10326                 i32type=int
10327                 u32type="unsigned int"
10328                 i32size=$intsize
10329                 u32size=$intsize
10330         fi
10331         ;;
10332 esac
10333
10334 case "$i64type" in
10335 '')     case "$d_quad:$quadtype" in
10336         define:?*)
10337                 i64type="$quadtype"
10338                 u64type="$uquadtype"
10339                 i64size=8
10340                 u64size=8
10341                 ;;
10342         esac
10343         ;;
10344 esac
10345
10346 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10347 : volatile so that the compiler has to store it out to memory.
10348 if test X"$d_volatile" = X"$define"; then
10349         volatile=volatile
10350 fi
10351 $cat <<EOP >try.c
10352 #include <stdio.h>
10353 #include <sys/types.h>
10354 #include <signal.h>
10355 #ifdef SIGFPE
10356 $volatile int bletched = 0;
10357 $signal_t blech(s) int s; { bletched = 1; }
10358 #endif
10359 int main() {
10360     $uvtype u = 0;
10361     $nvtype d;
10362     int     n = 8 * $uvsize;
10363     int     i;
10364 #ifdef SIGFPE
10365     signal(SIGFPE, blech);
10366 #endif
10367
10368     for (i = 0; i < n; i++) {
10369       u = u << 1 | ($uvtype)1;
10370       d = ($nvtype)u;
10371       if (($uvtype)d != u)
10372         break;
10373       if (d <= 0)
10374         break;
10375       d = ($nvtype)(u - 1);
10376       if (($uvtype)d != (u - 1))
10377         break;
10378 #ifdef SIGFPE
10379       if (bletched) {
10380         break;
10381 #endif
10382       } 
10383     }
10384     printf("%d\n", ((i == n) ? -n : i));
10385     exit(0);
10386 }
10387 EOP
10388 set try
10389
10390 d_nv_preserves_uv="$undef"
10391 if eval $compile; then
10392         d_nv_preserves_uv_bits="`./try$exe_ext`"
10393 fi
10394 case "$d_nv_preserves_uv_bits" in
10395 \-[1-9]*)       
10396         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10397         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10398         d_nv_preserves_uv="$define"
10399         ;;
10400 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10401         d_nv_preserves_uv="$undef" ;;
10402 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10403         d_nv_preserves_uv_bits="$undef" ;;
10404 esac
10405
10406 $rm -f try.* try
10407
10408
10409 : check for off64_t
10410 echo " "
10411 echo "Checking to see if you have off64_t..." >&4
10412 $cat >try.c <<EOCP
10413 #include <sys/types.h>
10414 #include <unistd.h>
10415 int main() { off64_t x = 7; }
10416 EOCP
10417 set try
10418 if eval $compile; then
10419         val="$define"
10420         echo "You have off64_t."
10421 else
10422         val="$undef"
10423         echo "You do not have off64_t."
10424         case "$lseeksize" in
10425         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10426         esac
10427 fi
10428 $rm -f try.* try
10429 set d_off64_t
10430 eval $setvar
10431
10432 : see if POSIX threads are available
10433 set pthread.h i_pthread
10434 eval $inhdr
10435
10436
10437
10438
10439 : how to create joinable pthreads
10440 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10441         echo " "
10442         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10443         $cat >try.c <<'EOCP'
10444 #include <pthread.h>
10445 int main() {
10446     int detachstate = JOINABLE;
10447 }
10448 EOCP
10449         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10450         if eval $compile; then
10451                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10452                 val="$undef" # Yes, undef.
10453                 set d_old_pthread_create_joinable
10454                 eval $setvar
10455                 val=""
10456                 set old_pthread_create_joinable
10457                 eval $setvar
10458         else
10459                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10460                 if eval $compile; then
10461                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10462                         val="$define"
10463                         set d_old_pthread_create_joinable
10464                         eval $setvar
10465                         val=PTHREAD_CREATE_UNDETACHED
10466                         set old_pthread_create_joinable
10467                         eval $setvar
10468                 else            
10469                         set try -DJOINABLE=__UNDETACHED
10470                         if eval $compile; then
10471                                 echo "You seem to use __UNDETACHED." >&4
10472                                 val="$define"
10473                                 set d_old_pthread_create_joinable
10474                                 eval $setvar
10475                                 val=__UNDETACHED
10476                                 set old_pthread_create_joinable
10477                                 eval $setvar
10478                         else
10479                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10480                                 val="$define"
10481                                 set d_old_pthread_create_joinable
10482                                 eval $setvar
10483                                 val=0
10484                                 set old_pthread_create_joinable
10485                                 eval $setvar
10486                         fi
10487                 fi
10488         fi
10489         $rm -f try try.*
10490 else
10491     d_old_pthread_create_joinable="$undef"
10492     old_pthread_create_joinable=""
10493 fi
10494
10495 : see if pause exists
10496 set pause d_pause
10497 eval $inlibc
10498
10499 : see if pipe exists
10500 set pipe d_pipe
10501 eval $inlibc
10502
10503 : see if poll exists
10504 set poll d_poll
10505 eval $inlibc
10506
10507
10508 : see whether the various POSIXish _yields exist
10509 $cat >try.c <<EOP
10510 #include <pthread.h>
10511 #include <stdio.h>
10512 int main() {
10513 #ifdef SCHED_YIELD
10514         sched_yield();
10515 #else
10516 #ifdef PTHREAD_YIELD
10517         pthread_yield();
10518 #else
10519 #ifdef PTHREAD_YIELD_NULL
10520         pthread_yield(NULL);
10521 #endif
10522 #endif
10523 #endif
10524 }
10525 EOP
10526 : see if sched_yield exists
10527 set try -DSCHED_YIELD
10528 if eval $compile; then
10529     val="$define"
10530     sched_yield='sched_yield()'
10531 else
10532     val="$undef"
10533 fi
10534 case "$usethreads" in
10535 $define)
10536         case "$val" in
10537         $define) echo 'sched_yield() found.' >&4        ;;
10538         *)       echo 'sched_yield() NOT found.' >&4    ;;
10539         esac
10540 esac
10541 set d_sched_yield
10542 eval $setvar
10543
10544 : see if pthread_yield exists
10545 set try -DPTHREAD_YIELD
10546 if eval $compile; then
10547     val="$define"
10548     case "$sched_yield" in
10549     '') sched_yield='pthread_yield()' ;;
10550     esac
10551 else
10552     set try -DPTHREAD_YIELD_NULL
10553     if eval $compile; then
10554         val="$define"
10555         case "$sched_yield" in
10556         '') sched_yield='pthread_yield(NULL)' ;;
10557         esac
10558     else
10559         val="$undef"
10560     fi
10561 fi
10562 case "$usethreads" in
10563 $define)
10564         case "$val" in
10565         $define) echo 'pthread_yield() found.' >&4      ;;
10566         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10567         esac
10568         ;;
10569 esac
10570 set d_pthread_yield
10571 eval $setvar
10572
10573 case "$sched_yield" in
10574 '') sched_yield=undef ;;
10575 esac
10576
10577 $rm -f try try.*
10578
10579 : see if this is a pwd.h system
10580 set pwd.h i_pwd
10581 eval $inhdr
10582
10583 case "$i_pwd" in
10584 $define)
10585         xxx=`./findhdr pwd.h`
10586         $cppstdin $cppflags $cppminus < $xxx >$$.h
10587
10588         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10589                 val="$define"
10590         else
10591                 val="$undef"
10592         fi
10593         set d_pwquota
10594         eval $setvar
10595
10596         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10597                 val="$define"
10598         else
10599                 val="$undef"
10600         fi
10601         set d_pwage
10602         eval $setvar
10603
10604         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10605                 val="$define"
10606         else
10607                 val="$undef"
10608         fi
10609         set d_pwchange
10610         eval $setvar
10611
10612         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10613                 val="$define"
10614         else
10615                 val="$undef"
10616         fi
10617         set d_pwclass
10618         eval $setvar
10619
10620         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10621                 val="$define"
10622         else
10623                 val="$undef"
10624         fi
10625         set d_pwexpire
10626         eval $setvar
10627
10628         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10629                 val="$define"
10630         else
10631                 val="$undef"
10632         fi
10633         set d_pwcomment
10634         eval $setvar
10635
10636         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10637                 val="$define"
10638         else
10639                 val="$undef"
10640         fi
10641         set d_pwgecos
10642         eval $setvar
10643
10644         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10645                 val="$define"
10646         else
10647                 val="$undef"
10648         fi
10649         set d_pwpasswd
10650         eval $setvar
10651
10652         $rm -f $$.h
10653         ;;
10654 *)
10655         val="$undef"; 
10656         set d_pwquota; eval $setvar
10657         set d_pwage; eval $setvar
10658         set d_pwchange; eval $setvar
10659         set d_pwclass; eval $setvar
10660         set d_pwexpire; eval $setvar
10661         set d_pwcomment; eval $setvar
10662         set d_pwgecos; eval $setvar
10663         set d_pwpasswd; eval $setvar
10664         ;;
10665 esac
10666
10667 : see if readdir and friends exist
10668 set readdir d_readdir
10669 eval $inlibc
10670 set seekdir d_seekdir
10671 eval $inlibc
10672 set telldir d_telldir
10673 eval $inlibc
10674 set rewinddir d_rewinddir
10675 eval $inlibc
10676
10677 : see if readlink exists
10678 set readlink d_readlink
10679 eval $inlibc
10680
10681 : see if rename exists
10682 set rename d_rename
10683 eval $inlibc
10684
10685 : see if rmdir exists
10686 set rmdir d_rmdir
10687 eval $inlibc
10688
10689 : see if memory.h is available.
10690 val=''
10691 set memory.h val
10692 eval $inhdr
10693
10694 : See if it conflicts with string.h
10695 case "$val" in
10696 $define)
10697         case "$strings" in
10698         '') ;;
10699         *)
10700                 $cppstdin $cppflags $cppminus < $strings > mem.h
10701                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10702                         echo " "
10703                         echo "We won't be including <memory.h>."
10704                         val="$undef"
10705                 fi
10706                 $rm -f mem.h
10707                 ;;
10708         esac
10709 esac
10710 set i_memory
10711 eval $setvar
10712
10713 : can bcopy handle overlapping blocks?
10714 val="$undef"
10715 case "$d_bcopy" in
10716 "$define")
10717         echo " "
10718         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10719         $cat >try.c <<EOCP
10720 #$i_memory I_MEMORY
10721 #$i_stdlib I_STDLIB
10722 #$i_string I_STRING
10723 #$i_unistd I_UNISTD
10724 EOCP
10725         $cat >>try.c <<'EOCP'
10726 #include <stdio.h>
10727 #ifdef I_MEMORY
10728 #  include <memory.h>
10729 #endif
10730 #ifdef I_STDLIB
10731 #  include <stdlib.h>
10732 #endif
10733 #ifdef I_STRING
10734 #  include <string.h>
10735 #else
10736 #  include <strings.h>
10737 #endif
10738 #ifdef I_UNISTD
10739 #  include <unistd.h>  /* Needed for NetBSD */
10740 #endif
10741 int main()
10742 {
10743 char buf[128], abc[128];
10744 char *b;
10745 int len;
10746 int off;
10747 int align;
10748
10749 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10750
10751 for (align = 7; align >= 0; align--) {
10752         for (len = 36; len; len--) {
10753                 b = buf+align;
10754                 bcopy(abc, b, len);
10755                 for (off = 1; off <= len; off++) {
10756                         bcopy(b, b+off, len);
10757                         bcopy(b+off, b, len);
10758                         if (bcmp(b, abc, len))
10759                                 exit(1);
10760                 }
10761         }
10762 }
10763 exit(0);
10764 }
10765 EOCP
10766         set try
10767         if eval $compile_ok; then
10768                 if ./try 2>/dev/null; then
10769                         echo "Yes, it can."
10770                         val="$define"
10771                 else
10772                         echo "It can't, sorry."
10773                         case "$d_memmove" in
10774                         "$define") echo "But that's Ok since you have memmove()." ;;
10775                         esac
10776                 fi
10777         else
10778                 echo "(I can't compile the test program, so we'll assume not...)"
10779                 case "$d_memmove" in
10780                 "$define") echo "But that's Ok since you have memmove()." ;;
10781                 esac
10782         fi
10783         ;;
10784 esac
10785 $rm -f try.* try core
10786 set d_safebcpy
10787 eval $setvar
10788
10789 : can memcpy handle overlapping blocks?
10790 val="$undef"
10791 case "$d_memcpy" in
10792 "$define")
10793         echo " "
10794         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10795         $cat >try.c <<EOCP
10796 #$i_memory I_MEMORY
10797 #$i_stdlib I_STDLIB
10798 #$i_string I_STRING
10799 #$i_unistd I_UNISTD
10800 EOCP
10801         $cat >>try.c <<'EOCP'
10802 #include <stdio.h>
10803 #ifdef I_MEMORY
10804 #  include <memory.h>
10805 #endif
10806 #ifdef I_STDLIB
10807 #  include <stdlib.h>
10808 #endif
10809 #ifdef I_STRING
10810 #  include <string.h>
10811 #else
10812 #  include <strings.h>
10813 #endif
10814 #ifdef I_UNISTD
10815 #  include <unistd.h>  /* Needed for NetBSD */
10816 #endif
10817 int main()
10818 {
10819 char buf[128], abc[128];
10820 char *b;
10821 int len;
10822 int off;
10823 int align;
10824
10825 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10826    try to store the string in read-only memory. */
10827 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10828
10829 for (align = 7; align >= 0; align--) {
10830         for (len = 36; len; len--) {
10831                 b = buf+align;
10832                 memcpy(b, abc, len);
10833                 for (off = 1; off <= len; off++) {
10834                         memcpy(b+off, b, len);
10835                         memcpy(b, b+off, len);
10836                         if (memcmp(b, abc, len))
10837                                 exit(1);
10838                 }
10839         }
10840 }
10841 exit(0);
10842 }
10843 EOCP
10844         set try
10845         if eval $compile_ok; then
10846                 if ./try 2>/dev/null; then
10847                         echo "Yes, it can."
10848                         val="$define"
10849                 else
10850                         echo "It can't, sorry."
10851                         case "$d_memmove" in
10852                         "$define") echo "But that's Ok since you have memmove()." ;;
10853                         esac
10854                 fi
10855         else
10856                 echo "(I can't compile the test program, so we'll assume not...)"
10857                 case "$d_memmove" in
10858                 "$define") echo "But that's Ok since you have memmove()." ;;
10859                 esac
10860         fi
10861         ;;
10862 esac
10863 $rm -f try.* try core
10864 set d_safemcpy
10865 eval $setvar
10866
10867 : can memcmp be trusted to compare relative magnitude?
10868 val="$undef"
10869 case "$d_memcmp" in
10870 "$define")
10871         echo " "
10872         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10873         $cat >try.c <<EOCP
10874 #$i_memory I_MEMORY
10875 #$i_stdlib I_STDLIB
10876 #$i_string I_STRING
10877 #$i_unistd I_UNISTD
10878 EOCP
10879         $cat >>try.c <<'EOCP'
10880 #include <stdio.h>
10881 #ifdef I_MEMORY
10882 #  include <memory.h>
10883 #endif
10884 #ifdef I_STDLIB
10885 #  include <stdlib.h>
10886 #endif
10887 #ifdef I_STRING
10888 #  include <string.h>
10889 #else
10890 #  include <strings.h>
10891 #endif
10892 #ifdef I_UNISTD
10893 #  include <unistd.h>  /* Needed for NetBSD */
10894 #endif
10895 int main()
10896 {
10897 char a = -1;
10898 char b = 0;
10899 if ((a < b) && memcmp(&a, &b, 1) < 0)
10900         exit(1);
10901 exit(0);
10902 }
10903 EOCP
10904         set try
10905         if eval $compile_ok; then
10906                 if ./try 2>/dev/null; then
10907                         echo "Yes, it can."
10908                         val="$define"
10909                 else
10910                         echo "No, it can't (it uses signed chars)."
10911                 fi
10912         else
10913                 echo "(I can't compile the test program, so we'll assume not...)"
10914         fi
10915         ;;
10916 esac
10917 $rm -f try.* try core
10918 set d_sanemcmp
10919 eval $setvar
10920
10921 : see if prototype for sbrk is available
10922 echo " "
10923 set d_sbrkproto sbrk $i_unistd unistd.h
10924 eval $hasproto
10925
10926 : see if select exists
10927 set select d_select
10928 eval $inlibc
10929
10930 : see if semctl exists
10931 set semctl d_semctl
10932 eval $inlibc
10933
10934 : see if semget exists
10935 set semget d_semget
10936 eval $inlibc
10937
10938 : see if semop exists
10939 set semop d_semop
10940 eval $inlibc
10941
10942 : see how much of the 'sem*(2)' library is present.
10943 h_sem=true
10944 echo " "
10945 case "$d_semctl$d_semget$d_semop" in
10946 *"$undef"*) h_sem=false;;
10947 esac
10948 case "$osname" in
10949 freebsd)
10950     case "`ipcs 2>&1`" in
10951     "SVID messages"*"not configured"*)
10952         echo "Your $osname does not have the sem*(2) configured." >&4
10953         h_sem=false
10954         val="$undef"
10955         set semctl d_semctl
10956         eval $setvar
10957         set semget d_semget
10958         eval $setvar
10959         set semop d_semop
10960         eval $setvar
10961         ;;
10962     esac
10963     ;;
10964 esac
10965 : we could also check for sys/ipc.h ...
10966 if $h_sem && $test `./findhdr sys/sem.h`; then
10967         echo "You have the full sem*(2) library." >&4
10968         val="$define"
10969 else
10970         echo "You don't have the full sem*(2) library." >&4
10971         val="$undef"
10972 fi
10973 set d_sem
10974 eval $setvar
10975
10976 : see whether sys/sem.h defines union semun
10977 echo " "
10978 $cat > try.c <<'END'
10979 #include <sys/types.h>
10980 #include <sys/ipc.h>
10981 #include <sys/sem.h>
10982 int main () { union semun semun; semun.buf = 0; }
10983 END
10984 set try
10985 if eval $compile; then
10986     echo "You have union semun in <sys/sem.h>." >&4
10987     val="$define"
10988 else
10989     echo "You do not have union semun in <sys/sem.h>." >&4
10990     val="$undef"
10991 fi
10992 $rm -f try try.c try.h
10993 set d_union_semun
10994 eval $setvar
10995
10996 : see how to do semctl IPC_STAT
10997 case "$d_sem" in
10998 $define)
10999     : see whether semctl IPC_STAT can use union semun
11000     echo " "
11001     $cat > try.h <<END
11002 #ifndef S_IRUSR
11003 #   ifdef S_IREAD
11004 #       define S_IRUSR S_IREAD
11005 #       define S_IWUSR S_IWRITE
11006 #       define S_IXUSR S_IEXEC
11007 #   else
11008 #       define S_IRUSR 0400
11009 #       define S_IWUSR 0200
11010 #       define S_IXUSR 0100
11011 #   endif
11012 #   define S_IRGRP (S_IRUSR>>3)
11013 #   define S_IWGRP (S_IWUSR>>3)
11014 #   define S_IXGRP (S_IXUSR>>3)
11015 #   define S_IROTH (S_IRUSR>>6)
11016 #   define S_IWOTH (S_IWUSR>>6)
11017 #   define S_IXOTH (S_IXUSR>>6)
11018 #endif
11019 #ifndef S_IRWXU
11020 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11021 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11022 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11023 #endif
11024 END
11025
11026     $cat > try.c <<END
11027 #include <sys/types.h>
11028 #include <sys/ipc.h>
11029 #include <sys/sem.h>
11030 #include <sys/stat.h>
11031 #include <stdio.h>
11032 #include <errno.h>
11033 #include "try.h"
11034 #ifndef errno
11035 extern int errno;
11036 #endif
11037 #$d_union_semun HAS_UNION_SEMUN
11038 int main() {
11039     union semun
11040 #ifndef HAS_UNION_SEMUN
11041     {
11042         int val;
11043         struct semid_ds *buf;
11044         unsigned short *array;
11045     }
11046 #endif
11047     arg;
11048     int sem, st;
11049
11050 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11051     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11052     if (sem > -1) {
11053         struct semid_ds argbuf;
11054         arg.buf = &argbuf;
11055 #       ifdef IPC_STAT
11056         st = semctl(sem, 0, IPC_STAT, arg);
11057         if (st == 0)
11058             printf("semun\n");
11059         else
11060 #       endif /* IPC_STAT */
11061             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11062 #       ifdef IPC_RMID
11063         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11064 #       endif /* IPC_RMID */
11065             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11066     } else
11067 #endif /* IPC_PRIVATE && ... */
11068         printf("semget failed: errno = %d\n", errno);
11069   return 0;
11070 }
11071 END
11072     val="$undef"
11073     set try
11074     if eval $compile; then
11075         xxx=`./try`
11076         case "$xxx" in
11077         semun) val="$define" ;;
11078         esac
11079     fi
11080     $rm -f try try.c
11081     set d_semctl_semun
11082     eval $setvar
11083     case "$d_semctl_semun" in
11084     $define)
11085         echo "You can use union semun for semctl IPC_STAT." >&4
11086         also='also'
11087         ;;
11088     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11089         also=''
11090         ;;
11091     esac
11092
11093     : see whether semctl IPC_STAT can use struct semid_ds pointer
11094     $cat > try.c <<'END'
11095 #include <sys/types.h>
11096 #include <sys/ipc.h>
11097 #include <sys/sem.h>
11098 #include <sys/stat.h>
11099 #include "try.h"
11100 #include <stdio.h>
11101 #include <errno.h>
11102 #ifndef errno
11103 extern int errno;
11104 #endif
11105 int main() {
11106     struct semid_ds arg;
11107     int sem, st;
11108
11109 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11110     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11111     if (sem > -1) {
11112 #       ifdef IPC_STAT
11113         st = semctl(sem, 0, IPC_STAT, &arg);
11114         if (st == 0)
11115             printf("semid_ds\n");
11116         else
11117 #       endif /* IPC_STAT */
11118             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11119 #       ifdef IPC_RMID
11120         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11121 #       endif /* IPC_RMID */
11122             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11123     } else
11124 #endif /* IPC_PRIVATE && ... */
11125         printf("semget failed: errno = %d\n", errno);
11126
11127     return 0;
11128 }
11129 END
11130     val="$undef"
11131     set try
11132     if eval $compile; then
11133         xxx=`./try`
11134         case "$xxx" in
11135         semid_ds) val="$define" ;;
11136         esac
11137     fi
11138     $rm -f try try.c
11139     set d_semctl_semid_ds
11140     eval $setvar
11141     case "$d_semctl_semid_ds" in
11142     $define)
11143         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11144         ;;
11145     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11146         ;;
11147     esac
11148     $rm -f try.h
11149     ;;
11150 *)  val="$undef"
11151
11152     # We do not have the full sem*(2) library, so assume we can not
11153     # use either.
11154
11155     set d_semctl_semun
11156     eval $setvar
11157
11158     set d_semctl_semid_ds
11159     eval $setvar
11160     ;;
11161 esac
11162
11163 : see if setegid exists
11164 set setegid d_setegid
11165 eval $inlibc
11166
11167 : see if seteuid exists
11168 set seteuid d_seteuid
11169 eval $inlibc
11170
11171 : see if setgrent exists
11172 set setgrent d_setgrent
11173 eval $inlibc
11174
11175 : see if sethostent exists
11176 set sethostent d_sethent
11177 eval $inlibc
11178
11179 : see if setlinebuf exists
11180 set setlinebuf d_setlinebuf
11181 eval $inlibc
11182
11183 : see if setlocale exists
11184 set setlocale d_setlocale
11185 eval $inlibc
11186
11187 : see if setnetent exists
11188 set setnetent d_setnent
11189 eval $inlibc
11190
11191 : see if setprotoent exists
11192 set setprotoent d_setpent
11193 eval $inlibc
11194
11195 : see if setpgid exists
11196 set setpgid d_setpgid
11197 eval $inlibc
11198
11199 : see if setpgrp2 exists
11200 set setpgrp2 d_setpgrp2
11201 eval $inlibc
11202
11203 : see if setpriority exists
11204 set setpriority d_setprior
11205 eval $inlibc
11206
11207 : see if setproctitle exists
11208 set setproctitle d_setproctitle
11209 eval $inlibc
11210
11211 : see if setpwent exists
11212 set setpwent d_setpwent
11213 eval $inlibc
11214
11215 : see if setregid exists
11216 set setregid d_setregid
11217 eval $inlibc
11218 set setresgid d_setresgid
11219 eval $inlibc
11220
11221 : see if setreuid exists
11222 set setreuid d_setreuid
11223 eval $inlibc
11224 set setresuid d_setresuid
11225 eval $inlibc
11226
11227 : see if setrgid exists
11228 set setrgid d_setrgid
11229 eval $inlibc
11230
11231 : see if setruid exists
11232 set setruid d_setruid
11233 eval $inlibc
11234
11235 : see if setservent exists
11236 set setservent d_setsent
11237 eval $inlibc
11238
11239 : see if setsid exists
11240 set setsid d_setsid
11241 eval $inlibc
11242
11243 : see if setvbuf exists
11244 set setvbuf d_setvbuf
11245 eval $inlibc
11246
11247 : see if sfio.h is available
11248 set sfio.h i_sfio
11249 eval $inhdr
11250
11251
11252 : see if sfio library is available
11253 case "$i_sfio" in
11254 $define)
11255         val=''
11256         set sfreserve val
11257         eval $inlibc
11258         ;;
11259 *)
11260         val="$undef"
11261         ;;
11262 esac
11263 : Ok, but do we want to use it.
11264 case "$val" in
11265 $define)
11266         case "$usesfio" in
11267         true|$define|[yY]*) dflt='y';;
11268         *) dflt='n';;
11269         esac
11270         echo "$package can use the sfio library, but it is experimental."
11271         case "$useperlio" in
11272         "$undef")
11273             echo "For sfio also the PerlIO abstraction layer is needed."
11274             echo "Earlier you said you wouldn't want that."
11275             ;;
11276         esac
11277         rp="You seem to have sfio available, do you want to try using it?"
11278         . ./myread
11279         case "$ans" in
11280         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11281                 useperlio="$define"
11282                 val="$define"
11283                 ;;
11284         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11285                 val="$undef"
11286                 : Remove sfio from list of libraries to use
11287                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11288                 shift
11289                 libs="$*"
11290                 echo "libs = $libs" >&4
11291                 ;;
11292         esac
11293         ;;
11294 *)      case "$usesfio" in
11295         true|$define|[yY]*)
11296                 echo "Sorry, cannot find sfio on this machine." >&4
11297                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11298                 val="$undef"
11299                 ;;
11300         esac
11301         ;;
11302 esac
11303 set d_sfio
11304 eval $setvar
11305 case "$d_sfio" in
11306 $define) usesfio='true';;
11307 *) usesfio='false';;
11308 esac
11309
11310 : see if shmctl exists
11311 set shmctl d_shmctl
11312 eval $inlibc
11313
11314 : see if shmget exists
11315 set shmget d_shmget
11316 eval $inlibc
11317
11318 : see if shmat exists
11319 set shmat d_shmat
11320 eval $inlibc
11321 : see what shmat returns
11322 case "$d_shmat" in
11323 "$define")
11324         $cat >shmat.c <<'END'
11325 #include <sys/shm.h>
11326 void *shmat();
11327 END
11328         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11329                 shmattype='void *'
11330         else
11331                 shmattype='char *'
11332         fi
11333         echo "and it returns ($shmattype)." >&4
11334         : see if a prototype for shmat is available
11335         xxx=`./findhdr sys/shm.h`
11336         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11337         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11338                 val="$define"
11339         else
11340                 val="$undef"
11341         fi
11342         $rm -f shmat.[co]
11343         ;;
11344 *)
11345         val="$undef"
11346         ;;
11347 esac
11348 set d_shmatprototype
11349 eval $setvar
11350
11351 : see if shmdt exists
11352 set shmdt d_shmdt
11353 eval $inlibc
11354
11355 : see how much of the 'shm*(2)' library is present.
11356 h_shm=true
11357 echo " "
11358 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11359 *"$undef"*) h_shm=false;;
11360 esac
11361 case "$osname" in
11362 freebsd)
11363     case "`ipcs 2>&1`" in
11364     "SVID shared memory"*"not configured"*)
11365         echo "Your $osname does not have the shm*(2) configured." >&4
11366         h_shm=false
11367         val="$undef"
11368         set shmctl d_shmctl
11369         evat $setvar
11370         set shmget d_shmget
11371         evat $setvar
11372         set shmat d_shmat
11373         evat $setvar
11374         set shmdt d_shmdt
11375         evat $setvar
11376         ;;
11377     esac
11378     ;;
11379 esac
11380 : we could also check for sys/ipc.h ...
11381 if $h_shm && $test `./findhdr sys/shm.h`; then
11382         echo "You have the full shm*(2) library." >&4
11383         val="$define"
11384 else
11385         echo "You don't have the full shm*(2) library." >&4
11386         val="$undef"
11387 fi
11388 set d_shm
11389 eval $setvar
11390
11391 echo " "
11392 : see if we have sigaction
11393 if set sigaction val -f d_sigaction; eval $csym; $val; then
11394         echo 'sigaction() found.' >&4
11395         $cat > try.c <<'EOP'
11396 #include <stdio.h>
11397 #include <sys/types.h>
11398 #include <signal.h>
11399 int main()
11400 {
11401     struct sigaction act, oact;
11402     act.sa_flags = 0;
11403     oact.sa_handler = 0;
11404     /* so that act and oact are used */
11405     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11406 }
11407 EOP
11408         set try
11409         if eval $compile_ok; then
11410                 val="$define"
11411         else
11412                 echo "But you don't seem to have a useable struct sigaction." >&4
11413                 val="$undef"
11414         fi
11415 else
11416         echo 'sigaction NOT found.' >&4
11417         val="$undef"
11418 fi
11419 set d_sigaction; eval $setvar
11420 $rm -f try try$_o try.c
11421
11422 : see if sigsetjmp exists
11423 echo " "
11424 case "$d_sigsetjmp" in
11425 '')
11426         $cat >try.c <<'EOP'
11427 #include <setjmp.h>
11428 sigjmp_buf env;
11429 int set = 1;
11430 int main()
11431 {
11432         if (sigsetjmp(env,1))
11433                 exit(set);
11434         set = 0;
11435         siglongjmp(env, 1);
11436         exit(1);
11437 }
11438 EOP
11439         set try
11440         if eval $compile; then
11441                 if ./try >/dev/null 2>&1; then
11442                         echo "POSIX sigsetjmp found." >&4
11443                         val="$define"
11444                 else
11445                         $cat >&4 <<EOM
11446 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11447 I'll ignore them.
11448 EOM
11449                         val="$undef"
11450                 fi
11451         else
11452                 echo "sigsetjmp not found." >&4
11453                 val="$undef"
11454         fi
11455         ;;
11456 *) val="$d_sigsetjmp"
11457         case "$d_sigsetjmp" in
11458         $define) echo "POSIX sigsetjmp found." >&4;;
11459         $undef) echo "sigsetjmp not found." >&4;;
11460         esac
11461         ;;
11462 esac
11463 set d_sigsetjmp
11464 eval $setvar
11465 $rm -f try.c try
11466
11467 : see if socks5_init exists
11468 set socks5_init d_socks5_init
11469 eval $inlibc
11470
11471 : see if sys/stat.h is available
11472 set sys/stat.h i_sysstat
11473 eval $inhdr
11474
11475
11476 : see if stat knows about block sizes
11477 echo " "
11478 echo "Checking to see if your struct stat has st_blocks field..." >&4
11479 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11480 eval $hasfield
11481
11482
11483 : see if this is a sys/vfs.h system
11484 set sys/vfs.h i_sysvfs
11485 eval $inhdr
11486
11487
11488 : see if this is a sys/statfs.h system
11489 set sys/statfs.h i_sysstatfs
11490 eval $inhdr
11491
11492
11493 echo " "
11494 echo "Checking to see if your system supports struct statfs..." >&4
11495 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
11496 eval $hasstruct
11497 case "$d_statfs_s" in
11498 "$define")      echo "Yes, it does."   ;;
11499 *)              echo "No, it doesn't." ;;
11500 esac
11501
11502
11503
11504 : see if struct statfs knows about f_flags
11505 case "$d_statfs_s" in
11506 define) 
11507         echo " "
11508         echo "Checking to see if your struct statfs has f_flags field..." >&4
11509         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
11510         eval $hasfield
11511         ;;
11512 *)      val="$undef"
11513         set d_statfs_f_flags
11514         eval $setvar
11515         ;;
11516 esac
11517 case "$d_statfs_f_flags" in
11518 "$define")      echo "Yes, it does."   ;;
11519 *)              echo "No, it doesn't." ;;
11520 esac
11521
11522 : see if _ptr and _cnt from stdio act std
11523 echo " "
11524
11525 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11526         echo "(Looks like you have stdio.h from BSD.)"
11527         case "$stdio_ptr" in
11528         '') stdio_ptr='((fp)->_p)'
11529                 ptr_lval=$define
11530                 ;;
11531         *)      ptr_lval=$d_stdio_ptr_lval;;
11532         esac
11533         case "$stdio_cnt" in
11534         '') stdio_cnt='((fp)->_r)'
11535                 cnt_lval=$define
11536                 ;;
11537         *)      cnt_lval=$d_stdio_cnt_lval;;
11538         esac
11539         case "$stdio_base" in
11540         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11541         esac
11542         case "$stdio_bufsiz" in
11543         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11544         esac
11545 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11546         echo "(Looks like you have stdio.h from Linux.)"
11547         case "$stdio_ptr" in
11548         '') stdio_ptr='((fp)->_IO_read_ptr)'
11549                 ptr_lval=$define
11550                 ;;
11551         *)      ptr_lval=$d_stdio_ptr_lval;;
11552         esac
11553         case "$stdio_cnt" in
11554         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11555                 cnt_lval=$undef
11556                 ;;
11557         *)      cnt_lval=$d_stdio_cnt_lval;;
11558         esac
11559         case "$stdio_base" in
11560         '') stdio_base='((fp)->_IO_read_base)';;
11561         esac
11562         case "$stdio_bufsiz" in
11563         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11564         esac
11565 else
11566         case "$stdio_ptr" in
11567         '') stdio_ptr='((fp)->_ptr)'
11568                 ptr_lval=$define
11569                 ;;
11570         *)      ptr_lval=$d_stdio_ptr_lval;;
11571         esac
11572         case "$stdio_cnt" in
11573         '') stdio_cnt='((fp)->_cnt)'
11574                 cnt_lval=$define
11575                 ;;
11576         *)      cnt_lval=$d_stdio_cnt_lval;;
11577         esac
11578         case "$stdio_base" in
11579         '') stdio_base='((fp)->_base)';;
11580         esac
11581         case "$stdio_bufsiz" in
11582         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11583         esac
11584 fi
11585
11586 : test whether _ptr and _cnt really work
11587 echo "Checking how std your stdio is..." >&4
11588 $cat >try.c <<EOP
11589 #include <stdio.h>
11590 #define FILE_ptr(fp)    $stdio_ptr
11591 #define FILE_cnt(fp)    $stdio_cnt
11592 int main() {
11593         FILE *fp = fopen("try.c", "r");
11594         char c = getc(fp);
11595         if (
11596                 18 <= FILE_cnt(fp) &&
11597                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11598         )
11599                 exit(0);
11600         exit(1);
11601 }
11602 EOP
11603 val="$undef"
11604 set try
11605 if eval $compile; then
11606         if ./try; then
11607                 echo "Your stdio acts pretty std."
11608                 val="$define"
11609         else
11610                 echo "Your stdio isn't very std."
11611         fi
11612 else
11613         echo "Your stdio doesn't appear very std."
11614 fi
11615 $rm -f try.c try
11616 set d_stdstdio
11617 eval $setvar
11618
11619 : Can _ptr be used as an lvalue?
11620 case "$d_stdstdio$ptr_lval" in
11621 $define$define) val=$define ;;
11622 *) val=$undef ;;
11623 esac
11624 set d_stdio_ptr_lval
11625 eval $setvar
11626
11627 : Can _cnt be used as an lvalue?
11628 case "$d_stdstdio$cnt_lval" in
11629 $define$define) val=$define ;;
11630 *) val=$undef ;;
11631 esac
11632 set d_stdio_cnt_lval
11633 eval $setvar
11634
11635
11636 : test whether setting _ptr sets _cnt as a side effect
11637 d_stdio_ptr_lval_sets_cnt="$undef"
11638 d_stdio_ptr_lval_nochange_cnt="$undef"
11639 case "$d_stdio_ptr_lval$d_stdstdio" in
11640 $define$define)
11641         echo "Checking to see what happens if we set the stdio ptr..." >&4
11642 $cat >try.c <<EOP
11643 #include <stdio.h>
11644 /* Can we scream? */
11645 /* Eat dust sed :-) */
11646 /* In the buffer space, no one can hear you scream. */
11647 #define FILE_ptr(fp)    $stdio_ptr
11648 #define FILE_cnt(fp)    $stdio_cnt
11649 #include <sys/types.h>
11650 int main() {
11651         FILE *fp = fopen("try.c", "r");
11652         int c;
11653         char *ptr;
11654         size_t cnt;
11655         if (!fp) {
11656             puts("Fail even to read");
11657             exit(1);
11658         }
11659         c = getc(fp); /* Read away the first # */
11660         if (c == EOF) {
11661             puts("Fail even to read");
11662             exit(1);
11663         }
11664         if (!(
11665                 18 <= FILE_cnt(fp) &&
11666                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11667         )) {
11668                 puts("Fail even to read");
11669                 exit (1);
11670         }
11671         ptr = (char*) FILE_ptr(fp);
11672         cnt = (size_t)FILE_cnt(fp);
11673
11674         FILE_ptr(fp) += 42;
11675
11676         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11677                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11678                 exit (1);
11679         }
11680         if (FILE_cnt(fp) <= 20) {
11681                 printf ("Fail (<20 chars to test)");
11682                 exit (1);
11683         }
11684         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11685                 puts("Fail compare");
11686                 exit (1);
11687         }
11688         if (cnt == FILE_cnt(fp)) {
11689                 puts("Pass_unchanged");
11690                 exit (0);
11691         }       
11692         if (FILE_cnt(fp) == (cnt - 42)) {
11693                 puts("Pass_changed");
11694                 exit (0);
11695         }
11696         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11697         return 1;
11698
11699 }
11700 EOP
11701         set try
11702         if eval $compile; then
11703                 case `./try$exe_ext` in
11704                 Pass_changed)
11705                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11706                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11707                 Pass_unchanged)
11708                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11709                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11710                 Fail*)
11711                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11712                 *)
11713                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11714         esac
11715         else
11716                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11717         fi
11718         $rm -f try.c try
11719         ;;
11720 esac
11721
11722 : see if _base is also standard
11723 val="$undef"
11724 case "$d_stdstdio" in
11725 $define)
11726         $cat >try.c <<EOP
11727 #include <stdio.h>
11728 #define FILE_base(fp)   $stdio_base
11729 #define FILE_bufsiz(fp) $stdio_bufsiz
11730 int main() {
11731         FILE *fp = fopen("try.c", "r");
11732         char c = getc(fp);
11733         if (
11734                 19 <= FILE_bufsiz(fp) &&
11735                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11736         )
11737                 exit(0);
11738         exit(1);
11739 }
11740 EOP
11741         set try
11742         if eval $compile; then
11743                 if ./try; then
11744                         echo "And its _base field acts std."
11745                         val="$define"
11746                 else
11747                         echo "But its _base field isn't std."
11748                 fi
11749         else
11750                 echo "However, it seems to be lacking the _base field."
11751         fi
11752         $rm -f try.c try
11753         ;;
11754 esac
11755 set d_stdiobase
11756 eval $setvar
11757
11758 $cat >&4 <<EOM
11759 Checking how to access stdio streams by file descriptor number...
11760 EOM
11761 case "$stdio_stream_array" in
11762 '')     $cat >try.c <<EOCP
11763 #include <stdio.h>
11764 int main() {
11765   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11766     printf("yes\n");
11767 }
11768 EOCP
11769         for s in _iob __iob __sF
11770         do
11771                 set try -DSTDIO_STREAM_ARRAY=$s
11772                 if eval $compile; then
11773                         case "`./try$exe_ext`" in
11774                         yes)    stdio_stream_array=$s; break ;;
11775                         esac
11776                 fi
11777         done
11778         $rm -f try.* try$exe_ext
11779 esac
11780 case "$stdio_stream_array" in
11781 '')     $cat >&4 <<EOM
11782 I can't figure out how to access stdio streams by file descriptor number.
11783 EOM
11784         d_stdio_stream_array="$undef"
11785         ;;
11786 *)      $cat >&4 <<EOM
11787 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11788 EOM
11789         d_stdio_stream_array="$define"
11790         ;;
11791 esac
11792
11793 : see if strcoll exists
11794 set strcoll d_strcoll
11795 eval $inlibc
11796
11797 : check for structure copying
11798 echo " "
11799 echo "Checking to see if your C compiler can copy structs..." >&4
11800 $cat >try.c <<'EOCP'
11801 int main()
11802 {
11803         struct blurfl {
11804                 int dyick;
11805         } foo, bar;
11806
11807         foo = bar;
11808 }
11809 EOCP
11810 if $cc -c try.c >/dev/null 2>&1 ; then
11811         val="$define"
11812         echo "Yup, it can."
11813 else
11814         val="$undef"
11815         echo "Nope, it can't."
11816 fi
11817 set d_strctcpy
11818 eval $setvar
11819 $rm -f try.*
11820
11821 : see if strerror and/or sys_errlist[] exist
11822 echo " "
11823 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11824     if set strerror val -f d_strerror; eval $csym; $val; then
11825                 echo 'strerror() found.' >&4
11826                 d_strerror="$define"
11827                 d_strerrm='strerror(e)'
11828                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11829                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11830                         d_syserrlst="$define"
11831                 else
11832                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11833                         d_syserrlst="$undef"
11834                 fi
11835     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11836                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11837                 echo 'strerror() found in string header.' >&4
11838                 d_strerror="$define"
11839                 d_strerrm='strerror(e)'
11840                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11841                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11842                                 d_syserrlst="$define"
11843                 else
11844                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11845                         d_syserrlst="$undef"
11846                 fi
11847     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11848                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11849                 d_strerror="$undef"
11850                 d_syserrlst="$define"
11851                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11852     else
11853                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11854                 d_strerror="$undef"
11855                 d_syserrlst="$undef"
11856                 d_strerrm='"unknown"'
11857     fi
11858 fi
11859
11860 : see if strtod exists
11861 set strtod d_strtod
11862 eval $inlibc
11863
11864 : see if strtol exists
11865 set strtol d_strtol
11866 eval $inlibc
11867
11868 : see if strtold exists
11869 set strtold d_strtold
11870 eval $inlibc
11871
11872 : see if strtoll exists
11873 set strtoll d_strtoll
11874 eval $inlibc
11875
11876 case "$d_longlong-$d_strtoll" in
11877 "$define-$define")
11878         $cat <<EOM
11879 Checking whether your strtoll() works okay...
11880 EOM
11881         $cat >try.c <<'EOCP'
11882 #include <errno.h>
11883 #ifdef __hpux
11884 #define strtoll __strtoll
11885 #endif
11886 #ifdef __EMX__
11887 #define strtoll _strtoll
11888 #endif
11889 #include <stdio.h>
11890 extern long long int strtoll(char *s, char **, int); 
11891 static int bad = 0;
11892 int check(char *s, long long ell, int een) {
11893         long long gll;
11894         errno = 0;
11895         gll = strtoll(s, 0, 10);
11896         if (!((gll == ell) && (errno == een)))
11897                 bad++;
11898 }
11899 int main() {
11900         check(" 1",                                      1LL, 0);
11901         check(" 0",                                      0LL, 0);
11902         check("-1",                                     -1LL, 0);
11903         check("-9223372036854775808", -9223372036854775808LL, 0);
11904         check("-9223372036854775808", -9223372036854775808LL, 0);
11905         check(" 9223372036854775807",  9223372036854775807LL, 0);
11906         check("-9223372036854775808", -9223372036854775808LL, 0);
11907         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11908         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11909         if (!bad)
11910                 printf("ok\n");
11911 }
11912 EOCP
11913         set try
11914         if eval $compile; then
11915                 yyy=`./try`
11916                 case "$yyy" in
11917                 ok) echo "Your strtoll() seems to be working okay." ;;
11918                 *) cat <<EOM >&4
11919 Your strtoll() doesn't seem to be working okay.
11920 EOM
11921                    d_strtoll="$undef"
11922                    ;;
11923                 esac
11924         else
11925                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11926                 d_strtoll="$undef"
11927         fi
11928         ;;
11929 esac
11930
11931 : see if strtoq exists
11932 set strtoq d_strtoq
11933 eval $inlibc
11934
11935 : see if strtoul exists
11936 set strtoul d_strtoul
11937 eval $inlibc
11938
11939 case "$d_strtoul" in
11940 "$define")
11941         $cat <<EOM
11942 Checking whether your strtoul() works okay...
11943 EOM
11944         $cat >try.c <<'EOCP'
11945 #include <errno.h>
11946 #include <stdio.h>
11947 extern unsigned long int strtoul(char *s, char **, int); 
11948 static int bad = 0;
11949 void check(char *s, unsigned long eul, int een) {
11950         unsigned long gul;
11951         errno = 0;
11952         gul = strtoul(s, 0, 10);
11953         if (!((gul == eul) && (errno == een)))
11954                 bad++;
11955 }
11956 int main() {
11957         check(" 1", 1L, 0);
11958         check(" 0", 0L, 0);
11959 EOCP
11960         case "$longsize" in
11961         8)
11962             $cat >>try.c <<'EOCP'
11963         check("18446744073709551615", 18446744073709551615ULL, 0);
11964         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11965         check("-1", 18446744073709551615ULL, 0);
11966         check("-18446744073709551614", 2, 0);
11967         check("-18446744073709551615", 1, 0);
11968         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
11969         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
11970 EOCP
11971                 ;;
11972         4)
11973                     $cat >>try.c <<'EOCP'
11974         check("4294967295", 4294967295UL, 0);
11975         check("4294967296", 4294967295UL, ERANGE);
11976         check("-1", 4294967295UL, 0);
11977         check("-4294967294", 2, 0);
11978         check("-4294967295", 1, 0);
11979         check("-4294967296", 4294967295UL, ERANGE);
11980         check("-4294967297", 4294967295UL, ERANGE);
11981 EOCP
11982                 ;;
11983         *)
11984 : Should we write these tests to be more portable by sprintf-ing
11985 : ~0 and then manipulating that char string as input for strtol?
11986                 ;;
11987         esac
11988         $cat >>try.c <<'EOCP'
11989         if (!bad)
11990                 printf("ok\n");
11991         return 0;
11992 }
11993 EOCP
11994         set try
11995         if eval $compile; then
11996                 case "`./try`" in
11997                 ok) echo "Your strtoul() seems to be working okay." ;;
11998                 *) cat <<EOM >&4
11999 Your strtoul() doesn't seem to be working okay.
12000 EOM
12001                    d_strtoul="$undef"
12002                    ;;
12003                 esac
12004         fi
12005         ;;
12006 esac
12007
12008 : see if strtoull exists
12009 set strtoull d_strtoull
12010 eval $inlibc
12011
12012 case "$d_longlong-$d_strtoull" in
12013 "$define-$define")
12014         $cat <<EOM
12015 Checking whether your strtoull() works okay...
12016 EOM
12017         $cat >try.c <<'EOCP'
12018 #include <errno.h>
12019 #ifdef __hpux
12020 #define strtoull __strtoull
12021 #endif
12022 #include <stdio.h>
12023 extern unsigned long long int strtoull(char *s, char **, int); 
12024 static int bad = 0;
12025 int check(char *s, long long eull, int een) {
12026         long long gull;
12027         errno = 0;
12028         gull = strtoull(s, 0, 10);
12029         if (!((gull == eull) && (errno == een)))
12030                 bad++;
12031 }
12032 int main() {
12033         check(" 1",                                        1LL, 0);
12034         check(" 0",                                        0LL, 0);
12035         check("18446744073709551615",  18446744073709551615ULL, 0);
12036         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12037         check("-1",                    18446744073709551615ULL, 0);
12038         check("-18446744073709551614",                     2LL, 0);
12039         check("-18446744073709551615",                     1LL, 0);
12040         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12041         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12042         if (!bad)
12043                 printf("ok\n");
12044 }
12045 EOCP
12046         set try
12047         if eval $compile; then
12048                 case "`./try`" in
12049                 ok) echo "Your strtoull() seems to be working okay." ;;
12050                 *) cat <<EOM >&4
12051 Your strtoull() doesn't seem to be working okay.
12052 EOM
12053                    d_strtoull="$undef"
12054                    ;;
12055                 esac
12056         fi
12057         ;;
12058 esac
12059
12060 : see if strtouq exists
12061 set strtouq d_strtouq
12062 eval $inlibc
12063
12064 case "$d_strtouq" in
12065 "$define")
12066         $cat <<EOM
12067 Checking whether your strtouq() works okay...
12068 EOM
12069         $cat >try.c <<'EOCP'
12070 #include <errno.h>
12071 #include <stdio.h>
12072 extern unsigned long long int strtouq(char *s, char **, int); 
12073 static int bad = 0;
12074 void check(char *s, unsigned long long eull, int een) {
12075         unsigned long long gull;
12076         errno = 0;
12077         gull = strtouq(s, 0, 10);
12078         if (!((gull == eull) && (errno == een)))
12079                 bad++;
12080 }
12081 int main() {
12082         check(" 1",                                        1LL, 0);
12083         check(" 0",                                        0LL, 0);
12084         check("18446744073709551615",  18446744073709551615ULL, 0);
12085         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12086         check("-1",                    18446744073709551615ULL, 0);
12087         check("-18446744073709551614",                     2LL, 0);
12088         check("-18446744073709551615",                     1LL, 0);
12089         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12090         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12091         if (!bad)
12092                 printf("ok\n");
12093         return 0;
12094 }
12095 EOCP
12096         set try
12097         if eval $compile; then
12098                 case "`./try`" in
12099                 ok) echo "Your strtouq() seems to be working okay." ;;
12100                 *) cat <<EOM >&4
12101 Your strtouq() doesn't seem to be working okay.
12102 EOM
12103                    d_strtouq="$undef"
12104                    ;;
12105                 esac
12106         fi
12107         ;;
12108 esac
12109
12110 : see if strxfrm exists
12111 set strxfrm d_strxfrm
12112 eval $inlibc
12113
12114 : see if symlink exists
12115 set symlink d_symlink
12116 eval $inlibc
12117
12118 : see if syscall exists
12119 set syscall d_syscall
12120 eval $inlibc
12121
12122 : see if sysconf exists
12123 set sysconf d_sysconf
12124 eval $inlibc
12125
12126 : see if system exists
12127 set system d_system
12128 eval $inlibc
12129
12130 : see if tcgetpgrp exists
12131 set tcgetpgrp d_tcgetpgrp
12132 eval $inlibc
12133
12134 : see if tcsetpgrp exists
12135 set tcsetpgrp d_tcsetpgrp
12136 eval $inlibc
12137
12138 : see if prototype for telldir is available
12139 echo " "
12140 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12141 eval $hasproto
12142
12143 : see if this is a sys/times.h system
12144 set sys/times.h i_systimes
12145 eval $inhdr
12146
12147 : see if times exists
12148 echo " "
12149 if set times val -f d_times; eval $csym; $val; then
12150         echo 'times() found.' >&4
12151         d_times="$define"
12152         inc=''
12153         case "$i_systimes" in
12154         "$define") inc='sys/times.h';;
12155         esac
12156         rp="What is the type returned by times() on this system?"
12157         set clock_t clocktype long stdio.h sys/types.h $inc
12158         eval $typedef_ask
12159 else
12160         echo 'times() NOT found, hope that will do.' >&4
12161         d_times="$undef"
12162         clocktype='int'
12163 fi
12164
12165 : see if truncate exists
12166 set truncate d_truncate
12167 eval $inlibc
12168
12169 : see if tzname[] exists
12170 echo " "
12171 if set tzname val -a d_tzname; eval $csym; $val; then
12172         val="$define"
12173         echo 'tzname[] found.' >&4
12174 else
12175         val="$undef"
12176         echo 'tzname[] NOT found.' >&4
12177 fi
12178 set d_tzname
12179 eval $setvar
12180
12181 : see if umask exists
12182 set umask d_umask
12183 eval $inlibc
12184
12185 : see if ustat exists
12186 set ustat d_ustat
12187 eval $inlibc
12188
12189 : backward compatibility for d_hvfork
12190 if test X$d_hvfork != X; then
12191         d_vfork="$d_hvfork"
12192         d_hvfork=''
12193 fi
12194 : see if there is a vfork
12195 val=''
12196 set vfork val
12197 eval $inlibc
12198
12199 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12200 : perl on Solaris 2.x, and probably elsewhere.
12201 case "$val" in
12202 $define)
12203         echo " "
12204         case "$usevfork" in
12205         false) dflt='n';;
12206         *) dflt='y';;
12207         esac
12208         cat <<'EOM'
12209  
12210 Perl can only use a vfork() that doesn't suffer from strict
12211 restrictions on calling functions or modifying global data in
12212 the child.  For example, glibc-2.1 contains such a vfork()
12213 that is unsuitable.  If your system provides a proper fork()
12214 call, chances are that you do NOT want perl to use vfork().
12215
12216 EOM
12217         rp="Do you still want to use vfork()?"
12218         . ./myread
12219         case "$ans" in
12220         y|Y) ;;
12221         *)
12222                 echo "Ok, we won't use vfork()."
12223                 val="$undef"
12224                 ;;
12225         esac
12226         ;;
12227 esac
12228 set d_vfork
12229 eval $setvar
12230 case "$d_vfork" in
12231 $define) usevfork='true';;
12232 *) usevfork='false';;
12233 esac
12234
12235 : see if this is an sysdir system
12236 set sys/dir.h i_sysdir
12237 eval $inhdr
12238
12239 : see if this is an sysndir system
12240 set sys/ndir.h i_sysndir
12241 eval $inhdr
12242
12243 : see if closedir exists
12244 set closedir d_closedir
12245 eval $inlibc
12246
12247 case "$d_closedir" in
12248 "$define")
12249         echo " "
12250         echo "Checking whether closedir() returns a status..." >&4
12251         cat > closedir.c <<EOM
12252 #$i_dirent I_DIRENT             /**/
12253 #$i_sysdir I_SYS_DIR            /**/
12254 #$i_sysndir I_SYS_NDIR          /**/
12255 #$i_systypes I_SYS_TYPES        /**/
12256
12257 #if defined(I_SYS_TYPES)
12258 #include <sys/types.h>
12259 #endif
12260 #if defined(I_DIRENT)
12261 #include <dirent.h>
12262 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12263 #include <sys/dir.h>
12264 #endif
12265 #else
12266 #ifdef I_SYS_NDIR
12267 #include <sys/ndir.h>
12268 #else
12269 #ifdef I_SYS_DIR
12270 #ifdef hp9000s500
12271 #include <ndir.h>       /* may be wrong in the future */
12272 #else
12273 #include <sys/dir.h>
12274 #endif
12275 #endif
12276 #endif
12277 #endif 
12278 int main() { return closedir(opendir(".")); }
12279 EOM
12280         set closedir
12281         if eval $compile_ok; then
12282                 if ./closedir > /dev/null 2>&1 ; then
12283                         echo "Yes, it does."
12284                         val="$undef"
12285                 else
12286                         echo "No, it doesn't."
12287                         val="$define"
12288                 fi
12289         else
12290                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12291                 val="$define"
12292         fi
12293         ;;
12294 *)
12295         val="$undef";
12296         ;;
12297 esac
12298 set d_void_closedir
12299 eval $setvar
12300 $rm -f closedir*
12301 : see if there is a wait4
12302 set wait4 d_wait4
12303 eval $inlibc
12304
12305 : see if waitpid exists
12306 set waitpid d_waitpid
12307 eval $inlibc
12308
12309 : see if wcstombs exists
12310 set wcstombs d_wcstombs
12311 eval $inlibc
12312
12313 : see if wctomb exists
12314 set wctomb d_wctomb
12315 eval $inlibc
12316
12317 : preserve RCS keywords in files with variable substitution, grrr
12318 Date='$Date'
12319 Id='$Id'
12320 Log='$Log'
12321 RCSfile='$RCSfile'
12322 Revision='$Revision'
12323
12324 case "$crosscompile" in
12325 ''|[nN]*) crosscompile="$undef" ;;
12326 esac
12327
12328 case "$osname" in
12329 next|rhapsody|darwin) multiarch="$define" ;;
12330 esac
12331 case "$multiarch" in
12332 ''|[nN]*) multiarch="$undef" ;;
12333 esac
12334
12335 : check for alignment requirements
12336 echo " "
12337 case "$crosscompile$multiarch" in
12338 *$define*)
12339         $cat <<EOM
12340 You seem to be either cross-compiling or doing a multiarchitecture build,
12341 skipping the memory alignment check.
12342
12343 EOM
12344         case "$alignbytes" in
12345         '') alignbytes=8 ;;
12346         esac
12347         ;;
12348 *)
12349         case "$alignbytes" in
12350         '') echo "Checking alignment constraints..." >&4
12351                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12352                         $cat >try.c <<'EOCP'
12353 typedef long double NV;
12354 EOCP
12355                 else
12356                         $cat >try.c <<'EOCP'
12357 typedef double NV;
12358 EOCP
12359                 fi
12360                 $cat >>try.c <<'EOCP'
12361 #include <stdio.h>
12362 struct foobar {
12363         char foo;
12364         NV bar;
12365 } try_algn;
12366 int main()
12367 {
12368     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12369     return(0);
12370 }
12371 EOCP
12372                 set try
12373                 if eval $compile_ok; then
12374                         dflt=`./try`
12375                 else
12376                         dflt='8'
12377                         echo "(I can't seem to compile the test program...)"
12378                 fi
12379                 ;;
12380         *) dflt="$alignbytes"
12381                 ;;
12382         esac
12383         rp="Doubles must be aligned on a how-many-byte boundary?"
12384         . ./myread
12385         alignbytes="$ans"
12386         $rm -f try.c try
12387         ;;
12388 esac
12389
12390
12391 : set the base revision
12392 baserev=5.0
12393
12394 : check for ordering of bytes in a long
12395 echo " "
12396 case "$crosscompile$multiarch" in
12397 *$define*)
12398         $cat <<EOM
12399 You seem to be either cross-compiling or doing a multiarchitecture build,
12400 skipping the byteorder check.
12401
12402 EOM
12403         byteorder='0xffff'
12404         ;;
12405 *)
12406         case "$byteorder" in
12407         '')
12408                 $cat <<'EOM'
12409 In the following, larger digits indicate more significance.  A big-endian
12410 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12411 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12412 machines may have weird orders like 3412.  A Cray will report 87654321,
12413 an Alpha will report 12345678. If the test program works the default is
12414 probably right.
12415 I'm now running the test program...
12416 EOM
12417                 $cat >try.c <<'EOCP'
12418 #include <stdio.h>
12419 int main()
12420 {
12421         int i;
12422         union {
12423                 unsigned long l;
12424                 char c[sizeof(long)];
12425         } u;
12426
12427         if (sizeof(long) > 4)
12428                 u.l = (0x08070605L << 32) | 0x04030201L;
12429         else
12430                 u.l = 0x04030201L;
12431         for (i = 0; i < sizeof(long); i++)
12432                 printf("%c", u.c[i]+'0');
12433         printf("\n");
12434         exit(0);
12435 }
12436 EOCP
12437                 xxx_prompt=y
12438                 set try
12439                 if eval $compile && ./try > /dev/null; then
12440                         dflt=`./try`
12441                         case "$dflt" in
12442                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12443                                 echo "(The test program ran ok.)"
12444                                 echo "byteorder=$dflt"
12445                                 xxx_prompt=n
12446                         ;;
12447                         ????|????????) echo "(The test program ran ok.)" ;;
12448                         *) echo "(The test program didn't run right for some reason.)" ;;
12449                         esac
12450                 else
12451                         dflt='4321'
12452                         cat <<'EOM'
12453 (I can't seem to compile the test program.  Guessing big-endian...)
12454 EOM
12455                 fi
12456                 case "$xxx_prompt" in
12457                 y)
12458                         rp="What is the order of bytes in a long?"
12459                         . ./myread
12460                         byteorder="$ans"
12461                         ;;
12462                 *)      byteorder=$dflt
12463                         ;;
12464                 esac
12465                 ;;
12466         esac
12467         $rm -f try.c try
12468         ;;
12469 esac
12470
12471
12472 : how do we catenate cpp tokens here?
12473 echo " "
12474 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12475 $cat >cpp_stuff.c <<'EOCP'
12476 #define RCAT(a,b)a/**/b
12477 #define ACAT(a,b)a ## b
12478 RCAT(Rei,ser)
12479 ACAT(Cir,cus)
12480 EOCP
12481 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12482 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12483         echo "Oh!  Smells like ANSI's been here." >&4
12484         echo "We can catify or stringify, separately or together!"
12485         cpp_stuff=42
12486 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12487         echo "Ah, yes!  The good old days!" >&4
12488         echo "However, in the good old days we don't know how to stringify and"
12489         echo "catify at the same time."
12490         cpp_stuff=1
12491 else
12492         $cat >&4 <<EOM
12493 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12494 to have to edit the values of CAT[2-5] in config.h...
12495 EOM
12496         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12497 fi
12498 $rm -f cpp_stuff.*
12499
12500 : see if this is a db.h system
12501 set db.h i_db
12502 eval $inhdr
12503
12504 case "$i_db" in
12505 $define)
12506         : Check db version.
12507         echo " "
12508         echo "Checking Berkeley DB version ..." >&4
12509         $cat >try.c <<EOCP
12510 #$d_const HASCONST
12511 #ifndef HASCONST
12512 #define const
12513 #endif
12514 #include <sys/types.h>
12515 #include <stdio.h>
12516 #include <db.h>
12517 int main()
12518 {
12519 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12520     int Major, Minor, Patch ;
12521     unsigned long Version ;
12522     (void)db_version(&Major, &Minor, &Patch) ;
12523     printf("You have Berkeley DB Version 2 or greater\n");
12524
12525     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12526                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12527     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12528                 Major, Minor, Patch) ;
12529
12530     /* check that db.h & libdb are compatible */
12531     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12532         printf("db.h and libdb are incompatible\n") ;
12533         exit(3);        
12534     }
12535
12536     printf("db.h and libdb are compatible\n") ;
12537
12538     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12539                 + DB_VERSION_PATCH ;
12540
12541     /* needs to be >= 2.3.4 */
12542     if (Version < 2003004) {
12543     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12544         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12545         exit(2);        
12546     }
12547
12548     exit(0);
12549 #else
12550 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12551     printf("You have Berkeley DB Version 1\n");
12552     exit(0);    /* DB version < 2: the coast is clear. */
12553 #else
12554     exit(1);    /* <db.h> not Berkeley DB? */
12555 #endif
12556 #endif
12557 }
12558 EOCP
12559         set try
12560         if eval $compile_ok && ./try; then
12561                 echo 'Looks OK.' >&4
12562         else
12563                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12564                 i_db=$undef
12565                 case " $libs " in
12566                 *"-ldb "*)
12567                         : Remove db from list of libraries to use
12568                         echo "Removing unusable -ldb from library list" >&4
12569                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12570                         shift
12571                         libs="$*"
12572                         echo "libs = $libs" >&4
12573                         ;;
12574                 esac
12575         fi
12576         $rm -f try.*
12577         ;;
12578 esac
12579
12580 case "$i_db" in
12581 define)
12582         : Check the return type needed for hash 
12583         echo " "
12584         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12585         $cat >try.c <<EOCP
12586 #$d_const HASCONST
12587 #ifndef HASCONST
12588 #define const
12589 #endif
12590 #include <sys/types.h>
12591 #include <db.h>
12592
12593 #ifndef DB_VERSION_MAJOR
12594 u_int32_t hash_cb (ptr, size)
12595 const void *ptr;
12596 size_t size;
12597 {
12598 }
12599 HASHINFO info;
12600 int main()
12601 {
12602         info.hash = hash_cb;
12603 }
12604 #endif
12605 EOCP
12606         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12607                 if $contains warning try.out >>/dev/null 2>&1 ; then
12608                         db_hashtype='int'
12609                 else
12610                         db_hashtype='u_int32_t'
12611                 fi
12612         else
12613                 : XXX Maybe we should just give up here.
12614                 db_hashtype=u_int32_t
12615                 $cat try.out >&4
12616                 echo "Help:  I can't seem to compile the db test program." >&4
12617                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12618         fi
12619         $rm -f try.*
12620         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12621         ;;
12622 *)      db_hashtype=u_int32_t
12623         ;;
12624 esac
12625 case "$i_db" in
12626 define)
12627         : Check the return type needed for prefix 
12628         echo " "
12629         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12630         cat >try.c <<EOCP
12631 #$d_const HASCONST
12632 #ifndef HASCONST
12633 #define const
12634 #endif
12635 #include <sys/types.h>
12636 #include <db.h>
12637
12638 #ifndef DB_VERSION_MAJOR
12639 size_t prefix_cb (key1, key2)
12640 const DBT *key1;
12641 const DBT *key2;
12642 {
12643 }
12644 BTREEINFO info;
12645 int main()
12646 {
12647         info.prefix = prefix_cb;
12648 }
12649 #endif
12650 EOCP
12651         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12652                 if $contains warning try.out >>/dev/null 2>&1 ; then
12653                         db_prefixtype='int'
12654                 else
12655                         db_prefixtype='size_t'
12656                 fi
12657         else
12658                 db_prefixtype='size_t'
12659                 : XXX Maybe we should just give up here.
12660                 $cat try.out >&4
12661                 echo "Help:  I can't seem to compile the db test program." >&4
12662                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12663         fi
12664         $rm -f try.*
12665         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12666         ;;
12667 *)      db_prefixtype='size_t'
12668         ;;
12669 esac
12670
12671 : check for void type
12672 echo " "
12673 echo "Checking to see how well your C compiler groks the void type..." >&4
12674 case "$voidflags" in
12675 '')
12676         $cat >try.c <<'EOCP'
12677 #if TRY & 1
12678 void sub() {
12679 #else
12680 sub() {
12681 #endif
12682         extern void moo();      /* function returning void */
12683         void (*goo)();          /* ptr to func returning void */
12684 #if TRY & 8
12685         void *hue;              /* generic ptr */
12686 #endif
12687 #if TRY & 2
12688         void (*foo[10])();
12689 #endif
12690
12691 #if TRY & 4
12692         if(goo == moo) {
12693                 exit(0);
12694         }
12695 #endif
12696         exit(0);
12697 }
12698 int main() { sub(); }
12699 EOCP
12700         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12701                 voidflags=$defvoidused
12702         echo "Good.  It appears to support void to the level $package wants.">&4
12703                 if $contains warning .out >/dev/null 2>&1; then
12704                         echo "However, you might get some warnings that look like this:"
12705                         $cat .out
12706                 fi
12707         else
12708 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12709                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12710                         echo "It supports 1..."
12711                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12712                                 echo "It also supports 2..."
12713                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12714                                         voidflags=7
12715                                         echo "And it supports 4 but not 8 definitely."
12716                                 else
12717                                         echo "It doesn't support 4..."
12718                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12719                                                 voidflags=11
12720                                                 echo "But it supports 8."
12721                                         else
12722                                                 voidflags=3
12723                                                 echo "Neither does it support 8."
12724                                         fi
12725                                 fi
12726                         else
12727                                 echo "It does not support 2..."
12728                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12729                                         voidflags=13
12730                                         echo "But it supports 4 and 8."
12731                                 else
12732                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12733                                                 voidflags=5
12734                                                 echo "And it supports 4 but has not heard about 8."
12735                                         else
12736                                                 echo "However it supports 8 but not 4."
12737                                         fi
12738                                 fi
12739                         fi
12740                 else
12741                         echo "There is no support at all for void."
12742                         voidflags=0
12743                 fi
12744         fi
12745 esac
12746 case "$voidflags" in
12747 "$defvoidused") ;;
12748 *)      $cat >&4 <<'EOM'
12749   Support flag bits are:
12750     1: basic void declarations.
12751     2: arrays of pointers to functions returning void.
12752     4: operations between pointers to and addresses of void functions.
12753     8: generic void pointers.
12754 EOM
12755         dflt="$voidflags";
12756         rp="Your void support flags add up to what?"
12757         . ./myread
12758         voidflags="$ans"
12759         ;;
12760 esac
12761 $rm -f try.* .out
12762
12763
12764 : How can we generate normalized random numbers ?
12765 echo " "
12766 echo "Looking for a random number function..." >&4
12767 case "$randfunc" in
12768 '')
12769         if set drand48 val -f; eval $csym; $val; then
12770                 dflt="drand48"
12771                 echo "Good, found drand48()." >&4
12772         elif set random val -f; eval $csym; $val; then
12773                 dflt="random"
12774                 echo "OK, found random()." >&4
12775         else
12776                 dflt="rand"
12777                 echo "Yick, looks like I have to use rand()." >&4
12778         fi
12779         echo " "
12780         ;;
12781 *)
12782         dflt="$randfunc"
12783         ;;
12784 esac
12785 cont=true
12786
12787 case "$ccflags" in
12788 *-Dmy_rand=*|*-Dmy_srand=*)
12789         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12790         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12791         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12792         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12793         ;;
12794 esac
12795
12796 while $test "$cont"; do
12797         rp="Use which function to generate random numbers?"
12798         . ./myread
12799         if $test "$ans" = "$dflt"; then
12800                 : null
12801         else
12802                 randbits=''
12803         fi
12804         randfunc="$ans"
12805         if set $ans val -f; eval $csym; $val; then
12806                 cont=''
12807         else
12808                 dflt=y
12809                 rp="I cannot find function $ans. Use that name anyway?"
12810                 . ./myread
12811                 dflt=rand
12812                 case "$ans" in
12813                         [yY]*) cont='';;
12814                 esac
12815         fi
12816         case "$cont" in
12817         '')
12818                 case "$randfunc" in
12819                 drand48)
12820                         drand01="drand48()"
12821                         seedfunc="srand48"
12822                         randbits=48
12823                         randseedtype=long
12824                         ;;
12825                 rand|random)
12826                         case "$randbits" in
12827                         '')
12828 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12829                                 $cat >try.c <<EOCP
12830 #$i_unistd I_UNISTD
12831 #$i_stdlib I_STDLIB
12832 #include <stdio.h>
12833 #ifdef I_UNISTD
12834 #  include <unistd.h>
12835 #endif
12836 #ifdef I_STDLIB
12837 #  include <stdlib.h>
12838 #endif
12839 int main()
12840 {
12841         register int i;
12842         register unsigned long tmp;
12843         register unsigned long max = 0L;
12844
12845         for (i = 1000; i; i--) {
12846                 tmp = (unsigned long) $randfunc();
12847                 if (tmp > max) max = tmp;
12848         }
12849         for (i = 0; max; i++)
12850                 max /= 2;
12851         printf("%d\n",i);
12852 }
12853 EOCP
12854                                 set try
12855                                 if eval $compile_ok; then
12856                                         dflt=`try`
12857                                 else
12858                                         dflt='?'
12859                                         echo "(I can't seem to compile the test program...)"
12860                                 fi
12861                                 ;;
12862                         *)
12863                                 dflt="$randbits"
12864                                 ;;
12865                         esac
12866                         rp="How many bits does your $randfunc() function produce?"
12867                         . ./myread
12868                         randbits="$ans"
12869                         $rm -f try.c try
12870                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12871                         seedfunc="s$randfunc"
12872                         randseedtype=unsigned
12873                         ;;
12874                 *)
12875                         dflt="31"
12876                         rp="How many bits does your $randfunc() function produce?"
12877                         . ./myread
12878                         randbits="$ans"
12879                         seedfunc="s$randfunc"
12880                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12881                         if set $seedfunc val -f; eval $csym; $val; then
12882                                 echo "(Using $seedfunc() to seed random generator)"
12883                         else
12884                                 echo "(Warning: no $seedfunc() to seed random generator)"
12885                                 seedfunc=rand
12886                         fi
12887                         randseedtype=unsigned
12888                         ;;
12889                 esac
12890                 ;;
12891         esac
12892 done
12893
12894 echo " "
12895 echo "Determining whether or not we are on an EBCDIC system..." >&4
12896 $cat >tebcdic.c <<'EOM'
12897 int main()
12898 {
12899   if ('M'==0xd4) return 0;
12900   return 1;
12901 }
12902 EOM
12903
12904 val=$undef
12905 set tebcdic
12906 if eval $compile_ok; then
12907         if ./tebcdic; then
12908                 echo "You seem to speak EBCDIC." >&4
12909                 val="$define"
12910         else
12911                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12912         fi
12913 else
12914         echo "I'm unable to compile the test program." >&4
12915         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12916 fi
12917 $rm -f tebcdic.c tebcdic
12918 set ebcdic
12919 eval $setvar
12920
12921 echo " "
12922 $cat >&4 <<EOM
12923 Checking how to flush all pending stdio output...
12924 EOM
12925 # I only know how to find the first 32 possibly open files on SunOS.
12926 # See also hints/sunos_4_1.sh and util.c  --AD
12927 case "$osname" in
12928 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12929 esac
12930 $cat >>try.c <<EOCP
12931 #include <stdio.h>
12932 #$i_unistd I_UNISTD
12933 #ifdef I_UNISTD
12934 # include <unistd.h>
12935 #endif
12936 #$d_sysconf HAS_SYSCONF
12937 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12938 #ifdef HAS_STDIO_STREAM_ARRAY
12939 # define STDIO_STREAM_ARRAY $stdio_stream_array
12940 #endif
12941 int main() {
12942   FILE* p = fopen("try.out", "w");
12943 #ifdef TRY_FPUTC
12944   fputc('x', p);
12945 #else
12946 # ifdef TRY_FPRINTF
12947   fprintf(p, "x");
12948 # endif
12949 #endif
12950 #ifdef TRY_FFLUSH_NULL
12951   fflush(NULL);
12952 #endif
12953 #ifdef TRY_FFLUSH_ALL
12954   {
12955     long open_max = -1;
12956 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12957     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12958 # else
12959 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12960     open_max = sysconf(_SC_OPEN_MAX);
12961 #  else
12962 #   ifdef FOPEN_MAX
12963     open_max = FOPEN_MAX;
12964 #   else
12965 #    ifdef OPEN_MAX
12966     open_max = OPEN_MAX;
12967 #    else
12968 #     ifdef _NFILE
12969     open_max = _NFILE;
12970 #     endif
12971 #    endif
12972 #   endif
12973 #  endif
12974 # endif 
12975 # ifdef HAS_STDIO_STREAM_ARRAY
12976     if (open_max > 0) {
12977       long i;
12978       for (i = 0; i < open_max; i++)
12979             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12980                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12981                 STDIO_STREAM_ARRAY[i]._flag)
12982                 fflush(&STDIO_STREAM_ARRAY[i]);
12983     }   
12984   }
12985 # endif
12986 #endif
12987   _exit(42);
12988 }
12989 EOCP
12990 : first we have to find out how _not_ to flush
12991 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12992     output=''
12993     set try -DTRY_FPUTC
12994     if eval $compile; then
12995             $rm -f try.out
12996             ./try$exe_ext 2>/dev/null
12997             if $test ! -s try.out -a "X$?" = X42; then
12998                 output=-DTRY_FPUTC
12999             fi
13000     fi
13001     case "$output" in
13002     '')
13003             set try -DTRY_FPRINTF
13004             $rm -f try.out
13005             if eval $compile; then
13006                     $rm -f try.out
13007                     ./try$exe_ext 2>/dev/null
13008                     if $test ! -s try.out -a "X$?" = X42; then
13009                         output=-DTRY_FPRINTF
13010                     fi
13011             fi
13012         ;;
13013     esac
13014 fi
13015 : check for fflush NULL behaviour
13016 case "$fflushNULL" in
13017 '')     set try -DTRY_FFLUSH_NULL $output
13018         if eval $compile; then
13019                 $rm -f try.out
13020                 ./try$exe_ext 2>/dev/null
13021                 code="$?"
13022                 if $test -s try.out -a "X$code" = X42; then
13023                         fflushNULL="`$cat try.out`"
13024                 else
13025                         if $test "X$code" != X42; then
13026                                 $cat >&4 <<EOM
13027 (If this test failed, don't worry, we'll try another method shortly.)
13028 EOM
13029                         fi
13030                 fi
13031         fi
13032         $rm -f core try.core core.try.*
13033         case "$fflushNULL" in
13034         x)      $cat >&4 <<EOM
13035 Your fflush(NULL) works okay for output streams.
13036 Let's see if it clobbers input pipes...
13037 EOM
13038 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13039 # bug that improperly flushes the input end of pipes.  So we avoid the
13040 # autoflush on fork/system/exec support for now. :-(
13041 $cat >tryp.c <<EOCP
13042 #include <stdio.h>
13043 int
13044 main(int argc, char **argv)
13045 {
13046     char buf[1024];
13047     int i;
13048     char *bp = buf;
13049     while (1) {
13050         while ((i = getc(stdin)) != -1
13051                && (*bp++ = i) != '\n'
13052                && bp < &buf[1024])
13053         /* DO NOTHING */ ;
13054         *bp = '\0';
13055         fprintf(stdout, "%s", buf);
13056         fflush(NULL);
13057         if (i == -1)
13058             return 0;
13059         bp = buf;
13060     }
13061 }
13062 EOCP
13063                 fflushNULL="$define"
13064                 set tryp
13065                 if eval $compile; then
13066                     $rm -f tryp.out
13067                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13068                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13069                        $cat >&4 <<EOM
13070 fflush(NULL) seems to behave okay with input streams.
13071 EOM
13072                         fflushNULL="$define"
13073                     else
13074                         $cat >&4 <<EOM
13075 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13076 EOM
13077                         fflushNULL="$undef"
13078                     fi
13079                 fi
13080                 $rm -f core tryp.c tryp.core core.tryp.*
13081                 ;;
13082         '')     $cat >&4 <<EOM
13083 Your fflush(NULL) isn't working (contrary to ANSI C).
13084 EOM
13085                 fflushNULL="$undef"
13086                 ;;
13087         *)      $cat >&4 <<EOM
13088 Cannot figure out whether your fflush(NULL) works or not.
13089 I'm assuming it doesn't (contrary to ANSI C).
13090 EOM
13091                 fflushNULL="$undef"
13092                 ;;
13093         esac
13094         ;;
13095 $define|true|[yY]*)
13096         fflushNULL="$define"
13097         ;;
13098 *)
13099         fflushNULL="$undef"
13100         ;;
13101 esac
13102 : check explicit looping only if NULL did not work, and if the pipe
13103 : bug does not show up on an explicit flush too
13104 case "$fflushNULL" in
13105 "$undef")
13106         $cat >tryp.c <<EOCP
13107 #include <stdio.h>
13108 int
13109 main(int argc, char **argv)
13110 {
13111     char buf[1024];
13112     int i;
13113     char *bp = buf;
13114     while (1) {
13115         while ((i = getc(stdin)) != -1
13116                && (*bp++ = i) != '\n'
13117                && bp < &buf[1024])
13118         /* DO NOTHING */ ;
13119         *bp = '\0';
13120         fprintf(stdout, "%s", buf);
13121         fflush(stdin);
13122         if (i == -1)
13123             return 0;
13124         bp = buf;
13125     }
13126 }
13127 EOCP
13128         set tryp
13129         if eval $compile; then
13130             $rm -f tryp.out
13131             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13132             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13133                $cat >&4 <<EOM
13134 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13135 EOM
13136                 : now check for fflushall behaviour
13137                 case "$fflushall" in
13138                 '')     set try -DTRY_FFLUSH_ALL $output
13139                         if eval $compile; then
13140                                 $cat >&4 <<EOM
13141 (Now testing the other method--but note that this also may fail.)
13142 EOM
13143                                 $rm -f try.out
13144                                 ./try$exe_ext 2>/dev/null
13145                                 if $test -s try.out -a "X$?" = X42; then
13146                                         fflushall="`$cat try.out`"
13147                                 fi
13148                         fi
13149                         $rm -f core try.core core.try.*
13150                         case "$fflushall" in
13151                         x)      $cat >&4 <<EOM
13152 Whew. Flushing explicitly all the stdio streams works.
13153 EOM
13154                                 fflushall="$define"
13155                                 ;;
13156                         '')     $cat >&4 <<EOM
13157 Sigh. Flushing explicitly all the stdio streams doesn't work.
13158 EOM
13159                                 fflushall="$undef"
13160                                 ;;
13161                         *)      $cat >&4 <<EOM
13162 Cannot figure out whether flushing stdio streams explicitly works or not.
13163 I'm assuming it doesn't.
13164 EOM
13165                                 fflushall="$undef"
13166                                 ;;
13167                         esac
13168                         ;;
13169                 "$define"|true|[yY]*)
13170                         fflushall="$define"
13171                         ;;
13172                 *)
13173                         fflushall="$undef"
13174                         ;;
13175                 esac
13176             else
13177                 $cat >&4 <<EOM
13178 All is futile.  Even fflush(stdin) clobbers input pipes!
13179 EOM
13180                 fflushall="$undef"
13181             fi
13182         else
13183             fflushall="$undef"
13184         fi
13185         $rm -f core tryp.c tryp.core core.tryp.*
13186         ;;
13187 *)      fflushall="$undef"
13188         ;;
13189 esac
13190
13191 case "$fflushNULL$fflushall" in
13192 undefundef)
13193         $cat <<EOM
13194 OK, I give up.  I cannot figure out how to flush pending stdio output.
13195 We won't be flushing handles at all before fork/exec/popen.
13196 EOM
13197         ;;
13198 esac
13199 $rm -f try.* try$exe_ext
13200
13201 : Store the full pathname to the ar program for use in the C program
13202 : Respect a hint or command line value for full_ar.
13203 case "$full_ar" in
13204 '') full_ar=$ar ;;
13205 esac
13206
13207 : Store the full pathname to the sed program for use in the C program
13208 full_sed=$sed
13209
13210 : see what type gids are declared as in the kernel
13211 echo " "
13212 echo "Looking for the type for group ids returned by getgid()."
13213 set gid_t gidtype xxx stdio.h sys/types.h
13214 eval $typedef
13215 case "$gidtype" in
13216 xxx)
13217         xxx=`./findhdr sys/user.h`
13218         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13219         case $1 in
13220         unsigned) dflt="$1 $2" ;;
13221         *) dflt="$1" ;;
13222         esac
13223         ;;
13224 *) dflt="$gidtype";;
13225 esac
13226 case "$gidtype" in
13227 gid_t) echo "gid_t found." ;;
13228 *)      rp="What is the type for group ids returned by getgid()?"
13229         . ./myread
13230         gidtype="$ans"
13231         ;;
13232 esac
13233
13234 echo " "
13235 case "$gidtype" in
13236 *_t) zzz="$gidtype"     ;;
13237 *)   zzz="gid"          ;;
13238 esac
13239 echo "Checking the size of $zzz..." >&4 
13240 cat > try.c <<EOCP
13241 #include <sys/types.h>
13242 #include <stdio.h>
13243 int main() {
13244     printf("%d\n", (int)sizeof($gidtype));
13245     exit(0);
13246 }
13247 EOCP
13248 set try
13249 if eval $compile_ok; then
13250         yyy=`./try`
13251         case "$yyy" in
13252         '')     gidsize=4
13253                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13254                 ;;
13255         *)      gidsize=$yyy
13256                 echo "Your $zzz is $gidsize bytes long."
13257                 ;;
13258         esac
13259 else
13260         gidsize=4
13261         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13262 fi
13263
13264
13265 echo " "
13266 case "$gidtype" in
13267 *_t) zzz="$gidtype"     ;;
13268 *)   zzz="gid"          ;;
13269 esac
13270 echo "Checking the sign of $zzz..." >&4 
13271 cat > try.c <<EOCP
13272 #include <sys/types.h>
13273 #include <stdio.h>
13274 int main() {
13275         $gidtype foo = -1;
13276         if (foo < 0)
13277                 printf("-1\n");
13278         else
13279                 printf("1\n");
13280 }
13281 EOCP
13282 set try
13283 if eval $compile; then
13284         yyy=`./try`
13285         case "$yyy" in
13286         '')     gidsign=1
13287                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13288                 ;;
13289         *)      gidsign=$yyy
13290                 case "$gidsign" in
13291                  1) echo "Your $zzz is unsigned." ;;
13292                 -1) echo "Your $zzz is signed."   ;;
13293                 esac
13294                 ;;
13295         esac
13296 else
13297         gidsign=1
13298         echo "(I can't compile the test program--guessing unsigned.)" >&4
13299 fi
13300
13301
13302 echo " "
13303
13304 if $test X"$quadtype" != X; then
13305
13306 echo "Checking how to print 64-bit integers..." >&4
13307
13308 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13309         $cat >try.c <<'EOCP'
13310 #include <sys/types.h>
13311 #include <stdio.h>
13312 int main() {
13313   int q = 12345678901;
13314   printf("%ld\n", q);
13315 }
13316 EOCP
13317         set try
13318         if eval $compile; then
13319                 yyy=`./try$exe_ext`
13320                 case "$yyy" in
13321                 12345678901)
13322                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13323                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13324                         echo "We will use %d."
13325                         ;;
13326                 esac
13327         fi
13328 fi
13329
13330 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13331         $cat >try.c <<'EOCP'
13332 #include <sys/types.h>
13333 #include <stdio.h>
13334 int main() {
13335   long q = 12345678901;
13336   printf("%ld\n", q);
13337 }
13338 EOCP
13339         set try
13340         if eval $compile; then
13341                 yyy=`./try$exe_ext`
13342                 case "$yyy" in
13343                 12345678901)
13344                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13345                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13346                         echo "We will use %ld."
13347                         ;;
13348                 esac
13349         fi
13350 fi
13351
13352 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13353         $cat >try.c <<'EOCP'
13354 #include <sys/types.h>
13355 #include <inttypes.h>
13356 #include <stdio.h>
13357 int main() {
13358   int64_t q = 12345678901;
13359   printf("%" PRId64 "\n", q);
13360 }
13361 EOCP
13362         set try
13363         if eval $compile; then
13364                 yyy=`./try$exe_ext`
13365                 case "$yyy" in
13366                 12345678901)
13367                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13368                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13369                         echo "We will use the C9X style."
13370                         ;;
13371                 esac
13372         fi
13373 fi
13374
13375 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13376         $cat >try.c <<'EOCP'
13377 #include <sys/types.h>
13378 #include <stdio.h>
13379 int main() {
13380   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13381   printf("%lld\n", q);
13382 }
13383 EOCP
13384         set try
13385         if eval $compile; then
13386                 yyy=`./try$exe_ext`
13387                 case "$yyy" in
13388                 12345678901)
13389                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13390                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13391                         echo "We will use the %lld style."
13392                         ;;
13393                 esac
13394         fi
13395 fi
13396
13397 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13398         $cat >try.c <<EOCP
13399 #include <sys/types.h>
13400 #include <stdio.h>
13401 int main() {
13402   $quadtype q = 12345678901;
13403   printf("%Ld\n", q);
13404 }
13405 EOCP
13406         set try
13407         if eval $compile; then
13408                 yyy=`./try$exe_ext`
13409                 case "$yyy" in
13410                 12345678901)
13411                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13412                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13413                         echo "We will use %Ld."
13414                         ;;
13415                 esac
13416         fi
13417 fi
13418
13419 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13420         $cat >try.c <<EOCP
13421 #include <sys/types.h>
13422 #include <stdio.h>
13423 int main() {
13424   $quadtype q = 12345678901;
13425   printf("%qd\n", q);
13426 }
13427 EOCP
13428         set try
13429         if eval $compile; then
13430                 yyy=`./try$exe_ext`
13431                 case "$yyy" in
13432                 12345678901)
13433                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13434                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13435                         echo "We will use %qd."
13436                         ;;
13437                 esac
13438         fi
13439 fi
13440
13441 if $test X"$sPRId64" = X; then
13442         echo "Cannot figure out how to print 64-bit integers." >&4
13443 fi
13444
13445 $rm -f try try.*
13446
13447 fi
13448
13449 case "$sPRId64" in
13450 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13451         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13452         ;;
13453 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13454         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13455         ;;
13456 esac
13457
13458
13459 echo " "
13460 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13461
13462 if $test X"$ivsize" = X8; then
13463         ivdformat="$sPRId64"
13464         uvuformat="$sPRIu64"
13465         uvoformat="$sPRIo64"
13466         uvxformat="$sPRIx64"
13467         uvXUformat="$sPRIXU64"
13468 else
13469         if $test X"$ivsize" = X"$longsize"; then
13470                 ivdformat='"ld"'
13471                 uvuformat='"lu"'
13472                 uvoformat='"lo"'
13473                 uvxformat='"lx"'
13474                 uvXUformat='"lX"'
13475         else
13476                 if $test X"$ivsize" = X"$intsize"; then
13477                         ivdformat='"d"'
13478                         uvuformat='"u"'
13479                         uvoformat='"o"'
13480                         uvxformat='"x"'
13481                         uvXUformat='"X"'
13482                 else
13483                         : far out
13484                         if $test X"$ivsize" = X"$shortsize"; then
13485                                 ivdformat='"hd"'
13486                                 uvuformat='"hu"'
13487                                 uvoformat='"ho"'
13488                                 uvxformat='"hx"'
13489                                 uvXUformat='"hX"'
13490                         fi
13491                 fi
13492         fi
13493 fi
13494
13495 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13496         nveformat="$sPRIeldbl"
13497         nvfformat="$sPRIfldbl"
13498         nvgformat="$sPRIgldbl"
13499         nvEUformat="$sPRIEUldbl"
13500         nvFUformat="$sPRIFUldbl"
13501         nvGUformat="$sPRIGUldbl"
13502 else
13503         nveformat='"e"'
13504         nvfformat='"f"'
13505         nvgformat='"g"'
13506         nvEUformat='"E"'
13507         nvFUformat='"F"'
13508         nvGUformat='"G"'
13509 fi
13510
13511 case "$ivdformat" in
13512 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13513     exit 1
13514     ;;
13515 esac
13516
13517
13518 echo " "
13519 $echo "Checking the format string to be used for gids..." >&4
13520
13521 case "$gidsign" in
13522 -1)     if $test X"$gidsize" = X"$ivsize"; then
13523                 gidformat="$ivdformat"
13524         else
13525                 if $test X"$gidsize" = X"$longsize"; then
13526                         gidformat='"ld"'
13527                 else
13528                         if $test X"$gidsize" = X"$intsize"; then
13529                                 gidformat='"d"'
13530                         else
13531                                 if $test X"$gidsize" = X"$shortsize"; then
13532                                         gidformat='"hd"'
13533                                 fi
13534                         fi
13535                 fi
13536         fi
13537         ;;
13538 *)      if $test X"$gidsize" = X"$uvsize"; then
13539                 gidformat="$uvuformat"
13540         else
13541                 if $test X"$gidsize" = X"$longsize"; then
13542                         gidformat='"lu"'
13543                 else
13544                         if $test X"$gidsize" = X"$intsize"; then
13545                                 gidformat='"u"'
13546                         else
13547                                 if $test X"$gidsize" = X"$shortsize"; then
13548                                         gidformat='"hu"'
13549                                 fi
13550                         fi
13551                 fi
13552         fi
13553         ;;
13554 esac
13555
13556 : see if getgroups exists
13557 set getgroups d_getgrps
13558 eval $inlibc
13559
13560 : see if setgroups exists
13561 set setgroups d_setgrps
13562 eval $inlibc
13563
13564
13565 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13566 echo " "
13567 case "$d_getgrps$d_setgrps" in
13568 *define*)
13569         case "$groupstype" in
13570         '') dflt="$gidtype" ;;
13571         *)  dflt="$groupstype" ;;
13572         esac
13573         $cat <<EOM
13574 What type of pointer is the second argument to getgroups() and setgroups()?
13575 Usually this is the same as group ids, $gidtype, but not always.
13576
13577 EOM
13578         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13579         . ./myread
13580         groupstype="$ans"
13581         ;;
13582 *)  groupstype="$gidtype";;
13583 esac
13584
13585 echo " "
13586 echo "Checking if your $make program sets \$(MAKE)..." >&4
13587 case "$make_set_make" in
13588 '')
13589         $sed 's/^X //' > testmake.mak << 'EOF'
13590 Xall:
13591 X       @echo 'maketemp="$(MAKE)"'
13592 EOF
13593         case "`$make -f testmake.mak 2>/dev/null`" in
13594         *maketemp=*) make_set_make='#' ;;
13595         *)      make_set_make="MAKE=$make" ;;
13596         esac
13597         $rm -f testmake.mak
13598         ;;
13599 esac
13600 case "$make_set_make" in
13601 '#') echo "Yup, it does.";;
13602 *) echo "Nope, it doesn't.";;
13603 esac
13604
13605 : see what type is used for mode_t
13606 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13607 set mode_t modetype int stdio.h sys/types.h
13608 eval $typedef_ask
13609
13610 : see if stdarg is available
13611 echo " "
13612 if $test `./findhdr stdarg.h`; then
13613         echo "<stdarg.h> found." >&4
13614         valstd="$define"
13615 else
13616         echo "<stdarg.h> NOT found." >&4
13617         valstd="$undef"
13618 fi
13619
13620 : see if varags is available
13621 echo " "
13622 if $test `./findhdr varargs.h`; then
13623         echo "<varargs.h> found." >&4
13624 else
13625         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13626 fi
13627
13628 : set up the varargs testing programs
13629 $cat > varargs.c <<EOP
13630 #ifdef I_STDARG
13631 #include <stdarg.h>
13632 #endif
13633 #ifdef I_VARARGS
13634 #include <varargs.h>
13635 #endif
13636
13637 #ifdef I_STDARG
13638 int f(char *p, ...)
13639 #else
13640 int f(va_alist)
13641 va_dcl
13642 #endif
13643 {
13644         va_list ap;
13645 #ifndef I_STDARG
13646         char *p;
13647 #endif
13648 #ifdef I_STDARG
13649         va_start(ap,p);
13650 #else
13651         va_start(ap);
13652         p = va_arg(ap, char *);
13653 #endif
13654         va_end(ap);
13655 }
13656 EOP
13657 $cat > varargs <<EOP
13658 $startsh
13659 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13660         echo "true"
13661 else
13662         echo "false"
13663 fi
13664 $rm -f varargs$_o
13665 EOP
13666 chmod +x varargs
13667
13668 : now check which varargs header should be included
13669 echo " "
13670 i_varhdr=''
13671 case "$valstd" in
13672 "$define")
13673         if `./varargs I_STDARG`; then
13674                 val='stdarg.h'
13675         elif `./varargs I_VARARGS`; then
13676                 val='varargs.h'
13677         fi
13678         ;;
13679 *)
13680         if `./varargs I_VARARGS`; then
13681                 val='varargs.h'
13682         fi
13683         ;;
13684 esac
13685 case "$val" in
13686 '')
13687 echo "I could not find the definition for va_dcl... You have problems..." >&4
13688         val="$undef"; set i_stdarg; eval $setvar
13689         val="$undef"; set i_varargs; eval $setvar
13690         ;;
13691 *) 
13692         set i_varhdr
13693         eval $setvar
13694         case "$i_varhdr" in
13695         stdarg.h)
13696                 val="$define"; set i_stdarg; eval $setvar
13697                 val="$undef"; set i_varargs; eval $setvar
13698                 ;;
13699         varargs.h)
13700                 val="$undef"; set i_stdarg; eval $setvar
13701                 val="$define"; set i_varargs; eval $setvar
13702                 ;;
13703         esac
13704         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13705 esac
13706 $rm -f varargs*
13707
13708 : see if we need va_copy
13709 echo " "
13710 case "$i_stdarg" in
13711 "$define")
13712         $cat >try.c <<EOCP
13713 #include <stdarg.h>
13714 #include <stdio.h>
13715 #$i_stdlib I_STDLIB
13716 #ifdef I_STDLIB
13717 #include <stdlib.h>
13718 #endif
13719 #include <signal.h>
13720
13721 int
13722 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13723 {
13724   return vfprintf(f, fmt, *valp);
13725 }
13726  
13727 int    
13728 myvfprintf(FILE *f, const  char *fmt, va_list val)
13729 {
13730   return ivfprintf(f, fmt, &val);
13731 }
13732       
13733 int
13734 myprintf(char *fmt, ...) 
13735 {
13736   va_list val;
13737   va_start(val, fmt);
13738   return myvfprintf(stdout, fmt, val); 
13739 }         
13740
13741 int
13742 main(int ac, char **av)
13743 {
13744   signal(SIGSEGV, exit);
13745
13746   myprintf("%s%cs all right, then\n", "that", '\'');                            
13747   exit(0);      
13748 }
13749 EOCP
13750         set try
13751         if eval $compile && ./try 2>&1 >/dev/null; then
13752                 case "`./try`" in
13753                 "that's all right, then")
13754                         okay=yes
13755                         ;;
13756                 esac
13757         fi
13758         case "$okay" in
13759         yes)    echo "It seems that you don't need va_copy()." >&4
13760                 need_va_copy="$undef"
13761                 ;;
13762         *)      echo "It seems that va_copy() or similar will be needed." >&4
13763                 need_va_copy="$define"
13764                 ;;
13765         esac
13766         $rm -f try.* core core.* *.core *.core.*
13767         ;;
13768 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13769         ;;
13770 esac
13771
13772 : define a fucntion to check prototypes
13773 $cat > protochk <<EOSH
13774 $startsh
13775 cc="$cc"
13776 optimize="$optimize"
13777 ccflags="$ccflags"
13778 prototype="$prototype"
13779 define="$define"
13780 rm=$rm
13781 EOSH
13782
13783 $cat >> protochk <<'EOSH'
13784
13785 $rm -f try.c
13786 foo="$1"
13787 shift
13788 while test $# -ge 2; do
13789         case "$1" in
13790                 $define) echo "#include <$2>" >> try.c ;;
13791                 literal) echo "$2" >> try.c ;;
13792         esac
13793     shift 2
13794 done
13795 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13796 cat >> try.c <<'EOCP'
13797 #ifdef CAN_PROTOTYPE
13798 #define _(args) args
13799 #else
13800 #define _(args) ()
13801 #endif
13802 EOCP
13803 echo "$foo" >> try.c
13804 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13805 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13806 status=$?
13807 $rm -f try.[co]
13808 exit $status
13809 EOSH
13810 chmod +x protochk
13811 $eunicefix protochk
13812
13813 : see what type is used for size_t
13814 rp="What is the type used for the length parameter for string functions?"
13815 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13816 eval $typedef_ask
13817
13818 : check for type of arguments to gethostbyaddr. 
13819 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13820         case "$d_gethbyaddr" in
13821         $define)
13822                 $cat <<EOM
13823
13824 Checking to see what type of arguments are accepted by gethostbyaddr().
13825 EOM
13826                 hdrs="$define sys/types.h
13827                         $d_socket sys/socket.h 
13828                         $i_niin netinet/in.h 
13829                         $i_netdb netdb.h
13830                         $i_unistd unistd.h"
13831                 : The first arg can 'char *' or 'void *'
13832                 : The second arg is some of integral type
13833                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13834                         for yyy in size_t long int; do
13835                                 case "$netdb_host_type" in
13836                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13837                                         if ./protochk "$try" $hdrs; then
13838                                                 echo "Your system accepts $xxx for the first arg."
13839                                                 echo "...and $yyy for the second arg."
13840                                                 netdb_host_type="$xxx"
13841                                                 netdb_hlen_type="$yyy"
13842                                         fi
13843                                         ;;
13844                                 esac
13845                         done
13846                 done
13847                 : In case none of those worked, prompt the user.
13848                 case "$netdb_host_type" in
13849                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13850                         dflt='char *'
13851                         . ./myread
13852                         netdb_host_type=$ans
13853                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13854                         dflt="$sizetype"
13855                         . ./myread
13856                         netdb_hlen_type=$ans
13857                         ;;
13858                 esac
13859                 ;;
13860         *)      : no gethostbyaddr, so pick harmless defaults
13861                 netdb_host_type='char *'
13862                 netdb_hlen_type="$sizetype"
13863                 ;;
13864         esac
13865         # Remove the "const" if needed. -- but then we'll have a 
13866         # prototype clash!
13867         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13868 fi
13869
13870 : check for type of argument to gethostbyname. 
13871 if test "X$netdb_name_type" = X ; then
13872         case "$d_gethbyname" in
13873         $define)
13874                 $cat <<EOM
13875
13876 Checking to see what type of argument is accepted by gethostbyname().
13877 EOM
13878                 hdrs="$define sys/types.h
13879                         $d_socket sys/socket.h 
13880                         $i_niin netinet/in.h 
13881                         $i_netdb netdb.h
13882                         $i_unistd unistd.h"
13883                 for xxx in "const char *" "char *"; do
13884                         case "$netdb_name_type" in
13885                         '')     try="extern struct hostent *gethostbyname($xxx);"
13886                                 if ./protochk "$try" $hdrs; then
13887                                         echo "Your system accepts $xxx."
13888                                         netdb_name_type="$xxx"
13889                                 fi
13890                                 ;;
13891                         esac
13892                 done
13893                 : In case none of those worked, prompt the user.
13894                 case "$netdb_name_type" in
13895                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13896                         dflt='char *'
13897                         . ./myread
13898                         netdb_name_type=$ans
13899                         ;;
13900                 esac
13901                 ;;
13902         *)      : no gethostbyname, so pick harmless default
13903                 netdb_name_type='char *'
13904                 ;;
13905         esac
13906 fi
13907
13908 : check for type of 1st argument to getnetbyaddr. 
13909 if test "X$netdb_net_type" = X ; then
13910         case "$d_getnbyaddr" in
13911         $define)
13912                 $cat <<EOM
13913
13914 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13915 EOM
13916                 hdrs="$define sys/types.h
13917                         $d_socket sys/socket.h 
13918                         $i_niin netinet/in.h 
13919                         $i_netdb netdb.h
13920                         $i_unistd unistd.h"
13921                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13922                         case "$netdb_net_type" in
13923                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13924                                 if ./protochk "$try" $hdrs; then
13925                                         echo "Your system accepts $xxx."
13926                                         netdb_net_type="$xxx"
13927                                 fi
13928                                 ;;
13929                         esac
13930                 done
13931                 : In case none of those worked, prompt the user.
13932                 case "$netdb_net_type" in
13933                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13934                         dflt='long'
13935                         . ./myread
13936                         netdb_net_type=$ans
13937                         ;;
13938                 esac
13939                 ;;
13940         *)      : no getnetbyaddr, so pick harmless default
13941                 netdb_net_type='long'
13942                 ;;
13943         esac
13944 fi
13945 : locate the preferred pager for this system
13946 case "$pager" in
13947 '')
13948         dflt=''
13949         case "$pg" in
13950         /*) dflt=$pg;;
13951         [a-zA-Z]:/*) dflt=$pg;;
13952         esac
13953         case "$more" in
13954         /*) dflt=$more;;
13955         [a-zA-Z]:/*) dflt=$more;;
13956         esac
13957         case "$less" in
13958         /*) dflt=$less;;
13959         [a-zA-Z]:/*) dflt=$less;;
13960         esac
13961         case "$dflt" in
13962         '') dflt=/usr/ucb/more;;
13963         esac
13964         ;;
13965 *) dflt="$pager";;
13966 esac
13967 echo " "
13968 fn=f/
13969 rp='What pager is used on your system?'
13970 . ./getfile
13971 pager="$ans"
13972
13973 : see what type pids are declared as in the kernel
13974 rp="What is the type of process ids on this system?"
13975 set pid_t pidtype int stdio.h sys/types.h
13976 eval $typedef_ask
13977
13978 : Find earliest binary compatible site_perl subdirectory perl can use.
13979 case "$bincompat5005" in
13980 "$define") xs_apiversion='5.005' ;;
13981 *) xs_apiversion=$version ;;   # The current site_perl version.
13982 esac
13983 : Find earliest pure perl site_perl subdirectory perl can use.
13984 : The versioned directories started at 5.005.
13985 pm_apiversion='5.005'
13986
13987 : check for length of pointer
13988 echo " "
13989 case "$ptrsize" in
13990 '')
13991         echo "Checking to see how big your pointers are..." >&4
13992         if test "$voidflags" -gt 7; then
13993                 echo '#define VOID_PTR char *' > try.c
13994         else
13995                 echo '#define VOID_PTR void *' > try.c
13996         fi
13997         $cat >>try.c <<'EOCP'
13998 #include <stdio.h>
13999 int main()
14000 {
14001     printf("%d\n", (int)sizeof(VOID_PTR));
14002     exit(0);
14003 }
14004 EOCP
14005         set try
14006         if eval $compile_ok; then
14007                 ptrsize=`./try`
14008                 echo "Your pointers are $ptrsize bytes long."
14009         else
14010                 dflt='4'
14011                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
14012                 rp="What is the size of a pointer (in bytes)?"
14013                 . ./myread
14014                 ptrsize="$ans"
14015         fi
14016         ;;
14017 esac
14018 $rm -f try.c try
14019
14020 : see if ar generates random libraries by itself
14021 echo " "
14022 echo "Checking how to generate random libraries on your machine..." >&4
14023 echo 'int bar1() { return bar2(); }' > bar1.c
14024 echo 'int bar2() { return 2; }' > bar2.c
14025 $cat > foo.c <<'EOP'
14026 int main() { printf("%d\n", bar1()); exit(0); }
14027 EOP
14028 $cc $ccflags -c bar1.c >/dev/null 2>&1
14029 $cc $ccflags -c bar2.c >/dev/null 2>&1
14030 $cc $ccflags -c foo.c >/dev/null 2>&1
14031 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14032 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14033         ./foobar >/dev/null 2>&1; then
14034         echo "$ar appears to generate random libraries itself."
14035         orderlib=false
14036         ranlib=":"
14037 elif $ar ts bar$_a >/dev/null 2>&1 &&
14038         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14039         ./foobar >/dev/null 2>&1; then
14040                 echo "a table of contents needs to be added with '$ar ts'."
14041                 orderlib=false
14042                 ranlib="$ar ts"
14043 else
14044         case "$ranlib" in
14045         :) ranlib='';;
14046         '')
14047                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14048                 $test -f $ranlib || ranlib=''
14049                 ;;
14050         esac
14051         if $test -n "$ranlib"; then
14052                 echo "your system has '$ranlib'; we'll use that."
14053                 orderlib=false
14054         else
14055                 echo "your system doesn't seem to support random libraries"
14056                 echo "so we'll use lorder and tsort to order the libraries."
14057                 orderlib=true
14058                 ranlib=":"
14059         fi
14060 fi
14061 $rm -f foo* bar* 
14062
14063 : check for type of arguments to select. 
14064 case "$selecttype" in
14065 '') case "$d_select" in
14066         $define)
14067                 echo " "
14068                 $cat <<EOM
14069 Checking to see what type of arguments are accepted by select().
14070 EOM
14071                 hdrs="$define sys/types.h
14072                         $i_systime sys/time.h 
14073                         $i_sysselct sys/select.h
14074                         $d_socket sys/socket.h"
14075                 : The first arg can be int, unsigned, or size_t
14076                 : The last arg may or may not be 'const'
14077                 val=''
14078                 : void pointer has been seen but using that
14079                 : breaks the selectminbits test
14080                 for xxx in 'fd_set *' 'int *'; do
14081                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14082                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14083                                         case "$val" in
14084                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14085                                                 if ./protochk "$try" $hdrs; then
14086                                                         echo "Your system accepts $xxx."
14087                                                         val="$xxx"
14088                                                 fi
14089                                                 ;;
14090                                         esac
14091                                 done
14092                         done
14093                 done
14094                 case "$val" in
14095                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14096                         case "$d_fd_set" in
14097                                 $define) dflt="fd_set *" ;;
14098                                 *)              dflt="int *" ;;
14099                         esac
14100                         . ./myread
14101                         val=$ans
14102                         ;;
14103                 esac
14104                 selecttype="$val"
14105                 ;;
14106         *)      : no select, so pick a harmless default
14107                 selecttype='int *'
14108                 ;;
14109         esac
14110         ;;
14111 esac
14112
14113 : check for the select 'width'
14114 case "$selectminbits" in
14115 '') case "$d_select" in
14116         $define)
14117                 $cat <<EOM
14118
14119 Checking to see on how many bits at a time your select() operates...
14120 EOM
14121                 $cat >try.c <<EOCP
14122 #include <sys/types.h>
14123 #$i_time I_TIME
14124 #$i_systime I_SYS_TIME
14125 #$i_systimek I_SYS_TIME_KERNEL
14126 #ifdef I_TIME
14127 #   include <time.h>
14128 #endif
14129 #ifdef I_SYS_TIME
14130 #   ifdef I_SYS_TIME_KERNEL
14131 #       define KERNEL
14132 #   endif
14133 #   include <sys/time.h>
14134 #   ifdef I_SYS_TIME_KERNEL
14135 #       undef KERNEL
14136 #   endif
14137 #endif
14138 #$i_sysselct I_SYS_SELECT
14139 #ifdef I_SYS_SELECT
14140 #include <sys/select.h>
14141 #endif
14142 #$d_socket HAS_SOCKET
14143 #ifdef HAS_SOCKET
14144 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14145 #endif
14146 #include <stdio.h>
14147 $selecttype b;
14148 #define S sizeof(*(b))
14149 #define MINBITS 64
14150 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14151 #define NBITS  (NBYTES * 8)
14152 int main() {
14153     char s[NBYTES];
14154     struct timeval t;
14155     int i;
14156     FILE* fp;
14157     int fd;
14158
14159     fclose(stdin);
14160     fp = fopen("try.c", "r");
14161     if (fp == 0)
14162       exit(1);
14163     fd = fileno(fp);
14164     if (fd < 0)
14165       exit(2);
14166     b = ($selecttype)s;
14167     for (i = 0; i < NBITS; i++)
14168         FD_SET(i, b);
14169     t.tv_sec  = 0;
14170     t.tv_usec = 0;
14171     select(fd + 1, b, 0, 0, &t);
14172     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14173     printf("%d\n", i + 1);
14174     return 0;
14175 }
14176 EOCP
14177                 set try
14178                 if eval $compile_ok; then
14179                         selectminbits=`./try`
14180                         case "$selectminbits" in
14181                         '')     cat >&4 <<EOM
14182 Cannot figure out on how many bits at a time your select() operates.
14183 I'll play safe and guess it is 32 bits.
14184 EOM
14185                                 selectminbits=32
14186                                 bits="32 bits"
14187                                 ;;
14188                         1)      bits="1 bit" ;;
14189                         *)      bits="$selectminbits bits" ;;
14190                         esac
14191                         echo "Your select() operates on $bits at a time." >&4
14192                 else
14193                         rp='What is the minimum number of bits your select() operates on?'
14194                         case "$byteorder" in
14195                         1234|12345678)  dflt=32 ;;
14196                         *)              dflt=1  ;;
14197                         esac
14198                         . ./myread
14199                         val=$ans
14200                         selectminbits="$val"
14201                 fi
14202                 $rm -f try.* try
14203                 ;;
14204         *)      : no select, so pick a harmless default
14205                 selectminbits='32'
14206                 ;;
14207         esac
14208         ;;
14209 esac
14210
14211 : Trace out the files included by signal.h, then look for SIGxxx names.
14212 : Remove SIGARRAYSIZE used by HPUX.
14213 : Remove SIGSTKSIZE used by Linux.
14214 : Remove SIGSTKSZ used by Posix.
14215 : Remove SIGTYP void lines used by OS2.
14216 : Some cpps, like os390, dont give the file name anywhere
14217 if [ "X$fieldn" = X ]; then
14218         : Just make some guesses.  We check them later.
14219         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14220 else
14221         xxx=`echo '#include <signal.h>' |
14222         $cppstdin $cppminus $cppflags 2>/dev/null |
14223         $grep '^[       ]*#.*include' | 
14224         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14225 fi
14226 : Check this list of files to be sure we have parsed the cpp output ok.
14227 : This will also avoid potentially non-existent files, such 
14228 : as ../foo/bar.h
14229 xxxfiles=''
14230 for xx in $xxx /dev/null ; do
14231         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14232 done
14233 : If we have found no files, at least try signal.h
14234 case "$xxxfiles" in
14235 '')     xxxfiles=`./findhdr signal.h` ;;
14236 esac
14237 xxx=`awk '
14238 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14239         print substr($2, 4, 20)
14240 }
14241 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14242         print substr($3, 4, 20)
14243 }' $xxxfiles`
14244 : Append some common names just in case the awk scan failed.
14245 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14246 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14247 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14248 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14249 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14250
14251 : generate a few handy files for later
14252 $cat > signal.c <<'EOCP'
14253 #include <sys/types.h>
14254 #include <signal.h>
14255 #include <stdio.h>
14256 int main() {
14257
14258 /* Strange style to avoid deeply-nested #if/#else/#endif */
14259 #ifndef NSIG
14260 #  ifdef _NSIG
14261 #    define NSIG (_NSIG)
14262 #  endif
14263 #endif
14264
14265 #ifndef NSIG
14266 #  ifdef SIGMAX
14267 #    define NSIG (SIGMAX+1)
14268 #  endif
14269 #endif
14270
14271 #ifndef NSIG
14272 #  ifdef SIG_MAX
14273 #    define NSIG (SIG_MAX+1)
14274 #  endif
14275 #endif
14276
14277 #ifndef NSIG
14278 #  ifdef MAXSIG
14279 #    define NSIG (MAXSIG+1)
14280 #  endif
14281 #endif
14282
14283 #ifndef NSIG
14284 #  ifdef MAX_SIG
14285 #    define NSIG (MAX_SIG+1)
14286 #  endif
14287 #endif
14288
14289 #ifndef NSIG
14290 #  ifdef SIGARRAYSIZE
14291 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14292 #  endif
14293 #endif
14294
14295 #ifndef NSIG
14296 #  ifdef _sys_nsig
14297 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14298 #  endif
14299 #endif
14300
14301 /* Default to some arbitrary number that's big enough to get most
14302    of the common signals.
14303 */
14304 #ifndef NSIG
14305 #    define NSIG 50
14306 #endif
14307
14308 printf("NSIG %d\n", NSIG);
14309
14310 #ifndef JUST_NSIG
14311
14312 EOCP
14313
14314 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14315 {
14316         printf "#ifdef SIG"; printf $1; printf "\n"
14317         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14318         printf $1; printf ");\n"
14319         printf "#endif\n"
14320 }
14321 END {
14322         printf "#endif /* JUST_NSIG */\n";
14323         printf "exit(0);\n}\n";
14324 }
14325 ' >>signal.c
14326 $cat >signal.awk <<'EOP'
14327 BEGIN { ndups = 0 }
14328 $1 ~ /^NSIG$/ { nsig = $2 }
14329 ($1 !~ /^NSIG$/) && (NF == 2) {
14330     if ($2 > maxsig) { maxsig = $2 }
14331     if (sig_name[$2]) {
14332         dup_name[ndups] = $1
14333         dup_num[ndups] = $2
14334         ndups++ 
14335     }
14336     else {
14337         sig_name[$2] = $1
14338         sig_num[$2] = $2
14339     }
14340 }
14341 END { 
14342     if (nsig == 0) {
14343         nsig = maxsig + 1
14344     }
14345     printf("NSIG %d\n", nsig);
14346     for (n = 1; n < nsig; n++) {
14347         if (sig_name[n]) {
14348             printf("%s %d\n", sig_name[n], sig_num[n])
14349         }
14350         else {
14351             printf("NUM%d %d\n", n, n) 
14352         }
14353     }
14354     for (n = 0; n < ndups; n++) {
14355         printf("%s %d\n", dup_name[n], dup_num[n])
14356     }
14357 }
14358 EOP
14359 $cat >signal_cmd <<EOS
14360 $startsh
14361 if $test -s signal.lst; then
14362     echo "Using your existing signal.lst file"
14363         exit 0
14364 fi
14365 xxx="$xxx"
14366 EOS
14367 $cat >>signal_cmd <<'EOS'
14368
14369 set signal
14370 if eval $compile_ok; then
14371         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14372 else
14373         echo "(I can't seem be able to compile the whole test program)" >&4
14374         echo "(I'll try it in little pieces.)" >&4
14375         set signal -DJUST_NSIG
14376         if eval $compile_ok; then
14377                 ./signal$_exe > signal.nsg
14378                 $cat signal.nsg
14379         else
14380                 echo "I can't seem to figure out how many signals you have." >&4
14381                 echo "Guessing 50." >&4
14382                 echo 'NSIG 50' > signal.nsg
14383         fi
14384         : Now look at all the signal names, one at a time.
14385         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14386                 $cat > signal.c <<EOCP
14387 #include <sys/types.h>
14388 #include <signal.h>
14389 #include <stdio.h>
14390 int main() {
14391 printf("$xx %d\n", SIG${xx});
14392 return 0;
14393 }
14394 EOCP
14395                 set signal
14396                 if eval $compile; then
14397                         echo "SIG${xx} found."
14398                         ./signal$_exe  >> signal.ls1
14399                 else
14400                         echo "SIG${xx} NOT found."
14401                 fi
14402         done
14403         if $test -s signal.ls1; then
14404                 $cat signal.nsg signal.ls1 |
14405                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14406         fi
14407
14408 fi
14409 if $test -s signal.lst; then
14410         :
14411 else
14412         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14413         echo 'kill -l' >signal
14414         set X `csh -f <signal`
14415         $rm -f signal
14416         shift
14417         case $# in
14418         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14419         esac
14420         echo $@ | $tr ' ' $trnl | \
14421             $awk '{ printf "%s %d\n", $1, ++s; }
14422                   END { printf "NSIG %d\n", ++s }' >signal.lst
14423 fi
14424 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14425 EOS
14426 chmod a+x signal_cmd
14427 $eunicefix signal_cmd
14428
14429 : generate list of signal names
14430 echo " "
14431 case "$sig_name_init" in
14432 '') doinit=yes ;;
14433 *)  case "$sig_num_init" in
14434     ''|*,*) doinit=yes ;;
14435     esac ;;
14436 esac
14437 case "$doinit" in
14438 yes)
14439         echo "Generating a list of signal names and numbers..." >&4
14440         . ./signal_cmd
14441         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14442         sig_name=`$awk 'BEGIN { printf "ZERO " }
14443                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14444         sig_num=`$awk  'BEGIN { printf "0 " }
14445                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14446         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14447                              !/^NSIG/   { printf "\"%s\", ", $1 }
14448                              END        { printf "0\n" }' signal.lst`
14449         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14450                              !/^NSIG/   { printf "%d, ", $2}
14451                              END        { printf "0\n"}' signal.lst`
14452         ;;
14453 esac
14454 echo "The following $sig_count signals are available:"
14455 echo " "
14456 echo $sig_name | $awk \
14457 'BEGIN { linelen = 0 }
14458 {
14459         for (i = 1; i <= NF; i++) {
14460                 name = "SIG" $i " "
14461                 linelen = linelen + length(name)
14462                 if (linelen > 70) {
14463                         printf "\n"
14464                         linelen = length(name)
14465                 }
14466                 printf "%s", name
14467         }
14468         printf "\n"
14469 }'
14470 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14471
14472 echo " "
14473 case "$sizetype" in
14474 *_t) zzz="$sizetype"    ;;
14475 *)   zzz="filesize"     ;;
14476 esac
14477 echo "Checking the size of $zzz..." >&4 
14478 cat > try.c <<EOCP
14479 #include <sys/types.h>
14480 #include <stdio.h>
14481 int main() {
14482     printf("%d\n", (int)sizeof($sizetype));
14483     exit(0);
14484 }
14485 EOCP
14486 set try
14487 if eval $compile_ok; then
14488         yyy=`./try`
14489         case "$yyy" in
14490         '')     sizesize=4
14491                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14492                 ;;
14493         *)      sizesize=$yyy
14494                 echo "Your $zzz size is $sizesize bytes."
14495                 ;;
14496         esac
14497 else
14498         sizesize=4
14499         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14500 fi
14501
14502
14503 : check for socklen_t
14504 echo " "
14505 echo "Checking to see if you have socklen_t..." >&4
14506 $cat >try.c <<EOCP
14507 #include <sys/types.h>
14508 #$d_socket HAS_SOCKET
14509 #ifdef HAS_SOCKET
14510 #include <sys/socket.h>
14511 #endif
14512 int main() { socklen_t x = 16; }
14513 EOCP
14514 set try
14515 if eval $compile; then
14516         val="$define"
14517         echo "You have socklen_t."
14518 else
14519         val="$undef"
14520         echo "You do not have socklen_t."
14521         case "$sizetype" in
14522         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14523         esac
14524 fi
14525 $rm -f try try.*
14526 set d_socklen_t
14527 eval $setvar
14528
14529 : see if this is a socks.h system
14530 set socks.h i_socks
14531 eval $inhdr
14532
14533 : check for type of the size argument to socket calls
14534 case "$d_socket" in
14535 "$define")
14536         $cat <<EOM
14537
14538 Checking to see what type is the last argument of accept().
14539 EOM
14540         yyy=''
14541         case "$d_socklen_t" in
14542         "$define") yyy="$yyy socklen_t"
14543         esac
14544         yyy="$yyy $sizetype int long unsigned"
14545         for xxx in $yyy; do
14546                 case "$socksizetype" in
14547                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14548                         case "$usesocks" in
14549                         "$define")
14550                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14551                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14552                                         socksizetype="$xxx"
14553                                 fi
14554                                 ;;
14555                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14556                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14557                                         socksizetype="$xxx"
14558                                 fi
14559                                 ;;
14560                         esac
14561                         ;;
14562                 esac
14563         done
14564 : In case none of those worked, prompt the user.
14565         case "$socksizetype" in
14566         '')     rp='What is the type for socket address structure sizes?'
14567                 dflt='int'
14568                 . ./myread
14569                 socksizetype=$ans
14570                 ;;
14571         esac
14572         ;;
14573 *)      : no sockets, so pick relatively harmless default
14574         socksizetype='int'
14575         ;;
14576 esac
14577
14578 : see what type is used for signed size_t
14579 set ssize_t ssizetype int stdio.h sys/types.h
14580 eval $typedef
14581 dflt="$ssizetype"
14582 $cat > ssize.c <<EOM
14583 #include <stdio.h>
14584 #include <sys/types.h>
14585 #define Size_t $sizetype
14586 #define SSize_t $dflt
14587 int main()
14588 {
14589         if (sizeof(Size_t) == sizeof(SSize_t))
14590                 printf("$dflt\n");
14591         else if (sizeof(Size_t) == sizeof(int))
14592                 printf("int\n");
14593         else 
14594                 printf("long\n");
14595         exit(0);
14596 }
14597 EOM
14598 echo " "
14599 set ssize
14600 if eval $compile_ok && ./ssize > /dev/null; then
14601         ssizetype=`./ssize`
14602         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14603 else
14604         $cat >&4 <<EOM
14605 Help! I can't compile and run the ssize_t test program: please enlighten me!
14606 (This is probably a misconfiguration in your system or libraries, and
14607 you really ought to fix it.  Still, I'll try anyway.)
14608
14609 I need a type that is the same size as $sizetype, but is guaranteed to
14610 be signed.  Common values are ssize_t, int and long.
14611
14612 EOM
14613         rp="What signed type is the same size as $sizetype?"
14614         . ./myread
14615         ssizetype="$ans"
14616 fi
14617 $rm -f ssize ssize.*
14618
14619 : see what type of char stdio uses.
14620 echo " "
14621 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14622 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14623         echo "Your stdio uses unsigned chars." >&4
14624         stdchar="unsigned char"
14625 else
14626         echo "Your stdio uses signed chars." >&4
14627         stdchar="char"
14628 fi
14629 $rm -f stdioh
14630
14631
14632
14633 : see if time exists
14634 echo " "
14635 if test "X$d_time" = X -o X"$timetype" = X; then
14636     if set time val -f d_time; eval $csym; $val; then
14637                 echo 'time() found.' >&4
14638                 val="$define"
14639                 rp="What is the type returned by time() on this system?"
14640                 set time_t timetype long stdio.h sys/types.h
14641                 eval $typedef_ask
14642     else
14643                 echo 'time() not found, hope that will do.' >&4
14644                 val="$undef"
14645                 timetype='int';
14646     fi
14647     set d_time
14648     eval $setvar
14649 fi
14650
14651 : see what type uids are declared as in the kernel
14652 echo " "
14653 echo "Looking for the type for user ids returned by getuid()."
14654 set uid_t uidtype xxx stdio.h sys/types.h
14655 eval $typedef
14656 case "$uidtype" in
14657 xxx)
14658         xxx=`./findhdr sys/user.h`
14659         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14660         case $1 in
14661         unsigned) dflt="$1 $2" ;;
14662         *) dflt="$1" ;;
14663         esac
14664         ;;
14665 *) dflt="$uidtype";;
14666 esac
14667 case "$uidtype" in
14668 uid_t)  echo "uid_t found." ;;
14669 *)      rp="What is the type for user ids returned by getuid()?"
14670         . ./myread
14671         uidtype="$ans"
14672         ;;
14673 esac
14674
14675 echo " "
14676 case "$uidtype" in
14677 *_t) zzz="$uidtype"     ;;
14678 *)   zzz="uid"          ;;
14679 esac
14680 echo "Checking the size of $zzz..." >&4 
14681 cat > try.c <<EOCP
14682 #include <sys/types.h>
14683 #include <stdio.h>
14684 int main() {
14685     printf("%d\n", (int)sizeof($uidtype));
14686     exit(0);
14687 }
14688 EOCP
14689 set try
14690 if eval $compile_ok; then
14691         yyy=`./try`
14692         case "$yyy" in
14693         '')     uidsize=4
14694                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14695                 ;;
14696         *)      uidsize=$yyy
14697                 echo "Your $zzz is $uidsize bytes long."
14698                 ;;
14699         esac
14700 else
14701         uidsize=4
14702         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14703 fi
14704
14705 echo " "
14706 case "$uidtype" in
14707 *_t) zzz="$uidtype"     ;;
14708 *)   zzz="uid"          ;;
14709 esac
14710 echo "Checking the sign of $zzz..." >&4
14711 cat > try.c <<EOCP
14712 #include <sys/types.h>
14713 #include <stdio.h>
14714 int main() {
14715         $uidtype foo = -1;
14716         if (foo < 0)
14717                 printf("-1\n");
14718         else
14719                 printf("1\n");
14720 }
14721 EOCP
14722 set try
14723 if eval $compile; then
14724         yyy=`./try`
14725         case "$yyy" in
14726         '')     uidsign=1
14727                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14728                 ;;
14729         *)      uidsign=$yyy
14730                 case "$uidsign" in
14731                  1) echo "Your $zzz is unsigned." ;;
14732                 -1) echo "Your $zzz is signed."   ;;
14733                 esac
14734                 ;;
14735         esac
14736 else
14737         uidsign=1
14738         echo "(I can't compile the test program--guessing unsigned.)" >&4
14739 fi
14740
14741
14742
14743 echo " "
14744 $echo "Checking the format string to be used for uids..." >&4
14745
14746 case "$uidsign" in
14747 -1)     if $test X"$uidsize" = X"$ivsize"; then
14748                 uidformat="$ivdformat"
14749         else
14750                 if $test X"$uidsize" = X"$longsize"; then
14751                         uidformat='"ld"'
14752                 else
14753                         if $test X"$uidsize" = X"$intsize"; then
14754                                 uidformat='"d"'
14755                         else
14756                                 if $test X"$uidsize" = X"$shortsize"; then
14757                                         uidformat='"hd"'
14758                                 fi
14759                         fi
14760                 fi
14761         fi
14762         ;;
14763 *)      if $test X"$uidsize" = X"$uvsize"; then
14764                 uidformat="$uvuformat"
14765         else
14766                 if $test X"$uidsize" = X"$longsize"; then
14767                         uidformat='"lu"'
14768                 else
14769                         if $test X"$uidsize" = X"$intsize"; then
14770                                 uidformat='"u"'
14771                         else
14772                                 if $test X"$uidsize" = X"$shortsize"; then
14773                                         uidformat='"hu"'
14774                                 fi
14775                         fi
14776                 fi
14777         fi
14778         ;;
14779 esac
14780
14781 : see if dbm.h is available
14782 : see if dbmclose exists
14783 set dbmclose d_dbmclose
14784 eval $inlibc
14785
14786 case "$d_dbmclose" in
14787 $define)
14788         set dbm.h i_dbm
14789         eval $inhdr
14790         case "$i_dbm" in
14791         $define)
14792                 val="$undef"
14793                 set i_rpcsvcdbm
14794                 eval $setvar
14795                 ;;
14796         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14797                 eval $inhdr
14798                 ;;
14799         esac
14800         ;;
14801 *)      echo "We won't be including <dbm.h>"
14802         val="$undef"
14803         set i_dbm
14804         eval $setvar
14805         val="$undef"
14806         set i_rpcsvcdbm
14807         eval $setvar
14808         ;;
14809 esac
14810
14811 : see if this is a sys/file.h system
14812 val=''
14813 set sys/file.h val
14814 eval $inhdr
14815
14816 : do we need to include sys/file.h ?
14817 case "$val" in
14818 "$define")
14819         echo " "
14820         if $h_sysfile; then
14821                 val="$define"
14822                 echo "We'll be including <sys/file.h>." >&4
14823         else
14824                 val="$undef"
14825                 echo "We won't be including <sys/file.h>." >&4
14826         fi
14827         ;;
14828 *)
14829         h_sysfile=false
14830         ;;
14831 esac
14832 set i_sysfile
14833 eval $setvar
14834
14835 : see if fcntl.h is there
14836 val=''
14837 set fcntl.h val
14838 eval $inhdr
14839
14840 : see if we can include fcntl.h
14841 case "$val" in
14842 "$define")
14843         echo " "
14844         if $h_fcntl; then
14845                 val="$define"
14846                 echo "We'll be including <fcntl.h>." >&4
14847         else
14848                 val="$undef"
14849                 if $h_sysfile; then
14850         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14851                 else
14852                         echo "We won't be including <fcntl.h>." >&4
14853                 fi
14854         fi
14855         ;;
14856 *)
14857         h_fcntl=false
14858         val="$undef"
14859         ;;
14860 esac
14861 set i_fcntl
14862 eval $setvar
14863
14864 : see if this is a iconv.h system
14865 set iconv.h i_iconv
14866 eval $inhdr
14867
14868 : see if this is a ieeefp.h system
14869 set ieeefp.h i_ieeefp
14870 eval $inhdr
14871
14872 : see if this is a libutil.h system
14873 set libutil.h i_libutil
14874 eval $inhdr
14875
14876 : see if locale.h is available
14877 set locale.h i_locale
14878 eval $inhdr
14879
14880 : see if mach cthreads are available
14881 if test "X$usethreads" = "X$define"; then
14882         set mach/cthreads.h i_machcthr
14883         eval $inhdr
14884 else
14885         i_machcthr="$undef"
14886 fi
14887
14888
14889
14890 : see if this is a math.h system
14891 set math.h i_math
14892 eval $inhdr
14893
14894 : see if this is a mntent.h system
14895 set mntent.h i_mntent
14896 eval $inhdr
14897
14898 : see if ndbm.h is available
14899 set ndbm.h t_ndbm
14900 eval $inhdr
14901 case "$t_ndbm" in
14902 $define)
14903         : see if dbm_open exists
14904         set dbm_open d_dbm_open
14905         eval $inlibc
14906         case "$d_dbm_open" in
14907         $undef)
14908                 t_ndbm="$undef"
14909                 echo "We won't be including <ndbm.h>"
14910                 ;;
14911         esac
14912         ;;
14913 esac
14914 val="$t_ndbm"
14915 set i_ndbm
14916 eval $setvar
14917
14918 : see if net/errno.h is available
14919 val=''
14920 set net/errno.h val
14921 eval $inhdr
14922
14923 : Unfortunately, it causes problems on some systems.  Arrgh.
14924 case "$val" in
14925 $define)
14926         cat > try.c <<'EOM'
14927 #include <stdio.h>
14928 #include <errno.h>
14929 #include <net/errno.h>
14930 int func()
14931 {
14932         return ENOTSOCK;
14933 }
14934 EOM
14935         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14936                 echo "We'll be including <net/errno.h>." >&4
14937         else
14938                 echo "We won't be including <net/errno.h>." >&4
14939                 val="$undef"
14940         fi
14941         $rm -f try.* try
14942         ;;
14943 esac
14944 set i_neterrno
14945 eval $setvar
14946
14947 : see if netinet/tcp.h is available
14948 set netinet/tcp.h i_netinettcp
14949 eval $inhdr
14950
14951 : see if this is a poll.h system
14952 set poll.h i_poll
14953 eval $inhdr
14954
14955 : see if this is a prot.h system
14956 set prot.h i_prot
14957 eval $inhdr
14958
14959 echo " "
14960 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14961 $cat <<'EOSH' > Cppsym.know
14962 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14963 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14964 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14965 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14966 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14967 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14968 bull c cadmus clipper CMU COFF COMPILER_VERSION
14969 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14970 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14971 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14972 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14973 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14974 H3050R H3050RX hbullx20 hcx host_mips
14975 hp200 hp300 hp700 HP700 hp800 hp9000
14976 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14977 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14978 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14979 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14980 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14981 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14982 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14983 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14984 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14985 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14986 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14987 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14988 MATH_HAS_NO_SIDE_EFFECTS
14989 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14990 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14991 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14992 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14993 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14994 NetBSD news1500 news1700 news1800 news1900 news3700
14995 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
14996 ns32016 ns32332 ns32k nsc32000
14997 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14998 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14999 pc532 pdp11 PGC PIC plexus PORTAR posix
15000 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15001 POSIX_C_SOURCE POSIX_SOURCE POWER
15002 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15003 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15004 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15005 sony sony_news sonyrisc sparc sparclite spectrum
15006 stardent stdc STDC_EXT stratos sun sun3 sun386
15007 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15008 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15009 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15010 sysV68 sysV88 Tek4132 Tek4300 titan
15011 tower tower32 tower32_200 tower32_600 tower32_700
15012 tower32_800 tower32_850 tss
15013 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15014 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15015 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15016 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15017 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15018 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15019 z8000
15020 EOSH
15021 # Maybe put other stuff here too.
15022 cat <<EOSH >>Cppsym.know
15023 $osname
15024 EOSH
15025 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15026 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15027 $cat Cppsym.know > Cppsym.c
15028 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15029 $rm -f Cppsym.a Cppsym.b Cppsym.c
15030 cat <<EOSH > Cppsym
15031 $startsh
15032 if $test \$# -gt 0; then
15033     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15034     if $test -s Cppsym.got; then
15035         $rm -f Cppsym.got
15036         exit 0
15037     fi
15038     $rm -f Cppsym.got
15039     exit 1
15040 else
15041     $tr " " "$trnl" | ./Cppsym.try
15042     exit 0
15043 fi
15044 EOSH
15045 chmod +x Cppsym
15046 $eunicefix Cppsym
15047 cat <<EOSH > Cppsym.try
15048 $startsh
15049 cat <<'EOCP' > try.c
15050 #include <stdio.h>
15051 int main() {
15052 EOCP
15053 $awk \\
15054 EOSH
15055 cat <<'EOSH' >> Cppsym.try
15056 'length($1) > 0 {
15057     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
15058     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
15059     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
15060     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
15061 }'       >> try.c
15062 echo '}' >> try.c
15063 EOSH
15064 cat <<EOSH >> Cppsym.try
15065 ccflags="$ccflags"
15066 case "$osname-$gccversion" in
15067 irix-) ccflags="\$ccflags -woff 1178" ;;
15068 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15069 esac
15070 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15071 EOSH
15072 chmod +x Cppsym.try
15073 $eunicefix Cppsym.try
15074 ./Cppsym < Cppsym.know > Cppsym.true
15075 : now check the C compiler for additional symbols
15076 postprocess_cc_v=''
15077 case "$osname" in
15078 aix) postprocess_cc_v="|$tr , ' '" ;;
15079 esac
15080 $cat >ccsym <<EOS
15081 $startsh
15082 $cat >tmp.c <<EOF
15083 extern int foo;
15084 EOF
15085 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15086 do
15087         case "\$i" in
15088         -D*) echo "\$i" | $sed 's/^-D//';;
15089         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15090         esac
15091 done
15092 $rm -f try.c
15093 EOS
15094 postprocess_cc_v=''
15095 chmod +x ccsym
15096 $eunicefix ccsym
15097 ./ccsym > ccsym1.raw
15098 if $test -s ccsym1.raw; then
15099        $sort ccsym1.raw | $uniq >ccsym.raw
15100 else
15101        mv ccsym1.raw ccsym.raw
15102 fi
15103
15104 $awk '/\=/ { print $0; next }
15105         { print $0"=1" }' ccsym.raw >ccsym.list
15106 $awk '/\=/ { print $0; next }
15107         { print $0"=1" }' Cppsym.true >ccsym.true
15108 $comm -13 ccsym.true ccsym.list >ccsym.own
15109 $comm -12 ccsym.true ccsym.list >ccsym.com
15110 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15111 also=''
15112 if $test -z ccsym.raw; then
15113         echo "Your C compiler doesn't seem to define any symbols!" >&4
15114         echo " "
15115         echo "However, your C preprocessor defines the following symbols:"
15116         $cat Cppsym.true
15117         ccsymbols=''
15118         cppsymbols=`$cat Cppsym.true`
15119         cppsymbols=`echo $cppsymbols`
15120         cppccsymbols="$cppsymbols"
15121 else
15122         if $test -s ccsym.com; then
15123                 echo "Your C compiler and pre-processor define these symbols:"
15124                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15125                 also='also '
15126                 symbols='ones'
15127                 cppccsymbols=`$cat ccsym.com`
15128                 cppccsymbols=`echo $cppccsymbols`
15129                 $test "$silent" || sleep 1
15130         fi
15131         if $test -s ccsym.cpp; then
15132                 $test "$also" && echo " "
15133                 echo "Your C pre-processor ${also}defines the following symbols:"
15134                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15135                 also='further '
15136                 cppsymbols=`$cat ccsym.cpp`
15137                 cppsymbols=`echo $cppsymbols`
15138                 $test "$silent" || sleep 1
15139         fi
15140         if $test -s ccsym.own; then
15141                 $test "$also" && echo " "
15142                 echo "Your C compiler ${also}defines the following cpp symbols:"
15143                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15144                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15145                 ccsymbols=`$cat ccsym.own`
15146                 ccsymbols=`echo $ccsymbols`
15147                 $test "$silent" || sleep 1
15148         fi
15149 fi
15150 $rm -f ccsym* Cppsym.*
15151
15152 : see if this is a termio system
15153 val="$undef"
15154 val2="$undef"
15155 val3="$undef"
15156 if $test `./findhdr termios.h`; then
15157         set tcsetattr i_termios
15158         eval $inlibc
15159         val3="$i_termios"
15160 fi
15161 echo " "
15162 case "$val3" in
15163 "$define") echo "You have POSIX termios.h... good!" >&4;;
15164 *) if ./Cppsym pyr; then
15165                 case "`/bin/universe`" in
15166                 ucb) if $test `./findhdr sgtty.h`; then
15167                                 val2="$define"
15168                                 echo "<sgtty.h> found." >&4
15169                         else
15170                                 echo "System is pyramid with BSD universe."
15171                                 echo "<sgtty.h> not found--you could have problems." >&4
15172                         fi;;
15173                 *) if $test `./findhdr termio.h`; then
15174                                 val="$define"
15175                                 echo "<termio.h> found." >&4
15176                         else
15177                                 echo "System is pyramid with USG universe."
15178                                 echo "<termio.h> not found--you could have problems." >&4
15179                         fi;;
15180                 esac
15181         elif ./usg; then
15182                 if $test `./findhdr termio.h`; then
15183                         echo "<termio.h> found." >&4
15184                         val="$define"
15185                 elif $test `./findhdr sgtty.h`; then
15186                         echo "<sgtty.h> found." >&4
15187                         val2="$define"
15188                 else
15189 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15190                 fi
15191         else
15192                 if $test `./findhdr sgtty.h`; then
15193                         echo "<sgtty.h> found." >&4
15194                         val2="$define"
15195                 elif $test `./findhdr termio.h`; then
15196                         echo "<termio.h> found." >&4
15197                         val="$define"
15198                 else
15199 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15200                 fi
15201         fi;;
15202 esac
15203 set i_termio; eval $setvar
15204 val=$val2; set i_sgtty; eval $setvar
15205 val=$val3; set i_termios; eval $setvar
15206
15207 : see if this is a shadow.h system
15208 set shadow.h i_shadow
15209 eval $inhdr
15210
15211 : see if stddef is available
15212 set stddef.h i_stddef
15213 eval $inhdr
15214
15215 : see if this is a sunmath.h system
15216 set sunmath.h i_sunmath
15217 eval $inhdr
15218
15219 : see if sys/access.h is available
15220 set sys/access.h i_sysaccess
15221 eval $inhdr
15222
15223 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15224 set sys/filio.h i_sysfilio
15225 eval $inhdr
15226 echo " "
15227 if $test `./findhdr sys/ioctl.h`; then
15228         val="$define"
15229         echo '<sys/ioctl.h> found.' >&4
15230 else
15231         val="$undef"
15232         if $test $i_sysfilio = "$define"; then
15233             echo '<sys/ioctl.h> NOT found.' >&4
15234         else
15235                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15236                 $test $i_termio = "$define" && xxx="termio.h"
15237                 $test $i_termios = "$define" && xxx="termios.h"
15238 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15239         fi
15240 fi
15241 set i_sysioctl
15242 eval $setvar
15243
15244
15245 : see if this is a syslog.h system
15246 set syslog.h i_syslog
15247 eval $inhdr
15248
15249
15250 : see if this is a sys/mode.h system
15251 set sys/mode.h i_sysmode
15252 eval $inhdr
15253
15254 : see if sys/resource.h has to be included
15255 set sys/resource.h i_sysresrc
15256 eval $inhdr
15257
15258 : see if sys/security.h is available
15259 set sys/security.h i_syssecrt
15260 eval $inhdr
15261
15262 : see if this is a sys/statvfs.h system
15263 set sys/statvfs.h i_sysstatvfs
15264 eval $inhdr
15265
15266 : see if this is a sys/uio.h system
15267 set sys/uio.h i_sysuio
15268 eval $inhdr
15269
15270 : see if this is a sys/un.h system
15271 set sys/un.h i_sysun
15272 eval $inhdr
15273
15274
15275 : see if this is a sys/utsname.h system
15276 set sys/utsname.h i_sysutsname
15277 eval $inhdr
15278
15279 : see if this is a syswait system
15280 set sys/wait.h i_syswait
15281 eval $inhdr
15282
15283 : see if this is a ustat.h system
15284 set ustat.h i_ustat
15285 eval $inhdr
15286
15287 : see if this is an utime system
15288 set utime.h i_utime
15289 eval $inhdr
15290
15291 : see if this is a values.h system
15292 set values.h i_values
15293 eval $inhdr
15294
15295 : see if this is a vfork system
15296 case "$d_vfork" in
15297 "$define")
15298         set vfork.h i_vfork
15299         eval $inhdr
15300         ;;
15301 *)
15302         i_vfork="$undef"
15303         ;;
15304 esac
15305
15306 : see if gdbm.h is available
15307 set gdbm.h t_gdbm
15308 eval $inhdr
15309 case "$t_gdbm" in
15310 $define)
15311         : see if gdbm_open exists
15312         set gdbm_open d_gdbm_open
15313         eval $inlibc
15314         case "$d_gdbm_open" in
15315         $undef)
15316                 t_gdbm="$undef"
15317                 echo "We won't be including <gdbm.h>"
15318                 ;;
15319         esac
15320         ;;
15321 esac
15322 val="$t_gdbm"
15323 set i_gdbm
15324 eval $setvar
15325
15326 echo " "
15327 echo "Looking for extensions..." >&4
15328 : If we are using the old config.sh, known_extensions may contain
15329 : old or inaccurate or duplicate values.
15330 known_extensions=''
15331 nonxs_extensions=''
15332 : We do not use find because it might not be available.
15333 : We do not just use MANIFEST because the user may have dropped
15334 : some additional extensions into the source tree and expect them
15335 : to be built.
15336
15337 : Function to recursively find available extensions, ignoring DynaLoader
15338 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15339 find_extensions='
15340     for xxx in *; do
15341        case "$xxx" in
15342            DynaLoader|dynaload) ;;
15343            *)
15344            if $test -f $xxx/$xxx.xs; then
15345                known_extensions="$known_extensions $1$xxx";
15346            elif $test -f $xxx/Makefile.PL; then
15347                nonxs_extensions="$nonxs_extensions $1$xxx";
15348            else
15349                if $test -d $xxx -a $# -lt 10; then
15350                    set $1$xxx/ $*;
15351                    cd $xxx;
15352                    eval $find_extensions;
15353                    cd ..;
15354                    shift;
15355                fi;
15356            fi
15357            ;;
15358        esac;
15359     done'
15360 tdir=`pwd`
15361 cd $rsrc/ext
15362 set X
15363 shift
15364 eval $find_extensions
15365 set X $nonxs_extensions
15366 shift
15367 nonxs_extensions="$*"
15368 set X $known_extensions
15369 shift
15370 known_extensions="$*"
15371 cd $tdir
15372
15373 : Now see which are supported on this system.
15374 avail_ext=''
15375 for xxx in $known_extensions ; do
15376         case "$xxx" in
15377         DB_File|db_file)
15378                 case "$i_db" in
15379                 $define) avail_ext="$avail_ext $xxx" ;;
15380                 esac
15381                 ;;
15382         GDBM_File|gdbm_fil)
15383                 case "$i_gdbm" in 
15384                 $define) avail_ext="$avail_ext $xxx" ;;
15385                 esac
15386                 ;;
15387         NDBM_File|ndbm_fil)
15388                 case "$i_ndbm" in
15389                 $define)
15390                     case "$osname-$use64bitint" in
15391                     hpux-define)
15392                         case "$libs" in
15393                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15394                         esac
15395                         ;;
15396                     *) avail_ext="$avail_ext $xxx" ;;
15397                     esac
15398                     ;;
15399                 esac
15400                 ;;
15401         ODBM_File|odbm_fil) 
15402                 case "${i_dbm}${i_rpcsvcdbm}" in
15403                 *"${define}"*)
15404                     case "$osname-$use64bitint" in
15405                     hpux-define)
15406                         case "$libs" in
15407                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15408                         esac
15409                         ;;
15410                     *) avail_ext="$avail_ext $xxx" ;;
15411                     esac
15412                     ;;
15413                 esac
15414                 ;;
15415         POSIX|posix)
15416                 case "$useposix" in
15417                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15418                 esac
15419                 ;;
15420         Opcode|opcode)
15421                 case "$useopcode" in
15422                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15423                 esac
15424                 ;;
15425         Socket|socket)
15426                 case "$d_socket" in 
15427                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15428                 esac
15429                 ;;
15430         Sys/Syslog|sys/syslog)
15431                 : XXX syslog requires socket
15432                 case "$d_socket" in 
15433                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15434                 esac
15435                 ;;
15436         Thread|thread)
15437                 case "$usethreads" in 
15438                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15439                 esac
15440                 ;;
15441         IPC/SysV|ipc/sysv)
15442                 : XXX Do we need a useipcsysv variable here
15443                 case "${d_msg}${d_sem}${d_shm}" in 
15444                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15445                 esac
15446                 ;;
15447         *)      avail_ext="$avail_ext $xxx"
15448                 ;;
15449         esac
15450 done
15451
15452 set X $avail_ext
15453 shift
15454 avail_ext="$*"
15455
15456 : Now see which nonxs extensions are supported on this system.
15457 : For now assume all are.
15458 nonxs_ext=''
15459 for xxx in $nonxs_extensions ; do
15460         case "$xxx" in
15461         *)      nonxs_ext="$nonxs_ext $xxx"
15462                 ;;
15463         esac
15464 done
15465
15466 set X $nonxs_ext
15467 shift
15468 nonxs_ext="$*"
15469
15470 case $usedl in
15471 $define)
15472         $cat <<EOM
15473 A number of extensions are supplied with $package.  You may choose to
15474 compile these extensions for dynamic loading (the default), compile
15475 them into the $package executable (static loading), or not include
15476 them at all.  Answer "none" to include no extensions.
15477 Note that DynaLoader is always built and need not be mentioned here.
15478
15479 EOM
15480         case "$dynamic_ext" in
15481         '') dflt="$avail_ext" ;;
15482         *)      dflt="$dynamic_ext"
15483                 # Perhaps we are reusing an old out-of-date config.sh.
15484                 case "$hint" in
15485                 previous)
15486                         if test X"$dynamic_ext" != X"$avail_ext"; then
15487                                 $cat <<EOM
15488 NOTICE:  Your previous config.sh list may be incorrect. 
15489 The extensions now available to you are 
15490         ${avail_ext}
15491 but the default list from your previous config.sh is
15492         ${dynamic_ext} 
15493
15494 EOM
15495                         fi
15496                         ;;
15497                 esac
15498                 ;;
15499         esac
15500         case "$dflt" in
15501         '')     dflt=none;;
15502         esac
15503         rp="What extensions do you wish to load dynamically?"
15504         . ./myread
15505         case "$ans" in
15506         none) dynamic_ext=' ' ;;
15507         *) dynamic_ext="$ans" ;;
15508         esac
15509
15510         case "$static_ext" in
15511         '')
15512                 : Exclude those already listed in dynamic linking
15513                 dflt=''
15514                 for xxx in $avail_ext; do
15515                         case " $dynamic_ext " in
15516                         *" $xxx "*) ;;
15517                         *) dflt="$dflt $xxx" ;;
15518                         esac
15519                 done
15520                 set X $dflt
15521                 shift
15522                 dflt="$*"
15523                 ;;
15524         *)  dflt="$static_ext" 
15525                 ;;
15526         esac
15527
15528         case "$dflt" in
15529         '')     dflt=none;;
15530         esac
15531         rp="What extensions do you wish to load statically?"
15532         . ./myread
15533         case "$ans" in
15534         none) static_ext=' ' ;;
15535         *) static_ext="$ans" ;;
15536         esac
15537         ;;
15538 *)
15539         $cat <<EOM
15540 A number of extensions are supplied with $package.  Answer "none" 
15541 to include no extensions. 
15542 Note that DynaLoader is always built and need not be mentioned here.
15543
15544 EOM
15545         case "$static_ext" in
15546         '') dflt="$avail_ext" ;;
15547         *)      dflt="$static_ext"
15548                 # Perhaps we are reusing an old out-of-date config.sh.
15549                 case "$hint" in
15550                 previous)
15551                         if test X"$static_ext" != X"$avail_ext"; then
15552                                 $cat <<EOM
15553 NOTICE:  Your previous config.sh list may be incorrect. 
15554 The extensions now available to you are 
15555         ${avail_ext}
15556 but the default list from your previous config.sh is
15557         ${static_ext} 
15558
15559 EOM
15560                         fi
15561                         ;;
15562                 esac
15563                 ;;
15564         esac
15565         : Exclude those that are not xs extensions
15566         case "$dflt" in
15567         '')     dflt=none;;
15568         esac
15569         rp="What extensions do you wish to include?"
15570         . ./myread
15571         case "$ans" in
15572         none) static_ext=' ' ;;
15573         *) static_ext="$ans" ;;
15574         esac
15575         ;;
15576 esac
15577
15578 set X $dynamic_ext $static_ext $nonxs_ext
15579 shift
15580 extensions="$*"
15581
15582 : Remove libraries needed only for extensions
15583 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15584 : The exception is SunOS 4.x, which needs them.
15585 case "${osname}X${osvers}" in
15586 sunos*X4*)
15587     perllibs="$libs"
15588     ;;
15589 *) case "$usedl" in
15590     $define|true|[yY]*)
15591             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15592             shift
15593             perllibs="$*"
15594             ;;
15595     *)  perllibs="$libs"
15596             ;;
15597     esac
15598     ;;
15599 esac
15600
15601 : Remove build directory name from cppstdin so it can be used from
15602 : either the present location or the final installed location.
15603 echo " "
15604 : Get out of the UU directory to get correct path name.
15605 cd ..
15606 case "$cppstdin" in
15607 `pwd`/cppstdin)
15608         echo "Stripping down cppstdin path name"
15609         cppstdin=cppstdin
15610         ;;
15611 esac
15612 cd UU
15613
15614 : end of configuration questions
15615 echo " "
15616 echo "End of configuration questions."
15617 echo " "
15618
15619 : back to where it started
15620 if test -d ../UU; then
15621         cd ..
15622 fi
15623
15624 : configuration may be patched via a 'config.over' file
15625 if $test -f config.over; then
15626         echo " "
15627         dflt=y
15628         rp='I see a config.over file.  Do you wish to load it?'
15629         . UU/myread
15630         case "$ans" in
15631         n*) echo "OK, I'll ignore it.";;
15632         *)      . ./config.over
15633                 echo "Configuration override changes have been loaded."
15634                 ;;
15635         esac
15636 fi
15637
15638 : in case they want portability, strip down executable paths
15639 case "$d_portable" in
15640 "$define")
15641         echo " "
15642         echo "Stripping down executable paths..." >&4
15643         for file in $loclist $trylist; do
15644                 eval temp=\$$file
15645                 eval $file=`basename $temp`
15646         done
15647         ;;
15648 esac
15649
15650 : create config.sh file
15651 echo " "
15652 echo "Creating config.sh..." >&4
15653 $spitshell <<EOT >config.sh
15654 $startsh
15655 #
15656 # This file was produced by running the Configure script. It holds all the
15657 # definitions figured out by Configure. Should you modify one of these values,
15658 # do not forget to propagate your changes by running "Configure -der". You may
15659 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15660 #
15661
15662 # Package name      : $package
15663 # Source directory  : $src
15664 # Configuration time: $cf_time
15665 # Configured by     : $cf_by
15666 # Target system     : $myuname
15667
15668 Author='$Author'
15669 Date='$Date'
15670 Header='$Header'
15671 Id='$Id'
15672 Locker='$Locker'
15673 Log='$Log'
15674 Mcc='$Mcc'
15675 RCSfile='$RCSfile'
15676 Revision='$Revision'
15677 Source='$Source'
15678 State='$State'
15679 _a='$_a'
15680 _exe='$_exe'
15681 _o='$_o'
15682 afs='$afs'
15683 alignbytes='$alignbytes'
15684 ansi2knr='$ansi2knr'
15685 aphostname='$aphostname'
15686 api_revision='$api_revision'
15687 api_subversion='$api_subversion'
15688 api_version='$api_version'
15689 api_versionstring='$api_versionstring'
15690 ar='$ar'
15691 archlib='$archlib'
15692 archlibexp='$archlibexp'
15693 archname64='$archname64'
15694 archname='$archname'
15695 archobjs='$archobjs'
15696 awk='$awk'
15697 baserev='$baserev'
15698 bash='$bash'
15699 bin='$bin'
15700 bincompat5005='$bincompat5005'
15701 binexp='$binexp'
15702 bison='$bison'
15703 byacc='$byacc'
15704 byteorder='$byteorder'
15705 c='$c'
15706 castflags='$castflags'
15707 cat='$cat'
15708 cc='$cc'
15709 cccdlflags='$cccdlflags'
15710 ccdlflags='$ccdlflags'
15711 ccflags='$ccflags'
15712 ccflags_uselargefiles='$ccflags_uselargefiles'
15713 ccname='$ccname'
15714 ccsymbols='$ccsymbols'
15715 ccversion='$ccversion'
15716 cf_by='$cf_by'
15717 cf_email='$cf_email'
15718 cf_time='$cf_time'
15719 charsize='$charsize'
15720 chgrp='$chgrp'
15721 chmod='$chmod'
15722 chown='$chown'
15723 clocktype='$clocktype'
15724 comm='$comm'
15725 compress='$compress'
15726 contains='$contains'
15727 cp='$cp'
15728 cpio='$cpio'
15729 cpp='$cpp'
15730 cpp_stuff='$cpp_stuff'
15731 cppccsymbols='$cppccsymbols'
15732 cppflags='$cppflags'
15733 cpplast='$cpplast'
15734 cppminus='$cppminus'
15735 cpprun='$cpprun'
15736 cppstdin='$cppstdin'
15737 cppsymbols='$cppsymbols'
15738 crosscompile='$crosscompile'
15739 cryptlib='$cryptlib'
15740 csh='$csh'
15741 d_Gconvert='$d_Gconvert'
15742 d_PRIEUldbl='$d_PRIEUldbl'
15743 d_PRIFUldbl='$d_PRIFUldbl'
15744 d_PRIGUldbl='$d_PRIGUldbl'
15745 d_PRIXU64='$d_PRIXU64'
15746 d_PRId64='$d_PRId64'
15747 d_PRIeldbl='$d_PRIeldbl'
15748 d_PRIfldbl='$d_PRIfldbl'
15749 d_PRIgldbl='$d_PRIgldbl'
15750 d_PRIi64='$d_PRIi64'
15751 d_PRIo64='$d_PRIo64'
15752 d_PRIu64='$d_PRIu64'
15753 d_PRIx64='$d_PRIx64'
15754 d_SCNfldbl='$d_SCNfldbl'
15755 d__fwalk='$d__fwalk'
15756 d_access='$d_access'
15757 d_accessx='$d_accessx'
15758 d_alarm='$d_alarm'
15759 d_archlib='$d_archlib'
15760 d_atolf='$d_atolf'
15761 d_atoll='$d_atoll'
15762 d_attribut='$d_attribut'
15763 d_bcmp='$d_bcmp'
15764 d_bcopy='$d_bcopy'
15765 d_bincompat5005='$d_bincompat5005'
15766 d_bsd='$d_bsd'
15767 d_bsdgetpgrp='$d_bsdgetpgrp'
15768 d_bsdsetpgrp='$d_bsdsetpgrp'
15769 d_bzero='$d_bzero'
15770 d_casti32='$d_casti32'
15771 d_castneg='$d_castneg'
15772 d_charvspr='$d_charvspr'
15773 d_chown='$d_chown'
15774 d_chroot='$d_chroot'
15775 d_chsize='$d_chsize'
15776 d_closedir='$d_closedir'
15777 d_const='$d_const'
15778 d_crypt='$d_crypt'
15779 d_csh='$d_csh'
15780 d_cuserid='$d_cuserid'
15781 d_dbl_dig='$d_dbl_dig'
15782 d_difftime='$d_difftime'
15783 d_dirnamlen='$d_dirnamlen'
15784 d_dlerror='$d_dlerror'
15785 d_dlopen='$d_dlopen'
15786 d_dlsymun='$d_dlsymun'
15787 d_dosuid='$d_dosuid'
15788 d_drand48proto='$d_drand48proto'
15789 d_dup2='$d_dup2'
15790 d_eaccess='$d_eaccess'
15791 d_endgrent='$d_endgrent'
15792 d_endhent='$d_endhent'
15793 d_endnent='$d_endnent'
15794 d_endpent='$d_endpent'
15795 d_endpwent='$d_endpwent'
15796 d_endsent='$d_endsent'
15797 d_eofnblk='$d_eofnblk'
15798 d_eunice='$d_eunice'
15799 d_fchmod='$d_fchmod'
15800 d_fchown='$d_fchown'
15801 d_fcntl='$d_fcntl'
15802 d_fcntl_can_lock='$d_fcntl_can_lock'
15803 d_fd_macros='$d_fd_macros'
15804 d_fd_set='$d_fd_set'
15805 d_fds_bits='$d_fds_bits'
15806 d_fgetpos='$d_fgetpos'
15807 d_flexfnam='$d_flexfnam'
15808 d_flock='$d_flock'
15809 d_fork='$d_fork'
15810 d_fpathconf='$d_fpathconf'
15811 d_fpos64_t='$d_fpos64_t'
15812 d_frexpl='$d_frexpl'
15813 d_fs_data_s='$d_fs_data_s'
15814 d_fseeko='$d_fseeko'
15815 d_fsetpos='$d_fsetpos'
15816 d_fstatfs='$d_fstatfs'
15817 d_fstatvfs='$d_fstatvfs'
15818 d_fsync='$d_fsync'
15819 d_ftello='$d_ftello'
15820 d_ftime='$d_ftime'
15821 d_getcwd='$d_getcwd'
15822 d_getespwnam='$d_getespwnam'
15823 d_getfsstat='$d_getfsstat'
15824 d_getgrent='$d_getgrent'
15825 d_getgrps='$d_getgrps'
15826 d_gethbyaddr='$d_gethbyaddr'
15827 d_gethbyname='$d_gethbyname'
15828 d_gethent='$d_gethent'
15829 d_gethname='$d_gethname'
15830 d_gethostprotos='$d_gethostprotos'
15831 d_getlogin='$d_getlogin'
15832 d_getmnt='$d_getmnt'
15833 d_getmntent='$d_getmntent'
15834 d_getnbyaddr='$d_getnbyaddr'
15835 d_getnbyname='$d_getnbyname'
15836 d_getnent='$d_getnent'
15837 d_getnetprotos='$d_getnetprotos'
15838 d_getpagsz='$d_getpagsz'
15839 d_getpbyname='$d_getpbyname'
15840 d_getpbynumber='$d_getpbynumber'
15841 d_getpent='$d_getpent'
15842 d_getpgid='$d_getpgid'
15843 d_getpgrp2='$d_getpgrp2'
15844 d_getpgrp='$d_getpgrp'
15845 d_getppid='$d_getppid'
15846 d_getprior='$d_getprior'
15847 d_getprotoprotos='$d_getprotoprotos'
15848 d_getprpwnam='$d_getprpwnam'
15849 d_getpwent='$d_getpwent'
15850 d_getsbyname='$d_getsbyname'
15851 d_getsbyport='$d_getsbyport'
15852 d_getsent='$d_getsent'
15853 d_getservprotos='$d_getservprotos'
15854 d_getspnam='$d_getspnam'
15855 d_gettimeod='$d_gettimeod'
15856 d_gnulibc='$d_gnulibc'
15857 d_grpasswd='$d_grpasswd'
15858 d_hasmntopt='$d_hasmntopt'
15859 d_htonl='$d_htonl'
15860 d_iconv='$d_iconv'
15861 d_index='$d_index'
15862 d_inetaton='$d_inetaton'
15863 d_int64_t='$d_int64_t'
15864 d_isascii='$d_isascii'
15865 d_isnan='$d_isnan'
15866 d_isnanl='$d_isnanl'
15867 d_killpg='$d_killpg'
15868 d_lchown='$d_lchown'
15869 d_ldbl_dig='$d_ldbl_dig'
15870 d_link='$d_link'
15871 d_locconv='$d_locconv'
15872 d_lockf='$d_lockf'
15873 d_longdbl='$d_longdbl'
15874 d_longlong='$d_longlong'
15875 d_lseekproto='$d_lseekproto'
15876 d_lstat='$d_lstat'
15877 d_madvise='$d_madvise'
15878 d_mblen='$d_mblen'
15879 d_mbstowcs='$d_mbstowcs'
15880 d_mbtowc='$d_mbtowc'
15881 d_memchr='$d_memchr'
15882 d_memcmp='$d_memcmp'
15883 d_memcpy='$d_memcpy'
15884 d_memmove='$d_memmove'
15885 d_memset='$d_memset'
15886 d_mkdir='$d_mkdir'
15887 d_mkdtemp='$d_mkdtemp'
15888 d_mkfifo='$d_mkfifo'
15889 d_mkstemp='$d_mkstemp'
15890 d_mkstemps='$d_mkstemps'
15891 d_mktime='$d_mktime'
15892 d_mmap='$d_mmap'
15893 d_modfl='$d_modfl'
15894 d_mprotect='$d_mprotect'
15895 d_msg='$d_msg'
15896 d_msg_ctrunc='$d_msg_ctrunc'
15897 d_msg_dontroute='$d_msg_dontroute'
15898 d_msg_oob='$d_msg_oob'
15899 d_msg_peek='$d_msg_peek'
15900 d_msg_proxy='$d_msg_proxy'
15901 d_msgctl='$d_msgctl'
15902 d_msgget='$d_msgget'
15903 d_msgrcv='$d_msgrcv'
15904 d_msgsnd='$d_msgsnd'
15905 d_msync='$d_msync'
15906 d_munmap='$d_munmap'
15907 d_mymalloc='$d_mymalloc'
15908 d_nice='$d_nice'
15909 d_nv_preserves_uv='$d_nv_preserves_uv'
15910 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15911 d_off64_t='$d_off64_t'
15912 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15913 d_oldpthreads='$d_oldpthreads'
15914 d_oldsock='$d_oldsock'
15915 d_open3='$d_open3'
15916 d_pathconf='$d_pathconf'
15917 d_pause='$d_pause'
15918 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15919 d_phostname='$d_phostname'
15920 d_pipe='$d_pipe'
15921 d_poll='$d_poll'
15922 d_portable='$d_portable'
15923 d_pthread_yield='$d_pthread_yield'
15924 d_pwage='$d_pwage'
15925 d_pwchange='$d_pwchange'
15926 d_pwclass='$d_pwclass'
15927 d_pwcomment='$d_pwcomment'
15928 d_pwexpire='$d_pwexpire'
15929 d_pwgecos='$d_pwgecos'
15930 d_pwpasswd='$d_pwpasswd'
15931 d_pwquota='$d_pwquota'
15932 d_qgcvt='$d_qgcvt'
15933 d_quad='$d_quad'
15934 d_readdir='$d_readdir'
15935 d_readlink='$d_readlink'
15936 d_rename='$d_rename'
15937 d_rewinddir='$d_rewinddir'
15938 d_rmdir='$d_rmdir'
15939 d_safebcpy='$d_safebcpy'
15940 d_safemcpy='$d_safemcpy'
15941 d_sanemcmp='$d_sanemcmp'
15942 d_sbrkproto='$d_sbrkproto'
15943 d_sched_yield='$d_sched_yield'
15944 d_scm_rights='$d_scm_rights'
15945 d_seekdir='$d_seekdir'
15946 d_select='$d_select'
15947 d_sem='$d_sem'
15948 d_semctl='$d_semctl'
15949 d_semctl_semid_ds='$d_semctl_semid_ds'
15950 d_semctl_semun='$d_semctl_semun'
15951 d_semget='$d_semget'
15952 d_semop='$d_semop'
15953 d_setegid='$d_setegid'
15954 d_seteuid='$d_seteuid'
15955 d_setgrent='$d_setgrent'
15956 d_setgrps='$d_setgrps'
15957 d_sethent='$d_sethent'
15958 d_setlinebuf='$d_setlinebuf'
15959 d_setlocale='$d_setlocale'
15960 d_setnent='$d_setnent'
15961 d_setpent='$d_setpent'
15962 d_setpgid='$d_setpgid'
15963 d_setpgrp2='$d_setpgrp2'
15964 d_setpgrp='$d_setpgrp'
15965 d_setprior='$d_setprior'
15966 d_setproctitle='$d_setproctitle'
15967 d_setpwent='$d_setpwent'
15968 d_setregid='$d_setregid'
15969 d_setresgid='$d_setresgid'
15970 d_setresuid='$d_setresuid'
15971 d_setreuid='$d_setreuid'
15972 d_setrgid='$d_setrgid'
15973 d_setruid='$d_setruid'
15974 d_setsent='$d_setsent'
15975 d_setsid='$d_setsid'
15976 d_setvbuf='$d_setvbuf'
15977 d_sfio='$d_sfio'
15978 d_shm='$d_shm'
15979 d_shmat='$d_shmat'
15980 d_shmatprototype='$d_shmatprototype'
15981 d_shmctl='$d_shmctl'
15982 d_shmdt='$d_shmdt'
15983 d_shmget='$d_shmget'
15984 d_sigaction='$d_sigaction'
15985 d_sigsetjmp='$d_sigsetjmp'
15986 d_socket='$d_socket'
15987 d_socklen_t='$d_socklen_t'
15988 d_sockpair='$d_sockpair'
15989 d_socks5_init='$d_socks5_init'
15990 d_sqrtl='$d_sqrtl'
15991 d_statblks='$d_statblks'
15992 d_statfs_f_flags='$d_statfs_f_flags'
15993 d_statfs_s='$d_statfs_s'
15994 d_statvfs='$d_statvfs'
15995 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15996 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15997 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15998 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
15999 d_stdio_stream_array='$d_stdio_stream_array'
16000 d_stdiobase='$d_stdiobase'
16001 d_stdstdio='$d_stdstdio'
16002 d_strchr='$d_strchr'
16003 d_strcoll='$d_strcoll'
16004 d_strctcpy='$d_strctcpy'
16005 d_strerrm='$d_strerrm'
16006 d_strerror='$d_strerror'
16007 d_strtod='$d_strtod'
16008 d_strtol='$d_strtol'
16009 d_strtold='$d_strtold'
16010 d_strtoll='$d_strtoll'
16011 d_strtoq='$d_strtoq'
16012 d_strtoul='$d_strtoul'
16013 d_strtoull='$d_strtoull'
16014 d_strtouq='$d_strtouq'
16015 d_strxfrm='$d_strxfrm'
16016 d_suidsafe='$d_suidsafe'
16017 d_symlink='$d_symlink'
16018 d_syscall='$d_syscall'
16019 d_sysconf='$d_sysconf'
16020 d_sysernlst='$d_sysernlst'
16021 d_syserrlst='$d_syserrlst'
16022 d_system='$d_system'
16023 d_tcgetpgrp='$d_tcgetpgrp'
16024 d_tcsetpgrp='$d_tcsetpgrp'
16025 d_telldir='$d_telldir'
16026 d_telldirproto='$d_telldirproto'
16027 d_time='$d_time'
16028 d_times='$d_times'
16029 d_truncate='$d_truncate'
16030 d_tzname='$d_tzname'
16031 d_umask='$d_umask'
16032 d_uname='$d_uname'
16033 d_union_semun='$d_union_semun'
16034 d_ustat='$d_ustat'
16035 d_vendorarch='$d_vendorarch'
16036 d_vendorbin='$d_vendorbin'
16037 d_vendorlib='$d_vendorlib'
16038 d_vfork='$d_vfork'
16039 d_void_closedir='$d_void_closedir'
16040 d_voidsig='$d_voidsig'
16041 d_voidtty='$d_voidtty'
16042 d_volatile='$d_volatile'
16043 d_vprintf='$d_vprintf'
16044 d_wait4='$d_wait4'
16045 d_waitpid='$d_waitpid'
16046 d_wcstombs='$d_wcstombs'
16047 d_wctomb='$d_wctomb'
16048 d_xenix='$d_xenix'
16049 date='$date'
16050 db_hashtype='$db_hashtype'
16051 db_prefixtype='$db_prefixtype'
16052 defvoidused='$defvoidused'
16053 direntrytype='$direntrytype'
16054 dlext='$dlext'
16055 dlsrc='$dlsrc'
16056 doublesize='$doublesize'
16057 drand01='$drand01'
16058 dynamic_ext='$dynamic_ext'
16059 eagain='$eagain'
16060 ebcdic='$ebcdic'
16061 echo='$echo'
16062 egrep='$egrep'
16063 emacs='$emacs'
16064 eunicefix='$eunicefix'
16065 exe_ext='$exe_ext'
16066 expr='$expr'
16067 extensions='$extensions'
16068 fflushNULL='$fflushNULL'
16069 fflushall='$fflushall'
16070 find='$find'
16071 firstmakefile='$firstmakefile'
16072 flex='$flex'
16073 fpossize='$fpossize'
16074 fpostype='$fpostype'
16075 freetype='$freetype'
16076 full_ar='$full_ar'
16077 full_csh='$full_csh'
16078 full_sed='$full_sed'
16079 gccosandvers='$gccosandvers'
16080 gccversion='$gccversion'
16081 gidformat='$gidformat'
16082 gidsign='$gidsign'
16083 gidsize='$gidsize'
16084 gidtype='$gidtype'
16085 glibpth='$glibpth'
16086 grep='$grep'
16087 groupcat='$groupcat'
16088 groupstype='$groupstype'
16089 gzip='$gzip'
16090 h_fcntl='$h_fcntl'
16091 h_sysfile='$h_sysfile'
16092 hint='$hint'
16093 hostcat='$hostcat'
16094 i16size='$i16size'
16095 i16type='$i16type'
16096 i32size='$i32size'
16097 i32type='$i32type'
16098 i64size='$i64size'
16099 i64type='$i64type'
16100 i8size='$i8size'
16101 i8type='$i8type'
16102 i_arpainet='$i_arpainet'
16103 i_bsdioctl='$i_bsdioctl'
16104 i_db='$i_db'
16105 i_dbm='$i_dbm'
16106 i_dirent='$i_dirent'
16107 i_dld='$i_dld'
16108 i_dlfcn='$i_dlfcn'
16109 i_fcntl='$i_fcntl'
16110 i_float='$i_float'
16111 i_gdbm='$i_gdbm'
16112 i_grp='$i_grp'
16113 i_iconv='$i_iconv'
16114 i_ieeefp='$i_ieeefp'
16115 i_inttypes='$i_inttypes'
16116 i_libutil='$i_libutil'
16117 i_limits='$i_limits'
16118 i_locale='$i_locale'
16119 i_machcthr='$i_machcthr'
16120 i_malloc='$i_malloc'
16121 i_math='$i_math'
16122 i_memory='$i_memory'
16123 i_mntent='$i_mntent'
16124 i_ndbm='$i_ndbm'
16125 i_netdb='$i_netdb'
16126 i_neterrno='$i_neterrno'
16127 i_netinettcp='$i_netinettcp'
16128 i_niin='$i_niin'
16129 i_poll='$i_poll'
16130 i_prot='$i_prot'
16131 i_pthread='$i_pthread'
16132 i_pwd='$i_pwd'
16133 i_rpcsvcdbm='$i_rpcsvcdbm'
16134 i_sfio='$i_sfio'
16135 i_sgtty='$i_sgtty'
16136 i_shadow='$i_shadow'
16137 i_socks='$i_socks'
16138 i_stdarg='$i_stdarg'
16139 i_stddef='$i_stddef'
16140 i_stdlib='$i_stdlib'
16141 i_string='$i_string'
16142 i_sunmath='$i_sunmath'
16143 i_sysaccess='$i_sysaccess'
16144 i_sysdir='$i_sysdir'
16145 i_sysfile='$i_sysfile'
16146 i_sysfilio='$i_sysfilio'
16147 i_sysin='$i_sysin'
16148 i_sysioctl='$i_sysioctl'
16149 i_syslog='$i_syslog'
16150 i_sysmman='$i_sysmman'
16151 i_sysmode='$i_sysmode'
16152 i_sysmount='$i_sysmount'
16153 i_sysndir='$i_sysndir'
16154 i_sysparam='$i_sysparam'
16155 i_sysresrc='$i_sysresrc'
16156 i_syssecrt='$i_syssecrt'
16157 i_sysselct='$i_sysselct'
16158 i_syssockio='$i_syssockio'
16159 i_sysstat='$i_sysstat'
16160 i_sysstatfs='$i_sysstatfs'
16161 i_sysstatvfs='$i_sysstatvfs'
16162 i_systime='$i_systime'
16163 i_systimek='$i_systimek'
16164 i_systimes='$i_systimes'
16165 i_systypes='$i_systypes'
16166 i_sysuio='$i_sysuio'
16167 i_sysun='$i_sysun'
16168 i_sysutsname='$i_sysutsname'
16169 i_sysvfs='$i_sysvfs'
16170 i_syswait='$i_syswait'
16171 i_termio='$i_termio'
16172 i_termios='$i_termios'
16173 i_time='$i_time'
16174 i_unistd='$i_unistd'
16175 i_ustat='$i_ustat'
16176 i_utime='$i_utime'
16177 i_values='$i_values'
16178 i_varargs='$i_varargs'
16179 i_varhdr='$i_varhdr'
16180 i_vfork='$i_vfork'
16181 ignore_versioned_solibs='$ignore_versioned_solibs'
16182 inc_version_list='$inc_version_list'
16183 inc_version_list_init='$inc_version_list_init'
16184 incpath='$incpath'
16185 inews='$inews'
16186 installarchlib='$installarchlib'
16187 installbin='$installbin'
16188 installman1dir='$installman1dir'
16189 installman3dir='$installman3dir'
16190 installprefix='$installprefix'
16191 installprefixexp='$installprefixexp'
16192 installprivlib='$installprivlib'
16193 installscript='$installscript'
16194 installsitearch='$installsitearch'
16195 installsitebin='$installsitebin'
16196 installsitelib='$installsitelib'
16197 installstyle='$installstyle'
16198 installusrbinperl='$installusrbinperl'
16199 installvendorarch='$installvendorarch'
16200 installvendorbin='$installvendorbin'
16201 installvendorlib='$installvendorlib'
16202 intsize='$intsize'
16203 ivdformat='$ivdformat'
16204 ivsize='$ivsize'
16205 ivtype='$ivtype'
16206 known_extensions='$known_extensions'
16207 ksh='$ksh'
16208 ld='$ld'
16209 lddlflags='$lddlflags'
16210 ldflags='$ldflags'
16211 ldflags_uselargefiles='$ldflags_uselargefiles'
16212 ldlibpthname='$ldlibpthname'
16213 less='$less'
16214 lib_ext='$lib_ext'
16215 libc='$libc'
16216 libperl='$libperl'
16217 libpth='$libpth'
16218 libs='$libs'
16219 libsdirs='$libsdirs'
16220 libsfiles='$libsfiles'
16221 libsfound='$libsfound'
16222 libspath='$libspath'
16223 libswanted='$libswanted'
16224 libswanted_uselargefiles='$libswanted_uselargefiles'
16225 line='$line'
16226 lint='$lint'
16227 lkflags='$lkflags'
16228 ln='$ln'
16229 lns='$lns'
16230 locincpth='$locincpth'
16231 loclibpth='$loclibpth'
16232 longdblsize='$longdblsize'
16233 longlongsize='$longlongsize'
16234 longsize='$longsize'
16235 lp='$lp'
16236 lpr='$lpr'
16237 ls='$ls'
16238 lseeksize='$lseeksize'
16239 lseektype='$lseektype'
16240 mail='$mail'
16241 mailx='$mailx'
16242 make='$make'
16243 make_set_make='$make_set_make'
16244 mallocobj='$mallocobj'
16245 mallocsrc='$mallocsrc'
16246 malloctype='$malloctype'
16247 man1dir='$man1dir'
16248 man1direxp='$man1direxp'
16249 man1ext='$man1ext'
16250 man3dir='$man3dir'
16251 man3direxp='$man3direxp'
16252 man3ext='$man3ext'
16253 mips_type='$mips_type'
16254 mkdir='$mkdir'
16255 mmaptype='$mmaptype'
16256 modetype='$modetype'
16257 more='$more'
16258 multiarch='$multiarch'
16259 mv='$mv'
16260 myarchname='$myarchname'
16261 mydomain='$mydomain'
16262 myhostname='$myhostname'
16263 myuname='$myuname'
16264 n='$n'
16265 need_va_copy='$need_va_copy'
16266 netdb_hlen_type='$netdb_hlen_type'
16267 netdb_host_type='$netdb_host_type'
16268 netdb_name_type='$netdb_name_type'
16269 netdb_net_type='$netdb_net_type'
16270 nm='$nm'
16271 nm_opt='$nm_opt'
16272 nm_so_opt='$nm_so_opt'
16273 nonxs_ext='$nonxs_ext'
16274 nroff='$nroff'
16275 nvEUformat='$nvEUformat'
16276 nvFUformat='$nvFUformat'
16277 nvGUformat='$nvGUformat'
16278 nveformat='$nveformat'
16279 nvfformat='$nvfformat'
16280 nvgformat='$nvgformat'
16281 nvsize='$nvsize'
16282 nvtype='$nvtype'
16283 o_nonblock='$o_nonblock'
16284 obj_ext='$obj_ext'
16285 old_pthread_create_joinable='$old_pthread_create_joinable'
16286 optimize='$optimize'
16287 orderlib='$orderlib'
16288 osname='$osname'
16289 osvers='$osvers'
16290 otherlibdirs='$otherlibdirs'
16291 package='$package'
16292 pager='$pager'
16293 passcat='$passcat'
16294 patchlevel='$patchlevel'
16295 path_sep='$path_sep'
16296 perl5='$perl5'
16297 perl='$perl'
16298 perladmin='$perladmin'
16299 perllibs='$perllibs'
16300 perlpath='$perlpath'
16301 pg='$pg'
16302 phostname='$phostname'
16303 pidtype='$pidtype'
16304 plibpth='$plibpth'
16305 pm_apiversion='$pm_apiversion'
16306 pmake='$pmake'
16307 pr='$pr'
16308 prefix='$prefix'
16309 prefixexp='$prefixexp'
16310 privlib='$privlib'
16311 privlibexp='$privlibexp'
16312 prototype='$prototype'
16313 ptrsize='$ptrsize'
16314 quadkind='$quadkind'
16315 quadtype='$quadtype'
16316 randbits='$randbits'
16317 randfunc='$randfunc'
16318 randseedtype='$randseedtype'
16319 ranlib='$ranlib'
16320 rd_nodata='$rd_nodata'
16321 revision='$revision'
16322 rm='$rm'
16323 rmail='$rmail'
16324 runnm='$runnm'
16325 sPRIEUldbl='$sPRIEUldbl'
16326 sPRIFUldbl='$sPRIFUldbl'
16327 sPRIGUldbl='$sPRIGUldbl'
16328 sPRIXU64='$sPRIXU64'
16329 sPRId64='$sPRId64'
16330 sPRIeldbl='$sPRIeldbl'
16331 sPRIfldbl='$sPRIfldbl'
16332 sPRIgldbl='$sPRIgldbl'
16333 sPRIi64='$sPRIi64'
16334 sPRIo64='$sPRIo64'
16335 sPRIu64='$sPRIu64'
16336 sPRIx64='$sPRIx64'
16337 sSCNfldbl='$sSCNfldbl'
16338 sched_yield='$sched_yield'
16339 scriptdir='$scriptdir'
16340 scriptdirexp='$scriptdirexp'
16341 sed='$sed'
16342 seedfunc='$seedfunc'
16343 selectminbits='$selectminbits'
16344 selecttype='$selecttype'
16345 sendmail='$sendmail'
16346 sh='$sh'
16347 shar='$shar'
16348 sharpbang='$sharpbang'
16349 shmattype='$shmattype'
16350 shortsize='$shortsize'
16351 shrpenv='$shrpenv'
16352 shsharp='$shsharp'
16353 sig_count='$sig_count'
16354 sig_name='$sig_name'
16355 sig_name_init='$sig_name_init'
16356 sig_num='$sig_num'
16357 sig_num_init='$sig_num_init'
16358 signal_t='$signal_t'
16359 sitearch='$sitearch'
16360 sitearchexp='$sitearchexp'
16361 sitebin='$sitebin'
16362 sitebinexp='$sitebinexp'
16363 sitelib='$sitelib'
16364 sitelib_stem='$sitelib_stem'
16365 sitelibexp='$sitelibexp'
16366 siteprefix='$siteprefix'
16367 siteprefixexp='$siteprefixexp'
16368 sizesize='$sizesize'
16369 sizetype='$sizetype'
16370 sleep='$sleep'
16371 smail='$smail'
16372 so='$so'
16373 sockethdr='$sockethdr'
16374 socketlib='$socketlib'
16375 socksizetype='$socksizetype'
16376 sort='$sort'
16377 spackage='$spackage'
16378 spitshell='$spitshell'
16379 src='$src'
16380 ssizetype='$ssizetype'
16381 startperl='$startperl'
16382 startsh='$startsh'
16383 static_ext='$static_ext'
16384 stdchar='$stdchar'
16385 stdio_base='$stdio_base'
16386 stdio_bufsiz='$stdio_bufsiz'
16387 stdio_cnt='$stdio_cnt'
16388 stdio_filbuf='$stdio_filbuf'
16389 stdio_ptr='$stdio_ptr'
16390 stdio_stream_array='$stdio_stream_array'
16391 strings='$strings'
16392 submit='$submit'
16393 subversion='$subversion'
16394 sysman='$sysman'
16395 tail='$tail'
16396 tar='$tar'
16397 tbl='$tbl'
16398 tee='$tee'
16399 test='$test'
16400 timeincl='$timeincl'
16401 timetype='$timetype'
16402 touch='$touch'
16403 tr='$tr'
16404 trnl='$trnl'
16405 troff='$troff'
16406 u16size='$u16size'
16407 u16type='$u16type'
16408 u32size='$u32size'
16409 u32type='$u32type'
16410 u64size='$u64size'
16411 u64type='$u64type'
16412 u8size='$u8size'
16413 u8type='$u8type'
16414 uidformat='$uidformat'
16415 uidsign='$uidsign'
16416 uidsize='$uidsize'
16417 uidtype='$uidtype'
16418 uname='$uname'
16419 uniq='$uniq'
16420 uquadtype='$uquadtype'
16421 use5005threads='$use5005threads'
16422 use64bitall='$use64bitall'
16423 use64bitint='$use64bitint'
16424 usedl='$usedl'
16425 useithreads='$useithreads'
16426 uselargefiles='$uselargefiles'
16427 uselongdouble='$uselongdouble'
16428 usemorebits='$usemorebits'
16429 usemultiplicity='$usemultiplicity'
16430 usemymalloc='$usemymalloc'
16431 usenm='$usenm'
16432 useopcode='$useopcode'
16433 useperlio='$useperlio'
16434 useposix='$useposix'
16435 usesfio='$usesfio'
16436 useshrplib='$useshrplib'
16437 usesocks='$usesocks'
16438 usethreads='$usethreads'
16439 usevendorprefix='$usevendorprefix'
16440 usevfork='$usevfork'
16441 usrinc='$usrinc'
16442 uuname='$uuname'
16443 uvXUformat='$uvXUformat'
16444 uvoformat='$uvoformat'
16445 uvsize='$uvsize'
16446 uvtype='$uvtype'
16447 uvuformat='$uvuformat'
16448 uvxformat='$uvxformat'
16449 vendorarch='$vendorarch'
16450 vendorarchexp='$vendorarchexp'
16451 vendorbin='$vendorbin'
16452 vendorbinexp='$vendorbinexp'
16453 vendorlib='$vendorlib'
16454 vendorlib_stem='$vendorlib_stem'
16455 vendorlibexp='$vendorlibexp'
16456 vendorprefix='$vendorprefix'
16457 vendorprefixexp='$vendorprefixexp'
16458 version='$version'
16459 versiononly='$versiononly'
16460 vi='$vi'
16461 voidflags='$voidflags'
16462 xlibpth='$xlibpth'
16463 xs_apiversion='$xs_apiversion'
16464 zcat='$zcat'
16465 zip='$zip'
16466 EOT
16467
16468 : Add in command line options if available
16469 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16470
16471 : add special variables
16472 $test -f $src/patchlevel.h && \
16473 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16474 echo "CONFIGDOTSH=true" >>config.sh
16475
16476 : propagate old symbols
16477 if $test -f UU/config.sh; then
16478         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16479         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16480         $sort | $uniq -u >UU/oldsyms
16481         set X `cat UU/oldsyms`
16482         shift
16483         case $# in
16484         0) ;;
16485         *)
16486                 cat <<EOM
16487 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16488 EOM
16489                 echo "# Variables propagated from previous config.sh file." >>config.sh
16490                 for sym in `cat UU/oldsyms`; do
16491                         echo "    Propagating $hint variable "'$'"$sym..."
16492                         eval 'tmp="$'"${sym}"'"'
16493                         echo "$tmp" | \
16494                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16495                 done
16496                 ;;
16497         esac
16498 fi
16499
16500 : Finish up by extracting the .SH files
16501 case "$alldone" in
16502 exit)
16503         $rm -rf UU
16504         echo "Done."
16505         exit 0
16506         ;;
16507 cont)
16508         ;;
16509 '')
16510         dflt=''
16511         nostick=true
16512         $cat <<EOM
16513
16514 If you'd like to make any changes to the config.sh file before I begin
16515 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16516
16517 EOM
16518         rp="Press return or use a shell escape to edit config.sh:"
16519         . UU/myread
16520         nostick=''
16521         case "$ans" in
16522         '') ;;
16523         *) : in case they cannot read
16524                 sh 1>&4 -c "$ans";;
16525         esac
16526         ;;
16527 esac
16528
16529 : if this fails, just run all the .SH files by hand
16530 . ./config.sh
16531
16532 echo " "
16533 exec 1>&4
16534 . ./UU/extract
16535
16536 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16537         dflt=y
16538         case "$silent" in
16539         true) ;;
16540         *)
16541                 $cat <<EOM
16542
16543 Now you need to generate make dependencies by running "$make depend".
16544 You might prefer to run it in background: "$make depend > makedepend.out &"
16545 It can take a while, so you might not want to run it right now.
16546
16547 EOM
16548                 ;;
16549         esac
16550         rp="Run $make depend now?"
16551         . UU/myread
16552         case "$ans" in
16553         y*)
16554                 $make depend && echo "Now you must run '$make'."
16555                 ;;
16556         *)
16557                 echo "You must run '$make depend' then '$make'."
16558                 ;;
16559         esac
16560 elif test -f [Mm]akefile; then
16561         echo " "
16562         echo "Now you must run a $make."
16563 else
16564         echo "Done."
16565 fi
16566
16567 if $test -f Policy.sh; then
16568     $cat <<EOM
16569
16570 If you compile $package on a different machine or from a different object
16571 directory, copy the Policy.sh file from this object directory to the
16572 new one before you run Configure -- this will help you with most of
16573 the policy defaults.
16574
16575 EOM
16576 fi
16577 if $test -f config.msg; then
16578     echo "Hmm.  I also noted the following information while running:"
16579     echo " "
16580     $cat config.msg >&4
16581     $rm -f config.msg
16582 fi
16583 $rm -f kit*isdone ark*isdone
16584 $rm -rf UU
16585
16586 : End of Configure
16587