Probe for <sys/utsname.h>.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed Feb 16 01:07:15 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getcwd=''
366 d_getgrent=''
367 d_getgrps=''
368 d_gethbyaddr=''
369 d_gethbyname=''
370 d_gethent=''
371 aphostname=''
372 d_gethname=''
373 d_phostname=''
374 d_uname=''
375 d_gethostprotos=''
376 d_getlogin=''
377 d_getmnt=''
378 d_getmntent=''
379 d_getnbyaddr=''
380 d_getnbyname=''
381 d_getnent=''
382 d_getnetprotos=''
383 d_getpent=''
384 d_getpgid=''
385 d_getpgrp2=''
386 d_bsdgetpgrp=''
387 d_getpgrp=''
388 d_getppid=''
389 d_getprior=''
390 d_getpbyname=''
391 d_getpbynumber=''
392 d_getprotoprotos=''
393 d_getpwent=''
394 d_getsent=''
395 d_getservprotos=''
396 d_getspent=''
397 d_getspnam=''
398 d_getsbyname=''
399 d_getsbyport=''
400 d_gnulibc=''
401 d_hasmntopt=''
402 d_htonl=''
403 d_iconv=''
404 d_inetaton=''
405 d_int64t=''
406 d_isascii=''
407 d_killpg=''
408 d_lchown=''
409 d_ldbl_dig=''
410 d_link=''
411 d_locconv=''
412 d_lockf=''
413 d_longdbl=''
414 longdblsize=''
415 d_longlong=''
416 longlongsize=''
417 d_lstat=''
418 d_mblen=''
419 d_mbstowcs=''
420 d_mbtowc=''
421 d_memchr=''
422 d_memcmp=''
423 d_memcpy=''
424 d_memmove=''
425 d_memset=''
426 d_mkdir=''
427 d_mkdtemp=''
428 d_mkfifo=''
429 d_mkstemp=''
430 d_mkstemps=''
431 d_mktime=''
432 d_mmap=''
433 mmaptype=''
434 d_mprotect=''
435 d_msg=''
436 d_msgctl=''
437 d_msgget=''
438 d_msgrcv=''
439 d_msgsnd=''
440 d_msync=''
441 d_munmap=''
442 d_nice=''
443 d_open3=''
444 d_fpathconf=''
445 d_pathconf=''
446 d_pause=''
447 d_pipe=''
448 d_poll=''
449 d_portable=''
450 d_old_pthread_create_joinable=''
451 old_pthread_create_joinable=''
452 d_pthread_yield=''
453 d_sched_yield=''
454 sched_yield=''
455 d_readdir=''
456 d_rewinddir=''
457 d_seekdir=''
458 d_telldir=''
459 d_readlink=''
460 d_rename=''
461 d_rmdir=''
462 d_safebcpy=''
463 d_safemcpy=''
464 d_sanemcmp=''
465 d_select=''
466 d_sem=''
467 d_semctl=''
468 d_semget=''
469 d_semop=''
470 d_setegid=''
471 d_seteuid=''
472 d_setgrent=''
473 d_setgrps=''
474 d_sethent=''
475 d_setlinebuf=''
476 d_setlocale=''
477 d_setnent=''
478 d_setpent=''
479 d_setpgid=''
480 d_setpgrp2=''
481 d_bsdsetpgrp=''
482 d_setpgrp=''
483 d_setprior=''
484 d_setpwent=''
485 d_setregid=''
486 d_setresgid=''
487 d_setresuid=''
488 d_setreuid=''
489 d_setrgid=''
490 d_setruid=''
491 d_setsent=''
492 d_setsid=''
493 d_setspent=''
494 d_setvbuf=''
495 d_sfio=''
496 usesfio=''
497 d_shm=''
498 d_shmat=''
499 d_shmatprototype=''
500 shmattype=''
501 d_shmctl=''
502 d_shmdt=''
503 d_shmget=''
504 d_sigaction=''
505 d_sigsetjmp=''
506 d_msg_ctrunc=''
507 d_msg_dontroute=''
508 d_msg_oob=''
509 d_msg_peek=''
510 d_msg_proxy=''
511 d_oldsock=''
512 d_scm_rights=''
513 d_socket=''
514 d_sockpair=''
515 sockethdr=''
516 socketlib=''
517 d_sqrtl=''
518 d_statblks=''
519 d_statfs_f_flags=''
520 d_statfs_s=''
521 d_fstatvfs=''
522 d_statvfs=''
523 d_stdio_cnt_lval=''
524 d_stdio_ptr_lval=''
525 d_stdiobase=''
526 d_stdstdio=''
527 stdio_base=''
528 stdio_bufsiz=''
529 stdio_cnt=''
530 stdio_filbuf=''
531 stdio_ptr=''
532 d_index=''
533 d_strchr=''
534 d_strcoll=''
535 d_strctcpy=''
536 d_strerrm=''
537 d_strerror=''
538 d_sysernlst=''
539 d_syserrlst=''
540 d_strtod=''
541 d_strtol=''
542 d_strtold=''
543 d_strtoll=''
544 d_strtoul=''
545 d_strtoull=''
546 d_strtouq=''
547 d_strxfrm=''
548 d_symlink=''
549 d_syscall=''
550 d_sysconf=''
551 d_system=''
552 d_tcgetpgrp=''
553 d_tcsetpgrp=''
554 d_telldirproto=''
555 d_time=''
556 timetype=''
557 clocktype=''
558 d_times=''
559 d_truncate=''
560 d_tzname=''
561 d_umask=''
562 d_semctl_semid_ds=''
563 d_semctl_semun=''
564 d_union_semun=''
565 d_ustat=''
566 d_vfork=''
567 usevfork=''
568 d_voidsig=''
569 signal_t=''
570 d_volatile=''
571 d_charvspr=''
572 d_vprintf=''
573 d_wait4=''
574 d_waitpid=''
575 d_wcstombs=''
576 d_wctomb=''
577 dlext=''
578 cccdlflags=''
579 ccdlflags=''
580 dlsrc=''
581 ld=''
582 lddlflags=''
583 usedl=''
584 doublesize=''
585 ebcdic=''
586 fflushNULL=''
587 fflushall=''
588 fpossize=''
589 fpostype=''
590 gidformat=''
591 gidsign=''
592 gidsize=''
593 gidtype=''
594 groupstype=''
595 h_fcntl=''
596 h_sysfile=''
597 i_arpainet=''
598 db_hashtype=''
599 db_prefixtype=''
600 i_db=''
601 i_dbm=''
602 i_rpcsvcdbm=''
603 d_dirnamlen=''
604 direntrytype=''
605 i_dirent=''
606 i_dld=''
607 i_dlfcn=''
608 i_fcntl=''
609 i_float=''
610 i_gdbm=''
611 d_grpasswd=''
612 i_grp=''
613 i_iconv=''
614 i_inttypes=''
615 i_limits=''
616 i_locale=''
617 i_machcthr=''
618 i_malloc=''
619 i_math=''
620 i_memory=''
621 i_mntent=''
622 i_ndbm=''
623 i_netdb=''
624 i_neterrno=''
625 i_netinettcp=''
626 i_niin=''
627 i_sysin=''
628 i_poll=''
629 i_pthread=''
630 d_pwage=''
631 d_pwchange=''
632 d_pwclass=''
633 d_pwcomment=''
634 d_pwexpire=''
635 d_pwgecos=''
636 d_pwpasswd=''
637 d_pwquota=''
638 i_pwd=''
639 i_sfio=''
640 i_shadow=''
641 i_socks=''
642 i_stddef=''
643 i_stdlib=''
644 i_string=''
645 strings=''
646 i_sysaccess=''
647 i_sysdir=''
648 i_sysfile=''
649 d_voidtty=''
650 i_bsdioctl=''
651 i_sysfilio=''
652 i_sysioctl=''
653 i_syssockio=''
654 i_syslog=''
655 i_sysmman=''
656 i_sysmount=''
657 i_sysndir=''
658 i_sysparam=''
659 i_sysresrc=''
660 i_syssecrt=''
661 i_sysselct=''
662 i_sysstat=''
663 i_sysstatfs=''
664 i_sysstatvfs=''
665 i_systimes=''
666 i_systypes=''
667 i_sysuio=''
668 i_sysun=''
669 i_sysutsname=''
670 i_sysvfs=''
671 i_syswait=''
672 i_sgtty=''
673 i_termio=''
674 i_termios=''
675 i_systime=''
676 i_systimek=''
677 i_time=''
678 timeincl=''
679 i_unistd=''
680 i_ustat=''
681 i_utime=''
682 i_values=''
683 i_stdarg=''
684 i_varargs=''
685 i_varhdr=''
686 i_vfork=''
687 inc_version_list=''
688 inc_version_list_init=''
689 installprefix=''
690 installprefixexp=''
691 installstyle=''
692 installusrbinperl=''
693 intsize=''
694 longsize=''
695 shortsize=''
696 d_fpos64_t=''
697 d_off64_t=''
698 libc=''
699 ldlibpthname=''
700 libperl=''
701 shrpenv=''
702 useshrplib=''
703 glibpth=''
704 libpth=''
705 loclibpth=''
706 plibpth=''
707 xlibpth=''
708 ignore_versioned_solibs=''
709 libs=''
710 libsdirs=''
711 libsfiles=''
712 libsfound=''
713 lns=''
714 d_PRIEldbl=''
715 d_PRIFldbl=''
716 d_PRIGldbl=''
717 d_PRIeldbl=''
718 d_PRIfldbl=''
719 d_PRIgldbl=''
720 sPRIEldbl=''
721 sPRIFldbl=''
722 sPRIGldbl=''
723 sPRIeldbl=''
724 sPRIfldbl=''
725 sPRIgldbl=''
726 lseeksize=''
727 lseektype=''
728 make_set_make=''
729 d_mymalloc=''
730 freetype=''
731 mallocobj=''
732 mallocsrc=''
733 malloctype=''
734 usemymalloc=''
735 installman1dir=''
736 man1dir=''
737 man1direxp=''
738 man1ext=''
739 installman3dir=''
740 man3dir=''
741 man3direxp=''
742 man3ext=''
743 huge=''
744 large=''
745 medium=''
746 models=''
747 small=''
748 split=''
749 modetype=''
750 multiarch=''
751 mydomain=''
752 myhostname=''
753 phostname=''
754 c=''
755 n=''
756 d_eofnblk=''
757 eagain=''
758 o_nonblock=''
759 rd_nodata=''
760 netdb_hlen_type=''
761 netdb_host_type=''
762 netdb_name_type=''
763 netdb_net_type=''
764 groupcat=''
765 hostcat=''
766 passcat=''
767 orderlib=''
768 ranlib=''
769 package=''
770 spackage=''
771 pager=''
772 api_revision=''
773 api_subversion=''
774 api_version=''
775 api_versionstring=''
776 patchlevel=''
777 subversion=''
778 version=''
779 perladmin=''
780 perlpath=''
781 d_nv_preserves_uv=''
782 i16size=''
783 i16type=''
784 i32size=''
785 i32type=''
786 i64size=''
787 i64type=''
788 i8size=''
789 i8type=''
790 ivsize=''
791 ivtype=''
792 nvsize=''
793 nvtype=''
794 u16size=''
795 u16type=''
796 u32size=''
797 u32type=''
798 u64size=''
799 u64type=''
800 u8size=''
801 u8type=''
802 uvsize=''
803 uvtype=''
804 ivdformat=''
805 uvoformat=''
806 uvuformat=''
807 uvxformat=''
808 pidtype=''
809 prefix=''
810 prefixexp=''
811 installprivlib=''
812 privlib=''
813 privlibexp=''
814 prototype=''
815 ptrsize=''
816 d_PRIX64=''
817 d_PRId64=''
818 d_PRIi64=''
819 d_PRIo64=''
820 d_PRIu64=''
821 d_PRIx64=''
822 sPRIX64=''
823 sPRId64=''
824 sPRIi64=''
825 sPRIo64=''
826 sPRIu64=''
827 sPRIx64=''
828 d_quad=''
829 quadkind=''
830 quadtype=''
831 uquadtype=''
832 drand01=''
833 randbits=''
834 randfunc=''
835 randseedtype=''
836 seedfunc=''
837 installscript=''
838 scriptdir=''
839 scriptdirexp=''
840 selectminbits=''
841 selecttype=''
842 sh=''
843 sig_count=''
844 sig_name=''
845 sig_name_init=''
846 sig_num=''
847 sig_num_init=''
848 installsitearch=''
849 sitearch=''
850 sitearchexp=''
851 installsitebin=''
852 sitebin=''
853 sitebinexp=''
854 installsitelib=''
855 sitelib=''
856 sitelibexp=''
857 siteprefix=''
858 siteprefixexp=''
859 sizetype=''
860 so=''
861 sharpbang=''
862 shsharp=''
863 spitshell=''
864 src=''
865 ssizetype=''
866 startperl=''
867 startsh=''
868 stdchar=''
869 d_stdio_stream_array=''
870 stdio_stream_array=''
871 sysman=''
872 trnl=''
873 uidformat=''
874 uidsign=''
875 uidsize=''
876 uidtype=''
877 archname64=''
878 use64bits=''
879 uselargefiles=''
880 uselongdouble=''
881 usemorebits=''
882 usemultiplicity=''
883 nm_opt=''
884 nm_so_opt=''
885 runnm=''
886 usenm=''
887 useperlio=''
888 usesocks=''
889 d_oldpthreads=''
890 use5005threads=''
891 useithreads=''
892 usethreads=''
893 incpath=''
894 mips_type=''
895 usrinc=''
896 d_vendorbin=''
897 installvendorbin=''
898 vendorbin=''
899 vendorbinexp=''
900 d_vendorlib=''
901 installvendorlib=''
902 vendorlib=''
903 vendorlibexp=''
904 usevendorprefix=''
905 vendorprefix=''
906 vendorprefixexp=''
907 defvoidused=''
908 voidflags=''
909 pm_apiversion=''
910 xs_apiversion=''
911 CONFIG=''
912
913 define='define'
914 undef='undef'
915 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
916 rmlist=''
917
918 : We must find out about Eunice early
919 eunicefix=':'
920 if test -f /etc/unixtovms; then
921         eunicefix=/etc/unixtovms
922 fi
923 if test -f /etc/unixtovms.exe; then
924         eunicefix=/etc/unixtovms.exe
925 fi
926
927 i_whoami=''
928 : set useposix=false in your hint file to disable the POSIX extension.
929 useposix=true
930 : set useopcode=false in your hint file to disable the Opcode extension.
931 useopcode=true
932 : Trailing extension.  Override this in a hint file, if needed.
933 _exe=''
934 : Extra object files, if any, needed on this platform.
935 archobjs=''
936 : Possible local include directories to search.
937 : Set locincpth to "" in a hint file to defeat local include searches.
938 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
939 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
940 :
941 : no include file wanted by default
942 inclwanted=''
943
944 groupstype=''
945 : change the next line if compiling for Xenix/286 on Xenix/386
946 xlibpth='/usr/lib/386 /lib/386'
947
948 : Possible local library directories to search.
949 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
950 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
951
952 : general looking path for locating libraries
953 glibpth="/usr/lib/large /lib/pa1.1 /lib /usr/lib $xlibpth"
954 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
955 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
956 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
957 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
958
959 : Private path used by Configure to find libraries.  Its value
960 : is prepended to libpth. This variable takes care of special
961 : machines, like the mips.  Usually, it should be empty.
962 plibpth=''
963
964 : default library list
965 libswanted=''
966 : some systems want to use only the non-versioned libso:s
967 ignore_versioned_solibs=''
968 : set usemultiplicity on the Configure command line to enable multiplicity.
969 : set usesocks on the Configure command line to enable socks.
970 : set usethreads on the Configure command line to enable threads.
971 : full support for void wanted by default
972 defvoidused=15
973
974 : List of libraries we want.
975 : If anyone needs -lnet, put it in a hint file.
976 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
977 libswanted="$libswanted dld ld sun m c cposix posix"
978 libswanted="$libswanted ndir dir crypt sec"
979 libswanted="$libswanted ucb bsd BSD PW x"
980 : We probably want to search /usr/shlib before most other libraries.
981 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
982 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
983 glibpth="/usr/shlib $glibpth"
984 : Do not use vfork unless overridden by a hint file.
985 usevfork=false
986
987 : Find the basic shell for Bourne shell scripts
988 case "$sh" in
989 '')
990         case "$SYSTYPE" in
991         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
992         *) xxx='/bin/sh';;
993         esac
994         if test -f "$xxx"; then
995                 sh="$xxx"
996         else
997                 : Build up a list and do a single loop so we can 'break' out.
998                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
999                 for xxx in sh bash ksh pdksh ash; do
1000                         for p in $pth; do
1001                                 try="$try ${p}/${xxx}"
1002                         done
1003                 done
1004                 for xxx in $try; do
1005                         if test -f "$xxx"; then
1006                                 sh="$xxx";
1007                                 break
1008                         elif test -f "$xxx.exe"; then
1009                                 sh="$xxx";
1010                                 break
1011                         fi
1012                 done
1013         fi
1014         ;;
1015 esac
1016
1017 case "$sh" in
1018 '')     cat <<EOM >&2
1019 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1020
1021 Usually it's in /bin/sh.  How did you even get this far?
1022 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1023 we'll try to straighten this all out.
1024 EOM
1025         exit 1
1026         ;;
1027 esac
1028
1029 : see if sh knows # comments
1030 if `$sh -c '#' >/dev/null 2>&1`; then
1031         shsharp=true
1032         spitshell=cat
1033         xcat=/bin/cat
1034         test -f $xcat || xcat=/usr/bin/cat
1035         echo "#!$xcat" >try
1036         $eunicefix try
1037         chmod +x try
1038         ./try > today
1039         if test -s today; then
1040                 sharpbang='#!'
1041         else
1042                 echo "#! $xcat" > try
1043                 $eunicefix try
1044                 chmod +x try
1045                 ./try > today
1046                 if test -s today; then
1047                         sharpbang='#! '
1048                 else
1049                         sharpbang=': use '
1050                 fi
1051         fi
1052 else
1053         echo " "
1054         echo "Your $sh doesn't grok # comments--I will strip them later on."
1055         shsharp=false
1056         cd ..
1057         echo "exec grep -v '^[  ]*#'" >spitshell
1058         chmod +x spitshell
1059         $eunicefix spitshell
1060         spitshell=`pwd`/spitshell
1061         cd UU
1062         echo "I presume that if # doesn't work, #! won't work either!"
1063         sharpbang=': use '
1064 fi
1065 rm -f try today
1066
1067 : figure out how to guarantee sh startup
1068 case "$startsh" in
1069 '') startsh=${sharpbang}${sh} ;;
1070 *)
1071 esac
1072 cat >try <<EOSS
1073 $startsh
1074 set abc
1075 test "$?abc" != 1
1076 EOSS
1077
1078 chmod +x try
1079 $eunicefix try
1080 if ./try; then
1081         : echo "Yup, it does."
1082 else
1083         echo "Hmm... '$startsh' does not guarantee sh startup..."
1084         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1085 fi
1086 rm -f try
1087
1088
1089 : Save command line options in file UU/cmdline.opt for later use in
1090 : generating config.sh.
1091 cat > cmdline.opt <<EOSH
1092 # Configure command line arguments.
1093 config_arg0='$0'
1094 config_args='$*'
1095 config_argc=$#
1096 EOSH
1097 argn=1
1098 for arg in "$@"; do
1099         cat >>cmdline.opt <<EOSH
1100 config_arg$argn='$arg'
1101 EOSH
1102         argn=`expr $argn + 1`
1103 done
1104
1105 : produce awk script to parse command line options
1106 cat >options.awk <<'EOF'
1107 BEGIN {
1108         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1109
1110         len = length(optstr);
1111         for (i = 1; i <= len; i++) {
1112                 c = substr(optstr, i, 1);
1113                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1114                 if (a == ":") {
1115                         arg[c] = 1;
1116                         i++;
1117                 }
1118                 opt[c] = 1;
1119         }
1120 }
1121 {
1122         expect = 0;
1123         str = $0;
1124         if (substr(str, 1, 1) != "-") {
1125                 printf("'%s'\n", str);
1126                 next;
1127         }
1128         len = length($0);
1129         for (i = 2; i <= len; i++) {
1130                 c = substr(str, i, 1);
1131                 if (!opt[c]) {
1132                         printf("-%s\n", substr(str, i));
1133                         next;
1134                 }
1135                 printf("-%s\n", c);
1136                 if (arg[c]) {
1137                         if (i < len)
1138                                 printf("'%s'\n", substr(str, i + 1));
1139                         else
1140                                 expect = 1;
1141                         next;
1142                 }
1143         }
1144 }
1145 END {
1146         if (expect)
1147                 print "?";
1148 }
1149 EOF
1150
1151 : process the command line options
1152 set X `for arg in "$@"; do echo "X$arg"; done |
1153         sed -e s/X// | awk -f options.awk`
1154 eval "set $*"
1155 shift
1156 rm -f options.awk
1157
1158 : set up default values
1159 fastread=''
1160 reuseval=false
1161 config_sh=''
1162 alldone=''
1163 error=''
1164 silent=''
1165 extractsh=''
1166 override=''
1167 knowitall=''
1168 rm -f optdef.sh posthint.sh
1169 cat >optdef.sh <<EOS
1170 $startsh
1171 EOS
1172
1173
1174 : option parsing
1175 while test $# -gt 0; do
1176         case "$1" in
1177         -d) shift; fastread=yes;;
1178         -e) shift; alldone=cont;;
1179         -f)
1180                 shift
1181                 cd ..
1182                 if test -r "$1"; then
1183                         config_sh="$1"
1184                 else
1185                         echo "$me: cannot read config file $1." >&2
1186                         error=true
1187                 fi
1188                 cd UU
1189                 shift;;
1190         -h) shift; error=true;;
1191         -r) shift; reuseval=true;;
1192         -s) shift; silent=true; realsilent=true;;
1193         -E) shift; alldone=exit;;
1194         -K) shift; knowitall=true;;
1195         -O) shift; override=true;;
1196         -S) shift; silent=true; extractsh=true;;
1197         -D)
1198                 shift
1199                 case "$1" in
1200                 *=)
1201                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1202                         echo "$me: ignoring -D $1" >&2
1203                         ;;
1204                 *=*) echo "$1" | \
1205                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1206                 *) echo "$1='define'" >> optdef.sh;;
1207                 esac
1208                 shift
1209                 ;;
1210         -U)
1211                 shift
1212                 case "$1" in
1213                 *=) echo "$1" >> optdef.sh;;
1214                 *=*)
1215                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1216                         echo "$me: ignoring -U $1" >&2
1217                         ;;
1218                 *) echo "$1='undef'" >> optdef.sh;;
1219                 esac
1220                 shift
1221                 ;;
1222         -A)
1223             shift
1224             xxx=''
1225             yyy="$1"
1226             zzz=''
1227             uuu=undef
1228             case "$yyy" in
1229             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1230                  case "$zzz" in
1231                  *:*) zzz='' ;;
1232                  *)   xxx=append
1233                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1234                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1235                  esac
1236                  ;;
1237             esac
1238             case "$xxx" in
1239             '')  case "$yyy" in
1240                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1241                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1242                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1243                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1244                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1245                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1246                  esac
1247                  ;;       
1248             esac
1249             case "$xxx" in
1250             append)
1251                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1252             clear)
1253                 echo "$yyy=''"                  >> posthint.sh ;;
1254             define)
1255                 case "$zzz" in
1256                 '') zzz=define ;;
1257                 esac
1258                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1259             eval)
1260                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1261             prepend)
1262                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1263             undef)
1264                 case "$zzz" in
1265                 '') zzz="$uuu" ;;
1266                 esac
1267                 echo "$yyy=$zzz"                >> posthint.sh ;;
1268             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1269             esac
1270             shift
1271             ;;
1272         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1273             exit 0;;
1274         --) break;;
1275         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1276         *) break;;
1277         esac
1278 done
1279
1280 case "$error" in
1281 true)
1282         cat >&2 <<EOM
1283 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1284                  [-U symbol] [-U symbol=] [-A command:symbol...]
1285   -d : use defaults for all answers.
1286   -e : go on without questioning past the production of config.sh.
1287   -f : specify an alternate default configuration file.
1288   -h : print this help message and exit (with an error status).
1289   -r : reuse C symbols value if possible (skips costly nm extraction).
1290   -s : silent mode, only echoes questions and essential information.
1291   -D : define symbol to have some value:
1292          -D symbol         symbol gets the value 'define'
1293          -D symbol=value   symbol gets the value 'value'
1294   -E : stop at the end of questions, after having produced config.sh.
1295   -K : do not use unless you know what you are doing.
1296   -O : let -D and -U override definitions from loaded configuration file.
1297   -S : perform variable substitutions on all .SH files (can mix with -f)
1298   -U : undefine symbol:
1299          -U symbol    symbol gets the value 'undef'
1300          -U symbol=   symbol gets completely empty
1301   -A : manipulate symbol after the platform specific hints have been applied:
1302          -A symbol=value                append " "value to symbol
1303          -A append:symbol=value         append value to symbol
1304          -A define:symbol=value         define symbol to have value
1305          -A clear:symbol                define symbol to be ''
1306          -A define:symbol               define symbol to be 'define'
1307          -A eval:symbol=value           define symbol to be eval of value
1308          -A prepend:symbol=value        prepend value to symbol
1309          -A undef:symbol                define symbol to be 'undef'
1310          -A undef:symbol=               define symbol to be ''
1311   -V : print version number and exit (with a zero status).
1312 EOM
1313         exit 1
1314         ;;
1315 esac
1316
1317 : Sanity checks
1318 case "$fastread$alldone" in
1319 yescont|yesexit) ;;
1320 *)
1321         if test ! -t 0; then
1322                 echo "Say 'sh Configure', not 'sh <Configure'"
1323                 exit 1
1324         fi
1325         ;;
1326 esac
1327
1328 exec 4>&1
1329 case "$silent" in
1330 true) exec 1>/dev/null;;
1331 esac
1332
1333 : run the defines and the undefines, if any, but leave the file out there...
1334 touch optdef.sh
1335 . ./optdef.sh
1336 : create the posthint manipulation script and leave the file out there...
1337 touch posthint.sh
1338
1339 : set package name
1340 package=perl5
1341 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1342 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1343 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1344 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1345 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1346 esac
1347
1348 : Some greps do not return status, grrr.
1349 echo "grimblepritz" >grimble
1350 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1351         contains=contains
1352 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1353         contains=grep
1354 else
1355         contains=contains
1356 fi
1357 rm -f grimble
1358 : the following should work in any shell
1359 case "$contains" in
1360 contains*)
1361         echo " "
1362         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1363         cat >contains <<'EOSS'
1364 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1365 EOSS
1366 chmod +x contains
1367 esac
1368
1369 : Find the path to the source tree
1370 case "$src" in
1371 '') case "$0" in
1372     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1373          case "$src" in
1374          /*)    ;;
1375          *)     src=`cd ../$src && pwd` ;;
1376          esac
1377          ;;
1378     *)   src='.';;
1379     esac;;
1380 esac
1381 case "$src" in
1382 '')     src=/
1383         rsrc=/
1384         ;;
1385 /*) rsrc="$src";;
1386 *) rsrc="../$src";;
1387 esac
1388 if test -f $rsrc/Configure && \
1389         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1390 then
1391    : found it, so we are ok.
1392 else
1393         rsrc=''
1394         for src in . .. ../.. ../../.. ../../../..; do
1395                 if test -f ../$src/Configure && \
1396                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1397                 then
1398                         rsrc=../$src
1399                         break
1400                 fi
1401         done
1402 fi
1403 case "$rsrc" in
1404 '')
1405         cat <<EOM >&4
1406
1407 Sorry, I can't seem to locate the source dir for $package.  Please start
1408 Configure with an explicit path -- i.e. /some/path/Configure.
1409
1410 EOM
1411         exit 1
1412         ;;
1413 ../.)   rsrc='..';;
1414 *)
1415         echo " "
1416         echo "Sources for $package found in \"$src\"." >&4
1417         ;;
1418 esac
1419
1420 : script used to extract .SH files with variable substitutions
1421 cat >extract <<'EOS'
1422 CONFIGDOTSH=true
1423 echo "Doing variable substitutions on .SH files..."
1424 if test -f $src/MANIFEST; then
1425         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1426 else
1427         echo "(Looking for .SH files under the source directory.)"
1428         set x `(cd $src; find . -name "*.SH" -print)`
1429 fi
1430 shift
1431 case $# in
1432 0) set x `(cd $src; echo *.SH)`; shift;;
1433 esac
1434 if test ! -f $src/$1; then
1435         shift
1436 fi
1437 mkdir_p='
1438 name=$1;
1439 create="";
1440 while test $name; do
1441         if test ! -d "$name"; then
1442                 create="$name $create";
1443                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1444                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1445         else
1446                 name="";
1447         fi;
1448 done;
1449 for file in $create; do
1450         mkdir $file;
1451 done
1452 '
1453 for file in $*; do
1454         case "$src" in
1455         ".")
1456                 case "$file" in
1457                 */*)
1458                         dir=`expr X$file : 'X\(.*\)/'`
1459                         file=`expr X$file : 'X.*/\(.*\)'`
1460                         (cd $dir && . ./$file)
1461                         ;;
1462                 *)
1463                         . ./$file
1464                         ;;
1465                 esac
1466                 ;;
1467         *)
1468                 case "$file" in
1469                 */*)
1470                         dir=`expr X$file : 'X\(.*\)/'`
1471                         file=`expr X$file : 'X.*/\(.*\)'`
1472                         (set x $dir; shift; eval $mkdir_p)
1473                         sh <$src/$dir/$file
1474                         ;;
1475                 *)
1476                         sh <$src/$file
1477                         ;;
1478                 esac
1479                 ;;
1480         esac
1481 done
1482 if test -f $src/config_h.SH; then
1483         if test ! -f config.h; then
1484         : oops, they left it out of MANIFEST, probably, so do it anyway.
1485         . $src/config_h.SH
1486         fi
1487 fi
1488 EOS
1489
1490 : extract files and exit if asked to do so
1491 case "$extractsh" in
1492 true)
1493         case "$realsilent" in
1494         true) ;;
1495         *) exec 1>&4;;
1496         esac
1497         case "$config_sh" in
1498         '') config_sh='config.sh';;
1499         esac
1500         echo " "
1501         echo "Fetching answers from $config_sh..."
1502         cd ..
1503         . $config_sh
1504         test "$override" && . ./optdef.sh
1505         echo " "
1506         . UU/extract
1507         rm -rf UU
1508         echo "Done."
1509         exit 0
1510         ;;
1511 esac
1512
1513 : Eunice requires " " instead of "", can you believe it
1514 echo " "
1515 : Here we go...
1516 echo "Beginning of configuration questions for $package."
1517
1518 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1519
1520 : first determine how to suppress newline on echo command
1521 echo " "
1522 echo "Checking echo to see how to suppress newlines..."
1523 (echo "hi there\c" ; echo " ") >.echotmp
1524 if $contains c .echotmp >/dev/null 2>&1 ; then
1525         echo "...using -n."
1526         n='-n'
1527         c=''
1528 else
1529         cat <<'EOM'
1530 ...using \c
1531 EOM
1532         n=''
1533         c='\c'
1534 fi
1535 echo $n "The star should be here-->$c"
1536 echo '*'
1537 rm -f .echotmp
1538
1539 : Now test for existence of everything in MANIFEST
1540 echo " "
1541 if test -f $rsrc/MANIFEST; then
1542         echo "First let's make sure your kit is complete.  Checking..." >&4
1543         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1544         rm -f missing
1545         tmppwd=`pwd`
1546         for filelist in x??; do
1547                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1548         done
1549         if test -s missing; then
1550                 cat missing >&4
1551                 cat >&4 <<'EOM'
1552
1553 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1554
1555 You have the option of continuing the configuration process, despite the
1556 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1557 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1558 and contact the author (perlbug@perl.com).
1559
1560 EOM
1561                 echo $n "Continue? [n] $c" >&4
1562                 read ans
1563                 case "$ans" in
1564                 y*)
1565                         echo "Continuing..." >&4
1566                         rm -f missing
1567                         ;;
1568                 *)
1569                         echo "ABORTING..." >&4
1570                         kill $$
1571                         ;;
1572                 esac
1573         else
1574                 echo "Looks good..."
1575         fi
1576 else
1577         echo "There is no MANIFEST file.  I hope your kit is complete !"
1578 fi
1579 rm -f missing x??
1580
1581 echo " "
1582 : Find the appropriate value for a newline for tr
1583 if test -n "$DJGPP"; then
1584        trnl='\012'
1585 fi
1586 if test X"$trnl" = X; then
1587         case "`echo foo|tr '\n' x 2>/dev/null`" in
1588         foox) trnl='\n' ;;
1589         esac
1590 fi
1591 if test X"$trnl" = X; then
1592         case "`echo foo|tr '\012' x 2>/dev/null`" in
1593         foox) trnl='\012' ;;
1594         esac
1595 fi
1596 if test X"$trnl" = X; then
1597         cat <<EOM >&2
1598
1599 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1600
1601 EOM
1602         exit 1
1603 fi
1604
1605 : compute the number of columns on the terminal for proper question formatting
1606 case "$COLUMNS" in
1607 '') COLUMNS='80';;
1608 esac
1609
1610 : set up the echo used in my read
1611 myecho="case \"\$xxxm\" in
1612 '') echo $n \"\$rp $c\" >&4;;
1613 *) case \"\$rp\" in
1614         '') echo $n \"[\$xxxm] $c\";;
1615         *)
1616                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1617                         echo \"\$rp\" >&4
1618                         echo $n \"[\$xxxm] $c\" >&4
1619                 else
1620                         echo $n \"\$rp [\$xxxm] $c\" >&4
1621                 fi
1622                 ;;
1623         esac;;
1624 esac"
1625
1626 : now set up to do reads with possible shell escape and default assignment
1627 cat <<EOSC >myread
1628 $startsh
1629 xxxm=\$dflt
1630 $myecho
1631 ans='!'
1632 case "\$fastread" in
1633 yes) case "\$dflt" in
1634         '') ;;
1635         *) ans='';
1636                 case "\$silent-\$rp" in
1637                 true-) ;;
1638                 *) echo " " >&4;;
1639                 esac;;
1640         esac;;
1641 *) case "\$silent" in
1642         true) case "\$rp" in
1643                 '') ans='';;
1644                 esac;;
1645         esac;;
1646 esac
1647 while expr "X\$ans" : "X!" >/dev/null; do
1648         read answ
1649         set x \$xxxm
1650         shift
1651         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1652         case  "\$answ" in
1653         "!")
1654                 sh 1>&4
1655                 echo " "
1656                 $myecho
1657                 ;;
1658         !*)
1659                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1660                 shift
1661                 sh 1>&4 -c "\$*"
1662                 echo " "
1663                 $myecho
1664                 ;;
1665         "\$ans")
1666                 case "\$ans" in
1667                 \\&*)
1668                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1669                         shift
1670                         case "\$1" in
1671                         -d)
1672                                 fastread=yes
1673                                 echo "(OK, I'll run with -d after this question.)" >&4
1674                                 ;;
1675                         -*)
1676                                 echo "*** Sorry, \$1 not supported yet." >&4
1677                                 ;;
1678                         esac
1679                         $myecho
1680                         ans=!
1681                         ;;
1682                 esac;;
1683         *)
1684                 case "\$aok" in
1685                 y)
1686                         echo "*** Substitution done -- please confirm."
1687                         xxxm="\$ans"
1688                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1689                         xxxm="\$ans"
1690                         ans=!
1691                         ;;
1692                 *)
1693                         echo "*** Error -- try again."
1694                         ans=!
1695                         ;;
1696                 esac
1697                 $myecho
1698                 ;;
1699         esac
1700         case "\$ans\$xxxm\$nostick" in
1701         '')
1702                 ans=!
1703                 $myecho
1704                 ;;
1705         esac
1706 done
1707 case "\$ans" in
1708 '') ans="\$xxxm";;
1709 esac
1710 EOSC
1711
1712 : create .config dir to save info across Configure sessions
1713 test -d ../.config || mkdir ../.config
1714 cat >../.config/README <<EOF
1715 This directory created by Configure to save information that should
1716 persist across sessions for $package.
1717
1718 You may safely delete it if you wish.
1719 EOF
1720
1721 : general instructions
1722 needman=true
1723 firsttime=true
1724 user=`(logname) 2>/dev/null`
1725 case "$user" in
1726 '') user=`whoami 2>&1`;;
1727 esac
1728 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1729         firsttime=false
1730         echo " "
1731         rp='Would you like to see the instructions?'
1732         dflt=n
1733         . ./myread
1734         case "$ans" in
1735         [yY]*) ;;
1736         *) needman=false;;
1737         esac
1738 fi
1739 if $needman; then
1740         cat <<EOH
1741
1742 This installation shell script will examine your system and ask you questions
1743 to determine how the perl5 package should be installed. If you get
1744 stuck on a question, you may use a ! shell escape to start a subshell or
1745 execute a command.  Many of the questions will have default answers in square
1746 brackets; typing carriage return will give you the default.
1747
1748 On some of the questions which ask for file or directory names you are allowed
1749 to use the ~name construct to specify the login directory belonging to "name",
1750 even if you don't have a shell which knows about that.  Questions where this is
1751 allowed will be marked "(~name ok)".
1752
1753 EOH
1754         rp=''
1755         dflt='Type carriage return to continue'
1756         . ./myread
1757         cat <<'EOH'
1758
1759 The prompter used in this script allows you to use shell variables and
1760 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1761 in the default answer, as if the default line was a set of arguments given to a
1762 script shell.  This means you may also use $* to repeat the whole default line,
1763 so you do not have to re-type everything to add something to the default.
1764
1765 Everytime there is a substitution, you will have to confirm.  If there is an
1766 error (e.g. an unmatched backtick), the default answer will remain unchanged
1767 and you will be prompted again.
1768
1769 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1770 the questions and use the computed defaults (or the previous answers if there
1771 was already a config.sh file). Type 'Configure -h' for a list of options.
1772 You may also start interactively and then answer '& -d' at any prompt to turn
1773 on the non-interactive behaviour for the remainder of the execution.
1774
1775 EOH
1776         . ./myread
1777         cat <<EOH
1778
1779 Much effort has been expended to ensure that this shell script will run on any
1780 Unix system.  If despite that it blows up on yours, your best bet is to edit
1781 Configure and run it again.  If you can't run Configure for some reason,
1782 you'll have to generate a config.sh file by hand.  Whatever problems you
1783 have, let me (perlbug@perl.com) know how I blew it.
1784
1785 This installation script affects things in two ways:
1786
1787 1) it may do direct variable substitutions on some of the files included
1788    in this kit.
1789 2) it builds a config.h file for inclusion in C programs.  You may edit
1790    any of these files as the need arises after running this script.
1791
1792 If you make a mistake on a question, there is no easy way to back up to it
1793 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1794 files.  Configure will offer to let you do this before it runs the SH files.
1795
1796 EOH
1797         dflt='Type carriage return to continue'
1798         . ./myread
1799         case "$firsttime" in
1800         true) echo $user >>../.config/instruct;;
1801         esac
1802 fi
1803
1804 : find out where common programs are
1805 echo " "
1806 echo "Locating common programs..." >&4
1807 cat <<EOSC >loc
1808 $startsh
1809 case \$# in
1810 0) exit 1;;
1811 esac
1812 thing=\$1
1813 shift
1814 dflt=\$1
1815 shift
1816 for dir in \$*; do
1817         case "\$thing" in
1818         .)
1819         if test -d \$dir/\$thing; then
1820                 echo \$dir
1821                 exit 0
1822         fi
1823         ;;
1824         *)
1825         for thisthing in \$dir/\$thing; do
1826                 : just loop through to pick last item
1827         done
1828         if test -f \$thisthing; then
1829                 echo \$thisthing
1830                 exit 0
1831         elif test -f \$dir/\$thing.exe; then
1832                 if test -n "$DJGPP"; then
1833                         echo \$dir/\$thing.exe
1834                 else
1835                         : on Eunice apparently
1836                         echo \$dir/\$thing
1837                 fi
1838                 exit 0
1839         fi
1840         ;;
1841         esac
1842 done
1843 echo \$dflt
1844 exit 1
1845 EOSC
1846 chmod +x loc
1847 $eunicefix loc
1848 loclist="
1849 awk
1850 cat
1851 comm
1852 cp
1853 echo
1854 expr
1855 grep
1856 ls
1857 make
1858 mkdir
1859 rm
1860 sed
1861 sort
1862 touch
1863 tr
1864 uniq
1865 "
1866 trylist="
1867 Mcc
1868 ar
1869 byacc
1870 cpp
1871 csh
1872 date
1873 egrep
1874 gzip
1875 less
1876 ln
1877 more
1878 nm
1879 nroff
1880 perl
1881 pg
1882 test
1883 uname
1884 zip
1885 "
1886 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1887 pth="$pth /lib /usr/lib"
1888 for file in $loclist; do
1889         eval xxx=\$$file
1890         case "$xxx" in
1891         /*|?:[\\/]*)
1892                 if test -f "$xxx"; then
1893                         : ok
1894                 else
1895                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1896                         xxx=`./loc $file $file $pth`
1897                 fi
1898                 ;;
1899         '') xxx=`./loc $file $file $pth`;;
1900         *) xxx=`./loc $xxx $xxx $pth`;;
1901         esac
1902         eval $file=$xxx
1903         eval _$file=$xxx
1904         case "$xxx" in
1905         /*)
1906                 echo $file is in $xxx.
1907                 ;;
1908         ?:[\\/]*)
1909                 echo $file is in $xxx.
1910                 ;;
1911         *)
1912                 echo "I don't know where '$file' is, and my life depends on it." >&4
1913                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1914                 exit 1
1915                 ;;
1916         esac
1917 done
1918 echo " "
1919 echo "Don't worry if any of the following aren't found..."
1920 say=offhand
1921 for file in $trylist; do
1922         eval xxx=\$$file
1923         case "$xxx" in
1924         /*|?:[\\/]*)
1925                 if test -f "$xxx"; then
1926                         : ok
1927                 else
1928                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1929                         xxx=`./loc $file $file $pth`
1930                 fi
1931                 ;;
1932         '') xxx=`./loc $file $file $pth`;;
1933         *) xxx=`./loc $xxx $xxx $pth`;;
1934         esac
1935         eval $file=$xxx
1936         eval _$file=$xxx
1937         case "$xxx" in
1938         /*)
1939                 echo $file is in $xxx.
1940                 ;;
1941         ?:[\\/]*)
1942                 echo $file is in $xxx.
1943                 ;;
1944         *)
1945                 echo "I don't see $file out there, $say."
1946                 say=either
1947                 ;;
1948         esac
1949 done
1950 case "$egrep" in
1951 egrep)
1952         echo "Substituting grep for egrep."
1953         egrep=$grep
1954         ;;
1955 esac
1956 case "$ln" in
1957 ln)
1958         echo "Substituting cp for ln."
1959         ln=$cp
1960         ;;
1961 esac
1962 case "$test" in
1963 test)
1964         echo "Hopefully test is built into your sh."
1965         ;;
1966 *)
1967         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1968                 echo "Using the test built into your sh."
1969                 test=test
1970                 _test=test
1971         fi
1972         ;;
1973 esac
1974 case "$echo" in
1975 echo)
1976         echo "Hopefully echo is built into your sh."
1977         ;;
1978 '') ;;
1979 *)
1980         echo " "
1981 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1982         $echo $n "hi there$c" >foo1
1983         echo $n "hi there$c" >foo2
1984         if cmp foo1 foo2 >/dev/null 2>&1; then
1985                 echo "They are compatible.  In fact, they may be identical."
1986         else
1987                 case "$n" in
1988                 '-n') n='' c='\c';;
1989                 *) n='-n' c='';;
1990                 esac
1991                 cat <<FOO
1992 They are not compatible!  You are probably running ksh on a non-USG system.
1993 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1994 have echo built in and we may have to run some Bourne shell scripts.  That
1995 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1996
1997 FOO
1998                 $echo $n "The star should be here-->$c"
1999                 $echo "*"
2000         fi
2001         $rm -f foo1 foo2
2002         ;;
2003 esac
2004
2005 : determine whether symbolic links are supported
2006 echo " "
2007 $touch blurfl
2008 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2009         echo "Symbolic links are supported." >&4
2010         lns="$ln -s"
2011 else
2012         echo "Symbolic links are NOT supported." >&4
2013         lns="$ln"
2014 fi
2015 $rm -f blurfl sym
2016
2017 : see whether [:lower:] and [:upper:] are supported character classes
2018 echo " "
2019 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2020 ABYZ)
2021         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2022         up='[:upper:]'
2023         low='[:lower:]'
2024         ;;
2025 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2026         # (0xc9 and 0xd1), therefore that is a nice testing point.
2027         if test "X$up" = X -o "X$low" = X; then
2028             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2029             ij) up='[A-Z]'
2030                 low='[a-z]'
2031                 ;;
2032             esac
2033         fi
2034         if test "X$up" = X -o "X$low" = X; then
2035             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2036             ij) up='A-Z'
2037                 low='a-z'
2038                 ;;
2039             esac
2040         fi
2041         if test "X$up" = X -o "X$low" = X; then
2042             case "`echo IJ | od -x 2>/dev/null`" in
2043             *C9D1*|*c9d1*)
2044                 echo "Hey, this might be EBCDIC." >&4
2045                 if test "X$up" = X -o "X$low" = X; then
2046                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2047                     ij) up='[A-IJ-RS-Z]'
2048                         low='[a-ij-rs-z]'
2049                         ;;
2050                     esac
2051                 fi
2052                 if test "X$up" = X -o "X$low" = X; then
2053                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2054                     ij) up='A-IJ-RS-Z'
2055                         low='a-ij-rs-z'
2056                         ;;
2057                     esac
2058                 fi
2059                 ;;
2060             esac
2061         fi
2062 esac
2063 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2064 ij)
2065     echo "Using $up and $low to convert case." >&4
2066     ;;
2067 *)
2068     echo "I don't know how to translate letters from upper to lower case." >&4
2069     echo "Your tr is not acting any way I know of." >&4
2070     exit 1
2071     ;;
2072 esac
2073 : set up the translation script tr, must be called with ./tr of course
2074 cat >tr <<EOSC
2075 $startsh
2076 case "\$1\$2" in
2077 '[A-Z][a-z]') exec $tr '$up' '$low';;
2078 '[a-z][A-Z]') exec $tr '$low' '$up';;
2079 esac
2080 exec $tr "\$@"
2081 EOSC
2082 chmod +x tr
2083 $eunicefix tr
2084
2085 : Try to determine whether config.sh was made on this system
2086 case "$config_sh" in
2087 '')
2088 myuname=`$uname -a 2>/dev/null`
2089 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2090 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2091 # because the A-Z/a-z are not consecutive.
2092 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2093         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2094 newmyuname="$myuname"
2095 dflt=n
2096 case "$knowitall" in
2097 '')
2098         if test -f ../config.sh; then
2099                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2100                         eval "`grep myuname= ../config.sh`"
2101                 fi
2102                 if test "X$myuname" = "X$newmyuname"; then
2103                         dflt=y
2104                 fi
2105         fi
2106         ;;
2107 *) dflt=y;;
2108 esac
2109
2110 : Get old answers from old config file if Configure was run on the
2111 : same system, otherwise use the hints.
2112 hint=default
2113 cd ..
2114 if test -f config.sh; then
2115         echo " "
2116         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2117         . UU/myread
2118         case "$ans" in
2119         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2120         *)  echo "Fetching default answers from your old config.sh file..." >&4
2121                 tmp_n="$n"
2122                 tmp_c="$c"
2123                 tmp_sh="$sh"
2124                 . ./config.sh
2125                 cp config.sh UU
2126                 n="$tmp_n"
2127                 c="$tmp_c"
2128                 : Older versions did not always set $sh.  Catch re-use of such
2129                 : an old config.sh.
2130                 case "$sh" in
2131                 '') sh="$tmp_sh" ;;
2132                 esac
2133                 hint=previous
2134                 ;;
2135         esac
2136 fi
2137 if test ! -f config.sh; then
2138         $cat <<EOM
2139
2140 First time through, eh?  I have some defaults handy for some systems
2141 that need some extra help getting the Configure answers right:
2142
2143 EOM
2144         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2145         dflt=''
2146         : Half the following guesses are probably wrong... If you have better
2147         : tests or hints, please send them to perlbug@perl.com
2148         : The metaconfig authors would also appreciate a copy...
2149         $test -f /irix && osname=irix
2150         $test -f /xenix && osname=sco_xenix
2151         $test -f /dynix && osname=dynix
2152         $test -f /dnix && osname=dnix
2153         $test -f /lynx.os && osname=lynxos
2154         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2155         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2156         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2157         $test -f /bin/mips && /bin/mips && osname=mips
2158         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2159                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2160         $test -d /usr/apollo/bin && osname=apollo
2161         $test -f /etc/saf/_sactab && osname=svr4
2162         $test -d /usr/include/minix && osname=minix
2163         if $test -d /MachTen -o -d /MachTen_Folder; then
2164                 osname=machten
2165                 if $test -x /sbin/version; then
2166                         osvers=`/sbin/version | $awk '{print $2}' |
2167                         $sed -e 's/[A-Za-z]$//'`
2168                 elif $test -x /usr/etc/version; then
2169                         osvers=`/usr/etc/version | $awk '{print $2}' |
2170                         $sed -e 's/[A-Za-z]$//'`
2171                 else
2172                         osvers="$2.$3"
2173                 fi
2174         fi
2175
2176         $test -f /sys/posix.dll &&
2177                 $test -f /usr/bin/what &&
2178                 set X `/usr/bin/what /sys/posix.dll` &&
2179                 $test "$3" = UWIN &&
2180                 osname=uwin &&
2181                 osvers="$5"
2182
2183         if $test -f $uname; then
2184                 set X $myuname
2185                 shift
2186
2187                 case "$5" in
2188                 fps*) osname=fps ;;
2189                 mips*)
2190                         case "$4" in
2191                         umips) osname=umips ;;
2192                         *) osname=mips ;;
2193                         esac;;
2194                 [23]100) osname=mips ;;
2195                 next*) osname=next ;;
2196                 i386*)
2197                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2198                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2199                                 osname='sco'
2200                                 osvers=$tmp
2201                         elif $test -f /etc/kconfig; then
2202                                 osname=isc
2203                                 if test "$lns" = "$ln -s"; then
2204                                         osvers=4
2205                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2206                                         osvers=3
2207                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2208                                         osvers=2
2209                                 fi
2210                         fi
2211                         tmp=''
2212                         ;;
2213                 pc*)
2214                         if test -n "$DJGPP"; then
2215                                 osname=dos
2216                                 osvers=djgpp
2217                         fi
2218                         ;;
2219                 esac
2220
2221                 case "$1" in
2222                 aix) osname=aix
2223                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2224                         case "$tmp" in
2225                         'not found') osvers="$4"."$3" ;;
2226                         '<3240'|'<>3240') osvers=3.2.0 ;;
2227                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2228                         '=3250'|'>3250') osvers=3.2.5 ;;
2229                         *) osvers=$tmp;;
2230                         esac
2231                         ;;
2232                 bsd386) osname=bsd386
2233                         osvers=`$uname -r`
2234                         ;;
2235                 cygwin*) osname=cygwin
2236                         osvers="$3"
2237                         ;;
2238                 *dc.osx) osname=dcosx
2239                         osvers="$3"
2240                         ;;
2241                 dnix) osname=dnix
2242                         osvers="$3"
2243                         ;;
2244                 domainos) osname=apollo
2245                         osvers="$3"
2246                         ;;
2247                 dgux) osname=dgux 
2248                         osvers="$3"
2249                         ;;
2250                 dynixptx*) osname=dynixptx
2251                         osvers=`echo "$4"|sed 's/^v//'`
2252                         ;;
2253                 freebsd) osname=freebsd 
2254                         osvers="$3" ;;
2255                 genix) osname=genix ;;
2256                 hp*) osname=hpux 
2257                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2258                         ;;
2259                 irix*) osname=irix
2260                         case "$3" in
2261                         4*) osvers=4 ;;
2262                         5*) osvers=5 ;;
2263                         *)      osvers="$3" ;;
2264                         esac
2265                         ;;
2266                 linux) osname=linux
2267                         case "$3" in
2268                         *)      osvers="$3" ;;
2269                         esac
2270                         ;;
2271                 MiNT) osname=mint
2272                         ;;
2273                 netbsd*) osname=netbsd
2274                         osvers="$3"
2275                         ;;
2276                 news-os) osvers="$3"
2277                         case "$3" in
2278                         4*) osname=newsos4 ;;
2279                         *) osname=newsos ;;
2280                         esac
2281                         ;;
2282                 next*) osname=next ;;
2283                 POSIX-BC | posix-bc ) osname=posix-bc
2284                         osvers="$3"
2285                         ;;
2286                 powerux | power_ux | powermax_os | powermaxos | \
2287                 powerunix | power_unix) osname=powerux
2288                         osvers="$3"
2289                         ;;
2290                 qnx) osname=qnx
2291                         osvers="$4"
2292                         ;;
2293                 solaris) osname=solaris
2294                         case "$3" in
2295                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2296                         *)      osvers="$3" ;;
2297                         esac
2298                         ;;
2299                 sunos) osname=sunos
2300                         case "$3" in
2301                         5*) osname=solaris
2302                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2303                         *)      osvers="$3" ;;
2304                         esac
2305                         ;;
2306                 titanos) osname=titanos
2307                         case "$3" in
2308                         1*) osvers=1 ;;
2309                         2*) osvers=2 ;;
2310                         3*) osvers=3 ;;
2311                         4*) osvers=4 ;;
2312                         *)      osvers="$3" ;;
2313                         esac
2314                         ;;
2315                 ultrix) osname=ultrix
2316                         osvers="$3"
2317                         ;;
2318                 osf1|mls+)      case "$5" in
2319                                 alpha)
2320                                         osname=dec_osf
2321                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2322                                         ;;
2323                         hp*)    osname=hp_osf1  ;;
2324                         mips)   osname=mips_osf1 ;;
2325                         esac
2326                         ;;
2327                 unixware) osname=svr5
2328                         osvers="$4"
2329                         ;;
2330                 uts) osname=uts
2331                         osvers="$3"
2332                         ;;
2333                 $2) case "$osname" in
2334                         *isc*) ;;
2335                         *freebsd*) ;;
2336                         svr*)
2337                                 : svr4.x or possibly later
2338                                 case "svr$3" in 
2339                                 ${osname}*)
2340                                         osname=svr$3
2341                                         osvers=$4
2342                                         ;;
2343                                 esac
2344                                 case "$osname" in
2345                                 svr4.0)
2346                                         : Check for ESIX
2347                                         if test -f /stand/boot ; then
2348                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2349                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2350                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2351                                                         if test -n "$isesix"; then
2352                                                                 osname=esix4
2353                                                         fi
2354                                                 fi
2355                                         fi
2356                                         ;;
2357                                 esac
2358                                 ;;
2359                         *)      if test -f /etc/systemid; then
2360                                         osname=sco
2361                                         set `echo $3 | $sed 's/\./ /g'` $4
2362                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2363                                                 osvers=$1.$2.$3
2364                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2365                                                 osvers=$1.$2
2366                                         elif $test -f $src/hints/sco_$1.sh; then
2367                                                 osvers=$1
2368                                         fi
2369                                 else
2370                                         case "$osname" in
2371                                         '') : Still unknown.  Probably a generic Sys V.
2372                                                 osname="sysv"
2373                                                 osvers="$3"
2374                                                 ;;
2375                                         esac
2376                                 fi
2377                                 ;;
2378                         esac
2379                         ;;
2380                 *)      case "$osname" in
2381                         '') : Still unknown.  Probably a generic BSD.
2382                                 osname="$1"
2383                                 osvers="$3"
2384                                 ;;
2385                         esac
2386                         ;;
2387                 esac
2388         else
2389                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2390                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2391                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2392                                 osname=news_os
2393                         fi
2394                         $rm -f UU/kernel.what
2395                 elif test -d c:/.; then
2396                         set X $myuname
2397                         osname=os2
2398                         osvers="$5"
2399                 fi
2400         fi
2401         
2402         : Now look for a hint file osname_osvers, unless one has been
2403         : specified already.
2404         case "$hintfile" in
2405         ''|' ')
2406                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2407                 : Also try without trailing minor version numbers.
2408                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2409                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2410                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2411                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2412                 case "$file" in
2413                 '') dflt=none ;;
2414                 *)  case "$osvers" in
2415                         '') dflt=$file
2416                                 ;;
2417                         *)  if $test -f $src/hints/$file.sh ; then
2418                                         dflt=$file
2419                                 elif $test -f $src/hints/$xfile.sh ; then
2420                                         dflt=$xfile
2421                                 elif $test -f $src/hints/$xxfile.sh ; then
2422                                         dflt=$xxfile
2423                                 elif $test -f $src/hints/$xxxfile.sh ; then
2424                                         dflt=$xxxfile
2425                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2426                                         dflt=$xxxxfile
2427                                 elif $test -f "$src/hints/${osname}.sh" ; then
2428                                         dflt="${osname}"
2429                                 else
2430                                         dflt=none
2431                                 fi
2432                                 ;;
2433                         esac
2434                         ;;
2435                 esac
2436                 if $test -f Policy.sh ; then
2437                         case "$dflt" in
2438                         *Policy*) ;;
2439                         none) dflt="Policy" ;;
2440                         *) dflt="Policy $dflt" ;;
2441                         esac
2442                 fi
2443                 ;;
2444         *)
2445                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2446                 ;;
2447         esac
2448
2449         if $test -f Policy.sh ; then
2450                 $cat <<EOM
2451
2452 There's also a Policy hint file available, which should make the
2453 site-specific (policy) questions easier to answer.
2454 EOM
2455
2456         fi
2457
2458         $cat <<EOM
2459
2460 You may give one or more space-separated answers, or "none" if appropriate.
2461 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2462 is a good thing.  DO NOT give a wrong version or a wrong OS.
2463
2464 EOM
2465
2466         rp="Which of these apply, if any?"
2467         . UU/myread
2468         tans=$ans
2469         for file in $tans; do
2470                 if $test X$file = XPolicy -a -f Policy.sh; then
2471                         . Policy.sh
2472                         $cat Policy.sh >> UU/config.sh
2473                 elif $test -f $src/hints/$file.sh; then
2474                         . $src/hints/$file.sh
2475                         $cat $src/hints/$file.sh >> UU/config.sh
2476                 elif $test X$tans = X -o X$tans = Xnone ; then
2477                         : nothing
2478                 else
2479                         : Give one chance to correct a possible typo.
2480                         echo "$file.sh does not exist"
2481                         dflt=$file
2482                         rp="hint to use instead?"
2483                         . UU/myread
2484                         for file in $ans; do
2485                                 if $test -f "$src/hints/$file.sh"; then
2486                                         . $src/hints/$file.sh
2487                                         $cat $src/hints/$file.sh >> UU/config.sh
2488                                 elif $test X$ans = X -o X$ans = Xnone ; then
2489                                         : nothing
2490                                 else
2491                                         echo "$file.sh does not exist -- ignored."
2492                                 fi
2493                         done
2494                 fi
2495         done
2496
2497         hint=recommended
2498         : Remember our hint file for later.
2499         if $test -f "$src/hints/$file.sh" ; then
2500                 hintfile="$file"
2501         else
2502                 hintfile=''
2503         fi
2504 fi
2505 cd UU
2506 ;;
2507 *)
2508         echo " "
2509         echo "Fetching default answers from $config_sh..." >&4
2510         tmp_n="$n"
2511         tmp_c="$c"
2512         cd ..
2513         cp $config_sh config.sh 2>/dev/null
2514         chmod +w config.sh
2515         . ./config.sh
2516         cd UU
2517         cp ../config.sh .
2518         n="$tmp_n"
2519         c="$tmp_c"
2520         hint=previous
2521         ;;
2522 esac
2523 test "$override" && . ./optdef.sh
2524 myuname="$newmyuname"
2525
2526 : Restore computed paths
2527 for file in $loclist $trylist; do
2528         eval $file="\$_$file"
2529 done
2530
2531 cat << EOM
2532
2533 Configure uses the operating system name and version to set some defaults.
2534 The default value is probably right if the name rings a bell. Otherwise,
2535 since spelling matters for me, either accept the default or answer "none"
2536 to leave it blank.
2537
2538 EOM
2539 case "$osname" in
2540         ''|' ')
2541                 case "$hintfile" in
2542                 ''|' '|none) dflt=none ;;
2543                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2544                 esac
2545                 ;;
2546         *) dflt="$osname" ;;
2547 esac
2548 rp="Operating system name?"
2549 . ./myread
2550 case "$ans" in
2551 none)  osname='' ;;
2552 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2553 esac
2554 echo " "
2555 case "$osvers" in
2556         ''|' ')
2557                 case "$hintfile" in
2558                 ''|' '|none) dflt=none ;;
2559                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2560                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2561                         case "$dflt" in
2562                         ''|' ') dflt=none ;;
2563                         esac
2564                         ;;
2565                 esac
2566                 ;;
2567         *) dflt="$osvers" ;;
2568 esac
2569 rp="Operating system version?"
2570 . ./myread
2571 case "$ans" in
2572 none)  osvers='' ;;
2573 *) osvers="$ans" ;;
2574 esac
2575
2576
2577 . ./posthint.sh
2578
2579 : who configured the system
2580 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2581 cf_by=`(logname) 2>/dev/null`
2582 case "$cf_by" in
2583 "")
2584         cf_by=`(whoami) 2>/dev/null`
2585         case "$cf_by" in
2586         "") cf_by=unknown ;;
2587         esac ;;
2588 esac
2589
2590 : set up the script used to warn in case of inconsistency
2591 cat <<EOS >whoa
2592 $startsh
2593 EOS
2594 cat <<'EOSC' >>whoa
2595 dflt=y
2596 echo " "
2597 echo "*** WHOA THERE!!! ***" >&4
2598 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2599 rp="    Keep the $hint value?"
2600 . ./myread
2601 case "$ans" in
2602 y) td=$was; tu=$was;;
2603 esac
2604 EOSC
2605
2606 : function used to set $1 to $val
2607 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2608 case "$val$was" in
2609 $define$undef) . ./whoa; eval "$var=\$td";;
2610 $undef$define) . ./whoa; eval "$var=\$tu";;
2611 *) eval "$var=$val";;
2612 esac'
2613
2614 cat <<EOM
2615
2616 Perl can be built to take advantage of threads on some systems.
2617 To do so, Configure must be run with -Dusethreads.
2618
2619 Note that threading is a highly experimental feature, and
2620 some known race conditions still remain.  If you choose to try
2621 it, be very sure to not actually deploy it for production
2622 purposes.  README.threads has more details, and is required
2623 reading if you enable threads.
2624 EOM
2625 case "$usethreads" in
2626 $define|true|[yY]*)     dflt='y';;
2627 *) dflt='n';;
2628 esac
2629 rp='Build a threading Perl?'
2630 . ./myread
2631 case "$ans" in
2632 y|Y)    val="$define" ;;
2633 *)      val="$undef" ;;
2634 esac
2635 set usethreads
2636 eval $setvar
2637
2638 case "$usethreads" in
2639 $define)
2640         $cat <<EOM
2641
2642 As of 5.5.640, Perl has two different internal threading implementations,
2643 the 5.005 version (5005threads) and an interpreter-based version
2644 (ithreads) that has one interpreter per thread.  Both are very 
2645 experimental.  This arrangement exists to help developers work out
2646 which one is better.
2647
2648 If you're a casual user, you probably don't want interpreter-threads
2649 at this time.  There doesn't yet exist a way to create threads from
2650 within Perl in this model, i.e., "use Thread;" will NOT work.
2651 EOM
2652         : Default to ithreads unless overridden on command line or with
2653         : old config.sh
2654         dflt='y'
2655         case "$use5005threads" in
2656                 $define|true|[yY]*) dflt='n';;
2657         esac
2658         case "$useithreads" in
2659                 $undef|false|[nN]*) dflt='n';;
2660         esac
2661         rp='Use interpreter-based ithreads?'
2662         . ./myread
2663         case "$ans" in
2664         y|Y)    val="$define" ;;
2665         *)      val="$undef" ;;
2666         esac
2667         set useithreads
2668         eval $setvar
2669         : Now set use5005threads to the opposite value.
2670         case "$useithreads" in
2671         $define) val="$undef" ;;
2672         *) val="$define" ;;
2673         esac
2674         set use5005threads
2675         eval $setvar
2676         ;;
2677 *)
2678         useithreads="$undef"
2679         use5005threads="$undef"
2680         ;;
2681 esac
2682
2683 case "$d_oldpthreads" in
2684 '')     : Configure tests would be welcome here.  For now, assume undef.
2685         val="$undef" ;;
2686 *)      val="$d_oldpthreads" ;;
2687 esac
2688 set d_oldpthreads
2689 eval $setvar
2690
2691
2692 case "$usethreads" in
2693 "$define"|true|[yY]*)
2694 : Look for a hint-file generated 'call-back-unit'.  If the
2695 : user has specified that a threading perl is to be built,
2696 : we may need to set or change some other defaults.
2697         if $test -f usethreads.cbu; then
2698                 echo "Your platform has some specific hints for threaded builds, using them..."
2699                 . ./usethreads.cbu
2700         else
2701                 $cat <<EOM
2702 (Your platform doesn't have any specific hints for threaded builds.
2703  Assuming POSIX threads, then.)
2704 EOM
2705         fi
2706         ;;
2707 esac
2708
2709 cat <<EOM
2710
2711 Perl can be built so that multiple Perl interpreters can coexist
2712 within the same Perl executable.
2713 EOM
2714
2715 case "$useithreads" in
2716 $define)
2717         cat <<EOM
2718 This multiple interpreter support is required for interpreter-based threads.
2719 EOM
2720         val="$define"
2721         ;;
2722 *)
2723         echo 'Normally you do not need this and you should answer no.'
2724         case "$usemultiplicity" in
2725         $define|true|[yY]*)     dflt='y';;
2726         *) dflt='n';;
2727         esac
2728         rp='Build Perl for multiplicity?'
2729         . ./myread
2730         case "$ans" in
2731         y|Y)    val="$define" ;;
2732         *)      val="$undef" ;;
2733         esac
2734         ;;
2735 esac
2736 set usemultiplicity
2737 eval $setvar
2738
2739 : determine where manual pages are on this system
2740 echo " "
2741 case "$sysman" in
2742 '') 
2743         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2744         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2745         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2746         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2747         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2748         sysman=`./loc . /usr/man/man1 $syspath`
2749         ;;
2750 esac
2751 if $test -d "$sysman"; then
2752         echo "System manual is in $sysman." >&4
2753 else
2754         echo "Could not find manual pages in source form." >&4
2755 fi
2756
2757 : see what memory models we can support
2758 case "$models" in
2759 '')
2760         $cat >pdp11.c <<'EOP'
2761 int main() {
2762 #ifdef pdp11
2763         exit(0);
2764 #else
2765         exit(1);
2766 #endif
2767 }
2768 EOP
2769         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2770         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2771                 dflt='unsplit split'
2772         else
2773                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2774                 case "$tans" in
2775                 X) dflt='none';;
2776                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2777                                 dflt='small'
2778                         else
2779                                 dflt=''
2780                         fi
2781                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2782                                 dflt="$dflt medium"
2783                         fi
2784                         if $test -d /lib/large || $test -d /usr/lib/large; then
2785                                 dflt="$dflt large"
2786                         fi
2787                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2788                                 dflt="$dflt huge"
2789                         fi
2790                 esac
2791         fi;;
2792 *) dflt="$models";;
2793 esac
2794 $cat <<EOM
2795  
2796 Some systems have different model sizes.  On most systems they are called
2797 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2798 split.  If your system doesn't support different memory models, say "none".
2799 If you wish to force everything to one memory model, say "none" here and
2800 put the appropriate flags later when it asks you for other cc and ld flags.
2801 Venix systems may wish to put "none" and let the compiler figure things out.
2802 (In the following question multiple model names should be space separated.)
2803
2804 The default for most systems is "none".
2805
2806 EOM
2807 rp="Which memory models are supported?"
2808 . ./myread
2809 models="$ans"
2810
2811 case "$models" in
2812 none)
2813         small=''
2814         medium=''
2815         large=''
2816         huge=''
2817         unsplit=''
2818         split=''
2819         ;;
2820 *split)
2821         case "$split" in
2822         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2823                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2824                         dflt='-i'
2825                 else
2826                         dflt='none'
2827                 fi;;
2828         *) dflt="$split";;
2829         esac
2830         rp="What flag indicates separate I and D space?"
2831         . ./myread
2832         tans="$ans"
2833         case "$tans" in
2834         none) tans='';;
2835         esac
2836         split="$tans"
2837         unsplit='';;
2838 *large*|*small*|*medium*|*huge*)
2839         case "$models" in
2840         *large*)
2841                 case "$large" in
2842                 '') dflt='-Ml';;
2843                 *) dflt="$large";;
2844                 esac
2845         rp="What flag indicates large model?"
2846         . ./myread
2847         tans="$ans"
2848         case "$tans" in
2849         none) tans='';
2850         esac
2851         large="$tans";;
2852         *) large='';;
2853         esac
2854         case "$models" in
2855         *huge*) case "$huge" in
2856                 '') dflt='-Mh';;
2857                 *) dflt="$huge";;
2858                 esac
2859                 rp="What flag indicates huge model?"
2860                 . ./myread
2861                 tans="$ans"
2862                 case "$tans" in
2863                 none) tans='';
2864                 esac
2865                 huge="$tans";;
2866         *) huge="$large";;
2867         esac
2868         case "$models" in
2869         *medium*) case "$medium" in
2870                 '') dflt='-Mm';;
2871                 *) dflt="$medium";;
2872                 esac
2873                 rp="What flag indicates medium model?"
2874                 . ./myread
2875                 tans="$ans"
2876                 case "$tans" in
2877                 none) tans='';
2878                 esac
2879                 medium="$tans";;
2880         *) medium="$large";;
2881         esac
2882         case "$models" in
2883         *small*) case "$small" in
2884                 '') dflt='none';;
2885                 *) dflt="$small";;
2886                 esac
2887                 rp="What flag indicates small model?"
2888                 . ./myread
2889                 tans="$ans"
2890                 case "$tans" in
2891                 none) tans='';
2892                 esac
2893                 small="$tans";;
2894         *) small='';;
2895         esac
2896         ;;
2897 *)
2898         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2899         ;;
2900 esac
2901 $rm -f pdp11.* pdp11
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 case "$p_" in
2960 :) ;;
2961 *)
2962         $cat <<'EOI'
2963 I have the feeling something is not exactly right, however...don't tell me...
2964 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2965 EOI
2966         echo exit 0 >os2
2967         ;;
2968 esac
2969 if test -f /xenix; then
2970         echo "Actually, this looks more like a XENIX system..."
2971         echo exit 0 >xenix
2972         d_xenix="$define"
2973 else
2974         echo " "
2975         echo "It's not Xenix..."
2976         d_xenix="$undef"
2977 fi
2978 chmod +x xenix
2979 $eunicefix xenix
2980 if test -f /venix; then
2981         echo "Actually, this looks more like a VENIX system..."
2982         echo exit 0 >venix
2983 else
2984         echo " "
2985         if ./xenix; then
2986                 : null
2987         else
2988                 echo "Nor is it Venix..."
2989         fi
2990 fi
2991 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2992 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2993 $rm -f foo
2994
2995 : see if we need a special compiler
2996 echo " "
2997 if ./usg; then
2998         case "$cc" in
2999         '') case "$Mcc" in
3000                 /*) dflt='Mcc';;
3001                 *) case "$large" in
3002                         -M*) dflt='cc';;
3003                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3004                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3005                                                 dflt='cc'
3006                                         else
3007                                                 dflt='cc -M'
3008                                         fi
3009                                 else
3010                                         dflt='cc'
3011                                 fi;;
3012                         esac;;
3013                 esac;;
3014         *)  dflt="$cc";;
3015         esac
3016         case "$dflt" in
3017         *M*)    $cat <<'EOM'
3018 On some older systems the default C compiler will not resolve multiple global
3019 references that happen to have the same name.  On some such systems the "Mcc"
3020 command may be used to force these to be resolved.  On other systems a "cc -M"
3021 command is required.  (Note that the -M flag on other systems indicates a
3022 memory model to use!) If you have the Gnu C compiler, you might wish to use
3023 that instead.
3024
3025 EOM
3026         ;;
3027         esac
3028         rp="Use which C compiler?"
3029         . ./myread
3030         cc="$ans"
3031 else
3032         case "$cc" in
3033         '') dflt=cc;;
3034         *) dflt="$cc";;
3035         esac
3036         rp="Use which C compiler?"
3037         . ./myread
3038         cc="$ans"
3039 fi
3040 : Look for a hint-file generated 'call-back-unit'.  Now that the
3041 : user has specified the compiler, we may need to set or change some
3042 : other defaults.
3043 if $test -f cc.cbu; then
3044     . ./cc.cbu
3045 fi
3046 echo " "
3047 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3048 $cat >gccvers.c <<EOM
3049 #include <stdio.h>
3050 int main() {
3051 #ifdef __GNUC__
3052 #ifdef __VERSION__
3053         printf("%s\n", __VERSION__);
3054 #else
3055         printf("%s\n", "1");
3056 #endif
3057 #endif
3058         exit(0);
3059 }
3060 EOM
3061 if $cc -o gccvers gccvers.c; then
3062         gccversion=`./gccvers`
3063         case "$gccversion" in
3064         '') echo "You are not using GNU cc." ;;
3065         *)  echo "You are using GNU cc $gccversion."
3066             ;;
3067         esac
3068 else
3069         echo " "
3070         echo "*** WHOA THERE!!! ***" >&4
3071         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3072         case "$knowitall" in
3073         '')
3074         echo "    You'd better start hunting for one and let me know about it." >&4
3075                 exit 1
3076                 ;;
3077         esac
3078 fi
3079 $rm -f gccvers*
3080 case "$gccversion" in
3081 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3082 esac
3083
3084 : decide how portable to be.  Allow command line overrides.
3085 case "$d_portable" in
3086 "$undef") ;;
3087 *)      d_portable="$define" ;;
3088 esac
3089
3090 : set up shell script to do ~ expansion
3091 cat >filexp <<EOSS
3092 $startsh
3093 : expand filename
3094 case "\$1" in
3095  ~/*|~)
3096         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3097         ;;
3098  ~*)
3099         if $test -f /bin/csh; then
3100                 /bin/csh -f -c "glob \$1"
3101                 failed=\$?
3102                 echo ""
3103                 exit \$failed
3104         else
3105                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3106                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3107                 if $test ! -d "\$dir"; then
3108                         me=\`basename \$0\`
3109                         echo "\$me: can't locate home directory for: \$name" >&2
3110                         exit 1
3111                 fi
3112                 case "\$1" in
3113                 */*)
3114                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3115                         ;;
3116                 *)
3117                         echo \$dir
3118                         ;;
3119                 esac
3120         fi
3121         ;;
3122 *)
3123         echo \$1
3124         ;;
3125 esac
3126 EOSS
3127 chmod +x filexp
3128 $eunicefix filexp
3129
3130 : now set up to get a file name
3131 cat <<EOS >getfile
3132 $startsh
3133 EOS
3134 cat <<'EOSC' >>getfile
3135 tilde=''
3136 fullpath=''
3137 already=''
3138 skip=''
3139 none_ok=''
3140 exp_file=''
3141 nopath_ok=''
3142 orig_rp="$rp"
3143 orig_dflt="$dflt"
3144 case "$gfpth" in
3145 '') gfpth='.' ;;
3146 esac
3147
3148 case "$fn" in
3149 *\(*)
3150         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3151         fn=`echo $fn | sed 's/(.*)//'`
3152         ;;
3153 esac
3154
3155 case "$fn" in
3156 *:*)
3157         loc_file=`expr $fn : '.*:\(.*\)'`
3158         fn=`expr $fn : '\(.*\):.*'`
3159         ;;
3160 esac
3161
3162 case "$fn" in
3163 *~*) tilde=true;;
3164 esac
3165 case "$fn" in
3166 */*) fullpath=true;;
3167 esac
3168 case "$fn" in
3169 *+*) skip=true;;
3170 esac
3171 case "$fn" in
3172 *n*) none_ok=true;;
3173 esac
3174 case "$fn" in
3175 *e*) exp_file=true;;
3176 esac
3177 case "$fn" in
3178 *p*) nopath_ok=true;;
3179 esac
3180
3181 case "$fn" in
3182 *f*) type='File';;
3183 *d*) type='Directory';;
3184 *l*) type='Locate';;
3185 esac
3186
3187 what="$type"
3188 case "$what" in
3189 Locate) what='File';;
3190 esac
3191
3192 case "$exp_file" in
3193 '')
3194         case "$d_portable" in
3195         "$define") ;;
3196         *) exp_file=true;;
3197         esac
3198         ;;
3199 esac
3200
3201 cd ..
3202 while test "$type"; do
3203         redo=''
3204         rp="$orig_rp"
3205         dflt="$orig_dflt"
3206         case "$tilde" in
3207         true) rp="$rp (~name ok)";;
3208         esac
3209         . UU/myread
3210         if test -f UU/getfile.ok && \
3211                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3212         then
3213                 value="$ans"
3214                 ansexp="$ans"
3215                 break
3216         fi
3217         case "$ans" in
3218         none)
3219                 value=''
3220                 ansexp=''
3221                 case "$none_ok" in
3222                 true) type='';;
3223                 esac
3224                 ;;
3225         *)
3226                 case "$tilde" in
3227                 '') value="$ans"
3228                         ansexp="$ans";;
3229                 *)
3230                         value=`UU/filexp $ans`
3231                         case $? in
3232                         0)
3233                                 if test "$ans" != "$value"; then
3234                                         echo "(That expands to $value on this system.)"
3235                                 fi
3236                                 ;;
3237                         *) value="$ans";;
3238                         esac
3239                         ansexp="$value"
3240                         case "$exp_file" in
3241                         '') value="$ans";;
3242                         esac
3243                         ;;
3244                 esac
3245                 case "$fullpath" in
3246                 true)
3247                         case "$ansexp" in
3248                         /*) value="$ansexp" ;;
3249                         *)
3250                                 redo=true
3251                                 case "$already" in
3252                                 true)
3253                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3254                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3255                                         ;;
3256                                 *)
3257                                 echo "Please give a full path name, starting with slash." >&4
3258                                         case "$tilde" in
3259                                         true)
3260                                 echo "Note that using ~name is ok provided it expands well." >&4
3261                                                 already=true
3262                                                 ;;
3263                                         esac
3264                                 esac
3265                                 ;;
3266                         esac
3267                         ;;
3268                 esac
3269                 case "$redo" in
3270                 '')
3271                         case "$type" in
3272                         File)
3273                                 for fp in $gfpth; do
3274                                         if test "X$fp" = X.; then
3275                                             pf="$ansexp"
3276                                         else    
3277                                             pf="$fp/$ansexp"
3278                                         fi
3279                                         if test -f "$pf"; then
3280                                                 type=''
3281                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3282                                         then
3283                                                 echo "($value is not a plain file, but that's ok.)"
3284                                                 type=''
3285                                         fi
3286                                         if test X"$type" = X; then
3287                                             value="$pf"
3288                                             break
3289                                         fi
3290                                 done
3291                                 ;;
3292                         Directory)
3293                                 for fp in $gfpth; do
3294                                         if test "X$fp" = X.; then
3295                                             pf="$ansexp"
3296                                         else    
3297                                             pf="$fp/$ansexp"
3298                                         fi
3299                                         if test -d "$pf"; then
3300                                                 type=''
3301                                                 value="$pf"
3302                                                 break
3303                                         fi
3304                                 done
3305                                 ;;
3306                         Locate)
3307                                 if test -d "$ansexp"; then
3308                                         echo "(Looking for $loc_file in directory $value.)"
3309                                         value="$value/$loc_file"
3310                                         ansexp="$ansexp/$loc_file"
3311                                 fi
3312                                 if test -f "$ansexp"; then
3313                                         type=''
3314                                 fi
3315                                 case "$nopath_ok" in
3316                                 true)   case "$value" in
3317                                         */*) ;;
3318                                         *)      echo "Assuming $value will be in people's path."
3319                                                 type=''
3320                                                 ;;
3321                                         esac
3322                                         ;;
3323                                 esac
3324                                 ;;
3325                         esac
3326
3327                         case "$skip" in
3328                         true) type='';
3329                         esac
3330
3331                         case "$type" in
3332                         '') ;;
3333                         *)
3334                                 if test "$fastread" = yes; then
3335                                         dflt=y
3336                                 else
3337                                         dflt=n
3338                                 fi
3339                                 rp="$what $value doesn't exist.  Use that name anyway?"
3340                                 . UU/myread
3341                                 dflt=''
3342                                 case "$ans" in
3343                                 y*) type='';;
3344                                 *) echo " ";;
3345                                 esac
3346                                 ;;
3347                         esac
3348                         ;;
3349                 esac
3350                 ;;
3351         esac
3352 done
3353 cd UU
3354 ans="$value"
3355 rp="$orig_rp"
3356 dflt="$orig_dflt"
3357 rm -f getfile.ok
3358 test "X$gfpthkeep" != Xy && gfpth=""
3359 EOSC
3360
3361 : What should the include directory be ?
3362 echo " "
3363 $echo $n "Hmm...  $c"
3364 dflt='/usr/include'
3365 incpath=''
3366 mips_type=''
3367 if $test -f /bin/mips && /bin/mips; then
3368         echo "Looks like a MIPS system..."
3369         $cat >usr.c <<'EOCP'
3370 #ifdef SYSTYPE_BSD43
3371 /bsd43
3372 #endif
3373 EOCP
3374         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3375                 dflt='/bsd43/usr/include'
3376                 incpath='/bsd43'
3377                 mips_type='BSD 4.3'
3378         else
3379                 mips_type='System V'
3380         fi
3381         $rm -f usr.c usr.out
3382         echo "and you're compiling with the $mips_type compiler and libraries."
3383         xxx_prompt=y
3384         echo "exit 0" >mips
3385 else
3386         echo "Doesn't look like a MIPS system."
3387         xxx_prompt=n
3388         echo "exit 1" >mips
3389 fi
3390 chmod +x mips
3391 $eunicefix mips
3392 case "$usrinc" in
3393 '') ;;
3394 *) dflt="$usrinc";;
3395 esac
3396 case "$xxx_prompt" in
3397 y)      fn=d/
3398         echo " "
3399         rp='Where are the include files you want to use?'
3400         . ./getfile
3401         usrinc="$ans"
3402         ;;
3403 *)      usrinc="$dflt"
3404         ;;
3405 esac
3406
3407 : see how we invoke the C preprocessor
3408 echo " "
3409 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3410 cat <<'EOT' >testcpp.c
3411 #define ABC abc
3412 #define XYZ xyz
3413 ABC.XYZ
3414 EOT
3415 cd ..
3416 if test ! -f cppstdin; then
3417         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3418                 # AIX cc -E doesn't show the absolute headerfile
3419                 # locations but we'll cheat by using the -M flag.
3420                 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
3421         else
3422                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3423         fi
3424 else
3425         echo "Keeping your $hint cppstdin wrapper."
3426 fi
3427 chmod 755 cppstdin
3428 wrapper=`pwd`/cppstdin
3429 ok='false'
3430 cd UU
3431
3432 if $test "X$cppstdin" != "X" && \
3433         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3434         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3435 then
3436         echo "You used to use $cppstdin $cppminus so we'll use that again."
3437         case "$cpprun" in
3438         '') echo "But let's see if we can live without a wrapper..." ;;
3439         *)
3440                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3441                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3442                 then
3443                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3444                         ok='true'
3445                 else
3446                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3447                 fi
3448                 ;;
3449         esac
3450 else
3451         case "$cppstdin" in
3452         '') ;;
3453         *)
3454                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3455                 ;;
3456         esac
3457 fi
3458
3459 if $ok; then
3460         : nothing
3461 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3462         $cc -E <testcpp.c >testcpp.out 2>&1; \
3463         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3464         echo "Yup, it does."
3465         x_cpp="$cc -E"
3466         x_minus='';
3467 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3468         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3469         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3470         echo "Yup, it does."
3471         x_cpp="$cc -E"
3472         x_minus='-';
3473 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3474         $cc -P <testcpp.c >testcpp.out 2>&1; \
3475         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3476         echo "Yipee, that works!"
3477         x_cpp="$cc -P"
3478         x_minus='';
3479 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3480         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3481         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3482         echo "At long last!"
3483         x_cpp="$cc -P"
3484         x_minus='-';
3485 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3486         $cpp <testcpp.c >testcpp.out 2>&1; \
3487         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3488         echo "It works!"
3489         x_cpp="$cpp"
3490         x_minus='';
3491 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3492         $cpp - <testcpp.c >testcpp.out 2>&1; \
3493         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3494         echo "Hooray, it works!  I was beginning to wonder."
3495         x_cpp="$cpp"
3496         x_minus='-';
3497 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3498         $wrapper <testcpp.c >testcpp.out 2>&1; \
3499         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3500         x_cpp="$wrapper"
3501         x_minus=''
3502         echo "Eureka!"
3503 else
3504         dflt=''
3505         rp="No dice.  I can't find a C preprocessor.  Name one:"
3506         . ./myread
3507         x_cpp="$ans"
3508         x_minus=''
3509         $x_cpp <testcpp.c >testcpp.out 2>&1
3510         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3511                 echo "OK, that will do." >&4
3512         else
3513 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3514                 exit 1
3515         fi
3516 fi
3517
3518 case "$ok" in
3519 false)
3520         cppstdin="$x_cpp"
3521         cppminus="$x_minus"
3522         cpprun="$x_cpp"
3523         cpplast="$x_minus"
3524         set X $x_cpp
3525         shift
3526         case "$1" in
3527         "$cpp")
3528                 echo "Perhaps can we force $cc -E using a wrapper..."
3529                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3530                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3531                 then
3532                         echo "Yup, we can."
3533                         cppstdin="$wrapper"
3534                         cppminus='';
3535                 else
3536                         echo "Nope, we'll have to live without it..."
3537                 fi
3538                 ;;
3539         esac
3540         case "$cpprun" in
3541         "$wrapper")
3542                 cpprun=''
3543                 cpplast=''
3544                 ;;
3545         esac
3546         ;;
3547 esac
3548
3549 case "$cppstdin" in
3550 "$wrapper"|'cppstdin') ;;
3551 *) $rm -f $wrapper;;
3552 esac
3553 $rm -f testcpp.c testcpp.out
3554
3555 : Set private lib path
3556 case "$plibpth" in
3557 '') if ./mips; then
3558                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3559         fi;;
3560 esac
3561 case "$libpth" in
3562 ' ') dlist='';;
3563 '') dlist="$loclibpth $plibpth $glibpth";;
3564 *) dlist="$libpth";;
3565 esac
3566
3567 : Now check and see which directories actually exist, avoiding duplicates
3568 libpth=''
3569 for xxx in $dlist
3570 do
3571     if $test -d $xxx; then
3572                 case " $libpth " in
3573                 *" $xxx "*) ;;
3574                 *) libpth="$libpth $xxx";;
3575                 esac
3576     fi
3577 done
3578 $cat <<'EOM'
3579
3580 Some systems have incompatible or broken versions of libraries.  Among
3581 the directories listed in the question below, please remove any you
3582 know not to be holding relevant libraries, and add any that are needed.
3583 Say "none" for none.
3584
3585 EOM
3586 case "$libpth" in
3587 '') dflt='none';;
3588 *)
3589         set X $libpth
3590         shift
3591         dflt=${1+"$@"}
3592         ;;
3593 esac
3594 rp="Directories to use for library searches?"
3595 . ./myread
3596 case "$ans" in
3597 none) libpth=' ';;
3598 *) libpth="$ans";;
3599 esac
3600
3601 : compute shared library extension
3602 case "$so" in
3603 '')
3604         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3605                 dflt='sl'
3606         else
3607                 dflt='so'
3608         fi
3609         ;;
3610 *) dflt="$so";;
3611 esac
3612 $cat <<EOM
3613
3614 On some systems, shared libraries may be available.  Answer 'none' if
3615 you want to suppress searching of shared libraries for the remainder
3616 of this configuration.
3617
3618 EOM
3619 rp='What is the file extension used for shared libraries?'
3620 . ./myread
3621 so="$ans"
3622
3623 : Define several unixisms.
3624 : Hints files or command line option can be used to override them.
3625 : The convoluted testing is in case hints files set either the old
3626 : or the new name.
3627 case "$_exe" in
3628 '')     case "$exe_ext" in
3629     '') ;;
3630         *)      _exe="$exe_ext" ;;
3631         esac
3632         ;;
3633 esac
3634 case "$_a" in
3635 '')     case "$lib_ext" in
3636     '') _a='.a';;
3637         *)      _a="$lib_ext" ;;
3638         esac
3639         ;;
3640 esac
3641 case "$_o" in
3642 '') case "$obj_ext" in
3643         '')     _o='.o';;
3644         *)      _o="$obj_ext";;
3645         esac
3646         ;;
3647 esac
3648 case "$p_" in
3649 '') case "$path_sep" in
3650         '')     p_=':';;
3651         *)      p_="$path_sep";;
3652         esac
3653         ;;
3654 esac
3655 exe_ext=$_exe
3656 lib_ext=$_a
3657 obj_ext=$_o
3658 path_sep=$p_
3659
3660 : Which makefile gets called first.  This is used by make depend.
3661 case "$firstmakefile" in
3662 '') firstmakefile='makefile';;
3663 esac
3664
3665 cat <<EOM
3666
3667 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3668 Configure must be run with -Dusesocks.
3669
3670 Normally you do not need this and you should answer no.
3671
3672 EOM
3673 case "$usesocks" in
3674 $define|true|[yY]*)     dflt='y';;
3675 *) dflt='n';;
3676 esac
3677 rp='Build Perl for SOCKS?'
3678 . ./myread
3679 case "$ans" in
3680 y|Y)    val="$define" ;;     
3681 *)      val="$undef" ;;
3682 esac
3683 set usesocks
3684 eval $setvar
3685
3686 : Looking for optional libraries
3687 echo " "
3688 echo "Checking for optional libraries..." >&4
3689 case "$libs" in
3690 ' '|'') dflt='';;
3691 *) dflt="$libs";;
3692 esac
3693 case "$libswanted" in
3694 '') libswanted='c_s';;
3695 esac
3696 case "$usesocks" in
3697 $define)
3698         libswanted="$libswanted socks5 socks5_sh"
3699         ;;
3700 esac
3701 for thislib in $libswanted; do
3702         for thisdir in $libpth; do
3703             xxx=''
3704             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3705                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3706                 $test -f "$xxx" && eval $libscheck
3707                 $test -f "$xxx" && libstyle=shared
3708             fi
3709             if test ! -f "$xxx"; then
3710                 xxx=$thisdir/lib$thislib.$so
3711                 $test -f "$xxx" && eval $libscheck
3712                 $test -f "$xxx" && libstyle=shared
3713             fi  
3714             if test ! -f "$xxx"; then
3715                 xxx=$thisdir/lib$thislib$_a
3716                 $test -f "$xxx" && eval $libscheck
3717                 $test -f "$xxx" && libstyle=static
3718             fi
3719             if test ! -f "$xxx"; then
3720                 xxx=$thisdir/$thislib$_a
3721                 $test -f "$xxx" && eval $libscheck
3722                 $test -f "$xxx" && libstyle=static
3723             fi
3724             if test ! -f "$xxx"; then
3725                 xxx=$thisdir/lib${thislib}_s$_a
3726                 $test -f "$xxx" && eval $libscheck
3727                 $test -f "$xxx" && libstyle=static
3728             fi
3729             if test ! -f "$xxx"; then
3730                 xxx=$thisdir/Slib$thislib$_a
3731                 $test -f "$xxx" && eval $libscheck
3732                 $test -f "$xxx" && libstyle=static
3733             fi
3734             if $test -f "$xxx"; then
3735                 case "$libstyle" in
3736                 shared) echo "Found -l$thislib (shared)." ;;
3737                 static) echo "Found -l$thislib." ;;
3738                 *)      echo "Found -l$thislib ($libstyle)." ;;
3739                 esac
3740                 case " $dflt " in
3741                 *"-l$thislib "*);;
3742                 *) dflt="$dflt -l$thislib"
3743                    libsfound="$libsfound $xxx"
3744                    yyy=`basename $xxx`
3745                    libsfiles="$libsfiles $yyy"
3746                    yyy=`echo $xxx|sed "s@/$yyy\\$@@"`
3747                    case " $libsdirs " in
3748                    *" $yyy "*) ;;
3749                    *) libsdirs="$libsdirs $yyy" ;;
3750                    esac
3751                    ;;
3752                 esac
3753                 break
3754             fi  
3755         done
3756         if $test ! -f "$xxx"; then
3757             echo "No -l$thislib."
3758         fi
3759 done
3760 set X $dflt
3761 shift
3762 dflt="$*"
3763 case "$libs" in
3764 '') dflt="$dflt";;
3765 *) dflt="$libs";;
3766 esac
3767 case "$dflt" in
3768 ' '|'') dflt='none';;
3769 esac
3770
3771 $cat <<EOM
3772
3773 In order to compile $package on your machine, a number of libraries
3774 are usually needed.  Include any other special libraries here as well.
3775 Say "none" for none.  The default list is almost always right.
3776 EOM
3777
3778 echo " "
3779 rp="What libraries to use?"
3780 . ./myread
3781 case "$ans" in
3782 none) libs=' ';;
3783 *) libs="$ans";;
3784 esac
3785
3786 : determine optimization, if desired, or use for debug flag also
3787 case "$optimize" in
3788 ' '|$undef) dflt='none';;
3789 '') dflt='-O';;
3790 *) dflt="$optimize";;
3791 esac
3792 $cat <<EOH
3793
3794 By default, $package compiles with the -O flag to use the optimizer.
3795 Alternately, you might want to use the symbolic debugger, which uses
3796 the -g flag (on traditional Unix systems).  Either flag can be
3797 specified here.  To use neither flag, specify the word "none".
3798
3799 EOH
3800 rp="What optimizer/debugger flag should be used?"
3801 . ./myread
3802 optimize="$ans"
3803 case "$optimize" in
3804 'none') optimize=" ";;
3805 esac
3806
3807 dflt=''
3808 : We will not override a previous value, but we might want to
3809 : augment a hint file
3810 case "$hint" in
3811 default|recommended)
3812         case "$gccversion" in
3813         1*) dflt='-fpcc-struct-return' ;;
3814         esac
3815         case "$optimize" in
3816         *-g*) dflt="$dflt -DDEBUGGING";;
3817         esac
3818         case "$gccversion" in
3819         2*) if test -d /etc/conf/kconfig.d &&
3820                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3821                 then
3822                         dflt="$dflt -posix"
3823                 fi
3824                 ;;
3825         esac
3826         case "$gccversion" in
3827         1*) ;;
3828         2.[0-8]*) ;;
3829         ?*)     echo " "
3830                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3831                 echo 'int main(void) { return 0; }' > gcctest.c
3832                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3833                         echo "Yes, it does." 2>&1
3834                         case "$ccflags" in
3835                         *strict-aliasing*) 
3836                                 echo "Leaving current flags $ccflags alone." 2>&1
3837                                 ;;
3838                         *) dflt="$dflt -fno-strict-aliasing" ;;
3839                         esac
3840                 else
3841                         echo "Nope, it doesn't, but that's ok." 2>&1
3842                 fi
3843                 ;;
3844         esac
3845         ;;
3846 esac
3847
3848 case "$mips_type" in
3849 *BSD*|'') inclwanted="$locincpth $usrinc";;
3850 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3851 esac
3852 for thisincl in $inclwanted; do
3853         if $test -d $thisincl; then
3854                 if $test x$thisincl != x$usrinc; then
3855                         case "$dflt" in
3856                         *$thisincl*);;
3857                         *) dflt="$dflt -I$thisincl";;
3858                         esac
3859                 fi
3860         fi
3861 done
3862
3863 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3864         xxx=true;
3865 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3866         xxx=true;
3867 else
3868         xxx=false;
3869 fi;
3870 if $xxx; then
3871         case "$dflt" in
3872         *$2*);;
3873         *) dflt="$dflt -D$2";;
3874         esac;
3875 fi'
3876
3877 set signal.h LANGUAGE_C; eval $inctest
3878
3879 case "$usesocks" in
3880 $define)
3881         ccflags="$ccflags -DSOCKS"
3882         ;;
3883 esac
3884
3885 case "$hint" in
3886 default|recommended) dflt="$ccflags $dflt" ;;
3887 *) dflt="$ccflags";;
3888 esac
3889
3890 case "$dflt" in
3891 ''|' ') dflt=none;;
3892 esac
3893 $cat <<EOH
3894
3895 Your C compiler may want other flags.  For this question you should include
3896 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3897 but you should NOT include libraries or ld flags like -lwhatever.  If you
3898 want $package to honor its debug switch, you should include -DDEBUGGING here.
3899 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3900
3901 To use no flags, specify the word "none".
3902
3903 EOH
3904 set X $dflt
3905 shift
3906 dflt=${1+"$@"}
3907 rp="Any additional cc flags?"
3908 . ./myread
3909 case "$ans" in
3910 none) ccflags='';;
3911 *) ccflags="$ans";;
3912 esac
3913
3914 : the following weeds options from ccflags that are of no interest to cpp
3915 cppflags="$ccflags"
3916 case "$gccversion" in
3917 1*) cppflags="$cppflags -D__GNUC__"
3918 esac
3919 case "$mips_type" in
3920 '');;
3921 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3922 esac
3923 case "$cppflags" in
3924 '');;
3925 *)
3926         echo " "
3927         echo "Let me guess what the preprocessor flags are..." >&4
3928         set X $cppflags
3929         shift
3930         cppflags=''
3931         $cat >cpp.c <<'EOM'
3932 #define BLURFL foo
3933
3934 BLURFL xx LFRULB
3935 EOM
3936         previous=''
3937         for flag in $*
3938         do
3939                 case "$flag" in
3940                 -*) ftry="$flag";;
3941                 *) ftry="$previous $flag";;
3942                 esac
3943                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3944                         >cpp1.out 2>/dev/null && \
3945                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3946                         >cpp2.out 2>/dev/null && \
3947                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3948                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3949                 then
3950                         cppflags="$cppflags $ftry"
3951                         previous=''
3952                 else
3953                         previous="$flag"
3954                 fi
3955         done
3956         set X $cppflags
3957         shift
3958         cppflags=${1+"$@"}
3959         case "$cppflags" in
3960         *-*)  echo "They appear to be: $cppflags";;
3961         esac
3962         $rm -f cpp.c cpp?.out
3963         ;;
3964 esac
3965
3966 : flags used in final linking phase
3967 case "$ldflags" in
3968 '') if ./venix; then
3969                 dflt='-i -z'
3970         else
3971                 dflt=''
3972         fi
3973         case "$ccflags" in
3974         *-posix*) dflt="$dflt -posix" ;;
3975         esac
3976         ;;
3977 *) dflt="$ldflags";;
3978 esac
3979
3980 : Try to guess additional flags to pick up local libraries.
3981 for thislibdir in $libpth; do
3982         case " $loclibpth " in
3983         *" $thislibdir "*)
3984                 case "$dflt " in 
3985                 *"-L$thislibdir "*) ;;
3986                 *)  dflt="$dflt -L$thislibdir" ;;
3987                 esac
3988                 ;;
3989         esac
3990 done
3991
3992 case "$dflt" in
3993 '') dflt='none' ;;
3994 esac
3995
3996 $cat <<EOH
3997
3998 Your C linker may need flags.  For this question you should
3999 include -L/whatever and any other flags used by the C linker, but you
4000 should NOT include libraries like -lwhatever.
4001
4002 Make sure you include the appropriate -L/path flags if your C linker
4003 does not normally search all of the directories you specified above,
4004 namely
4005         $libpth
4006 To use no flags, specify the word "none".
4007
4008 EOH
4009
4010 rp="Any additional ld flags (NOT including libraries)?"
4011 . ./myread
4012 case "$ans" in
4013 none) ldflags='';;
4014 *) ldflags="$ans";;
4015 esac
4016 rmlist="$rmlist pdp11"
4017
4018 : coherency check
4019 echo " "
4020 echo "Checking your choice of C compiler and flags for coherency..." >&4
4021 $cat > try.c <<'EOF'
4022 #include <stdio.h>
4023 int main() { printf("Ok\n"); exit(0); }
4024 EOF
4025 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4026 shift
4027 $cat >try.msg <<'EOM'
4028 I've tried to compile and run the following simple program:
4029
4030 EOM
4031 $cat try.c >> try.msg
4032
4033 $cat >> try.msg <<EOM
4034
4035 I used the command:
4036
4037         $*
4038         ./try
4039
4040 and I got the following output:
4041
4042 EOM
4043 dflt=y
4044 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4045         if sh -c './try' >>try.msg 2>&1; then
4046                 xxx=`./try`
4047                 case "$xxx" in
4048                 "Ok") dflt=n ;;
4049                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4050                         case " $libs " in
4051                         *" -lsfio "*)
4052                                 cat >> try.msg <<'EOQS'
4053 If $libs contains -lsfio, and sfio is mis-configured, then it
4054 sometimes (apparently) runs and exits with a 0 status, but with no
4055 output!  It may have to do with sfio's use of _exit vs. exit.
4056
4057 EOQS
4058                                 rp="You have a big problem.  Shall I abort Configure"
4059                                 dflt=y
4060                                 ;;
4061                         esac
4062                         ;;
4063                 esac
4064         else
4065                 echo "The program compiled OK, but exited with status $?." >>try.msg
4066                 rp="You have a problem.  Shall I abort Configure"
4067                 dflt=y
4068         fi
4069 else
4070         echo "I can't compile the test program." >>try.msg
4071         rp="You have a BIG problem.  Shall I abort Configure"
4072         dflt=y
4073 fi
4074 case "$dflt" in
4075 y)
4076         $cat try.msg >&4
4077         case "$knowitall" in
4078         '')
4079                 echo "(The supplied flags or libraries might be incorrect.)"
4080                 ;;
4081         *) dflt=n;;
4082         esac
4083         echo " "
4084         . ./myread
4085         case "$ans" in
4086         n*|N*) ;;
4087         *)      echo "Ok.  Stopping Configure." >&4
4088                 exit 1
4089                 ;;
4090         esac
4091         ;;
4092 n) echo "OK, that should do.";;
4093 esac
4094 $rm -f try try.* core
4095
4096 : define an is-a-typedef? function
4097 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4098 case "$inclist" in
4099 "") inclist="sys/types.h";;
4100 esac;
4101 eval "varval=\$$var";
4102 case "$varval" in
4103 "")
4104         $rm -f temp.c;
4105         for inc in $inclist; do
4106                 echo "#include <$inc>" >>temp.c;
4107         done;
4108         echo "#ifdef $type" >> temp.c;
4109         echo "printf(\"We have $type\");" >> temp.c;
4110         echo "#endif" >> temp.c;
4111         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4112         if $contains $type temp.E >/dev/null 2>&1; then
4113                 eval "$var=\$type";
4114         else
4115                 eval "$var=\$def";
4116         fi;
4117         $rm -f temp.?;;
4118 *) eval "$var=\$varval";;
4119 esac'
4120
4121 : define an is-a-typedef? function that prompts if the type is not available.
4122 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4123 case "$inclist" in
4124 "") inclist="sys/types.h";;
4125 esac;
4126 eval "varval=\$$var";
4127 case "$varval" in
4128 "")
4129         $rm -f temp.c;
4130         for inc in $inclist; do
4131                 echo "#include <$inc>" >>temp.c;
4132         done;
4133         echo "#ifdef $type" >> temp.c;
4134         echo "printf(\"We have $type\");" >> temp.c;
4135         echo "#endif" >> temp.c;
4136         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4137         echo " " ;
4138         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4139         if $contains $type temp.E >/dev/null 2>&1; then
4140                 echo "$type found." >&4;
4141                 eval "$var=\$type";
4142         else
4143                 echo "$type NOT found." >&4;
4144                 dflt="$def";
4145                 . ./myread ;
4146                 eval "$var=\$ans";
4147         fi;
4148         $rm -f temp.?;;
4149 *) eval "$var=\$varval";;
4150 esac'
4151
4152 : define a shorthand compile call
4153 compile='
4154 mc_file=$1;
4155 shift;
4156 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4157 : define a shorthand compile call for compilations that should be ok.
4158 compile_ok='
4159 mc_file=$1;
4160 shift;
4161 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4162
4163 : check for lengths of integral types
4164 echo " "
4165 case "$intsize" in
4166 '')
4167         echo "Checking to see how big your integers are..." >&4
4168         $cat >intsize.c <<'EOCP'
4169 #include <stdio.h>
4170 int main()
4171 {
4172         printf("intsize=%d;\n", (int)sizeof(int));
4173         printf("longsize=%d;\n", (int)sizeof(long));
4174         printf("shortsize=%d;\n", (int)sizeof(short));
4175         exit(0);
4176 }
4177 EOCP
4178         set intsize
4179         if eval $compile_ok && ./intsize > /dev/null; then
4180                 eval `./intsize`
4181                 echo "Your integers are $intsize bytes long."
4182                 echo "Your long integers are $longsize bytes long."
4183                 echo "Your short integers are $shortsize bytes long."
4184         else
4185                 $cat >&4 <<EOM
4186 !
4187 Help! I can't compile and run the intsize test program: please enlighten me!
4188 (This is probably a misconfiguration in your system or libraries, and
4189 you really ought to fix it.  Still, I'll try anyway.)
4190 !
4191 EOM
4192                 dflt=4
4193                 rp="What is the size of an integer (in bytes)?"
4194                 . ./myread
4195                 intsize="$ans"
4196                 dflt=$intsize
4197                 rp="What is the size of a long integer (in bytes)?"
4198                 . ./myread
4199                 longsize="$ans"
4200                 dflt=2
4201                 rp="What is the size of a short integer (in bytes)?"
4202                 . ./myread
4203                 shortsize="$ans"
4204         fi
4205         ;;
4206 esac
4207 $rm -f intsize intsize.*
4208
4209 : see what type lseek is declared as in the kernel
4210 rp="What is the type used for lseek's offset on this system?"
4211 set off_t lseektype long stdio.h sys/types.h
4212 eval $typedef_ask
4213
4214 echo " "
4215 $echo $n "Checking to see how big your file offsets are...$c" >&4
4216 $cat >try.c <<EOCP
4217 #include <sys/types.h>
4218 #include <stdio.h>
4219 int main()
4220 {
4221     printf("%d\n", (int)sizeof($lseektype));
4222     return(0); 
4223 }
4224 EOCP
4225 set try
4226 if eval $compile_ok; then
4227         lseeksize=`./try`
4228         $echo " $lseeksize bytes." >&4
4229 else
4230         dflt=$longsize
4231         echo " "
4232         echo "(I can't seem to compile the test program.  Guessing...)"
4233         rp="What is the size of your file offsets (in bytes)?"
4234         . ./myread
4235         lseeksize="$ans"
4236 fi
4237 $rm -f try.c try
4238
4239 : see what type file positions are declared as in the library
4240 rp="What is the type for file position used by fsetpos()?"
4241 set fpos_t fpostype long stdio.h sys/types.h
4242 eval $typedef_ask
4243
4244 echo " "
4245 case "$fpostype" in
4246 *_t) zzz="$fpostype"    ;;
4247 *)   zzz="fpos_t"       ;;
4248 esac
4249 $echo $n "Checking the size of $zzz...$c" >&4 
4250 cat > try.c <<EOCP
4251 #include <sys/types.h>
4252 #include <stdio.h>
4253 int main() {
4254     printf("%d\n", (int)sizeof($fpostype));
4255     exit(0);
4256 }
4257 EOCP
4258 set try
4259 if eval $compile_ok; then
4260         yyy=`./try`
4261         case "$yyy" in
4262         '')     fpossize=4
4263                 echo " "
4264                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4265                 ;;
4266         *)      fpossize=$yyy
4267                 echo " $fpossize bytes."
4268                 ;;
4269         esac
4270 else
4271         dflt="$longsize"
4272         echo " "
4273         echo "(I can't compile the test program.  Guessing...)" >&4
4274         rp="What is the size of your file positions (in bytes)?"
4275         . ./myread
4276         fpossize="$ans"
4277 fi
4278
4279
4280
4281 case "$lseeksize:$fpossize" in
4282 8:8) cat <<EOM
4283
4284 You can have files larger than 2 gigabytes.
4285 EOM
4286    val="$define" ;;
4287 *) cat <<EOM
4288
4289 Perl can be built to understand large files (files larger than 2 gigabytes)
4290 on some systems.  To do so, Configure must be run with -Duselargefiles.
4291
4292 If this doesn't make any sense to you, just accept the default 'y'.
4293 EOM
4294    case "$uselargefiles" in
4295    "$undef"|false|[nN]*) dflt='n' ;;
4296    *)   dflt='y' ;;
4297    esac
4298    rp='Try to understand large files, if available?'
4299    . ./myread
4300    case "$ans" in
4301    y|Y)         val="$define" ;;
4302    *)           val="$undef"  ;;
4303    esac
4304    ;;
4305 esac
4306 set uselargefiles
4307 eval $setvar
4308 case "$uselargefiles" in
4309 "$define")
4310 : Look for a hint-file generated 'call-back-unit'.  If the
4311 : user has specified that a large files perl is to be built,
4312 : we may need to set or change some other defaults.
4313         if $test -f uselfs.cbu; then
4314                 echo "Your platform has some specific hints for large file builds, using them..."
4315                 . ./uselfs.cbu
4316                 echo " "
4317                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4318                 $cat >try.c <<EOCP
4319 #include <sys/types.h>
4320 #include <stdio.h>
4321 int main()
4322 {
4323     printf("%d\n", (int)sizeof($lseektype));
4324     return(0); 
4325 }
4326 EOCP
4327                 set try
4328                 if eval $compile_ok; then
4329                         lseeksize=`./try`
4330                         $echo " $lseeksize bytes." >&4
4331                 else
4332                         dflt="$lseeksize"
4333                         echo " "
4334                         echo "(I can't seem to compile the test program.  Guessing...)"
4335                         rp="What is the size of your file offsets (in bytes)?"
4336                         . ./myread
4337                         lseeksize="$ans"
4338                 fi
4339                 case "$fpostype" in
4340                 *_t) zzz="$fpostype"    ;;
4341                 *)   zzz="fpos_t"       ;;
4342                 esac
4343                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4344                 $cat > try.c <<EOCP
4345 #include <sys/types.h>
4346 #include <stdio.h>
4347 int main() {
4348     printf("%d\n", (int)sizeof($fpostype));
4349     exit(0);
4350 }
4351 EOCP
4352                 set try
4353                 if eval $compile_ok; then
4354                         yyy=`./try`
4355                         dflt="$lseeksize"
4356                         case "$yyy" in
4357                         '')     echo " "
4358                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4359                                 ;;
4360                         *)      fpossize=$yyy
4361                                 echo " $fpossize bytes."
4362                                 ;;
4363                         esac
4364                 else
4365                         dflt="$fpossize"
4366                         echo " "
4367                         echo "(I can't compile the test program.  Guessing...)" >&4
4368                         rp="What is the size of your file positions (in bytes)?"
4369                         . ./myread
4370                         fpossize="$ans"
4371                 fi
4372                 $rm -f try.c try
4373         fi
4374         ;;
4375 esac
4376
4377
4378 case "$usemorebits" in
4379 "$define"|true|[yY]*)
4380         use64bits="$define"
4381         uselongdouble="$define"
4382         usemorebits="$define"
4383         ;;
4384 *)      usemorebits="$undef"
4385         ;;
4386 esac
4387
4388
4389 case "$intsize:$longsize" in
4390 8:*|*:8) cat <<EOM
4391
4392 You have natively 64-bit integers.
4393 EOM
4394    val="$define"
4395    ;;
4396 *) case "$ccflags" in
4397    *-DUSE_64_BITS*|*-DUSE_LONG_LONG*) use64bits="$define";;
4398    *) case "$uselonglong" in
4399       $define|true|[yY]*) use64bits="$define";;
4400       esac
4401       ;;
4402    esac
4403    case "$use64bits" in
4404    $define|true|[yY]*) dflt='y';;
4405    *) dflt='n';;
4406    esac
4407 cat <<EOM
4408
4409 Perl can be built to take advantage of 64-bit integer types
4410 on some systems.  To do so, Configure must be run with -Duse64bits.
4411
4412 If this doesn't make any sense to you, just accept the default '$dflt'.
4413 EOM
4414    rp='Try to use 64-bit integers, if available?'
4415    . ./myread
4416    case "$ans" in
4417    [yY]*) val="$define" ;;
4418    *)     val="$undef"  ;;
4419    esac
4420    ;;
4421 esac
4422 set use64bits
4423 eval $setvar
4424
4425 case "$archname64" in
4426 '') archname64='' ;;    # not a typo
4427 esac
4428
4429 case "$use64bits" in
4430 "$define"|true|[yY]*)
4431 : Look for a hint-file generated 'call-back-unit'.  If the
4432 : user has specified that a 64-bit perl is to be built,
4433 : we may need to set or change some other defaults.
4434         if $test -f use64bits.cbu; then
4435                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4436                 . ./use64bits.cbu
4437         else
4438                 $cat <<EOM
4439 (Your platform doesn't have any specific hints for 64-bit builds.)
4440 EOM
4441                 case "$intsize:$longsize" in
4442 8:*|*:8) cat <<EOM
4443 (This is probably okay, as your system is a natively 64-bit system.)
4444 EOM
4445                   ;;
4446                 esac
4447                 case "$gccversion" in
4448                 '')     ;;
4449                 *)      case "$ccflags" in
4450                         *-DUSE_64_BITS*) ;;
4451                         *) $cat <<EOM
4452 But since you seem to be using gcc, I will now add -DUSE_64_BITS
4453 to the compilation flags to get long longs.
4454 EOM
4455                            ccflags="$ccflags -DUSE_64_BITS"
4456                            ;;
4457                         esac
4458                         ;;
4459                 esac
4460         fi
4461         ;;
4462 esac
4463
4464 : determine the architecture name
4465 echo " "
4466 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4467         tarch=`arch`"-$osname"
4468 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4469         if uname -m > tmparch 2>&1 ; then
4470                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4471                         -e 's/$/'"-$osname/" tmparch`
4472         else
4473                 tarch="$osname"
4474         fi
4475         $rm -f tmparch
4476 else
4477         tarch="$osname"
4478 fi
4479 case "$myarchname" in
4480 ''|"$tarch") ;;
4481 *)
4482         echo "(Your architecture name used to be $myarchname.)"
4483         archname=''
4484         ;;
4485 esac
4486 myarchname="$tarch"
4487 case "$archname" in
4488 '') dflt="$tarch";;
4489 *) dflt="$archname";;
4490 esac
4491 rp='What is your architecture name'
4492 . ./myread
4493 archname="$ans"
4494 case "$usethreads" in
4495 $define)
4496         echo "Threads selected." >&4
4497         case "$archname" in
4498         *-thread*) echo "...and architecture name already has -thread." >&4
4499                 ;;
4500         *)      archname="$archname-thread"
4501                 echo "...setting architecture name to $archname." >&4
4502                 ;;
4503         esac
4504         ;;
4505 esac
4506 case "$usemultiplicity" in
4507 $define)
4508         echo "Multiplicity selected." >&4
4509         case "$archname" in
4510         *-multi*) echo "...and architecture name already has -multi." >&4
4511                 ;;
4512         *)      archname="$archname-multi"
4513                 echo "...setting architecture name to $archname." >&4
4514                 ;;
4515         esac
4516         ;;
4517 esac
4518 case "$use64bits" in
4519 $define)
4520         case "$archname64" in
4521         '')
4522                 ;;
4523         *)
4524                 case "$archname" in
4525                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4526                         ;;
4527                 *)      archname="$archname-$archname64"
4528                         echo "...setting architecture name to $archname." >&4
4529                         ;;
4530                 esac
4531                 ;;
4532         esac
4533 esac
4534
4535 : determine root of directory hierarchy where package will be installed.
4536 case "$prefix" in
4537 '')
4538         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4539         ;;
4540 *)
4541         dflt="$prefix"
4542         ;;
4543 esac
4544 $cat <<EOM
4545
4546 By default, $package will be installed in $dflt/bin, manual pages
4547 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4548 installation directories. Typically this is something like /usr/local.
4549 If you wish to have binaries under /usr/bin but other parts of the
4550 installation under /usr/local, that's ok: you will be prompted
4551 separately for each of the installation directories, the prefix being
4552 only used to set the defaults.
4553
4554 EOM
4555 fn=d~
4556 rp='Installation prefix to use?'
4557 . ./getfile
4558 oldprefix=''
4559 case "$prefix" in
4560 '') ;;
4561 *)
4562         case "$ans" in
4563         "$prefix") ;;
4564         *) oldprefix="$prefix";;
4565         esac
4566         ;;
4567 esac
4568 prefix="$ans"
4569 prefixexp="$ansexp"
4570
4571 : is AFS running?
4572 echo " "
4573 case "$afs" in
4574 $define|true)   afs=true ;;
4575 $undef|false)   afs=false ;;
4576 *)      if test -d /afs; then
4577                 afs=true
4578         else
4579                 afs=false
4580         fi
4581         ;;
4582 esac
4583 if $afs; then
4584         echo "AFS may be running... I'll be extra cautious then..." >&4
4585 else
4586         echo "AFS does not seem to be running..." >&4
4587 fi
4588
4589 : determine installation prefix for where package is to be installed.
4590 if $afs; then 
4591 $cat <<EOM
4592
4593 Since you are running AFS, I need to distinguish the directory in which
4594 files will reside from the directory in which they are installed (and from
4595 which they are presumably copied to the former directory by occult means).
4596
4597 EOM
4598         case "$installprefix" in
4599         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4600         *) dflt="$installprefix";;
4601         esac
4602 else
4603 $cat <<EOM
4604
4605 In some special cases, particularly when building $package for distribution,
4606 it is convenient to distinguish between the directory in which files should 
4607 be installed from the directory ($prefix) in which they 
4608 will eventually reside.  For most users, these two directories are the same.
4609
4610 EOM
4611         case "$installprefix" in
4612         '') dflt=$prefix ;;
4613         *) dflt=$installprefix;;
4614         esac
4615 fi
4616 fn=d~
4617 rp='What installation prefix should I use for installing files?'
4618 . ./getfile
4619 installprefix="$ans"
4620 installprefixexp="$ansexp"
4621
4622 : set the prefixit variable, to compute a suitable default value
4623 prefixit='case "$3" in
4624 ""|none)
4625         case "$oldprefix" in
4626         "") eval "$1=\"\$$2\"";;
4627         *)
4628                 case "$3" in
4629                 "") eval "$1=";;
4630                 none)
4631                         eval "tp=\"\$$2\"";
4632                         case "$tp" in
4633                         ""|" ") eval "$1=\"\$$2\"";;
4634                         *) eval "$1=";;
4635                         esac;;
4636                 esac;;
4637         esac;;
4638 *)
4639         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4640         case "$tp" in
4641         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4642         /*-$oldprefix/*|\~*-$oldprefix/*)
4643                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4644         *) eval "$1=\"\$$2\"";;
4645         esac;;
4646 esac'
4647
4648 : set the base revision
4649 baserev=5.0
4650
4651
4652 : get the patchlevel
4653 echo " "
4654 echo "Getting the current patchlevel..." >&4
4655 if $test -r $rsrc/patchlevel.h;then
4656         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4657         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4658         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4659         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4660         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4661 else
4662         patchlevel=0
4663         subversion=0
4664         api_revision=0
4665         api_version=0
4666         api_subversion=0
4667 fi
4668 $echo $n "(You have $package" $c
4669 case "$package" in
4670 "*$baserev")    ;;
4671 *)              $echo $n " $baserev" $c ;;
4672 esac
4673 $echo $n " patchlevel $patchlevel" $c
4674 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4675 echo ".)"
4676 case "$osname" in
4677 dos|vms)
4678         : XXX Should be a Configure test for double-dots in filenames.
4679         version=`echo $baserev $patchlevel $subversion | \
4680                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4681         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4682                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4683         ;;
4684 *)
4685         version=`echo $baserev $patchlevel $subversion | \
4686                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4687         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4688                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4689         ;;
4690 esac
4691 : Special case the 5.005_xx maintenance series, which used 5.005
4692 : without any subversion label as a subdirectory in $sitelib
4693 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4694         api_versionstring='5.005'
4695 fi
4696
4697 : determine installation style
4698 : For now, try to deduce it from prefix unless it is already set.
4699 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4700 case "$installstyle" in
4701 '')     case "$prefix" in
4702                 *perl*) dflt='lib';;
4703                 *) dflt='lib/perl5' ;;
4704         esac
4705         ;;
4706 *)      dflt='lib/perl5' ;;
4707 esac
4708 : Probably not worth prompting for this since we prompt for all
4709 : the directories individually, and the prompt would be too long and
4710 : confusing anyway.
4711 installstyle=$dflt
4712
4713 : determine where private library files go
4714 : Usual default is /usr/local/lib/perl5/$version.
4715 : Also allow things like /opt/perl/lib/$version, since 
4716 : /opt/perl/lib/perl5... would be redundant.
4717 : The default "style" setting is made in installstyle.U
4718 case "$installstyle" in
4719 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4720 *)       set dflt privlib lib/$version ;;
4721 esac
4722 eval $prefixit
4723 $cat <<EOM
4724
4725 There are some auxiliary files for $package that need to be put into a
4726 private library directory that is accessible by everyone.
4727
4728 EOM
4729 fn=d~+
4730 rp='Pathname where the private library files will reside?'
4731 . ./getfile
4732 privlib="$ans"
4733 privlibexp="$ansexp"
4734 : Change installation prefix, if necessary.
4735 if $test X"$prefix" != X"$installprefix"; then
4736         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4737 else
4738         installprivlib="$privlibexp"
4739 fi
4740
4741 : set the prefixup variable, to restore leading tilda escape
4742 prefixup='case "$prefixexp" in
4743 "$prefix") ;;
4744 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4745 esac'
4746
4747 : determine where public architecture dependent libraries go
4748 set archlib archlib
4749 eval $prefixit
4750 : privlib default is /usr/local/lib/$package/$version
4751 : archlib default is /usr/local/lib/$package/$version/$archname
4752 : privlib may have an optional trailing /share.
4753 tdflt=`echo $privlib | $sed 's,/share$,,'`
4754 tdflt=$tdflt/$archname
4755 case "$archlib" in
4756 '')     dflt=$tdflt
4757         ;;
4758 *)      dflt="$archlib"
4759     ;;
4760 esac
4761 $cat <<EOM
4762
4763 $spackage contains architecture-dependent library files.  If you are
4764 sharing libraries in a heterogeneous environment, you might store
4765 these files in a separate location.  Otherwise, you can just include
4766 them with the rest of the public library files.
4767
4768 EOM
4769 fn=d+~
4770 rp='Where do you want to put the public architecture-dependent libraries?'
4771 . ./getfile
4772 archlib="$ans"
4773 archlibexp="$ansexp"
4774 if $test X"$archlib" = X"$privlib"; then
4775         d_archlib="$undef"
4776 else
4777         d_archlib="$define"
4778 fi
4779 : Change installation prefix, if necessary.
4780 if $test X"$prefix" != X"$installprefix"; then
4781         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4782 else
4783         installarchlib="$archlibexp"
4784 fi
4785
4786
4787 : Binary compatibility with 5.005 is not possible for builds
4788 : with advanced features
4789 case "$usethreads$usemultiplicity" in
4790 *define*)
4791         bincompat5005="$undef"
4792         d_bincompat5005="$undef"
4793         ;;
4794 *)      $cat <<EOM
4795
4796 Perl 5.006 can be compiled for binary compatibility with 5.005.
4797 If you decide to do so, you will be able to continue using most
4798 of the extensions that were compiled for Perl 5.005.
4799
4800 EOM
4801         case "$bincompat5005$d_bincompat5005" in
4802         *"$undef"*) dflt=n ;;
4803         *) dflt=y ;;
4804         esac
4805         rp='Binary compatibility with Perl 5.005?'
4806         . ./myread
4807         case "$ans" in
4808         y*) val="$define" ;;
4809         *)  val="$undef" ;;
4810         esac
4811         set d_bincompat5005
4812         eval $setvar
4813         case "$d_bincompat5005" in
4814         "$define")
4815                 bincompat5005="$define"
4816                 ;;
4817         *)      bincompat5005="$undef"
4818                 d_bincompat5005="$undef"
4819                 ;;
4820         esac
4821         ;;
4822 esac
4823
4824
4825 : see if setuid scripts can be secure
4826 $cat <<EOM
4827
4828 Some kernels have a bug that prevents setuid #! scripts from being
4829 secure.  Some sites have disabled setuid #! scripts because of this.
4830
4831 First let's decide if your kernel supports secure setuid #! scripts.
4832 (If setuid #! scripts would be secure but have been disabled anyway,
4833 don't say that they are secure if asked.)
4834
4835 EOM
4836
4837 val="$undef"
4838 if $test -d /dev/fd; then
4839         echo "#!$ls" >reflect
4840         chmod +x,u+s reflect
4841         ./reflect >flect 2>&1
4842         if $contains "/dev/fd" flect >/dev/null; then
4843                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4844                 val="$define"
4845         else
4846                 $cat <<EOM
4847 If you are not sure if they are secure, I can check but I'll need a
4848 username and password different from the one you are using right now.
4849 If you don't have such a username or don't want me to test, simply
4850 enter 'none'.
4851
4852 EOM
4853                 rp='Other username to test security of setuid scripts with?'
4854                 dflt='none'
4855                 . ./myread
4856                 case "$ans" in
4857                 n|none)
4858                         case "$d_suidsafe" in
4859                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4860                                 dflt=n;;
4861                         "$undef")
4862                                 echo "Well, the $hint value is *not* secure." >&4
4863                                 dflt=n;;
4864                         *)      echo "Well, the $hint value *is* secure." >&4
4865                                 dflt=y;;
4866                         esac
4867                         ;;
4868                 *)
4869                         $rm -f reflect flect
4870                         echo "#!$ls" >reflect
4871                         chmod +x,u+s reflect
4872                         echo >flect
4873                         chmod a+w flect
4874                         echo '"su" will (probably) prompt you for '"$ans's password."
4875                         su $ans -c './reflect >flect'
4876                         if $contains "/dev/fd" flect >/dev/null; then
4877                                 echo "Okay, it looks like setuid scripts are secure." >&4
4878                                 dflt=y
4879                         else
4880                                 echo "I don't think setuid scripts are secure." >&4
4881                                 dflt=n
4882                         fi
4883                         ;;
4884                 esac
4885                 rp='Does your kernel have *secure* setuid scripts?'
4886                 . ./myread
4887                 case "$ans" in
4888                 [yY]*)  val="$define";;
4889                 *)      val="$undef";;
4890                 esac
4891         fi
4892 else
4893         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4894         echo "(That's for file descriptors, not floppy disks.)"
4895         val="$undef"
4896 fi
4897 set d_suidsafe
4898 eval $setvar
4899
4900 $rm -f reflect flect
4901
4902 : now see if they want to do setuid emulation
4903 echo " "
4904 val="$undef"
4905 case "$d_suidsafe" in
4906 "$define")
4907         val="$undef"
4908         echo "No need to emulate SUID scripts since they are secure here." >& 4
4909         ;;
4910 *)
4911         $cat <<EOM
4912 Some systems have disabled setuid scripts, especially systems where
4913 setuid scripts cannot be secure.  On systems where setuid scripts have
4914 been disabled, the setuid/setgid bits on scripts are currently
4915 useless.  It is possible for $package to detect those bits and emulate
4916 setuid/setgid in a secure fashion.  This emulation will only work if
4917 setuid scripts have been disabled in your kernel.
4918
4919 EOM
4920         case "$d_dosuid" in
4921         "$define") dflt=y ;;
4922         *) dflt=n ;;
4923         esac
4924         rp="Do you want to do setuid/setgid emulation?"
4925         . ./myread
4926         case "$ans" in
4927         [yY]*)  val="$define";;
4928         *)      val="$undef";;
4929         esac
4930         ;;
4931 esac
4932 set d_dosuid
4933 eval $setvar
4934
4935 : determine filename position in cpp output
4936 echo " "
4937 echo "Computing filename position in cpp output for #include directives..." >&4
4938 echo '#include <stdio.h>' > foo.c
4939 $cat >fieldn <<EOF
4940 $startsh
4941 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4942 $grep '^[       ]*#.*stdio\.h' | \
4943 while read cline; do
4944         pos=1
4945         set \$cline
4946         while $test \$# -gt 0; do
4947                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4948                         echo "\$pos"
4949                         exit 0
4950                 fi
4951                 shift
4952                 pos=\`expr \$pos + 1\`
4953         done
4954 done
4955 EOF
4956 chmod +x fieldn
4957 fieldn=`./fieldn`
4958 $rm -f foo.c fieldn
4959 case $fieldn in
4960 '') pos='???';;
4961 1) pos=first;;
4962 2) pos=second;;
4963 3) pos=third;;
4964 *) pos="${fieldn}th";;
4965 esac
4966 echo "Your cpp writes the filename in the $pos field of the line."
4967
4968 : locate header file
4969 $cat >findhdr <<EOF
4970 $startsh
4971 wanted=\$1
4972 name=''
4973 for usrincdir in $usrinc
4974 do
4975         if test -f \$usrincdir/\$wanted; then
4976                 echo "\$usrincdir/\$wanted"
4977                 exit 0
4978         fi
4979 done
4980 awkprg='{ print \$$fieldn }'
4981 echo "#include <\$wanted>" > foo\$\$.c
4982 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4983 $grep "^[       ]*#.*\$wanted" | \
4984 while read cline; do
4985         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4986         case "\$name" in
4987         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4988         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4989         *) exit 2;;
4990         esac;
4991 done;
4992 #
4993 # status = 0: grep returned 0 lines, case statement not executed
4994 # status = 1: headerfile found
4995 # status = 2: while loop executed, no headerfile found
4996 #
4997 status=\$?
4998 $rm -f foo\$\$.c;
4999 if test \$status -eq 1; then
5000         exit 0;
5001 fi
5002 exit 1
5003 EOF
5004 chmod +x findhdr
5005
5006 : define an alternate in-header-list? function
5007 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5008 cont=true; xxf="echo \"<\$1> found.\" >&4";
5009 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5010 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5011 esac;
5012 case $# in 4) instead=instead;; *) instead="at last";; esac;
5013 while $test "$cont"; do
5014         xxx=`./findhdr $1`
5015         var=$2; eval "was=\$$2";
5016         if $test "$xxx" && $test -r "$xxx";
5017         then eval $xxf;
5018         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5019                 cont="";
5020         else eval $xxnf;
5021         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5022         set $yyy; shift; shift; yyy=$@;
5023         case $# in 0) cont="";;
5024         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5025                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5026         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5027                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5028         esac;
5029 done;
5030 while $test "$yyy";
5031 do set $yyy; var=$2; eval "was=\$$2";
5032         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5033         set $yyy; shift; shift; yyy=$@;
5034 done'
5035
5036 : see if this is a malloc.h system
5037 set malloc.h i_malloc
5038 eval $inhdr
5039
5040 : see if stdlib is available
5041 set stdlib.h i_stdlib
5042 eval $inhdr
5043
5044 : determine which malloc to compile in
5045 echo " "
5046 case "$usemymalloc" in
5047 ''|[yY]*|true|$define)  dflt='y' ;;
5048 *)      dflt='n' ;;
5049 esac
5050 rp="Do you wish to attempt to use the malloc that comes with $package?"
5051 . ./myread
5052 usemymalloc="$ans"
5053 case "$ans" in
5054 y*|true)
5055         usemymalloc='y'
5056         mallocsrc='malloc.c'
5057         mallocobj="malloc$_o"
5058         d_mymalloc="$define"
5059         case "$libs" in
5060         *-lmalloc*)
5061                 : Remove malloc from list of libraries to use
5062                 echo "Removing unneeded -lmalloc from library list" >&4
5063                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5064                 shift
5065                 libs="$*"
5066                 echo "libs = $libs" >&4
5067                 ;;
5068         esac
5069         ;;
5070 *)
5071         usemymalloc='n'
5072         mallocsrc=''
5073         mallocobj=''
5074         d_mymalloc="$undef"
5075         ;;
5076 esac
5077
5078 : compute the return types of malloc and free
5079 echo " "
5080 $cat >malloc.c <<END
5081 #$i_malloc I_MALLOC
5082 #$i_stdlib I_STDLIB
5083 #include <stdio.h>
5084 #include <sys/types.h>
5085 #ifdef I_MALLOC
5086 #include <malloc.h>
5087 #endif
5088 #ifdef I_STDLIB
5089 #include <stdlib.h>
5090 #endif
5091 #ifdef TRY_MALLOC
5092 void *malloc();
5093 #endif
5094 #ifdef TRY_FREE
5095 void free();
5096 #endif
5097 END
5098 case "$malloctype" in
5099 '')
5100         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5101                 malloctype='void *'
5102         else
5103                 malloctype='char *'
5104         fi
5105         ;;
5106 esac
5107 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5108
5109 case "$freetype" in
5110 '')
5111         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5112                 freetype='void'
5113         else
5114                 freetype='int'
5115         fi
5116         ;;
5117 esac
5118 echo "Your system uses $freetype free(), it would seem." >&4
5119 $rm -f malloc.[co]
5120 $cat <<EOM
5121
5122 The installation process will also create a directory for
5123 vendor-supplied add-ons.  Vendors who supply perl with their system
5124 may find it convenient to place all vendor-supplied files in this
5125 directory rather than in the main distribution directory.  This will
5126 ease upgrades between binary-compatible maintenance versions of perl.
5127
5128 Of course you may also use these directories in whatever way you see
5129 fit.  For example, you might use them to access modules shared over a
5130 company-wide network.
5131
5132 The default answer should be fine for most people.
5133 This causes further questions about vendor add-ons to be skipped
5134 and no vendor-specific directories will be configured for perl.
5135
5136 EOM
5137 rp='Do you want to configure vendor-specific add-on directories?'
5138 case "$usevendorprefix" in
5139 define|true|[yY]*) dflt=y ;;
5140 *) dflt=n ;;
5141 esac
5142 . ./myread
5143 case "$ans" in
5144 [yY]*)  fn=d~+
5145         rp='Installation prefix to use for vendor-supplied add-ons?'
5146         case "$vendorprefix" in
5147         '') dflt='' ;;
5148         *)  dflt=$vendorprefix ;;
5149         esac
5150         . ./getfile
5151         oldvendorprefix=''
5152         case "$vendorprefix" in
5153         '') ;;
5154         *)      case "$ans" in
5155                 "$prefix") ;;
5156                 *) oldvendorprefix="$prefix";;
5157                 esac
5158                 ;;
5159         esac
5160         usevendorprefix="$define"
5161         vendorprefix="$ans"
5162         vendorprefixexp="$ansexp"
5163         ;;
5164 *)      usevendorprefix="$undef"
5165         vendorprefix=''
5166         vendorprefixexp=''
5167         ;;
5168 esac
5169
5170 case "$vendorprefix" in
5171 '')     d_vendorlib="$undef"
5172         vendorlib=''
5173         vendorlibexp=''
5174         ;;
5175 *)      d_vendorlib="$define"
5176         : determine where vendor-supplied modules go.
5177         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5178         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5179         case "$installstyle" in
5180         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5181         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5182         esac
5183         fn=d~+
5184         rp='Pathname for the vendor-supplied library files?'
5185         . ./getfile
5186         vendorlib="$ans"
5187         vendorlibexp="$ansexp"
5188         : Change installation prefix, if necessary.
5189         if $test X"$prefix" != X"$installprefix"; then
5190                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5191         else
5192                 installvendorlib="$vendorlibexp"
5193         fi
5194         ;;
5195 esac
5196
5197 : Cruising for prototypes
5198 echo " "
5199 echo "Checking out function prototypes..." >&4
5200 $cat >prototype.c <<'EOCP'
5201 int main(int argc, char *argv[]) {
5202         exit(0);}
5203 EOCP
5204 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5205         echo "Your C compiler appears to support function prototypes."
5206         val="$define"
5207 else
5208         echo "Your C compiler doesn't seem to understand function prototypes."
5209         val="$undef"
5210 fi
5211 set prototype
5212 eval $setvar
5213 $rm -f prototype*
5214
5215 case "$prototype" in
5216 "$define") ;;
5217 *)      ansi2knr='ansi2knr'
5218         echo " "
5219         cat <<EOM >&4
5220
5221 $me:  FATAL ERROR:
5222 This version of $package can only be compiled by a compiler that 
5223 understands function prototypes.  Unfortunately, your C compiler 
5224         $cc $ccflags
5225 doesn't seem to understand them.  Sorry about that.
5226
5227 If GNU cc is available for your system, perhaps you could try that instead.  
5228
5229 Eventually, we hope to support building Perl with pre-ANSI compilers.
5230 If you would like to help in that effort, please contact <perlbug@perl.org>.
5231
5232 Aborting Configure now.
5233 EOM
5234         exit 2
5235         ;;
5236 esac
5237
5238 : determine where public executables go
5239 echo " "
5240 set dflt bin bin
5241 eval $prefixit
5242 fn=d~
5243 rp='Pathname where the public executables will reside?'
5244 . ./getfile
5245 if $test "X$ansexp" != "X$binexp"; then
5246         installbin=''
5247 fi
5248 bin="$ans"
5249 binexp="$ansexp"
5250 : Change installation prefix, if necessary.
5251 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5252 if $test X"$prefix" != X"$installprefix"; then
5253         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5254 else
5255         installbin="$binexp"
5256 fi
5257
5258 $cat <<EOM
5259
5260 After $package is installed, you may wish to install various
5261 add-on modules and utilities.  Typically, these add-ons will
5262 be installed under $prefix with the rest
5263 of this package.  However, you may wish to install such add-ons
5264 elsewhere under a different prefix.
5265
5266 If you do not wish to put everything under a single prefix, that's
5267 ok.  You will be prompted for the individual locations; this siteprefix
5268 is only used to suggest the defaults.
5269
5270 The default should be fine for most people.
5271
5272 EOM
5273 fn=d~+
5274 rp='Installation prefix to use for add-on modules and utilities?'
5275 : XXX Here might be another good place for an installstyle setting.
5276 case "$siteprefix" in
5277 '') dflt=$prefix ;;
5278 *)  dflt=$siteprefix ;;
5279 esac
5280 . ./getfile
5281 oldsiteprefix=''
5282 case "$siteprefix" in
5283 '') ;;
5284 *)
5285         case "$ans" in
5286         "$prefix") ;;
5287         *) oldsiteprefix="$prefix";;
5288         esac
5289         ;;
5290 esac
5291 siteprefix="$ans"
5292 siteprefixexp="$ansexp"
5293
5294 : determine where site specific libraries go.
5295 : Usual default is /usr/local/lib/perl5/site_perl/$version
5296 : The default "style" setting is made in installstyle.U
5297 : XXX No longer works with Prefixit stuff.
5298 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5299 case "$installstyle" in
5300 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5301 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5302 esac
5303 $cat <<EOM
5304
5305 The installation process will create a directory for
5306 site-specific extensions and modules.  Most users find it convenient
5307 to place all site-specific files in this directory rather than in the
5308 main distribution directory.
5309
5310 EOM
5311 fn=d~+
5312 rp='Pathname for the site-specific library files?'
5313 . ./getfile
5314 sitelib="$ans"
5315 sitelibexp="$ansexp"
5316 : Change installation prefix, if necessary.
5317 if $test X"$prefix" != X"$installprefix"; then
5318         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5319 else
5320         installsitelib="$sitelibexp"
5321 fi
5322
5323 : Determine list of previous versions to include in @INC
5324 $cat > getverlist <<EOPL
5325 #!$perl -w
5326 use File::Basename;
5327 \$api_versionstring = "$api_versionstring";
5328 \$version = "$version";
5329 \$sitelib = "$sitelib";
5330 \$archname = "$archname";
5331 EOPL
5332         $cat >> getverlist <<'EOPL'
5333 # Can't have leading @ because metaconfig interprets it as a command!
5334 ;@inc_version_list=();
5335 $stem=dirname($sitelib);
5336 # Redo to do opendir/readdir? 
5337 if (-d $stem) {
5338     chdir($stem);
5339     ;@candidates = glob("5.*");
5340 }
5341 else {
5342     ;@candidates = ();
5343 }
5344
5345 # XXX ToDo:  These comparisons must be reworked when two-digit
5346 # subversions come along, so that 5.7.10 compares as greater than
5347 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5348 # widespread that we can use the built-in version vectors rather
5349 # than reinventing them here.  For 5.6.0, however, we must
5350 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5351 foreach $d (@candidates) {
5352     if ($d lt $version) {
5353         if ($d ge $api_versionstring) {
5354             unshift(@inc_version_list, "$d/$archname", $d);
5355         }
5356         elsif ($d ge "5.005") {
5357             unshift(@inc_version_list, $d);
5358         }
5359     }
5360     else {
5361         # Skip newer version.  I.e. don't look in
5362         # 5.7.0 if we're installing 5.6.1.
5363     }
5364 }
5365
5366 if (@inc_version_list) {
5367     print join(' ', @inc_version_list);
5368 }
5369 else {
5370     # Blank space to preserve value for next Configure run.
5371     print " ";
5372 }
5373 EOPL
5374 chmod +x getverlist
5375 case "$inc_version_list" in
5376 '')     if test -x $perl; then
5377                 dflt=`$perl getverlist`
5378         else
5379                 dflt='none'
5380         fi
5381         ;;
5382 $undef) dflt='none' ;;
5383 *)  dflt="$inc_version_list" ;;
5384 esac
5385 $cat <<'EOM'
5386
5387 In order to ease the process of upgrading, this version of perl 
5388 can be configured to use modules built and installed with earlier 
5389 versions of perl that were installed under $prefix.  Specify here
5390 the list of earlier versions that this version of perl should check.
5391 If Configure detected no earlier versions of perl installed under
5392 $prefix, then the list will be empty.  Answer 'none' to tell perl
5393 to not search earlier versions.
5394
5395 The default should almost always be sensible, so if you're not sure,
5396 just accept the default.
5397 EOM
5398
5399 rp='List of earlier versions to include in @INC?'
5400 . ./myread
5401 case "$ans" in
5402 [Nn]one) inc_version_list=' ' ;;
5403 *) inc_version_list="$ans" ;;
5404 esac
5405 case "$inc_version_list" in
5406 ''|' ') 
5407         inc_version_list_init='0';;
5408 *)      inc_version_list_init=`echo $inc_version_list |
5409                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5410         ;;
5411 esac
5412 $rm -f getverlist
5413
5414 : determine whether to install perl also as /usr/bin/perl
5415
5416 echo " "
5417 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5418         $cat <<EOM
5419 Many scripts expect to perl to be installed as /usr/bin/perl.
5420 I can install the perl you are about to compile also as /usr/bin/perl
5421 (in addition to $installbin/perl).
5422 EOM
5423         case "$installusrbinperl" in
5424         "$undef"|[nN]*) dflt='n';;
5425         *)              dflt='y';;
5426         esac
5427         rp="Do you want to install perl as /usr/bin/perl?"
5428         . ./myread
5429         case "$ans" in
5430         [yY]*)  val="$define";;
5431         *)      val="$undef" ;;
5432         esac
5433 else
5434         val="$undef"
5435 fi
5436 set installusrbinperl
5437 eval $setvar
5438
5439 echo " "
5440 echo "Checking for GNU C Library..." >&4
5441 cat >gnulibc.c <<EOM
5442 #include <stdio.h>
5443 int main()
5444 {
5445 #ifdef __GLIBC__
5446     exit(0);
5447 #else
5448     exit(1);
5449 #endif
5450 }
5451 EOM
5452 set gnulibc
5453 if eval $compile_ok && ./gnulibc; then
5454         val="$define"
5455         echo "You are using the GNU C Library"
5456 else
5457         val="$undef"
5458         echo "You are not using the GNU C Library"
5459 fi
5460 $rm -f gnulibc*
5461 set d_gnulibc
5462 eval $setvar
5463
5464 : see if nm is to be used to determine whether a symbol is defined or not
5465 case "$usenm" in
5466 '')
5467         dflt=''
5468         case "$d_gnulibc" in
5469         "$define")
5470                 echo " "
5471                 echo "nm probably won't work on the GNU C Library." >&4
5472                 dflt=n
5473                 ;;
5474         esac
5475         case "$dflt" in
5476         '') 
5477                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5478                         echo " "
5479                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5480                         echo "'nm' won't be sufficient on this sytem." >&4
5481                         dflt=n
5482                 fi
5483                 ;;
5484         esac
5485         case "$dflt" in
5486         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5487                 if $test $dflt -gt 20; then
5488                         dflt=y
5489                 else
5490                         dflt=n
5491                 fi
5492                 ;;
5493         esac
5494         ;;
5495 *)
5496         case "$usenm" in
5497         true|$define) dflt=y;;
5498         *) dflt=n;;
5499         esac
5500         ;;
5501 esac
5502 $cat <<EOM
5503
5504 I can use $nm to extract the symbols from your C libraries. This
5505 is a time consuming task which may generate huge output on the disk (up
5506 to 3 megabytes) but that should make the symbols extraction faster. The
5507 alternative is to skip the 'nm' extraction part and to compile a small
5508 test program instead to determine whether each symbol is present. If
5509 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5510 this may be the best solution.
5511
5512 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5513
5514 EOM
5515 rp="Shall I use $nm to extract C symbols from the libraries?"
5516 . ./myread
5517 case "$ans" in
5518 [Nn]*) usenm=false;;
5519 *) usenm=true;;
5520 esac
5521
5522 runnm=$usenm
5523 case "$reuseval" in
5524 true) runnm=false;;
5525 esac
5526
5527 : nm options which may be necessary
5528 case "$nm_opt" in
5529 '') if $test -f /mach_boot; then
5530                 nm_opt=''       # Mach
5531         elif $test -d /usr/ccs/lib; then
5532                 nm_opt='-p'     # Solaris (and SunOS?)
5533         elif $test -f /dgux; then
5534                 nm_opt='-p'     # DG-UX
5535         elif $test -f /lib64/rld; then
5536                 nm_opt='-p'     # 64-bit Irix
5537         else
5538                 nm_opt=''
5539         fi;;
5540 esac
5541
5542 : nm options which may be necessary for shared libraries but illegal
5543 : for archive libraries.  Thank you, Linux.
5544 case "$nm_so_opt" in
5545 '')     case "$myuname" in
5546         *linux*)
5547                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5548                         nm_so_opt='--dynamic'
5549                 fi
5550                 ;;
5551         esac
5552         ;;
5553 esac
5554
5555 case "$runnm" in
5556 true)
5557 : get list of predefined functions in a handy place
5558 echo " "
5559 case "$libc" in
5560 '') libc=unknown
5561         case "$libs" in
5562         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5563         esac
5564         ;;
5565 esac
5566 libnames='';
5567 case "$libs" in
5568 '') ;;
5569 *)  for thislib in $libs; do
5570         case "$thislib" in
5571         -lc|-lc_s)
5572                 : Handle C library specially below.
5573                 ;;
5574         -l*)
5575                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5576                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5577                         :
5578                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5579                         :
5580                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5581                         :
5582                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5583                         :
5584                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5585                         :
5586                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5587                         :
5588                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5589                         :
5590                 else
5591                         try=''
5592                 fi
5593                 libnames="$libnames $try"
5594                 ;;
5595         *) libnames="$libnames $thislib" ;;
5596         esac
5597         done
5598         ;;
5599 esac
5600 xxx=normal
5601 case "$libc" in
5602 unknown)
5603         set /lib/libc.$so
5604         for xxx in $libpth; do
5605                 $test -r $1 || set $xxx/libc.$so
5606                 : The messy sed command sorts on library version numbers.
5607                 $test -r $1 || \
5608                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5609                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5610                                 h
5611                                 s/[0-9][0-9]*/0000&/g
5612                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5613                                 G
5614                                 s/\n/ /' | \
5615                          sort | $sed -e 's/^.* //'`
5616                 eval set \$$#
5617         done
5618         $test -r $1 || set /usr/ccs/lib/libc.$so
5619         $test -r $1 || set /lib/libsys_s$_a
5620         ;;
5621 *)
5622         set blurfl
5623         ;;
5624 esac
5625 if $test -r "$1"; then
5626         echo "Your (shared) C library seems to be in $1."
5627         libc="$1"
5628 elif $test -r /lib/libc && $test -r /lib/clib; then
5629         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5630         xxx=apollo
5631         libc='/lib/clib /lib/libc'
5632         if $test -r /lib/syslib; then
5633                 echo "(Your math library is in /lib/syslib.)"
5634                 libc="$libc /lib/syslib"
5635         fi
5636 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5637         echo "Your C library seems to be in $libc, as you said before."
5638 elif $test -r $incpath/usr/lib/libc$_a; then
5639         libc=$incpath/usr/lib/libc$_a;
5640         echo "Your C library seems to be in $libc.  That's fine."
5641 elif $test -r /lib/libc$_a; then
5642         libc=/lib/libc$_a;
5643         echo "Your C library seems to be in $libc.  You're normal."
5644 else
5645         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5646                 :
5647         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5648                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5649         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5650                 :
5651         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5652                 :
5653         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5654                 :
5655         else
5656                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5657         fi
5658         if $test -r "$tans"; then
5659                 echo "Your C library seems to be in $tans, of all places."
5660                 libc=$tans
5661         else
5662                 libc='blurfl'
5663         fi
5664 fi
5665 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5666         dflt="$libc"
5667         cat <<EOM
5668
5669 If the guess above is wrong (which it might be if you're using a strange
5670 compiler, or your machine supports multiple models), you can override it here.
5671
5672 EOM
5673 else
5674         dflt=''
5675         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5676         cat >&4 <<EOM
5677 I can't seem to find your C library.  I've looked in the following places:
5678
5679 EOM
5680         $sed 's/^/      /' libpath
5681         cat <<EOM
5682
5683 None of these seems to contain your C library. I need to get its name...
5684
5685 EOM
5686 fi
5687 fn=f
5688 rp='Where is your C library?'
5689 . ./getfile
5690 libc="$ans"
5691
5692 echo " "
5693 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5694 set X `cat libnames`
5695 shift
5696 xxx=files
5697 case $# in 1) xxx=file; esac
5698 echo "Extracting names from the following $xxx for later perusal:" >&4
5699 echo " "
5700 $sed 's/^/      /' libnames >&4
5701 echo " "
5702 $echo $n "This may take a while...$c" >&4
5703
5704 for file in $*; do
5705         case $file in
5706         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5707         *) $nm $nm_opt $file 2>/dev/null;;
5708         esac
5709 done >libc.tmp
5710
5711 $echo $n ".$c"
5712 $grep fprintf libc.tmp > libc.ptf
5713 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5714 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5715 xxx='[ADTSIW]'
5716 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5717         eval $xscan;\
5718         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719                 eval $xrun
5720 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5721         eval $xscan;\
5722         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723                 eval $xrun
5724 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5741                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5750         eval $xscan;\
5751         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752                 eval $xrun
5753 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5754         eval $xscan;\
5755         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756                 eval $xrun
5757 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5758         eval $xscan;\
5759         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760                 eval $xrun
5761 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5762         eval $xscan;\
5763         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764                 eval $xrun
5765 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5766         eval $xscan;\
5767         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768                 eval $xrun
5769 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5770         eval $xscan;\
5771         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5772                 eval $xrun
5773 else
5774         $nm -p $* 2>/dev/null >libc.tmp
5775         $grep fprintf libc.tmp > libc.ptf
5776         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5777                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5778         then
5779                 nm_opt='-p'
5780                 eval $xrun
5781         else
5782                 echo " "
5783                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5784                 com=''
5785                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5786                         for thisname in $libnames $libc; do
5787                                 $ar t $thisname >>libc.tmp
5788                         done
5789                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5790                         echo "Ok." >&4
5791                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5792                         # Repeat libc to extract forwarders to DLL entries too
5793                         for thisname in $libnames $libc; do
5794                                 $ar tv $thisname >>libc.tmp
5795                                 # Revision 50 of EMX has bug in $ar.
5796                                 # it will not extract forwarders to DLL entries
5797                                 # Use emximp which will extract exactly them.
5798                                 emximp -o tmp.imp $thisname \
5799                                     2>/dev/null && \
5800                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5801                                     < tmp.imp >>libc.tmp
5802                                 $rm tmp.imp
5803                         done
5804                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5805                         echo "Ok." >&4
5806                 else
5807                         echo "$ar didn't seem to work right." >&4
5808                         echo "Maybe this is a Cray...trying bld instead..." >&4
5809                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5810                         then
5811                                 for thisname in $libnames; do
5812                                         bld t $libnames | \
5813                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5814                                         $ar t $thisname >>libc.tmp
5815                                 done
5816                                 echo "Ok." >&4
5817                         else
5818                                 echo "That didn't work either.  Giving up." >&4
5819                                 exit 1
5820                         fi
5821                 fi
5822         fi
5823 fi
5824 nm_extract="$com"
5825 if $test -f /lib/syscalls.exp; then
5826         echo " "
5827         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5828         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5829 fi
5830 ;;
5831 esac
5832 $rm -f libnames libpath
5833
5834 : see if dld is available
5835 set dld.h i_dld
5836 eval $inhdr
5837
5838 : is a C symbol defined?
5839 csym='tlook=$1;
5840 case "$3" in
5841 -v) tf=libc.tmp; tc=""; tdc="";;
5842 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5843 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5844 esac;
5845 tx=yes;
5846 case "$reuseval-$4" in
5847 true-) ;;
5848 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5849 esac;
5850 case "$tx" in
5851 yes)
5852         case "$runnm" in
5853         true)
5854                 if $contains $tlook $tf >/dev/null 2>&1;
5855                 then tval=true;
5856                 else tval=false;
5857                 fi;;
5858         *)
5859                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5860                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5861                 then tval=true;
5862                 else tval=false;
5863                 fi;
5864                 $rm -f t t.c;;
5865         esac;;
5866 *)
5867         case "$tval" in
5868         $define) tval=true;;
5869         *) tval=false;;
5870         esac;;
5871 esac;
5872 eval "$2=$tval"'
5873
5874 : define an is-in-libc? function
5875 inlibc='echo " "; td=$define; tu=$undef;
5876 sym=$1; var=$2; eval "was=\$$2";
5877 tx=yes;
5878 case "$reuseval$was" in
5879 true) ;;
5880 true*) tx=no;;
5881 esac;
5882 case "$tx" in
5883 yes)
5884         set $sym tres -f;
5885         eval $csym;
5886         case "$tres" in
5887         true)
5888                 echo "$sym() found." >&4;
5889                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5890         *)
5891                 echo "$sym() NOT found." >&4;
5892                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5893         esac;;
5894 *)
5895         case "$was" in
5896         $define) echo "$sym() found." >&4;;
5897         *) echo "$sym() NOT found." >&4;;
5898         esac;;
5899 esac'
5900
5901 : see if dlopen exists
5902 xxx_runnm="$runnm"
5903 runnm=false
5904 set dlopen d_dlopen
5905 eval $inlibc
5906 runnm="$xxx_runnm"
5907
5908 : determine which dynamic loading, if any, to compile in
5909 echo " "
5910 dldir="ext/DynaLoader"
5911 case "$usedl" in
5912 $define|y|true)
5913         dflt='y'
5914         usedl="$define"
5915         ;;
5916 $undef|n|false)
5917         dflt='n'
5918         usedl="$undef"
5919         ;;
5920 *) 
5921         dflt='n'
5922         case "$d_dlopen" in
5923             $define) dflt='y' ;;
5924         esac
5925         case "$i_dld" in
5926             $define) dflt='y' ;;
5927         esac
5928         : Does a dl_xxx.xs file exist for this operating system
5929         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5930         ;;
5931 esac
5932 rp="Do you wish to use dynamic loading?"
5933 . ./myread
5934 usedl="$ans"
5935 case "$ans" in
5936 y*) usedl="$define"
5937         case "$dlsrc" in
5938         '')
5939                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5940                         dflt="$dldir/dl_${osname}.xs"
5941                 elif $test "$d_dlopen" = "$define" ; then
5942                         dflt="$dldir/dl_dlopen.xs"
5943                 elif $test "$i_dld" = "$define" ; then
5944                         dflt="$dldir/dl_dld.xs"
5945                 else
5946                         dflt=''
5947                 fi
5948                 ;;
5949         *)      dflt="$dldir/$dlsrc"
5950                 ;;
5951         esac
5952     echo "The following dynamic loading files are available:"
5953         : Can not go over to $dldir because getfile has path hard-coded in.
5954         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5955         rp="Source file to use for dynamic loading"
5956         fn="fne"
5957         gfpth="$src"
5958         . ./getfile
5959         usedl="$define"
5960         : emulate basename
5961         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5962
5963         $cat << EOM
5964
5965 Some systems may require passing special flags to $cc -c to
5966 compile modules that will be used to create a shared library.
5967 To use no flags, say "none".
5968
5969 EOM
5970     case "$cccdlflags" in
5971     '') case "$gccversion" in
5972                 '') case "$osname" in
5973                         hpux)   dflt='+z' ;;
5974                         next)   dflt='none' ;;
5975                         irix*)  dflt='-KPIC' ;;
5976                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5977                         sunos)  dflt='-pic' ;;
5978                         *)      dflt='none' ;;
5979                     esac
5980                         ;;
5981                 *)  case "$osname" in
5982                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5983                         *)      dflt='-fpic' ;;
5984                     esac ;;
5985             esac ;;
5986         ' ') dflt='none' ;;
5987     *)  dflt="$cccdlflags" ;;
5988     esac
5989     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5990     . ./myread
5991     case "$ans" in
5992     none) cccdlflags=' ' ;;
5993     *) cccdlflags="$ans" ;;
5994     esac
5995
5996     cat << EOM
5997
5998 Some systems use ld to create libraries that can be dynamically loaded,
5999 while other systems (such as those using ELF) use $cc.
6000
6001 EOM
6002         case "$ld" in
6003         '')     $cat >try.c <<'EOM'
6004 /* Test for whether ELF binaries are produced */
6005 #include <fcntl.h>
6006 #include <stdlib.h>
6007 int main() {
6008         char b[4];
6009         int i = open("a.out",O_RDONLY);
6010         if(i == -1) 
6011                 exit(1); /* fail */
6012         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6013                 exit(0); /* succeed (yes, it's ELF) */
6014         else
6015                 exit(1); /* fail */
6016 }
6017 EOM
6018                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6019                         cat <<EOM
6020 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6021 EOM
6022                         dflt="$cc"
6023                 else
6024                         echo "I'll use ld to build dynamic libraries."
6025                         dflt='ld'
6026                 fi
6027                 rm -f try.c a.out
6028                 ;;
6029         *)      dflt="$ld"
6030                 ;;
6031         esac
6032
6033     rp="What command should be used to create dynamic libraries?"
6034     . ./myread
6035         ld="$ans"
6036
6037     cat << EOM
6038
6039 Some systems may require passing special flags to $ld to create a
6040 library that can be dynamically loaded.  If your ld flags include
6041 -L/other/path options to locate libraries outside your loader's normal
6042 search path, you may need to specify those -L options here as well.  To
6043 use no flags, say "none".
6044
6045 EOM
6046     case "$lddlflags" in
6047     '') case "$osname" in
6048                         beos) dflt='-nostart' ;;
6049                         hpux)  dflt='-b +vnocompatwarnings' ;;
6050                         linux|irix*)    dflt='-shared' ;;
6051                         next)  dflt='none' ;;
6052                         solaris) dflt='-G' ;;
6053                         sunos) dflt='-assert nodefinitions' ;;
6054                         svr4*|esix*) dflt="-G $ldflags" ;;
6055                 *)     dflt='none' ;;
6056                         esac
6057                         ;;
6058     *) dflt="$lddlflags" ;;
6059     esac
6060
6061         : Try to guess additional flags to pick up local libraries.
6062         : Be careful not to append to a plain 'none'
6063         case "$dflt" in
6064         none) dflt='' ;;
6065         esac
6066         for thisflag in $ldflags; do
6067                 case "$thisflag" in
6068                 -L*)
6069                         case " $dflt " in
6070                         *" $thisflag "*) ;;
6071                         *) dflt="$dflt $thisflag" ;;
6072                         esac
6073                         ;;
6074                 esac
6075         done
6076
6077         case "$dflt" in
6078         ''|' ') dflt='none' ;;
6079         esac
6080
6081     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6082     . ./myread
6083     case "$ans" in
6084     none) lddlflags=' ' ;;
6085     *) lddlflags="$ans" ;;
6086     esac
6087
6088         cat <<EOM
6089
6090 Some systems may require passing special flags to $cc to indicate that
6091 the resulting executable will use dynamic linking.  To use no flags,
6092 say "none".
6093
6094 EOM
6095     case "$ccdlflags" in
6096     '') case "$osname" in
6097                 hpux)   dflt='-Wl,-E' ;;
6098                 linux)  dflt='-rdynamic' ;;
6099                 next)   dflt='none' ;;
6100                 sunos)  dflt='none' ;;
6101                 *)      dflt='none' ;;
6102             esac ;;
6103     ' ')  dflt='none' ;;
6104     *)  dflt="$ccdlflags" ;;
6105     esac
6106     rp="Any special flags to pass to $cc to use dynamic linking?"
6107     . ./myread
6108     case "$ans" in
6109     none) ccdlflags=' ' ;;
6110     *) ccdlflags="$ans" ;;
6111     esac
6112     ;;
6113 *)  usedl="$undef"
6114         ld='ld'
6115     dlsrc='dl_none.xs'
6116     lddlflags=''
6117     ccdlflags=''
6118     ;;
6119 esac
6120
6121 also=''
6122 case "$usedl" in
6123 $undef)
6124         # No dynamic loading being used, so don't bother even to prompt.
6125         useshrplib='false'
6126         ;;
6127 *)      case "$useshrplib" in
6128         '')     case "$osname" in
6129                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6130                         dflt=y
6131                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6132                         ;;
6133                 next*)
6134                         case "$osvers" in
6135                         4*)     dflt=y
6136                                 also='Building a shared libperl is needed for MAB support.'
6137                                 ;;
6138                         *)      dflt=n
6139                                 ;;
6140                         esac
6141                         ;;
6142                 *)      dflt=n
6143                         ;;
6144                 esac
6145                 ;;
6146         $define|true|[Yy]*)
6147                 dflt=y
6148                 ;;
6149         *)      dflt=n
6150                 ;;
6151         esac
6152         $cat << EOM
6153
6154 The perl executable is normally obtained by linking perlmain.c with
6155 libperl${_a}, any static extensions (usually just DynaLoader), and
6156 any other libraries needed on this system (such as -lm, etc.).  Since
6157 your system supports dynamic loading, it is probably possible to build
6158 a shared libperl.$so.  If you will have more than one executable linked
6159 to libperl.$so, this will significantly reduce the size of each
6160 executable, but it may have a noticeable affect on performance.  The
6161 default is probably sensible for your system.
6162 $also
6163
6164 EOM
6165         rp="Build a shared libperl.$so (y/n)"
6166         . ./myread
6167         case "$ans" in
6168         true|$define|[Yy]*)
6169                 useshrplib='true'  ;;
6170         *)      useshrplib='false' ;;
6171         esac
6172         ;;
6173 esac
6174
6175 case "$useshrplib" in
6176 true)
6177         case "$libperl" in
6178         '')
6179                 # Figure out a good name for libperl.so.  Since it gets stored in
6180                 # a version-specific architecture-dependent library, the version
6181                 # number isn't really that important, except for making cc/ld happy.
6182                 #
6183                 # A name such as libperl.so.3.1
6184                 majmin="libperl.$so.$patchlevel.$subversion"
6185                 # A name such as libperl.so.301
6186                 majonly=`echo $patchlevel $subversion |
6187                         $awk '{printf "%d%02d", $1, $2}'`
6188                 majonly=libperl.$so.$majonly
6189                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6190                 # rely on figuring it out from the naming of libc.
6191                 case "${osname}${osvers}" in
6192                 next4*)
6193                         dflt=libperl.5.$so
6194                         # XXX How handle the --version stuff for MAB?
6195                         ;;
6196                 linux*)  # ld won't link with a bare -lperl otherwise.
6197                         dflt=libperl.$so
6198                         ;;
6199                 cygwin*) # include version
6200                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6201                         ;;
6202                 *)      # Try to guess based on whether libc has major.minor.
6203                         case "$libc" in
6204                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6205                         *libc.$so.[0-9]*) dflt=$majonly ;;
6206                         *)      dflt=libperl.$so ;;
6207                         esac
6208                         ;;
6209                 esac
6210                 ;;
6211         *)      dflt=$libperl
6212                 ;;
6213         esac
6214         cat << EOM
6215
6216 I need to select a good name for the shared libperl.  If your system uses
6217 library names with major and minor numbers, then you might want something
6218 like $majmin.  Alternatively, if your system uses a single version
6219 number for shared libraries, then you might want to use $majonly.
6220 Or, your system might be quite happy with a simple libperl.$so.
6221
6222 Since the shared libperl will get installed into a version-specific
6223 architecture-dependent directory, the version number of the shared perl
6224 library probably isn't important, so the default should be o.k.
6225
6226 EOM
6227         rp='What name do you want to give to the shared libperl?'
6228         . ./myread
6229         libperl=$ans
6230         echo "Ok, I'll use $libperl"
6231         ;;
6232 *)
6233         libperl="libperl${_a}"
6234         ;;
6235 esac
6236
6237 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6238 case "$shrpdir" in
6239 '') ;;
6240 *)      $cat >&4 <<EOM
6241 WARNING:  Use of the shrpdir variable for the installation location of
6242 the shared $libperl is not supported.  It was never documented and
6243 will not work in this version.  Let me (perlbug@perl.com)
6244 know of any problems this may cause.
6245
6246 EOM
6247         case "$shrpdir" in
6248         "$archlibexp/CORE")
6249                 $cat >&4 <<EOM
6250 But your current setting of $shrpdir is
6251 the default anyway, so it's harmless.
6252 EOM
6253                 ;;
6254         *)
6255                 $cat >&4 <<EOM
6256 Further, your current attempted setting of $shrpdir
6257 conflicts with the value of $archlibexp/CORE
6258 that installperl will use.
6259 EOM
6260                 ;;
6261         esac
6262         ;;
6263 esac
6264
6265 # How will the perl executable find the installed shared $libperl?
6266 # Add $xxx to ccdlflags.
6267 # If we can't figure out a command-line option, use $shrpenv to
6268 # set env LD_RUN_PATH.  The main perl makefile uses this.
6269 shrpdir=$archlibexp/CORE
6270 xxx=''
6271 tmp_shrpenv=''
6272 if "$useshrplib"; then
6273     case "$osname" in 
6274         aix)
6275                 # We'll set it in Makefile.SH...
6276                 ;;
6277         solaris|netbsd)
6278                 xxx="-R $shrpdir"
6279                 ;;
6280         freebsd)
6281                 xxx="-Wl,-R$shrpdir"
6282                 ;;
6283         linux|irix*|dec_osf)
6284                 xxx="-Wl,-rpath,$shrpdir"
6285                 ;;
6286         next)
6287                 # next doesn't like the default...
6288                 ;;
6289         beos)
6290                 # beos doesn't like the default, either.
6291                 ;;
6292         hpux*)
6293                 # hpux doesn't like the default, either.
6294                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6295                 ;;
6296         *)
6297                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6298                 ;;
6299         esac
6300         case "$xxx" in
6301         '') ;;
6302         *)      
6303                 # Only add $xxx if it isn't already in ccdlflags.
6304                 case " $ccdlflags " in
6305                 *" $xxx "*)     ;;
6306                 *)      ccdlflags="$ccdlflags $xxx"
6307                         cat <<EOM >&4
6308
6309 Adding $xxx to the flags
6310 passed to $ld so that the perl executable will find the 
6311 installed shared $libperl.
6312
6313 EOM
6314                         ;;
6315                 esac
6316                 ;;
6317         esac
6318 fi
6319 # Fix ccdlflags in AIX for building external extensions.
6320 # (For building Perl itself bare -bE:perl.exp is needed,
6321 #  Makefile.SH takes care of this.)
6322 case "$osname" in
6323 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6324 esac
6325 # Respect a hint or command-line value.
6326 case "$shrpenv" in
6327 '') shrpenv="$tmp_shrpenv" ;;
6328 esac
6329 case "$ldlibpthname" in
6330 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6331 none)   ldlibpthname='' ;;
6332 esac
6333
6334 : determine where manual pages go
6335 set man1dir man1dir none
6336 eval $prefixit
6337 $cat <<EOM
6338
6339 $spackage has manual pages available in source form.
6340 EOM
6341 case "$nroff" in
6342 nroff)
6343         echo "However, you don't have nroff, so they're probably useless to you."
6344         case "$man1dir" in
6345         '') man1dir="none";;
6346         esac;;
6347 esac
6348 echo "If you don't want the manual sources installed, answer 'none'."
6349 case "$man1dir" in
6350 ' ') dflt=none
6351         ;;
6352 '')
6353         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6354         lookpath="$lookpath $prefixexp/man/p_man/man1"
6355         lookpath="$lookpath $prefixexp/man/u_man/man1"
6356         lookpath="$lookpath $prefixexp/man/man.1"
6357         case "$sysman" in
6358         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6359         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6360         esac
6361         set dflt
6362         eval $prefixup
6363         ;;
6364 *)  dflt="$man1dir"
6365         ;;
6366 esac
6367 echo " "
6368 fn=dn+~
6369 rp="Where do the main $spackage manual pages (source) go?"
6370 . ./getfile
6371 if $test "X$man1direxp" != "X$ansexp"; then
6372         installman1dir=''
6373 fi
6374 man1dir="$ans"
6375 man1direxp="$ansexp"
6376 case "$man1dir" in
6377 '')     man1dir=' '
6378         installman1dir='';;
6379 esac
6380
6381 : Change installation prefix, if necessary.
6382 if $test X"$prefix" != X"$installprefix"; then
6383         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6384 else
6385         installman1dir="$man1direxp"
6386 fi
6387
6388 : What suffix to use on installed man pages
6389
6390 case "$man1dir" in
6391 ' ')
6392         man1ext='0'
6393         ;;
6394 *)
6395         rp="What suffix should be used for the main $spackage man pages?"
6396         case "$man1ext" in
6397         '')     case "$man1dir" in
6398                 *1)  dflt=1 ;;
6399                 *1p) dflt=1p ;;
6400                 *1pm) dflt=1pm ;;
6401                 *l) dflt=l;;
6402                 *n) dflt=n;;
6403                 *o) dflt=o;;
6404                 *p) dflt=p;;
6405                 *C) dflt=C;;
6406                 *L) dflt=L;;
6407                 *L1) dflt=L1;;
6408                 *) dflt=1;;
6409                 esac
6410                 ;;
6411         *)      dflt="$man1ext";;
6412         esac
6413         . ./myread
6414         man1ext="$ans"
6415         ;;
6416 esac
6417
6418 : see if we can have long filenames
6419 echo " "
6420 rmlist="$rmlist /tmp/cf$$"
6421 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6422 first=123456789abcdef
6423 second=/tmp/cf$$/$first
6424 $rm -f $first $second
6425 if (echo hi >$first) 2>/dev/null; then
6426         if $test -f 123456789abcde; then
6427                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6428                 val="$undef"
6429         else
6430                 if (echo hi >$second) 2>/dev/null; then
6431                         if $test -f /tmp/cf$$/123456789abcde; then
6432                                 $cat <<'EOM'
6433 That's peculiar... You can have filenames longer than 14 characters, but only
6434 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6435 I shall consider your system cannot support long filenames at all.
6436 EOM
6437                                 val="$undef"
6438                         else
6439                                 echo 'You can have filenames longer than 14 characters.' >&4
6440                                 val="$define"
6441                         fi
6442                 else
6443                         $cat <<'EOM'
6444 How confusing! Some of your filesystems are sane enough to allow filenames
6445 longer than 14 characters but some others like /tmp can't even think about them.
6446 So, for now on, I shall assume your kernel does not allow them at all.
6447 EOM
6448                         val="$undef"
6449                 fi
6450         fi
6451 else
6452         $cat <<'EOM'
6453 You can't have filenames longer than 14 chars.  You can't even think about them!
6454 EOM
6455         val="$undef"
6456 fi 
6457 set d_flexfnam
6458 eval $setvar
6459 $rm -rf /tmp/cf$$ 123456789abcde*
6460
6461 : determine where library module manual pages go
6462 set man3dir man3dir none
6463 eval $prefixit
6464 $cat <<EOM
6465
6466 $spackage has manual pages for many of the library modules.
6467 EOM
6468
6469 case "$nroff" in
6470 nroff)
6471         $cat <<'EOM'
6472 However, you don't have nroff, so they're probably useless to you.
6473 EOM
6474         case "$man3dir" in
6475         '') man3dir="none";;
6476         esac;;
6477 esac
6478
6479 case "$d_flexfnam" in
6480 undef)
6481         $cat <<'EOM'
6482 However, your system can't handle the long file names like File::Basename.3. 
6483 EOM
6484         case "$man3dir" in
6485         '') man3dir="none";;
6486         esac;;
6487 esac
6488
6489 echo "If you don't want the manual sources installed, answer 'none'."
6490 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6491 case "$man3dir" in
6492 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6493         if $test -d "$privlib/man/man3"; then
6494                 cat <<EOM >&4
6495
6496 WARNING:  Previous versions of perl installed man3 pages into
6497 $privlib/man/man3.  This version will suggest a 
6498 new default of $dflt.  
6499 EOM
6500                 tdflt=$dflt
6501                 dflt='n'
6502                 rp='Do you wish to preserve the old behavior?(y/n)'
6503                 . ./myread
6504                 case "$ans" in
6505                 y*) dflt="$privlib/man/man3" ;;
6506                 *)  dflt=$tdflt ;;
6507                 esac
6508     fi
6509         ;;
6510 ' ') dflt=none;;
6511 *)      dflt="$man3dir" ;;
6512 esac
6513 echo " "
6514 fn=dn+~
6515 rp="Where do the $package library man pages (source) go?"
6516 . ./getfile
6517 man3dir="$ans"
6518 man3direxp="$ansexp"
6519 case "$man1dir" in
6520 '')     man3dir=' '
6521         installman3dir='';;
6522 esac
6523
6524 : Change installation prefix, if necessary.
6525 if $test X"$prefix" != X"$installprefix"; then
6526         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6527 else
6528         installman3dir="$man3direxp"
6529 fi
6530
6531 : What suffix to use on installed man pages
6532 case "$man3dir" in
6533 ' ')
6534         man3ext='0'
6535         ;;
6536 *)
6537         rp="What suffix should be used for the $package library man pages?"
6538         case "$man3ext" in
6539         '')     case "$man3dir" in
6540                 *3)  dflt=3 ;;
6541                 *3p) dflt=3p ;;
6542                 *3pm) dflt=3pm ;;
6543                 *l) dflt=l;;
6544                 *n) dflt=n;;
6545                 *o) dflt=o;;
6546                 *p) dflt=p;;
6547                 *C) dflt=C;;
6548                 *L) dflt=L;;
6549                 *L3) dflt=L3;;
6550                 *) dflt=3;;
6551                 esac
6552                 ;;
6553         *)      dflt="$man3ext";;
6554         esac
6555         . ./myread
6556         man3ext="$ans"
6557         ;;
6558 esac
6559
6560 : see if we have to deal with yellow pages, now NIS.
6561 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6562         if $test -f /usr/etc/nibindd; then
6563                 echo " "
6564                 echo "I'm fairly confident you're on a NeXT."
6565                 echo " "
6566                 rp='Do you get the hosts file via NetInfo?'
6567                 dflt=y
6568                 case "$hostcat" in
6569                 nidump*) ;;
6570                 '') ;;
6571                 *) dflt=n;;
6572                 esac
6573                 . ./myread
6574                 case "$ans" in
6575                 y*) hostcat='nidump hosts .';;
6576                 *)      case "$hostcat" in
6577                         nidump*) hostcat='';;
6578                         esac
6579                         ;;
6580                 esac
6581         fi
6582         case "$hostcat" in
6583         nidump*) ;;
6584         *)
6585                 case "$hostcat" in
6586                 *ypcat*) dflt=y;;
6587                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6588                                 dflt=y
6589                         else
6590                                 dflt=n
6591                         fi;;
6592                 *) dflt=n;;
6593                 esac
6594                 echo " "
6595                 rp='Are you getting the hosts file via yellow pages?'
6596                 . ./myread
6597                 case "$ans" in
6598                 y*) hostcat='ypcat hosts';;
6599                 *) hostcat='cat /etc/hosts';;
6600                 esac
6601                 ;;
6602         esac
6603 fi
6604 case "$hostcat" in
6605 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6606 esac
6607 case "$groupcat" in
6608 '') test -f /etc/group && groupcat='cat /etc/group';;
6609 esac
6610 case "$passcat" in
6611 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6612 esac
6613
6614 : now get the host name
6615 echo " "
6616 echo "Figuring out host name..." >&4
6617 case "$myhostname" in
6618 '') cont=true
6619         echo 'Maybe "hostname" will work...'
6620         if tans=`sh -c hostname 2>&1` ; then
6621                 myhostname=$tans
6622                 phostname=hostname
6623                 cont=''
6624         fi
6625         ;;
6626 *) cont='';;
6627 esac
6628 if $test "$cont"; then
6629         if ./xenix; then
6630                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6631                 if tans=`cat /etc/systemid 2>&1` ; then
6632                         myhostname=$tans
6633                         phostname='cat /etc/systemid'
6634                         echo "Whadyaknow.  Xenix always was a bit strange..."
6635                         cont=''
6636                 fi
6637         elif $test -r /etc/systemid; then
6638                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6639         fi
6640 fi
6641 if $test "$cont"; then
6642         echo 'No, maybe "uuname -l" will work...'
6643         if tans=`sh -c 'uuname -l' 2>&1` ; then
6644                 myhostname=$tans
6645                 phostname='uuname -l'
6646         else
6647                 echo 'Strange.  Maybe "uname -n" will work...'
6648                 if tans=`sh -c 'uname -n' 2>&1` ; then
6649                         myhostname=$tans
6650                         phostname='uname -n'
6651                 else
6652                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6653                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6654                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6655                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6656                         else
6657                                 case "$myhostname" in
6658                                 '') echo "Does this machine have an identity crisis or something?"
6659                                         phostname='';;
6660                                 *)
6661                                         echo "Well, you said $myhostname before..."
6662                                         phostname='echo $myhostname';;
6663                                 esac
6664                         fi
6665                 fi
6666         fi
6667 fi
6668 : you do not want to know about this
6669 set $myhostname
6670 myhostname=$1
6671
6672 : verify guess
6673 if $test "$myhostname" ; then
6674         dflt=y
6675         rp='Your host name appears to be "'$myhostname'".'" Right?"
6676         . ./myread
6677         case "$ans" in
6678         y*) ;;
6679         *) myhostname='';;
6680         esac
6681 fi
6682
6683 : bad guess or no guess
6684 while $test "X$myhostname" = X ; do
6685         dflt=''
6686         rp="Please type the (one word) name of your host:"
6687         . ./myread
6688         myhostname="$ans"
6689 done
6690
6691 : translate upper to lower if necessary
6692 case "$myhostname" in
6693 *[A-Z]*)
6694         echo "(Normalizing case in your host name)"
6695         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6696         ;;
6697 esac
6698
6699 case "$myhostname" in
6700 *.*)
6701         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6702         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6703         echo "(Trimming domain name from host name--host name is now $myhostname)"
6704         ;;
6705 *) case "$mydomain" in
6706         '')
6707                 {
6708                         test "X$hostcat" = "Xypcat hosts" &&
6709                         ypmatch "$myhostname" hosts 2>/dev/null |\
6710                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6711                         $test -s hosts
6712                 } || {
6713                         test "X$hostcat" != "X" &&
6714                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6715                                         /[       ]$myhostname[  . ]/p" > hosts
6716                 }
6717                 tmp_re="[       . ]"
6718                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6719                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6720                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6721                         hosts | $sort | $uniq | \
6722                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6723                 case `$echo X$dflt` in
6724                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6725                         dflt=.
6726                         ;;
6727                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6728                         ;;
6729                 esac
6730                 case "$dflt" in
6731                 .)
6732                         tans=`./loc resolv.conf X /etc /usr/etc`
6733                         if $test -f "$tans"; then
6734                                 echo "(Attempting domain name extraction from $tans)"
6735                                 dflt=.`$sed -n -e 's/   / /g' \
6736                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6737                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6738                                 case "$dflt" in
6739                                 .) dflt=.`$sed -n -e 's/        / /g' \
6740                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6741                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6742                                         ;;
6743                                 esac
6744                         fi
6745                         ;;
6746                 esac
6747                 case "$dflt" in
6748                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6749                         dflt=.`sh -c domainname 2>/dev/null`
6750                         case "$dflt" in
6751                         '') dflt='.';;
6752                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6753                         esac
6754                         ;;
6755                 esac
6756                 case "$dflt" in
6757                 .) echo "(Lost all hope -- silly guess then)"
6758                         dflt='.uucp'
6759                         ;;
6760                 esac
6761                 $rm -f hosts
6762                 ;;
6763         *) dflt="$mydomain";;
6764         esac;;
6765 esac
6766 echo " "
6767 rp="What is your domain name?"
6768 . ./myread
6769 tans="$ans"
6770 case "$ans" in
6771 '') ;;
6772 .*) ;;
6773 *) tans=".$tans";;
6774 esac
6775 mydomain="$tans"
6776
6777 : translate upper to lower if necessary
6778 case "$mydomain" in
6779 *[A-Z]*)
6780         echo "(Normalizing case in your domain name)"
6781         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6782         ;;
6783 esac
6784
6785 : a little sanity check here
6786 case "$phostname" in
6787 '') ;;
6788 *)
6789         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6790         $myhostname$mydomain|$myhostname) ;;
6791         *)
6792                 case "$phostname" in
6793                 sed*)
6794                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6795                         ;;
6796                 *)
6797                         echo "(That doesn't agree with your $phostname command, by the way.)"
6798                         ;;
6799                 esac
6800         ;;
6801         esac
6802         ;;
6803 esac
6804
6805 $cat <<EOM
6806
6807 I need to get your e-mail address in Internet format if possible, i.e.
6808 something like user@host.domain. Please answer accurately since I have
6809 no easy means to double check it. The default value provided below
6810 is most probably close to reality but may not be valid from outside
6811 your organization...
6812
6813 EOM
6814 cont=x
6815 while test "$cont"; do
6816         case "$cf_email" in
6817         '') dflt="$cf_by@$myhostname$mydomain";;
6818         *) dflt="$cf_email";;
6819         esac
6820         rp='What is your e-mail address?'
6821         . ./myread
6822         cf_email="$ans"
6823         case "$cf_email" in
6824         *@*.*) cont='' ;;
6825         *)
6826                 rp='Address does not look like an Internet one.  Use it anyway?'
6827                 case "$fastread" in
6828                 yes) dflt=y ;;
6829                 *) dflt=n ;;
6830                 esac
6831                 . ./myread
6832                 case "$ans" in
6833                 y*) cont='' ;;
6834                 *) echo " " ;;
6835                 esac
6836                 ;;
6837         esac
6838 done
6839
6840 $cat <<EOM
6841
6842 If you or somebody else will be maintaining perl at your site, please
6843 fill in the correct e-mail address here so that they may be contacted
6844 if necessary. Currently, the "perlbug" program included with perl
6845 will send mail to this address in addition to perlbug@perl.com. You may
6846 enter "none" for no administrator.
6847
6848 EOM
6849 case "$perladmin" in
6850 '') dflt="$cf_email";;
6851 *) dflt="$perladmin";;
6852 esac
6853 rp='Perl administrator e-mail address'
6854 . ./myread
6855 perladmin="$ans"
6856
6857 : figure out how to guarantee perl startup
6858 case "$startperl" in
6859 '')
6860         case "$sharpbang" in
6861         *!)
6862                 $cat <<EOH
6863
6864 I can use the #! construct to start perl on your system. This will
6865 make startup of perl scripts faster, but may cause problems if you
6866 want to share those scripts and perl is not in a standard place
6867 ($binexp/perl) on all your platforms. The alternative is to force
6868 a shell by starting the script with a single ':' character.
6869
6870 EOH
6871                 dflt="$binexp/perl"
6872                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6873                 . ./myread
6874                 case "$ans" in
6875                 none)   startperl=": # use perl";;
6876                 *)      startperl="#!$ans"
6877                         if $test 30 -lt `echo "$ans" | wc -c`; then
6878                                 $cat >&4 <<EOM
6879
6880 WARNING:  Some systems limit the #! command to 32 characters.
6881 If you experience difficulty running Perl scripts with #!, try
6882 installing Perl in a directory with a shorter pathname.
6883
6884 EOM
6885                         fi ;;
6886                 esac
6887                 ;;
6888         *) startperl=": # use perl"
6889                 ;;
6890         esac
6891         ;;
6892 esac
6893 echo "I'll use $startperl to start perl scripts."
6894
6895 : figure best path for perl in scripts
6896 case "$perlpath" in
6897 '')
6898         perlpath="$binexp/perl"
6899         case "$startperl" in
6900         *!*) ;;
6901         *)
6902                 $cat <<EOH
6903
6904 I will use the "eval 'exec'" idiom to start Perl on your system.
6905 I can use the full path of your Perl binary for this purpose, but
6906 doing so may cause problems if you want to share those scripts and
6907 Perl is not always in a standard place ($binexp/perl).
6908
6909 EOH
6910                 dflt="$binexp/perl"
6911                 rp="What path shall I use in \"eval 'exec'\"?"
6912                 . ./myread
6913                 perlpath="$ans"
6914                 ;;
6915         esac
6916         ;;
6917 esac
6918 case "$startperl" in
6919 *!*)    ;;
6920 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6921 esac
6922
6923 : determine where public executable scripts go
6924 set scriptdir scriptdir
6925 eval $prefixit
6926 case "$scriptdir" in
6927 '')
6928         dflt="$bin"
6929         : guess some guesses
6930         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6931         $test -d /usr/share/bin     && dflt=/usr/share/bin
6932         $test -d /usr/local/script  && dflt=/usr/local/script
6933         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6934         $test -d $prefixexp/script  && dflt=$prefixexp/script
6935         set dflt
6936         eval $prefixup
6937         ;;
6938 *)  dflt="$scriptdir"
6939         ;;
6940 esac
6941 $cat <<EOM
6942  
6943 Some installations have a separate directory just for executable scripts so
6944 that they can mount it across multiple architectures but keep the scripts in
6945 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6946 Or you might just lump your scripts in with all your other executables.
6947  
6948 EOM
6949 fn=d~
6950 rp='Where do you keep publicly executable scripts?'
6951 . ./getfile
6952 if $test "X$ansexp" != "X$scriptdirexp"; then
6953         installscript=''
6954 fi
6955 scriptdir="$ans"
6956 scriptdirexp="$ansexp"
6957 : Change installation prefix, if necessary.
6958 if $test X"$prefix" != X"$installprefix"; then
6959         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6960 else
6961         installscript="$scriptdirexp"
6962 fi
6963
6964 : determine where site specific architecture-dependent libraries go.
6965 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6966 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6967 : sitelib may have an optional trailing /share.
6968 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6969 tdflt="$tdflt/$archname"
6970 set sitearch sitearch none
6971 eval $prefixit
6972 case "$sitearch" in
6973 '')     dflt="$tdflt" ;;
6974 *)      dflt="$sitearch" ;;
6975 esac
6976 $cat <<EOM
6977
6978 The installation process will also create a directory for
6979 architecture-dependent site-specific extensions and modules.
6980
6981 EOM
6982 fn=nd~+
6983 rp='Pathname for the site-specific architecture-dependent library files?'
6984 . ./getfile
6985 sitearch="$ans"
6986 sitearchexp="$ansexp"
6987 : Change installation prefix, if necessary.
6988 if $test X"$prefix" != X"$installprefix"; then
6989         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6990 else
6991         installsitearch="$sitearchexp"
6992 fi
6993
6994 : determine where add-on public executables go
6995 case "$sitebin" in
6996 '')     dflt=$siteprefix/bin ;;
6997 *)      dflt=$sitebin ;;
6998 esac
6999 fn=d~
7000 rp='Pathname where the add-on public executables should be installed?'
7001 . ./getfile
7002 sitebin="$ans"
7003 sitebinexp="$ansexp"
7004 : Change installation prefix, if necessary.
7005 if $test X"$prefix" != X"$installprefix"; then
7006         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7007 else
7008         installsitebin="$sitebinexp"
7009 fi
7010
7011 : see if sqrtl exists
7012 set sqrtl d_sqrtl
7013 eval $inlibc
7014
7015 cat <<EOM
7016
7017 Perl can be built to take advantage of long doubles which
7018 (if available) may give more accuracy and range for floating point numbers.
7019
7020 If this doesn't make any sense to you, just accept the default 'n'.
7021 EOM
7022
7023 case "$ccflags" in
7024 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7025 esac
7026
7027 case "$uselongdouble" in
7028 $define|true|[yY]*)     dflt='y';;
7029 *) dflt='n';;
7030 esac
7031 rp='Try to use long doubles if available?'
7032 . ./myread
7033 case "$ans" in
7034 y|Y)    val="$define"   ;;
7035 *)      val="$undef"    ;;
7036 esac
7037 set uselongdouble
7038 eval $setvar
7039
7040 case "$uselongdouble" in
7041 true|[yY]*) uselongdouble="$define" ;;
7042 esac
7043
7044 case "$uselongdouble" in
7045 $define)
7046 : Look for a hint-file generated 'call-back-unit'.  If the
7047 : user has specified that long doubles should be used,
7048 : we may need to set or change some other defaults.
7049         if $test -f uselongdouble.cbu; then
7050                 echo "Your platform has some specific hints for long doubles, using them..."
7051                 . ./uselongdouble.cbu
7052         else
7053                 $cat <<EOM
7054 (Your platform doesn't have any specific hints for long doubles.)
7055 EOM
7056         fi
7057         ;;
7058 esac
7059
7060 case "$uselongdouble:$d_sqrtl" in
7061 $define:$undef)
7062                 $cat <<EOM >&4
7063
7064 You requested the use of long doubles but you do not seem to have
7065 the mathematic functions for long doubles.  I'm disabling the use
7066 of long doubles.
7067 EOM
7068         uselongdouble=$undef
7069         ;;
7070 esac
7071
7072 cat <<EOM
7073
7074 Previous version of $package used the standard IO mechanisms as defined
7075 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7076 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7077 the default.  This abstraction layer can use AT&T's sfio (if you already
7078 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7079 problems with some extension modules.  Using PerlIO with stdio is safe,
7080 but it is slower than plain stdio and therefore is not the default.
7081
7082 If this doesn't make any sense to you, just accept the default 'n'.
7083 EOM
7084 case "$useperlio" in
7085 $define|true|[yY]*)     dflt='y';;
7086 *) dflt='n';;
7087 esac
7088 rp='Use the experimental PerlIO abstraction layer?'
7089 . ./myread
7090 case "$ans" in
7091 y|Y) 
7092         val="$define"
7093         ;;     
7094 *)      
7095         echo "Ok, doing things the stdio way"
7096         val="$undef"
7097         ;;
7098 esac
7099 set useperlio
7100 eval $setvar 
7101
7102 case "$vendorprefix" in
7103 '')     d_vendorbin="$undef"
7104         vendorbin=''
7105         vendorbinexp=''
7106         ;;
7107 *)      d_vendorbin="$define"
7108         : determine where vendor-supplied executables go.
7109         dflt=$vendorprefix/bin
7110         fn=d~+
7111         rp='Pathname for the vendor-supplied executables directory?'
7112         . ./getfile
7113         vendorbin="$ans"
7114         vendorbinexp="$ansexp"
7115         : Change installation prefix, if necessary.
7116         if $test X"$prefix" != X"$installprefix"; then
7117                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7118         else
7119                 installvendorbin="$vendorbinexp"
7120         fi
7121         ;;
7122 esac
7123
7124 : check for length of double
7125 echo " "
7126 case "$doublesize" in
7127 '')
7128         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7129         $cat >try.c <<'EOCP'
7130 #include <stdio.h>
7131 int main()
7132 {
7133     printf("%d\n", (int)sizeof(double));
7134     exit(0);
7135 }
7136 EOCP
7137         set try
7138         if eval $compile_ok; then
7139                 doublesize=`./try`
7140                 $echo " $doublesize bytes." >&4
7141         else
7142                 dflt='8'
7143                 echo "(I can't seem to compile the test program.  Guessing...)"
7144                 rp="What is the size of a double precision number (in bytes)?"
7145                 . ./myread
7146                 doublesize="$ans"
7147         fi
7148         ;;
7149 esac
7150 $rm -f try.c try
7151
7152 : check for long doubles
7153 echo " "
7154 $echo $n "Checking to see if your system supports long double..." $c >&4
7155 echo 'int main() { long double x = 7.0; }' > try.c
7156 set try
7157 if eval $compile; then
7158         val="$define"
7159         echo " Yes, it does." >&4
7160 else
7161         val="$undef"
7162         echo " No, it doesn't." >&4
7163 fi
7164 $rm try.*
7165 set d_longdbl
7166 eval $setvar
7167
7168 : check for length of long double
7169 case "${d_longdbl}${longdblsize}" in
7170 $define)
7171         echo " "
7172         $echo $n "Checking to see how big your long doubles are..." $c >&4
7173         $cat >try.c <<'EOCP'
7174 #include <stdio.h>
7175 int main()
7176 {
7177         printf("%d\n", sizeof(long double));
7178 }
7179 EOCP
7180         set try
7181         set try
7182         if eval $compile; then
7183                 longdblsize=`./try$exe_ext`
7184                 $echo " $longdblsize bytes." >&4
7185         else
7186                 dflt='8'
7187                 echo " "
7188                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7189                 rp="What is the size of a long double (in bytes)?"
7190                 . ./myread
7191                 longdblsize="$ans"
7192         fi
7193         if $test "X$doublesize" = "X$longdblsize"; then
7194                 echo "(That isn't any different from an ordinary double.)"
7195         fi      
7196         ;;
7197 esac
7198 $rm -f try.* try
7199
7200 : Check how to convert floats to strings.
7201 if test "X$d_Gconvert" = X; then
7202         echo " "
7203         echo "Checking for an efficient way to convert floats to strings."
7204         $cat >try.c <<EOP
7205 #ifdef TRY_gconvert
7206 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7207 char *myname = "gconvert";
7208 #endif
7209 #ifdef TRY_gcvt
7210 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7211 char *myname = "gcvt";
7212 #endif
7213 #ifdef TRY_qgcvt
7214 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7215 char *myname = "qgcvt";
7216 #define DOUBLETYPE long double
7217 #endif
7218 #ifdef TRY_sprintf
7219 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7220 char *myname = "sprintf";
7221 #endif
7222
7223 #ifndef DOUBLETYPE
7224 #define DOUBLETYPE double
7225 #endif
7226
7227 #include <stdio.h>
7228
7229 #define I_STDLIB $i_stdlib
7230 #ifdef I_STDLIB
7231 #include <stdlib.h>
7232 #endif
7233
7234 int
7235 checkit(expect, got)
7236 char *expect;
7237 char *got;
7238 {
7239     if (strcmp(expect, got)) {
7240                 printf("%s oddity:  Expected %s, got %s\n",
7241                         myname, expect, got);
7242                 exit(1);
7243         }
7244 }
7245
7246 int main()
7247
7248         char buf[64]; 
7249         buf[63] = '\0';
7250
7251         /* This must be 1st test on (which?) platform */
7252         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7253         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7254         checkit("0.1", buf);
7255
7256         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7257         checkit("1", buf);
7258
7259         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7260         checkit("0", buf);
7261
7262         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7263         checkit("-1", buf);
7264
7265         /* Some Linux gcvt's give 1.e+5 here. */
7266         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7267         checkit("100000", buf);
7268         
7269         /* Some Linux gcvt's give -1.e+5 here. */
7270         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7271         checkit("-100000", buf);
7272
7273         exit(0);
7274 }
7275 EOP
7276         case "$d_Gconvert" in
7277         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7278         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7279         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7280         *) xxx_list='gconvert gcvt sprintf' ;;
7281         esac
7282
7283         case "$d_longdbl$uselongdouble" in
7284         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7285         esac
7286
7287         for xxx_convert in $xxx_list; do
7288                 echo "Trying $xxx_convert..."
7289                 $rm -f try try$_o
7290                 set try -DTRY_$xxx_convert
7291                 if eval $compile; then
7292                         echo "$xxx_convert() found." >&4
7293                         if ./try; then
7294                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7295                                 break;
7296                         else
7297                                 echo "...But $xxx_convert didn't work as I expected."
7298                         fi
7299                 else
7300                         echo "$xxx_convert NOT found." >&4
7301                 fi
7302         done
7303                 
7304         case "$xxx_convert" in
7305         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7306         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7307         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7308         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7309         esac
7310 fi
7311
7312 echo " "
7313
7314 if $test X"$d_longdbl" = X"$define"; then
7315
7316 echo "Checking how to print long doubles..." >&4
7317
7318 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7319         $cat >try.c <<'EOCP'
7320 #include <sys/types.h>
7321 #include <stdio.h>
7322 int main() {
7323   double d = 123.456;
7324   printf("%.3f\n", d);
7325 }
7326 EOCP
7327         set try
7328         if eval $compile; then
7329                 yyy=`./try$exe_ext`
7330                 case "$yyy" in
7331                 123.456)
7332                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7333                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7334                         echo "We will use %f."
7335                         ;;
7336                 esac
7337         fi
7338 fi
7339
7340 if $test X"$sPRIfldbl" = X; then
7341         $cat >try.c <<'EOCP'
7342 #include <sys/types.h>
7343 #include <stdio.h>
7344 int main() {
7345   long double d = 123.456;
7346   printf("%.3llf\n", d);
7347 }
7348 EOCP
7349         set try
7350         if eval $compile; then
7351                 yyy=`./try$exe_ext`
7352                 case "$yyy" in
7353                 123.456)
7354                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7355                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7356                         echo "We will use %llf."
7357                         ;;
7358                 esac
7359         fi
7360 fi
7361
7362 if $test X"$sPRIfldbl" = X; then
7363         $cat >try.c <<'EOCP'
7364 #include <sys/types.h>
7365 #include <stdio.h>
7366 int main() {
7367   long double d = 123.456;
7368   printf("%.3Lf\n", d);
7369 }
7370 EOCP
7371         set try
7372         if eval $compile; then
7373                 yyy=`./try$exe_ext`
7374                 case "$yyy" in
7375                 123.456)
7376                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7377                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7378                         echo "We will use %Lf."
7379                         ;;
7380                 esac
7381         fi
7382 fi
7383
7384 if $test X"$sPRIfldbl" = X; then
7385         $cat >try.c <<'EOCP'
7386 #include <sys/types.h>
7387 #include <stdio.h>
7388 int main() {
7389   long double d = 123.456;
7390   printf("%.3lf\n", d);
7391 }
7392 EOCP
7393         set try
7394         if eval $compile; then
7395                 yyy=`./try$exe_ext`
7396                 case "$yyy" in
7397                 123.456)
7398                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7399                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7400                         echo "We will use %lf."
7401                         ;;
7402                 esac
7403         fi
7404 fi
7405
7406 if $test X"$sPRIfldbl" = X; then
7407         echo "Cannot figure out how to print long doubles." >&4
7408 fi
7409
7410 $rm -f try try.*
7411
7412 fi # d_longdbl
7413
7414 case "$sPRIfldbl" in
7415 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7416         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7417         ;;
7418 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7419         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7420         ;;
7421 esac
7422
7423 : Initialize h_fcntl
7424 h_fcntl=false
7425
7426 : Initialize h_sysfile
7427 h_sysfile=false
7428
7429 : access call always available on UNIX
7430 set access d_access
7431 eval $inlibc
7432
7433 : locate the flags for 'access()'
7434 case "$d_access" in
7435 "$define")
7436         echo " "
7437         $cat >access.c <<'EOCP'
7438 #include <sys/types.h>
7439 #ifdef I_FCNTL
7440 #include <fcntl.h>
7441 #endif
7442 #ifdef I_SYS_FILE
7443 #include <sys/file.h>
7444 #endif
7445 #ifdef I_UNISTD
7446 #include <unistd.h>
7447 #endif
7448 int main() {
7449         exit(R_OK);
7450 }
7451 EOCP
7452         : check sys/file.h first, no particular reason here
7453         if $test `./findhdr sys/file.h` && \
7454                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7455                 h_sysfile=true;
7456                 echo "<sys/file.h> defines the *_OK access constants." >&4
7457         elif $test `./findhdr fcntl.h` && \
7458                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7459                 h_fcntl=true;
7460                 echo "<fcntl.h> defines the *_OK access constants." >&4
7461         elif $test `./findhdr unistd.h` && \
7462                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7463                 echo "<unistd.h> defines the *_OK access constants." >&4
7464         else
7465                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7466         fi
7467         ;;
7468 esac
7469 $rm -f access*
7470
7471 : see if accessx exists
7472 set accessx d_accessx
7473 eval $inlibc
7474
7475 : see if alarm exists
7476 set alarm d_alarm
7477 eval $inlibc
7478
7479 : see if atolf exists
7480 set atolf d_atolf
7481 eval $inlibc
7482
7483 : see if atoll exists
7484 set atoll d_atoll
7485 eval $inlibc
7486
7487 : Look for GNU-cc style attribute checking
7488 echo " "
7489 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7490 $cat >attrib.c <<'EOCP'
7491 #include <stdio.h>
7492 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7493 EOCP
7494 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7495         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7496                 echo "Your C compiler doesn't fully support __attribute__."
7497                 val="$undef"
7498         else
7499                 echo "Your C compiler supports __attribute__."
7500                 val="$define"
7501         fi
7502 else
7503         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7504         val="$undef"
7505 fi
7506 set d_attribut
7507 eval $setvar
7508 $rm -f attrib*
7509
7510 : see if bcmp exists
7511 set bcmp d_bcmp
7512 eval $inlibc
7513
7514 : see if bcopy exists
7515 set bcopy d_bcopy
7516 eval $inlibc
7517
7518 : see if this is a unistd.h system
7519 set unistd.h i_unistd
7520 eval $inhdr
7521
7522 : see if getpgrp exists
7523 set getpgrp d_getpgrp
7524 eval $inlibc
7525
7526 case "$d_getpgrp" in
7527 "$define")
7528         echo " "
7529         echo "Checking to see which flavor of getpgrp is in use..."
7530         $cat >set.c <<EOP
7531 #$i_unistd I_UNISTD
7532 #include <sys/types.h>
7533 #ifdef I_UNISTD
7534 #  include <unistd.h>
7535 #endif
7536 int main()
7537 {
7538         if (getuid() == 0) {
7539                 printf("(I see you are running Configure as super-user...)\n");
7540                 setuid(1);
7541         }
7542 #ifdef TRY_BSD_PGRP
7543         if (getpgrp(1) == 0)
7544                 exit(0);
7545 #else
7546         if (getpgrp() > 0)
7547                 exit(0);
7548 #endif
7549         exit(1);
7550 }
7551 EOP
7552         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7553                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7554                 val="$define"
7555         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7556                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7557                 val="$undef"
7558         else
7559                 echo "I can't seem to compile and run the test program."
7560                 if ./usg; then
7561                         xxx="a USG one, i.e. you use getpgrp()."
7562                 else
7563                         # SVR4 systems can appear rather BSD-ish.
7564                         case "$i_unistd" in
7565                         $undef)
7566                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7567                                 val="$define"
7568                                 ;;
7569                         $define)
7570                                 xxx="probably a USG one, i.e. you use getpgrp()."
7571                                 val="$undef"
7572                                 ;;
7573                         esac
7574                 fi
7575                 echo "Assuming your getpgrp is $xxx" >&4
7576         fi
7577         ;;
7578 *) val="$undef";;
7579 esac
7580 set d_bsdgetpgrp
7581 eval $setvar
7582 $rm -f set set.c
7583
7584 : see if setpgrp exists
7585 set setpgrp d_setpgrp
7586 eval $inlibc
7587
7588 case "$d_setpgrp" in
7589 "$define")
7590         echo " "
7591         echo "Checking to see which flavor of setpgrp is in use..."
7592         $cat >set.c <<EOP
7593 #$i_unistd I_UNISTD
7594 #include <sys/types.h>
7595 #ifdef I_UNISTD
7596 #  include <unistd.h>
7597 #endif
7598 int main()
7599 {
7600         if (getuid() == 0) {
7601                 printf("(I see you are running Configure as super-user...)\n");
7602                 setuid(1);
7603         }
7604 #ifdef TRY_BSD_PGRP
7605         if (-1 == setpgrp(1, 1))
7606                 exit(0);
7607 #else
7608         if (setpgrp() != -1)
7609                 exit(0);
7610 #endif
7611         exit(1);
7612 }
7613 EOP
7614         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7615                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7616                 val="$define"
7617         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7618                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7619                 val="$undef"
7620         else
7621                 echo "(I can't seem to compile and run the test program.)"
7622                 if ./usg; then
7623                         xxx="a USG one, i.e. you use setpgrp()."
7624                 else
7625                         # SVR4 systems can appear rather BSD-ish.
7626                         case "$i_unistd" in
7627                         $undef)
7628                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7629                                 val="$define"
7630                                 ;;
7631                         $define)
7632                                 xxx="probably a USG one, i.e. you use setpgrp()."
7633                                 val="$undef"
7634                                 ;;
7635                         esac
7636                 fi
7637                 echo "Assuming your setpgrp is $xxx" >&4
7638         fi
7639         ;;
7640 *) val="$undef";;
7641 esac
7642 set d_bsdsetpgrp
7643 eval $setvar
7644 $rm -f set set.c
7645 : see if bzero exists
7646 set bzero d_bzero
7647 eval $inlibc
7648
7649 : see if signal is declared as pointer to function returning int or void
7650 echo " "
7651 xxx=`./findhdr signal.h`
7652 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7653 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7654         echo "You have int (*signal())() instead of void." >&4
7655         val="$undef"
7656 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7657         echo "You have void (*signal())()." >&4
7658         val="$define"
7659 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7660         echo "You have int (*signal())() instead of void." >&4
7661         val="$undef"
7662 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7663         echo "You have void (*signal())()." >&4
7664         val="$define"
7665 else
7666         case "$d_voidsig" in
7667         '')
7668         echo "I can't determine whether signal handler returns void or int..." >&4
7669                 dflt=void
7670                 rp="What type does your signal handler return?"
7671                 . ./myread
7672                 case "$ans" in
7673                 v*) val="$define";;
7674                 *) val="$undef";;
7675                 esac;;
7676         "$define")
7677                 echo "As you already told me, signal handler returns void." >&4
7678                 val="$define"
7679                 ;;
7680         *)      echo "As you already told me, signal handler returns int." >&4
7681                 val="$undef"
7682                 ;;
7683         esac
7684 fi
7685 set d_voidsig
7686 eval $setvar
7687 case "$d_voidsig" in
7688 "$define") signal_t="void";;
7689 *) signal_t="int";;
7690 esac
7691 $rm -f $$.tmp
7692
7693 : check for ability to cast large floats to 32-bit ints.
7694 echo " "
7695 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7696 if $test "$intsize" -ge 4; then
7697         xxx=int
7698 else
7699         xxx=long
7700 fi
7701 $cat >try.c <<EOCP
7702 #include <stdio.h>
7703 #include <sys/types.h>
7704 #include <signal.h>
7705 $signal_t blech(s) int s; { exit(3); }
7706 int main()
7707 {
7708         $xxx i32;
7709         double f, g;
7710         int result = 0;
7711         char str[16];
7712         signal(SIGFPE, blech);
7713
7714         /* Don't let compiler optimize the test away.  Store the number 
7715            in a writable string for gcc to pass to sscanf under HP/UX.
7716         */
7717         sprintf(str, "2147483647");
7718         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7719         g = 10 * f;
7720         i32  = ($xxx) g;
7721
7722         /* x86 processors will probably give 0x8000 0000, which is a
7723        sign change.  We don't want that.  We want to mimic SPARC
7724            behavior here, which is to preserve the sign and give
7725            back 0x7fff ffff.
7726         */
7727         if (i32 != ($xxx) f)
7728                 result |= 1;
7729         exit(result);
7730 }
7731 EOCP
7732 set try
7733 if eval $compile_ok; then
7734         ./try
7735         yyy=$?
7736 else
7737         echo "(I can't seem to compile the test program--assuming it can't)"
7738         yyy=1
7739 fi
7740 case "$yyy" in
7741 0)      val="$define"
7742         echo "Yup, it can."
7743         ;;
7744 *)      val="$undef"
7745         echo "Nope, it can't."
7746         ;;
7747 esac
7748 set d_casti32
7749 eval $setvar
7750 $rm -f try try.*
7751
7752 : check for ability to cast negative floats to unsigned
7753 echo " "
7754 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7755 $cat >try.c <<EOCP
7756 #include <stdio.h>
7757 #include <sys/types.h>
7758 #include <signal.h>
7759 $signal_t blech(s) int s; { exit(7); }
7760 $signal_t blech_in_list(s) int s; { exit(4); }
7761 unsigned long dummy_long(p) unsigned long p; { return p; }
7762 unsigned int dummy_int(p) unsigned int p; { return p; }
7763 unsigned short dummy_short(p) unsigned short p; { return p; }
7764 int main()
7765 {
7766         double f;
7767         unsigned long along;
7768         unsigned int aint;
7769         unsigned short ashort;
7770         int result = 0;
7771         char str[16];
7772         
7773         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7774            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7775            optimized the whole file away
7776         */
7777         /* Store the number in a writable string for gcc to pass to 
7778            sscanf under HP/UX.
7779         */
7780         sprintf(str, "-123");
7781         sscanf(str, "%lf", &f);  /* f = -123.; */
7782
7783         signal(SIGFPE, blech);
7784         along = (unsigned long)f;
7785         aint = (unsigned int)f;
7786         ashort = (unsigned short)f;
7787         if (along != (unsigned long)-123)
7788                 result |= 1;
7789         if (aint != (unsigned int)-123)
7790                 result |= 1;
7791         if (ashort != (unsigned short)-123)
7792                 result |= 1;
7793         sprintf(str, "1073741824.");
7794         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7795         f = f + f;
7796         along = 0;
7797         along = (unsigned long)f;
7798         if (along != 0x80000000)
7799                 result |= 2;
7800         f -= 1.;
7801         along = 0;
7802         along = (unsigned long)f;
7803         if (along != 0x7fffffff)
7804                 result |= 1;
7805         f += 2.;
7806         along = 0;
7807         along = (unsigned long)f;
7808         if (along != 0x80000001)
7809                 result |= 2;
7810         if (result)
7811                 exit(result);
7812         signal(SIGFPE, blech_in_list);
7813         sprintf(str, "123.");
7814         sscanf(str, "%lf", &f);  /* f = 123.; */
7815         along = dummy_long((unsigned long)f);
7816         aint = dummy_int((unsigned int)f);
7817         ashort = dummy_short((unsigned short)f);
7818         if (along != (unsigned long)123)
7819                 result |= 4;
7820         if (aint != (unsigned int)123)
7821                 result |= 4;
7822         if (ashort != (unsigned short)123)
7823                 result |= 4;
7824         exit(result);
7825
7826 }
7827 EOCP
7828 set try
7829 if eval $compile_ok; then
7830         ./try
7831         castflags=$?
7832 else
7833         echo "(I can't seem to compile the test program--assuming it can't)"
7834         castflags=7
7835 fi
7836 case "$castflags" in
7837 0)      val="$define"
7838         echo "Yup, it can."
7839         ;;
7840 *)      val="$undef"
7841         echo "Nope, it can't."
7842         ;;
7843 esac
7844 set d_castneg
7845 eval $setvar
7846 $rm -f try.*
7847
7848 : see if vprintf exists
7849 echo " "
7850 if set vprintf val -f d_vprintf; eval $csym; $val; then
7851         echo 'vprintf() found.' >&4
7852         val="$define"
7853         $cat >vprintf.c <<'EOF'
7854 #include <varargs.h>
7855
7856 int main() { xxx("foo"); }
7857
7858 xxx(va_alist)
7859 va_dcl
7860 {
7861         va_list args;
7862         char buf[10];
7863
7864         va_start(args);
7865         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7866 }
7867 EOF
7868         set vprintf
7869         if eval $compile && ./vprintf; then
7870                 echo "Your vsprintf() returns (int)." >&4
7871                 val2="$undef"
7872         else
7873                 echo "Your vsprintf() returns (char*)." >&4
7874                 val2="$define"
7875         fi
7876 else
7877         echo 'vprintf() NOT found.' >&4
7878                 val="$undef"
7879                 val2="$undef"
7880 fi
7881 set d_vprintf
7882 eval $setvar
7883 val=$val2
7884 set d_charvspr
7885 eval $setvar
7886
7887 : see if chown exists
7888 set chown d_chown
7889 eval $inlibc
7890
7891 : see if chroot exists
7892 set chroot d_chroot
7893 eval $inlibc
7894
7895 : see if chsize exists
7896 set chsize d_chsize
7897 eval $inlibc
7898
7899 : check for const keyword
7900 echo " "
7901 echo 'Checking to see if your C compiler knows about "const"...' >&4
7902 $cat >const.c <<'EOCP'
7903 typedef struct spug { int drokk; } spug;
7904 int main()
7905 {
7906         const char *foo;
7907         const spug y;
7908 }
7909 EOCP
7910 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7911         val="$define"
7912         echo "Yup, it does."
7913 else
7914         val="$undef"
7915         echo "Nope, it doesn't."
7916 fi
7917 set d_const
7918 eval $setvar
7919
7920 : see if crypt exists
7921 echo " "
7922 if set crypt val -f d_crypt; eval $csym; $val; then
7923         echo 'crypt() found.' >&4
7924         val="$define"
7925         cryptlib=''
7926 else
7927         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7928         if $test -z "$cryptlib"; then
7929                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7930         else
7931                 cryptlib=-lcrypt
7932         fi
7933         if $test -z "$cryptlib"; then
7934                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7935         else
7936                 cryptlib=-lcrypt
7937         fi
7938         if $test -z "$cryptlib"; then
7939                 cryptlib=`./loc libcrypt$_a "" $libpth`
7940         else
7941                 cryptlib=-lcrypt
7942         fi
7943         if $test -z "$cryptlib"; then
7944                 echo 'crypt() NOT found.' >&4
7945                 val="$undef"
7946         else
7947                 val="$define"
7948         fi
7949 fi
7950 set d_crypt
7951 eval $setvar
7952
7953 : get csh whereabouts
7954 case "$csh" in
7955 'csh') val="$undef" ;;
7956 *) val="$define" ;;
7957 esac
7958 set d_csh
7959 eval $setvar
7960 : Respect a hint or command line value for full_csh.
7961 case "$full_csh" in
7962 '') full_csh=$csh ;;
7963 esac
7964
7965 : see if cuserid exists
7966 set cuserid d_cuserid
7967 eval $inlibc
7968
7969 : see if this is a limits.h system
7970 set limits.h i_limits
7971 eval $inhdr
7972
7973 : see if this is a float.h system
7974 set float.h i_float
7975 eval $inhdr
7976
7977 : See if number of significant digits in a double precision number is known
7978 echo " "
7979 $cat >dbl_dig.c <<EOM
7980 #$i_limits I_LIMITS
7981 #$i_float I_FLOAT
7982 #ifdef I_LIMITS
7983 #include <limits.h>
7984 #endif
7985 #ifdef I_FLOAT
7986 #include <float.h>
7987 #endif
7988 #ifdef DBL_DIG
7989 printf("Contains DBL_DIG");
7990 #endif
7991 EOM
7992 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7993 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7994         echo "DBL_DIG found." >&4
7995         val="$define"
7996 else
7997         echo "DBL_DIG NOT found." >&4
7998         val="$undef"
7999 fi
8000 $rm -f dbl_dig.?
8001 set d_dbl_dig
8002 eval $setvar
8003
8004 : see if difftime exists
8005 set difftime d_difftime
8006 eval $inlibc
8007
8008 : see if this is a dirent system
8009 echo " "
8010 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8011         val="$define"
8012         echo "<dirent.h> found." >&4
8013 else
8014         val="$undef"
8015         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8016                 echo "<sys/dir.h> found." >&4
8017                 echo " "
8018         else
8019                 xinc=`./findhdr sys/ndir.h`
8020         fi
8021         echo "<dirent.h> NOT found." >&4
8022 fi
8023 set i_dirent
8024 eval $setvar
8025
8026 : Look for type of directory structure.
8027 echo " "
8028 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8029
8030 case "$direntrytype" in
8031 ''|' ')
8032         case "$i_dirent" in
8033         $define) guess1='struct dirent' ;;
8034         *) guess1='struct direct'  ;;
8035         esac
8036         ;;
8037 *)      guess1="$direntrytype"
8038         ;;
8039 esac
8040
8041 case "$guess1" in
8042 'struct dirent') guess2='struct direct' ;;
8043 *) guess2='struct dirent' ;;
8044 esac
8045                 
8046 if $contains "$guess1" try.c >/dev/null 2>&1; then
8047         direntrytype="$guess1"
8048         echo "Your directory entries are $direntrytype." >&4
8049 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8050         direntrytype="$guess2"
8051         echo "Your directory entries seem to be $direntrytype." >&4
8052 else
8053         echo "I don't recognize your system's directory entries." >&4
8054         rp="What type is used for directory entries on this system?"
8055         dflt="$guess1"
8056         . ./myread
8057         direntrytype="$ans"
8058 fi
8059 $rm -f try.c
8060
8061
8062 : see if the directory entry stores field length
8063 echo " "
8064 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8065 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8066         echo "Good, your directory entry keeps length information in d_namlen." >&4
8067         val="$define"
8068 else
8069         echo "Your directory entry does not know about the d_namlen field." >&4
8070         val="$undef"
8071 fi
8072 set d_dirnamlen
8073 eval $setvar
8074 $rm -f try.c
8075
8076 : see if dlerror exists
8077 xxx_runnm="$runnm"
8078 runnm=false
8079 set dlerror d_dlerror
8080 eval $inlibc
8081 runnm="$xxx_runnm"
8082
8083 : see if dlfcn is available
8084 set dlfcn.h i_dlfcn
8085 eval $inhdr
8086
8087 case "$usedl" in
8088 $define|y|true)
8089         $cat << EOM
8090
8091 On a few systems, the dynamically loaded modules that perl generates and uses
8092 will need a different extension than shared libs. The default will probably
8093 be appropriate.
8094
8095 EOM
8096         case "$dlext" in
8097         '')     dflt="$so" ;;
8098         *)      dflt="$dlext" ;;
8099         esac
8100         rp='What is the extension of dynamically loaded modules'
8101         . ./myread
8102         dlext="$ans"
8103         ;;
8104 *)
8105         dlext="none"
8106         ;;
8107 esac
8108
8109 : Check if dlsym need a leading underscore
8110 echo " "
8111 val="$undef"
8112
8113 case "$dlsrc" in
8114 dl_dlopen.xs)
8115         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8116         $cat >dyna.c <<'EOM'
8117 fred () { }
8118 EOM
8119
8120 $cat >fred.c<<EOM
8121
8122 #include <stdio.h>
8123 #$i_dlfcn I_DLFCN
8124 #ifdef I_DLFCN
8125 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8126 #else
8127 #include <sys/types.h>
8128 #include <nlist.h>
8129 #include <link.h>
8130 #endif
8131
8132 extern int fred() ;
8133
8134 int main()
8135 {
8136     void * handle ;
8137     void * symbol ;
8138 #ifndef RTLD_LAZY
8139     int mode = 1 ;
8140 #else
8141     int mode = RTLD_LAZY ;
8142 #endif
8143     handle = dlopen("./dyna.$dlext", mode) ;
8144     if (handle == NULL) {
8145         printf ("1\n") ;
8146         fflush (stdout) ;
8147         exit(0);
8148     }
8149     symbol = dlsym(handle, "fred") ;
8150     if (symbol == NULL) {
8151         /* try putting a leading underscore */
8152         symbol = dlsym(handle, "_fred") ;
8153         if (symbol == NULL) {
8154             printf ("2\n") ;
8155             fflush (stdout) ;
8156             exit(0);
8157         }
8158         printf ("3\n") ;
8159     }
8160     else
8161         printf ("4\n") ;
8162     fflush (stdout) ;
8163     exit(0);
8164 }
8165 EOM
8166         : Call the object file tmp-dyna.o in case dlext=o.
8167         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8168                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8169                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8170                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8171                 xxx=`./fred`
8172                 case $xxx in
8173                 1)      echo "Test program failed using dlopen." >&4
8174                         echo "Perhaps you should not use dynamic loading." >&4;;
8175                 2)      echo "Test program failed using dlsym." >&4
8176                         echo "Perhaps you should not use dynamic loading." >&4;;
8177                 3)      echo "dlsym needs a leading underscore" >&4
8178                         val="$define" ;;
8179                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8180                 esac
8181         else
8182                 echo "I can't compile and run the test program." >&4
8183                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8184         fi
8185         ;;
8186 esac
8187                 
8188 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8189
8190 set d_dlsymun
8191 eval $setvar
8192
8193 hasproto='varname=$1; func=$2; shift; shift;
8194 while $test $# -ge 2; do
8195         case "$1" in
8196         $define) echo "#include <$2>";;
8197         esac ;
8198     shift 2;
8199 done > try.c;
8200 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8201 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8202         echo "$func() prototype found.";
8203         val="$define";
8204 else
8205         echo "$func() prototype NOT found.";
8206         val="$undef";
8207 fi;
8208 set $varname;
8209 eval $setvar;
8210 $rm -f try.c tryout.c'
8211
8212 : see if prototype for drand48 is available
8213 echo " "
8214 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8215 eval $hasproto
8216
8217 : see if dup2 exists
8218 set dup2 d_dup2
8219 eval $inlibc
8220
8221 : see if eaccess exists
8222 set eaccess d_eaccess
8223 eval $inlibc
8224
8225 : see if endgrent exists
8226 set endgrent d_endgrent
8227 eval $inlibc
8228
8229 : see if endhostent exists
8230 set endhostent d_endhent
8231 eval $inlibc
8232
8233 : see if endnetent exists
8234 set endnetent d_endnent
8235 eval $inlibc
8236
8237 : see if endprotoent exists
8238 set endprotoent d_endpent
8239 eval $inlibc
8240
8241 : see if endpwent exists
8242 set endpwent d_endpwent
8243 eval $inlibc
8244
8245 : see if endservent exists
8246 set endservent d_endsent
8247 eval $inlibc
8248
8249 : see if endspent exists
8250 set endspent d_endspent
8251 eval $inlibc
8252
8253 : Locate the flags for 'open()'
8254 echo " "
8255 $cat >open3.c <<'EOCP'
8256 #include <sys/types.h>
8257 #ifdef I_FCNTL
8258 #include <fcntl.h>
8259 #endif
8260 #ifdef I_SYS_FILE
8261 #include <sys/file.h>
8262 #endif
8263 int main() {
8264         if(O_RDONLY);
8265 #ifdef O_TRUNC
8266         exit(0);
8267 #else
8268         exit(1);
8269 #endif
8270 }
8271 EOCP
8272 : check sys/file.h first to get FREAD on Sun
8273 if $test `./findhdr sys/file.h` && \
8274                 set open3 -DI_SYS_FILE && eval $compile; then
8275         h_sysfile=true;
8276         echo "<sys/file.h> defines the O_* constants..." >&4
8277         if ./open3; then
8278                 echo "and you have the 3 argument form of open()." >&4
8279                 val="$define"
8280         else
8281                 echo "but not the 3 argument form of open().  Oh, well." >&4
8282                 val="$undef"
8283         fi
8284 elif $test `./findhdr fcntl.h` && \
8285                 set open3 -DI_FCNTL && eval $compile; then
8286         h_fcntl=true;
8287         echo "<fcntl.h> defines the O_* constants..." >&4
8288         if ./open3; then
8289                 echo "and you have the 3 argument form of open()." >&4
8290                 val="$define"
8291         else
8292                 echo "but not the 3 argument form of open().  Oh, well." >&4
8293                 val="$undef"
8294         fi
8295 else
8296         val="$undef"
8297         echo "I can't find the O_* constant definitions!  You got problems." >&4
8298 fi
8299 set d_open3
8300 eval $setvar
8301 $rm -f open3*
8302
8303 : see which of string.h or strings.h is needed
8304 echo " "
8305 strings=`./findhdr string.h`
8306 if $test "$strings" && $test -r "$strings"; then
8307         echo "Using <string.h> instead of <strings.h>." >&4
8308         val="$define"
8309 else
8310         val="$undef"
8311         strings=`./findhdr strings.h`
8312         if $test "$strings" && $test -r "$strings"; then
8313                 echo "Using <strings.h> instead of <string.h>." >&4
8314         else
8315                 echo "No string header found -- You'll surely have problems." >&4
8316         fi
8317 fi
8318 set i_string
8319 eval $setvar
8320 case "$i_string" in
8321 "$undef") strings=`./findhdr strings.h`;;
8322 *)        strings=`./findhdr string.h`;;
8323 esac
8324
8325 : check for non-blocking I/O stuff
8326 case "$h_sysfile" in
8327 true) echo "#include <sys/file.h>" > head.c;;
8328 *)
8329         case "$h_fcntl" in
8330         true) echo "#include <fcntl.h>" > head.c;;
8331         *) echo "#include <sys/fcntl.h>" > head.c;;
8332         esac
8333         ;;
8334 esac
8335 echo " "
8336 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8337 case "$o_nonblock" in
8338 '')
8339         $cat head.c > try.c
8340         $cat >>try.c <<'EOCP'
8341 #include <stdio.h>
8342 int main() {
8343 #ifdef O_NONBLOCK
8344         printf("O_NONBLOCK\n");
8345         exit(0);
8346 #endif
8347 #ifdef O_NDELAY
8348         printf("O_NDELAY\n");
8349         exit(0);
8350 #endif
8351 #ifdef FNDELAY
8352         printf("FNDELAY\n");
8353         exit(0);
8354 #endif
8355         exit(0);
8356 }
8357 EOCP
8358         set try
8359         if eval $compile_ok; then
8360                 o_nonblock=`./try`
8361                 case "$o_nonblock" in
8362                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8363                 *) echo "Seems like we can use $o_nonblock.";;
8364                 esac
8365         else
8366                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8367         fi
8368         ;;
8369 *) echo "Using $hint value $o_nonblock.";;
8370 esac
8371 $rm -f try try.* .out core
8372
8373 echo " "
8374 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8375 case "$eagain" in
8376 '')
8377         $cat head.c > try.c
8378         $cat >>try.c <<EOCP
8379 #include <errno.h>
8380 #include <sys/types.h>
8381 #include <signal.h>
8382 #include <stdio.h> 
8383 #define MY_O_NONBLOCK $o_nonblock
8384 #ifndef errno  /* XXX need better Configure test */
8385 extern int errno;
8386 #endif
8387 #$i_unistd I_UNISTD
8388 #ifdef I_UNISTD
8389 #include <unistd.h>
8390 #endif
8391 #ifdef $i_string
8392 #include <string.h>
8393 #else
8394 #include <strings.h>
8395 #endif
8396 $signal_t blech(x) int x; { exit(3); }
8397 EOCP
8398         $cat >> try.c <<'EOCP'
8399 int main()
8400 {
8401         int pd[2];
8402         int pu[2];
8403         char buf[1];
8404         char string[100];
8405
8406         pipe(pd);       /* Down: child -> parent */
8407         pipe(pu);       /* Up: parent -> child */
8408         if (0 != fork()) {
8409                 int ret;
8410                 close(pd[1]);   /* Parent reads from pd[0] */
8411                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8412                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8413                         exit(1);
8414                 signal(SIGALRM, blech);
8415                 alarm(5);
8416                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8417                         exit(2);
8418                 sprintf(string, "%d\n", ret);
8419                 write(2, string, strlen(string));
8420                 alarm(0);
8421 #ifdef EAGAIN
8422                 if (errno == EAGAIN) {
8423                         printf("EAGAIN\n");
8424                         goto ok;
8425                 }
8426 #endif
8427 #ifdef EWOULDBLOCK
8428                 if (errno == EWOULDBLOCK)
8429                         printf("EWOULDBLOCK\n");
8430 #endif
8431         ok:
8432                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8433                 sleep(2);                               /* Give it time to close our pipe */
8434                 alarm(5);
8435                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8436                 alarm(0);
8437                 sprintf(string, "%d\n", ret);
8438                 write(3, string, strlen(string));
8439                 exit(0);
8440         }
8441
8442         close(pd[0]);                   /* We write to pd[1] */
8443         close(pu[1]);                   /* We read from pu[0] */
8444         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8445         close(pd[1]);                   /* Pipe pd is now fully closed! */
8446         exit(0);                                /* Bye bye, thank you for playing! */
8447 }
8448 EOCP
8449         set try
8450         if eval $compile_ok; then
8451                 echo "$startsh" >mtry
8452                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8453                 chmod +x mtry
8454                 ./mtry >/dev/null 2>&1
8455                 case $? in
8456                 0) eagain=`$cat try.out`;;
8457                 1) echo "Could not perform non-blocking setting!";;
8458                 2) echo "I did a successful read() for something that was not there!";;
8459                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8460                 *) echo "Something terribly wrong happened during testing.";;
8461                 esac
8462                 rd_nodata=`$cat try.ret`
8463                 echo "A read() system call with no data present returns $rd_nodata."
8464                 case "$rd_nodata" in
8465                 0|-1) ;;
8466                 *)
8467                         echo "(That's peculiar, fixing that to be -1.)"
8468                         rd_nodata=-1
8469                         ;;
8470                 esac
8471                 case "$eagain" in
8472                 '')
8473                         echo "Forcing errno EAGAIN on read() with no data available."
8474                         eagain=EAGAIN
8475                         ;;
8476                 *)
8477                         echo "Your read() sets errno to $eagain when no data is available."
8478                         ;;
8479                 esac
8480                 status=`$cat try.err`
8481                 case "$status" in
8482                 0) echo "And it correctly returns 0 to signal EOF.";;
8483                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8484                 *) echo "However, your read() returns '$status' on EOF??";;
8485                 esac
8486                 val="$define"
8487                 if test "$status" = "$rd_nodata"; then
8488                         echo "WARNING: you can't distinguish between EOF and no data!"
8489                         val="$undef"
8490                 fi
8491         else
8492                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8493                 eagain=EAGAIN
8494         fi
8495         set d_eofnblk
8496         eval $setvar
8497         ;;
8498 *)
8499         echo "Using $hint value $eagain."
8500         echo "Your read() returns $rd_nodata when no data is present."
8501         case "$d_eofnblk" in
8502         "$define") echo "And you can see EOF because read() returns 0.";;
8503         "$undef") echo "But you can't see EOF status from read() returned value.";;
8504         *)
8505                 echo "(Assuming you can't see EOF status from read anyway.)"
8506                 d_eofnblk=$undef
8507                 ;;
8508         esac
8509         ;;
8510 esac
8511 $rm -f try try.* .out core head.c mtry
8512
8513 : see if fchmod exists
8514 set fchmod d_fchmod
8515 eval $inlibc
8516
8517 : see if fchown exists
8518 set fchown d_fchown
8519 eval $inlibc
8520
8521 : see if this is an fcntl system
8522 set fcntl d_fcntl
8523 eval $inlibc
8524
8525 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8526 while $test $# -ge 2; do
8527         case "$1" in
8528         $define) echo "#include <$2>";;
8529         esac ;
8530     shift 2;
8531 done > try.c;
8532 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8533 set try;
8534 if eval $compile; then
8535         val="$define";
8536 else
8537         val="$undef";
8538 fi;
8539 set $varname;
8540 eval $setvar;
8541 $rm -f try.c try.o'
8542
8543 socketlib=''
8544 sockethdr=''
8545 : see whether socket exists
8546 echo " "
8547 $echo $n "Hmm... $c" >&4
8548 if set socket val -f d_socket; eval $csym; $val; then
8549         echo "Looks like you have Berkeley networking support." >&4
8550         d_socket="$define"
8551         if set setsockopt val -f; eval $csym; $val; then
8552                 d_oldsock="$undef"
8553         else
8554                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8555                 d_oldsock="$define"
8556         fi
8557 else
8558         if $contains socklib libc.list >/dev/null 2>&1; then
8559                 echo "Looks like you have Berkeley networking support." >&4
8560                 d_socket="$define"
8561                 : we will have to assume that it supports the 4.2 BSD interface
8562                 d_oldsock="$undef"
8563         else
8564                 echo "You don't have Berkeley networking in libc$_a..." >&4
8565                 if test "X$d_socket" = "X$define"; then
8566                    echo "...but you seem to believe that you have sockets." >&4
8567                 else
8568                         for net in net socket
8569                         do
8570                                 if test -f /usr/lib/lib$net$_a; then
8571                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8572                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8573                                         if $contains socket libc.list >/dev/null 2>&1; then
8574                                                 d_socket="$define"
8575                                                 socketlib="-l$net"
8576                                                 case "$net" in
8577                                                 net)
8578                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8579                                                         sockethdr="-I/usr/netinclude"
8580                                                         ;;
8581                                                 esac
8582                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8583                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8584                                                         d_oldsock="$undef"
8585                                                 else
8586                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8587                                                         d_oldsock="$define"
8588                                                 fi
8589                                                 break
8590                                         fi
8591                                 fi
8592                         done
8593                         if test "X$d_socket" != "X$define"; then
8594                            echo "or anywhere else I see." >&4
8595                            d_socket="$undef"
8596                            d_oldsock="$undef"
8597                         fi
8598                 fi
8599         fi
8600 fi
8601
8602 : see if socketpair exists
8603 set socketpair d_sockpair
8604 eval $inlibc
8605
8606
8607 echo " "
8608 echo "Checking the availability of certain socket constants..." >& 4
8609 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8610         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8611         $cat >try.c <<EOF
8612 #include <sys/types.h>
8613 #include <sys/socket.h>
8614 int main() {
8615     int i = $ENUM;
8616 }
8617 EOF
8618         val="$undef"
8619         set try; if eval $compile; then
8620                 val="$define"
8621         fi
8622         set d_${enum}; eval $setvar
8623         $rm -f try.c try
8624 done
8625
8626 : see if sys/select.h has to be included
8627 set sys/select.h i_sysselct
8628 eval $inhdr
8629
8630 : see if we should include time.h, sys/time.h, or both
8631 echo " "
8632 if test "X$timeincl" = X; then
8633         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8634         $echo $n "I'm now running the test program...$c"
8635         $cat >try.c <<'EOCP'
8636 #include <sys/types.h>
8637 #ifdef I_TIME
8638 #include <time.h>
8639 #endif
8640 #ifdef I_SYSTIME
8641 #ifdef SYSTIMEKERNEL
8642 #define KERNEL
8643 #endif
8644 #include <sys/time.h>
8645 #endif
8646 #ifdef I_SYSSELECT
8647 #include <sys/select.h>
8648 #endif
8649 int main()
8650 {
8651         struct tm foo;
8652 #ifdef S_TIMEVAL
8653         struct timeval bar;
8654 #endif
8655 #ifdef S_TIMEZONE
8656         struct timezone tzp;
8657 #endif
8658         if (foo.tm_sec == foo.tm_sec)
8659                 exit(0);
8660 #ifdef S_TIMEVAL
8661         if (bar.tv_sec == bar.tv_sec)
8662                 exit(0);
8663 #endif
8664         exit(1);
8665 }
8666 EOCP
8667         flags=''
8668         for s_timezone in '-DS_TIMEZONE' ''; do
8669         sysselect=''
8670         for s_timeval in '-DS_TIMEVAL' ''; do
8671         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8672         for i_time in '' '-DI_TIME'; do
8673         for i_systime in '-DI_SYSTIME' ''; do
8674                 case "$flags" in
8675                 '') $echo $n ".$c"
8676                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8677                         if eval $compile; then
8678                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8679                                 shift
8680                                 flags="$*"
8681                                 echo " "
8682                                 $echo $n "Succeeded with $flags$c"
8683                         fi
8684                         ;;
8685                 esac
8686         done
8687         done
8688         done
8689         done
8690         done
8691         timeincl=''
8692         echo " "
8693         case "$flags" in
8694         *SYSTIMEKERNEL*) i_systimek="$define"
8695                 timeincl=`./findhdr sys/time.h`
8696                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8697         *) i_systimek="$undef";;
8698         esac
8699         case "$flags" in
8700         *I_TIME*) i_time="$define"
8701                 timeincl=`./findhdr time.h`" $timeincl"
8702                 echo "We'll include <time.h>." >&4;;
8703         *) i_time="$undef";;
8704         esac
8705         case "$flags" in
8706         *I_SYSTIME*) i_systime="$define"
8707                 timeincl=`./findhdr sys/time.h`" $timeincl"
8708                 echo "We'll include <sys/time.h>." >&4;;
8709         *) i_systime="$undef";;
8710         esac
8711         $rm -f try.c try
8712 fi
8713
8714 : check for fd_set items
8715 $cat <<EOM
8716
8717 Checking to see how well your C compiler handles fd_set and friends ...
8718 EOM
8719 $cat >fd_set.c <<EOCP
8720 #$i_systime I_SYS_TIME
8721 #$i_sysselct I_SYS_SELECT
8722 #$d_socket HAS_SOCKET
8723 #include <sys/types.h>
8724 #ifdef HAS_SOCKET
8725 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8726 #endif
8727 #ifdef I_SYS_TIME
8728 #include <sys/time.h>
8729 #endif
8730 #ifdef I_SYS_SELECT
8731 #include <sys/select.h>
8732 #endif
8733 int main() {
8734         fd_set fds;
8735
8736 #ifdef TRYBITS
8737         if(fds.fds_bits);
8738 #endif
8739
8740 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8741         exit(0);
8742 #else
8743         exit(1);
8744 #endif
8745 }
8746 EOCP
8747 set fd_set -DTRYBITS
8748 if eval $compile; then
8749         d_fds_bits="$define"
8750         d_fd_set="$define"
8751         echo "Well, your system knows about the normal fd_set typedef..." >&4
8752         if ./fd_set; then
8753                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8754                 d_fd_macros="$define"
8755         else
8756                 $cat >&4 <<'EOM'
8757 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8758 EOM
8759                 d_fd_macros="$undef"
8760         fi
8761 else
8762         $cat <<'EOM'
8763 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8764 EOM
8765         set fd_set
8766         if eval $compile; then
8767                 d_fds_bits="$undef"
8768                 d_fd_set="$define"
8769                 echo "Well, your system has some sort of fd_set available..." >&4
8770                 if ./fd_set; then
8771                         echo "and you have the normal fd_set macros." >&4
8772                         d_fd_macros="$define"
8773                 else
8774                         $cat <<'EOM'
8775 but not the normal fd_set macros!  Gross!  More work for me...
8776 EOM
8777                         d_fd_macros="$undef"
8778                 fi
8779         else
8780         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8781                 d_fd_set="$undef"
8782                 d_fds_bits="$undef"
8783                 d_fd_macros="$undef"
8784         fi
8785 fi
8786 $rm -f fd_set*
8787
8788 : see if fgetpos exists
8789 set fgetpos d_fgetpos
8790 eval $inlibc
8791
8792 : see if flock exists
8793 set flock d_flock
8794 eval $inlibc
8795
8796 : see if fork exists
8797 set fork d_fork
8798 eval $inlibc
8799
8800 : see if pathconf exists
8801 set pathconf d_pathconf
8802 eval $inlibc
8803
8804 : see if fpathconf exists
8805 set fpathconf d_fpathconf
8806 eval $inlibc
8807
8808
8809 : check for off64_t
8810 echo " "
8811 echo "Checking to see if your system supports off64_t..." >&4
8812 $cat >try.c <<EOCP
8813 #include <sys/types.h>
8814 #include <unistd.h>
8815 int main() { off64_t x = 7; }'
8816 EOCP
8817 set try
8818 if eval $compile; then
8819         val="$define"
8820         echo "Yes, it does."
8821 else
8822         val="$undef"
8823         echo "No, it doesn't."
8824         case "$lseeksize" in
8825         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8826         esac
8827 fi
8828 $rm -f try.* try
8829 set d_off64_t
8830 eval $setvar
8831
8832 : check for fpos64_t
8833 echo " "
8834 echo "Checking to see if your system supports fpos64_t..." >&4
8835 $cat >try.c <<EOCP
8836 #include <sys/stdio.h>
8837 int main() { fpos64_t x x = 7; }'
8838 EOCP
8839 set try
8840 if eval $compile; then
8841         val="$define"
8842         echo "Yes, it does."
8843 else
8844         val="$undef"
8845         echo "No, it doesn't."
8846         case "$fpossize" in
8847         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8848         esac
8849 fi
8850 $rm -f try.* try
8851 set d_fpos64_t
8852 eval $setvar
8853
8854 hasstruct='varname=$1; struct=$2; shift; shift;
8855 while $test $# -ge 2; do
8856         case "$1" in
8857         $define) echo "#include <$2>";;
8858         esac ;
8859     shift 2;
8860 done > try.c;
8861 echo "int main () { struct $struct foo; }" >> try.c;
8862 set try;
8863 if eval $compile; then
8864         val="$define";
8865 else
8866         val="$undef";
8867 fi;
8868 set $varname;
8869 eval $setvar;
8870 $rm -f try.c try.o'
8871
8872 : see if this is a sys/param system
8873 set sys/param.h i_sysparam
8874 eval $inhdr
8875
8876 : see if this is a sys/mount.h system
8877 set sys/mount.h i_sysmount
8878 eval $inhdr
8879
8880 : see if sys/types.h has to be included
8881 set sys/types.h i_systypes
8882 eval $inhdr
8883
8884
8885 echo " "
8886 echo "Checking to see if your system supports struct fs_data..." >&4
8887 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8888 eval $hasstruct
8889 case "$d_fs_data_s" in
8890 "$define")      echo "Yes, it does."   ;;
8891 *)              echo "No, it doesn't." ;;
8892 esac
8893
8894 : see if fseeko exists
8895 set fseeko d_fseeko
8896 eval $inlibc
8897 case "$longsize" in
8898 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8899 esac
8900
8901 : see if fsetpos exists
8902 set fsetpos d_fsetpos
8903 eval $inlibc
8904
8905
8906 : see if fstatfs exists
8907 set fstatfs d_fstatfs
8908 eval $inlibc
8909
8910
8911 : see if statvfs exists
8912 set statvfs d_statvfs
8913 eval $inlibc
8914
8915 : see if fstatvfs exists
8916 set fstatvfs d_fstatvfs
8917 eval $inlibc
8918
8919
8920 : see if ftello exists
8921 set ftello d_ftello
8922 eval $inlibc
8923 case "$longsize" in
8924 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
8925 esac
8926
8927 : see if getcwd exists
8928 set getcwd d_getcwd
8929 eval $inlibc
8930
8931 : see if getgrent exists
8932 set getgrent d_getgrent
8933 eval $inlibc
8934
8935 : see if gethostbyaddr exists
8936 set gethostbyaddr d_gethbyaddr
8937 eval $inlibc
8938
8939 : see if gethostbyname exists
8940 set gethostbyname d_gethbyname
8941 eval $inlibc
8942
8943 : see if gethostent exists
8944 set gethostent d_gethent
8945 eval $inlibc
8946
8947 : see how we will look up host name
8948 echo " "
8949 call=''
8950 if set gethostname val -f d_gethname; eval $csym; $val; then
8951         echo 'gethostname() found.' >&4
8952         d_gethname="$define"
8953         call=gethostname
8954 fi
8955 if set uname val -f d_uname; eval $csym; $val; then
8956         if ./xenix; then
8957                 $cat <<'EOM'
8958 uname() was found, but you're running xenix, and older versions of xenix
8959 have a broken uname(). If you don't really know whether your xenix is old
8960 enough to have a broken system call, use the default answer.
8961
8962 EOM
8963                 dflt=y
8964                 case "$d_uname" in
8965                 "$define") dflt=n;;
8966                 esac
8967                 rp='Is your uname() broken?'
8968                 . ./myread
8969                 case "$ans" in
8970                 n*) d_uname="$define"; call=uname;;
8971                 esac
8972         else
8973                 echo 'uname() found.' >&4
8974                 d_uname="$define"
8975                 case "$call" in
8976                 '') call=uname ;;
8977                 esac
8978         fi
8979 fi
8980 case "$d_gethname" in
8981 '') d_gethname="$undef";;
8982 esac
8983 case "$d_uname" in
8984 '') d_uname="$undef";;
8985 esac
8986 case "$d_uname$d_gethname" in
8987 *define*)
8988         dflt=n
8989         cat <<EOM
8990  
8991 Every now and then someone has a $call() that lies about the hostname
8992 but can't be fixed for political or economic reasons.  If you wish, I can
8993 pretend $call() isn't there and maybe compute hostname at run-time
8994 thanks to the '$phostname' command.
8995
8996 EOM
8997         rp="Shall I ignore $call() from now on?"
8998         . ./myread
8999         case "$ans" in
9000         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9001         esac;;
9002 esac
9003 case "$phostname" in
9004 '') aphostname='';;
9005 *) case "$aphostname" in
9006         /*) ;;
9007         *) set X $phostname
9008                 shift
9009                 file=$1
9010                 shift
9011                 file=`./loc $file $file $pth`
9012                 aphostname=`echo $file $*`
9013                 ;;
9014         esac
9015         ;;
9016 esac
9017 case "$d_uname$d_gethname" in
9018 *define*) ;;
9019 *)
9020         case "$phostname" in
9021         '')
9022                 echo "There will be no way for $package to get your hostname." >&4;;
9023         *)
9024         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9025                 ;;
9026         esac;;
9027 esac
9028 case "$d_phostname" in
9029 '') d_phostname="$undef";;
9030 esac
9031
9032 : see if this is a netdb.h system
9033 set netdb.h i_netdb
9034 eval $inhdr
9035
9036 : see if prototypes for various gethostxxx netdb.h functions are available
9037 echo " "
9038 set d_gethostprotos gethostent $i_netdb netdb.h
9039 eval $hasproto
9040
9041 : see if getlogin exists
9042 set getlogin d_getlogin
9043 eval $inlibc
9044
9045 : see if getmnt exists
9046 set getmnt d_getmnt
9047 eval $inlibc
9048
9049 : see if getmntent exists
9050 set getmntent d_getmntent
9051 eval $inlibc
9052
9053 : see if getnetbyaddr exists
9054 set getnetbyaddr d_getnbyaddr
9055 eval $inlibc
9056
9057 : see if getnetbyname exists
9058 set getnetbyname d_getnbyname
9059 eval $inlibc
9060
9061 : see if getnetent exists
9062 set getnetent d_getnent
9063 eval $inlibc
9064
9065 : see if prototypes for various getnetxxx netdb.h functions are available
9066 echo " "
9067 set d_getnetprotos getnetent $i_netdb netdb.h
9068 eval $hasproto
9069
9070
9071 : see if getprotobyname exists
9072 set getprotobyname d_getpbyname
9073 eval $inlibc
9074
9075 : see if getprotobynumber exists
9076 set getprotobynumber d_getpbynumber
9077 eval $inlibc
9078
9079 : see if getprotoent exists
9080 set getprotoent d_getpent
9081 eval $inlibc
9082
9083 : see if getpgid exists
9084 set getpgid d_getpgid
9085 eval $inlibc
9086
9087 : see if getpgrp2 exists
9088 set getpgrp2 d_getpgrp2
9089 eval $inlibc
9090
9091 : see if getppid exists
9092 set getppid d_getppid
9093 eval $inlibc
9094
9095 : see if getpriority exists
9096 set getpriority d_getprior
9097 eval $inlibc
9098
9099 : see if prototypes for various getprotoxxx netdb.h functions are available
9100 echo " "
9101 set d_getprotoprotos getprotoent $i_netdb netdb.h
9102 eval $hasproto
9103
9104 : see if getpwent exists
9105 set getpwent d_getpwent
9106 eval $inlibc
9107
9108
9109 : see if getservbyname exists
9110 set getservbyname d_getsbyname
9111 eval $inlibc
9112
9113 : see if getservbyport exists
9114 set getservbyport d_getsbyport
9115 eval $inlibc
9116
9117 : see if getservent exists
9118 set getservent d_getsent
9119 eval $inlibc
9120
9121 : see if prototypes for various getservxxx netdb.h functions are available
9122 echo " "
9123 set d_getservprotos getservent $i_netdb netdb.h
9124 eval $hasproto
9125
9126 : see if getspent exists
9127 set getspent d_getspent
9128 eval $inlibc
9129
9130 : see if getspnam exists
9131 set getspnam d_getspnam
9132 eval $inlibc
9133
9134 : see if gettimeofday or ftime exists
9135 set gettimeofday d_gettimeod
9136 eval $inlibc
9137 case "$d_gettimeod" in
9138 "$undef")
9139         set ftime d_ftime 
9140         eval $inlibc
9141         ;;
9142 *)
9143         val="$undef"; set d_ftime; eval $setvar
9144         ;;
9145 esac
9146 case "$d_gettimeod$d_ftime" in
9147 "$undef$undef")
9148         echo " "
9149         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9150         ;;
9151 esac
9152
9153 : see if this is an grp system
9154 set grp.h i_grp
9155 eval $inhdr
9156
9157 case "$i_grp" in
9158 $define)
9159         xxx=`./findhdr grp.h`
9160         $cppstdin $cppflags $cppminus < $xxx >$$.h
9161
9162         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9163                 val="$define"
9164         else
9165                 val="$undef"
9166         fi
9167         set d_grpasswd
9168         eval $setvar
9169
9170         $rm -f $$.h
9171         ;;
9172 *)
9173         val="$undef";
9174         set d_grpasswd; eval $setvar
9175         ;;
9176 esac
9177
9178 : see if hasmntopt exists
9179 set hasmntopt d_hasmntopt
9180 eval $inlibc
9181
9182 : see if this is a netinet/in.h or sys/in.h system
9183 set netinet/in.h i_niin sys/in.h i_sysin
9184 eval $inhdr
9185
9186 : see if arpa/inet.h has to be included
9187 set arpa/inet.h i_arpainet
9188 eval $inhdr
9189
9190 : see if htonl --and friends-- exists
9191 val=''
9192 set htonl val
9193 eval $inlibc
9194
9195 : Maybe they are macros.
9196 case "$val" in
9197 $undef)
9198         $cat >htonl.c <<EOM
9199 #include <stdio.h>
9200 #include <sys/types.h>
9201 #$i_niin I_NETINET_IN
9202 #$i_sysin I_SYS_IN
9203 #$i_arpainet I_ARPA_INET
9204 #ifdef I_NETINET_IN
9205 #include <netinet/in.h>
9206 #endif
9207 #ifdef I_SYS_IN
9208 #include <sys/in.h>
9209 #endif
9210 #ifdef I_ARPA_INET
9211 #include <arpa/inet.h>
9212 #endif
9213 #ifdef htonl
9214 printf("Defined as a macro.");
9215 #endif
9216 EOM
9217         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9218         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9219                 val="$define"
9220                 echo "But it seems to be defined as a macro." >&4
9221         fi
9222         $rm -f htonl.?
9223         ;;
9224 esac
9225 set d_htonl
9226 eval $setvar
9227
9228 : see if iconv exists
9229 set iconv d_iconv
9230 eval $inlibc
9231
9232 : index or strchr
9233 echo " "
9234 if set index val -f; eval $csym; $val; then
9235         if set strchr val -f d_strchr; eval $csym; $val; then
9236                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9237                         val="$define"
9238                         vali="$undef"
9239                         echo "strchr() found." >&4
9240                 else
9241                         val="$undef"
9242                         vali="$define"
9243                         echo "index() found." >&4
9244                 fi
9245         else
9246                 val="$undef"
9247                 vali="$define"
9248                 echo "index() found." >&4
9249         fi
9250 else
9251         if set strchr val -f d_strchr; eval $csym; $val; then
9252                 val="$define"
9253                 vali="$undef"
9254                 echo "strchr() found." >&4
9255         else
9256                 echo "No index() or strchr() found!" >&4
9257                 val="$undef"
9258                 vali="$undef"
9259         fi
9260 fi
9261 set d_strchr; eval $setvar
9262 val="$vali"
9263 set d_index; eval $setvar
9264
9265 : check whether inet_aton exists
9266 set inet_aton d_inetaton
9267 eval $inlibc
9268
9269 : see if inttypes.h is available
9270 : we want a real compile instead of Inhdr because some systems
9271 : have an inttypes.h which includes non-existent headers
9272 echo " "
9273 $cat >try.c <<EOCP
9274 #include <inttypes.h>
9275 int main() {
9276         static int32_t foo32 = 0x12345678;
9277 }
9278 EOCP
9279 set try
9280 if eval $compile; then
9281         echo "<inttypes.h> found." >&4
9282         val="$define"
9283 else
9284         echo "<inttypes.h> NOT found." >&4
9285         val="$undef"
9286 fi
9287 $rm -f try.c try
9288 set i_inttypes
9289 eval $setvar
9290
9291 : check for int64_t
9292 echo " "
9293 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9294 $cat >try.c <<EOCP
9295 #include <sys/types.h>
9296 #$i_inttypes I_INTTYPES
9297 #ifdef I_INTTYPES
9298 #include <inttypes.h>
9299 #endif
9300 int main() { int64_t x = 7; }
9301 EOCP
9302 set try
9303 if eval $compile; then
9304         val="$define"
9305         echo " Yes, it does." >&4
9306 else
9307         val="$undef"
9308         echo " No, it doesn't." >&4
9309 fi
9310 $rm -f try try.*
9311 set d_int64t
9312 eval $setvar
9313
9314 : Look for isascii
9315 echo " "
9316 $cat >isascii.c <<'EOCP'
9317 #include <stdio.h>
9318 #include <ctype.h>
9319 int main() {
9320         int c = 'A';
9321         if (isascii(c))
9322                 exit(0);
9323         else
9324                 exit(1);
9325 }
9326 EOCP
9327 set isascii
9328 if eval $compile; then
9329         echo "isascii() found." >&4
9330         val="$define"
9331 else
9332         echo "isascii() NOT found." >&4
9333         val="$undef"
9334 fi
9335 set d_isascii
9336 eval $setvar
9337 $rm -f isascii*
9338
9339 : see if killpg exists
9340 set killpg d_killpg
9341 eval $inlibc
9342
9343 : see if lchown exists
9344 echo " "
9345 $cat > try.c <<'EOCP'
9346 /* System header to define __stub macros and hopefully few prototypes,
9347     which can conflict with char lchown(); below.  */
9348 #include <assert.h>
9349 /* Override any gcc2 internal prototype to avoid an error.  */
9350 /* We use char because int might match the return type of a gcc2
9351    builtin and then its argument prototype would still apply.  */
9352 char lchown();
9353 int main() {
9354     /*  The GNU C library defines this for functions which it implements
9355         to always fail with ENOSYS.  Some functions are actually named
9356         something starting with __ and the normal name is an alias.  */
9357 #if defined (__stub_lchown) || defined (__stub___lchown)
9358 choke me
9359 #else
9360 lchown();
9361 #endif
9362 ; return 0; }
9363 EOCP
9364 set try
9365 if eval $compile; then
9366     $echo "lchown() found." >&4
9367     val="$define"
9368 else
9369     $echo "lchown() NOT found." >&4
9370     val="$undef"
9371 fi
9372 set d_lchown
9373 eval $setvar
9374
9375 : See if number of significant digits in a double precision number is known
9376 echo " "
9377 $cat >ldbl_dig.c <<EOM
9378 #$i_limits I_LIMITS
9379 #$i_float I_FLOAT
9380 #ifdef I_LIMITS
9381 #include <limits.h>
9382 #endif
9383 #ifdef I_FLOAT
9384 #include <float.h>
9385 #endif
9386 #ifdef LDBL_DIG
9387 printf("Contains LDBL_DIG");
9388 #endif
9389 EOM
9390 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9391 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9392         echo "LDBL_DIG found." >&4
9393         val="$define"
9394 else
9395         echo "LDBL_DIG NOT found." >&4
9396         val="$undef"
9397 fi
9398 $rm -f ldbl_dig.?
9399 set d_ldbl_dig
9400 eval $setvar
9401
9402 : see if link exists
9403 set link d_link
9404 eval $inlibc
9405
9406 : see if localeconv exists
9407 set localeconv d_locconv
9408 eval $inlibc
9409
9410 : see if lockf exists
9411 set lockf d_lockf
9412 eval $inlibc
9413
9414 : check for long long
9415 echo " "
9416 $echo $n "Checking to see if your system supports long long..." $c >&4
9417 echo 'int main() { long long x = 7; return 0; }' > try.c
9418 set try
9419 if eval $compile; then
9420         val="$define"
9421         echo " Yes, it does." >&4
9422 else
9423         val="$undef"
9424         echo " No, it doesn't." >&4
9425 fi
9426 $rm try.*
9427 set d_longlong
9428 eval $setvar
9429
9430 : check for length of long long
9431 case "${d_longlong}${longlongsize}" in
9432 $define)
9433         echo " "
9434         $echo $n "Checking to see how big your long longs are..." $c >&4
9435         $cat >try.c <<'EOCP'
9436 #include <stdio.h>
9437 int main()
9438 {
9439     printf("%d\n", (int)sizeof(long long));
9440     return(0);
9441 }
9442 EOCP
9443         set try
9444         if eval $compile_ok; then
9445                 longlongsize=`./try$exe_ext`
9446                 $echo " $longlongsize bytes." >&4
9447         else
9448                 dflt='8'
9449                 echo " "
9450                 echo "(I can't seem to compile the test program.  Guessing...)"
9451                 rp="What is the size of a long long (in bytes)?"
9452                 . ./myread
9453                 longlongsize="$ans"
9454         fi
9455         if $test "X$longsize" = "X$longlongsize"; then
9456                 echo "(That isn't any different from an ordinary long.)"
9457         fi      
9458         ;;
9459 esac
9460 $rm -f try.* try
9461
9462 : see if lstat exists
9463 set lstat d_lstat
9464 eval $inlibc
9465
9466 : see if mblen exists
9467 set mblen d_mblen
9468 eval $inlibc
9469
9470 : see if mbstowcs exists
9471 set mbstowcs d_mbstowcs
9472 eval $inlibc
9473
9474 : see if mbtowc exists
9475 set mbtowc d_mbtowc
9476 eval $inlibc
9477
9478 : see if memchr exists
9479 set memchr d_memchr
9480 eval $inlibc
9481
9482 : see if memcmp exists
9483 set memcmp d_memcmp
9484 eval $inlibc
9485
9486 : see if memcpy exists
9487 set memcpy d_memcpy
9488 eval $inlibc
9489
9490 : see if memmove exists
9491 set memmove d_memmove
9492 eval $inlibc
9493
9494 : see if memset exists
9495 set memset d_memset
9496 eval $inlibc
9497
9498 : see if mkdir exists
9499 set mkdir d_mkdir
9500 eval $inlibc
9501
9502 : see if mkdtemp exists
9503 set mkdtemp d_mkdtemp
9504 eval $inlibc
9505
9506 : see if mkfifo exists
9507 set mkfifo d_mkfifo
9508 eval $inlibc
9509
9510 : see if mkstemp exists
9511 set mkstemp d_mkstemp
9512 eval $inlibc
9513
9514 : see if mkstemps exists
9515 set mkstemps d_mkstemps
9516 eval $inlibc
9517
9518 : see if mktime exists
9519 set mktime d_mktime
9520 eval $inlibc
9521
9522 : see if mprotect exists
9523 set mprotect d_mprotect
9524 eval $inlibc
9525
9526 : see if msgctl exists
9527 set msgctl d_msgctl
9528 eval $inlibc
9529
9530 : see if msgget exists
9531 set msgget d_msgget
9532 eval $inlibc
9533
9534 : see if msgsnd exists
9535 set msgsnd d_msgsnd
9536 eval $inlibc
9537
9538 : see if msgrcv exists
9539 set msgrcv d_msgrcv
9540 eval $inlibc
9541
9542 : see how much of the 'msg*(2)' library is present.
9543 h_msg=true
9544 echo " "
9545 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9546 *"$undef"*) h_msg=false;;
9547 esac
9548 case "$osname" in
9549 freebsd)
9550     case "`ipcs 2>&1`" in
9551     "SVID messages"*"not configured"*)
9552         echo "Your $osname does not have the msg*(2) configured." >&4
9553         h_msg=false
9554         val="$undef"
9555         set msgctl d_msgctl
9556         eval $setvar
9557         set msgget d_msgget
9558         eval $setvar
9559         set msgsnd d_msgsnd
9560         eval $setvar
9561         set msgrcv d_msgrcv
9562         eval $setvar
9563         ;;
9564     esac
9565     ;;
9566 esac
9567 : we could also check for sys/ipc.h ...
9568 if $h_msg && $test `./findhdr sys/msg.h`; then
9569         echo "You have the full msg*(2) library." >&4
9570         val="$define"
9571 else
9572         echo "You don't have the full msg*(2) library." >&4
9573         val="$undef"
9574 fi
9575 set d_msg
9576 eval $setvar
9577
9578 : see if msync exists
9579 set msync d_msync
9580 eval $inlibc
9581
9582 : see if munmap exists
9583 set munmap d_munmap
9584 eval $inlibc
9585
9586 : see if nice exists
9587 set nice d_nice
9588 eval $inlibc
9589
9590
9591 echo " "
9592 echo "Checking which 64-bit integer type we could use..." >&4
9593
9594 case "$intsize" in
9595 8) val=int
9596    set quadtype
9597    eval $setvar
9598    val='"unsigned int"'
9599    set uquadtype
9600    eval $setvar
9601    quadkind=1
9602    ;;
9603 *) case "$longsize" in
9604    8) val=long
9605       set quadtype
9606       eval $setvar
9607       val='"unsigned long"'
9608       set uquadtype
9609       eval $setvar
9610       quadkind=2
9611       ;;
9612    *) case "$d_longlong:$longlongsize" in
9613       define:8)
9614         val='"long long"'
9615         set quadtype
9616         eval $setvar
9617         val='"unsigned long long"'
9618         set uquadtype
9619         eval $setvar
9620         quadkind=3
9621         ;;
9622       *) case "$d_int64t" in
9623          define)
9624            val=int64_t
9625            set quadtype
9626            eval $setvar
9627            val=uint64_t
9628            set uquadtype
9629            eval $setvar
9630            quadkind=4
9631            ;;
9632          esac
9633          ;;
9634       esac
9635       ;;
9636    esac
9637    ;;
9638 esac
9639
9640 case "$quadtype" in
9641 '')     echo "Alas, no 64-bit integer types in sight." >&4
9642         d_quad="$undef"
9643         ;;
9644 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9645             verb="will"
9646         else
9647             verb="could"
9648         fi
9649         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9650         d_quad="$define"
9651         ;;
9652 esac
9653
9654 : check for length of character
9655 echo " "
9656 case "$charsize" in
9657 '')
9658         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9659         $cat >try.c <<'EOCP'
9660 #include <stdio.h>
9661 int main()
9662 {
9663     printf("%d\n", (int)sizeof(char));
9664     exit(0);
9665 }
9666 EOCP
9667         set try
9668         if eval $compile_ok; then
9669                 dflt=`./try`
9670         else
9671                 dflt='1'
9672                 echo "(I can't seem to compile the test program.  Guessing...)"
9673         fi
9674         ;;
9675 *)
9676         dflt="$charsize"
9677         ;;
9678 esac
9679 rp="What is the size of a character (in bytes)?"
9680 . ./myread
9681 charsize="$ans"
9682 $rm -f try.c try
9683
9684
9685 echo " "
9686 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9687
9688 case "$use64bits:$d_quad:$quadtype" in
9689 define:define:?*)
9690         ivtype="$quadtype"
9691         uvtype="$uquadtype"
9692         ivsize=8
9693         uvsize=8
9694         ;;
9695 *)      ivtype="long"
9696         uvtype="unsigned long"
9697         ivsize=$longsize
9698         uvsize=$longsize
9699         ;;
9700 esac
9701
9702 case "$uselongdouble:$d_longdbl" in
9703 define:define)
9704         nvtype="long double"
9705         nvsize=$longdblsize
9706         ;;
9707 *)      nvtype=double
9708         nvsize=$doublesize
9709         ;;
9710 esac
9711
9712 $echo "(IV will be "$ivtype", $ivsize bytes)"
9713 $echo "(UV will be "$uvtype", $uvsize bytes)"
9714 $echo "(NV will be "$nvtype", $nvsize bytes)"
9715
9716 $cat >try.c <<EOCP
9717 #$i_inttypes I_INTTYPES
9718 #ifdef I_INTTYPES
9719 #include <inttypes.h>
9720 #endif
9721 #include <stdio.h>
9722 int main() {
9723 #ifdef INT8
9724    int8_t i =  INT8_MAX;
9725   uint8_t u = UINT8_MAX;
9726   printf("int8_t\n");
9727 #endif
9728 #ifdef INT16
9729    int16_t i =  INT16_MAX;
9730   uint16_t i = UINT16_MAX;
9731   printf("int16_t\n");
9732 #endif
9733 #ifdef INT32
9734    int32_t i =  INT32_MAX;
9735   uint32_t u = UINT32_MAX;
9736   printf("int32_t\n");
9737 #endif
9738 }
9739 EOCP
9740
9741 case "$i8type" in
9742 '')     case "$charsize" in
9743         1)      i8type=char
9744                 u8type="unsigned char"
9745                 i8size=$charsize
9746                 u8size=$charsize
9747                 ;;
9748         esac
9749         ;;
9750 esac
9751 case "$i8type" in
9752 '')     set try -DINT8
9753         if eval $compile; then
9754                 case "`./try$exe_ext`" in
9755                 int8_t) i8type=int8_t
9756                         u8type=uint8_t
9757                         i8size=1
9758                         u8size=1
9759                         ;;
9760                 esac
9761         fi
9762         ;;
9763 esac
9764 case "$i8type" in
9765 '')     if $test $charsize -ge 1; then
9766                 i8type=char
9767                 u8type="unsigned char"
9768                 i8size=$charsize
9769                 u8size=$charsize
9770         fi
9771         ;;
9772 esac
9773
9774 case "$i16type" in
9775 '')     case "$shortsize" in
9776         2)      i16type=short
9777                 u16type="unsigned short"
9778                 i16size=$shortsize
9779                 u16size=$shortsize
9780                 ;;
9781         esac
9782         ;;
9783 esac
9784 case "$i16type" in
9785 '')     set try -DINT16
9786         if eval $compile; then
9787                 case "`./try$exe_ext`" in
9788                 int16_t)
9789                         i16type=int16_t
9790                         u16type=uint16_t
9791                         i16size=2
9792                         u16size=2
9793                         ;;
9794                 esac
9795         fi
9796         ;;
9797 esac
9798 case "$i16type" in
9799 '')     if $test $shortsize -ge 2; then
9800                 i16type=short
9801                 u16type="unsigned short"
9802                 i16size=$shortsize
9803                 u16size=$shortsize
9804         fi
9805         ;;
9806 esac
9807
9808 case "$i32type" in
9809 '')     case "$longsize" in
9810         4)      i32type=long
9811                 u32type="unsigned long"
9812                 i32size=$longsize
9813                 u32size=$longsize
9814                 ;;
9815         *)      case "$intsize" in
9816                 4)      i32type=int
9817                         u32type="unsigned int"
9818                         i32size=$intsize
9819                         u32size=$intsize
9820                         ;;
9821                 esac
9822                 ;;
9823         esac
9824         ;;
9825 esac
9826 case "$i32type" in
9827 '')     set try -DINT32
9828         if eval $compile; then
9829                 case "`./try$exe_ext`" in
9830                 int32_t)
9831                         i32type=int32_t
9832                         u32type=uint32_t
9833                         i32size=4
9834                         u32size=4
9835                         ;;
9836                 esac
9837         fi
9838         ;;
9839 esac
9840 case "$i32type" in
9841 '')     if $test $intsize -ge 4; then
9842                 i32type=int
9843                 u32type="unsigned int"
9844                 i32size=$intsize
9845                 u32size=$intsize
9846         fi
9847         ;;
9848 esac
9849
9850 case "$i64type" in
9851 '')     case "$d_quad:$quadtype" in
9852         define:?*)
9853                 i64type="$quadtype"
9854                 u64type="$uquadtype"
9855                 i64size=8
9856                 u64size=8
9857                 ;;
9858         esac
9859         ;;
9860 esac
9861
9862 $echo "Checking whether your NVs can preserve your UVs..." >&4
9863 $cat <<EOP >try.c
9864 #include <stdio.h>
9865 int main() {
9866     $uvtype k = ($uvtype)~0, l;
9867     $nvtype d;
9868     l = k;
9869     d = ($nvtype)l;
9870     l = ($uvtype)d;
9871     if (l == k)
9872        printf("preserve\n");
9873     exit(0);
9874 }
9875 EOP
9876 set try
9877 if eval $compile; then
9878         case "`./try$exe_ext`" in
9879         preserve) d_nv_preserves_uv="$define" ;;
9880         esac
9881 fi      
9882 case "$d_nv_preserves_uv" in
9883 $define) $echo "Yes, they can."  2>&1 ;;
9884 *)       $echo "No, they can't." 2>&1
9885          d_nv_preserves_uv="$undef"
9886          ;;
9887 esac
9888
9889 $rm -f try.* try
9890
9891 : see if POSIX threads are available
9892 set pthread.h i_pthread
9893 eval $inhdr
9894
9895
9896
9897
9898 : how to create joinable pthreads
9899 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9900         echo " "
9901         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9902         $cat >try.c <<'EOCP'
9903 #include <pthread.h>
9904 int main() {
9905     int detachstate = JOINABLE;
9906 }
9907 EOCP
9908         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9909         if eval $compile; then
9910                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9911                 val="$undef" # Yes, undef.
9912                 set d_old_pthread_create_joinable
9913                 eval $setvar
9914                 val=""
9915                 set old_pthread_create_joinable
9916                 eval $setvar
9917         else
9918                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9919                 if eval $compile; then
9920                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9921                         val="$define"
9922                         set d_old_pthread_create_joinable
9923                         eval $setvar
9924                         val=PTHREAD_CREATE_UNDETACHED
9925                         set old_pthread_create_joinable
9926                         eval $setvar
9927                 else            
9928                         set try -DJOINABLE=__UNDETACHED
9929                         if eval $compile; then
9930                                 echo "You seem to use __UNDETACHED." >&4
9931                                 val="$define"
9932                                 set d_old_pthread_create_joinable
9933                                 eval $setvar
9934                                 val=__UNDETACHED
9935                                 set old_pthread_create_joinable
9936                                 eval $setvar
9937                         else
9938                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9939                                 val="$define"
9940                                 set d_old_pthread_create_joinable
9941                                 eval $setvar
9942                                 val=0
9943                                 set old_pthread_create_joinable
9944                                 eval $setvar
9945                         fi
9946                 fi
9947         fi
9948         $rm -f try try.*
9949 else
9950     d_old_pthread_create_joinable="$undef"
9951     old_pthread_create_joinable=""
9952 fi
9953
9954 : see if pause exists
9955 set pause d_pause
9956 eval $inlibc
9957
9958 : see if pipe exists
9959 set pipe d_pipe
9960 eval $inlibc
9961
9962 : see if poll exists
9963 set poll d_poll
9964 eval $inlibc
9965
9966
9967 : see whether the various POSIXish _yields exist
9968 $cat >try.c <<EOP
9969 #include <pthread.h>
9970 #include <stdio.h>
9971 int main() {
9972 #ifdef SCHED_YIELD
9973         sched_yield();
9974 #else
9975 #ifdef PTHREAD_YIELD
9976         pthread_yield();
9977 #else
9978 #ifdef PTHREAD_YIELD_NULL
9979         pthread_yield(NULL);
9980 #endif
9981 #endif
9982 #endif
9983 }
9984 EOP
9985 : see if sched_yield exists
9986 set try -DSCHED_YIELD
9987 if eval $compile; then
9988     val="$define"
9989     sched_yield='sched_yield()'
9990 else
9991     val="$undef"
9992 fi
9993 case "$usethreads" in
9994 $define)
9995         case "$val" in
9996         $define) echo 'sched_yield() found.' >&4        ;;
9997         *)       echo 'sched_yield() NOT found.' >&4    ;;
9998         esac
9999 esac
10000 set d_sched_yield
10001 eval $setvar
10002
10003 : see if pthread_yield exists
10004 set try -DPTHREAD_YIELD
10005 if eval $compile; then
10006     val="$define"
10007     case "$sched_yield" in
10008     '') sched_yield='pthread_yield()' ;;
10009     esac
10010 else
10011     set try -DPTHREAD_YIELD_NULL
10012     if eval $compile; then
10013         val="$define"
10014         case "$sched_yield" in
10015         '') sched_yield='pthread_yield(NULL)' ;;
10016         esac
10017     else
10018         val="$undef"
10019     fi
10020 fi
10021 case "$usethreads" in
10022 $define)
10023         case "$val" in
10024         $define) echo 'pthread_yield() found.' >&4      ;;
10025         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10026         esac
10027         ;;
10028 esac
10029 set d_pthread_yield
10030 eval $setvar
10031
10032 case "$sched_yield" in
10033 '') sched_yield=undef ;;
10034 esac
10035
10036 $rm -f try try.*
10037
10038 : see if this is a pwd.h system
10039 set pwd.h i_pwd
10040 eval $inhdr
10041
10042 case "$i_pwd" in
10043 $define)
10044         xxx=`./findhdr pwd.h`
10045         $cppstdin $cppflags $cppminus < $xxx >$$.h
10046
10047         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10048                 val="$define"
10049         else
10050                 val="$undef"
10051         fi
10052         set d_pwquota
10053         eval $setvar
10054
10055         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10056                 val="$define"
10057         else
10058                 val="$undef"
10059         fi
10060         set d_pwage
10061         eval $setvar
10062
10063         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10064                 val="$define"
10065         else
10066                 val="$undef"
10067         fi
10068         set d_pwchange
10069         eval $setvar
10070
10071         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10072                 val="$define"
10073         else
10074                 val="$undef"
10075         fi
10076         set d_pwclass
10077         eval $setvar
10078
10079         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10080                 val="$define"
10081         else
10082                 val="$undef"
10083         fi
10084         set d_pwexpire
10085         eval $setvar
10086
10087         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10088                 val="$define"
10089         else
10090                 val="$undef"
10091         fi
10092         set d_pwcomment
10093         eval $setvar
10094
10095         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10096                 val="$define"
10097         else
10098                 val="$undef"
10099         fi
10100         set d_pwgecos
10101         eval $setvar
10102
10103         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10104                 val="$define"
10105         else
10106                 val="$undef"
10107         fi
10108         set d_pwpasswd
10109         eval $setvar
10110
10111         $rm -f $$.h
10112         ;;
10113 *)
10114         val="$undef"; 
10115         set d_pwquota; eval $setvar
10116         set d_pwage; eval $setvar
10117         set d_pwchange; eval $setvar
10118         set d_pwclass; eval $setvar
10119         set d_pwexpire; eval $setvar
10120         set d_pwcomment; eval $setvar
10121         set d_pwgecos; eval $setvar
10122         set d_pwpasswd; eval $setvar
10123         ;;
10124 esac
10125
10126 : see if readdir and friends exist
10127 set readdir d_readdir
10128 eval $inlibc
10129 set seekdir d_seekdir
10130 eval $inlibc
10131 set telldir d_telldir
10132 eval $inlibc
10133 set rewinddir d_rewinddir
10134 eval $inlibc
10135
10136 : see if readlink exists
10137 set readlink d_readlink
10138 eval $inlibc
10139
10140 : see if rename exists
10141 set rename d_rename
10142 eval $inlibc
10143
10144 : see if rmdir exists
10145 set rmdir d_rmdir
10146 eval $inlibc
10147
10148 : see if memory.h is available.
10149 val=''
10150 set memory.h val
10151 eval $inhdr
10152
10153 : See if it conflicts with string.h
10154 case "$val" in
10155 $define)
10156         case "$strings" in
10157         '') ;;
10158         *)
10159                 $cppstdin $cppflags $cppminus < $strings > mem.h
10160                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10161                         echo " "
10162                         echo "We won't be including <memory.h>."
10163                         val="$undef"
10164                 fi
10165                 $rm -f mem.h
10166                 ;;
10167         esac
10168 esac
10169 set i_memory
10170 eval $setvar
10171
10172 : can bcopy handle overlapping blocks?
10173 val="$undef"
10174 case "$d_bcopy" in
10175 "$define")
10176         echo " "
10177         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10178         $cat >try.c <<EOCP
10179 #$i_memory I_MEMORY
10180 #$i_stdlib I_STDLIB
10181 #$i_string I_STRING
10182 #$i_unistd I_UNISTD
10183 EOCP
10184         $cat >>try.c <<'EOCP'
10185 #include <stdio.h>
10186 #ifdef I_MEMORY
10187 #  include <memory.h>
10188 #endif
10189 #ifdef I_STDLIB
10190 #  include <stdlib.h>
10191 #endif
10192 #ifdef I_STRING
10193 #  include <string.h>
10194 #else
10195 #  include <strings.h>
10196 #endif
10197 #ifdef I_UNISTD
10198 #  include <unistd.h>  /* Needed for NetBSD */
10199 #endif
10200 int main()
10201 {
10202 char buf[128], abc[128];
10203 char *b;
10204 int len;
10205 int off;
10206 int align;
10207
10208 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10209
10210 for (align = 7; align >= 0; align--) {
10211         for (len = 36; len; len--) {
10212                 b = buf+align;
10213                 bcopy(abc, b, len);
10214                 for (off = 1; off <= len; off++) {
10215                         bcopy(b, b+off, len);
10216                         bcopy(b+off, b, len);
10217                         if (bcmp(b, abc, len))
10218                                 exit(1);
10219                 }
10220         }
10221 }
10222 exit(0);
10223 }
10224 EOCP
10225         set try
10226         if eval $compile_ok; then
10227                 if ./try 2>/dev/null; then
10228                         echo "Yes, it can."
10229                         val="$define"
10230                 else
10231                         echo "It can't, sorry."
10232                         case "$d_memmove" in
10233                         "$define") echo "But that's Ok since you have memmove()." ;;
10234                         esac
10235                 fi
10236         else
10237                 echo "(I can't compile the test program, so we'll assume not...)"
10238                 case "$d_memmove" in
10239                 "$define") echo "But that's Ok since you have memmove()." ;;
10240                 esac
10241         fi
10242         ;;
10243 esac
10244 $rm -f try.* try core
10245 set d_safebcpy
10246 eval $setvar
10247
10248 : can memcpy handle overlapping blocks?
10249 val="$undef"
10250 case "$d_memcpy" in
10251 "$define")
10252         echo " "
10253         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10254         $cat >try.c <<EOCP
10255 #$i_memory I_MEMORY
10256 #$i_stdlib I_STDLIB
10257 #$i_string I_STRING
10258 #$i_unistd I_UNISTD
10259 EOCP
10260         $cat >>try.c <<'EOCP'
10261 #include <stdio.h>
10262 #ifdef I_MEMORY
10263 #  include <memory.h>
10264 #endif
10265 #ifdef I_STDLIB
10266 #  include <stdlib.h>
10267 #endif
10268 #ifdef I_STRING
10269 #  include <string.h>
10270 #else
10271 #  include <strings.h>
10272 #endif
10273 #ifdef I_UNISTD
10274 #  include <unistd.h>  /* Needed for NetBSD */
10275 #endif
10276 int main()
10277 {
10278 char buf[128], abc[128];
10279 char *b;
10280 int len;
10281 int off;
10282 int align;
10283
10284 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10285    try to store the string in read-only memory. */
10286 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10287
10288 for (align = 7; align >= 0; align--) {
10289         for (len = 36; len; len--) {
10290                 b = buf+align;
10291                 memcpy(b, abc, len);
10292                 for (off = 1; off <= len; off++) {
10293                         memcpy(b+off, b, len);
10294                         memcpy(b, b+off, len);
10295                         if (memcmp(b, abc, len))
10296                                 exit(1);
10297                 }
10298         }
10299 }
10300 exit(0);
10301 }
10302 EOCP
10303         set try
10304         if eval $compile_ok; then
10305                 if ./try 2>/dev/null; then
10306                         echo "Yes, it can."
10307                         val="$define"
10308                 else
10309                         echo "It can't, sorry."
10310                         case "$d_memmove" in
10311                         "$define") echo "But that's Ok since you have memmove()." ;;
10312                         esac
10313                 fi
10314         else
10315                 echo "(I can't compile the test program, so we'll assume not...)"
10316                 case "$d_memmove" in
10317                 "$define") echo "But that's Ok since you have memmove()." ;;
10318                 esac
10319         fi
10320         ;;
10321 esac
10322 $rm -f try.* try core
10323 set d_safemcpy
10324 eval $setvar
10325
10326 : can memcmp be trusted to compare relative magnitude?
10327 val="$undef"
10328 case "$d_memcmp" in
10329 "$define")
10330         echo " "
10331         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10332         $cat >try.c <<EOCP
10333 #$i_memory I_MEMORY
10334 #$i_stdlib I_STDLIB
10335 #$i_string I_STRING
10336 #$i_unistd I_UNISTD
10337 EOCP
10338         $cat >>try.c <<'EOCP'
10339 #include <stdio.h>
10340 #ifdef I_MEMORY
10341 #  include <memory.h>
10342 #endif
10343 #ifdef I_STDLIB
10344 #  include <stdlib.h>
10345 #endif
10346 #ifdef I_STRING
10347 #  include <string.h>
10348 #else
10349 #  include <strings.h>
10350 #endif
10351 #ifdef I_UNISTD
10352 #  include <unistd.h>  /* Needed for NetBSD */
10353 #endif
10354 int main()
10355 {
10356 char a = -1;
10357 char b = 0;
10358 if ((a < b) && memcmp(&a, &b, 1) < 0)
10359         exit(1);
10360 exit(0);
10361 }
10362 EOCP
10363         set try
10364         if eval $compile_ok; then
10365                 if ./try 2>/dev/null; then
10366                         echo "Yes, it can."
10367                         val="$define"
10368                 else
10369                         echo "No, it can't (it uses signed chars)."
10370                 fi
10371         else
10372                 echo "(I can't compile the test program, so we'll assume not...)"
10373         fi
10374         ;;
10375 esac
10376 $rm -f try.* try core
10377 set d_sanemcmp
10378 eval $setvar
10379
10380 : see if select exists
10381 set select d_select
10382 eval $inlibc
10383
10384 : see if semctl exists
10385 set semctl d_semctl
10386 eval $inlibc
10387
10388 : see if semget exists
10389 set semget d_semget
10390 eval $inlibc
10391
10392 : see if semop exists
10393 set semop d_semop
10394 eval $inlibc
10395
10396 : see how much of the 'sem*(2)' library is present.
10397 h_sem=true
10398 echo " "
10399 case "$d_semctl$d_semget$d_semop" in
10400 *"$undef"*) h_sem=false;;
10401 esac
10402 case "$osname" in
10403 freebsd)
10404     case "`ipcs 2>&1`" in
10405     "SVID messages"*"not configured"*)
10406         echo "Your $osname does not have the sem*(2) configured." >&4
10407         h_sem=false
10408         val="$undef"
10409         set semctl d_semctl
10410         eval $setvar
10411         set semget d_semget
10412         eval $setvar
10413         set semop d_semop
10414         eval $setvar
10415         ;;
10416     esac
10417     ;;
10418 esac
10419 : we could also check for sys/ipc.h ...
10420 if $h_sem && $test `./findhdr sys/sem.h`; then
10421         echo "You have the full sem*(2) library." >&4
10422         val="$define"
10423 else
10424         echo "You don't have the full sem*(2) library." >&4
10425         val="$undef"
10426 fi
10427 set d_sem
10428 eval $setvar
10429
10430 : see whether sys/sem.h defines union semun
10431 echo " "
10432 $cat > try.c <<'END'
10433 #include <sys/types.h>
10434 #include <sys/ipc.h>
10435 #include <sys/sem.h>
10436 int main () { union semun semun; semun.buf = 0; }
10437 END
10438 set try
10439 if eval $compile; then
10440     echo "You have union semun in <sys/sem.h>." >&4
10441     val="$define"
10442 else
10443     echo "You do not have union semun in <sys/sem.h>." >&4
10444     val="$undef"
10445 fi
10446 $rm -f try try.c try.h
10447 set d_union_semun
10448 eval $setvar
10449
10450 : see how to do semctl IPC_STAT
10451 case "$d_sem" in
10452 $define)
10453     : see whether semctl IPC_STAT can use union semun
10454     echo " "
10455     $cat > try.h <<END
10456 #ifndef S_IRUSR
10457 #   ifdef S_IREAD
10458 #       define S_IRUSR S_IREAD
10459 #       define S_IWUSR S_IWRITE
10460 #       define S_IXUSR S_IEXEC
10461 #   else
10462 #       define S_IRUSR 0400
10463 #       define S_IWUSR 0200
10464 #       define S_IXUSR 0100
10465 #   endif
10466 #   define S_IRGRP (S_IRUSR>>3)
10467 #   define S_IWGRP (S_IWUSR>>3)
10468 #   define S_IXGRP (S_IXUSR>>3)
10469 #   define S_IROTH (S_IRUSR>>6)
10470 #   define S_IWOTH (S_IWUSR>>6)
10471 #   define S_IXOTH (S_IXUSR>>6)
10472 #endif
10473 #ifndef S_IRWXU
10474 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10475 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10476 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10477 #endif
10478 END
10479
10480     $cat > try.c <<END
10481 #include <sys/types.h>
10482 #include <sys/ipc.h>
10483 #include <sys/sem.h>
10484 #include <sys/stat.h>
10485 #include <stdio.h>
10486 #include <errno.h>
10487 #include "try.h"
10488 #ifndef errno
10489 extern int errno;
10490 #endif
10491 #$d_union_semun HAS_UNION_SEMUN
10492 int main() {
10493     union semun
10494 #ifndef HAS_UNION_SEMUN
10495     {
10496         int val;
10497         struct semid_ds *buf;
10498         unsigned short *array;
10499     }
10500 #endif
10501     arg;
10502     int sem, st;
10503
10504 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10505     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10506     if (sem > -1) {
10507         struct semid_ds argbuf;
10508         arg.buf = &argbuf;
10509 #       ifdef IPC_STAT
10510         st = semctl(sem, 0, IPC_STAT, arg);
10511         if (st == 0)
10512             printf("semun\n");
10513         else
10514 #       endif /* IPC_STAT */
10515             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10516 #       ifdef IPC_RMID
10517         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10518 #       endif /* IPC_RMID */
10519             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10520     } else
10521 #endif /* IPC_PRIVATE && ... */
10522         printf("semget failed: errno = %d\n", errno);
10523   return 0;
10524 }
10525 END
10526     val="$undef"
10527     set try
10528     if eval $compile; then
10529         xxx=`./try`
10530         case "$xxx" in
10531         semun) val="$define" ;;
10532         esac
10533     fi
10534     $rm -f try try.c
10535     set d_semctl_semun
10536     eval $setvar
10537     case "$d_semctl_semun" in
10538     $define)
10539         echo "You can use union semun for semctl IPC_STAT." >&4
10540         also='also'
10541         ;;
10542     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10543         also=''
10544         ;;
10545     esac
10546
10547     : see whether semctl IPC_STAT can use struct semid_ds pointer
10548     $cat > try.c <<'END'
10549 #include <sys/types.h>
10550 #include <sys/ipc.h>
10551 #include <sys/sem.h>
10552 #include <sys/stat.h>
10553 #include "try.h"
10554 #include <stdio.h>
10555 #include <errno.h>
10556 #ifndef errno
10557 extern int errno;
10558 #endif
10559 int main() {
10560     struct semid_ds arg;
10561     int sem, st;
10562
10563 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10564     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10565     if (sem > -1) {
10566 #       ifdef IPC_STAT
10567         st = semctl(sem, 0, IPC_STAT, &arg);
10568         if (st == 0)
10569             printf("semid_ds\n");
10570         else
10571 #       endif /* IPC_STAT */
10572             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10573 #       ifdef IPC_RMID
10574         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10575 #       endif /* IPC_RMID */
10576             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10577     } else
10578 #endif /* IPC_PRIVATE && ... */
10579         printf("semget failed: errno = %d\n", errno);
10580
10581     return 0;
10582 }
10583 END
10584     val="$undef"
10585     set try
10586     if eval $compile; then
10587         xxx=`./try`
10588         case "$xxx" in
10589         semid_ds) val="$define" ;;
10590         esac
10591     fi
10592     $rm -f try try.c
10593     set d_semctl_semid_ds
10594     eval $setvar
10595     case "$d_semctl_semid_ds" in
10596     $define)
10597         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10598         ;;
10599     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10600         ;;
10601     esac
10602     $rm -f try.h
10603     ;;
10604 *)  val="$undef"
10605
10606     # We do not have the full sem*(2) library, so assume we can not
10607     # use either.
10608
10609     set d_semctl_semun
10610     eval $setvar
10611
10612     set d_semctl_semid_ds
10613     eval $setvar
10614     ;;
10615 esac
10616
10617 : see if setegid exists
10618 set setegid d_setegid
10619 eval $inlibc
10620
10621 : see if seteuid exists
10622 set seteuid d_seteuid
10623 eval $inlibc
10624
10625 : see if setgrent exists
10626 set setgrent d_setgrent
10627 eval $inlibc
10628
10629 : see if sethostent exists
10630 set sethostent d_sethent
10631 eval $inlibc
10632
10633 : see if setlinebuf exists
10634 set setlinebuf d_setlinebuf
10635 eval $inlibc
10636
10637 : see if setlocale exists
10638 set setlocale d_setlocale
10639 eval $inlibc
10640
10641 : see if setnetent exists
10642 set setnetent d_setnent
10643 eval $inlibc
10644
10645 : see if setprotoent exists
10646 set setprotoent d_setpent
10647 eval $inlibc
10648
10649 : see if setpgid exists
10650 set setpgid d_setpgid
10651 eval $inlibc
10652
10653 : see if setpgrp2 exists
10654 set setpgrp2 d_setpgrp2
10655 eval $inlibc
10656
10657 : see if setpriority exists
10658 set setpriority d_setprior
10659 eval $inlibc
10660
10661 : see if setpwent exists
10662 set setpwent d_setpwent
10663 eval $inlibc
10664
10665 : see if setregid exists
10666 set setregid d_setregid
10667 eval $inlibc
10668 set setresgid d_setresgid
10669 eval $inlibc
10670
10671 : see if setreuid exists
10672 set setreuid d_setreuid
10673 eval $inlibc
10674 set setresuid d_setresuid
10675 eval $inlibc
10676
10677 : see if setrgid exists
10678 set setrgid d_setrgid
10679 eval $inlibc
10680
10681 : see if setruid exists
10682 set setruid d_setruid
10683 eval $inlibc
10684
10685 : see if setservent exists
10686 set setservent d_setsent
10687 eval $inlibc
10688
10689 : see if setsid exists
10690 set setsid d_setsid
10691 eval $inlibc
10692
10693 : see if setspent exists
10694 set setspent d_setspent
10695 eval $inlibc
10696
10697 : see if setvbuf exists
10698 set setvbuf d_setvbuf
10699 eval $inlibc
10700
10701 : see if sfio.h is available
10702 set sfio.h i_sfio
10703 eval $inhdr
10704
10705
10706 : see if sfio library is available
10707 case "$i_sfio" in
10708 $define)
10709         val=''
10710         set sfreserve val
10711         eval $inlibc
10712         ;;
10713 *)
10714         val="$undef"
10715         ;;
10716 esac
10717 : Ok, but do we want to use it.
10718 case "$val" in
10719 $define)
10720         case "$usesfio" in
10721         true|$define|[yY]*) dflt='y';;
10722         *) dflt='n';;
10723         esac
10724         echo "$package can use the sfio library, but it is experimental."
10725         rp="You seem to have sfio available, do you want to try using it?"
10726         . ./myread
10727         case "$ans" in
10728         y|Y) ;;
10729         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10730                 val="$undef"
10731                 : Remove sfio from list of libraries to use
10732                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10733                 shift
10734                 libs="$*"
10735                 echo "libs = $libs" >&4
10736                 ;;
10737         esac
10738         ;;
10739 *)      case "$usesfio" in
10740         true|$define|[yY]*)
10741                 echo "Sorry, cannot find sfio on this machine" >&4
10742                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10743                 ;;
10744         esac
10745         ;;
10746 esac
10747 set d_sfio
10748 eval $setvar
10749 case "$d_sfio" in
10750 $define) usesfio='true';;
10751 *) usesfio='false';;
10752 esac
10753
10754 : see if shmctl exists
10755 set shmctl d_shmctl
10756 eval $inlibc
10757
10758 : see if shmget exists
10759 set shmget d_shmget
10760 eval $inlibc
10761
10762 : see if shmat exists
10763 set shmat d_shmat
10764 eval $inlibc
10765 : see what shmat returns
10766 case "$d_shmat" in
10767 "$define")
10768         $cat >shmat.c <<'END'
10769 #include <sys/shm.h>
10770 void *shmat();
10771 END
10772         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10773                 shmattype='void *'
10774         else
10775                 shmattype='char *'
10776         fi
10777         echo "and it returns ($shmattype)." >&4
10778         : see if a prototype for shmat is available
10779         xxx=`./findhdr sys/shm.h`
10780         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10781         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10782                 val="$define"
10783         else
10784                 val="$undef"
10785         fi
10786         $rm -f shmat.[co]
10787         ;;
10788 *)
10789         val="$undef"
10790         ;;
10791 esac
10792 set d_shmatprototype
10793 eval $setvar
10794
10795 : see if shmdt exists
10796 set shmdt d_shmdt
10797 eval $inlibc
10798
10799 : see how much of the 'shm*(2)' library is present.
10800 h_shm=true
10801 echo " "
10802 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10803 *"$undef"*) h_shm=false;;
10804 esac
10805 case "$osname" in
10806 freebsd)
10807     case "`ipcs 2>&1`" in
10808     "SVID shared memory"*"not configured"*)
10809         echo "Your $osname does not have the shm*(2) configured." >&4
10810         h_shm=false
10811         val="$undef"
10812         set shmctl d_shmctl
10813         evat $setvar
10814         set shmget d_shmget
10815         evat $setvar
10816         set shmat d_shmat
10817         evat $setvar
10818         set shmdt d_shmdt
10819         evat $setvar
10820         ;;
10821     esac
10822     ;;
10823 esac
10824 : we could also check for sys/ipc.h ...
10825 if $h_shm && $test `./findhdr sys/shm.h`; then
10826         echo "You have the full shm*(2) library." >&4
10827         val="$define"
10828 else
10829         echo "You don't have the full shm*(2) library." >&4
10830         val="$undef"
10831 fi
10832 set d_shm
10833 eval $setvar
10834
10835 echo " "
10836 : see if we have sigaction
10837 if set sigaction val -f d_sigaction; eval $csym; $val; then
10838         echo 'sigaction() found.' >&4
10839         $cat > try.c <<'EOP'
10840 #include <stdio.h>
10841 #include <sys/types.h>
10842 #include <signal.h>
10843 int main()
10844 {
10845     struct sigaction act, oact;
10846     act.sa_flags = 0;
10847     oact.sa_handler = 0;
10848     /* so that act and oact are used */
10849     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10850 }
10851 EOP
10852         set try
10853         if eval $compile_ok; then
10854                 val="$define"
10855         else
10856                 echo "But you don't seem to have a useable struct sigaction." >&4
10857                 val="$undef"
10858         fi
10859 else
10860         echo 'sigaction NOT found.' >&4
10861         val="$undef"
10862 fi
10863 set d_sigaction; eval $setvar
10864 $rm -f try try$_o try.c
10865
10866 : see if sigsetjmp exists
10867 echo " "
10868 case "$d_sigsetjmp" in
10869 '')
10870         $cat >try.c <<'EOP'
10871 #include <setjmp.h>
10872 sigjmp_buf env;
10873 int set = 1;
10874 int main()
10875 {
10876         if (sigsetjmp(env,1))
10877                 exit(set);
10878         set = 0;
10879         siglongjmp(env, 1);
10880         exit(1);
10881 }
10882 EOP
10883         set try
10884         if eval $compile; then
10885                 if ./try >/dev/null 2>&1; then
10886                         echo "POSIX sigsetjmp found." >&4
10887                         val="$define"
10888                 else
10889                         $cat >&4 <<EOM
10890 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10891 I'll ignore them.
10892 EOM
10893                         val="$undef"
10894                 fi
10895         else
10896                 echo "sigsetjmp not found." >&4
10897                 val="$undef"
10898         fi
10899         ;;
10900 *) val="$d_sigsetjmp"
10901         case "$d_sigsetjmp" in
10902         $define) echo "POSIX sigsetjmp found." >&4;;
10903         $undef) echo "sigsetjmp not found." >&4;;
10904         esac
10905         ;;
10906 esac
10907 set d_sigsetjmp
10908 eval $setvar
10909 $rm -f try.c try
10910
10911 : see if sys/stat.h is available
10912 set sys/stat.h i_sysstat
10913 eval $inhdr
10914
10915
10916 : see if stat knows about block sizes
10917 echo " "
10918 echo "Checking to see if your struct stat has st_blocks field..." >&4
10919 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10920 eval $hasfield
10921
10922
10923 : see if this is a sys/vfs.h system
10924 set sys/vfs.h i_sysvfs
10925 eval $inhdr
10926
10927
10928 : see if this is a sys/statfs.h system
10929 set sys/statfs.h i_sysstatfs
10930 eval $inhdr
10931
10932
10933 echo " "
10934 echo "Checking to see if your system supports struct statfs..." >&4
10935 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
10936 eval $hasstruct
10937 case "$d_statfs_s" in
10938 "$define")      echo "Yes, it does."   ;;
10939 *)              echo "No, it doesn't." ;;
10940 esac
10941
10942
10943
10944 : see if struct statfs knows about f_flags
10945 case "$d_statfs_s" in
10946 define) 
10947         echo " "
10948         echo "Checking to see if your struct statfs has f_flags field..." >&4
10949         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
10950         eval $hasfield
10951         ;;
10952 *)      val="$undef"
10953         set d_statfs_f_flags
10954         eval $setvar
10955         ;;
10956 esac
10957 case "$d_statfs_f_flags" in
10958 "$define")      echo "Yes, it does."   ;;
10959 *)              echo "No, it doesn't." ;;
10960 esac
10961
10962 : see if _ptr and _cnt from stdio act std
10963 echo " "
10964 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10965         echo "(Looks like you have stdio.h from Linux.)"
10966         case "$stdio_ptr" in
10967         '') stdio_ptr='((fp)->_IO_read_ptr)'
10968                 ptr_lval=$define
10969                 ;;
10970         *)      ptr_lval=$d_stdio_ptr_lval;;
10971         esac
10972         case "$stdio_cnt" in
10973         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10974                 cnt_lval=$undef
10975                 ;;
10976         *)      cnt_lval=$d_stdio_cnt_lval;;
10977         esac
10978         case "$stdio_base" in
10979         '') stdio_base='((fp)->_IO_read_base)';;
10980         esac
10981         case "$stdio_bufsiz" in
10982         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10983         esac
10984 else
10985         case "$stdio_ptr" in
10986         '') stdio_ptr='((fp)->_ptr)'
10987                 ptr_lval=$define
10988                 ;;
10989         *)      ptr_lval=$d_stdio_ptr_lval;;
10990         esac
10991         case "$stdio_cnt" in
10992         '') stdio_cnt='((fp)->_cnt)'
10993                 cnt_lval=$define
10994                 ;;
10995         *)      cnt_lval=$d_stdio_cnt_lval;;
10996         esac
10997         case "$stdio_base" in
10998         '') stdio_base='((fp)->_base)';;
10999         esac
11000         case "$stdio_bufsiz" in
11001         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11002         esac
11003 fi
11004 : test whether _ptr and _cnt really work
11005 echo "Checking how std your stdio is..." >&4
11006 $cat >try.c <<EOP
11007 #include <stdio.h>
11008 #define FILE_ptr(fp)    $stdio_ptr
11009 #define FILE_cnt(fp)    $stdio_cnt
11010 int main() {
11011         FILE *fp = fopen("try.c", "r");
11012         char c = getc(fp);
11013         if (
11014                 18 <= FILE_cnt(fp) &&
11015                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11016         )
11017                 exit(0);
11018         exit(1);
11019 }
11020 EOP
11021 val="$undef"
11022 set try
11023 if eval $compile; then
11024         if ./try; then
11025                 echo "Your stdio acts pretty std."
11026                 val="$define"
11027         else
11028                 echo "Your stdio isn't very std."
11029         fi
11030 else
11031         echo "Your stdio doesn't appear very std."
11032 fi
11033 $rm -f try.c try
11034 set d_stdstdio
11035 eval $setvar
11036
11037 : Can _ptr be used as an lvalue?
11038 case "$d_stdstdio$ptr_lval" in
11039 $define$define) val=$define ;;
11040 *) val=$undef ;;
11041 esac
11042 set d_stdio_ptr_lval
11043 eval $setvar
11044
11045 : Can _cnt be used as an lvalue?
11046 case "$d_stdstdio$cnt_lval" in
11047 $define$define) val=$define ;;
11048 *) val=$undef ;;
11049 esac
11050 set d_stdio_cnt_lval
11051 eval $setvar
11052
11053 : see if _base is also standard
11054 val="$undef"
11055 case "$d_stdstdio" in
11056 $define)
11057         $cat >try.c <<EOP
11058 #include <stdio.h>
11059 #define FILE_base(fp)   $stdio_base
11060 #define FILE_bufsiz(fp) $stdio_bufsiz
11061 int main() {
11062         FILE *fp = fopen("try.c", "r");
11063         char c = getc(fp);
11064         if (
11065                 19 <= FILE_bufsiz(fp) &&
11066                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11067         )
11068                 exit(0);
11069         exit(1);
11070 }
11071 EOP
11072         set try
11073         if eval $compile; then
11074                 if ./try; then
11075                         echo "And its _base field acts std."
11076                         val="$define"
11077                 else
11078                         echo "But its _base field isn't std."
11079                 fi
11080         else
11081                 echo "However, it seems to be lacking the _base field."
11082         fi
11083         $rm -f try.c try
11084         ;;
11085 esac
11086 set d_stdiobase
11087 eval $setvar
11088
11089 $cat >&4 <<EOM
11090 Checking how to access stdio streams by file descriptor number...
11091 EOM
11092 case "$stdio_stream_array" in
11093 '')     $cat >try.c <<EOCP
11094 #include <stdio.h>
11095 int main() {
11096   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11097     printf("yes\n");
11098 }
11099 EOCP
11100         for s in _iob __iob __sF
11101         do
11102                 set try -DSTDIO_STREAM_ARRAY=$s
11103                 if eval $compile; then
11104                         case "`./try$exe_ext`" in
11105                         yes)    stdio_stream_array=$s; break ;;
11106                         esac
11107                 fi
11108         done
11109         $rm -f try.* try$exe_ext
11110 esac
11111 case "$stdio_stream_array" in
11112 '')     $cat >&4 <<EOM
11113 I can't figure out how to access stdio streams by file descriptor number.
11114 EOM
11115         d_stdio_stream_array="$undef"
11116         ;;
11117 *)      $cat >&4 <<EOM
11118 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11119 EOM
11120         d_stdio_stream_array="$define"
11121         ;;
11122 esac
11123
11124 : see if strcoll exists
11125 set strcoll d_strcoll
11126 eval $inlibc
11127
11128 : check for structure copying
11129 echo " "
11130 echo "Checking to see if your C compiler can copy structs..." >&4
11131 $cat >try.c <<'EOCP'
11132 int main()
11133 {
11134         struct blurfl {
11135                 int dyick;
11136         } foo, bar;
11137
11138         foo = bar;
11139 }
11140 EOCP
11141 if $cc -c try.c >/dev/null 2>&1 ; then
11142         val="$define"
11143         echo "Yup, it can."
11144 else
11145         val="$undef"
11146         echo "Nope, it can't."
11147 fi
11148 set d_strctcpy
11149 eval $setvar
11150 $rm -f try.*
11151
11152 : see if strerror and/or sys_errlist[] exist
11153 echo " "
11154 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11155     if set strerror val -f d_strerror; eval $csym; $val; then
11156                 echo 'strerror() found.' >&4
11157                 d_strerror="$define"
11158                 d_strerrm='strerror(e)'
11159                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11160                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11161                         d_syserrlst="$define"
11162                 else
11163                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11164                         d_syserrlst="$undef"
11165                 fi
11166     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11167                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11168                 echo 'strerror() found in string header.' >&4
11169                 d_strerror="$define"
11170                 d_strerrm='strerror(e)'
11171                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11172                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11173                                 d_syserrlst="$define"
11174                 else
11175                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11176                         d_syserrlst="$undef"
11177                 fi
11178     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11179                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11180                 d_strerror="$undef"
11181                 d_syserrlst="$define"
11182                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11183     else
11184                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11185                 d_strerror="$undef"
11186                 d_syserrlst="$undef"
11187                 d_strerrm='"unknown"'
11188     fi
11189 fi
11190
11191 : see if strtod exists
11192 set strtod d_strtod
11193 eval $inlibc
11194
11195 : see if strtol exists
11196 set strtol d_strtol
11197 eval $inlibc
11198
11199 : see if strtold exists
11200 set strtold d_strtold
11201 eval $inlibc
11202
11203 : see if strtoll exists
11204 set strtoll d_strtoll
11205 eval $inlibc
11206
11207 : see if strtoul exists
11208 set strtoul d_strtoul
11209 eval $inlibc
11210
11211 : see if strtoull exists
11212 set strtoull d_strtoull
11213 eval $inlibc
11214
11215 : see if strtouq exists
11216 set strtouq d_strtouq
11217 eval $inlibc
11218
11219 : see if strxfrm exists
11220 set strxfrm d_strxfrm
11221 eval $inlibc
11222
11223 : see if symlink exists
11224 set symlink d_symlink
11225 eval $inlibc
11226
11227 : see if syscall exists
11228 set syscall d_syscall
11229 eval $inlibc
11230
11231 : see if sysconf exists
11232 set sysconf d_sysconf
11233 eval $inlibc
11234
11235 : see if system exists
11236 set system d_system
11237 eval $inlibc
11238
11239 : see if tcgetpgrp exists
11240 set tcgetpgrp d_tcgetpgrp
11241 eval $inlibc
11242
11243 : see if tcsetpgrp exists
11244 set tcsetpgrp d_tcsetpgrp
11245 eval $inlibc
11246
11247 : see if prototype for telldir is available
11248 echo " "
11249 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11250 eval $hasproto
11251
11252 : see if this is a sys/times.h system
11253 set sys/times.h i_systimes
11254 eval $inhdr
11255
11256 : see if times exists
11257 echo " "
11258 if set times val -f d_times; eval $csym; $val; then
11259         echo 'times() found.' >&4
11260         d_times="$define"
11261         inc=''
11262         case "$i_systimes" in
11263         "$define") inc='sys/times.h';;
11264         esac
11265         rp="What is the type returned by times() on this system?"
11266         set clock_t clocktype long stdio.h sys/types.h $inc
11267         eval $typedef_ask
11268 else
11269         echo 'times() NOT found, hope that will do.' >&4
11270         d_times="$undef"
11271         clocktype='int'
11272 fi
11273
11274 : see if truncate exists
11275 set truncate d_truncate
11276 eval $inlibc
11277
11278 : see if tzname[] exists
11279 echo " "
11280 if set tzname val -a d_tzname; eval $csym; $val; then
11281         val="$define"
11282         echo 'tzname[] found.' >&4
11283 else
11284         val="$undef"
11285         echo 'tzname[] NOT found.' >&4
11286 fi
11287 set d_tzname
11288 eval $setvar
11289
11290 : see if umask exists
11291 set umask d_umask
11292 eval $inlibc
11293
11294 : see if ustat exists
11295 set ustat d_ustat
11296 eval $inlibc
11297
11298 : backward compatibility for d_hvfork
11299 if test X$d_hvfork != X; then
11300         d_vfork="$d_hvfork"
11301         d_hvfork=''
11302 fi
11303 : see if there is a vfork
11304 val=''
11305 set vfork val
11306 eval $inlibc
11307
11308 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11309 : perl on Solaris 2.x, and probably elsewhere.
11310 case "$val" in
11311 $define)
11312         echo " "
11313         case "$usevfork" in
11314         false) dflt='n';;
11315         *) dflt='y';;
11316         esac
11317         cat <<'EOM'
11318  
11319 Perl can only use a vfork() that doesn't suffer from strict
11320 restrictions on calling functions or modifying global data in
11321 the child.  For example, glibc-2.1 contains such a vfork()
11322 that is unsuitable.  If your system provides a proper fork()
11323 call, chances are that you do NOT want perl to use vfork().
11324
11325 EOM
11326         rp="Do you still want to use vfork()?"
11327         . ./myread
11328         case "$ans" in
11329         y|Y) ;;
11330         *)
11331                 echo "Ok, we won't use vfork()."
11332                 val="$undef"
11333                 ;;
11334         esac
11335         ;;
11336 esac
11337 set d_vfork
11338 eval $setvar
11339 case "$d_vfork" in
11340 $define) usevfork='true';;
11341 *) usevfork='false';;
11342 esac
11343
11344 : see if this is an sysdir system
11345 set sys/dir.h i_sysdir
11346 eval $inhdr
11347
11348 : see if this is an sysndir system
11349 set sys/ndir.h i_sysndir
11350 eval $inhdr
11351
11352 : see if closedir exists
11353 set closedir d_closedir
11354 eval $inlibc
11355
11356 case "$d_closedir" in
11357 "$define")
11358         echo " "
11359         echo "Checking whether closedir() returns a status..." >&4
11360         cat > closedir.c <<EOM
11361 #$i_dirent I_DIRENT             /**/
11362 #$i_sysdir I_SYS_DIR            /**/
11363 #$i_sysndir I_SYS_NDIR          /**/
11364 #$i_systypes I_SYS_TYPES        /**/
11365
11366 #if defined(I_SYS_TYPES)
11367 #include <sys/types.h>
11368 #endif
11369 #if defined(I_DIRENT)
11370 #include <dirent.h>
11371 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11372 #include <sys/dir.h>
11373 #endif
11374 #else
11375 #ifdef I_SYS_NDIR
11376 #include <sys/ndir.h>
11377 #else
11378 #ifdef I_SYS_DIR
11379 #ifdef hp9000s500
11380 #include <ndir.h>       /* may be wrong in the future */
11381 #else
11382 #include <sys/dir.h>
11383 #endif
11384 #endif
11385 #endif
11386 #endif 
11387 int main() { return closedir(opendir(".")); }
11388 EOM
11389         set closedir
11390         if eval $compile_ok; then
11391                 if ./closedir > /dev/null 2>&1 ; then
11392                         echo "Yes, it does."
11393                         val="$undef"
11394                 else
11395                         echo "No, it doesn't."
11396                         val="$define"
11397                 fi
11398         else
11399                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11400                 val="$define"
11401         fi
11402         ;;
11403 *)
11404         val="$undef";
11405         ;;
11406 esac
11407 set d_void_closedir
11408 eval $setvar
11409 $rm -f closedir*
11410 : check for volatile keyword
11411 echo " "
11412 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11413 $cat >try.c <<'EOCP'
11414 int main()
11415 {
11416         typedef struct _goo_struct goo_struct;
11417         goo_struct * volatile goo = ((goo_struct *)0);
11418         struct _goo_struct {
11419                 long long_int;
11420                 int reg_int;
11421                 char char_var;
11422         };
11423         typedef unsigned short foo_t;
11424         char *volatile foo;
11425         volatile int bar;
11426         volatile foo_t blech;
11427         foo = foo;
11428 }
11429 EOCP
11430 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11431         val="$define"
11432         echo "Yup, it does."
11433 else
11434         val="$undef"
11435         echo "Nope, it doesn't."
11436 fi
11437 set d_volatile
11438 eval $setvar
11439 $rm -f try.*
11440
11441 : see if there is a wait4
11442 set wait4 d_wait4
11443 eval $inlibc
11444
11445 : see if waitpid exists
11446 set waitpid d_waitpid
11447 eval $inlibc
11448
11449 : see if wcstombs exists
11450 set wcstombs d_wcstombs
11451 eval $inlibc
11452
11453 : see if wctomb exists
11454 set wctomb d_wctomb
11455 eval $inlibc
11456
11457 : preserve RCS keywords in files with variable substitution, grrr
11458 Date='$Date'
11459 Id='$Id'
11460 Log='$Log'
11461 RCSfile='$RCSfile'
11462 Revision='$Revision'
11463
11464 case "$crosscompile" in
11465 ''|[nN]*) crosscompile="$undef" ;;
11466 esac
11467
11468 case "$osname" in
11469 next|rhapsody) multiarch="$define" ;;
11470 esac
11471 case "$multiarch" in
11472 ''|[nN]*) multiarch="$undef" ;;
11473 esac
11474
11475 : check for alignment requirements
11476 echo " "
11477 case "$crosscompile$multiarch" in
11478 *$define*)
11479         $cat <<EOM
11480 You seem to be either cross-compiling or doing a multiarchitecture build,
11481 skipping the memory alignment check.
11482
11483 EOM
11484         case "$alignbytes" in
11485         '') alignbytes=8 ;;
11486         esac
11487         ;;
11488 *)
11489         case "$alignbytes" in
11490         '') echo "Checking alignment constraints..." >&4
11491                 $cat >try.c <<'EOCP'
11492 #include <stdio.h>
11493 struct foobar {
11494         char foo;
11495         double bar;
11496 } try_algn;
11497 int main()
11498 {
11499     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11500     return(0);
11501 }
11502 EOCP
11503                 set try
11504                 if eval $compile_ok; then
11505                         dflt=`./try`
11506                 else
11507                         dflt='8'
11508                         echo "(I can't seem to compile the test program...)"
11509                 fi
11510                 ;;
11511         *) dflt="$alignbytes"
11512                 ;;
11513         esac
11514         rp="Doubles must be aligned on a how-many-byte boundary?"
11515         . ./myread
11516         alignbytes="$ans"
11517         $rm -f try.c try
11518         ;;
11519 esac
11520
11521
11522 : check for ordering of bytes in a long
11523 echo " "
11524 case "$crosscompile$multiarch" in
11525 *$define*)
11526         $cat <<EOM
11527 You seem to be either cross-compiling or doing a multiarchitecture build,
11528 skipping the byteorder check.
11529
11530 EOM
11531         byteorder='0xffff'
11532         ;;
11533 *)
11534         case "$byteorder" in
11535         '')
11536                 $cat <<'EOM'
11537 In the following, larger digits indicate more significance.  A big-endian
11538 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11539 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11540 machines may have weird orders like 3412.  A Cray will report 87654321,
11541 an Alpha will report 12345678. If the test program works the default is
11542 probably right.
11543 I'm now running the test program...
11544 EOM
11545                 $cat >try.c <<'EOCP'
11546 #include <stdio.h>
11547 int main()
11548 {
11549         int i;
11550         union {
11551                 unsigned long l;
11552                 char c[sizeof(long)];
11553         } u;
11554
11555         if (sizeof(long) > 4)
11556                 u.l = (0x08070605L << 32) | 0x04030201L;
11557         else
11558                 u.l = 0x04030201L;
11559         for (i = 0; i < sizeof(long); i++)
11560                 printf("%c", u.c[i]+'0');
11561         printf("\n");
11562         exit(0);
11563 }
11564 EOCP
11565                 xxx_prompt=y
11566                 set try
11567                 if eval $compile && ./try > /dev/null; then
11568                         dflt=`./try`
11569                         case "$dflt" in
11570                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11571                                 echo "(The test program ran ok.)"
11572                                 echo "byteorder=$dflt"
11573                                 xxx_prompt=n
11574                         ;;
11575                         ????|????????) echo "(The test program ran ok.)" ;;
11576                         *) echo "(The test program didn't run right for some reason.)" ;;
11577                         esac
11578                 else
11579                         dflt='4321'
11580                         cat <<'EOM'
11581 (I can't seem to compile the test program.  Guessing big-endian...)
11582 EOM
11583                 fi
11584                 case "$xxx_prompt" in
11585                 y)
11586                         rp="What is the order of bytes in a long?"
11587                         . ./myread
11588                         byteorder="$ans"
11589                         ;;
11590                 *)      byteorder=$dflt
11591                         ;;
11592                 esac
11593                 ;;
11594         esac
11595         $rm -f try.c try
11596         ;;
11597 esac
11598
11599
11600 : how do we catenate cpp tokens here?
11601 echo " "
11602 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11603 $cat >cpp_stuff.c <<'EOCP'
11604 #define RCAT(a,b)a/**/b
11605 #define ACAT(a,b)a ## b
11606 RCAT(Rei,ser)
11607 ACAT(Cir,cus)
11608 EOCP
11609 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11610 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11611         echo "Oh!  Smells like ANSI's been here." >&4
11612         echo "We can catify or stringify, separately or together!"
11613         cpp_stuff=42
11614 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11615         echo "Ah, yes!  The good old days!" >&4
11616         echo "However, in the good old days we don't know how to stringify and"
11617         echo "catify at the same time."
11618         cpp_stuff=1
11619 else
11620         $cat >&4 <<EOM
11621 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11622 to have to edit the values of CAT[2-5] in config.h...
11623 EOM
11624         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11625 fi
11626 $rm -f cpp_stuff.*
11627
11628 : see if this is a db.h system
11629 set db.h i_db
11630 eval $inhdr
11631
11632 case "$i_db" in
11633 $define)
11634         : Check db version.
11635         echo " "
11636         echo "Checking Berkeley DB version ..." >&4
11637         $cat >try.c <<EOCP
11638 #$d_const HASCONST
11639 #ifndef HASCONST
11640 #define const
11641 #endif
11642 #include <sys/types.h>
11643 #include <stdio.h>
11644 #include <db.h>
11645 int main()
11646 {
11647 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11648     int Major, Minor, Patch ;
11649     unsigned long Version ;
11650     (void)db_version(&Major, &Minor, &Patch) ;
11651     printf("You have Berkeley DB Version 2 or greater\n");
11652
11653     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11654                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11655     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11656                 Major, Minor, Patch) ;
11657
11658     /* check that db.h & libdb are compatible */
11659     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11660         printf("db.h and libdb are incompatible\n") ;
11661         exit(3);        
11662     }
11663
11664     printf("db.h and libdb are compatible\n") ;
11665
11666     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11667                 + DB_VERSION_PATCH ;
11668
11669     /* needs to be >= 2.3.4 */
11670     if (Version < 2003004) {
11671     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11672         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11673         exit(2);        
11674     }
11675
11676     exit(0);
11677 #else
11678 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11679     printf("You have Berkeley DB Version 1\n");
11680     exit(0);    /* DB version < 2: the coast is clear. */
11681 #else
11682     exit(1);    /* <db.h> not Berkeley DB? */
11683 #endif
11684 #endif
11685 }
11686 EOCP
11687         set try
11688         if eval $compile_ok && ./try; then
11689                 echo 'Looks OK.' >&4
11690         else
11691                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11692                 i_db=$undef
11693                 case " $libs " in
11694                 *"-ldb "*)
11695                         : Remove db from list of libraries to use
11696                         echo "Removing unusable -ldb from library list" >&4
11697                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11698                         shift
11699                         libs="$*"
11700                         echo "libs = $libs" >&4
11701                         ;;
11702                 esac
11703         fi
11704         $rm -f try.*
11705         ;;
11706 esac
11707
11708 case "$i_db" in
11709 define)
11710         : Check the return type needed for hash 
11711         echo " "
11712         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11713         $cat >try.c <<EOCP
11714 #$d_const HASCONST
11715 #ifndef HASCONST
11716 #define const
11717 #endif
11718 #include <sys/types.h>
11719 #include <db.h>
11720
11721 #ifndef DB_VERSION_MAJOR
11722 u_int32_t hash_cb (ptr, size)
11723 const void *ptr;
11724 size_t size;
11725 {
11726 }
11727 HASHINFO info;
11728 int main()
11729 {
11730         info.hash = hash_cb;
11731 }
11732 #endif
11733 EOCP
11734         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11735                 if $contains warning try.out >>/dev/null 2>&1 ; then
11736                         db_hashtype='int'
11737                 else
11738                         db_hashtype='u_int32_t'
11739                 fi
11740         else
11741                 : XXX Maybe we should just give up here.
11742                 db_hashtype=u_int32_t
11743                 $cat try.out >&4
11744                 echo "Help:  I can't seem to compile the db test program." >&4
11745                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11746         fi
11747         $rm -f try.*
11748         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11749         ;;
11750 *)      db_hashtype=u_int32_t
11751         ;;
11752 esac
11753 case "$i_db" in
11754 define)
11755         : Check the return type needed for prefix 
11756         echo " "
11757         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11758         cat >try.c <<EOCP
11759 #$d_const HASCONST
11760 #ifndef HASCONST
11761 #define const
11762 #endif
11763 #include <sys/types.h>
11764 #include <db.h>
11765
11766 #ifndef DB_VERSION_MAJOR
11767 size_t prefix_cb (key1, key2)
11768 const DBT *key1;
11769 const DBT *key2;
11770 {
11771 }
11772 BTREEINFO info;
11773 int main()
11774 {
11775         info.prefix = prefix_cb;
11776 }
11777 #endif
11778 EOCP
11779         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11780                 if $contains warning try.out >>/dev/null 2>&1 ; then
11781                         db_prefixtype='int'
11782                 else
11783                         db_prefixtype='size_t'
11784                 fi
11785         else
11786                 db_prefixtype='size_t'
11787                 : XXX Maybe we should just give up here.
11788                 $cat try.out >&4
11789                 echo "Help:  I can't seem to compile the db test program." >&4
11790                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11791         fi
11792         $rm -f try.*
11793         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11794         ;;
11795 *)      db_prefixtype='size_t'
11796         ;;
11797 esac
11798
11799 : check for void type
11800 echo " "
11801 echo "Checking to see how well your C compiler groks the void type..." >&4
11802 case "$voidflags" in
11803 '')
11804         $cat >try.c <<'EOCP'
11805 #if TRY & 1
11806 void sub() {
11807 #else
11808 sub() {
11809 #endif
11810         extern void moo();      /* function returning void */
11811         void (*goo)();          /* ptr to func returning void */
11812 #if TRY & 8
11813         void *hue;              /* generic ptr */
11814 #endif
11815 #if TRY & 2
11816         void (*foo[10])();
11817 #endif
11818
11819 #if TRY & 4
11820         if(goo == moo) {
11821                 exit(0);
11822         }
11823 #endif
11824         exit(0);
11825 }
11826 int main() { sub(); }
11827 EOCP
11828         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11829                 voidflags=$defvoidused
11830         echo "Good.  It appears to support void to the level $package wants.">&4
11831                 if $contains warning .out >/dev/null 2>&1; then
11832                         echo "However, you might get some warnings that look like this:"
11833                         $cat .out
11834                 fi
11835         else
11836 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11837                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11838                         echo "It supports 1..."
11839                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11840                                 echo "It also supports 2..."
11841                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11842                                         voidflags=7
11843                                         echo "And it supports 4 but not 8 definitely."
11844                                 else
11845                                         echo "It doesn't support 4..."
11846                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11847                                                 voidflags=11
11848                                                 echo "But it supports 8."
11849                                         else
11850                                                 voidflags=3
11851                                                 echo "Neither does it support 8."
11852                                         fi
11853                                 fi
11854                         else
11855                                 echo "It does not support 2..."
11856                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11857                                         voidflags=13
11858                                         echo "But it supports 4 and 8."
11859                                 else
11860                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11861                                                 voidflags=5
11862                                                 echo "And it supports 4 but has not heard about 8."
11863                                         else
11864                                                 echo "However it supports 8 but not 4."
11865                                         fi
11866                                 fi
11867                         fi
11868                 else
11869                         echo "There is no support at all for void."
11870                         voidflags=0
11871                 fi
11872         fi
11873 esac
11874 case "$voidflags" in
11875 "$defvoidused") ;;
11876 *)      $cat >&4 <<'EOM'
11877   Support flag bits are:
11878     1: basic void declarations.
11879     2: arrays of pointers to functions returning void.
11880     4: operations between pointers to and addresses of void functions.
11881     8: generic void pointers.
11882 EOM
11883         dflt="$voidflags";
11884         rp="Your void support flags add up to what?"
11885         . ./myread
11886         voidflags="$ans"
11887         ;;
11888 esac
11889 $rm -f try.* .out
11890
11891
11892 : How can we generate normalized random numbers ?
11893 echo " "
11894 echo "Looking for a random number function..." >&4
11895 case "$randfunc" in
11896 '')
11897         if set drand48 val -f; eval $csym; $val; then
11898                 dflt="drand48"
11899                 echo "Good, found drand48()." >&4
11900         elif set random val -f; eval $csym; $val; then
11901                 dflt="random"
11902                 echo "OK, found random()." >&4
11903         else
11904                 dflt="rand"
11905                 echo "Yick, looks like I have to use rand()." >&4
11906         fi
11907         echo " "
11908         ;;
11909 *)
11910         dflt="$randfunc"
11911         ;;
11912 esac
11913 cont=true
11914
11915 case "$ccflags" in
11916 *-Dmy_rand=*|*-Dmy_srand=*)
11917         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11918         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11919         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11920         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11921         ;;
11922 esac
11923
11924 while $test "$cont"; do
11925         rp="Use which function to generate random numbers?"
11926         . ./myread
11927         if $test "$ans" = "$dflt"; then
11928                 : null
11929         else
11930                 randbits=''
11931         fi
11932         randfunc="$ans"
11933         if set $ans val -f; eval $csym; $val; then
11934                 cont=''
11935         else
11936                 dflt=y
11937                 rp="I cannot find function $ans. Use that name anyway?"
11938                 . ./myread
11939                 dflt=rand
11940                 case "$ans" in
11941                         [yY]*) cont='';;
11942                 esac
11943         fi
11944         case "$cont" in
11945         '')
11946                 case "$randfunc" in
11947                 drand48)
11948                         drand01="drand48()"
11949                         seedfunc="srand48"
11950                         randbits=48
11951                         randseedtype=long
11952                         ;;
11953                 rand|random)
11954                         case "$randbits" in
11955                         '')
11956 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11957                                 $cat >try.c <<EOCP
11958 #$i_unistd I_UNISTD
11959 #$i_stdlib I_STDLIB
11960 #include <stdio.h>
11961 #ifdef I_UNISTD
11962 #  include <unistd.h>
11963 #endif
11964 #ifdef I_STDLIB
11965 #  include <stdlib.h>
11966 #endif
11967 int main()
11968 {
11969         register int i;
11970         register unsigned long tmp;
11971         register unsigned long max = 0L;
11972
11973         for (i = 1000; i; i--) {
11974                 tmp = (unsigned long) $randfunc();
11975                 if (tmp > max) max = tmp;
11976         }
11977         for (i = 0; max; i++)
11978                 max /= 2;
11979         printf("%d\n",i);
11980 }
11981 EOCP
11982                                 set try
11983                                 if eval $compile_ok; then
11984                                         dflt=`try`
11985                                 else
11986                                         dflt='?'
11987                                         echo "(I can't seem to compile the test program...)"
11988                                 fi
11989                                 ;;
11990                         *)
11991                                 dflt="$randbits"
11992                                 ;;
11993                         esac
11994                         rp="How many bits does your $randfunc() function produce?"
11995                         . ./myread
11996                         randbits="$ans"
11997                         $rm -f try.c try
11998                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11999                         seedfunc="s$randfunc"
12000                         randseedtype=unsigned
12001                         ;;
12002                 *)
12003                         dflt="31"
12004                         rp="How many bits does your $randfunc() function produce?"
12005                         . ./myread
12006                         randbits="$ans"
12007                         seedfunc="s$randfunc"
12008                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12009                         if set $seedfunc val -f; eval $csym; $val; then
12010                                 echo "(Using $seedfunc() to seed random generator)"
12011                         else
12012                                 echo "(Warning: no $seedfunc() to seed random generator)"
12013                                 seedfunc=rand
12014                         fi
12015                         randseedtype=unsigned
12016                         ;;
12017                 esac
12018                 ;;
12019         esac
12020 done
12021
12022 echo " "
12023 echo "Determining whether or not we are on an EBCDIC system..." >&4
12024 $cat >tebcdic.c <<'EOM'
12025 int main()
12026 {
12027   if ('M'==0xd4) return 0;
12028   return 1;
12029 }
12030 EOM
12031
12032 val=$undef
12033 set tebcdic
12034 if eval $compile_ok; then
12035         if ./tebcdic; then
12036                 echo "You have EBCDIC." >&4
12037                 val="$define"
12038         else
12039                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12040         fi
12041 else
12042         echo "I'm unable to compile the test program." >&4
12043         echo "I'll assume ASCII or some ISO Latin." >&4
12044 fi
12045 $rm -f tebcdic.c tebcdic
12046 set ebcdic
12047 eval $setvar
12048
12049 echo " "
12050 $cat >&4 <<EOM
12051 Checking how to flush all pending stdio output...
12052 EOM
12053 # I only know how to find the first 32 possibly open files on SunOS.
12054 # See also hints/sunos_4_1.sh and util.c  --AD
12055 case "$osname" in
12056 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12057 esac
12058 $cat >>try.c <<EOCP
12059 #include <stdio.h>
12060 #$i_unistd I_UNISTD
12061 #ifdef I_UNISTD
12062 # include <unistd.h>
12063 #endif
12064 #$d_sysconf HAS_SYSCONF
12065 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12066 #ifdef HAS_STDIO_STREAM_ARRAY
12067 # define STDIO_STREAM_ARRAY $stdio_stream_array
12068 #endif
12069 int main() {
12070   FILE* p = fopen("try.out", "w");
12071 #ifdef TRY_FPUTC
12072   fputc('x', p);
12073 #else
12074 # ifdef TRY_FPRINTF
12075   fprintf(p, "x");
12076 # endif
12077 #endif
12078 #ifdef TRY_FFLUSH_NULL
12079   fflush(NULL);
12080 #endif
12081 #ifdef TRY_FFLUSH_ALL
12082   {
12083     long open_max = -1;
12084 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12085     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12086 # else
12087 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12088     open_max = sysconf(_SC_OPEN_MAX);
12089 #  else
12090 #   ifdef FOPEN_MAX
12091     open_max = FOPEN_MAX;
12092 #   else
12093 #    ifdef OPEN_MAX
12094     open_max = OPEN_MAX;
12095 #    else
12096 #     ifdef _NFILE
12097     open_max = _NFILE;
12098 #     endif
12099 #    endif
12100 #   endif
12101 #  endif
12102 # endif 
12103 # ifdef HAS_STDIO_STREAM_ARRAY
12104     if (open_max > 0) {
12105       long i;
12106       for (i = 0; i < open_max; i++)
12107             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12108                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12109                 STDIO_STREAM_ARRAY[i]._flag)
12110                 fflush(&STDIO_STREAM_ARRAY[i]);
12111     }   
12112   }
12113 # endif
12114 #endif
12115   _exit(42);
12116 }
12117 EOCP
12118 : first we have to find out how _not_ to flush
12119 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12120     output=''
12121     set try -DTRY_FPUTC
12122     if eval $compile; then
12123             $rm -f try.out
12124             ./try$exe_ext 2>/dev/null
12125             if $test ! -s try.out -a "X$?" = X42; then
12126                 output=-DTRY_FPUTC
12127             fi
12128     fi
12129     case "$output" in
12130     '')
12131             set try -DTRY_FPRINTF
12132             $rm -f try.out
12133             if eval $compile; then
12134                     $rm -f try.out
12135                     ./try$exe_ext 2>/dev/null
12136                     if $test ! -s try.out -a "X$?" = X42; then
12137                         output=-DTRY_FPRINTF
12138                     fi
12139             fi
12140         ;;
12141     esac
12142 fi
12143 : check for fflush NULL behaviour
12144 case "$fflushNULL" in
12145 '')     set try -DTRY_FFLUSH_NULL $output
12146         if eval $compile; then
12147                 $rm -f try.out
12148                 ./try$exe_ext 2>/dev/null
12149                 code="$?"
12150                 if $test -s try.out -a "X$code" = X42; then
12151                         fflushNULL="`$cat try.out`"
12152                 else
12153                         if $test "X$code" != X42; then
12154                                 $cat >&4 <<EOM
12155 (If this test failed, don't worry, we'll try another method shortly.)
12156 EOM
12157                         fi
12158                 fi
12159         fi
12160         $rm -f core try.core core.try.*
12161         case "$fflushNULL" in
12162         x)      $cat >&4 <<EOM
12163 Your fflush(NULL) works okay.
12164 EOM
12165                 fflushNULL="$define"
12166                 ;;
12167         '')     $cat >&4 <<EOM
12168 Your fflush(NULL) isn't working (contrary to ANSI C).
12169 EOM
12170                 fflushNULL="$undef"
12171                 ;;
12172         *)      $cat >&4 <<EOM
12173 Cannot figure out whether your fflush(NULL) works or not.
12174 I'm assuming it doesn't (contrary to ANSI C).
12175 EOM
12176                 fflushNULL="$undef"
12177                 ;;
12178         esac
12179         ;;
12180 $define|true|[yY]*)
12181         fflushNULL="$define"
12182         ;;
12183 *)
12184         fflushNULL="$undef"
12185         ;;
12186 esac
12187 : check explicit looping only if NULL did not work
12188 case "$fflushNULL" in
12189 "$undef")
12190         : check for fflush all behaviour
12191         case "$fflushall" in
12192         '')     set try -DTRY_FFLUSH_ALL $output
12193                 if eval $compile; then
12194                         $cat >&4 <<EOM
12195 (Now testing the other method--but note that also this may fail.)
12196 EOM
12197                         $rm -f try.out
12198                         ./try$exe_ext 2>/dev/null
12199                         if $test -s try.out -a "X$?" = X42; then
12200                                 fflushall="`$cat try.out`"
12201                         fi
12202                 fi
12203                 $rm -f core try.core core.try.*
12204                 case "$fflushall" in
12205                 x)      $cat >&4 <<EOM
12206 Whew. Flushing explicitly all the stdio streams works.
12207 EOM
12208                         fflushall="$define"
12209                         ;;
12210                 '')     $cat >&4 <<EOM
12211 Sigh. Flushing explicitly all the stdio streams doesn't work.
12212 EOM
12213                         fflushall="$undef"
12214                         ;;
12215                 *)      $cat >&4 <<EOM
12216 Cannot figure out whether flushing stdio streams explicitly works or not.
12217 I'm assuming it doesn't.
12218 EOM
12219                         fflushall="$undef"
12220                         ;;
12221                 esac
12222                 ;;
12223         "$define"|true|[yY]*)
12224                 fflushall="$define"
12225                 ;;
12226         *)
12227                 fflushall="$undef"
12228                 ;;
12229         esac
12230         ;;
12231 *)      fflushall="$undef"      
12232         ;;
12233 esac
12234 case "$fflushNULL$fflushall" in
12235 undefundef)
12236         $cat <<EOM
12237 I cannot figure out how to flush pending stdio output.
12238 EOM
12239         ;;
12240 esac
12241 $rm -f try.* try$exe_ext
12242
12243 : Store the full pathname to the ar program for use in the C program
12244 : Respect a hint or command line value for full_ar.
12245 case "$full_ar" in
12246 '') full_ar=$ar ;;
12247 esac
12248
12249 : Store the full pathname to the sed program for use in the C program
12250 full_sed=$sed
12251
12252 : see what type gids are declared as in the kernel
12253 echo " "
12254 echo "Looking for the type for group ids returned by getgid()."
12255 set gid_t gidtype xxx stdio.h sys/types.h
12256 eval $typedef
12257 case "$gidtype" in
12258 xxx)
12259         xxx=`./findhdr sys/user.h`
12260         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12261         case $1 in
12262         unsigned) dflt="$1 $2" ;;
12263         *) dflt="$1" ;;
12264         esac
12265         ;;
12266 *) dflt="$gidtype";;
12267 esac
12268 case "$gidtype" in
12269 gid_t) echo "gid_t found." ;;
12270 *)      rp="What is the type for group ids returned by getgid()?"
12271         . ./myread
12272         gidtype="$ans"
12273         ;;
12274 esac
12275
12276 echo " "
12277 case "$gidtype" in
12278 *_t) zzz="$gidtype"     ;;
12279 *)   zzz="gid"          ;;
12280 esac
12281 echo "Checking the size of $zzz..." >&4 
12282 cat > try.c <<EOCP
12283 #include <sys/types.h>
12284 #include <stdio.h>
12285 int main() {
12286     printf("%d\n", (int)sizeof($gidtype));
12287     exit(0);
12288 }
12289 EOCP
12290 set try
12291 if eval $compile_ok; then
12292         yyy=`./try`
12293         case "$yyy" in
12294         '')     gidsize=4
12295                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12296                 ;;
12297         *)      gidsize=$yyy
12298                 echo "Your $zzz size is $gidsize bytes."
12299                 ;;
12300         esac
12301 else
12302         gidsize=4
12303         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12304 fi
12305
12306
12307 echo " "
12308 case "$gidtype" in
12309 *_t) zzz="$gidtype"     ;;
12310 *)   zzz="gid"          ;;
12311 esac
12312 echo "Checking the sign of $zzz..." >&4 
12313 cat > try.c <<EOCP
12314 #include <sys/types.h>
12315 #include <stdio.h>
12316 int main() {
12317         $gidtype foo = -1;
12318         if (foo < 0)
12319                 printf("-1\n");
12320         else
12321                 printf("1\n");
12322 }
12323 EOCP
12324 set try
12325 if eval $compile; then
12326         yyy=`./try`
12327         case "$yyy" in
12328         '')     gidsign=1
12329                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12330                 ;;
12331         *)      gidsign=$yyy
12332                 case "$gidsign" in
12333                  1) echo "Your $zzz is unsigned." ;;
12334                 -1) echo "Your $zzz is signed."   ;;
12335                 esac
12336                 ;;
12337         esac
12338 else
12339         gidsign=1
12340         echo "(I can't compile the test program--guessing unsigned.)" >&4
12341 fi
12342
12343
12344 echo " "
12345
12346 if $test X"$quadtype" != X; then
12347
12348 echo "Checking how to print 64-bit integers..." >&4
12349
12350 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12351         $cat >try.c <<'EOCP'
12352 #include <sys/types.h>
12353 #include <stdio.h>
12354 int main() {
12355   int q = 12345678901;
12356   printf("%ld\n", q);
12357 }
12358 EOCP
12359         set try
12360         if eval $compile; then
12361                 yyy=`./try$exe_ext`
12362                 case "$yyy" in
12363                 12345678901)
12364                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12365                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12366                         echo "We will use %d."
12367                         ;;
12368                 esac
12369         fi
12370 fi
12371
12372 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12373         $cat >try.c <<'EOCP'
12374 #include <sys/types.h>
12375 #include <stdio.h>
12376 int main() {
12377   long q = 12345678901;
12378   printf("%ld\n", q);
12379 }
12380 EOCP
12381         set try
12382         if eval $compile; then
12383                 yyy=`./try$exe_ext`
12384                 case "$yyy" in
12385                 12345678901)
12386                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12387                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12388                         echo "We will use %ld."
12389                         ;;
12390                 esac
12391         fi
12392 fi
12393
12394 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12395         $cat >try.c <<'EOCP'
12396 #include <sys/types.h>
12397 #include <inttypes.h>
12398 #include <stdio.h>
12399 int main() {
12400   int64_t q = 12345678901;
12401   printf("%" PRId64 "\n", q);
12402 }
12403 EOCP
12404         set try
12405         if eval $compile; then
12406                 yyy=`./try$exe_ext`
12407                 case "$yyy" in
12408                 12345678901)
12409                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12410                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12411                         echo "We will use the C9X style."
12412                         ;;
12413                 esac
12414         fi
12415 fi
12416
12417 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12418         $cat >try.c <<'EOCP'
12419 #include <sys/types.h>
12420 #include <stdio.h>
12421 int main() {
12422   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12423   printf("%lld\n", q);
12424 }
12425 EOCP
12426         set try
12427         if eval $compile; then
12428                 yyy=`./try$exe_ext`
12429                 case "$yyy" in
12430                 12345678901)
12431                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12432                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12433                         echo "We will use the %lld style."
12434                         ;;
12435                 esac
12436         fi
12437 fi
12438
12439 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12440         $cat >try.c <<EOCP
12441 #include <sys/types.h>
12442 #include <stdio.h>
12443 int main() {
12444   $quadtype q = 12345678901;
12445   printf("%Ld\n", q);
12446 }
12447 EOCP
12448         set try
12449         if eval $compile; then
12450                 yyy=`./try$exe_ext`
12451                 case "$yyy" in
12452                 12345678901)
12453                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12454                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12455                         echo "We will use %Ld."
12456                         ;;
12457                 esac
12458         fi
12459 fi
12460
12461 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12462         $cat >try.c <<EOCP
12463 #include <sys/types.h>
12464 #include <stdio.h>
12465 int main() {
12466   $quadtype q = 12345678901;
12467   printf("%qd\n", q);
12468 }
12469 EOCP
12470         set try
12471         if eval $compile; then
12472                 yyy=`./try$exe_ext`
12473                 case "$yyy" in
12474                 12345678901)
12475                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12476                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12477                         echo "We will use %qd."
12478                         ;;
12479                 esac
12480         fi
12481 fi
12482
12483 if $test X"$sPRId64" = X; then
12484         echo "Cannot figure out how to print 64-bit integers." >&4
12485 fi
12486
12487 $rm -f try try.*
12488
12489 fi
12490
12491 case "$sPRId64" in
12492 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12493         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12494         ;;
12495 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12496         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12497         ;;
12498 esac
12499
12500
12501 echo " "
12502 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12503
12504 if $test X"$ivsize" = X8; then
12505         ivdformat="$sPRId64"
12506         uvuformat="$sPRIu64"
12507         uvoformat="$sPRIo64"
12508         uvxformat="$sPRIx64"
12509 else
12510         if $test X"$ivsize" = X"$longsize"; then
12511                 ivdformat='"ld"'
12512                 uvuformat='"lu"'
12513                 uvoformat='"lo"'
12514                 uvxformat='"lx"'
12515         else
12516                 if $test X"$ivsize" = X"$intsize"; then
12517                         ivdformat='"d"'
12518                         uvuformat='"u"'
12519                         uvoformat='"o"'
12520                         uvxformat='"x"'
12521                 else
12522                         : far out
12523                         if $test X"$ivsize" = X"$shortsize"; then
12524                                 ivdformat='"hd"'
12525                                 uvuformat='"hu"'
12526                                 uvoformat='"ho"'
12527                                 uvxformat='"hx"'
12528                         fi
12529                 fi
12530         fi
12531 fi
12532
12533 case "$ivdformat" in
12534 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12535     exit 1
12536     ;;
12537 esac
12538
12539
12540 echo " "
12541 $echo "Checking the format string to be used for gids..." >&4
12542
12543 case "$gidsign" in
12544 -1)     if $test X"$gidsize" = X"$ivsize"; then
12545                 gidformat="$ivdformat"
12546         else
12547                 if $test X"$gidsize" = X"$longsize"; then
12548                         gidformat='"ld"'
12549                 else
12550                         if $test X"$gidsize" = X"$intsize"; then
12551                                 gidformat='"d"'
12552                         else
12553                                 if $test X"$gidsize" = X"$shortsize"; then
12554                                         gidformat='"hd"'
12555                                 fi
12556                         fi
12557                 fi
12558         fi
12559         ;;
12560 *)      if $test X"$gidsize" = X"$uvsize"; then
12561                 gidformat="$uvuformat"
12562         else
12563                 if $test X"$gidsize" = X"$longsize"; then
12564                         gidformat='"lu"'
12565                 else
12566                         if $test X"$gidsize" = X"$intsize"; then
12567                                 gidformat='"u"'
12568                         else
12569                                 if $test X"$gidsize" = X"$shortsize"; then
12570                                         gidformat='"hu"'
12571                                 fi
12572                         fi
12573                 fi
12574         fi
12575         ;;
12576 esac
12577
12578 : see if getgroups exists
12579 set getgroups d_getgrps
12580 eval $inlibc
12581
12582 : see if setgroups exists
12583 set setgroups d_setgrps
12584 eval $inlibc
12585
12586
12587 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12588 echo " "
12589 case "$d_getgrps$d_setgrps" in
12590 *define*)
12591         case "$groupstype" in
12592         '') dflt="$gidtype" ;;
12593         *)  dflt="$groupstype" ;;
12594         esac
12595         $cat <<EOM
12596 What type of pointer is the second argument to getgroups() and setgroups()?
12597 Usually this is the same as group ids, $gidtype, but not always.
12598
12599 EOM
12600         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12601         . ./myread
12602         groupstype="$ans"
12603         ;;
12604 *)  groupstype="$gidtype";;
12605 esac
12606
12607 echo " "
12608 echo "Checking if your $make program sets \$(MAKE)..." >&4
12609 case "$make_set_make" in
12610 '')
12611         $sed 's/^X //' > testmake.mak << 'EOF'
12612 Xall:
12613 X       @echo 'maketemp="$(MAKE)"'
12614 EOF
12615         case "`$make -f testmake.mak 2>/dev/null`" in
12616         *maketemp=*) make_set_make='#' ;;
12617         *)      make_set_make="MAKE=$make" ;;
12618         esac
12619         $rm -f testmake.mak
12620         ;;
12621 esac
12622 case "$make_set_make" in
12623 '#') echo "Yup, it does.";;
12624 *) echo "Nope, it doesn't.";;
12625 esac
12626
12627 : see if this is a sys/mman.h system
12628 set sys/mman.h i_sysmman
12629 eval $inhdr
12630
12631 : see if mmap exists
12632 set mmap d_mmap
12633 eval $inlibc
12634 : see what shmat returns
12635 : default to something harmless
12636 mmaptype='void *'
12637 case "$i_sysmman$d_mmap" in
12638 "$define$define")
12639         $cat >mmap.c <<'END'
12640 #include <sys/mman.h>
12641 void *mmap();
12642 END
12643         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
12644                 mmaptype='void *'
12645         else
12646                 mmaptype='caddr_t'
12647         fi
12648         echo "and it returns ($mmaptype)." >&4
12649         ;;
12650 esac
12651
12652
12653
12654 : see what type is used for mode_t
12655 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12656 set mode_t modetype int stdio.h sys/types.h
12657 eval $typedef_ask
12658
12659 : define a fucntion to check prototypes
12660 $cat > protochk <<EOSH
12661 $startsh
12662 cc="$cc"
12663 optimize="$optimize"
12664 ccflags="$ccflags"
12665 prototype="$prototype"
12666 define="$define"
12667 rm=$rm
12668 EOSH
12669
12670 $cat >> protochk <<'EOSH'
12671
12672 $rm -f try.c
12673 foo="$1"
12674 shift
12675 while test $# -ge 2; do
12676         case "$1" in
12677                 $define) echo "#include <$2>" >> try.c ;;
12678                 literal) echo "$2" >> try.c ;;
12679         esac
12680     shift 2
12681 done
12682 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12683 cat >> try.c <<'EOCP'
12684 #ifdef CAN_PROTOTYPE
12685 #define _(args) args
12686 #else
12687 #define _(args) ()
12688 #endif
12689 EOCP
12690 echo "$foo" >> try.c
12691 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12692 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12693 status=$?
12694 $rm -f try.[co]
12695 exit $status
12696 EOSH
12697 chmod +x protochk
12698 $eunicefix protochk
12699
12700 : see what type is used for size_t
12701 rp="What is the type used for the length parameter for string functions?"
12702 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12703 eval $typedef_ask
12704
12705 : check for type of arguments to gethostbyaddr. 
12706 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12707         case "$d_gethbyaddr" in
12708         $define)
12709                 $cat <<EOM
12710
12711 Checking to see what type of arguments are accepted by gethostbyaddr().
12712 EOM
12713                 hdrs="$define sys/types.h
12714                         $d_socket sys/socket.h 
12715                         $i_niin netinet/in.h 
12716                         $i_netdb netdb.h
12717                         $i_unistd unistd.h"
12718                 : The first arg can 'char *' or 'void *'
12719                 : The second arg is some of integral type
12720                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12721                         for yyy in size_t long int; do
12722                                 case "$netdb_host_type" in
12723                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12724                                         if ./protochk "$try" $hdrs; then
12725                                                 echo "Your system accepts $xxx for the first arg."
12726                                                 echo "...and $yyy for the second arg."
12727                                                 netdb_host_type="$xxx"
12728                                                 netdb_hlen_type="$yyy"
12729                                         fi
12730                                         ;;
12731                                 esac
12732                         done
12733                 done
12734                 : In case none of those worked, prompt the user.
12735                 case "$netdb_host_type" in
12736                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12737                         dflt='char *'
12738                         . ./myread
12739                         netdb_host_type=$ans
12740                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12741                         dflt="$sizetype"
12742                         . ./myread
12743                         netdb_hlen_type=$ans
12744                         ;;
12745                 esac
12746                 ;;
12747         *)      : no gethostbyaddr, so pick harmless defaults
12748                 netdb_host_type='char *'
12749                 netdb_hlen_type="$sizetype"
12750                 ;;
12751         esac
12752         # Remove the "const" if needed. -- but then we'll have a 
12753         # prototype clash!
12754         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12755 fi
12756
12757 : check for type of argument to gethostbyname. 
12758 if test "X$netdb_name_type" = X ; then
12759         case "$d_gethbyname" in
12760         $define)
12761                 $cat <<EOM
12762
12763 Checking to see what type of argument is accepted by gethostbyname().
12764 EOM
12765                 hdrs="$define sys/types.h
12766                         $d_socket sys/socket.h 
12767                         $i_niin netinet/in.h 
12768                         $i_netdb netdb.h
12769                         $i_unistd unistd.h"
12770                 for xxx in "const char *" "char *"; do
12771                         case "$netdb_name_type" in
12772                         '')     try="extern struct hostent *gethostbyname($xxx);"
12773                                 if ./protochk "$try" $hdrs; then
12774                                         echo "Your system accepts $xxx."
12775                                         netdb_name_type="$xxx"
12776                                 fi
12777                                 ;;
12778                         esac
12779                 done
12780                 : In case none of those worked, prompt the user.
12781                 case "$netdb_name_type" in
12782                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12783                         dflt='char *'
12784                         . ./myread
12785                         netdb_name_type=$ans
12786                         ;;
12787                 esac
12788                 ;;
12789         *)      : no gethostbyname, so pick harmless default
12790                 netdb_name_type='char *'
12791                 ;;
12792         esac
12793 fi
12794
12795 : check for type of 1st argument to getnetbyaddr. 
12796 if test "X$netdb_net_type" = X ; then
12797         case "$d_getnbyaddr" in
12798         $define)
12799                 $cat <<EOM
12800
12801 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12802 EOM
12803                 hdrs="$define sys/types.h
12804                         $d_socket sys/socket.h 
12805                         $i_niin netinet/in.h 
12806                         $i_netdb netdb.h
12807                         $i_unistd unistd.h"
12808                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12809                         case "$netdb_net_type" in
12810                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12811                                 if ./protochk "$try" $hdrs; then
12812                                         echo "Your system accepts $xxx."
12813                                         netdb_net_type="$xxx"
12814                                 fi
12815                                 ;;
12816                         esac
12817                 done
12818                 : In case none of those worked, prompt the user.
12819                 case "$netdb_net_type" in
12820                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12821                         dflt='long'
12822                         . ./myread
12823                         netdb_net_type=$ans
12824                         ;;
12825                 esac
12826                 ;;
12827         *)      : no getnetbyaddr, so pick harmless default
12828                 netdb_net_type='long'
12829                 ;;
12830         esac
12831 fi
12832 : locate the preferred pager for this system
12833 case "$pager" in
12834 '')
12835         dflt=''
12836         case "$pg" in
12837         /*) dflt=$pg;;
12838         esac
12839         case "$more" in
12840         /*) dflt=$more;;
12841         esac
12842         case "$less" in
12843         /*) dflt=$less;;
12844         esac
12845         case "$dflt" in
12846         '') dflt=/usr/ucb/more;;
12847         esac
12848         ;;
12849 *) dflt="$pager";;
12850 esac
12851 echo " "
12852 fn=f/
12853 rp='What pager is used on your system?'
12854 . ./getfile
12855 pager="$ans"
12856
12857 : see what type pids are declared as in the kernel
12858 rp="What is the type of process ids on this system?"
12859 set pid_t pidtype int stdio.h sys/types.h
12860 eval $typedef_ask
12861
12862 : Find earliest binary compatible site_perl subdirectory perl can use.
12863 case "$bincompat5005" in
12864 "$define") xs_apiversion='5.005' ;;
12865 *) xs_apiversion=$version ;;   # The current site_perl version.
12866 esac
12867 : Find earliest pure perl site_perl subdirectory perl can use.
12868 : The versioned directories started at 5.005.
12869 pm_apiversion='5.005'
12870
12871 : check for length of pointer
12872 echo " "
12873 case "$ptrsize" in
12874 '')
12875         $echo $n "Checking to see how big your pointers are...$c" >&4
12876         if test "$voidflags" -gt 7; then
12877                 echo '#define VOID_PTR char *' > try.c
12878         else
12879                 echo '#define VOID_PTR void *' > try.c
12880         fi
12881         $cat >>try.c <<'EOCP'
12882 #include <stdio.h>
12883 int main()
12884 {
12885     printf("%d\n", (int)sizeof(VOID_PTR));
12886     exit(0);
12887 }
12888 EOCP
12889         set try
12890         if eval $compile_ok; then
12891                 ptrsize=`./try`
12892                 $echo " $ptrsize bytes." >&4
12893         else
12894                 dflt='4'
12895                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12896                 rp="What is the size of a pointer (in bytes)?"
12897                 . ./myread
12898                 ptrsize="$ans"
12899         fi
12900         ;;
12901 esac
12902 $rm -f try.c try
12903
12904 : see if ar generates random libraries by itself
12905 echo " "
12906 echo "Checking how to generate random libraries on your machine..." >&4
12907 echo 'int bar1() { return bar2(); }' > bar1.c
12908 echo 'int bar2() { return 2; }' > bar2.c
12909 $cat > foo.c <<'EOP'
12910 int main() { printf("%d\n", bar1()); exit(0); }
12911 EOP
12912 $cc $ccflags -c bar1.c >/dev/null 2>&1
12913 $cc $ccflags -c bar2.c >/dev/null 2>&1
12914 $cc $ccflags -c foo.c >/dev/null 2>&1
12915 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12916 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12917         ./foobar >/dev/null 2>&1; then
12918         echo "$ar appears to generate random libraries itself."
12919         orderlib=false
12920         ranlib=":"
12921 elif $ar ts bar$_a >/dev/null 2>&1 &&
12922         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12923         ./foobar >/dev/null 2>&1; then
12924                 echo "a table of contents needs to be added with '$ar ts'."
12925                 orderlib=false
12926                 ranlib="$ar ts"
12927 else
12928         case "$ranlib" in
12929         :) ranlib='';;
12930         '')
12931                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12932                 $test -f $ranlib || ranlib=''
12933                 ;;
12934         esac
12935         if $test -n "$ranlib"; then
12936                 echo "your system has '$ranlib'; we'll use that."
12937                 orderlib=false
12938         else
12939                 echo "your system doesn't seem to support random libraries"
12940                 echo "so we'll use lorder and tsort to order the libraries."
12941                 orderlib=true
12942                 ranlib=":"
12943         fi
12944 fi
12945 $rm -f foo* bar* 
12946
12947 : check for type of arguments to select. 
12948 case "$selecttype" in
12949 '') case "$d_select" in
12950         $define)
12951                 echo " "
12952                 $cat <<EOM
12953 Checking to see what type of arguments are accepted by select().
12954 EOM
12955                 hdrs="$define sys/types.h
12956                         $i_systime sys/time.h 
12957                         $i_sysselct sys/select.h
12958                         $d_socket sys/socket.h"
12959                 : The first arg can be int, unsigned, or size_t
12960                 : The last arg may or may not be 'const'
12961                 val=''
12962                 : void pointer has been seen but using that
12963                 : breaks the selectminbits test
12964                 for xxx in 'fd_set *' 'int *'; do
12965                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12966                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12967                                         case "$val" in
12968                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12969                                                 if ./protochk "$try" $hdrs; then
12970                                                         echo "Your system accepts $xxx."
12971                                                         val="$xxx"
12972                                                 fi
12973                                                 ;;
12974                                         esac
12975                                 done
12976                         done
12977                 done
12978                 case "$val" in
12979                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12980                         case "$d_fd_set" in
12981                                 $define) dflt="fd_set *" ;;
12982                                 *)              dflt="int *" ;;
12983                         esac
12984                         . ./myread
12985                         val=$ans
12986                         ;;
12987                 esac
12988                 selecttype="$val"
12989                 ;;
12990         *)      : no select, so pick a harmless default
12991                 selecttype='int *'
12992                 ;;
12993         esac
12994         ;;
12995 esac
12996
12997 : check for the select 'width'
12998 case "$selectminbits" in
12999 '') case "$d_select" in
13000         $define)
13001                 $cat <<EOM
13002
13003 Checking to see on how many bits at a time your select() operates...
13004 EOM
13005                 $cat >try.c <<EOCP
13006 #include <sys/types.h>
13007 #$i_time I_TIME
13008 #$i_systime I_SYS_TIME
13009 #$i_systimek I_SYS_TIME_KERNEL
13010 #ifdef I_TIME
13011 #   include <time.h>
13012 #endif
13013 #ifdef I_SYS_TIME
13014 #   ifdef I_SYS_TIME_KERNEL
13015 #       define KERNEL
13016 #   endif
13017 #   include <sys/time.h>
13018 #   ifdef I_SYS_TIME_KERNEL
13019 #       undef KERNEL
13020 #   endif
13021 #endif
13022 #$i_sysselct I_SYS_SELECT
13023 #ifdef I_SYS_SELECT
13024 #include <sys/select.h>
13025 #endif
13026 #$d_socket HAS_SOCKET
13027 #ifdef HAS_SOCKET
13028 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13029 #endif
13030 #include <stdio.h>
13031 $selecttype b;
13032 #define S sizeof(*(b))
13033 #define MINBITS 64
13034 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13035 #define NBITS  (NBYTES * 8)
13036 int main() {
13037     char s[NBYTES];
13038     struct timeval t;
13039     int i;
13040     FILE* fp;
13041     int fd;
13042
13043     fclose(stdin);
13044     fp = fopen("try.c", "r");
13045     if (fp == 0)
13046       exit(1);
13047     fd = fileno(fp);
13048     if (fd < 0)
13049       exit(2);
13050     b = ($selecttype)s;
13051     for (i = 0; i < NBITS; i++)
13052         FD_SET(i, b);
13053     t.tv_sec  = 0;
13054     t.tv_usec = 0;
13055     select(fd + 1, b, 0, 0, &t);
13056     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13057     printf("%d\n", i + 1);
13058     return 0;
13059 }
13060 EOCP
13061                 set try
13062                 if eval $compile_ok; then
13063                         selectminbits=`./try`
13064                         case "$selectminbits" in
13065                         '')     cat >&4 <<EOM
13066 Cannot figure out on how many bits at a time your select() operates.
13067 I'll play safe and guess it is 32 bits.
13068 EOM
13069                                 selectminbits=32
13070                                 bits="32 bits"
13071                                 ;;
13072                         1)      bits="1 bit" ;;
13073                         *)      bits="$selectminbits bits" ;;
13074                         esac
13075                         echo "Your select() operates on $bits at a time." >&4
13076                 else
13077                         rp='What is the minimum number of bits your select() operates on?'
13078                         case "$byteorder" in
13079                         1234|12345678)  dflt=32 ;;
13080                         *)              dflt=1  ;;
13081                         esac
13082                         . ./myread
13083                         val=$ans
13084                         selectminbits="$val"
13085                 fi
13086                 $rm -f try.* try
13087                 ;;
13088         *)      : no select, so pick a harmless default
13089                 selectminbits='32'
13090                 ;;
13091         esac
13092         ;;
13093 esac
13094
13095 : Trace out the files included by signal.h, then look for SIGxxx names.
13096 : Remove SIGARRAYSIZE used by HPUX.
13097 : Remove SIGSTKSIZE used by Linux.
13098 : Remove SIGSTKSZ used by Posix.
13099 : Remove SIGTYP void lines used by OS2.
13100 : Some cpps, like os390, dont give the file name anywhere
13101 if [ "X$fieldn" = X ]; then
13102         : Just make some guesses.  We check them later.
13103         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13104 else
13105         xxx=`echo '#include <signal.h>' |
13106         $cppstdin $cppminus $cppflags 2>/dev/null |
13107         $grep '^[       ]*#.*include' | 
13108         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13109 fi
13110 : Check this list of files to be sure we have parsed the cpp output ok.
13111 : This will also avoid potentially non-existent files, such 
13112 : as ../foo/bar.h
13113 xxxfiles=''
13114 for xx in $xxx /dev/null ; do
13115         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13116 done
13117 : If we have found no files, at least try signal.h
13118 case "$xxxfiles" in
13119 '')     xxxfiles=`./findhdr signal.h` ;;
13120 esac
13121 xxx=`awk '
13122 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13123         print substr($2, 4, 20)
13124 }
13125 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13126         print substr($3, 4, 20)
13127 }' $xxxfiles`
13128 : Append some common names just in case the awk scan failed.
13129 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13130 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13131 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13132 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13133 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13134
13135 : generate a few handy files for later
13136 $cat > signal.c <<'EOCP'
13137 #include <sys/types.h>
13138 #include <signal.h>
13139 #include <stdio.h>
13140 int main() {
13141
13142 /* Strange style to avoid deeply-nested #if/#else/#endif */
13143 #ifndef NSIG
13144 #  ifdef _NSIG
13145 #    define NSIG (_NSIG)
13146 #  endif
13147 #endif
13148
13149 #ifndef NSIG
13150 #  ifdef SIGMAX
13151 #    define NSIG (SIGMAX+1)
13152 #  endif
13153 #endif
13154
13155 #ifndef NSIG
13156 #  ifdef SIG_MAX
13157 #    define NSIG (SIG_MAX+1)
13158 #  endif
13159 #endif
13160
13161 #ifndef NSIG
13162 #  ifdef MAXSIG
13163 #    define NSIG (MAXSIG+1)
13164 #  endif
13165 #endif
13166
13167 #ifndef NSIG
13168 #  ifdef MAX_SIG
13169 #    define NSIG (MAX_SIG+1)
13170 #  endif
13171 #endif
13172
13173 #ifndef NSIG
13174 #  ifdef SIGARRAYSIZE
13175 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13176 #  endif
13177 #endif
13178
13179 #ifndef NSIG
13180 #  ifdef _sys_nsig
13181 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13182 #  endif
13183 #endif
13184
13185 /* Default to some arbitrary number that's big enough to get most
13186    of the common signals.
13187 */
13188 #ifndef NSIG
13189 #    define NSIG 50
13190 #endif
13191
13192 printf("NSIG %d\n", NSIG);
13193
13194 #ifndef JUST_NSIG
13195
13196 EOCP
13197
13198 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13199 {
13200         printf "#ifdef SIG"; printf $1; printf "\n"
13201         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13202         printf $1; printf ");\n"
13203         printf "#endif\n"
13204 }
13205 END {
13206         printf "#endif /* JUST_NSIG */\n";
13207         printf "exit(0);\n}\n";
13208 }
13209 ' >>signal.c
13210 $cat >signal.awk <<'EOP'
13211 BEGIN { ndups = 0 }
13212 $1 ~ /^NSIG$/ { nsig = $2 }
13213 ($1 !~ /^NSIG$/) && (NF == 2) {
13214     if ($2 > maxsig) { maxsig = $2 }
13215     if (sig_name[$2]) {
13216         dup_name[ndups] = $1
13217         dup_num[ndups] = $2
13218         ndups++ 
13219     }
13220     else {
13221         sig_name[$2] = $1
13222         sig_num[$2] = $2
13223     }
13224 }
13225 END { 
13226     if (nsig == 0) {
13227         nsig = maxsig + 1
13228     }
13229     printf("NSIG %d\n", nsig);
13230     for (n = 1; n < nsig; n++) {
13231         if (sig_name[n]) {
13232             printf("%s %d\n", sig_name[n], sig_num[n])
13233         }
13234         else {
13235             printf("NUM%d %d\n", n, n) 
13236         }
13237     }
13238     for (n = 0; n < ndups; n++) {
13239         printf("%s %d\n", dup_name[n], dup_num[n])
13240     }
13241 }
13242 EOP
13243 $cat >signal_cmd <<EOS
13244 $startsh
13245 if $test -s signal.lst; then
13246     echo "Using your existing signal.lst file"
13247         exit 0
13248 fi
13249 xxx="$xxx"
13250 EOS
13251 $cat >>signal_cmd <<'EOS'
13252
13253 set signal
13254 if eval $compile_ok; then
13255         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13256 else
13257         echo "(I can't seem be able to compile the whole test program)" >&4
13258         echo "(I'll try it in little pieces.)" >&4
13259         set signal -DJUST_NSIG
13260         if eval $compile_ok; then
13261                 ./signal$_exe > signal.nsg
13262                 $cat signal.nsg
13263         else
13264                 echo "I can't seem to figure out how many signals you have." >&4
13265                 echo "Guessing 50." >&4
13266                 echo 'NSIG 50' > signal.nsg
13267         fi
13268         : Now look at all the signal names, one at a time.
13269         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13270                 $cat > signal.c <<EOCP
13271 #include <sys/types.h>
13272 #include <signal.h>
13273 #include <stdio.h>
13274 int main() {
13275 printf("$xx %d\n", SIG${xx});
13276 return 0;
13277 }
13278 EOCP
13279                 set signal
13280                 if eval $compile; then
13281                         echo "SIG${xx} found."
13282                         ./signal$_exe  >> signal.ls1
13283                 else
13284                         echo "SIG${xx} NOT found."
13285                 fi
13286         done
13287         if $test -s signal.ls1; then
13288                 $cat signal.nsg signal.ls1 |
13289                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13290         fi
13291
13292 fi
13293 if $test -s signal.lst; then
13294         :
13295 else
13296         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13297         echo 'kill -l' >signal
13298         set X `csh -f <signal`
13299         $rm -f signal
13300         shift
13301         case $# in
13302         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13303         esac
13304         echo $@ | $tr ' ' $trnl | \
13305             $awk '{ printf "%s %d\n", $1, ++s; }
13306                   END { printf "NSIG %d\n", ++s }' >signal.lst
13307 fi
13308 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13309 EOS
13310 chmod a+x signal_cmd
13311 $eunicefix signal_cmd
13312
13313 : generate list of signal names
13314 echo " "
13315 case "$sig_name_init" in
13316 '') doinit=yes ;;
13317 *)  case "$sig_num_init" in
13318     ''|*,*) doinit=yes ;;
13319     esac ;;
13320 esac
13321 case "$doinit" in
13322 yes)
13323         echo "Generating a list of signal names and numbers..." >&4
13324         . ./signal_cmd
13325         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13326         sig_name=`$awk 'BEGIN { printf "ZERO " }
13327                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13328         sig_num=`$awk  'BEGIN { printf "0 " }
13329                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13330         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13331                              !/^NSIG/   { printf "\"%s\", ", $1 }
13332                              END        { printf "0\n" }' signal.lst`
13333         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13334                              !/^NSIG/   { printf "%d, ", $2}
13335                              END        { printf "0\n"}' signal.lst`
13336         ;;
13337 esac
13338 echo "The following $sig_count signals are available:"
13339 echo " "
13340 echo $sig_name | $awk \
13341 'BEGIN { linelen = 0 }
13342 {
13343         for (i = 1; i <= NF; i++) {
13344                 name = "SIG" $i " "
13345                 linelen = linelen + length(name)
13346                 if (linelen > 70) {
13347                         printf "\n"
13348                         linelen = length(name)
13349                 }
13350                 printf "%s", name
13351         }
13352         printf "\n"
13353 }'
13354 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13355
13356 : see what type is used for signed size_t
13357 set ssize_t ssizetype int stdio.h sys/types.h
13358 eval $typedef
13359 dflt="$ssizetype"
13360 $cat > ssize.c <<EOM
13361 #include <stdio.h>
13362 #include <sys/types.h>
13363 #define Size_t $sizetype
13364 #define SSize_t $dflt
13365 int main()
13366 {
13367         if (sizeof(Size_t) == sizeof(SSize_t))
13368                 printf("$dflt\n");
13369         else if (sizeof(Size_t) == sizeof(int))
13370                 printf("int\n");
13371         else 
13372                 printf("long\n");
13373         exit(0);
13374 }
13375 EOM
13376 echo " "
13377 set ssize
13378 if eval $compile_ok && ./ssize > /dev/null; then
13379         ssizetype=`./ssize`
13380         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13381 else
13382         $cat >&4 <<EOM
13383 Help! I can't compile and run the ssize_t test program: please enlighten me!
13384 (This is probably a misconfiguration in your system or libraries, and
13385 you really ought to fix it.  Still, I'll try anyway.)
13386
13387 I need a type that is the same size as $sizetype, but is guaranteed to
13388 be signed.  Common values are ssize_t, int and long.
13389
13390 EOM
13391         rp="What signed type is the same size as $sizetype?"
13392         . ./myread
13393         ssizetype="$ans"
13394 fi
13395 $rm -f ssize ssize.*
13396
13397 : see what type of char stdio uses.
13398 echo " "
13399 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13400         echo "Your stdio uses unsigned chars." >&4
13401         stdchar="unsigned char"
13402 else
13403         echo "Your stdio uses signed chars." >&4
13404         stdchar="char"
13405 fi
13406
13407 : see if time exists
13408 echo " "
13409 if test "X$d_time" = X -o X"$timetype" = X; then
13410     if set time val -f d_time; eval $csym; $val; then
13411                 echo 'time() found.' >&4
13412                 val="$define"
13413                 rp="What is the type returned by time() on this system?"
13414                 set time_t timetype long stdio.h sys/types.h
13415                 eval $typedef_ask
13416     else
13417                 echo 'time() not found, hope that will do.' >&4
13418                 val="$undef"
13419                 timetype='int';
13420     fi
13421     set d_time
13422     eval $setvar
13423 fi
13424
13425 : see what type uids are declared as in the kernel
13426 echo " "
13427 echo "Looking for the type for user ids returned by getuid()."
13428 set uid_t uidtype xxx stdio.h sys/types.h
13429 eval $typedef
13430 case "$uidtype" in
13431 xxx)
13432         xxx=`./findhdr sys/user.h`
13433         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13434         case $1 in
13435         unsigned) dflt="$1 $2" ;;
13436         *) dflt="$1" ;;
13437         esac
13438         ;;
13439 *) dflt="$uidtype";;
13440 esac
13441 case "$uidtype" in
13442 uid_t)  echo "uid_t found." ;;
13443 *)      rp="What is the type for user ids returned by getuid()?"
13444         . ./myread
13445         uidtype="$ans"
13446         ;;
13447 esac
13448
13449 echo " "
13450 case "$uidtype" in
13451 *_t) zzz="$uidtype"     ;;
13452 *)   zzz="uid"          ;;
13453 esac
13454 echo "Checking the size of $zzz..." >&4 
13455 cat > try.c <<EOCP
13456 #include <sys/types.h>
13457 #include <stdio.h>
13458 int main() {
13459     printf("%d\n", (int)sizeof($uidtype));
13460     exit(0);
13461 }
13462 EOCP
13463 set try
13464 if eval $compile_ok; then
13465         yyy=`./try`
13466         case "$yyy" in
13467         '')     uidsize=4
13468                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13469                 ;;
13470         *)      uidsize=$yyy
13471                 echo "Your $zzz size is $uidsize bytes."
13472                 ;;
13473         esac
13474 else
13475         uidsize=4
13476         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13477 fi
13478
13479 echo " "
13480 case "$uidtype" in
13481 *_t) zzz="$uidtype"     ;;
13482 *)   zzz="uid"          ;;
13483 esac
13484 echo "Checking the sign of $zzz..." >&4
13485 cat > try.c <<EOCP
13486 #include <sys/types.h>
13487 #include <stdio.h>
13488 int main() {
13489         $uidtype foo = -1;
13490         if (foo < 0)
13491                 printf("-1\n");
13492         else
13493                 printf("1\n");
13494 }
13495 EOCP
13496 set try
13497 if eval $compile; then
13498         yyy=`./try`
13499         case "$yyy" in
13500         '')     uidsign=1
13501                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13502                 ;;
13503         *)      uidsign=$yyy
13504                 case "$uidsign" in
13505                  1) echo "Your $zzz is unsigned." ;;
13506                 -1) echo "Your $zzz is signed."   ;;
13507                 esac
13508                 ;;
13509         esac
13510 else
13511         uidsign=1
13512         echo "(I can't compile the test program--guessing unsigned.)" >&4
13513 fi
13514
13515
13516
13517 echo " "
13518 $echo "Checking the format string to be used for uids..." >&4
13519
13520 case "$uidsign" in
13521 -1)     if $test X"$uidsize" = X"$ivsize"; then
13522                 uidformat="$ivdformat"
13523         else
13524                 if $test X"$uidsize" = X"$longsize"; then
13525                         uidformat='"ld"'
13526                 else
13527                         if $test X"$uidsize" = X"$intsize"; then
13528                                 uidformat='"d"'
13529                         else
13530                                 if $test X"$uidsize" = X"$shortsize"; then
13531                                         uidformat='"hd"'
13532                                 fi
13533                         fi
13534                 fi
13535         fi
13536         ;;
13537 *)      if $test X"$uidsize" = X"$uvsize"; then
13538                 uidformat="$uvuformat"
13539         else
13540                 if $test X"$uidsize" = X"$longsize"; then
13541                         uidformat='"lu"'
13542                 else
13543                         if $test X"$uidsize" = X"$intsize"; then
13544                                 uidformat='"u"'
13545                         else
13546                                 if $test X"$uidsize" = X"$shortsize"; then
13547                                         uidformat='"hu"'
13548                                 fi
13549                         fi
13550                 fi
13551         fi
13552         ;;
13553 esac
13554
13555 : see if dbm.h is available
13556 : see if dbmclose exists
13557 set dbmclose d_dbmclose
13558 eval $inlibc
13559
13560 case "$d_dbmclose" in
13561 $define)
13562         set dbm.h i_dbm
13563         eval $inhdr
13564         case "$i_dbm" in
13565         $define)
13566                 val="$undef"
13567                 set i_rpcsvcdbm
13568                 eval $setvar
13569                 ;;
13570         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13571                 eval $inhdr
13572                 ;;
13573         esac
13574         ;;
13575 *)      echo "We won't be including <dbm.h>"
13576         val="$undef"
13577         set i_dbm
13578         eval $setvar
13579         val="$undef"
13580         set i_rpcsvcdbm
13581         eval $setvar
13582         ;;
13583 esac
13584
13585 : see if this is a sys/file.h system
13586 val=''
13587 set sys/file.h val
13588 eval $inhdr
13589
13590 : do we need to include sys/file.h ?
13591 case "$val" in
13592 "$define")
13593         echo " "
13594         if $h_sysfile; then
13595                 val="$define"
13596                 echo "We'll be including <sys/file.h>." >&4
13597         else
13598                 val="$undef"
13599                 echo "We won't be including <sys/file.h>." >&4
13600         fi
13601         ;;
13602 *)
13603         h_sysfile=false
13604         ;;
13605 esac
13606 set i_sysfile
13607 eval $setvar
13608
13609 : see if fcntl.h is there
13610 val=''
13611 set fcntl.h val
13612 eval $inhdr
13613
13614 : see if we can include fcntl.h
13615 case "$val" in
13616 "$define")
13617         echo " "
13618         if $h_fcntl; then
13619                 val="$define"
13620                 echo "We'll be including <fcntl.h>." >&4
13621         else
13622                 val="$undef"
13623                 if $h_sysfile; then
13624         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13625                 else
13626                         echo "We won't be including <fcntl.h>." >&4
13627                 fi
13628         fi
13629         ;;
13630 *)
13631         h_fcntl=false
13632         val="$undef"
13633         ;;
13634 esac
13635 set i_fcntl
13636 eval $setvar
13637
13638 : see if this is a iconv.h system
13639 set iconv.h i_iconv
13640 eval $inhdr
13641
13642 : see if locale.h is available
13643 set locale.h i_locale
13644 eval $inhdr
13645
13646 : see if mach cthreads are available
13647 if test "X$usethreads" = "X$define"; then
13648         set mach/cthreads.h i_machcthr
13649         eval $inhdr
13650 else
13651         i_machcthr="$undef"
13652 fi
13653
13654
13655
13656 : see if this is a math.h system
13657 set math.h i_math
13658 eval $inhdr
13659
13660 : see if this is a mntent.h system
13661 set mntent.h i_mntent
13662 eval $inhdr
13663
13664 : see if ndbm.h is available
13665 set ndbm.h t_ndbm
13666 eval $inhdr
13667 case "$t_ndbm" in
13668 $define)
13669         : see if dbm_open exists
13670         set dbm_open d_dbm_open
13671         eval $inlibc
13672         case "$d_dbm_open" in
13673         $undef)
13674                 t_ndbm="$undef"
13675                 echo "We won't be including <ndbm.h>"
13676                 ;;
13677         esac
13678         ;;
13679 esac
13680 val="$t_ndbm"
13681 set i_ndbm
13682 eval $setvar
13683
13684 : see if net/errno.h is available
13685 val=''
13686 set net/errno.h val
13687 eval $inhdr
13688
13689 : Unfortunately, it causes problems on some systems.  Arrgh.
13690 case "$val" in
13691 $define)
13692         cat > try.c <<'EOM'
13693 #include <stdio.h>
13694 #include <errno.h>
13695 #include <net/errno.h>
13696 int func()
13697 {
13698         return ENOTSOCK;
13699 }
13700 EOM
13701         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13702                 echo "We'll be including <net/errno.h>." >&4
13703         else
13704                 echo "We won't be including <net/errno.h>." >&4
13705                 val="$undef"
13706         fi
13707         $rm -f try.* try
13708         ;;
13709 esac
13710 set i_neterrno
13711 eval $setvar
13712
13713 : see if netinet/tcp.h is available
13714 set netinet/tcp.h i_netinettcp
13715 eval $inhdr
13716
13717 : see if this is a poll.h system
13718 set poll.h i_poll
13719 eval $inhdr
13720
13721 echo " "
13722 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13723 $cat <<'EOSH' > Cppsym.know
13724 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13725 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13726 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13727 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13728 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13729 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13730 bull c cadmus clipper CMU COFF COMPILER_VERSION
13731 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13732 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13733 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13734 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13735 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13736 H3050R H3050RX hbullx20 hcx host_mips
13737 hp200 hp300 hp700 HP700 hp800 hp9000
13738 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13739 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13740 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13741 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13742 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13743 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13744 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13745 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13746 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13747 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13748 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13749 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13750 MATH_HAS_NO_SIDE_EFFECTS
13751 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13752 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13753 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13754 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13755 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13756 NetBSD news1500 news1700 news1800 news1900 news3700
13757 news700 news800 news900 NeXT NLS ns16000 ns32000
13758 ns32016 ns32332 ns32k nsc32000
13759 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13760 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13761 pc532 pdp11 PGC PIC plexus PORTAR posix
13762 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13763 POSIX_C_SOURCE POSIX_SOURCE POWER
13764 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13765 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13766 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13767 sony sony_news sonyrisc sparc sparclite spectrum
13768 stardent stdc STDC_EXT stratos sun sun3 sun386
13769 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13770 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13771 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13772 sysV68 sysV88 Tek4132 Tek4300 titan
13773 tower tower32 tower32_200 tower32_600 tower32_700
13774 tower32_800 tower32_850 tss
13775 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13776 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13777 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13778 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13779 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13780 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13781 z8000
13782 EOSH
13783 # Maybe put other stuff here too.
13784 cat <<EOSH >>Cppsym.know
13785 $osname
13786 EOSH
13787 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13788 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13789 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13790 $rm -f Cppsym.a Cppsym.b
13791 cat <<EOSH > Cppsym
13792 $startsh
13793 if $test \$# -gt 0; then
13794     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13795     if $test -s Cppsym.got; then
13796         $rm -f Cppsym.got
13797         exit 0
13798     fi
13799     $rm -f Cppsym.got
13800     exit 1
13801 else
13802     $tr " " "$trnl" | ./Cppsym.try
13803     exit 0
13804 fi
13805 EOSH
13806 chmod +x Cppsym
13807 $eunicefix Cppsym
13808 cat <<EOSH > Cppsym.try
13809 $startsh
13810 cat <<'EOCP' > try.c
13811 #include <stdio.h>
13812 int main() {
13813 EOCP
13814 $awk \\
13815 EOSH
13816 cat <<'EOSH' >> Cppsym.try
13817 'length($1) > 0 {
13818     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
13819     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
13820     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
13821     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
13822 }'       >> try.c
13823 echo '}' >> try.c
13824 EOSH
13825 cat <<EOSH >> Cppsym.try
13826 cc="$cc"
13827 optimize="$optimize"
13828 ccflags="$ccflags"
13829 ldflags="$ldflags"
13830 libs="$libs"
13831 exe_ext="$exe_ext"
13832 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
13833 EOSH
13834 chmod +x Cppsym.try
13835 $eunicefix Cppsym.try
13836 ./Cppsym < Cppsym.know > Cppsym.true
13837 : now check the C compiler for additional symbols
13838 postprocess_cc_v=''
13839 case "$osname" in
13840 aix) postprocess_cc_v="|$tr , ' '" ;;
13841 esac
13842 $cat >ccsym <<EOS
13843 $startsh
13844 $cat >tmp.c <<EOF
13845 extern int foo;
13846 EOF
13847 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13848 do
13849         case "\$i" in
13850         -D*) echo "\$i" | $sed 's/^-D//';;
13851         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13852         esac
13853 done
13854 $rm -f try.c
13855 EOS
13856 postprocess_cc_v=''
13857 chmod +x ccsym
13858 $eunicefix ccsym
13859 ./ccsym > ccsym1.raw
13860 if $test -s ccsym1.raw; then
13861        $sort ccsym1.raw | $uniq >ccsym.raw
13862 else
13863        mv ccsym1.raw ccsym.raw
13864 fi
13865
13866 $awk '/\=/ { print $0; next }
13867         { print $0"=1" }' ccsym.raw >ccsym.list
13868 $awk '/\=/ { print $0; next }
13869         { print $0"=1" }' Cppsym.true >ccsym.true
13870 $comm -13 ccsym.true ccsym.list >ccsym.own
13871 $comm -12 ccsym.true ccsym.list >ccsym.com
13872 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13873 also=''
13874 if $test -z ccsym.raw; then
13875         echo "Your C compiler doesn't seem to define any symbols!" >&4
13876         echo " "
13877         echo "However, your C preprocessor defines the following symbols:"
13878         $cat Cppsym.true
13879         ccsymbols=''
13880         cppsymbols=`$cat Cppsym.true`
13881         cppsymbols=`echo $cppsymbols`
13882         cppccsymbols="$cppsymbols"
13883 else
13884         if $test -s ccsym.com; then
13885                 echo "Your C compiler and pre-processor define these symbols:"
13886                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13887                 also='also '
13888                 symbols='ones'
13889                 cppccsymbols=`$cat ccsym.com`
13890                 cppccsymbols=`echo $cppccsymbols`
13891                 $test "$silent" || sleep 1
13892         fi
13893         if $test -s ccsym.cpp; then
13894                 $test "$also" && echo " "
13895                 echo "Your C pre-processor ${also}defines the following symbols:"
13896                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13897                 also='further '
13898                 cppsymbols=`$cat ccsym.cpp`
13899                 cppsymbols=`echo $cppsymbols`
13900                 $test "$silent" || sleep 1
13901         fi
13902         if $test -s ccsym.own; then
13903                 $test "$also" && echo " "
13904                 echo "Your C compiler ${also}defines the following cpp symbols:"
13905                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13906                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13907                 ccsymbols=`$cat ccsym.own`
13908                 ccsymbols=`echo $ccsymbols`
13909                 $test "$silent" || sleep 1
13910         fi
13911 fi
13912 $rm -f ccsym*
13913
13914 : see if this is a termio system
13915 val="$undef"
13916 val2="$undef"
13917 val3="$undef"
13918 if $test `./findhdr termios.h`; then
13919         set tcsetattr i_termios
13920         eval $inlibc
13921         val3="$i_termios"
13922 fi
13923 echo " "
13924 case "$val3" in
13925 "$define") echo "You have POSIX termios.h... good!" >&4;;
13926 *) if ./Cppsym pyr; then
13927                 case "`/bin/universe`" in
13928                 ucb) if $test `./findhdr sgtty.h`; then
13929                                 val2="$define"
13930                                 echo "<sgtty.h> found." >&4
13931                         else
13932                                 echo "System is pyramid with BSD universe."
13933                                 echo "<sgtty.h> not found--you could have problems." >&4
13934                         fi;;
13935                 *) if $test `./findhdr termio.h`; then
13936                                 val="$define"
13937                                 echo "<termio.h> found." >&4
13938                         else
13939                                 echo "System is pyramid with USG universe."
13940                                 echo "<termio.h> not found--you could have problems." >&4
13941                         fi;;
13942                 esac
13943         elif ./usg; then
13944                 if $test `./findhdr termio.h`; then
13945                         echo "<termio.h> found." >&4
13946                         val="$define"
13947                 elif $test `./findhdr sgtty.h`; then
13948                         echo "<sgtty.h> found." >&4
13949                         val2="$define"
13950                 else
13951 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13952                 fi
13953         else
13954                 if $test `./findhdr sgtty.h`; then
13955                         echo "<sgtty.h> found." >&4
13956                         val2="$define"
13957                 elif $test `./findhdr termio.h`; then
13958                         echo "<termio.h> found." >&4
13959                         val="$define"
13960                 else
13961 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13962                 fi
13963         fi;;
13964 esac
13965 set i_termio; eval $setvar
13966 val=$val2; set i_sgtty; eval $setvar
13967 val=$val3; set i_termios; eval $setvar
13968
13969 : see if this is a shadow.h system
13970 set shadow.h i_shadow
13971 eval $inhdr
13972
13973 : see if this is a socks.h system
13974 set socks.h i_socks
13975 eval $inhdr
13976
13977 : see if stdarg is available
13978 echo " "
13979 if $test `./findhdr stdarg.h`; then
13980         echo "<stdarg.h> found." >&4
13981         valstd="$define"
13982 else
13983         echo "<stdarg.h> NOT found." >&4
13984         valstd="$undef"
13985 fi
13986
13987 : see if varags is available
13988 echo " "
13989 if $test `./findhdr varargs.h`; then
13990         echo "<varargs.h> found." >&4
13991 else
13992         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13993 fi
13994
13995 : set up the varargs testing programs
13996 $cat > varargs.c <<EOP
13997 #ifdef I_STDARG
13998 #include <stdarg.h>
13999 #endif
14000 #ifdef I_VARARGS
14001 #include <varargs.h>
14002 #endif
14003
14004 #ifdef I_STDARG
14005 int f(char *p, ...)
14006 #else
14007 int f(va_alist)
14008 va_dcl
14009 #endif
14010 {
14011         va_list ap;
14012 #ifndef I_STDARG
14013         char *p;
14014 #endif
14015 #ifdef I_STDARG
14016         va_start(ap,p);
14017 #else
14018         va_start(ap);
14019         p = va_arg(ap, char *);
14020 #endif
14021         va_end(ap);
14022 }
14023 EOP
14024 $cat > varargs <<EOP
14025 $startsh
14026 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14027         echo "true"
14028 else
14029         echo "false"
14030 fi
14031 $rm -f varargs$_o
14032 EOP
14033 chmod +x varargs
14034
14035 : now check which varargs header should be included
14036 echo " "
14037 i_varhdr=''
14038 case "$valstd" in
14039 "$define")
14040         if `./varargs I_STDARG`; then
14041                 val='stdarg.h'
14042         elif `./varargs I_VARARGS`; then
14043                 val='varargs.h'
14044         fi
14045         ;;
14046 *)
14047         if `./varargs I_VARARGS`; then
14048                 val='varargs.h'
14049         fi
14050         ;;
14051 esac
14052 case "$val" in
14053 '')
14054 echo "I could not find the definition for va_dcl... You have problems..." >&4
14055         val="$undef"; set i_stdarg; eval $setvar
14056         val="$undef"; set i_varargs; eval $setvar
14057         ;;
14058 *) 
14059         set i_varhdr
14060         eval $setvar
14061         case "$i_varhdr" in
14062         stdarg.h)
14063                 val="$define"; set i_stdarg; eval $setvar
14064                 val="$undef"; set i_varargs; eval $setvar
14065                 ;;
14066         varargs.h)
14067                 val="$undef"; set i_stdarg; eval $setvar
14068                 val="$define"; set i_varargs; eval $setvar
14069                 ;;
14070         esac
14071         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14072 esac
14073 $rm -f varargs*
14074
14075 : see if stddef is available
14076 set stddef.h i_stddef
14077 eval $inhdr
14078
14079 : see if sys/access.h is available
14080 set sys/access.h i_sysaccess
14081 eval $inhdr
14082
14083 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14084 set sys/filio.h i_sysfilio
14085 eval $inhdr
14086 echo " "
14087 if $test `./findhdr sys/ioctl.h`; then
14088         val="$define"
14089         echo '<sys/ioctl.h> found.' >&4
14090 else
14091         val="$undef"
14092         if $test $i_sysfilio = "$define"; then
14093             echo '<sys/ioctl.h> NOT found.' >&4
14094         else
14095                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14096                 $test $i_termio = "$define" && xxx="termio.h"
14097                 $test $i_termios = "$define" && xxx="termios.h"
14098 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14099         fi
14100 fi
14101 set i_sysioctl
14102 eval $setvar
14103
14104
14105 : see if this is a syslog.h system
14106 set syslog.h i_syslog
14107 eval $inhdr
14108
14109 : see if sys/resource.h has to be included
14110 set sys/resource.h i_sysresrc
14111 eval $inhdr
14112
14113 : see if sys/security.h is available
14114 set sys/security.h i_syssecrt
14115 eval $inhdr
14116
14117 : see if this is a sys/statvfs.h system
14118 set sys/statvfs.h i_sysstatvfs
14119 eval $inhdr
14120
14121 : see if this is a sys/uio.h system
14122 set sys/uio.h i_sysuio
14123 eval $inhdr
14124
14125 : see if this is a sys/un.h system
14126 set sys/un.h i_sysun
14127 eval $inhdr
14128
14129
14130 : see if this is a sys/utsname.h system
14131 set sys/utsname.h i_sysutsname
14132 eval $inhdr
14133
14134 : see if this is a syswait system
14135 set sys/wait.h i_syswait
14136 eval $inhdr
14137
14138 : see if this is a ustat.h system
14139 set ustat.h i_ustat
14140 eval $inhdr
14141
14142 : see if this is an utime system
14143 set utime.h i_utime
14144 eval $inhdr
14145
14146 : see if this is a values.h system
14147 set values.h i_values
14148 eval $inhdr
14149
14150 : see if this is a vfork system
14151 case "$d_vfork" in
14152 "$define")
14153         set vfork.h i_vfork
14154         eval $inhdr
14155         ;;
14156 *)
14157         i_vfork="$undef"
14158         ;;
14159 esac
14160
14161 : see if gdbm.h is available
14162 set gdbm.h t_gdbm
14163 eval $inhdr
14164 case "$t_gdbm" in
14165 $define)
14166         : see if gdbm_open exists
14167         set gdbm_open d_gdbm_open
14168         eval $inlibc
14169         case "$d_gdbm_open" in
14170         $undef)
14171                 t_gdbm="$undef"
14172                 echo "We won't be including <gdbm.h>"
14173                 ;;
14174         esac
14175         ;;
14176 esac
14177 val="$t_gdbm"
14178 set i_gdbm
14179 eval $setvar
14180
14181 echo " "
14182 echo "Looking for extensions..." >&4
14183 : If we are using the old config.sh, known_extensions may contain
14184 : old or inaccurate or duplicate values.
14185 known_extensions=''
14186 nonxs_extensions=''
14187 : We do not use find because it might not be available.
14188 : We do not just use MANIFEST because the user may have dropped
14189 : some additional extensions into the source tree and expect them
14190 : to be built.
14191
14192 : Function to recursively find available extensions, ignoring DynaLoader
14193 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14194 find_extensions='
14195     for xxx in *; do
14196        case "$xxx" in
14197            DynaLoader|dynaload) ;;
14198            *)
14199            if $test -f $xxx/$xxx.xs; then
14200                known_extensions="$known_extensions $1$xxx";
14201            elif $test -f $xxx/Makefile.PL; then
14202                nonxs_extensions="$nonxs_extensions $1$xxx";
14203            else
14204                if $test -d $xxx -a $# -lt 10; then
14205                    set $1$xxx/ $*;
14206                    cd $xxx;
14207                    eval $find_extensions;
14208                    cd ..;
14209                    shift;
14210                fi;
14211            fi
14212            ;;
14213        esac;
14214     done'
14215 tdir=`pwd`
14216 cd $rsrc/ext
14217 set X
14218 shift
14219 eval $find_extensions
14220 set X $nonxs_extensions
14221 shift
14222 nonxs_extensions="$*"
14223 set X $known_extensions
14224 shift
14225 known_extensions="$*"
14226 cd $tdir
14227
14228 : Now see which are supported on this system.
14229 avail_ext=''
14230 for xxx in $known_extensions ; do
14231         case "$xxx" in
14232         DB_File|db_file)
14233                 case "$i_db" in
14234                 $define) avail_ext="$avail_ext $xxx" ;;
14235                 esac
14236                 ;;
14237         GDBM_File|gdbm_fil)
14238                 case "$i_gdbm" in 
14239                 $define) avail_ext="$avail_ext $xxx" ;;
14240                 esac
14241                 ;;
14242         NDBM_File|ndbm_fil)
14243                 case "$i_ndbm" in
14244                 $define)
14245                     case "$osname-$use64bits" in
14246                     hpux-define)
14247                         case "$libs" in
14248                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14249                         esac
14250                         ;;
14251                     *) avail_ext="$avail_ext $xxx" ;;
14252                     esac
14253                     ;;
14254                 esac
14255                 ;;
14256         ODBM_File|odbm_fil) 
14257                 case "${i_dbm}${i_rpcsvcdbm}" in
14258                 *"${define}"*)
14259                     case "$osname-$use64bits" in
14260                     hpux-define)
14261                         case "$libs" in
14262                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14263                         esac
14264                         ;;
14265                     *) avail_ext="$avail_ext $xxx" ;;
14266                     esac
14267                     ;;
14268                 esac
14269                 ;;
14270         POSIX|posix)
14271                 case "$useposix" in
14272                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14273                 esac
14274                 ;;
14275         Opcode|opcode)
14276                 case "$useopcode" in
14277                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14278                 esac
14279                 ;;
14280         Socket|socket)
14281                 case "$d_socket" in 
14282                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14283                 esac
14284                 ;;
14285         Thread|thread)
14286                 case "$usethreads" in 
14287                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14288                 esac
14289                 ;;
14290         IPC/SysV|ipc/sysv)
14291                 : XXX Do we need a useipcsysv variable here
14292                 case "${d_msg}${d_sem}${d_shm}" in 
14293                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14294                 esac
14295                 ;;
14296         *)      avail_ext="$avail_ext $xxx"
14297                 ;;
14298         esac
14299 done
14300
14301 set X $avail_ext
14302 shift
14303 avail_ext="$*"
14304
14305 : Now see which nonxs extensions are supported on this system.
14306 : For now assume all are.
14307 nonxs_ext=''
14308 for xxx in $nonxs_extensions ; do
14309         case "$xxx" in
14310         *)      nonxs_ext="$nonxs_ext $xxx"
14311                 ;;
14312         esac
14313 done
14314
14315 set X $nonxs_ext
14316 shift
14317 nonxs_ext="$*"
14318
14319 case $usedl in
14320 $define)
14321         $cat <<EOM
14322 A number of extensions are supplied with $package.  You may choose to
14323 compile these extensions for dynamic loading (the default), compile
14324 them into the $package executable (static loading), or not include
14325 them at all.  Answer "none" to include no extensions.
14326 Note that DynaLoader is always built and need not be mentioned here.
14327
14328 EOM
14329         case "$dynamic_ext" in
14330         '') dflt="$avail_ext" ;;
14331         *)      dflt="$dynamic_ext"
14332                 # Perhaps we are reusing an old out-of-date config.sh.
14333                 case "$hint" in
14334                 previous)
14335                         if test X"$dynamic_ext" != X"$avail_ext"; then
14336                                 $cat <<EOM
14337 NOTICE:  Your previous config.sh list may be incorrect. 
14338 The extensions now available to you are 
14339         ${avail_ext}
14340 but the default list from your previous config.sh is
14341         ${dynamic_ext} 
14342
14343 EOM
14344                         fi
14345                         ;;
14346                 esac
14347                 ;;
14348         esac
14349         case "$dflt" in
14350         '')     dflt=none;;
14351         esac
14352         rp="What extensions do you wish to load dynamically?"
14353         . ./myread
14354         case "$ans" in
14355         none) dynamic_ext=' ' ;;
14356         *) dynamic_ext="$ans" ;;
14357         esac
14358
14359         case "$static_ext" in
14360         '')
14361                 : Exclude those already listed in dynamic linking
14362                 dflt=''
14363                 for xxx in $avail_ext; do
14364                         case " $dynamic_ext " in
14365                         *" $xxx "*) ;;
14366                         *) dflt="$dflt $xxx" ;;
14367                         esac
14368                 done
14369                 set X $dflt
14370                 shift
14371                 dflt="$*"
14372                 ;;
14373         *)  dflt="$static_ext" 
14374                 ;;
14375         esac
14376
14377         case "$dflt" in
14378         '')     dflt=none;;
14379         esac
14380         rp="What extensions do you wish to load statically?"
14381         . ./myread
14382         case "$ans" in
14383         none) static_ext=' ' ;;
14384         *) static_ext="$ans" ;;
14385         esac
14386         ;;
14387 *)
14388         $cat <<EOM
14389 A number of extensions are supplied with $package.  Answer "none" 
14390 to include no extensions. 
14391 Note that DynaLoader is always built and need not be mentioned here.
14392
14393 EOM
14394         case "$static_ext" in
14395         '') dflt="$avail_ext" ;;
14396         *)      dflt="$static_ext"
14397                 # Perhaps we are reusing an old out-of-date config.sh.
14398                 case "$hint" in
14399                 previous)
14400                         if test X"$static_ext" != X"$avail_ext"; then
14401                                 $cat <<EOM
14402 NOTICE:  Your previous config.sh list may be incorrect. 
14403 The extensions now available to you are 
14404         ${avail_ext}
14405 but the default list from your previous config.sh is
14406         ${static_ext} 
14407
14408 EOM
14409                         fi
14410                         ;;
14411                 esac
14412                 ;;
14413         esac
14414         : Exclude those that are not xs extensions
14415         case "$dflt" in
14416         '')     dflt=none;;
14417         esac
14418         rp="What extensions do you wish to include?"
14419         . ./myread
14420         case "$ans" in
14421         none) static_ext=' ' ;;
14422         *) static_ext="$ans" ;;
14423         esac
14424         ;;
14425 esac
14426
14427 set X $dynamic_ext $static_ext $nonxs_ext
14428 shift
14429 extensions="$*"
14430
14431 : Remove build directory name from cppstdin so it can be used from
14432 : either the present location or the final installed location.
14433 echo " "
14434 : Get out of the UU directory to get correct path name.
14435 cd ..
14436 case "$cppstdin" in
14437 `pwd`/cppstdin)
14438         echo "Stripping down cppstdin path name"
14439         cppstdin=cppstdin
14440         ;;
14441 esac
14442 cd UU
14443
14444 : end of configuration questions
14445 echo " "
14446 echo "End of configuration questions."
14447 echo " "
14448
14449 : back to where it started
14450 if test -d ../UU; then
14451         cd ..
14452 fi
14453
14454 : configuration may be patched via a 'config.over' file
14455 if $test -f config.over; then
14456         echo " "
14457         dflt=y
14458         rp='I see a config.over file.  Do you wish to load it?'
14459         . UU/myread
14460         case "$ans" in
14461         n*) echo "OK, I'll ignore it.";;
14462         *)      . ./config.over
14463                 echo "Configuration override changes have been loaded."
14464                 ;;
14465         esac
14466 fi
14467
14468 : in case they want portability, strip down executable paths
14469 case "$d_portable" in
14470 "$define")
14471         echo " "
14472         echo "Stripping down executable paths..." >&4
14473         for file in $loclist $trylist; do
14474                 eval temp=\$$file
14475                 eval $file=`basename $temp`
14476         done
14477         ;;
14478 esac
14479
14480 : create config.sh file
14481 echo " "
14482 echo "Creating config.sh..." >&4
14483 $spitshell <<EOT >config.sh
14484 $startsh
14485 #
14486 # This file was produced by running the Configure script. It holds all the
14487 # definitions figured out by Configure. Should you modify one of these values,
14488 # do not forget to propagate your changes by running "Configure -der". You may
14489 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14490 #
14491
14492 # Package name      : $package
14493 # Source directory  : $src
14494 # Configuration time: $cf_time
14495 # Configured by     : $cf_by
14496 # Target system     : $myuname
14497
14498 Author='$Author'
14499 Date='$Date'
14500 Header='$Header'
14501 Id='$Id'
14502 Locker='$Locker'
14503 Log='$Log'
14504 Mcc='$Mcc'
14505 RCSfile='$RCSfile'
14506 Revision='$Revision'
14507 Source='$Source'
14508 State='$State'
14509 _a='$_a'
14510 _exe='$_exe'
14511 _o='$_o'
14512 afs='$afs'
14513 alignbytes='$alignbytes'
14514 ansi2knr='$ansi2knr'
14515 aphostname='$aphostname'
14516 api_revision='$api_revision'
14517 api_subversion='$api_subversion'
14518 api_version='$api_version'
14519 api_versionstring='$api_versionstring'
14520 ar='$ar'
14521 archlib='$archlib'
14522 archlibexp='$archlibexp'
14523 archname64='$archname64'
14524 archname='$archname'
14525 archobjs='$archobjs'
14526 awk='$awk'
14527 baserev='$baserev'
14528 bash='$bash'
14529 bin='$bin'
14530 bincompat5005='$bincompat5005'
14531 binexp='$binexp'
14532 bison='$bison'
14533 byacc='$byacc'
14534 byteorder='$byteorder'
14535 c='$c'
14536 castflags='$castflags'
14537 cat='$cat'
14538 cc='$cc'
14539 cccdlflags='$cccdlflags'
14540 ccdlflags='$ccdlflags'
14541 ccflags='$ccflags'
14542 ccsymbols='$ccsymbols'
14543 cf_by='$cf_by'
14544 cf_email='$cf_email'
14545 cf_time='$cf_time'
14546 charsize='$charsize'
14547 chgrp='$chgrp'
14548 chmod='$chmod'
14549 chown='$chown'
14550 clocktype='$clocktype'
14551 comm='$comm'
14552 compress='$compress'
14553 contains='$contains'
14554 cp='$cp'
14555 cpio='$cpio'
14556 cpp='$cpp'
14557 cpp_stuff='$cpp_stuff'
14558 cppccsymbols='$cppccsymbols'
14559 cppflags='$cppflags'
14560 cpplast='$cpplast'
14561 cppminus='$cppminus'
14562 cpprun='$cpprun'
14563 cppstdin='$cppstdin'
14564 cppsymbols='$cppsymbols'
14565 crosscompile='$crosscompile'
14566 cryptlib='$cryptlib'
14567 csh='$csh'
14568 d_Gconvert='$d_Gconvert'
14569 d_PRIEldbl='$d_PRIEldbl'
14570 d_PRIFldbl='$d_PRIFldbl'
14571 d_PRIGldbl='$d_PRIGldbl'
14572 d_PRIX64='$d_PRIX64'
14573 d_PRId64='$d_PRId64'
14574 d_PRIeldbl='$d_PRIeldbl'
14575 d_PRIfldbl='$d_PRIfldbl'
14576 d_PRIgldbl='$d_PRIgldbl'
14577 d_PRIi64='$d_PRIi64'
14578 d_PRIo64='$d_PRIo64'
14579 d_PRIu64='$d_PRIu64'
14580 d_PRIx64='$d_PRIx64'
14581 d_access='$d_access'
14582 d_accessx='$d_accessx'
14583 d_alarm='$d_alarm'
14584 d_archlib='$d_archlib'
14585 d_atolf='$d_atolf'
14586 d_atoll='$d_atoll'
14587 d_attribut='$d_attribut'
14588 d_bcmp='$d_bcmp'
14589 d_bcopy='$d_bcopy'
14590 d_bincompat5005='$d_bincompat5005'
14591 d_bsd='$d_bsd'
14592 d_bsdgetpgrp='$d_bsdgetpgrp'
14593 d_bsdsetpgrp='$d_bsdsetpgrp'
14594 d_bzero='$d_bzero'
14595 d_casti32='$d_casti32'
14596 d_castneg='$d_castneg'
14597 d_charvspr='$d_charvspr'
14598 d_chown='$d_chown'
14599 d_chroot='$d_chroot'
14600 d_chsize='$d_chsize'
14601 d_closedir='$d_closedir'
14602 d_const='$d_const'
14603 d_crypt='$d_crypt'
14604 d_csh='$d_csh'
14605 d_cuserid='$d_cuserid'
14606 d_dbl_dig='$d_dbl_dig'
14607 d_difftime='$d_difftime'
14608 d_dirnamlen='$d_dirnamlen'
14609 d_dlerror='$d_dlerror'
14610 d_dlopen='$d_dlopen'
14611 d_dlsymun='$d_dlsymun'
14612 d_dosuid='$d_dosuid'
14613 d_drand48proto='$d_drand48proto'
14614 d_dup2='$d_dup2'
14615 d_eaccess='$d_eaccess'
14616 d_endgrent='$d_endgrent'
14617 d_endhent='$d_endhent'
14618 d_endnent='$d_endnent'
14619 d_endpent='$d_endpent'
14620 d_endpwent='$d_endpwent'
14621 d_endsent='$d_endsent'
14622 d_endspent='$d_endspent'
14623 d_eofnblk='$d_eofnblk'
14624 d_eunice='$d_eunice'
14625 d_fchmod='$d_fchmod'
14626 d_fchown='$d_fchown'
14627 d_fcntl='$d_fcntl'
14628 d_fd_macros='$d_fd_macros'
14629 d_fd_set='$d_fd_set'
14630 d_fds_bits='$d_fds_bits'
14631 d_fgetpos='$d_fgetpos'
14632 d_flexfnam='$d_flexfnam'
14633 d_flock='$d_flock'
14634 d_fork='$d_fork'
14635 d_fpathconf='$d_fpathconf'
14636 d_fpos64_t='$d_fpos64_t'
14637 d_fs_data_s='$d_fs_data_s'
14638 d_fseeko='$d_fseeko'
14639 d_fsetpos='$d_fsetpos'
14640 d_fstatfs='$d_fstatfs'
14641 d_fstatvfs='$d_fstatvfs'
14642 d_ftello='$d_ftello'
14643 d_ftime='$d_ftime'
14644 d_getcwd='$d_getcwd'
14645 d_getgrent='$d_getgrent'
14646 d_getgrps='$d_getgrps'
14647 d_gethbyaddr='$d_gethbyaddr'
14648 d_gethbyname='$d_gethbyname'
14649 d_gethent='$d_gethent'
14650 d_gethname='$d_gethname'
14651 d_gethostprotos='$d_gethostprotos'
14652 d_getlogin='$d_getlogin'
14653 d_getmnt='$d_getmnt'
14654 d_getmntent='$d_getmntent'
14655 d_getnbyaddr='$d_getnbyaddr'
14656 d_getnbyname='$d_getnbyname'
14657 d_getnent='$d_getnent'
14658 d_getnetprotos='$d_getnetprotos'
14659 d_getpbyname='$d_getpbyname'
14660 d_getpbynumber='$d_getpbynumber'
14661 d_getpent='$d_getpent'
14662 d_getpgid='$d_getpgid'
14663 d_getpgrp2='$d_getpgrp2'
14664 d_getpgrp='$d_getpgrp'
14665 d_getppid='$d_getppid'
14666 d_getprior='$d_getprior'
14667 d_getprotoprotos='$d_getprotoprotos'
14668 d_getpwent='$d_getpwent'
14669 d_getsbyname='$d_getsbyname'
14670 d_getsbyport='$d_getsbyport'
14671 d_getsent='$d_getsent'
14672 d_getservprotos='$d_getservprotos'
14673 d_getspent='$d_getspent'
14674 d_getspnam='$d_getspnam'
14675 d_gettimeod='$d_gettimeod'
14676 d_gnulibc='$d_gnulibc'
14677 d_grpasswd='$d_grpasswd'
14678 d_hasmntopt='$d_hasmntopt'
14679 d_htonl='$d_htonl'
14680 d_iconv='$d_iconv'
14681 d_index='$d_index'
14682 d_inetaton='$d_inetaton'
14683 d_int64t='$d_int64t'
14684 d_isascii='$d_isascii'
14685 d_killpg='$d_killpg'
14686 d_lchown='$d_lchown'
14687 d_ldbl_dig='$d_ldbl_dig'
14688 d_link='$d_link'
14689 d_locconv='$d_locconv'
14690 d_lockf='$d_lockf'
14691 d_longdbl='$d_longdbl'
14692 d_longlong='$d_longlong'
14693 d_lstat='$d_lstat'
14694 d_mblen='$d_mblen'
14695 d_mbstowcs='$d_mbstowcs'
14696 d_mbtowc='$d_mbtowc'
14697 d_memchr='$d_memchr'
14698 d_memcmp='$d_memcmp'
14699 d_memcpy='$d_memcpy'
14700 d_memmove='$d_memmove'
14701 d_memset='$d_memset'
14702 d_mkdir='$d_mkdir'
14703 d_mkdtemp='$d_mkdtemp'
14704 d_mkfifo='$d_mkfifo'
14705 d_mkstemp='$d_mkstemp'
14706 d_mkstemps='$d_mkstemps'
14707 d_mktime='$d_mktime'
14708 d_mmap='$d_mmap'
14709 d_mprotect='$d_mprotect'
14710 d_msg='$d_msg'
14711 d_msg_ctrunc='$d_msg_ctrunc'
14712 d_msg_dontroute='$d_msg_dontroute'
14713 d_msg_oob='$d_msg_oob'
14714 d_msg_peek='$d_msg_peek'
14715 d_msg_proxy='$d_msg_proxy'
14716 d_msgctl='$d_msgctl'
14717 d_msgget='$d_msgget'
14718 d_msgrcv='$d_msgrcv'
14719 d_msgsnd='$d_msgsnd'
14720 d_msync='$d_msync'
14721 d_munmap='$d_munmap'
14722 d_mymalloc='$d_mymalloc'
14723 d_nice='$d_nice'
14724 d_nv_preserves_uv='$d_nv_preserves_uv'
14725 d_off64_t='$d_off64_t'
14726 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14727 d_oldpthreads='$d_oldpthreads'
14728 d_oldsock='$d_oldsock'
14729 d_open3='$d_open3'
14730 d_pathconf='$d_pathconf'
14731 d_pause='$d_pause'
14732 d_phostname='$d_phostname'
14733 d_pipe='$d_pipe'
14734 d_poll='$d_poll'
14735 d_portable='$d_portable'
14736 d_pthread_yield='$d_pthread_yield'
14737 d_pwage='$d_pwage'
14738 d_pwchange='$d_pwchange'
14739 d_pwclass='$d_pwclass'
14740 d_pwcomment='$d_pwcomment'
14741 d_pwexpire='$d_pwexpire'
14742 d_pwgecos='$d_pwgecos'
14743 d_pwpasswd='$d_pwpasswd'
14744 d_pwquota='$d_pwquota'
14745 d_quad='$d_quad'
14746 d_readdir='$d_readdir'
14747 d_readlink='$d_readlink'
14748 d_rename='$d_rename'
14749 d_rewinddir='$d_rewinddir'
14750 d_rmdir='$d_rmdir'
14751 d_safebcpy='$d_safebcpy'
14752 d_safemcpy='$d_safemcpy'
14753 d_sanemcmp='$d_sanemcmp'
14754 d_sched_yield='$d_sched_yield'
14755 d_scm_rights='$d_scm_rights'
14756 d_seekdir='$d_seekdir'
14757 d_select='$d_select'
14758 d_sem='$d_sem'
14759 d_semctl='$d_semctl'
14760 d_semctl_semid_ds='$d_semctl_semid_ds'
14761 d_semctl_semun='$d_semctl_semun'
14762 d_semget='$d_semget'
14763 d_semop='$d_semop'
14764 d_setegid='$d_setegid'
14765 d_seteuid='$d_seteuid'
14766 d_setgrent='$d_setgrent'
14767 d_setgrps='$d_setgrps'
14768 d_sethent='$d_sethent'
14769 d_setlinebuf='$d_setlinebuf'
14770 d_setlocale='$d_setlocale'
14771 d_setnent='$d_setnent'
14772 d_setpent='$d_setpent'
14773 d_setpgid='$d_setpgid'
14774 d_setpgrp2='$d_setpgrp2'
14775 d_setpgrp='$d_setpgrp'
14776 d_setprior='$d_setprior'
14777 d_setpwent='$d_setpwent'
14778 d_setregid='$d_setregid'
14779 d_setresgid='$d_setresgid'
14780 d_setresuid='$d_setresuid'
14781 d_setreuid='$d_setreuid'
14782 d_setrgid='$d_setrgid'
14783 d_setruid='$d_setruid'
14784 d_setsent='$d_setsent'
14785 d_setsid='$d_setsid'
14786 d_setspent='$d_setspent'
14787 d_setvbuf='$d_setvbuf'
14788 d_sfio='$d_sfio'
14789 d_shm='$d_shm'
14790 d_shmat='$d_shmat'
14791 d_shmatprototype='$d_shmatprototype'
14792 d_shmctl='$d_shmctl'
14793 d_shmdt='$d_shmdt'
14794 d_shmget='$d_shmget'
14795 d_sigaction='$d_sigaction'
14796 d_sigsetjmp='$d_sigsetjmp'
14797 d_socket='$d_socket'
14798 d_sockpair='$d_sockpair'
14799 d_sqrtl='$d_sqrtl'
14800 d_statblks='$d_statblks'
14801 d_statfs_f_flags='$d_statfs_f_flags'
14802 d_statfs_s='$d_statfs_s'
14803 d_statvfs='$d_statvfs'
14804 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14805 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14806 d_stdio_stream_array='$d_stdio_stream_array'
14807 d_stdiobase='$d_stdiobase'
14808 d_stdstdio='$d_stdstdio'
14809 d_strchr='$d_strchr'
14810 d_strcoll='$d_strcoll'
14811 d_strctcpy='$d_strctcpy'
14812 d_strerrm='$d_strerrm'
14813 d_strerror='$d_strerror'
14814 d_strtod='$d_strtod'
14815 d_strtol='$d_strtol'
14816 d_strtold='$d_strtold'
14817 d_strtoll='$d_strtoll'
14818 d_strtoul='$d_strtoul'
14819 d_strtoull='$d_strtoull'
14820 d_strtouq='$d_strtouq'
14821 d_strxfrm='$d_strxfrm'
14822 d_suidsafe='$d_suidsafe'
14823 d_symlink='$d_symlink'
14824 d_syscall='$d_syscall'
14825 d_sysconf='$d_sysconf'
14826 d_sysernlst='$d_sysernlst'
14827 d_syserrlst='$d_syserrlst'
14828 d_system='$d_system'
14829 d_tcgetpgrp='$d_tcgetpgrp'
14830 d_tcsetpgrp='$d_tcsetpgrp'
14831 d_telldir='$d_telldir'
14832 d_telldirproto='$d_telldirproto'
14833 d_time='$d_time'
14834 d_times='$d_times'
14835 d_truncate='$d_truncate'
14836 d_tzname='$d_tzname'
14837 d_umask='$d_umask'
14838 d_uname='$d_uname'
14839 d_union_semun='$d_union_semun'
14840 d_ustat='$d_ustat'
14841 d_vendorbin='$d_vendorbin'
14842 d_vendorlib='$d_vendorlib'
14843 d_vfork='$d_vfork'
14844 d_void_closedir='$d_void_closedir'
14845 d_voidsig='$d_voidsig'
14846 d_voidtty='$d_voidtty'
14847 d_volatile='$d_volatile'
14848 d_vprintf='$d_vprintf'
14849 d_wait4='$d_wait4'
14850 d_waitpid='$d_waitpid'
14851 d_wcstombs='$d_wcstombs'
14852 d_wctomb='$d_wctomb'
14853 d_xenix='$d_xenix'
14854 date='$date'
14855 db_hashtype='$db_hashtype'
14856 db_prefixtype='$db_prefixtype'
14857 defvoidused='$defvoidused'
14858 direntrytype='$direntrytype'
14859 dlext='$dlext'
14860 dlsrc='$dlsrc'
14861 doublesize='$doublesize'
14862 drand01='$drand01'
14863 dynamic_ext='$dynamic_ext'
14864 eagain='$eagain'
14865 ebcdic='$ebcdic'
14866 echo='$echo'
14867 egrep='$egrep'
14868 emacs='$emacs'
14869 eunicefix='$eunicefix'
14870 exe_ext='$exe_ext'
14871 expr='$expr'
14872 extensions='$extensions'
14873 fflushNULL='$fflushNULL'
14874 fflushall='$fflushall'
14875 find='$find'
14876 firstmakefile='$firstmakefile'
14877 flex='$flex'
14878 fpossize='$fpossize'
14879 fpostype='$fpostype'
14880 freetype='$freetype'
14881 full_ar='$full_ar'
14882 full_csh='$full_csh'
14883 full_sed='$full_sed'
14884 gccversion='$gccversion'
14885 gidformat='$gidformat'
14886 gidsign='$gidsign'
14887 gidsize='$gidsize'
14888 gidtype='$gidtype'
14889 glibpth='$glibpth'
14890 grep='$grep'
14891 groupcat='$groupcat'
14892 groupstype='$groupstype'
14893 gzip='$gzip'
14894 h_fcntl='$h_fcntl'
14895 h_sysfile='$h_sysfile'
14896 hint='$hint'
14897 hostcat='$hostcat'
14898 huge='$huge'
14899 i16size='$i16size'
14900 i16type='$i16type'
14901 i32size='$i32size'
14902 i32type='$i32type'
14903 i64size='$i64size'
14904 i64type='$i64type'
14905 i8size='$i8size'
14906 i8type='$i8type'
14907 i_arpainet='$i_arpainet'
14908 i_bsdioctl='$i_bsdioctl'
14909 i_db='$i_db'
14910 i_dbm='$i_dbm'
14911 i_dirent='$i_dirent'
14912 i_dld='$i_dld'
14913 i_dlfcn='$i_dlfcn'
14914 i_fcntl='$i_fcntl'
14915 i_float='$i_float'
14916 i_gdbm='$i_gdbm'
14917 i_grp='$i_grp'
14918 i_iconv='$i_iconv'
14919 i_inttypes='$i_inttypes'
14920 i_limits='$i_limits'
14921 i_locale='$i_locale'
14922 i_machcthr='$i_machcthr'
14923 i_malloc='$i_malloc'
14924 i_math='$i_math'
14925 i_memory='$i_memory'
14926 i_mntent='$i_mntent'
14927 i_ndbm='$i_ndbm'
14928 i_netdb='$i_netdb'
14929 i_neterrno='$i_neterrno'
14930 i_netinettcp='$i_netinettcp'
14931 i_niin='$i_niin'
14932 i_poll='$i_poll'
14933 i_pthread='$i_pthread'
14934 i_pwd='$i_pwd'
14935 i_rpcsvcdbm='$i_rpcsvcdbm'
14936 i_sfio='$i_sfio'
14937 i_sgtty='$i_sgtty'
14938 i_shadow='$i_shadow'
14939 i_socks='$i_socks'
14940 i_stdarg='$i_stdarg'
14941 i_stddef='$i_stddef'
14942 i_stdlib='$i_stdlib'
14943 i_string='$i_string'
14944 i_sysaccess='$i_sysaccess'
14945 i_sysdir='$i_sysdir'
14946 i_sysfile='$i_sysfile'
14947 i_sysfilio='$i_sysfilio'
14948 i_sysin='$i_sysin'
14949 i_sysioctl='$i_sysioctl'
14950 i_syslog='$i_syslog'
14951 i_sysmman='$i_sysmman'
14952 i_sysmount='$i_sysmount'
14953 i_sysndir='$i_sysndir'
14954 i_sysparam='$i_sysparam'
14955 i_sysresrc='$i_sysresrc'
14956 i_syssecrt='$i_syssecrt'
14957 i_sysselct='$i_sysselct'
14958 i_syssockio='$i_syssockio'
14959 i_sysstat='$i_sysstat'
14960 i_sysstatfs='$i_sysstatfs'
14961 i_sysstatvfs='$i_sysstatvfs'
14962 i_systime='$i_systime'
14963 i_systimek='$i_systimek'
14964 i_systimes='$i_systimes'
14965 i_systypes='$i_systypes'
14966 i_sysuio='$i_sysuio'
14967 i_sysun='$i_sysun'
14968 i_sysutsname='$i_sysutsname'
14969 i_sysvfs='$i_sysvfs'
14970 i_syswait='$i_syswait'
14971 i_termio='$i_termio'
14972 i_termios='$i_termios'
14973 i_time='$i_time'
14974 i_unistd='$i_unistd'
14975 i_ustat='$i_ustat'
14976 i_utime='$i_utime'
14977 i_values='$i_values'
14978 i_varargs='$i_varargs'
14979 i_varhdr='$i_varhdr'
14980 i_vfork='$i_vfork'
14981 ignore_versioned_solibs='$ignore_versioned_solibs'
14982 inc_version_list='$inc_version_list'
14983 inc_version_list_init='$inc_version_list_init'
14984 incpath='$incpath'
14985 inews='$inews'
14986 installarchlib='$installarchlib'
14987 installbin='$installbin'
14988 installman1dir='$installman1dir'
14989 installman3dir='$installman3dir'
14990 installprefix='$installprefix'
14991 installprefixexp='$installprefixexp'
14992 installprivlib='$installprivlib'
14993 installscript='$installscript'
14994 installsitearch='$installsitearch'
14995 installsitebin='$installsitebin'
14996 installsitelib='$installsitelib'
14997 installstyle='$installstyle'
14998 installusrbinperl='$installusrbinperl'
14999 installvendorbin='$installvendorbin'
15000 installvendorlib='$installvendorlib'
15001 intsize='$intsize'
15002 ivdformat='$ivdformat'
15003 ivsize='$ivsize'
15004 ivtype='$ivtype'
15005 known_extensions='$known_extensions'
15006 ksh='$ksh'
15007 large='$large'
15008 ld='$ld'
15009 lddlflags='$lddlflags'
15010 ldflags='$ldflags'
15011 ldlibpthname='$ldlibpthname'
15012 less='$less'
15013 lib_ext='$lib_ext'
15014 libc='$libc'
15015 libperl='$libperl'
15016 libpth='$libpth'
15017 libs='$libs'
15018 libsdirs='$libsdirs'
15019 libsfiles='$libsfiles'
15020 libsfound='$libsfound'
15021 libswanted='$libswanted'
15022 line='$line'
15023 lint='$lint'
15024 lkflags='$lkflags'
15025 ln='$ln'
15026 lns='$lns'
15027 locincpth='$locincpth'
15028 loclibpth='$loclibpth'
15029 longdblsize='$longdblsize'
15030 longlongsize='$longlongsize'
15031 longsize='$longsize'
15032 lp='$lp'
15033 lpr='$lpr'
15034 ls='$ls'
15035 lseeksize='$lseeksize'
15036 lseektype='$lseektype'
15037 mail='$mail'
15038 mailx='$mailx'
15039 make='$make'
15040 make_set_make='$make_set_make'
15041 mallocobj='$mallocobj'
15042 mallocsrc='$mallocsrc'
15043 malloctype='$malloctype'
15044 man1dir='$man1dir'
15045 man1direxp='$man1direxp'
15046 man1ext='$man1ext'
15047 man3dir='$man3dir'
15048 man3direxp='$man3direxp'
15049 man3ext='$man3ext'
15050 medium='$medium'
15051 mips_type='$mips_type'
15052 mkdir='$mkdir'
15053 mmaptype='$mmaptype'
15054 models='$models'
15055 modetype='$modetype'
15056 more='$more'
15057 multiarch='$multiarch'
15058 mv='$mv'
15059 myarchname='$myarchname'
15060 mydomain='$mydomain'
15061 myhostname='$myhostname'
15062 myuname='$myuname'
15063 n='$n'
15064 netdb_hlen_type='$netdb_hlen_type'
15065 netdb_host_type='$netdb_host_type'
15066 netdb_name_type='$netdb_name_type'
15067 netdb_net_type='$netdb_net_type'
15068 nm='$nm'
15069 nm_opt='$nm_opt'
15070 nm_so_opt='$nm_so_opt'
15071 nonxs_ext='$nonxs_ext'
15072 nroff='$nroff'
15073 nvsize='$nvsize'
15074 nvtype='$nvtype'
15075 o_nonblock='$o_nonblock'
15076 obj_ext='$obj_ext'
15077 old_pthread_create_joinable='$old_pthread_create_joinable'
15078 optimize='$optimize'
15079 orderlib='$orderlib'
15080 osname='$osname'
15081 osvers='$osvers'
15082 package='$package'
15083 pager='$pager'
15084 passcat='$passcat'
15085 patchlevel='$patchlevel'
15086 path_sep='$path_sep'
15087 perl='$perl'
15088 perladmin='$perladmin'
15089 perlpath='$perlpath'
15090 pg='$pg'
15091 phostname='$phostname'
15092 pidtype='$pidtype'
15093 plibpth='$plibpth'
15094 pm_apiversion='$pm_apiversion'
15095 pmake='$pmake'
15096 pr='$pr'
15097 prefix='$prefix'
15098 prefixexp='$prefixexp'
15099 privlib='$privlib'
15100 privlibexp='$privlibexp'
15101 prototype='$prototype'
15102 ptrsize='$ptrsize'
15103 quadkind='$quadkind'
15104 quadtype='$quadtype'
15105 randbits='$randbits'
15106 randfunc='$randfunc'
15107 randseedtype='$randseedtype'
15108 ranlib='$ranlib'
15109 rd_nodata='$rd_nodata'
15110 rm='$rm'
15111 rmail='$rmail'
15112 runnm='$runnm'
15113 sPRIEldbl='$sPRIEldbl'
15114 sPRIFldbl='$sPRIFldbl'
15115 sPRIGldbl='$sPRIGldbl'
15116 sPRIX64='$sPRIX64'
15117 sPRId64='$sPRId64'
15118 sPRIeldbl='$sPRIeldbl'
15119 sPRIfldbl='$sPRIfldbl'
15120 sPRIgldbl='$sPRIgldbl'
15121 sPRIi64='$sPRIi64'
15122 sPRIo64='$sPRIo64'
15123 sPRIu64='$sPRIu64'
15124 sPRIx64='$sPRIx64'
15125 sched_yield='$sched_yield'
15126 scriptdir='$scriptdir'
15127 scriptdirexp='$scriptdirexp'
15128 sed='$sed'
15129 seedfunc='$seedfunc'
15130 selectminbits='$selectminbits'
15131 selecttype='$selecttype'
15132 sendmail='$sendmail'
15133 sh='$sh'
15134 shar='$shar'
15135 sharpbang='$sharpbang'
15136 shmattype='$shmattype'
15137 shortsize='$shortsize'
15138 shrpenv='$shrpenv'
15139 shsharp='$shsharp'
15140 sig_count='$sig_count'
15141 sig_name='$sig_name'
15142 sig_name_init='$sig_name_init'
15143 sig_num='$sig_num'
15144 sig_num_init='$sig_num_init'
15145 signal_t='$signal_t'
15146 sitearch='$sitearch'
15147 sitearchexp='$sitearchexp'
15148 sitebin='$sitebin'
15149 sitebinexp='$sitebinexp'
15150 sitelib='$sitelib'
15151 sitelibexp='$sitelibexp'
15152 siteprefix='$siteprefix'
15153 siteprefixexp='$siteprefixexp'
15154 sizetype='$sizetype'
15155 sleep='$sleep'
15156 smail='$smail'
15157 small='$small'
15158 so='$so'
15159 sockethdr='$sockethdr'
15160 socketlib='$socketlib'
15161 sort='$sort'
15162 spackage='$spackage'
15163 spitshell='$spitshell'
15164 split='$split'
15165 src='$src'
15166 ssizetype='$ssizetype'
15167 startperl='$startperl'
15168 startsh='$startsh'
15169 static_ext='$static_ext'
15170 stdchar='$stdchar'
15171 stdio_base='$stdio_base'
15172 stdio_bufsiz='$stdio_bufsiz'
15173 stdio_cnt='$stdio_cnt'
15174 stdio_filbuf='$stdio_filbuf'
15175 stdio_ptr='$stdio_ptr'
15176 stdio_stream_array='$stdio_stream_array'
15177 strings='$strings'
15178 submit='$submit'
15179 subversion='$subversion'
15180 sysman='$sysman'
15181 tail='$tail'
15182 tar='$tar'
15183 tbl='$tbl'
15184 tee='$tee'
15185 test='$test'
15186 timeincl='$timeincl'
15187 timetype='$timetype'
15188 touch='$touch'
15189 tr='$tr'
15190 trnl='$trnl'
15191 troff='$troff'
15192 u16size='$u16size'
15193 u16type='$u16type'
15194 u32size='$u32size'
15195 u32type='$u32type'
15196 u64size='$u64size'
15197 u64type='$u64type'
15198 u8size='$u8size'
15199 u8type='$u8type'
15200 uidformat='$uidformat'
15201 uidsign='$uidsign'
15202 uidsize='$uidsize'
15203 uidtype='$uidtype'
15204 uname='$uname'
15205 uniq='$uniq'
15206 uquadtype='$uquadtype'
15207 use5005threads='$use5005threads'
15208 use64bits='$use64bits'
15209 usedl='$usedl'
15210 useithreads='$useithreads'
15211 uselargefiles='$uselargefiles'
15212 uselongdouble='$uselongdouble'
15213 usemorebits='$usemorebits'
15214 usemultiplicity='$usemultiplicity'
15215 usemymalloc='$usemymalloc'
15216 usenm='$usenm'
15217 useopcode='$useopcode'
15218 useperlio='$useperlio'
15219 useposix='$useposix'
15220 usesfio='$usesfio'
15221 useshrplib='$useshrplib'
15222 usesocks='$usesocks'
15223 usethreads='$usethreads'
15224 usevendorprefix='$usevendorprefix'
15225 usevfork='$usevfork'
15226 usrinc='$usrinc'
15227 uuname='$uuname'
15228 uvoformat='$uvoformat'
15229 uvsize='$uvsize'
15230 uvtype='$uvtype'
15231 uvuformat='$uvuformat'
15232 uvxformat='$uvxformat'
15233 vendorbin='$vendorbin'
15234 vendorbinexp='$vendorbinexp'
15235 vendorlib='$vendorlib'
15236 vendorlibexp='$vendorlibexp'
15237 vendorprefix='$vendorprefix'
15238 vendorprefixexp='$vendorprefixexp'
15239 version='$version'
15240 vi='$vi'
15241 voidflags='$voidflags'
15242 xlibpth='$xlibpth'
15243 xs_apiversion='$xs_apiversion'
15244 zcat='$zcat'
15245 zip='$zip'
15246 EOT
15247
15248 : Add in command line options if available
15249 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15250
15251 : add special variables
15252 $test -f $src/patchlevel.h && \
15253 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15254 echo "CONFIGDOTSH=true" >>config.sh
15255
15256 : propagate old symbols
15257 if $test -f UU/config.sh; then
15258         <UU/config.sh sort | uniq >UU/oldconfig.sh
15259         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15260         sort | uniq -u >UU/oldsyms
15261         set X `cat UU/oldsyms`
15262         shift
15263         case $# in
15264         0) ;;
15265         *)
15266                 cat <<EOM
15267 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15268 EOM
15269                 echo "# Variables propagated from previous config.sh file." >>config.sh
15270                 for sym in `cat UU/oldsyms`; do
15271                         echo "    Propagating $hint variable "'$'"$sym..."
15272                         eval 'tmp="$'"${sym}"'"'
15273                         echo "$tmp" | \
15274                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15275                 done
15276                 ;;
15277         esac
15278 fi
15279
15280 : Finish up by extracting the .SH files
15281 case "$alldone" in
15282 exit)
15283         $rm -rf UU
15284         echo "Done."
15285         exit 0
15286         ;;
15287 cont)
15288         ;;
15289 '')
15290         dflt=''
15291         nostick=true
15292         $cat <<EOM
15293
15294 If you'd like to make any changes to the config.sh file before I begin
15295 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15296
15297 EOM
15298         rp="Press return or use a shell escape to edit config.sh:"
15299         . UU/myread
15300         nostick=''
15301         case "$ans" in
15302         '') ;;
15303         *) : in case they cannot read
15304                 sh 1>&4 -c "$ans";;
15305         esac
15306         ;;
15307 esac
15308
15309 : if this fails, just run all the .SH files by hand
15310 . ./config.sh
15311
15312 echo " "
15313 exec 1>&4
15314 . ./UU/extract
15315
15316 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15317         dflt=y
15318         case "$silent" in
15319         true) ;;
15320         *)
15321                 $cat <<EOM
15322
15323 Now you need to generate make dependencies by running "$make depend".
15324 You might prefer to run it in background: "$make depend > makedepend.out &"
15325 It can take a while, so you might not want to run it right now.
15326
15327 EOM
15328                 ;;
15329         esac
15330         rp="Run $make depend now?"
15331         . UU/myread
15332         case "$ans" in
15333         y*)
15334                 $make depend && echo "Now you must run a $make."
15335                 ;;
15336         *)
15337                 echo "You must run '$make depend' then '$make'."
15338                 ;;
15339         esac
15340 elif test -f [Mm]akefile; then
15341         echo " "
15342         echo "Now you must run a $make."
15343 else
15344         echo "Done."
15345 fi
15346
15347 if $test -f Policy.sh; then
15348     $cat <<EOM
15349
15350 If you compile $package on a different machine or from a different object
15351 directory, copy the Policy.sh file from this object directory to the
15352 new one before you run Configure -- this will help you with most of
15353 the policy defaults.
15354
15355 EOM
15356 fi
15357 if $test -f config.msg; then
15358     echo "Hmm.  I also noted the following information while running:"
15359     echo " "
15360     $cat config.msg >&4
15361     $rm -f config.msg
15362 fi
15363 $rm -f kit*isdone ark*isdone
15364 $rm -rf UU
15365
15366 : End of Configure
15367