adjust notes on use5005threads
[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
2687 If you're a casual user, you probably don't want interpreter-threads
2688 at this time.  There doesn't yet exist a way to create threads from
2689 within Perl in this model, i.e., "use Thread;" will NOT work.
2690 EOM
2691         : Default to ithreads unless overridden on command line or with
2692         : old config.sh
2693         dflt='y'
2694         case "$use5005threads" in
2695                 $define|true|[yY]*) dflt='n';;
2696         esac
2697         case "$useithreads" in
2698                 $undef|false|[nN]*) dflt='n';;
2699         esac
2700         rp='Use interpreter-based ithreads?'
2701         . ./myread
2702         case "$ans" in
2703         y|Y)    val="$define" ;;
2704         *)      val="$undef" ;;
2705         esac
2706         set useithreads
2707         eval $setvar
2708         : Now set use5005threads to the opposite value.
2709         case "$useithreads" in
2710         $define) val="$undef" ;;
2711         *) val="$define" ;;
2712         esac
2713         set use5005threads
2714         eval $setvar
2715         ;;
2716 *)
2717         useithreads="$undef"
2718         use5005threads="$undef"
2719         ;;
2720 esac
2721
2722 case "$d_oldpthreads" in
2723 '')     : Configure tests would be welcome here.  For now, assume undef.
2724         val="$undef" ;;
2725 *)      val="$d_oldpthreads" ;;
2726 esac
2727 set d_oldpthreads
2728 eval $setvar
2729
2730
2731 case "$usethreads" in
2732 "$define"|true|[yY]*)
2733 : Look for a hint-file generated 'call-back-unit'.  If the
2734 : user has specified that a threading perl is to be built,
2735 : we may need to set or change some other defaults.
2736         if $test -f usethreads.cbu; then
2737                 echo "Your platform has some specific hints for threaded builds, using them..."
2738                 . ./usethreads.cbu
2739         else
2740                 $cat <<EOM
2741 (Your platform doesn't have any specific hints for threaded builds.
2742  Assuming POSIX threads, then.)
2743 EOM
2744         fi
2745         ;;
2746 esac
2747
2748 cat <<EOM
2749
2750 Perl can be built so that multiple Perl interpreters can coexist
2751 within the same Perl executable.
2752 EOM
2753
2754 case "$useithreads" in
2755 $define)
2756         cat <<EOM
2757 This multiple interpreter support is required for interpreter-based threads.
2758 EOM
2759         val="$define"
2760         ;;
2761 *)
2762         echo 'Normally you do not need this and you should answer no.'
2763         case "$usemultiplicity" in
2764         $define|true|[yY]*)     dflt='y';;
2765         *) dflt='n';;
2766         esac
2767         rp='Build Perl for multiplicity?'
2768         . ./myread
2769         case "$ans" in
2770         y|Y)    val="$define" ;;
2771         *)      val="$undef" ;;
2772         esac
2773         ;;
2774 esac
2775 set usemultiplicity
2776 eval $setvar
2777
2778 : determine where manual pages are on this system
2779 echo " "
2780 case "$sysman" in
2781 '') 
2782         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2783         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2784         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2785         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2786         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2787         sysman=`./loc . /usr/man/man1 $syspath`
2788         ;;
2789 esac
2790 if $test -d "$sysman"; then
2791         echo "System manual is in $sysman." >&4
2792 else
2793         echo "Could not find manual pages in source form." >&4
2794 fi
2795
2796 : see what memory models we can support
2797 case "$models" in
2798 '')
2799         $cat >pdp11.c <<'EOP'
2800 int main() {
2801 #ifdef pdp11
2802         exit(0);
2803 #else
2804         exit(1);
2805 #endif
2806 }
2807 EOP
2808         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2809         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2810                 dflt='unsplit split'
2811         else
2812                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2813                 case "$tans" in
2814                 X) dflt='none';;
2815                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2816                                 dflt='small'
2817                         else
2818                                 dflt=''
2819                         fi
2820                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2821                                 dflt="$dflt medium"
2822                         fi
2823                         if $test -d /lib/large || $test -d /usr/lib/large; then
2824                                 dflt="$dflt large"
2825                         fi
2826                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2827                                 dflt="$dflt huge"
2828                         fi
2829                 esac
2830         fi;;
2831 *) dflt="$models";;
2832 esac
2833 $cat <<EOM
2834  
2835 Some systems have different model sizes.  On most systems they are called
2836 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2837 split.  If your system doesn't support different memory models, say "none".
2838 If you wish to force everything to one memory model, say "none" here and
2839 put the appropriate flags later when it asks you for other cc and ld flags.
2840 Venix systems may wish to put "none" and let the compiler figure things out.
2841 (In the following question multiple model names should be space separated.)
2842
2843 The default for most systems is "none".
2844
2845 EOM
2846 rp="Which memory models are supported?"
2847 . ./myread
2848 models="$ans"
2849
2850 case "$models" in
2851 none)
2852         small=''
2853         medium=''
2854         large=''
2855         huge=''
2856         unsplit=''
2857         split=''
2858         ;;
2859 *split)
2860         case "$split" in
2861         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2862                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2863                         dflt='-i'
2864                 else
2865                         dflt='none'
2866                 fi;;
2867         *) dflt="$split";;
2868         esac
2869         rp="What flag indicates separate I and D space?"
2870         . ./myread
2871         tans="$ans"
2872         case "$tans" in
2873         none) tans='';;
2874         esac
2875         split="$tans"
2876         unsplit='';;
2877 *large*|*small*|*medium*|*huge*)
2878         case "$models" in
2879         *large*)
2880                 case "$large" in
2881                 '') dflt='-Ml';;
2882                 *) dflt="$large";;
2883                 esac
2884         rp="What flag indicates large model?"
2885         . ./myread
2886         tans="$ans"
2887         case "$tans" in
2888         none) tans='';
2889         esac
2890         large="$tans";;
2891         *) large='';;
2892         esac
2893         case "$models" in
2894         *huge*) case "$huge" in
2895                 '') dflt='-Mh';;
2896                 *) dflt="$huge";;
2897                 esac
2898                 rp="What flag indicates huge model?"
2899                 . ./myread
2900                 tans="$ans"
2901                 case "$tans" in
2902                 none) tans='';
2903                 esac
2904                 huge="$tans";;
2905         *) huge="$large";;
2906         esac
2907         case "$models" in
2908         *medium*) case "$medium" in
2909                 '') dflt='-Mm';;
2910                 *) dflt="$medium";;
2911                 esac
2912                 rp="What flag indicates medium model?"
2913                 . ./myread
2914                 tans="$ans"
2915                 case "$tans" in
2916                 none) tans='';
2917                 esac
2918                 medium="$tans";;
2919         *) medium="$large";;
2920         esac
2921         case "$models" in
2922         *small*) case "$small" in
2923                 '') dflt='none';;
2924                 *) dflt="$small";;
2925                 esac
2926                 rp="What flag indicates small model?"
2927                 . ./myread
2928                 tans="$ans"
2929                 case "$tans" in
2930                 none) tans='';
2931                 esac
2932                 small="$tans";;
2933         *) small='';;
2934         esac
2935         ;;
2936 *)
2937         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2938         ;;
2939 esac
2940 $rm -f pdp11.* pdp11
2941
2942 : make some quick guesses about what we are up against
2943 echo " "
2944 $echo $n "Hmm...  $c"
2945 echo exit 1 >bsd
2946 echo exit 1 >usg
2947 echo exit 1 >v7
2948 echo exit 1 >osf1
2949 echo exit 1 >eunice
2950 echo exit 1 >xenix
2951 echo exit 1 >venix
2952 echo exit 1 >os2
2953 d_bsd="$undef"
2954 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2955 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2956 then
2957         echo "Looks kind of like an OSF/1 system, but we'll see..."
2958         echo exit 0 >osf1
2959 elif test `echo abc | tr a-z A-Z` = Abc ; then
2960         xxx=`./loc addbib blurfl $pth`
2961         if $test -f $xxx; then
2962         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2963                 echo exit 0 >bsd
2964                 echo exit 0 >usg
2965         else
2966                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2967                         echo "Looks kind of like an extended USG system, but we'll see..."
2968                 else
2969                         echo "Looks kind of like a USG system, but we'll see..."
2970                 fi
2971                 echo exit 0 >usg
2972         fi
2973 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2974         echo "Looks kind of like a BSD system, but we'll see..."
2975         d_bsd="$define"
2976         echo exit 0 >bsd
2977 else
2978         echo "Looks kind of like a Version 7 system, but we'll see..."
2979         echo exit 0 >v7
2980 fi
2981 case "$eunicefix" in
2982 *unixtovms*)
2983         $cat <<'EOI'
2984 There is, however, a strange, musty smell in the air that reminds me of
2985 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2986 EOI
2987         echo exit 0 >eunice
2988         d_eunice="$define"
2989 : it so happens the Eunice I know will not run shell scripts in Unix format
2990         ;;
2991 *)
2992         echo " "
2993         echo "Congratulations.  You aren't running Eunice."
2994         d_eunice="$undef"
2995         ;;
2996 esac
2997 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2998 case "$p_" in
2999 :) ;;
3000 *)
3001         $cat <<'EOI'
3002 I have the feeling something is not exactly right, however...don't tell me...
3003 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3004 EOI
3005         echo exit 0 >os2
3006         ;;
3007 esac
3008 if test -f /xenix; then
3009         echo "Actually, this looks more like a XENIX system..."
3010         echo exit 0 >xenix
3011         d_xenix="$define"
3012 else
3013         echo " "
3014         echo "It's not Xenix..."
3015         d_xenix="$undef"
3016 fi
3017 chmod +x xenix
3018 $eunicefix xenix
3019 if test -f /venix; then
3020         echo "Actually, this looks more like a VENIX system..."
3021         echo exit 0 >venix
3022 else
3023         echo " "
3024         if ./xenix; then
3025                 : null
3026         else
3027                 echo "Nor is it Venix..."
3028         fi
3029 fi
3030 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3031 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3032 $rm -f foo
3033
3034 : see if we need a special compiler
3035 echo " "
3036 if ./usg; then
3037         case "$cc" in
3038         '') case "$Mcc" in
3039                 /*) dflt='Mcc';;
3040                 *) case "$large" in
3041                         -M*) dflt='cc';;
3042                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3043                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3044                                                 dflt='cc'
3045                                         else
3046                                                 dflt='cc -M'
3047                                         fi
3048                                 else
3049                                         dflt='cc'
3050                                 fi;;
3051                         esac;;
3052                 esac;;
3053         *)  dflt="$cc";;
3054         esac
3055         case "$dflt" in
3056         *M*)    $cat <<'EOM'
3057 On some older systems the default C compiler will not resolve multiple global
3058 references that happen to have the same name.  On some such systems the "Mcc"
3059 command may be used to force these to be resolved.  On other systems a "cc -M"
3060 command is required.  (Note that the -M flag on other systems indicates a
3061 memory model to use!) If you have the Gnu C compiler, you might wish to use
3062 that instead.
3063
3064 EOM
3065         ;;
3066         esac
3067         rp="Use which C compiler?"
3068         . ./myread
3069         cc="$ans"
3070 else
3071         case "$cc" in
3072         '') dflt=cc;;
3073         *) dflt="$cc";;
3074         esac
3075         rp="Use which C compiler?"
3076         . ./myread
3077         cc="$ans"
3078 fi
3079 : Look for a hint-file generated 'call-back-unit'.  Now that the
3080 : user has specified the compiler, we may need to set or change some
3081 : other defaults.
3082 if $test -f cc.cbu; then
3083     . ./cc.cbu
3084 fi
3085 echo " "
3086 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3087 $cat >gccvers.c <<EOM
3088 #include <stdio.h>
3089 int main() {
3090 #ifdef __GNUC__
3091 #ifdef __VERSION__
3092         printf("%s\n", __VERSION__);
3093 #else
3094         printf("%s\n", "1");
3095 #endif
3096 #endif
3097         exit(0);
3098 }
3099 EOM
3100 if $cc -o gccvers gccvers.c; then
3101         gccversion=`./gccvers`
3102         case "$gccversion" in
3103         '') echo "You are not using GNU cc." ;;
3104         *)  echo "You are using GNU cc $gccversion."
3105             ;;
3106         esac
3107 else
3108         echo " "
3109         echo "*** WHOA THERE!!! ***" >&4
3110         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3111         case "$knowitall" in
3112         '')
3113         echo "    You'd better start hunting for one and let me know about it." >&4
3114                 exit 1
3115                 ;;
3116         esac
3117 fi
3118 $rm -f gccvers*
3119 case "$gccversion" in
3120 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3121 esac
3122
3123 : decide how portable to be.  Allow command line overrides.
3124 case "$d_portable" in
3125 "$undef") ;;
3126 *)      d_portable="$define" ;;
3127 esac
3128
3129 : set up shell script to do ~ expansion
3130 cat >filexp <<EOSS
3131 $startsh
3132 : expand filename
3133 case "\$1" in
3134  ~/*|~)
3135         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3136         ;;
3137  ~*)
3138         if $test -f /bin/csh; then
3139                 /bin/csh -f -c "glob \$1"
3140                 failed=\$?
3141                 echo ""
3142                 exit \$failed
3143         else
3144                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3145                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3146                 if $test ! -d "\$dir"; then
3147                         me=\`basename \$0\`
3148                         echo "\$me: can't locate home directory for: \$name" >&2
3149                         exit 1
3150                 fi
3151                 case "\$1" in
3152                 */*)
3153                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3154                         ;;
3155                 *)
3156                         echo \$dir
3157                         ;;
3158                 esac
3159         fi
3160         ;;
3161 *)
3162         echo \$1
3163         ;;
3164 esac
3165 EOSS
3166 chmod +x filexp
3167 $eunicefix filexp
3168
3169 : now set up to get a file name
3170 cat <<EOS >getfile
3171 $startsh
3172 EOS
3173 cat <<'EOSC' >>getfile
3174 tilde=''
3175 fullpath=''
3176 already=''
3177 skip=''
3178 none_ok=''
3179 exp_file=''
3180 nopath_ok=''
3181 orig_rp="$rp"
3182 orig_dflt="$dflt"
3183 case "$gfpth" in
3184 '') gfpth='.' ;;
3185 esac
3186
3187 case "$fn" in
3188 *\(*)
3189         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3190         fn=`echo $fn | sed 's/(.*)//'`
3191         ;;
3192 esac
3193
3194 case "$fn" in
3195 *:*)
3196         loc_file=`expr $fn : '.*:\(.*\)'`
3197         fn=`expr $fn : '\(.*\):.*'`
3198         ;;
3199 esac
3200
3201 case "$fn" in
3202 *~*) tilde=true;;
3203 esac
3204 case "$fn" in
3205 */*) fullpath=true;;
3206 esac
3207 case "$fn" in
3208 *+*) skip=true;;
3209 esac
3210 case "$fn" in
3211 *n*) none_ok=true;;
3212 esac
3213 case "$fn" in
3214 *e*) exp_file=true;;
3215 esac
3216 case "$fn" in
3217 *p*) nopath_ok=true;;
3218 esac
3219
3220 case "$fn" in
3221 *f*) type='File';;
3222 *d*) type='Directory';;
3223 *l*) type='Locate';;
3224 esac
3225
3226 what="$type"
3227 case "$what" in
3228 Locate) what='File';;
3229 esac
3230
3231 case "$exp_file" in
3232 '')
3233         case "$d_portable" in
3234         "$define") ;;
3235         *) exp_file=true;;
3236         esac
3237         ;;
3238 esac
3239
3240 cd ..
3241 while test "$type"; do
3242         redo=''
3243         rp="$orig_rp"
3244         dflt="$orig_dflt"
3245         case "$tilde" in
3246         true) rp="$rp (~name ok)";;
3247         esac
3248         . UU/myread
3249         if test -f UU/getfile.ok && \
3250                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3251         then
3252                 value="$ans"
3253                 ansexp="$ans"
3254                 break
3255         fi
3256         case "$ans" in
3257         none)
3258                 value=''
3259                 ansexp=''
3260                 case "$none_ok" in
3261                 true) type='';;
3262                 esac
3263                 ;;
3264         *)
3265                 case "$tilde" in
3266                 '') value="$ans"
3267                         ansexp="$ans";;
3268                 *)
3269                         value=`UU/filexp $ans`
3270                         case $? in
3271                         0)
3272                                 if test "$ans" != "$value"; then
3273                                         echo "(That expands to $value on this system.)"
3274                                 fi
3275                                 ;;
3276                         *) value="$ans";;
3277                         esac
3278                         ansexp="$value"
3279                         case "$exp_file" in
3280                         '') value="$ans";;
3281                         esac
3282                         ;;
3283                 esac
3284                 case "$fullpath" in
3285                 true)
3286                         case "$ansexp" in
3287                         /*) value="$ansexp" ;;
3288                         *)
3289                                 redo=true
3290                                 case "$already" in
3291                                 true)
3292                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3293                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3294                                         ;;
3295                                 *)
3296                                 echo "Please give a full path name, starting with slash." >&4
3297                                         case "$tilde" in
3298                                         true)
3299                                 echo "Note that using ~name is ok provided it expands well." >&4
3300                                                 already=true
3301                                                 ;;
3302                                         esac
3303                                 esac
3304                                 ;;
3305                         esac
3306                         ;;
3307                 esac
3308                 case "$redo" in
3309                 '')
3310                         case "$type" in
3311                         File)
3312                                 for fp in $gfpth; do
3313                                         if test "X$fp" = X.; then
3314                                             pf="$ansexp"
3315                                         else    
3316                                             pf="$fp/$ansexp"
3317                                         fi
3318                                         if test -f "$pf"; then
3319                                                 type=''
3320                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3321                                         then
3322                                                 echo "($value is not a plain file, but that's ok.)"
3323                                                 type=''
3324                                         fi
3325                                         if test X"$type" = X; then
3326                                             value="$pf"
3327                                             break
3328                                         fi
3329                                 done
3330                                 ;;
3331                         Directory)
3332                                 for fp in $gfpth; do
3333                                         if test "X$fp" = X.; then
3334                                             pf="$ansexp"
3335                                         else    
3336                                             pf="$fp/$ansexp"
3337                                         fi
3338                                         if test -d "$pf"; then
3339                                                 type=''
3340                                                 value="$pf"
3341                                                 break
3342                                         fi
3343                                 done
3344                                 ;;
3345                         Locate)
3346                                 if test -d "$ansexp"; then
3347                                         echo "(Looking for $loc_file in directory $value.)"
3348                                         value="$value/$loc_file"
3349                                         ansexp="$ansexp/$loc_file"
3350                                 fi
3351                                 if test -f "$ansexp"; then
3352                                         type=''
3353                                 fi
3354                                 case "$nopath_ok" in
3355                                 true)   case "$value" in
3356                                         */*) ;;
3357                                         *)      echo "Assuming $value will be in people's path."
3358                                                 type=''
3359                                                 ;;
3360                                         esac
3361                                         ;;
3362                                 esac
3363                                 ;;
3364                         esac
3365
3366                         case "$skip" in
3367                         true) type='';
3368                         esac
3369
3370                         case "$type" in
3371                         '') ;;
3372                         *)
3373                                 if test "$fastread" = yes; then
3374                                         dflt=y
3375                                 else
3376                                         dflt=n
3377                                 fi
3378                                 rp="$what $value doesn't exist.  Use that name anyway?"
3379                                 . UU/myread
3380                                 dflt=''
3381                                 case "$ans" in
3382                                 y*) type='';;
3383                                 *) echo " ";;
3384                                 esac
3385                                 ;;
3386                         esac
3387                         ;;
3388                 esac
3389                 ;;
3390         esac
3391 done
3392 cd UU
3393 ans="$value"
3394 rp="$orig_rp"
3395 dflt="$orig_dflt"
3396 rm -f getfile.ok
3397 test "X$gfpthkeep" != Xy && gfpth=""
3398 EOSC
3399
3400 : What should the include directory be ?
3401 echo " "
3402 $echo $n "Hmm...  $c"
3403 dflt='/usr/include'
3404 incpath=''
3405 mips_type=''
3406 if $test -f /bin/mips && /bin/mips; then
3407         echo "Looks like a MIPS system..."
3408         $cat >usr.c <<'EOCP'
3409 #ifdef SYSTYPE_BSD43
3410 /bsd43
3411 #endif
3412 EOCP
3413         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3414                 dflt='/bsd43/usr/include'
3415                 incpath='/bsd43'
3416                 mips_type='BSD 4.3'
3417         else
3418                 mips_type='System V'
3419         fi
3420         $rm -f usr.c usr.out
3421         echo "and you're compiling with the $mips_type compiler and libraries."
3422         xxx_prompt=y
3423         echo "exit 0" >mips
3424 else
3425         echo "Doesn't look like a MIPS system."
3426         xxx_prompt=n
3427         echo "exit 1" >mips
3428 fi
3429 chmod +x mips
3430 $eunicefix mips
3431 case "$usrinc" in
3432 '') ;;
3433 *) dflt="$usrinc";;
3434 esac
3435 case "$xxx_prompt" in
3436 y)      fn=d/
3437         echo " "
3438         rp='Where are the include files you want to use?'
3439         . ./getfile
3440         usrinc="$ans"
3441         ;;
3442 *)      usrinc="$dflt"
3443         ;;
3444 esac
3445
3446 : see how we invoke the C preprocessor
3447 echo " "
3448 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3449 cat <<'EOT' >testcpp.c
3450 #define ABC abc
3451 #define XYZ xyz
3452 ABC.XYZ
3453 EOT
3454 cd ..
3455 if test ! -f cppstdin; then
3456         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3457                 # AIX cc -E doesn't show the absolute headerfile
3458                 # locations but we'll cheat by using the -M flag.
3459                 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
3460         else
3461                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3462         fi
3463 else
3464         echo "Keeping your $hint cppstdin wrapper."
3465 fi
3466 chmod 755 cppstdin
3467 wrapper=`pwd`/cppstdin
3468 ok='false'
3469 cd UU
3470
3471 if $test "X$cppstdin" != "X" && \
3472         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3473         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3474 then
3475         echo "You used to use $cppstdin $cppminus so we'll use that again."
3476         case "$cpprun" in
3477         '') echo "But let's see if we can live without a wrapper..." ;;
3478         *)
3479                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3480                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3481                 then
3482                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3483                         ok='true'
3484                 else
3485                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3486                 fi
3487                 ;;
3488         esac
3489 else
3490         case "$cppstdin" in
3491         '') ;;
3492         *)
3493                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3494                 ;;
3495         esac
3496 fi
3497
3498 if $ok; then
3499         : nothing
3500 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3501         $cc -E <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         echo "Yup, it does."
3504         x_cpp="$cc -E"
3505         x_minus='';
3506 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3507         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3509         echo "Yup, it does."
3510         x_cpp="$cc -E"
3511         x_minus='-';
3512 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3513         $cc -P <testcpp.c >testcpp.out 2>&1; \
3514         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3515         echo "Yipee, that works!"
3516         x_cpp="$cc -P"
3517         x_minus='';
3518 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3519         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3520         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3521         echo "At long last!"
3522         x_cpp="$cc -P"
3523         x_minus='-';
3524 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3525         $cpp <testcpp.c >testcpp.out 2>&1; \
3526         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3527         echo "It works!"
3528         x_cpp="$cpp"
3529         x_minus='';
3530 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3531         $cpp - <testcpp.c >testcpp.out 2>&1; \
3532         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3533         echo "Hooray, it works!  I was beginning to wonder."
3534         x_cpp="$cpp"
3535         x_minus='-';
3536 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3537         $wrapper <testcpp.c >testcpp.out 2>&1; \
3538         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3539         x_cpp="$wrapper"
3540         x_minus=''
3541         echo "Eureka!"
3542 else
3543         dflt=''
3544         rp="No dice.  I can't find a C preprocessor.  Name one:"
3545         . ./myread
3546         x_cpp="$ans"
3547         x_minus=''
3548         $x_cpp <testcpp.c >testcpp.out 2>&1
3549         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3550                 echo "OK, that will do." >&4
3551         else
3552 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3553                 exit 1
3554         fi
3555 fi
3556
3557 case "$ok" in
3558 false)
3559         cppstdin="$x_cpp"
3560         cppminus="$x_minus"
3561         cpprun="$x_cpp"
3562         cpplast="$x_minus"
3563         set X $x_cpp
3564         shift
3565         case "$1" in
3566         "$cpp")
3567                 echo "Perhaps can we force $cc -E using a wrapper..."
3568                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3569                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3570                 then
3571                         echo "Yup, we can."
3572                         cppstdin="$wrapper"
3573                         cppminus='';
3574                 else
3575                         echo "Nope, we'll have to live without it..."
3576                 fi
3577                 ;;
3578         esac
3579         case "$cpprun" in
3580         "$wrapper")
3581                 cpprun=''
3582                 cpplast=''
3583                 ;;
3584         esac
3585         ;;
3586 esac
3587
3588 case "$cppstdin" in
3589 "$wrapper"|'cppstdin') ;;
3590 *) $rm -f $wrapper;;
3591 esac
3592 $rm -f testcpp.c testcpp.out
3593
3594 : Set private lib path
3595 case "$plibpth" in
3596 '') if ./mips; then
3597                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3598         fi;;
3599 esac
3600 case "$libpth" in
3601 ' ') dlist='';;
3602 '') dlist="$loclibpth $plibpth $glibpth";;
3603 *) dlist="$libpth";;
3604 esac
3605
3606 : Now check and see which directories actually exist, avoiding duplicates
3607 libpth=''
3608 for xxx in $dlist
3609 do
3610     if $test -d $xxx; then
3611                 case " $libpth " in
3612                 *" $xxx "*) ;;
3613                 *) libpth="$libpth $xxx";;
3614                 esac
3615     fi
3616 done
3617 $cat <<'EOM'
3618
3619 Some systems have incompatible or broken versions of libraries.  Among
3620 the directories listed in the question below, please remove any you
3621 know not to be holding relevant libraries, and add any that are needed.
3622 Say "none" for none.
3623
3624 EOM
3625 case "$libpth" in
3626 '') dflt='none';;
3627 *)
3628         set X $libpth
3629         shift
3630         dflt=${1+"$@"}
3631         ;;
3632 esac
3633 rp="Directories to use for library searches?"
3634 . ./myread
3635 case "$ans" in
3636 none) libpth=' ';;
3637 *) libpth="$ans";;
3638 esac
3639
3640 : compute shared library extension
3641 case "$so" in
3642 '')
3643         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3644                 dflt='sl'
3645         else
3646                 dflt='so'
3647         fi
3648         ;;
3649 *) dflt="$so";;
3650 esac
3651 $cat <<EOM
3652
3653 On some systems, shared libraries may be available.  Answer 'none' if
3654 you want to suppress searching of shared libraries for the remainder
3655 of this configuration.
3656
3657 EOM
3658 rp='What is the file extension used for shared libraries?'
3659 . ./myread
3660 so="$ans"
3661
3662 : Define several unixisms.
3663 : Hints files or command line option can be used to override them.
3664 : The convoluted testing is in case hints files set either the old
3665 : or the new name.
3666 case "$_exe" in
3667 '')     case "$exe_ext" in
3668     '') ;;
3669         *)      _exe="$exe_ext" ;;
3670         esac
3671         ;;
3672 esac
3673 case "$_a" in
3674 '')     case "$lib_ext" in
3675     '') _a='.a';;
3676         *)      _a="$lib_ext" ;;
3677         esac
3678         ;;
3679 esac
3680 case "$_o" in
3681 '') case "$obj_ext" in
3682         '')     _o='.o';;
3683         *)      _o="$obj_ext";;
3684         esac
3685         ;;
3686 esac
3687 case "$p_" in
3688 '') case "$path_sep" in
3689         '')     p_=':';;
3690         *)      p_="$path_sep";;
3691         esac
3692         ;;
3693 esac
3694 exe_ext=$_exe
3695 lib_ext=$_a
3696 obj_ext=$_o
3697 path_sep=$p_
3698
3699 : Which makefile gets called first.  This is used by make depend.
3700 case "$firstmakefile" in
3701 '') firstmakefile='makefile';;
3702 esac
3703
3704 cat <<EOM
3705
3706 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3707 Configure must be run with -Dusesocks.
3708
3709 Normally you do not need this and you should answer no.
3710
3711 EOM
3712 case "$usesocks" in
3713 $define|true|[yY]*)     dflt='y';;
3714 *) dflt='n';;
3715 esac
3716 rp='Build Perl for SOCKS?'
3717 . ./myread
3718 case "$ans" in
3719 y|Y)    val="$define" ;;     
3720 *)      val="$undef" ;;
3721 esac
3722 set usesocks
3723 eval $setvar
3724
3725 : Looking for optional libraries
3726 echo " "
3727 echo "Checking for optional libraries..." >&4
3728 case "$libs" in
3729 ' '|'') dflt='';;
3730 *) dflt="$libs";;
3731 esac
3732 case "$libswanted" in
3733 '') libswanted='c_s';;
3734 esac
3735 case "$usesocks" in
3736 $define)
3737         libswanted="$libswanted socks5 socks5_sh"
3738         ;;
3739 esac
3740 for thislib in $libswanted; do
3741         
3742         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3743                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3744                 echo "Found -l$thislib (shared)."
3745                 case " $dflt " in
3746                 *"-l$thislib "*);;
3747                 *) dflt="$dflt -l$thislib";;
3748                 esac
3749         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3750                 echo "Found -l$thislib (shared)."
3751                 case " $dflt " in
3752                 *"-l$thislib "*);;
3753                 *) dflt="$dflt -l$thislib";;
3754                 esac
3755         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3756                 echo "Found -l$thislib."
3757                 case " $dflt " in
3758                 *"-l$thislib "*);;
3759                 *) dflt="$dflt -l$thislib";;
3760                 esac
3761         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3762                 echo "Found -l$thislib."
3763                 case " $dflt " in
3764                 *"-l$thislib "*);;
3765                 *) dflt="$dflt -l$thislib";;
3766                 esac
3767         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3768                 echo "Found -l${thislib}_s."
3769                 case " $dflt " in
3770                 *"-l$thislib "*);;
3771                 *) dflt="$dflt -l${thislib}_s";;
3772                 esac
3773         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3774                 echo "Found -l$thislib."
3775                 case " $dflt " in
3776                 *"-l$thislib "*);;
3777                 *) dflt="$dflt -l$thislib";;
3778                 esac
3779         else
3780                 echo "No -l$thislib."
3781         fi
3782 done
3783 set X $dflt
3784 shift
3785 dflt="$*"
3786 case "$libs" in
3787 '') dflt="$dflt";;
3788 *) dflt="$libs";;
3789 esac
3790 case "$dflt" in
3791 ' '|'') dflt='none';;
3792 esac
3793
3794 $cat <<EOM
3795
3796 In order to compile $package on your machine, a number of libraries
3797 are usually needed.  Include any other special libraries here as well.
3798 Say "none" for none.  The default list is almost always right.
3799 EOM
3800
3801 echo " "
3802 rp="What libraries to use?"
3803 . ./myread
3804 case "$ans" in
3805 none) libs=' ';;
3806 *) libs="$ans";;
3807 esac
3808
3809 : determine optimization, if desired, or use for debug flag also
3810 case "$optimize" in
3811 ' '|$undef) dflt='none';;
3812 '') dflt='-O';;
3813 *) dflt="$optimize";;
3814 esac
3815 $cat <<EOH
3816
3817 By default, $package compiles with the -O flag to use the optimizer.
3818 Alternately, you might want to use the symbolic debugger, which uses
3819 the -g flag (on traditional Unix systems).  Either flag can be
3820 specified here.  To use neither flag, specify the word "none".
3821
3822 EOH
3823 rp="What optimizer/debugger flag should be used?"
3824 . ./myread
3825 optimize="$ans"
3826 case "$optimize" in
3827 'none') optimize=" ";;
3828 esac
3829
3830 dflt=''
3831 : We will not override a previous value, but we might want to
3832 : augment a hint file
3833 case "$hint" in
3834 default|recommended)
3835         case "$gccversion" in
3836         1*) dflt='-fpcc-struct-return' ;;
3837         esac
3838         case "$optimize" in
3839         *-g*) dflt="$dflt -DDEBUGGING";;
3840         esac
3841         case "$gccversion" in
3842         2*) if test -d /etc/conf/kconfig.d &&
3843                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3844                 then
3845                         dflt="$dflt -posix"
3846                 fi
3847                 ;;
3848         esac
3849         case "$gccversion" in
3850         1*) ;;
3851         2.[0-8]*) ;;
3852         ?*)     echo " "
3853                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3854                 echo 'int main(void) { return 0; }' > gcctest.c
3855                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3856                         echo "Yes, it does." 2>&1
3857                         case "$ccflags" in
3858                         *strict-aliasing*) 
3859                                 echo "Leaving current flags $ccflags alone." 2>&1
3860                                 ;;
3861                         *) dflt="$dflt -fno-strict-aliasing" ;;
3862                         esac
3863                 else
3864                         echo "Nope, it doesn't, but that's ok." 2>&1
3865                 fi
3866                 ;;
3867         esac
3868         ;;
3869 esac
3870
3871 case "$mips_type" in
3872 *BSD*|'') inclwanted="$locincpth $usrinc";;
3873 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3874 esac
3875 for thisincl in $inclwanted; do
3876         if $test -d $thisincl; then
3877                 if $test x$thisincl != x$usrinc; then
3878                         case "$dflt" in
3879                         *$thisincl*);;
3880                         *) dflt="$dflt -I$thisincl";;
3881                         esac
3882                 fi
3883         fi
3884 done
3885
3886 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3887         xxx=true;
3888 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3889         xxx=true;
3890 else
3891         xxx=false;
3892 fi;
3893 if $xxx; then
3894         case "$dflt" in
3895         *$2*);;
3896         *) dflt="$dflt -D$2";;
3897         esac;
3898 fi'
3899
3900 set signal.h LANGUAGE_C; eval $inctest
3901
3902 case "$usesocks" in
3903 $define)
3904         ccflags="$ccflags -DSOCKS"
3905         ;;
3906 esac
3907
3908 case "$hint" in
3909 default|recommended) dflt="$ccflags $dflt" ;;
3910 *) dflt="$ccflags";;
3911 esac
3912
3913 case "$dflt" in
3914 ''|' ') dflt=none;;
3915 esac
3916 $cat <<EOH
3917
3918 Your C compiler may want other flags.  For this question you should include
3919 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3920 but you should NOT include libraries or ld flags like -lwhatever.  If you
3921 want $package to honor its debug switch, you should include -DDEBUGGING here.
3922 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3923
3924 To use no flags, specify the word "none".
3925
3926 EOH
3927 set X $dflt
3928 shift
3929 dflt=${1+"$@"}
3930 rp="Any additional cc flags?"
3931 . ./myread
3932 case "$ans" in
3933 none) ccflags='';;
3934 *) ccflags="$ans";;
3935 esac
3936
3937 : the following weeds options from ccflags that are of no interest to cpp
3938 cppflags="$ccflags"
3939 case "$gccversion" in
3940 1*) cppflags="$cppflags -D__GNUC__"
3941 esac
3942 case "$mips_type" in
3943 '');;
3944 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3945 esac
3946 case "$cppflags" in
3947 '');;
3948 *)
3949         echo " "
3950         echo "Let me guess what the preprocessor flags are..." >&4
3951         set X $cppflags
3952         shift
3953         cppflags=''
3954         $cat >cpp.c <<'EOM'
3955 #define BLURFL foo
3956
3957 BLURFL xx LFRULB
3958 EOM
3959         previous=''
3960         for flag in $*
3961         do
3962                 case "$flag" in
3963                 -*) ftry="$flag";;
3964                 *) ftry="$previous $flag";;
3965                 esac
3966                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3967                         >cpp1.out 2>/dev/null && \
3968                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3969                         >cpp2.out 2>/dev/null && \
3970                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3971                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3972                 then
3973                         cppflags="$cppflags $ftry"
3974                         previous=''
3975                 else
3976                         previous="$flag"
3977                 fi
3978         done
3979         set X $cppflags
3980         shift
3981         cppflags=${1+"$@"}
3982         case "$cppflags" in
3983         *-*)  echo "They appear to be: $cppflags";;
3984         esac
3985         $rm -f cpp.c cpp?.out
3986         ;;
3987 esac
3988
3989 : flags used in final linking phase
3990 case "$ldflags" in
3991 '') if ./venix; then
3992                 dflt='-i -z'
3993         else
3994                 dflt=''
3995         fi
3996         case "$ccflags" in
3997         *-posix*) dflt="$dflt -posix" ;;
3998         esac
3999         ;;
4000 *) dflt="$ldflags";;
4001 esac
4002
4003 : Try to guess additional flags to pick up local libraries.
4004 for thislibdir in $libpth; do
4005         case " $loclibpth " in
4006         *" $thislibdir "*)
4007                 case "$dflt " in 
4008                 *"-L$thislibdir "*) ;;
4009                 *)  dflt="$dflt -L$thislibdir" ;;
4010                 esac
4011                 ;;
4012         esac
4013 done
4014
4015 case "$dflt" in
4016 '') dflt='none' ;;
4017 esac
4018
4019 $cat <<EOH
4020
4021 Your C linker may need flags.  For this question you should
4022 include -L/whatever and any other flags used by the C linker, but you
4023 should NOT include libraries like -lwhatever.
4024
4025 Make sure you include the appropriate -L/path flags if your C linker
4026 does not normally search all of the directories you specified above,
4027 namely
4028         $libpth
4029 To use no flags, specify the word "none".
4030
4031 EOH
4032
4033 rp="Any additional ld flags (NOT including libraries)?"
4034 . ./myread
4035 case "$ans" in
4036 none) ldflags='';;
4037 *) ldflags="$ans";;
4038 esac
4039 rmlist="$rmlist pdp11"
4040
4041 : coherency check
4042 echo " "
4043 echo "Checking your choice of C compiler and flags for coherency..." >&4
4044 $cat > try.c <<'EOF'
4045 #include <stdio.h>
4046 int main() { printf("Ok\n"); exit(0); }
4047 EOF
4048 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4049 shift
4050 $cat >try.msg <<'EOM'
4051 I've tried to compile and run the following simple program:
4052
4053 EOM
4054 $cat try.c >> try.msg
4055
4056 $cat >> try.msg <<EOM
4057
4058 I used the command:
4059
4060         $*
4061         ./try
4062
4063 and I got the following output:
4064
4065 EOM
4066 dflt=y
4067 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4068         if sh -c './try' >>try.msg 2>&1; then
4069                 xxx=`./try`
4070                 case "$xxx" in
4071                 "Ok") dflt=n ;;
4072                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4073                         case " $libs " in
4074                         *" -lsfio "*)
4075                                 cat >> try.msg <<'EOQS'
4076 If $libs contains -lsfio, and sfio is mis-configured, then it
4077 sometimes (apparently) runs and exits with a 0 status, but with no
4078 output!  It may have to do with sfio's use of _exit vs. exit.
4079
4080 EOQS
4081                                 rp="You have a big problem.  Shall I abort Configure"
4082                                 dflt=y
4083                                 ;;
4084                         esac
4085                         ;;
4086                 esac
4087         else
4088                 echo "The program compiled OK, but exited with status $?." >>try.msg
4089                 rp="You have a problem.  Shall I abort Configure"
4090                 dflt=y
4091         fi
4092 else
4093         echo "I can't compile the test program." >>try.msg
4094         rp="You have a BIG problem.  Shall I abort Configure"
4095         dflt=y
4096 fi
4097 case "$dflt" in
4098 y)
4099         $cat try.msg >&4
4100         case "$knowitall" in
4101         '')
4102                 echo "(The supplied flags or libraries might be incorrect.)"
4103                 ;;
4104         *) dflt=n;;
4105         esac
4106         echo " "
4107         . ./myread
4108         case "$ans" in
4109         n*|N*) ;;
4110         *)      echo "Ok.  Stopping Configure." >&4
4111                 exit 1
4112                 ;;
4113         esac
4114         ;;
4115 n) echo "OK, that should do.";;
4116 esac
4117 $rm -f try try.* core
4118
4119 : define an is-a-typedef? function
4120 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4121 case "$inclist" in
4122 "") inclist="sys/types.h";;
4123 esac;
4124 eval "varval=\$$var";
4125 case "$varval" in
4126 "")
4127         $rm -f temp.c;
4128         for inc in $inclist; do
4129                 echo "#include <$inc>" >>temp.c;
4130         done;
4131         echo "#ifdef $type" >> temp.c;
4132         echo "printf(\"We have $type\");" >> temp.c;
4133         echo "#endif" >> temp.c;
4134         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4135         if $contains $type temp.E >/dev/null 2>&1; then
4136                 eval "$var=\$type";
4137         else
4138                 eval "$var=\$def";
4139         fi;
4140         $rm -f temp.?;;
4141 *) eval "$var=\$varval";;
4142 esac'
4143
4144 : define an is-a-typedef? function that prompts if the type is not available.
4145 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4146 case "$inclist" in
4147 "") inclist="sys/types.h";;
4148 esac;
4149 eval "varval=\$$var";
4150 case "$varval" in
4151 "")
4152         $rm -f temp.c;
4153         for inc in $inclist; do
4154                 echo "#include <$inc>" >>temp.c;
4155         done;
4156         echo "#ifdef $type" >> temp.c;
4157         echo "printf(\"We have $type\");" >> temp.c;
4158         echo "#endif" >> temp.c;
4159         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4160         echo " " ;
4161         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4162         if $contains $type temp.E >/dev/null 2>&1; then
4163                 echo "$type found." >&4;
4164                 eval "$var=\$type";
4165         else
4166                 echo "$type NOT found." >&4;
4167                 dflt="$def";
4168                 . ./myread ;
4169                 eval "$var=\$ans";
4170         fi;
4171         $rm -f temp.?;;
4172 *) eval "$var=\$varval";;
4173 esac'
4174
4175 : define a shorthand compile call
4176 compile='
4177 mc_file=$1;
4178 shift;
4179 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4180 : define a shorthand compile call for compilations that should be ok.
4181 compile_ok='
4182 mc_file=$1;
4183 shift;
4184 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4185
4186 : check for lengths of integral types
4187 echo " "
4188 case "$intsize" in
4189 '')
4190         echo "Checking to see how big your integers are..." >&4
4191         $cat >intsize.c <<'EOCP'
4192 #include <stdio.h>
4193 int main()
4194 {
4195         printf("intsize=%d;\n", (int)sizeof(int));
4196         printf("longsize=%d;\n", (int)sizeof(long));
4197         printf("shortsize=%d;\n", (int)sizeof(short));
4198         exit(0);
4199 }
4200 EOCP
4201         set intsize
4202         if eval $compile_ok && ./intsize > /dev/null; then
4203                 eval `./intsize`
4204                 echo "Your integers are $intsize bytes long."
4205                 echo "Your long integers are $longsize bytes long."
4206                 echo "Your short integers are $shortsize bytes long."
4207         else
4208                 $cat >&4 <<EOM
4209 !
4210 Help! I can't compile and run the intsize test program: please enlighten me!
4211 (This is probably a misconfiguration in your system or libraries, and
4212 you really ought to fix it.  Still, I'll try anyway.)
4213 !
4214 EOM
4215                 dflt=4
4216                 rp="What is the size of an integer (in bytes)?"
4217                 . ./myread
4218                 intsize="$ans"
4219                 dflt=$intsize
4220                 rp="What is the size of a long integer (in bytes)?"
4221                 . ./myread
4222                 longsize="$ans"
4223                 dflt=2
4224                 rp="What is the size of a short integer (in bytes)?"
4225                 . ./myread
4226                 shortsize="$ans"
4227         fi
4228         ;;
4229 esac
4230 $rm -f intsize intsize.*
4231
4232 : see what type lseek is declared as in the kernel
4233 rp="What is the type used for lseek's offset on this system?"
4234 set off_t lseektype long stdio.h sys/types.h
4235 eval $typedef_ask
4236
4237 echo " "
4238 $echo $n "Checking to see how big your file offsets are...$c" >&4
4239 $cat >try.c <<EOCP
4240 #include <sys/types.h>
4241 #include <stdio.h>
4242 int main()
4243 {
4244     printf("%d\n", (int)sizeof($lseektype));
4245     return(0); 
4246 }
4247 EOCP
4248 set try
4249 if eval $compile_ok; then
4250         lseeksize=`./try`
4251         $echo " $lseeksize bytes." >&4
4252 else
4253         dflt=$longsize
4254         echo " "
4255         echo "(I can't seem to compile the test program.  Guessing...)"
4256         rp="What is the size of your file offsets (in bytes)?"
4257         . ./myread
4258         lseeksize="$ans"
4259 fi
4260 $rm -f try.c try
4261
4262 : see what type file positions are declared as in the library
4263 rp="What is the type for file position used by fsetpos()?"
4264 set fpos_t fpostype long stdio.h sys/types.h
4265 eval $typedef_ask
4266
4267 echo " "
4268 case "$fpostype" in
4269 *_t) zzz="$fpostype"    ;;
4270 *)   zzz="fpos_t"       ;;
4271 esac
4272 $echo $n "Checking the size of $zzz...$c" >&4 
4273 cat > try.c <<EOCP
4274 #include <sys/types.h>
4275 #include <stdio.h>
4276 int main() {
4277     printf("%d\n", (int)sizeof($fpostype));
4278     exit(0);
4279 }
4280 EOCP
4281 set try
4282 if eval $compile_ok; then
4283         yyy=`./try`
4284         case "$yyy" in
4285         '')     fpossize=4
4286                 echo " "
4287                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4288                 ;;
4289         *)      fpossize=$yyy
4290                 echo " $fpossize bytes."
4291                 ;;
4292         esac
4293 else
4294         dflt="$longsize"
4295         echo " "
4296         echo "(I can't compile the test program.  Guessing...)" >&4
4297         rp="What is the size of your file positions (in bytes)?"
4298         . ./myread
4299         fpossize="$ans"
4300 fi
4301
4302
4303
4304 case "$lseeksize:$fpossize" in
4305 8:8) cat <<EOM
4306
4307 You can have files larger than 2 gigabytes.
4308 EOM
4309    val="$define" ;;
4310 *) cat <<EOM
4311
4312 Perl can be built to understand large files (files larger than 2 gigabytes)
4313 on some systems.  To do so, Configure must be run with -Duselargefiles.
4314
4315 If this doesn't make any sense to you, just accept the default 'y'.
4316 EOM
4317    case "$uselargefiles" in
4318    "$undef"|false|[nN]*) dflt='n' ;;
4319    *)   dflt='y' ;;
4320    esac
4321    rp='Try to understand large files, if available?'
4322    . ./myread
4323    case "$ans" in
4324    y|Y)         val="$define" ;;
4325    *)           val="$undef"  ;;
4326    esac
4327    ;;
4328 esac
4329 set uselargefiles
4330 eval $setvar
4331 case "$uselargefiles" in
4332 "$define")
4333 : Look for a hint-file generated 'call-back-unit'.  If the
4334 : user has specified that a large files perl is to be built,
4335 : we may need to set or change some other defaults.
4336         if $test -f uselfs.cbu; then
4337                 echo "Your platform has some specific hints for large file builds, using them..."
4338                 . ./uselfs.cbu
4339                 echo " "
4340                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4341                 $cat >try.c <<EOCP
4342 #include <sys/types.h>
4343 #include <stdio.h>
4344 int main()
4345 {
4346     printf("%d\n", (int)sizeof($lseektype));
4347     return(0); 
4348 }
4349 EOCP
4350                 set try
4351                 if eval $compile_ok; then
4352                         lseeksize=`./try`
4353                         $echo " $lseeksize bytes." >&4
4354                 else
4355                         dflt="$lseeksize"
4356                         echo " "
4357                         echo "(I can't seem to compile the test program.  Guessing...)"
4358                         rp="What is the size of your file offsets (in bytes)?"
4359                         . ./myread
4360                         lseeksize="$ans"
4361                 fi
4362                 case "$fpostype" in
4363                 *_t) zzz="$fpostype"    ;;
4364                 *)   zzz="fpos_t"       ;;
4365                 esac
4366                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4367                 $cat > try.c <<EOCP
4368 #include <sys/types.h>
4369 #include <stdio.h>
4370 int main() {
4371     printf("%d\n", (int)sizeof($fpostype));
4372     exit(0);
4373 }
4374 EOCP
4375                 set try
4376                 if eval $compile_ok; then
4377                         yyy=`./try`
4378                         dflt="$lseeksize"
4379                         case "$yyy" in
4380                         '')     echo " "
4381                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4382                                 ;;
4383                         *)      fpossize=$yyy
4384                                 echo " $fpossize bytes."
4385                                 ;;
4386                         esac
4387                 else
4388                         dflt="$fpossize"
4389                         echo " "
4390                         echo "(I can't compile the test program.  Guessing...)" >&4
4391                         rp="What is the size of your file positions (in bytes)?"
4392                         . ./myread
4393                         fpossize="$ans"
4394                 fi
4395                 $rm -f try.c try
4396         fi
4397         ;;
4398 esac
4399
4400
4401 case "$usemorebits" in
4402 "$define"|true|[yY]*)
4403         use64bits="$define"
4404         uselongdouble="$define"
4405         usemorebits="$define"
4406         ;;
4407 *)      usemorebits="$undef"
4408         ;;
4409 esac
4410
4411
4412 case "$intsize:$longsize" in
4413 8:*|*:8) cat <<EOM
4414
4415 You have natively 64-bit integers.
4416 EOM
4417    val="$define" ;;
4418 *) cat <<EOM
4419
4420 Perl can be built to take advantage of 64-bit integer types
4421 on some systems.  To do so, Configure must be run with -Duse64bits.
4422
4423 If this doesn't make any sense to you, just accept the default.
4424 EOM
4425   case "$use64bits" in
4426   $define|true|[yY]*)   dflt='y';;
4427   *) dflt='n';;
4428   esac
4429   rp='Try to use 64-bit integers, if available?'
4430   . ./myread
4431   case "$ans" in
4432   y|Y) val="$define" ;;
4433   *)   val="$undef"  ;;
4434   esac
4435   ;;
4436 esac
4437 set use64bits
4438 eval $setvar
4439
4440 case "$archname64" in
4441 '') archname64='' ;;    # not a typo
4442 esac
4443
4444 case "$use64bits" in
4445 "$define"|true|[yY]*)
4446 : Look for a hint-file generated 'call-back-unit'.  If the
4447 : user has specified that a 64-bit perl is to be built,
4448 : we may need to set or change some other defaults.
4449         if $test -f use64bits.cbu; then
4450                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4451                 . ./use64bits.cbu
4452         else
4453                 $cat <<EOM
4454 (Your platform doesn't have any specific hints for 64-bit builds.)
4455 EOM
4456                 case "$intsize:$longsize" in
4457 8:*|*:8) cat <<EOM
4458 (This is probably okay, as your system is a natively 64-bit system.)
4459 EOM
4460                   ;;
4461                 esac
4462                 case "$gccversion" in
4463                 '')     ;;
4464                 *)      case "$ccflags" in
4465                         *-DUSE_LONG_LONG*) ;;
4466                         *) $cat <<EOM
4467 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4468 to the compilation flags.
4469 EOM
4470                            ccflags="$ccflags -DUSE_LONG_LONG"
4471                            ;;
4472                         esac
4473                         ;;
4474                 esac
4475         fi
4476         ;;
4477 esac
4478
4479 : determine the architecture name
4480 echo " "
4481 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4482         tarch=`arch`"-$osname"
4483 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4484         if uname -m > tmparch 2>&1 ; then
4485                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4486                         -e 's/$/'"-$osname/" tmparch`
4487         else
4488                 tarch="$osname"
4489         fi
4490         $rm -f tmparch
4491 else
4492         tarch="$osname"
4493 fi
4494 case "$myarchname" in
4495 ''|"$tarch") ;;
4496 *)
4497         echo "(Your architecture name used to be $myarchname.)"
4498         archname=''
4499         ;;
4500 esac
4501 myarchname="$tarch"
4502 case "$archname" in
4503 '') dflt="$tarch";;
4504 *) dflt="$archname";;
4505 esac
4506 rp='What is your architecture name'
4507 . ./myread
4508 archname="$ans"
4509 case "$usethreads" in
4510 $define)
4511         echo "Threads selected." >&4
4512         case "$archname" in
4513         *-thread*) echo "...and architecture name already has -thread." >&4
4514                 ;;
4515         *)      archname="$archname-thread"
4516                 echo "...setting architecture name to $archname." >&4
4517                 ;;
4518         esac
4519         ;;
4520 esac
4521 case "$usemultiplicity" in
4522 $define)
4523         echo "Multiplicity selected." >&4
4524         case "$archname" in
4525         *-multi*) echo "...and architecture name already has -multi." >&4
4526                 ;;
4527         *)      archname="$archname-multi"
4528                 echo "...setting architecture name to $archname." >&4
4529                 ;;
4530         esac
4531         ;;
4532 esac
4533 case "$use64bits" in
4534 $define)
4535         case "$archname64" in
4536         '')
4537                 ;;
4538         *)
4539                 case "$archname" in
4540                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4541                         ;;
4542                 *)      archname="$archname-$archname64"
4543                         echo "...setting architecture name to $archname." >&4
4544                         ;;
4545                 esac
4546                 ;;
4547         esac
4548 esac
4549
4550 : determine root of directory hierarchy where package will be installed.
4551 case "$prefix" in
4552 '')
4553         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4554         ;;
4555 *)
4556         dflt="$prefix"
4557         ;;
4558 esac
4559 $cat <<EOM
4560
4561 By default, $package will be installed in $dflt/bin, manual pages
4562 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4563 installation directories. Typically this is something like /usr/local.
4564 If you wish to have binaries under /usr/bin but other parts of the
4565 installation under /usr/local, that's ok: you will be prompted
4566 separately for each of the installation directories, the prefix being
4567 only used to set the defaults.
4568
4569 EOM
4570 fn=d~
4571 rp='Installation prefix to use?'
4572 . ./getfile
4573 oldprefix=''
4574 case "$prefix" in
4575 '') ;;
4576 *)
4577         case "$ans" in
4578         "$prefix") ;;
4579         *) oldprefix="$prefix";;
4580         esac
4581         ;;
4582 esac
4583 prefix="$ans"
4584 prefixexp="$ansexp"
4585
4586 : is AFS running?
4587 echo " "
4588 case "$afs" in
4589 $define|true)   afs=true ;;
4590 $undef|false)   afs=false ;;
4591 *)      if test -d /afs; then
4592                 afs=true
4593         else
4594                 afs=false
4595         fi
4596         ;;
4597 esac
4598 if $afs; then
4599         echo "AFS may be running... I'll be extra cautious then..." >&4
4600 else
4601         echo "AFS does not seem to be running..." >&4
4602 fi
4603
4604 : determine installation prefix for where package is to be installed.
4605 if $afs; then 
4606 $cat <<EOM
4607
4608 Since you are running AFS, I need to distinguish the directory in which
4609 files will reside from the directory in which they are installed (and from
4610 which they are presumably copied to the former directory by occult means).
4611
4612 EOM
4613         case "$installprefix" in
4614         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4615         *) dflt="$installprefix";;
4616         esac
4617 else
4618 $cat <<EOM
4619
4620 In some special cases, particularly when building $package for distribution,
4621 it is convenient to distinguish between the directory in which files should 
4622 be installed from the directory ($prefix) in which they 
4623 will eventually reside.  For most users, these two directories are the same.
4624
4625 EOM
4626         case "$installprefix" in
4627         '') dflt=$prefix ;;
4628         *) dflt=$installprefix;;
4629         esac
4630 fi
4631 fn=d~
4632 rp='What installation prefix should I use for installing files?'
4633 . ./getfile
4634 installprefix="$ans"
4635 installprefixexp="$ansexp"
4636
4637 : set the prefixit variable, to compute a suitable default value
4638 prefixit='case "$3" in
4639 ""|none)
4640         case "$oldprefix" in
4641         "") eval "$1=\"\$$2\"";;
4642         *)
4643                 case "$3" in
4644                 "") eval "$1=";;
4645                 none)
4646                         eval "tp=\"\$$2\"";
4647                         case "$tp" in
4648                         ""|" ") eval "$1=\"\$$2\"";;
4649                         *) eval "$1=";;
4650                         esac;;
4651                 esac;;
4652         esac;;
4653 *)
4654         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4655         case "$tp" in
4656         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4657         /*-$oldprefix/*|\~*-$oldprefix/*)
4658                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4659         *) eval "$1=\"\$$2\"";;
4660         esac;;
4661 esac'
4662
4663 : set the base revision
4664 baserev=5.0
4665
4666
4667 : get the patchlevel
4668 echo " "
4669 echo "Getting the current patchlevel..." >&4
4670 if $test -r $rsrc/patchlevel.h;then
4671         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4672         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4673         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4674         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4675         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4676 else
4677         patchlevel=0
4678         subversion=0
4679         api_revision=0
4680         api_version=0
4681         api_subversion=0
4682 fi
4683 $echo $n "(You have $package" $c
4684 case "$package" in
4685 "*$baserev")    ;;
4686 *)              $echo $n " $baserev" $c ;;
4687 esac
4688 $echo $n " patchlevel $patchlevel" $c
4689 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4690 echo ".)"
4691 case "$osname" in
4692 dos|vms)
4693         : XXX Should be a Configure test for double-dots in filenames.
4694         version=`echo $baserev $patchlevel $subversion | \
4695                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4696         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4697                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4698         ;;
4699 *)
4700         version=`echo $baserev $patchlevel $subversion | \
4701                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4702         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4703                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4704         ;;
4705 esac
4706 : Special case the 5.005_xx maintenance series, which used 5.005
4707 : without any subversion label as a subdirectory in $sitelib
4708 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4709         api_versionstring='5.005'
4710 fi
4711
4712 : determine installation style
4713 : For now, try to deduce it from prefix unless it is already set.
4714 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4715 case "$installstyle" in
4716 '')     case "$prefix" in
4717                 *perl*) dflt='lib';;
4718                 *) dflt='lib/perl5' ;;
4719         esac
4720         ;;
4721 *)      dflt='lib/perl5' ;;
4722 esac
4723 : Probably not worth prompting for this since we prompt for all
4724 : the directories individually, and the prompt would be too long and
4725 : confusing anyway.
4726 installstyle=$dflt
4727
4728 : determine where private library files go
4729 : Usual default is /usr/local/lib/perl5/$version.
4730 : Also allow things like /opt/perl/lib/$version, since 
4731 : /opt/perl/lib/perl5... would be redundant.
4732 : The default "style" setting is made in installstyle.U
4733 case "$installstyle" in
4734 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4735 *)       set dflt privlib lib/$version ;;
4736 esac
4737 eval $prefixit
4738 $cat <<EOM
4739
4740 There are some auxiliary files for $package that need to be put into a
4741 private library directory that is accessible by everyone.
4742
4743 EOM
4744 fn=d~+
4745 rp='Pathname where the private library files will reside?'
4746 . ./getfile
4747 privlib="$ans"
4748 privlibexp="$ansexp"
4749 : Change installation prefix, if necessary.
4750 if $test X"$prefix" != X"$installprefix"; then
4751         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4752 else
4753         installprivlib="$privlibexp"
4754 fi
4755
4756 : set the prefixup variable, to restore leading tilda escape
4757 prefixup='case "$prefixexp" in
4758 "$prefix") ;;
4759 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4760 esac'
4761
4762 : determine where public architecture dependent libraries go
4763 set archlib archlib
4764 eval $prefixit
4765 : privlib default is /usr/local/lib/$package/$version
4766 : archlib default is /usr/local/lib/$package/$version/$archname
4767 : privlib may have an optional trailing /share.
4768 tdflt=`echo $privlib | $sed 's,/share$,,'`
4769 tdflt=$tdflt/$archname
4770 case "$archlib" in
4771 '')     dflt=$tdflt
4772         ;;
4773 *)      dflt="$archlib"
4774     ;;
4775 esac
4776 $cat <<EOM
4777
4778 $spackage contains architecture-dependent library files.  If you are
4779 sharing libraries in a heterogeneous environment, you might store
4780 these files in a separate location.  Otherwise, you can just include
4781 them with the rest of the public library files.
4782
4783 EOM
4784 fn=d+~
4785 rp='Where do you want to put the public architecture-dependent libraries?'
4786 . ./getfile
4787 archlib="$ans"
4788 archlibexp="$ansexp"
4789 if $test X"$archlib" = X"$privlib"; then
4790         d_archlib="$undef"
4791 else
4792         d_archlib="$define"
4793 fi
4794 : Change installation prefix, if necessary.
4795 if $test X"$prefix" != X"$installprefix"; then
4796         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4797 else
4798         installarchlib="$archlibexp"
4799 fi
4800
4801
4802 : Binary compatibility with 5.005 is not possible for builds
4803 : with advanced features
4804 case "$usethreads$usemultiplicity" in
4805 *define*)
4806         bincompat5005="$undef"
4807         d_bincompat5005="$undef"
4808         ;;
4809 *)      $cat <<EOM
4810
4811 Perl 5.006 can be compiled for binary compatibility with 5.005.
4812 If you decide to do so, you will be able to continue using most
4813 of the extensions that were compiled for Perl 5.005.
4814
4815 EOM
4816         case "$bincompat5005$d_bincompat5005" in
4817         *"$undef"*) dflt=n ;;
4818         *) dflt=y ;;
4819         esac
4820         rp='Binary compatibility with Perl 5.005?'
4821         . ./myread
4822         case "$ans" in
4823         y*) val="$define" ;;
4824         *)  val="$undef" ;;
4825         esac
4826         set d_bincompat5005
4827         eval $setvar
4828         case "$d_bincompat5005" in
4829         "$define")
4830                 bincompat5005="$define"
4831                 ;;
4832         *)      bincompat5005="$undef"
4833                 d_bincompat5005="$undef"
4834                 ;;
4835         esac
4836         ;;
4837 esac
4838
4839
4840 : see if setuid scripts can be secure
4841 $cat <<EOM
4842
4843 Some kernels have a bug that prevents setuid #! scripts from being
4844 secure.  Some sites have disabled setuid #! scripts because of this.
4845
4846 First let's decide if your kernel supports secure setuid #! scripts.
4847 (If setuid #! scripts would be secure but have been disabled anyway,
4848 don't say that they are secure if asked.)
4849
4850 EOM
4851
4852 val="$undef"
4853 if $test -d /dev/fd; then
4854         echo "#!$ls" >reflect
4855         chmod +x,u+s reflect
4856         ./reflect >flect 2>&1
4857         if $contains "/dev/fd" flect >/dev/null; then
4858                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4859                 val="$define"
4860         else
4861                 $cat <<EOM
4862 If you are not sure if they are secure, I can check but I'll need a
4863 username and password different from the one you are using right now.
4864 If you don't have such a username or don't want me to test, simply
4865 enter 'none'.
4866
4867 EOM
4868                 rp='Other username to test security of setuid scripts with?'
4869                 dflt='none'
4870                 . ./myread
4871                 case "$ans" in
4872                 n|none)
4873                         case "$d_suidsafe" in
4874                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4875                                 dflt=n;;
4876                         "$undef")
4877                                 echo "Well, the $hint value is *not* secure." >&4
4878                                 dflt=n;;
4879                         *)      echo "Well, the $hint value *is* secure." >&4
4880                                 dflt=y;;
4881                         esac
4882                         ;;
4883                 *)
4884                         $rm -f reflect flect
4885                         echo "#!$ls" >reflect
4886                         chmod +x,u+s reflect
4887                         echo >flect
4888                         chmod a+w flect
4889                         echo '"su" will (probably) prompt you for '"$ans's password."
4890                         su $ans -c './reflect >flect'
4891                         if $contains "/dev/fd" flect >/dev/null; then
4892                                 echo "Okay, it looks like setuid scripts are secure." >&4
4893                                 dflt=y
4894                         else
4895                                 echo "I don't think setuid scripts are secure." >&4
4896                                 dflt=n
4897                         fi
4898                         ;;
4899                 esac
4900                 rp='Does your kernel have *secure* setuid scripts?'
4901                 . ./myread
4902                 case "$ans" in
4903                 [yY]*)  val="$define";;
4904                 *)      val="$undef";;
4905                 esac
4906         fi
4907 else
4908         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4909         echo "(That's for file descriptors, not floppy disks.)"
4910         val="$undef"
4911 fi
4912 set d_suidsafe
4913 eval $setvar
4914
4915 $rm -f reflect flect
4916
4917 : now see if they want to do setuid emulation
4918 echo " "
4919 val="$undef"
4920 case "$d_suidsafe" in
4921 "$define")
4922         val="$undef"
4923         echo "No need to emulate SUID scripts since they are secure here." >& 4
4924         ;;
4925 *)
4926         $cat <<EOM
4927 Some systems have disabled setuid scripts, especially systems where
4928 setuid scripts cannot be secure.  On systems where setuid scripts have
4929 been disabled, the setuid/setgid bits on scripts are currently
4930 useless.  It is possible for $package to detect those bits and emulate
4931 setuid/setgid in a secure fashion.  This emulation will only work if
4932 setuid scripts have been disabled in your kernel.
4933
4934 EOM
4935         case "$d_dosuid" in
4936         "$define") dflt=y ;;
4937         *) dflt=n ;;
4938         esac
4939         rp="Do you want to do setuid/setgid emulation?"
4940         . ./myread
4941         case "$ans" in
4942         [yY]*)  val="$define";;
4943         *)      val="$undef";;
4944         esac
4945         ;;
4946 esac
4947 set d_dosuid
4948 eval $setvar
4949
4950 : determine filename position in cpp output
4951 echo " "
4952 echo "Computing filename position in cpp output for #include directives..." >&4
4953 echo '#include <stdio.h>' > foo.c
4954 $cat >fieldn <<EOF
4955 $startsh
4956 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4957 $grep '^[       ]*#.*stdio\.h' | \
4958 while read cline; do
4959         pos=1
4960         set \$cline
4961         while $test \$# -gt 0; do
4962                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4963                         echo "\$pos"
4964                         exit 0
4965                 fi
4966                 shift
4967                 pos=\`expr \$pos + 1\`
4968         done
4969 done
4970 EOF
4971 chmod +x fieldn
4972 fieldn=`./fieldn`
4973 $rm -f foo.c fieldn
4974 case $fieldn in
4975 '') pos='???';;
4976 1) pos=first;;
4977 2) pos=second;;
4978 3) pos=third;;
4979 *) pos="${fieldn}th";;
4980 esac
4981 echo "Your cpp writes the filename in the $pos field of the line."
4982
4983 : locate header file
4984 $cat >findhdr <<EOF
4985 $startsh
4986 wanted=\$1
4987 name=''
4988 for usrincdir in $usrinc
4989 do
4990         if test -f \$usrincdir/\$wanted; then
4991                 echo "\$usrincdir/\$wanted"
4992                 exit 0
4993         fi
4994 done
4995 awkprg='{ print \$$fieldn }'
4996 echo "#include <\$wanted>" > foo\$\$.c
4997 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4998 $grep "^[       ]*#.*\$wanted" | \
4999 while read cline; do
5000         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5001         case "\$name" in
5002         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5003         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5004         *) exit 2;;
5005         esac;
5006 done;
5007 #
5008 # status = 0: grep returned 0 lines, case statement not executed
5009 # status = 1: headerfile found
5010 # status = 2: while loop executed, no headerfile found
5011 #
5012 status=\$?
5013 $rm -f foo\$\$.c;
5014 if test \$status -eq 1; then
5015         exit 0;
5016 fi
5017 exit 1
5018 EOF
5019 chmod +x findhdr
5020
5021 : define an alternate in-header-list? function
5022 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5023 cont=true; xxf="echo \"<\$1> found.\" >&4";
5024 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5025 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5026 esac;
5027 case $# in 4) instead=instead;; *) instead="at last";; esac;
5028 while $test "$cont"; do
5029         xxx=`./findhdr $1`
5030         var=$2; eval "was=\$$2";
5031         if $test "$xxx" && $test -r "$xxx";
5032         then eval $xxf;
5033         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5034                 cont="";
5035         else eval $xxnf;
5036         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5037         set $yyy; shift; shift; yyy=$@;
5038         case $# in 0) cont="";;
5039         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5040                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5041         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5042                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5043         esac;
5044 done;
5045 while $test "$yyy";
5046 do set $yyy; var=$2; eval "was=\$$2";
5047         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5048         set $yyy; shift; shift; yyy=$@;
5049 done'
5050
5051 : see if this is a malloc.h system
5052 set malloc.h i_malloc
5053 eval $inhdr
5054
5055 : see if stdlib is available
5056 set stdlib.h i_stdlib
5057 eval $inhdr
5058
5059 : determine which malloc to compile in
5060 echo " "
5061 case "$usemymalloc" in
5062 ''|[yY]*|true|$define)  dflt='y' ;;
5063 *)      dflt='n' ;;
5064 esac
5065 rp="Do you wish to attempt to use the malloc that comes with $package?"
5066 . ./myread
5067 usemymalloc="$ans"
5068 case "$ans" in
5069 y*|true)
5070         usemymalloc='y'
5071         mallocsrc='malloc.c'
5072         mallocobj="malloc$_o"
5073         d_mymalloc="$define"
5074         case "$libs" in
5075         *-lmalloc*)
5076                 : Remove malloc from list of libraries to use
5077                 echo "Removing unneeded -lmalloc from library list" >&4
5078                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5079                 shift
5080                 libs="$*"
5081                 echo "libs = $libs" >&4
5082                 ;;
5083         esac
5084         ;;
5085 *)
5086         usemymalloc='n'
5087         mallocsrc=''
5088         mallocobj=''
5089         d_mymalloc="$undef"
5090         ;;
5091 esac
5092
5093 : compute the return types of malloc and free
5094 echo " "
5095 $cat >malloc.c <<END
5096 #$i_malloc I_MALLOC
5097 #$i_stdlib I_STDLIB
5098 #include <stdio.h>
5099 #include <sys/types.h>
5100 #ifdef I_MALLOC
5101 #include <malloc.h>
5102 #endif
5103 #ifdef I_STDLIB
5104 #include <stdlib.h>
5105 #endif
5106 #ifdef TRY_MALLOC
5107 void *malloc();
5108 #endif
5109 #ifdef TRY_FREE
5110 void free();
5111 #endif
5112 END
5113 case "$malloctype" in
5114 '')
5115         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5116                 malloctype='void *'
5117         else
5118                 malloctype='char *'
5119         fi
5120         ;;
5121 esac
5122 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5123
5124 case "$freetype" in
5125 '')
5126         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5127                 freetype='void'
5128         else
5129                 freetype='int'
5130         fi
5131         ;;
5132 esac
5133 echo "Your system uses $freetype free(), it would seem." >&4
5134 $rm -f malloc.[co]
5135 $cat <<EOM
5136
5137 The installation process will also create a directory for
5138 vendor-supplied add-ons.  Vendors who supply perl with their system
5139 may find it convenient to place all vendor-supplied files in this
5140 directory rather than in the main distribution directory.  This will
5141 ease upgrades between binary-compatible maintenance versions of perl.
5142
5143 Of course you may also use these directories in whatever way you see
5144 fit.  For example, you might use them to access modules shared over a
5145 company-wide network.
5146
5147 The default answer should be fine for most people.
5148 This causes further questions about vendor add-ons to be skipped
5149 and no vendor-specific directories will be configured for perl.
5150
5151 EOM
5152 rp='Do you want to configure vendor-specific add-on directories?'
5153 case "$usevendorprefix" in
5154 define|true|[yY]*) dflt=y ;;
5155 *) dflt=n ;;
5156 esac
5157 . ./myread
5158 case "$ans" in
5159 [yY]*)  fn=d~+
5160         rp='Installation prefix to use for vendor-supplied add-ons?'
5161         case "$vendorprefix" in
5162         '') dflt='' ;;
5163         *)  dflt=$vendorprefix ;;
5164         esac
5165         . ./getfile
5166         oldvendorprefix=''
5167         case "$vendorprefix" in
5168         '') ;;
5169         *)      case "$ans" in
5170                 "$prefix") ;;
5171                 *) oldvendorprefix="$prefix";;
5172                 esac
5173                 ;;
5174         esac
5175         usevendorprefix="$define"
5176         vendorprefix="$ans"
5177         vendorprefixexp="$ansexp"
5178         ;;
5179 *)      usevendorprefix="$undef"
5180         vendorprefix=''
5181         vendorprefixexp=''
5182         ;;
5183 esac
5184
5185 case "$vendorprefix" in
5186 '')     d_vendorlib="$undef"
5187         vendorlib=''
5188         vendorlibexp=''
5189         ;;
5190 *)      d_vendorlib="$define"
5191         : determine where vendor-supplied modules go.
5192         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5193         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5194         case "$installstyle" in
5195         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5196         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5197         esac
5198         fn=d~+
5199         rp='Pathname for the vendor-supplied library files?'
5200         . ./getfile
5201         vendorlib="$ans"
5202         vendorlibexp="$ansexp"
5203         : Change installation prefix, if necessary.
5204         if $test X"$prefix" != X"$installprefix"; then
5205                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5206         else
5207                 installvendorlib="$vendorlibexp"
5208         fi
5209         ;;
5210 esac
5211
5212 : Cruising for prototypes
5213 echo " "
5214 echo "Checking out function prototypes..." >&4
5215 $cat >prototype.c <<'EOCP'
5216 int main(int argc, char *argv[]) {
5217         exit(0);}
5218 EOCP
5219 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5220         echo "Your C compiler appears to support function prototypes."
5221         val="$define"
5222 else
5223         echo "Your C compiler doesn't seem to understand function prototypes."
5224         val="$undef"
5225 fi
5226 set prototype
5227 eval $setvar
5228 $rm -f prototype*
5229
5230 case "$prototype" in
5231 "$define") ;;
5232 *)      ansi2knr='ansi2knr'
5233         echo " "
5234         cat <<EOM >&4
5235
5236 $me:  FATAL ERROR:
5237 This version of $package can only be compiled by a compiler that 
5238 understands function prototypes.  Unfortunately, your C compiler 
5239         $cc $ccflags
5240 doesn't seem to understand them.  Sorry about that.
5241
5242 If GNU cc is available for your system, perhaps you could try that instead.  
5243
5244 Eventually, we hope to support building Perl with pre-ANSI compilers.
5245 If you would like to help in that effort, please contact <perlbug@perl.org>.
5246
5247 Aborting Configure now.
5248 EOM
5249         exit 2
5250         ;;
5251 esac
5252
5253 : determine where public executables go
5254 echo " "
5255 set dflt bin bin
5256 eval $prefixit
5257 fn=d~
5258 rp='Pathname where the public executables will reside?'
5259 . ./getfile
5260 if $test "X$ansexp" != "X$binexp"; then
5261         installbin=''
5262 fi
5263 bin="$ans"
5264 binexp="$ansexp"
5265 : Change installation prefix, if necessary.
5266 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5267 if $test X"$prefix" != X"$installprefix"; then
5268         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5269 else
5270         installbin="$binexp"
5271 fi
5272
5273 $cat <<EOM
5274
5275 After $package is installed, you may wish to install various
5276 add-on modules and utilities.  Typically, these add-ons will
5277 be installed under $prefix with the rest
5278 of this package.  However, you may wish to install such add-ons
5279 elsewhere under a different prefix.
5280
5281 If you do not wish to put everything under a single prefix, that's
5282 ok.  You will be prompted for the individual locations; this siteprefix
5283 is only used to suggest the defaults.
5284
5285 The default should be fine for most people.
5286
5287 EOM
5288 fn=d~+
5289 rp='Installation prefix to use for add-on modules and utilities?'
5290 : XXX Here might be another good place for an installstyle setting.
5291 case "$siteprefix" in
5292 '') dflt=$prefix ;;
5293 *)  dflt=$siteprefix ;;
5294 esac
5295 . ./getfile
5296 oldsiteprefix=''
5297 case "$siteprefix" in
5298 '') ;;
5299 *)
5300         case "$ans" in
5301         "$prefix") ;;
5302         *) oldsiteprefix="$prefix";;
5303         esac
5304         ;;
5305 esac
5306 siteprefix="$ans"
5307 siteprefixexp="$ansexp"
5308
5309 : determine where site specific libraries go.
5310 : Usual default is /usr/local/lib/perl5/site_perl/$version
5311 : The default "style" setting is made in installstyle.U
5312 : XXX No longer works with Prefixit stuff.
5313 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5314 case "$installstyle" in
5315 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5316 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5317 esac
5318 $cat <<EOM
5319
5320 The installation process will create a directory for
5321 site-specific extensions and modules.  Most users find it convenient
5322 to place all site-specific files in this directory rather than in the
5323 main distribution directory.
5324
5325 EOM
5326 fn=d~+
5327 rp='Pathname for the site-specific library files?'
5328 . ./getfile
5329 sitelib="$ans"
5330 sitelibexp="$ansexp"
5331 : Change installation prefix, if necessary.
5332 if $test X"$prefix" != X"$installprefix"; then
5333         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5334 else
5335         installsitelib="$sitelibexp"
5336 fi
5337
5338 : Determine list of previous versions to include in @INC
5339 $cat > getverlist <<EOPL
5340 #!$perl -w
5341 use File::Basename;
5342 \$api_versionstring = "$api_versionstring";
5343 \$version = "$version";
5344 \$sitelib = "$sitelib";
5345 \$archname = "$archname";
5346 EOPL
5347         $cat >> getverlist <<'EOPL'
5348 # Can't have leading @ because metaconfig interprets it as a command!
5349 ;@inc_version_list=();
5350 $stem=dirname($sitelib);
5351 # Redo to do opendir/readdir? 
5352 if (-d $stem) {
5353     chdir($stem);
5354     ;@candidates = glob("5.*");
5355 }
5356 else {
5357     ;@candidates = ();
5358 }
5359
5360 # XXX ToDo:  These comparisons must be reworked when two-digit
5361 # subversions come along, so that 5.7.10 compares as greater than
5362 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5363 # widespread that we can use the built-in version vectors rather
5364 # than reinventing them here.  For 5.6.0, however, we must
5365 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5366 foreach $d (@candidates) {
5367     if ($d lt $version) {
5368         if ($d ge $api_versionstring) {
5369             unshift(@inc_version_list, "$d/$archname", $d);
5370         }
5371         elsif ($d ge "5.005") {
5372             unshift(@inc_version_list, $d);
5373         }
5374     }
5375     else {
5376         # Skip newer version.  I.e. don't look in
5377         # 5.7.0 if we're installing 5.6.1.
5378     }
5379 }
5380
5381 if (@inc_version_list) {
5382     print join(' ', @inc_version_list);
5383 }
5384 else {
5385     # Blank space to preserve value for next Configure run.
5386     print " ";
5387 }
5388 EOPL
5389 chmod +x getverlist
5390 case "$inc_version_list" in
5391 '')     if test -x $perl; then
5392                 dflt=`$perl getverlist`
5393         else
5394                 dflt='none'
5395         fi
5396         ;;
5397 $undef) dflt='none' ;;
5398 *)  dflt="$inc_version_list" ;;
5399 esac
5400 $cat <<'EOM'
5401
5402 In order to ease the process of upgrading, this version of perl 
5403 can be configured to use modules built and installed with earlier 
5404 versions of perl that were installed under $prefix.  Specify here
5405 the list of earlier versions that this version of perl should check.
5406 If Configure detected no earlier versions of perl installed under
5407 $prefix, then the list will be empty.  Answer 'none' to tell perl
5408 to not search earlier versions.
5409
5410 The default should almost always be sensible, so if you're not sure,
5411 just accept the default.
5412 EOM
5413
5414 rp='List of earlier versions to include in @INC?'
5415 . ./myread
5416 case "$ans" in
5417 [Nn]one) inc_version_list=' ' ;;
5418 *) inc_version_list="$ans" ;;
5419 esac
5420 case "$inc_version_list" in
5421 ''|' ') 
5422         inc_version_list_init='""';;
5423 *)      inc_version_list_init=`echo $inc_version_list |
5424                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/"/'`
5425         ;;
5426 esac
5427 $rm -f getverlist
5428
5429 : determine whether to install perl also as /usr/bin/perl
5430
5431 echo " "
5432 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5433         $cat <<EOM
5434 Many scripts expect to perl to be installed as /usr/bin/perl.
5435 I can install the perl you are about to compile also as /usr/bin/perl
5436 (in addition to $installbin/perl).
5437 EOM
5438         case "$installusrbinperl" in
5439         "$undef"|[nN]*) dflt='n';;
5440         *)              dflt='y';;
5441         esac
5442         rp="Do you want to install perl as /usr/bin/perl?"
5443         . ./myread
5444         case "$ans" in
5445         [yY]*)  val="$define";;
5446         *)      val="$undef" ;;
5447         esac
5448 else
5449         val="$undef"
5450 fi
5451 set installusrbinperl
5452 eval $setvar
5453
5454 echo " "
5455 echo "Checking for GNU C Library..." >&4
5456 cat >gnulibc.c <<EOM
5457 #include <stdio.h>
5458 int main()
5459 {
5460 #ifdef __GLIBC__
5461     exit(0);
5462 #else
5463     exit(1);
5464 #endif
5465 }
5466 EOM
5467 set gnulibc
5468 if eval $compile_ok && ./gnulibc; then
5469         val="$define"
5470         echo "You are using the GNU C Library"
5471 else
5472         val="$undef"
5473         echo "You are not using the GNU C Library"
5474 fi
5475 $rm -f gnulibc*
5476 set d_gnulibc
5477 eval $setvar
5478
5479 : see if nm is to be used to determine whether a symbol is defined or not
5480 case "$usenm" in
5481 '')
5482         dflt=''
5483         case "$d_gnulibc" in
5484         "$define")
5485                 echo " "
5486                 echo "nm probably won't work on the GNU C Library." >&4
5487                 dflt=n
5488                 ;;
5489         esac
5490         case "$dflt" in
5491         '') 
5492                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5493                         echo " "
5494                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5495                         echo "'nm' won't be sufficient on this sytem." >&4
5496                         dflt=n
5497                 fi
5498                 ;;
5499         esac
5500         case "$dflt" in
5501         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5502                 if $test $dflt -gt 20; then
5503                         dflt=y
5504                 else
5505                         dflt=n
5506                 fi
5507                 ;;
5508         esac
5509         ;;
5510 *)
5511         case "$usenm" in
5512         true|$define) dflt=y;;
5513         *) dflt=n;;
5514         esac
5515         ;;
5516 esac
5517 $cat <<EOM
5518
5519 I can use $nm to extract the symbols from your C libraries. This
5520 is a time consuming task which may generate huge output on the disk (up
5521 to 3 megabytes) but that should make the symbols extraction faster. The
5522 alternative is to skip the 'nm' extraction part and to compile a small
5523 test program instead to determine whether each symbol is present. If
5524 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5525 this may be the best solution.
5526
5527 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5528
5529 EOM
5530 rp="Shall I use $nm to extract C symbols from the libraries?"
5531 . ./myread
5532 case "$ans" in
5533 [Nn]*) usenm=false;;
5534 *) usenm=true;;
5535 esac
5536
5537 runnm=$usenm
5538 case "$reuseval" in
5539 true) runnm=false;;
5540 esac
5541
5542 : nm options which may be necessary
5543 case "$nm_opt" in
5544 '') if $test -f /mach_boot; then
5545                 nm_opt=''       # Mach
5546         elif $test -d /usr/ccs/lib; then
5547                 nm_opt='-p'     # Solaris (and SunOS?)
5548         elif $test -f /dgux; then
5549                 nm_opt='-p'     # DG-UX
5550         elif $test -f /lib64/rld; then
5551                 nm_opt='-p'     # 64-bit Irix
5552         else
5553                 nm_opt=''
5554         fi;;
5555 esac
5556
5557 : nm options which may be necessary for shared libraries but illegal
5558 : for archive libraries.  Thank you, Linux.
5559 case "$nm_so_opt" in
5560 '')     case "$myuname" in
5561         *linux*)
5562                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5563                         nm_so_opt='--dynamic'
5564                 fi
5565                 ;;
5566         esac
5567         ;;
5568 esac
5569
5570 case "$runnm" in
5571 true)
5572 : get list of predefined functions in a handy place
5573 echo " "
5574 case "$libc" in
5575 '') libc=unknown
5576         case "$libs" in
5577         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5578         esac
5579         ;;
5580 esac
5581 libnames='';
5582 case "$libs" in
5583 '') ;;
5584 *)  for thislib in $libs; do
5585         case "$thislib" in
5586         -lc|-lc_s)
5587                 : Handle C library specially below.
5588                 ;;
5589         -l*)
5590                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5591                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5592                         :
5593                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5594                         :
5595                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5596                         :
5597                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5598                         :
5599                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5600                         :
5601                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5602                         :
5603                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5604                         :
5605                 else
5606                         try=''
5607                 fi
5608                 libnames="$libnames $try"
5609                 ;;
5610         *) libnames="$libnames $thislib" ;;
5611         esac
5612         done
5613         ;;
5614 esac
5615 xxx=normal
5616 case "$libc" in
5617 unknown)
5618         set /lib/libc.$so
5619         for xxx in $libpth; do
5620                 $test -r $1 || set $xxx/libc.$so
5621                 : The messy sed command sorts on library version numbers.
5622                 $test -r $1 || \
5623                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5624                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5625                                 h
5626                                 s/[0-9][0-9]*/0000&/g
5627                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5628                                 G
5629                                 s/\n/ /' | \
5630                          sort | $sed -e 's/^.* //'`
5631                 eval set \$$#
5632         done
5633         $test -r $1 || set /usr/ccs/lib/libc.$so
5634         $test -r $1 || set /lib/libsys_s$_a
5635         ;;
5636 *)
5637         set blurfl
5638         ;;
5639 esac
5640 if $test -r "$1"; then
5641         echo "Your (shared) C library seems to be in $1."
5642         libc="$1"
5643 elif $test -r /lib/libc && $test -r /lib/clib; then
5644         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5645         xxx=apollo
5646         libc='/lib/clib /lib/libc'
5647         if $test -r /lib/syslib; then
5648                 echo "(Your math library is in /lib/syslib.)"
5649                 libc="$libc /lib/syslib"
5650         fi
5651 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5652         echo "Your C library seems to be in $libc, as you said before."
5653 elif $test -r $incpath/usr/lib/libc$_a; then
5654         libc=$incpath/usr/lib/libc$_a;
5655         echo "Your C library seems to be in $libc.  That's fine."
5656 elif $test -r /lib/libc$_a; then
5657         libc=/lib/libc$_a;
5658         echo "Your C library seems to be in $libc.  You're normal."
5659 else
5660         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5661                 :
5662         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5663                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5664         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5665                 :
5666         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5667                 :
5668         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5669                 :
5670         else
5671                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5672         fi
5673         if $test -r "$tans"; then
5674                 echo "Your C library seems to be in $tans, of all places."
5675                 libc=$tans
5676         else
5677                 libc='blurfl'
5678         fi
5679 fi
5680 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5681         dflt="$libc"
5682         cat <<EOM
5683
5684 If the guess above is wrong (which it might be if you're using a strange
5685 compiler, or your machine supports multiple models), you can override it here.
5686
5687 EOM
5688 else
5689         dflt=''
5690         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5691         cat >&4 <<EOM
5692 I can't seem to find your C library.  I've looked in the following places:
5693
5694 EOM
5695         $sed 's/^/      /' libpath
5696         cat <<EOM
5697
5698 None of these seems to contain your C library. I need to get its name...
5699
5700 EOM
5701 fi
5702 fn=f
5703 rp='Where is your C library?'
5704 . ./getfile
5705 libc="$ans"
5706
5707 echo " "
5708 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5709 set X `cat libnames`
5710 shift
5711 xxx=files
5712 case $# in 1) xxx=file; esac
5713 echo "Extracting names from the following $xxx for later perusal:" >&4
5714 echo " "
5715 $sed 's/^/      /' libnames >&4
5716 echo " "
5717 $echo $n "This may take a while...$c" >&4
5718
5719 for file in $*; do
5720         case $file in
5721         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5722         *) $nm $nm_opt $file 2>/dev/null;;
5723         esac
5724 done >libc.tmp
5725
5726 $echo $n ".$c"
5727 $grep fprintf libc.tmp > libc.ptf
5728 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5729 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5730 xxx='[ADTSIW]'
5731 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5732         eval $xscan;\
5733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734                 eval $xrun
5735 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5736         eval $xscan;\
5737         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5738                 eval $xrun
5739 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5740         eval $xscan;\
5741         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5742                 eval $xrun
5743 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5744         eval $xscan;\
5745         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5746                 eval $xrun
5747 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5748         eval $xscan;\
5749         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5750                 eval $xrun
5751 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5752         eval $xscan;\
5753         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5754                 eval $xrun
5755 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5756                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5757         eval $xscan;\
5758         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5759                 eval $xrun
5760 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5761         eval $xscan;\
5762         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5763                 eval $xrun
5764 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5765         eval $xscan;\
5766         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5767                 eval $xrun
5768 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5769         eval $xscan;\
5770         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5771                 eval $xrun
5772 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\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/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5777         eval $xscan;\
5778         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5779                 eval $xrun
5780 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5781         eval $xscan;\
5782         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5783                 eval $xrun
5784 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5785         eval $xscan;\
5786         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5787                 eval $xrun
5788 else
5789         $nm -p $* 2>/dev/null >libc.tmp
5790         $grep fprintf libc.tmp > libc.ptf
5791         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5792                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5793         then
5794                 nm_opt='-p'
5795                 eval $xrun
5796         else
5797                 echo " "
5798                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5799                 com=''
5800                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5801                         for thisname in $libnames $libc; do
5802                                 $ar t $thisname >>libc.tmp
5803                         done
5804                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5805                         echo "Ok." >&4
5806                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5807                         # Repeat libc to extract forwarders to DLL entries too
5808                         for thisname in $libnames $libc; do
5809                                 $ar tv $thisname >>libc.tmp
5810                                 # Revision 50 of EMX has bug in $ar.
5811                                 # it will not extract forwarders to DLL entries
5812                                 # Use emximp which will extract exactly them.
5813                                 emximp -o tmp.imp $thisname \
5814                                     2>/dev/null && \
5815                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5816                                     < tmp.imp >>libc.tmp
5817                                 $rm tmp.imp
5818                         done
5819                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5820                         echo "Ok." >&4
5821                 else
5822                         echo "$ar didn't seem to work right." >&4
5823                         echo "Maybe this is a Cray...trying bld instead..." >&4
5824                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5825                         then
5826                                 for thisname in $libnames; do
5827                                         bld t $libnames | \
5828                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5829                                         $ar t $thisname >>libc.tmp
5830                                 done
5831                                 echo "Ok." >&4
5832                         else
5833                                 echo "That didn't work either.  Giving up." >&4
5834                                 exit 1
5835                         fi
5836                 fi
5837         fi
5838 fi
5839 nm_extract="$com"
5840 if $test -f /lib/syscalls.exp; then
5841         echo " "
5842         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5843         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5844 fi
5845 ;;
5846 esac
5847 $rm -f libnames libpath
5848
5849 : see if dld is available
5850 set dld.h i_dld
5851 eval $inhdr
5852
5853 : is a C symbol defined?
5854 csym='tlook=$1;
5855 case "$3" in
5856 -v) tf=libc.tmp; tc=""; tdc="";;
5857 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5858 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5859 esac;
5860 tx=yes;
5861 case "$reuseval-$4" in
5862 true-) ;;
5863 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5864 esac;
5865 case "$tx" in
5866 yes)
5867         case "$runnm" in
5868         true)
5869                 if $contains $tlook $tf >/dev/null 2>&1;
5870                 then tval=true;
5871                 else tval=false;
5872                 fi;;
5873         *)
5874                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5875                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5876                 then tval=true;
5877                 else tval=false;
5878                 fi;
5879                 $rm -f t t.c;;
5880         esac;;
5881 *)
5882         case "$tval" in
5883         $define) tval=true;;
5884         *) tval=false;;
5885         esac;;
5886 esac;
5887 eval "$2=$tval"'
5888
5889 : define an is-in-libc? function
5890 inlibc='echo " "; td=$define; tu=$undef;
5891 sym=$1; var=$2; eval "was=\$$2";
5892 tx=yes;
5893 case "$reuseval$was" in
5894 true) ;;
5895 true*) tx=no;;
5896 esac;
5897 case "$tx" in
5898 yes)
5899         set $sym tres -f;
5900         eval $csym;
5901         case "$tres" in
5902         true)
5903                 echo "$sym() found." >&4;
5904                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5905         *)
5906                 echo "$sym() NOT found." >&4;
5907                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5908         esac;;
5909 *)
5910         case "$was" in
5911         $define) echo "$sym() found." >&4;;
5912         *) echo "$sym() NOT found." >&4;;
5913         esac;;
5914 esac'
5915
5916 : see if dlopen exists
5917 xxx_runnm="$runnm"
5918 runnm=false
5919 set dlopen d_dlopen
5920 eval $inlibc
5921 runnm="$xxx_runnm"
5922
5923 : determine which dynamic loading, if any, to compile in
5924 echo " "
5925 dldir="ext/DynaLoader"
5926 case "$usedl" in
5927 $define|y|true)
5928         dflt='y'
5929         usedl="$define"
5930         ;;
5931 $undef|n|false)
5932         dflt='n'
5933         usedl="$undef"
5934         ;;
5935 *) 
5936         dflt='n'
5937         case "$d_dlopen" in
5938             $define) dflt='y' ;;
5939         esac
5940         case "$i_dld" in
5941             $define) dflt='y' ;;
5942         esac
5943         : Does a dl_xxx.xs file exist for this operating system
5944         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5945         ;;
5946 esac
5947 rp="Do you wish to use dynamic loading?"
5948 . ./myread
5949 usedl="$ans"
5950 case "$ans" in
5951 y*) usedl="$define"
5952         case "$dlsrc" in
5953         '')
5954                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5955                         dflt="$dldir/dl_${osname}.xs"
5956                 elif $test "$d_dlopen" = "$define" ; then
5957                         dflt="$dldir/dl_dlopen.xs"
5958                 elif $test "$i_dld" = "$define" ; then
5959                         dflt="$dldir/dl_dld.xs"
5960                 else
5961                         dflt=''
5962                 fi
5963                 ;;
5964         *)      dflt="$dldir/$dlsrc"
5965                 ;;
5966         esac
5967     echo "The following dynamic loading files are available:"
5968         : Can not go over to $dldir because getfile has path hard-coded in.
5969         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5970         rp="Source file to use for dynamic loading"
5971         fn="fne"
5972         gfpth="$src"
5973         . ./getfile
5974         usedl="$define"
5975         : emulate basename
5976         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5977
5978         $cat << EOM
5979
5980 Some systems may require passing special flags to $cc -c to
5981 compile modules that will be used to create a shared library.
5982 To use no flags, say "none".
5983
5984 EOM
5985     case "$cccdlflags" in
5986     '') case "$gccversion" in
5987                 '') case "$osname" in
5988                         hpux)   dflt='+z' ;;
5989                         next)   dflt='none' ;;
5990                         irix*)  dflt='-KPIC' ;;
5991                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5992                         sunos)  dflt='-pic' ;;
5993                         *)      dflt='none' ;;
5994                     esac
5995                         ;;
5996                 *)  case "$osname" in
5997                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5998                         *)      dflt='-fpic' ;;
5999                     esac ;;
6000             esac ;;
6001         ' ') dflt='none' ;;
6002     *)  dflt="$cccdlflags" ;;
6003     esac
6004     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6005     . ./myread
6006     case "$ans" in
6007     none) cccdlflags=' ' ;;
6008     *) cccdlflags="$ans" ;;
6009     esac
6010
6011     cat << EOM
6012
6013 Some systems use ld to create libraries that can be dynamically loaded,
6014 while other systems (such as those using ELF) use $cc.
6015
6016 EOM
6017         case "$ld" in
6018         '')     $cat >try.c <<'EOM'
6019 /* Test for whether ELF binaries are produced */
6020 #include <fcntl.h>
6021 #include <stdlib.h>
6022 int main() {
6023         char b[4];
6024         int i = open("a.out",O_RDONLY);
6025         if(i == -1) 
6026                 exit(1); /* fail */
6027         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6028                 exit(0); /* succeed (yes, it's ELF) */
6029         else
6030                 exit(1); /* fail */
6031 }
6032 EOM
6033                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6034                         cat <<EOM
6035 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6036 EOM
6037                         dflt="$cc"
6038                 else
6039                         echo "I'll use ld to build dynamic libraries."
6040                         dflt='ld'
6041                 fi
6042                 rm -f try.c a.out
6043                 ;;
6044         *)      dflt="$ld"
6045                 ;;
6046         esac
6047
6048     rp="What command should be used to create dynamic libraries?"
6049     . ./myread
6050         ld="$ans"
6051
6052     cat << EOM
6053
6054 Some systems may require passing special flags to $ld to create a
6055 library that can be dynamically loaded.  If your ld flags include
6056 -L/other/path options to locate libraries outside your loader's normal
6057 search path, you may need to specify those -L options here as well.  To
6058 use no flags, say "none".
6059
6060 EOM
6061     case "$lddlflags" in
6062     '') case "$osname" in
6063                         beos) dflt='-nostart' ;;
6064                         hpux)  dflt='-b' ;;
6065                         linux|irix*)    dflt='-shared' ;;
6066                         next)  dflt='none' ;;
6067                         solaris) dflt='-G' ;;
6068                         sunos) dflt='-assert nodefinitions' ;;
6069                         svr4*|esix*) dflt="-G $ldflags" ;;
6070                 *)     dflt='none' ;;
6071                         esac
6072                         ;;
6073     *) dflt="$lddlflags" ;;
6074     esac
6075
6076         : Try to guess additional flags to pick up local libraries.
6077         : Be careful not to append to a plain 'none'
6078         case "$dflt" in
6079         none) dflt='' ;;
6080         esac
6081         for thisflag in $ldflags; do
6082                 case "$thisflag" in
6083                 -L*)
6084                         case " $dflt " in
6085                         *" $thisflag "*) ;;
6086                         *) dflt="$dflt $thisflag" ;;
6087                         esac
6088                         ;;
6089                 esac
6090         done
6091
6092         case "$dflt" in
6093         ''|' ') dflt='none' ;;
6094         esac
6095
6096     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6097     . ./myread
6098     case "$ans" in
6099     none) lddlflags=' ' ;;
6100     *) lddlflags="$ans" ;;
6101     esac
6102
6103         cat <<EOM
6104
6105 Some systems may require passing special flags to $cc to indicate that
6106 the resulting executable will use dynamic linking.  To use no flags,
6107 say "none".
6108
6109 EOM
6110     case "$ccdlflags" in
6111     '') case "$osname" in
6112                 hpux)   dflt='-Wl,-E' ;;
6113                 linux)  dflt='-rdynamic' ;;
6114                 next)   dflt='none' ;;
6115                 sunos)  dflt='none' ;;
6116                 *)      dflt='none' ;;
6117             esac ;;
6118     ' ')  dflt='none' ;;
6119     *)  dflt="$ccdlflags" ;;
6120     esac
6121     rp="Any special flags to pass to $cc to use dynamic linking?"
6122     . ./myread
6123     case "$ans" in
6124     none) ccdlflags=' ' ;;
6125     *) ccdlflags="$ans" ;;
6126     esac
6127     ;;
6128 *)  usedl="$undef"
6129         ld='ld'
6130     dlsrc='dl_none.xs'
6131     lddlflags=''
6132     ccdlflags=''
6133     ;;
6134 esac
6135
6136 also=''
6137 case "$usedl" in
6138 $undef)
6139         # No dynamic loading being used, so don't bother even to prompt.
6140         useshrplib='false'
6141         ;;
6142 *)      case "$useshrplib" in
6143         '')     case "$osname" in
6144                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6145                         dflt=y
6146                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6147                         ;;
6148                 next*)
6149                         case "$osvers" in
6150                         4*)     dflt=y
6151                                 also='Building a shared libperl is needed for MAB support.'
6152                                 ;;
6153                         *)      dflt=n
6154                                 ;;
6155                         esac
6156                         ;;
6157                 *)      dflt=n
6158                         ;;
6159                 esac
6160                 ;;
6161         $define|true|[Yy]*)
6162                 dflt=y
6163                 ;;
6164         *)      dflt=n
6165                 ;;
6166         esac
6167         $cat << EOM
6168
6169 The perl executable is normally obtained by linking perlmain.c with
6170 libperl${_a}, any static extensions (usually just DynaLoader), and
6171 any other libraries needed on this system (such as -lm, etc.).  Since
6172 your system supports dynamic loading, it is probably possible to build
6173 a shared libperl.$so.  If you will have more than one executable linked
6174 to libperl.$so, this will significantly reduce the size of each
6175 executable, but it may have a noticeable affect on performance.  The
6176 default is probably sensible for your system.
6177 $also
6178
6179 EOM
6180         rp="Build a shared libperl.$so (y/n)"
6181         . ./myread
6182         case "$ans" in
6183         true|$define|[Yy]*)
6184                 useshrplib='true'  ;;
6185         *)      useshrplib='false' ;;
6186         esac
6187         ;;
6188 esac
6189
6190 case "$useshrplib" in
6191 true)
6192         case "$libperl" in
6193         '')
6194                 # Figure out a good name for libperl.so.  Since it gets stored in
6195                 # a version-specific architecture-dependent library, the version
6196                 # number isn't really that important, except for making cc/ld happy.
6197                 #
6198                 # A name such as libperl.so.3.1
6199                 majmin="libperl.$so.$patchlevel.$subversion"
6200                 # A name such as libperl.so.301
6201                 majonly=`echo $patchlevel $subversion |
6202                         $awk '{printf "%d%02d", $1, $2}'`
6203                 majonly=libperl.$so.$majonly
6204                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6205                 # rely on figuring it out from the naming of libc.
6206                 case "${osname}${osvers}" in
6207                 next4*)
6208                         dflt=libperl.5.$so
6209                         # XXX How handle the --version stuff for MAB?
6210                         ;;
6211                 linux*)  # ld won't link with a bare -lperl otherwise.
6212                         dflt=libperl.$so
6213                         ;;
6214                 cygwin*) # include version
6215                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6216                         ;;
6217                 *)      # Try to guess based on whether libc has major.minor.
6218                         case "$libc" in
6219                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6220                         *libc.$so.[0-9]*) dflt=$majonly ;;
6221                         *)      dflt=libperl.$so ;;
6222                         esac
6223                         ;;
6224                 esac
6225                 ;;
6226         *)      dflt=$libperl
6227                 ;;
6228         esac
6229         cat << EOM
6230
6231 I need to select a good name for the shared libperl.  If your system uses
6232 library names with major and minor numbers, then you might want something
6233 like $majmin.  Alternatively, if your system uses a single version
6234 number for shared libraries, then you might want to use $majonly.
6235 Or, your system might be quite happy with a simple libperl.$so.
6236
6237 Since the shared libperl will get installed into a version-specific
6238 architecture-dependent directory, the version number of the shared perl
6239 library probably isn't important, so the default should be o.k.
6240
6241 EOM
6242         rp='What name do you want to give to the shared libperl?'
6243         . ./myread
6244         libperl=$ans
6245         echo "Ok, I'll use $libperl"
6246         ;;
6247 *)
6248         libperl="libperl${_a}"
6249         ;;
6250 esac
6251
6252 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6253 case "$shrpdir" in
6254 '') ;;
6255 *)      $cat >&4 <<EOM
6256 WARNING:  Use of the shrpdir variable for the installation location of
6257 the shared $libperl is not supported.  It was never documented and
6258 will not work in this version.  Let me (perlbug@perl.com)
6259 know of any problems this may cause.
6260
6261 EOM
6262         case "$shrpdir" in
6263         "$archlibexp/CORE")
6264                 $cat >&4 <<EOM
6265 But your current setting of $shrpdir is
6266 the default anyway, so it's harmless.
6267 EOM
6268                 ;;
6269         *)
6270                 $cat >&4 <<EOM
6271 Further, your current attempted setting of $shrpdir
6272 conflicts with the value of $archlibexp/CORE
6273 that installperl will use.
6274 EOM
6275                 ;;
6276         esac
6277         ;;
6278 esac
6279
6280 # How will the perl executable find the installed shared $libperl?
6281 # Add $xxx to ccdlflags.
6282 # If we can't figure out a command-line option, use $shrpenv to
6283 # set env LD_RUN_PATH.  The main perl makefile uses this.
6284 shrpdir=$archlibexp/CORE
6285 xxx=''
6286 tmp_shrpenv=''
6287 if "$useshrplib"; then
6288     case "$osname" in 
6289         aix)
6290                 # We'll set it in Makefile.SH...
6291                 ;;
6292         solaris|netbsd)
6293                 xxx="-R $shrpdir"
6294                 ;;
6295         freebsd)
6296                 xxx="-Wl,-R$shrpdir"
6297                 ;;
6298         linux|irix*|dec_osf)
6299                 xxx="-Wl,-rpath,$shrpdir"
6300                 ;;
6301         next)
6302                 # next doesn't like the default...
6303                 ;;
6304         beos)
6305                 # beos doesn't like the default, either.
6306                 ;;
6307         hpux*)
6308                 # hpux doesn't like the default, either.
6309                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6310                 ;;
6311         *)
6312                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6313                 ;;
6314         esac
6315         case "$xxx" in
6316         '') ;;
6317         *)      
6318                 # Only add $xxx if it isn't already in ccdlflags.
6319                 case " $ccdlflags " in
6320                 *" $xxx "*)     ;;
6321                 *)      ccdlflags="$ccdlflags $xxx"
6322                         cat <<EOM >&4
6323
6324 Adding $xxx to the flags
6325 passed to $ld so that the perl executable will find the 
6326 installed shared $libperl.
6327
6328 EOM
6329                         ;;
6330                 esac
6331                 ;;
6332         esac
6333 fi
6334 # Fix ccdlflags in AIX for building external extensions.
6335 # (For building Perl itself bare -bE:perl.exp is needed,
6336 #  Makefile.SH takes care of this.)
6337 case "$osname" in
6338 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6339 esac
6340 # Respect a hint or command-line value.
6341 case "$shrpenv" in
6342 '') shrpenv="$tmp_shrpenv" ;;
6343 esac
6344 case "$ldlibpthname" in
6345 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6346 none)   ldlibpthname='' ;;
6347 esac
6348
6349 : determine where manual pages go
6350 set man1dir man1dir none
6351 eval $prefixit
6352 $cat <<EOM
6353
6354 $spackage has manual pages available in source form.
6355 EOM
6356 case "$nroff" in
6357 nroff)
6358         echo "However, you don't have nroff, so they're probably useless to you."
6359         case "$man1dir" in
6360         '') man1dir="none";;
6361         esac;;
6362 esac
6363 echo "If you don't want the manual sources installed, answer 'none'."
6364 case "$man1dir" in
6365 ' ') dflt=none
6366         ;;
6367 '')
6368         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6369         lookpath="$lookpath $prefixexp/man/p_man/man1"
6370         lookpath="$lookpath $prefixexp/man/u_man/man1"
6371         lookpath="$lookpath $prefixexp/man/man.1"
6372         case "$sysman" in
6373         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6374         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6375         esac
6376         set dflt
6377         eval $prefixup
6378         ;;
6379 *)  dflt="$man1dir"
6380         ;;
6381 esac
6382 echo " "
6383 fn=dn+~
6384 rp="Where do the main $spackage manual pages (source) go?"
6385 . ./getfile
6386 if $test "X$man1direxp" != "X$ansexp"; then
6387         installman1dir=''
6388 fi
6389 man1dir="$ans"
6390 man1direxp="$ansexp"
6391 case "$man1dir" in
6392 '')     man1dir=' '
6393         installman1dir='';;
6394 esac
6395
6396 : Change installation prefix, if necessary.
6397 if $test X"$prefix" != X"$installprefix"; then
6398         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6399 else
6400         installman1dir="$man1direxp"
6401 fi
6402
6403 : What suffix to use on installed man pages
6404
6405 case "$man1dir" in
6406 ' ')
6407         man1ext='0'
6408         ;;
6409 *)
6410         rp="What suffix should be used for the main $spackage man pages?"
6411         case "$man1ext" in
6412         '')     case "$man1dir" in
6413                 *1)  dflt=1 ;;
6414                 *1p) dflt=1p ;;
6415                 *1pm) dflt=1pm ;;
6416                 *l) dflt=l;;
6417                 *n) dflt=n;;
6418                 *o) dflt=o;;
6419                 *p) dflt=p;;
6420                 *C) dflt=C;;
6421                 *L) dflt=L;;
6422                 *L1) dflt=L1;;
6423                 *) dflt=1;;
6424                 esac
6425                 ;;
6426         *)      dflt="$man1ext";;
6427         esac
6428         . ./myread
6429         man1ext="$ans"
6430         ;;
6431 esac
6432
6433 : see if we can have long filenames
6434 echo " "
6435 rmlist="$rmlist /tmp/cf$$"
6436 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6437 first=123456789abcdef
6438 second=/tmp/cf$$/$first
6439 $rm -f $first $second
6440 if (echo hi >$first) 2>/dev/null; then
6441         if $test -f 123456789abcde; then
6442                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6443                 val="$undef"
6444         else
6445                 if (echo hi >$second) 2>/dev/null; then
6446                         if $test -f /tmp/cf$$/123456789abcde; then
6447                                 $cat <<'EOM'
6448 That's peculiar... You can have filenames longer than 14 characters, but only
6449 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6450 I shall consider your system cannot support long filenames at all.
6451 EOM
6452                                 val="$undef"
6453                         else
6454                                 echo 'You can have filenames longer than 14 characters.' >&4
6455                                 val="$define"
6456                         fi
6457                 else
6458                         $cat <<'EOM'
6459 How confusing! Some of your filesystems are sane enough to allow filenames
6460 longer than 14 characters but some others like /tmp can't even think about them.
6461 So, for now on, I shall assume your kernel does not allow them at all.
6462 EOM
6463                         val="$undef"
6464                 fi
6465         fi
6466 else
6467         $cat <<'EOM'
6468 You can't have filenames longer than 14 chars.  You can't even think about them!
6469 EOM
6470         val="$undef"
6471 fi 
6472 set d_flexfnam
6473 eval $setvar
6474 $rm -rf /tmp/cf$$ 123456789abcde*
6475
6476 : determine where library module manual pages go
6477 set man3dir man3dir none
6478 eval $prefixit
6479 $cat <<EOM
6480
6481 $spackage has manual pages for many of the library modules.
6482 EOM
6483
6484 case "$nroff" in
6485 nroff)
6486         $cat <<'EOM'
6487 However, you don't have nroff, so they're probably useless to you.
6488 EOM
6489         case "$man3dir" in
6490         '') man3dir="none";;
6491         esac;;
6492 esac
6493
6494 case "$d_flexfnam" in
6495 undef)
6496         $cat <<'EOM'
6497 However, your system can't handle the long file names like File::Basename.3. 
6498 EOM
6499         case "$man3dir" in
6500         '') man3dir="none";;
6501         esac;;
6502 esac
6503
6504 echo "If you don't want the manual sources installed, answer 'none'."
6505 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6506 case "$man3dir" in
6507 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6508         if $test -d "$privlib/man/man3"; then
6509                 cat <<EOM >&4
6510
6511 WARNING:  Previous versions of perl installed man3 pages into
6512 $privlib/man/man3.  This version will suggest a 
6513 new default of $dflt.  
6514 EOM
6515                 tdflt=$dflt
6516                 dflt='n'
6517                 rp='Do you wish to preserve the old behavior?(y/n)'
6518                 . ./myread
6519                 case "$ans" in
6520                 y*) dflt="$privlib/man/man3" ;;
6521                 *)  dflt=$tdflt ;;
6522                 esac
6523     fi
6524         ;;
6525 ' ') dflt=none;;
6526 *)      dflt="$man3dir" ;;
6527 esac
6528 echo " "
6529 fn=dn+~
6530 rp="Where do the $package library man pages (source) go?"
6531 . ./getfile
6532 man3dir="$ans"
6533 man3direxp="$ansexp"
6534 case "$man1dir" in
6535 '')     man3dir=' '
6536         installman3dir='';;
6537 esac
6538
6539 : Change installation prefix, if necessary.
6540 if $test X"$prefix" != X"$installprefix"; then
6541         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6542 else
6543         installman3dir="$man3direxp"
6544 fi
6545
6546 : What suffix to use on installed man pages
6547 case "$man3dir" in
6548 ' ')
6549         man3ext='0'
6550         ;;
6551 *)
6552         rp="What suffix should be used for the $package library man pages?"
6553         case "$man3ext" in
6554         '')     case "$man3dir" in
6555                 *3)  dflt=3 ;;
6556                 *3p) dflt=3p ;;
6557                 *3pm) dflt=3pm ;;
6558                 *l) dflt=l;;
6559                 *n) dflt=n;;
6560                 *o) dflt=o;;
6561                 *p) dflt=p;;
6562                 *C) dflt=C;;
6563                 *L) dflt=L;;
6564                 *L3) dflt=L3;;
6565                 *) dflt=3;;
6566                 esac
6567                 ;;
6568         *)      dflt="$man3ext";;
6569         esac
6570         . ./myread
6571         man3ext="$ans"
6572         ;;
6573 esac
6574
6575 : see if we have to deal with yellow pages, now NIS.
6576 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6577         if $test -f /usr/etc/nibindd; then
6578                 echo " "
6579                 echo "I'm fairly confident you're on a NeXT."
6580                 echo " "
6581                 rp='Do you get the hosts file via NetInfo?'
6582                 dflt=y
6583                 case "$hostcat" in
6584                 nidump*) ;;
6585                 '') ;;
6586                 *) dflt=n;;
6587                 esac
6588                 . ./myread
6589                 case "$ans" in
6590                 y*) hostcat='nidump hosts .';;
6591                 *)      case "$hostcat" in
6592                         nidump*) hostcat='';;
6593                         esac
6594                         ;;
6595                 esac
6596         fi
6597         case "$hostcat" in
6598         nidump*) ;;
6599         *)
6600                 case "$hostcat" in
6601                 *ypcat*) dflt=y;;
6602                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6603                                 dflt=y
6604                         else
6605                                 dflt=n
6606                         fi;;
6607                 *) dflt=n;;
6608                 esac
6609                 echo " "
6610                 rp='Are you getting the hosts file via yellow pages?'
6611                 . ./myread
6612                 case "$ans" in
6613                 y*) hostcat='ypcat hosts';;
6614                 *) hostcat='cat /etc/hosts';;
6615                 esac
6616                 ;;
6617         esac
6618 fi
6619 case "$hostcat" in
6620 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6621 esac
6622 case "$groupcat" in
6623 '') test -f /etc/group && groupcat='cat /etc/group';;
6624 esac
6625 case "$passcat" in
6626 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6627 esac
6628
6629 : now get the host name
6630 echo " "
6631 echo "Figuring out host name..." >&4
6632 case "$myhostname" in
6633 '') cont=true
6634         echo 'Maybe "hostname" will work...'
6635         if tans=`sh -c hostname 2>&1` ; then
6636                 myhostname=$tans
6637                 phostname=hostname
6638                 cont=''
6639         fi
6640         ;;
6641 *) cont='';;
6642 esac
6643 if $test "$cont"; then
6644         if ./xenix; then
6645                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6646                 if tans=`cat /etc/systemid 2>&1` ; then
6647                         myhostname=$tans
6648                         phostname='cat /etc/systemid'
6649                         echo "Whadyaknow.  Xenix always was a bit strange..."
6650                         cont=''
6651                 fi
6652         elif $test -r /etc/systemid; then
6653                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6654         fi
6655 fi
6656 if $test "$cont"; then
6657         echo 'No, maybe "uuname -l" will work...'
6658         if tans=`sh -c 'uuname -l' 2>&1` ; then
6659                 myhostname=$tans
6660                 phostname='uuname -l'
6661         else
6662                 echo 'Strange.  Maybe "uname -n" will work...'
6663                 if tans=`sh -c 'uname -n' 2>&1` ; then
6664                         myhostname=$tans
6665                         phostname='uname -n'
6666                 else
6667                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6668                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6669                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6670                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6671                         else
6672                                 case "$myhostname" in
6673                                 '') echo "Does this machine have an identity crisis or something?"
6674                                         phostname='';;
6675                                 *)
6676                                         echo "Well, you said $myhostname before..."
6677                                         phostname='echo $myhostname';;
6678                                 esac
6679                         fi
6680                 fi
6681         fi
6682 fi
6683 : you do not want to know about this
6684 set $myhostname
6685 myhostname=$1
6686
6687 : verify guess
6688 if $test "$myhostname" ; then
6689         dflt=y
6690         rp='Your host name appears to be "'$myhostname'".'" Right?"
6691         . ./myread
6692         case "$ans" in
6693         y*) ;;
6694         *) myhostname='';;
6695         esac
6696 fi
6697
6698 : bad guess or no guess
6699 while $test "X$myhostname" = X ; do
6700         dflt=''
6701         rp="Please type the (one word) name of your host:"
6702         . ./myread
6703         myhostname="$ans"
6704 done
6705
6706 : translate upper to lower if necessary
6707 case "$myhostname" in
6708 *[A-Z]*)
6709         echo "(Normalizing case in your host name)"
6710         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6711         ;;
6712 esac
6713
6714 case "$myhostname" in
6715 *.*)
6716         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6717         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6718         echo "(Trimming domain name from host name--host name is now $myhostname)"
6719         ;;
6720 *) case "$mydomain" in
6721         '')
6722                 {
6723                         test "X$hostcat" = "Xypcat hosts" &&
6724                         ypmatch "$myhostname" hosts 2>/dev/null |\
6725                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6726                         $test -s hosts
6727                 } || {
6728                         test "X$hostcat" != "X" &&
6729                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6730                                         /[       ]$myhostname[  . ]/p" > hosts
6731                 }
6732                 tmp_re="[       . ]"
6733                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6734                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6735                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6736                         hosts | $sort | $uniq | \
6737                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6738                 case `$echo X$dflt` in
6739                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6740                         dflt=.
6741                         ;;
6742                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6743                         ;;
6744                 esac
6745                 case "$dflt" in
6746                 .)
6747                         tans=`./loc resolv.conf X /etc /usr/etc`
6748                         if $test -f "$tans"; then
6749                                 echo "(Attempting domain name extraction from $tans)"
6750                                 dflt=.`$sed -n -e 's/   / /g' \
6751                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6752                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6753                                 case "$dflt" in
6754                                 .) dflt=.`$sed -n -e 's/        / /g' \
6755                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6756                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6757                                         ;;
6758                                 esac
6759                         fi
6760                         ;;
6761                 esac
6762                 case "$dflt" in
6763                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6764                         dflt=.`sh -c domainname 2>/dev/null`
6765                         case "$dflt" in
6766                         '') dflt='.';;
6767                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6768                         esac
6769                         ;;
6770                 esac
6771                 case "$dflt" in
6772                 .) echo "(Lost all hope -- silly guess then)"
6773                         dflt='.uucp'
6774                         ;;
6775                 esac
6776                 $rm -f hosts
6777                 ;;
6778         *) dflt="$mydomain";;
6779         esac;;
6780 esac
6781 echo " "
6782 rp="What is your domain name?"
6783 . ./myread
6784 tans="$ans"
6785 case "$ans" in
6786 '') ;;
6787 .*) ;;
6788 *) tans=".$tans";;
6789 esac
6790 mydomain="$tans"
6791
6792 : translate upper to lower if necessary
6793 case "$mydomain" in
6794 *[A-Z]*)
6795         echo "(Normalizing case in your domain name)"
6796         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6797         ;;
6798 esac
6799
6800 : a little sanity check here
6801 case "$phostname" in
6802 '') ;;
6803 *)
6804         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6805         $myhostname$mydomain|$myhostname) ;;
6806         *)
6807                 case "$phostname" in
6808                 sed*)
6809                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6810                         ;;
6811                 *)
6812                         echo "(That doesn't agree with your $phostname command, by the way.)"
6813                         ;;
6814                 esac
6815         ;;
6816         esac
6817         ;;
6818 esac
6819
6820 $cat <<EOM
6821
6822 I need to get your e-mail address in Internet format if possible, i.e.
6823 something like user@host.domain. Please answer accurately since I have
6824 no easy means to double check it. The default value provided below
6825 is most probably close to reality but may not be valid from outside
6826 your organization...
6827
6828 EOM
6829 cont=x
6830 while test "$cont"; do
6831         case "$cf_email" in
6832         '') dflt="$cf_by@$myhostname$mydomain";;
6833         *) dflt="$cf_email";;
6834         esac
6835         rp='What is your e-mail address?'
6836         . ./myread
6837         cf_email="$ans"
6838         case "$cf_email" in
6839         *@*.*) cont='' ;;
6840         *)
6841                 rp='Address does not look like an Internet one.  Use it anyway?'
6842                 case "$fastread" in
6843                 yes) dflt=y ;;
6844                 *) dflt=n ;;
6845                 esac
6846                 . ./myread
6847                 case "$ans" in
6848                 y*) cont='' ;;
6849                 *) echo " " ;;
6850                 esac
6851                 ;;
6852         esac
6853 done
6854
6855 $cat <<EOM
6856
6857 If you or somebody else will be maintaining perl at your site, please
6858 fill in the correct e-mail address here so that they may be contacted
6859 if necessary. Currently, the "perlbug" program included with perl
6860 will send mail to this address in addition to perlbug@perl.com. You may
6861 enter "none" for no administrator.
6862
6863 EOM
6864 case "$perladmin" in
6865 '') dflt="$cf_email";;
6866 *) dflt="$perladmin";;
6867 esac
6868 rp='Perl administrator e-mail address'
6869 . ./myread
6870 perladmin="$ans"
6871
6872 : figure out how to guarantee perl startup
6873 case "$startperl" in
6874 '')
6875         case "$sharpbang" in
6876         *!)
6877                 $cat <<EOH
6878
6879 I can use the #! construct to start perl on your system. This will
6880 make startup of perl scripts faster, but may cause problems if you
6881 want to share those scripts and perl is not in a standard place
6882 ($binexp/perl) on all your platforms. The alternative is to force
6883 a shell by starting the script with a single ':' character.
6884
6885 EOH
6886                 dflt="$binexp/perl"
6887                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6888                 . ./myread
6889                 case "$ans" in
6890                 none)   startperl=": # use perl";;
6891                 *)      startperl="#!$ans"
6892                         if $test 30 -lt `echo "$ans" | wc -c`; then
6893                                 $cat >&4 <<EOM
6894
6895 WARNING:  Some systems limit the #! command to 32 characters.
6896 If you experience difficulty running Perl scripts with #!, try
6897 installing Perl in a directory with a shorter pathname.
6898
6899 EOM
6900                         fi ;;
6901                 esac
6902                 ;;
6903         *) startperl=": # use perl"
6904                 ;;
6905         esac
6906         ;;
6907 esac
6908 echo "I'll use $startperl to start perl scripts."
6909
6910 : figure best path for perl in scripts
6911 case "$perlpath" in
6912 '')
6913         perlpath="$binexp/perl"
6914         case "$startperl" in
6915         *!*) ;;
6916         *)
6917                 $cat <<EOH
6918
6919 I will use the "eval 'exec'" idiom to start Perl on your system.
6920 I can use the full path of your Perl binary for this purpose, but
6921 doing so may cause problems if you want to share those scripts and
6922 Perl is not always in a standard place ($binexp/perl).
6923
6924 EOH
6925                 dflt="$binexp/perl"
6926                 rp="What path shall I use in \"eval 'exec'\"?"
6927                 . ./myread
6928                 perlpath="$ans"
6929                 ;;
6930         esac
6931         ;;
6932 esac
6933 case "$startperl" in
6934 *!*)    ;;
6935 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6936 esac
6937
6938 : determine where public executable scripts go
6939 set scriptdir scriptdir
6940 eval $prefixit
6941 case "$scriptdir" in
6942 '')
6943         dflt="$bin"
6944         : guess some guesses
6945         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6946         $test -d /usr/share/bin     && dflt=/usr/share/bin
6947         $test -d /usr/local/script  && dflt=/usr/local/script
6948         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6949         $test -d $prefixexp/script  && dflt=$prefixexp/script
6950         set dflt
6951         eval $prefixup
6952         ;;
6953 *)  dflt="$scriptdir"
6954         ;;
6955 esac
6956 $cat <<EOM
6957  
6958 Some installations have a separate directory just for executable scripts so
6959 that they can mount it across multiple architectures but keep the scripts in
6960 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6961 Or you might just lump your scripts in with all your other executables.
6962  
6963 EOM
6964 fn=d~
6965 rp='Where do you keep publicly executable scripts?'
6966 . ./getfile
6967 if $test "X$ansexp" != "X$scriptdirexp"; then
6968         installscript=''
6969 fi
6970 scriptdir="$ans"
6971 scriptdirexp="$ansexp"
6972 : Change installation prefix, if necessary.
6973 if $test X"$prefix" != X"$installprefix"; then
6974         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6975 else
6976         installscript="$scriptdirexp"
6977 fi
6978
6979 : determine where site specific architecture-dependent libraries go.
6980 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6981 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6982 : sitelib may have an optional trailing /share.
6983 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6984 tdflt="$tdflt/$archname"
6985 set sitearch sitearch none
6986 eval $prefixit
6987 case "$sitearch" in
6988 '')     dflt="$tdflt" ;;
6989 *)      dflt="$sitearch" ;;
6990 esac
6991 $cat <<EOM
6992
6993 The installation process will also create a directory for
6994 architecture-dependent site-specific extensions and modules.
6995
6996 EOM
6997 fn=nd~+
6998 rp='Pathname for the site-specific architecture-dependent library files?'
6999 . ./getfile
7000 sitearch="$ans"
7001 sitearchexp="$ansexp"
7002 : Change installation prefix, if necessary.
7003 if $test X"$prefix" != X"$installprefix"; then
7004         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7005 else
7006         installsitearch="$sitearchexp"
7007 fi
7008
7009 : determine where add-on public executables go
7010 case "$sitebin" in
7011 '')     dflt=$siteprefix/bin ;;
7012 *)      dflt=$sitebin ;;
7013 esac
7014 fn=d~
7015 rp='Pathname where the add-on public executables should be installed?'
7016 . ./getfile
7017 sitebin="$ans"
7018 sitebinexp="$ansexp"
7019 : Change installation prefix, if necessary.
7020 if $test X"$prefix" != X"$installprefix"; then
7021         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7022 else
7023         installsitebin="$sitebinexp"
7024 fi
7025
7026 cat <<EOM
7027
7028 Perl can be built to take advantage of long doubles which
7029 (if available) may give more accuracy and range for floating point numbers.
7030
7031 If this doesn't make any sense to you, just accept the default 'n'.
7032 EOM
7033
7034 case "$ccflags" in
7035 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7036 esac
7037
7038 case "$uselongdouble" in
7039 $define|true|[yY]*)     dflt='y';;
7040 *) dflt='n';;
7041 esac
7042 rp='Try to use long doubles if available?'
7043 . ./myread
7044 case "$ans" in
7045 y|Y)    val="$define"   ;;
7046 *)      val="$undef"    ;;
7047 esac
7048 set uselongdouble
7049 eval $setvar
7050
7051 case "$uselongdouble" in
7052 true|[yY]*) uselongdouble="$define" ;;
7053 esac
7054
7055 case "$uselongdouble" in
7056 $define)
7057 : Look for a hint-file generated 'call-back-unit'.  If the
7058 : user has specified that long doubles should be used,
7059 : we may need to set or change some other defaults.
7060         if $test -f uselongdouble.cbu; then
7061                 echo "Your platform has some specific hints for long doubles, using them..."
7062                 . ./uselongdouble.cbu
7063         else
7064                 $cat <<EOM
7065 (Your platform doesn't have any specific hints for long doubles.)
7066 EOM
7067         fi
7068         ;;
7069 esac
7070
7071 cat <<EOM
7072
7073 Perl can be built to take advantage of long longs which
7074 (if available) may give more range for integer numbers.
7075
7076 If this doesn't make any sense to you, just accept the default 'n'.
7077 EOM
7078
7079 case "$ccflags" in
7080 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7081 esac
7082
7083 case "$uselonglong" in
7084 $define|true|[yY]*)     dflt='y';;
7085 *) dflt='n';;
7086 esac
7087 rp='Try to use long longs if available?'
7088 . ./myread
7089 case "$ans" in
7090 y|Y)    val="$define"   ;;
7091 *)      val="$undef"    ;;
7092 esac
7093 set uselonglong
7094 eval $setvar
7095
7096 case "$uselonglong" in
7097 true|[yY]*) uselonglong="$define" ;;
7098 esac
7099
7100 case "$uselonglong" in
7101 $define)
7102 : Look for a hint-file generated 'call-back-unit'.  If the
7103 : user has specified that long longs should be used,
7104 : we may need to set or change some other defaults.
7105         if $test -f uselonglong.cbu; then
7106                 echo "Your platform has some specific hints for long longs, using them..."
7107                 . ./uselonglong.cbu
7108         else
7109                 $cat <<EOM
7110 (Your platform doesn't have any specific hints for long longs.)
7111 EOM
7112         fi
7113         ;;
7114 esac
7115
7116 cat <<EOM
7117
7118 Previous version of $package used the standard IO mechanisms as defined
7119 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7120 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7121 the default.  This abstraction layer can use AT&T's sfio (if you already
7122 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7123 problems with some extension modules.  Using PerlIO with stdio is safe,
7124 but it is slower than plain stdio and therefore is not the default.
7125
7126 If this doesn't make any sense to you, just accept the default 'n'.
7127 EOM
7128 case "$useperlio" in
7129 $define|true|[yY]*)     dflt='y';;
7130 *) dflt='n';;
7131 esac
7132 rp='Use the experimental PerlIO abstraction layer?'
7133 . ./myread
7134 case "$ans" in
7135 y|Y) 
7136         val="$define"
7137         ;;     
7138 *)      
7139         echo "Ok, doing things the stdio way"
7140         val="$undef"
7141         ;;
7142 esac
7143 set useperlio
7144 eval $setvar 
7145
7146 case "$vendorprefix" in
7147 '')     d_vendorbin="$undef"
7148         vendorbin=''
7149         vendorbinexp=''
7150         ;;
7151 *)      d_vendorbin="$define"
7152         : determine where vendor-supplied executables go.
7153         dflt=$vendorprefix/bin
7154         fn=d~+
7155         rp='Pathname for the vendor-supplied executables directory?'
7156         . ./getfile
7157         vendorbin="$ans"
7158         vendorbinexp="$ansexp"
7159         : Change installation prefix, if necessary.
7160         if $test X"$prefix" != X"$installprefix"; then
7161                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7162         else
7163                 installvendorbin="$vendorbinexp"
7164         fi
7165         ;;
7166 esac
7167
7168 : check for length of double
7169 echo " "
7170 case "$doublesize" in
7171 '')
7172         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7173         $cat >try.c <<'EOCP'
7174 #include <stdio.h>
7175 int main()
7176 {
7177     printf("%d\n", (int)sizeof(double));
7178     exit(0);
7179 }
7180 EOCP
7181         set try
7182         if eval $compile_ok; then
7183                 doublesize=`./try`
7184                 $echo " $doublesize bytes." >&4
7185         else
7186                 dflt='8'
7187                 echo "(I can't seem to compile the test program.  Guessing...)"
7188                 rp="What is the size of a double precision number (in bytes)?"
7189                 . ./myread
7190                 doublesize="$ans"
7191         fi
7192         ;;
7193 esac
7194 $rm -f try.c try
7195
7196 : check for long doubles
7197 echo " "
7198 $echo $n "Checking to see if your system supports long double..." $c >&4
7199 echo 'int main() { long double x = 7.0; }' > try.c
7200 set try
7201 if eval $compile; then
7202         val="$define"
7203         echo " Yes, it does." >&4
7204 else
7205         val="$undef"
7206         echo " No, it doesn't." >&4
7207 fi
7208 $rm try.*
7209 set d_longdbl
7210 eval $setvar
7211
7212 : check for length of long double
7213 case "${d_longdbl}${longdblsize}" in
7214 $define)
7215         echo " "
7216         $echo $n "Checking to see how big your long doubles are..." $c >&4
7217         $cat >try.c <<'EOCP'
7218 #include <stdio.h>
7219 int main()
7220 {
7221         printf("%d\n", sizeof(long double));
7222 }
7223 EOCP
7224         set try
7225         set try
7226         if eval $compile; then
7227                 longdblsize=`./try$exe_ext`
7228                 $echo " $longdblsize bytes." >&4
7229         else
7230                 dflt='8'
7231                 echo " "
7232                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7233                 rp="What is the size of a long double (in bytes)?"
7234                 . ./myread
7235                 longdblsize="$ans"
7236         fi
7237         if $test "X$doublesize" = "X$longdblsize"; then
7238                 echo "(That isn't any different from an ordinary double.)"
7239         fi      
7240         ;;
7241 esac
7242 $rm -f try.* try
7243
7244 : Check how to convert floats to strings.
7245 if test "X$d_Gconvert" = X; then
7246         echo " "
7247         echo "Checking for an efficient way to convert floats to strings."
7248         $cat >try.c <<EOP
7249 #ifdef TRY_gconvert
7250 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7251 char *myname = "gconvert";
7252 #endif
7253 #ifdef TRY_gcvt
7254 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7255 char *myname = "gcvt";
7256 #endif
7257 #ifdef TRY_qgcvt
7258 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7259 char *myname = "qgcvt";
7260 #define DOUBLETYPE long double
7261 #endif
7262 #ifdef TRY_sprintf
7263 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7264 char *myname = "sprintf";
7265 #endif
7266
7267 #ifndef DOUBLETYPE
7268 #define DOUBLETYPE double
7269 #endif
7270
7271 #include <stdio.h>
7272
7273 #ifdef I_STDLIB
7274 #include <stdlib.h>
7275 #endif
7276
7277 int
7278 checkit(expect, got)
7279 char *expect;
7280 char *got;
7281 {
7282     if (strcmp(expect, got)) {
7283                 printf("%s oddity:  Expected %s, got %s\n",
7284                         myname, expect, got);
7285                 exit(1);
7286         }
7287 }
7288
7289 int main()
7290
7291         char buf[64]; 
7292         buf[63] = '\0';
7293
7294         /* This must be 1st test on (which?) platform */
7295         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7296         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7297         checkit("0.1", buf);
7298
7299         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7300         checkit("1", buf);
7301
7302         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7303         checkit("0", buf);
7304
7305         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7306         checkit("-1", 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         /* Some Linux gcvt's give -1.e+5 here. */
7313         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7314         checkit("-100000", buf);
7315
7316         exit(0);
7317 }
7318 EOP
7319         case "$d_Gconvert" in
7320         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7321         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7322         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7323         *) xxx_list='gconvert gcvt sprintf' ;;
7324         esac
7325
7326         case "$d_longdbl$uselongdouble" in
7327         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7328         esac
7329
7330         for xxx_convert in $xxx_list; do
7331                 echo "Trying $xxx_convert..."
7332                 $rm -f try try$_o
7333                 set try -DTRY_$xxx_convert
7334                 if eval $compile; then
7335                         echo "$xxx_convert() found." >&4
7336                         if ./try; then
7337                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7338                                 break;
7339                         else
7340                                 echo "...But $xxx_convert didn't work as I expected."
7341                         fi
7342                 else
7343                         echo "$xxx_convert NOT found." >&4
7344                 fi
7345         done
7346                 
7347         case "$xxx_convert" in
7348         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7349         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7350         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7351         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7352         esac
7353 fi
7354
7355 echo " "
7356
7357 if $test X"$d_longdbl" = X"$define"; then
7358
7359 echo "Checking how to print long doubles..." >&4
7360
7361 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7362         $cat >try.c <<'EOCP'
7363 #include <sys/types.h>
7364 #include <stdio.h>
7365 int main() {
7366   double d = 123.456;
7367   printf("%.3f\n", d);
7368 }
7369 EOCP
7370         set try
7371         if eval $compile; then
7372                 yyy=`./try$exe_ext`
7373                 case "$yyy" in
7374                 123.456)
7375                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7376                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7377                         echo "We will use %f."
7378                         ;;
7379                 esac
7380         fi
7381 fi
7382
7383 if $test X"$sPRIfldbl" = X; then
7384         $cat >try.c <<'EOCP'
7385 #include <sys/types.h>
7386 #include <stdio.h>
7387 int main() {
7388   long double d = 123.456;
7389   printf("%.3llf\n", d);
7390 }
7391 EOCP
7392         set try
7393         if eval $compile; then
7394                 yyy=`./try$exe_ext`
7395                 case "$yyy" in
7396                 123.456)
7397                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7398                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7399                         echo "We will use %llf."
7400                         ;;
7401                 esac
7402         fi
7403 fi
7404
7405 if $test X"$sPRIfldbl" = X; then
7406         $cat >try.c <<'EOCP'
7407 #include <sys/types.h>
7408 #include <stdio.h>
7409 int main() {
7410   long double d = 123.456;
7411   printf("%.3Lf\n", d);
7412 }
7413 EOCP
7414         set try
7415         if eval $compile; then
7416                 yyy=`./try$exe_ext`
7417                 case "$yyy" in
7418                 123.456)
7419                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7420                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7421                         echo "We will use %Lf."
7422                         ;;
7423                 esac
7424         fi
7425 fi
7426
7427 if $test X"$sPRIfldbl" = X; then
7428         $cat >try.c <<'EOCP'
7429 #include <sys/types.h>
7430 #include <stdio.h>
7431 int main() {
7432   long double d = 123.456;
7433   printf("%.3lf\n", d);
7434 }
7435 EOCP
7436         set try
7437         if eval $compile; then
7438                 yyy=`./try$exe_ext`
7439                 case "$yyy" in
7440                 123.456)
7441                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7442                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7443                         echo "We will use %lf."
7444                         ;;
7445                 esac
7446         fi
7447 fi
7448
7449 if $test X"$sPRIfldbl" = X; then
7450         echo "Cannot figure out how to print long doubles." >&4
7451 fi
7452
7453 $rm -f try try.*
7454
7455 fi # d_longdbl
7456
7457 case "$sPRIfldbl" in
7458 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7459         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7460         ;;
7461 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7462         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7463         ;;
7464 esac
7465
7466 : Initialize h_fcntl
7467 h_fcntl=false
7468
7469 : Initialize h_sysfile
7470 h_sysfile=false
7471
7472 : access call always available on UNIX
7473 set access d_access
7474 eval $inlibc
7475
7476 : locate the flags for 'access()'
7477 case "$d_access" in
7478 "$define")
7479         echo " "
7480         $cat >access.c <<'EOCP'
7481 #include <sys/types.h>
7482 #ifdef I_FCNTL
7483 #include <fcntl.h>
7484 #endif
7485 #ifdef I_SYS_FILE
7486 #include <sys/file.h>
7487 #endif
7488 #ifdef I_UNISTD
7489 #include <unistd.h>
7490 #endif
7491 int main() {
7492         exit(R_OK);
7493 }
7494 EOCP
7495         : check sys/file.h first, no particular reason here
7496         if $test `./findhdr sys/file.h` && \
7497                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7498                 h_sysfile=true;
7499                 echo "<sys/file.h> defines the *_OK access constants." >&4
7500         elif $test `./findhdr fcntl.h` && \
7501                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7502                 h_fcntl=true;
7503                 echo "<fcntl.h> defines the *_OK access constants." >&4
7504         elif $test `./findhdr unistd.h` && \
7505                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7506                 echo "<unistd.h> defines the *_OK access constants." >&4
7507         else
7508                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7509         fi
7510         ;;
7511 esac
7512 $rm -f access*
7513
7514 : see if accessx exists
7515 set accessx d_accessx
7516 eval $inlibc
7517
7518 : see if alarm exists
7519 set alarm d_alarm
7520 eval $inlibc
7521
7522 : see if atolf exists
7523 set atolf d_atolf
7524 eval $inlibc
7525
7526 : see if atoll exists
7527 set atoll d_atoll
7528 eval $inlibc
7529
7530 : Look for GNU-cc style attribute checking
7531 echo " "
7532 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7533 $cat >attrib.c <<'EOCP'
7534 #include <stdio.h>
7535 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7536 EOCP
7537 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7538         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7539                 echo "Your C compiler doesn't fully support __attribute__."
7540                 val="$undef"
7541         else
7542                 echo "Your C compiler supports __attribute__."
7543                 val="$define"
7544         fi
7545 else
7546         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7547         val="$undef"
7548 fi
7549 set d_attribut
7550 eval $setvar
7551 $rm -f attrib*
7552
7553 : see if bcmp exists
7554 set bcmp d_bcmp
7555 eval $inlibc
7556
7557 : see if bcopy exists
7558 set bcopy d_bcopy
7559 eval $inlibc
7560
7561 : see if this is a unistd.h system
7562 set unistd.h i_unistd
7563 eval $inhdr
7564
7565 : see if getpgrp exists
7566 set getpgrp d_getpgrp
7567 eval $inlibc
7568
7569 case "$d_getpgrp" in
7570 "$define")
7571         echo " "
7572         echo "Checking to see which flavor of getpgrp is in use..."
7573         $cat >set.c <<EOP
7574 #$i_unistd I_UNISTD
7575 #include <sys/types.h>
7576 #ifdef I_UNISTD
7577 #  include <unistd.h>
7578 #endif
7579 int main()
7580 {
7581         if (getuid() == 0) {
7582                 printf("(I see you are running Configure as super-user...)\n");
7583                 setuid(1);
7584         }
7585 #ifdef TRY_BSD_PGRP
7586         if (getpgrp(1) == 0)
7587                 exit(0);
7588 #else
7589         if (getpgrp() > 0)
7590                 exit(0);
7591 #endif
7592         exit(1);
7593 }
7594 EOP
7595         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7596                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7597                 val="$define"
7598         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7599                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7600                 val="$undef"
7601         else
7602                 echo "I can't seem to compile and run the test program."
7603                 if ./usg; then
7604                         xxx="a USG one, i.e. you use getpgrp()."
7605                 else
7606                         # SVR4 systems can appear rather BSD-ish.
7607                         case "$i_unistd" in
7608                         $undef)
7609                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7610                                 val="$define"
7611                                 ;;
7612                         $define)
7613                                 xxx="probably a USG one, i.e. you use getpgrp()."
7614                                 val="$undef"
7615                                 ;;
7616                         esac
7617                 fi
7618                 echo "Assuming your getpgrp is $xxx" >&4
7619         fi
7620         ;;
7621 *) val="$undef";;
7622 esac
7623 set d_bsdgetpgrp
7624 eval $setvar
7625 $rm -f set set.c
7626
7627 : see if setpgrp exists
7628 set setpgrp d_setpgrp
7629 eval $inlibc
7630
7631 case "$d_setpgrp" in
7632 "$define")
7633         echo " "
7634         echo "Checking to see which flavor of setpgrp is in use..."
7635         $cat >set.c <<EOP
7636 #$i_unistd I_UNISTD
7637 #include <sys/types.h>
7638 #ifdef I_UNISTD
7639 #  include <unistd.h>
7640 #endif
7641 int main()
7642 {
7643         if (getuid() == 0) {
7644                 printf("(I see you are running Configure as super-user...)\n");
7645                 setuid(1);
7646         }
7647 #ifdef TRY_BSD_PGRP
7648         if (-1 == setpgrp(1, 1))
7649                 exit(0);
7650 #else
7651         if (setpgrp() != -1)
7652                 exit(0);
7653 #endif
7654         exit(1);
7655 }
7656 EOP
7657         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7658                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7659                 val="$define"
7660         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7661                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7662                 val="$undef"
7663         else
7664                 echo "(I can't seem to compile and run the test program.)"
7665                 if ./usg; then
7666                         xxx="a USG one, i.e. you use setpgrp()."
7667                 else
7668                         # SVR4 systems can appear rather BSD-ish.
7669                         case "$i_unistd" in
7670                         $undef)
7671                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7672                                 val="$define"
7673                                 ;;
7674                         $define)
7675                                 xxx="probably a USG one, i.e. you use setpgrp()."
7676                                 val="$undef"
7677                                 ;;
7678                         esac
7679                 fi
7680                 echo "Assuming your setpgrp is $xxx" >&4
7681         fi
7682         ;;
7683 *) val="$undef";;
7684 esac
7685 set d_bsdsetpgrp
7686 eval $setvar
7687 $rm -f set set.c
7688 : see if bzero exists
7689 set bzero d_bzero
7690 eval $inlibc
7691
7692 : see if signal is declared as pointer to function returning int or void
7693 echo " "
7694 xxx=`./findhdr signal.h`
7695 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7696 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7697         echo "You have int (*signal())() instead of void." >&4
7698         val="$undef"
7699 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7700         echo "You have void (*signal())()." >&4
7701         val="$define"
7702 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7703         echo "You have int (*signal())() instead of void." >&4
7704         val="$undef"
7705 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7706         echo "You have void (*signal())()." >&4
7707         val="$define"
7708 else
7709         case "$d_voidsig" in
7710         '')
7711         echo "I can't determine whether signal handler returns void or int..." >&4
7712                 dflt=void
7713                 rp="What type does your signal handler return?"
7714                 . ./myread
7715                 case "$ans" in
7716                 v*) val="$define";;
7717                 *) val="$undef";;
7718                 esac;;
7719         "$define")
7720                 echo "As you already told me, signal handler returns void." >&4
7721                 val="$define"
7722                 ;;
7723         *)      echo "As you already told me, signal handler returns int." >&4
7724                 val="$undef"
7725                 ;;
7726         esac
7727 fi
7728 set d_voidsig
7729 eval $setvar
7730 case "$d_voidsig" in
7731 "$define") signal_t="void";;
7732 *) signal_t="int";;
7733 esac
7734 $rm -f $$.tmp
7735
7736 : check for ability to cast large floats to 32-bit ints.
7737 echo " "
7738 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7739 if $test "$intsize" -ge 4; then
7740         xxx=int
7741 else
7742         xxx=long
7743 fi
7744 $cat >try.c <<EOCP
7745 #include <stdio.h>
7746 #include <sys/types.h>
7747 #include <signal.h>
7748 $signal_t blech(s) int s; { exit(3); }
7749 int main()
7750 {
7751         $xxx i32;
7752         double f, g;
7753         int result = 0;
7754         char str[16];
7755         signal(SIGFPE, blech);
7756
7757         /* Don't let compiler optimize the test away.  Store the number 
7758            in a writable string for gcc to pass to sscanf under HP/UX.
7759         */
7760         sprintf(str, "2147483647");
7761         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7762         g = 10 * f;
7763         i32  = ($xxx) g;
7764
7765         /* x86 processors will probably give 0x8000 0000, which is a
7766        sign change.  We don't want that.  We want to mimic SPARC
7767            behavior here, which is to preserve the sign and give
7768            back 0x7fff ffff.
7769         */
7770         if (i32 != ($xxx) f)
7771                 result |= 1;
7772         exit(result);
7773 }
7774 EOCP
7775 set try
7776 if eval $compile_ok; then
7777         ./try
7778         yyy=$?
7779 else
7780         echo "(I can't seem to compile the test program--assuming it can't)"
7781         yyy=1
7782 fi
7783 case "$yyy" in
7784 0)      val="$define"
7785         echo "Yup, it can."
7786         ;;
7787 *)      val="$undef"
7788         echo "Nope, it can't."
7789         ;;
7790 esac
7791 set d_casti32
7792 eval $setvar
7793 $rm -f try try.*
7794
7795 : check for ability to cast negative floats to unsigned
7796 echo " "
7797 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7798 $cat >try.c <<EOCP
7799 #include <stdio.h>
7800 #include <sys/types.h>
7801 #include <signal.h>
7802 $signal_t blech(s) int s; { exit(7); }
7803 $signal_t blech_in_list(s) int s; { exit(4); }
7804 unsigned long dummy_long(p) unsigned long p; { return p; }
7805 unsigned int dummy_int(p) unsigned int p; { return p; }
7806 unsigned short dummy_short(p) unsigned short p; { return p; }
7807 int main()
7808 {
7809         double f;
7810         unsigned long along;
7811         unsigned int aint;
7812         unsigned short ashort;
7813         int result = 0;
7814         char str[16];
7815         
7816         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7817            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7818            optimized the whole file away
7819         */
7820         /* Store the number in a writable string for gcc to pass to 
7821            sscanf under HP/UX.
7822         */
7823         sprintf(str, "-123");
7824         sscanf(str, "%lf", &f);  /* f = -123.; */
7825
7826         signal(SIGFPE, blech);
7827         along = (unsigned long)f;
7828         aint = (unsigned int)f;
7829         ashort = (unsigned short)f;
7830         if (along != (unsigned long)-123)
7831                 result |= 1;
7832         if (aint != (unsigned int)-123)
7833                 result |= 1;
7834         if (ashort != (unsigned short)-123)
7835                 result |= 1;
7836         sprintf(str, "1073741824.");
7837         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7838         f = f + f;
7839         along = 0;
7840         along = (unsigned long)f;
7841         if (along != 0x80000000)
7842                 result |= 2;
7843         f -= 1.;
7844         along = 0;
7845         along = (unsigned long)f;
7846         if (along != 0x7fffffff)
7847                 result |= 1;
7848         f += 2.;
7849         along = 0;
7850         along = (unsigned long)f;
7851         if (along != 0x80000001)
7852                 result |= 2;
7853         if (result)
7854                 exit(result);
7855         signal(SIGFPE, blech_in_list);
7856         sprintf(str, "123.");
7857         sscanf(str, "%lf", &f);  /* f = 123.; */
7858         along = dummy_long((unsigned long)f);
7859         aint = dummy_int((unsigned int)f);
7860         ashort = dummy_short((unsigned short)f);
7861         if (along != (unsigned long)123)
7862                 result |= 4;
7863         if (aint != (unsigned int)123)
7864                 result |= 4;
7865         if (ashort != (unsigned short)123)
7866                 result |= 4;
7867         exit(result);
7868
7869 }
7870 EOCP
7871 set try
7872 if eval $compile_ok; then
7873         ./try
7874         castflags=$?
7875 else
7876         echo "(I can't seem to compile the test program--assuming it can't)"
7877         castflags=7
7878 fi
7879 case "$castflags" in
7880 0)      val="$define"
7881         echo "Yup, it can."
7882         ;;
7883 *)      val="$undef"
7884         echo "Nope, it can't."
7885         ;;
7886 esac
7887 set d_castneg
7888 eval $setvar
7889 $rm -f try.*
7890
7891 : see if vprintf exists
7892 echo " "
7893 if set vprintf val -f d_vprintf; eval $csym; $val; then
7894         echo 'vprintf() found.' >&4
7895         val="$define"
7896         $cat >vprintf.c <<'EOF'
7897 #include <varargs.h>
7898
7899 int main() { xxx("foo"); }
7900
7901 xxx(va_alist)
7902 va_dcl
7903 {
7904         va_list args;
7905         char buf[10];
7906
7907         va_start(args);
7908         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7909 }
7910 EOF
7911         set vprintf
7912         if eval $compile && ./vprintf; then
7913                 echo "Your vsprintf() returns (int)." >&4
7914                 val2="$undef"
7915         else
7916                 echo "Your vsprintf() returns (char*)." >&4
7917                 val2="$define"
7918         fi
7919 else
7920         echo 'vprintf() NOT found.' >&4
7921                 val="$undef"
7922                 val2="$undef"
7923 fi
7924 set d_vprintf
7925 eval $setvar
7926 val=$val2
7927 set d_charvspr
7928 eval $setvar
7929
7930 : see if chown exists
7931 set chown d_chown
7932 eval $inlibc
7933
7934 : see if chroot exists
7935 set chroot d_chroot
7936 eval $inlibc
7937
7938 : see if chsize exists
7939 set chsize d_chsize
7940 eval $inlibc
7941
7942 : check for const keyword
7943 echo " "
7944 echo 'Checking to see if your C compiler knows about "const"...' >&4
7945 $cat >const.c <<'EOCP'
7946 typedef struct spug { int drokk; } spug;
7947 int main()
7948 {
7949         const char *foo;
7950         const spug y;
7951 }
7952 EOCP
7953 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7954         val="$define"
7955         echo "Yup, it does."
7956 else
7957         val="$undef"
7958         echo "Nope, it doesn't."
7959 fi
7960 set d_const
7961 eval $setvar
7962
7963 : see if crypt exists
7964 echo " "
7965 if set crypt val -f d_crypt; eval $csym; $val; then
7966         echo 'crypt() found.' >&4
7967         val="$define"
7968         cryptlib=''
7969 else
7970         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7971         if $test -z "$cryptlib"; then
7972                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7973         else
7974                 cryptlib=-lcrypt
7975         fi
7976         if $test -z "$cryptlib"; then
7977                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7978         else
7979                 cryptlib=-lcrypt
7980         fi
7981         if $test -z "$cryptlib"; then
7982                 cryptlib=`./loc libcrypt$_a "" $libpth`
7983         else
7984                 cryptlib=-lcrypt
7985         fi
7986         if $test -z "$cryptlib"; then
7987                 echo 'crypt() NOT found.' >&4
7988                 val="$undef"
7989         else
7990                 val="$define"
7991         fi
7992 fi
7993 set d_crypt
7994 eval $setvar
7995
7996 : get csh whereabouts
7997 case "$csh" in
7998 'csh') val="$undef" ;;
7999 *) val="$define" ;;
8000 esac
8001 set d_csh
8002 eval $setvar
8003 : Respect a hint or command line value for full_csh.
8004 case "$full_csh" in
8005 '') full_csh=$csh ;;
8006 esac
8007
8008 : see if cuserid exists
8009 set cuserid d_cuserid
8010 eval $inlibc
8011
8012 : see if this is a limits.h system
8013 set limits.h i_limits
8014 eval $inhdr
8015
8016 : see if this is a float.h system
8017 set float.h i_float
8018 eval $inhdr
8019
8020 : See if number of significant digits in a double precision number is known
8021 echo " "
8022 $cat >dbl_dig.c <<EOM
8023 #$i_limits I_LIMITS
8024 #$i_float I_FLOAT
8025 #ifdef I_LIMITS
8026 #include <limits.h>
8027 #endif
8028 #ifdef I_FLOAT
8029 #include <float.h>
8030 #endif
8031 #ifdef DBL_DIG
8032 printf("Contains DBL_DIG");
8033 #endif
8034 EOM
8035 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8036 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8037         echo "DBL_DIG found." >&4
8038         val="$define"
8039 else
8040         echo "DBL_DIG NOT found." >&4
8041         val="$undef"
8042 fi
8043 $rm -f dbl_dig.?
8044 set d_dbl_dig
8045 eval $setvar
8046
8047 : see if difftime exists
8048 set difftime d_difftime
8049 eval $inlibc
8050
8051 : see if this is a dirent system
8052 echo " "
8053 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8054         val="$define"
8055         echo "<dirent.h> found." >&4
8056 else
8057         val="$undef"
8058         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8059                 echo "<sys/dir.h> found." >&4
8060                 echo " "
8061         else
8062                 xinc=`./findhdr sys/ndir.h`
8063         fi
8064         echo "<dirent.h> NOT found." >&4
8065 fi
8066 set i_dirent
8067 eval $setvar
8068
8069 : Look for type of directory structure.
8070 echo " "
8071 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8072
8073 case "$direntrytype" in
8074 ''|' ')
8075         case "$i_dirent" in
8076         $define) guess1='struct dirent' ;;
8077         *) guess1='struct direct'  ;;
8078         esac
8079         ;;
8080 *)      guess1="$direntrytype"
8081         ;;
8082 esac
8083
8084 case "$guess1" in
8085 'struct dirent') guess2='struct direct' ;;
8086 *) guess2='struct dirent' ;;
8087 esac
8088                 
8089 if $contains "$guess1" try.c >/dev/null 2>&1; then
8090         direntrytype="$guess1"
8091         echo "Your directory entries are $direntrytype." >&4
8092 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8093         direntrytype="$guess2"
8094         echo "Your directory entries seem to be $direntrytype." >&4
8095 else
8096         echo "I don't recognize your system's directory entries." >&4
8097         rp="What type is used for directory entries on this system?"
8098         dflt="$guess1"
8099         . ./myread
8100         direntrytype="$ans"
8101 fi
8102 $rm -f try.c
8103
8104
8105 : see if the directory entry stores field length
8106 echo " "
8107 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8108 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8109         echo "Good, your directory entry keeps length information in d_namlen." >&4
8110         val="$define"
8111 else
8112         echo "Your directory entry does not know about the d_namlen field." >&4
8113         val="$undef"
8114 fi
8115 set d_dirnamlen
8116 eval $setvar
8117 $rm -f try.c
8118
8119 : see if dlerror exists
8120 xxx_runnm="$runnm"
8121 runnm=false
8122 set dlerror d_dlerror
8123 eval $inlibc
8124 runnm="$xxx_runnm"
8125
8126 : see if dlfcn is available
8127 set dlfcn.h i_dlfcn
8128 eval $inhdr
8129
8130 case "$usedl" in
8131 $define|y|true)
8132         $cat << EOM
8133
8134 On a few systems, the dynamically loaded modules that perl generates and uses
8135 will need a different extension than shared libs. The default will probably
8136 be appropriate.
8137
8138 EOM
8139         case "$dlext" in
8140         '')     dflt="$so" ;;
8141         *)      dflt="$dlext" ;;
8142         esac
8143         rp='What is the extension of dynamically loaded modules'
8144         . ./myread
8145         dlext="$ans"
8146         ;;
8147 *)
8148         dlext="none"
8149         ;;
8150 esac
8151
8152 : Check if dlsym need a leading underscore
8153 echo " "
8154 val="$undef"
8155
8156 case "$dlsrc" in
8157 dl_dlopen.xs)
8158         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8159         $cat >dyna.c <<'EOM'
8160 fred () { }
8161 EOM
8162
8163 $cat >fred.c<<EOM
8164
8165 #include <stdio.h>
8166 #$i_dlfcn I_DLFCN
8167 #ifdef I_DLFCN
8168 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8169 #else
8170 #include <sys/types.h>
8171 #include <nlist.h>
8172 #include <link.h>
8173 #endif
8174
8175 extern int fred() ;
8176
8177 int main()
8178 {
8179     void * handle ;
8180     void * symbol ;
8181 #ifndef RTLD_LAZY
8182     int mode = 1 ;
8183 #else
8184     int mode = RTLD_LAZY ;
8185 #endif
8186     handle = dlopen("./dyna.$dlext", mode) ;
8187     if (handle == NULL) {
8188         printf ("1\n") ;
8189         fflush (stdout) ;
8190         exit(0);
8191     }
8192     symbol = dlsym(handle, "fred") ;
8193     if (symbol == NULL) {
8194         /* try putting a leading underscore */
8195         symbol = dlsym(handle, "_fred") ;
8196         if (symbol == NULL) {
8197             printf ("2\n") ;
8198             fflush (stdout) ;
8199             exit(0);
8200         }
8201         printf ("3\n") ;
8202     }
8203     else
8204         printf ("4\n") ;
8205     fflush (stdout) ;
8206     exit(0);
8207 }
8208 EOM
8209         : Call the object file tmp-dyna.o in case dlext=o.
8210         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8211                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8212                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8213                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8214                 xxx=`./fred`
8215                 case $xxx in
8216                 1)      echo "Test program failed using dlopen." >&4
8217                         echo "Perhaps you should not use dynamic loading." >&4;;
8218                 2)      echo "Test program failed using dlsym." >&4
8219                         echo "Perhaps you should not use dynamic loading." >&4;;
8220                 3)      echo "dlsym needs a leading underscore" >&4
8221                         val="$define" ;;
8222                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8223                 esac
8224         else
8225                 echo "I can't compile and run the test program." >&4
8226                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8227         fi
8228         ;;
8229 esac
8230                 
8231 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8232
8233 set d_dlsymun
8234 eval $setvar
8235
8236 hasproto='varname=$1; func=$2; shift; shift;
8237 while $test $# -ge 2; do
8238         case "$1" in
8239         $define) echo "#include <$2>";;
8240         esac ;
8241     shift 2;
8242 done > try.c;
8243 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8244 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8245         echo "$func() prototype found.";
8246         val="$define";
8247 else
8248         echo "$func() prototype NOT found.";
8249         val="$undef";
8250 fi;
8251 set $varname;
8252 eval $setvar;
8253 $rm -f try.c tryout.c'
8254
8255 : see if prototype for drand48 is available
8256 echo " "
8257 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8258 eval $hasproto
8259
8260 : see if dup2 exists
8261 set dup2 d_dup2
8262 eval $inlibc
8263
8264 : see if eaccess exists
8265 set eaccess d_eaccess
8266 eval $inlibc
8267
8268 : see if endgrent exists
8269 set endgrent d_endgrent
8270 eval $inlibc
8271
8272 : see if endhostent exists
8273 set endhostent d_endhent
8274 eval $inlibc
8275
8276 : see if endnetent exists
8277 set endnetent d_endnent
8278 eval $inlibc
8279
8280 : see if endprotoent exists
8281 set endprotoent d_endpent
8282 eval $inlibc
8283
8284 : see if endpwent exists
8285 set endpwent d_endpwent
8286 eval $inlibc
8287
8288 : see if endservent exists
8289 set endservent d_endsent
8290 eval $inlibc
8291
8292 : see if endspent exists
8293 set endspent d_endspent
8294 eval $inlibc
8295
8296 : Locate the flags for 'open()'
8297 echo " "
8298 $cat >open3.c <<'EOCP'
8299 #include <sys/types.h>
8300 #ifdef I_FCNTL
8301 #include <fcntl.h>
8302 #endif
8303 #ifdef I_SYS_FILE
8304 #include <sys/file.h>
8305 #endif
8306 int main() {
8307         if(O_RDONLY);
8308 #ifdef O_TRUNC
8309         exit(0);
8310 #else
8311         exit(1);
8312 #endif
8313 }
8314 EOCP
8315 : check sys/file.h first to get FREAD on Sun
8316 if $test `./findhdr sys/file.h` && \
8317                 set open3 -DI_SYS_FILE && eval $compile; then
8318         h_sysfile=true;
8319         echo "<sys/file.h> defines the O_* constants..." >&4
8320         if ./open3; then
8321                 echo "and you have the 3 argument form of open()." >&4
8322                 val="$define"
8323         else
8324                 echo "but not the 3 argument form of open().  Oh, well." >&4
8325                 val="$undef"
8326         fi
8327 elif $test `./findhdr fcntl.h` && \
8328                 set open3 -DI_FCNTL && eval $compile; then
8329         h_fcntl=true;
8330         echo "<fcntl.h> defines the O_* constants..." >&4
8331         if ./open3; then
8332                 echo "and you have the 3 argument form of open()." >&4
8333                 val="$define"
8334         else
8335                 echo "but not the 3 argument form of open().  Oh, well." >&4
8336                 val="$undef"
8337         fi
8338 else
8339         val="$undef"
8340         echo "I can't find the O_* constant definitions!  You got problems." >&4
8341 fi
8342 set d_open3
8343 eval $setvar
8344 $rm -f open3*
8345
8346 : see which of string.h or strings.h is needed
8347 echo " "
8348 strings=`./findhdr string.h`
8349 if $test "$strings" && $test -r "$strings"; then
8350         echo "Using <string.h> instead of <strings.h>." >&4
8351         val="$define"
8352 else
8353         val="$undef"
8354         strings=`./findhdr strings.h`
8355         if $test "$strings" && $test -r "$strings"; then
8356                 echo "Using <strings.h> instead of <string.h>." >&4
8357         else
8358                 echo "No string header found -- You'll surely have problems." >&4
8359         fi
8360 fi
8361 set i_string
8362 eval $setvar
8363 case "$i_string" in
8364 "$undef") strings=`./findhdr strings.h`;;
8365 *)        strings=`./findhdr string.h`;;
8366 esac
8367
8368 : check for non-blocking I/O stuff
8369 case "$h_sysfile" in
8370 true) echo "#include <sys/file.h>" > head.c;;
8371 *)
8372         case "$h_fcntl" in
8373         true) echo "#include <fcntl.h>" > head.c;;
8374         *) echo "#include <sys/fcntl.h>" > head.c;;
8375         esac
8376         ;;
8377 esac
8378 echo " "
8379 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8380 case "$o_nonblock" in
8381 '')
8382         $cat head.c > try.c
8383         $cat >>try.c <<'EOCP'
8384 #include <stdio.h>
8385 int main() {
8386 #ifdef O_NONBLOCK
8387         printf("O_NONBLOCK\n");
8388         exit(0);
8389 #endif
8390 #ifdef O_NDELAY
8391         printf("O_NDELAY\n");
8392         exit(0);
8393 #endif
8394 #ifdef FNDELAY
8395         printf("FNDELAY\n");
8396         exit(0);
8397 #endif
8398         exit(0);
8399 }
8400 EOCP
8401         set try
8402         if eval $compile_ok; then
8403                 o_nonblock=`./try`
8404                 case "$o_nonblock" in
8405                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8406                 *) echo "Seems like we can use $o_nonblock.";;
8407                 esac
8408         else
8409                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8410         fi
8411         ;;
8412 *) echo "Using $hint value $o_nonblock.";;
8413 esac
8414 $rm -f try try.* .out core
8415
8416 echo " "
8417 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8418 case "$eagain" in
8419 '')
8420         $cat head.c > try.c
8421         $cat >>try.c <<EOCP
8422 #include <errno.h>
8423 #include <sys/types.h>
8424 #include <signal.h>
8425 #include <stdio.h> 
8426 #define MY_O_NONBLOCK $o_nonblock
8427 #ifndef errno  /* XXX need better Configure test */
8428 extern int errno;
8429 #endif
8430 #$i_unistd I_UNISTD
8431 #ifdef I_UNISTD
8432 #include <unistd.h>
8433 #endif
8434 #ifdef $i_string
8435 #include <string.h>
8436 #else
8437 #include <strings.h>
8438 #endif
8439 $signal_t blech(x) int x; { exit(3); }
8440 EOCP
8441         $cat >> try.c <<'EOCP'
8442 int main()
8443 {
8444         int pd[2];
8445         int pu[2];
8446         char buf[1];
8447         char string[100];
8448
8449         pipe(pd);       /* Down: child -> parent */
8450         pipe(pu);       /* Up: parent -> child */
8451         if (0 != fork()) {
8452                 int ret;
8453                 close(pd[1]);   /* Parent reads from pd[0] */
8454                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8455                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8456                         exit(1);
8457                 signal(SIGALRM, blech);
8458                 alarm(5);
8459                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8460                         exit(2);
8461                 sprintf(string, "%d\n", ret);
8462                 write(2, string, strlen(string));
8463                 alarm(0);
8464 #ifdef EAGAIN
8465                 if (errno == EAGAIN) {
8466                         printf("EAGAIN\n");
8467                         goto ok;
8468                 }
8469 #endif
8470 #ifdef EWOULDBLOCK
8471                 if (errno == EWOULDBLOCK)
8472                         printf("EWOULDBLOCK\n");
8473 #endif
8474         ok:
8475                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8476                 sleep(2);                               /* Give it time to close our pipe */
8477                 alarm(5);
8478                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8479                 alarm(0);
8480                 sprintf(string, "%d\n", ret);
8481                 write(3, string, strlen(string));
8482                 exit(0);
8483         }
8484
8485         close(pd[0]);                   /* We write to pd[1] */
8486         close(pu[1]);                   /* We read from pu[0] */
8487         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8488         close(pd[1]);                   /* Pipe pd is now fully closed! */
8489         exit(0);                                /* Bye bye, thank you for playing! */
8490 }
8491 EOCP
8492         set try
8493         if eval $compile_ok; then
8494                 echo "$startsh" >mtry
8495                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8496                 chmod +x mtry
8497                 ./mtry >/dev/null 2>&1
8498                 case $? in
8499                 0) eagain=`$cat try.out`;;
8500                 1) echo "Could not perform non-blocking setting!";;
8501                 2) echo "I did a successful read() for something that was not there!";;
8502                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8503                 *) echo "Something terribly wrong happened during testing.";;
8504                 esac
8505                 rd_nodata=`$cat try.ret`
8506                 echo "A read() system call with no data present returns $rd_nodata."
8507                 case "$rd_nodata" in
8508                 0|-1) ;;
8509                 *)
8510                         echo "(That's peculiar, fixing that to be -1.)"
8511                         rd_nodata=-1
8512                         ;;
8513                 esac
8514                 case "$eagain" in
8515                 '')
8516                         echo "Forcing errno EAGAIN on read() with no data available."
8517                         eagain=EAGAIN
8518                         ;;
8519                 *)
8520                         echo "Your read() sets errno to $eagain when no data is available."
8521                         ;;
8522                 esac
8523                 status=`$cat try.err`
8524                 case "$status" in
8525                 0) echo "And it correctly returns 0 to signal EOF.";;
8526                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8527                 *) echo "However, your read() returns '$status' on EOF??";;
8528                 esac
8529                 val="$define"
8530                 if test "$status" = "$rd_nodata"; then
8531                         echo "WARNING: you can't distinguish between EOF and no data!"
8532                         val="$undef"
8533                 fi
8534         else
8535                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8536                 eagain=EAGAIN
8537         fi
8538         set d_eofnblk
8539         eval $setvar
8540         ;;
8541 *)
8542         echo "Using $hint value $eagain."
8543         echo "Your read() returns $rd_nodata when no data is present."
8544         case "$d_eofnblk" in
8545         "$define") echo "And you can see EOF because read() returns 0.";;
8546         "$undef") echo "But you can't see EOF status from read() returned value.";;
8547         *)
8548                 echo "(Assuming you can't see EOF status from read anyway.)"
8549                 d_eofnblk=$undef
8550                 ;;
8551         esac
8552         ;;
8553 esac
8554 $rm -f try try.* .out core head.c mtry
8555
8556 : see if fchmod exists
8557 set fchmod d_fchmod
8558 eval $inlibc
8559
8560 : see if fchown exists
8561 set fchown d_fchown
8562 eval $inlibc
8563
8564 : see if this is an fcntl system
8565 set fcntl d_fcntl
8566 eval $inlibc
8567
8568 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8569 while $test $# -ge 2; do
8570         case "$1" in
8571         $define) echo "#include <$2>";;
8572         esac ;
8573     shift 2;
8574 done > try.c;
8575 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8576 set try;
8577 if eval $compile; then
8578         val="$define";
8579 else
8580         val="$undef";
8581 fi;
8582 set $varname;
8583 eval $setvar;
8584 $rm -f try.c try.o'
8585
8586 socketlib=''
8587 sockethdr=''
8588 : see whether socket exists
8589 echo " "
8590 $echo $n "Hmm... $c" >&4
8591 if set socket val -f d_socket; eval $csym; $val; then
8592         echo "Looks like you have Berkeley networking support." >&4
8593         d_socket="$define"
8594         if set setsockopt val -f; eval $csym; $val; then
8595                 d_oldsock="$undef"
8596         else
8597                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8598                 d_oldsock="$define"
8599         fi
8600 else
8601         if $contains socklib libc.list >/dev/null 2>&1; then
8602                 echo "Looks like you have Berkeley networking support." >&4
8603                 d_socket="$define"
8604                 : we will have to assume that it supports the 4.2 BSD interface
8605                 d_oldsock="$undef"
8606         else
8607                 echo "You don't have Berkeley networking in libc$_a..." >&4
8608                 if test "X$d_socket" = "X$define"; then
8609                    echo "...but you seem to believe that you have sockets." >&4
8610                 else
8611                         for net in net socket
8612                         do
8613                                 if test -f /usr/lib/lib$net$_a; then
8614                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8615                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8616                                         if $contains socket libc.list >/dev/null 2>&1; then
8617                                                 d_socket="$define"
8618                                                 socketlib="-l$net"
8619                                                 case "$net" in
8620                                                 net)
8621                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8622                                                         sockethdr="-I/usr/netinclude"
8623                                                         ;;
8624                                                 esac
8625                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8626                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8627                                                         d_oldsock="$undef"
8628                                                 else
8629                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8630                                                         d_oldsock="$define"
8631                                                 fi
8632                                                 break
8633                                         fi
8634                                 fi
8635                         done
8636                         if test "X$d_socket" != "X$define"; then
8637                            echo "or anywhere else I see." >&4
8638                            d_socket="$undef"
8639                            d_oldsock="$undef"
8640                         fi
8641                 fi
8642         fi
8643 fi
8644
8645 : see if socketpair exists
8646 set socketpair d_sockpair
8647 eval $inlibc
8648
8649
8650 echo " "
8651 echo "Checking the availability of certain socket constants..." >& 4
8652 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8653         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8654         $cat >try.c <<EOF
8655 #include <sys/types.h>
8656 #include <sys/socket.h>
8657 int main() {
8658     int i = $ENUM;
8659 }
8660 EOF
8661         val="$undef"
8662         set try; if eval $compile; then
8663                 val="$define"
8664         fi
8665         set d_${enum}; eval $setvar
8666         $rm -f try.c try
8667 done
8668
8669 : see if sys/select.h has to be included
8670 set sys/select.h i_sysselct
8671 eval $inhdr
8672
8673 : see if we should include time.h, sys/time.h, or both
8674 echo " "
8675 if test "X$timeincl" = X; then
8676         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8677         $echo $n "I'm now running the test program...$c"
8678         $cat >try.c <<'EOCP'
8679 #include <sys/types.h>
8680 #ifdef I_TIME
8681 #include <time.h>
8682 #endif
8683 #ifdef I_SYSTIME
8684 #ifdef SYSTIMEKERNEL
8685 #define KERNEL
8686 #endif
8687 #include <sys/time.h>
8688 #endif
8689 #ifdef I_SYSSELECT
8690 #include <sys/select.h>
8691 #endif
8692 int main()
8693 {
8694         struct tm foo;
8695 #ifdef S_TIMEVAL
8696         struct timeval bar;
8697 #endif
8698 #ifdef S_TIMEZONE
8699         struct timezone tzp;
8700 #endif
8701         if (foo.tm_sec == foo.tm_sec)
8702                 exit(0);
8703 #ifdef S_TIMEVAL
8704         if (bar.tv_sec == bar.tv_sec)
8705                 exit(0);
8706 #endif
8707         exit(1);
8708 }
8709 EOCP
8710         flags=''
8711         for s_timezone in '-DS_TIMEZONE' ''; do
8712         sysselect=''
8713         for s_timeval in '-DS_TIMEVAL' ''; do
8714         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8715         for i_time in '' '-DI_TIME'; do
8716         for i_systime in '-DI_SYSTIME' ''; do
8717                 case "$flags" in
8718                 '') $echo $n ".$c"
8719                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8720                         if eval $compile; then
8721                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8722                                 shift
8723                                 flags="$*"
8724                                 echo " "
8725                                 $echo $n "Succeeded with $flags$c"
8726                         fi
8727                         ;;
8728                 esac
8729         done
8730         done
8731         done
8732         done
8733         done
8734         timeincl=''
8735         echo " "
8736         case "$flags" in
8737         *SYSTIMEKERNEL*) i_systimek="$define"
8738                 timeincl=`./findhdr sys/time.h`
8739                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8740         *) i_systimek="$undef";;
8741         esac
8742         case "$flags" in
8743         *I_TIME*) i_time="$define"
8744                 timeincl=`./findhdr time.h`" $timeincl"
8745                 echo "We'll include <time.h>." >&4;;
8746         *) i_time="$undef";;
8747         esac
8748         case "$flags" in
8749         *I_SYSTIME*) i_systime="$define"
8750                 timeincl=`./findhdr sys/time.h`" $timeincl"
8751                 echo "We'll include <sys/time.h>." >&4;;
8752         *) i_systime="$undef";;
8753         esac
8754         $rm -f try.c try
8755 fi
8756
8757 : check for fd_set items
8758 $cat <<EOM
8759
8760 Checking to see how well your C compiler handles fd_set and friends ...
8761 EOM
8762 $cat >fd_set.c <<EOCP
8763 #$i_systime I_SYS_TIME
8764 #$i_sysselct I_SYS_SELECT
8765 #$d_socket HAS_SOCKET
8766 #include <sys/types.h>
8767 #ifdef HAS_SOCKET
8768 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8769 #endif
8770 #ifdef I_SYS_TIME
8771 #include <sys/time.h>
8772 #endif
8773 #ifdef I_SYS_SELECT
8774 #include <sys/select.h>
8775 #endif
8776 int main() {
8777         fd_set fds;
8778
8779 #ifdef TRYBITS
8780         if(fds.fds_bits);
8781 #endif
8782
8783 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8784         exit(0);
8785 #else
8786         exit(1);
8787 #endif
8788 }
8789 EOCP
8790 set fd_set -DTRYBITS
8791 if eval $compile; then
8792         d_fds_bits="$define"
8793         d_fd_set="$define"
8794         echo "Well, your system knows about the normal fd_set typedef..." >&4
8795         if ./fd_set; then
8796                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8797                 d_fd_macros="$define"
8798         else
8799                 $cat >&4 <<'EOM'
8800 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8801 EOM
8802                 d_fd_macros="$undef"
8803         fi
8804 else
8805         $cat <<'EOM'
8806 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8807 EOM
8808         set fd_set
8809         if eval $compile; then
8810                 d_fds_bits="$undef"
8811                 d_fd_set="$define"
8812                 echo "Well, your system has some sort of fd_set available..." >&4
8813                 if ./fd_set; then
8814                         echo "and you have the normal fd_set macros." >&4
8815                         d_fd_macros="$define"
8816                 else
8817                         $cat <<'EOM'
8818 but not the normal fd_set macros!  Gross!  More work for me...
8819 EOM
8820                         d_fd_macros="$undef"
8821                 fi
8822         else
8823         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8824                 d_fd_set="$undef"
8825                 d_fds_bits="$undef"
8826                 d_fd_macros="$undef"
8827         fi
8828 fi
8829 $rm -f fd_set*
8830
8831 : see if fgetpos exists
8832 set fgetpos d_fgetpos
8833 eval $inlibc
8834
8835 : see if flock exists
8836 set flock d_flock
8837 eval $inlibc
8838
8839 : see if fork exists
8840 set fork d_fork
8841 eval $inlibc
8842
8843 : see if pathconf exists
8844 set pathconf d_pathconf
8845 eval $inlibc
8846
8847 : see if fpathconf exists
8848 set fpathconf d_fpathconf
8849 eval $inlibc
8850
8851
8852 : check for off64_t
8853 echo " "
8854 echo "Checking to see if your system supports off64_t..." >&4
8855 $cat >try.c <<EOCP
8856 #include <sys/types.h>
8857 #include <unistd.h>
8858 int main() { off64_t x = 7; }'
8859 EOCP
8860 set try
8861 if eval $compile; then
8862         val="$define"
8863         echo "Yes, it does."
8864 else
8865         val="$undef"
8866         echo "No, it doesn't."
8867         case "$lseeksize" in
8868         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8869         esac
8870 fi
8871 $rm -f try.* try
8872 set d_off64_t
8873 eval $setvar
8874
8875 : check for fpos64_t
8876 echo " "
8877 echo "Checking to see if your system supports fpos64_t..." >&4
8878 $cat >try.c <<EOCP
8879 #include <sys/stdio.h>
8880 int main() { fpos64_t x x = 7; }'
8881 EOCP
8882 set try
8883 if eval $compile; then
8884         val="$define"
8885         echo "Yes, it does."
8886 else
8887         val="$undef"
8888         echo "No, it doesn't."
8889         case "$fpossize" in
8890         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8891         esac
8892 fi
8893 $rm -f try.* try
8894 set d_fpos64_t
8895 eval $setvar
8896
8897 hasstruct='varname=$1; struct=$2; shift; shift;
8898 while $test $# -ge 2; do
8899         case "$1" in
8900         $define) echo "#include <$2>";;
8901         esac ;
8902     shift 2;
8903 done > try.c;
8904 echo "int main () { struct $struct foo; }" >> try.c;
8905 set try;
8906 if eval $compile; then
8907         val="$define";
8908 else
8909         val="$undef";
8910 fi;
8911 set $varname;
8912 eval $setvar;
8913 $rm -f try.c try.o'
8914
8915 : see if this is a sys/param system
8916 set sys/param.h i_sysparam
8917 eval $inhdr
8918
8919 : see if this is a sys/mount.h system
8920 set sys/mount.h i_sysmount
8921 eval $inhdr
8922
8923 : see if sys/types.h has to be included
8924 set sys/types.h i_systypes
8925 eval $inhdr
8926
8927
8928 echo " "
8929 echo "Checking to see if your system supports struct fs_data..." >&4
8930 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8931 eval $hasstruct
8932 case "$d_fs_data_s" in
8933 "$define")      echo "Yes, it does."   ;;
8934 *)              echo "No, it doesn't." ;;
8935 esac
8936
8937 : see if fseeko exists
8938 set fseeko d_fseeko
8939 eval $inlibc
8940 case "$longsize" in
8941 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8942 esac
8943
8944 : see if fsetpos exists
8945 set fsetpos d_fsetpos
8946 eval $inlibc
8947
8948
8949 : see if fstatfs exists
8950 set fstatfs d_fstatfs
8951 eval $inlibc
8952
8953
8954 : see if statvfs exists
8955 set statvfs d_statvfs
8956 eval $inlibc
8957
8958 : see if fstatvfs exists
8959 set fstatvfs d_fstatvfs
8960 eval $inlibc
8961
8962
8963 : see if ftello exists
8964 set ftello d_ftello
8965 eval $inlibc
8966 case "$longsize" in
8967 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8968 esac
8969
8970 : see if getgrent exists
8971 set getgrent d_getgrent
8972 eval $inlibc
8973
8974 : see if gethostbyaddr exists
8975 set gethostbyaddr d_gethbyaddr
8976 eval $inlibc
8977
8978 : see if gethostbyname exists
8979 set gethostbyname d_gethbyname
8980 eval $inlibc
8981
8982 : see if gethostent exists
8983 set gethostent d_gethent
8984 eval $inlibc
8985
8986 : see how we will look up host name
8987 echo " "
8988 call=''
8989 if set gethostname val -f d_gethname; eval $csym; $val; then
8990         echo 'gethostname() found.' >&4
8991         d_gethname="$define"
8992         call=gethostname
8993 fi
8994 if set uname val -f d_uname; eval $csym; $val; then
8995         if ./xenix; then
8996                 $cat <<'EOM'
8997 uname() was found, but you're running xenix, and older versions of xenix
8998 have a broken uname(). If you don't really know whether your xenix is old
8999 enough to have a broken system call, use the default answer.
9000
9001 EOM
9002                 dflt=y
9003                 case "$d_uname" in
9004                 "$define") dflt=n;;
9005                 esac
9006                 rp='Is your uname() broken?'
9007                 . ./myread
9008                 case "$ans" in
9009                 n*) d_uname="$define"; call=uname;;
9010                 esac
9011         else
9012                 echo 'uname() found.' >&4
9013                 d_uname="$define"
9014                 case "$call" in
9015                 '') call=uname ;;
9016                 esac
9017         fi
9018 fi
9019 case "$d_gethname" in
9020 '') d_gethname="$undef";;
9021 esac
9022 case "$d_uname" in
9023 '') d_uname="$undef";;
9024 esac
9025 case "$d_uname$d_gethname" in
9026 *define*)
9027         dflt=n
9028         cat <<EOM
9029  
9030 Every now and then someone has a $call() that lies about the hostname
9031 but can't be fixed for political or economic reasons.  If you wish, I can
9032 pretend $call() isn't there and maybe compute hostname at run-time
9033 thanks to the '$phostname' command.
9034
9035 EOM
9036         rp="Shall I ignore $call() from now on?"
9037         . ./myread
9038         case "$ans" in
9039         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9040         esac;;
9041 esac
9042 case "$phostname" in
9043 '') aphostname='';;
9044 *) case "$aphostname" in
9045         /*) ;;
9046         *) set X $phostname
9047                 shift
9048                 file=$1
9049                 shift
9050                 file=`./loc $file $file $pth`
9051                 aphostname=`echo $file $*`
9052                 ;;
9053         esac
9054         ;;
9055 esac
9056 case "$d_uname$d_gethname" in
9057 *define*) ;;
9058 *)
9059         case "$phostname" in
9060         '')
9061                 echo "There will be no way for $package to get your hostname." >&4;;
9062         *)
9063         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9064                 ;;
9065         esac;;
9066 esac
9067 case "$d_phostname" in
9068 '') d_phostname="$undef";;
9069 esac
9070
9071 : see if this is a netdb.h system
9072 set netdb.h i_netdb
9073 eval $inhdr
9074
9075 : see if prototypes for various gethostxxx netdb.h functions are available
9076 echo " "
9077 set d_gethostprotos gethostent $i_netdb netdb.h
9078 eval $hasproto
9079
9080 : see if getlogin exists
9081 set getlogin d_getlogin
9082 eval $inlibc
9083
9084 : see if getmnt exists
9085 set getmnt d_getmnt
9086 eval $inlibc
9087
9088 : see if getmntent exists
9089 set getmntent d_getmntent
9090 eval $inlibc
9091
9092 : see if getnetbyaddr exists
9093 set getnetbyaddr d_getnbyaddr
9094 eval $inlibc
9095
9096 : see if getnetbyname exists
9097 set getnetbyname d_getnbyname
9098 eval $inlibc
9099
9100 : see if getnetent exists
9101 set getnetent d_getnent
9102 eval $inlibc
9103
9104 : see if prototypes for various getnetxxx netdb.h functions are available
9105 echo " "
9106 set d_getnetprotos getnetent $i_netdb netdb.h
9107 eval $hasproto
9108
9109
9110 : see if getprotobyname exists
9111 set getprotobyname d_getpbyname
9112 eval $inlibc
9113
9114 : see if getprotobynumber exists
9115 set getprotobynumber d_getpbynumber
9116 eval $inlibc
9117
9118 : see if getprotoent exists
9119 set getprotoent d_getpent
9120 eval $inlibc
9121
9122 : see if getpgid exists
9123 set getpgid d_getpgid
9124 eval $inlibc
9125
9126 : see if getpgrp2 exists
9127 set getpgrp2 d_getpgrp2
9128 eval $inlibc
9129
9130 : see if getppid exists
9131 set getppid d_getppid
9132 eval $inlibc
9133
9134 : see if getpriority exists
9135 set getpriority d_getprior
9136 eval $inlibc
9137
9138 : see if prototypes for various getprotoxxx netdb.h functions are available
9139 echo " "
9140 set d_getprotoprotos getprotoent $i_netdb netdb.h
9141 eval $hasproto
9142
9143 : see if getpwent exists
9144 set getpwent d_getpwent
9145 eval $inlibc
9146
9147
9148 : see if getservbyname exists
9149 set getservbyname d_getsbyname
9150 eval $inlibc
9151
9152 : see if getservbyport exists
9153 set getservbyport d_getsbyport
9154 eval $inlibc
9155
9156 : see if getservent exists
9157 set getservent d_getsent
9158 eval $inlibc
9159
9160 : see if prototypes for various getservxxx netdb.h functions are available
9161 echo " "
9162 set d_getservprotos getservent $i_netdb netdb.h
9163 eval $hasproto
9164
9165 : see if getspent exists
9166 set getspent d_getspent
9167 eval $inlibc
9168
9169 : see if getspnam exists
9170 set getspnam d_getspnam
9171 eval $inlibc
9172
9173 : see if gettimeofday or ftime exists
9174 set gettimeofday d_gettimeod
9175 eval $inlibc
9176 case "$d_gettimeod" in
9177 "$undef")
9178         set ftime d_ftime 
9179         eval $inlibc
9180         ;;
9181 *)
9182         val="$undef"; set d_ftime; eval $setvar
9183         ;;
9184 esac
9185 case "$d_gettimeod$d_ftime" in
9186 "$undef$undef")
9187         echo " "
9188         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9189         ;;
9190 esac
9191
9192 : see if this is an grp system
9193 set grp.h i_grp
9194 eval $inhdr
9195
9196 case "$i_grp" in
9197 $define)
9198         xxx=`./findhdr grp.h`
9199         $cppstdin $cppflags $cppminus < $xxx >$$.h
9200
9201         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9202                 val="$define"
9203         else
9204                 val="$undef"
9205         fi
9206         set d_grpasswd
9207         eval $setvar
9208
9209         $rm -f $$.h
9210         ;;
9211 *)
9212         val="$undef";
9213         set d_grpasswd; eval $setvar
9214         ;;
9215 esac
9216
9217 : see if hasmntopt exists
9218 set hasmntopt d_hasmntopt
9219 eval $inlibc
9220
9221 : see if this is a netinet/in.h or sys/in.h system
9222 set netinet/in.h i_niin sys/in.h i_sysin
9223 eval $inhdr
9224
9225 : see if arpa/inet.h has to be included
9226 set arpa/inet.h i_arpainet
9227 eval $inhdr
9228
9229 : see if htonl --and friends-- exists
9230 val=''
9231 set htonl val
9232 eval $inlibc
9233
9234 : Maybe they are macros.
9235 case "$val" in
9236 $undef)
9237         $cat >htonl.c <<EOM
9238 #include <stdio.h>
9239 #include <sys/types.h>
9240 #$i_niin I_NETINET_IN
9241 #$i_sysin I_SYS_IN
9242 #$i_arpainet I_ARPA_INET
9243 #ifdef I_NETINET_IN
9244 #include <netinet/in.h>
9245 #endif
9246 #ifdef I_SYS_IN
9247 #include <sys/in.h>
9248 #endif
9249 #ifdef I_ARPA_INET
9250 #include <arpa/inet.h>
9251 #endif
9252 #ifdef htonl
9253 printf("Defined as a macro.");
9254 #endif
9255 EOM
9256         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9257         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9258                 val="$define"
9259                 echo "But it seems to be defined as a macro." >&4
9260         fi
9261         $rm -f htonl.?
9262         ;;
9263 esac
9264 set d_htonl
9265 eval $setvar
9266
9267 : index or strchr
9268 echo " "
9269 if set index val -f; eval $csym; $val; then
9270         if set strchr val -f d_strchr; eval $csym; $val; then
9271                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9272                         val="$define"
9273                         vali="$undef"
9274                         echo "strchr() found." >&4
9275                 else
9276                         val="$undef"
9277                         vali="$define"
9278                         echo "index() found." >&4
9279                 fi
9280         else
9281                 val="$undef"
9282                 vali="$define"
9283                 echo "index() found." >&4
9284         fi
9285 else
9286         if set strchr val -f d_strchr; eval $csym; $val; then
9287                 val="$define"
9288                 vali="$undef"
9289                 echo "strchr() found." >&4
9290         else
9291                 echo "No index() or strchr() found!" >&4
9292                 val="$undef"
9293                 vali="$undef"
9294         fi
9295 fi
9296 set d_strchr; eval $setvar
9297 val="$vali"
9298 set d_index; eval $setvar
9299
9300 : check whether inet_aton exists
9301 set inet_aton d_inetaton
9302 eval $inlibc
9303
9304 : Look for isascii
9305 echo " "
9306 $cat >isascii.c <<'EOCP'
9307 #include <stdio.h>
9308 #include <ctype.h>
9309 int main() {
9310         int c = 'A';
9311         if (isascii(c))
9312                 exit(0);
9313         else
9314                 exit(1);
9315 }
9316 EOCP
9317 set isascii
9318 if eval $compile; then
9319         echo "isascii() found." >&4
9320         val="$define"
9321 else
9322         echo "isascii() NOT found." >&4
9323         val="$undef"
9324 fi
9325 set d_isascii
9326 eval $setvar
9327 $rm -f isascii*
9328
9329 : see if killpg exists
9330 set killpg d_killpg
9331 eval $inlibc
9332
9333 : see if lchown exists
9334 echo " "
9335 $cat > try.c <<'EOCP'
9336 /* System header to define __stub macros and hopefully few prototypes,
9337     which can conflict with char lchown(); below.  */
9338 #include <assert.h>
9339 /* Override any gcc2 internal prototype to avoid an error.  */
9340 /* We use char because int might match the return type of a gcc2
9341    builtin and then its argument prototype would still apply.  */
9342 char lchown();
9343 int main() {
9344     /*  The GNU C library defines this for functions which it implements
9345         to always fail with ENOSYS.  Some functions are actually named
9346         something starting with __ and the normal name is an alias.  */
9347 #if defined (__stub_lchown) || defined (__stub___lchown)
9348 choke me
9349 #else
9350 lchown();
9351 #endif
9352 ; return 0; }
9353 EOCP
9354 set try
9355 if eval $compile; then
9356     $echo "lchown() found." >&4
9357     val="$define"
9358 else
9359     $echo "lchown() NOT found." >&4
9360     val="$undef"
9361 fi
9362 set d_lchown
9363 eval $setvar
9364
9365 : See if number of significant digits in a double precision number is known
9366 echo " "
9367 $cat >ldbl_dig.c <<EOM
9368 #$i_limits I_LIMITS
9369 #$i_float I_FLOAT
9370 #ifdef I_LIMITS
9371 #include <limits.h>
9372 #endif
9373 #ifdef I_FLOAT
9374 #include <float.h>
9375 #endif
9376 #ifdef LDBL_DIG
9377 printf("Contains LDBL_DIG");
9378 #endif
9379 EOM
9380 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9381 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9382         echo "LDBL_DIG found." >&4
9383         val="$define"
9384 else
9385         echo "LDBL_DIG NOT found." >&4
9386         val="$undef"
9387 fi
9388 $rm -f ldbl_dig.?
9389 set d_ldbl_dig
9390 eval $setvar
9391
9392 : see if link exists
9393 set link d_link
9394 eval $inlibc
9395
9396 : see if localeconv exists
9397 set localeconv d_locconv
9398 eval $inlibc
9399
9400 : see if lockf exists
9401 set lockf d_lockf
9402 eval $inlibc
9403
9404 : check for long long
9405 echo " "
9406 $echo $n "Checking to see if your system supports long long..." $c >&4
9407 echo 'int main() { long long x = 7; return 0; }' > try.c
9408 set try
9409 if eval $compile; then
9410         val="$define"
9411         echo " Yes, it does." >&4
9412 else
9413         val="$undef"
9414         echo " No, it doesn't." >&4
9415 fi
9416 $rm try.*
9417 set d_longlong
9418 eval $setvar
9419
9420 : check for length of long long
9421 case "${d_longlong}${longlongsize}" in
9422 $define)
9423         echo " "
9424         $echo $n "Checking to see how big your long longs are..." $c >&4
9425         $cat >try.c <<'EOCP'
9426 #include <stdio.h>
9427 int main()
9428 {
9429     printf("%d\n", (int)sizeof(long long));
9430     return(0);
9431 }
9432 EOCP
9433         set try
9434         if eval $compile_ok; then
9435                 longlongsize=`./try$exe_ext`
9436                 $echo " $longlongsize bytes." >&4
9437         else
9438                 dflt='8'
9439                 echo " "
9440                 echo "(I can't seem to compile the test program.  Guessing...)"
9441                 rp="What is the size of a long long (in bytes)?"
9442                 . ./myread
9443                 longlongsize="$ans"
9444         fi
9445         if $test "X$longsize" = "X$longlongsize"; then
9446                 echo "(That isn't any different from an ordinary long.)"
9447         fi      
9448         ;;
9449 esac
9450 $rm -f try.* try
9451
9452 : see if lstat exists
9453 set lstat d_lstat
9454 eval $inlibc
9455
9456 : see if mblen exists
9457 set mblen d_mblen
9458 eval $inlibc
9459
9460 : see if mbstowcs exists
9461 set mbstowcs d_mbstowcs
9462 eval $inlibc
9463
9464 : see if mbtowc exists
9465 set mbtowc d_mbtowc
9466 eval $inlibc
9467
9468 : see if memchr exists
9469 set memchr d_memchr
9470 eval $inlibc
9471
9472 : see if memcmp exists
9473 set memcmp d_memcmp
9474 eval $inlibc
9475
9476 : see if memcpy exists
9477 set memcpy d_memcpy
9478 eval $inlibc
9479
9480 : see if memmove exists
9481 set memmove d_memmove
9482 eval $inlibc
9483
9484 : see if memset exists
9485 set memset d_memset
9486 eval $inlibc
9487
9488 : see if mkdir exists
9489 set mkdir d_mkdir
9490 eval $inlibc
9491
9492 : see if mkfifo exists
9493 set mkfifo d_mkfifo
9494 eval $inlibc
9495
9496 : see if mktime exists
9497 set mktime d_mktime
9498 eval $inlibc
9499
9500 : see if msgctl exists
9501 set msgctl d_msgctl
9502 eval $inlibc
9503
9504 : see if msgget exists
9505 set msgget d_msgget
9506 eval $inlibc
9507
9508 : see if msgsnd exists
9509 set msgsnd d_msgsnd
9510 eval $inlibc
9511
9512 : see if msgrcv exists
9513 set msgrcv d_msgrcv
9514 eval $inlibc
9515
9516 : see how much of the 'msg*(2)' library is present.
9517 h_msg=true
9518 echo " "
9519 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9520 *"$undef"*) h_msg=false;;
9521 esac
9522 case "$osname" in
9523 freebsd)
9524     case "`ipcs 2>&1`" in
9525     "SVID messages"*"not configured"*)
9526         echo "Your $osname does not have the msg*(2) configured." >&4
9527         h_msg=false
9528         val="$undef"
9529         set msgctl d_msgctl
9530         eval $setvar
9531         set msgget d_msgget
9532         eval $setvar
9533         set msgsnd d_msgsnd
9534         eval $setvar
9535         set msgrcv d_msgrcv
9536         eval $setvar
9537         ;;
9538     esac
9539     ;;
9540 esac
9541 : we could also check for sys/ipc.h ...
9542 if $h_msg && $test `./findhdr sys/msg.h`; then
9543         echo "You have the full msg*(2) library." >&4
9544         val="$define"
9545 else
9546         echo "You don't have the full msg*(2) library." >&4
9547         val="$undef"
9548 fi
9549 set d_msg
9550 eval $setvar
9551
9552 : see if nice exists
9553 set nice d_nice
9554 eval $inlibc
9555
9556 : see if inttypes.h is available
9557 : we want a real compile instead of Inhdr because some systems
9558 : have an inttypes.h which includes non-existent headers
9559 echo " "
9560 $cat >try.c <<EOCP
9561 #include <inttypes.h>
9562 int main() {
9563         static int32_t foo32 = 0x12345678;
9564 }
9565 EOCP
9566 set try
9567 if eval $compile; then
9568         echo "<inttypes.h> found." >&4
9569         val="$define"
9570 else
9571         echo "<inttypes.h> NOT found." >&4
9572         val="$undef"
9573 fi
9574 $rm -f try.c try
9575 set i_inttypes
9576 eval $setvar
9577
9578 : check for int64_t
9579 echo " "
9580 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9581 $cat >try.c <<EOCP
9582 #include <sys/types.h>
9583 #$i_inttypes I_INTTYPES
9584 #ifdef I_INTTYPES
9585 #include <inttypes.h>
9586 #endif
9587 int main() { int64_t x = 7; }
9588 EOCP
9589 set try
9590 if eval $compile; then
9591         val="$define"
9592         echo " Yes, it does." >&4
9593 else
9594         val="$undef"
9595         echo " No, it doesn't." >&4
9596 fi
9597 $rm -f try try.*
9598 set d_int64t
9599 eval $setvar
9600
9601
9602 echo " "
9603 echo "Checking which 64-bit integer type we could use..." >&4
9604
9605 case "$intsize" in
9606 8) val=int
9607    set quadtype
9608    eval $setvar
9609    val='"unsigned int"'
9610    set uquadtype
9611    eval $setvar
9612    quadkind=1
9613    ;;
9614 *) case "$longsize" in
9615    8) val=long
9616       set quadtype
9617       eval $setvar
9618       val='"unsigned long"'
9619       set uquadtype
9620       eval $setvar
9621       quadkind=2
9622       ;;
9623    *) case "$uselonglong:$d_longlong:$longlongsize" in
9624       define:define:8)
9625         val='"long long"'
9626         set quadtype
9627         eval $setvar
9628         val='"unsigned long long"'
9629         set uquadtype
9630         eval $setvar
9631         quadkind=3
9632         ;;
9633       *) case "$d_int64t" in
9634          define)
9635            val=int64_t
9636            set quadtype
9637            eval $setvar
9638            val=uint64_t
9639            set uquadtype
9640            eval $setvar
9641            quadkind=4
9642            ;;
9643          esac
9644          ;;
9645       esac
9646       ;;
9647    esac
9648    ;;
9649 esac
9650
9651 case "$quadtype" in
9652 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9653         undef:define:8)
9654            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9655         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9656         esac
9657         d_quad="$undef"
9658         ;;
9659 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9660             verb="will"
9661         else
9662             verb="could"
9663         fi
9664         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9665         d_quad="$define"
9666         ;;
9667 esac
9668
9669 : check for length of character
9670 echo " "
9671 case "$charsize" in
9672 '')
9673         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9674         $cat >try.c <<'EOCP'
9675 #include <stdio.h>
9676 int main()
9677 {
9678     printf("%d\n", (int)sizeof(char));
9679     exit(0);
9680 }
9681 EOCP
9682         set try
9683         if eval $compile_ok; then
9684                 dflt=`./try`
9685         else
9686                 dflt='1'
9687                 echo "(I can't seem to compile the test program.  Guessing...)"
9688         fi
9689         ;;
9690 *)
9691         dflt="$charsize"
9692         ;;
9693 esac
9694 rp="What is the size of a character (in bytes)?"
9695 . ./myread
9696 charsize="$ans"
9697 $rm -f try.c try
9698
9699
9700 echo " "
9701 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9702
9703 case "$use64bits:$d_quad:$quadtype" in
9704 define:define:?*)
9705         ivtype="$quadtype"
9706         uvtype="$uquadtype"
9707         ivsize=8
9708         uvsize=8
9709         ;;
9710 *)      ivtype="long"
9711         uvtype="unsigned long"
9712         ivsize=$longsize
9713         uvsize=$longsize
9714         ;;
9715 esac
9716
9717 case "$uselongdouble:$d_longdbl" in
9718 define:define)
9719         nvtype="long double"
9720         nvsize=$longdblsize
9721         ;;
9722 *)      nvtype=double
9723         nvsize=$doublesize
9724         ;;
9725 esac
9726
9727 $echo "(IV will be "$ivtype", $ivsize bytes)"
9728 $echo "(UV will be "$uvtype", $uvsize bytes)"
9729 $echo "(NV will be "$nvtype", $nvsize bytes)"
9730
9731 $cat >try.c <<EOCP
9732 #$i_inttypes I_INTTYPES
9733 #ifdef I_INTTYPES
9734 #include <inttypes.h>
9735 #endif
9736 #include <stdio.h>
9737 int main() {
9738 #ifdef INT8
9739    int8_t i =  INT8_MAX;
9740   uint8_t u = UINT8_MAX;
9741   printf("int8_t\n");
9742 #endif
9743 #ifdef INT16
9744    int16_t i =  INT16_MAX;
9745   uint16_t i = UINT16_MAX;
9746   printf("int16_t\n");
9747 #endif
9748 #ifdef INT32
9749    int32_t i =  INT32_MAX;
9750   uint32_t u = UINT32_MAX;
9751   printf("int32_t\n");
9752 #endif
9753 }
9754 EOCP
9755
9756 case "$i8type" in
9757 '')     case "$charsize" in
9758         1)      i8type=char
9759                 u8type="unsigned char"
9760                 i8size=$charsize
9761                 u8size=$charsize
9762                 ;;
9763         esac
9764         ;;
9765 esac
9766 case "$i8type" in
9767 '')     set try -DINT8
9768         if eval $compile; then
9769                 case "`./try$exe_ext`" in
9770                 int8_t) i8type=int8_t
9771                         u8type=uint8_t
9772                         i8size=1
9773                         u8size=1
9774                         ;;
9775                 esac
9776         fi
9777         ;;
9778 esac
9779 case "$i8type" in
9780 '')     if $test $charsize -ge 1; then
9781                 i8type=char
9782                 u8type="unsigned char"
9783                 i8size=$charsize
9784                 u8size=$charsize
9785         fi
9786         ;;
9787 esac
9788
9789 case "$i16type" in
9790 '')     case "$shortsize" in
9791         2)      i16type=short
9792                 u16type="unsigned short"
9793                 i16size=$shortsize
9794                 u16size=$shortsize
9795                 ;;
9796         esac
9797         ;;
9798 esac
9799 case "$i16type" in
9800 '')     set try -DINT16
9801         if eval $compile; then
9802                 case "`./try$exe_ext`" in
9803                 int16_t)
9804                         i16type=int16_t
9805                         u16type=uint16_t
9806                         i16size=2
9807                         u16size=2
9808                         ;;
9809                 esac
9810         fi
9811         ;;
9812 esac
9813 case "$i16type" in
9814 '')     if $test $shortsize -ge 2; then
9815                 i16type=short
9816                 u16type="unsigned short"
9817                 i16size=$shortsize
9818                 u16size=$shortsize
9819         fi
9820         ;;
9821 esac
9822
9823 case "$i32type" in
9824 '')     case "$longsize" in
9825         4)      i32type=long
9826                 u32type="unsigned long"
9827                 i32size=$longsize
9828                 u32size=$longsize
9829                 ;;
9830         *)      case "$intsize" in
9831                 4)      i32type=int
9832                         u32type="unsigned int"
9833                         i32size=$intsize
9834                         u32size=$intsize
9835                         ;;
9836                 esac
9837                 ;;
9838         esac
9839         ;;
9840 esac
9841 case "$i32type" in
9842 '')     set try -DINT32
9843         if eval $compile; then
9844                 case "`./try$exe_ext`" in
9845                 int32_t)
9846                         i32type=int32_t
9847                         u32type=uint32_t
9848                         i32size=4
9849                         u32size=4
9850                         ;;
9851                 esac
9852         fi
9853         ;;
9854 esac
9855 case "$i32type" in
9856 '')     if $test $intsize -ge 4; then
9857                 i32type=int
9858                 u32type="unsigned int"
9859                 i32size=$intsize
9860                 u32size=$intsize
9861         fi
9862         ;;
9863 esac
9864
9865 case "$i64type" in
9866 '')     case "$d_quad:$quadtype" in
9867         define:?*)
9868                 i64type="$quadtype"
9869                 u64type="$uquadtype"
9870                 i64size=8
9871                 u64size=8
9872                 ;;
9873         esac
9874         ;;
9875 esac
9876
9877 $echo "Checking whether your NVs can preserve your UVs..." >&4
9878 $cat <<EOP >try.c
9879 #include <stdio.h>
9880 int main() {
9881     $uvtype k = ($uvtype)~0, l;
9882     $nvtype d;
9883     l = k;
9884     d = ($nvtype)l;
9885     l = ($uvtype)d;
9886     if (l == k)
9887        printf("preserve\n");
9888     exit(0);
9889 }
9890 EOP
9891 set try
9892 if eval $compile; then
9893         case "`./try$exe_ext`" in
9894         preserve) d_nv_preserves_uv="$define" ;;
9895         esac
9896 fi      
9897 case "$d_nv_preserves_uv" in
9898 $define) $echo "Yes, they can."  2>&1 ;;
9899 *)       $echo "No, they can't." 2>&1
9900          d_nv_preserves_uv="$undef"
9901          ;;
9902 esac
9903
9904 $rm -f try.* try
9905
9906 : see if POSIX threads are available
9907 set pthread.h i_pthread
9908 eval $inhdr
9909
9910
9911
9912
9913 : how to create joinable pthreads
9914 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9915         echo " "
9916         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9917         $cat >try.c <<'EOCP'
9918 #include <pthread.h>
9919 int main() {
9920     int detachstate = JOINABLE;
9921 }
9922 EOCP
9923         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9924         if eval $compile; then
9925                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9926                 val="$undef" # Yes, undef.
9927                 set d_old_pthread_create_joinable
9928                 eval $setvar
9929                 val=""
9930                 set old_pthread_create_joinable
9931                 eval $setvar
9932         else
9933                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9934                 if eval $compile; then
9935                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9936                         val="$define"
9937                         set d_old_pthread_create_joinable
9938                         eval $setvar
9939                         val=PTHREAD_CREATE_UNDETACHED
9940                         set old_pthread_create_joinable
9941                         eval $setvar
9942                 else            
9943                         set try -DJOINABLE=__UNDETACHED
9944                         if eval $compile; then
9945                                 echo "You seem to use __UNDETACHED." >&4
9946                                 val="$define"
9947                                 set d_old_pthread_create_joinable
9948                                 eval $setvar
9949                                 val=__UNDETACHED
9950                                 set old_pthread_create_joinable
9951                                 eval $setvar
9952                         else
9953                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9954                                 val="$define"
9955                                 set d_old_pthread_create_joinable
9956                                 eval $setvar
9957                                 val=0
9958                                 set old_pthread_create_joinable
9959                                 eval $setvar
9960                         fi
9961                 fi
9962         fi
9963         $rm -f try try.*
9964 else
9965     d_old_pthread_create_joinable="$undef"
9966     old_pthread_create_joinable=""
9967 fi
9968
9969 : see if pause exists
9970 set pause d_pause
9971 eval $inlibc
9972
9973 : see if pipe exists
9974 set pipe d_pipe
9975 eval $inlibc
9976
9977 : see if poll exists
9978 set poll d_poll
9979 eval $inlibc
9980
9981
9982 : see whether the various POSIXish _yields exist
9983 $cat >try.c <<EOP
9984 #include <pthread.h>
9985 #include <stdio.h>
9986 int main() {
9987 #ifdef SCHED_YIELD
9988         sched_yield();
9989 #else
9990 #ifdef PTHREAD_YIELD
9991         pthread_yield();
9992 #else
9993 #ifdef PTHREAD_YIELD_NULL
9994         pthread_yield(NULL);
9995 #endif
9996 #endif
9997 #endif
9998 }
9999 EOP
10000 : see if sched_yield exists
10001 set try -DSCHED_YIELD
10002 if eval $compile; then
10003     val="$define"
10004     sched_yield='sched_yield()'
10005 else
10006     val="$undef"
10007 fi
10008 case "$usethreads" in
10009 $define)
10010         case "$val" in
10011         $define) echo 'sched_yield() found.' >&4        ;;
10012         *)       echo 'sched_yield() NOT found.' >&4    ;;
10013         esac
10014 esac
10015 set d_sched_yield
10016 eval $setvar
10017
10018 : see if pthread_yield exists
10019 set try -DPTHREAD_YIELD
10020 if eval $compile; then
10021     val="$define"
10022     case "$sched_yield" in
10023     '') sched_yield='pthread_yield()' ;;
10024     esac
10025 else
10026     set try -DPTHREAD_YIELD_NULL
10027     if eval $compile; then
10028         val="$define"
10029         case "$sched_yield" in
10030         '') sched_yield='pthread_yield(NULL)' ;;
10031         esac
10032     else
10033         val="$undef"
10034     fi
10035 fi
10036 case "$usethreads" in
10037 $define)
10038         case "$val" in
10039         $define) echo 'pthread_yield() found.' >&4      ;;
10040         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10041         esac
10042         ;;
10043 esac
10044 set d_pthread_yield
10045 eval $setvar
10046
10047 case "$sched_yield" in
10048 '') sched_yield=undef ;;
10049 esac
10050
10051 $rm -f try try.*
10052
10053 : see if this is a pwd.h system
10054 set pwd.h i_pwd
10055 eval $inhdr
10056
10057 case "$i_pwd" in
10058 $define)
10059         xxx=`./findhdr pwd.h`
10060         $cppstdin $cppflags $cppminus < $xxx >$$.h
10061
10062         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10063                 val="$define"
10064         else
10065                 val="$undef"
10066         fi
10067         set d_pwquota
10068         eval $setvar
10069
10070         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10071                 val="$define"
10072         else
10073                 val="$undef"
10074         fi
10075         set d_pwage
10076         eval $setvar
10077
10078         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10079                 val="$define"
10080         else
10081                 val="$undef"
10082         fi
10083         set d_pwchange
10084         eval $setvar
10085
10086         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10087                 val="$define"
10088         else
10089                 val="$undef"
10090         fi
10091         set d_pwclass
10092         eval $setvar
10093
10094         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10095                 val="$define"
10096         else
10097                 val="$undef"
10098         fi
10099         set d_pwexpire
10100         eval $setvar
10101
10102         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10103                 val="$define"
10104         else
10105                 val="$undef"
10106         fi
10107         set d_pwcomment
10108         eval $setvar
10109
10110         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10111                 val="$define"
10112         else
10113                 val="$undef"
10114         fi
10115         set d_pwgecos
10116         eval $setvar
10117
10118         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10119                 val="$define"
10120         else
10121                 val="$undef"
10122         fi
10123         set d_pwpasswd
10124         eval $setvar
10125
10126         $rm -f $$.h
10127         ;;
10128 *)
10129         val="$undef"; 
10130         set d_pwquota; eval $setvar
10131         set d_pwage; eval $setvar
10132         set d_pwchange; eval $setvar
10133         set d_pwclass; eval $setvar
10134         set d_pwexpire; eval $setvar
10135         set d_pwcomment; eval $setvar
10136         set d_pwgecos; eval $setvar
10137         set d_pwpasswd; eval $setvar
10138         ;;
10139 esac
10140
10141 : see if readdir and friends exist
10142 set readdir d_readdir
10143 eval $inlibc
10144 set seekdir d_seekdir
10145 eval $inlibc
10146 set telldir d_telldir
10147 eval $inlibc
10148 set rewinddir d_rewinddir
10149 eval $inlibc
10150
10151 : see if readlink exists
10152 set readlink d_readlink
10153 eval $inlibc
10154
10155 : see if rename exists
10156 set rename d_rename
10157 eval $inlibc
10158
10159 : see if rmdir exists
10160 set rmdir d_rmdir
10161 eval $inlibc
10162
10163 : see if memory.h is available.
10164 val=''
10165 set memory.h val
10166 eval $inhdr
10167
10168 : See if it conflicts with string.h
10169 case "$val" in
10170 $define)
10171         case "$strings" in
10172         '') ;;
10173         *)
10174                 $cppstdin $cppflags $cppminus < $strings > mem.h
10175                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10176                         echo " "
10177                         echo "We won't be including <memory.h>."
10178                         val="$undef"
10179                 fi
10180                 $rm -f mem.h
10181                 ;;
10182         esac
10183 esac
10184 set i_memory
10185 eval $setvar
10186
10187 : can bcopy handle overlapping blocks?
10188 val="$undef"
10189 case "$d_bcopy" in
10190 "$define")
10191         echo " "
10192         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10193         $cat >try.c <<EOCP
10194 #$i_memory I_MEMORY
10195 #$i_stdlib I_STDLIB
10196 #$i_string I_STRING
10197 #$i_unistd I_UNISTD
10198 EOCP
10199         $cat >>try.c <<'EOCP'
10200 #include <stdio.h>
10201 #ifdef I_MEMORY
10202 #  include <memory.h>
10203 #endif
10204 #ifdef I_STDLIB
10205 #  include <stdlib.h>
10206 #endif
10207 #ifdef I_STRING
10208 #  include <string.h>
10209 #else
10210 #  include <strings.h>
10211 #endif
10212 #ifdef I_UNISTD
10213 #  include <unistd.h>  /* Needed for NetBSD */
10214 #endif
10215 int main()
10216 {
10217 char buf[128], abc[128];
10218 char *b;
10219 int len;
10220 int off;
10221 int align;
10222
10223 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10224
10225 for (align = 7; align >= 0; align--) {
10226         for (len = 36; len; len--) {
10227                 b = buf+align;
10228                 bcopy(abc, b, len);
10229                 for (off = 1; off <= len; off++) {
10230                         bcopy(b, b+off, len);
10231                         bcopy(b+off, b, len);
10232                         if (bcmp(b, abc, len))
10233                                 exit(1);
10234                 }
10235         }
10236 }
10237 exit(0);
10238 }
10239 EOCP
10240         set try
10241         if eval $compile_ok; then
10242                 if ./try 2>/dev/null; then
10243                         echo "Yes, it can."
10244                         val="$define"
10245                 else
10246                         echo "It can't, sorry."
10247                         case "$d_memmove" in
10248                         "$define") echo "But that's Ok since you have memmove()." ;;
10249                         esac
10250                 fi
10251         else
10252                 echo "(I can't compile the test program, so we'll assume not...)"
10253                 case "$d_memmove" in
10254                 "$define") echo "But that's Ok since you have memmove()." ;;
10255                 esac
10256         fi
10257         ;;
10258 esac
10259 $rm -f try.* try core
10260 set d_safebcpy
10261 eval $setvar
10262
10263 : can memcpy handle overlapping blocks?
10264 val="$undef"
10265 case "$d_memcpy" in
10266 "$define")
10267         echo " "
10268         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10269         $cat >try.c <<EOCP
10270 #$i_memory I_MEMORY
10271 #$i_stdlib I_STDLIB
10272 #$i_string I_STRING
10273 #$i_unistd I_UNISTD
10274 EOCP
10275         $cat >>try.c <<'EOCP'
10276 #include <stdio.h>
10277 #ifdef I_MEMORY
10278 #  include <memory.h>
10279 #endif
10280 #ifdef I_STDLIB
10281 #  include <stdlib.h>
10282 #endif
10283 #ifdef I_STRING
10284 #  include <string.h>
10285 #else
10286 #  include <strings.h>
10287 #endif
10288 #ifdef I_UNISTD
10289 #  include <unistd.h>  /* Needed for NetBSD */
10290 #endif
10291 int main()
10292 {
10293 char buf[128], abc[128];
10294 char *b;
10295 int len;
10296 int off;
10297 int align;
10298
10299 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10300    try to store the string in read-only memory. */
10301 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10302
10303 for (align = 7; align >= 0; align--) {
10304         for (len = 36; len; len--) {
10305                 b = buf+align;
10306                 memcpy(b, abc, len);
10307                 for (off = 1; off <= len; off++) {
10308                         memcpy(b+off, b, len);
10309                         memcpy(b, b+off, len);
10310                         if (memcmp(b, abc, len))
10311                                 exit(1);
10312                 }
10313         }
10314 }
10315 exit(0);
10316 }
10317 EOCP
10318         set try
10319         if eval $compile_ok; then
10320                 if ./try 2>/dev/null; then
10321                         echo "Yes, it can."
10322                         val="$define"
10323                 else
10324                         echo "It can't, sorry."
10325                         case "$d_memmove" in
10326                         "$define") echo "But that's Ok since you have memmove()." ;;
10327                         esac
10328                 fi
10329         else
10330                 echo "(I can't compile the test program, so we'll assume not...)"
10331                 case "$d_memmove" in
10332                 "$define") echo "But that's Ok since you have memmove()." ;;
10333                 esac
10334         fi
10335         ;;
10336 esac
10337 $rm -f try.* try core
10338 set d_safemcpy
10339 eval $setvar
10340
10341 : can memcmp be trusted to compare relative magnitude?
10342 val="$undef"
10343 case "$d_memcmp" in
10344 "$define")
10345         echo " "
10346         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10347         $cat >try.c <<EOCP
10348 #$i_memory I_MEMORY
10349 #$i_stdlib I_STDLIB
10350 #$i_string I_STRING
10351 #$i_unistd I_UNISTD
10352 EOCP
10353         $cat >>try.c <<'EOCP'
10354 #include <stdio.h>
10355 #ifdef I_MEMORY
10356 #  include <memory.h>
10357 #endif
10358 #ifdef I_STDLIB
10359 #  include <stdlib.h>
10360 #endif
10361 #ifdef I_STRING
10362 #  include <string.h>
10363 #else
10364 #  include <strings.h>
10365 #endif
10366 #ifdef I_UNISTD
10367 #  include <unistd.h>  /* Needed for NetBSD */
10368 #endif
10369 int main()
10370 {
10371 char a = -1;
10372 char b = 0;
10373 if ((a < b) && memcmp(&a, &b, 1) < 0)
10374         exit(1);
10375 exit(0);
10376 }
10377 EOCP
10378         set try
10379         if eval $compile_ok; then
10380                 if ./try 2>/dev/null; then
10381                         echo "Yes, it can."
10382                         val="$define"
10383                 else
10384                         echo "No, it can't (it uses signed chars)."
10385                 fi
10386         else
10387                 echo "(I can't compile the test program, so we'll assume not...)"
10388         fi
10389         ;;
10390 esac
10391 $rm -f try.* try core
10392 set d_sanemcmp
10393 eval $setvar
10394
10395 : see if select exists
10396 set select d_select
10397 eval $inlibc
10398
10399 : see if semctl exists
10400 set semctl d_semctl
10401 eval $inlibc
10402
10403 : see if semget exists
10404 set semget d_semget
10405 eval $inlibc
10406
10407 : see if semop exists
10408 set semop d_semop
10409 eval $inlibc
10410
10411 : see how much of the 'sem*(2)' library is present.
10412 h_sem=true
10413 echo " "
10414 case "$d_semctl$d_semget$d_semop" in
10415 *"$undef"*) h_sem=false;;
10416 esac
10417 case "$osname" in
10418 freebsd)
10419     case "`ipcs 2>&1`" in
10420     "SVID messages"*"not configured"*)
10421         echo "Your $osname does not have the sem*(2) configured." >&4
10422         h_sem=false
10423         val="$undef"
10424         set semctl d_semctl
10425         eval $setvar
10426         set semget d_semget
10427         eval $setvar
10428         set semop d_semop
10429         eval $setvar
10430         ;;
10431     esac
10432     ;;
10433 esac
10434 : we could also check for sys/ipc.h ...
10435 if $h_sem && $test `./findhdr sys/sem.h`; then
10436         echo "You have the full sem*(2) library." >&4
10437         val="$define"
10438 else
10439         echo "You don't have the full sem*(2) library." >&4
10440         val="$undef"
10441 fi
10442 set d_sem
10443 eval $setvar
10444
10445 : see whether sys/sem.h defines union semun
10446 echo " "
10447 $cat > try.c <<'END'
10448 #include <sys/types.h>
10449 #include <sys/ipc.h>
10450 #include <sys/sem.h>
10451 int main () { union semun semun; semun.buf = 0; }
10452 END
10453 set try
10454 if eval $compile; then
10455     echo "You have union semun in <sys/sem.h>." >&4
10456     val="$define"
10457 else
10458     echo "You do not have union semun in <sys/sem.h>." >&4
10459     val="$undef"
10460 fi
10461 $rm -f try try.c try.h
10462 set d_union_semun
10463 eval $setvar
10464
10465 : see how to do semctl IPC_STAT
10466 case "$d_sem" in
10467 $define)
10468     : see whether semctl IPC_STAT can use union semun
10469     echo " "
10470     $cat > try.h <<END
10471 #ifndef S_IRUSR
10472 #   ifdef S_IREAD
10473 #       define S_IRUSR S_IREAD
10474 #       define S_IWUSR S_IWRITE
10475 #       define S_IXUSR S_IEXEC
10476 #   else
10477 #       define S_IRUSR 0400
10478 #       define S_IWUSR 0200
10479 #       define S_IXUSR 0100
10480 #   endif
10481 #   define S_IRGRP (S_IRUSR>>3)
10482 #   define S_IWGRP (S_IWUSR>>3)
10483 #   define S_IXGRP (S_IXUSR>>3)
10484 #   define S_IROTH (S_IRUSR>>6)
10485 #   define S_IWOTH (S_IWUSR>>6)
10486 #   define S_IXOTH (S_IXUSR>>6)
10487 #endif
10488 #ifndef S_IRWXU
10489 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10490 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10491 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10492 #endif
10493 END
10494
10495     $cat > try.c <<END
10496 #include <sys/types.h>
10497 #include <sys/ipc.h>
10498 #include <sys/sem.h>
10499 #include <sys/stat.h>
10500 #include <stdio.h>
10501 #include <errno.h>
10502 #include "try.h"
10503 #ifndef errno
10504 extern int errno;
10505 #endif
10506 #$d_union_semun HAS_UNION_SEMUN
10507 int main() {
10508     union semun
10509 #ifndef HAS_UNION_SEMUN
10510     {
10511         int val;
10512         struct semid_ds *buf;
10513         unsigned short *array;
10514     }
10515 #endif
10516     arg;
10517     int sem, st;
10518
10519 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10520     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10521     if (sem > -1) {
10522         struct semid_ds argbuf;
10523         arg.buf = &argbuf;
10524 #       ifdef IPC_STAT
10525         st = semctl(sem, 0, IPC_STAT, arg);
10526         if (st == 0)
10527             printf("semun\n");
10528         else
10529 #       endif /* IPC_STAT */
10530             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10531 #       ifdef IPC_RMID
10532         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10533 #       endif /* IPC_RMID */
10534             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10535     } else
10536 #endif /* IPC_PRIVATE && ... */
10537         printf("semget failed: errno = %d\n", errno);
10538   return 0;
10539 }
10540 END
10541     val="$undef"
10542     set try
10543     if eval $compile; then
10544         xxx=`./try`
10545         case "$xxx" in
10546         semun) val="$define" ;;
10547         esac
10548     fi
10549     $rm -f try try.c
10550     set d_semctl_semun
10551     eval $setvar
10552     case "$d_semctl_semun" in
10553     $define)
10554         echo "You can use union semun for semctl IPC_STAT." >&4
10555         also='also'
10556         ;;
10557     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10558         also=''
10559         ;;
10560     esac
10561
10562     : see whether semctl IPC_STAT can use struct semid_ds pointer
10563     $cat > try.c <<'END'
10564 #include <sys/types.h>
10565 #include <sys/ipc.h>
10566 #include <sys/sem.h>
10567 #include <sys/stat.h>
10568 #include "try.h"
10569 #include <stdio.h>
10570 #include <errno.h>
10571 #ifndef errno
10572 extern int errno;
10573 #endif
10574 int main() {
10575     struct semid_ds arg;
10576     int sem, st;
10577
10578 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10579     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10580     if (sem > -1) {
10581 #       ifdef IPC_STAT
10582         st = semctl(sem, 0, IPC_STAT, &arg);
10583         if (st == 0)
10584             printf("semid_ds\n");
10585         else
10586 #       endif /* IPC_STAT */
10587             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10588 #       ifdef IPC_RMID
10589         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10590 #       endif /* IPC_RMID */
10591             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10592     } else
10593 #endif /* IPC_PRIVATE && ... */
10594         printf("semget failed: errno = %d\n", errno);
10595
10596     return 0;
10597 }
10598 END
10599     val="$undef"
10600     set try
10601     if eval $compile; then
10602         xxx=`./try`
10603         case "$xxx" in
10604         semid_ds) val="$define" ;;
10605         esac
10606     fi
10607     $rm -f try try.c
10608     set d_semctl_semid_ds
10609     eval $setvar
10610     case "$d_semctl_semid_ds" in
10611     $define)
10612         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10613         ;;
10614     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10615         ;;
10616     esac
10617     $rm -f try.h
10618     ;;
10619 *)  val="$undef"
10620
10621     # We do not have the full sem*(2) library, so assume we can not
10622     # use either.
10623
10624     set d_semctl_semun
10625     eval $setvar
10626
10627     set d_semctl_semid_ds
10628     eval $setvar
10629     ;;
10630 esac
10631
10632 : see if setegid exists
10633 set setegid d_setegid
10634 eval $inlibc
10635
10636 : see if seteuid exists
10637 set seteuid d_seteuid
10638 eval $inlibc
10639
10640 : see if setgrent exists
10641 set setgrent d_setgrent
10642 eval $inlibc
10643
10644 : see if sethostent exists
10645 set sethostent d_sethent
10646 eval $inlibc
10647
10648 : see if setlinebuf exists
10649 set setlinebuf d_setlinebuf
10650 eval $inlibc
10651
10652 : see if setlocale exists
10653 set setlocale d_setlocale
10654 eval $inlibc
10655
10656 : see if setnetent exists
10657 set setnetent d_setnent
10658 eval $inlibc
10659
10660 : see if setprotoent exists
10661 set setprotoent d_setpent
10662 eval $inlibc
10663
10664 : see if setpgid exists
10665 set setpgid d_setpgid
10666 eval $inlibc
10667
10668 : see if setpgrp2 exists
10669 set setpgrp2 d_setpgrp2
10670 eval $inlibc
10671
10672 : see if setpriority exists
10673 set setpriority d_setprior
10674 eval $inlibc
10675
10676 : see if setpwent exists
10677 set setpwent d_setpwent
10678 eval $inlibc
10679
10680 : see if setregid exists
10681 set setregid d_setregid
10682 eval $inlibc
10683 set setresgid d_setresgid
10684 eval $inlibc
10685
10686 : see if setreuid exists
10687 set setreuid d_setreuid
10688 eval $inlibc
10689 set setresuid d_setresuid
10690 eval $inlibc
10691
10692 : see if setrgid exists
10693 set setrgid d_setrgid
10694 eval $inlibc
10695
10696 : see if setruid exists
10697 set setruid d_setruid
10698 eval $inlibc
10699
10700 : see if setservent exists
10701 set setservent d_setsent
10702 eval $inlibc
10703
10704 : see if setsid exists
10705 set setsid d_setsid
10706 eval $inlibc
10707
10708 : see if setspent exists
10709 set setspent d_setspent
10710 eval $inlibc
10711
10712 : see if setvbuf exists
10713 set setvbuf d_setvbuf
10714 eval $inlibc
10715
10716 : see if sfio.h is available
10717 set sfio.h i_sfio
10718 eval $inhdr
10719
10720
10721 : see if sfio library is available
10722 case "$i_sfio" in
10723 $define)
10724         val=''
10725         set sfreserve val
10726         eval $inlibc
10727         ;;
10728 *)
10729         val="$undef"
10730         ;;
10731 esac
10732 : Ok, but do we want to use it.
10733 case "$val" in
10734 $define)
10735         case "$usesfio" in
10736         true|$define|[yY]*) dflt='y';;
10737         *) dflt='n';;
10738         esac
10739         echo "$package can use the sfio library, but it is experimental."
10740         rp="You seem to have sfio available, do you want to try using it?"
10741         . ./myread
10742         case "$ans" in
10743         y|Y) ;;
10744         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10745                 val="$undef"
10746                 : Remove sfio from list of libraries to use
10747                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10748                 shift
10749                 libs="$*"
10750                 echo "libs = $libs" >&4
10751                 ;;
10752         esac
10753         ;;
10754 *)      case "$usesfio" in
10755         true|$define|[yY]*)
10756                 echo "Sorry, cannot find sfio on this machine" >&4
10757                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10758                 ;;
10759         esac
10760         ;;
10761 esac
10762 set d_sfio
10763 eval $setvar
10764 case "$d_sfio" in
10765 $define) usesfio='true';;
10766 *) usesfio='false';;
10767 esac
10768
10769 : see if shmctl exists
10770 set shmctl d_shmctl
10771 eval $inlibc
10772
10773 : see if shmget exists
10774 set shmget d_shmget
10775 eval $inlibc
10776
10777 : see if shmat exists
10778 set shmat d_shmat
10779 eval $inlibc
10780 : see what shmat returns
10781 case "$d_shmat" in
10782 "$define")
10783         $cat >shmat.c <<'END'
10784 #include <sys/shm.h>
10785 void *shmat();
10786 END
10787         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10788                 shmattype='void *'
10789         else
10790                 shmattype='char *'
10791         fi
10792         echo "and it returns ($shmattype)." >&4
10793         : see if a prototype for shmat is available
10794         xxx=`./findhdr sys/shm.h`
10795         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10796         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10797                 val="$define"
10798         else
10799                 val="$undef"
10800         fi
10801         $rm -f shmat.[co]
10802         ;;
10803 *)
10804         val="$undef"
10805         ;;
10806 esac
10807 set d_shmatprototype
10808 eval $setvar
10809
10810 : see if shmdt exists
10811 set shmdt d_shmdt
10812 eval $inlibc
10813
10814 : see how much of the 'shm*(2)' library is present.
10815 h_shm=true
10816 echo " "
10817 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10818 *"$undef"*) h_shm=false;;
10819 esac
10820 case "$osname" in
10821 freebsd)
10822     case "`ipcs 2>&1`" in
10823     "SVID shared memory"*"not configured"*)
10824         echo "Your $osname does not have the shm*(2) configured." >&4
10825         h_shm=false
10826         val="$undef"
10827         set shmctl d_shmctl
10828         evat $setvar
10829         set shmget d_shmget
10830         evat $setvar
10831         set shmat d_shmat
10832         evat $setvar
10833         set shmdt d_shmdt
10834         evat $setvar
10835         ;;
10836     esac
10837     ;;
10838 esac
10839 : we could also check for sys/ipc.h ...
10840 if $h_shm && $test `./findhdr sys/shm.h`; then
10841         echo "You have the full shm*(2) library." >&4
10842         val="$define"
10843 else
10844         echo "You don't have the full shm*(2) library." >&4
10845         val="$undef"
10846 fi
10847 set d_shm
10848 eval $setvar
10849
10850 echo " "
10851 : see if we have sigaction
10852 if set sigaction val -f d_sigaction; eval $csym; $val; then
10853         echo 'sigaction() found.' >&4
10854         $cat > try.c <<'EOP'
10855 #include <stdio.h>
10856 #include <sys/types.h>
10857 #include <signal.h>
10858 int main()
10859 {
10860     struct sigaction act, oact;
10861     act.sa_flags = 0;
10862     oact.sa_handler = 0;
10863     /* so that act and oact are used */
10864     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10865 }
10866 EOP
10867         set try
10868         if eval $compile_ok; then
10869                 val="$define"
10870         else
10871                 echo "But you don't seem to have a useable struct sigaction." >&4
10872                 val="$undef"
10873         fi
10874 else
10875         echo 'sigaction NOT found.' >&4
10876         val="$undef"
10877 fi
10878 set d_sigaction; eval $setvar
10879 $rm -f try try$_o try.c
10880
10881 : see if sigsetjmp exists
10882 echo " "
10883 case "$d_sigsetjmp" in
10884 '')
10885         $cat >try.c <<'EOP'
10886 #include <setjmp.h>
10887 sigjmp_buf env;
10888 int set = 1;
10889 int main()
10890 {
10891         if (sigsetjmp(env,1))
10892                 exit(set);
10893         set = 0;
10894         siglongjmp(env, 1);
10895         exit(1);
10896 }
10897 EOP
10898         set try
10899         if eval $compile; then
10900                 if ./try >/dev/null 2>&1; then
10901                         echo "POSIX sigsetjmp found." >&4
10902                         val="$define"
10903                 else
10904                         $cat >&4 <<EOM
10905 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10906 I'll ignore them.
10907 EOM
10908                         val="$undef"
10909                 fi
10910         else
10911                 echo "sigsetjmp not found." >&4
10912                 val="$undef"
10913         fi
10914         ;;
10915 *) val="$d_sigsetjmp"
10916         case "$d_sigsetjmp" in
10917         $define) echo "POSIX sigsetjmp found." >&4;;
10918         $undef) echo "sigsetjmp not found." >&4;;
10919         esac
10920         ;;
10921 esac
10922 set d_sigsetjmp
10923 eval $setvar
10924 $rm -f try.c try
10925
10926 : see if sqrtl exists
10927 set sqrtl d_sqrtl
10928 eval $inlibc
10929
10930 : see if sys/stat.h is available
10931 set sys/stat.h i_sysstat
10932 eval $inhdr
10933
10934
10935 : see if stat knows about block sizes
10936 echo " "
10937 echo "Checking to see if your struct stat has st_blocks field..." >&4
10938 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10939 eval $hasfield
10940
10941
10942 : see if this is a sys/vfs.h system
10943 set sys/vfs.h i_sysvfs
10944 eval $inhdr
10945
10946
10947 : see if this is a sys/statfs.h system
10948 set sys/statfs.h i_sysstatfs
10949 eval $inhdr
10950
10951
10952 echo " "
10953 echo "Checking to see if your system supports struct statfs..." >&4
10954 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
10955 eval $hasstruct
10956 case "$d_statfs_s" in
10957 "$define")      echo "Yes, it does."   ;;
10958 *)              echo "No, it doesn't." ;;
10959 esac
10960
10961
10962
10963 : see if struct statfs knows about f_flags
10964 case "$d_statfs_s" in
10965 define) 
10966         echo " "
10967         echo "Checking to see if your struct statfs has f_flags field..." >&4
10968         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
10969         eval $hasfield
10970         ;;
10971 *)      val="$undef"
10972         set d_statfs_f_flags
10973         eval $setvar
10974         ;;
10975 esac
10976 case "$d_statfs_f_flags" in
10977 "$define")      echo "Yes, it does."   ;;
10978 *)              echo "No, it doesn't." ;;
10979 esac
10980
10981 : see if _ptr and _cnt from stdio act std
10982 echo " "
10983 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10984         echo "(Looks like you have stdio.h from Linux.)"
10985         case "$stdio_ptr" in
10986         '') stdio_ptr='((fp)->_IO_read_ptr)'
10987                 ptr_lval=$define
10988                 ;;
10989         *)      ptr_lval=$d_stdio_ptr_lval;;
10990         esac
10991         case "$stdio_cnt" in
10992         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10993                 cnt_lval=$undef
10994                 ;;
10995         *)      cnt_lval=$d_stdio_cnt_lval;;
10996         esac
10997         case "$stdio_base" in
10998         '') stdio_base='((fp)->_IO_read_base)';;
10999         esac
11000         case "$stdio_bufsiz" in
11001         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11002         esac
11003 else
11004         case "$stdio_ptr" in
11005         '') stdio_ptr='((fp)->_ptr)'
11006                 ptr_lval=$define
11007                 ;;
11008         *)      ptr_lval=$d_stdio_ptr_lval;;
11009         esac
11010         case "$stdio_cnt" in
11011         '') stdio_cnt='((fp)->_cnt)'
11012                 cnt_lval=$define
11013                 ;;
11014         *)      cnt_lval=$d_stdio_cnt_lval;;
11015         esac
11016         case "$stdio_base" in
11017         '') stdio_base='((fp)->_base)';;
11018         esac
11019         case "$stdio_bufsiz" in
11020         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11021         esac
11022 fi
11023 : test whether _ptr and _cnt really work
11024 echo "Checking how std your stdio is..." >&4
11025 $cat >try.c <<EOP
11026 #include <stdio.h>
11027 #define FILE_ptr(fp)    $stdio_ptr
11028 #define FILE_cnt(fp)    $stdio_cnt
11029 int main() {
11030         FILE *fp = fopen("try.c", "r");
11031         char c = getc(fp);
11032         if (
11033                 18 <= FILE_cnt(fp) &&
11034                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11035         )
11036                 exit(0);
11037         exit(1);
11038 }
11039 EOP
11040 val="$undef"
11041 set try
11042 if eval $compile; then
11043         if ./try; then
11044                 echo "Your stdio acts pretty std."
11045                 val="$define"
11046         else
11047                 echo "Your stdio isn't very std."
11048         fi
11049 else
11050         echo "Your stdio doesn't appear very std."
11051 fi
11052 $rm -f try.c try
11053 set d_stdstdio
11054 eval $setvar
11055
11056 : Can _ptr be used as an lvalue?
11057 case "$d_stdstdio$ptr_lval" in
11058 $define$define) val=$define ;;
11059 *) val=$undef ;;
11060 esac
11061 set d_stdio_ptr_lval
11062 eval $setvar
11063
11064 : Can _cnt be used as an lvalue?
11065 case "$d_stdstdio$cnt_lval" in
11066 $define$define) val=$define ;;
11067 *) val=$undef ;;
11068 esac
11069 set d_stdio_cnt_lval
11070 eval $setvar
11071
11072 : see if _base is also standard
11073 val="$undef"
11074 case "$d_stdstdio" in
11075 $define)
11076         $cat >try.c <<EOP
11077 #include <stdio.h>
11078 #define FILE_base(fp)   $stdio_base
11079 #define FILE_bufsiz(fp) $stdio_bufsiz
11080 int main() {
11081         FILE *fp = fopen("try.c", "r");
11082         char c = getc(fp);
11083         if (
11084                 19 <= FILE_bufsiz(fp) &&
11085                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11086         )
11087                 exit(0);
11088         exit(1);
11089 }
11090 EOP
11091         set try
11092         if eval $compile; then
11093                 if ./try; then
11094                         echo "And its _base field acts std."
11095                         val="$define"
11096                 else
11097                         echo "But its _base field isn't std."
11098                 fi
11099         else
11100                 echo "However, it seems to be lacking the _base field."
11101         fi
11102         $rm -f try.c try
11103         ;;
11104 esac
11105 set d_stdiobase
11106 eval $setvar
11107
11108 $cat >&4 <<EOM
11109 Checking how to access stdio streams by file descriptor number...
11110 EOM
11111 case "$stdio_stream_array" in
11112 '')     $cat >try.c <<EOCP
11113 #include <stdio.h>
11114 int main() {
11115   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11116     printf("yes\n");
11117 }
11118 EOCP
11119         for s in _iob __iob __sF
11120         do
11121                 set try -DSTDIO_STREAM_ARRAY=$s
11122                 if eval $compile; then
11123                         case "`./try$exe_ext`" in
11124                         yes)    stdio_stream_array=$s; break ;;
11125                         esac
11126                 fi
11127         done
11128         $rm -f try.* try$exe_ext
11129 esac
11130 case "$stdio_stream_array" in
11131 '')     $cat >&4 <<EOM
11132 I can't figure out how to access stdio streams by file descriptor number.
11133 EOM
11134         d_stdio_stream_array="$undef"
11135         ;;
11136 *)      $cat >&4 <<EOM
11137 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11138 EOM
11139         d_stdio_stream_array="$define"
11140         ;;
11141 esac
11142
11143 : see if strcoll exists
11144 set strcoll d_strcoll
11145 eval $inlibc
11146
11147 : check for structure copying
11148 echo " "
11149 echo "Checking to see if your C compiler can copy structs..." >&4
11150 $cat >try.c <<'EOCP'
11151 int main()
11152 {
11153         struct blurfl {
11154                 int dyick;
11155         } foo, bar;
11156
11157         foo = bar;
11158 }
11159 EOCP
11160 if $cc -c try.c >/dev/null 2>&1 ; then
11161         val="$define"
11162         echo "Yup, it can."
11163 else
11164         val="$undef"
11165         echo "Nope, it can't."
11166 fi
11167 set d_strctcpy
11168 eval $setvar
11169 $rm -f try.*
11170
11171 : see if strerror and/or sys_errlist[] exist
11172 echo " "
11173 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11174     if set strerror val -f d_strerror; eval $csym; $val; then
11175                 echo 'strerror() found.' >&4
11176                 d_strerror="$define"
11177                 d_strerrm='strerror(e)'
11178                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11179                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11180                         d_syserrlst="$define"
11181                 else
11182                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11183                         d_syserrlst="$undef"
11184                 fi
11185     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11186                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11187                 echo 'strerror() found in string header.' >&4
11188                 d_strerror="$define"
11189                 d_strerrm='strerror(e)'
11190                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11191                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11192                                 d_syserrlst="$define"
11193                 else
11194                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11195                         d_syserrlst="$undef"
11196                 fi
11197     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11198                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11199                 d_strerror="$undef"
11200                 d_syserrlst="$define"
11201                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11202     else
11203                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11204                 d_strerror="$undef"
11205                 d_syserrlst="$undef"
11206                 d_strerrm='"unknown"'
11207     fi
11208 fi
11209
11210 : see if strtod exists
11211 set strtod d_strtod
11212 eval $inlibc
11213
11214 : see if strtol exists
11215 set strtol d_strtol
11216 eval $inlibc
11217
11218 : see if strtold exists
11219 set strtold d_strtold
11220 eval $inlibc
11221
11222 : see if strtoll exists
11223 set strtoll d_strtoll
11224 eval $inlibc
11225
11226 : see if strtoul exists
11227 set strtoul d_strtoul
11228 eval $inlibc
11229
11230 : see if strtoull exists
11231 set strtoull d_strtoull
11232 eval $inlibc
11233
11234 : see if strtouq exists
11235 set strtouq d_strtouq
11236 eval $inlibc
11237
11238 : see if strxfrm exists
11239 set strxfrm d_strxfrm
11240 eval $inlibc
11241
11242 : see if symlink exists
11243 set symlink d_symlink
11244 eval $inlibc
11245
11246 : see if syscall exists
11247 set syscall d_syscall
11248 eval $inlibc
11249
11250 : see if sysconf exists
11251 set sysconf d_sysconf
11252 eval $inlibc
11253
11254 : see if system exists
11255 set system d_system
11256 eval $inlibc
11257
11258 : see if tcgetpgrp exists
11259 set tcgetpgrp d_tcgetpgrp
11260 eval $inlibc
11261
11262 : see if tcsetpgrp exists
11263 set tcsetpgrp d_tcsetpgrp
11264 eval $inlibc
11265
11266 : see if prototype for telldir is available
11267 echo " "
11268 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11269 eval $hasproto
11270
11271 : see if this is a sys/times.h system
11272 set sys/times.h i_systimes
11273 eval $inhdr
11274
11275 : see if times exists
11276 echo " "
11277 if set times val -f d_times; eval $csym; $val; then
11278         echo 'times() found.' >&4
11279         d_times="$define"
11280         inc=''
11281         case "$i_systimes" in
11282         "$define") inc='sys/times.h';;
11283         esac
11284         rp="What is the type returned by times() on this system?"
11285         set clock_t clocktype long stdio.h sys/types.h $inc
11286         eval $typedef_ask
11287 else
11288         echo 'times() NOT found, hope that will do.' >&4
11289         d_times="$undef"
11290         clocktype='int'
11291 fi
11292
11293 : see if truncate exists
11294 set truncate d_truncate
11295 eval $inlibc
11296
11297 : see if tzname[] exists
11298 echo " "
11299 if set tzname val -a d_tzname; eval $csym; $val; then
11300         val="$define"
11301         echo 'tzname[] found.' >&4
11302 else
11303         val="$undef"
11304         echo 'tzname[] NOT found.' >&4
11305 fi
11306 set d_tzname
11307 eval $setvar
11308
11309 : see if umask exists
11310 set umask d_umask
11311 eval $inlibc
11312
11313 : see if ustat exists
11314 set ustat d_ustat
11315 eval $inlibc
11316
11317 : backward compatibility for d_hvfork
11318 if test X$d_hvfork != X; then
11319         d_vfork="$d_hvfork"
11320         d_hvfork=''
11321 fi
11322 : see if there is a vfork
11323 val=''
11324 set vfork val
11325 eval $inlibc
11326
11327 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11328 : perl on Solaris 2.x, and probably elsewhere.
11329 case "$val" in
11330 $define)
11331         echo " "
11332         case "$usevfork" in
11333         false) dflt='n';;
11334         *) dflt='y';;
11335         esac
11336         cat <<'EOM'
11337  
11338 Perl can only use a vfork() that doesn't suffer from strict
11339 restrictions on calling functions or modifying global data in
11340 the child.  For example, glibc-2.1 contains such a vfork()
11341 that is unsuitable.  If your system provides a proper fork()
11342 call, chances are that you do NOT want perl to use vfork().
11343
11344 EOM
11345         rp="Do you still want to use vfork()?"
11346         . ./myread
11347         case "$ans" in
11348         y|Y) ;;
11349         *)
11350                 echo "Ok, we won't use vfork()."
11351                 val="$undef"
11352                 ;;
11353         esac
11354         ;;
11355 esac
11356 set d_vfork
11357 eval $setvar
11358 case "$d_vfork" in
11359 $define) usevfork='true';;
11360 *) usevfork='false';;
11361 esac
11362
11363 : see if this is an sysdir system
11364 set sys/dir.h i_sysdir
11365 eval $inhdr
11366
11367 : see if this is an sysndir system
11368 set sys/ndir.h i_sysndir
11369 eval $inhdr
11370
11371 : see if closedir exists
11372 set closedir d_closedir
11373 eval $inlibc
11374
11375 case "$d_closedir" in
11376 "$define")
11377         echo " "
11378         echo "Checking whether closedir() returns a status..." >&4
11379         cat > closedir.c <<EOM
11380 #$i_dirent I_DIRENT             /**/
11381 #$i_sysdir I_SYS_DIR            /**/
11382 #$i_sysndir I_SYS_NDIR          /**/
11383 #$i_systypes I_SYS_TYPES        /**/
11384
11385 #if defined(I_SYS_TYPES)
11386 #include <sys/types.h>
11387 #endif
11388 #if defined(I_DIRENT)
11389 #include <dirent.h>
11390 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11391 #include <sys/dir.h>
11392 #endif
11393 #else
11394 #ifdef I_SYS_NDIR
11395 #include <sys/ndir.h>
11396 #else
11397 #ifdef I_SYS_DIR
11398 #ifdef hp9000s500
11399 #include <ndir.h>       /* may be wrong in the future */
11400 #else
11401 #include <sys/dir.h>
11402 #endif
11403 #endif
11404 #endif
11405 #endif 
11406 int main() { return closedir(opendir(".")); }
11407 EOM
11408         set closedir
11409         if eval $compile_ok; then
11410                 if ./closedir > /dev/null 2>&1 ; then
11411                         echo "Yes, it does."
11412                         val="$undef"
11413                 else
11414                         echo "No, it doesn't."
11415                         val="$define"
11416                 fi
11417         else
11418                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11419                 val="$define"
11420         fi
11421         ;;
11422 *)
11423         val="$undef";
11424         ;;
11425 esac
11426 set d_void_closedir
11427 eval $setvar
11428 $rm -f closedir*
11429 : check for volatile keyword
11430 echo " "
11431 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11432 $cat >try.c <<'EOCP'
11433 int main()
11434 {
11435         typedef struct _goo_struct goo_struct;
11436         goo_struct * volatile goo = ((goo_struct *)0);
11437         struct _goo_struct {
11438                 long long_int;
11439                 int reg_int;
11440                 char char_var;
11441         };
11442         typedef unsigned short foo_t;
11443         char *volatile foo;
11444         volatile int bar;
11445         volatile foo_t blech;
11446         foo = foo;
11447 }
11448 EOCP
11449 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11450         val="$define"
11451         echo "Yup, it does."
11452 else
11453         val="$undef"
11454         echo "Nope, it doesn't."
11455 fi
11456 set d_volatile
11457 eval $setvar
11458 $rm -f try.*
11459
11460 : see if there is a wait4
11461 set wait4 d_wait4
11462 eval $inlibc
11463
11464 : see if waitpid exists
11465 set waitpid d_waitpid
11466 eval $inlibc
11467
11468 : see if wcstombs exists
11469 set wcstombs d_wcstombs
11470 eval $inlibc
11471
11472 : see if wctomb exists
11473 set wctomb d_wctomb
11474 eval $inlibc
11475
11476 : preserve RCS keywords in files with variable substitution, grrr
11477 Date='$Date'
11478 Id='$Id'
11479 Log='$Log'
11480 RCSfile='$RCSfile'
11481 Revision='$Revision'
11482
11483 case "$crosscompile" in
11484 ''|[nN]*) crosscompile="$undef" ;;
11485 esac
11486
11487 case "$osname" in
11488 next|rhapsody) multiarch="$define" ;;
11489 esac
11490 case "$multiarch" in
11491 ''|[nN]*) multiarch="$undef" ;;
11492 esac
11493
11494 : check for alignment requirements
11495 echo " "
11496 case "$crosscompile$multiarch" in
11497 *$define*)
11498         $cat <<EOM
11499 You seem to be either cross-compiling or doing a multiarchitecture build,
11500 skipping the memory alignment check.
11501
11502 EOM
11503         case "$alignbytes" in
11504         '') alignbytes=8 ;;
11505         esac
11506         ;;
11507 *)
11508         case "$alignbytes" in
11509         '') echo "Checking alignment constraints..." >&4
11510                 $cat >try.c <<'EOCP'
11511 #include <stdio.h>
11512 struct foobar {
11513         char foo;
11514         double bar;
11515 } try_algn;
11516 int main()
11517 {
11518     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11519     return(0);
11520 }
11521 EOCP
11522                 set try
11523                 if eval $compile_ok; then
11524                         dflt=`./try`
11525                 else
11526                         dflt='8'
11527                         echo "(I can't seem to compile the test program...)"
11528                 fi
11529                 ;;
11530         *) dflt="$alignbytes"
11531                 ;;
11532         esac
11533         rp="Doubles must be aligned on a how-many-byte boundary?"
11534         . ./myread
11535         alignbytes="$ans"
11536         $rm -f try.c try
11537         ;;
11538 esac
11539
11540
11541 : check for ordering of bytes in a long
11542 echo " "
11543 case "$crosscompile$multiarch" in
11544 *$define*)
11545         $cat <<EOM
11546 You seem to be either cross-compiling or doing a multiarchitecture build,
11547 skipping the byteorder check.
11548
11549 EOM
11550         byteorder='0xffff'
11551         ;;
11552 *)
11553         case "$byteorder" in
11554         '')
11555                 $cat <<'EOM'
11556 In the following, larger digits indicate more significance.  A big-endian
11557 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11558 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11559 machines may have weird orders like 3412.  A Cray will report 87654321,
11560 an Alpha will report 12345678. If the test program works the default is
11561 probably right.
11562 I'm now running the test program...
11563 EOM
11564                 $cat >try.c <<'EOCP'
11565 #include <stdio.h>
11566 int main()
11567 {
11568         int i;
11569         union {
11570                 unsigned long l;
11571                 char c[sizeof(long)];
11572         } u;
11573
11574         if (sizeof(long) > 4)
11575                 u.l = (0x08070605L << 32) | 0x04030201L;
11576         else
11577                 u.l = 0x04030201L;
11578         for (i = 0; i < sizeof(long); i++)
11579                 printf("%c", u.c[i]+'0');
11580         printf("\n");
11581         exit(0);
11582 }
11583 EOCP
11584                 xxx_prompt=y
11585                 set try
11586                 if eval $compile && ./try > /dev/null; then
11587                         dflt=`./try`
11588                         case "$dflt" in
11589                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11590                                 echo "(The test program ran ok.)"
11591                                 echo "byteorder=$dflt"
11592                                 xxx_prompt=n
11593                         ;;
11594                         ????|????????) echo "(The test program ran ok.)" ;;
11595                         *) echo "(The test program didn't run right for some reason.)" ;;
11596                         esac
11597                 else
11598                         dflt='4321'
11599                         cat <<'EOM'
11600 (I can't seem to compile the test program.  Guessing big-endian...)
11601 EOM
11602                 fi
11603                 case "$xxx_prompt" in
11604                 y)
11605                         rp="What is the order of bytes in a long?"
11606                         . ./myread
11607                         byteorder="$ans"
11608                         ;;
11609                 *)      byteorder=$dflt
11610                         ;;
11611                 esac
11612                 ;;
11613         esac
11614         $rm -f try.c try
11615         ;;
11616 esac
11617
11618
11619 : how do we catenate cpp tokens here?
11620 echo " "
11621 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11622 $cat >cpp_stuff.c <<'EOCP'
11623 #define RCAT(a,b)a/**/b
11624 #define ACAT(a,b)a ## b
11625 RCAT(Rei,ser)
11626 ACAT(Cir,cus)
11627 EOCP
11628 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11629 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11630         echo "Oh!  Smells like ANSI's been here." >&4
11631         echo "We can catify or stringify, separately or together!"
11632         cpp_stuff=42
11633 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11634         echo "Ah, yes!  The good old days!" >&4
11635         echo "However, in the good old days we don't know how to stringify and"
11636         echo "catify at the same time."
11637         cpp_stuff=1
11638 else
11639         $cat >&4 <<EOM
11640 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11641 to have to edit the values of CAT[2-5] in config.h...
11642 EOM
11643         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11644 fi
11645 $rm -f cpp_stuff.*
11646
11647 : see if this is a db.h system
11648 set db.h i_db
11649 eval $inhdr
11650
11651 case "$i_db" in
11652 $define)
11653         : Check db version.
11654         echo " "
11655         echo "Checking Berkeley DB version ..." >&4
11656         $cat >try.c <<EOCP
11657 #$d_const HASCONST
11658 #ifndef HASCONST
11659 #define const
11660 #endif
11661 #include <sys/types.h>
11662 #include <stdio.h>
11663 #include <db.h>
11664 int main()
11665 {
11666 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11667     int Major, Minor, Patch ;
11668     unsigned long Version ;
11669     (void)db_version(&Major, &Minor, &Patch) ;
11670     printf("You have Berkeley DB Version 2 or greater\n");
11671
11672     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11673                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11674     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11675                 Major, Minor, Patch) ;
11676
11677     /* check that db.h & libdb are compatible */
11678     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11679         printf("db.h and libdb are incompatible\n") ;
11680         exit(3);        
11681     }
11682
11683     printf("db.h and libdb are compatible\n") ;
11684
11685     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11686                 + DB_VERSION_PATCH ;
11687
11688     /* needs to be >= 2.3.4 */
11689     if (Version < 2003004) {
11690     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11691         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11692         exit(2);        
11693     }
11694
11695     exit(0);
11696 #else
11697 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11698     printf("You have Berkeley DB Version 1\n");
11699     exit(0);    /* DB version < 2: the coast is clear. */
11700 #else
11701     exit(1);    /* <db.h> not Berkeley DB? */
11702 #endif
11703 #endif
11704 }
11705 EOCP
11706         set try
11707         if eval $compile_ok && ./try; then
11708                 echo 'Looks OK.' >&4
11709         else
11710                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11711                 i_db=$undef
11712                 case " $libs " in
11713                 *"-ldb "*)
11714                         : Remove db from list of libraries to use
11715                         echo "Removing unusable -ldb from library list" >&4
11716                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11717                         shift
11718                         libs="$*"
11719                         echo "libs = $libs" >&4
11720                         ;;
11721                 esac
11722         fi
11723         $rm -f try.*
11724         ;;
11725 esac
11726
11727 case "$i_db" in
11728 define)
11729         : Check the return type needed for hash 
11730         echo " "
11731         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11732         $cat >try.c <<EOCP
11733 #$d_const HASCONST
11734 #ifndef HASCONST
11735 #define const
11736 #endif
11737 #include <sys/types.h>
11738 #include <db.h>
11739
11740 #ifndef DB_VERSION_MAJOR
11741 u_int32_t hash_cb (ptr, size)
11742 const void *ptr;
11743 size_t size;
11744 {
11745 }
11746 HASHINFO info;
11747 int main()
11748 {
11749         info.hash = hash_cb;
11750 }
11751 #endif
11752 EOCP
11753         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11754                 if $contains warning try.out >>/dev/null 2>&1 ; then
11755                         db_hashtype='int'
11756                 else
11757                         db_hashtype='u_int32_t'
11758                 fi
11759         else
11760                 : XXX Maybe we should just give up here.
11761                 db_hashtype=u_int32_t
11762                 $cat try.out >&4
11763                 echo "Help:  I can't seem to compile the db test program." >&4
11764                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11765         fi
11766         $rm -f try.*
11767         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11768         ;;
11769 *)      db_hashtype=u_int32_t
11770         ;;
11771 esac
11772 case "$i_db" in
11773 define)
11774         : Check the return type needed for prefix 
11775         echo " "
11776         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11777         cat >try.c <<EOCP
11778 #$d_const HASCONST
11779 #ifndef HASCONST
11780 #define const
11781 #endif
11782 #include <sys/types.h>
11783 #include <db.h>
11784
11785 #ifndef DB_VERSION_MAJOR
11786 size_t prefix_cb (key1, key2)
11787 const DBT *key1;
11788 const DBT *key2;
11789 {
11790 }
11791 BTREEINFO info;
11792 int main()
11793 {
11794         info.prefix = prefix_cb;
11795 }
11796 #endif
11797 EOCP
11798         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11799                 if $contains warning try.out >>/dev/null 2>&1 ; then
11800                         db_prefixtype='int'
11801                 else
11802                         db_prefixtype='size_t'
11803                 fi
11804         else
11805                 db_prefixtype='size_t'
11806                 : XXX Maybe we should just give up here.
11807                 $cat try.out >&4
11808                 echo "Help:  I can't seem to compile the db test program." >&4
11809                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11810         fi
11811         $rm -f try.*
11812         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11813         ;;
11814 *)      db_prefixtype='size_t'
11815         ;;
11816 esac
11817
11818 : check for void type
11819 echo " "
11820 echo "Checking to see how well your C compiler groks the void type..." >&4
11821 case "$voidflags" in
11822 '')
11823         $cat >try.c <<'EOCP'
11824 #if TRY & 1
11825 void sub() {
11826 #else
11827 sub() {
11828 #endif
11829         extern void moo();      /* function returning void */
11830         void (*goo)();          /* ptr to func returning void */
11831 #if TRY & 8
11832         void *hue;              /* generic ptr */
11833 #endif
11834 #if TRY & 2
11835         void (*foo[10])();
11836 #endif
11837
11838 #if TRY & 4
11839         if(goo == moo) {
11840                 exit(0);
11841         }
11842 #endif
11843         exit(0);
11844 }
11845 int main() { sub(); }
11846 EOCP
11847         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11848                 voidflags=$defvoidused
11849         echo "Good.  It appears to support void to the level $package wants.">&4
11850                 if $contains warning .out >/dev/null 2>&1; then
11851                         echo "However, you might get some warnings that look like this:"
11852                         $cat .out
11853                 fi
11854         else
11855 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11856                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11857                         echo "It supports 1..."
11858                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11859                                 echo "It also supports 2..."
11860                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11861                                         voidflags=7
11862                                         echo "And it supports 4 but not 8 definitely."
11863                                 else
11864                                         echo "It doesn't support 4..."
11865                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11866                                                 voidflags=11
11867                                                 echo "But it supports 8."
11868                                         else
11869                                                 voidflags=3
11870                                                 echo "Neither does it support 8."
11871                                         fi
11872                                 fi
11873                         else
11874                                 echo "It does not support 2..."
11875                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11876                                         voidflags=13
11877                                         echo "But it supports 4 and 8."
11878                                 else
11879                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11880                                                 voidflags=5
11881                                                 echo "And it supports 4 but has not heard about 8."
11882                                         else
11883                                                 echo "However it supports 8 but not 4."
11884                                         fi
11885                                 fi
11886                         fi
11887                 else
11888                         echo "There is no support at all for void."
11889                         voidflags=0
11890                 fi
11891         fi
11892 esac
11893 case "$voidflags" in
11894 "$defvoidused") ;;
11895 *)      $cat >&4 <<'EOM'
11896   Support flag bits are:
11897     1: basic void declarations.
11898     2: arrays of pointers to functions returning void.
11899     4: operations between pointers to and addresses of void functions.
11900     8: generic void pointers.
11901 EOM
11902         dflt="$voidflags";
11903         rp="Your void support flags add up to what?"
11904         . ./myread
11905         voidflags="$ans"
11906         ;;
11907 esac
11908 $rm -f try.* .out
11909
11910
11911 : How can we generate normalized random numbers ?
11912 echo " "
11913 echo "Looking for a random number function..." >&4
11914 case "$randfunc" in
11915 '')
11916         if set drand48 val -f; eval $csym; $val; then
11917                 dflt="drand48"
11918                 echo "Good, found drand48()." >&4
11919         elif set random val -f; eval $csym; $val; then
11920                 dflt="random"
11921                 echo "OK, found random()." >&4
11922         else
11923                 dflt="rand"
11924                 echo "Yick, looks like I have to use rand()." >&4
11925         fi
11926         echo " "
11927         ;;
11928 *)
11929         dflt="$randfunc"
11930         ;;
11931 esac
11932 cont=true
11933
11934 case "$ccflags" in
11935 *-Dmy_rand=*|*-Dmy_srand=*)
11936         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11937         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11938         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11939         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11940         ;;
11941 esac
11942
11943 while $test "$cont"; do
11944         rp="Use which function to generate random numbers?"
11945         . ./myread
11946         if $test "$ans" = "$dflt"; then
11947                 : null
11948         else
11949                 randbits=''
11950         fi
11951         randfunc="$ans"
11952         if set $ans val -f; eval $csym; $val; then
11953                 cont=''
11954         else
11955                 dflt=y
11956                 rp="I cannot find function $ans. Use that name anyway?"
11957                 . ./myread
11958                 dflt=rand
11959                 case "$ans" in
11960                         [yY]*) cont='';;
11961                 esac
11962         fi
11963         case "$cont" in
11964         '')
11965                 case "$randfunc" in
11966                 drand48)
11967                         drand01="drand48()"
11968                         seedfunc="srand48"
11969                         randbits=48
11970                         randseedtype=long
11971                         ;;
11972                 rand|random)
11973                         case "$randbits" in
11974                         '')
11975 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11976                                 $cat >try.c <<EOCP
11977 #$i_unistd I_UNISTD
11978 #$i_stdlib I_STDLIB
11979 #include <stdio.h>
11980 #ifdef I_UNISTD
11981 #  include <unistd.h>
11982 #endif
11983 #ifdef I_STDLIB
11984 #  include <stdlib.h>
11985 #endif
11986 int main()
11987 {
11988         register int i;
11989         register unsigned long tmp;
11990         register unsigned long max = 0L;
11991
11992         for (i = 1000; i; i--) {
11993                 tmp = (unsigned long) $randfunc();
11994                 if (tmp > max) max = tmp;
11995         }
11996         for (i = 0; max; i++)
11997                 max /= 2;
11998         printf("%d\n",i);
11999 }
12000 EOCP
12001                                 set try
12002                                 if eval $compile_ok; then
12003                                         dflt=`try`
12004                                 else
12005                                         dflt='?'
12006                                         echo "(I can't seem to compile the test program...)"
12007                                 fi
12008                                 ;;
12009                         *)
12010                                 dflt="$randbits"
12011                                 ;;
12012                         esac
12013                         rp="How many bits does your $randfunc() function produce?"
12014                         . ./myread
12015                         randbits="$ans"
12016                         $rm -f try.c try
12017                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12018                         seedfunc="s$randfunc"
12019                         randseedtype=unsigned
12020                         ;;
12021                 *)
12022                         dflt="31"
12023                         rp="How many bits does your $randfunc() function produce?"
12024                         . ./myread
12025                         randbits="$ans"
12026                         seedfunc="s$randfunc"
12027                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12028                         if set $seedfunc val -f; eval $csym; $val; then
12029                                 echo "(Using $seedfunc() to seed random generator)"
12030                         else
12031                                 echo "(Warning: no $seedfunc() to seed random generator)"
12032                                 seedfunc=rand
12033                         fi
12034                         randseedtype=unsigned
12035                         ;;
12036                 esac
12037                 ;;
12038         esac
12039 done
12040
12041 echo " "
12042 echo "Determining whether or not we are on an EBCDIC system..." >&4
12043 $cat >tebcdic.c <<'EOM'
12044 int main()
12045 {
12046   if ('M'==0xd4) return 0;
12047   return 1;
12048 }
12049 EOM
12050
12051 val=$undef
12052 set tebcdic
12053 if eval $compile_ok; then
12054         if ./tebcdic; then
12055                 echo "You have EBCDIC." >&4
12056                 val="$define"
12057         else
12058                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12059         fi
12060 else
12061         echo "I'm unable to compile the test program." >&4
12062         echo "I'll assume ASCII or some ISO Latin." >&4
12063 fi
12064 $rm -f tebcdic.c tebcdic
12065 set ebcdic
12066 eval $setvar
12067
12068 echo " "
12069 $cat >&4 <<EOM
12070 Checking how to flush all pending stdio output...
12071 EOM
12072 # I only know how to find the first 32 possibly open files on SunOS.
12073 # See also hints/sunos_4_1.sh and util.c  --AD
12074 case "$osname" in
12075 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12076 esac
12077 $cat >>try.c <<EOCP
12078 #include <stdio.h>
12079 #$i_unistd I_UNISTD
12080 #ifdef I_UNISTD
12081 # include <unistd.h>
12082 #endif
12083 #$d_sysconf HAS_SYSCONF
12084 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12085 #ifdef HAS_STDIO_STREAM_ARRAY
12086 # define STDIO_STREAM_ARRAY $stdio_stream_array
12087 #endif
12088 int main() {
12089   FILE* p = fopen("try.out", "w");
12090 #ifdef TRY_FPUTC
12091   fputc('x', p);
12092 #else
12093 # ifdef TRY_FPRINTF
12094   fprintf(p, "x");
12095 # endif
12096 #endif
12097 #ifdef TRY_FFLUSH_NULL
12098   fflush(NULL);
12099 #endif
12100 #ifdef TRY_FFLUSH_ALL
12101   {
12102     long open_max = -1;
12103 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12104     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12105 # else
12106 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12107     open_max = sysconf(_SC_OPEN_MAX);
12108 #  else
12109 #   ifdef FOPEN_MAX
12110     open_max = FOPEN_MAX;
12111 #   else
12112 #    ifdef OPEN_MAX
12113     open_max = OPEN_MAX;
12114 #    else
12115 #     ifdef _NFILE
12116     open_max = _NFILE;
12117 #     endif
12118 #    endif
12119 #   endif
12120 #  endif
12121 # endif 
12122 # ifdef HAS_STDIO_STREAM_ARRAY
12123     if (open_max > 0) {
12124       long i;
12125       for (i = 0; i < open_max; i++)
12126             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12127                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12128                 STDIO_STREAM_ARRAY[i]._flag)
12129                 fflush(&STDIO_STREAM_ARRAY[i]);
12130     }   
12131   }
12132 # endif
12133 #endif
12134   _exit(42);
12135 }
12136 EOCP
12137 : first we have to find out how _not_ to flush
12138 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12139     output=''
12140     set try -DTRY_FPUTC
12141     if eval $compile; then
12142             $rm -f try.out
12143             ./try$exe_ext 2>/dev/null
12144             if $test ! -s try.out -a "X$?" = X42; then
12145                 output=-DTRY_FPUTC
12146             fi
12147     fi
12148     case "$output" in
12149     '')
12150             set try -DTRY_FPRINTF
12151             $rm -f try.out
12152             if eval $compile; then
12153                     $rm -f try.out
12154                     ./try$exe_ext 2>/dev/null
12155                     if $test ! -s try.out -a "X$?" = X42; then
12156                         output=-DTRY_FPRINTF
12157                     fi
12158             fi
12159         ;;
12160     esac
12161 fi
12162 : check for fflush NULL behaviour
12163 case "$fflushNULL" in
12164 '')     set try -DTRY_FFLUSH_NULL $output
12165         if eval $compile; then
12166                 $rm -f try.out
12167                 ./try$exe_ext 2>/dev/null
12168                 code="$?"
12169                 if $test -s try.out -a "X$code" = X42; then
12170                         fflushNULL="`$cat try.out`"
12171                 else
12172                         if $test "X$code" != X42; then
12173                                 $cat >&4 <<EOM
12174 (If this test failed, don't worry, we'll try another method shortly.)
12175 EOM
12176                         fi
12177                 fi
12178         fi
12179         $rm -f core try.core core.try.*
12180         case "$fflushNULL" in
12181         x)      $cat >&4 <<EOM
12182 Your fflush(NULL) works okay.
12183 EOM
12184                 fflushNULL="$define"
12185                 ;;
12186         '')     $cat >&4 <<EOM
12187 Your fflush(NULL) isn't working (contrary to ANSI C).
12188 EOM
12189                 fflushNULL="$undef"
12190                 ;;
12191         *)      $cat >&4 <<EOM
12192 Cannot figure out whether your fflush(NULL) works or not.
12193 I'm assuming it doesn't (contrary to ANSI C).
12194 EOM
12195                 fflushNULL="$undef"
12196                 ;;
12197         esac
12198         ;;
12199 $define|true|[yY]*)
12200         fflushNULL="$define"
12201         ;;
12202 *)
12203         fflushNULL="$undef"
12204         ;;
12205 esac
12206 : check explicit looping only if NULL did not work
12207 case "$fflushNULL" in
12208 "$undef")
12209         : check for fflush all behaviour
12210         case "$fflushall" in
12211         '')     set try -DTRY_FFLUSH_ALL $output
12212                 if eval $compile; then
12213                         $cat >&4 <<EOM
12214 (Now testing the other method--but note that also this may fail.)
12215 EOM
12216                         $rm -f try.out
12217                         ./try$exe_ext 2>/dev/null
12218                         if $test -s try.out -a "X$?" = X42; then
12219                                 fflushall="`$cat try.out`"
12220                         fi
12221                 fi
12222                 $rm -f core try.core core.try.*
12223                 case "$fflushall" in
12224                 x)      $cat >&4 <<EOM
12225 Whew. Flushing explicitly all the stdio streams works.
12226 EOM
12227                         fflushall="$define"
12228                         ;;
12229                 '')     $cat >&4 <<EOM
12230 Sigh. Flushing explicitly all the stdio streams doesn't work.
12231 EOM
12232                         fflushall="$undef"
12233                         ;;
12234                 *)      $cat >&4 <<EOM
12235 Cannot figure out whether flushing stdio streams explicitly works or not.
12236 I'm assuming it doesn't.
12237 EOM
12238                         fflushall="$undef"
12239                         ;;
12240                 esac
12241                 ;;
12242         "$define"|true|[yY]*)
12243                 fflushall="$define"
12244                 ;;
12245         *)
12246                 fflushall="$undef"
12247                 ;;
12248         esac
12249         ;;
12250 *)      fflushall="$undef"      
12251         ;;
12252 esac
12253 case "$fflushNULL$fflushall" in
12254 undefundef)
12255         $cat <<EOM
12256 I cannot figure out how to flush pending stdio output.
12257 EOM
12258         ;;
12259 esac
12260 $rm -f try.* try$exe_ext
12261
12262 : Store the full pathname to the ar program for use in the C program
12263 : Respect a hint or command line value for full_ar.
12264 case "$full_ar" in
12265 '') full_ar=$ar ;;
12266 esac
12267
12268 : Store the full pathname to the sed program for use in the C program
12269 full_sed=$sed
12270
12271 : see what type gids are declared as in the kernel
12272 echo " "
12273 echo "Looking for the type for group ids returned by getgid()."
12274 set gid_t gidtype xxx stdio.h sys/types.h
12275 eval $typedef
12276 case "$gidtype" in
12277 xxx)
12278         xxx=`./findhdr sys/user.h`
12279         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12280         case $1 in
12281         unsigned) dflt="$1 $2" ;;
12282         *) dflt="$1" ;;
12283         esac
12284         ;;
12285 *) dflt="$gidtype";;
12286 esac
12287 case "$gidtype" in
12288 gid_t) echo "gid_t found." ;;
12289 *)      rp="What is the type for group ids returned by getgid()?"
12290         . ./myread
12291         gidtype="$ans"
12292         ;;
12293 esac
12294
12295 echo " "
12296 case "$gidtype" in
12297 *_t) zzz="$gidtype"     ;;
12298 *)   zzz="gid"          ;;
12299 esac
12300 echo "Checking the size of $zzz..." >&4 
12301 cat > try.c <<EOCP
12302 #include <sys/types.h>
12303 #include <stdio.h>
12304 int main() {
12305     printf("%d\n", (int)sizeof($gidtype));
12306     exit(0);
12307 }
12308 EOCP
12309 set try
12310 if eval $compile_ok; then
12311         yyy=`./try`
12312         case "$yyy" in
12313         '')     gidsize=4
12314                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12315                 ;;
12316         *)      gidsize=$yyy
12317                 echo "Your $zzz size is $gidsize bytes."
12318                 ;;
12319         esac
12320 else
12321         gidsize=4
12322         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12323 fi
12324
12325
12326 echo " "
12327 case "$gidtype" in
12328 *_t) zzz="$gidtype"     ;;
12329 *)   zzz="gid"          ;;
12330 esac
12331 echo "Checking the sign of $zzz..." >&4 
12332 cat > try.c <<EOCP
12333 #include <sys/types.h>
12334 #include <stdio.h>
12335 int main() {
12336         $gidtype foo = -1;
12337         if (foo < 0)
12338                 printf("-1\n");
12339         else
12340                 printf("1\n");
12341 }
12342 EOCP
12343 set try
12344 if eval $compile; then
12345         yyy=`./try`
12346         case "$yyy" in
12347         '')     gidsign=1
12348                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12349                 ;;
12350         *)      gidsign=$yyy
12351                 case "$gidsign" in
12352                  1) echo "Your $zzz is unsigned." ;;
12353                 -1) echo "Your $zzz is signed."   ;;
12354                 esac
12355                 ;;
12356         esac
12357 else
12358         gidsign=1
12359         echo "(I can't compile the test program--guessing unsigned.)" >&4
12360 fi
12361
12362
12363 echo " "
12364
12365 if $test X"$quadtype" != X; then
12366
12367 echo "Checking how to print 64-bit integers..." >&4
12368
12369 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12370         $cat >try.c <<'EOCP'
12371 #include <sys/types.h>
12372 #include <stdio.h>
12373 int main() {
12374   int q = 12345678901;
12375   printf("%ld\n", q);
12376 }
12377 EOCP
12378         set try
12379         if eval $compile; then
12380                 yyy=`./try$exe_ext`
12381                 case "$yyy" in
12382                 12345678901)
12383                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12384                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12385                         echo "We will use %d."
12386                         ;;
12387                 esac
12388         fi
12389 fi
12390
12391 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12392         $cat >try.c <<'EOCP'
12393 #include <sys/types.h>
12394 #include <stdio.h>
12395 int main() {
12396   long q = 12345678901;
12397   printf("%ld\n", q);
12398 }
12399 EOCP
12400         set try
12401         if eval $compile; then
12402                 yyy=`./try$exe_ext`
12403                 case "$yyy" in
12404                 12345678901)
12405                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12406                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12407                         echo "We will use %ld."
12408                         ;;
12409                 esac
12410         fi
12411 fi
12412
12413 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12414         $cat >try.c <<'EOCP'
12415 #include <sys/types.h>
12416 #include <inttypes.h>
12417 #include <stdio.h>
12418 int main() {
12419   int64_t q = 12345678901;
12420   printf("%" PRId64 "\n", q);
12421 }
12422 EOCP
12423         set try
12424         if eval $compile; then
12425                 yyy=`./try$exe_ext`
12426                 case "$yyy" in
12427                 12345678901)
12428                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12429                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12430                         echo "We will use the C9X style."
12431                         ;;
12432                 esac
12433         fi
12434 fi
12435
12436 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12437         $cat >try.c <<'EOCP'
12438 #include <sys/types.h>
12439 #include <stdio.h>
12440 int main() {
12441   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12442   printf("%lld\n", q);
12443 }
12444 EOCP
12445         set try
12446         if eval $compile; then
12447                 yyy=`./try$exe_ext`
12448                 case "$yyy" in
12449                 12345678901)
12450                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12451                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12452                         echo "We will use the %lld style."
12453                         ;;
12454                 esac
12455         fi
12456 fi
12457
12458 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12459         $cat >try.c <<EOCP
12460 #include <sys/types.h>
12461 #include <stdio.h>
12462 int main() {
12463   $quadtype q = 12345678901;
12464   printf("%Ld\n", q);
12465 }
12466 EOCP
12467         set try
12468         if eval $compile; then
12469                 yyy=`./try$exe_ext`
12470                 case "$yyy" in
12471                 12345678901)
12472                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12473                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12474                         echo "We will use %Ld."
12475                         ;;
12476                 esac
12477         fi
12478 fi
12479
12480 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12481         $cat >try.c <<EOCP
12482 #include <sys/types.h>
12483 #include <stdio.h>
12484 int main() {
12485   $quadtype q = 12345678901;
12486   printf("%qd\n", q);
12487 }
12488 EOCP
12489         set try
12490         if eval $compile; then
12491                 yyy=`./try$exe_ext`
12492                 case "$yyy" in
12493                 12345678901)
12494                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12495                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12496                         echo "We will use %qd."
12497                         ;;
12498                 esac
12499         fi
12500 fi
12501
12502 if $test X"$sPRId64" = X; then
12503         echo "Cannot figure out how to print 64-bit integers." >&4
12504 fi
12505
12506 $rm -f try try.*
12507
12508 fi
12509
12510 case "$sPRId64" in
12511 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12512         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12513         ;;
12514 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12515         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12516         ;;
12517 esac
12518
12519
12520 echo " "
12521 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12522
12523 if $test X"$ivsize" = X8; then
12524         ivdformat="$sPRId64"
12525         uvuformat="$sPRIu64"
12526         uvoformat="$sPRIo64"
12527         uvxformat="$sPRIx64"
12528 else
12529         if $test X"$ivsize" = X"$longsize"; then
12530                 ivdformat='"ld"'
12531                 uvuformat='"lu"'
12532                 uvoformat='"lo"'
12533                 uvxformat='"lx"'
12534         else
12535                 if $test X"$ivsize" = X"$intsize"; then
12536                         ivdformat='"d"'
12537                         uvuformat='"u"'
12538                         uvoformat='"o"'
12539                         uvxformat='"x"'
12540                 else
12541                         : far out
12542                         if $test X"$ivsize" = X"$shortsize"; then
12543                                 ivdformat='"hd"'
12544                                 uvuformat='"hu"'
12545                                 uvoformat='"ho"'
12546                                 uvxformat='"hx"'
12547                         fi
12548                 fi
12549         fi
12550 fi
12551
12552 case "$ivdformat" in
12553 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12554     exit 1
12555     ;;
12556 esac
12557
12558
12559 echo " "
12560 $echo "Checking the format string to be used for gids..." >&4
12561
12562 case "$gidsign" in
12563 -1)     if $test X"$gidsize" = X"$ivsize"; then
12564                 gidformat="$ivdformat"
12565         else
12566                 if $test X"$gidsize" = X"$longsize"; then
12567                         gidformat='"ld"'
12568                 else
12569                         if $test X"$gidsize" = X"$intsize"; then
12570                                 gidformat='"d"'
12571                         else
12572                                 if $test X"$gidsize" = X"$shortsize"; then
12573                                         gidformat='"hd"'
12574                                 fi
12575                         fi
12576                 fi
12577         fi
12578         ;;
12579 *)      if $test X"$gidsize" = X"$uvsize"; then
12580                 gidformat="$uvuformat"
12581         else
12582                 if $test X"$gidsize" = X"$longsize"; then
12583                         gidformat='"lu"'
12584                 else
12585                         if $test X"$gidsize" = X"$intsize"; then
12586                                 gidformat='"u"'
12587                         else
12588                                 if $test X"$gidsize" = X"$shortsize"; then
12589                                         gidformat='"hu"'
12590                                 fi
12591                         fi
12592                 fi
12593         fi
12594         ;;
12595 esac
12596
12597 : see if getgroups exists
12598 set getgroups d_getgrps
12599 eval $inlibc
12600
12601 : see if setgroups exists
12602 set setgroups d_setgrps
12603 eval $inlibc
12604
12605
12606 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12607 echo " "
12608 case "$d_getgrps$d_setgrps" in
12609 *define*)
12610         case "$groupstype" in
12611         '') dflt="$gidtype" ;;
12612         *)  dflt="$groupstype" ;;
12613         esac
12614         $cat <<EOM
12615 What type of pointer is the second argument to getgroups() and setgroups()?
12616 Usually this is the same as group ids, $gidtype, but not always.
12617
12618 EOM
12619         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12620         . ./myread
12621         groupstype="$ans"
12622         ;;
12623 *)  groupstype="$gidtype";;
12624 esac
12625
12626 echo " "
12627 echo "Checking if your $make program sets \$(MAKE)..." >&4
12628 case "$make_set_make" in
12629 '')
12630         $sed 's/^X //' > testmake.mak << 'EOF'
12631 Xall:
12632 X       @echo 'maketemp="$(MAKE)"'
12633 EOF
12634         case "`$make -f testmake.mak 2>/dev/null`" in
12635         *maketemp=*) make_set_make='#' ;;
12636         *)      make_set_make="MAKE=$make" ;;
12637         esac
12638         $rm -f testmake.mak
12639         ;;
12640 esac
12641 case "$make_set_make" in
12642 '#') echo "Yup, it does.";;
12643 *) echo "Nope, it doesn't.";;
12644 esac
12645
12646 : see what type is used for mode_t
12647 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12648 set mode_t modetype int stdio.h sys/types.h
12649 eval $typedef_ask
12650
12651 : define a fucntion to check prototypes
12652 $cat > protochk <<EOSH
12653 $startsh
12654 cc="$cc"
12655 optimize="$optimize"
12656 ccflags="$ccflags"
12657 prototype="$prototype"
12658 define="$define"
12659 rm=$rm
12660 EOSH
12661
12662 $cat >> protochk <<'EOSH'
12663
12664 $rm -f try.c
12665 foo="$1"
12666 shift
12667 while test $# -ge 2; do
12668         case "$1" in
12669                 $define) echo "#include <$2>" >> try.c ;;
12670                 literal) echo "$2" >> try.c ;;
12671         esac
12672     shift 2
12673 done
12674 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12675 cat >> try.c <<'EOCP'
12676 #ifdef CAN_PROTOTYPE
12677 #define _(args) args
12678 #else
12679 #define _(args) ()
12680 #endif
12681 EOCP
12682 echo "$foo" >> try.c
12683 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12684 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12685 status=$?
12686 $rm -f try.[co]
12687 exit $status
12688 EOSH
12689 chmod +x protochk
12690 $eunicefix protochk
12691
12692 : see what type is used for size_t
12693 rp="What is the type used for the length parameter for string functions?"
12694 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12695 eval $typedef_ask
12696
12697 : check for type of arguments to gethostbyaddr. 
12698 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12699         case "$d_gethbyaddr" in
12700         $define)
12701                 $cat <<EOM
12702
12703 Checking to see what type of arguments are accepted by gethostbyaddr().
12704 EOM
12705                 hdrs="$define sys/types.h
12706                         $d_socket sys/socket.h 
12707                         $i_niin netinet/in.h 
12708                         $i_netdb netdb.h
12709                         $i_unistd unistd.h"
12710                 : The first arg can 'char *' or 'void *'
12711                 : The second arg is some of integral type
12712                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12713                         for yyy in size_t long int; do
12714                                 case "$netdb_host_type" in
12715                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12716                                         if ./protochk "$try" $hdrs; then
12717                                                 echo "Your system accepts $xxx for the first arg."
12718                                                 echo "...and $yyy for the second arg."
12719                                                 netdb_host_type="$xxx"
12720                                                 netdb_hlen_type="$yyy"
12721                                         fi
12722                                         ;;
12723                                 esac
12724                         done
12725                 done
12726                 : In case none of those worked, prompt the user.
12727                 case "$netdb_host_type" in
12728                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12729                         dflt='char *'
12730                         . ./myread
12731                         netdb_host_type=$ans
12732                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12733                         dflt="$sizetype"
12734                         . ./myread
12735                         netdb_hlen_type=$ans
12736                         ;;
12737                 esac
12738                 ;;
12739         *)      : no gethostbyaddr, so pick harmless defaults
12740                 netdb_host_type='char *'
12741                 netdb_hlen_type="$sizetype"
12742                 ;;
12743         esac
12744         # Remove the "const" if needed. -- but then we'll have a 
12745         # prototype clash!
12746         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12747 fi
12748
12749 : check for type of argument to gethostbyname. 
12750 if test "X$netdb_name_type" = X ; then
12751         case "$d_gethbyname" in
12752         $define)
12753                 $cat <<EOM
12754
12755 Checking to see what type of argument is accepted by gethostbyname().
12756 EOM
12757                 hdrs="$define sys/types.h
12758                         $d_socket sys/socket.h 
12759                         $i_niin netinet/in.h 
12760                         $i_netdb netdb.h
12761                         $i_unistd unistd.h"
12762                 for xxx in "const char *" "char *"; do
12763                         case "$netdb_name_type" in
12764                         '')     try="extern struct hostent *gethostbyname($xxx);"
12765                                 if ./protochk "$try" $hdrs; then
12766                                         echo "Your system accepts $xxx."
12767                                         netdb_name_type="$xxx"
12768                                 fi
12769                                 ;;
12770                         esac
12771                 done
12772                 : In case none of those worked, prompt the user.
12773                 case "$netdb_name_type" in
12774                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12775                         dflt='char *'
12776                         . ./myread
12777                         netdb_name_type=$ans
12778                         ;;
12779                 esac
12780                 ;;
12781         *)      : no gethostbyname, so pick harmless default
12782                 netdb_name_type='char *'
12783                 ;;
12784         esac
12785 fi
12786
12787 : check for type of 1st argument to getnetbyaddr. 
12788 if test "X$netdb_net_type" = X ; then
12789         case "$d_getnbyaddr" in
12790         $define)
12791                 $cat <<EOM
12792
12793 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12794 EOM
12795                 hdrs="$define sys/types.h
12796                         $d_socket sys/socket.h 
12797                         $i_niin netinet/in.h 
12798                         $i_netdb netdb.h
12799                         $i_unistd unistd.h"
12800                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12801                         case "$netdb_net_type" in
12802                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12803                                 if ./protochk "$try" $hdrs; then
12804                                         echo "Your system accepts $xxx."
12805                                         netdb_net_type="$xxx"
12806                                 fi
12807                                 ;;
12808                         esac
12809                 done
12810                 : In case none of those worked, prompt the user.
12811                 case "$netdb_net_type" in
12812                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12813                         dflt='long'
12814                         . ./myread
12815                         netdb_net_type=$ans
12816                         ;;
12817                 esac
12818                 ;;
12819         *)      : no getnetbyaddr, so pick harmless default
12820                 netdb_net_type='long'
12821                 ;;
12822         esac
12823 fi
12824 : locate the preferred pager for this system
12825 case "$pager" in
12826 '')
12827         dflt=''
12828         case "$pg" in
12829         /*) dflt=$pg;;
12830         esac
12831         case "$more" in
12832         /*) dflt=$more;;
12833         esac
12834         case "$less" in
12835         /*) dflt=$less;;
12836         esac
12837         case "$dflt" in
12838         '') dflt=/usr/ucb/more;;
12839         esac
12840         ;;
12841 *) dflt="$pager";;
12842 esac
12843 echo " "
12844 fn=f/
12845 rp='What pager is used on your system?'
12846 . ./getfile
12847 pager="$ans"
12848
12849 : see what type pids are declared as in the kernel
12850 rp="What is the type of process ids on this system?"
12851 set pid_t pidtype int stdio.h sys/types.h
12852 eval $typedef_ask
12853
12854 : check for length of pointer
12855 echo " "
12856 case "$ptrsize" in
12857 '')
12858         $echo $n "Checking to see how big your pointers are...$c" >&4
12859         if test "$voidflags" -gt 7; then
12860                 echo '#define VOID_PTR char *' > try.c
12861         else
12862                 echo '#define VOID_PTR void *' > try.c
12863         fi
12864         $cat >>try.c <<'EOCP'
12865 #include <stdio.h>
12866 int main()
12867 {
12868     printf("%d\n", (int)sizeof(VOID_PTR));
12869     exit(0);
12870 }
12871 EOCP
12872         set try
12873         if eval $compile_ok; then
12874                 ptrsize=`./try`
12875                 $echo " $ptrsize bytes." >&4
12876         else
12877                 dflt='4'
12878                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12879                 rp="What is the size of a pointer (in bytes)?"
12880                 . ./myread
12881                 ptrsize="$ans"
12882         fi
12883         ;;
12884 esac
12885 $rm -f try.c try
12886
12887 : see if ar generates random libraries by itself
12888 echo " "
12889 echo "Checking how to generate random libraries on your machine..." >&4
12890 echo 'int bar1() { return bar2(); }' > bar1.c
12891 echo 'int bar2() { return 2; }' > bar2.c
12892 $cat > foo.c <<'EOP'
12893 int main() { printf("%d\n", bar1()); exit(0); }
12894 EOP
12895 $cc $ccflags -c bar1.c >/dev/null 2>&1
12896 $cc $ccflags -c bar2.c >/dev/null 2>&1
12897 $cc $ccflags -c foo.c >/dev/null 2>&1
12898 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12899 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12900         ./foobar >/dev/null 2>&1; then
12901         echo "$ar appears to generate random libraries itself."
12902         orderlib=false
12903         ranlib=":"
12904 elif $ar ts bar$_a >/dev/null 2>&1 &&
12905         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12906         ./foobar >/dev/null 2>&1; then
12907                 echo "a table of contents needs to be added with '$ar ts'."
12908                 orderlib=false
12909                 ranlib="$ar ts"
12910 else
12911         case "$ranlib" in
12912         :) ranlib='';;
12913         '')
12914                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12915                 $test -f $ranlib || ranlib=''
12916                 ;;
12917         esac
12918         if $test -n "$ranlib"; then
12919                 echo "your system has '$ranlib'; we'll use that."
12920                 orderlib=false
12921         else
12922                 echo "your system doesn't seem to support random libraries"
12923                 echo "so we'll use lorder and tsort to order the libraries."
12924                 orderlib=true
12925                 ranlib=":"
12926         fi
12927 fi
12928 $rm -f foo* bar* 
12929
12930 : check for type of arguments to select. 
12931 case "$selecttype" in
12932 '') case "$d_select" in
12933         $define)
12934                 echo " "
12935                 $cat <<EOM
12936 Checking to see what type of arguments are accepted by select().
12937 EOM
12938                 hdrs="$define sys/types.h
12939                         $i_systime sys/time.h 
12940                         $i_sysselct sys/select.h
12941                         $d_socket sys/socket.h"
12942                 : The first arg can be int, unsigned, or size_t
12943                 : The last arg may or may not be 'const'
12944                 val=''
12945                 : void pointer has been seen but using that
12946                 : breaks the selectminbits test
12947                 for xxx in 'fd_set *' 'int *'; do
12948                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12949                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12950                                         case "$val" in
12951                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12952                                                 if ./protochk "$try" $hdrs; then
12953                                                         echo "Your system accepts $xxx."
12954                                                         val="$xxx"
12955                                                 fi
12956                                                 ;;
12957                                         esac
12958                                 done
12959                         done
12960                 done
12961                 case "$val" in
12962                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12963                         case "$d_fd_set" in
12964                                 $define) dflt="fd_set *" ;;
12965                                 *)              dflt="int *" ;;
12966                         esac
12967                         . ./myread
12968                         val=$ans
12969                         ;;
12970                 esac
12971                 selecttype="$val"
12972                 ;;
12973         *)      : no select, so pick a harmless default
12974                 selecttype='int *'
12975                 ;;
12976         esac
12977         ;;
12978 esac
12979
12980 : check for the select 'width'
12981 case "$selectminbits" in
12982 '') case "$d_select" in
12983         $define)
12984                 $cat <<EOM
12985
12986 Checking to see on how many bits at a time your select() operates...
12987 EOM
12988                 $cat >try.c <<EOCP
12989 #include <sys/types.h>
12990 #$i_time I_TIME
12991 #$i_systime I_SYS_TIME
12992 #$i_systimek I_SYS_TIME_KERNEL
12993 #ifdef I_TIME
12994 #   include <time.h>
12995 #endif
12996 #ifdef I_SYS_TIME
12997 #   ifdef I_SYS_TIME_KERNEL
12998 #       define KERNEL
12999 #   endif
13000 #   include <sys/time.h>
13001 #   ifdef I_SYS_TIME_KERNEL
13002 #       undef KERNEL
13003 #   endif
13004 #endif
13005 #$i_sysselct I_SYS_SELECT
13006 #ifdef I_SYS_SELECT
13007 #include <sys/select.h>
13008 #endif
13009 #$d_socket HAS_SOCKET
13010 #ifdef HAS_SOCKET
13011 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13012 #endif
13013 #include <stdio.h>
13014 $selecttype b;
13015 #define S sizeof(*(b))
13016 #define MINBITS 64
13017 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13018 #define NBITS  (NBYTES * 8)
13019 int main() {
13020     char s[NBYTES];
13021     struct timeval t;
13022     int i;
13023     FILE* fp;
13024     int fd;
13025
13026     fclose(stdin);
13027     fp = fopen("try.c", "r");
13028     if (fp == 0)
13029       exit(1);
13030     fd = fileno(fp);
13031     if (fd < 0)
13032       exit(2);
13033     b = ($selecttype)s;
13034     for (i = 0; i < NBITS; i++)
13035         FD_SET(i, b);
13036     t.tv_sec  = 0;
13037     t.tv_usec = 0;
13038     select(fd + 1, b, 0, 0, &t);
13039     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13040     printf("%d\n", i + 1);
13041     return 0;
13042 }
13043 EOCP
13044                 set try
13045                 if eval $compile_ok; then
13046                         selectminbits=`./try`
13047                         case "$selectminbits" in
13048                         '')     cat >&4 <<EOM
13049 Cannot figure out on how many bits at a time your select() operates.
13050 I'll play safe and guess it is 32 bits.
13051 EOM
13052                                 selectminbits=32
13053                                 bits="32 bits"
13054                                 ;;
13055                         1)      bits="1 bit" ;;
13056                         *)      bits="$selectminbits bits" ;;
13057                         esac
13058                         echo "Your select() operates on $bits at a time." >&4
13059                 else
13060                         rp='What is the minimum number of bits your select() operates on?'
13061                         case "$byteorder" in
13062                         1234|12345678)  dflt=32 ;;
13063                         *)              dflt=1  ;;
13064                         esac
13065                         . ./myread
13066                         val=$ans
13067                         selectminbits="$val"
13068                 fi
13069                 $rm -f try.* try
13070                 ;;
13071         *)      : no select, so pick a harmless default
13072                 selectminbits='32'
13073                 ;;
13074         esac
13075         ;;
13076 esac
13077
13078 : Trace out the files included by signal.h, then look for SIGxxx names.
13079 : Remove SIGARRAYSIZE used by HPUX.
13080 : Remove SIGSTKSIZE used by Linux.
13081 : Remove SIGSTKSZ used by Posix.
13082 : Remove SIGTYP void lines used by OS2.
13083 : Some cpps, like os390, dont give the file name anywhere
13084 if [ "X$fieldn" = X ]; then
13085         : Just make some guesses.  We check them later.
13086         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13087 else
13088         xxx=`echo '#include <signal.h>' |
13089         $cppstdin $cppminus $cppflags 2>/dev/null |
13090         $grep '^[       ]*#.*include' | 
13091         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13092 fi
13093 : Check this list of files to be sure we have parsed the cpp output ok.
13094 : This will also avoid potentially non-existent files, such 
13095 : as ../foo/bar.h
13096 xxxfiles=''
13097 for xx in $xxx /dev/null ; do
13098         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13099 done
13100 : If we have found no files, at least try signal.h
13101 case "$xxxfiles" in
13102 '')     xxxfiles=`./findhdr signal.h` ;;
13103 esac
13104 xxx=`awk '
13105 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13106         print substr($2, 4, 20)
13107 }
13108 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13109         print substr($3, 4, 20)
13110 }' $xxxfiles`
13111 : Append some common names just in case the awk scan failed.
13112 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13113 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13114 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13115 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13116 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13117
13118 : generate a few handy files for later
13119 $cat > signal.c <<'EOCP'
13120 #include <sys/types.h>
13121 #include <signal.h>
13122 #include <stdio.h>
13123 int main() {
13124
13125 /* Strange style to avoid deeply-nested #if/#else/#endif */
13126 #ifndef NSIG
13127 #  ifdef _NSIG
13128 #    define NSIG (_NSIG)
13129 #  endif
13130 #endif
13131
13132 #ifndef NSIG
13133 #  ifdef SIGMAX
13134 #    define NSIG (SIGMAX+1)
13135 #  endif
13136 #endif
13137
13138 #ifndef NSIG
13139 #  ifdef SIG_MAX
13140 #    define NSIG (SIG_MAX+1)
13141 #  endif
13142 #endif
13143
13144 #ifndef NSIG
13145 #  ifdef MAXSIG
13146 #    define NSIG (MAXSIG+1)
13147 #  endif
13148 #endif
13149
13150 #ifndef NSIG
13151 #  ifdef MAX_SIG
13152 #    define NSIG (MAX_SIG+1)
13153 #  endif
13154 #endif
13155
13156 #ifndef NSIG
13157 #  ifdef SIGARRAYSIZE
13158 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13159 #  endif
13160 #endif
13161
13162 #ifndef NSIG
13163 #  ifdef _sys_nsig
13164 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13165 #  endif
13166 #endif
13167
13168 /* Default to some arbitrary number that's big enough to get most
13169    of the common signals.
13170 */
13171 #ifndef NSIG
13172 #    define NSIG 50
13173 #endif
13174
13175 printf("NSIG %d\n", NSIG);
13176
13177 #ifndef JUST_NSIG
13178
13179 EOCP
13180
13181 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13182 {
13183         printf "#ifdef SIG"; printf $1; printf "\n"
13184         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13185         printf $1; printf ");\n"
13186         printf "#endif\n"
13187 }
13188 END {
13189         printf "#endif /* JUST_NSIG */\n";
13190         printf "exit(0);\n}\n";
13191 }
13192 ' >>signal.c
13193 $cat >signal.awk <<'EOP'
13194 BEGIN { ndups = 0 }
13195 $1 ~ /^NSIG$/ { nsig = $2 }
13196 ($1 !~ /^NSIG$/) && (NF == 2) {
13197     if ($2 > maxsig) { maxsig = $2 }
13198     if (sig_name[$2]) {
13199         dup_name[ndups] = $1
13200         dup_num[ndups] = $2
13201         ndups++ 
13202     }
13203     else {
13204         sig_name[$2] = $1
13205         sig_num[$2] = $2
13206     }
13207 }
13208 END { 
13209     if (nsig == 0) {
13210         nsig = maxsig + 1
13211     }
13212     printf("NSIG %d\n", nsig);
13213     for (n = 1; n < nsig; n++) {
13214         if (sig_name[n]) {
13215             printf("%s %d\n", sig_name[n], sig_num[n])
13216         }
13217         else {
13218             printf("NUM%d %d\n", n, n) 
13219         }
13220     }
13221     for (n = 0; n < ndups; n++) {
13222         printf("%s %d\n", dup_name[n], dup_num[n])
13223     }
13224 }
13225 EOP
13226 $cat >signal_cmd <<EOS
13227 $startsh
13228 if $test -s signal.lst; then
13229     echo "Using your existing signal.lst file"
13230         exit 0
13231 fi
13232 xxx="$xxx"
13233 EOS
13234 $cat >>signal_cmd <<'EOS'
13235
13236 set signal
13237 if eval $compile_ok; then
13238         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13239 else
13240         echo "(I can't seem be able to compile the whole test program)" >&4
13241         echo "(I'll try it in little pieces.)" >&4
13242         set signal -DJUST_NSIG
13243         if eval $compile_ok; then
13244                 ./signal$_exe > signal.nsg
13245                 $cat signal.nsg
13246         else
13247                 echo "I can't seem to figure out how many signals you have." >&4
13248                 echo "Guessing 50." >&4
13249                 echo 'NSIG 50' > signal.nsg
13250         fi
13251         : Now look at all the signal names, one at a time.
13252         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13253                 $cat > signal.c <<EOCP
13254 #include <sys/types.h>
13255 #include <signal.h>
13256 #include <stdio.h>
13257 int main() {
13258 printf("$xx %d\n", SIG${xx});
13259 return 0;
13260 }
13261 EOCP
13262                 set signal
13263                 if eval $compile; then
13264                         echo "SIG${xx} found."
13265                         ./signal$_exe  >> signal.ls1
13266                 else
13267                         echo "SIG${xx} NOT found."
13268                 fi
13269         done
13270         if $test -s signal.ls1; then
13271                 $cat signal.nsg signal.ls1 |
13272                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13273         fi
13274
13275 fi
13276 if $test -s signal.lst; then
13277         :
13278 else
13279         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13280         echo 'kill -l' >signal
13281         set X `csh -f <signal`
13282         $rm -f signal
13283         shift
13284         case $# in
13285         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13286         esac
13287         echo $@ | $tr ' ' $trnl | \
13288             $awk '{ printf "%s %d\n", $1, ++s; }
13289                   END { printf "NSIG %d\n", ++s }' >signal.lst
13290 fi
13291 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13292 EOS
13293 chmod a+x signal_cmd
13294 $eunicefix signal_cmd
13295
13296 : generate list of signal names
13297 echo " "
13298 case "$sig_name_init" in
13299 '') doinit=yes ;;
13300 *)  case "$sig_num_init" in
13301     ''|*,*) doinit=yes ;;
13302     esac ;;
13303 esac
13304 case "$doinit" in
13305 yes)
13306         echo "Generating a list of signal names and numbers..." >&4
13307         . ./signal_cmd
13308         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13309         sig_name=`$awk 'BEGIN { printf "ZERO " }
13310                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13311         sig_num=`$awk  'BEGIN { printf "0 " }
13312                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13313         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13314                              !/^NSIG/   { printf "\"%s\", ", $1 }
13315                              END        { printf "0\n" }' signal.lst`
13316         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13317                              !/^NSIG/   { printf "%d, ", $2}
13318                              END        { printf "0\n"}' signal.lst`
13319         ;;
13320 esac
13321 echo "The following $sig_count signals are available:"
13322 echo " "
13323 echo $sig_name | $awk \
13324 'BEGIN { linelen = 0 }
13325 {
13326         for (i = 1; i <= NF; i++) {
13327                 name = "SIG" $i " "
13328                 linelen = linelen + length(name)
13329                 if (linelen > 70) {
13330                         printf "\n"
13331                         linelen = length(name)
13332                 }
13333                 printf "%s", name
13334         }
13335         printf "\n"
13336 }'
13337 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13338
13339 : see what type is used for signed size_t
13340 set ssize_t ssizetype int stdio.h sys/types.h
13341 eval $typedef
13342 dflt="$ssizetype"
13343 $cat > ssize.c <<EOM
13344 #include <stdio.h>
13345 #include <sys/types.h>
13346 #define Size_t $sizetype
13347 #define SSize_t $dflt
13348 int main()
13349 {
13350         if (sizeof(Size_t) == sizeof(SSize_t))
13351                 printf("$dflt\n");
13352         else if (sizeof(Size_t) == sizeof(int))
13353                 printf("int\n");
13354         else 
13355                 printf("long\n");
13356         exit(0);
13357 }
13358 EOM
13359 echo " "
13360 set ssize
13361 if eval $compile_ok && ./ssize > /dev/null; then
13362         ssizetype=`./ssize`
13363         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13364 else
13365         $cat >&4 <<EOM
13366 Help! I can't compile and run the ssize_t test program: please enlighten me!
13367 (This is probably a misconfiguration in your system or libraries, and
13368 you really ought to fix it.  Still, I'll try anyway.)
13369
13370 I need a type that is the same size as $sizetype, but is guaranteed to
13371 be signed.  Common values are ssize_t, int and long.
13372
13373 EOM
13374         rp="What signed type is the same size as $sizetype?"
13375         . ./myread
13376         ssizetype="$ans"
13377 fi
13378 $rm -f ssize ssize.*
13379
13380 : see what type of char stdio uses.
13381 echo " "
13382 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13383         echo "Your stdio uses unsigned chars." >&4
13384         stdchar="unsigned char"
13385 else
13386         echo "Your stdio uses signed chars." >&4
13387         stdchar="char"
13388 fi
13389
13390 : see if time exists
13391 echo " "
13392 if test "X$d_time" = X -o X"$timetype" = X; then
13393     if set time val -f d_time; eval $csym; $val; then
13394                 echo 'time() found.' >&4
13395                 val="$define"
13396                 rp="What is the type returned by time() on this system?"
13397                 set time_t timetype long stdio.h sys/types.h
13398                 eval $typedef_ask
13399     else
13400                 echo 'time() not found, hope that will do.' >&4
13401                 val="$undef"
13402                 timetype='int';
13403     fi
13404     set d_time
13405     eval $setvar
13406 fi
13407
13408 : see what type uids are declared as in the kernel
13409 echo " "
13410 echo "Looking for the type for user ids returned by getuid()."
13411 set uid_t uidtype xxx stdio.h sys/types.h
13412 eval $typedef
13413 case "$uidtype" in
13414 xxx)
13415         xxx=`./findhdr sys/user.h`
13416         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13417         case $1 in
13418         unsigned) dflt="$1 $2" ;;
13419         *) dflt="$1" ;;
13420         esac
13421         ;;
13422 *) dflt="$uidtype";;
13423 esac
13424 case "$uidtype" in
13425 uid_t)  echo "uid_t found." ;;
13426 *)      rp="What is the type for user ids returned by getuid()?"
13427         . ./myread
13428         uidtype="$ans"
13429         ;;
13430 esac
13431
13432 echo " "
13433 case "$uidtype" in
13434 *_t) zzz="$uidtype"     ;;
13435 *)   zzz="uid"          ;;
13436 esac
13437 echo "Checking the size of $zzz..." >&4 
13438 cat > try.c <<EOCP
13439 #include <sys/types.h>
13440 #include <stdio.h>
13441 int main() {
13442     printf("%d\n", (int)sizeof($uidtype));
13443     exit(0);
13444 }
13445 EOCP
13446 set try
13447 if eval $compile_ok; then
13448         yyy=`./try`
13449         case "$yyy" in
13450         '')     uidsize=4
13451                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13452                 ;;
13453         *)      uidsize=$yyy
13454                 echo "Your $zzz size is $uidsize bytes."
13455                 ;;
13456         esac
13457 else
13458         uidsize=4
13459         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13460 fi
13461
13462 echo " "
13463 case "$uidtype" in
13464 *_t) zzz="$uidtype"     ;;
13465 *)   zzz="uid"          ;;
13466 esac
13467 echo "Checking the sign of $zzz..." >&4
13468 cat > try.c <<EOCP
13469 #include <sys/types.h>
13470 #include <stdio.h>
13471 int main() {
13472         $uidtype foo = -1;
13473         if (foo < 0)
13474                 printf("-1\n");
13475         else
13476                 printf("1\n");
13477 }
13478 EOCP
13479 set try
13480 if eval $compile; then
13481         yyy=`./try`
13482         case "$yyy" in
13483         '')     uidsign=1
13484                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13485                 ;;
13486         *)      uidsign=$yyy
13487                 case "$uidsign" in
13488                  1) echo "Your $zzz is unsigned." ;;
13489                 -1) echo "Your $zzz is signed."   ;;
13490                 esac
13491                 ;;
13492         esac
13493 else
13494         uidsign=1
13495         echo "(I can't compile the test program--guessing unsigned.)" >&4
13496 fi
13497
13498
13499
13500 echo " "
13501 $echo "Checking the format string to be used for uids..." >&4
13502
13503 case "$uidsign" in
13504 -1)     if $test X"$uidsize" = X"$ivsize"; then
13505                 uidformat="$ivdformat"
13506         else
13507                 if $test X"$uidsize" = X"$longsize"; then
13508                         uidformat='"ld"'
13509                 else
13510                         if $test X"$uidsize" = X"$intsize"; then
13511                                 uidformat='"d"'
13512                         else
13513                                 if $test X"$uidsize" = X"$shortsize"; then
13514                                         uidformat='"hd"'
13515                                 fi
13516                         fi
13517                 fi
13518         fi
13519         ;;
13520 *)      if $test X"$uidsize" = X"$uvsize"; then
13521                 uidformat="$uvuformat"
13522         else
13523                 if $test X"$uidsize" = X"$longsize"; then
13524                         uidformat='"lu"'
13525                 else
13526                         if $test X"$uidsize" = X"$intsize"; then
13527                                 uidformat='"u"'
13528                         else
13529                                 if $test X"$uidsize" = X"$shortsize"; then
13530                                         uidformat='"hu"'
13531                                 fi
13532                         fi
13533                 fi
13534         fi
13535         ;;
13536 esac
13537
13538 : see if dbm.h is available
13539 : see if dbmclose exists
13540 set dbmclose d_dbmclose
13541 eval $inlibc
13542
13543 case "$d_dbmclose" in
13544 $define)
13545         set dbm.h i_dbm
13546         eval $inhdr
13547         case "$i_dbm" in
13548         $define)
13549                 val="$undef"
13550                 set i_rpcsvcdbm
13551                 eval $setvar
13552                 ;;
13553         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13554                 eval $inhdr
13555                 ;;
13556         esac
13557         ;;
13558 *)      echo "We won't be including <dbm.h>"
13559         val="$undef"
13560         set i_dbm
13561         eval $setvar
13562         val="$undef"
13563         set i_rpcsvcdbm
13564         eval $setvar
13565         ;;
13566 esac
13567
13568 : see if this is a sys/file.h system
13569 val=''
13570 set sys/file.h val
13571 eval $inhdr
13572
13573 : do we need to include sys/file.h ?
13574 case "$val" in
13575 "$define")
13576         echo " "
13577         if $h_sysfile; then
13578                 val="$define"
13579                 echo "We'll be including <sys/file.h>." >&4
13580         else
13581                 val="$undef"
13582                 echo "We won't be including <sys/file.h>." >&4
13583         fi
13584         ;;
13585 *)
13586         h_sysfile=false
13587         ;;
13588 esac
13589 set i_sysfile
13590 eval $setvar
13591
13592 : see if fcntl.h is there
13593 val=''
13594 set fcntl.h val
13595 eval $inhdr
13596
13597 : see if we can include fcntl.h
13598 case "$val" in
13599 "$define")
13600         echo " "
13601         if $h_fcntl; then
13602                 val="$define"
13603                 echo "We'll be including <fcntl.h>." >&4
13604         else
13605                 val="$undef"
13606                 if $h_sysfile; then
13607         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13608                 else
13609                         echo "We won't be including <fcntl.h>." >&4
13610                 fi
13611         fi
13612         ;;
13613 *)
13614         h_fcntl=false
13615         val="$undef"
13616         ;;
13617 esac
13618 set i_fcntl
13619 eval $setvar
13620
13621 : see if locale.h is available
13622 set locale.h i_locale
13623 eval $inhdr
13624
13625 : see if mach cthreads are available
13626 if test "X$usethreads" = "X$define"; then
13627         set mach/cthreads.h i_machcthr
13628         eval $inhdr
13629 else
13630         i_machcthr="$undef"
13631 fi
13632
13633
13634
13635 : see if this is a math.h system
13636 set math.h i_math
13637 eval $inhdr
13638
13639 : see if this is a mntent.h system
13640 set mntent.h i_mntent
13641 eval $inhdr
13642
13643 : see if ndbm.h is available
13644 set ndbm.h t_ndbm
13645 eval $inhdr
13646 case "$t_ndbm" in
13647 $define)
13648         : see if dbm_open exists
13649         set dbm_open d_dbm_open
13650         eval $inlibc
13651         case "$d_dbm_open" in
13652         $undef)
13653                 t_ndbm="$undef"
13654                 echo "We won't be including <ndbm.h>"
13655                 ;;
13656         esac
13657         ;;
13658 esac
13659 val="$t_ndbm"
13660 set i_ndbm
13661 eval $setvar
13662
13663 : see if net/errno.h is available
13664 val=''
13665 set net/errno.h val
13666 eval $inhdr
13667
13668 : Unfortunately, it causes problems on some systems.  Arrgh.
13669 case "$val" in
13670 $define)
13671         cat > try.c <<'EOM'
13672 #include <stdio.h>
13673 #include <errno.h>
13674 #include <net/errno.h>
13675 int func()
13676 {
13677         return ENOTSOCK;
13678 }
13679 EOM
13680         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13681                 echo "We'll be including <net/errno.h>." >&4
13682         else
13683                 echo "We won't be including <net/errno.h>." >&4
13684                 val="$undef"
13685         fi
13686         $rm -f try.* try
13687         ;;
13688 esac
13689 set i_neterrno
13690 eval $setvar
13691
13692 : see if netinet/tcp.h is available
13693 set netinet/tcp.h i_netinettcp
13694 eval $inhdr
13695
13696 : see if this is a poll.h system
13697 set poll.h i_poll
13698 eval $inhdr
13699
13700 : get C preprocessor symbols handy
13701 echo " "
13702 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13703 echo $al $osname | $tr ' ' $trnl >Cppsym.know
13704 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13705 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13706 cat Cppsym.a Cppsym.b >> Cppsym.know
13707 $sed 's/^/_/'           < Cppsym.know > Cppsym.a
13708 $sed 's/^/__/'          < Cppsym.know > Cppsym.b
13709 $sed 's/\(.*\)/__\1__/' < Cppsym.know > Cppsym.c
13710 $cat Cppsym.know Cppsym.a Cppsym.b Cppsym.c | sort | uniq > Cppsym.d
13711 mv Cppsym.d Cppsym.know
13712 rm Cppsym.?
13713 $cat <<EOSS >Cppsym
13714 $startsh
13715 case "\$1" in
13716 -l) list=true
13717         shift
13718         ;;
13719 esac
13720 unknown=''
13721 case "\$list\$#" in
13722 1|2)
13723         for sym do
13724                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13725                         exit 0
13726                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13727                         :
13728                 else
13729                         unknown="\$unknown \$sym"
13730                 fi
13731         done
13732         set X \$unknown
13733         shift
13734         ;;
13735 esac
13736 case \$# in
13737 0) exit 1;;
13738 esac
13739 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13740 #ifdef \1\\
13741 exit 0; _ _ _ _\1\\      \1\\
13742 #endif\\
13743 /' >Cppsym\$\$
13744 echo "exit 1; _ _ _" >>Cppsym\$\$
13745 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13746 case "\$list" in
13747 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13748 *)
13749         sh Cppsym2\$\$
13750         status=\$?
13751         ;;
13752 esac
13753 $rm -f Cppsym\$\$ Cppsym2\$\$
13754 exit \$status
13755 EOSS
13756 chmod +x Cppsym
13757 $eunicefix Cppsym
13758 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13759
13760 : now check the C compiler for additional symbols
13761 postprocess_cc_v=''
13762 case "$osname" in
13763 aix) postprocess_cc_v="|$tr , ' '" ;;
13764 esac
13765 $cat >ccsym <<EOS
13766 $startsh
13767 $cat >tmp.c <<EOF
13768 extern int foo;
13769 EOF
13770 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13771 do
13772         case "\$i" in
13773         -D*) echo "\$i" | $sed 's/^-D//';;
13774         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13775         esac
13776 done
13777 $rm -f try.c
13778 EOS
13779 postprocess_cc_v=''
13780 chmod +x ccsym
13781 $eunicefix ccsym
13782 ./ccsym > ccsym1.raw
13783 if $test -s ccsym1.raw; then
13784        $sort ccsym1.raw | $uniq >ccsym.raw
13785 else
13786        mv ccsym1.raw ccsym.raw
13787 fi
13788
13789 $awk '/\=/ { print $0; next }
13790         { print $0"=1" }' ccsym.raw >ccsym.list
13791 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13792 $comm -13 ccsym.true ccsym.list >ccsym.own
13793 $comm -12 ccsym.true ccsym.list >ccsym.com
13794 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13795 also=''
13796 if $test -z ccsym.raw; then
13797         echo "Your C compiler doesn't seem to define any symbols!" >&4
13798         echo " "
13799         echo "However, your C preprocessor defines the following symbols:"
13800         $cat Cppsym.true
13801         ccsymbols=''
13802         cppsymbols=`$cat Cppsym.true`
13803         cppsymbols=`echo $cppsymbols`
13804         cppccsymbols="$cppsymbols"
13805 else
13806         if $test -s ccsym.com; then
13807                 echo "Your C compiler and pre-processor define these symbols:"
13808                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13809                 also='also '
13810                 symbols='ones'
13811                 cppccsymbols=`$cat ccsym.com`
13812                 cppccsymbols=`echo $cppccsymbols`
13813                 $test "$silent" || sleep 1
13814         fi
13815         if $test -s ccsym.cpp; then
13816                 $test "$also" && echo " "
13817                 echo "Your C pre-processor ${also}defines the following symbols:"
13818                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13819                 also='further '
13820                 cppsymbols=`$cat ccsym.cpp`
13821                 cppsymbols=`echo $cppsymbols`
13822                 $test "$silent" || sleep 1
13823         fi
13824         if $test -s ccsym.own; then
13825                 $test "$also" && echo " "
13826                 echo "Your C compiler ${also}defines the following cpp symbols:"
13827                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13828                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13829                 ccsymbols=`$cat ccsym.own`
13830                 ccsymbols=`echo $ccsymbols`
13831                 $test "$silent" || sleep 1
13832         fi
13833 fi
13834 $rm -f ccsym*
13835
13836 : see if this is a termio system
13837 val="$undef"
13838 val2="$undef"
13839 val3="$undef"
13840 if $test `./findhdr termios.h`; then
13841         set tcsetattr i_termios
13842         eval $inlibc
13843         val3="$i_termios"
13844 fi
13845 echo " "
13846 case "$val3" in
13847 "$define") echo "You have POSIX termios.h... good!" >&4;;
13848 *) if ./Cppsym pyr; then
13849                 case "`/bin/universe`" in
13850                 ucb) if $test `./findhdr sgtty.h`; then
13851                                 val2="$define"
13852                                 echo "<sgtty.h> found." >&4
13853                         else
13854                                 echo "System is pyramid with BSD universe."
13855                                 echo "<sgtty.h> not found--you could have problems." >&4
13856                         fi;;
13857                 *) if $test `./findhdr termio.h`; then
13858                                 val="$define"
13859                                 echo "<termio.h> found." >&4
13860                         else
13861                                 echo "System is pyramid with USG universe."
13862                                 echo "<termio.h> not found--you could have problems." >&4
13863                         fi;;
13864                 esac
13865         elif ./usg; then
13866                 if $test `./findhdr termio.h`; then
13867                         echo "<termio.h> found." >&4
13868                         val="$define"
13869                 elif $test `./findhdr sgtty.h`; then
13870                         echo "<sgtty.h> found." >&4
13871                         val2="$define"
13872                 else
13873 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13874                 fi
13875         else
13876                 if $test `./findhdr sgtty.h`; then
13877                         echo "<sgtty.h> found." >&4
13878                         val2="$define"
13879                 elif $test `./findhdr termio.h`; then
13880                         echo "<termio.h> found." >&4
13881                         val="$define"
13882                 else
13883 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13884                 fi
13885         fi;;
13886 esac
13887 set i_termio; eval $setvar
13888 val=$val2; set i_sgtty; eval $setvar
13889 val=$val3; set i_termios; eval $setvar
13890
13891 : see if this is a shadow.h system
13892 set shadow.h i_shadow
13893 eval $inhdr
13894
13895 : see if this is a socks.h system
13896 set socks.h i_socks
13897 eval $inhdr
13898
13899 : see if stdarg is available
13900 echo " "
13901 if $test `./findhdr stdarg.h`; then
13902         echo "<stdarg.h> found." >&4
13903         valstd="$define"
13904 else
13905         echo "<stdarg.h> NOT found." >&4
13906         valstd="$undef"
13907 fi
13908
13909 : see if varags is available
13910 echo " "
13911 if $test `./findhdr varargs.h`; then
13912         echo "<varargs.h> found." >&4
13913 else
13914         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13915 fi
13916
13917 : set up the varargs testing programs
13918 $cat > varargs.c <<EOP
13919 #ifdef I_STDARG
13920 #include <stdarg.h>
13921 #endif
13922 #ifdef I_VARARGS
13923 #include <varargs.h>
13924 #endif
13925
13926 #ifdef I_STDARG
13927 int f(char *p, ...)
13928 #else
13929 int f(va_alist)
13930 va_dcl
13931 #endif
13932 {
13933         va_list ap;
13934 #ifndef I_STDARG
13935         char *p;
13936 #endif
13937 #ifdef I_STDARG
13938         va_start(ap,p);
13939 #else
13940         va_start(ap);
13941         p = va_arg(ap, char *);
13942 #endif
13943         va_end(ap);
13944 }
13945 EOP
13946 $cat > varargs <<EOP
13947 $startsh
13948 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13949         echo "true"
13950 else
13951         echo "false"
13952 fi
13953 $rm -f varargs$_o
13954 EOP
13955 chmod +x varargs
13956
13957 : now check which varargs header should be included
13958 echo " "
13959 i_varhdr=''
13960 case "$valstd" in
13961 "$define")
13962         if `./varargs I_STDARG`; then
13963                 val='stdarg.h'
13964         elif `./varargs I_VARARGS`; then
13965                 val='varargs.h'
13966         fi
13967         ;;
13968 *)
13969         if `./varargs I_VARARGS`; then
13970                 val='varargs.h'
13971         fi
13972         ;;
13973 esac
13974 case "$val" in
13975 '')
13976 echo "I could not find the definition for va_dcl... You have problems..." >&4
13977         val="$undef"; set i_stdarg; eval $setvar
13978         val="$undef"; set i_varargs; eval $setvar
13979         ;;
13980 *) 
13981         set i_varhdr
13982         eval $setvar
13983         case "$i_varhdr" in
13984         stdarg.h)
13985                 val="$define"; set i_stdarg; eval $setvar
13986                 val="$undef"; set i_varargs; eval $setvar
13987                 ;;
13988         varargs.h)
13989                 val="$undef"; set i_stdarg; eval $setvar
13990                 val="$define"; set i_varargs; eval $setvar
13991                 ;;
13992         esac
13993         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13994 esac
13995 $rm -f varargs*
13996
13997 : see if stddef is available
13998 set stddef.h i_stddef
13999 eval $inhdr
14000
14001 : see if sys/access.h is available
14002 set sys/access.h i_sysaccess
14003 eval $inhdr
14004
14005 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14006 set sys/filio.h i_sysfilio
14007 eval $inhdr
14008 echo " "
14009 if $test `./findhdr sys/ioctl.h`; then
14010         val="$define"
14011         echo '<sys/ioctl.h> found.' >&4
14012 else
14013         val="$undef"
14014         if $test $i_sysfilio = "$define"; then
14015             echo '<sys/ioctl.h> NOT found.' >&4
14016         else
14017                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14018                 $test $i_termio = "$define" && xxx="termio.h"
14019                 $test $i_termios = "$define" && xxx="termios.h"
14020 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14021         fi
14022 fi
14023 set i_sysioctl
14024 eval $setvar
14025
14026 : see if sys/resource.h has to be included
14027 set sys/resource.h i_sysresrc
14028 eval $inhdr
14029
14030 : see if sys/security.h is available
14031 set sys/security.h i_syssecrt
14032 eval $inhdr
14033
14034 : see if this is a sys/statvfs.h system
14035 set sys/statvfs.h i_sysstatvfs
14036 eval $inhdr
14037
14038 : see if this is a sys/uio.h system
14039 set sys/uio.h i_sysuio
14040 eval $inhdr
14041
14042 : see if this is a sys/un.h system
14043 set sys/un.h i_sysun
14044 eval $inhdr
14045
14046 : see if this is a syswait system
14047 set sys/wait.h i_syswait
14048 eval $inhdr
14049
14050 : see if this is a ustat.h system
14051 set ustat.h i_ustat
14052 eval $inhdr
14053
14054 : see if this is an utime system
14055 set utime.h i_utime
14056 eval $inhdr
14057
14058 : see if this is a values.h system
14059 set values.h i_values
14060 eval $inhdr
14061
14062 : see if this is a vfork system
14063 case "$d_vfork" in
14064 "$define")
14065         set vfork.h i_vfork
14066         eval $inhdr
14067         ;;
14068 *)
14069         i_vfork="$undef"
14070         ;;
14071 esac
14072
14073 : see if gdbm.h is available
14074 set gdbm.h t_gdbm
14075 eval $inhdr
14076 case "$t_gdbm" in
14077 $define)
14078         : see if gdbm_open exists
14079         set gdbm_open d_gdbm_open
14080         eval $inlibc
14081         case "$d_gdbm_open" in
14082         $undef)
14083                 t_gdbm="$undef"
14084                 echo "We won't be including <gdbm.h>"
14085                 ;;
14086         esac
14087         ;;
14088 esac
14089 val="$t_gdbm"
14090 set i_gdbm
14091 eval $setvar
14092
14093 echo " "
14094 echo "Looking for extensions..." >&4
14095 : If we are using the old config.sh, known_extensions may contain
14096 : old or inaccurate or duplicate values.
14097 known_extensions=''
14098 nonxs_extensions=''
14099 : We do not use find because it might not be available.
14100 : We do not just use MANIFEST because the user may have dropped
14101 : some additional extensions into the source tree and expect them
14102 : to be built.
14103
14104 : Function to recursively find available extensions, ignoring DynaLoader
14105 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14106 find_extensions='
14107     for xxx in *; do
14108        case "$xxx" in
14109            DynaLoader|dynaload) ;;
14110            *)
14111            if $test -f $xxx/$xxx.xs; then
14112                known_extensions="$known_extensions $1$xxx";
14113            elif $test -f $xxx/Makefile.PL; then
14114                nonxs_extensions="$nonxs_extensions $1$xxx";
14115            else
14116                if $test -d $xxx -a $# -lt 10; then
14117                    set $1$xxx/ $*;
14118                    cd $xxx;
14119                    eval $find_extensions;
14120                    cd ..;
14121                    shift;
14122                fi;
14123            fi
14124            ;;
14125        esac;
14126     done'
14127 tdir=`pwd`
14128 cd $rsrc/ext
14129 set X
14130 shift
14131 eval $find_extensions
14132 set X $nonxs_extensions
14133 shift
14134 nonxs_extensions="$*"
14135 set X $known_extensions
14136 shift
14137 known_extensions="$*"
14138 cd $tdir
14139
14140 : Now see which are supported on this system.
14141 avail_ext=''
14142 for xxx in $known_extensions ; do
14143         case "$xxx" in
14144         DB_File|db_file)
14145                 case "$i_db" in
14146                 $define) avail_ext="$avail_ext $xxx" ;;
14147                 esac
14148                 ;;
14149         GDBM_File|gdbm_fil)
14150                 case "$i_gdbm" in 
14151                 $define) avail_ext="$avail_ext $xxx" ;;
14152                 esac
14153                 ;;
14154         NDBM_File|ndbm_fil)
14155                 case "$i_ndbm" in
14156                 $define) avail_ext="$avail_ext $xxx" ;;
14157                 esac
14158                 ;;
14159         ODBM_File|odbm_fil) 
14160                 case "${i_dbm}${i_rpcsvcdbm}" in
14161                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14162                 esac
14163                 ;;
14164         POSIX|posix)
14165                 case "$useposix" in
14166                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14167                 esac
14168                 ;;
14169         Opcode|opcode)
14170                 case "$useopcode" in
14171                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14172                 esac
14173                 ;;
14174         Socket|socket)
14175                 case "$d_socket" in 
14176                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14177                 esac
14178                 ;;
14179         Thread|thread)
14180                 case "$usethreads" in 
14181                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14182                 esac
14183                 ;;
14184         IPC/SysV|ipc/sysv)
14185                 : XXX Do we need a useipcsysv variable here
14186                 case "${d_msg}${d_sem}${d_shm}" in 
14187                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14188                 esac
14189                 ;;
14190         *)      avail_ext="$avail_ext $xxx"
14191                 ;;
14192         esac
14193 done
14194
14195 set X $avail_ext
14196 shift
14197 avail_ext="$*"
14198
14199 : Now see which nonxs extensions are supported on this system.
14200 : For now assume all are.
14201 nonxs_ext=''
14202 for xxx in $nonxs_extensions ; do
14203         case "$xxx" in
14204         *)      nonxs_ext="$nonxs_ext $xxx"
14205                 ;;
14206         esac
14207 done
14208
14209 set X $nonxs_ext
14210 shift
14211 nonxs_ext="$*"
14212
14213 case $usedl in
14214 $define)
14215         $cat <<EOM
14216 A number of extensions are supplied with $package.  You may choose to
14217 compile these extensions for dynamic loading (the default), compile
14218 them into the $package executable (static loading), or not include
14219 them at all.  Answer "none" to include no extensions.
14220 Note that DynaLoader is always built and need not be mentioned here.
14221
14222 EOM
14223         case "$dynamic_ext" in
14224         '') dflt="$avail_ext" ;;
14225         *)      dflt="$dynamic_ext"
14226                 # Perhaps we are reusing an old out-of-date config.sh.
14227                 case "$hint" in
14228                 previous)
14229                         if test X"$dynamic_ext" != X"$avail_ext"; then
14230                                 $cat <<EOM
14231 NOTICE:  Your previous config.sh list may be incorrect. 
14232 The extensions now available to you are 
14233         ${avail_ext}
14234 but the default list from your previous config.sh is
14235         ${dynamic_ext} 
14236
14237 EOM
14238                         fi
14239                         ;;
14240                 esac
14241                 ;;
14242         esac
14243         case "$dflt" in
14244         '')     dflt=none;;
14245         esac
14246         rp="What extensions do you wish to load dynamically?"
14247         . ./myread
14248         case "$ans" in
14249         none) dynamic_ext=' ' ;;
14250         *) dynamic_ext="$ans" ;;
14251         esac
14252
14253         case "$static_ext" in
14254         '')
14255                 : Exclude those already listed in dynamic linking
14256                 dflt=''
14257                 for xxx in $avail_ext; do
14258                         case " $dynamic_ext " in
14259                         *" $xxx "*) ;;
14260                         *) dflt="$dflt $xxx" ;;
14261                         esac
14262                 done
14263                 set X $dflt
14264                 shift
14265                 dflt="$*"
14266                 ;;
14267         *)  dflt="$static_ext" 
14268                 ;;
14269         esac
14270
14271         case "$dflt" in
14272         '')     dflt=none;;
14273         esac
14274         rp="What extensions do you wish to load statically?"
14275         . ./myread
14276         case "$ans" in
14277         none) static_ext=' ' ;;
14278         *) static_ext="$ans" ;;
14279         esac
14280         ;;
14281 *)
14282         $cat <<EOM
14283 A number of extensions are supplied with $package.  Answer "none" 
14284 to include no extensions. 
14285 Note that DynaLoader is always built and need not be mentioned here.
14286
14287 EOM
14288         case "$static_ext" in
14289         '') dflt="$avail_ext" ;;
14290         *)      dflt="$static_ext"
14291                 # Perhaps we are reusing an old out-of-date config.sh.
14292                 case "$hint" in
14293                 previous)
14294                         if test X"$static_ext" != X"$avail_ext"; then
14295                                 $cat <<EOM
14296 NOTICE:  Your previous config.sh list may be incorrect. 
14297 The extensions now available to you are 
14298         ${avail_ext}
14299 but the default list from your previous config.sh is
14300         ${static_ext} 
14301
14302 EOM
14303                         fi
14304                         ;;
14305                 esac
14306                 ;;
14307         esac
14308         : Exclude those that are not xs extensions
14309         case "$dflt" in
14310         '')     dflt=none;;
14311         esac
14312         rp="What extensions do you wish to include?"
14313         . ./myread
14314         case "$ans" in
14315         none) static_ext=' ' ;;
14316         *) static_ext="$ans" ;;
14317         esac
14318         ;;
14319 esac
14320
14321 set X $dynamic_ext $static_ext $nonxs_ext
14322 shift
14323 extensions="$*"
14324
14325 : Remove build directory name from cppstdin so it can be used from
14326 : either the present location or the final installed location.
14327 echo " "
14328 : Get out of the UU directory to get correct path name.
14329 cd ..
14330 case "$cppstdin" in
14331 `pwd`/cppstdin)
14332         echo "Stripping down cppstdin path name"
14333         cppstdin=cppstdin
14334         ;;
14335 esac
14336 cd UU
14337
14338 : end of configuration questions
14339 echo " "
14340 echo "End of configuration questions."
14341 echo " "
14342
14343 : back to where it started
14344 if test -d ../UU; then
14345         cd ..
14346 fi
14347
14348 : configuration may be patched via a 'config.over' file
14349 if $test -f config.over; then
14350         echo " "
14351         dflt=y
14352         rp='I see a config.over file.  Do you wish to load it?'
14353         . UU/myread
14354         case "$ans" in
14355         n*) echo "OK, I'll ignore it.";;
14356         *)      . ./config.over
14357                 echo "Configuration override changes have been loaded."
14358                 ;;
14359         esac
14360 fi
14361
14362 : in case they want portability, strip down executable paths
14363 case "$d_portable" in
14364 "$define")
14365         echo " "
14366         echo "Stripping down executable paths..." >&4
14367         for file in $loclist $trylist; do
14368                 eval temp=\$$file
14369                 eval $file=`basename $temp`
14370         done
14371         ;;
14372 esac
14373
14374 : create config.sh file
14375 echo " "
14376 echo "Creating config.sh..." >&4
14377 $spitshell <<EOT >config.sh
14378 $startsh
14379 #
14380 # This file was produced by running the Configure script. It holds all the
14381 # definitions figured out by Configure. Should you modify one of these values,
14382 # do not forget to propagate your changes by running "Configure -der". You may
14383 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14384 #
14385
14386 # Package name      : $package
14387 # Source directory  : $src
14388 # Configuration time: $cf_time
14389 # Configured by     : $cf_by
14390 # Target system     : $myuname
14391
14392 Author='$Author'
14393 Date='$Date'
14394 Header='$Header'
14395 Id='$Id'
14396 Locker='$Locker'
14397 Log='$Log'
14398 Mcc='$Mcc'
14399 RCSfile='$RCSfile'
14400 Revision='$Revision'
14401 Source='$Source'
14402 State='$State'
14403 _a='$_a'
14404 _exe='$_exe'
14405 _o='$_o'
14406 afs='$afs'
14407 alignbytes='$alignbytes'
14408 ansi2knr='$ansi2knr'
14409 aphostname='$aphostname'
14410 api_revision='$api_revision'
14411 api_subversion='$api_subversion'
14412 api_version='$api_version'
14413 api_versionstring='$api_versionstring'
14414 ar='$ar'
14415 archlib='$archlib'
14416 archlibexp='$archlibexp'
14417 archname64='$archname64'
14418 archname='$archname'
14419 archobjs='$archobjs'
14420 awk='$awk'
14421 baserev='$baserev'
14422 bash='$bash'
14423 bin='$bin'
14424 bincompat5005='$bincompat5005'
14425 binexp='$binexp'
14426 bison='$bison'
14427 byacc='$byacc'
14428 byteorder='$byteorder'
14429 c='$c'
14430 castflags='$castflags'
14431 cat='$cat'
14432 cc='$cc'
14433 cccdlflags='$cccdlflags'
14434 ccdlflags='$ccdlflags'
14435 ccflags='$ccflags'
14436 ccsymbols='$ccsymbols'
14437 cf_by='$cf_by'
14438 cf_email='$cf_email'
14439 cf_time='$cf_time'
14440 charsize='$charsize'
14441 chgrp='$chgrp'
14442 chmod='$chmod'
14443 chown='$chown'
14444 clocktype='$clocktype'
14445 comm='$comm'
14446 compress='$compress'
14447 contains='$contains'
14448 cp='$cp'
14449 cpio='$cpio'
14450 cpp='$cpp'
14451 cpp_stuff='$cpp_stuff'
14452 cppccsymbols='$cppccsymbols'
14453 cppflags='$cppflags'
14454 cpplast='$cpplast'
14455 cppminus='$cppminus'
14456 cpprun='$cpprun'
14457 cppstdin='$cppstdin'
14458 cppsymbols='$cppsymbols'
14459 crosscompile='$crosscompile'
14460 cryptlib='$cryptlib'
14461 csh='$csh'
14462 d_Gconvert='$d_Gconvert'
14463 d_PRIEldbl='$d_PRIEldbl'
14464 d_PRIFldbl='$d_PRIFldbl'
14465 d_PRIGldbl='$d_PRIGldbl'
14466 d_PRIX64='$d_PRIX64'
14467 d_PRId64='$d_PRId64'
14468 d_PRIeldbl='$d_PRIeldbl'
14469 d_PRIfldbl='$d_PRIfldbl'
14470 d_PRIgldbl='$d_PRIgldbl'
14471 d_PRIi64='$d_PRIi64'
14472 d_PRIo64='$d_PRIo64'
14473 d_PRIu64='$d_PRIu64'
14474 d_PRIx64='$d_PRIx64'
14475 d_access='$d_access'
14476 d_accessx='$d_accessx'
14477 d_alarm='$d_alarm'
14478 d_archlib='$d_archlib'
14479 d_atolf='$d_atolf'
14480 d_atoll='$d_atoll'
14481 d_attribut='$d_attribut'
14482 d_bcmp='$d_bcmp'
14483 d_bcopy='$d_bcopy'
14484 d_bincompat5005='$d_bincompat5005'
14485 d_bsd='$d_bsd'
14486 d_bsdgetpgrp='$d_bsdgetpgrp'
14487 d_bsdsetpgrp='$d_bsdsetpgrp'
14488 d_bzero='$d_bzero'
14489 d_casti32='$d_casti32'
14490 d_castneg='$d_castneg'
14491 d_charvspr='$d_charvspr'
14492 d_chown='$d_chown'
14493 d_chroot='$d_chroot'
14494 d_chsize='$d_chsize'
14495 d_closedir='$d_closedir'
14496 d_const='$d_const'
14497 d_crypt='$d_crypt'
14498 d_csh='$d_csh'
14499 d_cuserid='$d_cuserid'
14500 d_dbl_dig='$d_dbl_dig'
14501 d_difftime='$d_difftime'
14502 d_dirnamlen='$d_dirnamlen'
14503 d_dlerror='$d_dlerror'
14504 d_dlopen='$d_dlopen'
14505 d_dlsymun='$d_dlsymun'
14506 d_dosuid='$d_dosuid'
14507 d_drand48proto='$d_drand48proto'
14508 d_dup2='$d_dup2'
14509 d_eaccess='$d_eaccess'
14510 d_endgrent='$d_endgrent'
14511 d_endhent='$d_endhent'
14512 d_endnent='$d_endnent'
14513 d_endpent='$d_endpent'
14514 d_endpwent='$d_endpwent'
14515 d_endsent='$d_endsent'
14516 d_endspent='$d_endspent'
14517 d_eofnblk='$d_eofnblk'
14518 d_eunice='$d_eunice'
14519 d_fchmod='$d_fchmod'
14520 d_fchown='$d_fchown'
14521 d_fcntl='$d_fcntl'
14522 d_fd_macros='$d_fd_macros'
14523 d_fd_set='$d_fd_set'
14524 d_fds_bits='$d_fds_bits'
14525 d_fgetpos='$d_fgetpos'
14526 d_flexfnam='$d_flexfnam'
14527 d_flock='$d_flock'
14528 d_fork='$d_fork'
14529 d_fpathconf='$d_fpathconf'
14530 d_fpos64_t='$d_fpos64_t'
14531 d_fs_data_s='$d_fs_data_s'
14532 d_fseeko='$d_fseeko'
14533 d_fsetpos='$d_fsetpos'
14534 d_fstatfs='$d_fstatfs'
14535 d_fstatvfs='$d_fstatvfs'
14536 d_ftello='$d_ftello'
14537 d_ftime='$d_ftime'
14538 d_getgrent='$d_getgrent'
14539 d_getgrps='$d_getgrps'
14540 d_gethbyaddr='$d_gethbyaddr'
14541 d_gethbyname='$d_gethbyname'
14542 d_gethent='$d_gethent'
14543 d_gethname='$d_gethname'
14544 d_gethostprotos='$d_gethostprotos'
14545 d_getlogin='$d_getlogin'
14546 d_getmnt='$d_getmnt'
14547 d_getmntent='$d_getmntent'
14548 d_getnbyaddr='$d_getnbyaddr'
14549 d_getnbyname='$d_getnbyname'
14550 d_getnent='$d_getnent'
14551 d_getnetprotos='$d_getnetprotos'
14552 d_getpbyname='$d_getpbyname'
14553 d_getpbynumber='$d_getpbynumber'
14554 d_getpent='$d_getpent'
14555 d_getpgid='$d_getpgid'
14556 d_getpgrp2='$d_getpgrp2'
14557 d_getpgrp='$d_getpgrp'
14558 d_getppid='$d_getppid'
14559 d_getprior='$d_getprior'
14560 d_getprotoprotos='$d_getprotoprotos'
14561 d_getpwent='$d_getpwent'
14562 d_getsbyname='$d_getsbyname'
14563 d_getsbyport='$d_getsbyport'
14564 d_getsent='$d_getsent'
14565 d_getservprotos='$d_getservprotos'
14566 d_getspent='$d_getspent'
14567 d_getspnam='$d_getspnam'
14568 d_gettimeod='$d_gettimeod'
14569 d_gnulibc='$d_gnulibc'
14570 d_grpasswd='$d_grpasswd'
14571 d_hasmntopt='$d_hasmntopt'
14572 d_htonl='$d_htonl'
14573 d_index='$d_index'
14574 d_inetaton='$d_inetaton'
14575 d_int64t='$d_int64t'
14576 d_isascii='$d_isascii'
14577 d_killpg='$d_killpg'
14578 d_lchown='$d_lchown'
14579 d_ldbl_dig='$d_ldbl_dig'
14580 d_link='$d_link'
14581 d_locconv='$d_locconv'
14582 d_lockf='$d_lockf'
14583 d_longdbl='$d_longdbl'
14584 d_longlong='$d_longlong'
14585 d_lstat='$d_lstat'
14586 d_mblen='$d_mblen'
14587 d_mbstowcs='$d_mbstowcs'
14588 d_mbtowc='$d_mbtowc'
14589 d_memchr='$d_memchr'
14590 d_memcmp='$d_memcmp'
14591 d_memcpy='$d_memcpy'
14592 d_memmove='$d_memmove'
14593 d_memset='$d_memset'
14594 d_mkdir='$d_mkdir'
14595 d_mkfifo='$d_mkfifo'
14596 d_mktime='$d_mktime'
14597 d_msg='$d_msg'
14598 d_msg_ctrunc='$d_msg_ctrunc'
14599 d_msg_dontroute='$d_msg_dontroute'
14600 d_msg_oob='$d_msg_oob'
14601 d_msg_peek='$d_msg_peek'
14602 d_msg_proxy='$d_msg_proxy'
14603 d_msgctl='$d_msgctl'
14604 d_msgget='$d_msgget'
14605 d_msgrcv='$d_msgrcv'
14606 d_msgsnd='$d_msgsnd'
14607 d_mymalloc='$d_mymalloc'
14608 d_nice='$d_nice'
14609 d_nv_preserves_uv='$d_nv_preserves_uv'
14610 d_off64_t='$d_off64_t'
14611 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14612 d_oldpthreads='$d_oldpthreads'
14613 d_oldsock='$d_oldsock'
14614 d_open3='$d_open3'
14615 d_pathconf='$d_pathconf'
14616 d_pause='$d_pause'
14617 d_phostname='$d_phostname'
14618 d_pipe='$d_pipe'
14619 d_poll='$d_poll'
14620 d_portable='$d_portable'
14621 d_pthread_yield='$d_pthread_yield'
14622 d_pwage='$d_pwage'
14623 d_pwchange='$d_pwchange'
14624 d_pwclass='$d_pwclass'
14625 d_pwcomment='$d_pwcomment'
14626 d_pwexpire='$d_pwexpire'
14627 d_pwgecos='$d_pwgecos'
14628 d_pwpasswd='$d_pwpasswd'
14629 d_pwquota='$d_pwquota'
14630 d_quad='$d_quad'
14631 d_readdir='$d_readdir'
14632 d_readlink='$d_readlink'
14633 d_rename='$d_rename'
14634 d_rewinddir='$d_rewinddir'
14635 d_rmdir='$d_rmdir'
14636 d_safebcpy='$d_safebcpy'
14637 d_safemcpy='$d_safemcpy'
14638 d_sanemcmp='$d_sanemcmp'
14639 d_sched_yield='$d_sched_yield'
14640 d_scm_rights='$d_scm_rights'
14641 d_seekdir='$d_seekdir'
14642 d_select='$d_select'
14643 d_sem='$d_sem'
14644 d_semctl='$d_semctl'
14645 d_semctl_semid_ds='$d_semctl_semid_ds'
14646 d_semctl_semun='$d_semctl_semun'
14647 d_semget='$d_semget'
14648 d_semop='$d_semop'
14649 d_setegid='$d_setegid'
14650 d_seteuid='$d_seteuid'
14651 d_setgrent='$d_setgrent'
14652 d_setgrps='$d_setgrps'
14653 d_sethent='$d_sethent'
14654 d_setlinebuf='$d_setlinebuf'
14655 d_setlocale='$d_setlocale'
14656 d_setnent='$d_setnent'
14657 d_setpent='$d_setpent'
14658 d_setpgid='$d_setpgid'
14659 d_setpgrp2='$d_setpgrp2'
14660 d_setpgrp='$d_setpgrp'
14661 d_setprior='$d_setprior'
14662 d_setpwent='$d_setpwent'
14663 d_setregid='$d_setregid'
14664 d_setresgid='$d_setresgid'
14665 d_setresuid='$d_setresuid'
14666 d_setreuid='$d_setreuid'
14667 d_setrgid='$d_setrgid'
14668 d_setruid='$d_setruid'
14669 d_setsent='$d_setsent'
14670 d_setsid='$d_setsid'
14671 d_setspent='$d_setspent'
14672 d_setvbuf='$d_setvbuf'
14673 d_sfio='$d_sfio'
14674 d_shm='$d_shm'
14675 d_shmat='$d_shmat'
14676 d_shmatprototype='$d_shmatprototype'
14677 d_shmctl='$d_shmctl'
14678 d_shmdt='$d_shmdt'
14679 d_shmget='$d_shmget'
14680 d_sigaction='$d_sigaction'
14681 d_sigsetjmp='$d_sigsetjmp'
14682 d_socket='$d_socket'
14683 d_sockpair='$d_sockpair'
14684 d_sqrtl='$d_sqrtl'
14685 d_statblks='$d_statblks'
14686 d_statfs_f_flags='$d_statfs_f_flags'
14687 d_statfs_s='$d_statfs_s'
14688 d_statvfs='$d_statvfs'
14689 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14690 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14691 d_stdio_stream_array='$d_stdio_stream_array'
14692 d_stdiobase='$d_stdiobase'
14693 d_stdstdio='$d_stdstdio'
14694 d_strchr='$d_strchr'
14695 d_strcoll='$d_strcoll'
14696 d_strctcpy='$d_strctcpy'
14697 d_strerrm='$d_strerrm'
14698 d_strerror='$d_strerror'
14699 d_strtod='$d_strtod'
14700 d_strtol='$d_strtol'
14701 d_strtold='$d_strtold'
14702 d_strtoll='$d_strtoll'
14703 d_strtoul='$d_strtoul'
14704 d_strtoull='$d_strtoull'
14705 d_strtouq='$d_strtouq'
14706 d_strxfrm='$d_strxfrm'
14707 d_suidsafe='$d_suidsafe'
14708 d_symlink='$d_symlink'
14709 d_syscall='$d_syscall'
14710 d_sysconf='$d_sysconf'
14711 d_sysernlst='$d_sysernlst'
14712 d_syserrlst='$d_syserrlst'
14713 d_system='$d_system'
14714 d_tcgetpgrp='$d_tcgetpgrp'
14715 d_tcsetpgrp='$d_tcsetpgrp'
14716 d_telldir='$d_telldir'
14717 d_telldirproto='$d_telldirproto'
14718 d_time='$d_time'
14719 d_times='$d_times'
14720 d_truncate='$d_truncate'
14721 d_tzname='$d_tzname'
14722 d_umask='$d_umask'
14723 d_uname='$d_uname'
14724 d_union_semun='$d_union_semun'
14725 d_ustat='$d_ustat'
14726 d_vendorbin='$d_vendorbin'
14727 d_vendorlib='$d_vendorlib'
14728 d_vfork='$d_vfork'
14729 d_void_closedir='$d_void_closedir'
14730 d_voidsig='$d_voidsig'
14731 d_voidtty='$d_voidtty'
14732 d_volatile='$d_volatile'
14733 d_vprintf='$d_vprintf'
14734 d_wait4='$d_wait4'
14735 d_waitpid='$d_waitpid'
14736 d_wcstombs='$d_wcstombs'
14737 d_wctomb='$d_wctomb'
14738 d_xenix='$d_xenix'
14739 date='$date'
14740 db_hashtype='$db_hashtype'
14741 db_prefixtype='$db_prefixtype'
14742 defvoidused='$defvoidused'
14743 direntrytype='$direntrytype'
14744 dlext='$dlext'
14745 dlsrc='$dlsrc'
14746 doublesize='$doublesize'
14747 drand01='$drand01'
14748 dynamic_ext='$dynamic_ext'
14749 eagain='$eagain'
14750 ebcdic='$ebcdic'
14751 echo='$echo'
14752 egrep='$egrep'
14753 emacs='$emacs'
14754 eunicefix='$eunicefix'
14755 exe_ext='$exe_ext'
14756 expr='$expr'
14757 extensions='$extensions'
14758 fflushNULL='$fflushNULL'
14759 fflushall='$fflushall'
14760 find='$find'
14761 firstmakefile='$firstmakefile'
14762 flex='$flex'
14763 fpossize='$fpossize'
14764 fpostype='$fpostype'
14765 freetype='$freetype'
14766 full_ar='$full_ar'
14767 full_csh='$full_csh'
14768 full_sed='$full_sed'
14769 gccversion='$gccversion'
14770 gidformat='$gidformat'
14771 gidsign='$gidsign'
14772 gidsize='$gidsize'
14773 gidtype='$gidtype'
14774 glibpth='$glibpth'
14775 grep='$grep'
14776 groupcat='$groupcat'
14777 groupstype='$groupstype'
14778 gzip='$gzip'
14779 h_fcntl='$h_fcntl'
14780 h_sysfile='$h_sysfile'
14781 hint='$hint'
14782 hostcat='$hostcat'
14783 huge='$huge'
14784 i16size='$i16size'
14785 i16type='$i16type'
14786 i32size='$i32size'
14787 i32type='$i32type'
14788 i64size='$i64size'
14789 i64type='$i64type'
14790 i8size='$i8size'
14791 i8type='$i8type'
14792 i_arpainet='$i_arpainet'
14793 i_bsdioctl='$i_bsdioctl'
14794 i_db='$i_db'
14795 i_dbm='$i_dbm'
14796 i_dirent='$i_dirent'
14797 i_dld='$i_dld'
14798 i_dlfcn='$i_dlfcn'
14799 i_fcntl='$i_fcntl'
14800 i_float='$i_float'
14801 i_gdbm='$i_gdbm'
14802 i_grp='$i_grp'
14803 i_inttypes='$i_inttypes'
14804 i_limits='$i_limits'
14805 i_locale='$i_locale'
14806 i_machcthr='$i_machcthr'
14807 i_malloc='$i_malloc'
14808 i_math='$i_math'
14809 i_memory='$i_memory'
14810 i_mntent='$i_mntent'
14811 i_ndbm='$i_ndbm'
14812 i_netdb='$i_netdb'
14813 i_neterrno='$i_neterrno'
14814 i_netinettcp='$i_netinettcp'
14815 i_niin='$i_niin'
14816 i_poll='$i_poll'
14817 i_pthread='$i_pthread'
14818 i_pwd='$i_pwd'
14819 i_rpcsvcdbm='$i_rpcsvcdbm'
14820 i_sfio='$i_sfio'
14821 i_sgtty='$i_sgtty'
14822 i_shadow='$i_shadow'
14823 i_socks='$i_socks'
14824 i_stdarg='$i_stdarg'
14825 i_stddef='$i_stddef'
14826 i_stdlib='$i_stdlib'
14827 i_string='$i_string'
14828 i_sysaccess='$i_sysaccess'
14829 i_sysdir='$i_sysdir'
14830 i_sysfile='$i_sysfile'
14831 i_sysfilio='$i_sysfilio'
14832 i_sysin='$i_sysin'
14833 i_sysioctl='$i_sysioctl'
14834 i_sysmount='$i_sysmount'
14835 i_sysndir='$i_sysndir'
14836 i_sysparam='$i_sysparam'
14837 i_sysresrc='$i_sysresrc'
14838 i_syssecrt='$i_syssecrt'
14839 i_sysselct='$i_sysselct'
14840 i_syssockio='$i_syssockio'
14841 i_sysstat='$i_sysstat'
14842 i_sysstatfs='$i_sysstatfs'
14843 i_sysstatvfs='$i_sysstatvfs'
14844 i_systime='$i_systime'
14845 i_systimek='$i_systimek'
14846 i_systimes='$i_systimes'
14847 i_systypes='$i_systypes'
14848 i_sysuio='$i_sysuio'
14849 i_sysun='$i_sysun'
14850 i_sysvfs='$i_sysvfs'
14851 i_syswait='$i_syswait'
14852 i_termio='$i_termio'
14853 i_termios='$i_termios'
14854 i_time='$i_time'
14855 i_unistd='$i_unistd'
14856 i_ustat='$i_ustat'
14857 i_utime='$i_utime'
14858 i_values='$i_values'
14859 i_varargs='$i_varargs'
14860 i_varhdr='$i_varhdr'
14861 i_vfork='$i_vfork'
14862 ignore_versioned_solibs='$ignore_versioned_solibs'
14863 inc_version_list='$inc_version_list'
14864 inc_version_list_init='$inc_version_list_init'
14865 incpath='$incpath'
14866 inews='$inews'
14867 installarchlib='$installarchlib'
14868 installbin='$installbin'
14869 installman1dir='$installman1dir'
14870 installman3dir='$installman3dir'
14871 installprefix='$installprefix'
14872 installprefixexp='$installprefixexp'
14873 installprivlib='$installprivlib'
14874 installscript='$installscript'
14875 installsitearch='$installsitearch'
14876 installsitebin='$installsitebin'
14877 installsitelib='$installsitelib'
14878 installstyle='$installstyle'
14879 installusrbinperl='$installusrbinperl'
14880 installvendorbin='$installvendorbin'
14881 installvendorlib='$installvendorlib'
14882 intsize='$intsize'
14883 ivdformat='$ivdformat'
14884 ivsize='$ivsize'
14885 ivtype='$ivtype'
14886 known_extensions='$known_extensions'
14887 ksh='$ksh'
14888 large='$large'
14889 ld='$ld'
14890 lddlflags='$lddlflags'
14891 ldflags='$ldflags'
14892 ldlibpthname='$ldlibpthname'
14893 less='$less'
14894 lib_ext='$lib_ext'
14895 libc='$libc'
14896 libperl='$libperl'
14897 libpth='$libpth'
14898 libs='$libs'
14899 libswanted='$libswanted'
14900 line='$line'
14901 lint='$lint'
14902 lkflags='$lkflags'
14903 ln='$ln'
14904 lns='$lns'
14905 locincpth='$locincpth'
14906 loclibpth='$loclibpth'
14907 longdblsize='$longdblsize'
14908 longlongsize='$longlongsize'
14909 longsize='$longsize'
14910 lp='$lp'
14911 lpr='$lpr'
14912 ls='$ls'
14913 lseeksize='$lseeksize'
14914 lseektype='$lseektype'
14915 mail='$mail'
14916 mailx='$mailx'
14917 make='$make'
14918 make_set_make='$make_set_make'
14919 mallocobj='$mallocobj'
14920 mallocsrc='$mallocsrc'
14921 malloctype='$malloctype'
14922 man1dir='$man1dir'
14923 man1direxp='$man1direxp'
14924 man1ext='$man1ext'
14925 man3dir='$man3dir'
14926 man3direxp='$man3direxp'
14927 man3ext='$man3ext'
14928 medium='$medium'
14929 mips_type='$mips_type'
14930 mkdir='$mkdir'
14931 models='$models'
14932 modetype='$modetype'
14933 more='$more'
14934 multiarch='$multiarch'
14935 mv='$mv'
14936 myarchname='$myarchname'
14937 mydomain='$mydomain'
14938 myhostname='$myhostname'
14939 myuname='$myuname'
14940 n='$n'
14941 netdb_hlen_type='$netdb_hlen_type'
14942 netdb_host_type='$netdb_host_type'
14943 netdb_name_type='$netdb_name_type'
14944 netdb_net_type='$netdb_net_type'
14945 nm='$nm'
14946 nm_opt='$nm_opt'
14947 nm_so_opt='$nm_so_opt'
14948 nonxs_ext='$nonxs_ext'
14949 nroff='$nroff'
14950 nvsize='$nvsize'
14951 nvtype='$nvtype'
14952 o_nonblock='$o_nonblock'
14953 obj_ext='$obj_ext'
14954 old_pthread_create_joinable='$old_pthread_create_joinable'
14955 optimize='$optimize'
14956 orderlib='$orderlib'
14957 osname='$osname'
14958 osvers='$osvers'
14959 package='$package'
14960 pager='$pager'
14961 passcat='$passcat'
14962 patchlevel='$patchlevel'
14963 path_sep='$path_sep'
14964 perl='$perl'
14965 perladmin='$perladmin'
14966 perlpath='$perlpath'
14967 pg='$pg'
14968 phostname='$phostname'
14969 pidtype='$pidtype'
14970 plibpth='$plibpth'
14971 pmake='$pmake'
14972 pr='$pr'
14973 prefix='$prefix'
14974 prefixexp='$prefixexp'
14975 privlib='$privlib'
14976 privlibexp='$privlibexp'
14977 prototype='$prototype'
14978 ptrsize='$ptrsize'
14979 quadkind='$quadkind'
14980 quadtype='$quadtype'
14981 randbits='$randbits'
14982 randfunc='$randfunc'
14983 randseedtype='$randseedtype'
14984 ranlib='$ranlib'
14985 rd_nodata='$rd_nodata'
14986 rm='$rm'
14987 rmail='$rmail'
14988 runnm='$runnm'
14989 sPRIEldbl='$sPRIEldbl'
14990 sPRIFldbl='$sPRIFldbl'
14991 sPRIGldbl='$sPRIGldbl'
14992 sPRIX64='$sPRIX64'
14993 sPRId64='$sPRId64'
14994 sPRIeldbl='$sPRIeldbl'
14995 sPRIfldbl='$sPRIfldbl'
14996 sPRIgldbl='$sPRIgldbl'
14997 sPRIi64='$sPRIi64'
14998 sPRIo64='$sPRIo64'
14999 sPRIu64='$sPRIu64'
15000 sPRIx64='$sPRIx64'
15001 sched_yield='$sched_yield'
15002 scriptdir='$scriptdir'
15003 scriptdirexp='$scriptdirexp'
15004 sed='$sed'
15005 seedfunc='$seedfunc'
15006 selectminbits='$selectminbits'
15007 selecttype='$selecttype'
15008 sendmail='$sendmail'
15009 sh='$sh'
15010 shar='$shar'
15011 sharpbang='$sharpbang'
15012 shmattype='$shmattype'
15013 shortsize='$shortsize'
15014 shrpenv='$shrpenv'
15015 shsharp='$shsharp'
15016 sig_count='$sig_count'
15017 sig_name='$sig_name'
15018 sig_name_init='$sig_name_init'
15019 sig_num='$sig_num'
15020 sig_num_init='$sig_num_init'
15021 signal_t='$signal_t'
15022 sitearch='$sitearch'
15023 sitearchexp='$sitearchexp'
15024 sitebin='$sitebin'
15025 sitebinexp='$sitebinexp'
15026 sitelib='$sitelib'
15027 sitelibexp='$sitelibexp'
15028 siteprefix='$siteprefix'
15029 siteprefixexp='$siteprefixexp'
15030 sizetype='$sizetype'
15031 sleep='$sleep'
15032 smail='$smail'
15033 small='$small'
15034 so='$so'
15035 sockethdr='$sockethdr'
15036 socketlib='$socketlib'
15037 sort='$sort'
15038 spackage='$spackage'
15039 spitshell='$spitshell'
15040 split='$split'
15041 src='$src'
15042 ssizetype='$ssizetype'
15043 startperl='$startperl'
15044 startsh='$startsh'
15045 static_ext='$static_ext'
15046 stdchar='$stdchar'
15047 stdio_base='$stdio_base'
15048 stdio_bufsiz='$stdio_bufsiz'
15049 stdio_cnt='$stdio_cnt'
15050 stdio_filbuf='$stdio_filbuf'
15051 stdio_ptr='$stdio_ptr'
15052 stdio_stream_array='$stdio_stream_array'
15053 strings='$strings'
15054 submit='$submit'
15055 subversion='$subversion'
15056 sysman='$sysman'
15057 tail='$tail'
15058 tar='$tar'
15059 tbl='$tbl'
15060 tee='$tee'
15061 test='$test'
15062 timeincl='$timeincl'
15063 timetype='$timetype'
15064 touch='$touch'
15065 tr='$tr'
15066 trnl='$trnl'
15067 troff='$troff'
15068 u16size='$u16size'
15069 u16type='$u16type'
15070 u32size='$u32size'
15071 u32type='$u32type'
15072 u64size='$u64size'
15073 u64type='$u64type'
15074 u8size='$u8size'
15075 u8type='$u8type'
15076 uidformat='$uidformat'
15077 uidsign='$uidsign'
15078 uidsize='$uidsize'
15079 uidtype='$uidtype'
15080 uname='$uname'
15081 uniq='$uniq'
15082 uquadtype='$uquadtype'
15083 use5005threads='$use5005threads'
15084 use64bits='$use64bits'
15085 usedl='$usedl'
15086 useithreads='$useithreads'
15087 uselargefiles='$uselargefiles'
15088 uselongdouble='$uselongdouble'
15089 uselonglong='$uselonglong'
15090 usemorebits='$usemorebits'
15091 usemultiplicity='$usemultiplicity'
15092 usemymalloc='$usemymalloc'
15093 usenm='$usenm'
15094 useopcode='$useopcode'
15095 useperlio='$useperlio'
15096 useposix='$useposix'
15097 usesfio='$usesfio'
15098 useshrplib='$useshrplib'
15099 usesocks='$usesocks'
15100 usethreads='$usethreads'
15101 usevendorprefix='$usevendorprefix'
15102 usevfork='$usevfork'
15103 usrinc='$usrinc'
15104 uuname='$uuname'
15105 uvoformat='$uvoformat'
15106 uvsize='$uvsize'
15107 uvtype='$uvtype'
15108 uvuformat='$uvuformat'
15109 uvxformat='$uvxformat'
15110 vendorbin='$vendorbin'
15111 vendorbinexp='$vendorbinexp'
15112 vendorlib='$vendorlib'
15113 vendorlibexp='$vendorlibexp'
15114 vendorprefix='$vendorprefix'
15115 vendorprefixexp='$vendorprefixexp'
15116 version='$version'
15117 vi='$vi'
15118 voidflags='$voidflags'
15119 xlibpth='$xlibpth'
15120 zcat='$zcat'
15121 zip='$zip'
15122 EOT
15123
15124 : Add in command line options if available
15125 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15126
15127 : add special variables
15128 $test -f $src/patchlevel.h && \
15129 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15130 echo "CONFIGDOTSH=true" >>config.sh
15131
15132 : propagate old symbols
15133 if $test -f UU/config.sh; then
15134         <UU/config.sh sort | uniq >UU/oldconfig.sh
15135         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15136         sort | uniq -u >UU/oldsyms
15137         set X `cat UU/oldsyms`
15138         shift
15139         case $# in
15140         0) ;;
15141         *)
15142                 cat <<EOM
15143 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15144 EOM
15145                 echo "# Variables propagated from previous config.sh file." >>config.sh
15146                 for sym in `cat UU/oldsyms`; do
15147                         echo "    Propagating $hint variable "'$'"$sym..."
15148                         eval 'tmp="$'"${sym}"'"'
15149                         echo "$tmp" | \
15150                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15151                 done
15152                 ;;
15153         esac
15154 fi
15155
15156 : Finish up by extracting the .SH files
15157 case "$alldone" in
15158 exit)
15159         $rm -rf UU
15160         echo "Done."
15161         exit 0
15162         ;;
15163 cont)
15164         ;;
15165 '')
15166         dflt=''
15167         nostick=true
15168         $cat <<EOM
15169
15170 If you'd like to make any changes to the config.sh file before I begin
15171 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15172
15173 EOM
15174         rp="Press return or use a shell escape to edit config.sh:"
15175         . UU/myread
15176         nostick=''
15177         case "$ans" in
15178         '') ;;
15179         *) : in case they cannot read
15180                 sh 1>&4 -c "$ans";;
15181         esac
15182         ;;
15183 esac
15184
15185 : if this fails, just run all the .SH files by hand
15186 . ./config.sh
15187
15188 echo " "
15189 exec 1>&4
15190 . ./UU/extract
15191
15192 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15193         dflt=y
15194         case "$silent" in
15195         true) ;;
15196         *)
15197                 $cat <<EOM
15198
15199 Now you need to generate make dependencies by running "$make depend".
15200 You might prefer to run it in background: "$make depend > makedepend.out &"
15201 It can take a while, so you might not want to run it right now.
15202
15203 EOM
15204                 ;;
15205         esac
15206         rp="Run $make depend now?"
15207         . UU/myread
15208         case "$ans" in
15209         y*)
15210                 $make depend && echo "Now you must run a $make."
15211                 ;;
15212         *)
15213                 echo "You must run '$make depend' then '$make'."
15214                 ;;
15215         esac
15216 elif test -f [Mm]akefile; then
15217         echo " "
15218         echo "Now you must run a $make."
15219 else
15220         echo "Done."
15221 fi
15222
15223 if $test -f Policy.sh; then
15224     $cat <<EOM
15225
15226 If you compile $package on a different machine or from a different object
15227 directory, copy the Policy.sh file from this object directory to the
15228 new one before you run Configure -- this will help you with most of
15229 the policy defaults.
15230
15231 EOM
15232 fi
15233 if $test -f config.msg; then
15234     echo "Hmm.  I also noted the following information while running:"
15235     echo " "
15236     $cat config.msg >&4
15237     $rm -f config.msg
15238 fi
15239 $rm -f kit*isdone ark*isdone
15240 $rm -rf UU
15241
15242 : End of Configure
15243