s/d_nvpresuv/d_nv_preserves_uv/;
[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 Jan 26 09:59:39 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_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtold=''
533 d_strtoll=''
534 d_strtoul=''
535 d_strtoull=''
536 d_strtouq=''
537 d_strxfrm=''
538 d_symlink=''
539 d_syscall=''
540 d_sysconf=''
541 d_system=''
542 d_tcgetpgrp=''
543 d_tcsetpgrp=''
544 d_telldirproto=''
545 d_time=''
546 timetype=''
547 clocktype=''
548 d_times=''
549 d_truncate=''
550 d_tzname=''
551 d_umask=''
552 d_semctl_semid_ds=''
553 d_semctl_semun=''
554 d_union_semun=''
555 d_ustat=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 dlext=''
568 cccdlflags=''
569 ccdlflags=''
570 dlsrc=''
571 ld=''
572 lddlflags=''
573 usedl=''
574 doublesize=''
575 ebcdic=''
576 fflushNULL=''
577 fflushall=''
578 fpossize=''
579 fpostype=''
580 gidformat=''
581 gidsign=''
582 gidsize=''
583 gidtype=''
584 groupstype=''
585 h_fcntl=''
586 h_sysfile=''
587 i_arpainet=''
588 db_hashtype=''
589 db_prefixtype=''
590 i_db=''
591 i_dbm=''
592 i_rpcsvcdbm=''
593 d_dirnamlen=''
594 direntrytype=''
595 i_dirent=''
596 i_dld=''
597 i_dlfcn=''
598 i_fcntl=''
599 i_float=''
600 i_gdbm=''
601 d_grpasswd=''
602 i_grp=''
603 i_inttypes=''
604 i_limits=''
605 i_locale=''
606 i_machcthr=''
607 i_malloc=''
608 i_math=''
609 i_memory=''
610 i_mntent=''
611 i_ndbm=''
612 i_netdb=''
613 i_neterrno=''
614 i_netinettcp=''
615 i_niin=''
616 i_sysin=''
617 i_poll=''
618 i_pthread=''
619 d_pwage=''
620 d_pwchange=''
621 d_pwclass=''
622 d_pwcomment=''
623 d_pwexpire=''
624 d_pwgecos=''
625 d_pwpasswd=''
626 d_pwquota=''
627 i_pwd=''
628 i_sfio=''
629 i_shadow=''
630 i_socks=''
631 i_stddef=''
632 i_stdlib=''
633 i_string=''
634 strings=''
635 i_sysaccess=''
636 i_sysdir=''
637 i_sysfile=''
638 d_voidtty=''
639 i_bsdioctl=''
640 i_sysfilio=''
641 i_sysioctl=''
642 i_syssockio=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatfs=''
651 i_sysstatvfs=''
652 i_systimes=''
653 i_systypes=''
654 i_sysuio=''
655 i_sysun=''
656 i_sysvfs=''
657 i_syswait=''
658 i_sgtty=''
659 i_termio=''
660 i_termios=''
661 i_systime=''
662 i_systimek=''
663 i_time=''
664 timeincl=''
665 i_unistd=''
666 i_ustat=''
667 i_utime=''
668 i_values=''
669 i_stdarg=''
670 i_varargs=''
671 i_varhdr=''
672 i_vfork=''
673 inc_version_list=''
674 inc_version_list_init=''
675 installprefix=''
676 installprefixexp=''
677 installstyle=''
678 installusrbinperl=''
679 intsize=''
680 longsize=''
681 shortsize=''
682 d_fpos64_t=''
683 d_off64_t=''
684 libc=''
685 ldlibpthname=''
686 libperl=''
687 shrpenv=''
688 useshrplib=''
689 glibpth=''
690 libpth=''
691 loclibpth=''
692 plibpth=''
693 xlibpth=''
694 ignore_versioned_solibs=''
695 libs=''
696 lns=''
697 d_PRIEldbl=''
698 d_PRIFldbl=''
699 d_PRIGldbl=''
700 d_PRIeldbl=''
701 d_PRIfldbl=''
702 d_PRIgldbl=''
703 sPRIEldbl=''
704 sPRIFldbl=''
705 sPRIGldbl=''
706 sPRIeldbl=''
707 sPRIfldbl=''
708 sPRIgldbl=''
709 lseeksize=''
710 lseektype=''
711 make_set_make=''
712 d_mymalloc=''
713 freetype=''
714 mallocobj=''
715 mallocsrc=''
716 malloctype=''
717 usemymalloc=''
718 installman1dir=''
719 man1dir=''
720 man1direxp=''
721 man1ext=''
722 installman3dir=''
723 man3dir=''
724 man3direxp=''
725 man3ext=''
726 huge=''
727 large=''
728 medium=''
729 models=''
730 small=''
731 split=''
732 modetype=''
733 multiarch=''
734 mydomain=''
735 myhostname=''
736 phostname=''
737 c=''
738 n=''
739 d_eofnblk=''
740 eagain=''
741 o_nonblock=''
742 rd_nodata=''
743 netdb_hlen_type=''
744 netdb_host_type=''
745 netdb_name_type=''
746 netdb_net_type=''
747 groupcat=''
748 hostcat=''
749 passcat=''
750 orderlib=''
751 ranlib=''
752 package=''
753 spackage=''
754 pager=''
755 api_revision=''
756 api_subversion=''
757 api_version=''
758 api_versionstring=''
759 patchlevel=''
760 subversion=''
761 version=''
762 perladmin=''
763 perlpath=''
764 d_nv_preserves_uv=''
765 i16size=''
766 i16type=''
767 i32size=''
768 i32type=''
769 i64size=''
770 i64type=''
771 i8size=''
772 i8type=''
773 ivsize=''
774 ivtype=''
775 nvsize=''
776 nvtype=''
777 u16size=''
778 u16type=''
779 u32size=''
780 u32type=''
781 u64size=''
782 u64type=''
783 u8size=''
784 u8type=''
785 uvsize=''
786 uvtype=''
787 ivdformat=''
788 uvoformat=''
789 uvuformat=''
790 uvxformat=''
791 pidtype=''
792 prefix=''
793 prefixexp=''
794 installprivlib=''
795 privlib=''
796 privlibexp=''
797 prototype=''
798 ptrsize=''
799 d_PRIX64=''
800 d_PRId64=''
801 d_PRIi64=''
802 d_PRIo64=''
803 d_PRIu64=''
804 d_PRIx64=''
805 sPRIX64=''
806 sPRId64=''
807 sPRIi64=''
808 sPRIo64=''
809 sPRIu64=''
810 sPRIx64=''
811 d_quad=''
812 quadkind=''
813 quadtype=''
814 uquadtype=''
815 drand01=''
816 randbits=''
817 randfunc=''
818 randseedtype=''
819 seedfunc=''
820 installscript=''
821 scriptdir=''
822 scriptdirexp=''
823 selectminbits=''
824 selecttype=''
825 sh=''
826 sig_count=''
827 sig_name=''
828 sig_name_init=''
829 sig_num=''
830 sig_num_init=''
831 installsitearch=''
832 sitearch=''
833 sitearchexp=''
834 installsitebin=''
835 sitebin=''
836 sitebinexp=''
837 installsitelib=''
838 sitelib=''
839 sitelibexp=''
840 siteprefix=''
841 siteprefixexp=''
842 sizetype=''
843 so=''
844 sharpbang=''
845 shsharp=''
846 spitshell=''
847 src=''
848 ssizetype=''
849 startperl=''
850 startsh=''
851 stdchar=''
852 d_stdio_stream_array=''
853 stdio_stream_array=''
854 sysman=''
855 trnl=''
856 uidformat=''
857 uidsign=''
858 uidsize=''
859 uidtype=''
860 archname64=''
861 use64bits=''
862 uselargefiles=''
863 uselongdouble=''
864 uselonglong=''
865 usemorebits=''
866 usemultiplicity=''
867 nm_opt=''
868 nm_so_opt=''
869 runnm=''
870 usenm=''
871 useperlio=''
872 usesocks=''
873 d_oldpthreads=''
874 use5005threads=''
875 useithreads=''
876 usethreads=''
877 incpath=''
878 mips_type=''
879 usrinc=''
880 d_vendorbin=''
881 installvendorbin=''
882 vendorbin=''
883 vendorbinexp=''
884 d_vendorlib=''
885 installvendorlib=''
886 vendorlib=''
887 vendorlibexp=''
888 usevendorprefix=''
889 vendorprefix=''
890 vendorprefixexp=''
891 defvoidused=''
892 voidflags=''
893 CONFIG=''
894
895 define='define'
896 undef='undef'
897 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
898 rmlist=''
899
900 : We must find out about Eunice early
901 eunicefix=':'
902 if test -f /etc/unixtovms; then
903         eunicefix=/etc/unixtovms
904 fi
905 if test -f /etc/unixtovms.exe; then
906         eunicefix=/etc/unixtovms.exe
907 fi
908
909 i_whoami=''
910 : list of known cpp symbols, sorted alphabetically
911 al="386BSD 3b1 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370"
912 al="$al AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE"
913 al="$al alliant alpha am29000 AM29000 amiga AMIGAOS AMIX"
914 al="$al ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS"
915 al="$al BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4"
916 al="$al BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi"
917 al="$al bull c cadmus clipper CMU COFF COMPILER_VERSION"
918 al="$al concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX"
919 al="$al CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO"
920 al="$al Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS"
921 al="$al FreeBSD GCC_NEW_VARARGS gcos gcx gimpel"
922 al="$al GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN"
923 al="$al H3050R H3050RX hbullx20 hcx host_mips"
924 al="$al hp200 hp300 hp700 HP700 hp800 hp9000"
925 al="$al hp9000s200 hp9000s300 hp9000s400 hp9000s500"
926 al="$al hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE"
927 al="$al i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960"
928 al="$al iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64"
929 al="$al INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1"
930 al="$al LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE"
931 al="$al LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE"
932 al="$al Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG"
933 al="$al LONGDOUBLE LONGLONG LP64 luna luna88k Lynx"
934 al="$al M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF"
935 al="$al M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3"
936 al="$al M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen"
937 al="$al MATH_HAS_NO_SIDE_EFFECTS"
938 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040"
939 al="$al mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin"
940 al="$al mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT"
941 al="$al MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola"
942 al="$al mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr"
943 al="$al NetBSD news1500 news1700 news1800 news1900 news3700"
944 al="$al news700 news800 news900 NeXT NLS ns16000 ns32000"
945 al="$al ns32016 ns32332 ns32k nsc32000"
946 al="$al OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE"
947 al="$al pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc"
948 al="$al pc532 pdp11 PGC PIC plexus PORTAR posix"
949 al="$al POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE"
950 al="$al POSIX_C_SOURCE POSIX_SOURCE POWER"
951 al="$al PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000"
952 al="$al riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix"
953 al="$al SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE"
954 al="$al sony sony_news sonyrisc sparc sparclite spectrum"
955 al="$al stardent stdc STDC_EXT stratos sun sun3 sun386"
956 al="$al Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5"
957 al="$al SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44"
958 al="$al SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5"
959 al="$al sysV68 sysV88 Tek4132 Tek4300 titan"
960 al="$al tower tower32 tower32_200 tower32_600 tower32_700"
961 al="$al tower32_800 tower32_850 tss"
962 al="$al u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5"
963 al="$al ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK"
964 al="$al unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2"
965 al="$al Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286"
966 al="$al XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED"
967 al="$al XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED"
968 al="$al z8000"
969
970 : set useposix=false in your hint file to disable the POSIX extension.
971 useposix=true
972 : set useopcode=false in your hint file to disable the Opcode extension.
973 useopcode=true
974 : Trailing extension.  Override this in a hint file, if needed.
975 _exe=''
976 : Extra object files, if any, needed on this platform.
977 archobjs=''
978 : Possible local include directories to search.
979 : Set locincpth to "" in a hint file to defeat local include searches.
980 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
981 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
982 :
983 : no include file wanted by default
984 inclwanted=''
985
986 groupstype=''
987 : change the next line if compiling for Xenix/286 on Xenix/386
988 xlibpth='/usr/lib/386 /lib/386'
989
990 : Possible local library directories to search.
991 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
992 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
993
994 : general looking path for locating libraries
995 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
996 glibpth="$glibpth /lib /usr/lib $xlibpth"
997 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
998 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
999
1000 : Private path used by Configure to find libraries.  Its value
1001 : is prepended to libpth. This variable takes care of special
1002 : machines, like the mips.  Usually, it should be empty.
1003 plibpth=''
1004
1005 : default library list
1006 libswanted=''
1007 : some systems want to use only the non-versioned libso:s
1008 ignore_versioned_solibs=''
1009 : set usemultiplicity on the Configure command line to enable multiplicity.
1010 : set usesocks on the Configure command line to enable socks.
1011 : set usethreads on the Configure command line to enable threads.
1012 : full support for void wanted by default
1013 defvoidused=15
1014
1015 : List of libraries we want.
1016 : If anyone needs -lnet, put it in a hint file.
1017 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1018 libswanted="$libswanted dld ld sun m c cposix posix"
1019 libswanted="$libswanted ndir dir crypt sec"
1020 libswanted="$libswanted ucb bsd BSD PW x"
1021 : We probably want to search /usr/shlib before most other libraries.
1022 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1023 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1024 glibpth="/usr/shlib $glibpth"
1025 : Do not use vfork unless overridden by a hint file.
1026 usevfork=false
1027
1028 : Find the basic shell for Bourne shell scripts
1029 case "$sh" in
1030 '')
1031         case "$SYSTYPE" in
1032         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1033         *) xxx='/bin/sh';;
1034         esac
1035         if test -f "$xxx"; then
1036                 sh="$xxx"
1037         else
1038                 : Build up a list and do a single loop so we can 'break' out.
1039                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1040                 for xxx in sh bash ksh pdksh ash; do
1041                         for p in $pth; do
1042                                 try="$try ${p}/${xxx}"
1043                         done
1044                 done
1045                 for xxx in $try; do
1046                         if test -f "$xxx"; then
1047                                 sh="$xxx";
1048                                 break
1049                         elif test -f "$xxx.exe"; then
1050                                 sh="$xxx";
1051                                 break
1052                         fi
1053                 done
1054         fi
1055         ;;
1056 esac
1057
1058 case "$sh" in
1059 '')     cat <<EOM >&2
1060 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1061
1062 Usually it's in /bin/sh.  How did you even get this far?
1063 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1064 we'll try to straighten this all out.
1065 EOM
1066         exit 1
1067         ;;
1068 esac
1069
1070 : see if sh knows # comments
1071 if `$sh -c '#' >/dev/null 2>&1`; then
1072         shsharp=true
1073         spitshell=cat
1074         xcat=/bin/cat
1075         test -f $xcat || xcat=/usr/bin/cat
1076         echo "#!$xcat" >try
1077         $eunicefix try
1078         chmod +x try
1079         ./try > today
1080         if test -s today; then
1081                 sharpbang='#!'
1082         else
1083                 echo "#! $xcat" > try
1084                 $eunicefix try
1085                 chmod +x try
1086                 ./try > today
1087                 if test -s today; then
1088                         sharpbang='#! '
1089                 else
1090                         sharpbang=': use '
1091                 fi
1092         fi
1093 else
1094         echo " "
1095         echo "Your $sh doesn't grok # comments--I will strip them later on."
1096         shsharp=false
1097         cd ..
1098         echo "exec grep -v '^[  ]*#'" >spitshell
1099         chmod +x spitshell
1100         $eunicefix spitshell
1101         spitshell=`pwd`/spitshell
1102         cd UU
1103         echo "I presume that if # doesn't work, #! won't work either!"
1104         sharpbang=': use '
1105 fi
1106 rm -f try today
1107
1108 : figure out how to guarantee sh startup
1109 case "$startsh" in
1110 '') startsh=${sharpbang}${sh} ;;
1111 *)
1112 esac
1113 cat >try <<EOSS
1114 $startsh
1115 set abc
1116 test "$?abc" != 1
1117 EOSS
1118
1119 chmod +x try
1120 $eunicefix try
1121 if ./try; then
1122         : echo "Yup, it does."
1123 else
1124         echo "Hmm... '$startsh' does not guarantee sh startup..."
1125         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1126 fi
1127 rm -f try
1128
1129
1130 : Save command line options in file UU/cmdline.opt for later use in
1131 : generating config.sh.
1132 cat > cmdline.opt <<EOSH
1133 # Configure command line arguments.
1134 config_arg0='$0'
1135 config_args='$*'
1136 config_argc=$#
1137 EOSH
1138 argn=1
1139 for arg in "$@"; do
1140         cat >>cmdline.opt <<EOSH
1141 config_arg$argn='$arg'
1142 EOSH
1143         argn=`expr $argn + 1`
1144 done
1145
1146 : produce awk script to parse command line options
1147 cat >options.awk <<'EOF'
1148 BEGIN {
1149         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1150
1151         len = length(optstr);
1152         for (i = 1; i <= len; i++) {
1153                 c = substr(optstr, i, 1);
1154                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1155                 if (a == ":") {
1156                         arg[c] = 1;
1157                         i++;
1158                 }
1159                 opt[c] = 1;
1160         }
1161 }
1162 {
1163         expect = 0;
1164         str = $0;
1165         if (substr(str, 1, 1) != "-") {
1166                 printf("'%s'\n", str);
1167                 next;
1168         }
1169         len = length($0);
1170         for (i = 2; i <= len; i++) {
1171                 c = substr(str, i, 1);
1172                 if (!opt[c]) {
1173                         printf("-%s\n", substr(str, i));
1174                         next;
1175                 }
1176                 printf("-%s\n", c);
1177                 if (arg[c]) {
1178                         if (i < len)
1179                                 printf("'%s'\n", substr(str, i + 1));
1180                         else
1181                                 expect = 1;
1182                         next;
1183                 }
1184         }
1185 }
1186 END {
1187         if (expect)
1188                 print "?";
1189 }
1190 EOF
1191
1192 : process the command line options
1193 set X `for arg in "$@"; do echo "X$arg"; done |
1194         sed -e s/X// | awk -f options.awk`
1195 eval "set $*"
1196 shift
1197 rm -f options.awk
1198
1199 : set up default values
1200 fastread=''
1201 reuseval=false
1202 config_sh=''
1203 alldone=''
1204 error=''
1205 silent=''
1206 extractsh=''
1207 override=''
1208 knowitall=''
1209 rm -f optdef.sh posthint.sh
1210 cat >optdef.sh <<EOS
1211 $startsh
1212 EOS
1213
1214
1215 : option parsing
1216 while test $# -gt 0; do
1217         case "$1" in
1218         -d) shift; fastread=yes;;
1219         -e) shift; alldone=cont;;
1220         -f)
1221                 shift
1222                 cd ..
1223                 if test -r "$1"; then
1224                         config_sh="$1"
1225                 else
1226                         echo "$me: cannot read config file $1." >&2
1227                         error=true
1228                 fi
1229                 cd UU
1230                 shift;;
1231         -h) shift; error=true;;
1232         -r) shift; reuseval=true;;
1233         -s) shift; silent=true; realsilent=true;;
1234         -E) shift; alldone=exit;;
1235         -K) shift; knowitall=true;;
1236         -O) shift; override=true;;
1237         -S) shift; silent=true; extractsh=true;;
1238         -D)
1239                 shift
1240                 case "$1" in
1241                 *=)
1242                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1243                         echo "$me: ignoring -D $1" >&2
1244                         ;;
1245                 *=*) echo "$1" | \
1246                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1247                 *) echo "$1='define'" >> optdef.sh;;
1248                 esac
1249                 shift
1250                 ;;
1251         -U)
1252                 shift
1253                 case "$1" in
1254                 *=) echo "$1" >> optdef.sh;;
1255                 *=*)
1256                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1257                         echo "$me: ignoring -U $1" >&2
1258                         ;;
1259                 *) echo "$1='undef'" >> optdef.sh;;
1260                 esac
1261                 shift
1262                 ;;
1263         -A)
1264             shift
1265             xxx=''
1266             yyy="$1"
1267             zzz=''
1268             uuu=undef
1269             case "$yyy" in
1270             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1271                  case "$zzz" in
1272                  *:*) zzz='' ;;
1273                  *)   xxx=append
1274                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1275                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1276                  esac
1277                  ;;
1278             esac
1279             case "$xxx" in
1280             '')  case "$yyy" in
1281                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1282                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1283                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1284                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1285                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1286                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1287                  esac
1288                  ;;       
1289             esac
1290             case "$xxx" in
1291             append)
1292                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1293             clear)
1294                 echo "$yyy=''"                  >> posthint.sh ;;
1295             define)
1296                 case "$zzz" in
1297                 '') zzz=define ;;
1298                 esac
1299                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1300             eval)
1301                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1302             prepend)
1303                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1304             undef)
1305                 case "$zzz" in
1306                 '') zzz="$uuu" ;;
1307                 esac
1308                 echo "$yyy=$zzz"                >> posthint.sh ;;
1309             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1310             esac
1311             ;;
1312         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1313             exit 0;;
1314         --) break;;
1315         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1316         *) break;;
1317         esac
1318 done
1319
1320 case "$error" in
1321 true)
1322         cat >&2 <<EOM
1323 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1324                  [-U symbol] [-U symbol=] [-A command:symbol...]
1325   -d : use defaults for all answers.
1326   -e : go on without questioning past the production of config.sh.
1327   -f : specify an alternate default configuration file.
1328   -h : print this help message and exit (with an error status).
1329   -r : reuse C symbols value if possible (skips costly nm extraction).
1330   -s : silent mode, only echoes questions and essential information.
1331   -D : define symbol to have some value:
1332          -D symbol         symbol gets the value 'define'
1333          -D symbol=value   symbol gets the value 'value'
1334   -E : stop at the end of questions, after having produced config.sh.
1335   -K : do not use unless you know what you are doing.
1336   -O : let -D and -U override definitions from loaded configuration file.
1337   -S : perform variable substitutions on all .SH files (can mix with -f)
1338   -U : undefine symbol:
1339          -U symbol    symbol gets the value 'undef'
1340          -U symbol=   symbol gets completely empty
1341   -A : manipulate symbol after the platform specific hints have been applied:
1342          -A symbol=value                append " "value to symbol
1343          -A append:symbol=value         append value to symbol
1344          -A define:symbol=value         define symbol to have value
1345          -A clear:symbol                define symbol to be ''
1346          -A define:symbol               define symbol to be 'define'
1347          -A eval:symbol=value           define symbol to be eval of value
1348          -A prepend:symbol=value        prepend value to symbol
1349          -A undef:symbol                define symbol to be 'undef'
1350          -A undef:symbol=               define symbol to be ''
1351   -V : print version number and exit (with a zero status).
1352 EOM
1353         exit 1
1354         ;;
1355 esac
1356
1357 : Sanity checks
1358 case "$fastread$alldone" in
1359 yescont|yesexit) ;;
1360 *)
1361         if test ! -t 0; then
1362                 echo "Say 'sh Configure', not 'sh <Configure'"
1363                 exit 1
1364         fi
1365         ;;
1366 esac
1367
1368 exec 4>&1
1369 case "$silent" in
1370 true) exec 1>/dev/null;;
1371 esac
1372
1373 : run the defines and the undefines, if any, but leave the file out there...
1374 touch optdef.sh
1375 . ./optdef.sh
1376 : create the posthint manipulation script and leave the file out there...
1377 touch posthint.sh
1378
1379 : set package name
1380 package=perl5
1381 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1382 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1383 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1384 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1385 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1386 esac
1387
1388 : Some greps do not return status, grrr.
1389 echo "grimblepritz" >grimble
1390 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1391         contains=contains
1392 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1393         contains=grep
1394 else
1395         contains=contains
1396 fi
1397 rm -f grimble
1398 : the following should work in any shell
1399 case "$contains" in
1400 contains*)
1401         echo " "
1402         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1403         cat >contains <<'EOSS'
1404 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1405 EOSS
1406 chmod +x contains
1407 esac
1408
1409 : Find the path to the source tree
1410 case "$src" in
1411 '') case "$0" in
1412     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1413          case "$src" in
1414          /*)    ;;
1415          *)     src=`cd ../$src && pwd` ;;
1416          esac
1417          ;;
1418     *)   src='.';;
1419     esac;;
1420 esac
1421 case "$src" in
1422 '')     src=/
1423         rsrc=/
1424         ;;
1425 /*) rsrc="$src";;
1426 *) rsrc="../$src";;
1427 esac
1428 if test -f $rsrc/Configure && \
1429         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1430 then
1431    : found it, so we are ok.
1432 else
1433         rsrc=''
1434         for src in . .. ../.. ../../.. ../../../..; do
1435                 if test -f ../$src/Configure && \
1436                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1437                 then
1438                         rsrc=../$src
1439                         break
1440                 fi
1441         done
1442 fi
1443 case "$rsrc" in
1444 '')
1445         cat <<EOM >&4
1446
1447 Sorry, I can't seem to locate the source dir for $package.  Please start
1448 Configure with an explicit path -- i.e. /some/path/Configure.
1449
1450 EOM
1451         exit 1
1452         ;;
1453 ../.)   rsrc='..';;
1454 *)
1455         echo " "
1456         echo "Sources for $package found in \"$src\"." >&4
1457         ;;
1458 esac
1459
1460 : script used to extract .SH files with variable substitutions
1461 cat >extract <<'EOS'
1462 CONFIGDOTSH=true
1463 echo "Doing variable substitutions on .SH files..."
1464 if test -f $src/MANIFEST; then
1465         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1466 else
1467         echo "(Looking for .SH files under the source directory.)"
1468         set x `(cd $src; find . -name "*.SH" -print)`
1469 fi
1470 shift
1471 case $# in
1472 0) set x `(cd $src; echo *.SH)`; shift;;
1473 esac
1474 if test ! -f $src/$1; then
1475         shift
1476 fi
1477 mkdir_p='
1478 name=$1;
1479 create="";
1480 while test $name; do
1481         if test ! -d "$name"; then
1482                 create="$name $create";
1483                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1484                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1485         else
1486                 name="";
1487         fi;
1488 done;
1489 for file in $create; do
1490         mkdir $file;
1491 done
1492 '
1493 for file in $*; do
1494         case "$src" in
1495         ".")
1496                 case "$file" in
1497                 */*)
1498                         dir=`expr X$file : 'X\(.*\)/'`
1499                         file=`expr X$file : 'X.*/\(.*\)'`
1500                         (cd $dir && . ./$file)
1501                         ;;
1502                 *)
1503                         . ./$file
1504                         ;;
1505                 esac
1506                 ;;
1507         *)
1508                 case "$file" in
1509                 */*)
1510                         dir=`expr X$file : 'X\(.*\)/'`
1511                         file=`expr X$file : 'X.*/\(.*\)'`
1512                         (set x $dir; shift; eval $mkdir_p)
1513                         sh <$src/$dir/$file
1514                         ;;
1515                 *)
1516                         sh <$src/$file
1517                         ;;
1518                 esac
1519                 ;;
1520         esac
1521 done
1522 if test -f $src/config_h.SH; then
1523         if test ! -f config.h; then
1524         : oops, they left it out of MANIFEST, probably, so do it anyway.
1525         . $src/config_h.SH
1526         fi
1527 fi
1528 EOS
1529
1530 : extract files and exit if asked to do so
1531 case "$extractsh" in
1532 true)
1533         case "$realsilent" in
1534         true) ;;
1535         *) exec 1>&4;;
1536         esac
1537         case "$config_sh" in
1538         '') config_sh='config.sh';;
1539         esac
1540         echo " "
1541         echo "Fetching answers from $config_sh..."
1542         cd ..
1543         . $config_sh
1544         test "$override" && . ./optdef.sh
1545         echo " "
1546         . UU/extract
1547         rm -rf UU
1548         echo "Done."
1549         exit 0
1550         ;;
1551 esac
1552
1553 : Eunice requires " " instead of "", can you believe it
1554 echo " "
1555 : Here we go...
1556 echo "Beginning of configuration questions for $package."
1557
1558 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1559
1560 : first determine how to suppress newline on echo command
1561 echo " "
1562 echo "Checking echo to see how to suppress newlines..."
1563 (echo "hi there\c" ; echo " ") >.echotmp
1564 if $contains c .echotmp >/dev/null 2>&1 ; then
1565         echo "...using -n."
1566         n='-n'
1567         c=''
1568 else
1569         cat <<'EOM'
1570 ...using \c
1571 EOM
1572         n=''
1573         c='\c'
1574 fi
1575 echo $n "The star should be here-->$c"
1576 echo '*'
1577 rm -f .echotmp
1578
1579 : Now test for existence of everything in MANIFEST
1580 echo " "
1581 if test -f $rsrc/MANIFEST; then
1582         echo "First let's make sure your kit is complete.  Checking..." >&4
1583         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1584         rm -f missing
1585         tmppwd=`pwd`
1586         for filelist in x??; do
1587                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1588         done
1589         if test -s missing; then
1590                 cat missing >&4
1591                 cat >&4 <<'EOM'
1592
1593 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1594
1595 You have the option of continuing the configuration process, despite the
1596 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1597 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1598 and contact the author (perlbug@perl.com).
1599
1600 EOM
1601                 echo $n "Continue? [n] $c" >&4
1602                 read ans
1603                 case "$ans" in
1604                 y*)
1605                         echo "Continuing..." >&4
1606                         rm -f missing
1607                         ;;
1608                 *)
1609                         echo "ABORTING..." >&4
1610                         kill $$
1611                         ;;
1612                 esac
1613         else
1614                 echo "Looks good..."
1615         fi
1616 else
1617         echo "There is no MANIFEST file.  I hope your kit is complete !"
1618 fi
1619 rm -f missing x??
1620
1621 echo " "
1622 : Find the appropriate value for a newline for tr
1623 if test -n "$DJGPP"; then
1624        trnl='\012'
1625 fi
1626 if test X"$trnl" = X; then
1627         case "`echo foo|tr '\n' x 2>/dev/null`" in
1628         foox) trnl='\n' ;;
1629         esac
1630 fi
1631 if test X"$trnl" = X; then
1632         case "`echo foo|tr '\012' x 2>/dev/null`" in
1633         foox) trnl='\012' ;;
1634         esac
1635 fi
1636 if test X"$trnl" = X; then
1637         cat <<EOM >&2
1638
1639 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1640
1641 EOM
1642         exit 1
1643 fi
1644
1645 : compute the number of columns on the terminal for proper question formatting
1646 case "$COLUMNS" in
1647 '') COLUMNS='80';;
1648 esac
1649
1650 : set up the echo used in my read
1651 myecho="case \"\$xxxm\" in
1652 '') echo $n \"\$rp $c\" >&4;;
1653 *) case \"\$rp\" in
1654         '') echo $n \"[\$xxxm] $c\";;
1655         *)
1656                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1657                         echo \"\$rp\" >&4
1658                         echo $n \"[\$xxxm] $c\" >&4
1659                 else
1660                         echo $n \"\$rp [\$xxxm] $c\" >&4
1661                 fi
1662                 ;;
1663         esac;;
1664 esac"
1665
1666 : now set up to do reads with possible shell escape and default assignment
1667 cat <<EOSC >myread
1668 $startsh
1669 xxxm=\$dflt
1670 $myecho
1671 ans='!'
1672 case "\$fastread" in
1673 yes) case "\$dflt" in
1674         '') ;;
1675         *) ans='';
1676                 case "\$silent-\$rp" in
1677                 true-) ;;
1678                 *) echo " " >&4;;
1679                 esac;;
1680         esac;;
1681 *) case "\$silent" in
1682         true) case "\$rp" in
1683                 '') ans='';;
1684                 esac;;
1685         esac;;
1686 esac
1687 while expr "X\$ans" : "X!" >/dev/null; do
1688         read answ
1689         set x \$xxxm
1690         shift
1691         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1692         case  "\$answ" in
1693         "!")
1694                 sh 1>&4
1695                 echo " "
1696                 $myecho
1697                 ;;
1698         !*)
1699                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1700                 shift
1701                 sh 1>&4 -c "\$*"
1702                 echo " "
1703                 $myecho
1704                 ;;
1705         "\$ans")
1706                 case "\$ans" in
1707                 \\&*)
1708                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1709                         shift
1710                         case "\$1" in
1711                         -d)
1712                                 fastread=yes
1713                                 echo "(OK, I'll run with -d after this question.)" >&4
1714                                 ;;
1715                         -*)
1716                                 echo "*** Sorry, \$1 not supported yet." >&4
1717                                 ;;
1718                         esac
1719                         $myecho
1720                         ans=!
1721                         ;;
1722                 esac;;
1723         *)
1724                 case "\$aok" in
1725                 y)
1726                         echo "*** Substitution done -- please confirm."
1727                         xxxm="\$ans"
1728                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1729                         xxxm="\$ans"
1730                         ans=!
1731                         ;;
1732                 *)
1733                         echo "*** Error -- try again."
1734                         ans=!
1735                         ;;
1736                 esac
1737                 $myecho
1738                 ;;
1739         esac
1740         case "\$ans\$xxxm\$nostick" in
1741         '')
1742                 ans=!
1743                 $myecho
1744                 ;;
1745         esac
1746 done
1747 case "\$ans" in
1748 '') ans="\$xxxm";;
1749 esac
1750 EOSC
1751
1752 : create .config dir to save info across Configure sessions
1753 test -d ../.config || mkdir ../.config
1754 cat >../.config/README <<EOF
1755 This directory created by Configure to save information that should
1756 persist across sessions for $package.
1757
1758 You may safely delete it if you wish.
1759 EOF
1760
1761 : general instructions
1762 needman=true
1763 firsttime=true
1764 user=`(logname) 2>/dev/null`
1765 case "$user" in
1766 '') user=`whoami 2>&1`;;
1767 esac
1768 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1769         firsttime=false
1770         echo " "
1771         rp='Would you like to see the instructions?'
1772         dflt=n
1773         . ./myread
1774         case "$ans" in
1775         [yY]*) ;;
1776         *) needman=false;;
1777         esac
1778 fi
1779 if $needman; then
1780         cat <<EOH
1781
1782 This installation shell script will examine your system and ask you questions
1783 to determine how the perl5 package should be installed. If you get
1784 stuck on a question, you may use a ! shell escape to start a subshell or
1785 execute a command.  Many of the questions will have default answers in square
1786 brackets; typing carriage return will give you the default.
1787
1788 On some of the questions which ask for file or directory names you are allowed
1789 to use the ~name construct to specify the login directory belonging to "name",
1790 even if you don't have a shell which knows about that.  Questions where this is
1791 allowed will be marked "(~name ok)".
1792
1793 EOH
1794         rp=''
1795         dflt='Type carriage return to continue'
1796         . ./myread
1797         cat <<'EOH'
1798
1799 The prompter used in this script allows you to use shell variables and
1800 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1801 in the default answer, as if the default line was a set of arguments given to a
1802 script shell.  This means you may also use $* to repeat the whole default line,
1803 so you do not have to re-type everything to add something to the default.
1804
1805 Everytime there is a substitution, you will have to confirm.  If there is an
1806 error (e.g. an unmatched backtick), the default answer will remain unchanged
1807 and you will be prompted again.
1808
1809 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1810 the questions and use the computed defaults (or the previous answers if there
1811 was already a config.sh file). Type 'Configure -h' for a list of options.
1812 You may also start interactively and then answer '& -d' at any prompt to turn
1813 on the non-interactive behaviour for the remainder of the execution.
1814
1815 EOH
1816         . ./myread
1817         cat <<EOH
1818
1819 Much effort has been expended to ensure that this shell script will run on any
1820 Unix system.  If despite that it blows up on yours, your best bet is to edit
1821 Configure and run it again.  If you can't run Configure for some reason,
1822 you'll have to generate a config.sh file by hand.  Whatever problems you
1823 have, let me (perlbug@perl.com) know how I blew it.
1824
1825 This installation script affects things in two ways:
1826
1827 1) it may do direct variable substitutions on some of the files included
1828    in this kit.
1829 2) it builds a config.h file for inclusion in C programs.  You may edit
1830    any of these files as the need arises after running this script.
1831
1832 If you make a mistake on a question, there is no easy way to back up to it
1833 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1834 files.  Configure will offer to let you do this before it runs the SH files.
1835
1836 EOH
1837         dflt='Type carriage return to continue'
1838         . ./myread
1839         case "$firsttime" in
1840         true) echo $user >>../.config/instruct;;
1841         esac
1842 fi
1843
1844 : find out where common programs are
1845 echo " "
1846 echo "Locating common programs..." >&4
1847 cat <<EOSC >loc
1848 $startsh
1849 case \$# in
1850 0) exit 1;;
1851 esac
1852 thing=\$1
1853 shift
1854 dflt=\$1
1855 shift
1856 for dir in \$*; do
1857         case "\$thing" in
1858         .)
1859         if test -d \$dir/\$thing; then
1860                 echo \$dir
1861                 exit 0
1862         fi
1863         ;;
1864         *)
1865         for thisthing in \$dir/\$thing; do
1866                 : just loop through to pick last item
1867         done
1868         if test -f \$thisthing; then
1869                 echo \$thisthing
1870                 exit 0
1871         elif test -f \$dir/\$thing.exe; then
1872                 if test -n "$DJGPP"; then
1873                         echo \$dir/\$thing.exe
1874                 else
1875                         : on Eunice apparently
1876                         echo \$dir/\$thing
1877                 fi
1878                 exit 0
1879         fi
1880         ;;
1881         esac
1882 done
1883 echo \$dflt
1884 exit 1
1885 EOSC
1886 chmod +x loc
1887 $eunicefix loc
1888 loclist="
1889 awk
1890 cat
1891 comm
1892 cp
1893 echo
1894 expr
1895 grep
1896 ls
1897 make
1898 mkdir
1899 rm
1900 sed
1901 sort
1902 touch
1903 tr
1904 uniq
1905 "
1906 trylist="
1907 Mcc
1908 ar
1909 byacc
1910 cpp
1911 csh
1912 date
1913 egrep
1914 gzip
1915 less
1916 ln
1917 more
1918 nm
1919 nroff
1920 perl
1921 pg
1922 test
1923 uname
1924 zip
1925 "
1926 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1927 pth="$pth /lib /usr/lib"
1928 for file in $loclist; do
1929         eval xxx=\$$file
1930         case "$xxx" in
1931         /*|?:[\\/]*)
1932                 if test -f "$xxx"; then
1933                         : ok
1934                 else
1935                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1936                         xxx=`./loc $file $file $pth`
1937                 fi
1938                 ;;
1939         '') xxx=`./loc $file $file $pth`;;
1940         *) xxx=`./loc $xxx $xxx $pth`;;
1941         esac
1942         eval $file=$xxx
1943         eval _$file=$xxx
1944         case "$xxx" in
1945         /*)
1946                 echo $file is in $xxx.
1947                 ;;
1948         ?:[\\/]*)
1949                 echo $file is in $xxx.
1950                 ;;
1951         *)
1952                 echo "I don't know where '$file' is, and my life depends on it." >&4
1953                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1954                 exit 1
1955                 ;;
1956         esac
1957 done
1958 echo " "
1959 echo "Don't worry if any of the following aren't found..."
1960 say=offhand
1961 for file in $trylist; do
1962         eval xxx=\$$file
1963         case "$xxx" in
1964         /*|?:[\\/]*)
1965                 if test -f "$xxx"; then
1966                         : ok
1967                 else
1968                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1969                         xxx=`./loc $file $file $pth`
1970                 fi
1971                 ;;
1972         '') xxx=`./loc $file $file $pth`;;
1973         *) xxx=`./loc $xxx $xxx $pth`;;
1974         esac
1975         eval $file=$xxx
1976         eval _$file=$xxx
1977         case "$xxx" in
1978         /*)
1979                 echo $file is in $xxx.
1980                 ;;
1981         ?:[\\/]*)
1982                 echo $file is in $xxx.
1983                 ;;
1984         *)
1985                 echo "I don't see $file out there, $say."
1986                 say=either
1987                 ;;
1988         esac
1989 done
1990 case "$egrep" in
1991 egrep)
1992         echo "Substituting grep for egrep."
1993         egrep=$grep
1994         ;;
1995 esac
1996 case "$ln" in
1997 ln)
1998         echo "Substituting cp for ln."
1999         ln=$cp
2000         ;;
2001 esac
2002 case "$test" in
2003 test)
2004         echo "Hopefully test is built into your sh."
2005         ;;
2006 *)
2007         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2008                 echo "Using the test built into your sh."
2009                 test=test
2010                 _test=test
2011         fi
2012         ;;
2013 esac
2014 case "$echo" in
2015 echo)
2016         echo "Hopefully echo is built into your sh."
2017         ;;
2018 '') ;;
2019 *)
2020         echo " "
2021 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2022         $echo $n "hi there$c" >foo1
2023         echo $n "hi there$c" >foo2
2024         if cmp foo1 foo2 >/dev/null 2>&1; then
2025                 echo "They are compatible.  In fact, they may be identical."
2026         else
2027                 case "$n" in
2028                 '-n') n='' c='\c';;
2029                 *) n='-n' c='';;
2030                 esac
2031                 cat <<FOO
2032 They are not compatible!  You are probably running ksh on a non-USG system.
2033 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2034 have echo built in and we may have to run some Bourne shell scripts.  That
2035 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2036
2037 FOO
2038                 $echo $n "The star should be here-->$c"
2039                 $echo "*"
2040         fi
2041         $rm -f foo1 foo2
2042         ;;
2043 esac
2044
2045 : determine whether symbolic links are supported
2046 echo " "
2047 $touch blurfl
2048 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2049         echo "Symbolic links are supported." >&4
2050         lns="$ln -s"
2051 else
2052         echo "Symbolic links are NOT supported." >&4
2053         lns="$ln"
2054 fi
2055 $rm -f blurfl sym
2056
2057 : see whether [:lower:] and [:upper:] are supported character classes
2058 echo " "
2059 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2060 ABYZ)
2061         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2062         up='[:upper:]'
2063         low='[:lower:]'
2064         ;;
2065 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2066         # (0xc9 and 0xd1), therefore that is a nice testing point.
2067         if test "X$up" = X -o "X$low" = X; then
2068             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2069             ij) up='[A-Z]'
2070                 low='[a-z]'
2071                 ;;
2072             esac
2073         fi
2074         if test "X$up" = X -o "X$low" = X; then
2075             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2076             ij) up='A-Z'
2077                 low='a-z'
2078                 ;;
2079             esac
2080         fi
2081         if test "X$up" = X -o "X$low" = X; then
2082             case "`echo IJ | od -x 2>/dev/null`" in
2083             *C9D1*|*c9d1*)
2084                 echo "Hey, this might be EBCDIC." >&4
2085                 if test "X$up" = X -o "X$low" = X; then
2086                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2087                     ij) up='[A-IJ-RS-Z]'
2088                         low='[a-ij-rs-z]'
2089                         ;;
2090                     esac
2091                 fi
2092                 if test "X$up" = X -o "X$low" = X; then
2093                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2094                     ij) up='A-IJ-RS-Z'
2095                         low='a-ij-rs-z'
2096                         ;;
2097                     esac
2098                 fi
2099                 ;;
2100             esac
2101         fi
2102 esac
2103 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2104 ij)
2105     echo "Using $up and $low to convert case." >&4
2106     ;;
2107 *)
2108     echo "I don't know how to translate letters from upper to lower case." >&4
2109     echo "Your tr is not acting any way I know of." >&4
2110     exit 1
2111     ;;
2112 esac
2113 : set up the translation script tr, must be called with ./tr of course
2114 cat >tr <<EOSC
2115 $startsh
2116 case "\$1\$2" in
2117 '[A-Z][a-z]') exec $tr '$up' '$low';;
2118 '[a-z][A-Z]') exec $tr '$low' '$up';;
2119 esac
2120 exec $tr "\$@"
2121 EOSC
2122 chmod +x tr
2123 $eunicefix tr
2124
2125 : Try to determine whether config.sh was made on this system
2126 case "$config_sh" in
2127 '')
2128 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2129 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2130 # because the A-Z/a-z are not consecutive.
2131 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2132         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2133 newmyuname="$myuname"
2134 dflt=n
2135 case "$knowitall" in
2136 '')
2137         if test -f ../config.sh; then
2138                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2139                         eval "`grep myuname= ../config.sh`"
2140                 fi
2141                 if test "X$myuname" = "X$newmyuname"; then
2142                         dflt=y
2143                 fi
2144         fi
2145         ;;
2146 *) dflt=y;;
2147 esac
2148
2149 : Get old answers from old config file if Configure was run on the
2150 : same system, otherwise use the hints.
2151 hint=default
2152 cd ..
2153 if test -f config.sh; then
2154         echo " "
2155         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2156         . UU/myread
2157         case "$ans" in
2158         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2159         *)  echo "Fetching default answers from your old config.sh file..." >&4
2160                 tmp_n="$n"
2161                 tmp_c="$c"
2162                 tmp_sh="$sh"
2163                 . ./config.sh
2164                 cp config.sh UU
2165                 n="$tmp_n"
2166                 c="$tmp_c"
2167                 : Older versions did not always set $sh.  Catch re-use of such
2168                 : an old config.sh.
2169                 case "$sh" in
2170                 '') sh="$tmp_sh" ;;
2171                 esac
2172                 hint=previous
2173                 ;;
2174         esac
2175 fi
2176 if test ! -f config.sh; then
2177         $cat <<EOM
2178
2179 First time through, eh?  I have some defaults handy for some systems
2180 that need some extra help getting the Configure answers right:
2181
2182 EOM
2183         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2184         dflt=''
2185         : Half the following guesses are probably wrong... If you have better
2186         : tests or hints, please send them to perlbug@perl.com
2187         : The metaconfig authors would also appreciate a copy...
2188         $test -f /irix && osname=irix
2189         $test -f /xenix && osname=sco_xenix
2190         $test -f /dynix && osname=dynix
2191         $test -f /dnix && osname=dnix
2192         $test -f /lynx.os && osname=lynxos
2193         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2194         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2195         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2196         $test -f /bin/mips && /bin/mips && osname=mips
2197         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2198                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2199         $test -d /usr/apollo/bin && osname=apollo
2200         $test -f /etc/saf/_sactab && osname=svr4
2201         $test -d /usr/include/minix && osname=minix
2202         if $test -d /MachTen -o -d /MachTen_Folder; then
2203                 osname=machten
2204                 if $test -x /sbin/version; then
2205                         osvers=`/sbin/version | $awk '{print $2}' |
2206                         $sed -e 's/[A-Za-z]$//'`
2207                 elif $test -x /usr/etc/version; then
2208                         osvers=`/usr/etc/version | $awk '{print $2}' |
2209                         $sed -e 's/[A-Za-z]$//'`
2210                 else
2211                         osvers="$2.$3"
2212                 fi
2213         fi
2214
2215         $test -f /sys/posix.dll &&
2216                 $test -f /usr/bin/what &&
2217                 set X `/usr/bin/what /sys/posix.dll` &&
2218                 $test "$3" = UWIN &&
2219                 osname=uwin &&
2220                 osvers="$5"
2221
2222         if $test -f $uname; then
2223                 set X $myuname
2224                 shift
2225
2226                 case "$5" in
2227                 fps*) osname=fps ;;
2228                 mips*)
2229                         case "$4" in
2230                         umips) osname=umips ;;
2231                         *) osname=mips ;;
2232                         esac;;
2233                 [23]100) osname=mips ;;
2234                 next*) osname=next ;;
2235                 i386*)
2236                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2237                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2238                                 osname='sco'
2239                                 osvers=$tmp
2240                         elif $test -f /etc/kconfig; then
2241                                 osname=isc
2242                                 if test "$lns" = "$ln -s"; then
2243                                         osvers=4
2244                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2245                                         osvers=3
2246                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2247                                         osvers=2
2248                                 fi
2249                         fi
2250                         tmp=''
2251                         ;;
2252                 pc*)
2253                         if test -n "$DJGPP"; then
2254                                 osname=dos
2255                                 osvers=djgpp
2256                         fi
2257                         ;;
2258                 esac
2259
2260                 case "$1" in
2261                 aix) osname=aix
2262                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2263                         case "$tmp" in
2264                         'not found') osvers="$4"."$3" ;;
2265                         '<3240'|'<>3240') osvers=3.2.0 ;;
2266                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2267                         '=3250'|'>3250') osvers=3.2.5 ;;
2268                         *) osvers=$tmp;;
2269                         esac
2270                         ;;
2271                 bsd386) osname=bsd386
2272                         osvers=`$uname -r`
2273                         ;;
2274                 cygwin*) osname=cygwin
2275                         osvers="$3"
2276                         ;;
2277                 *dc.osx) osname=dcosx
2278                         osvers="$3"
2279                         ;;
2280                 dnix) osname=dnix
2281                         osvers="$3"
2282                         ;;
2283                 domainos) osname=apollo
2284                         osvers="$3"
2285                         ;;
2286                 dgux) osname=dgux 
2287                         osvers="$3"
2288                         ;;
2289                 dynixptx*) osname=dynixptx
2290                         osvers=`echo "$4"|sed 's/^v//'`
2291                         ;;
2292                 freebsd) osname=freebsd 
2293                         osvers="$3" ;;
2294                 genix) osname=genix ;;
2295                 hp*) osname=hpux 
2296                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2297                         ;;
2298                 irix*) osname=irix
2299                         case "$3" in
2300                         4*) osvers=4 ;;
2301                         5*) osvers=5 ;;
2302                         *)      osvers="$3" ;;
2303                         esac
2304                         ;;
2305                 linux) osname=linux
2306                         case "$3" in
2307                         *)      osvers="$3" ;;
2308                         esac
2309                         ;;
2310                 MiNT) osname=mint
2311                         ;;
2312                 netbsd*) osname=netbsd
2313                         osvers="$3"
2314                         ;;
2315                 news-os) osvers="$3"
2316                         case "$3" in
2317                         4*) osname=newsos4 ;;
2318                         *) osname=newsos ;;
2319                         esac
2320                         ;;
2321                 next*) osname=next ;;
2322                 POSIX-BC | posix-bc ) osname=posix-bc
2323                         osvers="$3"
2324                         ;;
2325                 powerux | power_ux | powermax_os | powermaxos | \
2326                 powerunix | power_unix) osname=powerux
2327                         osvers="$3"
2328                         ;;
2329                 qnx) osname=qnx
2330                         osvers="$4"
2331                         ;;
2332                 solaris) osname=solaris
2333                         case "$3" in
2334                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2335                         *)      osvers="$3" ;;
2336                         esac
2337                         ;;
2338                 sunos) osname=sunos
2339                         case "$3" in
2340                         5*) osname=solaris
2341                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2342                         *)      osvers="$3" ;;
2343                         esac
2344                         ;;
2345                 titanos) osname=titanos
2346                         case "$3" in
2347                         1*) osvers=1 ;;
2348                         2*) osvers=2 ;;
2349                         3*) osvers=3 ;;
2350                         4*) osvers=4 ;;
2351                         *)      osvers="$3" ;;
2352                         esac
2353                         ;;
2354                 ultrix) osname=ultrix
2355                         osvers="$3"
2356                         ;;
2357                 osf1|mls+)      case "$5" in
2358                                 alpha)
2359                                         osname=dec_osf
2360                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2361                                         ;;
2362                         hp*)    osname=hp_osf1  ;;
2363                         mips)   osname=mips_osf1 ;;
2364                         esac
2365                         ;;
2366                 unixware) osname=svr5
2367                         osvers="$4"
2368                         ;;
2369                 uts) osname=uts
2370                         osvers="$3"
2371                         ;;
2372                 $2) case "$osname" in
2373                         *isc*) ;;
2374                         *freebsd*) ;;
2375                         svr*)
2376                                 : svr4.x or possibly later
2377                                 case "svr$3" in 
2378                                 ${osname}*)
2379                                         osname=svr$3
2380                                         osvers=$4
2381                                         ;;
2382                                 esac
2383                                 case "$osname" in
2384                                 svr4.0)
2385                                         : Check for ESIX
2386                                         if test -f /stand/boot ; then
2387                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2388                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2389                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2390                                                         if test -n "$isesix"; then
2391                                                                 osname=esix4
2392                                                         fi
2393                                                 fi
2394                                         fi
2395                                         ;;
2396                                 esac
2397                                 ;;
2398                         *)      if test -f /etc/systemid; then
2399                                         osname=sco
2400                                         set `echo $3 | $sed 's/\./ /g'` $4
2401                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2402                                                 osvers=$1.$2.$3
2403                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2404                                                 osvers=$1.$2
2405                                         elif $test -f $src/hints/sco_$1.sh; then
2406                                                 osvers=$1
2407                                         fi
2408                                 else
2409                                         case "$osname" in
2410                                         '') : Still unknown.  Probably a generic Sys V.
2411                                                 osname="sysv"
2412                                                 osvers="$3"
2413                                                 ;;
2414                                         esac
2415                                 fi
2416                                 ;;
2417                         esac
2418                         ;;
2419                 *)      case "$osname" in
2420                         '') : Still unknown.  Probably a generic BSD.
2421                                 osname="$1"
2422                                 osvers="$3"
2423                                 ;;
2424                         esac
2425                         ;;
2426                 esac
2427         else
2428                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2429                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2430                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2431                                 osname=news_os
2432                         fi
2433                         $rm -f UU/kernel.what
2434                 elif test -d c:/.; then
2435                         set X $myuname
2436                         osname=os2
2437                         osvers="$5"
2438                 fi
2439         fi
2440         
2441         : Now look for a hint file osname_osvers, unless one has been
2442         : specified already.
2443         case "$hintfile" in
2444         ''|' ')
2445                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2446                 : Also try without trailing minor version numbers.
2447                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2448                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2449                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2450                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2451                 case "$file" in
2452                 '') dflt=none ;;
2453                 *)  case "$osvers" in
2454                         '') dflt=$file
2455                                 ;;
2456                         *)  if $test -f $src/hints/$file.sh ; then
2457                                         dflt=$file
2458                                 elif $test -f $src/hints/$xfile.sh ; then
2459                                         dflt=$xfile
2460                                 elif $test -f $src/hints/$xxfile.sh ; then
2461                                         dflt=$xxfile
2462                                 elif $test -f $src/hints/$xxxfile.sh ; then
2463                                         dflt=$xxxfile
2464                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2465                                         dflt=$xxxxfile
2466                                 elif $test -f "$src/hints/${osname}.sh" ; then
2467                                         dflt="${osname}"
2468                                 else
2469                                         dflt=none
2470                                 fi
2471                                 ;;
2472                         esac
2473                         ;;
2474                 esac
2475                 if $test -f Policy.sh ; then
2476                         case "$dflt" in
2477                         *Policy*) ;;
2478                         none) dflt="Policy" ;;
2479                         *) dflt="Policy $dflt" ;;
2480                         esac
2481                 fi
2482                 ;;
2483         *)
2484                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2485                 ;;
2486         esac
2487
2488         if $test -f Policy.sh ; then
2489                 $cat <<EOM
2490
2491 There's also a Policy hint file available, which should make the
2492 site-specific (policy) questions easier to answer.
2493 EOM
2494
2495         fi
2496
2497         $cat <<EOM
2498
2499 You may give one or more space-separated answers, or "none" if appropriate.
2500 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2501 is a good thing.  DO NOT give a wrong version or a wrong OS.
2502
2503 EOM
2504
2505         rp="Which of these apply, if any?"
2506         . UU/myread
2507         tans=$ans
2508         for file in $tans; do
2509                 if $test X$file = XPolicy -a -f Policy.sh; then
2510                         . Policy.sh
2511                         $cat Policy.sh >> UU/config.sh
2512                 elif $test -f $src/hints/$file.sh; then
2513                         . $src/hints/$file.sh
2514                         $cat $src/hints/$file.sh >> UU/config.sh
2515                 elif $test X$tans = X -o X$tans = Xnone ; then
2516                         : nothing
2517                 else
2518                         : Give one chance to correct a possible typo.
2519                         echo "$file.sh does not exist"
2520                         dflt=$file
2521                         rp="hint to use instead?"
2522                         . UU/myread
2523                         for file in $ans; do
2524                                 if $test -f "$src/hints/$file.sh"; then
2525                                         . $src/hints/$file.sh
2526                                         $cat $src/hints/$file.sh >> UU/config.sh
2527                                 elif $test X$ans = X -o X$ans = Xnone ; then
2528                                         : nothing
2529                                 else
2530                                         echo "$file.sh does not exist -- ignored."
2531                                 fi
2532                         done
2533                 fi
2534         done
2535
2536         hint=recommended
2537         : Remember our hint file for later.
2538         if $test -f "$src/hints/$file.sh" ; then
2539                 hintfile="$file"
2540         else
2541                 hintfile=''
2542         fi
2543 fi
2544 cd UU
2545 ;;
2546 *)
2547         echo " "
2548         echo "Fetching default answers from $config_sh..." >&4
2549         tmp_n="$n"
2550         tmp_c="$c"
2551         cd ..
2552         cp $config_sh config.sh 2>/dev/null
2553         chmod +w config.sh
2554         . ./config.sh
2555         cd UU
2556         cp ../config.sh .
2557         n="$tmp_n"
2558         c="$tmp_c"
2559         hint=previous
2560         ;;
2561 esac
2562 test "$override" && . ./optdef.sh
2563 myuname="$newmyuname"
2564
2565 : Restore computed paths
2566 for file in $loclist $trylist; do
2567         eval $file="\$_$file"
2568 done
2569
2570 cat << EOM
2571
2572 Configure uses the operating system name and version to set some defaults.
2573 The default value is probably right if the name rings a bell. Otherwise,
2574 since spelling matters for me, either accept the default or answer "none"
2575 to leave it blank.
2576
2577 EOM
2578 case "$osname" in
2579         ''|' ')
2580                 case "$hintfile" in
2581                 ''|' '|none) dflt=none ;;
2582                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2583                 esac
2584                 ;;
2585         *) dflt="$osname" ;;
2586 esac
2587 rp="Operating system name?"
2588 . ./myread
2589 case "$ans" in
2590 none)  osname='' ;;
2591 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2592 esac
2593 echo " "
2594 case "$osvers" in
2595         ''|' ')
2596                 case "$hintfile" in
2597                 ''|' '|none) dflt=none ;;
2598                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2599                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2600                         case "$dflt" in
2601                         ''|' ') dflt=none ;;
2602                         esac
2603                         ;;
2604                 esac
2605                 ;;
2606         *) dflt="$osvers" ;;
2607 esac
2608 rp="Operating system version?"
2609 . ./myread
2610 case "$ans" in
2611 none)  osvers='' ;;
2612 *) osvers="$ans" ;;
2613 esac
2614
2615
2616 . ./posthint.sh
2617
2618 : who configured the system
2619 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2620 cf_by=`(logname) 2>/dev/null`
2621 case "$cf_by" in
2622 "")
2623         cf_by=`(whoami) 2>/dev/null`
2624         case "$cf_by" in
2625         "") cf_by=unknown ;;
2626         esac ;;
2627 esac
2628
2629 : set up the script used to warn in case of inconsistency
2630 cat <<EOS >whoa
2631 $startsh
2632 EOS
2633 cat <<'EOSC' >>whoa
2634 dflt=y
2635 echo " "
2636 echo "*** WHOA THERE!!! ***" >&4
2637 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2638 rp="    Keep the $hint value?"
2639 . ./myread
2640 case "$ans" in
2641 y) td=$was; tu=$was;;
2642 esac
2643 EOSC
2644
2645 : function used to set $1 to $val
2646 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2647 case "$val$was" in
2648 $define$undef) . ./whoa; eval "$var=\$td";;
2649 $undef$define) . ./whoa; eval "$var=\$tu";;
2650 *) eval "$var=$val";;
2651 esac'
2652
2653 cat <<EOM
2654
2655 Perl can be built to take advantage of threads, on some systems.
2656 To do so, Configure must be run with -Dusethreads.
2657
2658 Note that threading is a highly experimental feature, and
2659 some known race conditions still remain.  If you choose to try
2660 it, be very sure to not actually deploy it for production
2661 purposes.  README.threads has more details, and is required
2662 reading if you enable threads.
2663 EOM
2664 case "$usethreads" in
2665 $define|true|[yY]*)     dflt='y';;
2666 *) dflt='n';;
2667 esac
2668 rp='Build a threading Perl?'
2669 . ./myread
2670 case "$ans" in
2671 y|Y)    val="$define" ;;
2672 *)      val="$undef" ;;
2673 esac
2674 set usethreads
2675 eval $setvar
2676
2677 case "$usethreads" in
2678 $define)
2679         $cat <<EOM
2680
2681 As of 5.5.640, Perl has two different internal threading implementations,
2682 the 5.005 version (5005threads) and an interpreter-based version
2683 (ithreads) that has one interpreter per thread.  Both are very 
2684 experimental.  This arrangement exists to help developers work out
2685 which one is better.
2686 EOM
2687         : Default to ithreads unless overridden on command line or with
2688         : old config.sh
2689         dflt='y'
2690         case "$use5005threads" in
2691                 $define|true|[yY]*) dflt='n';;
2692         esac
2693         case "$useithreads" in
2694                 $undef|false|[nN]*) dflt='n';;
2695         esac
2696         rp='Use interpreter-based ithreads?'
2697         . ./myread
2698         case "$ans" in
2699         y|Y)    val="$define" ;;
2700         *)      val="$undef" ;;
2701         esac
2702         set useithreads
2703         eval $setvar
2704         : Now set use5005threads to the opposite value.
2705         case "$useithreads" in
2706         $define) val="$undef" ;;
2707         *) val="$define" ;;
2708         esac
2709         set use5005threads
2710         eval $setvar
2711         ;;
2712 *)
2713         useithreads="$undef"
2714         use5005threads="$undef"
2715         ;;
2716 esac
2717
2718 case "$d_oldpthreads" in
2719 '')     : Configure tests would be welcome here.  For now, assume undef.
2720         val="$undef" ;;
2721 *)      val="$d_oldpthreads" ;;
2722 esac
2723 set d_oldpthreads
2724 eval $setvar
2725
2726
2727 case "$usethreads" in
2728 "$define"|true|[yY]*)
2729 : Look for a hint-file generated 'call-back-unit'.  If the
2730 : user has specified that a threading perl is to be built,
2731 : we may need to set or change some other defaults.
2732         if $test -f usethreads.cbu; then
2733                 echo "Your platform has some specific hints for threaded builds, using them..."
2734                 . ./usethreads.cbu
2735         else
2736                 $cat <<EOM
2737 (Your platform doesn't have any specific hints for threaded builds.
2738  Assuming POSIX threads, then.)
2739 EOM
2740         fi
2741         ;;
2742 esac
2743
2744 cat <<EOM
2745
2746 Perl can be built so that multiple Perl interpreters can coexist
2747 within the same Perl executable.
2748 EOM
2749
2750 case "$useithreads" in
2751 $define)
2752         cat <<EOM
2753 This multiple interpreter support is required for interpreter-based threads.
2754 EOM
2755         val="$define"
2756         ;;
2757 *)
2758         echo 'Normally you do not need this and you should answer no.'
2759         case "$usemultiplicity" in
2760         $define|true|[yY]*)     dflt='y';;
2761         *) dflt='n';;
2762         esac
2763         rp='Build Perl for multiplicity?'
2764         . ./myread
2765         case "$ans" in
2766         y|Y)    val="$define" ;;
2767         *)      val="$undef" ;;
2768         esac
2769         ;;
2770 esac
2771 set usemultiplicity
2772 eval $setvar
2773
2774 : determine where manual pages are on this system
2775 echo " "
2776 case "$sysman" in
2777 '') 
2778         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2779         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2780         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2781         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2782         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2783         sysman=`./loc . /usr/man/man1 $syspath`
2784         ;;
2785 esac
2786 if $test -d "$sysman"; then
2787         echo "System manual is in $sysman." >&4
2788 else
2789         echo "Could not find manual pages in source form." >&4
2790 fi
2791
2792 : see what memory models we can support
2793 case "$models" in
2794 '')
2795         $cat >pdp11.c <<'EOP'
2796 int main() {
2797 #ifdef pdp11
2798         exit(0);
2799 #else
2800         exit(1);
2801 #endif
2802 }
2803 EOP
2804         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2805         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2806                 dflt='unsplit split'
2807         else
2808                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2809                 case "$tans" in
2810                 X) dflt='none';;
2811                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2812                                 dflt='small'
2813                         else
2814                                 dflt=''
2815                         fi
2816                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2817                                 dflt="$dflt medium"
2818                         fi
2819                         if $test -d /lib/large || $test -d /usr/lib/large; then
2820                                 dflt="$dflt large"
2821                         fi
2822                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2823                                 dflt="$dflt huge"
2824                         fi
2825                 esac
2826         fi;;
2827 *) dflt="$models";;
2828 esac
2829 $cat <<EOM
2830  
2831 Some systems have different model sizes.  On most systems they are called
2832 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2833 split.  If your system doesn't support different memory models, say "none".
2834 If you wish to force everything to one memory model, say "none" here and
2835 put the appropriate flags later when it asks you for other cc and ld flags.
2836 Venix systems may wish to put "none" and let the compiler figure things out.
2837 (In the following question multiple model names should be space separated.)
2838
2839 The default for most systems is "none".
2840
2841 EOM
2842 rp="Which memory models are supported?"
2843 . ./myread
2844 models="$ans"
2845
2846 case "$models" in
2847 none)
2848         small=''
2849         medium=''
2850         large=''
2851         huge=''
2852         unsplit=''
2853         split=''
2854         ;;
2855 *split)
2856         case "$split" in
2857         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2858                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2859                         dflt='-i'
2860                 else
2861                         dflt='none'
2862                 fi;;
2863         *) dflt="$split";;
2864         esac
2865         rp="What flag indicates separate I and D space?"
2866         . ./myread
2867         tans="$ans"
2868         case "$tans" in
2869         none) tans='';;
2870         esac
2871         split="$tans"
2872         unsplit='';;
2873 *large*|*small*|*medium*|*huge*)
2874         case "$models" in
2875         *large*)
2876                 case "$large" in
2877                 '') dflt='-Ml';;
2878                 *) dflt="$large";;
2879                 esac
2880         rp="What flag indicates large model?"
2881         . ./myread
2882         tans="$ans"
2883         case "$tans" in
2884         none) tans='';
2885         esac
2886         large="$tans";;
2887         *) large='';;
2888         esac
2889         case "$models" in
2890         *huge*) case "$huge" in
2891                 '') dflt='-Mh';;
2892                 *) dflt="$huge";;
2893                 esac
2894                 rp="What flag indicates huge model?"
2895                 . ./myread
2896                 tans="$ans"
2897                 case "$tans" in
2898                 none) tans='';
2899                 esac
2900                 huge="$tans";;
2901         *) huge="$large";;
2902         esac
2903         case "$models" in
2904         *medium*) case "$medium" in
2905                 '') dflt='-Mm';;
2906                 *) dflt="$medium";;
2907                 esac
2908                 rp="What flag indicates medium model?"
2909                 . ./myread
2910                 tans="$ans"
2911                 case "$tans" in
2912                 none) tans='';
2913                 esac
2914                 medium="$tans";;
2915         *) medium="$large";;
2916         esac
2917         case "$models" in
2918         *small*) case "$small" in
2919                 '') dflt='none';;
2920                 *) dflt="$small";;
2921                 esac
2922                 rp="What flag indicates small model?"
2923                 . ./myread
2924                 tans="$ans"
2925                 case "$tans" in
2926                 none) tans='';
2927                 esac
2928                 small="$tans";;
2929         *) small='';;
2930         esac
2931         ;;
2932 *)
2933         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2934         ;;
2935 esac
2936 $rm -f pdp11.* pdp11
2937
2938 : make some quick guesses about what we are up against
2939 echo " "
2940 $echo $n "Hmm...  $c"
2941 echo exit 1 >bsd
2942 echo exit 1 >usg
2943 echo exit 1 >v7
2944 echo exit 1 >osf1
2945 echo exit 1 >eunice
2946 echo exit 1 >xenix
2947 echo exit 1 >venix
2948 echo exit 1 >os2
2949 d_bsd="$undef"
2950 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2951 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2952 then
2953         echo "Looks kind of like an OSF/1 system, but we'll see..."
2954         echo exit 0 >osf1
2955 elif test `echo abc | tr a-z A-Z` = Abc ; then
2956         xxx=`./loc addbib blurfl $pth`
2957         if $test -f $xxx; then
2958         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2959                 echo exit 0 >bsd
2960                 echo exit 0 >usg
2961         else
2962                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2963                         echo "Looks kind of like an extended USG system, but we'll see..."
2964                 else
2965                         echo "Looks kind of like a USG system, but we'll see..."
2966                 fi
2967                 echo exit 0 >usg
2968         fi
2969 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2970         echo "Looks kind of like a BSD system, but we'll see..."
2971         d_bsd="$define"
2972         echo exit 0 >bsd
2973 else
2974         echo "Looks kind of like a Version 7 system, but we'll see..."
2975         echo exit 0 >v7
2976 fi
2977 case "$eunicefix" in
2978 *unixtovms*)
2979         $cat <<'EOI'
2980 There is, however, a strange, musty smell in the air that reminds me of
2981 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2982 EOI
2983         echo exit 0 >eunice
2984         d_eunice="$define"
2985 : it so happens the Eunice I know will not run shell scripts in Unix format
2986         ;;
2987 *)
2988         echo " "
2989         echo "Congratulations.  You aren't running Eunice."
2990         d_eunice="$undef"
2991         ;;
2992 esac
2993 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2994 case "$p_" in
2995 :) ;;
2996 *)
2997         $cat <<'EOI'
2998 I have the feeling something is not exactly right, however...don't tell me...
2999 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3000 EOI
3001         echo exit 0 >os2
3002         ;;
3003 esac
3004 if test -f /xenix; then
3005         echo "Actually, this looks more like a XENIX system..."
3006         echo exit 0 >xenix
3007         d_xenix="$define"
3008 else
3009         echo " "
3010         echo "It's not Xenix..."
3011         d_xenix="$undef"
3012 fi
3013 chmod +x xenix
3014 $eunicefix xenix
3015 if test -f /venix; then
3016         echo "Actually, this looks more like a VENIX system..."
3017         echo exit 0 >venix
3018 else
3019         echo " "
3020         if ./xenix; then
3021                 : null
3022         else
3023                 echo "Nor is it Venix..."
3024         fi
3025 fi
3026 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3027 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3028 $rm -f foo
3029
3030 : see if we need a special compiler
3031 echo " "
3032 if ./usg; then
3033         case "$cc" in
3034         '') case "$Mcc" in
3035                 /*) dflt='Mcc';;
3036                 *) case "$large" in
3037                         -M*) dflt='cc';;
3038                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3039                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3040                                                 dflt='cc'
3041                                         else
3042                                                 dflt='cc -M'
3043                                         fi
3044                                 else
3045                                         dflt='cc'
3046                                 fi;;
3047                         esac;;
3048                 esac;;
3049         *)  dflt="$cc";;
3050         esac
3051         case "$dflt" in
3052         *M*)    $cat <<'EOM'
3053 On some older systems the default C compiler will not resolve multiple global
3054 references that happen to have the same name.  On some such systems the "Mcc"
3055 command may be used to force these to be resolved.  On other systems a "cc -M"
3056 command is required.  (Note that the -M flag on other systems indicates a
3057 memory model to use!) If you have the Gnu C compiler, you might wish to use
3058 that instead.
3059
3060 EOM
3061         ;;
3062         esac
3063         rp="Use which C compiler?"
3064         . ./myread
3065         cc="$ans"
3066 else
3067         case "$cc" in
3068         '') dflt=cc;;
3069         *) dflt="$cc";;
3070         esac
3071         rp="Use which C compiler?"
3072         . ./myread
3073         cc="$ans"
3074 fi
3075 : Look for a hint-file generated 'call-back-unit'.  Now that the
3076 : user has specified the compiler, we may need to set or change some
3077 : other defaults.
3078 if $test -f cc.cbu; then
3079     . ./cc.cbu
3080 fi
3081 echo " "
3082 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3083 $cat >gccvers.c <<EOM
3084 #include <stdio.h>
3085 int main() {
3086 #ifdef __GNUC__
3087 #ifdef __VERSION__
3088         printf("%s\n", __VERSION__);
3089 #else
3090         printf("%s\n", "1");
3091 #endif
3092 #endif
3093         exit(0);
3094 }
3095 EOM
3096 if $cc -o gccvers gccvers.c; then
3097         gccversion=`./gccvers`
3098         case "$gccversion" in
3099         '') echo "You are not using GNU cc." ;;
3100         *)  echo "You are using GNU cc $gccversion."
3101             ;;
3102         esac
3103 else
3104         echo " "
3105         echo "*** WHOA THERE!!! ***" >&4
3106         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3107         case "$knowitall" in
3108         '')
3109         echo "    You'd better start hunting for one and let me know about it." >&4
3110                 exit 1
3111                 ;;
3112         esac
3113 fi
3114 $rm -f gccvers*
3115 case "$gccversion" in
3116 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3117 esac
3118
3119 : decide how portable to be.  Allow command line overrides.
3120 case "$d_portable" in
3121 "$undef") ;;
3122 *)      d_portable="$define" ;;
3123 esac
3124
3125 : set up shell script to do ~ expansion
3126 cat >filexp <<EOSS
3127 $startsh
3128 : expand filename
3129 case "\$1" in
3130  ~/*|~)
3131         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3132         ;;
3133  ~*)
3134         if $test -f /bin/csh; then
3135                 /bin/csh -f -c "glob \$1"
3136                 failed=\$?
3137                 echo ""
3138                 exit \$failed
3139         else
3140                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3141                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3142                 if $test ! -d "\$dir"; then
3143                         me=\`basename \$0\`
3144                         echo "\$me: can't locate home directory for: \$name" >&2
3145                         exit 1
3146                 fi
3147                 case "\$1" in
3148                 */*)
3149                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3150                         ;;
3151                 *)
3152                         echo \$dir
3153                         ;;
3154                 esac
3155         fi
3156         ;;
3157 *)
3158         echo \$1
3159         ;;
3160 esac
3161 EOSS
3162 chmod +x filexp
3163 $eunicefix filexp
3164
3165 : now set up to get a file name
3166 cat <<EOS >getfile
3167 $startsh
3168 EOS
3169 cat <<'EOSC' >>getfile
3170 tilde=''
3171 fullpath=''
3172 already=''
3173 skip=''
3174 none_ok=''
3175 exp_file=''
3176 nopath_ok=''
3177 orig_rp="$rp"
3178 orig_dflt="$dflt"
3179 case "$gfpth" in
3180 '') gfpth='.' ;;
3181 esac
3182
3183 case "$fn" in
3184 *\(*)
3185         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3186         fn=`echo $fn | sed 's/(.*)//'`
3187         ;;
3188 esac
3189
3190 case "$fn" in
3191 *:*)
3192         loc_file=`expr $fn : '.*:\(.*\)'`
3193         fn=`expr $fn : '\(.*\):.*'`
3194         ;;
3195 esac
3196
3197 case "$fn" in
3198 *~*) tilde=true;;
3199 esac
3200 case "$fn" in
3201 */*) fullpath=true;;
3202 esac
3203 case "$fn" in
3204 *+*) skip=true;;
3205 esac
3206 case "$fn" in
3207 *n*) none_ok=true;;
3208 esac
3209 case "$fn" in
3210 *e*) exp_file=true;;
3211 esac
3212 case "$fn" in
3213 *p*) nopath_ok=true;;
3214 esac
3215
3216 case "$fn" in
3217 *f*) type='File';;
3218 *d*) type='Directory';;
3219 *l*) type='Locate';;
3220 esac
3221
3222 what="$type"
3223 case "$what" in
3224 Locate) what='File';;
3225 esac
3226
3227 case "$exp_file" in
3228 '')
3229         case "$d_portable" in
3230         "$define") ;;
3231         *) exp_file=true;;
3232         esac
3233         ;;
3234 esac
3235
3236 cd ..
3237 while test "$type"; do
3238         redo=''
3239         rp="$orig_rp"
3240         dflt="$orig_dflt"
3241         case "$tilde" in
3242         true) rp="$rp (~name ok)";;
3243         esac
3244         . UU/myread
3245         if test -f UU/getfile.ok && \
3246                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3247         then
3248                 value="$ans"
3249                 ansexp="$ans"
3250                 break
3251         fi
3252         case "$ans" in
3253         none)
3254                 value=''
3255                 ansexp=''
3256                 case "$none_ok" in
3257                 true) type='';;
3258                 esac
3259                 ;;
3260         *)
3261                 case "$tilde" in
3262                 '') value="$ans"
3263                         ansexp="$ans";;
3264                 *)
3265                         value=`UU/filexp $ans`
3266                         case $? in
3267                         0)
3268                                 if test "$ans" != "$value"; then
3269                                         echo "(That expands to $value on this system.)"
3270                                 fi
3271                                 ;;
3272                         *) value="$ans";;
3273                         esac
3274                         ansexp="$value"
3275                         case "$exp_file" in
3276                         '') value="$ans";;
3277                         esac
3278                         ;;
3279                 esac
3280                 case "$fullpath" in
3281                 true)
3282                         case "$ansexp" in
3283                         /*) value="$ansexp" ;;
3284                         *)
3285                                 redo=true
3286                                 case "$already" in
3287                                 true)
3288                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3289                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3290                                         ;;
3291                                 *)
3292                                 echo "Please give a full path name, starting with slash." >&4
3293                                         case "$tilde" in
3294                                         true)
3295                                 echo "Note that using ~name is ok provided it expands well." >&4
3296                                                 already=true
3297                                                 ;;
3298                                         esac
3299                                 esac
3300                                 ;;
3301                         esac
3302                         ;;
3303                 esac
3304                 case "$redo" in
3305                 '')
3306                         case "$type" in
3307                         File)
3308                                 for fp in $gfpth; do
3309                                         if test "X$fp" = X.; then
3310                                             pf="$ansexp"
3311                                         else    
3312                                             pf="$fp/$ansexp"
3313                                         fi
3314                                         if test -f "$pf"; then
3315                                                 type=''
3316                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3317                                         then
3318                                                 echo "($value is not a plain file, but that's ok.)"
3319                                                 type=''
3320                                         fi
3321                                         if test X"$type" = X; then
3322                                             value="$pf"
3323                                             break
3324                                         fi
3325                                 done
3326                                 ;;
3327                         Directory)
3328                                 for fp in $gfpth; do
3329                                         if test "X$fp" = X.; then
3330                                             pf="$ansexp"
3331                                         else    
3332                                             pf="$fp/$ansexp"
3333                                         fi
3334                                         if test -d "$pf"; then
3335                                                 type=''
3336                                                 value="$pf"
3337                                                 break
3338                                         fi
3339                                 done
3340                                 ;;
3341                         Locate)
3342                                 if test -d "$ansexp"; then
3343                                         echo "(Looking for $loc_file in directory $value.)"
3344                                         value="$value/$loc_file"
3345                                         ansexp="$ansexp/$loc_file"
3346                                 fi
3347                                 if test -f "$ansexp"; then
3348                                         type=''
3349                                 fi
3350                                 case "$nopath_ok" in
3351                                 true)   case "$value" in
3352                                         */*) ;;
3353                                         *)      echo "Assuming $value will be in people's path."
3354                                                 type=''
3355                                                 ;;
3356                                         esac
3357                                         ;;
3358                                 esac
3359                                 ;;
3360                         esac
3361
3362                         case "$skip" in
3363                         true) type='';
3364                         esac
3365
3366                         case "$type" in
3367                         '') ;;
3368                         *)
3369                                 if test "$fastread" = yes; then
3370                                         dflt=y
3371                                 else
3372                                         dflt=n
3373                                 fi
3374                                 rp="$what $value doesn't exist.  Use that name anyway?"
3375                                 . UU/myread
3376                                 dflt=''
3377                                 case "$ans" in
3378                                 y*) type='';;
3379                                 *) echo " ";;
3380                                 esac
3381                                 ;;
3382                         esac
3383                         ;;
3384                 esac
3385                 ;;
3386         esac
3387 done
3388 cd UU
3389 ans="$value"
3390 rp="$orig_rp"
3391 dflt="$orig_dflt"
3392 rm -f getfile.ok
3393 test "X$gfpthkeep" != Xy && gfpth=""
3394 EOSC
3395
3396 : What should the include directory be ?
3397 echo " "
3398 $echo $n "Hmm...  $c"
3399 dflt='/usr/include'
3400 incpath=''
3401 mips_type=''
3402 if $test -f /bin/mips && /bin/mips; then
3403         echo "Looks like a MIPS system..."
3404         $cat >usr.c <<'EOCP'
3405 #ifdef SYSTYPE_BSD43
3406 /bsd43
3407 #endif
3408 EOCP
3409         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3410                 dflt='/bsd43/usr/include'
3411                 incpath='/bsd43'
3412                 mips_type='BSD 4.3'
3413         else
3414                 mips_type='System V'
3415         fi
3416         $rm -f usr.c usr.out
3417         echo "and you're compiling with the $mips_type compiler and libraries."
3418         xxx_prompt=y
3419         echo "exit 0" >mips
3420 else
3421         echo "Doesn't look like a MIPS system."
3422         xxx_prompt=n
3423         echo "exit 1" >mips
3424 fi
3425 chmod +x mips
3426 $eunicefix mips
3427 case "$usrinc" in
3428 '') ;;
3429 *) dflt="$usrinc";;
3430 esac
3431 case "$xxx_prompt" in
3432 y)      fn=d/
3433         echo " "
3434         rp='Where are the include files you want to use?'
3435         . ./getfile
3436         usrinc="$ans"
3437         ;;
3438 *)      usrinc="$dflt"
3439         ;;
3440 esac
3441
3442 : see how we invoke the C preprocessor
3443 echo " "
3444 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3445 cat <<'EOT' >testcpp.c
3446 #define ABC abc
3447 #define XYZ xyz
3448 ABC.XYZ
3449 EOT
3450 cd ..
3451 if test ! -f cppstdin; then
3452         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3453                 # AIX cc -E doesn't show the absolute headerfile
3454                 # locations but we'll cheat by using the -M flag.
3455                 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
3456         else
3457                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3458         fi
3459 else
3460         echo "Keeping your $hint cppstdin wrapper."
3461 fi
3462 chmod 755 cppstdin
3463 wrapper=`pwd`/cppstdin
3464 ok='false'
3465 cd UU
3466
3467 if $test "X$cppstdin" != "X" && \
3468         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3469         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3470 then
3471         echo "You used to use $cppstdin $cppminus so we'll use that again."
3472         case "$cpprun" in
3473         '') echo "But let's see if we can live without a wrapper..." ;;
3474         *)
3475                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3476                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3477                 then
3478                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3479                         ok='true'
3480                 else
3481                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3482                 fi
3483                 ;;
3484         esac
3485 else
3486         case "$cppstdin" in
3487         '') ;;
3488         *)
3489                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3490                 ;;
3491         esac
3492 fi
3493
3494 if $ok; then
3495         : nothing
3496 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3497         $cc -E <testcpp.c >testcpp.out 2>&1; \
3498         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3499         echo "Yup, it does."
3500         x_cpp="$cc -E"
3501         x_minus='';
3502 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3503         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3504         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3505         echo "Yup, it does."
3506         x_cpp="$cc -E"
3507         x_minus='-';
3508 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3509         $cc -P <testcpp.c >testcpp.out 2>&1; \
3510         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3511         echo "Yipee, that works!"
3512         x_cpp="$cc -P"
3513         x_minus='';
3514 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3515         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3516         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3517         echo "At long last!"
3518         x_cpp="$cc -P"
3519         x_minus='-';
3520 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3521         $cpp <testcpp.c >testcpp.out 2>&1; \
3522         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3523         echo "It works!"
3524         x_cpp="$cpp"
3525         x_minus='';
3526 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3527         $cpp - <testcpp.c >testcpp.out 2>&1; \
3528         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3529         echo "Hooray, it works!  I was beginning to wonder."
3530         x_cpp="$cpp"
3531         x_minus='-';
3532 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3533         $wrapper <testcpp.c >testcpp.out 2>&1; \
3534         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3535         x_cpp="$wrapper"
3536         x_minus=''
3537         echo "Eureka!"
3538 else
3539         dflt=''
3540         rp="No dice.  I can't find a C preprocessor.  Name one:"
3541         . ./myread
3542         x_cpp="$ans"
3543         x_minus=''
3544         $x_cpp <testcpp.c >testcpp.out 2>&1
3545         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3546                 echo "OK, that will do." >&4
3547         else
3548 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3549                 exit 1
3550         fi
3551 fi
3552
3553 case "$ok" in
3554 false)
3555         cppstdin="$x_cpp"
3556         cppminus="$x_minus"
3557         cpprun="$x_cpp"
3558         cpplast="$x_minus"
3559         set X $x_cpp
3560         shift
3561         case "$1" in
3562         "$cpp")
3563                 echo "Perhaps can we force $cc -E using a wrapper..."
3564                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3565                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3566                 then
3567                         echo "Yup, we can."
3568                         cppstdin="$wrapper"
3569                         cppminus='';
3570                 else
3571                         echo "Nope, we'll have to live without it..."
3572                 fi
3573                 ;;
3574         esac
3575         case "$cpprun" in
3576         "$wrapper")
3577                 cpprun=''
3578                 cpplast=''
3579                 ;;
3580         esac
3581         ;;
3582 esac
3583
3584 case "$cppstdin" in
3585 "$wrapper"|'cppstdin') ;;
3586 *) $rm -f $wrapper;;
3587 esac
3588 $rm -f testcpp.c testcpp.out
3589
3590 : Set private lib path
3591 case "$plibpth" in
3592 '') if ./mips; then
3593                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3594         fi;;
3595 esac
3596 case "$libpth" in
3597 ' ') dlist='';;
3598 '') dlist="$loclibpth $plibpth $glibpth";;
3599 *) dlist="$libpth";;
3600 esac
3601
3602 : Now check and see which directories actually exist, avoiding duplicates
3603 libpth=''
3604 for xxx in $dlist
3605 do
3606     if $test -d $xxx; then
3607                 case " $libpth " in
3608                 *" $xxx "*) ;;
3609                 *) libpth="$libpth $xxx";;
3610                 esac
3611     fi
3612 done
3613 $cat <<'EOM'
3614
3615 Some systems have incompatible or broken versions of libraries.  Among
3616 the directories listed in the question below, please remove any you
3617 know not to be holding relevant libraries, and add any that are needed.
3618 Say "none" for none.
3619
3620 EOM
3621 case "$libpth" in
3622 '') dflt='none';;
3623 *)
3624         set X $libpth
3625         shift
3626         dflt=${1+"$@"}
3627         ;;
3628 esac
3629 rp="Directories to use for library searches?"
3630 . ./myread
3631 case "$ans" in
3632 none) libpth=' ';;
3633 *) libpth="$ans";;
3634 esac
3635
3636 : compute shared library extension
3637 case "$so" in
3638 '')
3639         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3640                 dflt='sl'
3641         else
3642                 dflt='so'
3643         fi
3644         ;;
3645 *) dflt="$so";;
3646 esac
3647 $cat <<EOM
3648
3649 On some systems, shared libraries may be available.  Answer 'none' if
3650 you want to suppress searching of shared libraries for the remainder
3651 of this configuration.
3652
3653 EOM
3654 rp='What is the file extension used for shared libraries?'
3655 . ./myread
3656 so="$ans"
3657
3658 : Define several unixisms.
3659 : Hints files or command line option can be used to override them.
3660 : The convoluted testing is in case hints files set either the old
3661 : or the new name.
3662 case "$_exe" in
3663 '')     case "$exe_ext" in
3664     '') ;;
3665         *)      _exe="$exe_ext" ;;
3666         esac
3667         ;;
3668 esac
3669 case "$_a" in
3670 '')     case "$lib_ext" in
3671     '') _a='.a';;
3672         *)      _a="$lib_ext" ;;
3673         esac
3674         ;;
3675 esac
3676 case "$_o" in
3677 '') case "$obj_ext" in
3678         '')     _o='.o';;
3679         *)      _o="$obj_ext";;
3680         esac
3681         ;;
3682 esac
3683 case "$p_" in
3684 '') case "$path_sep" in
3685         '')     p_=':';;
3686         *)      p_="$path_sep";;
3687         esac
3688         ;;
3689 esac
3690 exe_ext=$_exe
3691 lib_ext=$_a
3692 obj_ext=$_o
3693 path_sep=$p_
3694
3695 : Which makefile gets called first.  This is used by make depend.
3696 case "$firstmakefile" in
3697 '') firstmakefile='makefile';;
3698 esac
3699
3700 cat <<EOM
3701
3702 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3703 Configure must be run with -Dusesocks.
3704
3705 Normally you do not need this and you should answer no.
3706
3707 EOM
3708 case "$usesocks" in
3709 $define|true|[yY]*)     dflt='y';;
3710 *) dflt='n';;
3711 esac
3712 rp='Build Perl for SOCKS?'
3713 . ./myread
3714 case "$ans" in
3715 y|Y)    val="$define" ;;     
3716 *)      val="$undef" ;;
3717 esac
3718 set usesocks
3719 eval $setvar
3720
3721 : Looking for optional libraries
3722 echo " "
3723 echo "Checking for optional libraries..." >&4
3724 case "$libs" in
3725 ' '|'') dflt='';;
3726 *) dflt="$libs";;
3727 esac
3728 case "$libswanted" in
3729 '') libswanted='c_s';;
3730 esac
3731 case "$usesocks" in
3732 $define)
3733         libswanted="$libswanted socks5 socks5_sh"
3734         ;;
3735 esac
3736 for thislib in $libswanted; do
3737         
3738         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3739                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3740                 echo "Found -l$thislib (shared)."
3741                 case " $dflt " in
3742                 *"-l$thislib "*);;
3743                 *) dflt="$dflt -l$thislib";;
3744                 esac
3745         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3746                 echo "Found -l$thislib (shared)."
3747                 case " $dflt " in
3748                 *"-l$thislib "*);;
3749                 *) dflt="$dflt -l$thislib";;
3750                 esac
3751         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3752                 echo "Found -l$thislib."
3753                 case " $dflt " in
3754                 *"-l$thislib "*);;
3755                 *) dflt="$dflt -l$thislib";;
3756                 esac
3757         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3758                 echo "Found -l$thislib."
3759                 case " $dflt " in
3760                 *"-l$thislib "*);;
3761                 *) dflt="$dflt -l$thislib";;
3762                 esac
3763         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3764                 echo "Found -l${thislib}_s."
3765                 case " $dflt " in
3766                 *"-l$thislib "*);;
3767                 *) dflt="$dflt -l${thislib}_s";;
3768                 esac
3769         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3770                 echo "Found -l$thislib."
3771                 case " $dflt " in
3772                 *"-l$thislib "*);;
3773                 *) dflt="$dflt -l$thislib";;
3774                 esac
3775         else
3776                 echo "No -l$thislib."
3777         fi
3778 done
3779 set X $dflt
3780 shift
3781 dflt="$*"
3782 case "$libs" in
3783 '') dflt="$dflt";;
3784 *) dflt="$libs";;
3785 esac
3786 case "$dflt" in
3787 ' '|'') dflt='none';;
3788 esac
3789
3790 $cat <<EOM
3791
3792 In order to compile $package on your machine, a number of libraries
3793 are usually needed.  Include any other special libraries here as well.
3794 Say "none" for none.  The default list is almost always right.
3795 EOM
3796
3797 echo " "
3798 rp="What libraries to use?"
3799 . ./myread
3800 case "$ans" in
3801 none) libs=' ';;
3802 *) libs="$ans";;
3803 esac
3804
3805 : determine optimization, if desired, or use for debug flag also
3806 case "$optimize" in
3807 ' '|$undef) dflt='none';;
3808 '') dflt='-O';;
3809 *) dflt="$optimize";;
3810 esac
3811 $cat <<EOH
3812
3813 By default, $package compiles with the -O flag to use the optimizer.
3814 Alternately, you might want to use the symbolic debugger, which uses
3815 the -g flag (on traditional Unix systems).  Either flag can be
3816 specified here.  To use neither flag, specify the word "none".
3817
3818 EOH
3819 rp="What optimizer/debugger flag should be used?"
3820 . ./myread
3821 optimize="$ans"
3822 case "$optimize" in
3823 'none') optimize=" ";;
3824 esac
3825
3826 dflt=''
3827 : We will not override a previous value, but we might want to
3828 : augment a hint file
3829 case "$hint" in
3830 default|recommended)
3831         case "$gccversion" in
3832         1*) dflt='-fpcc-struct-return' ;;
3833         esac
3834         case "$optimize" in
3835         *-g*) dflt="$dflt -DDEBUGGING";;
3836         esac
3837         case "$gccversion" in
3838         2*) if test -d /etc/conf/kconfig.d &&
3839                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3840                 then
3841                         dflt="$dflt -posix"
3842                 fi
3843                 ;;
3844         esac
3845         case "$gccversion" in
3846         1*) ;;
3847         2.[0-8]*) ;;
3848         ?*)     echo " "
3849                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3850                 echo 'int main(void) { return 0; }' > gcctest.c
3851                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3852                         echo "Yes, it does." 2>&1
3853                         case "$ccflags" in
3854                         *strict-aliasing*) 
3855                                 echo "Leaving current flags $ccflags alone." 2>&1
3856                                 ;;
3857                         *) dflt="$dflt -fno-strict-aliasing" ;;
3858                         esac
3859                 else
3860                         echo "Nope, it doesn't, but that's ok." 2>&1
3861                 fi
3862                 ;;
3863         esac
3864         ;;
3865 esac
3866
3867 case "$mips_type" in
3868 *BSD*|'') inclwanted="$locincpth $usrinc";;
3869 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3870 esac
3871 for thisincl in $inclwanted; do
3872         if $test -d $thisincl; then
3873                 if $test x$thisincl != x$usrinc; then
3874                         case "$dflt" in
3875                         *$thisincl*);;
3876                         *) dflt="$dflt -I$thisincl";;
3877                         esac
3878                 fi
3879         fi
3880 done
3881
3882 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3883         xxx=true;
3884 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3885         xxx=true;
3886 else
3887         xxx=false;
3888 fi;
3889 if $xxx; then
3890         case "$dflt" in
3891         *$2*);;
3892         *) dflt="$dflt -D$2";;
3893         esac;
3894 fi'
3895
3896 set signal.h LANGUAGE_C; eval $inctest
3897
3898 case "$usesocks" in
3899 $define)
3900         ccflags="$ccflags -DSOCKS"
3901         ;;
3902 esac
3903
3904 case "$hint" in
3905 default|recommended) dflt="$ccflags $dflt" ;;
3906 *) dflt="$ccflags";;
3907 esac
3908
3909 case "$dflt" in
3910 ''|' ') dflt=none;;
3911 esac
3912 $cat <<EOH
3913
3914 Your C compiler may want other flags.  For this question you should include
3915 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3916 but you should NOT include libraries or ld flags like -lwhatever.  If you
3917 want $package to honor its debug switch, you should include -DDEBUGGING here.
3918 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3919
3920 To use no flags, specify the word "none".
3921
3922 EOH
3923 set X $dflt
3924 shift
3925 dflt=${1+"$@"}
3926 rp="Any additional cc flags?"
3927 . ./myread
3928 case "$ans" in
3929 none) ccflags='';;
3930 *) ccflags="$ans";;
3931 esac
3932
3933 : the following weeds options from ccflags that are of no interest to cpp
3934 cppflags="$ccflags"
3935 case "$gccversion" in
3936 1*) cppflags="$cppflags -D__GNUC__"
3937 esac
3938 case "$mips_type" in
3939 '');;
3940 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3941 esac
3942 case "$cppflags" in
3943 '');;
3944 *)
3945         echo " "
3946         echo "Let me guess what the preprocessor flags are..." >&4
3947         set X $cppflags
3948         shift
3949         cppflags=''
3950         $cat >cpp.c <<'EOM'
3951 #define BLURFL foo
3952
3953 BLURFL xx LFRULB
3954 EOM
3955         previous=''
3956         for flag in $*
3957         do
3958                 case "$flag" in
3959                 -*) ftry="$flag";;
3960                 *) ftry="$previous $flag";;
3961                 esac
3962                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3963                         >cpp1.out 2>/dev/null && \
3964                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3965                         >cpp2.out 2>/dev/null && \
3966                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3967                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3968                 then
3969                         cppflags="$cppflags $ftry"
3970                         previous=''
3971                 else
3972                         previous="$flag"
3973                 fi
3974         done
3975         set X $cppflags
3976         shift
3977         cppflags=${1+"$@"}
3978         case "$cppflags" in
3979         *-*)  echo "They appear to be: $cppflags";;
3980         esac
3981         $rm -f cpp.c cpp?.out
3982         ;;
3983 esac
3984
3985 : flags used in final linking phase
3986 case "$ldflags" in
3987 '') if ./venix; then
3988                 dflt='-i -z'
3989         else
3990                 dflt=''
3991         fi
3992         case "$ccflags" in
3993         *-posix*) dflt="$dflt -posix" ;;
3994         esac
3995         ;;
3996 *) dflt="$ldflags";;
3997 esac
3998
3999 : Try to guess additional flags to pick up local libraries.
4000 for thislibdir in $libpth; do
4001         case " $loclibpth " in
4002         *" $thislibdir "*)
4003                 case "$dflt " in 
4004                 *"-L$thislibdir "*) ;;
4005                 *)  dflt="$dflt -L$thislibdir" ;;
4006                 esac
4007                 ;;
4008         esac
4009 done
4010
4011 case "$dflt" in
4012 '') dflt='none' ;;
4013 esac
4014
4015 $cat <<EOH
4016
4017 Your C linker may need flags.  For this question you should
4018 include -L/whatever and any other flags used by the C linker, but you
4019 should NOT include libraries like -lwhatever.
4020
4021 Make sure you include the appropriate -L/path flags if your C linker
4022 does not normally search all of the directories you specified above,
4023 namely
4024         $libpth
4025 To use no flags, specify the word "none".
4026
4027 EOH
4028
4029 rp="Any additional ld flags (NOT including libraries)?"
4030 . ./myread
4031 case "$ans" in
4032 none) ldflags='';;
4033 *) ldflags="$ans";;
4034 esac
4035 rmlist="$rmlist pdp11"
4036
4037 : coherency check
4038 echo " "
4039 echo "Checking your choice of C compiler and flags for coherency..." >&4
4040 $cat > try.c <<'EOF'
4041 #include <stdio.h>
4042 int main() { printf("Ok\n"); exit(0); }
4043 EOF
4044 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4045 shift
4046 $cat >try.msg <<'EOM'
4047 I've tried to compile and run the following simple program:
4048
4049 EOM
4050 $cat try.c >> try.msg
4051
4052 $cat >> try.msg <<EOM
4053
4054 I used the command:
4055
4056         $*
4057         ./try
4058
4059 and I got the following output:
4060
4061 EOM
4062 dflt=y
4063 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4064         if sh -c './try' >>try.msg 2>&1; then
4065                 xxx=`./try`
4066                 case "$xxx" in
4067                 "Ok") dflt=n ;;
4068                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4069                         case " $libs " in
4070                         *" -lsfio "*)
4071                                 cat >> try.msg <<'EOQS'
4072 If $libs contains -lsfio, and sfio is mis-configured, then it
4073 sometimes (apparently) runs and exits with a 0 status, but with no
4074 output!  It may have to do with sfio's use of _exit vs. exit.
4075
4076 EOQS
4077                                 rp="You have a big problem.  Shall I abort Configure"
4078                                 dflt=y
4079                                 ;;
4080                         esac
4081                         ;;
4082                 esac
4083         else
4084                 echo "The program compiled OK, but exited with status $?." >>try.msg
4085                 rp="You have a problem.  Shall I abort Configure"
4086                 dflt=y
4087         fi
4088 else
4089         echo "I can't compile the test program." >>try.msg
4090         rp="You have a BIG problem.  Shall I abort Configure"
4091         dflt=y
4092 fi
4093 case "$dflt" in
4094 y)
4095         $cat try.msg >&4
4096         case "$knowitall" in
4097         '')
4098                 echo "(The supplied flags or libraries might be incorrect.)"
4099                 ;;
4100         *) dflt=n;;
4101         esac
4102         echo " "
4103         . ./myread
4104         case "$ans" in
4105         n*|N*) ;;
4106         *)      echo "Ok.  Stopping Configure." >&4
4107                 exit 1
4108                 ;;
4109         esac
4110         ;;
4111 n) echo "OK, that should do.";;
4112 esac
4113 $rm -f try try.* core
4114
4115 : define an is-a-typedef? function
4116 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4117 case "$inclist" in
4118 "") inclist="sys/types.h";;
4119 esac;
4120 eval "varval=\$$var";
4121 case "$varval" in
4122 "")
4123         $rm -f temp.c;
4124         for inc in $inclist; do
4125                 echo "#include <$inc>" >>temp.c;
4126         done;
4127         echo "#ifdef $type" >> temp.c;
4128         echo "printf(\"We have $type\");" >> temp.c;
4129         echo "#endif" >> temp.c;
4130         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4131         if $contains $type temp.E >/dev/null 2>&1; then
4132                 eval "$var=\$type";
4133         else
4134                 eval "$var=\$def";
4135         fi;
4136         $rm -f temp.?;;
4137 *) eval "$var=\$varval";;
4138 esac'
4139
4140 : define an is-a-typedef? function that prompts if the type is not available.
4141 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4142 case "$inclist" in
4143 "") inclist="sys/types.h";;
4144 esac;
4145 eval "varval=\$$var";
4146 case "$varval" in
4147 "")
4148         $rm -f temp.c;
4149         for inc in $inclist; do
4150                 echo "#include <$inc>" >>temp.c;
4151         done;
4152         echo "#ifdef $type" >> temp.c;
4153         echo "printf(\"We have $type\");" >> temp.c;
4154         echo "#endif" >> temp.c;
4155         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4156         echo " " ;
4157         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4158         if $contains $type temp.E >/dev/null 2>&1; then
4159                 echo "$type found." >&4;
4160                 eval "$var=\$type";
4161         else
4162                 echo "$type NOT found." >&4;
4163                 dflt="$def";
4164                 . ./myread ;
4165                 eval "$var=\$ans";
4166         fi;
4167         $rm -f temp.?;;
4168 *) eval "$var=\$varval";;
4169 esac'
4170
4171 : define a shorthand compile call
4172 compile='
4173 mc_file=$1;
4174 shift;
4175 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4176 : define a shorthand compile call for compilations that should be ok.
4177 compile_ok='
4178 mc_file=$1;
4179 shift;
4180 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4181
4182 : check for lengths of integral types
4183 echo " "
4184 case "$intsize" in
4185 '')
4186         echo "Checking to see how big your integers are..." >&4
4187         $cat >intsize.c <<'EOCP'
4188 #include <stdio.h>
4189 int main()
4190 {
4191         printf("intsize=%d;\n", (int)sizeof(int));
4192         printf("longsize=%d;\n", (int)sizeof(long));
4193         printf("shortsize=%d;\n", (int)sizeof(short));
4194         exit(0);
4195 }
4196 EOCP
4197         set intsize
4198         if eval $compile_ok && ./intsize > /dev/null; then
4199                 eval `./intsize`
4200                 echo "Your integers are $intsize bytes long."
4201                 echo "Your long integers are $longsize bytes long."
4202                 echo "Your short integers are $shortsize bytes long."
4203         else
4204                 $cat >&4 <<EOM
4205 !
4206 Help! I can't compile and run the intsize test program: please enlighten me!
4207 (This is probably a misconfiguration in your system or libraries, and
4208 you really ought to fix it.  Still, I'll try anyway.)
4209 !
4210 EOM
4211                 dflt=4
4212                 rp="What is the size of an integer (in bytes)?"
4213                 . ./myread
4214                 intsize="$ans"
4215                 dflt=$intsize
4216                 rp="What is the size of a long integer (in bytes)?"
4217                 . ./myread
4218                 longsize="$ans"
4219                 dflt=2
4220                 rp="What is the size of a short integer (in bytes)?"
4221                 . ./myread
4222                 shortsize="$ans"
4223         fi
4224         ;;
4225 esac
4226 $rm -f intsize intsize.*
4227
4228 : see what type lseek is declared as in the kernel
4229 rp="What is the type used for lseek's offset on this system?"
4230 set off_t lseektype long stdio.h sys/types.h
4231 eval $typedef_ask
4232
4233 echo " "
4234 $echo $n "Checking to see how big your file offsets are...$c" >&4
4235 $cat >try.c <<EOCP
4236 #include <sys/types.h>
4237 #include <stdio.h>
4238 int main()
4239 {
4240     printf("%d\n", (int)sizeof($lseektype));
4241     return(0); 
4242 }
4243 EOCP
4244 set try
4245 if eval $compile_ok; then
4246         lseeksize=`./try`
4247         $echo " $lseeksize bytes." >&4
4248 else
4249         dflt=$longsize
4250         echo " "
4251         echo "(I can't seem to compile the test program.  Guessing...)"
4252         rp="What is the size of your file offsets (in bytes)?"
4253         . ./myread
4254         lseeksize="$ans"
4255 fi
4256 $rm -f try.c try
4257
4258 : see what type file positions are declared as in the library
4259 rp="What is the type for file position used by fsetpos()?"
4260 set fpos_t fpostype long stdio.h sys/types.h
4261 eval $typedef_ask
4262
4263 echo " "
4264 case "$fpostype" in
4265 *_t) zzz="$fpostype"    ;;
4266 *)   zzz="fpos_t"       ;;
4267 esac
4268 $echo $n "Checking the size of $zzz...$c" >&4 
4269 cat > try.c <<EOCP
4270 #include <sys/types.h>
4271 #include <stdio.h>
4272 int main() {
4273     printf("%d\n", (int)sizeof($fpostype));
4274     exit(0);
4275 }
4276 EOCP
4277 set try
4278 if eval $compile_ok; then
4279         yyy=`./try`
4280         case "$yyy" in
4281         '')     fpossize=4
4282                 echo " "
4283                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4284                 ;;
4285         *)      fpossize=$yyy
4286                 echo " $fpossize bytes."
4287                 ;;
4288         esac
4289 else
4290         dflt="$longsize"
4291         echo " "
4292         echo "(I can't compile the test program.  Guessing...)" >&4
4293         rp="What is the size of your file positions (in bytes)?"
4294         . ./myread
4295         fpossize="$ans"
4296 fi
4297
4298
4299
4300 case "$lseeksize:$fpossize" in
4301 8:8) cat <<EOM
4302
4303 You can have files larger than 2 gigabytes.
4304 EOM
4305    val="$define" ;;
4306 *) cat <<EOM
4307
4308 Perl can be built to understand large files (files larger than 2 gigabytes)
4309 on some systems.  To do so, Configure must be run with -Duselargefiles.
4310
4311 If this doesn't make any sense to you, just accept the default 'y'.
4312 EOM
4313    case "$uselargefiles" in
4314    "$undef"|false|[nN]*) dflt='n' ;;
4315    *)   dflt='y' ;;
4316    esac
4317    rp='Try to understand large files, if available?'
4318    . ./myread
4319    case "$ans" in
4320    y|Y)         val="$define" ;;
4321    *)           val="$undef"  ;;
4322    esac
4323    ;;
4324 esac
4325 set uselargefiles
4326 eval $setvar
4327 case "$uselargefiles" in
4328 "$define")
4329 : Look for a hint-file generated 'call-back-unit'.  If the
4330 : user has specified that a large files perl is to be built,
4331 : we may need to set or change some other defaults.
4332         if $test -f uselfs.cbu; then
4333                 echo "Your platform has some specific hints for large file builds, using them..."
4334                 . ./uselfs.cbu
4335                 echo " "
4336                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4337                 $cat >try.c <<EOCP
4338 #include <sys/types.h>
4339 #include <stdio.h>
4340 int main()
4341 {
4342     printf("%d\n", (int)sizeof($lseektype));
4343     return(0); 
4344 }
4345 EOCP
4346                 set try
4347                 if eval $compile_ok; then
4348                         lseeksize=`./try`
4349                         $echo " $lseeksize bytes." >&4
4350                 else
4351                         dflt="$lseeksize"
4352                         echo " "
4353                         echo "(I can't seem to compile the test program.  Guessing...)"
4354                         rp="What is the size of your file offsets (in bytes)?"
4355                         . ./myread
4356                         lseeksize="$ans"
4357                 fi
4358                 case "$fpostype" in
4359                 *_t) zzz="$fpostype"    ;;
4360                 *)   zzz="fpos_t"       ;;
4361                 esac
4362                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4363                 $cat > try.c <<EOCP
4364 #include <sys/types.h>
4365 #include <stdio.h>
4366 int main() {
4367     printf("%d\n", (int)sizeof($fpostype));
4368     exit(0);
4369 }
4370 EOCP
4371                 set try
4372                 if eval $compile_ok; then
4373                         yyy=`./try`
4374                         dflt="$lseeksize"
4375                         case "$yyy" in
4376                         '')     echo " "
4377                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4378                                 ;;
4379                         *)      fpossize=$yyy
4380                                 echo " $fpossize bytes."
4381                                 ;;
4382                         esac
4383                 else
4384                         dflt="$fpossize"
4385                         echo " "
4386                         echo "(I can't compile the test program.  Guessing...)" >&4
4387                         rp="What is the size of your file positions (in bytes)?"
4388                         . ./myread
4389                         fpossize="$ans"
4390                 fi
4391                 $rm -f try.c try
4392         fi
4393         ;;
4394 esac
4395
4396
4397 case "$usemorebits" in
4398 "$define"|true|[yY]*)
4399         use64bits="$define"
4400         uselongdouble="$define"
4401         usemorebits="$define"
4402         ;;
4403 *)      usemorebits="$undef"
4404         ;;
4405 esac
4406
4407
4408 case "$intsize:$longsize" in
4409 8:*|*:8) cat <<EOM
4410
4411 You have natively 64-bit integers.
4412 EOM
4413    val="$define" ;;
4414 *) cat <<EOM
4415
4416 Perl can be built to take advantage of 64-bit integer types
4417 on some systems.  To do so, Configure must be run with -Duse64bits.
4418
4419 If this doesn't make any sense to you, just accept the default.
4420 EOM
4421   case "$use64bits" in
4422   $define|true|[yY]*)   dflt='y';;
4423   *) dflt='n';;
4424   esac
4425   rp='Try to use 64-bit integers, if available?'
4426   . ./myread
4427   case "$ans" in
4428   y|Y) val="$define" ;;
4429   *)   val="$undef"  ;;
4430   esac
4431   ;;
4432 esac
4433 set use64bits
4434 eval $setvar
4435
4436 case "$archname64" in
4437 '') archname64='' ;;    # not a typo
4438 esac
4439
4440 case "$use64bits" in
4441 "$define"|true|[yY]*)
4442 : Look for a hint-file generated 'call-back-unit'.  If the
4443 : user has specified that a 64-bit perl is to be built,
4444 : we may need to set or change some other defaults.
4445         if $test -f use64bits.cbu; then
4446                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4447                 . ./use64bits.cbu
4448         else
4449                 $cat <<EOM
4450 (Your platform doesn't have any specific hints for 64-bit builds.)
4451 EOM
4452                 case "$intsize:$longsize" in
4453 8:*|*:8) cat <<EOM
4454 (This is probably okay, as your system is a natively 64-bit system.)
4455 EOM
4456                   ;;
4457                 esac
4458                 case "$gccversion" in
4459                 '')     ;;
4460                 *)      case "$ccflags" in
4461                         *-DUSE_LONG_LONG*) ;;
4462                         *) $cat <<EOM
4463 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4464 to the compilation flags.
4465 EOM
4466                            ccflags="$ccflags -DUSE_LONG_LONG"
4467                            ;;
4468                         esac
4469                         ;;
4470                 esac
4471         fi
4472         ;;
4473 esac
4474
4475 : determine the architecture name
4476 echo " "
4477 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4478         tarch=`arch`"-$osname"
4479 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4480         if uname -m > tmparch 2>&1 ; then
4481                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4482                         -e 's/$/'"-$osname/" tmparch`
4483         else
4484                 tarch="$osname"
4485         fi
4486         $rm -f tmparch
4487 else
4488         tarch="$osname"
4489 fi
4490 case "$myarchname" in
4491 ''|"$tarch") ;;
4492 *)
4493         echo "(Your architecture name used to be $myarchname.)"
4494         archname=''
4495         ;;
4496 esac
4497 myarchname="$tarch"
4498 case "$archname" in
4499 '') dflt="$tarch";;
4500 *) dflt="$archname";;
4501 esac
4502 rp='What is your architecture name'
4503 . ./myread
4504 archname="$ans"
4505 case "$usethreads" in
4506 $define)
4507         echo "Threads selected." >&4
4508         case "$archname" in
4509         *-thread*) echo "...and architecture name already has -thread." >&4
4510                 ;;
4511         *)      archname="$archname-thread"
4512                 echo "...setting architecture name to $archname." >&4
4513                 ;;
4514         esac
4515         ;;
4516 esac
4517 case "$usemultiplicity" in
4518 $define)
4519         echo "Multiplicity selected." >&4
4520         case "$archname" in
4521         *-multi*) echo "...and architecture name already has -multi." >&4
4522                 ;;
4523         *)      archname="$archname-multi"
4524                 echo "...setting architecture name to $archname." >&4
4525                 ;;
4526         esac
4527         ;;
4528 esac
4529 case "$use64bits" in
4530 $define)
4531         case "$archname64" in
4532         '')
4533                 ;;
4534         *)
4535                 case "$archname" in
4536                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4537                         ;;
4538                 *)      archname="$archname-$archname64"
4539                         echo "...setting architecture name to $archname." >&4
4540                         ;;
4541                 esac
4542                 ;;
4543         esac
4544 esac
4545
4546 : determine root of directory hierarchy where package will be installed.
4547 case "$prefix" in
4548 '')
4549         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4550         ;;
4551 *)
4552         dflt="$prefix"
4553         ;;
4554 esac
4555 $cat <<EOM
4556
4557 By default, $package will be installed in $dflt/bin, manual pages
4558 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4559 installation directories. Typically this is something like /usr/local.
4560 If you wish to have binaries under /usr/bin but other parts of the
4561 installation under /usr/local, that's ok: you will be prompted
4562 separately for each of the installation directories, the prefix being
4563 only used to set the defaults.
4564
4565 EOM
4566 fn=d~
4567 rp='Installation prefix to use?'
4568 . ./getfile
4569 oldprefix=''
4570 case "$prefix" in
4571 '') ;;
4572 *)
4573         case "$ans" in
4574         "$prefix") ;;
4575         *) oldprefix="$prefix";;
4576         esac
4577         ;;
4578 esac
4579 prefix="$ans"
4580 prefixexp="$ansexp"
4581
4582 : is AFS running?
4583 echo " "
4584 case "$afs" in
4585 $define|true)   afs=true ;;
4586 $undef|false)   afs=false ;;
4587 *)      if test -d /afs; then
4588                 afs=true
4589         else
4590                 afs=false
4591         fi
4592         ;;
4593 esac
4594 if $afs; then
4595         echo "AFS may be running... I'll be extra cautious then..." >&4
4596 else
4597         echo "AFS does not seem to be running..." >&4
4598 fi
4599
4600 : determine installation prefix for where package is to be installed.
4601 if $afs; then 
4602 $cat <<EOM
4603
4604 Since you are running AFS, I need to distinguish the directory in which
4605 files will reside from the directory in which they are installed (and from
4606 which they are presumably copied to the former directory by occult means).
4607
4608 EOM
4609         case "$installprefix" in
4610         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4611         *) dflt="$installprefix";;
4612         esac
4613 else
4614 $cat <<EOM
4615
4616 In some special cases, particularly when building $package for distribution,
4617 it is convenient to distinguish between the directory in which files should 
4618 be installed from the directory ($prefix) in which they 
4619 will eventually reside.  For most users, these two directories are the same.
4620
4621 EOM
4622         case "$installprefix" in
4623         '') dflt=$prefix ;;
4624         *) dflt=$installprefix;;
4625         esac
4626 fi
4627 fn=d~
4628 rp='What installation prefix should I use for installing files?'
4629 . ./getfile
4630 installprefix="$ans"
4631 installprefixexp="$ansexp"
4632
4633 : set the prefixit variable, to compute a suitable default value
4634 prefixit='case "$3" in
4635 ""|none)
4636         case "$oldprefix" in
4637         "") eval "$1=\"\$$2\"";;
4638         *)
4639                 case "$3" in
4640                 "") eval "$1=";;
4641                 none)
4642                         eval "tp=\"\$$2\"";
4643                         case "$tp" in
4644                         ""|" ") eval "$1=\"\$$2\"";;
4645                         *) eval "$1=";;
4646                         esac;;
4647                 esac;;
4648         esac;;
4649 *)
4650         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4651         case "$tp" in
4652         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4653         /*-$oldprefix/*|\~*-$oldprefix/*)
4654                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4655         *) eval "$1=\"\$$2\"";;
4656         esac;;
4657 esac'
4658
4659 : set the base revision
4660 baserev=5.0
4661
4662
4663 : get the patchlevel
4664 echo " "
4665 echo "Getting the current patchlevel..." >&4
4666 if $test -r $rsrc/patchlevel.h;then
4667         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4668         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4669         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4670         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4671         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4672 else
4673         patchlevel=0
4674         subversion=0
4675         api_revision=0
4676         api_version=0
4677         api_subversion=0
4678 fi
4679 $echo $n "(You have $package" $c
4680 case "$package" in
4681 "*$baserev")    ;;
4682 *)              $echo $n " $baserev" $c ;;
4683 esac
4684 $echo $n " patchlevel $patchlevel" $c
4685 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4686 echo ".)"
4687 case "$osname" in
4688 dos|cygwin|vms|win32)
4689         : XXX Should be a Configure test for double-dots in filenames.
4690         version=`echo $baserev $patchlevel $subversion | \
4691                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4692         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4693                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4694         ;;
4695 *)
4696         version=`echo $baserev $patchlevel $subversion | \
4697                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4698         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4699                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4700         ;;
4701 esac
4702 : Special case the 5.005_xx maintenance series, which used 5.005
4703 : without any subversion label as a subdirectory in $sitelib
4704 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4705         api_versionstring='5.005'
4706 fi
4707
4708 : determine installation style
4709 : For now, try to deduce it from prefix unless it is already set.
4710 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4711 case "$installstyle" in
4712 '')     case "$prefix" in
4713                 *perl*) dflt='lib';;
4714                 *) dflt='lib/perl5' ;;
4715         esac
4716         ;;
4717 *)      dflt='lib/perl5' ;;
4718 esac
4719 : Probably not worth prompting for this since we prompt for all
4720 : the directories individually, and the prompt would be too long and
4721 : confusing anyway.
4722 installstyle=$dflt
4723
4724 : determine where private library files go
4725 : Usual default is /usr/local/lib/perl5/$version.
4726 : Also allow things like /opt/perl/lib/$version, since 
4727 : /opt/perl/lib/perl5... would be redundant.
4728 : The default "style" setting is made in installstyle.U
4729 case "$installstyle" in
4730 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4731 *)       set dflt privlib lib/$version ;;
4732 esac
4733 eval $prefixit
4734 $cat <<EOM
4735
4736 There are some auxiliary files for $package that need to be put into a
4737 private library directory that is accessible by everyone.
4738
4739 EOM
4740 fn=d~+
4741 rp='Pathname where the private library files will reside?'
4742 . ./getfile
4743 privlib="$ans"
4744 privlibexp="$ansexp"
4745 : Change installation prefix, if necessary.
4746 if $test X"$prefix" != X"$installprefix"; then
4747         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4748 else
4749         installprivlib="$privlibexp"
4750 fi
4751
4752 : set the prefixup variable, to restore leading tilda escape
4753 prefixup='case "$prefixexp" in
4754 "$prefix") ;;
4755 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4756 esac'
4757
4758 : determine where public architecture dependent libraries go
4759 set archlib archlib
4760 eval $prefixit
4761 : privlib default is /usr/local/lib/$package/$version
4762 : archlib default is /usr/local/lib/$package/$version/$archname
4763 : privlib may have an optional trailing /share.
4764 tdflt=`echo $privlib | $sed 's,/share$,,'`
4765 tdflt=$tdflt/$archname
4766 case "$archlib" in
4767 '')     dflt=$tdflt
4768         ;;
4769 *)      dflt="$archlib"
4770     ;;
4771 esac
4772 $cat <<EOM
4773
4774 $spackage contains architecture-dependent library files.  If you are
4775 sharing libraries in a heterogeneous environment, you might store
4776 these files in a separate location.  Otherwise, you can just include
4777 them with the rest of the public library files.
4778
4779 EOM
4780 fn=d+~
4781 rp='Where do you want to put the public architecture-dependent libraries?'
4782 . ./getfile
4783 archlib="$ans"
4784 archlibexp="$ansexp"
4785 if $test X"$archlib" = X"$privlib"; then
4786         d_archlib="$undef"
4787 else
4788         d_archlib="$define"
4789 fi
4790 : Change installation prefix, if necessary.
4791 if $test X"$prefix" != X"$installprefix"; then
4792         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4793 else
4794         installarchlib="$archlibexp"
4795 fi
4796
4797
4798 : Binary compatibility with 5.005 is not possible for builds
4799 : with advanced features
4800 case "$usethreads$usemultiplicity" in
4801 *define*)
4802         bincompat5005="$undef"
4803         d_bincompat5005="$undef"
4804         ;;
4805 *)      $cat <<EOM
4806
4807 Perl 5.006 can be compiled for binary compatibility with 5.005.
4808 If you decide to do so, you will be able to continue using most
4809 of the extensions that were compiled for Perl 5.005.
4810
4811 EOM
4812         case "$bincompat5005$d_bincompat5005" in
4813         *"$undef"*) dflt=n ;;
4814         *) dflt=y ;;
4815         esac
4816         rp='Binary compatibility with Perl 5.005?'
4817         . ./myread
4818         case "$ans" in
4819         y*) val="$define" ;;
4820         *)  val="$undef" ;;
4821         esac
4822         set d_bincompat5005
4823         eval $setvar
4824         case "$d_bincompat5005" in
4825         "$define")
4826                 bincompat5005="$define"
4827                 ;;
4828         *)      bincompat5005="$undef"
4829                 d_bincompat5005="$undef"
4830                 ;;
4831         esac
4832         ;;
4833 esac
4834
4835
4836 : see if setuid scripts can be secure
4837 $cat <<EOM
4838
4839 Some kernels have a bug that prevents setuid #! scripts from being
4840 secure.  Some sites have disabled setuid #! scripts because of this.
4841
4842 First let's decide if your kernel supports secure setuid #! scripts.
4843 (If setuid #! scripts would be secure but have been disabled anyway,
4844 don't say that they are secure if asked.)
4845
4846 EOM
4847
4848 val="$undef"
4849 if $test -d /dev/fd; then
4850         echo "#!$ls" >reflect
4851         chmod +x,u+s reflect
4852         ./reflect >flect 2>&1
4853         if $contains "/dev/fd" flect >/dev/null; then
4854                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4855                 val="$define"
4856         else
4857                 $cat <<EOM
4858 If you are not sure if they are secure, I can check but I'll need a
4859 username and password different from the one you are using right now.
4860 If you don't have such a username or don't want me to test, simply
4861 enter 'none'.
4862
4863 EOM
4864                 rp='Other username to test security of setuid scripts with?'
4865                 dflt='none'
4866                 . ./myread
4867                 case "$ans" in
4868                 n|none)
4869                         case "$d_suidsafe" in
4870                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4871                                 dflt=n;;
4872                         "$undef")
4873                                 echo "Well, the $hint value is *not* secure." >&4
4874                                 dflt=n;;
4875                         *)      echo "Well, the $hint value *is* secure." >&4
4876                                 dflt=y;;
4877                         esac
4878                         ;;
4879                 *)
4880                         $rm -f reflect flect
4881                         echo "#!$ls" >reflect
4882                         chmod +x,u+s reflect
4883                         echo >flect
4884                         chmod a+w flect
4885                         echo '"su" will (probably) prompt you for '"$ans's password."
4886                         su $ans -c './reflect >flect'
4887                         if $contains "/dev/fd" flect >/dev/null; then
4888                                 echo "Okay, it looks like setuid scripts are secure." >&4
4889                                 dflt=y
4890                         else
4891                                 echo "I don't think setuid scripts are secure." >&4
4892                                 dflt=n
4893                         fi
4894                         ;;
4895                 esac
4896                 rp='Does your kernel have *secure* setuid scripts?'
4897                 . ./myread
4898                 case "$ans" in
4899                 [yY]*)  val="$define";;
4900                 *)      val="$undef";;
4901                 esac
4902         fi
4903 else
4904         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4905         echo "(That's for file descriptors, not floppy disks.)"
4906         val="$undef"
4907 fi
4908 set d_suidsafe
4909 eval $setvar
4910
4911 $rm -f reflect flect
4912
4913 : now see if they want to do setuid emulation
4914 echo " "
4915 val="$undef"
4916 case "$d_suidsafe" in
4917 "$define")
4918         val="$undef"
4919         echo "No need to emulate SUID scripts since they are secure here." >& 4
4920         ;;
4921 *)
4922         $cat <<EOM
4923 Some systems have disabled setuid scripts, especially systems where
4924 setuid scripts cannot be secure.  On systems where setuid scripts have
4925 been disabled, the setuid/setgid bits on scripts are currently
4926 useless.  It is possible for $package to detect those bits and emulate
4927 setuid/setgid in a secure fashion.  This emulation will only work if
4928 setuid scripts have been disabled in your kernel.
4929
4930 EOM
4931         case "$d_dosuid" in
4932         "$define") dflt=y ;;
4933         *) dflt=n ;;
4934         esac
4935         rp="Do you want to do setuid/setgid emulation?"
4936         . ./myread
4937         case "$ans" in
4938         [yY]*)  val="$define";;
4939         *)      val="$undef";;
4940         esac
4941         ;;
4942 esac
4943 set d_dosuid
4944 eval $setvar
4945
4946 : determine filename position in cpp output
4947 echo " "
4948 echo "Computing filename position in cpp output for #include directives..." >&4
4949 echo '#include <stdio.h>' > foo.c
4950 $cat >fieldn <<EOF
4951 $startsh
4952 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4953 $grep '^[       ]*#.*stdio\.h' | \
4954 while read cline; do
4955         pos=1
4956         set \$cline
4957         while $test \$# -gt 0; do
4958                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4959                         echo "\$pos"
4960                         exit 0
4961                 fi
4962                 shift
4963                 pos=\`expr \$pos + 1\`
4964         done
4965 done
4966 EOF
4967 chmod +x fieldn
4968 fieldn=`./fieldn`
4969 $rm -f foo.c fieldn
4970 case $fieldn in
4971 '') pos='???';;
4972 1) pos=first;;
4973 2) pos=second;;
4974 3) pos=third;;
4975 *) pos="${fieldn}th";;
4976 esac
4977 echo "Your cpp writes the filename in the $pos field of the line."
4978
4979 : locate header file
4980 $cat >findhdr <<EOF
4981 $startsh
4982 wanted=\$1
4983 name=''
4984 for usrincdir in $usrinc
4985 do
4986         if test -f \$usrincdir/\$wanted; then
4987                 echo "\$usrincdir/\$wanted"
4988                 exit 0
4989         fi
4990 done
4991 awkprg='{ print \$$fieldn }'
4992 echo "#include <\$wanted>" > foo\$\$.c
4993 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4994 $grep "^[       ]*#.*\$wanted" | \
4995 while read cline; do
4996         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4997         case "\$name" in
4998         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4999         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5000         *) exit 2;;
5001         esac;
5002 done;
5003 #
5004 # status = 0: grep returned 0 lines, case statement not executed
5005 # status = 1: headerfile found
5006 # status = 2: while loop executed, no headerfile found
5007 #
5008 status=\$?
5009 $rm -f foo\$\$.c;
5010 if test \$status -eq 1; then
5011         exit 0;
5012 fi
5013 exit 1
5014 EOF
5015 chmod +x findhdr
5016
5017 : define an alternate in-header-list? function
5018 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5019 cont=true; xxf="echo \"<\$1> found.\" >&4";
5020 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5021 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5022 esac;
5023 case $# in 4) instead=instead;; *) instead="at last";; esac;
5024 while $test "$cont"; do
5025         xxx=`./findhdr $1`
5026         var=$2; eval "was=\$$2";
5027         if $test "$xxx" && $test -r "$xxx";
5028         then eval $xxf;
5029         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5030                 cont="";
5031         else eval $xxnf;
5032         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5033         set $yyy; shift; shift; yyy=$@;
5034         case $# in 0) cont="";;
5035         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5036                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5037         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5038                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5039         esac;
5040 done;
5041 while $test "$yyy";
5042 do set $yyy; var=$2; eval "was=\$$2";
5043         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5044         set $yyy; shift; shift; yyy=$@;
5045 done'
5046
5047 : see if this is a malloc.h system
5048 set malloc.h i_malloc
5049 eval $inhdr
5050
5051 : see if stdlib is available
5052 set stdlib.h i_stdlib
5053 eval $inhdr
5054
5055 : determine which malloc to compile in
5056 echo " "
5057 case "$usemymalloc" in
5058 ''|[yY]*|true|$define)  dflt='y' ;;
5059 *)      dflt='n' ;;
5060 esac
5061 rp="Do you wish to attempt to use the malloc that comes with $package?"
5062 . ./myread
5063 usemymalloc="$ans"
5064 case "$ans" in
5065 y*|true)
5066         usemymalloc='y'
5067         mallocsrc='malloc.c'
5068         mallocobj="malloc$_o"
5069         d_mymalloc="$define"
5070         case "$libs" in
5071         *-lmalloc*)
5072                 : Remove malloc from list of libraries to use
5073                 echo "Removing unneeded -lmalloc from library list" >&4
5074                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5075                 shift
5076                 libs="$*"
5077                 echo "libs = $libs" >&4
5078                 ;;
5079         esac
5080         ;;
5081 *)
5082         usemymalloc='n'
5083         mallocsrc=''
5084         mallocobj=''
5085         d_mymalloc="$undef"
5086         ;;
5087 esac
5088
5089 : compute the return types of malloc and free
5090 echo " "
5091 $cat >malloc.c <<END
5092 #$i_malloc I_MALLOC
5093 #$i_stdlib I_STDLIB
5094 #include <stdio.h>
5095 #include <sys/types.h>
5096 #ifdef I_MALLOC
5097 #include <malloc.h>
5098 #endif
5099 #ifdef I_STDLIB
5100 #include <stdlib.h>
5101 #endif
5102 #ifdef TRY_MALLOC
5103 void *malloc();
5104 #endif
5105 #ifdef TRY_FREE
5106 void free();
5107 #endif
5108 END
5109 case "$malloctype" in
5110 '')
5111         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5112                 malloctype='void *'
5113         else
5114                 malloctype='char *'
5115         fi
5116         ;;
5117 esac
5118 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5119
5120 case "$freetype" in
5121 '')
5122         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5123                 freetype='void'
5124         else
5125                 freetype='int'
5126         fi
5127         ;;
5128 esac
5129 echo "Your system uses $freetype free(), it would seem." >&4
5130 $rm -f malloc.[co]
5131 $cat <<EOM
5132
5133 The installation process will also create a directory for
5134 vendor-supplied add-ons.  Vendors who supply perl with their system
5135 may find it convenient to place all vendor-supplied files in this
5136 directory rather than in the main distribution directory.  This will
5137 ease upgrades between binary-compatible maintenance versions of perl.
5138
5139 Of course you may also use these directories in whatever way you see
5140 fit.  For example, you might use them to access modules shared over a
5141 company-wide network.
5142
5143 The default answer should be fine for most people.
5144 This causes further questions about vendor add-ons to be skipped
5145 and no vendor-specific directories will be configured for perl.
5146
5147 EOM
5148 rp='Do you want to configure vendor-specific add-on directories?'
5149 case "$usevendorprefix" in
5150 define|true|[yY]*) dflt=y ;;
5151 *) dflt=n ;;
5152 esac
5153 . ./myread
5154 case "$ans" in
5155 [yY]*)  fn=d~+
5156         rp='Installation prefix to use for vendor-supplied add-ons?'
5157         case "$vendorprefix" in
5158         '') dflt='' ;;
5159         *)  dflt=$vendorprefix ;;
5160         esac
5161         . ./getfile
5162         oldvendorprefix=''
5163         case "$vendorprefix" in
5164         '') ;;
5165         *)      case "$ans" in
5166                 "$prefix") ;;
5167                 *) oldvendorprefix="$prefix";;
5168                 esac
5169                 ;;
5170         esac
5171         usevendorprefix="$define"
5172         vendorprefix="$ans"
5173         vendorprefixexp="$ansexp"
5174         ;;
5175 *)      usevendorprefix="$undef"
5176         vendorprefix=''
5177         vendorprefixexp=''
5178         ;;
5179 esac
5180
5181 case "$vendorprefix" in
5182 '')     d_vendorlib="$undef"
5183         vendorlib=''
5184         vendorlibexp=''
5185         ;;
5186 *)      d_vendorlib="$define"
5187         : determine where vendor-supplied modules go.
5188         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5189         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5190         case "$installstyle" in
5191         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5192         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5193         esac
5194         fn=d~+
5195         rp='Pathname for the vendor-supplied library files?'
5196         . ./getfile
5197         vendorlib="$ans"
5198         vendorlibexp="$ansexp"
5199         : Change installation prefix, if necessary.
5200         if $test X"$prefix" != X"$installprefix"; then
5201                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5202         else
5203                 installvendorlib="$vendorlibexp"
5204         fi
5205         ;;
5206 esac
5207
5208 : Cruising for prototypes
5209 echo " "
5210 echo "Checking out function prototypes..." >&4
5211 $cat >prototype.c <<'EOCP'
5212 int main(int argc, char *argv[]) {
5213         exit(0);}
5214 EOCP
5215 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5216         echo "Your C compiler appears to support function prototypes."
5217         val="$define"
5218 else
5219         echo "Your C compiler doesn't seem to understand function prototypes."
5220         val="$undef"
5221 fi
5222 set prototype
5223 eval $setvar
5224 $rm -f prototype*
5225
5226 case "$prototype" in
5227 "$define") ;;
5228 *)      ansi2knr='ansi2knr'
5229         echo " "
5230         cat <<EOM >&4
5231
5232 $me:  FATAL ERROR:
5233 This version of $package can only be compiled by a compiler that 
5234 understands function prototypes.  Unfortunately, your C compiler 
5235         $cc $ccflags
5236 doesn't seem to understand them.  Sorry about that.
5237
5238 If GNU cc is available for your system, perhaps you could try that instead.  
5239
5240 Eventually, we hope to support building Perl with pre-ANSI compilers.
5241 If you would like to help in that effort, please contact <perlbug@perl.org>.
5242
5243 Aborting Configure now.
5244 EOM
5245         exit 2
5246         ;;
5247 esac
5248
5249 : determine where public executables go
5250 echo " "
5251 set dflt bin bin
5252 eval $prefixit
5253 fn=d~
5254 rp='Pathname where the public executables will reside?'
5255 . ./getfile
5256 if $test "X$ansexp" != "X$binexp"; then
5257         installbin=''
5258 fi
5259 bin="$ans"
5260 binexp="$ansexp"
5261 : Change installation prefix, if necessary.
5262 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5263 if $test X"$prefix" != X"$installprefix"; then
5264         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5265 else
5266         installbin="$binexp"
5267 fi
5268
5269 $cat <<EOM
5270
5271 After $package is installed, you may wish to install various
5272 add-on modules and utilities.  Typically, these add-ons will
5273 be installed under $prefix with the rest
5274 of this package.  However, you may wish to install such add-ons
5275 elsewhere under a different prefix.
5276
5277 If you do not wish to put everything under a single prefix, that's
5278 ok.  You will be prompted for the individual locations; this siteprefix
5279 is only used to suggest the defaults.
5280
5281 The default should be fine for most people.
5282
5283 EOM
5284 fn=d~+
5285 rp='Installation prefix to use for add-on modules and utilities?'
5286 : XXX Here might be another good place for an installstyle setting.
5287 case "$siteprefix" in
5288 '') dflt=$prefix ;;
5289 *)  dflt=$siteprefix ;;
5290 esac
5291 . ./getfile
5292 oldsiteprefix=''
5293 case "$siteprefix" in
5294 '') ;;
5295 *)
5296         case "$ans" in
5297         "$prefix") ;;
5298         *) oldsiteprefix="$prefix";;
5299         esac
5300         ;;
5301 esac
5302 siteprefix="$ans"
5303 siteprefixexp="$ansexp"
5304
5305 : determine where site specific libraries go.
5306 : Usual default is /usr/local/lib/perl5/site_perl/$version
5307 : The default "style" setting is made in installstyle.U
5308 : XXX No longer works with Prefixit stuff.
5309 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5310 case "$installstyle" in
5311 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5312 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5313 esac
5314 $cat <<EOM
5315
5316 The installation process will create a directory for
5317 site-specific extensions and modules.  Most users find it convenient
5318 to place all site-specific files in this directory rather than in the
5319 main distribution directory.
5320
5321 EOM
5322 fn=d~+
5323 rp='Pathname for the site-specific library files?'
5324 . ./getfile
5325 sitelib="$ans"
5326 sitelibexp="$ansexp"
5327 : Change installation prefix, if necessary.
5328 if $test X"$prefix" != X"$installprefix"; then
5329         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5330 else
5331         installsitelib="$sitelibexp"
5332 fi
5333
5334 : Determine list of previous versions to include in @INC
5335 $cat > getverlist <<EOPL
5336 #!$perl -w
5337 use File::Basename;
5338 \$api_versionstring = "$api_versionstring";
5339 \$version = "$version";
5340 \$sitelib = "$sitelib";
5341 \$archname = "$archname";
5342 EOPL
5343         $cat >> getverlist <<'EOPL'
5344 # Can't have leading @ because metaconfig interprets it as a command!
5345 ;@inc_version_list=();
5346 $stem=dirname($sitelib);
5347 # Redo to do opendir/readdir? 
5348 if (-d $stem) {
5349     chdir($stem);
5350     ;@candidates = glob("5.*");
5351 }
5352 else {
5353     ;@candidates = ();
5354 }
5355
5356 # XXX ToDo:  These comparisons must be reworked when two-digit
5357 # subversions come along, so that 5.7.10 compares as greater than
5358 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5359 # widespread that we can use the built-in version vectors rather
5360 # than reinventing them here.  For 5.6.0, however, we must
5361 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5362 foreach $d (@candidates) {
5363     if ($d lt $version) {
5364         if ($d ge $api_versionstring) {
5365             unshift(@inc_version_list, "$d/$archname", $d);
5366         }
5367         elsif ($d ge "5.005") {
5368             unshift(@inc_version_list, $d);
5369         }
5370     }
5371     else {
5372         # Skip newer version.  I.e. don't look in
5373         # 5.7.0 if we're installing 5.6.1.
5374     }
5375 }
5376
5377 if (@inc_version_list) {
5378     print join(' ', @inc_version_list);
5379 }
5380 else {
5381     # Blank space to preserve value for next Configure run.
5382     print " ";
5383 }
5384 EOPL
5385 chmod +x getverlist
5386 case "$inc_version_list" in
5387 '')     if test -x $perl; then
5388                 dflt=`$perl getverlist`
5389         else
5390                 dflt='none'
5391         fi
5392         ;;
5393 $undef) dflt='none' ;;
5394 *)  dflt="$inc_version_list" ;;
5395 esac
5396 $cat <<'EOM'
5397
5398 In order to ease the process of upgrading, this version of perl 
5399 can be configured to use modules built and installed with earlier 
5400 versions of perl that were installed under $prefix.  Specify here
5401 the list of earlier versions that this version of perl should check.
5402 If Configure detected no earlier versions of perl installed under
5403 $prefix, then the list will be empty.  Answer 'none' to tell perl
5404 to not search earlier versions.
5405
5406 The default should almost always be sensible, so if you're not sure,
5407 just accept the default.
5408 EOM
5409
5410 rp='List of earlier versions to include in @INC?'
5411 . ./myread
5412 case "$ans" in
5413 [Nn]one) inc_version_list=' ' ;;
5414 *) inc_version_list="$ans" ;;
5415 esac
5416 case "$inc_version_list" in
5417 ''|' ') 
5418         inc_version_list_init='""';;
5419 *)      inc_version_list_init=`echo $inc_version_list |
5420                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/"/'`
5421         ;;
5422 esac
5423 $rm -f getverlist
5424
5425 : determine whether to install perl also as /usr/bin/perl
5426
5427 echo " "
5428 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5429         $cat <<EOM
5430 Many scripts expect to perl to be installed as /usr/bin/perl.
5431 I can install the perl you are about to compile also as /usr/bin/perl
5432 (in addition to $installbin/perl).
5433 EOM
5434         case "$installusrbinperl" in
5435         "$undef"|[nN]*) dflt='n';;
5436         *)              dflt='y';;
5437         esac
5438         rp="Do you want to install perl as /usr/bin/perl?"
5439         . ./myread
5440         case "$ans" in
5441         [yY]*)  val="$define";;
5442         *)      val="$undef" ;;
5443         esac
5444 else
5445         val="$undef"
5446 fi
5447 set installusrbinperl
5448 eval $setvar
5449
5450 echo " "
5451 echo "Checking for GNU C Library..." >&4
5452 cat >gnulibc.c <<EOM
5453 #include <stdio.h>
5454 int main()
5455 {
5456 #ifdef __GLIBC__
5457     exit(0);
5458 #else
5459     exit(1);
5460 #endif
5461 }
5462 EOM
5463 set gnulibc
5464 if eval $compile_ok && ./gnulibc; then
5465         val="$define"
5466         echo "You are using the GNU C Library"
5467 else
5468         val="$undef"
5469         echo "You are not using the GNU C Library"
5470 fi
5471 $rm -f gnulibc*
5472 set d_gnulibc
5473 eval $setvar
5474
5475 : see if nm is to be used to determine whether a symbol is defined or not
5476 case "$usenm" in
5477 '')
5478         dflt=''
5479         case "$d_gnulibc" in
5480         "$define")
5481                 echo " "
5482                 echo "nm probably won't work on the GNU C Library." >&4
5483                 dflt=n
5484                 ;;
5485         esac
5486         case "$dflt" in
5487         '') 
5488                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5489                         echo " "
5490                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5491                         echo "'nm' won't be sufficient on this sytem." >&4
5492                         dflt=n
5493                 fi
5494                 ;;
5495         esac
5496         case "$dflt" in
5497         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5498                 if $test $dflt -gt 20; then
5499                         dflt=y
5500                 else
5501                         dflt=n
5502                 fi
5503                 ;;
5504         esac
5505         ;;
5506 *)
5507         case "$usenm" in
5508         true|$define) dflt=y;;
5509         *) dflt=n;;
5510         esac
5511         ;;
5512 esac
5513 $cat <<EOM
5514
5515 I can use $nm to extract the symbols from your C libraries. This
5516 is a time consuming task which may generate huge output on the disk (up
5517 to 3 megabytes) but that should make the symbols extraction faster. The
5518 alternative is to skip the 'nm' extraction part and to compile a small
5519 test program instead to determine whether each symbol is present. If
5520 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5521 this may be the best solution.
5522
5523 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5524
5525 EOM
5526 rp="Shall I use $nm to extract C symbols from the libraries?"
5527 . ./myread
5528 case "$ans" in
5529 [Nn]*) usenm=false;;
5530 *) usenm=true;;
5531 esac
5532
5533 runnm=$usenm
5534 case "$reuseval" in
5535 true) runnm=false;;
5536 esac
5537
5538 : nm options which may be necessary
5539 case "$nm_opt" in
5540 '') if $test -f /mach_boot; then
5541                 nm_opt=''       # Mach
5542         elif $test -d /usr/ccs/lib; then
5543                 nm_opt='-p'     # Solaris (and SunOS?)
5544         elif $test -f /dgux; then
5545                 nm_opt='-p'     # DG-UX
5546         elif $test -f /lib64/rld; then
5547                 nm_opt='-p'     # 64-bit Irix
5548         else
5549                 nm_opt=''
5550         fi;;
5551 esac
5552
5553 : nm options which may be necessary for shared libraries but illegal
5554 : for archive libraries.  Thank you, Linux.
5555 case "$nm_so_opt" in
5556 '')     case "$myuname" in
5557         *linux*)
5558                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5559                         nm_so_opt='--dynamic'
5560                 fi
5561                 ;;
5562         esac
5563         ;;
5564 esac
5565
5566 case "$runnm" in
5567 true)
5568 : get list of predefined functions in a handy place
5569 echo " "
5570 case "$libc" in
5571 '') libc=unknown
5572         case "$libs" in
5573         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5574         esac
5575         ;;
5576 esac
5577 libnames='';
5578 case "$libs" in
5579 '') ;;
5580 *)  for thislib in $libs; do
5581         case "$thislib" in
5582         -lc|-lc_s)
5583                 : Handle C library specially below.
5584                 ;;
5585         -l*)
5586                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5587                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5588                         :
5589                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5590                         :
5591                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5592                         :
5593                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5594                         :
5595                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5596                         :
5597                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5598                         :
5599                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5600                         :
5601                 else
5602                         try=''
5603                 fi
5604                 libnames="$libnames $try"
5605                 ;;
5606         *) libnames="$libnames $thislib" ;;
5607         esac
5608         done
5609         ;;
5610 esac
5611 xxx=normal
5612 case "$libc" in
5613 unknown)
5614         set /lib/libc.$so
5615         for xxx in $libpth; do
5616                 $test -r $1 || set $xxx/libc.$so
5617                 : The messy sed command sorts on library version numbers.
5618                 $test -r $1 || \
5619                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5620                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5621                                 h
5622                                 s/[0-9][0-9]*/0000&/g
5623                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5624                                 G
5625                                 s/\n/ /' | \
5626                          sort | $sed -e 's/^.* //'`
5627                 eval set \$$#
5628         done
5629         $test -r $1 || set /usr/ccs/lib/libc.$so
5630         $test -r $1 || set /lib/libsys_s$_a
5631         ;;
5632 *)
5633         set blurfl
5634         ;;
5635 esac
5636 if $test -r "$1"; then
5637         echo "Your (shared) C library seems to be in $1."
5638         libc="$1"
5639 elif $test -r /lib/libc && $test -r /lib/clib; then
5640         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5641         xxx=apollo
5642         libc='/lib/clib /lib/libc'
5643         if $test -r /lib/syslib; then
5644                 echo "(Your math library is in /lib/syslib.)"
5645                 libc="$libc /lib/syslib"
5646         fi
5647 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5648         echo "Your C library seems to be in $libc, as you said before."
5649 elif $test -r $incpath/usr/lib/libc$_a; then
5650         libc=$incpath/usr/lib/libc$_a;
5651         echo "Your C library seems to be in $libc.  That's fine."
5652 elif $test -r /lib/libc$_a; then
5653         libc=/lib/libc$_a;
5654         echo "Your C library seems to be in $libc.  You're normal."
5655 else
5656         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5657                 :
5658         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5659                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5660         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5661                 :
5662         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5663                 :
5664         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5665                 :
5666         else
5667                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5668         fi
5669         if $test -r "$tans"; then
5670                 echo "Your C library seems to be in $tans, of all places."
5671                 libc=$tans
5672         else
5673                 libc='blurfl'
5674         fi
5675 fi
5676 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5677         dflt="$libc"
5678         cat <<EOM
5679
5680 If the guess above is wrong (which it might be if you're using a strange
5681 compiler, or your machine supports multiple models), you can override it here.
5682
5683 EOM
5684 else
5685         dflt=''
5686         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5687         cat >&4 <<EOM
5688 I can't seem to find your C library.  I've looked in the following places:
5689
5690 EOM
5691         $sed 's/^/      /' libpath
5692         cat <<EOM
5693
5694 None of these seems to contain your C library. I need to get its name...
5695
5696 EOM
5697 fi
5698 fn=f
5699 rp='Where is your C library?'
5700 . ./getfile
5701 libc="$ans"
5702
5703 echo " "
5704 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5705 set X `cat libnames`
5706 shift
5707 xxx=files
5708 case $# in 1) xxx=file; esac
5709 echo "Extracting names from the following $xxx for later perusal:" >&4
5710 echo " "
5711 $sed 's/^/      /' libnames >&4
5712 echo " "
5713 $echo $n "This may take a while...$c" >&4
5714
5715 for file in $*; do
5716         case $file in
5717         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5718         *) $nm $nm_opt $file 2>/dev/null;;
5719         esac
5720 done >libc.tmp
5721
5722 $echo $n ".$c"
5723 $grep fprintf libc.tmp > libc.ptf
5724 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5725 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5726 xxx='[ADTSIW]'
5727 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5728         eval $xscan;\
5729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5730                 eval $xrun
5731 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5732         eval $xscan;\
5733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734                 eval $xrun
5735 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5736         eval $xscan;\
5737         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5738                 eval $xrun
5739 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5740         eval $xscan;\
5741         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5742                 eval $xrun
5743 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5744         eval $xscan;\
5745         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5746                 eval $xrun
5747 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5748         eval $xscan;\
5749         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5750                 eval $xrun
5751 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5752                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5753         eval $xscan;\
5754         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755                 eval $xrun
5756 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5757         eval $xscan;\
5758         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5759                 eval $xrun
5760 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5761         eval $xscan;\
5762         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5763                 eval $xrun
5764 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5765         eval $xscan;\
5766         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5767                 eval $xrun
5768 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5769         eval $xscan;\
5770         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5771                 eval $xrun
5772 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5773         eval $xscan;\
5774         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5775                 eval $xrun
5776 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5777         eval $xscan;\
5778         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5779                 eval $xrun
5780 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5781         eval $xscan;\
5782         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5783                 eval $xrun
5784 else
5785         $nm -p $* 2>/dev/null >libc.tmp
5786         $grep fprintf libc.tmp > libc.ptf
5787         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5788                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5789         then
5790                 nm_opt='-p'
5791                 eval $xrun
5792         else
5793                 echo " "
5794                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5795                 com=''
5796                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5797                         for thisname in $libnames $libc; do
5798                                 $ar t $thisname >>libc.tmp
5799                         done
5800                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5801                         echo "Ok." >&4
5802                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5803                         # Repeat libc to extract forwarders to DLL entries too
5804                         for thisname in $libnames $libc; do
5805                                 $ar tv $thisname >>libc.tmp
5806                                 # Revision 50 of EMX has bug in $ar.
5807                                 # it will not extract forwarders to DLL entries
5808                                 # Use emximp which will extract exactly them.
5809                                 emximp -o tmp.imp $thisname \
5810                                     2>/dev/null && \
5811                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5812                                     < tmp.imp >>libc.tmp
5813                                 $rm tmp.imp
5814                         done
5815                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5816                         echo "Ok." >&4
5817                 else
5818                         echo "$ar didn't seem to work right." >&4
5819                         echo "Maybe this is a Cray...trying bld instead..." >&4
5820                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5821                         then
5822                                 for thisname in $libnames; do
5823                                         bld t $libnames | \
5824                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5825                                         $ar t $thisname >>libc.tmp
5826                                 done
5827                                 echo "Ok." >&4
5828                         else
5829                                 echo "That didn't work either.  Giving up." >&4
5830                                 exit 1
5831                         fi
5832                 fi
5833         fi
5834 fi
5835 nm_extract="$com"
5836 if $test -f /lib/syscalls.exp; then
5837         echo " "
5838         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5839         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5840 fi
5841 ;;
5842 esac
5843 $rm -f libnames libpath
5844
5845 : see if dld is available
5846 set dld.h i_dld
5847 eval $inhdr
5848
5849 : is a C symbol defined?
5850 csym='tlook=$1;
5851 case "$3" in
5852 -v) tf=libc.tmp; tc=""; tdc="";;
5853 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5854 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5855 esac;
5856 tx=yes;
5857 case "$reuseval-$4" in
5858 true-) ;;
5859 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5860 esac;
5861 case "$tx" in
5862 yes)
5863         case "$runnm" in
5864         true)
5865                 if $contains $tlook $tf >/dev/null 2>&1;
5866                 then tval=true;
5867                 else tval=false;
5868                 fi;;
5869         *)
5870                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5871                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5872                 then tval=true;
5873                 else tval=false;
5874                 fi;
5875                 $rm -f t t.c;;
5876         esac;;
5877 *)
5878         case "$tval" in
5879         $define) tval=true;;
5880         *) tval=false;;
5881         esac;;
5882 esac;
5883 eval "$2=$tval"'
5884
5885 : define an is-in-libc? function
5886 inlibc='echo " "; td=$define; tu=$undef;
5887 sym=$1; var=$2; eval "was=\$$2";
5888 tx=yes;
5889 case "$reuseval$was" in
5890 true) ;;
5891 true*) tx=no;;
5892 esac;
5893 case "$tx" in
5894 yes)
5895         set $sym tres -f;
5896         eval $csym;
5897         case "$tres" in
5898         true)
5899                 echo "$sym() found." >&4;
5900                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5901         *)
5902                 echo "$sym() NOT found." >&4;
5903                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5904         esac;;
5905 *)
5906         case "$was" in
5907         $define) echo "$sym() found." >&4;;
5908         *) echo "$sym() NOT found." >&4;;
5909         esac;;
5910 esac'
5911
5912 : see if dlopen exists
5913 xxx_runnm="$runnm"
5914 runnm=false
5915 set dlopen d_dlopen
5916 eval $inlibc
5917 runnm="$xxx_runnm"
5918
5919 : determine which dynamic loading, if any, to compile in
5920 echo " "
5921 dldir="ext/DynaLoader"
5922 case "$usedl" in
5923 $define|y|true)
5924         dflt='y'
5925         usedl="$define"
5926         ;;
5927 $undef|n|false)
5928         dflt='n'
5929         usedl="$undef"
5930         ;;
5931 *) 
5932         dflt='n'
5933         case "$d_dlopen" in
5934             $define) dflt='y' ;;
5935         esac
5936         case "$i_dld" in
5937             $define) dflt='y' ;;
5938         esac
5939         : Does a dl_xxx.xs file exist for this operating system
5940         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5941         ;;
5942 esac
5943 rp="Do you wish to use dynamic loading?"
5944 . ./myread
5945 usedl="$ans"
5946 case "$ans" in
5947 y*) usedl="$define"
5948         case "$dlsrc" in
5949         '')
5950                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5951                         dflt="$dldir/dl_${osname}.xs"
5952                 elif $test "$d_dlopen" = "$define" ; then
5953                         dflt="$dldir/dl_dlopen.xs"
5954                 elif $test "$i_dld" = "$define" ; then
5955                         dflt="$dldir/dl_dld.xs"
5956                 else
5957                         dflt=''
5958                 fi
5959                 ;;
5960         *)      dflt="$dldir/$dlsrc"
5961                 ;;
5962         esac
5963     echo "The following dynamic loading files are available:"
5964         : Can not go over to $dldir because getfile has path hard-coded in.
5965         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5966         rp="Source file to use for dynamic loading"
5967         fn="fne"
5968         gfpth="$src"
5969         . ./getfile
5970         usedl="$define"
5971         : emulate basename
5972         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5973
5974         $cat << EOM
5975
5976 Some systems may require passing special flags to $cc -c to
5977 compile modules that will be used to create a shared library.
5978 To use no flags, say "none".
5979
5980 EOM
5981     case "$cccdlflags" in
5982     '') case "$gccversion" in
5983                 '') case "$osname" in
5984                         hpux)   dflt='+z' ;;
5985                         next)   dflt='none' ;;
5986                         irix*)  dflt='-KPIC' ;;
5987                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5988                         sunos)  dflt='-pic' ;;
5989                         *)      dflt='none' ;;
5990                     esac
5991                         ;;
5992                 *)  case "$osname" in
5993                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5994                         *)      dflt='-fpic' ;;
5995                     esac ;;
5996             esac ;;
5997         ' ') dflt='none' ;;
5998     *)  dflt="$cccdlflags" ;;
5999     esac
6000     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6001     . ./myread
6002     case "$ans" in
6003     none) cccdlflags=' ' ;;
6004     *) cccdlflags="$ans" ;;
6005     esac
6006
6007     cat << EOM
6008
6009 Some systems use ld to create libraries that can be dynamically loaded,
6010 while other systems (such as those using ELF) use $cc.
6011
6012 EOM
6013         case "$ld" in
6014         '')     $cat >try.c <<'EOM'
6015 /* Test for whether ELF binaries are produced */
6016 #include <fcntl.h>
6017 #include <stdlib.h>
6018 int main() {
6019         char b[4];
6020         int i = open("a.out",O_RDONLY);
6021         if(i == -1) 
6022                 exit(1); /* fail */
6023         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6024                 exit(0); /* succeed (yes, it's ELF) */
6025         else
6026                 exit(1); /* fail */
6027 }
6028 EOM
6029                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6030                         cat <<EOM
6031 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6032 EOM
6033                         dflt="$cc"
6034                 else
6035                         echo "I'll use ld to build dynamic libraries."
6036                         dflt='ld'
6037                 fi
6038                 rm -f try.c a.out
6039                 ;;
6040         *)      dflt="$ld"
6041                 ;;
6042         esac
6043
6044     rp="What command should be used to create dynamic libraries?"
6045     . ./myread
6046         ld="$ans"
6047
6048     cat << EOM
6049
6050 Some systems may require passing special flags to $ld to create a
6051 library that can be dynamically loaded.  If your ld flags include
6052 -L/other/path options to locate libraries outside your loader's normal
6053 search path, you may need to specify those -L options here as well.  To
6054 use no flags, say "none".
6055
6056 EOM
6057     case "$lddlflags" in
6058     '') case "$osname" in
6059                         beos) dflt='-nostart' ;;
6060                         hpux)  dflt='-b' ;;
6061                         linux|irix*)    dflt='-shared' ;;
6062                         next)  dflt='none' ;;
6063                         solaris) dflt='-G' ;;
6064                         sunos) dflt='-assert nodefinitions' ;;
6065                         svr4*|esix*) dflt="-G $ldflags" ;;
6066                 *)     dflt='none' ;;
6067                         esac
6068                         ;;
6069     *) dflt="$lddlflags" ;;
6070     esac
6071
6072         : Try to guess additional flags to pick up local libraries.
6073         : Be careful not to append to a plain 'none'
6074         case "$dflt" in
6075         none) dflt='' ;;
6076         esac
6077         for thisflag in $ldflags; do
6078                 case "$thisflag" in
6079                 -L*)
6080                         case " $dflt " in
6081                         *" $thisflag "*) ;;
6082                         *) dflt="$dflt $thisflag" ;;
6083                         esac
6084                         ;;
6085                 esac
6086         done
6087
6088         case "$dflt" in
6089         ''|' ') dflt='none' ;;
6090         esac
6091
6092     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6093     . ./myread
6094     case "$ans" in
6095     none) lddlflags=' ' ;;
6096     *) lddlflags="$ans" ;;
6097     esac
6098
6099         cat <<EOM
6100
6101 Some systems may require passing special flags to $cc to indicate that
6102 the resulting executable will use dynamic linking.  To use no flags,
6103 say "none".
6104
6105 EOM
6106     case "$ccdlflags" in
6107     '') case "$osname" in
6108                 hpux)   dflt='-Wl,-E' ;;
6109                 linux)  dflt='-rdynamic' ;;
6110                 next)   dflt='none' ;;
6111                 sunos)  dflt='none' ;;
6112                 *)      dflt='none' ;;
6113             esac ;;
6114     ' ')  dflt='none' ;;
6115     *)  dflt="$ccdlflags" ;;
6116     esac
6117     rp="Any special flags to pass to $cc to use dynamic linking?"
6118     . ./myread
6119     case "$ans" in
6120     none) ccdlflags=' ' ;;
6121     *) ccdlflags="$ans" ;;
6122     esac
6123     ;;
6124 *)  usedl="$undef"
6125         ld='ld'
6126     dlsrc='dl_none.xs'
6127     lddlflags=''
6128     ccdlflags=''
6129     ;;
6130 esac
6131
6132 also=''
6133 case "$usedl" in
6134 $undef)
6135         # No dynamic loading being used, so don't bother even to prompt.
6136         useshrplib='false'
6137         ;;
6138 *)      case "$useshrplib" in
6139         '')     case "$osname" in
6140                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6141                         dflt=y
6142                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6143                         ;;
6144                 next*)
6145                         case "$osvers" in
6146                         4*)     dflt=y
6147                                 also='Building a shared libperl is needed for MAB support.'
6148                                 ;;
6149                         *)      dflt=n
6150                                 ;;
6151                         esac
6152                         ;;
6153                 *)      dflt=n
6154                         ;;
6155                 esac
6156                 ;;
6157         $define|true|[Yy]*)
6158                 dflt=y
6159                 ;;
6160         *)      dflt=n
6161                 ;;
6162         esac
6163         $cat << EOM
6164
6165 The perl executable is normally obtained by linking perlmain.c with
6166 libperl${_a}, any static extensions (usually just DynaLoader), and
6167 any other libraries needed on this system (such as -lm, etc.).  Since
6168 your system supports dynamic loading, it is probably possible to build
6169 a shared libperl.$so.  If you will have more than one executable linked
6170 to libperl.$so, this will significantly reduce the size of each
6171 executable, but it may have a noticeable affect on performance.  The
6172 default is probably sensible for your system.
6173 $also
6174
6175 EOM
6176         rp="Build a shared libperl.$so (y/n)"
6177         . ./myread
6178         case "$ans" in
6179         true|$define|[Yy]*)
6180                 useshrplib='true'  ;;
6181         *)      useshrplib='false' ;;
6182         esac
6183         ;;
6184 esac
6185
6186 case "$useshrplib" in
6187 true)
6188         case "$libperl" in
6189         '')
6190                 # Figure out a good name for libperl.so.  Since it gets stored in
6191                 # a version-specific architecture-dependent library, the version
6192                 # number isn't really that important, except for making cc/ld happy.
6193                 #
6194                 # A name such as libperl.so.3.1
6195                 majmin="libperl.$so.$patchlevel.$subversion"
6196                 # A name such as libperl.so.301
6197                 majonly=`echo $patchlevel $subversion |
6198                         $awk '{printf "%d%02d", $1, $2}'`
6199                 majonly=libperl.$so.$majonly
6200                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6201                 # rely on figuring it out from the naming of libc.
6202                 case "${osname}${osvers}" in
6203                 next4*)
6204                         dflt=libperl.5.$so
6205                         # XXX How handle the --version stuff for MAB?
6206                         ;;
6207                 linux*)  # ld won't link with a bare -lperl otherwise.
6208                         dflt=libperl.$so
6209                         ;;
6210                 cygwin*) # include version
6211                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6212                         ;;
6213                 *)      # Try to guess based on whether libc has major.minor.
6214                         case "$libc" in
6215                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6216                         *libc.$so.[0-9]*) dflt=$majonly ;;
6217                         *)      dflt=libperl.$so ;;
6218                         esac
6219                         ;;
6220                 esac
6221                 ;;
6222         *)      dflt=$libperl
6223                 ;;
6224         esac
6225         cat << EOM
6226
6227 I need to select a good name for the shared libperl.  If your system uses
6228 library names with major and minor numbers, then you might want something
6229 like $majmin.  Alternatively, if your system uses a single version
6230 number for shared libraries, then you might want to use $majonly.
6231 Or, your system might be quite happy with a simple libperl.$so.
6232
6233 Since the shared libperl will get installed into a version-specific
6234 architecture-dependent directory, the version number of the shared perl
6235 library probably isn't important, so the default should be o.k.
6236
6237 EOM
6238         rp='What name do you want to give to the shared libperl?'
6239         . ./myread
6240         libperl=$ans
6241         echo "Ok, I'll use $libperl"
6242         ;;
6243 *)
6244         libperl="libperl${_a}"
6245         ;;
6246 esac
6247
6248 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6249 case "$shrpdir" in
6250 '') ;;
6251 *)      $cat >&4 <<EOM
6252 WARNING:  Use of the shrpdir variable for the installation location of
6253 the shared $libperl is not supported.  It was never documented and
6254 will not work in this version.  Let me (perlbug@perl.com)
6255 know of any problems this may cause.
6256
6257 EOM
6258         case "$shrpdir" in
6259         "$archlibexp/CORE")
6260                 $cat >&4 <<EOM
6261 But your current setting of $shrpdir is
6262 the default anyway, so it's harmless.
6263 EOM
6264                 ;;
6265         *)
6266                 $cat >&4 <<EOM
6267 Further, your current attempted setting of $shrpdir
6268 conflicts with the value of $archlibexp/CORE
6269 that installperl will use.
6270 EOM
6271                 ;;
6272         esac
6273         ;;
6274 esac
6275
6276 # How will the perl executable find the installed shared $libperl?
6277 # Add $xxx to ccdlflags.
6278 # If we can't figure out a command-line option, use $shrpenv to
6279 # set env LD_RUN_PATH.  The main perl makefile uses this.
6280 shrpdir=$archlibexp/CORE
6281 xxx=''
6282 tmp_shrpenv=''
6283 if "$useshrplib"; then
6284     case "$osname" in 
6285         aix)
6286                 # We'll set it in Makefile.SH...
6287                 ;;
6288         solaris|netbsd)
6289                 xxx="-R $shrpdir"
6290                 ;;
6291         freebsd)
6292                 xxx="-Wl,-R$shrpdir"
6293                 ;;
6294         linux|irix*|dec_osf)
6295                 xxx="-Wl,-rpath,$shrpdir"
6296                 ;;
6297         next)
6298                 # next doesn't like the default...
6299                 ;;
6300         beos)
6301                 # beos doesn't like the default, either.
6302                 ;;
6303         hpux*)
6304                 # hpux doesn't like the default, either.
6305                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6306                 ;;
6307         *)
6308                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6309                 ;;
6310         esac
6311         case "$xxx" in
6312         '') ;;
6313         *)      
6314                 # Only add $xxx if it isn't already in ccdlflags.
6315                 case " $ccdlflags " in
6316                 *" $xxx "*)     ;;
6317                 *)      ccdlflags="$ccdlflags $xxx"
6318                         cat <<EOM >&4
6319
6320 Adding $xxx to the flags
6321 passed to $ld so that the perl executable will find the 
6322 installed shared $libperl.
6323
6324 EOM
6325                         ;;
6326                 esac
6327                 ;;
6328         esac
6329 fi
6330 # Fix ccdlflags in AIX for building external extensions.
6331 # (For building Perl itself bare -bE:perl.exp is needed,
6332 #  Makefile.SH takes care of this.)
6333 case "$osname" in
6334 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6335 esac
6336 # Respect a hint or command-line value.
6337 case "$shrpenv" in
6338 '') shrpenv="$tmp_shrpenv" ;;
6339 esac
6340 case "$ldlibpthname" in
6341 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6342 none)   ldlibpthname='' ;;
6343 esac
6344
6345 : determine where manual pages go
6346 set man1dir man1dir none
6347 eval $prefixit
6348 $cat <<EOM
6349
6350 $spackage has manual pages available in source form.
6351 EOM
6352 case "$nroff" in
6353 nroff)
6354         echo "However, you don't have nroff, so they're probably useless to you."
6355         case "$man1dir" in
6356         '') man1dir="none";;
6357         esac;;
6358 esac
6359 echo "If you don't want the manual sources installed, answer 'none'."
6360 case "$man1dir" in
6361 ' ') dflt=none
6362         ;;
6363 '')
6364         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6365         lookpath="$lookpath $prefixexp/man/p_man/man1"
6366         lookpath="$lookpath $prefixexp/man/u_man/man1"
6367         lookpath="$lookpath $prefixexp/man/man.1"
6368         case "$sysman" in
6369         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6370         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6371         esac
6372         set dflt
6373         eval $prefixup
6374         ;;
6375 *)  dflt="$man1dir"
6376         ;;
6377 esac
6378 echo " "
6379 fn=dn+~
6380 rp="Where do the main $spackage manual pages (source) go?"
6381 . ./getfile
6382 if $test "X$man1direxp" != "X$ansexp"; then
6383         installman1dir=''
6384 fi
6385 man1dir="$ans"
6386 man1direxp="$ansexp"
6387 case "$man1dir" in
6388 '')     man1dir=' '
6389         installman1dir='';;
6390 esac
6391
6392 : Change installation prefix, if necessary.
6393 if $test X"$prefix" != X"$installprefix"; then
6394         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6395 else
6396         installman1dir="$man1direxp"
6397 fi
6398
6399 : What suffix to use on installed man pages
6400
6401 case "$man1dir" in
6402 ' ')
6403         man1ext='0'
6404         ;;
6405 *)
6406         rp="What suffix should be used for the main $spackage man pages?"
6407         case "$man1ext" in
6408         '')     case "$man1dir" in
6409                 *1)  dflt=1 ;;
6410                 *1p) dflt=1p ;;
6411                 *1pm) dflt=1pm ;;
6412                 *l) dflt=l;;
6413                 *n) dflt=n;;
6414                 *o) dflt=o;;
6415                 *p) dflt=p;;
6416                 *C) dflt=C;;
6417                 *L) dflt=L;;
6418                 *L1) dflt=L1;;
6419                 *) dflt=1;;
6420                 esac
6421                 ;;
6422         *)      dflt="$man1ext";;
6423         esac
6424         . ./myread
6425         man1ext="$ans"
6426         ;;
6427 esac
6428
6429 : see if we can have long filenames
6430 echo " "
6431 rmlist="$rmlist /tmp/cf$$"
6432 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6433 first=123456789abcdef
6434 second=/tmp/cf$$/$first
6435 $rm -f $first $second
6436 if (echo hi >$first) 2>/dev/null; then
6437         if $test -f 123456789abcde; then
6438                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6439                 val="$undef"
6440         else
6441                 if (echo hi >$second) 2>/dev/null; then
6442                         if $test -f /tmp/cf$$/123456789abcde; then
6443                                 $cat <<'EOM'
6444 That's peculiar... You can have filenames longer than 14 characters, but only
6445 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6446 I shall consider your system cannot support long filenames at all.
6447 EOM
6448                                 val="$undef"
6449                         else
6450                                 echo 'You can have filenames longer than 14 characters.' >&4
6451                                 val="$define"
6452                         fi
6453                 else
6454                         $cat <<'EOM'
6455 How confusing! Some of your filesystems are sane enough to allow filenames
6456 longer than 14 characters but some others like /tmp can't even think about them.
6457 So, for now on, I shall assume your kernel does not allow them at all.
6458 EOM
6459                         val="$undef"
6460                 fi
6461         fi
6462 else
6463         $cat <<'EOM'
6464 You can't have filenames longer than 14 chars.  You can't even think about them!
6465 EOM
6466         val="$undef"
6467 fi 
6468 set d_flexfnam
6469 eval $setvar
6470 $rm -rf /tmp/cf$$ 123456789abcde*
6471
6472 : determine where library module manual pages go
6473 set man3dir man3dir none
6474 eval $prefixit
6475 $cat <<EOM
6476
6477 $spackage has manual pages for many of the library modules.
6478 EOM
6479
6480 case "$nroff" in
6481 nroff)
6482         $cat <<'EOM'
6483 However, you don't have nroff, so they're probably useless to you.
6484 EOM
6485         case "$man3dir" in
6486         '') man3dir="none";;
6487         esac;;
6488 esac
6489
6490 case "$d_flexfnam" in
6491 undef)
6492         $cat <<'EOM'
6493 However, your system can't handle the long file names like File::Basename.3. 
6494 EOM
6495         case "$man3dir" in
6496         '') man3dir="none";;
6497         esac;;
6498 esac
6499
6500 echo "If you don't want the manual sources installed, answer 'none'."
6501 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6502 case "$man3dir" in
6503 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6504         if $test -d "$privlib/man/man3"; then
6505                 cat <<EOM >&4
6506
6507 WARNING:  Previous versions of perl installed man3 pages into
6508 $privlib/man/man3.  This version will suggest a 
6509 new default of $dflt.  
6510 EOM
6511                 tdflt=$dflt
6512                 dflt='n'
6513                 rp='Do you wish to preserve the old behavior?(y/n)'
6514                 . ./myread
6515                 case "$ans" in
6516                 y*) dflt="$privlib/man/man3" ;;
6517                 *)  dflt=$tdflt ;;
6518                 esac
6519     fi
6520         ;;
6521 ' ') dflt=none;;
6522 *)      dflt="$man3dir" ;;
6523 esac
6524 echo " "
6525 fn=dn+~
6526 rp="Where do the $package library man pages (source) go?"
6527 . ./getfile
6528 man3dir="$ans"
6529 man3direxp="$ansexp"
6530 case "$man1dir" in
6531 '')     man3dir=' '
6532         installman3dir='';;
6533 esac
6534
6535 : Change installation prefix, if necessary.
6536 if $test X"$prefix" != X"$installprefix"; then
6537         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6538 else
6539         installman3dir="$man3direxp"
6540 fi
6541
6542 : What suffix to use on installed man pages
6543 case "$man3dir" in
6544 ' ')
6545         man3ext='0'
6546         ;;
6547 *)
6548         rp="What suffix should be used for the $package library man pages?"
6549         case "$man3ext" in
6550         '')     case "$man3dir" in
6551                 *3)  dflt=3 ;;
6552                 *3p) dflt=3p ;;
6553                 *3pm) dflt=3pm ;;
6554                 *l) dflt=l;;
6555                 *n) dflt=n;;
6556                 *o) dflt=o;;
6557                 *p) dflt=p;;
6558                 *C) dflt=C;;
6559                 *L) dflt=L;;
6560                 *L3) dflt=L3;;
6561                 *) dflt=3;;
6562                 esac
6563                 ;;
6564         *)      dflt="$man3ext";;
6565         esac
6566         . ./myread
6567         man3ext="$ans"
6568         ;;
6569 esac
6570
6571 : see if we have to deal with yellow pages, now NIS.
6572 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6573         if $test -f /usr/etc/nibindd; then
6574                 echo " "
6575                 echo "I'm fairly confident you're on a NeXT."
6576                 echo " "
6577                 rp='Do you get the hosts file via NetInfo?'
6578                 dflt=y
6579                 case "$hostcat" in
6580                 nidump*) ;;
6581                 '') ;;
6582                 *) dflt=n;;
6583                 esac
6584                 . ./myread
6585                 case "$ans" in
6586                 y*) hostcat='nidump hosts .';;
6587                 *)      case "$hostcat" in
6588                         nidump*) hostcat='';;
6589                         esac
6590                         ;;
6591                 esac
6592         fi
6593         case "$hostcat" in
6594         nidump*) ;;
6595         *)
6596                 case "$hostcat" in
6597                 *ypcat*) dflt=y;;
6598                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6599                                 dflt=y
6600                         else
6601                                 dflt=n
6602                         fi;;
6603                 *) dflt=n;;
6604                 esac
6605                 echo " "
6606                 rp='Are you getting the hosts file via yellow pages?'
6607                 . ./myread
6608                 case "$ans" in
6609                 y*) hostcat='ypcat hosts';;
6610                 *) hostcat='cat /etc/hosts';;
6611                 esac
6612                 ;;
6613         esac
6614 fi
6615 case "$hostcat" in
6616 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6617 esac
6618 case "$groupcat" in
6619 '') test -f /etc/group && groupcat='cat /etc/group';;
6620 esac
6621 case "$passcat" in
6622 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6623 esac
6624
6625 : now get the host name
6626 echo " "
6627 echo "Figuring out host name..." >&4
6628 case "$myhostname" in
6629 '') cont=true
6630         echo 'Maybe "hostname" will work...'
6631         if tans=`sh -c hostname 2>&1` ; then
6632                 myhostname=$tans
6633                 phostname=hostname
6634                 cont=''
6635         fi
6636         ;;
6637 *) cont='';;
6638 esac
6639 if $test "$cont"; then
6640         if ./xenix; then
6641                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6642                 if tans=`cat /etc/systemid 2>&1` ; then
6643                         myhostname=$tans
6644                         phostname='cat /etc/systemid'
6645                         echo "Whadyaknow.  Xenix always was a bit strange..."
6646                         cont=''
6647                 fi
6648         elif $test -r /etc/systemid; then
6649                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6650         fi
6651 fi
6652 if $test "$cont"; then
6653         echo 'No, maybe "uuname -l" will work...'
6654         if tans=`sh -c 'uuname -l' 2>&1` ; then
6655                 myhostname=$tans
6656                 phostname='uuname -l'
6657         else
6658                 echo 'Strange.  Maybe "uname -n" will work...'
6659                 if tans=`sh -c 'uname -n' 2>&1` ; then
6660                         myhostname=$tans
6661                         phostname='uname -n'
6662                 else
6663                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6664                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6665                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6666                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6667                         else
6668                                 case "$myhostname" in
6669                                 '') echo "Does this machine have an identity crisis or something?"
6670                                         phostname='';;
6671                                 *)
6672                                         echo "Well, you said $myhostname before..."
6673                                         phostname='echo $myhostname';;
6674                                 esac
6675                         fi
6676                 fi
6677         fi
6678 fi
6679 : you do not want to know about this
6680 set $myhostname
6681 myhostname=$1
6682
6683 : verify guess
6684 if $test "$myhostname" ; then
6685         dflt=y
6686         rp='Your host name appears to be "'$myhostname'".'" Right?"
6687         . ./myread
6688         case "$ans" in
6689         y*) ;;
6690         *) myhostname='';;
6691         esac
6692 fi
6693
6694 : bad guess or no guess
6695 while $test "X$myhostname" = X ; do
6696         dflt=''
6697         rp="Please type the (one word) name of your host:"
6698         . ./myread
6699         myhostname="$ans"
6700 done
6701
6702 : translate upper to lower if necessary
6703 case "$myhostname" in
6704 *[A-Z]*)
6705         echo "(Normalizing case in your host name)"
6706         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6707         ;;
6708 esac
6709
6710 case "$myhostname" in
6711 *.*)
6712         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6713         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6714         echo "(Trimming domain name from host name--host name is now $myhostname)"
6715         ;;
6716 *) case "$mydomain" in
6717         '')
6718                 {
6719                         test "X$hostcat" = "Xypcat hosts" &&
6720                         ypmatch "$myhostname" hosts 2>/dev/null |\
6721                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6722                         $test -s hosts
6723                 } || {
6724                         test "X$hostcat" != "X" &&
6725                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6726                                         /[       ]$myhostname[  . ]/p" > hosts
6727                 }
6728                 tmp_re="[       . ]"
6729                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6730                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6731                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6732                         hosts | $sort | $uniq | \
6733                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6734                 case `$echo X$dflt` in
6735                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6736                         dflt=.
6737                         ;;
6738                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6739                         ;;
6740                 esac
6741                 case "$dflt" in
6742                 .)
6743                         tans=`./loc resolv.conf X /etc /usr/etc`
6744                         if $test -f "$tans"; then
6745                                 echo "(Attempting domain name extraction from $tans)"
6746                                 dflt=.`$sed -n -e 's/   / /g' \
6747                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6748                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6749                                 case "$dflt" in
6750                                 .) dflt=.`$sed -n -e 's/        / /g' \
6751                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6752                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6753                                         ;;
6754                                 esac
6755                         fi
6756                         ;;
6757                 esac
6758                 case "$dflt" in
6759                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6760                         dflt=.`sh -c domainname 2>/dev/null`
6761                         case "$dflt" in
6762                         '') dflt='.';;
6763                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6764                         esac
6765                         ;;
6766                 esac
6767                 case "$dflt" in
6768                 .) echo "(Lost all hope -- silly guess then)"
6769                         dflt='.uucp'
6770                         ;;
6771                 esac
6772                 $rm -f hosts
6773                 ;;
6774         *) dflt="$mydomain";;
6775         esac;;
6776 esac
6777 echo " "
6778 rp="What is your domain name?"
6779 . ./myread
6780 tans="$ans"
6781 case "$ans" in
6782 '') ;;
6783 .*) ;;
6784 *) tans=".$tans";;
6785 esac
6786 mydomain="$tans"
6787
6788 : translate upper to lower if necessary
6789 case "$mydomain" in
6790 *[A-Z]*)
6791         echo "(Normalizing case in your domain name)"
6792         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6793         ;;
6794 esac
6795
6796 : a little sanity check here
6797 case "$phostname" in
6798 '') ;;
6799 *)
6800         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6801         $myhostname$mydomain|$myhostname) ;;
6802         *)
6803                 case "$phostname" in
6804                 sed*)
6805                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6806                         ;;
6807                 *)
6808                         echo "(That doesn't agree with your $phostname command, by the way.)"
6809                         ;;
6810                 esac
6811         ;;
6812         esac
6813         ;;
6814 esac
6815
6816 $cat <<EOM
6817
6818 I need to get your e-mail address in Internet format if possible, i.e.
6819 something like user@host.domain. Please answer accurately since I have
6820 no easy means to double check it. The default value provided below
6821 is most probably close to reality but may not be valid from outside
6822 your organization...
6823
6824 EOM
6825 cont=x
6826 while test "$cont"; do
6827         case "$cf_email" in
6828         '') dflt="$cf_by@$myhostname$mydomain";;
6829         *) dflt="$cf_email";;
6830         esac
6831         rp='What is your e-mail address?'
6832         . ./myread
6833         cf_email="$ans"
6834         case "$cf_email" in
6835         *@*.*) cont='' ;;
6836         *)
6837                 rp='Address does not look like an Internet one.  Use it anyway?'
6838                 case "$fastread" in
6839                 yes) dflt=y ;;
6840                 *) dflt=n ;;
6841                 esac
6842                 . ./myread
6843                 case "$ans" in
6844                 y*) cont='' ;;
6845                 *) echo " " ;;
6846                 esac
6847                 ;;
6848         esac
6849 done
6850
6851 $cat <<EOM
6852
6853 If you or somebody else will be maintaining perl at your site, please
6854 fill in the correct e-mail address here so that they may be contacted
6855 if necessary. Currently, the "perlbug" program included with perl
6856 will send mail to this address in addition to perlbug@perl.com. You may
6857 enter "none" for no administrator.
6858
6859 EOM
6860 case "$perladmin" in
6861 '') dflt="$cf_email";;
6862 *) dflt="$perladmin";;
6863 esac
6864 rp='Perl administrator e-mail address'
6865 . ./myread
6866 perladmin="$ans"
6867
6868 : figure out how to guarantee perl startup
6869 case "$startperl" in
6870 '')
6871         case "$sharpbang" in
6872         *!)
6873                 $cat <<EOH
6874
6875 I can use the #! construct to start perl on your system. This will
6876 make startup of perl scripts faster, but may cause problems if you
6877 want to share those scripts and perl is not in a standard place
6878 ($binexp/perl) on all your platforms. The alternative is to force
6879 a shell by starting the script with a single ':' character.
6880
6881 EOH
6882                 dflt="$binexp/perl"
6883                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6884                 . ./myread
6885                 case "$ans" in
6886                 none)   startperl=": # use perl";;
6887                 *)      startperl="#!$ans"
6888                         if $test 30 -lt `echo "$ans" | wc -c`; then
6889                                 $cat >&4 <<EOM
6890
6891 WARNING:  Some systems limit the #! command to 32 characters.
6892 If you experience difficulty running Perl scripts with #!, try
6893 installing Perl in a directory with a shorter pathname.
6894
6895 EOM
6896                         fi ;;
6897                 esac
6898                 ;;
6899         *) startperl=": # use perl"
6900                 ;;
6901         esac
6902         ;;
6903 esac
6904 echo "I'll use $startperl to start perl scripts."
6905
6906 : figure best path for perl in scripts
6907 case "$perlpath" in
6908 '')
6909         perlpath="$binexp/perl"
6910         case "$startperl" in
6911         *!*) ;;
6912         *)
6913                 $cat <<EOH
6914
6915 I will use the "eval 'exec'" idiom to start Perl on your system.
6916 I can use the full path of your Perl binary for this purpose, but
6917 doing so may cause problems if you want to share those scripts and
6918 Perl is not always in a standard place ($binexp/perl).
6919
6920 EOH
6921                 dflt="$binexp/perl"
6922                 rp="What path shall I use in \"eval 'exec'\"?"
6923                 . ./myread
6924                 perlpath="$ans"
6925                 ;;
6926         esac
6927         ;;
6928 esac
6929 case "$startperl" in
6930 *!*)    ;;
6931 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6932 esac
6933
6934 : determine where public executable scripts go
6935 set scriptdir scriptdir
6936 eval $prefixit
6937 case "$scriptdir" in
6938 '')
6939         dflt="$bin"
6940         : guess some guesses
6941         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6942         $test -d /usr/share/bin     && dflt=/usr/share/bin
6943         $test -d /usr/local/script  && dflt=/usr/local/script
6944         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6945         $test -d $prefixexp/script  && dflt=$prefixexp/script
6946         set dflt
6947         eval $prefixup
6948         ;;
6949 *)  dflt="$scriptdir"
6950         ;;
6951 esac
6952 $cat <<EOM
6953  
6954 Some installations have a separate directory just for executable scripts so
6955 that they can mount it across multiple architectures but keep the scripts in
6956 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6957 Or you might just lump your scripts in with all your other executables.
6958  
6959 EOM
6960 fn=d~
6961 rp='Where do you keep publicly executable scripts?'
6962 . ./getfile
6963 if $test "X$ansexp" != "X$scriptdirexp"; then
6964         installscript=''
6965 fi
6966 scriptdir="$ans"
6967 scriptdirexp="$ansexp"
6968 : Change installation prefix, if necessary.
6969 if $test X"$prefix" != X"$installprefix"; then
6970         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6971 else
6972         installscript="$scriptdirexp"
6973 fi
6974
6975 : determine where site specific architecture-dependent libraries go.
6976 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6977 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6978 : sitelib may have an optional trailing /share.
6979 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6980 tdflt="$tdflt/$archname"
6981 set sitearch sitearch none
6982 eval $prefixit
6983 case "$sitearch" in
6984 '')     dflt="$tdflt" ;;
6985 *)      dflt="$sitearch" ;;
6986 esac
6987 $cat <<EOM
6988
6989 The installation process will also create a directory for
6990 architecture-dependent site-specific extensions and modules.
6991
6992 EOM
6993 fn=nd~+
6994 rp='Pathname for the site-specific architecture-dependent library files?'
6995 . ./getfile
6996 sitearch="$ans"
6997 sitearchexp="$ansexp"
6998 : Change installation prefix, if necessary.
6999 if $test X"$prefix" != X"$installprefix"; then
7000         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7001 else
7002         installsitearch="$sitearchexp"
7003 fi
7004
7005 : determine where add-on public executables go
7006 case "$sitebin" in
7007 '')     dflt=$siteprefix/bin ;;
7008 *)      dflt=$sitebin ;;
7009 esac
7010 fn=d~
7011 rp='Pathname where the add-on public executables should be installed?'
7012 . ./getfile
7013 sitebin="$ans"
7014 sitebinexp="$ansexp"
7015 : Change installation prefix, if necessary.
7016 if $test X"$prefix" != X"$installprefix"; then
7017         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7018 else
7019         installsitebin="$sitebinexp"
7020 fi
7021
7022 cat <<EOM
7023
7024 Perl can be built to take advantage of long doubles which
7025 (if available) may give more accuracy and range for floating point numbers.
7026
7027 If this doesn't make any sense to you, just accept the default 'n'.
7028 EOM
7029
7030 case "$ccflags" in
7031 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7032 esac
7033
7034 case "$uselongdouble" in
7035 $define|true|[yY]*)     dflt='y';;
7036 *) dflt='n';;
7037 esac
7038 rp='Try to use long doubles if available?'
7039 . ./myread
7040 case "$ans" in
7041 y|Y)    val="$define"   ;;
7042 *)      val="$undef"    ;;
7043 esac
7044 set uselongdouble
7045 eval $setvar
7046
7047 case "$uselongdouble" in
7048 true|[yY]*) uselongdouble="$define" ;;
7049 esac
7050
7051 case "$uselongdouble" in
7052 $define)
7053 : Look for a hint-file generated 'call-back-unit'.  If the
7054 : user has specified that long doubles should be used,
7055 : we may need to set or change some other defaults.
7056         if $test -f uselongdouble.cbu; then
7057                 echo "Your platform has some specific hints for long doubles, using them..."
7058                 . ./uselongdouble.cbu
7059         else
7060                 $cat <<EOM
7061 (Your platform doesn't have any specific hints for long doubles.)
7062 EOM
7063         fi
7064         ;;
7065 esac
7066
7067 cat <<EOM
7068
7069 Perl can be built to take advantage of long longs which
7070 (if available) may give more range for integer numbers.
7071
7072 If this doesn't make any sense to you, just accept the default 'n'.
7073 EOM
7074
7075 case "$ccflags" in
7076 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7077 esac
7078
7079 case "$uselonglong" in
7080 $define|true|[yY]*)     dflt='y';;
7081 *) dflt='n';;
7082 esac
7083 rp='Try to use long longs if available?'
7084 . ./myread
7085 case "$ans" in
7086 y|Y)    val="$define"   ;;
7087 *)      val="$undef"    ;;
7088 esac
7089 set uselonglong
7090 eval $setvar
7091
7092 case "$uselonglong" in
7093 true|[yY]*) uselonglong="$define" ;;
7094 esac
7095
7096 case "$uselonglong" in
7097 $define)
7098 : Look for a hint-file generated 'call-back-unit'.  If the
7099 : user has specified that long longs should be used,
7100 : we may need to set or change some other defaults.
7101         if $test -f uselonglong.cbu; then
7102                 echo "Your platform has some specific hints for long longs, using them..."
7103                 . ./uselonglong.cbu
7104         else
7105                 $cat <<EOM
7106 (Your platform doesn't have any specific hints for long longs.)
7107 EOM
7108         fi
7109         ;;
7110 esac
7111
7112 cat <<EOM
7113
7114 Previous version of $package used the standard IO mechanisms as defined
7115 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7116 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7117 the default.  This abstraction layer can use AT&T's sfio (if you already
7118 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7119 problems with some extension modules.  Using PerlIO with stdio is safe,
7120 but it is slower than plain stdio and therefore is not the default.
7121
7122 If this doesn't make any sense to you, just accept the default 'n'.
7123 EOM
7124 case "$useperlio" in
7125 $define|true|[yY]*)     dflt='y';;
7126 *) dflt='n';;
7127 esac
7128 rp='Use the experimental PerlIO abstraction layer?'
7129 . ./myread
7130 case "$ans" in
7131 y|Y) 
7132         val="$define"
7133         ;;     
7134 *)      
7135         echo "Ok, doing things the stdio way"
7136         val="$undef"
7137         ;;
7138 esac
7139 set useperlio
7140 eval $setvar 
7141
7142 case "$vendorprefix" in
7143 '')     d_vendorbin="$undef"
7144         vendorbin=''
7145         vendorbinexp=''
7146         ;;
7147 *)      d_vendorbin="$define"
7148         : determine where vendor-supplied executables go.
7149         dflt=$vendorprefix/bin
7150         fn=d~+
7151         rp='Pathname for the vendor-supplied executables directory?'
7152         . ./getfile
7153         vendorbin="$ans"
7154         vendorbinexp="$ansexp"
7155         : Change installation prefix, if necessary.
7156         if $test X"$prefix" != X"$installprefix"; then
7157                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7158         else
7159                 installvendorbin="$vendorbinexp"
7160         fi
7161         ;;
7162 esac
7163
7164 : check for length of double
7165 echo " "
7166 case "$doublesize" in
7167 '')
7168         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7169         $cat >try.c <<'EOCP'
7170 #include <stdio.h>
7171 int main()
7172 {
7173     printf("%d\n", (int)sizeof(double));
7174     exit(0);
7175 }
7176 EOCP
7177         set try
7178         if eval $compile_ok; then
7179                 doublesize=`./try`
7180                 $echo " $doublesize bytes." >&4
7181         else
7182                 dflt='8'
7183                 echo "(I can't seem to compile the test program.  Guessing...)"
7184                 rp="What is the size of a double precision number (in bytes)?"
7185                 . ./myread
7186                 doublesize="$ans"
7187         fi
7188         ;;
7189 esac
7190 $rm -f try.c try
7191
7192 : check for long doubles
7193 echo " "
7194 $echo $n "Checking to see if your system supports long double..." $c >&4
7195 echo 'int main() { long double x = 7.0; }' > try.c
7196 set try
7197 if eval $compile; then
7198         val="$define"
7199         echo " Yes, it does." >&4
7200 else
7201         val="$undef"
7202         echo " No, it doesn't." >&4
7203 fi
7204 $rm try.*
7205 set d_longdbl
7206 eval $setvar
7207
7208 : check for length of long double
7209 case "${d_longdbl}${longdblsize}" in
7210 $define)
7211         echo " "
7212         $echo $n "Checking to see how big your long doubles are..." $c >&4
7213         $cat >try.c <<'EOCP'
7214 #include <stdio.h>
7215 int main()
7216 {
7217         printf("%d\n", sizeof(long double));
7218 }
7219 EOCP
7220         set try
7221         set try
7222         if eval $compile; then
7223                 longdblsize=`./try$exe_ext`
7224                 $echo " $longdblsize bytes." >&4
7225         else
7226                 dflt='8'
7227                 echo " "
7228                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7229                 rp="What is the size of a long double (in bytes)?"
7230                 . ./myread
7231                 longdblsize="$ans"
7232         fi
7233         if $test "X$doublesize" = "X$longdblsize"; then
7234                 echo "(That isn't any different from an ordinary double.)"
7235         fi      
7236         ;;
7237 esac
7238 $rm -f try.* try
7239
7240 : Check how to convert floats to strings.
7241 if test "X$d_Gconvert" = X; then
7242         echo " "
7243         echo "Checking for an efficient way to convert floats to strings."
7244         $cat >try.c <<EOP
7245 #ifdef TRY_gconvert
7246 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7247 char *myname = "gconvert";
7248 #endif
7249 #ifdef TRY_gcvt
7250 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7251 char *myname = "gcvt";
7252 #endif
7253 #ifdef TRY_qgcvt
7254 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7255 char *myname = "qgcvt";
7256 #define DOUBLETYPE long double
7257 #endif
7258 #ifdef TRY_sprintf
7259 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7260 char *myname = "sprintf";
7261 #endif
7262
7263 #ifndef DOUBLETYPE
7264 #define DOUBLETYPE double
7265 #endif
7266
7267 #include <stdio.h>
7268
7269 #ifdef I_STDLIB
7270 #include <stdlib.h>
7271 #endif
7272
7273 int
7274 checkit(expect, got)
7275 char *expect;
7276 char *got;
7277 {
7278     if (strcmp(expect, got)) {
7279                 printf("%s oddity:  Expected %s, got %s\n",
7280                         myname, expect, got);
7281                 exit(1);
7282         }
7283 }
7284
7285 int main()
7286
7287         char buf[64]; 
7288         buf[63] = '\0';
7289
7290         /* This must be 1st test on (which?) platform */
7291         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7292         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7293         checkit("0.1", buf);
7294
7295         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7296         checkit("1", buf);
7297
7298         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7299         checkit("0", buf);
7300
7301         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7302         checkit("-1", buf);
7303
7304         /* Some Linux gcvt's give 1.e+5 here. */
7305         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7306         checkit("100000", buf);
7307         
7308         /* Some Linux gcvt's give -1.e+5 here. */
7309         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7310         checkit("-100000", buf);
7311
7312         exit(0);
7313 }
7314 EOP
7315         case "$d_Gconvert" in
7316         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7317         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7318         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7319         *) xxx_list='gconvert gcvt sprintf' ;;
7320         esac
7321
7322         case "$d_longdbl$uselongdouble" in
7323         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7324         esac
7325
7326         for xxx_convert in $xxx_list; do
7327                 echo "Trying $xxx_convert..."
7328                 $rm -f try try$_o
7329                 set try -DTRY_$xxx_convert
7330                 if eval $compile; then
7331                         echo "$xxx_convert() found." >&4
7332                         if ./try; then
7333                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7334                                 break;
7335                         else
7336                                 echo "...But $xxx_convert didn't work as I expected."
7337                         fi
7338                 else
7339                         echo "$xxx_convert NOT found." >&4
7340                 fi
7341         done
7342                 
7343         case "$xxx_convert" in
7344         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7345         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7346         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7347         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7348         esac
7349 fi
7350
7351 echo " "
7352
7353 if $test X"$d_longdbl" = X"$define"; then
7354
7355 echo "Checking how to print long doubles..." >&4
7356
7357 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7358         $cat >try.c <<'EOCP'
7359 #include <sys/types.h>
7360 #include <stdio.h>
7361 int main() {
7362   double d = 123.456;
7363   printf("%.3f\n", d);
7364 }
7365 EOCP
7366         set try
7367         if eval $compile; then
7368                 yyy=`./try$exe_ext`
7369                 case "$yyy" in
7370                 123.456)
7371                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7372                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7373                         echo "We will use %f."
7374                         ;;
7375                 esac
7376         fi
7377 fi
7378
7379 if $test X"$sPRIfldbl" = X; then
7380         $cat >try.c <<'EOCP'
7381 #include <sys/types.h>
7382 #include <stdio.h>
7383 int main() {
7384   long double d = 123.456;
7385   printf("%.3llf\n", d);
7386 }
7387 EOCP
7388         set try
7389         if eval $compile; then
7390                 yyy=`./try$exe_ext`
7391                 case "$yyy" in
7392                 123.456)
7393                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7394                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7395                         echo "We will use %llf."
7396                         ;;
7397                 esac
7398         fi
7399 fi
7400
7401 if $test X"$sPRIfldbl" = X; then
7402         $cat >try.c <<'EOCP'
7403 #include <sys/types.h>
7404 #include <stdio.h>
7405 int main() {
7406   long double d = 123.456;
7407   printf("%.3Lf\n", d);
7408 }
7409 EOCP
7410         set try
7411         if eval $compile; then
7412                 yyy=`./try$exe_ext`
7413                 case "$yyy" in
7414                 123.456)
7415                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7416                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7417                         echo "We will use %Lf."
7418                         ;;
7419                 esac
7420         fi
7421 fi
7422
7423 if $test X"$sPRIfldbl" = X; then
7424         $cat >try.c <<'EOCP'
7425 #include <sys/types.h>
7426 #include <stdio.h>
7427 int main() {
7428   long double d = 123.456;
7429   printf("%.3lf\n", d);
7430 }
7431 EOCP
7432         set try
7433         if eval $compile; then
7434                 yyy=`./try$exe_ext`
7435                 case "$yyy" in
7436                 123.456)
7437                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7438                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7439                         echo "We will use %lf."
7440                         ;;
7441                 esac
7442         fi
7443 fi
7444
7445 if $test X"$sPRIfldbl" = X; then
7446         echo "Cannot figure out how to print long doubles." >&4
7447 fi
7448
7449 $rm -f try try.*
7450
7451 fi # d_longdbl
7452
7453 case "$sPRIfldbl" in
7454 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7455         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7456         ;;
7457 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7458         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7459         ;;
7460 esac
7461
7462 : Initialize h_fcntl
7463 h_fcntl=false
7464
7465 : Initialize h_sysfile
7466 h_sysfile=false
7467
7468 : access call always available on UNIX
7469 set access d_access
7470 eval $inlibc
7471
7472 : locate the flags for 'access()'
7473 case "$d_access" in
7474 "$define")
7475         echo " "
7476         $cat >access.c <<'EOCP'
7477 #include <sys/types.h>
7478 #ifdef I_FCNTL
7479 #include <fcntl.h>
7480 #endif
7481 #ifdef I_SYS_FILE
7482 #include <sys/file.h>
7483 #endif
7484 #ifdef I_UNISTD
7485 #include <unistd.h>
7486 #endif
7487 int main() {
7488         exit(R_OK);
7489 }
7490 EOCP
7491         : check sys/file.h first, no particular reason here
7492         if $test `./findhdr sys/file.h` && \
7493                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7494                 h_sysfile=true;
7495                 echo "<sys/file.h> defines the *_OK access constants." >&4
7496         elif $test `./findhdr fcntl.h` && \
7497                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7498                 h_fcntl=true;
7499                 echo "<fcntl.h> defines the *_OK access constants." >&4
7500         elif $test `./findhdr unistd.h` && \
7501                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7502                 echo "<unistd.h> defines the *_OK access constants." >&4
7503         else
7504                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7505         fi
7506         ;;
7507 esac
7508 $rm -f access*
7509
7510 : see if accessx exists
7511 set accessx d_accessx
7512 eval $inlibc
7513
7514 : see if alarm exists
7515 set alarm d_alarm
7516 eval $inlibc
7517
7518 : see if atolf exists
7519 set atolf d_atolf
7520 eval $inlibc
7521
7522 : see if atoll exists
7523 set atoll d_atoll
7524 eval $inlibc
7525
7526 : Look for GNU-cc style attribute checking
7527 echo " "
7528 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7529 $cat >attrib.c <<'EOCP'
7530 #include <stdio.h>
7531 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7532 EOCP
7533 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7534         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7535                 echo "Your C compiler doesn't fully support __attribute__."
7536                 val="$undef"
7537         else
7538                 echo "Your C compiler supports __attribute__."
7539                 val="$define"
7540         fi
7541 else
7542         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7543         val="$undef"
7544 fi
7545 set d_attribut
7546 eval $setvar
7547 $rm -f attrib*
7548
7549 : see if bcmp exists
7550 set bcmp d_bcmp
7551 eval $inlibc
7552
7553 : see if bcopy exists
7554 set bcopy d_bcopy
7555 eval $inlibc
7556
7557 : see if this is a unistd.h system
7558 set unistd.h i_unistd
7559 eval $inhdr
7560
7561 : see if getpgrp exists
7562 set getpgrp d_getpgrp
7563 eval $inlibc
7564
7565 case "$d_getpgrp" in
7566 "$define")
7567         echo " "
7568         echo "Checking to see which flavor of getpgrp is in use..."
7569         $cat >set.c <<EOP
7570 #$i_unistd I_UNISTD
7571 #include <sys/types.h>
7572 #ifdef I_UNISTD
7573 #  include <unistd.h>
7574 #endif
7575 int main()
7576 {
7577         if (getuid() == 0) {
7578                 printf("(I see you are running Configure as super-user...)\n");
7579                 setuid(1);
7580         }
7581 #ifdef TRY_BSD_PGRP
7582         if (getpgrp(1) == 0)
7583                 exit(0);
7584 #else
7585         if (getpgrp() > 0)
7586                 exit(0);
7587 #endif
7588         exit(1);
7589 }
7590 EOP
7591         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7592                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7593                 val="$define"
7594         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7595                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7596                 val="$undef"
7597         else
7598                 echo "I can't seem to compile and run the test program."
7599                 if ./usg; then
7600                         xxx="a USG one, i.e. you use getpgrp()."
7601                 else
7602                         # SVR4 systems can appear rather BSD-ish.
7603                         case "$i_unistd" in
7604                         $undef)
7605                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7606                                 val="$define"
7607                                 ;;
7608                         $define)
7609                                 xxx="probably a USG one, i.e. you use getpgrp()."
7610                                 val="$undef"
7611                                 ;;
7612                         esac
7613                 fi
7614                 echo "Assuming your getpgrp is $xxx" >&4
7615         fi
7616         ;;
7617 *) val="$undef";;
7618 esac
7619 set d_bsdgetpgrp
7620 eval $setvar
7621 $rm -f set set.c
7622
7623 : see if setpgrp exists
7624 set setpgrp d_setpgrp
7625 eval $inlibc
7626
7627 case "$d_setpgrp" in
7628 "$define")
7629         echo " "
7630         echo "Checking to see which flavor of setpgrp is in use..."
7631         $cat >set.c <<EOP
7632 #$i_unistd I_UNISTD
7633 #include <sys/types.h>
7634 #ifdef I_UNISTD
7635 #  include <unistd.h>
7636 #endif
7637 int main()
7638 {
7639         if (getuid() == 0) {
7640                 printf("(I see you are running Configure as super-user...)\n");
7641                 setuid(1);
7642         }
7643 #ifdef TRY_BSD_PGRP
7644         if (-1 == setpgrp(1, 1))
7645                 exit(0);
7646 #else
7647         if (setpgrp() != -1)
7648                 exit(0);
7649 #endif
7650         exit(1);
7651 }
7652 EOP
7653         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7654                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7655                 val="$define"
7656         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7657                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7658                 val="$undef"
7659         else
7660                 echo "(I can't seem to compile and run the test program.)"
7661                 if ./usg; then
7662                         xxx="a USG one, i.e. you use setpgrp()."
7663                 else
7664                         # SVR4 systems can appear rather BSD-ish.
7665                         case "$i_unistd" in
7666                         $undef)
7667                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7668                                 val="$define"
7669                                 ;;
7670                         $define)
7671                                 xxx="probably a USG one, i.e. you use setpgrp()."
7672                                 val="$undef"
7673                                 ;;
7674                         esac
7675                 fi
7676                 echo "Assuming your setpgrp is $xxx" >&4
7677         fi
7678         ;;
7679 *) val="$undef";;
7680 esac
7681 set d_bsdsetpgrp
7682 eval $setvar
7683 $rm -f set set.c
7684 : see if bzero exists
7685 set bzero d_bzero
7686 eval $inlibc
7687
7688 : see if signal is declared as pointer to function returning int or void
7689 echo " "
7690 xxx=`./findhdr signal.h`
7691 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7692 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7693         echo "You have int (*signal())() instead of void." >&4
7694         val="$undef"
7695 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7696         echo "You have void (*signal())()." >&4
7697         val="$define"
7698 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7699         echo "You have int (*signal())() instead of void." >&4
7700         val="$undef"
7701 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7702         echo "You have void (*signal())()." >&4
7703         val="$define"
7704 else
7705         case "$d_voidsig" in
7706         '')
7707         echo "I can't determine whether signal handler returns void or int..." >&4
7708                 dflt=void
7709                 rp="What type does your signal handler return?"
7710                 . ./myread
7711                 case "$ans" in
7712                 v*) val="$define";;
7713                 *) val="$undef";;
7714                 esac;;
7715         "$define")
7716                 echo "As you already told me, signal handler returns void." >&4
7717                 val="$define"
7718                 ;;
7719         *)      echo "As you already told me, signal handler returns int." >&4
7720                 val="$undef"
7721                 ;;
7722         esac
7723 fi
7724 set d_voidsig
7725 eval $setvar
7726 case "$d_voidsig" in
7727 "$define") signal_t="void";;
7728 *) signal_t="int";;
7729 esac
7730 $rm -f $$.tmp
7731
7732 : check for ability to cast large floats to 32-bit ints.
7733 echo " "
7734 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7735 if $test "$intsize" -ge 4; then
7736         xxx=int
7737 else
7738         xxx=long
7739 fi
7740 $cat >try.c <<EOCP
7741 #include <stdio.h>
7742 #include <sys/types.h>
7743 #include <signal.h>
7744 $signal_t blech(s) int s; { exit(3); }
7745 int main()
7746 {
7747         $xxx i32;
7748         double f, g;
7749         int result = 0;
7750         char str[16];
7751         signal(SIGFPE, blech);
7752
7753         /* Don't let compiler optimize the test away.  Store the number 
7754            in a writable string for gcc to pass to sscanf under HP/UX.
7755         */
7756         sprintf(str, "2147483647");
7757         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7758         g = 10 * f;
7759         i32  = ($xxx) g;
7760
7761         /* x86 processors will probably give 0x8000 0000, which is a
7762        sign change.  We don't want that.  We want to mimic SPARC
7763            behavior here, which is to preserve the sign and give
7764            back 0x7fff ffff.
7765         */
7766         if (i32 != ($xxx) f)
7767                 result |= 1;
7768         exit(result);
7769 }
7770 EOCP
7771 set try
7772 if eval $compile_ok; then
7773         ./try
7774         yyy=$?
7775 else
7776         echo "(I can't seem to compile the test program--assuming it can't)"
7777         yyy=1
7778 fi
7779 case "$yyy" in
7780 0)      val="$define"
7781         echo "Yup, it can."
7782         ;;
7783 *)      val="$undef"
7784         echo "Nope, it can't."
7785         ;;
7786 esac
7787 set d_casti32
7788 eval $setvar
7789 $rm -f try try.*
7790
7791 : check for ability to cast negative floats to unsigned
7792 echo " "
7793 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7794 $cat >try.c <<EOCP
7795 #include <stdio.h>
7796 #include <sys/types.h>
7797 #include <signal.h>
7798 $signal_t blech(s) int s; { exit(7); }
7799 $signal_t blech_in_list(s) int s; { exit(4); }
7800 unsigned long dummy_long(p) unsigned long p; { return p; }
7801 unsigned int dummy_int(p) unsigned int p; { return p; }
7802 unsigned short dummy_short(p) unsigned short p; { return p; }
7803 int main()
7804 {
7805         double f;
7806         unsigned long along;
7807         unsigned int aint;
7808         unsigned short ashort;
7809         int result = 0;
7810         char str[16];
7811         
7812         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7813            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7814            optimized the whole file away
7815         */
7816         /* Store the number in a writable string for gcc to pass to 
7817            sscanf under HP/UX.
7818         */
7819         sprintf(str, "-123");
7820         sscanf(str, "%lf", &f);  /* f = -123.; */
7821
7822         signal(SIGFPE, blech);
7823         along = (unsigned long)f;
7824         aint = (unsigned int)f;
7825         ashort = (unsigned short)f;
7826         if (along != (unsigned long)-123)
7827                 result |= 1;
7828         if (aint != (unsigned int)-123)
7829                 result |= 1;
7830         if (ashort != (unsigned short)-123)
7831                 result |= 1;
7832         sprintf(str, "1073741824.");
7833         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7834         f = f + f;
7835         along = 0;
7836         along = (unsigned long)f;
7837         if (along != 0x80000000)
7838                 result |= 2;
7839         f -= 1.;
7840         along = 0;
7841         along = (unsigned long)f;
7842         if (along != 0x7fffffff)
7843                 result |= 1;
7844         f += 2.;
7845         along = 0;
7846         along = (unsigned long)f;
7847         if (along != 0x80000001)
7848                 result |= 2;
7849         if (result)
7850                 exit(result);
7851         signal(SIGFPE, blech_in_list);
7852         sprintf(str, "123.");
7853         sscanf(str, "%lf", &f);  /* f = 123.; */
7854         along = dummy_long((unsigned long)f);
7855         aint = dummy_int((unsigned int)f);
7856         ashort = dummy_short((unsigned short)f);
7857         if (along != (unsigned long)123)
7858                 result |= 4;
7859         if (aint != (unsigned int)123)
7860                 result |= 4;
7861         if (ashort != (unsigned short)123)
7862                 result |= 4;
7863         exit(result);
7864
7865 }
7866 EOCP
7867 set try
7868 if eval $compile_ok; then
7869         ./try
7870         castflags=$?
7871 else
7872         echo "(I can't seem to compile the test program--assuming it can't)"
7873         castflags=7
7874 fi
7875 case "$castflags" in
7876 0)      val="$define"
7877         echo "Yup, it can."
7878         ;;
7879 *)      val="$undef"
7880         echo "Nope, it can't."
7881         ;;
7882 esac
7883 set d_castneg
7884 eval $setvar
7885 $rm -f try.*
7886
7887 : see if vprintf exists
7888 echo " "
7889 if set vprintf val -f d_vprintf; eval $csym; $val; then
7890         echo 'vprintf() found.' >&4
7891         val="$define"
7892         $cat >vprintf.c <<'EOF'
7893 #include <varargs.h>
7894
7895 int main() { xxx("foo"); }
7896
7897 xxx(va_alist)
7898 va_dcl
7899 {
7900         va_list args;
7901         char buf[10];
7902
7903         va_start(args);
7904         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7905 }
7906 EOF
7907         set vprintf
7908         if eval $compile && ./vprintf; then
7909                 echo "Your vsprintf() returns (int)." >&4
7910                 val2="$undef"
7911         else
7912                 echo "Your vsprintf() returns (char*)." >&4
7913                 val2="$define"
7914         fi
7915 else
7916         echo 'vprintf() NOT found.' >&4
7917                 val="$undef"
7918                 val2="$undef"
7919 fi
7920 set d_vprintf
7921 eval $setvar
7922 val=$val2
7923 set d_charvspr
7924 eval $setvar
7925
7926 : see if chown exists
7927 set chown d_chown
7928 eval $inlibc
7929
7930 : see if chroot exists
7931 set chroot d_chroot
7932 eval $inlibc
7933
7934 : see if chsize exists
7935 set chsize d_chsize
7936 eval $inlibc
7937
7938 : check for const keyword
7939 echo " "
7940 echo 'Checking to see if your C compiler knows about "const"...' >&4
7941 $cat >const.c <<'EOCP'
7942 typedef struct spug { int drokk; } spug;
7943 int main()
7944 {
7945         const char *foo;
7946         const spug y;
7947 }
7948 EOCP
7949 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7950         val="$define"
7951         echo "Yup, it does."
7952 else
7953         val="$undef"
7954         echo "Nope, it doesn't."
7955 fi
7956 set d_const
7957 eval $setvar
7958
7959 : see if crypt exists
7960 echo " "
7961 if set crypt val -f d_crypt; eval $csym; $val; then
7962         echo 'crypt() found.' >&4
7963         val="$define"
7964         cryptlib=''
7965 else
7966         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7967         if $test -z "$cryptlib"; then
7968                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7969         else
7970                 cryptlib=-lcrypt
7971         fi
7972         if $test -z "$cryptlib"; then
7973                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7974         else
7975                 cryptlib=-lcrypt
7976         fi
7977         if $test -z "$cryptlib"; then
7978                 cryptlib=`./loc libcrypt$_a "" $libpth`
7979         else
7980                 cryptlib=-lcrypt
7981         fi
7982         if $test -z "$cryptlib"; then
7983                 echo 'crypt() NOT found.' >&4
7984                 val="$undef"
7985         else
7986                 val="$define"
7987         fi
7988 fi
7989 set d_crypt
7990 eval $setvar
7991
7992 : get csh whereabouts
7993 case "$csh" in
7994 'csh') val="$undef" ;;
7995 *) val="$define" ;;
7996 esac
7997 set d_csh
7998 eval $setvar
7999 : Respect a hint or command line value for full_csh.
8000 case "$full_csh" in
8001 '') full_csh=$csh ;;
8002 esac
8003
8004 : see if cuserid exists
8005 set cuserid d_cuserid
8006 eval $inlibc
8007
8008 : see if this is a limits.h system
8009 set limits.h i_limits
8010 eval $inhdr
8011
8012 : see if this is a float.h system
8013 set float.h i_float
8014 eval $inhdr
8015
8016 : See if number of significant digits in a double precision number is known
8017 echo " "
8018 $cat >dbl_dig.c <<EOM
8019 #$i_limits I_LIMITS
8020 #$i_float I_FLOAT
8021 #ifdef I_LIMITS
8022 #include <limits.h>
8023 #endif
8024 #ifdef I_FLOAT
8025 #include <float.h>
8026 #endif
8027 #ifdef DBL_DIG
8028 printf("Contains DBL_DIG");
8029 #endif
8030 EOM
8031 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8032 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8033         echo "DBL_DIG found." >&4
8034         val="$define"
8035 else
8036         echo "DBL_DIG NOT found." >&4
8037         val="$undef"
8038 fi
8039 $rm -f dbl_dig.?
8040 set d_dbl_dig
8041 eval $setvar
8042
8043 : see if difftime exists
8044 set difftime d_difftime
8045 eval $inlibc
8046
8047 : see if this is a dirent system
8048 echo " "
8049 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8050         val="$define"
8051         echo "<dirent.h> found." >&4
8052 else
8053         val="$undef"
8054         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8055                 echo "<sys/dir.h> found." >&4
8056                 echo " "
8057         else
8058                 xinc=`./findhdr sys/ndir.h`
8059         fi
8060         echo "<dirent.h> NOT found." >&4
8061 fi
8062 set i_dirent
8063 eval $setvar
8064
8065 : Look for type of directory structure.
8066 echo " "
8067 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8068
8069 case "$direntrytype" in
8070 ''|' ')
8071         case "$i_dirent" in
8072         $define) guess1='struct dirent' ;;
8073         *) guess1='struct direct'  ;;
8074         esac
8075         ;;
8076 *)      guess1="$direntrytype"
8077         ;;
8078 esac
8079
8080 case "$guess1" in
8081 'struct dirent') guess2='struct direct' ;;
8082 *) guess2='struct dirent' ;;
8083 esac
8084                 
8085 if $contains "$guess1" try.c >/dev/null 2>&1; then
8086         direntrytype="$guess1"
8087         echo "Your directory entries are $direntrytype." >&4
8088 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8089         direntrytype="$guess2"
8090         echo "Your directory entries seem to be $direntrytype." >&4
8091 else
8092         echo "I don't recognize your system's directory entries." >&4
8093         rp="What type is used for directory entries on this system?"
8094         dflt="$guess1"
8095         . ./myread
8096         direntrytype="$ans"
8097 fi
8098 $rm -f try.c
8099
8100
8101 : see if the directory entry stores field length
8102 echo " "
8103 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8104 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8105         echo "Good, your directory entry keeps length information in d_namlen." >&4
8106         val="$define"
8107 else
8108         echo "Your directory entry does not know about the d_namlen field." >&4
8109         val="$undef"
8110 fi
8111 set d_dirnamlen
8112 eval $setvar
8113 $rm -f try.c
8114
8115 : see if dlerror exists
8116 xxx_runnm="$runnm"
8117 runnm=false
8118 set dlerror d_dlerror
8119 eval $inlibc
8120 runnm="$xxx_runnm"
8121
8122 : see if dlfcn is available
8123 set dlfcn.h i_dlfcn
8124 eval $inhdr
8125
8126 case "$usedl" in
8127 $define|y|true)
8128         $cat << EOM
8129
8130 On a few systems, the dynamically loaded modules that perl generates and uses
8131 will need a different extension than shared libs. The default will probably
8132 be appropriate.
8133
8134 EOM
8135         case "$dlext" in
8136         '')     dflt="$so" ;;
8137         *)      dflt="$dlext" ;;
8138         esac
8139         rp='What is the extension of dynamically loaded modules'
8140         . ./myread
8141         dlext="$ans"
8142         ;;
8143 *)
8144         dlext="none"
8145         ;;
8146 esac
8147
8148 : Check if dlsym need a leading underscore
8149 echo " "
8150 val="$undef"
8151
8152 case "$dlsrc" in
8153 dl_dlopen.xs)
8154         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8155         $cat >dyna.c <<'EOM'
8156 fred () { }
8157 EOM
8158
8159 $cat >fred.c<<EOM
8160
8161 #include <stdio.h>
8162 #$i_dlfcn I_DLFCN
8163 #ifdef I_DLFCN
8164 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8165 #else
8166 #include <sys/types.h>
8167 #include <nlist.h>
8168 #include <link.h>
8169 #endif
8170
8171 extern int fred() ;
8172
8173 int main()
8174 {
8175     void * handle ;
8176     void * symbol ;
8177 #ifndef RTLD_LAZY
8178     int mode = 1 ;
8179 #else
8180     int mode = RTLD_LAZY ;
8181 #endif
8182     handle = dlopen("./dyna.$dlext", mode) ;
8183     if (handle == NULL) {
8184         printf ("1\n") ;
8185         fflush (stdout) ;
8186         exit(0);
8187     }
8188     symbol = dlsym(handle, "fred") ;
8189     if (symbol == NULL) {
8190         /* try putting a leading underscore */
8191         symbol = dlsym(handle, "_fred") ;
8192         if (symbol == NULL) {
8193             printf ("2\n") ;
8194             fflush (stdout) ;
8195             exit(0);
8196         }
8197         printf ("3\n") ;
8198     }
8199     else
8200         printf ("4\n") ;
8201     fflush (stdout) ;
8202     exit(0);
8203 }
8204 EOM
8205         : Call the object file tmp-dyna.o in case dlext=o.
8206         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8207                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8208                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8209                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8210                 xxx=`./fred`
8211                 case $xxx in
8212                 1)      echo "Test program failed using dlopen." >&4
8213                         echo "Perhaps you should not use dynamic loading." >&4;;
8214                 2)      echo "Test program failed using dlsym." >&4
8215                         echo "Perhaps you should not use dynamic loading." >&4;;
8216                 3)      echo "dlsym needs a leading underscore" >&4
8217                         val="$define" ;;
8218                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8219                 esac
8220         else
8221                 echo "I can't compile and run the test program." >&4
8222                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8223         fi
8224         ;;
8225 esac
8226                 
8227 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8228
8229 set d_dlsymun
8230 eval $setvar
8231
8232 hasproto='varname=$1; func=$2; shift; shift;
8233 while $test $# -ge 2; do
8234         case "$1" in
8235         $define) echo "#include <$2>";;
8236         esac ;
8237     shift 2;
8238 done > try.c;
8239 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8240 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8241         echo "$func() prototype found.";
8242         val="$define";
8243 else
8244         echo "$func() prototype NOT found.";
8245         val="$undef";
8246 fi;
8247 set $varname;
8248 eval $setvar;
8249 $rm -f try.c tryout.c'
8250
8251 : see if prototype for drand48 is available
8252 echo " "
8253 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8254 eval $hasproto
8255
8256 : see if dup2 exists
8257 set dup2 d_dup2
8258 eval $inlibc
8259
8260 : see if eaccess exists
8261 set eaccess d_eaccess
8262 eval $inlibc
8263
8264 : see if endgrent exists
8265 set endgrent d_endgrent
8266 eval $inlibc
8267
8268 : see if endhostent exists
8269 set endhostent d_endhent
8270 eval $inlibc
8271
8272 : see if endnetent exists
8273 set endnetent d_endnent
8274 eval $inlibc
8275
8276 : see if endprotoent exists
8277 set endprotoent d_endpent
8278 eval $inlibc
8279
8280 : see if endpwent exists
8281 set endpwent d_endpwent
8282 eval $inlibc
8283
8284 : see if endservent exists
8285 set endservent d_endsent
8286 eval $inlibc
8287
8288 : see if endspent exists
8289 set endspent d_endspent
8290 eval $inlibc
8291
8292 : Locate the flags for 'open()'
8293 echo " "
8294 $cat >open3.c <<'EOCP'
8295 #include <sys/types.h>
8296 #ifdef I_FCNTL
8297 #include <fcntl.h>
8298 #endif
8299 #ifdef I_SYS_FILE
8300 #include <sys/file.h>
8301 #endif
8302 int main() {
8303         if(O_RDONLY);
8304 #ifdef O_TRUNC
8305         exit(0);
8306 #else
8307         exit(1);
8308 #endif
8309 }
8310 EOCP
8311 : check sys/file.h first to get FREAD on Sun
8312 if $test `./findhdr sys/file.h` && \
8313                 set open3 -DI_SYS_FILE && eval $compile; then
8314         h_sysfile=true;
8315         echo "<sys/file.h> defines the O_* constants..." >&4
8316         if ./open3; then
8317                 echo "and you have the 3 argument form of open()." >&4
8318                 val="$define"
8319         else
8320                 echo "but not the 3 argument form of open().  Oh, well." >&4
8321                 val="$undef"
8322         fi
8323 elif $test `./findhdr fcntl.h` && \
8324                 set open3 -DI_FCNTL && eval $compile; then
8325         h_fcntl=true;
8326         echo "<fcntl.h> defines the O_* constants..." >&4
8327         if ./open3; then
8328                 echo "and you have the 3 argument form of open()." >&4
8329                 val="$define"
8330         else
8331                 echo "but not the 3 argument form of open().  Oh, well." >&4
8332                 val="$undef"
8333         fi
8334 else
8335         val="$undef"
8336         echo "I can't find the O_* constant definitions!  You got problems." >&4
8337 fi
8338 set d_open3
8339 eval $setvar
8340 $rm -f open3*
8341
8342 : see which of string.h or strings.h is needed
8343 echo " "
8344 strings=`./findhdr string.h`
8345 if $test "$strings" && $test -r "$strings"; then
8346         echo "Using <string.h> instead of <strings.h>." >&4
8347         val="$define"
8348 else
8349         val="$undef"
8350         strings=`./findhdr strings.h`
8351         if $test "$strings" && $test -r "$strings"; then
8352                 echo "Using <strings.h> instead of <string.h>." >&4
8353         else
8354                 echo "No string header found -- You'll surely have problems." >&4
8355         fi
8356 fi
8357 set i_string
8358 eval $setvar
8359 case "$i_string" in
8360 "$undef") strings=`./findhdr strings.h`;;
8361 *)        strings=`./findhdr string.h`;;
8362 esac
8363
8364 : check for non-blocking I/O stuff
8365 case "$h_sysfile" in
8366 true) echo "#include <sys/file.h>" > head.c;;
8367 *)
8368         case "$h_fcntl" in
8369         true) echo "#include <fcntl.h>" > head.c;;
8370         *) echo "#include <sys/fcntl.h>" > head.c;;
8371         esac
8372         ;;
8373 esac
8374 echo " "
8375 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8376 case "$o_nonblock" in
8377 '')
8378         $cat head.c > try.c
8379         $cat >>try.c <<'EOCP'
8380 #include <stdio.h>
8381 int main() {
8382 #ifdef O_NONBLOCK
8383         printf("O_NONBLOCK\n");
8384         exit(0);
8385 #endif
8386 #ifdef O_NDELAY
8387         printf("O_NDELAY\n");
8388         exit(0);
8389 #endif
8390 #ifdef FNDELAY
8391         printf("FNDELAY\n");
8392         exit(0);
8393 #endif
8394         exit(0);
8395 }
8396 EOCP
8397         set try
8398         if eval $compile_ok; then
8399                 o_nonblock=`./try`
8400                 case "$o_nonblock" in
8401                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8402                 *) echo "Seems like we can use $o_nonblock.";;
8403                 esac
8404         else
8405                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8406         fi
8407         ;;
8408 *) echo "Using $hint value $o_nonblock.";;
8409 esac
8410 $rm -f try try.* .out core
8411
8412 echo " "
8413 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8414 case "$eagain" in
8415 '')
8416         $cat head.c > try.c
8417         $cat >>try.c <<EOCP
8418 #include <errno.h>
8419 #include <sys/types.h>
8420 #include <signal.h>
8421 #include <stdio.h> 
8422 #define MY_O_NONBLOCK $o_nonblock
8423 #ifndef errno  /* XXX need better Configure test */
8424 extern int errno;
8425 #endif
8426 #$i_unistd I_UNISTD
8427 #ifdef I_UNISTD
8428 #include <unistd.h>
8429 #endif
8430 #ifdef $i_string
8431 #include <string.h>
8432 #else
8433 #include <strings.h>
8434 #endif
8435 $signal_t blech(x) int x; { exit(3); }
8436 EOCP
8437         $cat >> try.c <<'EOCP'
8438 int main()
8439 {
8440         int pd[2];
8441         int pu[2];
8442         char buf[1];
8443         char string[100];
8444
8445         pipe(pd);       /* Down: child -> parent */
8446         pipe(pu);       /* Up: parent -> child */
8447         if (0 != fork()) {
8448                 int ret;
8449                 close(pd[1]);   /* Parent reads from pd[0] */
8450                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8451                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8452                         exit(1);
8453                 signal(SIGALRM, blech);
8454                 alarm(5);
8455                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8456                         exit(2);
8457                 sprintf(string, "%d\n", ret);
8458                 write(2, string, strlen(string));
8459                 alarm(0);
8460 #ifdef EAGAIN
8461                 if (errno == EAGAIN) {
8462                         printf("EAGAIN\n");
8463                         goto ok;
8464                 }
8465 #endif
8466 #ifdef EWOULDBLOCK
8467                 if (errno == EWOULDBLOCK)
8468                         printf("EWOULDBLOCK\n");
8469 #endif
8470         ok:
8471                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8472                 sleep(2);                               /* Give it time to close our pipe */
8473                 alarm(5);
8474                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8475                 alarm(0);
8476                 sprintf(string, "%d\n", ret);
8477                 write(3, string, strlen(string));
8478                 exit(0);
8479         }
8480
8481         close(pd[0]);                   /* We write to pd[1] */
8482         close(pu[1]);                   /* We read from pu[0] */
8483         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8484         close(pd[1]);                   /* Pipe pd is now fully closed! */
8485         exit(0);                                /* Bye bye, thank you for playing! */
8486 }
8487 EOCP
8488         set try
8489         if eval $compile_ok; then
8490                 echo "$startsh" >mtry
8491                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8492                 chmod +x mtry
8493                 ./mtry >/dev/null 2>&1
8494                 case $? in
8495                 0) eagain=`$cat try.out`;;
8496                 1) echo "Could not perform non-blocking setting!";;
8497                 2) echo "I did a successful read() for something that was not there!";;
8498                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8499                 *) echo "Something terribly wrong happened during testing.";;
8500                 esac
8501                 rd_nodata=`$cat try.ret`
8502                 echo "A read() system call with no data present returns $rd_nodata."
8503                 case "$rd_nodata" in
8504                 0|-1) ;;
8505                 *)
8506                         echo "(That's peculiar, fixing that to be -1.)"
8507                         rd_nodata=-1
8508                         ;;
8509                 esac
8510                 case "$eagain" in
8511                 '')
8512                         echo "Forcing errno EAGAIN on read() with no data available."
8513                         eagain=EAGAIN
8514                         ;;
8515                 *)
8516                         echo "Your read() sets errno to $eagain when no data is available."
8517                         ;;
8518                 esac
8519                 status=`$cat try.err`
8520                 case "$status" in
8521                 0) echo "And it correctly returns 0 to signal EOF.";;
8522                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8523                 *) echo "However, your read() returns '$status' on EOF??";;
8524                 esac
8525                 val="$define"
8526                 if test "$status" = "$rd_nodata"; then
8527                         echo "WARNING: you can't distinguish between EOF and no data!"
8528                         val="$undef"
8529                 fi
8530         else
8531                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8532                 eagain=EAGAIN
8533         fi
8534         set d_eofnblk
8535         eval $setvar
8536         ;;
8537 *)
8538         echo "Using $hint value $eagain."
8539         echo "Your read() returns $rd_nodata when no data is present."
8540         case "$d_eofnblk" in
8541         "$define") echo "And you can see EOF because read() returns 0.";;
8542         "$undef") echo "But you can't see EOF status from read() returned value.";;
8543         *)
8544                 echo "(Assuming you can't see EOF status from read anyway.)"
8545                 d_eofnblk=$undef
8546                 ;;
8547         esac
8548         ;;
8549 esac
8550 $rm -f try try.* .out core head.c mtry
8551
8552 : see if fchmod exists
8553 set fchmod d_fchmod
8554 eval $inlibc
8555
8556 : see if fchown exists
8557 set fchown d_fchown
8558 eval $inlibc
8559
8560 : see if this is an fcntl system
8561 set fcntl d_fcntl
8562 eval $inlibc
8563
8564 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8565 while $test $# -ge 2; do
8566         case "$1" in
8567         $define) echo "#include <$2>";;
8568         esac ;
8569     shift 2;
8570 done > try.c;
8571 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8572 set try;
8573 if eval $compile; then
8574         val="$define";
8575 else
8576         val="$undef";
8577 fi;
8578 set $varname;
8579 eval $setvar;
8580 $rm -f try.c try.o'
8581
8582 socketlib=''
8583 sockethdr=''
8584 : see whether socket exists
8585 echo " "
8586 $echo $n "Hmm... $c" >&4
8587 if set socket val -f d_socket; eval $csym; $val; then
8588         echo "Looks like you have Berkeley networking support." >&4
8589         d_socket="$define"
8590         if set setsockopt val -f; eval $csym; $val; then
8591                 d_oldsock="$undef"
8592         else
8593                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8594                 d_oldsock="$define"
8595         fi
8596 else
8597         if $contains socklib libc.list >/dev/null 2>&1; then
8598                 echo "Looks like you have Berkeley networking support." >&4
8599                 d_socket="$define"
8600                 : we will have to assume that it supports the 4.2 BSD interface
8601                 d_oldsock="$undef"
8602         else
8603                 echo "You don't have Berkeley networking in libc$_a..." >&4
8604                 if test "X$d_socket" = "X$define"; then
8605                    echo "...but you seem to believe that you have sockets." >&4
8606                 else
8607                         for net in net socket
8608                         do
8609                                 if test -f /usr/lib/lib$net$_a; then
8610                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8611                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8612                                         if $contains socket libc.list >/dev/null 2>&1; then
8613                                                 d_socket="$define"
8614                                                 socketlib="-l$net"
8615                                                 case "$net" in
8616                                                 net)
8617                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8618                                                         sockethdr="-I/usr/netinclude"
8619                                                         ;;
8620                                                 esac
8621                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8622                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8623                                                         d_oldsock="$undef"
8624                                                 else
8625                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8626                                                         d_oldsock="$define"
8627                                                 fi
8628                                                 break
8629                                         fi
8630                                 fi
8631                         done
8632                         if test "X$d_socket" != "X$define"; then
8633                            echo "or anywhere else I see." >&4
8634                            d_socket="$undef"
8635                            d_oldsock="$undef"
8636                         fi
8637                 fi
8638         fi
8639 fi
8640
8641 : see if socketpair exists
8642 set socketpair d_sockpair
8643 eval $inlibc
8644
8645
8646 echo " "
8647 echo "Checking the availability of certain socket constants..." >& 4
8648 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8649         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8650         $cat >try.c <<EOF
8651 #include <sys/types.h>
8652 #include <sys/socket.h>
8653 int main() {
8654     int i = $ENUM;
8655 }
8656 EOF
8657         val="$undef"
8658         set try; if eval $compile; then
8659                 val="$define"
8660         fi
8661         set d_${enum}; eval $setvar
8662         $rm -f try.c try
8663 done
8664
8665 : see if sys/select.h has to be included
8666 set sys/select.h i_sysselct
8667 eval $inhdr
8668
8669 : see if we should include time.h, sys/time.h, or both
8670 echo " "
8671 if test "X$timeincl" = X; then
8672         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8673         $echo $n "I'm now running the test program...$c"
8674         $cat >try.c <<'EOCP'
8675 #include <sys/types.h>
8676 #ifdef I_TIME
8677 #include <time.h>
8678 #endif
8679 #ifdef I_SYSTIME
8680 #ifdef SYSTIMEKERNEL
8681 #define KERNEL
8682 #endif
8683 #include <sys/time.h>
8684 #endif
8685 #ifdef I_SYSSELECT
8686 #include <sys/select.h>
8687 #endif
8688 int main()
8689 {
8690         struct tm foo;
8691 #ifdef S_TIMEVAL
8692         struct timeval bar;
8693 #endif
8694 #ifdef S_TIMEZONE
8695         struct timezone tzp;
8696 #endif
8697         if (foo.tm_sec == foo.tm_sec)
8698                 exit(0);
8699 #ifdef S_TIMEVAL
8700         if (bar.tv_sec == bar.tv_sec)
8701                 exit(0);
8702 #endif
8703         exit(1);
8704 }
8705 EOCP
8706         flags=''
8707         for s_timezone in '-DS_TIMEZONE' ''; do
8708         sysselect=''
8709         for s_timeval in '-DS_TIMEVAL' ''; do
8710         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8711         for i_time in '' '-DI_TIME'; do
8712         for i_systime in '-DI_SYSTIME' ''; do
8713                 case "$flags" in
8714                 '') $echo $n ".$c"
8715                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8716                         if eval $compile; then
8717                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8718                                 shift
8719                                 flags="$*"
8720                                 echo " "
8721                                 $echo $n "Succeeded with $flags$c"
8722                         fi
8723                         ;;
8724                 esac
8725         done
8726         done
8727         done
8728         done
8729         done
8730         timeincl=''
8731         echo " "
8732         case "$flags" in
8733         *SYSTIMEKERNEL*) i_systimek="$define"
8734                 timeincl=`./findhdr sys/time.h`
8735                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8736         *) i_systimek="$undef";;
8737         esac
8738         case "$flags" in
8739         *I_TIME*) i_time="$define"
8740                 timeincl=`./findhdr time.h`" $timeincl"
8741                 echo "We'll include <time.h>." >&4;;
8742         *) i_time="$undef";;
8743         esac
8744         case "$flags" in
8745         *I_SYSTIME*) i_systime="$define"
8746                 timeincl=`./findhdr sys/time.h`" $timeincl"
8747                 echo "We'll include <sys/time.h>." >&4;;
8748         *) i_systime="$undef";;
8749         esac
8750         $rm -f try.c try
8751 fi
8752
8753 : check for fd_set items
8754 $cat <<EOM
8755
8756 Checking to see how well your C compiler handles fd_set and friends ...
8757 EOM
8758 $cat >fd_set.c <<EOCP
8759 #$i_systime I_SYS_TIME
8760 #$i_sysselct I_SYS_SELECT
8761 #$d_socket HAS_SOCKET
8762 #include <sys/types.h>
8763 #ifdef HAS_SOCKET
8764 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8765 #endif
8766 #ifdef I_SYS_TIME
8767 #include <sys/time.h>
8768 #endif
8769 #ifdef I_SYS_SELECT
8770 #include <sys/select.h>
8771 #endif
8772 int main() {
8773         fd_set fds;
8774
8775 #ifdef TRYBITS
8776         if(fds.fds_bits);
8777 #endif
8778
8779 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8780         exit(0);
8781 #else
8782         exit(1);
8783 #endif
8784 }
8785 EOCP
8786 set fd_set -DTRYBITS
8787 if eval $compile; then
8788         d_fds_bits="$define"
8789         d_fd_set="$define"
8790         echo "Well, your system knows about the normal fd_set typedef..." >&4
8791         if ./fd_set; then
8792                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8793                 d_fd_macros="$define"
8794         else
8795                 $cat >&4 <<'EOM'
8796 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8797 EOM
8798                 d_fd_macros="$undef"
8799         fi
8800 else
8801         $cat <<'EOM'
8802 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8803 EOM
8804         set fd_set
8805         if eval $compile; then
8806                 d_fds_bits="$undef"
8807                 d_fd_set="$define"
8808                 echo "Well, your system has some sort of fd_set available..." >&4
8809                 if ./fd_set; then
8810                         echo "and you have the normal fd_set macros." >&4
8811                         d_fd_macros="$define"
8812                 else
8813                         $cat <<'EOM'
8814 but not the normal fd_set macros!  Gross!  More work for me...
8815 EOM
8816                         d_fd_macros="$undef"
8817                 fi
8818         else
8819         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8820                 d_fd_set="$undef"
8821                 d_fds_bits="$undef"
8822                 d_fd_macros="$undef"
8823         fi
8824 fi
8825 $rm -f fd_set*
8826
8827 : see if fgetpos exists
8828 set fgetpos d_fgetpos
8829 eval $inlibc
8830
8831 : see if flock exists
8832 set flock d_flock
8833 eval $inlibc
8834
8835 : see if fork exists
8836 set fork d_fork
8837 eval $inlibc
8838
8839 : see if pathconf exists
8840 set pathconf d_pathconf
8841 eval $inlibc
8842
8843 : see if fpathconf exists
8844 set fpathconf d_fpathconf
8845 eval $inlibc
8846
8847
8848 : check for off64_t
8849 echo " "
8850 echo "Checking to see if your system supports off64_t..." >&4
8851 $cat >try.c <<EOCP
8852 #include <sys/types.h>
8853 #include <unistd.h>
8854 int main() { off64_t x = 7; }'
8855 EOCP
8856 set try
8857 if eval $compile; then
8858         val="$define"
8859         echo "Yes, it does."
8860 else
8861         val="$undef"
8862         echo "No, it doesn't."
8863         case "$lseeksize" in
8864         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8865         esac
8866 fi
8867 $rm -f try.* try
8868 set d_off64_t
8869 eval $setvar
8870
8871 : check for fpos64_t
8872 echo " "
8873 echo "Checking to see if your system supports fpos64_t..." >&4
8874 $cat >try.c <<EOCP
8875 #include <sys/stdio.h>
8876 int main() { fpos64_t x x = 7; }'
8877 EOCP
8878 set try
8879 if eval $compile; then
8880         val="$define"
8881         echo "Yes, it does."
8882 else
8883         val="$undef"
8884         echo "No, it doesn't."
8885         case "$fpossize" in
8886         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8887         esac
8888 fi
8889 $rm -f try.* try
8890 set d_fpos64_t
8891 eval $setvar
8892
8893 hasstruct='varname=$1; struct=$2; shift; shift;
8894 while $test $# -ge 2; do
8895         case "$1" in
8896         $define) echo "#include <$2>";;
8897         esac ;
8898     shift 2;
8899 done > try.c;
8900 echo "int main () { struct $struct foo; }" >> try.c;
8901 set try;
8902 if eval $compile; then
8903         val="$define";
8904 else
8905         val="$undef";
8906 fi;
8907 set $varname;
8908 eval $setvar;
8909 $rm -f try.c try.o'
8910
8911 : see if this is a sys/param system
8912 set sys/param.h i_sysparam
8913 eval $inhdr
8914
8915 : see if this is a sys/mount.h system
8916 set sys/mount.h i_sysmount
8917 eval $inhdr
8918
8919 : see if sys/types.h has to be included
8920 set sys/types.h i_systypes
8921 eval $inhdr
8922
8923
8924 echo " "
8925 echo "Checking to see if your system supports struct fs_data..." >&4
8926 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8927 eval $hasstruct
8928 case "$d_fs_data_s" in
8929 "$define")      echo "Yes, it does."   ;;
8930 *)              echo "No, it doesn't." ;;
8931 esac
8932
8933 : see if fseeko exists
8934 set fseeko d_fseeko
8935 eval $inlibc
8936 case "$longsize" in
8937 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8938 esac
8939
8940 : see if fsetpos exists
8941 set fsetpos d_fsetpos
8942 eval $inlibc
8943
8944
8945 : see if fstatfs exists
8946 set fstatfs d_fstatfs
8947 eval $inlibc
8948
8949
8950 : see if statvfs exists
8951 set statvfs d_statvfs
8952 eval $inlibc
8953
8954 : see if fstatvfs exists
8955 set fstatvfs d_fstatvfs
8956 eval $inlibc
8957
8958
8959 : see if ftello exists
8960 set ftello d_ftello
8961 eval $inlibc
8962 case "$longsize" in
8963 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8964 esac
8965
8966 : see if getgrent exists
8967 set getgrent d_getgrent
8968 eval $inlibc
8969
8970 : see if gethostbyaddr exists
8971 set gethostbyaddr d_gethbyaddr
8972 eval $inlibc
8973
8974 : see if gethostbyname exists
8975 set gethostbyname d_gethbyname
8976 eval $inlibc
8977
8978 : see if gethostent exists
8979 set gethostent d_gethent
8980 eval $inlibc
8981
8982 : see how we will look up host name
8983 echo " "
8984 call=''
8985 if set gethostname val -f d_gethname; eval $csym; $val; then
8986         echo 'gethostname() found.' >&4
8987         d_gethname="$define"
8988         call=gethostname
8989 fi
8990 if set uname val -f d_uname; eval $csym; $val; then
8991         if ./xenix; then
8992                 $cat <<'EOM'
8993 uname() was found, but you're running xenix, and older versions of xenix
8994 have a broken uname(). If you don't really know whether your xenix is old
8995 enough to have a broken system call, use the default answer.
8996
8997 EOM
8998                 dflt=y
8999                 case "$d_uname" in
9000                 "$define") dflt=n;;
9001                 esac
9002                 rp='Is your uname() broken?'
9003                 . ./myread
9004                 case "$ans" in
9005                 n*) d_uname="$define"; call=uname;;
9006                 esac
9007         else
9008                 echo 'uname() found.' >&4
9009                 d_uname="$define"
9010                 case "$call" in
9011                 '') call=uname ;;
9012                 esac
9013         fi
9014 fi
9015 case "$d_gethname" in
9016 '') d_gethname="$undef";;
9017 esac
9018 case "$d_uname" in
9019 '') d_uname="$undef";;
9020 esac
9021 case "$d_uname$d_gethname" in
9022 *define*)
9023         dflt=n
9024         cat <<EOM
9025  
9026 Every now and then someone has a $call() that lies about the hostname
9027 but can't be fixed for political or economic reasons.  If you wish, I can
9028 pretend $call() isn't there and maybe compute hostname at run-time
9029 thanks to the '$phostname' command.
9030
9031 EOM
9032         rp="Shall I ignore $call() from now on?"
9033         . ./myread
9034         case "$ans" in
9035         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9036         esac;;
9037 esac
9038 case "$phostname" in
9039 '') aphostname='';;
9040 *) case "$aphostname" in
9041         /*) ;;
9042         *) set X $phostname
9043                 shift
9044                 file=$1
9045                 shift
9046                 file=`./loc $file $file $pth`
9047                 aphostname=`echo $file $*`
9048                 ;;
9049         esac
9050         ;;
9051 esac
9052 case "$d_uname$d_gethname" in
9053 *define*) ;;
9054 *)
9055         case "$phostname" in
9056         '')
9057                 echo "There will be no way for $package to get your hostname." >&4;;
9058         *)
9059         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9060                 ;;
9061         esac;;
9062 esac
9063 case "$d_phostname" in
9064 '') d_phostname="$undef";;
9065 esac
9066
9067 : see if this is a netdb.h system
9068 set netdb.h i_netdb
9069 eval $inhdr
9070
9071 : see if prototypes for various gethostxxx netdb.h functions are available
9072 echo " "
9073 set d_gethostprotos gethostent $i_netdb netdb.h
9074 eval $hasproto
9075
9076 : see if getlogin exists
9077 set getlogin d_getlogin
9078 eval $inlibc
9079
9080 : see if getmnt exists
9081 set getmnt d_getmnt
9082 eval $inlibc
9083
9084 : see if getmntent exists
9085 set getmntent d_getmntent
9086 eval $inlibc
9087
9088 : see if getnetbyaddr exists
9089 set getnetbyaddr d_getnbyaddr
9090 eval $inlibc
9091
9092 : see if getnetbyname exists
9093 set getnetbyname d_getnbyname
9094 eval $inlibc
9095
9096 : see if getnetent exists
9097 set getnetent d_getnent
9098 eval $inlibc
9099
9100 : see if prototypes for various getnetxxx netdb.h functions are available
9101 echo " "
9102 set d_getnetprotos getnetent $i_netdb netdb.h
9103 eval $hasproto
9104
9105
9106 : see if getprotobyname exists
9107 set getprotobyname d_getpbyname
9108 eval $inlibc
9109
9110 : see if getprotobynumber exists
9111 set getprotobynumber d_getpbynumber
9112 eval $inlibc
9113
9114 : see if getprotoent exists
9115 set getprotoent d_getpent
9116 eval $inlibc
9117
9118 : see if getpgid exists
9119 set getpgid d_getpgid
9120 eval $inlibc
9121
9122 : see if getpgrp2 exists
9123 set getpgrp2 d_getpgrp2
9124 eval $inlibc
9125
9126 : see if getppid exists
9127 set getppid d_getppid
9128 eval $inlibc
9129
9130 : see if getpriority exists
9131 set getpriority d_getprior
9132 eval $inlibc
9133
9134 : see if prototypes for various getprotoxxx netdb.h functions are available
9135 echo " "
9136 set d_getprotoprotos getprotoent $i_netdb netdb.h
9137 eval $hasproto
9138
9139 : see if getpwent exists
9140 set getpwent d_getpwent
9141 eval $inlibc
9142
9143
9144 : see if getservbyname exists
9145 set getservbyname d_getsbyname
9146 eval $inlibc
9147
9148 : see if getservbyport exists
9149 set getservbyport d_getsbyport
9150 eval $inlibc
9151
9152 : see if getservent exists
9153 set getservent d_getsent
9154 eval $inlibc
9155
9156 : see if prototypes for various getservxxx netdb.h functions are available
9157 echo " "
9158 set d_getservprotos getservent $i_netdb netdb.h
9159 eval $hasproto
9160
9161 : see if getspent exists
9162 set getspent d_getspent
9163 eval $inlibc
9164
9165 : see if getspnam exists
9166 set getspnam d_getspnam
9167 eval $inlibc
9168
9169 : see if gettimeofday or ftime exists
9170 set gettimeofday d_gettimeod
9171 eval $inlibc
9172 case "$d_gettimeod" in
9173 "$undef")
9174         set ftime d_ftime 
9175         eval $inlibc
9176         ;;
9177 *)
9178         val="$undef"; set d_ftime; eval $setvar
9179         ;;
9180 esac
9181 case "$d_gettimeod$d_ftime" in
9182 "$undef$undef")
9183         echo " "
9184         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9185         ;;
9186 esac
9187
9188 : see if this is an grp system
9189 set grp.h i_grp
9190 eval $inhdr
9191
9192 case "$i_grp" in
9193 $define)
9194         xxx=`./findhdr grp.h`
9195         $cppstdin $cppflags $cppminus < $xxx >$$.h
9196
9197         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9198                 val="$define"
9199         else
9200                 val="$undef"
9201         fi
9202         set d_grpasswd
9203         eval $setvar
9204
9205         $rm -f $$.h
9206         ;;
9207 *)
9208         val="$undef";
9209         set d_grpasswd; eval $setvar
9210         ;;
9211 esac
9212
9213 : see if hasmntopt exists
9214 set hasmntopt d_hasmntopt
9215 eval $inlibc
9216
9217 : see if this is a netinet/in.h or sys/in.h system
9218 set netinet/in.h i_niin sys/in.h i_sysin
9219 eval $inhdr
9220
9221 : see if arpa/inet.h has to be included
9222 set arpa/inet.h i_arpainet
9223 eval $inhdr
9224
9225 : see if htonl --and friends-- exists
9226 val=''
9227 set htonl val
9228 eval $inlibc
9229
9230 : Maybe they are macros.
9231 case "$val" in
9232 $undef)
9233         $cat >htonl.c <<EOM
9234 #include <stdio.h>
9235 #include <sys/types.h>
9236 #$i_niin I_NETINET_IN
9237 #$i_sysin I_SYS_IN
9238 #$i_arpainet I_ARPA_INET
9239 #ifdef I_NETINET_IN
9240 #include <netinet/in.h>
9241 #endif
9242 #ifdef I_SYS_IN
9243 #include <sys/in.h>
9244 #endif
9245 #ifdef I_ARPA_INET
9246 #include <arpa/inet.h>
9247 #endif
9248 #ifdef htonl
9249 printf("Defined as a macro.");
9250 #endif
9251 EOM
9252         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9253         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9254                 val="$define"
9255                 echo "But it seems to be defined as a macro." >&4
9256         fi
9257         $rm -f htonl.?
9258         ;;
9259 esac
9260 set d_htonl
9261 eval $setvar
9262
9263 : index or strchr
9264 echo " "
9265 if set index val -f; eval $csym; $val; then
9266         if set strchr val -f d_strchr; eval $csym; $val; then
9267                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9268                         val="$define"
9269                         vali="$undef"
9270                         echo "strchr() found." >&4
9271                 else
9272                         val="$undef"
9273                         vali="$define"
9274                         echo "index() found." >&4
9275                 fi
9276         else
9277                 val="$undef"
9278                 vali="$define"
9279                 echo "index() found." >&4
9280         fi
9281 else
9282         if set strchr val -f d_strchr; eval $csym; $val; then
9283                 val="$define"
9284                 vali="$undef"
9285                 echo "strchr() found." >&4
9286         else
9287                 echo "No index() or strchr() found!" >&4
9288                 val="$undef"
9289                 vali="$undef"
9290         fi
9291 fi
9292 set d_strchr; eval $setvar
9293 val="$vali"
9294 set d_index; eval $setvar
9295
9296 : check whether inet_aton exists
9297 set inet_aton d_inetaton
9298 eval $inlibc
9299
9300 : Look for isascii
9301 echo " "
9302 $cat >isascii.c <<'EOCP'
9303 #include <stdio.h>
9304 #include <ctype.h>
9305 int main() {
9306         int c = 'A';
9307         if (isascii(c))
9308                 exit(0);
9309         else
9310                 exit(1);
9311 }
9312 EOCP
9313 set isascii
9314 if eval $compile; then
9315         echo "isascii() found." >&4
9316         val="$define"
9317 else
9318         echo "isascii() NOT found." >&4
9319         val="$undef"
9320 fi
9321 set d_isascii
9322 eval $setvar
9323 $rm -f isascii*
9324
9325 : see if killpg exists
9326 set killpg d_killpg
9327 eval $inlibc
9328
9329 : see if lchown exists
9330 echo " "
9331 $cat > try.c <<'EOCP'
9332 /* System header to define __stub macros and hopefully few prototypes,
9333     which can conflict with char lchown(); below.  */
9334 #include <assert.h>
9335 /* Override any gcc2 internal prototype to avoid an error.  */
9336 /* We use char because int might match the return type of a gcc2
9337    builtin and then its argument prototype would still apply.  */
9338 char lchown();
9339 int main() {
9340     /*  The GNU C library defines this for functions which it implements
9341         to always fail with ENOSYS.  Some functions are actually named
9342         something starting with __ and the normal name is an alias.  */
9343 #if defined (__stub_lchown) || defined (__stub___lchown)
9344 choke me
9345 #else
9346 lchown();
9347 #endif
9348 ; return 0; }
9349 EOCP
9350 set try
9351 if eval $compile; then
9352     $echo "lchown() found." >&4
9353     val="$define"
9354 else
9355     $echo "lchown() NOT found." >&4
9356     val="$undef"
9357 fi
9358 set d_lchown
9359 eval $setvar
9360
9361 : See if number of significant digits in a double precision number is known
9362 echo " "
9363 $cat >ldbl_dig.c <<EOM
9364 #$i_limits I_LIMITS
9365 #$i_float I_FLOAT
9366 #ifdef I_LIMITS
9367 #include <limits.h>
9368 #endif
9369 #ifdef I_FLOAT
9370 #include <float.h>
9371 #endif
9372 #ifdef LDBL_DIG
9373 printf("Contains LDBL_DIG");
9374 #endif
9375 EOM
9376 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9377 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9378         echo "LDBL_DIG found." >&4
9379         val="$define"
9380 else
9381         echo "LDBL_DIG NOT found." >&4
9382         val="$undef"
9383 fi
9384 $rm -f ldbl_dig.?
9385 set d_ldbl_dig
9386 eval $setvar
9387
9388 : see if link exists
9389 set link d_link
9390 eval $inlibc
9391
9392 : see if localeconv exists
9393 set localeconv d_locconv
9394 eval $inlibc
9395
9396 : see if lockf exists
9397 set lockf d_lockf
9398 eval $inlibc
9399
9400 : check for long long
9401 echo " "
9402 $echo $n "Checking to see if your system supports long long..." $c >&4
9403 echo 'int main() { long long x = 7; return 0; }' > try.c
9404 set try
9405 if eval $compile; then
9406         val="$define"
9407         echo " Yes, it does." >&4
9408 else
9409         val="$undef"
9410         echo " No, it doesn't." >&4
9411 fi
9412 $rm try.*
9413 set d_longlong
9414 eval $setvar
9415
9416 : check for length of long long
9417 case "${d_longlong}${longlongsize}" in
9418 $define)
9419         echo " "
9420         $echo $n "Checking to see how big your long longs are..." $c >&4
9421         $cat >try.c <<'EOCP'
9422 #include <stdio.h>
9423 int main()
9424 {
9425     printf("%d\n", (int)sizeof(long long));
9426     return(0);
9427 }
9428 EOCP
9429         set try
9430         if eval $compile_ok; then
9431                 longlongsize=`./try$exe_ext`
9432                 $echo " $longlongsize bytes." >&4
9433         else
9434                 dflt='8'
9435                 echo " "
9436                 echo "(I can't seem to compile the test program.  Guessing...)"
9437                 rp="What is the size of a long long (in bytes)?"
9438                 . ./myread
9439                 longlongsize="$ans"
9440         fi
9441         if $test "X$longsize" = "X$longlongsize"; then
9442                 echo "(That isn't any different from an ordinary long.)"
9443         fi      
9444         ;;
9445 esac
9446 $rm -f try.* try
9447
9448 : see if lstat exists
9449 set lstat d_lstat
9450 eval $inlibc
9451
9452 : see if mblen exists
9453 set mblen d_mblen
9454 eval $inlibc
9455
9456 : see if mbstowcs exists
9457 set mbstowcs d_mbstowcs
9458 eval $inlibc
9459
9460 : see if mbtowc exists
9461 set mbtowc d_mbtowc
9462 eval $inlibc
9463
9464 : see if memchr exists
9465 set memchr d_memchr
9466 eval $inlibc
9467
9468 : see if memcmp exists
9469 set memcmp d_memcmp
9470 eval $inlibc
9471
9472 : see if memcpy exists
9473 set memcpy d_memcpy
9474 eval $inlibc
9475
9476 : see if memmove exists
9477 set memmove d_memmove
9478 eval $inlibc
9479
9480 : see if memset exists
9481 set memset d_memset
9482 eval $inlibc
9483
9484 : see if mkdir exists
9485 set mkdir d_mkdir
9486 eval $inlibc
9487
9488 : see if mkfifo exists
9489 set mkfifo d_mkfifo
9490 eval $inlibc
9491
9492 : see if mktime exists
9493 set mktime d_mktime
9494 eval $inlibc
9495
9496 : see if msgctl exists
9497 set msgctl d_msgctl
9498 eval $inlibc
9499
9500 : see if msgget exists
9501 set msgget d_msgget
9502 eval $inlibc
9503
9504 : see if msgsnd exists
9505 set msgsnd d_msgsnd
9506 eval $inlibc
9507
9508 : see if msgrcv exists
9509 set msgrcv d_msgrcv
9510 eval $inlibc
9511
9512 : see how much of the 'msg*(2)' library is present.
9513 h_msg=true
9514 echo " "
9515 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9516 *"$undef"*) h_msg=false;;
9517 esac
9518 case "$osname" in
9519 freebsd)
9520     case "`ipcs 2>&1`" in
9521     "SVID messages"*"not configured"*)
9522         echo "Your $osname does not have the msg*(2) configured." >&4
9523         h_msg=false
9524         val="$undef"
9525         set msgctl d_msgctl
9526         eval $setvar
9527         set msgget d_msgget
9528         eval $setvar
9529         set msgsnd d_msgsnd
9530         eval $setvar
9531         set msgrcv d_msgrcv
9532         eval $setvar
9533         ;;
9534     esac
9535     ;;
9536 esac
9537 : we could also check for sys/ipc.h ...
9538 if $h_msg && $test `./findhdr sys/msg.h`; then
9539         echo "You have the full msg*(2) library." >&4
9540         val="$define"
9541 else
9542         echo "You don't have the full msg*(2) library." >&4
9543         val="$undef"
9544 fi
9545 set d_msg
9546 eval $setvar
9547
9548 : see if nice exists
9549 set nice d_nice
9550 eval $inlibc
9551
9552 : see if inttypes.h is available
9553 : we want a real compile instead of Inhdr because some systems
9554 : have an inttypes.h which includes non-existent headers
9555 echo " "
9556 $cat >try.c <<EOCP
9557 #include <inttypes.h>
9558 int main() {
9559         static int32_t foo32 = 0x12345678;
9560 }
9561 EOCP
9562 set try
9563 if eval $compile; then
9564         echo "<inttypes.h> found." >&4
9565         val="$define"
9566 else
9567         echo "<inttypes.h> NOT found." >&4
9568         val="$undef"
9569 fi
9570 $rm -f try.c try
9571 set i_inttypes
9572 eval $setvar
9573
9574 : check for int64_t
9575 echo " "
9576 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9577 $cat >try.c <<EOCP
9578 #include <sys/types.h>
9579 #$i_inttypes I_INTTYPES
9580 #ifdef I_INTTYPES
9581 #include <inttypes.h>
9582 #endif
9583 int main() { int64_t x = 7; }
9584 EOCP
9585 set try
9586 if eval $compile; then
9587         val="$define"
9588         echo " Yes, it does." >&4
9589 else
9590         val="$undef"
9591         echo " No, it doesn't." >&4
9592 fi
9593 $rm -f try try.*
9594 set d_int64t
9595 eval $setvar
9596
9597
9598 echo " "
9599 echo "Checking which 64-bit integer type we could use..." >&4
9600
9601 case "$intsize" in
9602 8) val=int
9603    set quadtype
9604    eval $setvar
9605    val='"unsigned int"'
9606    set uquadtype
9607    eval $setvar
9608    quadkind=1
9609    ;;
9610 *) case "$longsize" in
9611    8) val=long
9612       set quadtype
9613       eval $setvar
9614       val='"unsigned long"'
9615       set uquadtype
9616       eval $setvar
9617       quadkind=2
9618       ;;
9619    *) case "$uselonglong:$d_longlong:$longlongsize" in
9620       define:define:8)
9621         val='"long long"'
9622         set quadtype
9623         eval $setvar
9624         val='"unsigned long long"'
9625         set uquadtype
9626         eval $setvar
9627         quadkind=3
9628         ;;
9629       *) case "$d_int64t" in
9630          define)
9631            val=int64_t
9632            set quadtype
9633            eval $setvar
9634            val=uint64_t
9635            set uquadtype
9636            eval $setvar
9637            quadkind=4
9638            ;;
9639          esac
9640          ;;
9641       esac
9642       ;;
9643    esac
9644    ;;
9645 esac
9646
9647 case "$quadtype" in
9648 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9649         undef:define:8)
9650            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9651         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9652         esac
9653         d_quad="$undef"
9654         ;;
9655 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9656             verb="will"
9657         else
9658             verb="could"
9659         fi
9660         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9661         d_quad="$define"
9662         ;;
9663 esac
9664
9665 : check for length of character
9666 echo " "
9667 case "$charsize" in
9668 '')
9669         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9670         $cat >try.c <<'EOCP'
9671 #include <stdio.h>
9672 int main()
9673 {
9674     printf("%d\n", (int)sizeof(char));
9675     exit(0);
9676 }
9677 EOCP
9678         set try
9679         if eval $compile_ok; then
9680                 dflt=`./try`
9681         else
9682                 dflt='1'
9683                 echo "(I can't seem to compile the test program.  Guessing...)"
9684         fi
9685         ;;
9686 *)
9687         dflt="$charsize"
9688         ;;
9689 esac
9690 rp="What is the size of a character (in bytes)?"
9691 . ./myread
9692 charsize="$ans"
9693 $rm -f try.c try
9694
9695
9696 echo " "
9697 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9698
9699 case "$use64bits:$d_quad:$quadtype" in
9700 define:define:?*)
9701         ivtype="$quadtype"
9702         uvtype="$uquadtype"
9703         ivsize=8
9704         uvsize=8
9705         ;;
9706 *)      ivtype="long"
9707         uvtype="unsigned long"
9708         ivsize=$longsize
9709         uvsize=$longsize
9710         ;;
9711 esac
9712
9713 case "$uselongdouble:$d_longdbl" in
9714 define:define)
9715         nvtype="long double"
9716         nvsize=$longdblsize
9717         ;;
9718 *)      nvtype=double
9719         nvsize=$doublesize
9720         ;;
9721 esac
9722
9723 $echo "(IV will be "$ivtype", $ivsize bytes)"
9724 $echo "(UV will be "$uvtype", $uvsize bytes)"
9725 $echo "(NV will be "$nvtype", $nvsize bytes)"
9726
9727 $cat >try.c <<EOCP
9728 #$i_inttypes I_INTTYPES
9729 #ifdef I_INTTYPES
9730 #include <inttypes.h>
9731 #endif
9732 #include <stdio.h>
9733 int main() {
9734 #ifdef INT8
9735    int8_t i =  INT8_MAX;
9736   uint8_t u = UINT8_MAX;
9737   printf("int8_t\n");
9738 #endif
9739 #ifdef INT16
9740    int16_t i =  INT16_MAX;
9741   uint16_t i = UINT16_MAX;
9742   printf("int16_t\n");
9743 #endif
9744 #ifdef INT32
9745    int32_t i =  INT32_MAX;
9746   uint32_t u = UINT32_MAX;
9747   printf("int32_t\n");
9748 #endif
9749 }
9750 EOCP
9751
9752 case "$i8type" in
9753 '')     case "$charsize" in
9754         1)      i8type=char
9755                 u8type="unsigned char"
9756                 i8size=$charsize
9757                 u8size=$charsize
9758                 ;;
9759         esac
9760         ;;
9761 esac
9762 case "$i8type" in
9763 '')     set try -DINT8
9764         if eval $compile; then
9765                 case "`./try$exe_ext`" in
9766                 int8_t) i8type=int8_t
9767                         u8type=uint8_t
9768                         i8size=1
9769                         u8size=1
9770                         ;;
9771                 esac
9772         fi
9773         ;;
9774 esac
9775 case "$i8type" in
9776 '')     if $test $charsize -ge 1; then
9777                 i8type=char
9778                 u8type="unsigned char"
9779                 i8size=$charsize
9780                 u8size=$charsize
9781         fi
9782         ;;
9783 esac
9784
9785 case "$i16type" in
9786 '')     case "$shortsize" in
9787         2)      i16type=short
9788                 u16type="unsigned short"
9789                 i16size=$shortsize
9790                 u16size=$shortsize
9791                 ;;
9792         esac
9793         ;;
9794 esac
9795 case "$i16type" in
9796 '')     set try -DINT16
9797         if eval $compile; then
9798                 case "`./try$exe_ext`" in
9799                 int16_t)
9800                         i16type=int16_t
9801                         u16type=uint16_t
9802                         i16size=2
9803                         u16size=2
9804                         ;;
9805                 esac
9806         fi
9807         ;;
9808 esac
9809 case "$i16type" in
9810 '')     if $test $shortsize -ge 2; then
9811                 i16type=short
9812                 u16type="unsigned short"
9813                 i16size=$shortsize
9814                 u16size=$shortsize
9815         fi
9816         ;;
9817 esac
9818
9819 case "$i32type" in
9820 '')     case "$longsize" in
9821         4)      i32type=long
9822                 u32type="unsigned long"
9823                 i32size=$longsize
9824                 u32size=$longsize
9825                 ;;
9826         *)      case "$intsize" in
9827                 4)      i32type=int
9828                         u32type="unsigned int"
9829                         i32size=$intsize
9830                         u32size=$intsize
9831                         ;;
9832                 esac
9833                 ;;
9834         esac
9835         ;;
9836 esac
9837 case "$i32type" in
9838 '')     set try -DINT32
9839         if eval $compile; then
9840                 case "`./try$exe_ext`" in
9841                 int32_t)
9842                         i32type=int32_t
9843                         u32type=uint32_t
9844                         i32size=4
9845                         u32size=4
9846                         ;;
9847                 esac
9848         fi
9849         ;;
9850 esac
9851 case "$i32type" in
9852 '')     if $test $intsize -ge 4; then
9853                 i32type=int
9854                 u32type="unsigned int"
9855                 i32size=$intsize
9856                 u32size=$intsize
9857         fi
9858         ;;
9859 esac
9860
9861 case "$i64type" in
9862 '')     case "$d_quad:$quadtype" in
9863         define:?*)
9864                 i64type="$quadtype"
9865                 u64type="$uquadtype"
9866                 i64size=8
9867                 u64size=8
9868                 ;;
9869         esac
9870         ;;
9871 esac
9872
9873 $echo "Checking whether your NVs can preserve your UVs..." >&4
9874 $cat <<EOP >try.c
9875 #include <stdio.h>
9876 int main() {
9877     $uvtype k = ($uvtype)~0, l;
9878     $nvtype d;
9879     l = k;
9880     d = ($nvtype)l;
9881     l = ($uvtype)d;
9882     if (l == k)
9883        printf("preserve\n");
9884     exit(0);
9885 }
9886 EOP
9887 set try
9888 if eval $compile; then
9889         case "`./try$exe_ext`" in
9890         preserve) d_nv_preserves_uv="$define" ;;
9891         esac
9892 fi      
9893 case "$d_nv_preserves_uv" in
9894 $define) $echo "Yes, they can."  2>&1 ;;
9895 *)       $echo "No, they can't." 2>&1
9896          d_nv_preserves_uv="$undef"
9897          ;;
9898 esac
9899
9900 $rm -f try.* try
9901
9902 : see if POSIX threads are available
9903 set pthread.h i_pthread
9904 eval $inhdr
9905
9906
9907
9908
9909 : how to create joinable pthreads
9910 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9911         echo " "
9912         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9913         $cat >try.c <<'EOCP'
9914 #include <pthread.h>
9915 int main() {
9916     int detachstate = JOINABLE;
9917 }
9918 EOCP
9919         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9920         if eval $compile; then
9921                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9922                 val="$undef" # Yes, undef.
9923                 set d_old_pthread_create_joinable
9924                 eval $setvar
9925                 val=""
9926                 set old_pthread_create_joinable
9927                 eval $setvar
9928         else
9929                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9930                 if eval $compile; then
9931                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9932                         val="$define"
9933                         set d_old_pthread_create_joinable
9934                         eval $setvar
9935                         val=PTHREAD_CREATE_UNDETACHED
9936                         set old_pthread_create_joinable
9937                         eval $setvar
9938                 else            
9939                         set try -DJOINABLE=__UNDETACHED
9940                         if eval $compile; then
9941                                 echo "You seem to use __UNDETACHED." >&4
9942                                 val="$define"
9943                                 set d_old_pthread_create_joinable
9944                                 eval $setvar
9945                                 val=__UNDETACHED
9946                                 set old_pthread_create_joinable
9947                                 eval $setvar
9948                         else
9949                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9950                                 val="$define"
9951                                 set d_old_pthread_create_joinable
9952                                 eval $setvar
9953                                 val=0
9954                                 set old_pthread_create_joinable
9955                                 eval $setvar
9956                         fi
9957                 fi
9958         fi
9959         $rm -f try try.*
9960 else
9961     d_old_pthread_create_joinable="$undef"
9962     old_pthread_create_joinable=""
9963 fi
9964
9965 : see if pause exists
9966 set pause d_pause
9967 eval $inlibc
9968
9969 : see if pipe exists
9970 set pipe d_pipe
9971 eval $inlibc
9972
9973 : see if poll exists
9974 set poll d_poll
9975 eval $inlibc
9976
9977
9978 : see whether the various POSIXish _yields exist
9979 $cat >try.c <<EOP
9980 #include <pthread.h>
9981 #include <stdio.h>
9982 int main() {
9983 #ifdef SCHED_YIELD
9984         sched_yield();
9985 #else
9986 #ifdef PTHREAD_YIELD
9987         pthread_yield();
9988 #else
9989 #ifdef PTHREAD_YIELD_NULL
9990         pthread_yield(NULL);
9991 #endif
9992 #endif
9993 #endif
9994 }
9995 EOP
9996 : see if sched_yield exists
9997 set try -DSCHED_YIELD
9998 if eval $compile; then
9999     val="$define"
10000     sched_yield='sched_yield()'
10001 else
10002     val="$undef"
10003 fi
10004 case "$usethreads" in
10005 $define)
10006         case "$val" in
10007         $define) echo 'sched_yield() found.' >&4        ;;
10008         *)       echo 'sched_yield() NOT found.' >&4    ;;
10009         esac
10010 esac
10011 set d_sched_yield
10012 eval $setvar
10013
10014 : see if pthread_yield exists
10015 set try -DPTHREAD_YIELD
10016 if eval $compile; then
10017     val="$define"
10018     case "$sched_yield" in
10019     '') sched_yield='pthread_yield()' ;;
10020     esac
10021 else
10022     set try -DPTHREAD_YIELD_NULL
10023     if eval $compile; then
10024         val="$define"
10025         case "$sched_yield" in
10026         '') sched_yield='pthread_yield(NULL)' ;;
10027         esac
10028     else
10029         val="$undef"
10030     fi
10031 fi
10032 case "$usethreads" in
10033 $define)
10034         case "$val" in
10035         $define) echo 'pthread_yield() found.' >&4      ;;
10036         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10037         esac
10038         ;;
10039 esac
10040 set d_pthread_yield
10041 eval $setvar
10042
10043 case "$sched_yield" in
10044 '') sched_yield=undef ;;
10045 esac
10046
10047 $rm -f try try.*
10048
10049 : see if this is a pwd.h system
10050 set pwd.h i_pwd
10051 eval $inhdr
10052
10053 case "$i_pwd" in
10054 $define)
10055         xxx=`./findhdr pwd.h`
10056         $cppstdin $cppflags $cppminus < $xxx >$$.h
10057
10058         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10059                 val="$define"
10060         else
10061                 val="$undef"
10062         fi
10063         set d_pwquota
10064         eval $setvar
10065
10066         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10067                 val="$define"
10068         else
10069                 val="$undef"
10070         fi
10071         set d_pwage
10072         eval $setvar
10073
10074         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10075                 val="$define"
10076         else
10077                 val="$undef"
10078         fi
10079         set d_pwchange
10080         eval $setvar
10081
10082         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10083                 val="$define"
10084         else
10085                 val="$undef"
10086         fi
10087         set d_pwclass
10088         eval $setvar
10089
10090         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10091                 val="$define"
10092         else
10093                 val="$undef"
10094         fi
10095         set d_pwexpire
10096         eval $setvar
10097
10098         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10099                 val="$define"
10100         else
10101                 val="$undef"
10102         fi
10103         set d_pwcomment
10104         eval $setvar
10105
10106         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10107                 val="$define"
10108         else
10109                 val="$undef"
10110         fi
10111         set d_pwgecos
10112         eval $setvar
10113
10114         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10115                 val="$define"
10116         else
10117                 val="$undef"
10118         fi
10119         set d_pwpasswd
10120         eval $setvar
10121
10122         $rm -f $$.h
10123         ;;
10124 *)
10125         val="$undef"; 
10126         set d_pwquota; eval $setvar
10127         set d_pwage; eval $setvar
10128         set d_pwchange; eval $setvar
10129         set d_pwclass; eval $setvar
10130         set d_pwexpire; eval $setvar
10131         set d_pwcomment; eval $setvar
10132         set d_pwgecos; eval $setvar
10133         set d_pwpasswd; eval $setvar
10134         ;;
10135 esac
10136
10137 : see if readdir and friends exist
10138 set readdir d_readdir
10139 eval $inlibc
10140 set seekdir d_seekdir
10141 eval $inlibc
10142 set telldir d_telldir
10143 eval $inlibc
10144 set rewinddir d_rewinddir
10145 eval $inlibc
10146
10147 : see if readlink exists
10148 set readlink d_readlink
10149 eval $inlibc
10150
10151 : see if rename exists
10152 set rename d_rename
10153 eval $inlibc
10154
10155 : see if rmdir exists
10156 set rmdir d_rmdir
10157 eval $inlibc
10158
10159 : see if memory.h is available.
10160 val=''
10161 set memory.h val
10162 eval $inhdr
10163
10164 : See if it conflicts with string.h
10165 case "$val" in
10166 $define)
10167         case "$strings" in
10168         '') ;;
10169         *)
10170                 $cppstdin $cppflags $cppminus < $strings > mem.h
10171                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10172                         echo " "
10173                         echo "We won't be including <memory.h>."
10174                         val="$undef"
10175                 fi
10176                 $rm -f mem.h
10177                 ;;
10178         esac
10179 esac
10180 set i_memory
10181 eval $setvar
10182
10183 : can bcopy handle overlapping blocks?
10184 val="$undef"
10185 case "$d_bcopy" in
10186 "$define")
10187         echo " "
10188         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10189         $cat >try.c <<EOCP
10190 #$i_memory I_MEMORY
10191 #$i_stdlib I_STDLIB
10192 #$i_string I_STRING
10193 #$i_unistd I_UNISTD
10194 EOCP
10195         $cat >>try.c <<'EOCP'
10196 #include <stdio.h>
10197 #ifdef I_MEMORY
10198 #  include <memory.h>
10199 #endif
10200 #ifdef I_STDLIB
10201 #  include <stdlib.h>
10202 #endif
10203 #ifdef I_STRING
10204 #  include <string.h>
10205 #else
10206 #  include <strings.h>
10207 #endif
10208 #ifdef I_UNISTD
10209 #  include <unistd.h>  /* Needed for NetBSD */
10210 #endif
10211 int main()
10212 {
10213 char buf[128], abc[128];
10214 char *b;
10215 int len;
10216 int off;
10217 int align;
10218
10219 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10220
10221 for (align = 7; align >= 0; align--) {
10222         for (len = 36; len; len--) {
10223                 b = buf+align;
10224                 bcopy(abc, b, len);
10225                 for (off = 1; off <= len; off++) {
10226                         bcopy(b, b+off, len);
10227                         bcopy(b+off, b, len);
10228                         if (bcmp(b, abc, len))
10229                                 exit(1);
10230                 }
10231         }
10232 }
10233 exit(0);
10234 }
10235 EOCP
10236         set try
10237         if eval $compile_ok; then
10238                 if ./try 2>/dev/null; then
10239                         echo "Yes, it can."
10240                         val="$define"
10241                 else
10242                         echo "It can't, sorry."
10243                         case "$d_memmove" in
10244                         "$define") echo "But that's Ok since you have memmove()." ;;
10245                         esac
10246                 fi
10247         else
10248                 echo "(I can't compile the test program, so we'll assume not...)"
10249                 case "$d_memmove" in
10250                 "$define") echo "But that's Ok since you have memmove()." ;;
10251                 esac
10252         fi
10253         ;;
10254 esac
10255 $rm -f try.* try core
10256 set d_safebcpy
10257 eval $setvar
10258
10259 : can memcpy handle overlapping blocks?
10260 val="$undef"
10261 case "$d_memcpy" in
10262 "$define")
10263         echo " "
10264         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10265         $cat >try.c <<EOCP
10266 #$i_memory I_MEMORY
10267 #$i_stdlib I_STDLIB
10268 #$i_string I_STRING
10269 #$i_unistd I_UNISTD
10270 EOCP
10271         $cat >>try.c <<'EOCP'
10272 #include <stdio.h>
10273 #ifdef I_MEMORY
10274 #  include <memory.h>
10275 #endif
10276 #ifdef I_STDLIB
10277 #  include <stdlib.h>
10278 #endif
10279 #ifdef I_STRING
10280 #  include <string.h>
10281 #else
10282 #  include <strings.h>
10283 #endif
10284 #ifdef I_UNISTD
10285 #  include <unistd.h>  /* Needed for NetBSD */
10286 #endif
10287 int main()
10288 {
10289 char buf[128], abc[128];
10290 char *b;
10291 int len;
10292 int off;
10293 int align;
10294
10295 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10296    try to store the string in read-only memory. */
10297 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10298
10299 for (align = 7; align >= 0; align--) {
10300         for (len = 36; len; len--) {
10301                 b = buf+align;
10302                 memcpy(b, abc, len);
10303                 for (off = 1; off <= len; off++) {
10304                         memcpy(b+off, b, len);
10305                         memcpy(b, b+off, len);
10306                         if (memcmp(b, abc, len))
10307                                 exit(1);
10308                 }
10309         }
10310 }
10311 exit(0);
10312 }
10313 EOCP
10314         set try
10315         if eval $compile_ok; then
10316                 if ./try 2>/dev/null; then
10317                         echo "Yes, it can."
10318                         val="$define"
10319                 else
10320                         echo "It can't, sorry."
10321                         case "$d_memmove" in
10322                         "$define") echo "But that's Ok since you have memmove()." ;;
10323                         esac
10324                 fi
10325         else
10326                 echo "(I can't compile the test program, so we'll assume not...)"
10327                 case "$d_memmove" in
10328                 "$define") echo "But that's Ok since you have memmove()." ;;
10329                 esac
10330         fi
10331         ;;
10332 esac
10333 $rm -f try.* try core
10334 set d_safemcpy
10335 eval $setvar
10336
10337 : can memcmp be trusted to compare relative magnitude?
10338 val="$undef"
10339 case "$d_memcmp" in
10340 "$define")
10341         echo " "
10342         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10343         $cat >try.c <<EOCP
10344 #$i_memory I_MEMORY
10345 #$i_stdlib I_STDLIB
10346 #$i_string I_STRING
10347 #$i_unistd I_UNISTD
10348 EOCP
10349         $cat >>try.c <<'EOCP'
10350 #include <stdio.h>
10351 #ifdef I_MEMORY
10352 #  include <memory.h>
10353 #endif
10354 #ifdef I_STDLIB
10355 #  include <stdlib.h>
10356 #endif
10357 #ifdef I_STRING
10358 #  include <string.h>
10359 #else
10360 #  include <strings.h>
10361 #endif
10362 #ifdef I_UNISTD
10363 #  include <unistd.h>  /* Needed for NetBSD */
10364 #endif
10365 int main()
10366 {
10367 char a = -1;
10368 char b = 0;
10369 if ((a < b) && memcmp(&a, &b, 1) < 0)
10370         exit(1);
10371 exit(0);
10372 }
10373 EOCP
10374         set try
10375         if eval $compile_ok; then
10376                 if ./try 2>/dev/null; then
10377                         echo "Yes, it can."
10378                         val="$define"
10379                 else
10380                         echo "No, it can't (it uses signed chars)."
10381                 fi
10382         else
10383                 echo "(I can't compile the test program, so we'll assume not...)"
10384         fi
10385         ;;
10386 esac
10387 $rm -f try.* try core
10388 set d_sanemcmp
10389 eval $setvar
10390
10391 : see if select exists
10392 set select d_select
10393 eval $inlibc
10394
10395 : see if semctl exists
10396 set semctl d_semctl
10397 eval $inlibc
10398
10399 : see if semget exists
10400 set semget d_semget
10401 eval $inlibc
10402
10403 : see if semop exists
10404 set semop d_semop
10405 eval $inlibc
10406
10407 : see how much of the 'sem*(2)' library is present.
10408 h_sem=true
10409 echo " "
10410 case "$d_semctl$d_semget$d_semop" in
10411 *"$undef"*) h_sem=false;;
10412 esac
10413 case "$osname" in
10414 freebsd)
10415     case "`ipcs 2>&1`" in
10416     "SVID messages"*"not configured"*)
10417         echo "Your $osname does not have the sem*(2) configured." >&4
10418         h_sem=false
10419         val="$undef"
10420         set semctl d_semctl
10421         eval $setvar
10422         set semget d_semget
10423         eval $setvar
10424         set semop d_semop
10425         eval $setvar
10426         ;;
10427     esac
10428     ;;
10429 esac
10430 : we could also check for sys/ipc.h ...
10431 if $h_sem && $test `./findhdr sys/sem.h`; then
10432         echo "You have the full sem*(2) library." >&4
10433         val="$define"
10434 else
10435         echo "You don't have the full sem*(2) library." >&4
10436         val="$undef"
10437 fi
10438 set d_sem
10439 eval $setvar
10440
10441 : see whether sys/sem.h defines union semun
10442 echo " "
10443 $cat > try.c <<'END'
10444 #include <sys/types.h>
10445 #include <sys/ipc.h>
10446 #include <sys/sem.h>
10447 int main () { union semun semun; semun.buf = 0; }
10448 END
10449 set try
10450 if eval $compile; then
10451     echo "You have union semun in <sys/sem.h>." >&4
10452     val="$define"
10453 else
10454     echo "You do not have union semun in <sys/sem.h>." >&4
10455     val="$undef"
10456 fi
10457 $rm -f try try.c try.h
10458 set d_union_semun
10459 eval $setvar
10460
10461 : see how to do semctl IPC_STAT
10462 case "$d_sem" in
10463 $define)
10464     : see whether semctl IPC_STAT can use union semun
10465     echo " "
10466     $cat > try.h <<END
10467 #ifndef S_IRUSR
10468 #   ifdef S_IREAD
10469 #       define S_IRUSR S_IREAD
10470 #       define S_IWUSR S_IWRITE
10471 #       define S_IXUSR S_IEXEC
10472 #   else
10473 #       define S_IRUSR 0400
10474 #       define S_IWUSR 0200
10475 #       define S_IXUSR 0100
10476 #   endif
10477 #   define S_IRGRP (S_IRUSR>>3)
10478 #   define S_IWGRP (S_IWUSR>>3)
10479 #   define S_IXGRP (S_IXUSR>>3)
10480 #   define S_IROTH (S_IRUSR>>6)
10481 #   define S_IWOTH (S_IWUSR>>6)
10482 #   define S_IXOTH (S_IXUSR>>6)
10483 #endif
10484 #ifndef S_IRWXU
10485 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10486 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10487 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10488 #endif
10489 END
10490
10491     $cat > try.c <<END
10492 #include <sys/types.h>
10493 #include <sys/ipc.h>
10494 #include <sys/sem.h>
10495 #include <sys/stat.h>
10496 #include <stdio.h>
10497 #include <errno.h>
10498 #include "try.h"
10499 #ifndef errno
10500 extern int errno;
10501 #endif
10502 #$d_union_semun HAS_UNION_SEMUN
10503 int main() {
10504     union semun
10505 #ifndef HAS_UNION_SEMUN
10506     {
10507         int val;
10508         struct semid_ds *buf;
10509         unsigned short *array;
10510     }
10511 #endif
10512     arg;
10513     int sem, st;
10514
10515 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10516     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10517     if (sem > -1) {
10518         struct semid_ds argbuf;
10519         arg.buf = &argbuf;
10520 #       ifdef IPC_STAT
10521         st = semctl(sem, 0, IPC_STAT, arg);
10522         if (st == 0)
10523             printf("semun\n");
10524         else
10525 #       endif /* IPC_STAT */
10526             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10527 #       ifdef IPC_RMID
10528         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10529 #       endif /* IPC_RMID */
10530             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10531     } else
10532 #endif /* IPC_PRIVATE && ... */
10533         printf("semget failed: errno = %d\n", errno);
10534   return 0;
10535 }
10536 END
10537     val="$undef"
10538     set try
10539     if eval $compile; then
10540         xxx=`./try`
10541         case "$xxx" in
10542         semun) val="$define" ;;
10543         esac
10544     fi
10545     $rm -f try try.c
10546     set d_semctl_semun
10547     eval $setvar
10548     case "$d_semctl_semun" in
10549     $define)
10550         echo "You can use union semun for semctl IPC_STAT." >&4
10551         also='also'
10552         ;;
10553     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10554         also=''
10555         ;;
10556     esac
10557
10558     : see whether semctl IPC_STAT can use struct semid_ds pointer
10559     $cat > try.c <<'END'
10560 #include <sys/types.h>
10561 #include <sys/ipc.h>
10562 #include <sys/sem.h>
10563 #include <sys/stat.h>
10564 #include "try.h"
10565 #include <stdio.h>
10566 #include <errno.h>
10567 #ifndef errno
10568 extern int errno;
10569 #endif
10570 int main() {
10571     struct semid_ds arg;
10572     int sem, st;
10573
10574 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10575     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10576     if (sem > -1) {
10577 #       ifdef IPC_STAT
10578         st = semctl(sem, 0, IPC_STAT, &arg);
10579         if (st == 0)
10580             printf("semid_ds\n");
10581         else
10582 #       endif /* IPC_STAT */
10583             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10584 #       ifdef IPC_RMID
10585         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10586 #       endif /* IPC_RMID */
10587             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10588     } else
10589 #endif /* IPC_PRIVATE && ... */
10590         printf("semget failed: errno = %d\n", errno);
10591
10592     return 0;
10593 }
10594 END
10595     val="$undef"
10596     set try
10597     if eval $compile; then
10598         xxx=`./try`
10599         case "$xxx" in
10600         semid_ds) val="$define" ;;
10601         esac
10602     fi
10603     $rm -f try try.c
10604     set d_semctl_semid_ds
10605     eval $setvar
10606     case "$d_semctl_semid_ds" in
10607     $define)
10608         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10609         ;;
10610     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10611         ;;
10612     esac
10613     $rm -f try.h
10614     ;;
10615 *)  val="$undef"
10616
10617     # We do not have the full sem*(2) library, so assume we can not
10618     # use either.
10619
10620     set d_semctl_semun
10621     eval $setvar
10622
10623     set d_semctl_semid_ds
10624     eval $setvar
10625     ;;
10626 esac
10627
10628 : see if setegid exists
10629 set setegid d_setegid
10630 eval $inlibc
10631
10632 : see if seteuid exists
10633 set seteuid d_seteuid
10634 eval $inlibc
10635
10636 : see if setgrent exists
10637 set setgrent d_setgrent
10638 eval $inlibc
10639
10640 : see if sethostent exists
10641 set sethostent d_sethent
10642 eval $inlibc
10643
10644 : see if setlinebuf exists
10645 set setlinebuf d_setlinebuf
10646 eval $inlibc
10647
10648 : see if setlocale exists
10649 set setlocale d_setlocale
10650 eval $inlibc
10651
10652 : see if setnetent exists
10653 set setnetent d_setnent
10654 eval $inlibc
10655
10656 : see if setprotoent exists
10657 set setprotoent d_setpent
10658 eval $inlibc
10659
10660 : see if setpgid exists
10661 set setpgid d_setpgid
10662 eval $inlibc
10663
10664 : see if setpgrp2 exists
10665 set setpgrp2 d_setpgrp2
10666 eval $inlibc
10667
10668 : see if setpriority exists
10669 set setpriority d_setprior
10670 eval $inlibc
10671
10672 : see if setpwent exists
10673 set setpwent d_setpwent
10674 eval $inlibc
10675
10676 : see if setregid exists
10677 set setregid d_setregid
10678 eval $inlibc
10679 set setresgid d_setresgid
10680 eval $inlibc
10681
10682 : see if setreuid exists
10683 set setreuid d_setreuid
10684 eval $inlibc
10685 set setresuid d_setresuid
10686 eval $inlibc
10687
10688 : see if setrgid exists
10689 set setrgid d_setrgid
10690 eval $inlibc
10691
10692 : see if setruid exists
10693 set setruid d_setruid
10694 eval $inlibc
10695
10696 : see if setservent exists
10697 set setservent d_setsent
10698 eval $inlibc
10699
10700 : see if setsid exists
10701 set setsid d_setsid
10702 eval $inlibc
10703
10704 : see if setspent exists
10705 set setspent d_setspent
10706 eval $inlibc
10707
10708 : see if setvbuf exists
10709 set setvbuf d_setvbuf
10710 eval $inlibc
10711
10712 : see if sfio.h is available
10713 set sfio.h i_sfio
10714 eval $inhdr
10715
10716
10717 : see if sfio library is available
10718 case "$i_sfio" in
10719 $define)
10720         val=''
10721         set sfreserve val
10722         eval $inlibc
10723         ;;
10724 *)
10725         val="$undef"
10726         ;;
10727 esac
10728 : Ok, but do we want to use it.
10729 case "$val" in
10730 $define)
10731         case "$usesfio" in
10732         true|$define|[yY]*) dflt='y';;
10733         *) dflt='n';;
10734         esac
10735         echo "$package can use the sfio library, but it is experimental."
10736         rp="You seem to have sfio available, do you want to try using it?"
10737         . ./myread
10738         case "$ans" in
10739         y|Y) ;;
10740         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10741                 val="$undef"
10742                 : Remove sfio from list of libraries to use
10743                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10744                 shift
10745                 libs="$*"
10746                 echo "libs = $libs" >&4
10747                 ;;
10748         esac
10749         ;;
10750 *)      case "$usesfio" in
10751         true|$define|[yY]*)
10752                 echo "Sorry, cannot find sfio on this machine" >&4
10753                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10754                 ;;
10755         esac
10756         ;;
10757 esac
10758 set d_sfio
10759 eval $setvar
10760 case "$d_sfio" in
10761 $define) usesfio='true';;
10762 *) usesfio='false';;
10763 esac
10764
10765 : see if shmctl exists
10766 set shmctl d_shmctl
10767 eval $inlibc
10768
10769 : see if shmget exists
10770 set shmget d_shmget
10771 eval $inlibc
10772
10773 : see if shmat exists
10774 set shmat d_shmat
10775 eval $inlibc
10776 : see what shmat returns
10777 case "$d_shmat" in
10778 "$define")
10779         $cat >shmat.c <<'END'
10780 #include <sys/shm.h>
10781 void *shmat();
10782 END
10783         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10784                 shmattype='void *'
10785         else
10786                 shmattype='char *'
10787         fi
10788         echo "and it returns ($shmattype)." >&4
10789         : see if a prototype for shmat is available
10790         xxx=`./findhdr sys/shm.h`
10791         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10792         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10793                 val="$define"
10794         else
10795                 val="$undef"
10796         fi
10797         $rm -f shmat.[co]
10798         ;;
10799 *)
10800         val="$undef"
10801         ;;
10802 esac
10803 set d_shmatprototype
10804 eval $setvar
10805
10806 : see if shmdt exists
10807 set shmdt d_shmdt
10808 eval $inlibc
10809
10810 : see how much of the 'shm*(2)' library is present.
10811 h_shm=true
10812 echo " "
10813 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10814 *"$undef"*) h_shm=false;;
10815 esac
10816 case "$osname" in
10817 freebsd)
10818     case "`ipcs 2>&1`" in
10819     "SVID shared memory"*"not configured"*)
10820         echo "Your $osname does not have the shm*(2) configured." >&4
10821         h_shm=false
10822         val="$undef"
10823         set shmctl d_shmctl
10824         evat $setvar
10825         set shmget d_shmget
10826         evat $setvar
10827         set shmat d_shmat
10828         evat $setvar
10829         set shmdt d_shmdt
10830         evat $setvar
10831         ;;
10832     esac
10833     ;;
10834 esac
10835 : we could also check for sys/ipc.h ...
10836 if $h_shm && $test `./findhdr sys/shm.h`; then
10837         echo "You have the full shm*(2) library." >&4
10838         val="$define"
10839 else
10840         echo "You don't have the full shm*(2) library." >&4
10841         val="$undef"
10842 fi
10843 set d_shm
10844 eval $setvar
10845
10846 echo " "
10847 : see if we have sigaction
10848 if set sigaction val -f d_sigaction; eval $csym; $val; then
10849         echo 'sigaction() found.' >&4
10850         $cat > try.c <<'EOP'
10851 #include <stdio.h>
10852 #include <sys/types.h>
10853 #include <signal.h>
10854 int main()
10855 {
10856     struct sigaction act, oact;
10857     act.sa_flags = 0;
10858     oact.sa_handler = 0;
10859     /* so that act and oact are used */
10860     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10861 }
10862 EOP
10863         set try
10864         if eval $compile_ok; then
10865                 val="$define"
10866         else
10867                 echo "But you don't seem to have a useable struct sigaction." >&4
10868                 val="$undef"
10869         fi
10870 else
10871         echo 'sigaction NOT found.' >&4
10872         val="$undef"
10873 fi
10874 set d_sigaction; eval $setvar
10875 $rm -f try try$_o try.c
10876
10877 : see if sigsetjmp exists
10878 echo " "
10879 case "$d_sigsetjmp" in
10880 '')
10881         $cat >try.c <<'EOP'
10882 #include <setjmp.h>
10883 sigjmp_buf env;
10884 int set = 1;
10885 int main()
10886 {
10887         if (sigsetjmp(env,1))
10888                 exit(set);
10889         set = 0;
10890         siglongjmp(env, 1);
10891         exit(1);
10892 }
10893 EOP
10894         set try
10895         if eval $compile; then
10896                 if ./try >/dev/null 2>&1; then
10897                         echo "POSIX sigsetjmp found." >&4
10898                         val="$define"
10899                 else
10900                         $cat >&4 <<EOM
10901 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10902 I'll ignore them.
10903 EOM
10904                         val="$undef"
10905                 fi
10906         else
10907                 echo "sigsetjmp not found." >&4
10908                 val="$undef"
10909         fi
10910         ;;
10911 *) val="$d_sigsetjmp"
10912         case "$d_sigsetjmp" in
10913         $define) echo "POSIX sigsetjmp found." >&4;;
10914         $undef) echo "sigsetjmp not found." >&4;;
10915         esac
10916         ;;
10917 esac
10918 set d_sigsetjmp
10919 eval $setvar
10920 $rm -f try.c try
10921
10922 : see if sqrtl exists
10923 set sqrtl d_sqrtl
10924 eval $inlibc
10925
10926 : see if sys/stat.h is available
10927 set sys/stat.h i_sysstat
10928 eval $inhdr
10929
10930
10931 : see if stat knows about block sizes
10932 echo " "
10933 echo "Checking to see if your struct stat has st_blocks field..." >&4
10934 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10935 eval $hasfield
10936
10937
10938 : see if this is a sys/vfs.h system
10939 set sys/vfs.h i_sysvfs
10940 eval $inhdr
10941
10942
10943 : see if this is a sys/statfs.h system
10944 set sys/statfs.h i_sysstatfs
10945 eval $inhdr
10946
10947
10948 echo " "
10949 echo "Checking to see if your system supports struct statfs..." >&4
10950 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
10951 eval $hasstruct
10952 case "$d_statfs_s" in
10953 "$define")      echo "Yes, it does."   ;;
10954 *)              echo "No, it doesn't." ;;
10955 esac
10956
10957
10958
10959 : see if struct statfs knows about f_flags
10960 case "$d_statfs_s" in
10961 define) 
10962         echo " "
10963         echo "Checking to see if your struct statfs has f_flags field..." >&4
10964         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
10965         eval $hasfield
10966         ;;
10967 *)      val="$undef"
10968         set d_statfs_f_flags
10969         eval $setvar
10970         ;;
10971 esac
10972 case "$d_statfs_f_flags" in
10973 "$define")      echo "Yes, it does."   ;;
10974 *)              echo "No, it doesn't." ;;
10975 esac
10976
10977 : see if _ptr and _cnt from stdio act std
10978 echo " "
10979 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10980         echo "(Looks like you have stdio.h from Linux.)"
10981         case "$stdio_ptr" in
10982         '') stdio_ptr='((fp)->_IO_read_ptr)'
10983                 ptr_lval=$define
10984                 ;;
10985         *)      ptr_lval=$d_stdio_ptr_lval;;
10986         esac
10987         case "$stdio_cnt" in
10988         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10989                 cnt_lval=$undef
10990                 ;;
10991         *)      cnt_lval=$d_stdio_cnt_lval;;
10992         esac
10993         case "$stdio_base" in
10994         '') stdio_base='((fp)->_IO_read_base)';;
10995         esac
10996         case "$stdio_bufsiz" in
10997         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10998         esac
10999 else
11000         case "$stdio_ptr" in
11001         '') stdio_ptr='((fp)->_ptr)'
11002                 ptr_lval=$define
11003                 ;;
11004         *)      ptr_lval=$d_stdio_ptr_lval;;
11005         esac
11006         case "$stdio_cnt" in
11007         '') stdio_cnt='((fp)->_cnt)'
11008                 cnt_lval=$define
11009                 ;;
11010         *)      cnt_lval=$d_stdio_cnt_lval;;
11011         esac
11012         case "$stdio_base" in
11013         '') stdio_base='((fp)->_base)';;
11014         esac
11015         case "$stdio_bufsiz" in
11016         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11017         esac
11018 fi
11019 : test whether _ptr and _cnt really work
11020 echo "Checking how std your stdio is..." >&4
11021 $cat >try.c <<EOP
11022 #include <stdio.h>
11023 #define FILE_ptr(fp)    $stdio_ptr
11024 #define FILE_cnt(fp)    $stdio_cnt
11025 int main() {
11026         FILE *fp = fopen("try.c", "r");
11027         char c = getc(fp);
11028         if (
11029                 18 <= FILE_cnt(fp) &&
11030                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11031         )
11032                 exit(0);
11033         exit(1);
11034 }
11035 EOP
11036 val="$undef"
11037 set try
11038 if eval $compile; then
11039         if ./try; then
11040                 echo "Your stdio acts pretty std."
11041                 val="$define"
11042         else
11043                 echo "Your stdio isn't very std."
11044         fi
11045 else
11046         echo "Your stdio doesn't appear very std."
11047 fi
11048 $rm -f try.c try
11049 set d_stdstdio
11050 eval $setvar
11051
11052 : Can _ptr be used as an lvalue?
11053 case "$d_stdstdio$ptr_lval" in
11054 $define$define) val=$define ;;
11055 *) val=$undef ;;
11056 esac
11057 set d_stdio_ptr_lval
11058 eval $setvar
11059
11060 : Can _cnt be used as an lvalue?
11061 case "$d_stdstdio$cnt_lval" in
11062 $define$define) val=$define ;;
11063 *) val=$undef ;;
11064 esac
11065 set d_stdio_cnt_lval
11066 eval $setvar
11067
11068 : see if _base is also standard
11069 val="$undef"
11070 case "$d_stdstdio" in
11071 $define)
11072         $cat >try.c <<EOP
11073 #include <stdio.h>
11074 #define FILE_base(fp)   $stdio_base
11075 #define FILE_bufsiz(fp) $stdio_bufsiz
11076 int main() {
11077         FILE *fp = fopen("try.c", "r");
11078         char c = getc(fp);
11079         if (
11080                 19 <= FILE_bufsiz(fp) &&
11081                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11082         )
11083                 exit(0);
11084         exit(1);
11085 }
11086 EOP
11087         set try
11088         if eval $compile; then
11089                 if ./try; then
11090                         echo "And its _base field acts std."
11091                         val="$define"
11092                 else
11093                         echo "But its _base field isn't std."
11094                 fi
11095         else
11096                 echo "However, it seems to be lacking the _base field."
11097         fi
11098         $rm -f try.c try
11099         ;;
11100 esac
11101 set d_stdiobase
11102 eval $setvar
11103
11104 $cat >&4 <<EOM
11105 Checking how to access stdio streams by file descriptor number...
11106 EOM
11107 case "$stdio_stream_array" in
11108 '')     $cat >try.c <<EOCP
11109 #include <stdio.h>
11110 int main() {
11111   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11112     printf("yes\n");
11113 }
11114 EOCP
11115         for s in _iob __iob __sF
11116         do
11117                 set try -DSTDIO_STREAM_ARRAY=$s
11118                 if eval $compile; then
11119                         case "`./try$exe_ext`" in
11120                         yes)    stdio_stream_array=$s; break ;;
11121                         esac
11122                 fi
11123         done
11124         $rm -f try.* try$exe_ext
11125 esac
11126 case "$stdio_stream_array" in
11127 '')     $cat >&4 <<EOM
11128 I can't figure out how to access stdio streams by file descriptor number.
11129 EOM
11130         d_stdio_stream_array="$undef"
11131         ;;
11132 *)      $cat >&4 <<EOM
11133 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11134 EOM
11135         d_stdio_stream_array="$define"
11136         ;;
11137 esac
11138
11139 : see if strcoll exists
11140 set strcoll d_strcoll
11141 eval $inlibc
11142
11143 : check for structure copying
11144 echo " "
11145 echo "Checking to see if your C compiler can copy structs..." >&4
11146 $cat >try.c <<'EOCP'
11147 int main()
11148 {
11149         struct blurfl {
11150                 int dyick;
11151         } foo, bar;
11152
11153         foo = bar;
11154 }
11155 EOCP
11156 if $cc -c try.c >/dev/null 2>&1 ; then
11157         val="$define"
11158         echo "Yup, it can."
11159 else
11160         val="$undef"
11161         echo "Nope, it can't."
11162 fi
11163 set d_strctcpy
11164 eval $setvar
11165 $rm -f try.*
11166
11167 : see if strerror and/or sys_errlist[] exist
11168 echo " "
11169 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11170     if set strerror val -f d_strerror; eval $csym; $val; then
11171                 echo 'strerror() found.' >&4
11172                 d_strerror="$define"
11173                 d_strerrm='strerror(e)'
11174                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11175                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11176                         d_syserrlst="$define"
11177                 else
11178                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11179                         d_syserrlst="$undef"
11180                 fi
11181     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11182                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11183                 echo 'strerror() found in string header.' >&4
11184                 d_strerror="$define"
11185                 d_strerrm='strerror(e)'
11186                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11187                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11188                                 d_syserrlst="$define"
11189                 else
11190                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11191                         d_syserrlst="$undef"
11192                 fi
11193     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11194                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11195                 d_strerror="$undef"
11196                 d_syserrlst="$define"
11197                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11198     else
11199                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11200                 d_strerror="$undef"
11201                 d_syserrlst="$undef"
11202                 d_strerrm='"unknown"'
11203     fi
11204 fi
11205
11206 : see if strtod exists
11207 set strtod d_strtod
11208 eval $inlibc
11209
11210 : see if strtol exists
11211 set strtol d_strtol
11212 eval $inlibc
11213
11214 : see if strtold exists
11215 set strtold d_strtold
11216 eval $inlibc
11217
11218 : see if strtoll exists
11219 set strtoll d_strtoll
11220 eval $inlibc
11221
11222 : see if strtoul exists
11223 set strtoul d_strtoul
11224 eval $inlibc
11225
11226 : see if strtoull exists
11227 set strtoull d_strtoull
11228 eval $inlibc
11229
11230 : see if strtouq exists
11231 set strtouq d_strtouq
11232 eval $inlibc
11233
11234 : see if strxfrm exists
11235 set strxfrm d_strxfrm
11236 eval $inlibc
11237
11238 : see if symlink exists
11239 set symlink d_symlink
11240 eval $inlibc
11241
11242 : see if syscall exists
11243 set syscall d_syscall
11244 eval $inlibc
11245
11246 : see if sysconf exists
11247 set sysconf d_sysconf
11248 eval $inlibc
11249
11250 : see if system exists
11251 set system d_system
11252 eval $inlibc
11253
11254 : see if tcgetpgrp exists
11255 set tcgetpgrp d_tcgetpgrp
11256 eval $inlibc
11257
11258 : see if tcsetpgrp exists
11259 set tcsetpgrp d_tcsetpgrp
11260 eval $inlibc
11261
11262 : see if prototype for telldir is available
11263 echo " "
11264 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11265 eval $hasproto
11266
11267 : see if this is a sys/times.h system
11268 set sys/times.h i_systimes
11269 eval $inhdr
11270
11271 : see if times exists
11272 echo " "
11273 if set times val -f d_times; eval $csym; $val; then
11274         echo 'times() found.' >&4
11275         d_times="$define"
11276         inc=''
11277         case "$i_systimes" in
11278         "$define") inc='sys/times.h';;
11279         esac
11280         rp="What is the type returned by times() on this system?"
11281         set clock_t clocktype long stdio.h sys/types.h $inc
11282         eval $typedef_ask
11283 else
11284         echo 'times() NOT found, hope that will do.' >&4
11285         d_times="$undef"
11286         clocktype='int'
11287 fi
11288
11289 : see if truncate exists
11290 set truncate d_truncate
11291 eval $inlibc
11292
11293 : see if tzname[] exists
11294 echo " "
11295 if set tzname val -a d_tzname; eval $csym; $val; then
11296         val="$define"
11297         echo 'tzname[] found.' >&4
11298 else
11299         val="$undef"
11300         echo 'tzname[] NOT found.' >&4
11301 fi
11302 set d_tzname
11303 eval $setvar
11304
11305 : see if umask exists
11306 set umask d_umask
11307 eval $inlibc
11308
11309 : see if ustat exists
11310 set ustat d_ustat
11311 eval $inlibc
11312
11313 : backward compatibility for d_hvfork
11314 if test X$d_hvfork != X; then
11315         d_vfork="$d_hvfork"
11316         d_hvfork=''
11317 fi
11318 : see if there is a vfork
11319 val=''
11320 set vfork val
11321 eval $inlibc
11322
11323 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11324 : perl on Solaris 2.x, and probably elsewhere.
11325 case "$val" in
11326 $define)
11327         echo " "
11328         case "$usevfork" in
11329         false) dflt='n';;
11330         *) dflt='y';;
11331         esac
11332         cat <<'EOM'
11333  
11334 Perl can only use a vfork() that doesn't suffer from strict
11335 restrictions on calling functions or modifying global data in
11336 the child.  For example, glibc-2.1 contains such a vfork()
11337 that is unsuitable.  If your system provides a proper fork()
11338 call, chances are that you do NOT want perl to use vfork().
11339
11340 EOM
11341         rp="Do you still want to use vfork()?"
11342         . ./myread
11343         case "$ans" in
11344         y|Y) ;;
11345         *)
11346                 echo "Ok, we won't use vfork()."
11347                 val="$undef"
11348                 ;;
11349         esac
11350         ;;
11351 esac
11352 set d_vfork
11353 eval $setvar
11354 case "$d_vfork" in
11355 $define) usevfork='true';;
11356 *) usevfork='false';;
11357 esac
11358
11359 : see if this is an sysdir system
11360 set sys/dir.h i_sysdir
11361 eval $inhdr
11362
11363 : see if this is an sysndir system
11364 set sys/ndir.h i_sysndir
11365 eval $inhdr
11366
11367 : see if closedir exists
11368 set closedir d_closedir
11369 eval $inlibc
11370
11371 case "$d_closedir" in
11372 "$define")
11373         echo " "
11374         echo "Checking whether closedir() returns a status..." >&4
11375         cat > closedir.c <<EOM
11376 #$i_dirent I_DIRENT             /**/
11377 #$i_sysdir I_SYS_DIR            /**/
11378 #$i_sysndir I_SYS_NDIR          /**/
11379 #$i_systypes I_SYS_TYPES        /**/
11380
11381 #if defined(I_SYS_TYPES)
11382 #include <sys/types.h>
11383 #endif
11384 #if defined(I_DIRENT)
11385 #include <dirent.h>
11386 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11387 #include <sys/dir.h>
11388 #endif
11389 #else
11390 #ifdef I_SYS_NDIR
11391 #include <sys/ndir.h>
11392 #else
11393 #ifdef I_SYS_DIR
11394 #ifdef hp9000s500
11395 #include <ndir.h>       /* may be wrong in the future */
11396 #else
11397 #include <sys/dir.h>
11398 #endif
11399 #endif
11400 #endif
11401 #endif 
11402 int main() { return closedir(opendir(".")); }
11403 EOM
11404         set closedir
11405         if eval $compile_ok; then
11406                 if ./closedir > /dev/null 2>&1 ; then
11407                         echo "Yes, it does."
11408                         val="$undef"
11409                 else
11410                         echo "No, it doesn't."
11411                         val="$define"
11412                 fi
11413         else
11414                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11415                 val="$define"
11416         fi
11417         ;;
11418 *)
11419         val="$undef";
11420         ;;
11421 esac
11422 set d_void_closedir
11423 eval $setvar
11424 $rm -f closedir*
11425 : check for volatile keyword
11426 echo " "
11427 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11428 $cat >try.c <<'EOCP'
11429 int main()
11430 {
11431         typedef struct _goo_struct goo_struct;
11432         goo_struct * volatile goo = ((goo_struct *)0);
11433         struct _goo_struct {
11434                 long long_int;
11435                 int reg_int;
11436                 char char_var;
11437         };
11438         typedef unsigned short foo_t;
11439         char *volatile foo;
11440         volatile int bar;
11441         volatile foo_t blech;
11442         foo = foo;
11443 }
11444 EOCP
11445 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11446         val="$define"
11447         echo "Yup, it does."
11448 else
11449         val="$undef"
11450         echo "Nope, it doesn't."
11451 fi
11452 set d_volatile
11453 eval $setvar
11454 $rm -f try.*
11455
11456 : see if there is a wait4
11457 set wait4 d_wait4
11458 eval $inlibc
11459
11460 : see if waitpid exists
11461 set waitpid d_waitpid
11462 eval $inlibc
11463
11464 : see if wcstombs exists
11465 set wcstombs d_wcstombs
11466 eval $inlibc
11467
11468 : see if wctomb exists
11469 set wctomb d_wctomb
11470 eval $inlibc
11471
11472 : preserve RCS keywords in files with variable substitution, grrr
11473 Date='$Date'
11474 Id='$Id'
11475 Log='$Log'
11476 RCSfile='$RCSfile'
11477 Revision='$Revision'
11478
11479 case "$crosscompile" in
11480 ''|[nN]*) crosscompile="$undef" ;;
11481 esac
11482
11483 case "$osname" in
11484 next|rhapsody) multiarch="$define" ;;
11485 esac
11486 case "$multiarch" in
11487 ''|[nN]*) multiarch="$undef" ;;
11488 esac
11489
11490 : check for alignment requirements
11491 echo " "
11492 case "$crosscompile$multiarch" in
11493 *$define*)
11494         $cat <<EOM
11495 You seem to be either cross-compiling or doing a multiarchitecture build,
11496 skipping the memory alignment check.
11497
11498 EOM
11499         case "$alignbytes" in
11500         '') alignbytes=8 ;;
11501         esac
11502         ;;
11503 *)
11504         case "$alignbytes" in
11505         '') echo "Checking alignment constraints..." >&4
11506                 $cat >try.c <<'EOCP'
11507 #include <stdio.h>
11508 struct foobar {
11509         char foo;
11510         double bar;
11511 } try_algn;
11512 int main()
11513 {
11514     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11515     return(0);
11516 }
11517 EOCP
11518                 set try
11519                 if eval $compile_ok; then
11520                         dflt=`./try`
11521                 else
11522                         dflt='8'
11523                         echo "(I can't seem to compile the test program...)"
11524                 fi
11525                 ;;
11526         *) dflt="$alignbytes"
11527                 ;;
11528         esac
11529         rp="Doubles must be aligned on a how-many-byte boundary?"
11530         . ./myread
11531         alignbytes="$ans"
11532         $rm -f try.c try
11533         ;;
11534 esac
11535
11536
11537 : check for ordering of bytes in a long
11538 echo " "
11539 case "$crosscompile$multiarch" in
11540 *$define*)
11541         $cat <<EOM
11542 You seem to be either cross-compiling or doing a multiarchitecture build,
11543 skipping the byteorder check.
11544
11545 EOM
11546         byteorder='0xffff'
11547         ;;
11548 *)
11549         case "$byteorder" in
11550         '')
11551                 $cat <<'EOM'
11552 In the following, larger digits indicate more significance.  A big-endian
11553 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11554 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11555 machines may have weird orders like 3412.  A Cray will report 87654321,
11556 an Alpha will report 12345678. If the test program works the default is
11557 probably right.
11558 I'm now running the test program...
11559 EOM
11560                 $cat >try.c <<'EOCP'
11561 #include <stdio.h>
11562 int main()
11563 {
11564         int i;
11565         union {
11566                 unsigned long l;
11567                 char c[sizeof(long)];
11568         } u;
11569
11570         if (sizeof(long) > 4)
11571                 u.l = (0x08070605L << 32) | 0x04030201L;
11572         else
11573                 u.l = 0x04030201L;
11574         for (i = 0; i < sizeof(long); i++)
11575                 printf("%c", u.c[i]+'0');
11576         printf("\n");
11577         exit(0);
11578 }
11579 EOCP
11580                 xxx_prompt=y
11581                 set try
11582                 if eval $compile && ./try > /dev/null; then
11583                         dflt=`./try`
11584                         case "$dflt" in
11585                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11586                                 echo "(The test program ran ok.)"
11587                                 echo "byteorder=$dflt"
11588                                 xxx_prompt=n
11589                         ;;
11590                         ????|????????) echo "(The test program ran ok.)" ;;
11591                         *) echo "(The test program didn't run right for some reason.)" ;;
11592                         esac
11593                 else
11594                         dflt='4321'
11595                         cat <<'EOM'
11596 (I can't seem to compile the test program.  Guessing big-endian...)
11597 EOM
11598                 fi
11599                 case "$xxx_prompt" in
11600                 y)
11601                         rp="What is the order of bytes in a long?"
11602                         . ./myread
11603                         byteorder="$ans"
11604                         ;;
11605                 *)      byteorder=$dflt
11606                         ;;
11607                 esac
11608                 ;;
11609         esac
11610         $rm -f try.c try
11611         ;;
11612 esac
11613
11614
11615 : how do we catenate cpp tokens here?
11616 echo " "
11617 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11618 $cat >cpp_stuff.c <<'EOCP'
11619 #define RCAT(a,b)a/**/b
11620 #define ACAT(a,b)a ## b
11621 RCAT(Rei,ser)
11622 ACAT(Cir,cus)
11623 EOCP
11624 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11625 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11626         echo "Oh!  Smells like ANSI's been here." >&4
11627         echo "We can catify or stringify, separately or together!"
11628         cpp_stuff=42
11629 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11630         echo "Ah, yes!  The good old days!" >&4
11631         echo "However, in the good old days we don't know how to stringify and"
11632         echo "catify at the same time."
11633         cpp_stuff=1
11634 else
11635         $cat >&4 <<EOM
11636 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11637 to have to edit the values of CAT[2-5] in config.h...
11638 EOM
11639         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11640 fi
11641 $rm -f cpp_stuff.*
11642
11643 : see if this is a db.h system
11644 set db.h i_db
11645 eval $inhdr
11646
11647 case "$i_db" in
11648 $define)
11649         : Check db version.
11650         echo " "
11651         echo "Checking Berkeley DB version ..." >&4
11652         $cat >try.c <<EOCP
11653 #$d_const HASCONST
11654 #ifndef HASCONST
11655 #define const
11656 #endif
11657 #include <sys/types.h>
11658 #include <stdio.h>
11659 #include <db.h>
11660 int main()
11661 {
11662 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11663     int Major, Minor, Patch ;
11664     unsigned long Version ;
11665     (void)db_version(&Major, &Minor, &Patch) ;
11666     printf("You have Berkeley DB Version 2 or greater\n");
11667
11668     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11669                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11670     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11671                 Major, Minor, Patch) ;
11672
11673     /* check that db.h & libdb are compatible */
11674     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11675         printf("db.h and libdb are incompatible\n") ;
11676         exit(3);        
11677     }
11678
11679     printf("db.h and libdb are compatible\n") ;
11680
11681     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11682                 + DB_VERSION_PATCH ;
11683
11684     /* needs to be >= 2.3.4 */
11685     if (Version < 2003004) {
11686     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11687         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11688         exit(2);        
11689     }
11690
11691     exit(0);
11692 #else
11693 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11694     printf("You have Berkeley DB Version 1\n");
11695     exit(0);    /* DB version < 2: the coast is clear. */
11696 #else
11697     exit(1);    /* <db.h> not Berkeley DB? */
11698 #endif
11699 #endif
11700 }
11701 EOCP
11702         set try
11703         if eval $compile_ok && ./try; then
11704                 echo 'Looks OK.' >&4
11705         else
11706                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11707                 i_db=$undef
11708                 case " $libs " in
11709                 *"-ldb "*)
11710                         : Remove db from list of libraries to use
11711                         echo "Removing unusable -ldb from library list" >&4
11712                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11713                         shift
11714                         libs="$*"
11715                         echo "libs = $libs" >&4
11716                         ;;
11717                 esac
11718         fi
11719         $rm -f try.*
11720         ;;
11721 esac
11722
11723 case "$i_db" in
11724 define)
11725         : Check the return type needed for hash 
11726         echo " "
11727         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11728         $cat >try.c <<EOCP
11729 #$d_const HASCONST
11730 #ifndef HASCONST
11731 #define const
11732 #endif
11733 #include <sys/types.h>
11734 #include <db.h>
11735
11736 #ifndef DB_VERSION_MAJOR
11737 u_int32_t hash_cb (ptr, size)
11738 const void *ptr;
11739 size_t size;
11740 {
11741 }
11742 HASHINFO info;
11743 int main()
11744 {
11745         info.hash = hash_cb;
11746 }
11747 #endif
11748 EOCP
11749         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11750                 if $contains warning try.out >>/dev/null 2>&1 ; then
11751                         db_hashtype='int'
11752                 else
11753                         db_hashtype='u_int32_t'
11754                 fi
11755         else
11756                 : XXX Maybe we should just give up here.
11757                 db_hashtype=u_int32_t
11758                 $cat try.out >&4
11759                 echo "Help:  I can't seem to compile the db test program." >&4
11760                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11761         fi
11762         $rm -f try.*
11763         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11764         ;;
11765 *)      db_hashtype=u_int32_t
11766         ;;
11767 esac
11768 case "$i_db" in
11769 define)
11770         : Check the return type needed for prefix 
11771         echo " "
11772         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11773         cat >try.c <<EOCP
11774 #$d_const HASCONST
11775 #ifndef HASCONST
11776 #define const
11777 #endif
11778 #include <sys/types.h>
11779 #include <db.h>
11780
11781 #ifndef DB_VERSION_MAJOR
11782 size_t prefix_cb (key1, key2)
11783 const DBT *key1;
11784 const DBT *key2;
11785 {
11786 }
11787 BTREEINFO info;
11788 int main()
11789 {
11790         info.prefix = prefix_cb;
11791 }
11792 #endif
11793 EOCP
11794         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11795                 if $contains warning try.out >>/dev/null 2>&1 ; then
11796                         db_prefixtype='int'
11797                 else
11798                         db_prefixtype='size_t'
11799                 fi
11800         else
11801                 db_prefixtype='size_t'
11802                 : XXX Maybe we should just give up here.
11803                 $cat try.out >&4
11804                 echo "Help:  I can't seem to compile the db test program." >&4
11805                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11806         fi
11807         $rm -f try.*
11808         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11809         ;;
11810 *)      db_prefixtype='size_t'
11811         ;;
11812 esac
11813
11814 : check for void type
11815 echo " "
11816 echo "Checking to see how well your C compiler groks the void type..." >&4
11817 case "$voidflags" in
11818 '')
11819         $cat >try.c <<'EOCP'
11820 #if TRY & 1
11821 void sub() {
11822 #else
11823 sub() {
11824 #endif
11825         extern void moo();      /* function returning void */
11826         void (*goo)();          /* ptr to func returning void */
11827 #if TRY & 8
11828         void *hue;              /* generic ptr */
11829 #endif
11830 #if TRY & 2
11831         void (*foo[10])();
11832 #endif
11833
11834 #if TRY & 4
11835         if(goo == moo) {
11836                 exit(0);
11837         }
11838 #endif
11839         exit(0);
11840 }
11841 int main() { sub(); }
11842 EOCP
11843         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11844                 voidflags=$defvoidused
11845         echo "Good.  It appears to support void to the level $package wants.">&4
11846                 if $contains warning .out >/dev/null 2>&1; then
11847                         echo "However, you might get some warnings that look like this:"
11848                         $cat .out
11849                 fi
11850         else
11851 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11852                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11853                         echo "It supports 1..."
11854                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11855                                 echo "It also supports 2..."
11856                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11857                                         voidflags=7
11858                                         echo "And it supports 4 but not 8 definitely."
11859                                 else
11860                                         echo "It doesn't support 4..."
11861                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11862                                                 voidflags=11
11863                                                 echo "But it supports 8."
11864                                         else
11865                                                 voidflags=3
11866                                                 echo "Neither does it support 8."
11867                                         fi
11868                                 fi
11869                         else
11870                                 echo "It does not support 2..."
11871                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11872                                         voidflags=13
11873                                         echo "But it supports 4 and 8."
11874                                 else
11875                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11876                                                 voidflags=5
11877                                                 echo "And it supports 4 but has not heard about 8."
11878                                         else
11879                                                 echo "However it supports 8 but not 4."
11880                                         fi
11881                                 fi
11882                         fi
11883                 else
11884                         echo "There is no support at all for void."
11885                         voidflags=0
11886                 fi
11887         fi
11888 esac
11889 case "$voidflags" in
11890 "$defvoidused") ;;
11891 *)      $cat >&4 <<'EOM'
11892   Support flag bits are:
11893     1: basic void declarations.
11894     2: arrays of pointers to functions returning void.
11895     4: operations between pointers to and addresses of void functions.
11896     8: generic void pointers.
11897 EOM
11898         dflt="$voidflags";
11899         rp="Your void support flags add up to what?"
11900         . ./myread
11901         voidflags="$ans"
11902         ;;
11903 esac
11904 $rm -f try.* .out
11905
11906
11907 : How can we generate normalized random numbers ?
11908 echo " "
11909 echo "Looking for a random number function..." >&4
11910 case "$randfunc" in
11911 '')
11912         if set drand48 val -f; eval $csym; $val; then
11913                 dflt="drand48"
11914                 echo "Good, found drand48()." >&4
11915         elif set random val -f; eval $csym; $val; then
11916                 dflt="random"
11917                 echo "OK, found random()." >&4
11918         else
11919                 dflt="rand"
11920                 echo "Yick, looks like I have to use rand()." >&4
11921         fi
11922         echo " "
11923         ;;
11924 *)
11925         dflt="$randfunc"
11926         ;;
11927 esac
11928 cont=true
11929
11930 case "$ccflags" in
11931 *-Dmy_rand=*|*-Dmy_srand=*)
11932         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11933         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11934         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11935         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11936         ;;
11937 esac
11938
11939 while $test "$cont"; do
11940         rp="Use which function to generate random numbers?"
11941         . ./myread
11942         if $test "$ans" = "$dflt"; then
11943                 : null
11944         else
11945                 randbits=''
11946         fi
11947         randfunc="$ans"
11948         if set $ans val -f; eval $csym; $val; then
11949                 cont=''
11950         else
11951                 dflt=y
11952                 rp="I cannot find function $ans. Use that name anyway?"
11953                 . ./myread
11954                 dflt=rand
11955                 case "$ans" in
11956                         [yY]*) cont='';;
11957                 esac
11958         fi
11959         case "$cont" in
11960         '')
11961                 case "$randfunc" in
11962                 drand48)
11963                         drand01="drand48()"
11964                         seedfunc="srand48"
11965                         randbits=48
11966                         randseedtype=long
11967                         ;;
11968                 rand|random)
11969                         case "$randbits" in
11970                         '')
11971 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11972                                 $cat >try.c <<EOCP
11973 #$i_unistd I_UNISTD
11974 #$i_stdlib I_STDLIB
11975 #include <stdio.h>
11976 #ifdef I_UNISTD
11977 #  include <unistd.h>
11978 #endif
11979 #ifdef I_STDLIB
11980 #  include <stdlib.h>
11981 #endif
11982 int main()
11983 {
11984         register int i;
11985         register unsigned long tmp;
11986         register unsigned long max = 0L;
11987
11988         for (i = 1000; i; i--) {
11989                 tmp = (unsigned long) $randfunc();
11990                 if (tmp > max) max = tmp;
11991         }
11992         for (i = 0; max; i++)
11993                 max /= 2;
11994         printf("%d\n",i);
11995 }
11996 EOCP
11997                                 set try
11998                                 if eval $compile_ok; then
11999                                         dflt=`try`
12000                                 else
12001                                         dflt='?'
12002                                         echo "(I can't seem to compile the test program...)"
12003                                 fi
12004                                 ;;
12005                         *)
12006                                 dflt="$randbits"
12007                                 ;;
12008                         esac
12009                         rp="How many bits does your $randfunc() function produce?"
12010                         . ./myread
12011                         randbits="$ans"
12012                         $rm -f try.c try
12013                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12014                         seedfunc="s$randfunc"
12015                         randseedtype=unsigned
12016                         ;;
12017                 *)
12018                         dflt="31"
12019                         rp="How many bits does your $randfunc() function produce?"
12020                         . ./myread
12021                         randbits="$ans"
12022                         seedfunc="s$randfunc"
12023                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12024                         if set $seedfunc val -f; eval $csym; $val; then
12025                                 echo "(Using $seedfunc() to seed random generator)"
12026                         else
12027                                 echo "(Warning: no $seedfunc() to seed random generator)"
12028                                 seedfunc=rand
12029                         fi
12030                         randseedtype=unsigned
12031                         ;;
12032                 esac
12033                 ;;
12034         esac
12035 done
12036
12037 echo " "
12038 echo "Determining whether or not we are on an EBCDIC system..." >&4
12039 $cat >tebcdic.c <<'EOM'
12040 int main()
12041 {
12042   if ('M'==0xd4) return 0;
12043   return 1;
12044 }
12045 EOM
12046
12047 val=$undef
12048 set tebcdic
12049 if eval $compile_ok; then
12050         if ./tebcdic; then
12051                 echo "You have EBCDIC." >&4
12052                 val="$define"
12053         else
12054                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12055         fi
12056 else
12057         echo "I'm unable to compile the test program." >&4
12058         echo "I'll assume ASCII or some ISO Latin." >&4
12059 fi
12060 $rm -f tebcdic.c tebcdic
12061 set ebcdic
12062 eval $setvar
12063
12064 echo " "
12065 $cat >&4 <<EOM
12066 Checking how to flush all pending stdio output...
12067 EOM
12068 # I only know how to find the first 32 possibly open files on SunOS.
12069 # See also hints/sunos_4_1.sh and util.c  --AD
12070 case "$osname" in
12071 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12072 esac
12073 $cat >>try.c <<EOCP
12074 #include <stdio.h>
12075 #$i_unistd I_UNISTD
12076 #ifdef I_UNISTD
12077 # include <unistd.h>
12078 #endif
12079 #$d_sysconf HAS_SYSCONF
12080 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12081 #ifdef HAS_STDIO_STREAM_ARRAY
12082 # define STDIO_STREAM_ARRAY $stdio_stream_array
12083 #endif
12084 int main() {
12085   FILE* p = fopen("try.out", "w");
12086 #ifdef TRY_FPUTC
12087   fputc('x', p);
12088 #else
12089 # ifdef TRY_FPRINTF
12090   fprintf(p, "x");
12091 # endif
12092 #endif
12093 #ifdef TRY_FFLUSH_NULL
12094   fflush(NULL);
12095 #endif
12096 #ifdef TRY_FFLUSH_ALL
12097   {
12098     long open_max = -1;
12099 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12100     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12101 # else
12102 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12103     open_max = sysconf(_SC_OPEN_MAX);
12104 #  else
12105 #   ifdef FOPEN_MAX
12106     open_max = FOPEN_MAX;
12107 #   else
12108 #    ifdef OPEN_MAX
12109     open_max = OPEN_MAX;
12110 #    else
12111 #     ifdef _NFILE
12112     open_max = _NFILE;
12113 #     endif
12114 #    endif
12115 #   endif
12116 #  endif
12117 # endif 
12118 # ifdef HAS_STDIO_STREAM_ARRAY
12119     if (open_max > 0) {
12120       long i;
12121       for (i = 0; i < open_max; i++)
12122             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12123                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12124                 STDIO_STREAM_ARRAY[i]._flag)
12125                 fflush(&STDIO_STREAM_ARRAY[i]);
12126     }   
12127   }
12128 # endif
12129 #endif
12130   _exit(42);
12131 }
12132 EOCP
12133 : first we have to find out how _not_ to flush
12134 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12135     output=''
12136     set try -DTRY_FPUTC
12137     if eval $compile; then
12138             $rm -f try.out
12139             ./try$exe_ext 2>/dev/null
12140             if $test ! -s try.out -a "X$?" = X42; then
12141                 output=-DTRY_FPUTC
12142             fi
12143     fi
12144     case "$output" in
12145     '')
12146             set try -DTRY_FPRINTF
12147             $rm -f try.out
12148             if eval $compile; then
12149                     $rm -f try.out
12150                     ./try$exe_ext 2>/dev/null
12151                     if $test ! -s try.out -a "X$?" = X42; then
12152                         output=-DTRY_FPRINTF
12153                     fi
12154             fi
12155         ;;
12156     esac
12157 fi
12158 : check for fflush NULL behaviour
12159 case "$fflushNULL" in
12160 '')     set try -DTRY_FFLUSH_NULL $output
12161         if eval $compile; then
12162                 $rm -f try.out
12163                 ./try$exe_ext 2>/dev/null
12164                 code="$?"
12165                 if $test -s try.out -a "X$code" = X42; then
12166                         fflushNULL="`$cat try.out`"
12167                 else
12168                         if $test "X$code" != X42; then
12169                                 $cat >&4 <<EOM
12170 (If this test failed, don't worry, we'll try another method shortly.)
12171 EOM
12172                         fi
12173                 fi
12174         fi
12175         $rm -f core try.core core.try.*
12176         case "$fflushNULL" in
12177         x)      $cat >&4 <<EOM
12178 Your fflush(NULL) works okay.
12179 EOM
12180                 fflushNULL="$define"
12181                 ;;
12182         '')     $cat >&4 <<EOM
12183 Your fflush(NULL) isn't working (contrary to ANSI C).
12184 EOM
12185                 fflushNULL="$undef"
12186                 ;;
12187         *)      $cat >&4 <<EOM
12188 Cannot figure out whether your fflush(NULL) works or not.
12189 I'm assuming it doesn't (contrary to ANSI C).
12190 EOM
12191                 fflushNULL="$undef"
12192                 ;;
12193         esac
12194         ;;
12195 $define|true|[yY]*)
12196         fflushNULL="$define"
12197         ;;
12198 *)
12199         fflushNULL="$undef"
12200         ;;
12201 esac
12202 : check explicit looping only if NULL did not work
12203 case "$fflushNULL" in
12204 "$undef")
12205         : check for fflush all behaviour
12206         case "$fflushall" in
12207         '')     set try -DTRY_FFLUSH_ALL $output
12208                 if eval $compile; then
12209                         $cat >&4 <<EOM
12210 (Now testing the other method--but note that also this may fail.)
12211 EOM
12212                         $rm -f try.out
12213                         ./try$exe_ext 2>/dev/null
12214                         if $test -s try.out -a "X$?" = X42; then
12215                                 fflushall="`$cat try.out`"
12216                         fi
12217                 fi
12218                 $rm -f core try.core core.try.*
12219                 case "$fflushall" in
12220                 x)      $cat >&4 <<EOM
12221 Whew. Flushing explicitly all the stdio streams works.
12222 EOM
12223                         fflushall="$define"
12224                         ;;
12225                 '')     $cat >&4 <<EOM
12226 Sigh. Flushing explicitly all the stdio streams doesn't work.
12227 EOM
12228                         fflushall="$undef"
12229                         ;;
12230                 *)      $cat >&4 <<EOM
12231 Cannot figure out whether flushing stdio streams explicitly works or not.
12232 I'm assuming it doesn't.
12233 EOM
12234                         fflushall="$undef"
12235                         ;;
12236                 esac
12237                 ;;
12238         "$define"|true|[yY]*)
12239                 fflushall="$define"
12240                 ;;
12241         *)
12242                 fflushall="$undef"
12243                 ;;
12244         esac
12245         ;;
12246 *)      fflushall="$undef"      
12247         ;;
12248 esac
12249 case "$fflushNULL$fflushall" in
12250 undefundef)
12251         $cat <<EOM
12252 I cannot figure out how to flush pending stdio output.
12253 EOM
12254         ;;
12255 esac
12256 $rm -f try.* try$exe_ext
12257
12258 : Store the full pathname to the ar program for use in the C program
12259 : Respect a hint or command line value for full_ar.
12260 case "$full_ar" in
12261 '') full_ar=$ar ;;
12262 esac
12263
12264 : Store the full pathname to the sed program for use in the C program
12265 full_sed=$sed
12266
12267 : see what type gids are declared as in the kernel
12268 echo " "
12269 echo "Looking for the type for group ids returned by getgid()."
12270 set gid_t gidtype xxx stdio.h sys/types.h
12271 eval $typedef
12272 case "$gidtype" in
12273 xxx)
12274         xxx=`./findhdr sys/user.h`
12275         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12276         case $1 in
12277         unsigned) dflt="$1 $2" ;;
12278         *) dflt="$1" ;;
12279         esac
12280         ;;
12281 *) dflt="$gidtype";;
12282 esac
12283 case "$gidtype" in
12284 gid_t) echo "gid_t found." ;;
12285 *)      rp="What is the type for group ids returned by getgid()?"
12286         . ./myread
12287         gidtype="$ans"
12288         ;;
12289 esac
12290
12291 echo " "
12292 case "$gidtype" in
12293 *_t) zzz="$gidtype"     ;;
12294 *)   zzz="gid"          ;;
12295 esac
12296 echo "Checking the size of $zzz..." >&4 
12297 cat > try.c <<EOCP
12298 #include <sys/types.h>
12299 #include <stdio.h>
12300 int main() {
12301     printf("%d\n", (int)sizeof($gidtype));
12302     exit(0);
12303 }
12304 EOCP
12305 set try
12306 if eval $compile_ok; then
12307         yyy=`./try`
12308         case "$yyy" in
12309         '')     gidsize=4
12310                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12311                 ;;
12312         *)      gidsize=$yyy
12313                 echo "Your $zzz size is $gidsize bytes."
12314                 ;;
12315         esac
12316 else
12317         gidsize=4
12318         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12319 fi
12320
12321
12322 echo " "
12323 case "$gidtype" in
12324 *_t) zzz="$gidtype"     ;;
12325 *)   zzz="gid"          ;;
12326 esac
12327 echo "Checking the sign of $zzz..." >&4 
12328 cat > try.c <<EOCP
12329 #include <sys/types.h>
12330 #include <stdio.h>
12331 int main() {
12332         $gidtype foo = -1;
12333         if (foo < 0)
12334                 printf("-1\n");
12335         else
12336                 printf("1\n");
12337 }
12338 EOCP
12339 set try
12340 if eval $compile; then
12341         yyy=`./try`
12342         case "$yyy" in
12343         '')     gidsign=1
12344                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12345                 ;;
12346         *)      gidsign=$yyy
12347                 case "$gidsign" in
12348                  1) echo "Your $zzz is unsigned." ;;
12349                 -1) echo "Your $zzz is signed."   ;;
12350                 esac
12351                 ;;
12352         esac
12353 else
12354         gidsign=1
12355         echo "(I can't compile the test program--guessing unsigned.)" >&4
12356 fi
12357
12358
12359 echo " "
12360
12361 if $test X"$quadtype" != X; then
12362
12363 echo "Checking how to print 64-bit integers..." >&4
12364
12365 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12366         $cat >try.c <<'EOCP'
12367 #include <sys/types.h>
12368 #include <stdio.h>
12369 int main() {
12370   int q = 12345678901;
12371   printf("%ld\n", q);
12372 }
12373 EOCP
12374         set try
12375         if eval $compile; then
12376                 yyy=`./try$exe_ext`
12377                 case "$yyy" in
12378                 12345678901)
12379                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12380                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12381                         echo "We will use %d."
12382                         ;;
12383                 esac
12384         fi
12385 fi
12386
12387 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12388         $cat >try.c <<'EOCP'
12389 #include <sys/types.h>
12390 #include <stdio.h>
12391 int main() {
12392   long q = 12345678901;
12393   printf("%ld\n", q);
12394 }
12395 EOCP
12396         set try
12397         if eval $compile; then
12398                 yyy=`./try$exe_ext`
12399                 case "$yyy" in
12400                 12345678901)
12401                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12402                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12403                         echo "We will use %ld."
12404                         ;;
12405                 esac
12406         fi
12407 fi
12408
12409 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12410         $cat >try.c <<'EOCP'
12411 #include <sys/types.h>
12412 #include <inttypes.h>
12413 #include <stdio.h>
12414 int main() {
12415   int64_t q = 12345678901;
12416   printf("%" PRId64 "\n", q);
12417 }
12418 EOCP
12419         set try
12420         if eval $compile; then
12421                 yyy=`./try$exe_ext`
12422                 case "$yyy" in
12423                 12345678901)
12424                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12425                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12426                         echo "We will use the C9X style."
12427                         ;;
12428                 esac
12429         fi
12430 fi
12431
12432 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12433         $cat >try.c <<'EOCP'
12434 #include <sys/types.h>
12435 #include <stdio.h>
12436 int main() {
12437   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12438   printf("%lld\n", q);
12439 }
12440 EOCP
12441         set try
12442         if eval $compile; then
12443                 yyy=`./try$exe_ext`
12444                 case "$yyy" in
12445                 12345678901)
12446                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12447                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12448                         echo "We will use the %lld style."
12449                         ;;
12450                 esac
12451         fi
12452 fi
12453
12454 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12455         $cat >try.c <<EOCP
12456 #include <sys/types.h>
12457 #include <stdio.h>
12458 int main() {
12459   $quadtype q = 12345678901;
12460   printf("%Ld\n", q);
12461 }
12462 EOCP
12463         set try
12464         if eval $compile; then
12465                 yyy=`./try$exe_ext`
12466                 case "$yyy" in
12467                 12345678901)
12468                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12469                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12470                         echo "We will use %Ld."
12471                         ;;
12472                 esac
12473         fi
12474 fi
12475
12476 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12477         $cat >try.c <<EOCP
12478 #include <sys/types.h>
12479 #include <stdio.h>
12480 int main() {
12481   $quadtype q = 12345678901;
12482   printf("%qd\n", q);
12483 }
12484 EOCP
12485         set try
12486         if eval $compile; then
12487                 yyy=`./try$exe_ext`
12488                 case "$yyy" in
12489                 12345678901)
12490                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12491                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12492                         echo "We will use %qd."
12493                         ;;
12494                 esac
12495         fi
12496 fi
12497
12498 if $test X"$sPRId64" = X; then
12499         echo "Cannot figure out how to print 64-bit integers." >&4
12500 fi
12501
12502 $rm -f try try.*
12503
12504 fi
12505
12506 case "$sPRId64" in
12507 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12508         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12509         ;;
12510 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12511         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12512         ;;
12513 esac
12514
12515
12516 echo " "
12517 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12518
12519 if $test X"$ivsize" = X8; then
12520         ivdformat="$sPRId64"
12521         uvuformat="$sPRIu64"
12522         uvoformat="$sPRIo64"
12523         uvxformat="$sPRIx64"
12524 else
12525         if $test X"$ivsize" = X"$longsize"; then
12526                 ivdformat='"ld"'
12527                 uvuformat='"lu"'
12528                 uvoformat='"lo"'
12529                 uvxformat='"lx"'
12530         else
12531                 if $test X"$ivsize" = X"$intsize"; then
12532                         ivdformat='"d"'
12533                         uvuformat='"u"'
12534                         uvoformat='"o"'
12535                         uvxformat='"x"'
12536                 else
12537                         : far out
12538                         if $test X"$ivsize" = X"$shortsize"; then
12539                                 ivdformat='"hd"'
12540                                 uvuformat='"hu"'
12541                                 uvoformat='"ho"'
12542                                 uvxformat='"hx"'
12543                         fi
12544                 fi
12545         fi
12546 fi
12547
12548 case "$ivdformat" in
12549 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12550     exit 1
12551     ;;
12552 esac
12553
12554
12555 echo " "
12556 $echo "Checking the format string to be used for gids..." >&4
12557
12558 case "$gidsign" in
12559 -1)     if $test X"$gidsize" = X"$ivsize"; then
12560                 gidformat="$ivdformat"
12561         else
12562                 if $test X"$gidsize" = X"$longsize"; then
12563                         gidformat='"ld"'
12564                 else
12565                         if $test X"$gidsize" = X"$intsize"; then
12566                                 gidformat='"d"'
12567                         else
12568                                 if $test X"$gidsize" = X"$shortsize"; then
12569                                         gidformat='"hd"'
12570                                 fi
12571                         fi
12572                 fi
12573         fi
12574         ;;
12575 *)      if $test X"$gidsize" = X"$uvsize"; then
12576                 gidformat="$uvuformat"
12577         else
12578                 if $test X"$gidsize" = X"$longsize"; then
12579                         gidformat='"lu"'
12580                 else
12581                         if $test X"$gidsize" = X"$intsize"; then
12582                                 gidformat='"u"'
12583                         else
12584                                 if $test X"$gidsize" = X"$shortsize"; then
12585                                         gidformat='"hu"'
12586                                 fi
12587                         fi
12588                 fi
12589         fi
12590         ;;
12591 esac
12592
12593 : see if getgroups exists
12594 set getgroups d_getgrps
12595 eval $inlibc
12596
12597 : see if setgroups exists
12598 set setgroups d_setgrps
12599 eval $inlibc
12600
12601
12602 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12603 echo " "
12604 case "$d_getgrps$d_setgrps" in
12605 *define*)
12606         case "$groupstype" in
12607         '') dflt="$gidtype" ;;
12608         *)  dflt="$groupstype" ;;
12609         esac
12610         $cat <<EOM
12611 What type of pointer is the second argument to getgroups() and setgroups()?
12612 Usually this is the same as group ids, $gidtype, but not always.
12613
12614 EOM
12615         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12616         . ./myread
12617         groupstype="$ans"
12618         ;;
12619 *)  groupstype="$gidtype";;
12620 esac
12621
12622 echo " "
12623 echo "Checking if your $make program sets \$(MAKE)..." >&4
12624 case "$make_set_make" in
12625 '')
12626         $sed 's/^X //' > testmake.mak << 'EOF'
12627 Xall:
12628 X       @echo 'maketemp="$(MAKE)"'
12629 EOF
12630         case "`$make -f testmake.mak 2>/dev/null`" in
12631         *maketemp=*) make_set_make='#' ;;
12632         *)      make_set_make="MAKE=$make" ;;
12633         esac
12634         $rm -f testmake.mak
12635         ;;
12636 esac
12637 case "$make_set_make" in
12638 '#') echo "Yup, it does.";;
12639 *) echo "Nope, it doesn't.";;
12640 esac
12641
12642 : see what type is used for mode_t
12643 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12644 set mode_t modetype int stdio.h sys/types.h
12645 eval $typedef_ask
12646
12647 : define a fucntion to check prototypes
12648 $cat > protochk <<EOSH
12649 $startsh
12650 cc="$cc"
12651 optimize="$optimize"
12652 ccflags="$ccflags"
12653 prototype="$prototype"
12654 define="$define"
12655 rm=$rm
12656 EOSH
12657
12658 $cat >> protochk <<'EOSH'
12659
12660 $rm -f try.c
12661 foo="$1"
12662 shift
12663 while test $# -ge 2; do
12664         case "$1" in
12665                 $define) echo "#include <$2>" >> try.c ;;
12666                 literal) echo "$2" >> try.c ;;
12667         esac
12668     shift 2
12669 done
12670 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12671 cat >> try.c <<'EOCP'
12672 #ifdef CAN_PROTOTYPE
12673 #define _(args) args
12674 #else
12675 #define _(args) ()
12676 #endif
12677 EOCP
12678 echo "$foo" >> try.c
12679 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12680 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12681 status=$?
12682 $rm -f try.[co]
12683 exit $status
12684 EOSH
12685 chmod +x protochk
12686 $eunicefix protochk
12687
12688 : see what type is used for size_t
12689 rp="What is the type used for the length parameter for string functions?"
12690 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12691 eval $typedef_ask
12692
12693 : check for type of arguments to gethostbyaddr. 
12694 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12695         case "$d_gethbyaddr" in
12696         $define)
12697                 $cat <<EOM
12698
12699 Checking to see what type of arguments are accepted by gethostbyaddr().
12700 EOM
12701                 hdrs="$define sys/types.h
12702                         $d_socket sys/socket.h 
12703                         $i_niin netinet/in.h 
12704                         $i_netdb netdb.h
12705                         $i_unistd unistd.h"
12706                 : The first arg can 'char *' or 'void *'
12707                 : The second arg is some of integral type
12708                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12709                         for yyy in size_t long int; do
12710                                 case "$netdb_host_type" in
12711                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12712                                         if ./protochk "$try" $hdrs; then
12713                                                 echo "Your system accepts $xxx for the first arg."
12714                                                 echo "...and $yyy for the second arg."
12715                                                 netdb_host_type="$xxx"
12716                                                 netdb_hlen_type="$yyy"
12717                                         fi
12718                                         ;;
12719                                 esac
12720                         done
12721                 done
12722                 : In case none of those worked, prompt the user.
12723                 case "$netdb_host_type" in
12724                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12725                         dflt='char *'
12726                         . ./myread
12727                         netdb_host_type=$ans
12728                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12729                         dflt="$sizetype"
12730                         . ./myread
12731                         netdb_hlen_type=$ans
12732                         ;;
12733                 esac
12734                 ;;
12735         *)      : no gethostbyaddr, so pick harmless defaults
12736                 netdb_host_type='char *'
12737                 netdb_hlen_type="$sizetype"
12738                 ;;
12739         esac
12740         # Remove the "const" if needed. -- but then we'll have a 
12741         # prototype clash!
12742         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12743 fi
12744
12745 : check for type of argument to gethostbyname. 
12746 if test "X$netdb_name_type" = X ; then
12747         case "$d_gethbyname" in
12748         $define)
12749                 $cat <<EOM
12750
12751 Checking to see what type of argument is accepted by gethostbyname().
12752 EOM
12753                 hdrs="$define sys/types.h
12754                         $d_socket sys/socket.h 
12755                         $i_niin netinet/in.h 
12756                         $i_netdb netdb.h
12757                         $i_unistd unistd.h"
12758                 for xxx in "const char *" "char *"; do
12759                         case "$netdb_name_type" in
12760                         '')     try="extern struct hostent *gethostbyname($xxx);"
12761                                 if ./protochk "$try" $hdrs; then
12762                                         echo "Your system accepts $xxx."
12763                                         netdb_name_type="$xxx"
12764                                 fi
12765                                 ;;
12766                         esac
12767                 done
12768                 : In case none of those worked, prompt the user.
12769                 case "$netdb_name_type" in
12770                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12771                         dflt='char *'
12772                         . ./myread
12773                         netdb_name_type=$ans
12774                         ;;
12775                 esac
12776                 ;;
12777         *)      : no gethostbyname, so pick harmless default
12778                 netdb_name_type='char *'
12779                 ;;
12780         esac
12781 fi
12782
12783 : check for type of 1st argument to getnetbyaddr. 
12784 if test "X$netdb_net_type" = X ; then
12785         case "$d_getnbyaddr" in
12786         $define)
12787                 $cat <<EOM
12788
12789 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12790 EOM
12791                 hdrs="$define sys/types.h
12792                         $d_socket sys/socket.h 
12793                         $i_niin netinet/in.h 
12794                         $i_netdb netdb.h
12795                         $i_unistd unistd.h"
12796                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12797                         case "$netdb_net_type" in
12798                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12799                                 if ./protochk "$try" $hdrs; then
12800                                         echo "Your system accepts $xxx."
12801                                         netdb_net_type="$xxx"
12802                                 fi
12803                                 ;;
12804                         esac
12805                 done
12806                 : In case none of those worked, prompt the user.
12807                 case "$netdb_net_type" in
12808                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12809                         dflt='long'
12810                         . ./myread
12811                         netdb_net_type=$ans
12812                         ;;
12813                 esac
12814                 ;;
12815         *)      : no getnetbyaddr, so pick harmless default
12816                 netdb_net_type='long'
12817                 ;;
12818         esac
12819 fi
12820 : locate the preferred pager for this system
12821 case "$pager" in
12822 '')
12823         dflt=''
12824         case "$pg" in
12825         /*) dflt=$pg;;
12826         esac
12827         case "$more" in
12828         /*) dflt=$more;;
12829         esac
12830         case "$less" in
12831         /*) dflt=$less;;
12832         esac
12833         case "$dflt" in
12834         '') dflt=/usr/ucb/more;;
12835         esac
12836         ;;
12837 *) dflt="$pager";;
12838 esac
12839 echo " "
12840 fn=f/
12841 rp='What pager is used on your system?'
12842 . ./getfile
12843 pager="$ans"
12844
12845 : see what type pids are declared as in the kernel
12846 rp="What is the type of process ids on this system?"
12847 set pid_t pidtype int stdio.h sys/types.h
12848 eval $typedef_ask
12849
12850 : check for length of pointer
12851 echo " "
12852 case "$ptrsize" in
12853 '')
12854         $echo $n "Checking to see how big your pointers are...$c" >&4
12855         if test "$voidflags" -gt 7; then
12856                 echo '#define VOID_PTR char *' > try.c
12857         else
12858                 echo '#define VOID_PTR void *' > try.c
12859         fi
12860         $cat >>try.c <<'EOCP'
12861 #include <stdio.h>
12862 int main()
12863 {
12864     printf("%d\n", (int)sizeof(VOID_PTR));
12865     exit(0);
12866 }
12867 EOCP
12868         set try
12869         if eval $compile_ok; then
12870                 ptrsize=`./try`
12871                 $echo " $ptrsize bytes." >&4
12872         else
12873                 dflt='4'
12874                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12875                 rp="What is the size of a pointer (in bytes)?"
12876                 . ./myread
12877                 ptrsize="$ans"
12878         fi
12879         ;;
12880 esac
12881 $rm -f try.c try
12882
12883 : see if ar generates random libraries by itself
12884 echo " "
12885 echo "Checking how to generate random libraries on your machine..." >&4
12886 echo 'int bar1() { return bar2(); }' > bar1.c
12887 echo 'int bar2() { return 2; }' > bar2.c
12888 $cat > foo.c <<'EOP'
12889 int main() { printf("%d\n", bar1()); exit(0); }
12890 EOP
12891 $cc $ccflags -c bar1.c >/dev/null 2>&1
12892 $cc $ccflags -c bar2.c >/dev/null 2>&1
12893 $cc $ccflags -c foo.c >/dev/null 2>&1
12894 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12895 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12896         ./foobar >/dev/null 2>&1; then
12897         echo "$ar appears to generate random libraries itself."
12898         orderlib=false
12899         ranlib=":"
12900 elif $ar ts bar$_a >/dev/null 2>&1 &&
12901         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12902         ./foobar >/dev/null 2>&1; then
12903                 echo "a table of contents needs to be added with '$ar ts'."
12904                 orderlib=false
12905                 ranlib="$ar ts"
12906 else
12907         case "$ranlib" in
12908         :) ranlib='';;
12909         '')
12910                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12911                 $test -f $ranlib || ranlib=''
12912                 ;;
12913         esac
12914         if $test -n "$ranlib"; then
12915                 echo "your system has '$ranlib'; we'll use that."
12916                 orderlib=false
12917         else
12918                 echo "your system doesn't seem to support random libraries"
12919                 echo "so we'll use lorder and tsort to order the libraries."
12920                 orderlib=true
12921                 ranlib=":"
12922         fi
12923 fi
12924 $rm -f foo* bar* 
12925
12926 : check for type of arguments to select. 
12927 case "$selecttype" in
12928 '') case "$d_select" in
12929         $define)
12930                 echo " "
12931                 $cat <<EOM
12932 Checking to see what type of arguments are accepted by select().
12933 EOM
12934                 hdrs="$define sys/types.h
12935                         $i_systime sys/time.h 
12936                         $i_sysselct sys/select.h
12937                         $d_socket sys/socket.h"
12938                 : The first arg can be int, unsigned, or size_t
12939                 : The last arg may or may not be 'const'
12940                 val=''
12941                 : void pointer has been seen but using that
12942                 : breaks the selectminbits test
12943                 for xxx in 'fd_set *' 'int *'; do
12944                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12945                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12946                                         case "$val" in
12947                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12948                                                 if ./protochk "$try" $hdrs; then
12949                                                         echo "Your system accepts $xxx."
12950                                                         val="$xxx"
12951                                                 fi
12952                                                 ;;
12953                                         esac
12954                                 done
12955                         done
12956                 done
12957                 case "$val" in
12958                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12959                         case "$d_fd_set" in
12960                                 $define) dflt="fd_set *" ;;
12961                                 *)              dflt="int *" ;;
12962                         esac
12963                         . ./myread
12964                         val=$ans
12965                         ;;
12966                 esac
12967                 selecttype="$val"
12968                 ;;
12969         *)      : no select, so pick a harmless default
12970                 selecttype='int *'
12971                 ;;
12972         esac
12973         ;;
12974 esac
12975
12976 : check for the select 'width'
12977 case "$selectminbits" in
12978 '') case "$d_select" in
12979         $define)
12980                 $cat <<EOM
12981
12982 Checking to see on how many bits at a time your select() operates...
12983 EOM
12984                 $cat >try.c <<EOCP
12985 #include <sys/types.h>
12986 #$i_time I_TIME
12987 #$i_systime I_SYS_TIME
12988 #$i_systimek I_SYS_TIME_KERNEL
12989 #ifdef I_TIME
12990 #   include <time.h>
12991 #endif
12992 #ifdef I_SYS_TIME
12993 #   ifdef I_SYS_TIME_KERNEL
12994 #       define KERNEL
12995 #   endif
12996 #   include <sys/time.h>
12997 #   ifdef I_SYS_TIME_KERNEL
12998 #       undef KERNEL
12999 #   endif
13000 #endif
13001 #$i_sysselct I_SYS_SELECT
13002 #ifdef I_SYS_SELECT
13003 #include <sys/select.h>
13004 #endif
13005 #$d_socket HAS_SOCKET
13006 #ifdef HAS_SOCKET
13007 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13008 #endif
13009 #include <stdio.h>
13010 $selecttype b;
13011 #define S sizeof(*(b))
13012 #define MINBITS 64
13013 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13014 #define NBITS  (NBYTES * 8)
13015 int main() {
13016     char s[NBYTES];
13017     struct timeval t;
13018     int i;
13019     FILE* fp;
13020     int fd;
13021
13022     fclose(stdin);
13023     fp = fopen("try.c", "r");
13024     if (fp == 0)
13025       exit(1);
13026     fd = fileno(fp);
13027     if (fd < 0)
13028       exit(2);
13029     b = ($selecttype)s;
13030     for (i = 0; i < NBITS; i++)
13031         FD_SET(i, b);
13032     t.tv_sec  = 0;
13033     t.tv_usec = 0;
13034     select(fd + 1, b, 0, 0, &t);
13035     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13036     printf("%d\n", i + 1);
13037     return 0;
13038 }
13039 EOCP
13040                 set try
13041                 if eval $compile_ok; then
13042                         selectminbits=`./try`
13043                         case "$selectminbits" in
13044                         '')     cat >&4 <<EOM
13045 Cannot figure out on how many bits at a time your select() operates.
13046 I'll play safe and guess it is 32 bits.
13047 EOM
13048                                 selectminbits=32
13049                                 bits="32 bits"
13050                                 ;;
13051                         1)      bits="1 bit" ;;
13052                         *)      bits="$selectminbits bits" ;;
13053                         esac
13054                         echo "Your select() operates on $bits at a time." >&4
13055                 else
13056                         rp='What is the minimum number of bits your select() operates on?'
13057                         case "$byteorder" in
13058                         1234|12345678)  dflt=32 ;;
13059                         *)              dflt=1  ;;
13060                         esac
13061                         . ./myread
13062                         val=$ans
13063                         selectminbits="$val"
13064                 fi
13065                 $rm -f try.* try
13066                 ;;
13067         *)      : no select, so pick a harmless default
13068                 selectminbits='32'
13069                 ;;
13070         esac
13071         ;;
13072 esac
13073
13074 : Trace out the files included by signal.h, then look for SIGxxx names.
13075 : Remove SIGARRAYSIZE used by HPUX.
13076 : Remove SIGSTKSIZE used by Linux.
13077 : Remove SIGSTKSZ used by Posix.
13078 : Remove SIGTYP void lines used by OS2.
13079 : Some cpps, like os390, dont give the file name anywhere
13080 if [ "X$fieldn" = X ]; then
13081         : Just make some guesses.  We check them later.
13082         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13083 else
13084         xxx=`echo '#include <signal.h>' |
13085         $cppstdin $cppminus $cppflags 2>/dev/null |
13086         $grep '^[       ]*#.*include' | 
13087         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13088 fi
13089 : Check this list of files to be sure we have parsed the cpp output ok.
13090 : This will also avoid potentially non-existent files, such 
13091 : as ../foo/bar.h
13092 xxxfiles=''
13093 for xx in $xxx /dev/null ; do
13094         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13095 done
13096 : If we have found no files, at least try signal.h
13097 case "$xxxfiles" in
13098 '')     xxxfiles=`./findhdr signal.h` ;;
13099 esac
13100 xxx=`awk '
13101 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13102         print substr($2, 4, 20)
13103 }
13104 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13105         print substr($3, 4, 20)
13106 }' $xxxfiles`
13107 : Append some common names just in case the awk scan failed.
13108 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13109 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13110 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13111 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13112 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13113
13114 : generate a few handy files for later
13115 $cat > signal.c <<'EOCP'
13116 #include <sys/types.h>
13117 #include <signal.h>
13118 #include <stdio.h>
13119 int main() {
13120
13121 /* Strange style to avoid deeply-nested #if/#else/#endif */
13122 #ifndef NSIG
13123 #  ifdef _NSIG
13124 #    define NSIG (_NSIG)
13125 #  endif
13126 #endif
13127
13128 #ifndef NSIG
13129 #  ifdef SIGMAX
13130 #    define NSIG (SIGMAX+1)
13131 #  endif
13132 #endif
13133
13134 #ifndef NSIG
13135 #  ifdef SIG_MAX
13136 #    define NSIG (SIG_MAX+1)
13137 #  endif
13138 #endif
13139
13140 #ifndef NSIG
13141 #  ifdef MAXSIG
13142 #    define NSIG (MAXSIG+1)
13143 #  endif
13144 #endif
13145
13146 #ifndef NSIG
13147 #  ifdef MAX_SIG
13148 #    define NSIG (MAX_SIG+1)
13149 #  endif
13150 #endif
13151
13152 #ifndef NSIG
13153 #  ifdef SIGARRAYSIZE
13154 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13155 #  endif
13156 #endif
13157
13158 #ifndef NSIG
13159 #  ifdef _sys_nsig
13160 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13161 #  endif
13162 #endif
13163
13164 /* Default to some arbitrary number that's big enough to get most
13165    of the common signals.
13166 */
13167 #ifndef NSIG
13168 #    define NSIG 50
13169 #endif
13170
13171 printf("NSIG %d\n", NSIG);
13172
13173 #ifndef JUST_NSIG
13174
13175 EOCP
13176
13177 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13178 {
13179         printf "#ifdef SIG"; printf $1; printf "\n"
13180         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13181         printf $1; printf ");\n"
13182         printf "#endif\n"
13183 }
13184 END {
13185         printf "#endif /* JUST_NSIG */\n";
13186         printf "exit(0);\n}\n";
13187 }
13188 ' >>signal.c
13189 $cat >signal.awk <<'EOP'
13190 BEGIN { ndups = 0 }
13191 $1 ~ /^NSIG$/ { nsig = $2 }
13192 ($1 !~ /^NSIG$/) && (NF == 2) {
13193     if ($2 > maxsig) { maxsig = $2 }
13194     if (sig_name[$2]) {
13195         dup_name[ndups] = $1
13196         dup_num[ndups] = $2
13197         ndups++ 
13198     }
13199     else {
13200         sig_name[$2] = $1
13201         sig_num[$2] = $2
13202     }
13203 }
13204 END { 
13205     if (nsig == 0) {
13206         nsig = maxsig + 1
13207     }
13208     printf("NSIG %d\n", nsig);
13209     for (n = 1; n < nsig; n++) {
13210         if (sig_name[n]) {
13211             printf("%s %d\n", sig_name[n], sig_num[n])
13212         }
13213         else {
13214             printf("NUM%d %d\n", n, n) 
13215         }
13216     }
13217     for (n = 0; n < ndups; n++) {
13218         printf("%s %d\n", dup_name[n], dup_num[n])
13219     }
13220 }
13221 EOP
13222 $cat >signal_cmd <<EOS
13223 $startsh
13224 if $test -s signal.lst; then
13225     echo "Using your existing signal.lst file"
13226         exit 0
13227 fi
13228 xxx="$xxx"
13229 EOS
13230 $cat >>signal_cmd <<'EOS'
13231
13232 set signal
13233 if eval $compile_ok; then
13234         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13235 else
13236         echo "(I can't seem be able to compile the whole test program)" >&4
13237         echo "(I'll try it in little pieces.)" >&4
13238         set signal -DJUST_NSIG
13239         if eval $compile_ok; then
13240                 ./signal$_exe > signal.nsg
13241                 $cat signal.nsg
13242         else
13243                 echo "I can't seem to figure out how many signals you have." >&4
13244                 echo "Guessing 50." >&4
13245                 echo 'NSIG 50' > signal.nsg
13246         fi
13247         : Now look at all the signal names, one at a time.
13248         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13249                 $cat > signal.c <<EOCP
13250 #include <sys/types.h>
13251 #include <signal.h>
13252 #include <stdio.h>
13253 int main() {
13254 printf("$xx %d\n", SIG${xx});
13255 return 0;
13256 }
13257 EOCP
13258                 set signal
13259                 if eval $compile; then
13260                         echo "SIG${xx} found."
13261                         ./signal$_exe  >> signal.ls1
13262                 else
13263                         echo "SIG${xx} NOT found."
13264                 fi
13265         done
13266         if $test -s signal.ls1; then
13267                 $cat signal.nsg signal.ls1 |
13268                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13269         fi
13270
13271 fi
13272 if $test -s signal.lst; then
13273         :
13274 else
13275         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13276         echo 'kill -l' >signal
13277         set X `csh -f <signal`
13278         $rm -f signal
13279         shift
13280         case $# in
13281         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13282         esac
13283         echo $@ | $tr ' ' $trnl | \
13284             $awk '{ printf "%s %d\n", $1, ++s; }
13285                   END { printf "NSIG %d\n", ++s }' >signal.lst
13286 fi
13287 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13288 EOS
13289 chmod a+x signal_cmd
13290 $eunicefix signal_cmd
13291
13292 : generate list of signal names
13293 echo " "
13294 case "$sig_name_init" in
13295 '') doinit=yes ;;
13296 *)  case "$sig_num_init" in
13297     ''|*,*) doinit=yes ;;
13298     esac ;;
13299 esac
13300 case "$doinit" in
13301 yes)
13302         echo "Generating a list of signal names and numbers..." >&4
13303         . ./signal_cmd
13304         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13305         sig_name=`$awk 'BEGIN { printf "ZERO " }
13306                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13307         sig_num=`$awk  'BEGIN { printf "0 " }
13308                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13309         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13310                              !/^NSIG/   { printf "\"%s\", ", $1 }
13311                              END        { printf "0\n" }' signal.lst`
13312         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13313                              !/^NSIG/   { printf "%d, ", $2}
13314                              END        { printf "0\n"}' signal.lst`
13315         ;;
13316 esac
13317 echo "The following $sig_count signals are available:"
13318 echo " "
13319 echo $sig_name | $awk \
13320 'BEGIN { linelen = 0 }
13321 {
13322         for (i = 1; i <= NF; i++) {
13323                 name = "SIG" $i " "
13324                 linelen = linelen + length(name)
13325                 if (linelen > 70) {
13326                         printf "\n"
13327                         linelen = length(name)
13328                 }
13329                 printf "%s", name
13330         }
13331         printf "\n"
13332 }'
13333 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13334
13335 : see what type is used for signed size_t
13336 set ssize_t ssizetype int stdio.h sys/types.h
13337 eval $typedef
13338 dflt="$ssizetype"
13339 $cat > ssize.c <<EOM
13340 #include <stdio.h>
13341 #include <sys/types.h>
13342 #define Size_t $sizetype
13343 #define SSize_t $dflt
13344 int main()
13345 {
13346         if (sizeof(Size_t) == sizeof(SSize_t))
13347                 printf("$dflt\n");
13348         else if (sizeof(Size_t) == sizeof(int))
13349                 printf("int\n");
13350         else 
13351                 printf("long\n");
13352         exit(0);
13353 }
13354 EOM
13355 echo " "
13356 set ssize
13357 if eval $compile_ok && ./ssize > /dev/null; then
13358         ssizetype=`./ssize`
13359         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13360 else
13361         $cat >&4 <<EOM
13362 Help! I can't compile and run the ssize_t test program: please enlighten me!
13363 (This is probably a misconfiguration in your system or libraries, and
13364 you really ought to fix it.  Still, I'll try anyway.)
13365
13366 I need a type that is the same size as $sizetype, but is guaranteed to
13367 be signed.  Common values are ssize_t, int and long.
13368
13369 EOM
13370         rp="What signed type is the same size as $sizetype?"
13371         . ./myread
13372         ssizetype="$ans"
13373 fi
13374 $rm -f ssize ssize.*
13375
13376 : see what type of char stdio uses.
13377 echo " "
13378 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13379         echo "Your stdio uses unsigned chars." >&4
13380         stdchar="unsigned char"
13381 else
13382         echo "Your stdio uses signed chars." >&4
13383         stdchar="char"
13384 fi
13385
13386 : see if time exists
13387 echo " "
13388 if test "X$d_time" = X -o X"$timetype" = X; then
13389     if set time val -f d_time; eval $csym; $val; then
13390                 echo 'time() found.' >&4
13391                 val="$define"
13392                 rp="What is the type returned by time() on this system?"
13393                 set time_t timetype long stdio.h sys/types.h
13394                 eval $typedef_ask
13395     else
13396                 echo 'time() not found, hope that will do.' >&4
13397                 val="$undef"
13398                 timetype='int';
13399     fi
13400     set d_time
13401     eval $setvar
13402 fi
13403
13404 : see what type uids are declared as in the kernel
13405 echo " "
13406 echo "Looking for the type for user ids returned by getuid()."
13407 set uid_t uidtype xxx stdio.h sys/types.h
13408 eval $typedef
13409 case "$uidtype" in
13410 xxx)
13411         xxx=`./findhdr sys/user.h`
13412         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13413         case $1 in
13414         unsigned) dflt="$1 $2" ;;
13415         *) dflt="$1" ;;
13416         esac
13417         ;;
13418 *) dflt="$uidtype";;
13419 esac
13420 case "$uidtype" in
13421 uid_t)  echo "uid_t found." ;;
13422 *)      rp="What is the type for user ids returned by getuid()?"
13423         . ./myread
13424         uidtype="$ans"
13425         ;;
13426 esac
13427
13428 echo " "
13429 case "$uidtype" in
13430 *_t) zzz="$uidtype"     ;;
13431 *)   zzz="uid"          ;;
13432 esac
13433 echo "Checking the size of $zzz..." >&4 
13434 cat > try.c <<EOCP
13435 #include <sys/types.h>
13436 #include <stdio.h>
13437 int main() {
13438     printf("%d\n", (int)sizeof($uidtype));
13439     exit(0);
13440 }
13441 EOCP
13442 set try
13443 if eval $compile_ok; then
13444         yyy=`./try`
13445         case "$yyy" in
13446         '')     uidsize=4
13447                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13448                 ;;
13449         *)      uidsize=$yyy
13450                 echo "Your $zzz size is $uidsize bytes."
13451                 ;;
13452         esac
13453 else
13454         uidsize=4
13455         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13456 fi
13457
13458 echo " "
13459 case "$uidtype" in
13460 *_t) zzz="$uidtype"     ;;
13461 *)   zzz="uid"          ;;
13462 esac
13463 echo "Checking the sign of $zzz..." >&4
13464 cat > try.c <<EOCP
13465 #include <sys/types.h>
13466 #include <stdio.h>
13467 int main() {
13468         $uidtype foo = -1;
13469         if (foo < 0)
13470                 printf("-1\n");
13471         else
13472                 printf("1\n");
13473 }
13474 EOCP
13475 set try
13476 if eval $compile; then
13477         yyy=`./try`
13478         case "$yyy" in
13479         '')     uidsign=1
13480                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13481                 ;;
13482         *)      uidsign=$yyy
13483                 case "$uidsign" in
13484                  1) echo "Your $zzz is unsigned." ;;
13485                 -1) echo "Your $zzz is signed."   ;;
13486                 esac
13487                 ;;
13488         esac
13489 else
13490         uidsign=1
13491         echo "(I can't compile the test program--guessing unsigned.)" >&4
13492 fi
13493
13494
13495
13496 echo " "
13497 $echo "Checking the format string to be used for uids..." >&4
13498
13499 case "$uidsign" in
13500 -1)     if $test X"$uidsize" = X"$ivsize"; then
13501                 uidformat="$ivdformat"
13502         else
13503                 if $test X"$uidsize" = X"$longsize"; then
13504                         uidformat='"ld"'
13505                 else
13506                         if $test X"$uidsize" = X"$intsize"; then
13507                                 uidformat='"d"'
13508                         else
13509                                 if $test X"$uidsize" = X"$shortsize"; then
13510                                         uidformat='"hd"'
13511                                 fi
13512                         fi
13513                 fi
13514         fi
13515         ;;
13516 *)      if $test X"$uidsize" = X"$uvsize"; then
13517                 uidformat="$uvuformat"
13518         else
13519                 if $test X"$uidsize" = X"$longsize"; then
13520                         uidformat='"lu"'
13521                 else
13522                         if $test X"$uidsize" = X"$intsize"; then
13523                                 uidformat='"u"'
13524                         else
13525                                 if $test X"$uidsize" = X"$shortsize"; then
13526                                         uidformat='"hu"'
13527                                 fi
13528                         fi
13529                 fi
13530         fi
13531         ;;
13532 esac
13533
13534 : see if dbm.h is available
13535 : see if dbmclose exists
13536 set dbmclose d_dbmclose
13537 eval $inlibc
13538
13539 case "$d_dbmclose" in
13540 $define)
13541         set dbm.h i_dbm
13542         eval $inhdr
13543         case "$i_dbm" in
13544         $define)
13545                 val="$undef"
13546                 set i_rpcsvcdbm
13547                 eval $setvar
13548                 ;;
13549         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13550                 eval $inhdr
13551                 ;;
13552         esac
13553         ;;
13554 *)      echo "We won't be including <dbm.h>"
13555         val="$undef"
13556         set i_dbm
13557         eval $setvar
13558         val="$undef"
13559         set i_rpcsvcdbm
13560         eval $setvar
13561         ;;
13562 esac
13563
13564 : see if this is a sys/file.h system
13565 val=''
13566 set sys/file.h val
13567 eval $inhdr
13568
13569 : do we need to include sys/file.h ?
13570 case "$val" in
13571 "$define")
13572         echo " "
13573         if $h_sysfile; then
13574                 val="$define"
13575                 echo "We'll be including <sys/file.h>." >&4
13576         else
13577                 val="$undef"
13578                 echo "We won't be including <sys/file.h>." >&4
13579         fi
13580         ;;
13581 *)
13582         h_sysfile=false
13583         ;;
13584 esac
13585 set i_sysfile
13586 eval $setvar
13587
13588 : see if fcntl.h is there
13589 val=''
13590 set fcntl.h val
13591 eval $inhdr
13592
13593 : see if we can include fcntl.h
13594 case "$val" in
13595 "$define")
13596         echo " "
13597         if $h_fcntl; then
13598                 val="$define"
13599                 echo "We'll be including <fcntl.h>." >&4
13600         else
13601                 val="$undef"
13602                 if $h_sysfile; then
13603         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13604                 else
13605                         echo "We won't be including <fcntl.h>." >&4
13606                 fi
13607         fi
13608         ;;
13609 *)
13610         h_fcntl=false
13611         val="$undef"
13612         ;;
13613 esac
13614 set i_fcntl
13615 eval $setvar
13616
13617 : see if locale.h is available
13618 set locale.h i_locale
13619 eval $inhdr
13620
13621 : see if mach cthreads are available
13622 if test "X$usethreads" = "X$define"; then
13623         set mach/cthreads.h i_machcthr
13624         eval $inhdr
13625 else
13626         i_machcthr="$undef"
13627 fi
13628
13629
13630
13631 : see if this is a math.h system
13632 set math.h i_math
13633 eval $inhdr
13634
13635 : see if this is a mntent.h system
13636 set mntent.h i_mntent
13637 eval $inhdr
13638
13639 : see if ndbm.h is available
13640 set ndbm.h t_ndbm
13641 eval $inhdr
13642 case "$t_ndbm" in
13643 $define)
13644         : see if dbm_open exists
13645         set dbm_open d_dbm_open
13646         eval $inlibc
13647         case "$d_dbm_open" in
13648         $undef)
13649                 t_ndbm="$undef"
13650                 echo "We won't be including <ndbm.h>"
13651                 ;;
13652         esac
13653         ;;
13654 esac
13655 val="$t_ndbm"
13656 set i_ndbm
13657 eval $setvar
13658
13659 : see if net/errno.h is available
13660 val=''
13661 set net/errno.h val
13662 eval $inhdr
13663
13664 : Unfortunately, it causes problems on some systems.  Arrgh.
13665 case "$val" in
13666 $define)
13667         cat > try.c <<'EOM'
13668 #include <stdio.h>
13669 #include <errno.h>
13670 #include <net/errno.h>
13671 int func()
13672 {
13673         return ENOTSOCK;
13674 }
13675 EOM
13676         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13677                 echo "We'll be including <net/errno.h>." >&4
13678         else
13679                 echo "We won't be including <net/errno.h>." >&4
13680                 val="$undef"
13681         fi
13682         $rm -f try.* try
13683         ;;
13684 esac
13685 set i_neterrno
13686 eval $setvar
13687
13688 : see if netinet/tcp.h is available
13689 set netinet/tcp.h i_netinettcp
13690 eval $inhdr
13691
13692 : see if this is a poll.h system
13693 set poll.h i_poll
13694 eval $inhdr
13695
13696 : get C preprocessor symbols handy
13697 echo " "
13698 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13699 echo $al $osname | $tr ' ' $trnl >Cppsym.know
13700 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13701 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13702 cat Cppsym.a Cppsym.b >> Cppsym.know
13703 $sed 's/^/_/'           < Cppsym.know > Cppsym.a
13704 $sed 's/^/__/'          < Cppsym.know > Cppsym.b
13705 $sed 's/\(.*\)/__\1__/' < Cppsym.know > Cppsym.c
13706 $cat Cppsym.know Cppsym.a Cppsym.b Cppsym.c | sort | uniq > Cppsym.d
13707 mv Cppsym.d Cppsym.know
13708 rm Cppsym.?
13709 $cat <<EOSS >Cppsym
13710 $startsh
13711 case "\$1" in
13712 -l) list=true
13713         shift
13714         ;;
13715 esac
13716 unknown=''
13717 case "\$list\$#" in
13718 1|2)
13719         for sym do
13720                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13721                         exit 0
13722                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13723                         :
13724                 else
13725                         unknown="\$unknown \$sym"
13726                 fi
13727         done
13728         set X \$unknown
13729         shift
13730         ;;
13731 esac
13732 case \$# in
13733 0) exit 1;;
13734 esac
13735 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13736 #ifdef \1\\
13737 exit 0; _ _ _ _\1\\      \1\\
13738 #endif\\
13739 /' >Cppsym\$\$
13740 echo "exit 1; _ _ _" >>Cppsym\$\$
13741 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13742 case "\$list" in
13743 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13744 *)
13745         sh Cppsym2\$\$
13746         status=\$?
13747         ;;
13748 esac
13749 $rm -f Cppsym\$\$ Cppsym2\$\$
13750 exit \$status
13751 EOSS
13752 chmod +x Cppsym
13753 $eunicefix Cppsym
13754 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13755
13756 : now check the C compiler for additional symbols
13757 postprocess_cc_v=''
13758 case "$osname" in
13759 aix) postprocess_cc_v="|$tr , ' '" ;;
13760 esac
13761 $cat >ccsym <<EOS
13762 $startsh
13763 $cat >tmp.c <<EOF
13764 extern int foo;
13765 EOF
13766 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13767 do
13768         case "\$i" in
13769         -D*) echo "\$i" | $sed 's/^-D//';;
13770         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13771         esac
13772 done
13773 $rm -f try.c
13774 EOS
13775 postprocess_cc_v=''
13776 chmod +x ccsym
13777 $eunicefix ccsym
13778 ./ccsym > ccsym1.raw
13779 if $test -s ccsym1.raw; then
13780        $sort ccsym1.raw | $uniq >ccsym.raw
13781 else
13782        mv ccsym1.raw ccsym.raw
13783 fi
13784
13785 $awk '/\=/ { print $0; next }
13786         { print $0"=1" }' ccsym.raw >ccsym.list
13787 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13788 $comm -13 ccsym.true ccsym.list >ccsym.own
13789 $comm -12 ccsym.true ccsym.list >ccsym.com
13790 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13791 also=''
13792 if $test -z ccsym.raw; then
13793         echo "Your C compiler doesn't seem to define any symbols!" >&4
13794         echo " "
13795         echo "However, your C preprocessor defines the following symbols:"
13796         $cat Cppsym.true
13797         ccsymbols=''
13798         cppsymbols=`$cat Cppsym.true`
13799         cppsymbols=`echo $cppsymbols`
13800         cppccsymbols="$cppsymbols"
13801 else
13802         if $test -s ccsym.com; then
13803                 echo "Your C compiler and pre-processor define these symbols:"
13804                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13805                 also='also '
13806                 symbols='ones'
13807                 cppccsymbols=`$cat ccsym.com`
13808                 cppccsymbols=`echo $cppccsymbols`
13809                 $test "$silent" || sleep 1
13810         fi
13811         if $test -s ccsym.cpp; then
13812                 $test "$also" && echo " "
13813                 echo "Your C pre-processor ${also}defines the following symbols:"
13814                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13815                 also='further '
13816                 cppsymbols=`$cat ccsym.cpp`
13817                 cppsymbols=`echo $cppsymbols`
13818                 $test "$silent" || sleep 1
13819         fi
13820         if $test -s ccsym.own; then
13821                 $test "$also" && echo " "
13822                 echo "Your C compiler ${also}defines the following cpp symbols:"
13823                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13824                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13825                 ccsymbols=`$cat ccsym.own`
13826                 ccsymbols=`echo $ccsymbols`
13827                 $test "$silent" || sleep 1
13828         fi
13829 fi
13830 $rm -f ccsym*
13831
13832 : see if this is a termio system
13833 val="$undef"
13834 val2="$undef"
13835 val3="$undef"
13836 if $test `./findhdr termios.h`; then
13837         set tcsetattr i_termios
13838         eval $inlibc
13839         val3="$i_termios"
13840 fi
13841 echo " "
13842 case "$val3" in
13843 "$define") echo "You have POSIX termios.h... good!" >&4;;
13844 *) if ./Cppsym pyr; then
13845                 case "`/bin/universe`" in
13846                 ucb) if $test `./findhdr sgtty.h`; then
13847                                 val2="$define"
13848                                 echo "<sgtty.h> found." >&4
13849                         else
13850                                 echo "System is pyramid with BSD universe."
13851                                 echo "<sgtty.h> not found--you could have problems." >&4
13852                         fi;;
13853                 *) if $test `./findhdr termio.h`; then
13854                                 val="$define"
13855                                 echo "<termio.h> found." >&4
13856                         else
13857                                 echo "System is pyramid with USG universe."
13858                                 echo "<termio.h> not found--you could have problems." >&4
13859                         fi;;
13860                 esac
13861         elif ./usg; then
13862                 if $test `./findhdr termio.h`; then
13863                         echo "<termio.h> found." >&4
13864                         val="$define"
13865                 elif $test `./findhdr sgtty.h`; then
13866                         echo "<sgtty.h> found." >&4
13867                         val2="$define"
13868                 else
13869 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13870                 fi
13871         else
13872                 if $test `./findhdr sgtty.h`; then
13873                         echo "<sgtty.h> found." >&4
13874                         val2="$define"
13875                 elif $test `./findhdr termio.h`; then
13876                         echo "<termio.h> found." >&4
13877                         val="$define"
13878                 else
13879 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13880                 fi
13881         fi;;
13882 esac
13883 set i_termio; eval $setvar
13884 val=$val2; set i_sgtty; eval $setvar
13885 val=$val3; set i_termios; eval $setvar
13886
13887 : see if this is a shadow.h system
13888 set shadow.h i_shadow
13889 eval $inhdr
13890
13891 : see if this is a socks.h system
13892 set socks.h i_socks
13893 eval $inhdr
13894
13895 : see if stdarg is available
13896 echo " "
13897 if $test `./findhdr stdarg.h`; then
13898         echo "<stdarg.h> found." >&4
13899         valstd="$define"
13900 else
13901         echo "<stdarg.h> NOT found." >&4
13902         valstd="$undef"
13903 fi
13904
13905 : see if varags is available
13906 echo " "
13907 if $test `./findhdr varargs.h`; then
13908         echo "<varargs.h> found." >&4
13909 else
13910         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13911 fi
13912
13913 : set up the varargs testing programs
13914 $cat > varargs.c <<EOP
13915 #ifdef I_STDARG
13916 #include <stdarg.h>
13917 #endif
13918 #ifdef I_VARARGS
13919 #include <varargs.h>
13920 #endif
13921
13922 #ifdef I_STDARG
13923 int f(char *p, ...)
13924 #else
13925 int f(va_alist)
13926 va_dcl
13927 #endif
13928 {
13929         va_list ap;
13930 #ifndef I_STDARG
13931         char *p;
13932 #endif
13933 #ifdef I_STDARG
13934         va_start(ap,p);
13935 #else
13936         va_start(ap);
13937         p = va_arg(ap, char *);
13938 #endif
13939         va_end(ap);
13940 }
13941 EOP
13942 $cat > varargs <<EOP
13943 $startsh
13944 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13945         echo "true"
13946 else
13947         echo "false"
13948 fi
13949 $rm -f varargs$_o
13950 EOP
13951 chmod +x varargs
13952
13953 : now check which varargs header should be included
13954 echo " "
13955 i_varhdr=''
13956 case "$valstd" in
13957 "$define")
13958         if `./varargs I_STDARG`; then
13959                 val='stdarg.h'
13960         elif `./varargs I_VARARGS`; then
13961                 val='varargs.h'
13962         fi
13963         ;;
13964 *)
13965         if `./varargs I_VARARGS`; then
13966                 val='varargs.h'
13967         fi
13968         ;;
13969 esac
13970 case "$val" in
13971 '')
13972 echo "I could not find the definition for va_dcl... You have problems..." >&4
13973         val="$undef"; set i_stdarg; eval $setvar
13974         val="$undef"; set i_varargs; eval $setvar
13975         ;;
13976 *) 
13977         set i_varhdr
13978         eval $setvar
13979         case "$i_varhdr" in
13980         stdarg.h)
13981                 val="$define"; set i_stdarg; eval $setvar
13982                 val="$undef"; set i_varargs; eval $setvar
13983                 ;;
13984         varargs.h)
13985                 val="$undef"; set i_stdarg; eval $setvar
13986                 val="$define"; set i_varargs; eval $setvar
13987                 ;;
13988         esac
13989         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13990 esac
13991 $rm -f varargs*
13992
13993 : see if stddef is available
13994 set stddef.h i_stddef
13995 eval $inhdr
13996
13997 : see if sys/access.h is available
13998 set sys/access.h i_sysaccess
13999 eval $inhdr
14000
14001 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14002 set sys/filio.h i_sysfilio
14003 eval $inhdr
14004 echo " "
14005 if $test `./findhdr sys/ioctl.h`; then
14006         val="$define"
14007         echo '<sys/ioctl.h> found.' >&4
14008 else
14009         val="$undef"
14010         if $test $i_sysfilio = "$define"; then
14011             echo '<sys/ioctl.h> NOT found.' >&4
14012         else
14013                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14014                 $test $i_termio = "$define" && xxx="termio.h"
14015                 $test $i_termios = "$define" && xxx="termios.h"
14016 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14017         fi
14018 fi
14019 set i_sysioctl
14020 eval $setvar
14021
14022 : see if sys/resource.h has to be included
14023 set sys/resource.h i_sysresrc
14024 eval $inhdr
14025
14026 : see if sys/security.h is available
14027 set sys/security.h i_syssecrt
14028 eval $inhdr
14029
14030 : see if this is a sys/statvfs.h system
14031 set sys/statvfs.h i_sysstatvfs
14032 eval $inhdr
14033
14034 : see if this is a sys/uio.h system
14035 set sys/uio.h i_sysuio
14036 eval $inhdr
14037
14038 : see if this is a sys/un.h system
14039 set sys/un.h i_sysun
14040 eval $inhdr
14041
14042 : see if this is a syswait system
14043 set sys/wait.h i_syswait
14044 eval $inhdr
14045
14046 : see if this is a ustat.h system
14047 set ustat.h i_ustat
14048 eval $inhdr
14049
14050 : see if this is an utime system
14051 set utime.h i_utime
14052 eval $inhdr
14053
14054 : see if this is a values.h system
14055 set values.h i_values
14056 eval $inhdr
14057
14058 : see if this is a vfork system
14059 case "$d_vfork" in
14060 "$define")
14061         set vfork.h i_vfork
14062         eval $inhdr
14063         ;;
14064 *)
14065         i_vfork="$undef"
14066         ;;
14067 esac
14068
14069 : see if gdbm.h is available
14070 set gdbm.h t_gdbm
14071 eval $inhdr
14072 case "$t_gdbm" in
14073 $define)
14074         : see if gdbm_open exists
14075         set gdbm_open d_gdbm_open
14076         eval $inlibc
14077         case "$d_gdbm_open" in
14078         $undef)
14079                 t_gdbm="$undef"
14080                 echo "We won't be including <gdbm.h>"
14081                 ;;
14082         esac
14083         ;;
14084 esac
14085 val="$t_gdbm"
14086 set i_gdbm
14087 eval $setvar
14088
14089 echo " "
14090 echo "Looking for extensions..." >&4
14091 : If we are using the old config.sh, known_extensions may contain
14092 : old or inaccurate or duplicate values.
14093 known_extensions=''
14094 nonxs_extensions=''
14095 : We do not use find because it might not be available.
14096 : We do not just use MANIFEST because the user may have dropped
14097 : some additional extensions into the source tree and expect them
14098 : to be built.
14099
14100 : Function to recursively find available extensions, ignoring DynaLoader
14101 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14102 find_extensions='
14103     for xxx in *; do
14104        case "$xxx" in
14105            DynaLoader|dynaload) ;;
14106            *)
14107            if $test -f $xxx/$xxx.xs; then
14108                known_extensions="$known_extensions $1$xxx";
14109            elif $test -f $xxx/Makefile.PL; then
14110                nonxs_extensions="$nonxs_extensions $1$xxx";
14111            else
14112                if $test -d $xxx -a $# -lt 10; then
14113                    set $1$xxx/ $*;
14114                    cd $xxx;
14115                    eval $find_extensions;
14116                    cd ..;
14117                    shift;
14118                fi;
14119            fi
14120            ;;
14121        esac;
14122     done'
14123 tdir=`pwd`
14124 cd $rsrc/ext
14125 set X
14126 shift
14127 eval $find_extensions
14128 set X $nonxs_extensions
14129 shift
14130 nonxs_extensions="$*"
14131 set X $known_extensions
14132 shift
14133 known_extensions="$*"
14134 cd $tdir
14135
14136 : Now see which are supported on this system.
14137 avail_ext=''
14138 for xxx in $known_extensions ; do
14139         case "$xxx" in
14140         DB_File|db_file)
14141                 case "$i_db" in
14142                 $define) avail_ext="$avail_ext $xxx" ;;
14143                 esac
14144                 ;;
14145         GDBM_File|gdbm_fil)
14146                 case "$i_gdbm" in 
14147                 $define) avail_ext="$avail_ext $xxx" ;;
14148                 esac
14149                 ;;
14150         NDBM_File|ndbm_fil)
14151                 case "$i_ndbm" in
14152                 $define) avail_ext="$avail_ext $xxx" ;;
14153                 esac
14154                 ;;
14155         ODBM_File|odbm_fil) 
14156                 case "${i_dbm}${i_rpcsvcdbm}" in
14157                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14158                 esac
14159                 ;;
14160         POSIX|posix)
14161                 case "$useposix" in
14162                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14163                 esac
14164                 ;;
14165         Opcode|opcode)
14166                 case "$useopcode" in
14167                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14168                 esac
14169                 ;;
14170         Socket|socket)
14171                 case "$d_socket" in 
14172                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14173                 esac
14174                 ;;
14175         Thread|thread)
14176                 case "$usethreads" in 
14177                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14178                 esac
14179                 ;;
14180         IPC/SysV|ipc/sysv)
14181                 : XXX Do we need a useipcsysv variable here
14182                 case "${d_msg}${d_sem}${d_shm}" in 
14183                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14184                 esac
14185                 ;;
14186         *)      avail_ext="$avail_ext $xxx"
14187                 ;;
14188         esac
14189 done
14190
14191 set X $avail_ext
14192 shift
14193 avail_ext="$*"
14194
14195 : Now see which nonxs extensions are supported on this system.
14196 : For now assume all are.
14197 nonxs_ext=''
14198 for xxx in $nonxs_extensions ; do
14199         case "$xxx" in
14200         *)      nonxs_ext="$nonxs_ext $xxx"
14201                 ;;
14202         esac
14203 done
14204
14205 set X $nonxs_ext
14206 shift
14207 nonxs_ext="$*"
14208
14209 case $usedl in
14210 $define)
14211         $cat <<EOM
14212 A number of extensions are supplied with $package.  You may choose to
14213 compile these extensions for dynamic loading (the default), compile
14214 them into the $package executable (static loading), or not include
14215 them at all.  Answer "none" to include no extensions.
14216 Note that DynaLoader is always built and need not be mentioned here.
14217
14218 EOM
14219         case "$dynamic_ext" in
14220         '') dflt="$avail_ext" ;;
14221         *)      dflt="$dynamic_ext"
14222                 # Perhaps we are reusing an old out-of-date config.sh.
14223                 case "$hint" in
14224                 previous)
14225                         if test X"$dynamic_ext" != X"$avail_ext"; then
14226                                 $cat <<EOM
14227 NOTICE:  Your previous config.sh list may be incorrect. 
14228 The extensions now available to you are 
14229         ${avail_ext}
14230 but the default list from your previous config.sh is
14231         ${dynamic_ext} 
14232
14233 EOM
14234                         fi
14235                         ;;
14236                 esac
14237                 ;;
14238         esac
14239         case "$dflt" in
14240         '')     dflt=none;;
14241         esac
14242         rp="What extensions do you wish to load dynamically?"
14243         . ./myread
14244         case "$ans" in
14245         none) dynamic_ext=' ' ;;
14246         *) dynamic_ext="$ans" ;;
14247         esac
14248
14249         case "$static_ext" in
14250         '')
14251                 : Exclude those already listed in dynamic linking
14252                 dflt=''
14253                 for xxx in $avail_ext; do
14254                         case " $dynamic_ext " in
14255                         *" $xxx "*) ;;
14256                         *) dflt="$dflt $xxx" ;;
14257                         esac
14258                 done
14259                 set X $dflt
14260                 shift
14261                 dflt="$*"
14262                 ;;
14263         *)  dflt="$static_ext" 
14264                 ;;
14265         esac
14266
14267         case "$dflt" in
14268         '')     dflt=none;;
14269         esac
14270         rp="What extensions do you wish to load statically?"
14271         . ./myread
14272         case "$ans" in
14273         none) static_ext=' ' ;;
14274         *) static_ext="$ans" ;;
14275         esac
14276         ;;
14277 *)
14278         $cat <<EOM
14279 A number of extensions are supplied with $package.  Answer "none" 
14280 to include no extensions. 
14281 Note that DynaLoader is always built and need not be mentioned here.
14282
14283 EOM
14284         case "$static_ext" in
14285         '') dflt="$avail_ext" ;;
14286         *)      dflt="$static_ext"
14287                 # Perhaps we are reusing an old out-of-date config.sh.
14288                 case "$hint" in
14289                 previous)
14290                         if test X"$static_ext" != X"$avail_ext"; then
14291                                 $cat <<EOM
14292 NOTICE:  Your previous config.sh list may be incorrect. 
14293 The extensions now available to you are 
14294         ${avail_ext}
14295 but the default list from your previous config.sh is
14296         ${static_ext} 
14297
14298 EOM
14299                         fi
14300                         ;;
14301                 esac
14302                 ;;
14303         esac
14304         : Exclude those that are not xs extensions
14305         case "$dflt" in
14306         '')     dflt=none;;
14307         esac
14308         rp="What extensions do you wish to include?"
14309         . ./myread
14310         case "$ans" in
14311         none) static_ext=' ' ;;
14312         *) static_ext="$ans" ;;
14313         esac
14314         ;;
14315 esac
14316
14317 set X $dynamic_ext $static_ext $nonxs_ext
14318 shift
14319 extensions="$*"
14320
14321 : Remove build directory name from cppstdin so it can be used from
14322 : either the present location or the final installed location.
14323 echo " "
14324 : Get out of the UU directory to get correct path name.
14325 cd ..
14326 case "$cppstdin" in
14327 `pwd`/cppstdin)
14328         echo "Stripping down cppstdin path name"
14329         cppstdin=cppstdin
14330         ;;
14331 esac
14332 cd UU
14333
14334 : end of configuration questions
14335 echo " "
14336 echo "End of configuration questions."
14337 echo " "
14338
14339 : back to where it started
14340 if test -d ../UU; then
14341         cd ..
14342 fi
14343
14344 : configuration may be patched via a 'config.over' file
14345 if $test -f config.over; then
14346         echo " "
14347         dflt=y
14348         rp='I see a config.over file.  Do you wish to load it?'
14349         . UU/myread
14350         case "$ans" in
14351         n*) echo "OK, I'll ignore it.";;
14352         *)      . ./config.over
14353                 echo "Configuration override changes have been loaded."
14354                 ;;
14355         esac
14356 fi
14357
14358 : in case they want portability, strip down executable paths
14359 case "$d_portable" in
14360 "$define")
14361         echo " "
14362         echo "Stripping down executable paths..." >&4
14363         for file in $loclist $trylist; do
14364                 eval temp=\$$file
14365                 eval $file=`basename $temp`
14366         done
14367         ;;
14368 esac
14369
14370 : create config.sh file
14371 echo " "
14372 echo "Creating config.sh..." >&4
14373 $spitshell <<EOT >config.sh
14374 $startsh
14375 #
14376 # This file was produced by running the Configure script. It holds all the
14377 # definitions figured out by Configure. Should you modify one of these values,
14378 # do not forget to propagate your changes by running "Configure -der". You may
14379 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14380 #
14381
14382 # Package name      : $package
14383 # Source directory  : $src
14384 # Configuration time: $cf_time
14385 # Configured by     : $cf_by
14386 # Target system     : $myuname
14387
14388 Author='$Author'
14389 Date='$Date'
14390 Header='$Header'
14391 Id='$Id'
14392 Locker='$Locker'
14393 Log='$Log'
14394 Mcc='$Mcc'
14395 RCSfile='$RCSfile'
14396 Revision='$Revision'
14397 Source='$Source'
14398 State='$State'
14399 _a='$_a'
14400 _exe='$_exe'
14401 _o='$_o'
14402 afs='$afs'
14403 alignbytes='$alignbytes'
14404 ansi2knr='$ansi2knr'
14405 aphostname='$aphostname'
14406 api_revision='$api_revision'
14407 api_subversion='$api_subversion'
14408 api_version='$api_version'
14409 api_versionstring='$api_versionstring'
14410 ar='$ar'
14411 archlib='$archlib'
14412 archlibexp='$archlibexp'
14413 archname64='$archname64'
14414 archname='$archname'
14415 archobjs='$archobjs'
14416 awk='$awk'
14417 baserev='$baserev'
14418 bash='$bash'
14419 bin='$bin'
14420 bincompat5005='$bincompat5005'
14421 binexp='$binexp'
14422 bison='$bison'
14423 byacc='$byacc'
14424 byteorder='$byteorder'
14425 c='$c'
14426 castflags='$castflags'
14427 cat='$cat'
14428 cc='$cc'
14429 cccdlflags='$cccdlflags'
14430 ccdlflags='$ccdlflags'
14431 ccflags='$ccflags'
14432 ccsymbols='$ccsymbols'
14433 cf_by='$cf_by'
14434 cf_email='$cf_email'
14435 cf_time='$cf_time'
14436 charsize='$charsize'
14437 chgrp='$chgrp'
14438 chmod='$chmod'
14439 chown='$chown'
14440 clocktype='$clocktype'
14441 comm='$comm'
14442 compress='$compress'
14443 contains='$contains'
14444 cp='$cp'
14445 cpio='$cpio'
14446 cpp='$cpp'
14447 cpp_stuff='$cpp_stuff'
14448 cppccsymbols='$cppccsymbols'
14449 cppflags='$cppflags'
14450 cpplast='$cpplast'
14451 cppminus='$cppminus'
14452 cpprun='$cpprun'
14453 cppstdin='$cppstdin'
14454 cppsymbols='$cppsymbols'
14455 crosscompile='$crosscompile'
14456 cryptlib='$cryptlib'
14457 csh='$csh'
14458 d_Gconvert='$d_Gconvert'
14459 d_PRIEldbl='$d_PRIEldbl'
14460 d_PRIFldbl='$d_PRIFldbl'
14461 d_PRIGldbl='$d_PRIGldbl'
14462 d_PRIX64='$d_PRIX64'
14463 d_PRId64='$d_PRId64'
14464 d_PRIeldbl='$d_PRIeldbl'
14465 d_PRIfldbl='$d_PRIfldbl'
14466 d_PRIgldbl='$d_PRIgldbl'
14467 d_PRIi64='$d_PRIi64'
14468 d_PRIo64='$d_PRIo64'
14469 d_PRIu64='$d_PRIu64'
14470 d_PRIx64='$d_PRIx64'
14471 d_access='$d_access'
14472 d_accessx='$d_accessx'
14473 d_alarm='$d_alarm'
14474 d_archlib='$d_archlib'
14475 d_atolf='$d_atolf'
14476 d_atoll='$d_atoll'
14477 d_attribut='$d_attribut'
14478 d_bcmp='$d_bcmp'
14479 d_bcopy='$d_bcopy'
14480 d_bincompat5005='$d_bincompat5005'
14481 d_bsd='$d_bsd'
14482 d_bsdgetpgrp='$d_bsdgetpgrp'
14483 d_bsdsetpgrp='$d_bsdsetpgrp'
14484 d_bzero='$d_bzero'
14485 d_casti32='$d_casti32'
14486 d_castneg='$d_castneg'
14487 d_charvspr='$d_charvspr'
14488 d_chown='$d_chown'
14489 d_chroot='$d_chroot'
14490 d_chsize='$d_chsize'
14491 d_closedir='$d_closedir'
14492 d_const='$d_const'
14493 d_crypt='$d_crypt'
14494 d_csh='$d_csh'
14495 d_cuserid='$d_cuserid'
14496 d_dbl_dig='$d_dbl_dig'
14497 d_difftime='$d_difftime'
14498 d_dirnamlen='$d_dirnamlen'
14499 d_dlerror='$d_dlerror'
14500 d_dlopen='$d_dlopen'
14501 d_dlsymun='$d_dlsymun'
14502 d_dosuid='$d_dosuid'
14503 d_drand48proto='$d_drand48proto'
14504 d_dup2='$d_dup2'
14505 d_eaccess='$d_eaccess'
14506 d_endgrent='$d_endgrent'
14507 d_endhent='$d_endhent'
14508 d_endnent='$d_endnent'
14509 d_endpent='$d_endpent'
14510 d_endpwent='$d_endpwent'
14511 d_endsent='$d_endsent'
14512 d_endspent='$d_endspent'
14513 d_eofnblk='$d_eofnblk'
14514 d_eunice='$d_eunice'
14515 d_fchmod='$d_fchmod'
14516 d_fchown='$d_fchown'
14517 d_fcntl='$d_fcntl'
14518 d_fd_macros='$d_fd_macros'
14519 d_fd_set='$d_fd_set'
14520 d_fds_bits='$d_fds_bits'
14521 d_fgetpos='$d_fgetpos'
14522 d_flexfnam='$d_flexfnam'
14523 d_flock='$d_flock'
14524 d_fork='$d_fork'
14525 d_fpathconf='$d_fpathconf'
14526 d_fpos64_t='$d_fpos64_t'
14527 d_fs_data_s='$d_fs_data_s'
14528 d_fseeko='$d_fseeko'
14529 d_fsetpos='$d_fsetpos'
14530 d_fstatfs='$d_fstatfs'
14531 d_fstatvfs='$d_fstatvfs'
14532 d_ftello='$d_ftello'
14533 d_ftime='$d_ftime'
14534 d_getgrent='$d_getgrent'
14535 d_getgrps='$d_getgrps'
14536 d_gethbyaddr='$d_gethbyaddr'
14537 d_gethbyname='$d_gethbyname'
14538 d_gethent='$d_gethent'
14539 d_gethname='$d_gethname'
14540 d_gethostprotos='$d_gethostprotos'
14541 d_getlogin='$d_getlogin'
14542 d_getmnt='$d_getmnt'
14543 d_getmntent='$d_getmntent'
14544 d_getnbyaddr='$d_getnbyaddr'
14545 d_getnbyname='$d_getnbyname'
14546 d_getnent='$d_getnent'
14547 d_getnetprotos='$d_getnetprotos'
14548 d_getpbyname='$d_getpbyname'
14549 d_getpbynumber='$d_getpbynumber'
14550 d_getpent='$d_getpent'
14551 d_getpgid='$d_getpgid'
14552 d_getpgrp2='$d_getpgrp2'
14553 d_getpgrp='$d_getpgrp'
14554 d_getppid='$d_getppid'
14555 d_getprior='$d_getprior'
14556 d_getprotoprotos='$d_getprotoprotos'
14557 d_getpwent='$d_getpwent'
14558 d_getsbyname='$d_getsbyname'
14559 d_getsbyport='$d_getsbyport'
14560 d_getsent='$d_getsent'
14561 d_getservprotos='$d_getservprotos'
14562 d_getspent='$d_getspent'
14563 d_getspnam='$d_getspnam'
14564 d_gettimeod='$d_gettimeod'
14565 d_gnulibc='$d_gnulibc'
14566 d_grpasswd='$d_grpasswd'
14567 d_hasmntopt='$d_hasmntopt'
14568 d_htonl='$d_htonl'
14569 d_index='$d_index'
14570 d_inetaton='$d_inetaton'
14571 d_int64t='$d_int64t'
14572 d_isascii='$d_isascii'
14573 d_killpg='$d_killpg'
14574 d_lchown='$d_lchown'
14575 d_ldbl_dig='$d_ldbl_dig'
14576 d_link='$d_link'
14577 d_locconv='$d_locconv'
14578 d_lockf='$d_lockf'
14579 d_longdbl='$d_longdbl'
14580 d_longlong='$d_longlong'
14581 d_lstat='$d_lstat'
14582 d_mblen='$d_mblen'
14583 d_mbstowcs='$d_mbstowcs'
14584 d_mbtowc='$d_mbtowc'
14585 d_memchr='$d_memchr'
14586 d_memcmp='$d_memcmp'
14587 d_memcpy='$d_memcpy'
14588 d_memmove='$d_memmove'
14589 d_memset='$d_memset'
14590 d_mkdir='$d_mkdir'
14591 d_mkfifo='$d_mkfifo'
14592 d_mktime='$d_mktime'
14593 d_msg='$d_msg'
14594 d_msg_ctrunc='$d_msg_ctrunc'
14595 d_msg_dontroute='$d_msg_dontroute'
14596 d_msg_oob='$d_msg_oob'
14597 d_msg_peek='$d_msg_peek'
14598 d_msg_proxy='$d_msg_proxy'
14599 d_msgctl='$d_msgctl'
14600 d_msgget='$d_msgget'
14601 d_msgrcv='$d_msgrcv'
14602 d_msgsnd='$d_msgsnd'
14603 d_mymalloc='$d_mymalloc'
14604 d_nice='$d_nice'
14605 d_nv_preserves_uv='$d_nv_preserves_uv'
14606 d_off64_t='$d_off64_t'
14607 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14608 d_oldpthreads='$d_oldpthreads'
14609 d_oldsock='$d_oldsock'
14610 d_open3='$d_open3'
14611 d_pathconf='$d_pathconf'
14612 d_pause='$d_pause'
14613 d_phostname='$d_phostname'
14614 d_pipe='$d_pipe'
14615 d_poll='$d_poll'
14616 d_portable='$d_portable'
14617 d_pthread_yield='$d_pthread_yield'
14618 d_pwage='$d_pwage'
14619 d_pwchange='$d_pwchange'
14620 d_pwclass='$d_pwclass'
14621 d_pwcomment='$d_pwcomment'
14622 d_pwexpire='$d_pwexpire'
14623 d_pwgecos='$d_pwgecos'
14624 d_pwpasswd='$d_pwpasswd'
14625 d_pwquota='$d_pwquota'
14626 d_quad='$d_quad'
14627 d_readdir='$d_readdir'
14628 d_readlink='$d_readlink'
14629 d_rename='$d_rename'
14630 d_rewinddir='$d_rewinddir'
14631 d_rmdir='$d_rmdir'
14632 d_safebcpy='$d_safebcpy'
14633 d_safemcpy='$d_safemcpy'
14634 d_sanemcmp='$d_sanemcmp'
14635 d_sched_yield='$d_sched_yield'
14636 d_scm_rights='$d_scm_rights'
14637 d_seekdir='$d_seekdir'
14638 d_select='$d_select'
14639 d_sem='$d_sem'
14640 d_semctl='$d_semctl'
14641 d_semctl_semid_ds='$d_semctl_semid_ds'
14642 d_semctl_semun='$d_semctl_semun'
14643 d_semget='$d_semget'
14644 d_semop='$d_semop'
14645 d_setegid='$d_setegid'
14646 d_seteuid='$d_seteuid'
14647 d_setgrent='$d_setgrent'
14648 d_setgrps='$d_setgrps'
14649 d_sethent='$d_sethent'
14650 d_setlinebuf='$d_setlinebuf'
14651 d_setlocale='$d_setlocale'
14652 d_setnent='$d_setnent'
14653 d_setpent='$d_setpent'
14654 d_setpgid='$d_setpgid'
14655 d_setpgrp2='$d_setpgrp2'
14656 d_setpgrp='$d_setpgrp'
14657 d_setprior='$d_setprior'
14658 d_setpwent='$d_setpwent'
14659 d_setregid='$d_setregid'
14660 d_setresgid='$d_setresgid'
14661 d_setresuid='$d_setresuid'
14662 d_setreuid='$d_setreuid'
14663 d_setrgid='$d_setrgid'
14664 d_setruid='$d_setruid'
14665 d_setsent='$d_setsent'
14666 d_setsid='$d_setsid'
14667 d_setspent='$d_setspent'
14668 d_setvbuf='$d_setvbuf'
14669 d_sfio='$d_sfio'
14670 d_shm='$d_shm'
14671 d_shmat='$d_shmat'
14672 d_shmatprototype='$d_shmatprototype'
14673 d_shmctl='$d_shmctl'
14674 d_shmdt='$d_shmdt'
14675 d_shmget='$d_shmget'
14676 d_sigaction='$d_sigaction'
14677 d_sigsetjmp='$d_sigsetjmp'
14678 d_socket='$d_socket'
14679 d_sockpair='$d_sockpair'
14680 d_sqrtl='$d_sqrtl'
14681 d_statblks='$d_statblks'
14682 d_statfs_f_flags='$d_statfs_f_flags'
14683 d_statfs_s='$d_statfs_s'
14684 d_statvfs='$d_statvfs'
14685 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14686 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14687 d_stdio_stream_array='$d_stdio_stream_array'
14688 d_stdiobase='$d_stdiobase'
14689 d_stdstdio='$d_stdstdio'
14690 d_strchr='$d_strchr'
14691 d_strcoll='$d_strcoll'
14692 d_strctcpy='$d_strctcpy'
14693 d_strerrm='$d_strerrm'
14694 d_strerror='$d_strerror'
14695 d_strtod='$d_strtod'
14696 d_strtol='$d_strtol'
14697 d_strtold='$d_strtold'
14698 d_strtoll='$d_strtoll'
14699 d_strtoul='$d_strtoul'
14700 d_strtoull='$d_strtoull'
14701 d_strtouq='$d_strtouq'
14702 d_strxfrm='$d_strxfrm'
14703 d_suidsafe='$d_suidsafe'
14704 d_symlink='$d_symlink'
14705 d_syscall='$d_syscall'
14706 d_sysconf='$d_sysconf'
14707 d_sysernlst='$d_sysernlst'
14708 d_syserrlst='$d_syserrlst'
14709 d_system='$d_system'
14710 d_tcgetpgrp='$d_tcgetpgrp'
14711 d_tcsetpgrp='$d_tcsetpgrp'
14712 d_telldir='$d_telldir'
14713 d_telldirproto='$d_telldirproto'
14714 d_time='$d_time'
14715 d_times='$d_times'
14716 d_truncate='$d_truncate'
14717 d_tzname='$d_tzname'
14718 d_umask='$d_umask'
14719 d_uname='$d_uname'
14720 d_union_semun='$d_union_semun'
14721 d_ustat='$d_ustat'
14722 d_vendorbin='$d_vendorbin'
14723 d_vendorlib='$d_vendorlib'
14724 d_vfork='$d_vfork'
14725 d_void_closedir='$d_void_closedir'
14726 d_voidsig='$d_voidsig'
14727 d_voidtty='$d_voidtty'
14728 d_volatile='$d_volatile'
14729 d_vprintf='$d_vprintf'
14730 d_wait4='$d_wait4'
14731 d_waitpid='$d_waitpid'
14732 d_wcstombs='$d_wcstombs'
14733 d_wctomb='$d_wctomb'
14734 d_xenix='$d_xenix'
14735 date='$date'
14736 db_hashtype='$db_hashtype'
14737 db_prefixtype='$db_prefixtype'
14738 defvoidused='$defvoidused'
14739 direntrytype='$direntrytype'
14740 dlext='$dlext'
14741 dlsrc='$dlsrc'
14742 doublesize='$doublesize'
14743 drand01='$drand01'
14744 dynamic_ext='$dynamic_ext'
14745 eagain='$eagain'
14746 ebcdic='$ebcdic'
14747 echo='$echo'
14748 egrep='$egrep'
14749 emacs='$emacs'
14750 eunicefix='$eunicefix'
14751 exe_ext='$exe_ext'
14752 expr='$expr'
14753 extensions='$extensions'
14754 fflushNULL='$fflushNULL'
14755 fflushall='$fflushall'
14756 find='$find'
14757 firstmakefile='$firstmakefile'
14758 flex='$flex'
14759 fpossize='$fpossize'
14760 fpostype='$fpostype'
14761 freetype='$freetype'
14762 full_ar='$full_ar'
14763 full_csh='$full_csh'
14764 full_sed='$full_sed'
14765 gccversion='$gccversion'
14766 gidformat='$gidformat'
14767 gidsign='$gidsign'
14768 gidsize='$gidsize'
14769 gidtype='$gidtype'
14770 glibpth='$glibpth'
14771 grep='$grep'
14772 groupcat='$groupcat'
14773 groupstype='$groupstype'
14774 gzip='$gzip'
14775 h_fcntl='$h_fcntl'
14776 h_sysfile='$h_sysfile'
14777 hint='$hint'
14778 hostcat='$hostcat'
14779 huge='$huge'
14780 i16size='$i16size'
14781 i16type='$i16type'
14782 i32size='$i32size'
14783 i32type='$i32type'
14784 i64size='$i64size'
14785 i64type='$i64type'
14786 i8size='$i8size'
14787 i8type='$i8type'
14788 i_arpainet='$i_arpainet'
14789 i_bsdioctl='$i_bsdioctl'
14790 i_db='$i_db'
14791 i_dbm='$i_dbm'
14792 i_dirent='$i_dirent'
14793 i_dld='$i_dld'
14794 i_dlfcn='$i_dlfcn'
14795 i_fcntl='$i_fcntl'
14796 i_float='$i_float'
14797 i_gdbm='$i_gdbm'
14798 i_grp='$i_grp'
14799 i_inttypes='$i_inttypes'
14800 i_limits='$i_limits'
14801 i_locale='$i_locale'
14802 i_machcthr='$i_machcthr'
14803 i_malloc='$i_malloc'
14804 i_math='$i_math'
14805 i_memory='$i_memory'
14806 i_mntent='$i_mntent'
14807 i_ndbm='$i_ndbm'
14808 i_netdb='$i_netdb'
14809 i_neterrno='$i_neterrno'
14810 i_netinettcp='$i_netinettcp'
14811 i_niin='$i_niin'
14812 i_poll='$i_poll'
14813 i_pthread='$i_pthread'
14814 i_pwd='$i_pwd'
14815 i_rpcsvcdbm='$i_rpcsvcdbm'
14816 i_sfio='$i_sfio'
14817 i_sgtty='$i_sgtty'
14818 i_shadow='$i_shadow'
14819 i_socks='$i_socks'
14820 i_stdarg='$i_stdarg'
14821 i_stddef='$i_stddef'
14822 i_stdlib='$i_stdlib'
14823 i_string='$i_string'
14824 i_sysaccess='$i_sysaccess'
14825 i_sysdir='$i_sysdir'
14826 i_sysfile='$i_sysfile'
14827 i_sysfilio='$i_sysfilio'
14828 i_sysin='$i_sysin'
14829 i_sysioctl='$i_sysioctl'
14830 i_sysmount='$i_sysmount'
14831 i_sysndir='$i_sysndir'
14832 i_sysparam='$i_sysparam'
14833 i_sysresrc='$i_sysresrc'
14834 i_syssecrt='$i_syssecrt'
14835 i_sysselct='$i_sysselct'
14836 i_syssockio='$i_syssockio'
14837 i_sysstat='$i_sysstat'
14838 i_sysstatfs='$i_sysstatfs'
14839 i_sysstatvfs='$i_sysstatvfs'
14840 i_systime='$i_systime'
14841 i_systimek='$i_systimek'
14842 i_systimes='$i_systimes'
14843 i_systypes='$i_systypes'
14844 i_sysuio='$i_sysuio'
14845 i_sysun='$i_sysun'
14846 i_sysvfs='$i_sysvfs'
14847 i_syswait='$i_syswait'
14848 i_termio='$i_termio'
14849 i_termios='$i_termios'
14850 i_time='$i_time'
14851 i_unistd='$i_unistd'
14852 i_ustat='$i_ustat'
14853 i_utime='$i_utime'
14854 i_values='$i_values'
14855 i_varargs='$i_varargs'
14856 i_varhdr='$i_varhdr'
14857 i_vfork='$i_vfork'
14858 ignore_versioned_solibs='$ignore_versioned_solibs'
14859 inc_version_list='$inc_version_list'
14860 inc_version_list_init='$inc_version_list_init'
14861 incpath='$incpath'
14862 inews='$inews'
14863 installarchlib='$installarchlib'
14864 installbin='$installbin'
14865 installman1dir='$installman1dir'
14866 installman3dir='$installman3dir'
14867 installprefix='$installprefix'
14868 installprefixexp='$installprefixexp'
14869 installprivlib='$installprivlib'
14870 installscript='$installscript'
14871 installsitearch='$installsitearch'
14872 installsitebin='$installsitebin'
14873 installsitelib='$installsitelib'
14874 installstyle='$installstyle'
14875 installusrbinperl='$installusrbinperl'
14876 installvendorbin='$installvendorbin'
14877 installvendorlib='$installvendorlib'
14878 intsize='$intsize'
14879 ivdformat='$ivdformat'
14880 ivsize='$ivsize'
14881 ivtype='$ivtype'
14882 known_extensions='$known_extensions'
14883 ksh='$ksh'
14884 large='$large'
14885 ld='$ld'
14886 lddlflags='$lddlflags'
14887 ldflags='$ldflags'
14888 ldlibpthname='$ldlibpthname'
14889 less='$less'
14890 lib_ext='$lib_ext'
14891 libc='$libc'
14892 libperl='$libperl'
14893 libpth='$libpth'
14894 libs='$libs'
14895 libswanted='$libswanted'
14896 line='$line'
14897 lint='$lint'
14898 lkflags='$lkflags'
14899 ln='$ln'
14900 lns='$lns'
14901 locincpth='$locincpth'
14902 loclibpth='$loclibpth'
14903 longdblsize='$longdblsize'
14904 longlongsize='$longlongsize'
14905 longsize='$longsize'
14906 lp='$lp'
14907 lpr='$lpr'
14908 ls='$ls'
14909 lseeksize='$lseeksize'
14910 lseektype='$lseektype'
14911 mail='$mail'
14912 mailx='$mailx'
14913 make='$make'
14914 make_set_make='$make_set_make'
14915 mallocobj='$mallocobj'
14916 mallocsrc='$mallocsrc'
14917 malloctype='$malloctype'
14918 man1dir='$man1dir'
14919 man1direxp='$man1direxp'
14920 man1ext='$man1ext'
14921 man3dir='$man3dir'
14922 man3direxp='$man3direxp'
14923 man3ext='$man3ext'
14924 medium='$medium'
14925 mips_type='$mips_type'
14926 mkdir='$mkdir'
14927 models='$models'
14928 modetype='$modetype'
14929 more='$more'
14930 multiarch='$multiarch'
14931 mv='$mv'
14932 myarchname='$myarchname'
14933 mydomain='$mydomain'
14934 myhostname='$myhostname'
14935 myuname='$myuname'
14936 n='$n'
14937 netdb_hlen_type='$netdb_hlen_type'
14938 netdb_host_type='$netdb_host_type'
14939 netdb_name_type='$netdb_name_type'
14940 netdb_net_type='$netdb_net_type'
14941 nm='$nm'
14942 nm_opt='$nm_opt'
14943 nm_so_opt='$nm_so_opt'
14944 nonxs_ext='$nonxs_ext'
14945 nroff='$nroff'
14946 nvsize='$nvsize'
14947 nvtype='$nvtype'
14948 o_nonblock='$o_nonblock'
14949 obj_ext='$obj_ext'
14950 old_pthread_create_joinable='$old_pthread_create_joinable'
14951 optimize='$optimize'
14952 orderlib='$orderlib'
14953 osname='$osname'
14954 osvers='$osvers'
14955 package='$package'
14956 pager='$pager'
14957 passcat='$passcat'
14958 patchlevel='$patchlevel'
14959 path_sep='$path_sep'
14960 perl='$perl'
14961 perladmin='$perladmin'
14962 perlpath='$perlpath'
14963 pg='$pg'
14964 phostname='$phostname'
14965 pidtype='$pidtype'
14966 plibpth='$plibpth'
14967 pmake='$pmake'
14968 pr='$pr'
14969 prefix='$prefix'
14970 prefixexp='$prefixexp'
14971 privlib='$privlib'
14972 privlibexp='$privlibexp'
14973 prototype='$prototype'
14974 ptrsize='$ptrsize'
14975 quadkind='$quadkind'
14976 quadtype='$quadtype'
14977 randbits='$randbits'
14978 randfunc='$randfunc'
14979 randseedtype='$randseedtype'
14980 ranlib='$ranlib'
14981 rd_nodata='$rd_nodata'
14982 rm='$rm'
14983 rmail='$rmail'
14984 runnm='$runnm'
14985 sPRIEldbl='$sPRIEldbl'
14986 sPRIFldbl='$sPRIFldbl'
14987 sPRIGldbl='$sPRIGldbl'
14988 sPRIX64='$sPRIX64'
14989 sPRId64='$sPRId64'
14990 sPRIeldbl='$sPRIeldbl'
14991 sPRIfldbl='$sPRIfldbl'
14992 sPRIgldbl='$sPRIgldbl'
14993 sPRIi64='$sPRIi64'
14994 sPRIo64='$sPRIo64'
14995 sPRIu64='$sPRIu64'
14996 sPRIx64='$sPRIx64'
14997 sched_yield='$sched_yield'
14998 scriptdir='$scriptdir'
14999 scriptdirexp='$scriptdirexp'
15000 sed='$sed'
15001 seedfunc='$seedfunc'
15002 selectminbits='$selectminbits'
15003 selecttype='$selecttype'
15004 sendmail='$sendmail'
15005 sh='$sh'
15006 shar='$shar'
15007 sharpbang='$sharpbang'
15008 shmattype='$shmattype'
15009 shortsize='$shortsize'
15010 shrpenv='$shrpenv'
15011 shsharp='$shsharp'
15012 sig_count='$sig_count'
15013 sig_name='$sig_name'
15014 sig_name_init='$sig_name_init'
15015 sig_num='$sig_num'
15016 sig_num_init='$sig_num_init'
15017 signal_t='$signal_t'
15018 sitearch='$sitearch'
15019 sitearchexp='$sitearchexp'
15020 sitebin='$sitebin'
15021 sitebinexp='$sitebinexp'
15022 sitelib='$sitelib'
15023 sitelibexp='$sitelibexp'
15024 siteprefix='$siteprefix'
15025 siteprefixexp='$siteprefixexp'
15026 sizetype='$sizetype'
15027 sleep='$sleep'
15028 smail='$smail'
15029 small='$small'
15030 so='$so'
15031 sockethdr='$sockethdr'
15032 socketlib='$socketlib'
15033 sort='$sort'
15034 spackage='$spackage'
15035 spitshell='$spitshell'
15036 split='$split'
15037 src='$src'
15038 ssizetype='$ssizetype'
15039 startperl='$startperl'
15040 startsh='$startsh'
15041 static_ext='$static_ext'
15042 stdchar='$stdchar'
15043 stdio_base='$stdio_base'
15044 stdio_bufsiz='$stdio_bufsiz'
15045 stdio_cnt='$stdio_cnt'
15046 stdio_filbuf='$stdio_filbuf'
15047 stdio_ptr='$stdio_ptr'
15048 stdio_stream_array='$stdio_stream_array'
15049 strings='$strings'
15050 submit='$submit'
15051 subversion='$subversion'
15052 sysman='$sysman'
15053 tail='$tail'
15054 tar='$tar'
15055 tbl='$tbl'
15056 tee='$tee'
15057 test='$test'
15058 timeincl='$timeincl'
15059 timetype='$timetype'
15060 touch='$touch'
15061 tr='$tr'
15062 trnl='$trnl'
15063 troff='$troff'
15064 u16size='$u16size'
15065 u16type='$u16type'
15066 u32size='$u32size'
15067 u32type='$u32type'
15068 u64size='$u64size'
15069 u64type='$u64type'
15070 u8size='$u8size'
15071 u8type='$u8type'
15072 uidformat='$uidformat'
15073 uidsign='$uidsign'
15074 uidsize='$uidsize'
15075 uidtype='$uidtype'
15076 uname='$uname'
15077 uniq='$uniq'
15078 uquadtype='$uquadtype'
15079 use5005threads='$use5005threads'
15080 use64bits='$use64bits'
15081 usedl='$usedl'
15082 useithreads='$useithreads'
15083 uselargefiles='$uselargefiles'
15084 uselongdouble='$uselongdouble'
15085 uselonglong='$uselonglong'
15086 usemorebits='$usemorebits'
15087 usemultiplicity='$usemultiplicity'
15088 usemymalloc='$usemymalloc'
15089 usenm='$usenm'
15090 useopcode='$useopcode'
15091 useperlio='$useperlio'
15092 useposix='$useposix'
15093 usesfio='$usesfio'
15094 useshrplib='$useshrplib'
15095 usesocks='$usesocks'
15096 usethreads='$usethreads'
15097 usevendorprefix='$usevendorprefix'
15098 usevfork='$usevfork'
15099 usrinc='$usrinc'
15100 uuname='$uuname'
15101 uvoformat='$uvoformat'
15102 uvsize='$uvsize'
15103 uvtype='$uvtype'
15104 uvuformat='$uvuformat'
15105 uvxformat='$uvxformat'
15106 vendorbin='$vendorbin'
15107 vendorbinexp='$vendorbinexp'
15108 vendorlib='$vendorlib'
15109 vendorlibexp='$vendorlibexp'
15110 vendorprefix='$vendorprefix'
15111 vendorprefixexp='$vendorprefixexp'
15112 version='$version'
15113 vi='$vi'
15114 voidflags='$voidflags'
15115 xlibpth='$xlibpth'
15116 zcat='$zcat'
15117 zip='$zip'
15118 EOT
15119
15120 : Add in command line options if available
15121 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15122
15123 : add special variables
15124 $test -f $src/patchlevel.h && \
15125 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15126 echo "CONFIGDOTSH=true" >>config.sh
15127
15128 : propagate old symbols
15129 if $test -f UU/config.sh; then
15130         <UU/config.sh sort | uniq >UU/oldconfig.sh
15131         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15132         sort | uniq -u >UU/oldsyms
15133         set X `cat UU/oldsyms`
15134         shift
15135         case $# in
15136         0) ;;
15137         *)
15138                 cat <<EOM
15139 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15140 EOM
15141                 echo "# Variables propagated from previous config.sh file." >>config.sh
15142                 for sym in `cat UU/oldsyms`; do
15143                         echo "    Propagating $hint variable "'$'"$sym..."
15144                         eval 'tmp="$'"${sym}"'"'
15145                         echo "$tmp" | \
15146                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15147                 done
15148                 ;;
15149         esac
15150 fi
15151
15152 : Finish up by extracting the .SH files
15153 case "$alldone" in
15154 exit)
15155         $rm -rf UU
15156         echo "Done."
15157         exit 0
15158         ;;
15159 cont)
15160         ;;
15161 '')
15162         dflt=''
15163         nostick=true
15164         $cat <<EOM
15165
15166 If you'd like to make any changes to the config.sh file before I begin
15167 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15168
15169 EOM
15170         rp="Press return or use a shell escape to edit config.sh:"
15171         . UU/myread
15172         nostick=''
15173         case "$ans" in
15174         '') ;;
15175         *) : in case they cannot read
15176                 sh 1>&4 -c "$ans";;
15177         esac
15178         ;;
15179 esac
15180
15181 : if this fails, just run all the .SH files by hand
15182 . ./config.sh
15183
15184 echo " "
15185 exec 1>&4
15186 . ./UU/extract
15187
15188 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15189         dflt=y
15190         case "$silent" in
15191         true) ;;
15192         *)
15193                 $cat <<EOM
15194
15195 Now you need to generate make dependencies by running "$make depend".
15196 You might prefer to run it in background: "$make depend > makedepend.out &"
15197 It can take a while, so you might not want to run it right now.
15198
15199 EOM
15200                 ;;
15201         esac
15202         rp="Run $make depend now?"
15203         . UU/myread
15204         case "$ans" in
15205         y*)
15206                 $make depend && echo "Now you must run a $make."
15207                 ;;
15208         *)
15209                 echo "You must run '$make depend' then '$make'."
15210                 ;;
15211         esac
15212 elif test -f [Mm]akefile; then
15213         echo " "
15214         echo "Now you must run a $make."
15215 else
15216         echo "Done."
15217 fi
15218
15219 if $test -f Policy.sh; then
15220     $cat <<EOM
15221
15222 If you compile $package on a different machine or from a different object
15223 directory, copy the Policy.sh file from this object directory to the
15224 new one before you run Configure -- this will help you with most of
15225 the policy defaults.
15226
15227 EOM
15228 fi
15229 if $test -f config.msg; then
15230     echo "Hmm.  I also noted the following information while running:"
15231     echo " "
15232     $cat config.msg >&4
15233     $rm -f config.msg
15234 fi
15235 $rm -f kit*isdone ark*isdone
15236 $rm -rf UU
15237
15238 : End of Configure
15239