4183e01bf603f55231302798cad229ee69f03a01
[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 Thu Feb 24 03:09:49 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getcwd=''
366 d_getgrent=''
367 d_getgrps=''
368 d_gethbyaddr=''
369 d_gethbyname=''
370 d_gethent=''
371 aphostname=''
372 d_gethname=''
373 d_phostname=''
374 d_uname=''
375 d_gethostprotos=''
376 d_getlogin=''
377 d_getmnt=''
378 d_getmntent=''
379 d_getnbyaddr=''
380 d_getnbyname=''
381 d_getnent=''
382 d_getnetprotos=''
383 d_getpent=''
384 d_getpgid=''
385 d_getpgrp2=''
386 d_bsdgetpgrp=''
387 d_getpgrp=''
388 d_getppid=''
389 d_getprior=''
390 d_getpbyname=''
391 d_getpbynumber=''
392 d_getprotoprotos=''
393 d_getpwent=''
394 d_getsent=''
395 d_getservprotos=''
396 d_getspent=''
397 d_getspnam=''
398 d_getsbyname=''
399 d_getsbyport=''
400 d_gnulibc=''
401 d_hasmntopt=''
402 d_htonl=''
403 d_iconv=''
404 d_inetaton=''
405 d_int64_t=''
406 d_isascii=''
407 d_killpg=''
408 d_lchown=''
409 d_ldbl_dig=''
410 d_link=''
411 d_locconv=''
412 d_lockf=''
413 d_longdbl=''
414 longdblsize=''
415 d_longlong=''
416 longlongsize=''
417 d_lstat=''
418 d_mblen=''
419 d_mbstowcs=''
420 d_mbtowc=''
421 d_memchr=''
422 d_memcmp=''
423 d_memcpy=''
424 d_memmove=''
425 d_memset=''
426 d_mkdir=''
427 d_mkdtemp=''
428 d_mkfifo=''
429 d_mkstemp=''
430 d_mkstemps=''
431 d_mktime=''
432 d_mmap=''
433 mmaptype=''
434 d_mprotect=''
435 d_msg=''
436 d_msgctl=''
437 d_msgget=''
438 d_msgrcv=''
439 d_msgsnd=''
440 d_msync=''
441 d_munmap=''
442 d_nice=''
443 d_open3=''
444 d_fpathconf=''
445 d_pathconf=''
446 d_pause=''
447 d_pipe=''
448 d_poll=''
449 d_portable=''
450 d_old_pthread_create_joinable=''
451 old_pthread_create_joinable=''
452 d_pthread_yield=''
453 d_sched_yield=''
454 sched_yield=''
455 d_readdir=''
456 d_rewinddir=''
457 d_seekdir=''
458 d_telldir=''
459 d_readlink=''
460 d_rename=''
461 d_rmdir=''
462 d_safebcpy=''
463 d_safemcpy=''
464 d_sanemcmp=''
465 d_select=''
466 d_sem=''
467 d_semctl=''
468 d_semget=''
469 d_semop=''
470 d_setegid=''
471 d_seteuid=''
472 d_setgrent=''
473 d_setgrps=''
474 d_sethent=''
475 d_setlinebuf=''
476 d_setlocale=''
477 d_setnent=''
478 d_setpent=''
479 d_setpgid=''
480 d_setpgrp2=''
481 d_bsdsetpgrp=''
482 d_setpgrp=''
483 d_setprior=''
484 d_setpwent=''
485 d_setregid=''
486 d_setresgid=''
487 d_setresuid=''
488 d_setreuid=''
489 d_setrgid=''
490 d_setruid=''
491 d_setsent=''
492 d_setsid=''
493 d_setspent=''
494 d_setvbuf=''
495 d_sfio=''
496 usesfio=''
497 d_shm=''
498 d_shmat=''
499 d_shmatprototype=''
500 shmattype=''
501 d_shmctl=''
502 d_shmdt=''
503 d_shmget=''
504 d_sigaction=''
505 d_sigsetjmp=''
506 d_msg_ctrunc=''
507 d_msg_dontroute=''
508 d_msg_oob=''
509 d_msg_peek=''
510 d_msg_proxy=''
511 d_oldsock=''
512 d_scm_rights=''
513 d_socket=''
514 d_sockpair=''
515 sockethdr=''
516 socketlib=''
517 d_socklen_t=''
518 d_sqrtl=''
519 d_statblks=''
520 d_statfs_f_flags=''
521 d_statfs_s=''
522 d_fstatvfs=''
523 d_statvfs=''
524 d_stdio_cnt_lval=''
525 d_stdio_ptr_lval=''
526 d_stdiobase=''
527 d_stdstdio=''
528 stdio_base=''
529 stdio_bufsiz=''
530 stdio_cnt=''
531 stdio_filbuf=''
532 stdio_ptr=''
533 d_index=''
534 d_strchr=''
535 d_strcoll=''
536 d_strctcpy=''
537 d_strerrm=''
538 d_strerror=''
539 d_sysernlst=''
540 d_syserrlst=''
541 d_strtod=''
542 d_strtol=''
543 d_strtold=''
544 d_strtoll=''
545 d_strtoul=''
546 d_strtoull=''
547 d_strtouq=''
548 d_strxfrm=''
549 d_symlink=''
550 d_syscall=''
551 d_sysconf=''
552 d_system=''
553 d_tcgetpgrp=''
554 d_tcsetpgrp=''
555 d_telldirproto=''
556 d_time=''
557 timetype=''
558 clocktype=''
559 d_times=''
560 d_truncate=''
561 d_tzname=''
562 d_umask=''
563 d_semctl_semid_ds=''
564 d_semctl_semun=''
565 d_union_semun=''
566 d_ustat=''
567 d_vfork=''
568 usevfork=''
569 d_voidsig=''
570 signal_t=''
571 d_volatile=''
572 d_charvspr=''
573 d_vprintf=''
574 d_wait4=''
575 d_waitpid=''
576 d_wcstombs=''
577 d_wctomb=''
578 dlext=''
579 cccdlflags=''
580 ccdlflags=''
581 dlsrc=''
582 ld=''
583 lddlflags=''
584 usedl=''
585 doublesize=''
586 ebcdic=''
587 fflushNULL=''
588 fflushall=''
589 fpossize=''
590 fpostype=''
591 gidformat=''
592 gidsign=''
593 gidsize=''
594 gidtype=''
595 groupstype=''
596 h_fcntl=''
597 h_sysfile=''
598 i_arpainet=''
599 db_hashtype=''
600 db_prefixtype=''
601 i_db=''
602 i_dbm=''
603 i_rpcsvcdbm=''
604 d_dirnamlen=''
605 direntrytype=''
606 i_dirent=''
607 i_dld=''
608 i_dlfcn=''
609 i_fcntl=''
610 i_float=''
611 i_gdbm=''
612 d_grpasswd=''
613 i_grp=''
614 i_iconv=''
615 i_inttypes=''
616 i_limits=''
617 i_locale=''
618 i_machcthr=''
619 i_malloc=''
620 i_math=''
621 i_memory=''
622 i_mntent=''
623 i_ndbm=''
624 i_netdb=''
625 i_neterrno=''
626 i_netinettcp=''
627 i_niin=''
628 i_sysin=''
629 i_poll=''
630 i_pthread=''
631 d_pwage=''
632 d_pwchange=''
633 d_pwclass=''
634 d_pwcomment=''
635 d_pwexpire=''
636 d_pwgecos=''
637 d_pwpasswd=''
638 d_pwquota=''
639 i_pwd=''
640 i_sfio=''
641 i_shadow=''
642 i_socks=''
643 i_stddef=''
644 i_stdlib=''
645 i_string=''
646 strings=''
647 i_sysaccess=''
648 i_sysdir=''
649 i_sysfile=''
650 d_voidtty=''
651 i_bsdioctl=''
652 i_sysfilio=''
653 i_sysioctl=''
654 i_syssockio=''
655 i_syslog=''
656 i_sysmman=''
657 i_sysmode=''
658 i_sysmount=''
659 i_sysndir=''
660 i_sysparam=''
661 i_sysresrc=''
662 i_syssecrt=''
663 i_sysselct=''
664 i_sysstat=''
665 i_sysstatfs=''
666 i_sysstatvfs=''
667 i_systimes=''
668 i_systypes=''
669 i_sysuio=''
670 i_sysun=''
671 i_sysutsname=''
672 i_sysvfs=''
673 i_syswait=''
674 i_sgtty=''
675 i_termio=''
676 i_termios=''
677 i_systime=''
678 i_systimek=''
679 i_time=''
680 timeincl=''
681 i_unistd=''
682 i_ustat=''
683 i_utime=''
684 i_values=''
685 i_stdarg=''
686 i_varargs=''
687 i_varhdr=''
688 i_vfork=''
689 inc_version_list=''
690 inc_version_list_init=''
691 installprefix=''
692 installprefixexp=''
693 installstyle=''
694 installusrbinperl=''
695 intsize=''
696 longsize=''
697 shortsize=''
698 d_fpos64_t=''
699 d_off64_t=''
700 libc=''
701 ldlibpthname=''
702 libperl=''
703 shrpenv=''
704 useshrplib=''
705 glibpth=''
706 libpth=''
707 loclibpth=''
708 plibpth=''
709 xlibpth=''
710 ignore_versioned_solibs=''
711 libs=''
712 libsdirs=''
713 libsfiles=''
714 libsfound=''
715 libspath=''
716 lns=''
717 d_PRIEldbl=''
718 d_PRIFldbl=''
719 d_PRIGldbl=''
720 d_PRIeldbl=''
721 d_PRIfldbl=''
722 d_PRIgldbl=''
723 sPRIEldbl=''
724 sPRIFldbl=''
725 sPRIGldbl=''
726 sPRIeldbl=''
727 sPRIfldbl=''
728 sPRIgldbl=''
729 lseeksize=''
730 lseektype=''
731 make_set_make=''
732 d_mymalloc=''
733 freetype=''
734 mallocobj=''
735 mallocsrc=''
736 malloctype=''
737 usemymalloc=''
738 installman1dir=''
739 man1dir=''
740 man1direxp=''
741 man1ext=''
742 installman3dir=''
743 man3dir=''
744 man3direxp=''
745 man3ext=''
746 huge=''
747 large=''
748 medium=''
749 models=''
750 small=''
751 split=''
752 modetype=''
753 multiarch=''
754 mydomain=''
755 myhostname=''
756 phostname=''
757 c=''
758 n=''
759 d_eofnblk=''
760 eagain=''
761 o_nonblock=''
762 rd_nodata=''
763 netdb_hlen_type=''
764 netdb_host_type=''
765 netdb_name_type=''
766 netdb_net_type=''
767 groupcat=''
768 hostcat=''
769 passcat=''
770 orderlib=''
771 ranlib=''
772 package=''
773 spackage=''
774 pager=''
775 api_revision=''
776 api_subversion=''
777 api_version=''
778 api_versionstring=''
779 patchlevel=''
780 subversion=''
781 version=''
782 perladmin=''
783 perlpath=''
784 d_nv_preserves_uv=''
785 i16size=''
786 i16type=''
787 i32size=''
788 i32type=''
789 i64size=''
790 i64type=''
791 i8size=''
792 i8type=''
793 ivsize=''
794 ivtype=''
795 nvsize=''
796 nvtype=''
797 u16size=''
798 u16type=''
799 u32size=''
800 u32type=''
801 u64size=''
802 u64type=''
803 u8size=''
804 u8type=''
805 uvsize=''
806 uvtype=''
807 ivdformat=''
808 uvoformat=''
809 uvuformat=''
810 uvxformat=''
811 pidtype=''
812 prefix=''
813 prefixexp=''
814 installprivlib=''
815 privlib=''
816 privlibexp=''
817 prototype=''
818 ptrsize=''
819 d_PRIX64=''
820 d_PRId64=''
821 d_PRIi64=''
822 d_PRIo64=''
823 d_PRIu64=''
824 d_PRIx64=''
825 sPRIX64=''
826 sPRId64=''
827 sPRIi64=''
828 sPRIo64=''
829 sPRIu64=''
830 sPRIx64=''
831 d_quad=''
832 quadkind=''
833 quadtype=''
834 uquadtype=''
835 drand01=''
836 randbits=''
837 randfunc=''
838 randseedtype=''
839 seedfunc=''
840 installscript=''
841 scriptdir=''
842 scriptdirexp=''
843 selectminbits=''
844 selecttype=''
845 sh=''
846 sig_count=''
847 sig_name=''
848 sig_name_init=''
849 sig_num=''
850 sig_num_init=''
851 installsitearch=''
852 sitearch=''
853 sitearchexp=''
854 installsitebin=''
855 sitebin=''
856 sitebinexp=''
857 installsitelib=''
858 sitelib=''
859 sitelibexp=''
860 siteprefix=''
861 siteprefixexp=''
862 sizetype=''
863 so=''
864 sharpbang=''
865 shsharp=''
866 spitshell=''
867 src=''
868 ssizetype=''
869 startperl=''
870 startsh=''
871 stdchar=''
872 d_stdio_stream_array=''
873 stdio_stream_array=''
874 sysman=''
875 trnl=''
876 uidformat=''
877 uidsign=''
878 uidsize=''
879 uidtype=''
880 archname64=''
881 use64bits=''
882 uselargefiles=''
883 uselongdouble=''
884 usemorebits=''
885 usemultiplicity=''
886 nm_opt=''
887 nm_so_opt=''
888 runnm=''
889 usenm=''
890 useperlio=''
891 usesocks=''
892 d_oldpthreads=''
893 use5005threads=''
894 useithreads=''
895 usethreads=''
896 incpath=''
897 mips_type=''
898 usrinc=''
899 d_vendorbin=''
900 installvendorbin=''
901 vendorbin=''
902 vendorbinexp=''
903 d_vendorlib=''
904 installvendorlib=''
905 vendorlib=''
906 vendorlibexp=''
907 usevendorprefix=''
908 vendorprefix=''
909 vendorprefixexp=''
910 defvoidused=''
911 voidflags=''
912 pm_apiversion=''
913 xs_apiversion=''
914 CONFIG=''
915
916 define='define'
917 undef='undef'
918 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
919 rmlist=''
920
921 : We must find out about Eunice early
922 eunicefix=':'
923 if test -f /etc/unixtovms; then
924         eunicefix=/etc/unixtovms
925 fi
926 if test -f /etc/unixtovms.exe; then
927         eunicefix=/etc/unixtovms.exe
928 fi
929
930 i_whoami=''
931 : set useposix=false in your hint file to disable the POSIX extension.
932 useposix=true
933 : set useopcode=false in your hint file to disable the Opcode extension.
934 useopcode=true
935 : Trailing extension.  Override this in a hint file, if needed.
936 _exe=''
937 : Extra object files, if any, needed on this platform.
938 archobjs=''
939 : Possible local include directories to search.
940 : Set locincpth to "" in a hint file to defeat local include searches.
941 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
942 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
943 :
944 : no include file wanted by default
945 inclwanted=''
946
947 groupstype=''
948 : change the next line if compiling for Xenix/286 on Xenix/386
949 xlibpth='/usr/lib/386 /lib/386'
950 : Possible local library directories to search.
951 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
952 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
953
954 : general looking path for locating libraries
955 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
956 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
957 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
958 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
959 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
960
961 : Private path used by Configure to find libraries.  Its value
962 : is prepended to libpth. This variable takes care of special
963 : machines, like the mips.  Usually, it should be empty.
964 plibpth=''
965
966 : default library list
967 libswanted=''
968 : some systems want to use only the non-versioned libso:s
969 ignore_versioned_solibs=''
970 : set usemultiplicity on the Configure command line to enable multiplicity.
971 : set usesocks on the Configure command line to enable socks.
972 : set usethreads on the Configure command line to enable threads.
973 : full support for void wanted by default
974 defvoidused=15
975
976 : List of libraries we want.
977 : If anyone needs -lnet, put it in a hint file.
978 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
979 libswanted="$libswanted dld ld sun m c cposix posix"
980 libswanted="$libswanted ndir dir crypt sec"
981 libswanted="$libswanted ucb bsd BSD PW x"
982 : We probably want to search /usr/shlib before most other libraries.
983 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
984 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
985 glibpth="/usr/shlib $glibpth"
986 : Do not use vfork unless overridden by a hint file.
987 usevfork=false
988
989 : Find the basic shell for Bourne shell scripts
990 case "$sh" in
991 '')
992         case "$SYSTYPE" in
993         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
994         *) xxx='/bin/sh';;
995         esac
996         if test -f "$xxx"; then
997                 sh="$xxx"
998         else
999                 : Build up a list and do a single loop so we can 'break' out.
1000                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1001                 for xxx in sh bash ksh pdksh ash; do
1002                         for p in $pth; do
1003                                 try="$try ${p}/${xxx}"
1004                         done
1005                 done
1006                 for xxx in $try; do
1007                         if test -f "$xxx"; then
1008                                 sh="$xxx";
1009                                 break
1010                         elif test -f "$xxx.exe"; then
1011                                 sh="$xxx";
1012                                 break
1013                         fi
1014                 done
1015         fi
1016         ;;
1017 esac
1018
1019 case "$sh" in
1020 '')     cat <<EOM >&2
1021 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1022
1023 Usually it's in /bin/sh.  How did you even get this far?
1024 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1025 we'll try to straighten this all out.
1026 EOM
1027         exit 1
1028         ;;
1029 esac
1030
1031 : see if sh knows # comments
1032 if `$sh -c '#' >/dev/null 2>&1`; then
1033         shsharp=true
1034         spitshell=cat
1035         xcat=/bin/cat
1036         test -f $xcat || xcat=/usr/bin/cat
1037         echo "#!$xcat" >try
1038         $eunicefix try
1039         chmod +x try
1040         ./try > today
1041         if test -s today; then
1042                 sharpbang='#!'
1043         else
1044                 echo "#! $xcat" > try
1045                 $eunicefix try
1046                 chmod +x try
1047                 ./try > today
1048                 if test -s today; then
1049                         sharpbang='#! '
1050                 else
1051                         sharpbang=': use '
1052                 fi
1053         fi
1054 else
1055         echo " "
1056         echo "Your $sh doesn't grok # comments--I will strip them later on."
1057         shsharp=false
1058         cd ..
1059         echo "exec grep -v '^[  ]*#'" >spitshell
1060         chmod +x spitshell
1061         $eunicefix spitshell
1062         spitshell=`pwd`/spitshell
1063         cd UU
1064         echo "I presume that if # doesn't work, #! won't work either!"
1065         sharpbang=': use '
1066 fi
1067 rm -f try today
1068
1069 : figure out how to guarantee sh startup
1070 case "$startsh" in
1071 '') startsh=${sharpbang}${sh} ;;
1072 *)
1073 esac
1074 cat >try <<EOSS
1075 $startsh
1076 set abc
1077 test "$?abc" != 1
1078 EOSS
1079
1080 chmod +x try
1081 $eunicefix try
1082 if ./try; then
1083         : echo "Yup, it does."
1084 else
1085         echo "Hmm... '$startsh' does not guarantee sh startup..."
1086         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1087 fi
1088 rm -f try
1089
1090
1091 : Save command line options in file UU/cmdline.opt for later use in
1092 : generating config.sh.
1093 cat > cmdline.opt <<EOSH
1094 # Configure command line arguments.
1095 config_arg0='$0'
1096 config_args='$*'
1097 config_argc=$#
1098 EOSH
1099 argn=1
1100 for arg in "$@"; do
1101         cat >>cmdline.opt <<EOSH
1102 config_arg$argn='$arg'
1103 EOSH
1104         argn=`expr $argn + 1`
1105 done
1106
1107 : produce awk script to parse command line options
1108 cat >options.awk <<'EOF'
1109 BEGIN {
1110         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1111
1112         len = length(optstr);
1113         for (i = 1; i <= len; i++) {
1114                 c = substr(optstr, i, 1);
1115                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1116                 if (a == ":") {
1117                         arg[c] = 1;
1118                         i++;
1119                 }
1120                 opt[c] = 1;
1121         }
1122 }
1123 {
1124         expect = 0;
1125         str = $0;
1126         if (substr(str, 1, 1) != "-") {
1127                 printf("'%s'\n", str);
1128                 next;
1129         }
1130         len = length($0);
1131         for (i = 2; i <= len; i++) {
1132                 c = substr(str, i, 1);
1133                 if (!opt[c]) {
1134                         printf("-%s\n", substr(str, i));
1135                         next;
1136                 }
1137                 printf("-%s\n", c);
1138                 if (arg[c]) {
1139                         if (i < len)
1140                                 printf("'%s'\n", substr(str, i + 1));
1141                         else
1142                                 expect = 1;
1143                         next;
1144                 }
1145         }
1146 }
1147 END {
1148         if (expect)
1149                 print "?";
1150 }
1151 EOF
1152
1153 : process the command line options
1154 set X `for arg in "$@"; do echo "X$arg"; done |
1155         sed -e s/X// | awk -f options.awk`
1156 eval "set $*"
1157 shift
1158 rm -f options.awk
1159
1160 : set up default values
1161 fastread=''
1162 reuseval=false
1163 config_sh=''
1164 alldone=''
1165 error=''
1166 silent=''
1167 extractsh=''
1168 override=''
1169 knowitall=''
1170 rm -f optdef.sh posthint.sh
1171 cat >optdef.sh <<EOS
1172 $startsh
1173 EOS
1174
1175
1176 : option parsing
1177 while test $# -gt 0; do
1178         case "$1" in
1179         -d) shift; fastread=yes;;
1180         -e) shift; alldone=cont;;
1181         -f)
1182                 shift
1183                 cd ..
1184                 if test -r "$1"; then
1185                         config_sh="$1"
1186                 else
1187                         echo "$me: cannot read config file $1." >&2
1188                         error=true
1189                 fi
1190                 cd UU
1191                 shift;;
1192         -h) shift; error=true;;
1193         -r) shift; reuseval=true;;
1194         -s) shift; silent=true; realsilent=true;;
1195         -E) shift; alldone=exit;;
1196         -K) shift; knowitall=true;;
1197         -O) shift; override=true;;
1198         -S) shift; silent=true; extractsh=true;;
1199         -D)
1200                 shift
1201                 case "$1" in
1202                 *=)
1203                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1204                         echo "$me: ignoring -D $1" >&2
1205                         ;;
1206                 *=*) echo "$1" | \
1207                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1208                 *) echo "$1='define'" >> optdef.sh;;
1209                 esac
1210                 shift
1211                 ;;
1212         -U)
1213                 shift
1214                 case "$1" in
1215                 *=) echo "$1" >> optdef.sh;;
1216                 *=*)
1217                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1218                         echo "$me: ignoring -U $1" >&2
1219                         ;;
1220                 *) echo "$1='undef'" >> optdef.sh;;
1221                 esac
1222                 shift
1223                 ;;
1224         -A)
1225             shift
1226             xxx=''
1227             yyy="$1"
1228             zzz=''
1229             uuu=undef
1230             case "$yyy" in
1231             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1232                  case "$zzz" in
1233                  *:*) zzz='' ;;
1234                  *)   xxx=append
1235                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1236                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1237                  esac
1238                  ;;
1239             esac
1240             case "$xxx" in
1241             '')  case "$yyy" in
1242                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1243                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1244                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1245                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1246                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1247                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1248                  esac
1249                  ;;       
1250             esac
1251             case "$xxx" in
1252             append)
1253                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1254             clear)
1255                 echo "$yyy=''"                  >> posthint.sh ;;
1256             define)
1257                 case "$zzz" in
1258                 '') zzz=define ;;
1259                 esac
1260                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1261             eval)
1262                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1263             prepend)
1264                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1265             undef)
1266                 case "$zzz" in
1267                 '') zzz="$uuu" ;;
1268                 esac
1269                 echo "$yyy=$zzz"                >> posthint.sh ;;
1270             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1271             esac
1272             shift
1273             ;;
1274         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1275             exit 0;;
1276         --) break;;
1277         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1278         *) break;;
1279         esac
1280 done
1281
1282 case "$error" in
1283 true)
1284         cat >&2 <<EOM
1285 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1286                  [-U symbol] [-U symbol=] [-A command:symbol...]
1287   -d : use defaults for all answers.
1288   -e : go on without questioning past the production of config.sh.
1289   -f : specify an alternate default configuration file.
1290   -h : print this help message and exit (with an error status).
1291   -r : reuse C symbols value if possible (skips costly nm extraction).
1292   -s : silent mode, only echoes questions and essential information.
1293   -D : define symbol to have some value:
1294          -D symbol         symbol gets the value 'define'
1295          -D symbol=value   symbol gets the value 'value'
1296   -E : stop at the end of questions, after having produced config.sh.
1297   -K : do not use unless you know what you are doing.
1298   -O : let -D and -U override definitions from loaded configuration file.
1299   -S : perform variable substitutions on all .SH files (can mix with -f)
1300   -U : undefine symbol:
1301          -U symbol    symbol gets the value 'undef'
1302          -U symbol=   symbol gets completely empty
1303   -A : manipulate symbol after the platform specific hints have been applied:
1304          -A symbol=value                append " "value to symbol
1305          -A append:symbol=value         append value to symbol
1306          -A define:symbol=value         define symbol to have value
1307          -A clear:symbol                define symbol to be ''
1308          -A define:symbol               define symbol to be 'define'
1309          -A eval:symbol=value           define symbol to be eval of value
1310          -A prepend:symbol=value        prepend value to symbol
1311          -A undef:symbol                define symbol to be 'undef'
1312          -A undef:symbol=               define symbol to be ''
1313   -V : print version number and exit (with a zero status).
1314 EOM
1315         exit 1
1316         ;;
1317 esac
1318
1319 : Sanity checks
1320 case "$fastread$alldone" in
1321 yescont|yesexit) ;;
1322 *)
1323         if test ! -t 0; then
1324                 echo "Say 'sh Configure', not 'sh <Configure'"
1325                 exit 1
1326         fi
1327         ;;
1328 esac
1329
1330 exec 4>&1
1331 case "$silent" in
1332 true) exec 1>/dev/null;;
1333 esac
1334
1335 : run the defines and the undefines, if any, but leave the file out there...
1336 touch optdef.sh
1337 . ./optdef.sh
1338 : create the posthint manipulation script and leave the file out there...
1339 touch posthint.sh
1340
1341 : set package name
1342 package=perl5
1343 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1344 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1345 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1346 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1347 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1348 esac
1349
1350 : Some greps do not return status, grrr.
1351 echo "grimblepritz" >grimble
1352 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1353         contains=contains
1354 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1355         contains=grep
1356 else
1357         contains=contains
1358 fi
1359 rm -f grimble
1360 : the following should work in any shell
1361 case "$contains" in
1362 contains*)
1363         echo " "
1364         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1365         cat >contains <<'EOSS'
1366 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1367 EOSS
1368 chmod +x contains
1369 esac
1370
1371 : Find the path to the source tree
1372 case "$src" in
1373 '') case "$0" in
1374     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1375          case "$src" in
1376          /*)    ;;
1377          *)     src=`cd ../$src && pwd` ;;
1378          esac
1379          ;;
1380     *)   src='.';;
1381     esac;;
1382 esac
1383 case "$src" in
1384 '')     src=/
1385         rsrc=/
1386         ;;
1387 /*) rsrc="$src";;
1388 *) rsrc="../$src";;
1389 esac
1390 if test -f $rsrc/Configure && \
1391         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1392 then
1393    : found it, so we are ok.
1394 else
1395         rsrc=''
1396         for src in . .. ../.. ../../.. ../../../..; do
1397                 if test -f ../$src/Configure && \
1398                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1399                 then
1400                         rsrc=../$src
1401                         break
1402                 fi
1403         done
1404 fi
1405 case "$rsrc" in
1406 '')
1407         cat <<EOM >&4
1408
1409 Sorry, I can't seem to locate the source dir for $package.  Please start
1410 Configure with an explicit path -- i.e. /some/path/Configure.
1411
1412 EOM
1413         exit 1
1414         ;;
1415 ../.)   rsrc='..';;
1416 *)
1417         echo " "
1418         echo "Sources for $package found in \"$src\"." >&4
1419         ;;
1420 esac
1421
1422 : script used to extract .SH files with variable substitutions
1423 cat >extract <<'EOS'
1424 CONFIGDOTSH=true
1425 echo "Doing variable substitutions on .SH files..."
1426 if test -f $src/MANIFEST; then
1427         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1428 else
1429         echo "(Looking for .SH files under the source directory.)"
1430         set x `(cd $src; find . -name "*.SH" -print)`
1431 fi
1432 shift
1433 case $# in
1434 0) set x `(cd $src; echo *.SH)`; shift;;
1435 esac
1436 if test ! -f $src/$1; then
1437         shift
1438 fi
1439 mkdir_p='
1440 name=$1;
1441 create="";
1442 while test $name; do
1443         if test ! -d "$name"; then
1444                 create="$name $create";
1445                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1446                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1447         else
1448                 name="";
1449         fi;
1450 done;
1451 for file in $create; do
1452         mkdir $file;
1453 done
1454 '
1455 for file in $*; do
1456         case "$src" in
1457         ".")
1458                 case "$file" in
1459                 */*)
1460                         dir=`expr X$file : 'X\(.*\)/'`
1461                         file=`expr X$file : 'X.*/\(.*\)'`
1462                         (cd $dir && . ./$file)
1463                         ;;
1464                 *)
1465                         . ./$file
1466                         ;;
1467                 esac
1468                 ;;
1469         *)
1470                 case "$file" in
1471                 */*)
1472                         dir=`expr X$file : 'X\(.*\)/'`
1473                         file=`expr X$file : 'X.*/\(.*\)'`
1474                         (set x $dir; shift; eval $mkdir_p)
1475                         sh <$src/$dir/$file
1476                         ;;
1477                 *)
1478                         sh <$src/$file
1479                         ;;
1480                 esac
1481                 ;;
1482         esac
1483 done
1484 if test -f $src/config_h.SH; then
1485         if test ! -f config.h; then
1486         : oops, they left it out of MANIFEST, probably, so do it anyway.
1487         . $src/config_h.SH
1488         fi
1489 fi
1490 EOS
1491
1492 : extract files and exit if asked to do so
1493 case "$extractsh" in
1494 true)
1495         case "$realsilent" in
1496         true) ;;
1497         *) exec 1>&4;;
1498         esac
1499         case "$config_sh" in
1500         '') config_sh='config.sh';;
1501         esac
1502         echo " "
1503         echo "Fetching answers from $config_sh..."
1504         cd ..
1505         . $config_sh
1506         test "$override" && . ./optdef.sh
1507         echo " "
1508         . UU/extract
1509         rm -rf UU
1510         echo "Done."
1511         exit 0
1512         ;;
1513 esac
1514
1515 : Eunice requires " " instead of "", can you believe it
1516 echo " "
1517 : Here we go...
1518 echo "Beginning of configuration questions for $package."
1519
1520 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1521
1522 : first determine how to suppress newline on echo command
1523 echo " "
1524 echo "Checking echo to see how to suppress newlines..."
1525 (echo "hi there\c" ; echo " ") >.echotmp
1526 if $contains c .echotmp >/dev/null 2>&1 ; then
1527         echo "...using -n."
1528         n='-n'
1529         c=''
1530 else
1531         cat <<'EOM'
1532 ...using \c
1533 EOM
1534         n=''
1535         c='\c'
1536 fi
1537 echo $n "The star should be here-->$c"
1538 echo '*'
1539 rm -f .echotmp
1540
1541 : Now test for existence of everything in MANIFEST
1542 echo " "
1543 if test -f $rsrc/MANIFEST; then
1544         echo "First let's make sure your kit is complete.  Checking..." >&4
1545         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1546         rm -f missing
1547         tmppwd=`pwd`
1548         for filelist in x??; do
1549                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1550         done
1551         if test -s missing; then
1552                 cat missing >&4
1553                 cat >&4 <<'EOM'
1554
1555 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1556
1557 You have the option of continuing the configuration process, despite the
1558 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1559 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1560 and contact the author (perlbug@perl.com).
1561
1562 EOM
1563                 echo $n "Continue? [n] $c" >&4
1564                 read ans
1565                 case "$ans" in
1566                 y*)
1567                         echo "Continuing..." >&4
1568                         rm -f missing
1569                         ;;
1570                 *)
1571                         echo "ABORTING..." >&4
1572                         kill $$
1573                         ;;
1574                 esac
1575         else
1576                 echo "Looks good..."
1577         fi
1578 else
1579         echo "There is no MANIFEST file.  I hope your kit is complete !"
1580 fi
1581 rm -f missing x??
1582
1583 echo " "
1584 : Find the appropriate value for a newline for tr
1585 if test -n "$DJGPP"; then
1586        trnl='\012'
1587 fi
1588 if test X"$trnl" = X; then
1589         case "`echo foo|tr '\n' x 2>/dev/null`" in
1590         foox) trnl='\n' ;;
1591         esac
1592 fi
1593 if test X"$trnl" = X; then
1594         case "`echo foo|tr '\012' x 2>/dev/null`" in
1595         foox) trnl='\012' ;;
1596         esac
1597 fi
1598 if test X"$trnl" = X; then
1599         cat <<EOM >&2
1600
1601 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1602
1603 EOM
1604         exit 1
1605 fi
1606
1607 : compute the number of columns on the terminal for proper question formatting
1608 case "$COLUMNS" in
1609 '') COLUMNS='80';;
1610 esac
1611
1612 : set up the echo used in my read
1613 myecho="case \"\$xxxm\" in
1614 '') echo $n \"\$rp $c\" >&4;;
1615 *) case \"\$rp\" in
1616         '') echo $n \"[\$xxxm] $c\";;
1617         *)
1618                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1619                         echo \"\$rp\" >&4
1620                         echo $n \"[\$xxxm] $c\" >&4
1621                 else
1622                         echo $n \"\$rp [\$xxxm] $c\" >&4
1623                 fi
1624                 ;;
1625         esac;;
1626 esac"
1627
1628 : now set up to do reads with possible shell escape and default assignment
1629 cat <<EOSC >myread
1630 $startsh
1631 xxxm=\$dflt
1632 $myecho
1633 ans='!'
1634 case "\$fastread" in
1635 yes) case "\$dflt" in
1636         '') ;;
1637         *) ans='';
1638                 case "\$silent-\$rp" in
1639                 true-) ;;
1640                 *) echo " " >&4;;
1641                 esac;;
1642         esac;;
1643 *) case "\$silent" in
1644         true) case "\$rp" in
1645                 '') ans='';;
1646                 esac;;
1647         esac;;
1648 esac
1649 while expr "X\$ans" : "X!" >/dev/null; do
1650         read answ
1651         set x \$xxxm
1652         shift
1653         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1654         case  "\$answ" in
1655         "!")
1656                 sh 1>&4
1657                 echo " "
1658                 $myecho
1659                 ;;
1660         !*)
1661                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1662                 shift
1663                 sh 1>&4 -c "\$*"
1664                 echo " "
1665                 $myecho
1666                 ;;
1667         "\$ans")
1668                 case "\$ans" in
1669                 \\&*)
1670                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1671                         shift
1672                         case "\$1" in
1673                         -d)
1674                                 fastread=yes
1675                                 echo "(OK, I'll run with -d after this question.)" >&4
1676                                 ;;
1677                         -*)
1678                                 echo "*** Sorry, \$1 not supported yet." >&4
1679                                 ;;
1680                         esac
1681                         $myecho
1682                         ans=!
1683                         ;;
1684                 esac;;
1685         *)
1686                 case "\$aok" in
1687                 y)
1688                         echo "*** Substitution done -- please confirm."
1689                         xxxm="\$ans"
1690                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1691                         xxxm="\$ans"
1692                         ans=!
1693                         ;;
1694                 *)
1695                         echo "*** Error -- try again."
1696                         ans=!
1697                         ;;
1698                 esac
1699                 $myecho
1700                 ;;
1701         esac
1702         case "\$ans\$xxxm\$nostick" in
1703         '')
1704                 ans=!
1705                 $myecho
1706                 ;;
1707         esac
1708 done
1709 case "\$ans" in
1710 '') ans="\$xxxm";;
1711 esac
1712 EOSC
1713
1714 : create .config dir to save info across Configure sessions
1715 test -d ../.config || mkdir ../.config
1716 cat >../.config/README <<EOF
1717 This directory created by Configure to save information that should
1718 persist across sessions for $package.
1719
1720 You may safely delete it if you wish.
1721 EOF
1722
1723 : general instructions
1724 needman=true
1725 firsttime=true
1726 user=`(logname) 2>/dev/null`
1727 case "$user" in
1728 '') user=`whoami 2>&1`;;
1729 esac
1730 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1731         firsttime=false
1732         echo " "
1733         rp='Would you like to see the instructions?'
1734         dflt=n
1735         . ./myread
1736         case "$ans" in
1737         [yY]*) ;;
1738         *) needman=false;;
1739         esac
1740 fi
1741 if $needman; then
1742         cat <<EOH
1743
1744 This installation shell script will examine your system and ask you questions
1745 to determine how the perl5 package should be installed. If you get
1746 stuck on a question, you may use a ! shell escape to start a subshell or
1747 execute a command.  Many of the questions will have default answers in square
1748 brackets; typing carriage return will give you the default.
1749
1750 On some of the questions which ask for file or directory names you are allowed
1751 to use the ~name construct to specify the login directory belonging to "name",
1752 even if you don't have a shell which knows about that.  Questions where this is
1753 allowed will be marked "(~name ok)".
1754
1755 EOH
1756         rp=''
1757         dflt='Type carriage return to continue'
1758         . ./myread
1759         cat <<'EOH'
1760
1761 The prompter used in this script allows you to use shell variables and
1762 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1763 in the default answer, as if the default line was a set of arguments given to a
1764 script shell.  This means you may also use $* to repeat the whole default line,
1765 so you do not have to re-type everything to add something to the default.
1766
1767 Everytime there is a substitution, you will have to confirm.  If there is an
1768 error (e.g. an unmatched backtick), the default answer will remain unchanged
1769 and you will be prompted again.
1770
1771 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1772 the questions and use the computed defaults (or the previous answers if there
1773 was already a config.sh file). Type 'Configure -h' for a list of options.
1774 You may also start interactively and then answer '& -d' at any prompt to turn
1775 on the non-interactive behaviour for the remainder of the execution.
1776
1777 EOH
1778         . ./myread
1779         cat <<EOH
1780
1781 Much effort has been expended to ensure that this shell script will run on any
1782 Unix system.  If despite that it blows up on yours, your best bet is to edit
1783 Configure and run it again.  If you can't run Configure for some reason,
1784 you'll have to generate a config.sh file by hand.  Whatever problems you
1785 have, let me (perlbug@perl.com) know how I blew it.
1786
1787 This installation script affects things in two ways:
1788
1789 1) it may do direct variable substitutions on some of the files included
1790    in this kit.
1791 2) it builds a config.h file for inclusion in C programs.  You may edit
1792    any of these files as the need arises after running this script.
1793
1794 If you make a mistake on a question, there is no easy way to back up to it
1795 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1796 files.  Configure will offer to let you do this before it runs the SH files.
1797
1798 EOH
1799         dflt='Type carriage return to continue'
1800         . ./myread
1801         case "$firsttime" in
1802         true) echo $user >>../.config/instruct;;
1803         esac
1804 fi
1805
1806 : find out where common programs are
1807 echo " "
1808 echo "Locating common programs..." >&4
1809 cat <<EOSC >loc
1810 $startsh
1811 case \$# in
1812 0) exit 1;;
1813 esac
1814 thing=\$1
1815 shift
1816 dflt=\$1
1817 shift
1818 for dir in \$*; do
1819         case "\$thing" in
1820         .)
1821         if test -d \$dir/\$thing; then
1822                 echo \$dir
1823                 exit 0
1824         fi
1825         ;;
1826         *)
1827         for thisthing in \$dir/\$thing; do
1828                 : just loop through to pick last item
1829         done
1830         if test -f \$thisthing; then
1831                 echo \$thisthing
1832                 exit 0
1833         elif test -f \$dir/\$thing.exe; then
1834                 if test -n "$DJGPP"; then
1835                         echo \$dir/\$thing.exe
1836                 else
1837                         : on Eunice apparently
1838                         echo \$dir/\$thing
1839                 fi
1840                 exit 0
1841         fi
1842         ;;
1843         esac
1844 done
1845 echo \$dflt
1846 exit 1
1847 EOSC
1848 chmod +x loc
1849 $eunicefix loc
1850 loclist="
1851 awk
1852 cat
1853 comm
1854 cp
1855 echo
1856 expr
1857 grep
1858 ls
1859 make
1860 mkdir
1861 rm
1862 sed
1863 sort
1864 touch
1865 tr
1866 uniq
1867 "
1868 trylist="
1869 Mcc
1870 ar
1871 byacc
1872 cpp
1873 csh
1874 date
1875 egrep
1876 gzip
1877 less
1878 ln
1879 more
1880 nm
1881 nroff
1882 perl
1883 pg
1884 test
1885 uname
1886 zip
1887 "
1888 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1889 pth="$pth /lib /usr/lib"
1890 for file in $loclist; do
1891         eval xxx=\$$file
1892         case "$xxx" in
1893         /*|?:[\\/]*)
1894                 if test -f "$xxx"; then
1895                         : ok
1896                 else
1897                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1898                         xxx=`./loc $file $file $pth`
1899                 fi
1900                 ;;
1901         '') xxx=`./loc $file $file $pth`;;
1902         *) xxx=`./loc $xxx $xxx $pth`;;
1903         esac
1904         eval $file=$xxx
1905         eval _$file=$xxx
1906         case "$xxx" in
1907         /*)
1908                 echo $file is in $xxx.
1909                 ;;
1910         ?:[\\/]*)
1911                 echo $file is in $xxx.
1912                 ;;
1913         *)
1914                 echo "I don't know where '$file' is, and my life depends on it." >&4
1915                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1916                 exit 1
1917                 ;;
1918         esac
1919 done
1920 echo " "
1921 echo "Don't worry if any of the following aren't found..."
1922 say=offhand
1923 for file in $trylist; do
1924         eval xxx=\$$file
1925         case "$xxx" in
1926         /*|?:[\\/]*)
1927                 if test -f "$xxx"; then
1928                         : ok
1929                 else
1930                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1931                         xxx=`./loc $file $file $pth`
1932                 fi
1933                 ;;
1934         '') xxx=`./loc $file $file $pth`;;
1935         *) xxx=`./loc $xxx $xxx $pth`;;
1936         esac
1937         eval $file=$xxx
1938         eval _$file=$xxx
1939         case "$xxx" in
1940         /*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         ?:[\\/]*)
1944                 echo $file is in $xxx.
1945                 ;;
1946         *)
1947                 echo "I don't see $file out there, $say."
1948                 say=either
1949                 ;;
1950         esac
1951 done
1952 case "$egrep" in
1953 egrep)
1954         echo "Substituting grep for egrep."
1955         egrep=$grep
1956         ;;
1957 esac
1958 case "$ln" in
1959 ln)
1960         echo "Substituting cp for ln."
1961         ln=$cp
1962         ;;
1963 esac
1964 case "$test" in
1965 test)
1966         echo "Hopefully test is built into your sh."
1967         ;;
1968 *)
1969         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1970                 echo "Using the test built into your sh."
1971                 test=test
1972                 _test=test
1973         fi
1974         ;;
1975 esac
1976 case "$echo" in
1977 echo)
1978         echo "Hopefully echo is built into your sh."
1979         ;;
1980 '') ;;
1981 *)
1982         echo " "
1983 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1984         $echo $n "hi there$c" >foo1
1985         echo $n "hi there$c" >foo2
1986         if cmp foo1 foo2 >/dev/null 2>&1; then
1987                 echo "They are compatible.  In fact, they may be identical."
1988         else
1989                 case "$n" in
1990                 '-n') n='' c='\c';;
1991                 *) n='-n' c='';;
1992                 esac
1993                 cat <<FOO
1994 They are not compatible!  You are probably running ksh on a non-USG system.
1995 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1996 have echo built in and we may have to run some Bourne shell scripts.  That
1997 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1998
1999 FOO
2000                 $echo $n "The star should be here-->$c"
2001                 $echo "*"
2002         fi
2003         $rm -f foo1 foo2
2004         ;;
2005 esac
2006
2007 : determine whether symbolic links are supported
2008 echo " "
2009 $touch blurfl
2010 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2011         echo "Symbolic links are supported." >&4
2012         lns="$ln -s"
2013 else
2014         echo "Symbolic links are NOT supported." >&4
2015         lns="$ln"
2016 fi
2017 $rm -f blurfl sym
2018
2019 : see whether [:lower:] and [:upper:] are supported character classes
2020 echo " "
2021 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2022 ABYZ)
2023         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2024         up='[:upper:]'
2025         low='[:lower:]'
2026         ;;
2027 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2028         # (0xc9 and 0xd1), therefore that is a nice testing point.
2029         if test "X$up" = X -o "X$low" = X; then
2030             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2031             ij) up='[A-Z]'
2032                 low='[a-z]'
2033                 ;;
2034             esac
2035         fi
2036         if test "X$up" = X -o "X$low" = X; then
2037             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2038             ij) up='A-Z'
2039                 low='a-z'
2040                 ;;
2041             esac
2042         fi
2043         if test "X$up" = X -o "X$low" = X; then
2044             case "`echo IJ | od -x 2>/dev/null`" in
2045             *C9D1*|*c9d1*)
2046                 echo "Hey, this might be EBCDIC." >&4
2047                 if test "X$up" = X -o "X$low" = X; then
2048                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2049                     ij) up='[A-IJ-RS-Z]'
2050                         low='[a-ij-rs-z]'
2051                         ;;
2052                     esac
2053                 fi
2054                 if test "X$up" = X -o "X$low" = X; then
2055                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2056                     ij) up='A-IJ-RS-Z'
2057                         low='a-ij-rs-z'
2058                         ;;
2059                     esac
2060                 fi
2061                 ;;
2062             esac
2063         fi
2064 esac
2065 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2066 ij)
2067     echo "Using $up and $low to convert case." >&4
2068     ;;
2069 *)
2070     echo "I don't know how to translate letters from upper to lower case." >&4
2071     echo "Your tr is not acting any way I know of." >&4
2072     exit 1
2073     ;;
2074 esac
2075 : set up the translation script tr, must be called with ./tr of course
2076 cat >tr <<EOSC
2077 $startsh
2078 case "\$1\$2" in
2079 '[A-Z][a-z]') exec $tr '$up' '$low';;
2080 '[a-z][A-Z]') exec $tr '$low' '$up';;
2081 esac
2082 exec $tr "\$@"
2083 EOSC
2084 chmod +x tr
2085 $eunicefix tr
2086
2087 : Try to determine whether config.sh was made on this system
2088 case "$config_sh" in
2089 '')
2090 myuname=`$uname -a 2>/dev/null`
2091 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2092 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2093 # because the A-Z/a-z are not consecutive.
2094 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2095         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2096 newmyuname="$myuname"
2097 dflt=n
2098 case "$knowitall" in
2099 '')
2100         if test -f ../config.sh; then
2101                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2102                         eval "`grep myuname= ../config.sh`"
2103                 fi
2104                 if test "X$myuname" = "X$newmyuname"; then
2105                         dflt=y
2106                 fi
2107         fi
2108         ;;
2109 *) dflt=y;;
2110 esac
2111
2112 : Get old answers from old config file if Configure was run on the
2113 : same system, otherwise use the hints.
2114 hint=default
2115 cd ..
2116 if test -f config.sh; then
2117         echo " "
2118         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2119         . UU/myread
2120         case "$ans" in
2121         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2122         *)  echo "Fetching default answers from your old config.sh file..." >&4
2123                 tmp_n="$n"
2124                 tmp_c="$c"
2125                 tmp_sh="$sh"
2126                 . ./config.sh
2127                 cp config.sh UU
2128                 n="$tmp_n"
2129                 c="$tmp_c"
2130                 : Older versions did not always set $sh.  Catch re-use of such
2131                 : an old config.sh.
2132                 case "$sh" in
2133                 '') sh="$tmp_sh" ;;
2134                 esac
2135                 hint=previous
2136                 ;;
2137         esac
2138 fi
2139 if test ! -f config.sh; then
2140         $cat <<EOM
2141
2142 First time through, eh?  I have some defaults handy for some systems
2143 that need some extra help getting the Configure answers right:
2144
2145 EOM
2146         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2147         dflt=''
2148         : Half the following guesses are probably wrong... If you have better
2149         : tests or hints, please send them to perlbug@perl.com
2150         : The metaconfig authors would also appreciate a copy...
2151         $test -f /irix && osname=irix
2152         $test -f /xenix && osname=sco_xenix
2153         $test -f /dynix && osname=dynix
2154         $test -f /dnix && osname=dnix
2155         $test -f /lynx.os && osname=lynxos
2156         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2157         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2158         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2159         $test -f /bin/mips && /bin/mips && osname=mips
2160         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2161                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2162         $test -d /usr/apollo/bin && osname=apollo
2163         $test -f /etc/saf/_sactab && osname=svr4
2164         $test -d /usr/include/minix && osname=minix
2165         if $test -d /MachTen -o -d /MachTen_Folder; then
2166                 osname=machten
2167                 if $test -x /sbin/version; then
2168                         osvers=`/sbin/version | $awk '{print $2}' |
2169                         $sed -e 's/[A-Za-z]$//'`
2170                 elif $test -x /usr/etc/version; then
2171                         osvers=`/usr/etc/version | $awk '{print $2}' |
2172                         $sed -e 's/[A-Za-z]$//'`
2173                 else
2174                         osvers="$2.$3"
2175                 fi
2176         fi
2177
2178         $test -f /sys/posix.dll &&
2179                 $test -f /usr/bin/what &&
2180                 set X `/usr/bin/what /sys/posix.dll` &&
2181                 $test "$3" = UWIN &&
2182                 osname=uwin &&
2183                 osvers="$5"
2184
2185         if $test -f $uname; then
2186                 set X $myuname
2187                 shift
2188
2189                 case "$5" in
2190                 fps*) osname=fps ;;
2191                 mips*)
2192                         case "$4" in
2193                         umips) osname=umips ;;
2194                         *) osname=mips ;;
2195                         esac;;
2196                 [23]100) osname=mips ;;
2197                 next*) osname=next ;;
2198                 i386*)
2199                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2200                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2201                                 osname='sco'
2202                                 osvers=$tmp
2203                         elif $test -f /etc/kconfig; then
2204                                 osname=isc
2205                                 if test "$lns" = "$ln -s"; then
2206                                         osvers=4
2207                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2208                                         osvers=3
2209                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2210                                         osvers=2
2211                                 fi
2212                         fi
2213                         tmp=''
2214                         ;;
2215                 pc*)
2216                         if test -n "$DJGPP"; then
2217                                 osname=dos
2218                                 osvers=djgpp
2219                         fi
2220                         ;;
2221                 esac
2222
2223                 case "$1" in
2224                 aix) osname=aix
2225                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2226                         case "$tmp" in
2227                         'not found') osvers="$4"."$3" ;;
2228                         '<3240'|'<>3240') osvers=3.2.0 ;;
2229                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2230                         '=3250'|'>3250') osvers=3.2.5 ;;
2231                         *) osvers=$tmp;;
2232                         esac
2233                         ;;
2234                 bsd386) osname=bsd386
2235                         osvers=`$uname -r`
2236                         ;;
2237                 cygwin*) osname=cygwin
2238                         osvers="$3"
2239                         ;;
2240                 *dc.osx) osname=dcosx
2241                         osvers="$3"
2242                         ;;
2243                 dnix) osname=dnix
2244                         osvers="$3"
2245                         ;;
2246                 domainos) osname=apollo
2247                         osvers="$3"
2248                         ;;
2249                 dgux) osname=dgux 
2250                         osvers="$3"
2251                         ;;
2252                 dynixptx*) osname=dynixptx
2253                         osvers=`echo "$4"|sed 's/^v//'`
2254                         ;;
2255                 freebsd) osname=freebsd 
2256                         osvers="$3" ;;
2257                 genix) osname=genix ;;
2258                 hp*) osname=hpux 
2259                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2260                         ;;
2261                 irix*) osname=irix
2262                         case "$3" in
2263                         4*) osvers=4 ;;
2264                         5*) osvers=5 ;;
2265                         *)      osvers="$3" ;;
2266                         esac
2267                         ;;
2268                 linux) osname=linux
2269                         case "$3" in
2270                         *)      osvers="$3" ;;
2271                         esac
2272                         ;;
2273                 MiNT) osname=mint
2274                         ;;
2275                 netbsd*) osname=netbsd
2276                         osvers="$3"
2277                         ;;
2278                 news-os) osvers="$3"
2279                         case "$3" in
2280                         4*) osname=newsos4 ;;
2281                         *) osname=newsos ;;
2282                         esac
2283                         ;;
2284                 next*) osname=next ;;
2285                 POSIX-BC | posix-bc ) osname=posix-bc
2286                         osvers="$3"
2287                         ;;
2288                 powerux | power_ux | powermax_os | powermaxos | \
2289                 powerunix | power_unix) osname=powerux
2290                         osvers="$3"
2291                         ;;
2292                 qnx) osname=qnx
2293                         osvers="$4"
2294                         ;;
2295                 solaris) osname=solaris
2296                         case "$3" in
2297                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2298                         *)      osvers="$3" ;;
2299                         esac
2300                         ;;
2301                 sunos) osname=sunos
2302                         case "$3" in
2303                         5*) osname=solaris
2304                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2305                         *)      osvers="$3" ;;
2306                         esac
2307                         ;;
2308                 titanos) osname=titanos
2309                         case "$3" in
2310                         1*) osvers=1 ;;
2311                         2*) osvers=2 ;;
2312                         3*) osvers=3 ;;
2313                         4*) osvers=4 ;;
2314                         *)      osvers="$3" ;;
2315                         esac
2316                         ;;
2317                 ultrix) osname=ultrix
2318                         osvers="$3"
2319                         ;;
2320                 osf1|mls+)      case "$5" in
2321                                 alpha)
2322                                         osname=dec_osf
2323                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2324                                         ;;
2325                         hp*)    osname=hp_osf1  ;;
2326                         mips)   osname=mips_osf1 ;;
2327                         esac
2328                         ;;
2329                 unixware) osname=svr5
2330                         osvers="$4"
2331                         ;;
2332                 uts) osname=uts
2333                         osvers="$3"
2334                         ;;
2335                 $2) case "$osname" in
2336                         *isc*) ;;
2337                         *freebsd*) ;;
2338                         svr*)
2339                                 : svr4.x or possibly later
2340                                 case "svr$3" in 
2341                                 ${osname}*)
2342                                         osname=svr$3
2343                                         osvers=$4
2344                                         ;;
2345                                 esac
2346                                 case "$osname" in
2347                                 svr4.0)
2348                                         : Check for ESIX
2349                                         if test -f /stand/boot ; then
2350                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2351                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2352                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2353                                                         if test -n "$isesix"; then
2354                                                                 osname=esix4
2355                                                         fi
2356                                                 fi
2357                                         fi
2358                                         ;;
2359                                 esac
2360                                 ;;
2361                         *)      if test -f /etc/systemid; then
2362                                         osname=sco
2363                                         set `echo $3 | $sed 's/\./ /g'` $4
2364                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2365                                                 osvers=$1.$2.$3
2366                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2367                                                 osvers=$1.$2
2368                                         elif $test -f $src/hints/sco_$1.sh; then
2369                                                 osvers=$1
2370                                         fi
2371                                 else
2372                                         case "$osname" in
2373                                         '') : Still unknown.  Probably a generic Sys V.
2374                                                 osname="sysv"
2375                                                 osvers="$3"
2376                                                 ;;
2377                                         esac
2378                                 fi
2379                                 ;;
2380                         esac
2381                         ;;
2382                 *)      case "$osname" in
2383                         '') : Still unknown.  Probably a generic BSD.
2384                                 osname="$1"
2385                                 osvers="$3"
2386                                 ;;
2387                         esac
2388                         ;;
2389                 esac
2390         else
2391                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2392                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2393                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2394                                 osname=news_os
2395                         fi
2396                         $rm -f UU/kernel.what
2397                 elif test -d c:/.; then
2398                         set X $myuname
2399                         osname=os2
2400                         osvers="$5"
2401                 fi
2402         fi
2403         
2404         : Now look for a hint file osname_osvers, unless one has been
2405         : specified already.
2406         case "$hintfile" in
2407         ''|' ')
2408                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2409                 : Also try without trailing minor version numbers.
2410                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2411                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2412                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2413                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2414                 case "$file" in
2415                 '') dflt=none ;;
2416                 *)  case "$osvers" in
2417                         '') dflt=$file
2418                                 ;;
2419                         *)  if $test -f $src/hints/$file.sh ; then
2420                                         dflt=$file
2421                                 elif $test -f $src/hints/$xfile.sh ; then
2422                                         dflt=$xfile
2423                                 elif $test -f $src/hints/$xxfile.sh ; then
2424                                         dflt=$xxfile
2425                                 elif $test -f $src/hints/$xxxfile.sh ; then
2426                                         dflt=$xxxfile
2427                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2428                                         dflt=$xxxxfile
2429                                 elif $test -f "$src/hints/${osname}.sh" ; then
2430                                         dflt="${osname}"
2431                                 else
2432                                         dflt=none
2433                                 fi
2434                                 ;;
2435                         esac
2436                         ;;
2437                 esac
2438                 if $test -f Policy.sh ; then
2439                         case "$dflt" in
2440                         *Policy*) ;;
2441                         none) dflt="Policy" ;;
2442                         *) dflt="Policy $dflt" ;;
2443                         esac
2444                 fi
2445                 ;;
2446         *)
2447                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2448                 ;;
2449         esac
2450
2451         if $test -f Policy.sh ; then
2452                 $cat <<EOM
2453
2454 There's also a Policy hint file available, which should make the
2455 site-specific (policy) questions easier to answer.
2456 EOM
2457
2458         fi
2459
2460         $cat <<EOM
2461
2462 You may give one or more space-separated answers, or "none" if appropriate.
2463 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2464 is a good thing.  DO NOT give a wrong version or a wrong OS.
2465
2466 EOM
2467
2468         rp="Which of these apply, if any?"
2469         . UU/myread
2470         tans=$ans
2471         for file in $tans; do
2472                 if $test X$file = XPolicy -a -f Policy.sh; then
2473                         . Policy.sh
2474                         $cat Policy.sh >> UU/config.sh
2475                 elif $test -f $src/hints/$file.sh; then
2476                         . $src/hints/$file.sh
2477                         $cat $src/hints/$file.sh >> UU/config.sh
2478                 elif $test X$tans = X -o X$tans = Xnone ; then
2479                         : nothing
2480                 else
2481                         : Give one chance to correct a possible typo.
2482                         echo "$file.sh does not exist"
2483                         dflt=$file
2484                         rp="hint to use instead?"
2485                         . UU/myread
2486                         for file in $ans; do
2487                                 if $test -f "$src/hints/$file.sh"; then
2488                                         . $src/hints/$file.sh
2489                                         $cat $src/hints/$file.sh >> UU/config.sh
2490                                 elif $test X$ans = X -o X$ans = Xnone ; then
2491                                         : nothing
2492                                 else
2493                                         echo "$file.sh does not exist -- ignored."
2494                                 fi
2495                         done
2496                 fi
2497         done
2498
2499         hint=recommended
2500         : Remember our hint file for later.
2501         if $test -f "$src/hints/$file.sh" ; then
2502                 hintfile="$file"
2503         else
2504                 hintfile=''
2505         fi
2506 fi
2507 cd UU
2508 ;;
2509 *)
2510         echo " "
2511         echo "Fetching default answers from $config_sh..." >&4
2512         tmp_n="$n"
2513         tmp_c="$c"
2514         cd ..
2515         cp $config_sh config.sh 2>/dev/null
2516         chmod +w config.sh
2517         . ./config.sh
2518         cd UU
2519         cp ../config.sh .
2520         n="$tmp_n"
2521         c="$tmp_c"
2522         hint=previous
2523         ;;
2524 esac
2525 test "$override" && . ./optdef.sh
2526 myuname="$newmyuname"
2527
2528 : Restore computed paths
2529 for file in $loclist $trylist; do
2530         eval $file="\$_$file"
2531 done
2532
2533 cat << EOM
2534
2535 Configure uses the operating system name and version to set some defaults.
2536 The default value is probably right if the name rings a bell. Otherwise,
2537 since spelling matters for me, either accept the default or answer "none"
2538 to leave it blank.
2539
2540 EOM
2541 case "$osname" in
2542         ''|' ')
2543                 case "$hintfile" in
2544                 ''|' '|none) dflt=none ;;
2545                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2546                 esac
2547                 ;;
2548         *) dflt="$osname" ;;
2549 esac
2550 rp="Operating system name?"
2551 . ./myread
2552 case "$ans" in
2553 none)  osname='' ;;
2554 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2555 esac
2556 echo " "
2557 case "$osvers" in
2558         ''|' ')
2559                 case "$hintfile" in
2560                 ''|' '|none) dflt=none ;;
2561                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2562                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2563                         case "$dflt" in
2564                         ''|' ') dflt=none ;;
2565                         esac
2566                         ;;
2567                 esac
2568                 ;;
2569         *) dflt="$osvers" ;;
2570 esac
2571 rp="Operating system version?"
2572 . ./myread
2573 case "$ans" in
2574 none)  osvers='' ;;
2575 *) osvers="$ans" ;;
2576 esac
2577
2578
2579 . ./posthint.sh
2580
2581 : who configured the system
2582 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2583 cf_by=`(logname) 2>/dev/null`
2584 case "$cf_by" in
2585 "")
2586         cf_by=`(whoami) 2>/dev/null`
2587         case "$cf_by" in
2588         "") cf_by=unknown ;;
2589         esac ;;
2590 esac
2591
2592 : set up the script used to warn in case of inconsistency
2593 cat <<EOS >whoa
2594 $startsh
2595 EOS
2596 cat <<'EOSC' >>whoa
2597 dflt=y
2598 echo " "
2599 echo "*** WHOA THERE!!! ***" >&4
2600 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2601 rp="    Keep the $hint value?"
2602 . ./myread
2603 case "$ans" in
2604 y) td=$was; tu=$was;;
2605 esac
2606 EOSC
2607
2608 : function used to set $1 to $val
2609 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2610 case "$val$was" in
2611 $define$undef) . ./whoa; eval "$var=\$td";;
2612 $undef$define) . ./whoa; eval "$var=\$tu";;
2613 *) eval "$var=$val";;
2614 esac'
2615
2616 case "$usethreads" in
2617 $define|true|[yY]*)     dflt='y';;
2618 *) dflt='n';;
2619 esac
2620 cat <<EOM
2621
2622 Perl can be built to take advantage of threads on some systems.
2623 To do so, Configure can be run with -Dusethreads.
2624
2625 Note that threading is a highly experimental feature, and
2626 some known race conditions still remain.  If you choose to try
2627 it, be very sure to not actually deploy it for production
2628 purposes.  README.threads has more details, and is required
2629 reading if you enable threads.
2630
2631 If this doesn't make any sense to you, just accept the default '$dflt'.
2632 EOM
2633 rp='Build a threading Perl?'
2634 . ./myread
2635 case "$ans" in
2636 y|Y)    val="$define" ;;
2637 *)      val="$undef" ;;
2638 esac
2639 set usethreads
2640 eval $setvar
2641
2642 case "$usethreads" in
2643 $define)
2644         $cat <<EOM
2645
2646 As of 5.5.640, Perl has two different internal threading implementations,
2647 the 5.005 version (5005threads) and an interpreter-based version
2648 (ithreads) that has one interpreter per thread.  Both are very 
2649 experimental.  This arrangement exists to help developers work out
2650 which one is better.
2651
2652 If you're a casual user, you probably don't want interpreter-threads
2653 at this time.  There doesn't yet exist a way to create threads from
2654 within Perl in this model, i.e., "use Thread;" will NOT work.
2655 EOM
2656         : Default to ithreads unless overridden on command line or with
2657         : old config.sh
2658         dflt='y'
2659         case "$use5005threads" in
2660                 $define|true|[yY]*) dflt='n';;
2661         esac
2662         case "$useithreads" in
2663                 $undef|false|[nN]*) dflt='n';;
2664         esac
2665         rp='Use interpreter-based ithreads?'
2666         . ./myread
2667         case "$ans" in
2668         y|Y)    val="$define" ;;
2669         *)      val="$undef" ;;
2670         esac
2671         set useithreads
2672         eval $setvar
2673         : Now set use5005threads to the opposite value.
2674         case "$useithreads" in
2675         $define) val="$undef" ;;
2676         *) val="$define" ;;
2677         esac
2678         set use5005threads
2679         eval $setvar
2680         ;;
2681 *)
2682         useithreads="$undef"
2683         use5005threads="$undef"
2684         ;;
2685 esac
2686
2687 case "$d_oldpthreads" in
2688 '')     : Configure tests would be welcome here.  For now, assume undef.
2689         val="$undef" ;;
2690 *)      val="$d_oldpthreads" ;;
2691 esac
2692 set d_oldpthreads
2693 eval $setvar
2694
2695
2696 case "$usethreads" in
2697 "$define"|true|[yY]*)
2698 : Look for a hint-file generated 'call-back-unit'.  If the
2699 : user has specified that a threading perl is to be built,
2700 : we may need to set or change some other defaults.
2701         if $test -f usethreads.cbu; then
2702                 echo "Your platform has some specific hints for threaded builds, using them..."
2703                 . ./usethreads.cbu
2704         else
2705                 $cat <<EOM
2706 (Your platform doesn't have any specific hints for threaded builds.
2707  Assuming POSIX threads, then.)
2708 EOM
2709         fi
2710         ;;
2711 esac
2712
2713 cat <<EOM
2714
2715 Perl can be built so that multiple Perl interpreters can coexist
2716 within the same Perl executable.
2717 EOM
2718
2719 case "$useithreads" in
2720 $define)
2721         cat <<EOM
2722 This multiple interpreter support is required for interpreter-based threads.
2723 EOM
2724         val="$define"
2725         ;;
2726 *)      case "$usemultiplicity" in
2727         $define|true|[yY]*)     dflt='y';;
2728         *) dflt='n';;
2729         esac
2730         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2731         rp='Build Perl for multiplicity?'
2732         . ./myread
2733         case "$ans" in
2734         y|Y)    val="$define" ;;
2735         *)      val="$undef" ;;
2736         esac
2737         ;;
2738 esac
2739 set usemultiplicity
2740 eval $setvar
2741
2742 : determine where manual pages are on this system
2743 echo " "
2744 case "$sysman" in
2745 '') 
2746         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2747         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2748         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2749         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2750         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2751         sysman=`./loc . /usr/man/man1 $syspath`
2752         ;;
2753 esac
2754 if $test -d "$sysman"; then
2755         echo "System manual is in $sysman." >&4
2756 else
2757         echo "Could not find manual pages in source form." >&4
2758 fi
2759
2760 : see what memory models we can support
2761 case "$models" in
2762 '')
2763         $cat >pdp11.c <<'EOP'
2764 int main() {
2765 #ifdef pdp11
2766         exit(0);
2767 #else
2768         exit(1);
2769 #endif
2770 }
2771 EOP
2772         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2773         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2774                 dflt='unsplit split'
2775         else
2776                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2777                 case "$tans" in
2778                 X) dflt='none';;
2779                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2780                                 dflt='small'
2781                         else
2782                                 dflt=''
2783                         fi
2784                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2785                                 dflt="$dflt medium"
2786                         fi
2787                         if $test -d /lib/large || $test -d /usr/lib/large; then
2788                                 dflt="$dflt large"
2789                         fi
2790                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2791                                 dflt="$dflt huge"
2792                         fi
2793                 esac
2794         fi;;
2795 *) dflt="$models";;
2796 esac
2797 $cat <<EOM
2798  
2799 Some systems have different model sizes.  On most systems they are called
2800 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2801 split.  If your system doesn't support different memory models, say "none".
2802 If you wish to force everything to one memory model, say "none" here and
2803 put the appropriate flags later when it asks you for other cc and ld flags.
2804 Venix systems may wish to put "none" and let the compiler figure things out.
2805 (In the following question multiple model names should be space separated.)
2806
2807 The default for most systems is "none".
2808
2809 EOM
2810 rp="Which memory models are supported?"
2811 . ./myread
2812 models="$ans"
2813
2814 case "$models" in
2815 none)
2816         small=''
2817         medium=''
2818         large=''
2819         huge=''
2820         unsplit=''
2821         split=''
2822         ;;
2823 *split)
2824         case "$split" in
2825         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2826                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2827                         dflt='-i'
2828                 else
2829                         dflt='none'
2830                 fi;;
2831         *) dflt="$split";;
2832         esac
2833         rp="What flag indicates separate I and D space?"
2834         . ./myread
2835         tans="$ans"
2836         case "$tans" in
2837         none) tans='';;
2838         esac
2839         split="$tans"
2840         unsplit='';;
2841 *large*|*small*|*medium*|*huge*)
2842         case "$models" in
2843         *large*)
2844                 case "$large" in
2845                 '') dflt='-Ml';;
2846                 *) dflt="$large";;
2847                 esac
2848         rp="What flag indicates large model?"
2849         . ./myread
2850         tans="$ans"
2851         case "$tans" in
2852         none) tans='';
2853         esac
2854         large="$tans";;
2855         *) large='';;
2856         esac
2857         case "$models" in
2858         *huge*) case "$huge" in
2859                 '') dflt='-Mh';;
2860                 *) dflt="$huge";;
2861                 esac
2862                 rp="What flag indicates huge model?"
2863                 . ./myread
2864                 tans="$ans"
2865                 case "$tans" in
2866                 none) tans='';
2867                 esac
2868                 huge="$tans";;
2869         *) huge="$large";;
2870         esac
2871         case "$models" in
2872         *medium*) case "$medium" in
2873                 '') dflt='-Mm';;
2874                 *) dflt="$medium";;
2875                 esac
2876                 rp="What flag indicates medium model?"
2877                 . ./myread
2878                 tans="$ans"
2879                 case "$tans" in
2880                 none) tans='';
2881                 esac
2882                 medium="$tans";;
2883         *) medium="$large";;
2884         esac
2885         case "$models" in
2886         *small*) case "$small" in
2887                 '') dflt='none';;
2888                 *) dflt="$small";;
2889                 esac
2890                 rp="What flag indicates small model?"
2891                 . ./myread
2892                 tans="$ans"
2893                 case "$tans" in
2894                 none) tans='';
2895                 esac
2896                 small="$tans";;
2897         *) small='';;
2898         esac
2899         ;;
2900 *)
2901         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2902         ;;
2903 esac
2904 $rm -f pdp11.* pdp11
2905
2906 : make some quick guesses about what we are up against
2907 echo " "
2908 $echo $n "Hmm...  $c"
2909 echo exit 1 >bsd
2910 echo exit 1 >usg
2911 echo exit 1 >v7
2912 echo exit 1 >osf1
2913 echo exit 1 >eunice
2914 echo exit 1 >xenix
2915 echo exit 1 >venix
2916 echo exit 1 >os2
2917 d_bsd="$undef"
2918 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2919 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2920 then
2921         echo "Looks kind of like an OSF/1 system, but we'll see..."
2922         echo exit 0 >osf1
2923 elif test `echo abc | tr a-z A-Z` = Abc ; then
2924         xxx=`./loc addbib blurfl $pth`
2925         if $test -f $xxx; then
2926         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2927                 echo exit 0 >bsd
2928                 echo exit 0 >usg
2929         else
2930                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2931                         echo "Looks kind of like an extended USG system, but we'll see..."
2932                 else
2933                         echo "Looks kind of like a USG system, but we'll see..."
2934                 fi
2935                 echo exit 0 >usg
2936         fi
2937 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2938         echo "Looks kind of like a BSD system, but we'll see..."
2939         d_bsd="$define"
2940         echo exit 0 >bsd
2941 else
2942         echo "Looks kind of like a Version 7 system, but we'll see..."
2943         echo exit 0 >v7
2944 fi
2945 case "$eunicefix" in
2946 *unixtovms*)
2947         $cat <<'EOI'
2948 There is, however, a strange, musty smell in the air that reminds me of
2949 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2950 EOI
2951         echo exit 0 >eunice
2952         d_eunice="$define"
2953 : it so happens the Eunice I know will not run shell scripts in Unix format
2954         ;;
2955 *)
2956         echo " "
2957         echo "Congratulations.  You aren't running Eunice."
2958         d_eunice="$undef"
2959         ;;
2960 esac
2961 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2962 case "$p_" in
2963 :) ;;
2964 *)
2965         $cat <<'EOI'
2966 I have the feeling something is not exactly right, however...don't tell me...
2967 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2968 EOI
2969         echo exit 0 >os2
2970         ;;
2971 esac
2972 if test -f /xenix; then
2973         echo "Actually, this looks more like a XENIX system..."
2974         echo exit 0 >xenix
2975         d_xenix="$define"
2976 else
2977         echo " "
2978         echo "It's not Xenix..."
2979         d_xenix="$undef"
2980 fi
2981 chmod +x xenix
2982 $eunicefix xenix
2983 if test -f /venix; then
2984         echo "Actually, this looks more like a VENIX system..."
2985         echo exit 0 >venix
2986 else
2987         echo " "
2988         if ./xenix; then
2989                 : null
2990         else
2991                 echo "Nor is it Venix..."
2992         fi
2993 fi
2994 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2995 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2996 $rm -f foo
2997
2998 : see if we need a special compiler
2999 echo " "
3000 if ./usg; then
3001         case "$cc" in
3002         '') case "$Mcc" in
3003                 /*) dflt='Mcc';;
3004                 *) case "$large" in
3005                         -M*) dflt='cc';;
3006                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3007                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3008                                                 dflt='cc'
3009                                         else
3010                                                 dflt='cc -M'
3011                                         fi
3012                                 else
3013                                         dflt='cc'
3014                                 fi;;
3015                         esac;;
3016                 esac;;
3017         *)  dflt="$cc";;
3018         esac
3019         case "$dflt" in
3020         *M*)    $cat <<'EOM'
3021 On some older systems the default C compiler will not resolve multiple global
3022 references that happen to have the same name.  On some such systems the "Mcc"
3023 command may be used to force these to be resolved.  On other systems a "cc -M"
3024 command is required.  (Note that the -M flag on other systems indicates a
3025 memory model to use!) If you have the Gnu C compiler, you might wish to use
3026 that instead.
3027
3028 EOM
3029         ;;
3030         esac
3031         rp="Use which C compiler?"
3032         . ./myread
3033         cc="$ans"
3034 else
3035         case "$cc" in
3036         '') dflt=cc;;
3037         *) dflt="$cc";;
3038         esac
3039         rp="Use which C compiler?"
3040         . ./myread
3041         cc="$ans"
3042 fi
3043 : Look for a hint-file generated 'call-back-unit'.  Now that the
3044 : user has specified the compiler, we may need to set or change some
3045 : other defaults.
3046 if $test -f cc.cbu; then
3047     . ./cc.cbu
3048 fi
3049 echo " "
3050 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3051 $cat >gccvers.c <<EOM
3052 #include <stdio.h>
3053 int main() {
3054 #ifdef __GNUC__
3055 #ifdef __VERSION__
3056         printf("%s\n", __VERSION__);
3057 #else
3058         printf("%s\n", "1");
3059 #endif
3060 #endif
3061         exit(0);
3062 }
3063 EOM
3064 if $cc $ldflags -o gccvers gccvers.c; then
3065         gccversion=`./gccvers`
3066         case "$gccversion" in
3067         '') echo "You are not using GNU cc." ;;
3068         *)  echo "You are using GNU cc $gccversion."
3069             ;;
3070         esac
3071 else
3072         echo " "
3073         echo "*** WHOA THERE!!! ***" >&4
3074         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3075         case "$knowitall" in
3076         '')
3077         echo "    You'd better start hunting for one and let me know about it." >&4
3078                 exit 1
3079                 ;;
3080         esac
3081 fi
3082 $rm -f gccvers*
3083 case "$gccversion" in
3084 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3085 esac
3086
3087 : decide how portable to be.  Allow command line overrides.
3088 case "$d_portable" in
3089 "$undef") ;;
3090 *)      d_portable="$define" ;;
3091 esac
3092
3093 : set up shell script to do ~ expansion
3094 cat >filexp <<EOSS
3095 $startsh
3096 : expand filename
3097 case "\$1" in
3098  ~/*|~)
3099         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3100         ;;
3101  ~*)
3102         if $test -f /bin/csh; then
3103                 /bin/csh -f -c "glob \$1"
3104                 failed=\$?
3105                 echo ""
3106                 exit \$failed
3107         else
3108                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3109                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3110                 if $test ! -d "\$dir"; then
3111                         me=\`basename \$0\`
3112                         echo "\$me: can't locate home directory for: \$name" >&2
3113                         exit 1
3114                 fi
3115                 case "\$1" in
3116                 */*)
3117                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3118                         ;;
3119                 *)
3120                         echo \$dir
3121                         ;;
3122                 esac
3123         fi
3124         ;;
3125 *)
3126         echo \$1
3127         ;;
3128 esac
3129 EOSS
3130 chmod +x filexp
3131 $eunicefix filexp
3132
3133 : now set up to get a file name
3134 cat <<EOS >getfile
3135 $startsh
3136 EOS
3137 cat <<'EOSC' >>getfile
3138 tilde=''
3139 fullpath=''
3140 already=''
3141 skip=''
3142 none_ok=''
3143 exp_file=''
3144 nopath_ok=''
3145 orig_rp="$rp"
3146 orig_dflt="$dflt"
3147 case "$gfpth" in
3148 '') gfpth='.' ;;
3149 esac
3150
3151 case "$fn" in
3152 *\(*)
3153         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3154         fn=`echo $fn | sed 's/(.*)//'`
3155         ;;
3156 esac
3157
3158 case "$fn" in
3159 *:*)
3160         loc_file=`expr $fn : '.*:\(.*\)'`
3161         fn=`expr $fn : '\(.*\):.*'`
3162         ;;
3163 esac
3164
3165 case "$fn" in
3166 *~*) tilde=true;;
3167 esac
3168 case "$fn" in
3169 */*) fullpath=true;;
3170 esac
3171 case "$fn" in
3172 *+*) skip=true;;
3173 esac
3174 case "$fn" in
3175 *n*) none_ok=true;;
3176 esac
3177 case "$fn" in
3178 *e*) exp_file=true;;
3179 esac
3180 case "$fn" in
3181 *p*) nopath_ok=true;;
3182 esac
3183
3184 case "$fn" in
3185 *f*) type='File';;
3186 *d*) type='Directory';;
3187 *l*) type='Locate';;
3188 esac
3189
3190 what="$type"
3191 case "$what" in
3192 Locate) what='File';;
3193 esac
3194
3195 case "$exp_file" in
3196 '')
3197         case "$d_portable" in
3198         "$define") ;;
3199         *) exp_file=true;;
3200         esac
3201         ;;
3202 esac
3203
3204 cd ..
3205 while test "$type"; do
3206         redo=''
3207         rp="$orig_rp"
3208         dflt="$orig_dflt"
3209         case "$tilde" in
3210         true) rp="$rp (~name ok)";;
3211         esac
3212         . UU/myread
3213         if test -f UU/getfile.ok && \
3214                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3215         then
3216                 value="$ans"
3217                 ansexp="$ans"
3218                 break
3219         fi
3220         case "$ans" in
3221         none)
3222                 value=''
3223                 ansexp=''
3224                 case "$none_ok" in
3225                 true) type='';;
3226                 esac
3227                 ;;
3228         *)
3229                 case "$tilde" in
3230                 '') value="$ans"
3231                         ansexp="$ans";;
3232                 *)
3233                         value=`UU/filexp $ans`
3234                         case $? in
3235                         0)
3236                                 if test "$ans" != "$value"; then
3237                                         echo "(That expands to $value on this system.)"
3238                                 fi
3239                                 ;;
3240                         *) value="$ans";;
3241                         esac
3242                         ansexp="$value"
3243                         case "$exp_file" in
3244                         '') value="$ans";;
3245                         esac
3246                         ;;
3247                 esac
3248                 case "$fullpath" in
3249                 true)
3250                         case "$ansexp" in
3251                         /*) value="$ansexp" ;;
3252                         *)
3253                                 redo=true
3254                                 case "$already" in
3255                                 true)
3256                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3257                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3258                                         ;;
3259                                 *)
3260                                 echo "Please give a full path name, starting with slash." >&4
3261                                         case "$tilde" in
3262                                         true)
3263                                 echo "Note that using ~name is ok provided it expands well." >&4
3264                                                 already=true
3265                                                 ;;
3266                                         esac
3267                                 esac
3268                                 ;;
3269                         esac
3270                         ;;
3271                 esac
3272                 case "$redo" in
3273                 '')
3274                         case "$type" in
3275                         File)
3276                                 for fp in $gfpth; do
3277                                         if test "X$fp" = X.; then
3278                                             pf="$ansexp"
3279                                         else    
3280                                             pf="$fp/$ansexp"
3281                                         fi
3282                                         if test -f "$pf"; then
3283                                                 type=''
3284                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3285                                         then
3286                                                 echo "($value is not a plain file, but that's ok.)"
3287                                                 type=''
3288                                         fi
3289                                         if test X"$type" = X; then
3290                                             value="$pf"
3291                                             break
3292                                         fi
3293                                 done
3294                                 ;;
3295                         Directory)
3296                                 for fp in $gfpth; do
3297                                         if test "X$fp" = X.; then
3298                                             pf="$ansexp"
3299                                         else    
3300                                             pf="$fp/$ansexp"
3301                                         fi
3302                                         if test -d "$pf"; then
3303                                                 type=''
3304                                                 value="$pf"
3305                                                 break
3306                                         fi
3307                                 done
3308                                 ;;
3309                         Locate)
3310                                 if test -d "$ansexp"; then
3311                                         echo "(Looking for $loc_file in directory $value.)"
3312                                         value="$value/$loc_file"
3313                                         ansexp="$ansexp/$loc_file"
3314                                 fi
3315                                 if test -f "$ansexp"; then
3316                                         type=''
3317                                 fi
3318                                 case "$nopath_ok" in
3319                                 true)   case "$value" in
3320                                         */*) ;;
3321                                         *)      echo "Assuming $value will be in people's path."
3322                                                 type=''
3323                                                 ;;
3324                                         esac
3325                                         ;;
3326                                 esac
3327                                 ;;
3328                         esac
3329
3330                         case "$skip" in
3331                         true) type='';
3332                         esac
3333
3334                         case "$type" in
3335                         '') ;;
3336                         *)
3337                                 if test "$fastread" = yes; then
3338                                         dflt=y
3339                                 else
3340                                         dflt=n
3341                                 fi
3342                                 rp="$what $value doesn't exist.  Use that name anyway?"
3343                                 . UU/myread
3344                                 dflt=''
3345                                 case "$ans" in
3346                                 y*) type='';;
3347                                 *) echo " ";;
3348                                 esac
3349                                 ;;
3350                         esac
3351                         ;;
3352                 esac
3353                 ;;
3354         esac
3355 done
3356 cd UU
3357 ans="$value"
3358 rp="$orig_rp"
3359 dflt="$orig_dflt"
3360 rm -f getfile.ok
3361 test "X$gfpthkeep" != Xy && gfpth=""
3362 EOSC
3363
3364 : What should the include directory be ?
3365 echo " "
3366 $echo $n "Hmm...  $c"
3367 dflt='/usr/include'
3368 incpath=''
3369 mips_type=''
3370 if $test -f /bin/mips && /bin/mips; then
3371         echo "Looks like a MIPS system..."
3372         $cat >usr.c <<'EOCP'
3373 #ifdef SYSTYPE_BSD43
3374 /bsd43
3375 #endif
3376 EOCP
3377         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3378                 dflt='/bsd43/usr/include'
3379                 incpath='/bsd43'
3380                 mips_type='BSD 4.3'
3381         else
3382                 mips_type='System V'
3383         fi
3384         $rm -f usr.c usr.out
3385         echo "and you're compiling with the $mips_type compiler and libraries."
3386         xxx_prompt=y
3387         echo "exit 0" >mips
3388 else
3389         echo "Doesn't look like a MIPS system."
3390         xxx_prompt=n
3391         echo "exit 1" >mips
3392 fi
3393 chmod +x mips
3394 $eunicefix mips
3395 case "$usrinc" in
3396 '') ;;
3397 *) dflt="$usrinc";;
3398 esac
3399 case "$xxx_prompt" in
3400 y)      fn=d/
3401         echo " "
3402         rp='Where are the include files you want to use?'
3403         . ./getfile
3404         usrinc="$ans"
3405         ;;
3406 *)      usrinc="$dflt"
3407         ;;
3408 esac
3409
3410 : see how we invoke the C preprocessor
3411 echo " "
3412 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3413 cat <<'EOT' >testcpp.c
3414 #define ABC abc
3415 #define XYZ xyz
3416 ABC.XYZ
3417 EOT
3418 cd ..
3419 if test ! -f cppstdin; then
3420         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3421                 # AIX cc -E doesn't show the absolute headerfile
3422                 # locations but we'll cheat by using the -M flag.
3423                 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
3424         else
3425                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3426         fi
3427 else
3428         echo "Keeping your $hint cppstdin wrapper."
3429 fi
3430 chmod 755 cppstdin
3431 wrapper=`pwd`/cppstdin
3432 ok='false'
3433 cd UU
3434
3435 if $test "X$cppstdin" != "X" && \
3436         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3437         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3438 then
3439         echo "You used to use $cppstdin $cppminus so we'll use that again."
3440         case "$cpprun" in
3441         '') echo "But let's see if we can live without a wrapper..." ;;
3442         *)
3443                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3444                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3445                 then
3446                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3447                         ok='true'
3448                 else
3449                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3450                 fi
3451                 ;;
3452         esac
3453 else
3454         case "$cppstdin" in
3455         '') ;;
3456         *)
3457                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3458                 ;;
3459         esac
3460 fi
3461
3462 if $ok; then
3463         : nothing
3464 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3465         $cc -E <testcpp.c >testcpp.out 2>&1; \
3466         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3467         echo "Yup, it does."
3468         x_cpp="$cc -E"
3469         x_minus='';
3470 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3471         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3472         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3473         echo "Yup, it does."
3474         x_cpp="$cc -E"
3475         x_minus='-';
3476 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3477         $cc -P <testcpp.c >testcpp.out 2>&1; \
3478         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3479         echo "Yipee, that works!"
3480         x_cpp="$cc -P"
3481         x_minus='';
3482 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3483         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3484         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3485         echo "At long last!"
3486         x_cpp="$cc -P"
3487         x_minus='-';
3488 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3489         $cpp <testcpp.c >testcpp.out 2>&1; \
3490         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3491         echo "It works!"
3492         x_cpp="$cpp"
3493         x_minus='';
3494 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3495         $cpp - <testcpp.c >testcpp.out 2>&1; \
3496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3497         echo "Hooray, it works!  I was beginning to wonder."
3498         x_cpp="$cpp"
3499         x_minus='-';
3500 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3501         $wrapper <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         x_cpp="$wrapper"
3504         x_minus=''
3505         echo "Eureka!"
3506 else
3507         dflt=''
3508         rp="No dice.  I can't find a C preprocessor.  Name one:"
3509         . ./myread
3510         x_cpp="$ans"
3511         x_minus=''
3512         $x_cpp <testcpp.c >testcpp.out 2>&1
3513         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3514                 echo "OK, that will do." >&4
3515         else
3516 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3517                 exit 1
3518         fi
3519 fi
3520
3521 case "$ok" in
3522 false)
3523         cppstdin="$x_cpp"
3524         cppminus="$x_minus"
3525         cpprun="$x_cpp"
3526         cpplast="$x_minus"
3527         set X $x_cpp
3528         shift
3529         case "$1" in
3530         "$cpp")
3531                 echo "Perhaps can we force $cc -E using a wrapper..."
3532                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3533                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3534                 then
3535                         echo "Yup, we can."
3536                         cppstdin="$wrapper"
3537                         cppminus='';
3538                 else
3539                         echo "Nope, we'll have to live without it..."
3540                 fi
3541                 ;;
3542         esac
3543         case "$cpprun" in
3544         "$wrapper")
3545                 cpprun=''
3546                 cpplast=''
3547                 ;;
3548         esac
3549         ;;
3550 esac
3551
3552 case "$cppstdin" in
3553 "$wrapper"|'cppstdin') ;;
3554 *) $rm -f $wrapper;;
3555 esac
3556 $rm -f testcpp.c testcpp.out
3557
3558 : Set private lib path
3559 case "$plibpth" in
3560 '') if ./mips; then
3561                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3562         fi;;
3563 esac
3564 case "$libpth" in
3565 ' ') dlist='';;
3566 '') dlist="$loclibpth $plibpth $glibpth";;
3567 *) dlist="$libpth";;
3568 esac
3569
3570 : Now check and see which directories actually exist, avoiding duplicates
3571 libpth=''
3572 for xxx in $dlist
3573 do
3574     if $test -d $xxx; then
3575                 case " $libpth " in
3576                 *" $xxx "*) ;;
3577                 *) libpth="$libpth $xxx";;
3578                 esac
3579     fi
3580 done
3581 $cat <<'EOM'
3582
3583 Some systems have incompatible or broken versions of libraries.  Among
3584 the directories listed in the question below, please remove any you
3585 know not to be holding relevant libraries, and add any that are needed.
3586 Say "none" for none.
3587
3588 EOM
3589 case "$libpth" in
3590 '') dflt='none';;
3591 *)
3592         set X $libpth
3593         shift
3594         dflt=${1+"$@"}
3595         ;;
3596 esac
3597 rp="Directories to use for library searches?"
3598 . ./myread
3599 case "$ans" in
3600 none) libpth=' ';;
3601 *) libpth="$ans";;
3602 esac
3603
3604 : compute shared library extension
3605 case "$so" in
3606 '')
3607         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3608                 dflt='sl'
3609         else
3610                 dflt='so'
3611         fi
3612         ;;
3613 *) dflt="$so";;
3614 esac
3615 $cat <<EOM
3616
3617 On some systems, shared libraries may be available.  Answer 'none' if
3618 you want to suppress searching of shared libraries for the remainder
3619 of this configuration.
3620
3621 EOM
3622 rp='What is the file extension used for shared libraries?'
3623 . ./myread
3624 so="$ans"
3625
3626 : Define several unixisms.
3627 : Hints files or command line option can be used to override them.
3628 : The convoluted testing is in case hints files set either the old
3629 : or the new name.
3630 case "$_exe" in
3631 '')     case "$exe_ext" in
3632     '') ;;
3633         *)      _exe="$exe_ext" ;;
3634         esac
3635         ;;
3636 esac
3637 case "$_a" in
3638 '')     case "$lib_ext" in
3639     '') _a='.a';;
3640         *)      _a="$lib_ext" ;;
3641         esac
3642         ;;
3643 esac
3644 case "$_o" in
3645 '') case "$obj_ext" in
3646         '')     _o='.o';;
3647         *)      _o="$obj_ext";;
3648         esac
3649         ;;
3650 esac
3651 case "$p_" in
3652 '') case "$path_sep" in
3653         '')     p_=':';;
3654         *)      p_="$path_sep";;
3655         esac
3656         ;;
3657 esac
3658 exe_ext=$_exe
3659 lib_ext=$_a
3660 obj_ext=$_o
3661 path_sep=$p_
3662
3663 : Which makefile gets called first.  This is used by make depend.
3664 case "$firstmakefile" in
3665 '') firstmakefile='makefile';;
3666 esac
3667
3668 case "$usesocks" in
3669 $define|true|[yY]*)     dflt='y';;
3670 *) dflt='n';;
3671 esac
3672 cat <<EOM
3673
3674 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3675 Configure must be run with -Dusesocks.
3676
3677 If this doesn't make any sense to you, just accept the default '$dflt'.
3678 EOM
3679 rp='Build Perl for SOCKS?'
3680 . ./myread
3681 case "$ans" in
3682 y|Y)    val="$define" ;;     
3683 *)      val="$undef" ;;
3684 esac
3685 set usesocks
3686 eval $setvar
3687
3688 : Looking for optional libraries
3689 echo " "
3690 echo "Checking for optional libraries..." >&4
3691 case "$libs" in
3692 ' '|'') dflt='';;
3693 *) dflt="$libs";;
3694 esac
3695 case "$libswanted" in
3696 '') libswanted='c_s';;
3697 esac
3698 case "$usesocks" in
3699 $define)
3700         libswanted="$libswanted socks5 socks5_sh"
3701         ;;
3702 esac
3703 libsfound=''
3704 libsfiles=''
3705 libsdirs=''
3706 libspath=''
3707 for thisdir in $libpth $xlibpth; do
3708   test -d $thisdir && libspath="$libspath $thisdir"
3709 done
3710 for thislib in $libswanted; do
3711         for thisdir in $libspath; do
3712             xxx=''
3713             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3714                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3715                 $test -f "$xxx" && eval $libscheck
3716                 $test -f "$xxx" && libstyle=shared
3717             fi
3718             if test ! -f "$xxx"; then
3719                 xxx=$thisdir/lib$thislib.$so
3720                 $test -f "$xxx" && eval $libscheck
3721                 $test -f "$xxx" && libstyle=shared
3722             fi  
3723             if test ! -f "$xxx"; then
3724                 xxx=$thisdir/lib$thislib$_a
3725                 $test -f "$xxx" && eval $libscheck
3726                 $test -f "$xxx" && libstyle=static
3727             fi
3728             if test ! -f "$xxx"; then
3729                 xxx=$thisdir/$thislib$_a
3730                 $test -f "$xxx" && eval $libscheck
3731                 $test -f "$xxx" && libstyle=static
3732             fi
3733             if test ! -f "$xxx"; then
3734                 xxx=$thisdir/lib${thislib}_s$_a
3735                 $test -f "$xxx" && eval $libscheck
3736                 $test -f "$xxx" && libstyle=static
3737             fi
3738             if test ! -f "$xxx"; then
3739                 xxx=$thisdir/Slib$thislib$_a
3740                 $test -f "$xxx" && eval $libscheck
3741                 $test -f "$xxx" && libstyle=static
3742             fi
3743             if $test -f "$xxx"; then
3744                 case "$libstyle" in
3745                 shared) echo "Found -l$thislib (shared)." ;;
3746                 static) echo "Found -l$thislib." ;;
3747                 *)      echo "Found -l$thislib ($libstyle)." ;;
3748                 esac
3749                 case " $dflt " in
3750                 *"-l$thislib "*);;
3751                 *) dflt="$dflt -l$thislib"
3752                    libsfound="$libsfound $xxx"
3753                    yyy=`basename $xxx`
3754                    libsfiles="$libsfiles $yyy"
3755                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3756                    case " $libsdirs " in
3757                    *" $yyy "*) ;;
3758                    *) libsdirs="$libsdirs $yyy" ;;
3759                    esac
3760                    ;;
3761                 esac
3762                 break
3763             fi  
3764         done
3765         if $test ! -f "$xxx"; then
3766             echo "No -l$thislib."
3767         fi
3768 done
3769 set X $dflt
3770 shift
3771 dflt="$*"
3772 case "$libs" in
3773 '') dflt="$dflt";;
3774 *) dflt="$libs";;
3775 esac
3776 case "$dflt" in
3777 ' '|'') dflt='none';;
3778 esac
3779
3780 $cat <<EOM
3781
3782 In order to compile $package on your machine, a number of libraries
3783 are usually needed.  Include any other special libraries here as well.
3784 Say "none" for none.  The default list is almost always right.
3785 EOM
3786
3787 echo " "
3788 rp="What libraries to use?"
3789 . ./myread
3790 case "$ans" in
3791 none) libs=' ';;
3792 *) libs="$ans";;
3793 esac
3794
3795 : determine optimization, if desired, or use for debug flag also
3796 case "$optimize" in
3797 ' '|$undef) dflt='none';;
3798 '') dflt='-O';;
3799 *) dflt="$optimize";;
3800 esac
3801 $cat <<EOH
3802
3803 By default, $package compiles with the -O flag to use the optimizer.
3804 Alternately, you might want to use the symbolic debugger, which uses
3805 the -g flag (on traditional Unix systems).  Either flag can be
3806 specified here.  To use neither flag, specify the word "none".
3807
3808 EOH
3809 rp="What optimizer/debugger flag should be used?"
3810 . ./myread
3811 optimize="$ans"
3812 case "$optimize" in
3813 'none') optimize=" ";;
3814 esac
3815
3816 dflt=''
3817 : We will not override a previous value, but we might want to
3818 : augment a hint file
3819 case "$hint" in
3820 default|recommended)
3821         case "$gccversion" in
3822         1*) dflt='-fpcc-struct-return' ;;
3823         esac
3824         case "$optimize" in
3825         *-g*) dflt="$dflt -DDEBUGGING";;
3826         esac
3827         case "$gccversion" in
3828         2*) if test -d /etc/conf/kconfig.d &&
3829                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3830                 then
3831                         dflt="$dflt -posix"
3832                 fi
3833                 ;;
3834         esac
3835         case "$gccversion" in
3836         1*) ;;
3837         2.[0-8]*) ;;
3838         ?*)     echo " "
3839                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3840                 echo 'int main(void) { return 0; }' > gcctest.c
3841                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3842                         echo "Yes, it does." 2>&1
3843                         case "$ccflags" in
3844                         *strict-aliasing*) 
3845                                 echo "Leaving current flags $ccflags alone." 2>&1
3846                                 ;;
3847                         *) dflt="$dflt -fno-strict-aliasing" ;;
3848                         esac
3849                 else
3850                         echo "Nope, it doesn't, but that's ok." 2>&1
3851                 fi
3852                 ;;
3853         esac
3854         ;;
3855 esac
3856
3857 case "$mips_type" in
3858 *BSD*|'') inclwanted="$locincpth $usrinc";;
3859 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3860 esac
3861 for thisincl in $inclwanted; do
3862         if $test -d $thisincl; then
3863                 if $test x$thisincl != x$usrinc; then
3864                         case "$dflt" in
3865                         *$thisincl*);;
3866                         *) dflt="$dflt -I$thisincl";;
3867                         esac
3868                 fi
3869         fi
3870 done
3871
3872 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3873         xxx=true;
3874 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3875         xxx=true;
3876 else
3877         xxx=false;
3878 fi;
3879 if $xxx; then
3880         case "$dflt" in
3881         *$2*);;
3882         *) dflt="$dflt -D$2";;
3883         esac;
3884 fi'
3885
3886 set signal.h LANGUAGE_C; eval $inctest
3887
3888 case "$usesocks" in
3889 $define)
3890         ccflags="$ccflags -DSOCKS"
3891         ;;
3892 esac
3893
3894 case "$hint" in
3895 default|recommended) dflt="$ccflags $dflt" ;;
3896 *) dflt="$ccflags";;
3897 esac
3898
3899 case "$dflt" in
3900 ''|' ') dflt=none;;
3901 esac
3902 $cat <<EOH
3903
3904 Your C compiler may want other flags.  For this question you should include
3905 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3906 but you should NOT include libraries or ld flags like -lwhatever.  If you
3907 want $package to honor its debug switch, you should include -DDEBUGGING here.
3908 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3909
3910 To use no flags, specify the word "none".
3911
3912 EOH
3913 set X $dflt
3914 shift
3915 dflt=${1+"$@"}
3916 rp="Any additional cc flags?"
3917 . ./myread
3918 case "$ans" in
3919 none) ccflags='';;
3920 *) ccflags="$ans";;
3921 esac
3922
3923 : the following weeds options from ccflags that are of no interest to cpp
3924 cppflags="$ccflags"
3925 case "$gccversion" in
3926 1*) cppflags="$cppflags -D__GNUC__"
3927 esac
3928 case "$mips_type" in
3929 '');;
3930 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3931 esac
3932 case "$cppflags" in
3933 '');;
3934 *)
3935         echo " "
3936         echo "Let me guess what the preprocessor flags are..." >&4
3937         set X $cppflags
3938         shift
3939         cppflags=''
3940         $cat >cpp.c <<'EOM'
3941 #define BLURFL foo
3942
3943 BLURFL xx LFRULB
3944 EOM
3945         previous=''
3946         for flag in $*
3947         do
3948                 case "$flag" in
3949                 -*) ftry="$flag";;
3950                 *) ftry="$previous $flag";;
3951                 esac
3952                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3953                         >cpp1.out 2>/dev/null && \
3954                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3955                         >cpp2.out 2>/dev/null && \
3956                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3957                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3958                 then
3959                         cppflags="$cppflags $ftry"
3960                         previous=''
3961                 else
3962                         previous="$flag"
3963                 fi
3964         done
3965         set X $cppflags
3966         shift
3967         cppflags=${1+"$@"}
3968         case "$cppflags" in
3969         *-*)  echo "They appear to be: $cppflags";;
3970         esac
3971         $rm -f cpp.c cpp?.out
3972         ;;
3973 esac
3974
3975 : flags used in final linking phase
3976 case "$ldflags" in
3977 '') if ./venix; then
3978                 dflt='-i -z'
3979         else
3980                 dflt=''
3981         fi
3982         case "$ccflags" in
3983         *-posix*) dflt="$dflt -posix" ;;
3984         esac
3985         ;;
3986 *) dflt="$ldflags";;
3987 esac
3988
3989 : Try to guess additional flags to pick up local libraries.
3990 for thislibdir in $libpth; do
3991         case " $loclibpth " in
3992         *" $thislibdir "*)
3993                 case "$dflt " in 
3994                 *"-L$thislibdir "*) ;;
3995                 *)  dflt="$dflt -L$thislibdir" ;;
3996                 esac
3997                 ;;
3998         esac
3999 done
4000
4001 case "$dflt" in
4002 '') dflt='none' ;;
4003 esac
4004
4005 $cat <<EOH
4006
4007 Your C linker may need flags.  For this question you should
4008 include -L/whatever and any other flags used by the C linker, but you
4009 should NOT include libraries like -lwhatever.
4010
4011 Make sure you include the appropriate -L/path flags if your C linker
4012 does not normally search all of the directories you specified above,
4013 namely
4014         $libpth
4015 To use no flags, specify the word "none".
4016
4017 EOH
4018
4019 rp="Any additional ld flags (NOT including libraries)?"
4020 . ./myread
4021 case "$ans" in
4022 none) ldflags='';;
4023 *) ldflags="$ans";;
4024 esac
4025 rmlist="$rmlist pdp11"
4026
4027 : coherency check
4028 echo " "
4029 echo "Checking your choice of C compiler and flags for coherency..." >&4
4030 $cat > try.c <<'EOF'
4031 #include <stdio.h>
4032 int main() { printf("Ok\n"); exit(0); }
4033 EOF
4034 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4035 shift
4036 $cat >try.msg <<'EOM'
4037 I've tried to compile and run the following simple program:
4038
4039 EOM
4040 $cat try.c >> try.msg
4041
4042 $cat >> try.msg <<EOM
4043
4044 I used the command:
4045
4046         $*
4047         ./try
4048
4049 and I got the following output:
4050
4051 EOM
4052 dflt=y
4053 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4054         if sh -c './try' >>try.msg 2>&1; then
4055                 xxx=`./try`
4056                 case "$xxx" in
4057                 "Ok") dflt=n ;;
4058                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4059                         case " $libs " in
4060                         *" -lsfio "*)
4061                                 cat >> try.msg <<'EOQS'
4062 If $libs contains -lsfio, and sfio is mis-configured, then it
4063 sometimes (apparently) runs and exits with a 0 status, but with no
4064 output!  It may have to do with sfio's use of _exit vs. exit.
4065
4066 EOQS
4067                                 rp="You have a big problem.  Shall I abort Configure"
4068                                 dflt=y
4069                                 ;;
4070                         esac
4071                         ;;
4072                 esac
4073         else
4074                 echo "The program compiled OK, but exited with status $?." >>try.msg
4075                 rp="You have a problem.  Shall I abort Configure"
4076                 dflt=y
4077         fi
4078 else
4079         echo "I can't compile the test program." >>try.msg
4080         rp="You have a BIG problem.  Shall I abort Configure"
4081         dflt=y
4082 fi
4083 case "$dflt" in
4084 y)
4085         $cat try.msg >&4
4086         case "$knowitall" in
4087         '')
4088                 echo "(The supplied flags or libraries might be incorrect.)"
4089                 ;;
4090         *) dflt=n;;
4091         esac
4092         echo " "
4093         . ./myread
4094         case "$ans" in
4095         n*|N*) ;;
4096         *)      echo "Ok.  Stopping Configure." >&4
4097                 exit 1
4098                 ;;
4099         esac
4100         ;;
4101 n) echo "OK, that should do.";;
4102 esac
4103 $rm -f try try.* core
4104
4105 : define an is-a-typedef? function
4106 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4107 case "$inclist" in
4108 "") inclist="sys/types.h";;
4109 esac;
4110 eval "varval=\$$var";
4111 case "$varval" in
4112 "")
4113         $rm -f temp.c;
4114         for inc in $inclist; do
4115                 echo "#include <$inc>" >>temp.c;
4116         done;
4117         echo "#ifdef $type" >> temp.c;
4118         echo "printf(\"We have $type\");" >> temp.c;
4119         echo "#endif" >> temp.c;
4120         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4121         if $contains $type temp.E >/dev/null 2>&1; then
4122                 eval "$var=\$type";
4123         else
4124                 eval "$var=\$def";
4125         fi;
4126         $rm -f temp.?;;
4127 *) eval "$var=\$varval";;
4128 esac'
4129
4130 : define an is-a-typedef? function that prompts if the type is not available.
4131 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4132 case "$inclist" in
4133 "") inclist="sys/types.h";;
4134 esac;
4135 eval "varval=\$$var";
4136 case "$varval" in
4137 "")
4138         $rm -f temp.c;
4139         for inc in $inclist; do
4140                 echo "#include <$inc>" >>temp.c;
4141         done;
4142         echo "#ifdef $type" >> temp.c;
4143         echo "printf(\"We have $type\");" >> temp.c;
4144         echo "#endif" >> temp.c;
4145         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4146         echo " " ;
4147         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4148         if $contains $type temp.E >/dev/null 2>&1; then
4149                 echo "$type found." >&4;
4150                 eval "$var=\$type";
4151         else
4152                 echo "$type NOT found." >&4;
4153                 dflt="$def";
4154                 . ./myread ;
4155                 eval "$var=\$ans";
4156         fi;
4157         $rm -f temp.?;;
4158 *) eval "$var=\$varval";;
4159 esac'
4160
4161 : define a shorthand compile call
4162 compile='
4163 mc_file=$1;
4164 shift;
4165 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4166 : define a shorthand compile call for compilations that should be ok.
4167 compile_ok='
4168 mc_file=$1;
4169 shift;
4170 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4171
4172 : check for lengths of integral types
4173 echo " "
4174 case "$intsize" in
4175 '')
4176         echo "Checking to see how big your integers are..." >&4
4177         $cat >intsize.c <<'EOCP'
4178 #include <stdio.h>
4179 int main()
4180 {
4181         printf("intsize=%d;\n", (int)sizeof(int));
4182         printf("longsize=%d;\n", (int)sizeof(long));
4183         printf("shortsize=%d;\n", (int)sizeof(short));
4184         exit(0);
4185 }
4186 EOCP
4187         set intsize
4188         if eval $compile_ok && ./intsize > /dev/null; then
4189                 eval `./intsize`
4190                 echo "Your integers are $intsize bytes long."
4191                 echo "Your long integers are $longsize bytes long."
4192                 echo "Your short integers are $shortsize bytes long."
4193         else
4194                 $cat >&4 <<EOM
4195 !
4196 Help! I can't compile and run the intsize test program: please enlighten me!
4197 (This is probably a misconfiguration in your system or libraries, and
4198 you really ought to fix it.  Still, I'll try anyway.)
4199 !
4200 EOM
4201                 dflt=4
4202                 rp="What is the size of an integer (in bytes)?"
4203                 . ./myread
4204                 intsize="$ans"
4205                 dflt=$intsize
4206                 rp="What is the size of a long integer (in bytes)?"
4207                 . ./myread
4208                 longsize="$ans"
4209                 dflt=2
4210                 rp="What is the size of a short integer (in bytes)?"
4211                 . ./myread
4212                 shortsize="$ans"
4213         fi
4214         ;;
4215 esac
4216 $rm -f intsize intsize.*
4217
4218 : see what type lseek is declared as in the kernel
4219 rp="What is the type used for lseek's offset on this system?"
4220 set off_t lseektype long stdio.h sys/types.h
4221 eval $typedef_ask
4222
4223 echo " "
4224 $echo $n "Checking to see how big your file offsets are...$c" >&4
4225 $cat >try.c <<EOCP
4226 #include <sys/types.h>
4227 #include <stdio.h>
4228 int main()
4229 {
4230     printf("%d\n", (int)sizeof($lseektype));
4231     return(0); 
4232 }
4233 EOCP
4234 set try
4235 if eval $compile_ok; then
4236         lseeksize=`./try`
4237         $echo " $lseeksize bytes." >&4
4238 else
4239         dflt=$longsize
4240         echo " "
4241         echo "(I can't seem to compile the test program.  Guessing...)"
4242         rp="What is the size of your file offsets (in bytes)?"
4243         . ./myread
4244         lseeksize="$ans"
4245 fi
4246 $rm -f try.c try
4247
4248 : see what type file positions are declared as in the library
4249 rp="What is the type for file position used by fsetpos()?"
4250 set fpos_t fpostype long stdio.h sys/types.h
4251 eval $typedef_ask
4252
4253 echo " "
4254 case "$fpostype" in
4255 *_t) zzz="$fpostype"    ;;
4256 *)   zzz="fpos_t"       ;;
4257 esac
4258 $echo $n "Checking the size of $zzz...$c" >&4 
4259 cat > try.c <<EOCP
4260 #include <sys/types.h>
4261 #include <stdio.h>
4262 int main() {
4263     printf("%d\n", (int)sizeof($fpostype));
4264     exit(0);
4265 }
4266 EOCP
4267 set try
4268 if eval $compile_ok; then
4269         yyy=`./try`
4270         case "$yyy" in
4271         '')     fpossize=4
4272                 echo " " >&4
4273                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4274                 ;;
4275         *)      fpossize=$yyy
4276                 echo " $fpossize bytes." >&4
4277                 ;;
4278         esac
4279 else
4280         dflt="$longsize"
4281         echo " " >&4
4282         echo "(I can't compile the test program.  Guessing...)" >&4
4283         rp="What is the size of your file positions (in bytes)?"
4284         . ./myread
4285         fpossize="$ans"
4286 fi
4287
4288
4289
4290 case "$lseeksize:$fpossize" in
4291 8:8) cat <<EOM
4292
4293 You can have files larger than 2 gigabytes.
4294 EOM
4295    val="$define" ;;
4296 *)    case "$uselargefiles" in
4297    "$undef"|false|[nN]*) dflt='n' ;;
4298    *)   dflt='y' ;;
4299    esac
4300    cat <<EOM
4301
4302 Perl can be built to understand large files (files larger than 2 gigabytes)
4303 on some systems.  To do so, Configure can be run with -Duselargefiles.
4304
4305 If this doesn't make any sense to you, just accept the default '$dflt'.
4306 EOM
4307    rp='Try to understand large files, if available?'
4308    . ./myread
4309    case "$ans" in
4310    y|Y)         val="$define" ;;
4311    *)           val="$undef"  ;;
4312    esac
4313    ;;
4314 esac
4315 set uselargefiles
4316 eval $setvar
4317 case "$uselargefiles" in
4318 "$define")
4319 : Look for a hint-file generated 'call-back-unit'.  If the
4320 : user has specified that a large files perl is to be built,
4321 : we may need to set or change some other defaults.
4322         if $test -f uselfs.cbu; then
4323                 echo "Your platform has some specific hints for large file builds, using them..."
4324                 . ./uselfs.cbu
4325                 echo " "
4326                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4327                 $cat >try.c <<EOCP
4328 #include <sys/types.h>
4329 #include <stdio.h>
4330 int main()
4331 {
4332     printf("%d\n", (int)sizeof($lseektype));
4333     return(0); 
4334 }
4335 EOCP
4336                 set try
4337                 if eval $compile_ok; then
4338                         lseeksize=`./try`
4339                         $echo " $lseeksize bytes." >&4
4340                 else
4341                         dflt="$lseeksize"
4342                         echo " "
4343                         echo "(I can't seem to compile the test program.  Guessing...)"
4344                         rp="What is the size of your file offsets (in bytes)?"
4345                         . ./myread
4346                         lseeksize="$ans"
4347                 fi
4348                 case "$fpostype" in
4349                 *_t) zzz="$fpostype"    ;;
4350                 *)   zzz="fpos_t"       ;;
4351                 esac
4352                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4353                 $cat > try.c <<EOCP
4354 #include <sys/types.h>
4355 #include <stdio.h>
4356 int main() {
4357     printf("%d\n", (int)sizeof($fpostype));
4358     exit(0);
4359 }
4360 EOCP
4361                 set try
4362                 if eval $compile_ok; then
4363                         yyy=`./try`
4364                         dflt="$lseeksize"
4365                         case "$yyy" in
4366                         '')     echo " "
4367                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4368                                 ;;
4369                         *)      fpossize=$yyy
4370                                 echo " $fpossize bytes."
4371                                 ;;
4372                         esac
4373                 else
4374                         dflt="$fpossize"
4375                         echo " "
4376                         echo "(I can't compile the test program.  Guessing...)" >&4
4377                         rp="What is the size of your file positions (in bytes)?"
4378                         . ./myread
4379                         fpossize="$ans"
4380                 fi
4381                 $rm -f try.c try
4382         fi
4383         ;;
4384 esac
4385
4386
4387 case "$usemorebits" in
4388 "$define"|true|[yY]*)
4389         use64bits="$define"
4390         uselongdouble="$define"
4391         usemorebits="$define"
4392         ;;
4393 *)      usemorebits="$undef"
4394         ;;
4395 esac
4396
4397
4398 case "$intsize:$longsize" in
4399 8:*|*:8) cat <<EOM
4400
4401 You have natively 64-bit integers.
4402 EOM
4403    val="$define"
4404    ;;
4405 *) case "$ccflags" in
4406    *-DUSE_64_BITS*|*-DUSE_LONG_LONG*) use64bits="$define";;
4407    *) case "$uselonglong" in
4408       $define|true|[yY]*) use64bits="$define";;
4409       esac
4410       ;;
4411    esac
4412    case "$use64bits" in
4413    $define|true|[yY]*) dflt='y';;
4414    *) dflt='n';;
4415    esac
4416 cat <<EOM
4417
4418 Perl can be built to take advantage of 64-bit integer types
4419 on some systems.  To do so, Configure can be run with -Duse64bits.
4420
4421 If this doesn't make any sense to you, just accept the default '$dflt'.
4422 EOM
4423    rp='Try to use 64-bit integers, if available?'
4424    . ./myread
4425    case "$ans" in
4426    [yY]*) val="$define" ;;
4427    *)     val="$undef"  ;;
4428    esac
4429    ;;
4430 esac
4431 set use64bits
4432 eval $setvar
4433
4434 case "$archname64" in
4435 '') archname64='' ;;    # not a typo
4436 esac
4437
4438 case "$use64bits" in
4439 "$define"|true|[yY]*)
4440 : Look for a hint-file generated 'call-back-unit'.  If the
4441 : user has specified that a 64-bit perl is to be built,
4442 : we may need to set or change some other defaults.
4443         if $test -f use64bits.cbu; then
4444                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4445                 . ./use64bits.cbu
4446         else
4447                 $cat <<EOM
4448 (Your platform doesn't have any specific hints for 64-bit builds.)
4449 EOM
4450                 case "$intsize:$longsize" in
4451 8:*|*:8) cat <<EOM
4452 (This is probably okay, as your system is a natively 64-bit system.)
4453 EOM
4454                   ;;
4455                 esac
4456                 case "$gccversion" in
4457                 '')     ;;
4458                 *)      case "$ccflags" in
4459                         *-DUSE_64_BITS*) ;;
4460                         *) $cat <<EOM
4461 But since you seem to be using gcc, I will now add -DUSE_64_BITS
4462 to the compilation flags to get long longs.
4463 EOM
4464                            ccflags="$ccflags -DUSE_64_BITS"
4465                            ;;
4466                         esac
4467                         ;;
4468                 esac
4469         fi
4470         ;;
4471 esac
4472
4473 : determine the architecture name
4474 echo " "
4475 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4476         tarch=`arch`"-$osname"
4477 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4478         if uname -m > tmparch 2>&1 ; then
4479                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4480                         -e 's/$/'"-$osname/" tmparch`
4481         else
4482                 tarch="$osname"
4483         fi
4484         $rm -f tmparch
4485 else
4486         tarch="$osname"
4487 fi
4488 case "$myarchname" in
4489 ''|"$tarch") ;;
4490 *)
4491         echo "(Your architecture name used to be $myarchname.)"
4492         archname=''
4493         ;;
4494 esac
4495 myarchname="$tarch"
4496 case "$archname" in
4497 '') dflt="$tarch";;
4498 *) dflt="$archname";;
4499 esac
4500 rp='What is your architecture name'
4501 . ./myread
4502 archname="$ans"
4503 case "$usethreads" in
4504 $define)
4505         echo "Threads selected." >&4
4506         case "$archname" in
4507         *-thread*) echo "...and architecture name already has -thread." >&4
4508                 ;;
4509         *)      archname="$archname-thread"
4510                 echo "...setting architecture name to $archname." >&4
4511                 ;;
4512         esac
4513         ;;
4514 esac
4515 case "$usemultiplicity" in
4516 $define)
4517         echo "Multiplicity selected." >&4
4518         case "$archname" in
4519         *-multi*) echo "...and architecture name already has -multi." >&4
4520                 ;;
4521         *)      archname="$archname-multi"
4522                 echo "...setting architecture name to $archname." >&4
4523                 ;;
4524         esac
4525         ;;
4526 esac
4527 case "$use64bits" in
4528 $define)
4529         case "$archname64" in
4530         '')
4531                 ;;
4532         *)
4533                 case "$archname" in
4534                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4535                         ;;
4536                 *)      archname="$archname-$archname64"
4537                         echo "...setting architecture name to $archname." >&4
4538                         ;;
4539                 esac
4540                 ;;
4541         esac
4542 esac
4543
4544 : determine root of directory hierarchy where package will be installed.
4545 case "$prefix" in
4546 '')
4547         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4548         ;;
4549 *)
4550         dflt="$prefix"
4551         ;;
4552 esac
4553 $cat <<EOM
4554
4555 By default, $package will be installed in $dflt/bin, manual pages
4556 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4557 installation directories. Typically this is something like /usr/local.
4558 If you wish to have binaries under /usr/bin but other parts of the
4559 installation under /usr/local, that's ok: you will be prompted
4560 separately for each of the installation directories, the prefix being
4561 only used to set the defaults.
4562
4563 EOM
4564 fn=d~
4565 rp='Installation prefix to use?'
4566 . ./getfile
4567 oldprefix=''
4568 case "$prefix" in
4569 '') ;;
4570 *)
4571         case "$ans" in
4572         "$prefix") ;;
4573         *) oldprefix="$prefix";;
4574         esac
4575         ;;
4576 esac
4577 prefix="$ans"
4578 prefixexp="$ansexp"
4579
4580 : is AFS running?
4581 echo " "
4582 case "$afs" in
4583 $define|true)   afs=true ;;
4584 $undef|false)   afs=false ;;
4585 *)      if test -d /afs; then
4586                 afs=true
4587         else
4588                 afs=false
4589         fi
4590         ;;
4591 esac
4592 if $afs; then
4593         echo "AFS may be running... I'll be extra cautious then..." >&4
4594 else
4595         echo "AFS does not seem to be running..." >&4
4596 fi
4597
4598 : determine installation prefix for where package is to be installed.
4599 if $afs; then 
4600 $cat <<EOM
4601
4602 Since you are running AFS, I need to distinguish the directory in which
4603 files will reside from the directory in which they are installed (and from
4604 which they are presumably copied to the former directory by occult means).
4605
4606 EOM
4607         case "$installprefix" in
4608         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4609         *) dflt="$installprefix";;
4610         esac
4611 else
4612 $cat <<EOM
4613
4614 In some special cases, particularly when building $package for distribution,
4615 it is convenient to distinguish between the directory in which files should 
4616 be installed from the directory ($prefix) in which they 
4617 will eventually reside.  For most users, these two directories are the same.
4618
4619 EOM
4620         case "$installprefix" in
4621         '') dflt=$prefix ;;
4622         *) dflt=$installprefix;;
4623         esac
4624 fi
4625 fn=d~
4626 rp='What installation prefix should I use for installing files?'
4627 . ./getfile
4628 installprefix="$ans"
4629 installprefixexp="$ansexp"
4630
4631 : set the prefixit variable, to compute a suitable default value
4632 prefixit='case "$3" in
4633 ""|none)
4634         case "$oldprefix" in
4635         "") eval "$1=\"\$$2\"";;
4636         *)
4637                 case "$3" in
4638                 "") eval "$1=";;
4639                 none)
4640                         eval "tp=\"\$$2\"";
4641                         case "$tp" in
4642                         ""|" ") eval "$1=\"\$$2\"";;
4643                         *) eval "$1=";;
4644                         esac;;
4645                 esac;;
4646         esac;;
4647 *)
4648         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4649         case "$tp" in
4650         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4651         /*-$oldprefix/*|\~*-$oldprefix/*)
4652                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4653         *) eval "$1=\"\$$2\"";;
4654         esac;;
4655 esac'
4656
4657 : set the base revision
4658 baserev=5.0
4659
4660
4661 : get the patchlevel
4662 echo " "
4663 echo "Getting the current patchlevel..." >&4
4664 if $test -r $rsrc/patchlevel.h;then
4665         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4666         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4667         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4668         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4669         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4670 else
4671         patchlevel=0
4672         subversion=0
4673         api_revision=0
4674         api_version=0
4675         api_subversion=0
4676 fi
4677 $echo $n "(You have $package" $c
4678 case "$package" in
4679 "*$baserev")    ;;
4680 *)              $echo $n " $baserev" $c ;;
4681 esac
4682 $echo $n " patchlevel $patchlevel" $c
4683 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4684 echo ".)"
4685 case "$osname" in
4686 dos|vms)
4687         : XXX Should be a Configure test for double-dots in filenames.
4688         version=`echo $baserev $patchlevel $subversion | \
4689                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4690         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4691                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4692         ;;
4693 *)
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 esac
4700 : Special case the 5.005_xx maintenance series, which used 5.005
4701 : without any subversion label as a subdirectory in $sitelib
4702 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4703         api_versionstring='5.005'
4704 fi
4705
4706 : determine installation style
4707 : For now, try to deduce it from prefix unless it is already set.
4708 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4709 case "$installstyle" in
4710 '')     case "$prefix" in
4711                 *perl*) dflt='lib';;
4712                 *) dflt='lib/perl5' ;;
4713         esac
4714         ;;
4715 *)      dflt='lib/perl5' ;;
4716 esac
4717 : Probably not worth prompting for this since we prompt for all
4718 : the directories individually, and the prompt would be too long and
4719 : confusing anyway.
4720 installstyle=$dflt
4721
4722 : determine where private library files go
4723 : Usual default is /usr/local/lib/perl5/$version.
4724 : Also allow things like /opt/perl/lib/$version, since 
4725 : /opt/perl/lib/perl5... would be redundant.
4726 : The default "style" setting is made in installstyle.U
4727 case "$installstyle" in
4728 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4729 *)       set dflt privlib lib/$version ;;
4730 esac
4731 eval $prefixit
4732 $cat <<EOM
4733
4734 There are some auxiliary files for $package that need to be put into a
4735 private library directory that is accessible by everyone.
4736
4737 EOM
4738 fn=d~+
4739 rp='Pathname where the private library files will reside?'
4740 . ./getfile
4741 privlib="$ans"
4742 privlibexp="$ansexp"
4743 : Change installation prefix, if necessary.
4744 if $test X"$prefix" != X"$installprefix"; then
4745         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4746 else
4747         installprivlib="$privlibexp"
4748 fi
4749
4750 : set the prefixup variable, to restore leading tilda escape
4751 prefixup='case "$prefixexp" in
4752 "$prefix") ;;
4753 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4754 esac'
4755
4756 : determine where public architecture dependent libraries go
4757 set archlib archlib
4758 eval $prefixit
4759 : privlib default is /usr/local/lib/$package/$version
4760 : archlib default is /usr/local/lib/$package/$version/$archname
4761 : privlib may have an optional trailing /share.
4762 tdflt=`echo $privlib | $sed 's,/share$,,'`
4763 tdflt=$tdflt/$archname
4764 case "$archlib" in
4765 '')     dflt=$tdflt
4766         ;;
4767 *)      dflt="$archlib"
4768     ;;
4769 esac
4770 $cat <<EOM
4771
4772 $spackage contains architecture-dependent library files.  If you are
4773 sharing libraries in a heterogeneous environment, you might store
4774 these files in a separate location.  Otherwise, you can just include
4775 them with the rest of the public library files.
4776
4777 EOM
4778 fn=d+~
4779 rp='Where do you want to put the public architecture-dependent libraries?'
4780 . ./getfile
4781 archlib="$ans"
4782 archlibexp="$ansexp"
4783 if $test X"$archlib" = X"$privlib"; then
4784         d_archlib="$undef"
4785 else
4786         d_archlib="$define"
4787 fi
4788 : Change installation prefix, if necessary.
4789 if $test X"$prefix" != X"$installprefix"; then
4790         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4791 else
4792         installarchlib="$archlibexp"
4793 fi
4794
4795
4796 : Binary compatibility with 5.005 is not possible for builds
4797 : with advanced features
4798 case "$usethreads$usemultiplicity" in
4799 *define*)
4800         bincompat5005="$undef"
4801         d_bincompat5005="$undef"
4802         ;;
4803 *)      $cat <<EOM
4804
4805 Perl 5.006 can be compiled for binary compatibility with 5.005.
4806 If you decide to do so, you will be able to continue using most
4807 of the extensions that were compiled for Perl 5.005.
4808
4809 EOM
4810         case "$bincompat5005$d_bincompat5005" in
4811         *"$undef"*) dflt=n ;;
4812         *) dflt=y ;;
4813         esac
4814         rp='Binary compatibility with Perl 5.005?'
4815         . ./myread
4816         case "$ans" in
4817         y*) val="$define" ;;
4818         *)  val="$undef" ;;
4819         esac
4820         set d_bincompat5005
4821         eval $setvar
4822         case "$d_bincompat5005" in
4823         "$define")
4824                 bincompat5005="$define"
4825                 ;;
4826         *)      bincompat5005="$undef"
4827                 d_bincompat5005="$undef"
4828                 ;;
4829         esac
4830         ;;
4831 esac
4832
4833
4834 : see if setuid scripts can be secure
4835 $cat <<EOM
4836
4837 Some kernels have a bug that prevents setuid #! scripts from being
4838 secure.  Some sites have disabled setuid #! scripts because of this.
4839
4840 First let's decide if your kernel supports secure setuid #! scripts.
4841 (If setuid #! scripts would be secure but have been disabled anyway,
4842 don't say that they are secure if asked.)
4843
4844 EOM
4845
4846 val="$undef"
4847 if $test -d /dev/fd; then
4848         echo "#!$ls" >reflect
4849         chmod +x,u+s reflect
4850         ./reflect >flect 2>&1
4851         if $contains "/dev/fd" flect >/dev/null; then
4852                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4853                 val="$define"
4854         else
4855                 $cat <<EOM
4856 If you are not sure if they are secure, I can check but I'll need a
4857 username and password different from the one you are using right now.
4858 If you don't have such a username or don't want me to test, simply
4859 enter 'none'.
4860
4861 EOM
4862                 rp='Other username to test security of setuid scripts with?'
4863                 dflt='none'
4864                 . ./myread
4865                 case "$ans" in
4866                 n|none)
4867                         case "$d_suidsafe" in
4868                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4869                                 dflt=n;;
4870                         "$undef")
4871                                 echo "Well, the $hint value is *not* secure." >&4
4872                                 dflt=n;;
4873                         *)      echo "Well, the $hint value *is* secure." >&4
4874                                 dflt=y;;
4875                         esac
4876                         ;;
4877                 *)
4878                         $rm -f reflect flect
4879                         echo "#!$ls" >reflect
4880                         chmod +x,u+s reflect
4881                         echo >flect
4882                         chmod a+w flect
4883                         echo '"su" will (probably) prompt you for '"$ans's password."
4884                         su $ans -c './reflect >flect'
4885                         if $contains "/dev/fd" flect >/dev/null; then
4886                                 echo "Okay, it looks like setuid scripts are secure." >&4
4887                                 dflt=y
4888                         else
4889                                 echo "I don't think setuid scripts are secure." >&4
4890                                 dflt=n
4891                         fi
4892                         ;;
4893                 esac
4894                 rp='Does your kernel have *secure* setuid scripts?'
4895                 . ./myread
4896                 case "$ans" in
4897                 [yY]*)  val="$define";;
4898                 *)      val="$undef";;
4899                 esac
4900         fi
4901 else
4902         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4903         echo "(That's for file descriptors, not floppy disks.)"
4904         val="$undef"
4905 fi
4906 set d_suidsafe
4907 eval $setvar
4908
4909 $rm -f reflect flect
4910
4911 : now see if they want to do setuid emulation
4912 echo " "
4913 val="$undef"
4914 case "$d_suidsafe" in
4915 "$define")
4916         val="$undef"
4917         echo "No need to emulate SUID scripts since they are secure here." >& 4
4918         ;;
4919 *)
4920         $cat <<EOM
4921 Some systems have disabled setuid scripts, especially systems where
4922 setuid scripts cannot be secure.  On systems where setuid scripts have
4923 been disabled, the setuid/setgid bits on scripts are currently
4924 useless.  It is possible for $package to detect those bits and emulate
4925 setuid/setgid in a secure fashion.  This emulation will only work if
4926 setuid scripts have been disabled in your kernel.
4927
4928 EOM
4929         case "$d_dosuid" in
4930         "$define") dflt=y ;;
4931         *) dflt=n ;;
4932         esac
4933         rp="Do you want to do setuid/setgid emulation?"
4934         . ./myread
4935         case "$ans" in
4936         [yY]*)  val="$define";;
4937         *)      val="$undef";;
4938         esac
4939         ;;
4940 esac
4941 set d_dosuid
4942 eval $setvar
4943
4944 : determine filename position in cpp output
4945 echo " "
4946 echo "Computing filename position in cpp output for #include directives..." >&4
4947 echo '#include <stdio.h>' > foo.c
4948 $cat >fieldn <<EOF
4949 $startsh
4950 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4951 $grep '^[       ]*#.*stdio\.h' | \
4952 while read cline; do
4953         pos=1
4954         set \$cline
4955         while $test \$# -gt 0; do
4956                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4957                         echo "\$pos"
4958                         exit 0
4959                 fi
4960                 shift
4961                 pos=\`expr \$pos + 1\`
4962         done
4963 done
4964 EOF
4965 chmod +x fieldn
4966 fieldn=`./fieldn`
4967 $rm -f foo.c fieldn
4968 case $fieldn in
4969 '') pos='???';;
4970 1) pos=first;;
4971 2) pos=second;;
4972 3) pos=third;;
4973 *) pos="${fieldn}th";;
4974 esac
4975 echo "Your cpp writes the filename in the $pos field of the line."
4976
4977 : locate header file
4978 $cat >findhdr <<EOF
4979 $startsh
4980 wanted=\$1
4981 name=''
4982 for usrincdir in $usrinc
4983 do
4984         if test -f \$usrincdir/\$wanted; then
4985                 echo "\$usrincdir/\$wanted"
4986                 exit 0
4987         fi
4988 done
4989 awkprg='{ print \$$fieldn }'
4990 echo "#include <\$wanted>" > foo\$\$.c
4991 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4992 $grep "^[       ]*#.*\$wanted" | \
4993 while read cline; do
4994         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4995         case "\$name" in
4996         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4997         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4998         *) exit 2;;
4999         esac;
5000 done;
5001 #
5002 # status = 0: grep returned 0 lines, case statement not executed
5003 # status = 1: headerfile found
5004 # status = 2: while loop executed, no headerfile found
5005 #
5006 status=\$?
5007 $rm -f foo\$\$.c;
5008 if test \$status -eq 1; then
5009         exit 0;
5010 fi
5011 exit 1
5012 EOF
5013 chmod +x findhdr
5014
5015 : define an alternate in-header-list? function
5016 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5017 cont=true; xxf="echo \"<\$1> found.\" >&4";
5018 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5019 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5020 esac;
5021 case $# in 4) instead=instead;; *) instead="at last";; esac;
5022 while $test "$cont"; do
5023         xxx=`./findhdr $1`
5024         var=$2; eval "was=\$$2";
5025         if $test "$xxx" && $test -r "$xxx";
5026         then eval $xxf;
5027         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5028                 cont="";
5029         else eval $xxnf;
5030         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5031         set $yyy; shift; shift; yyy=$@;
5032         case $# in 0) cont="";;
5033         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5034                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5035         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5036                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5037         esac;
5038 done;
5039 while $test "$yyy";
5040 do set $yyy; var=$2; eval "was=\$$2";
5041         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5042         set $yyy; shift; shift; yyy=$@;
5043 done'
5044
5045 : see if this is a malloc.h system
5046 set malloc.h i_malloc
5047 eval $inhdr
5048
5049 : see if stdlib is available
5050 set stdlib.h i_stdlib
5051 eval $inhdr
5052
5053 : determine which malloc to compile in
5054 echo " "
5055 case "$usemymalloc" in
5056 ''|[yY]*|true|$define)  dflt='y' ;;
5057 *)      dflt='n' ;;
5058 esac
5059 rp="Do you wish to attempt to use the malloc that comes with $package?"
5060 . ./myread
5061 usemymalloc="$ans"
5062 case "$ans" in
5063 y*|true)
5064         usemymalloc='y'
5065         mallocsrc='malloc.c'
5066         mallocobj="malloc$_o"
5067         d_mymalloc="$define"
5068         case "$libs" in
5069         *-lmalloc*)
5070                 : Remove malloc from list of libraries to use
5071                 echo "Removing unneeded -lmalloc from library list" >&4
5072                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5073                 shift
5074                 libs="$*"
5075                 echo "libs = $libs" >&4
5076                 ;;
5077         esac
5078         ;;
5079 *)
5080         usemymalloc='n'
5081         mallocsrc=''
5082         mallocobj=''
5083         d_mymalloc="$undef"
5084         ;;
5085 esac
5086
5087 : compute the return types of malloc and free
5088 echo " "
5089 $cat >malloc.c <<END
5090 #$i_malloc I_MALLOC
5091 #$i_stdlib I_STDLIB
5092 #include <stdio.h>
5093 #include <sys/types.h>
5094 #ifdef I_MALLOC
5095 #include <malloc.h>
5096 #endif
5097 #ifdef I_STDLIB
5098 #include <stdlib.h>
5099 #endif
5100 #ifdef TRY_MALLOC
5101 void *malloc();
5102 #endif
5103 #ifdef TRY_FREE
5104 void free();
5105 #endif
5106 END
5107 case "$malloctype" in
5108 '')
5109         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5110                 malloctype='void *'
5111         else
5112                 malloctype='char *'
5113         fi
5114         ;;
5115 esac
5116 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5117
5118 case "$freetype" in
5119 '')
5120         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5121                 freetype='void'
5122         else
5123                 freetype='int'
5124         fi
5125         ;;
5126 esac
5127 echo "Your system uses $freetype free(), it would seem." >&4
5128 $rm -f malloc.[co]
5129 $cat <<EOM
5130
5131 The installation process will also create a directory for
5132 vendor-supplied add-ons.  Vendors who supply perl with their system
5133 may find it convenient to place all vendor-supplied files in this
5134 directory rather than in the main distribution directory.  This will
5135 ease upgrades between binary-compatible maintenance versions of perl.
5136
5137 Of course you may also use these directories in whatever way you see
5138 fit.  For example, you might use them to access modules shared over a
5139 company-wide network.
5140
5141 The default answer should be fine for most people.
5142 This causes further questions about vendor add-ons to be skipped
5143 and no vendor-specific directories will be configured for perl.
5144
5145 EOM
5146 rp='Do you want to configure vendor-specific add-on directories?'
5147 case "$usevendorprefix" in
5148 define|true|[yY]*) dflt=y ;;
5149 *) dflt=n ;;
5150 esac
5151 . ./myread
5152 case "$ans" in
5153 [yY]*)  fn=d~+
5154         rp='Installation prefix to use for vendor-supplied add-ons?'
5155         case "$vendorprefix" in
5156         '') dflt='' ;;
5157         *)  dflt=$vendorprefix ;;
5158         esac
5159         . ./getfile
5160         oldvendorprefix=''
5161         case "$vendorprefix" in
5162         '') ;;
5163         *)      case "$ans" in
5164                 "$prefix") ;;
5165                 *) oldvendorprefix="$prefix";;
5166                 esac
5167                 ;;
5168         esac
5169         usevendorprefix="$define"
5170         vendorprefix="$ans"
5171         vendorprefixexp="$ansexp"
5172         ;;
5173 *)      usevendorprefix="$undef"
5174         vendorprefix=''
5175         vendorprefixexp=''
5176         ;;
5177 esac
5178
5179 case "$vendorprefix" in
5180 '')     d_vendorlib="$undef"
5181         vendorlib=''
5182         vendorlibexp=''
5183         ;;
5184 *)      d_vendorlib="$define"
5185         : determine where vendor-supplied modules go.
5186         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5187         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5188         case "$installstyle" in
5189         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5190         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5191         esac
5192         fn=d~+
5193         rp='Pathname for the vendor-supplied library files?'
5194         . ./getfile
5195         vendorlib="$ans"
5196         vendorlibexp="$ansexp"
5197         : Change installation prefix, if necessary.
5198         if $test X"$prefix" != X"$installprefix"; then
5199                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5200         else
5201                 installvendorlib="$vendorlibexp"
5202         fi
5203         ;;
5204 esac
5205
5206 : Cruising for prototypes
5207 echo " "
5208 echo "Checking out function prototypes..." >&4
5209 $cat >prototype.c <<'EOCP'
5210 int main(int argc, char *argv[]) {
5211         exit(0);}
5212 EOCP
5213 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5214         echo "Your C compiler appears to support function prototypes."
5215         val="$define"
5216 else
5217         echo "Your C compiler doesn't seem to understand function prototypes."
5218         val="$undef"
5219 fi
5220 set prototype
5221 eval $setvar
5222 $rm -f prototype*
5223
5224 case "$prototype" in
5225 "$define") ;;
5226 *)      ansi2knr='ansi2knr'
5227         echo " "
5228         cat <<EOM >&4
5229
5230 $me:  FATAL ERROR:
5231 This version of $package can only be compiled by a compiler that 
5232 understands function prototypes.  Unfortunately, your C compiler 
5233         $cc $ccflags
5234 doesn't seem to understand them.  Sorry about that.
5235
5236 If GNU cc is available for your system, perhaps you could try that instead.  
5237
5238 Eventually, we hope to support building Perl with pre-ANSI compilers.
5239 If you would like to help in that effort, please contact <perlbug@perl.org>.
5240
5241 Aborting Configure now.
5242 EOM
5243         exit 2
5244         ;;
5245 esac
5246
5247 : determine where public executables go
5248 echo " "
5249 set dflt bin bin
5250 eval $prefixit
5251 fn=d~
5252 rp='Pathname where the public executables will reside?'
5253 . ./getfile
5254 if $test "X$ansexp" != "X$binexp"; then
5255         installbin=''
5256 fi
5257 bin="$ans"
5258 binexp="$ansexp"
5259 : Change installation prefix, if necessary.
5260 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5261 if $test X"$prefix" != X"$installprefix"; then
5262         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5263 else
5264         installbin="$binexp"
5265 fi
5266
5267 $cat <<EOM
5268
5269 After $package is installed, you may wish to install various
5270 add-on modules and utilities.  Typically, these add-ons will
5271 be installed under $prefix with the rest
5272 of this package.  However, you may wish to install such add-ons
5273 elsewhere under a different prefix.
5274
5275 If you do not wish to put everything under a single prefix, that's
5276 ok.  You will be prompted for the individual locations; this siteprefix
5277 is only used to suggest the defaults.
5278
5279 The default should be fine for most people.
5280
5281 EOM
5282 fn=d~+
5283 rp='Installation prefix to use for add-on modules and utilities?'
5284 : XXX Here might be another good place for an installstyle setting.
5285 case "$siteprefix" in
5286 '') dflt=$prefix ;;
5287 *)  dflt=$siteprefix ;;
5288 esac
5289 . ./getfile
5290 oldsiteprefix=''
5291 case "$siteprefix" in
5292 '') ;;
5293 *)
5294         case "$ans" in
5295         "$prefix") ;;
5296         *) oldsiteprefix="$prefix";;
5297         esac
5298         ;;
5299 esac
5300 siteprefix="$ans"
5301 siteprefixexp="$ansexp"
5302
5303 : determine where site specific libraries go.
5304 : Usual default is /usr/local/lib/perl5/site_perl/$version
5305 : The default "style" setting is made in installstyle.U
5306 : XXX No longer works with Prefixit stuff.
5307 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5308 case "$installstyle" in
5309 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5310 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5311 esac
5312 $cat <<EOM
5313
5314 The installation process will create a directory for
5315 site-specific extensions and modules.  Most users find it convenient
5316 to place all site-specific files in this directory rather than in the
5317 main distribution directory.
5318
5319 EOM
5320 fn=d~+
5321 rp='Pathname for the site-specific library files?'
5322 . ./getfile
5323 sitelib="$ans"
5324 sitelibexp="$ansexp"
5325 : Change installation prefix, if necessary.
5326 if $test X"$prefix" != X"$installprefix"; then
5327         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5328 else
5329         installsitelib="$sitelibexp"
5330 fi
5331
5332 : Determine list of previous versions to include in @INC
5333 $cat > getverlist <<EOPL
5334 #!$perl -w
5335 use File::Basename;
5336 \$api_versionstring = "$api_versionstring";
5337 \$version = "$version";
5338 \$sitelib = "$sitelib";
5339 \$archname = "$archname";
5340 EOPL
5341         $cat >> getverlist <<'EOPL'
5342 # Can't have leading @ because metaconfig interprets it as a command!
5343 ;@inc_version_list=();
5344 $stem=dirname($sitelib);
5345 # Redo to do opendir/readdir? 
5346 if (-d $stem) {
5347     chdir($stem);
5348     ;@candidates = glob("5.*");
5349 }
5350 else {
5351     ;@candidates = ();
5352 }
5353
5354 # XXX ToDo:  These comparisons must be reworked when two-digit
5355 # subversions come along, so that 5.7.10 compares as greater than
5356 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5357 # widespread that we can use the built-in version vectors rather
5358 # than reinventing them here.  For 5.6.0, however, we must
5359 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5360 foreach $d (@candidates) {
5361     if ($d lt $version) {
5362         if ($d ge $api_versionstring) {
5363             unshift(@inc_version_list, "$d/$archname", $d);
5364         }
5365         elsif ($d ge "5.005") {
5366             unshift(@inc_version_list, $d);
5367         }
5368     }
5369     else {
5370         # Skip newer version.  I.e. don't look in
5371         # 5.7.0 if we're installing 5.6.1.
5372     }
5373 }
5374
5375 if (@inc_version_list) {
5376     print join(' ', @inc_version_list);
5377 }
5378 else {
5379     # Blank space to preserve value for next Configure run.
5380     print " ";
5381 }
5382 EOPL
5383 chmod +x getverlist
5384 case "$inc_version_list" in
5385 '')     if test -x $perl; then
5386                 dflt=`$perl getverlist`
5387         else
5388                 dflt='none'
5389         fi
5390         ;;
5391 $undef) dflt='none' ;;
5392 *)  dflt="$inc_version_list" ;;
5393 esac
5394 $cat <<'EOM'
5395
5396 In order to ease the process of upgrading, this version of perl 
5397 can be configured to use modules built and installed with earlier 
5398 versions of perl that were installed under $prefix.  Specify here
5399 the list of earlier versions that this version of perl should check.
5400 If Configure detected no earlier versions of perl installed under
5401 $prefix, then the list will be empty.  Answer 'none' to tell perl
5402 to not search earlier versions.
5403
5404 The default should almost always be sensible, so if you're not sure,
5405 just accept the default.
5406 EOM
5407
5408 rp='List of earlier versions to include in @INC?'
5409 . ./myread
5410 case "$ans" in
5411 [Nn]one) inc_version_list=' ' ;;
5412 *) inc_version_list="$ans" ;;
5413 esac
5414 case "$inc_version_list" in
5415 ''|' ') 
5416         inc_version_list_init='0';;
5417 *)      inc_version_list_init=`echo $inc_version_list |
5418                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5419         ;;
5420 esac
5421 $rm -f getverlist
5422
5423 : determine whether to install perl also as /usr/bin/perl
5424
5425 echo " "
5426 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5427         $cat <<EOM
5428 Many scripts expect to perl to be installed as /usr/bin/perl.
5429 I can install the perl you are about to compile also as /usr/bin/perl
5430 (in addition to $installbin/perl).
5431 EOM
5432         case "$installusrbinperl" in
5433         "$undef"|[nN]*) dflt='n';;
5434         *)              dflt='y';;
5435         esac
5436         rp="Do you want to install perl as /usr/bin/perl?"
5437         . ./myread
5438         case "$ans" in
5439         [yY]*)  val="$define";;
5440         *)      val="$undef" ;;
5441         esac
5442 else
5443         val="$undef"
5444 fi
5445 set installusrbinperl
5446 eval $setvar
5447
5448 echo " "
5449 echo "Checking for GNU C Library..." >&4
5450 cat >gnulibc.c <<EOM
5451 #include <stdio.h>
5452 int main()
5453 {
5454 #ifdef __GLIBC__
5455     exit(0);
5456 #else
5457     exit(1);
5458 #endif
5459 }
5460 EOM
5461 set gnulibc
5462 if eval $compile_ok && ./gnulibc; then
5463         val="$define"
5464         echo "You are using the GNU C Library"
5465 else
5466         val="$undef"
5467         echo "You are not using the GNU C Library"
5468 fi
5469 $rm -f gnulibc*
5470 set d_gnulibc
5471 eval $setvar
5472
5473 : see if nm is to be used to determine whether a symbol is defined or not
5474 case "$usenm" in
5475 '')
5476         dflt=''
5477         case "$d_gnulibc" in
5478         "$define")
5479                 echo " "
5480                 echo "nm probably won't work on the GNU C Library." >&4
5481                 dflt=n
5482                 ;;
5483         esac
5484         case "$dflt" in
5485         '') 
5486                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5487                         echo " "
5488                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5489                         echo "'nm' won't be sufficient on this sytem." >&4
5490                         dflt=n
5491                 fi
5492                 ;;
5493         esac
5494         case "$dflt" in
5495         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5496                 if $test $dflt -gt 20; then
5497                         dflt=y
5498                 else
5499                         dflt=n
5500                 fi
5501                 ;;
5502         esac
5503         ;;
5504 *)
5505         case "$usenm" in
5506         true|$define) dflt=y;;
5507         *) dflt=n;;
5508         esac
5509         ;;
5510 esac
5511 $cat <<EOM
5512
5513 I can use $nm to extract the symbols from your C libraries. This
5514 is a time consuming task which may generate huge output on the disk (up
5515 to 3 megabytes) but that should make the symbols extraction faster. The
5516 alternative is to skip the 'nm' extraction part and to compile a small
5517 test program instead to determine whether each symbol is present. If
5518 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5519 this may be the best solution.
5520
5521 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5522
5523 EOM
5524 rp="Shall I use $nm to extract C symbols from the libraries?"
5525 . ./myread
5526 case "$ans" in
5527 [Nn]*) usenm=false;;
5528 *) usenm=true;;
5529 esac
5530
5531 runnm=$usenm
5532 case "$reuseval" in
5533 true) runnm=false;;
5534 esac
5535
5536 : nm options which may be necessary
5537 case "$nm_opt" in
5538 '') if $test -f /mach_boot; then
5539                 nm_opt=''       # Mach
5540         elif $test -d /usr/ccs/lib; then
5541                 nm_opt='-p'     # Solaris (and SunOS?)
5542         elif $test -f /dgux; then
5543                 nm_opt='-p'     # DG-UX
5544         elif $test -f /lib64/rld; then
5545                 nm_opt='-p'     # 64-bit Irix
5546         else
5547                 nm_opt=''
5548         fi;;
5549 esac
5550
5551 : nm options which may be necessary for shared libraries but illegal
5552 : for archive libraries.  Thank you, Linux.
5553 case "$nm_so_opt" in
5554 '')     case "$myuname" in
5555         *linux*)
5556                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5557                         nm_so_opt='--dynamic'
5558                 fi
5559                 ;;
5560         esac
5561         ;;
5562 esac
5563
5564 case "$runnm" in
5565 true)
5566 : get list of predefined functions in a handy place
5567 echo " "
5568 case "$libc" in
5569 '') libc=unknown
5570         case "$libs" in
5571         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5572         esac
5573         ;;
5574 esac
5575 libnames='';
5576 case "$libs" in
5577 '') ;;
5578 *)  for thislib in $libs; do
5579         case "$thislib" in
5580         -lc|-lc_s)
5581                 : Handle C library specially below.
5582                 ;;
5583         -l*)
5584                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5585                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5586                         :
5587                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5588                         :
5589                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5590                         :
5591                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5592                         :
5593                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5594                         :
5595                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5596                         :
5597                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5598                         :
5599                 else
5600                         try=''
5601                 fi
5602                 libnames="$libnames $try"
5603                 ;;
5604         *) libnames="$libnames $thislib" ;;
5605         esac
5606         done
5607         ;;
5608 esac
5609 xxx=normal
5610 case "$libc" in
5611 unknown)
5612         set /lib/libc.$so
5613         for xxx in $libpth; do
5614                 $test -r $1 || set $xxx/libc.$so
5615                 : The messy sed command sorts on library version numbers.
5616                 $test -r $1 || \
5617                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5618                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5619                                 h
5620                                 s/[0-9][0-9]*/0000&/g
5621                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5622                                 G
5623                                 s/\n/ /' | \
5624                          sort | $sed -e 's/^.* //'`
5625                 eval set \$$#
5626         done
5627         $test -r $1 || set /usr/ccs/lib/libc.$so
5628         $test -r $1 || set /lib/libsys_s$_a
5629         ;;
5630 *)
5631         set blurfl
5632         ;;
5633 esac
5634 if $test -r "$1"; then
5635         echo "Your (shared) C library seems to be in $1."
5636         libc="$1"
5637 elif $test -r /lib/libc && $test -r /lib/clib; then
5638         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5639         xxx=apollo
5640         libc='/lib/clib /lib/libc'
5641         if $test -r /lib/syslib; then
5642                 echo "(Your math library is in /lib/syslib.)"
5643                 libc="$libc /lib/syslib"
5644         fi
5645 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5646         echo "Your C library seems to be in $libc, as you said before."
5647 elif $test -r $incpath/usr/lib/libc$_a; then
5648         libc=$incpath/usr/lib/libc$_a;
5649         echo "Your C library seems to be in $libc.  That's fine."
5650 elif $test -r /lib/libc$_a; then
5651         libc=/lib/libc$_a;
5652         echo "Your C library seems to be in $libc.  You're normal."
5653 else
5654         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5655                 :
5656         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5657                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5658         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5659                 :
5660         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5661                 :
5662         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5663                 :
5664         else
5665                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5666         fi
5667         if $test -r "$tans"; then
5668                 echo "Your C library seems to be in $tans, of all places."
5669                 libc=$tans
5670         else
5671                 libc='blurfl'
5672         fi
5673 fi
5674 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5675         dflt="$libc"
5676         cat <<EOM
5677
5678 If the guess above is wrong (which it might be if you're using a strange
5679 compiler, or your machine supports multiple models), you can override it here.
5680
5681 EOM
5682 else
5683         dflt=''
5684         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5685         cat >&4 <<EOM
5686 I can't seem to find your C library.  I've looked in the following places:
5687
5688 EOM
5689         $sed 's/^/      /' libpath
5690         cat <<EOM
5691
5692 None of these seems to contain your C library. I need to get its name...
5693
5694 EOM
5695 fi
5696 fn=f
5697 rp='Where is your C library?'
5698 . ./getfile
5699 libc="$ans"
5700
5701 echo " "
5702 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5703 set X `cat libnames`
5704 shift
5705 xxx=files
5706 case $# in 1) xxx=file; esac
5707 echo "Extracting names from the following $xxx for later perusal:" >&4
5708 echo " "
5709 $sed 's/^/      /' libnames >&4
5710 echo " "
5711 $echo $n "This may take a while...$c" >&4
5712
5713 for file in $*; do
5714         case $file in
5715         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5716         *) $nm $nm_opt $file 2>/dev/null;;
5717         esac
5718 done >libc.tmp
5719
5720 $echo $n ".$c"
5721 $grep fprintf libc.tmp > libc.ptf
5722 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5723 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5724 xxx='[ADTSIW]'
5725 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5726         eval $xscan;\
5727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5728                 eval $xrun
5729 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5730         eval $xscan;\
5731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5732                 eval $xrun
5733 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5734         eval $xscan;\
5735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736                 eval $xrun
5737 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5738         eval $xscan;\
5739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5740                 eval $xrun
5741 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5750                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5751         eval $xscan;\
5752         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5753                 eval $xrun
5754 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5755         eval $xscan;\
5756         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5757                 eval $xrun
5758 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5759         eval $xscan;\
5760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5761                 eval $xrun
5762 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5763         eval $xscan;\
5764         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5765                 eval $xrun
5766 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5767         eval $xscan;\
5768         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5769                 eval $xrun
5770 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5771         eval $xscan;\
5772         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5773                 eval $xrun
5774 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5775         eval $xscan;\
5776         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5777                 eval $xrun
5778 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5779         eval $xscan;\
5780         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5781                 eval $xrun
5782 else
5783         $nm -p $* 2>/dev/null >libc.tmp
5784         $grep fprintf libc.tmp > libc.ptf
5785         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5786                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5787         then
5788                 nm_opt='-p'
5789                 eval $xrun
5790         else
5791                 echo " "
5792                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5793                 com=''
5794                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5795                         for thisname in $libnames $libc; do
5796                                 $ar t $thisname >>libc.tmp
5797                         done
5798                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5799                         echo "Ok." >&4
5800                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5801                         # Repeat libc to extract forwarders to DLL entries too
5802                         for thisname in $libnames $libc; do
5803                                 $ar tv $thisname >>libc.tmp
5804                                 # Revision 50 of EMX has bug in $ar.
5805                                 # it will not extract forwarders to DLL entries
5806                                 # Use emximp which will extract exactly them.
5807                                 emximp -o tmp.imp $thisname \
5808                                     2>/dev/null && \
5809                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5810                                     < tmp.imp >>libc.tmp
5811                                 $rm tmp.imp
5812                         done
5813                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5814                         echo "Ok." >&4
5815                 else
5816                         echo "$ar didn't seem to work right." >&4
5817                         echo "Maybe this is a Cray...trying bld instead..." >&4
5818                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5819                         then
5820                                 for thisname in $libnames; do
5821                                         bld t $libnames | \
5822                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5823                                         $ar t $thisname >>libc.tmp
5824                                 done
5825                                 echo "Ok." >&4
5826                         else
5827                                 echo "That didn't work either.  Giving up." >&4
5828                                 exit 1
5829                         fi
5830                 fi
5831         fi
5832 fi
5833 nm_extract="$com"
5834 if $test -f /lib/syscalls.exp; then
5835         echo " "
5836         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5837         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5838 fi
5839 ;;
5840 esac
5841 $rm -f libnames libpath
5842
5843 : see if dld is available
5844 set dld.h i_dld
5845 eval $inhdr
5846
5847 : is a C symbol defined?
5848 csym='tlook=$1;
5849 case "$3" in
5850 -v) tf=libc.tmp; tc=""; tdc="";;
5851 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5852 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5853 esac;
5854 tx=yes;
5855 case "$reuseval-$4" in
5856 true-) ;;
5857 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5858 esac;
5859 case "$tx" in
5860 yes)
5861         case "$runnm" in
5862         true)
5863                 if $contains $tlook $tf >/dev/null 2>&1;
5864                 then tval=true;
5865                 else tval=false;
5866                 fi;;
5867         *)
5868                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5869                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5870                 then tval=true;
5871                 else tval=false;
5872                 fi;
5873                 $rm -f t t.c;;
5874         esac;;
5875 *)
5876         case "$tval" in
5877         $define) tval=true;;
5878         *) tval=false;;
5879         esac;;
5880 esac;
5881 eval "$2=$tval"'
5882
5883 : define an is-in-libc? function
5884 inlibc='echo " "; td=$define; tu=$undef;
5885 sym=$1; var=$2; eval "was=\$$2";
5886 tx=yes;
5887 case "$reuseval$was" in
5888 true) ;;
5889 true*) tx=no;;
5890 esac;
5891 case "$tx" in
5892 yes)
5893         set $sym tres -f;
5894         eval $csym;
5895         case "$tres" in
5896         true)
5897                 echo "$sym() found." >&4;
5898                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5899         *)
5900                 echo "$sym() NOT found." >&4;
5901                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5902         esac;;
5903 *)
5904         case "$was" in
5905         $define) echo "$sym() found." >&4;;
5906         *) echo "$sym() NOT found." >&4;;
5907         esac;;
5908 esac'
5909
5910 : see if dlopen exists
5911 xxx_runnm="$runnm"
5912 runnm=false
5913 set dlopen d_dlopen
5914 eval $inlibc
5915 runnm="$xxx_runnm"
5916
5917 : determine which dynamic loading, if any, to compile in
5918 echo " "
5919 dldir="ext/DynaLoader"
5920 case "$usedl" in
5921 $define|y|true)
5922         dflt='y'
5923         usedl="$define"
5924         ;;
5925 $undef|n|false)
5926         dflt='n'
5927         usedl="$undef"
5928         ;;
5929 *) 
5930         dflt='n'
5931         case "$d_dlopen" in
5932             $define) dflt='y' ;;
5933         esac
5934         case "$i_dld" in
5935             $define) dflt='y' ;;
5936         esac
5937         : Does a dl_xxx.xs file exist for this operating system
5938         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5939         ;;
5940 esac
5941 rp="Do you wish to use dynamic loading?"
5942 . ./myread
5943 usedl="$ans"
5944 case "$ans" in
5945 y*) usedl="$define"
5946         case "$dlsrc" in
5947         '')
5948                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5949                         dflt="$dldir/dl_${osname}.xs"
5950                 elif $test "$d_dlopen" = "$define" ; then
5951                         dflt="$dldir/dl_dlopen.xs"
5952                 elif $test "$i_dld" = "$define" ; then
5953                         dflt="$dldir/dl_dld.xs"
5954                 else
5955                         dflt=''
5956                 fi
5957                 ;;
5958         *)      dflt="$dldir/$dlsrc"
5959                 ;;
5960         esac
5961     echo "The following dynamic loading files are available:"
5962         : Can not go over to $dldir because getfile has path hard-coded in.
5963         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5964         rp="Source file to use for dynamic loading"
5965         fn="fne"
5966         gfpth="$src"
5967         . ./getfile
5968         usedl="$define"
5969         : emulate basename
5970         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
5971
5972         $cat << EOM
5973
5974 Some systems may require passing special flags to $cc -c to
5975 compile modules that will be used to create a shared library.
5976 To use no flags, say "none".
5977
5978 EOM
5979     case "$cccdlflags" in
5980     '') case "$gccversion" in
5981                 '') case "$osname" in
5982                         hpux)   dflt='+z' ;;
5983                         next)   dflt='none' ;;
5984                         irix*)  dflt='-KPIC' ;;
5985                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5986                         sunos)  dflt='-pic' ;;
5987                         *)      dflt='none' ;;
5988                     esac
5989                         ;;
5990                 *)  case "$osname" in
5991                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5992                         *)      dflt='-fpic' ;;
5993                     esac ;;
5994             esac ;;
5995         ' ') dflt='none' ;;
5996     *)  dflt="$cccdlflags" ;;
5997     esac
5998     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5999     . ./myread
6000     case "$ans" in
6001     none) cccdlflags=' ' ;;
6002     *) cccdlflags="$ans" ;;
6003     esac
6004
6005     cat << EOM
6006
6007 Some systems use ld to create libraries that can be dynamically loaded,
6008 while other systems (such as those using ELF) use $cc.
6009
6010 EOM
6011         case "$ld" in
6012         '')     $cat >try.c <<'EOM'
6013 /* Test for whether ELF binaries are produced */
6014 #include <fcntl.h>
6015 #include <stdlib.h>
6016 int main() {
6017         char b[4];
6018         int i = open("a.out",O_RDONLY);
6019         if(i == -1) 
6020                 exit(1); /* fail */
6021         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6022                 exit(0); /* succeed (yes, it's ELF) */
6023         else
6024                 exit(1); /* fail */
6025 }
6026 EOM
6027                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6028                         cat <<EOM
6029 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6030 EOM
6031                         dflt="$cc"
6032                 else
6033                         echo "I'll use ld to build dynamic libraries."
6034                         dflt='ld'
6035                 fi
6036                 rm -f try.c a.out
6037                 ;;
6038         *)      dflt="$ld"
6039                 ;;
6040         esac
6041
6042     rp="What command should be used to create dynamic libraries?"
6043     . ./myread
6044         ld="$ans"
6045
6046     cat << EOM
6047
6048 Some systems may require passing special flags to $ld to create a
6049 library that can be dynamically loaded.  If your ld flags include
6050 -L/other/path options to locate libraries outside your loader's normal
6051 search path, you may need to specify those -L options here as well.  To
6052 use no flags, say "none".
6053
6054 EOM
6055     case "$lddlflags" in
6056     '') case "$osname" in
6057                         beos) dflt='-nostart' ;;
6058                         hpux)  dflt='-b +vnocompatwarnings' ;;
6059                         linux|irix*)    dflt='-shared' ;;
6060                         next)  dflt='none' ;;
6061                         solaris) dflt='-G' ;;
6062                         sunos) dflt='-assert nodefinitions' ;;
6063                         svr4*|esix*) dflt="-G $ldflags" ;;
6064                 *)     dflt='none' ;;
6065                         esac
6066                         ;;
6067     *) dflt="$lddlflags" ;;
6068     esac
6069
6070         : Try to guess additional flags to pick up local libraries.
6071         : Be careful not to append to a plain 'none'
6072         case "$dflt" in
6073         none) dflt='' ;;
6074         esac
6075         for thisflag in $ldflags; do
6076                 case "$thisflag" in
6077                 -L*)
6078                         case " $dflt " in
6079                         *" $thisflag "*) ;;
6080                         *) dflt="$dflt $thisflag" ;;
6081                         esac
6082                         ;;
6083                 esac
6084         done
6085
6086         case "$dflt" in
6087         ''|' ') dflt='none' ;;
6088         esac
6089
6090     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6091     . ./myread
6092     case "$ans" in
6093     none) lddlflags=' ' ;;
6094     *) lddlflags="$ans" ;;
6095     esac
6096
6097         cat <<EOM
6098
6099 Some systems may require passing special flags to $cc to indicate that
6100 the resulting executable will use dynamic linking.  To use no flags,
6101 say "none".
6102
6103 EOM
6104     case "$ccdlflags" in
6105     '') case "$osname" in
6106                 hpux)   dflt='-Wl,-E' ;;
6107                 linux)  dflt='-rdynamic' ;;
6108                 next)   dflt='none' ;;
6109                 sunos)  dflt='none' ;;
6110                 *)      dflt='none' ;;
6111             esac ;;
6112     ' ')  dflt='none' ;;
6113     *)  dflt="$ccdlflags" ;;
6114     esac
6115     rp="Any special flags to pass to $cc to use dynamic linking?"
6116     . ./myread
6117     case "$ans" in
6118     none) ccdlflags=' ' ;;
6119     *) ccdlflags="$ans" ;;
6120     esac
6121     ;;
6122 *)  usedl="$undef"
6123         ld='ld'
6124     dlsrc='dl_none.xs'
6125     lddlflags=''
6126     ccdlflags=''
6127     ;;
6128 esac
6129
6130 also=''
6131 case "$usedl" in
6132 $undef)
6133         # No dynamic loading being used, so don't bother even to prompt.
6134         useshrplib='false'
6135         ;;
6136 *)      case "$useshrplib" in
6137         '')     case "$osname" in
6138                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6139                         dflt=y
6140                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6141                         ;;
6142                 next*)
6143                         case "$osvers" in
6144                         4*)     dflt=y
6145                                 also='Building a shared libperl is needed for MAB support.'
6146                                 ;;
6147                         *)      dflt=n
6148                                 ;;
6149                         esac
6150                         ;;
6151                 *)      dflt=n
6152                         ;;
6153                 esac
6154                 ;;
6155         $define|true|[Yy]*)
6156                 dflt=y
6157                 ;;
6158         *)      dflt=n
6159                 ;;
6160         esac
6161         $cat << EOM
6162
6163 The perl executable is normally obtained by linking perlmain.c with
6164 libperl${_a}, any static extensions (usually just DynaLoader), and
6165 any other libraries needed on this system (such as -lm, etc.).  Since
6166 your system supports dynamic loading, it is probably possible to build
6167 a shared libperl.$so.  If you will have more than one executable linked
6168 to libperl.$so, this will significantly reduce the size of each
6169 executable, but it may have a noticeable affect on performance.  The
6170 default is probably sensible for your system.
6171 $also
6172
6173 EOM
6174         rp="Build a shared libperl.$so (y/n)"
6175         . ./myread
6176         case "$ans" in
6177         true|$define|[Yy]*)
6178                 useshrplib='true'  ;;
6179         *)      useshrplib='false' ;;
6180         esac
6181         ;;
6182 esac
6183
6184 case "$useshrplib" in
6185 true)
6186         case "$libperl" in
6187         '')
6188                 # Figure out a good name for libperl.so.  Since it gets stored in
6189                 # a version-specific architecture-dependent library, the version
6190                 # number isn't really that important, except for making cc/ld happy.
6191                 #
6192                 # A name such as libperl.so.3.1
6193                 majmin="libperl.$so.$patchlevel.$subversion"
6194                 # A name such as libperl.so.301
6195                 majonly=`echo $patchlevel $subversion |
6196                         $awk '{printf "%d%02d", $1, $2}'`
6197                 majonly=libperl.$so.$majonly
6198                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6199                 # rely on figuring it out from the naming of libc.
6200                 case "${osname}${osvers}" in
6201                 next4*)
6202                         dflt=libperl.5.$so
6203                         # XXX How handle the --version stuff for MAB?
6204                         ;;
6205                 linux*)  # ld won't link with a bare -lperl otherwise.
6206                         dflt=libperl.$so
6207                         ;;
6208                 cygwin*) # include version
6209                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6210                         ;;
6211                 *)      # Try to guess based on whether libc has major.minor.
6212                         case "$libc" in
6213                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6214                         *libc.$so.[0-9]*) dflt=$majonly ;;
6215                         *)      dflt=libperl.$so ;;
6216                         esac
6217                         ;;
6218                 esac
6219                 ;;
6220         *)      dflt=$libperl
6221                 ;;
6222         esac
6223         cat << EOM
6224
6225 I need to select a good name for the shared libperl.  If your system uses
6226 library names with major and minor numbers, then you might want something
6227 like $majmin.  Alternatively, if your system uses a single version
6228 number for shared libraries, then you might want to use $majonly.
6229 Or, your system might be quite happy with a simple libperl.$so.
6230
6231 Since the shared libperl will get installed into a version-specific
6232 architecture-dependent directory, the version number of the shared perl
6233 library probably isn't important, so the default should be o.k.
6234
6235 EOM
6236         rp='What name do you want to give to the shared libperl?'
6237         . ./myread
6238         libperl=$ans
6239         echo "Ok, I'll use $libperl"
6240         ;;
6241 *)
6242         libperl="libperl${_a}"
6243         ;;
6244 esac
6245
6246 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6247 case "$shrpdir" in
6248 '') ;;
6249 *)      $cat >&4 <<EOM
6250 WARNING:  Use of the shrpdir variable for the installation location of
6251 the shared $libperl is not supported.  It was never documented and
6252 will not work in this version.  Let me (perlbug@perl.com)
6253 know of any problems this may cause.
6254
6255 EOM
6256         case "$shrpdir" in
6257         "$archlibexp/CORE")
6258                 $cat >&4 <<EOM
6259 But your current setting of $shrpdir is
6260 the default anyway, so it's harmless.
6261 EOM
6262                 ;;
6263         *)
6264                 $cat >&4 <<EOM
6265 Further, your current attempted setting of $shrpdir
6266 conflicts with the value of $archlibexp/CORE
6267 that installperl will use.
6268 EOM
6269                 ;;
6270         esac
6271         ;;
6272 esac
6273
6274 # How will the perl executable find the installed shared $libperl?
6275 # Add $xxx to ccdlflags.
6276 # If we can't figure out a command-line option, use $shrpenv to
6277 # set env LD_RUN_PATH.  The main perl makefile uses this.
6278 shrpdir=$archlibexp/CORE
6279 xxx=''
6280 tmp_shrpenv=''
6281 if "$useshrplib"; then
6282     case "$osname" in 
6283         aix)
6284                 # We'll set it in Makefile.SH...
6285                 ;;
6286         solaris|netbsd)
6287                 xxx="-R $shrpdir"
6288                 ;;
6289         freebsd)
6290                 xxx="-Wl,-R$shrpdir"
6291                 ;;
6292         linux|irix*|dec_osf)
6293                 xxx="-Wl,-rpath,$shrpdir"
6294                 ;;
6295         next)
6296                 # next doesn't like the default...
6297                 ;;
6298         beos)
6299                 # beos doesn't like the default, either.
6300                 ;;
6301         hpux*)
6302                 # hpux doesn't like the default, either.
6303                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6304                 ;;
6305         *)
6306                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6307                 ;;
6308         esac
6309         case "$xxx" in
6310         '') ;;
6311         *)      
6312                 # Only add $xxx if it isn't already in ccdlflags.
6313                 case " $ccdlflags " in
6314                 *" $xxx "*)     ;;
6315                 *)      ccdlflags="$ccdlflags $xxx"
6316                         cat <<EOM >&4
6317
6318 Adding $xxx to the flags
6319 passed to $ld so that the perl executable will find the 
6320 installed shared $libperl.
6321
6322 EOM
6323                         ;;
6324                 esac
6325                 ;;
6326         esac
6327 fi
6328 # Fix ccdlflags in AIX for building external extensions.
6329 # (For building Perl itself bare -bE:perl.exp is needed,
6330 #  Makefile.SH takes care of this.)
6331 case "$osname" in
6332 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6333 esac
6334 # Respect a hint or command-line value.
6335 case "$shrpenv" in
6336 '') shrpenv="$tmp_shrpenv" ;;
6337 esac
6338 case "$ldlibpthname" in
6339 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6340 none)   ldlibpthname='' ;;
6341 esac
6342
6343 : determine where manual pages go
6344 set man1dir man1dir none
6345 eval $prefixit
6346 $cat <<EOM
6347
6348 $spackage has manual pages available in source form.
6349 EOM
6350 case "$nroff" in
6351 nroff)
6352         echo "However, you don't have nroff, so they're probably useless to you."
6353         case "$man1dir" in
6354         '') man1dir="none";;
6355         esac;;
6356 esac
6357 echo "If you don't want the manual sources installed, answer 'none'."
6358 case "$man1dir" in
6359 ' ') dflt=none
6360         ;;
6361 '')
6362         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6363         lookpath="$lookpath $prefixexp/man/p_man/man1"
6364         lookpath="$lookpath $prefixexp/man/u_man/man1"
6365         lookpath="$lookpath $prefixexp/man/man.1"
6366         case "$sysman" in
6367         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6368         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6369         esac
6370         set dflt
6371         eval $prefixup
6372         ;;
6373 *)  dflt="$man1dir"
6374         ;;
6375 esac
6376 echo " "
6377 fn=dn+~
6378 rp="Where do the main $spackage manual pages (source) go?"
6379 . ./getfile
6380 if $test "X$man1direxp" != "X$ansexp"; then
6381         installman1dir=''
6382 fi
6383 man1dir="$ans"
6384 man1direxp="$ansexp"
6385 case "$man1dir" in
6386 '')     man1dir=' '
6387         installman1dir='';;
6388 esac
6389
6390 : Change installation prefix, if necessary.
6391 if $test X"$prefix" != X"$installprefix"; then
6392         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6393 else
6394         installman1dir="$man1direxp"
6395 fi
6396
6397 : What suffix to use on installed man pages
6398
6399 case "$man1dir" in
6400 ' ')
6401         man1ext='0'
6402         ;;
6403 *)
6404         rp="What suffix should be used for the main $spackage man pages?"
6405         case "$man1ext" in
6406         '')     case "$man1dir" in
6407                 *1)  dflt=1 ;;
6408                 *1p) dflt=1p ;;
6409                 *1pm) dflt=1pm ;;
6410                 *l) dflt=l;;
6411                 *n) dflt=n;;
6412                 *o) dflt=o;;
6413                 *p) dflt=p;;
6414                 *C) dflt=C;;
6415                 *L) dflt=L;;
6416                 *L1) dflt=L1;;
6417                 *) dflt=1;;
6418                 esac
6419                 ;;
6420         *)      dflt="$man1ext";;
6421         esac
6422         . ./myread
6423         man1ext="$ans"
6424         ;;
6425 esac
6426
6427 : see if we can have long filenames
6428 echo " "
6429 rmlist="$rmlist /tmp/cf$$"
6430 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6431 first=123456789abcdef
6432 second=/tmp/cf$$/$first
6433 $rm -f $first $second
6434 if (echo hi >$first) 2>/dev/null; then
6435         if $test -f 123456789abcde; then
6436                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6437                 val="$undef"
6438         else
6439                 if (echo hi >$second) 2>/dev/null; then
6440                         if $test -f /tmp/cf$$/123456789abcde; then
6441                                 $cat <<'EOM'
6442 That's peculiar... You can have filenames longer than 14 characters, but only
6443 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6444 I shall consider your system cannot support long filenames at all.
6445 EOM
6446                                 val="$undef"
6447                         else
6448                                 echo 'You can have filenames longer than 14 characters.' >&4
6449                                 val="$define"
6450                         fi
6451                 else
6452                         $cat <<'EOM'
6453 How confusing! Some of your filesystems are sane enough to allow filenames
6454 longer than 14 characters but some others like /tmp can't even think about them.
6455 So, for now on, I shall assume your kernel does not allow them at all.
6456 EOM
6457                         val="$undef"
6458                 fi
6459         fi
6460 else
6461         $cat <<'EOM'
6462 You can't have filenames longer than 14 chars.  You can't even think about them!
6463 EOM
6464         val="$undef"
6465 fi 
6466 set d_flexfnam
6467 eval $setvar
6468 $rm -rf /tmp/cf$$ 123456789abcde*
6469
6470 : determine where library module manual pages go
6471 set man3dir man3dir none
6472 eval $prefixit
6473 $cat <<EOM
6474
6475 $spackage has manual pages for many of the library modules.
6476 EOM
6477
6478 case "$nroff" in
6479 nroff)
6480         $cat <<'EOM'
6481 However, you don't have nroff, so they're probably useless to you.
6482 EOM
6483         case "$man3dir" in
6484         '') man3dir="none";;
6485         esac;;
6486 esac
6487
6488 case "$d_flexfnam" in
6489 undef)
6490         $cat <<'EOM'
6491 However, your system can't handle the long file names like File::Basename.3. 
6492 EOM
6493         case "$man3dir" in
6494         '') man3dir="none";;
6495         esac;;
6496 esac
6497
6498 echo "If you don't want the manual sources installed, answer 'none'."
6499 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6500 case "$man3dir" in
6501 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6502         if $test -d "$privlib/man/man3"; then
6503                 cat <<EOM >&4
6504
6505 WARNING:  Previous versions of perl installed man3 pages into
6506 $privlib/man/man3.  This version will suggest a 
6507 new default of $dflt.  
6508 EOM
6509                 tdflt=$dflt
6510                 dflt='n'
6511                 rp='Do you wish to preserve the old behavior?(y/n)'
6512                 . ./myread
6513                 case "$ans" in
6514                 y*) dflt="$privlib/man/man3" ;;
6515                 *)  dflt=$tdflt ;;
6516                 esac
6517     fi
6518         ;;
6519 ' ') dflt=none;;
6520 *)      dflt="$man3dir" ;;
6521 esac
6522 echo " "
6523 fn=dn+~
6524 rp="Where do the $package library man pages (source) go?"
6525 . ./getfile
6526 man3dir="$ans"
6527 man3direxp="$ansexp"
6528 case "$man1dir" in
6529 '')     man3dir=' '
6530         installman3dir='';;
6531 esac
6532
6533 : Change installation prefix, if necessary.
6534 if $test X"$prefix" != X"$installprefix"; then
6535         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6536 else
6537         installman3dir="$man3direxp"
6538 fi
6539
6540 : What suffix to use on installed man pages
6541 case "$man3dir" in
6542 ' ')
6543         man3ext='0'
6544         ;;
6545 *)
6546         rp="What suffix should be used for the $package library man pages?"
6547         case "$man3ext" in
6548         '')     case "$man3dir" in
6549                 *3)  dflt=3 ;;
6550                 *3p) dflt=3p ;;
6551                 *3pm) dflt=3pm ;;
6552                 *l) dflt=l;;
6553                 *n) dflt=n;;
6554                 *o) dflt=o;;
6555                 *p) dflt=p;;
6556                 *C) dflt=C;;
6557                 *L) dflt=L;;
6558                 *L3) dflt=L3;;
6559                 *) dflt=3;;
6560                 esac
6561                 ;;
6562         *)      dflt="$man3ext";;
6563         esac
6564         . ./myread
6565         man3ext="$ans"
6566         ;;
6567 esac
6568
6569 : see if we have to deal with yellow pages, now NIS.
6570 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6571         if $test -f /usr/etc/nibindd; then
6572                 echo " "
6573                 echo "I'm fairly confident you're on a NeXT."
6574                 echo " "
6575                 rp='Do you get the hosts file via NetInfo?'
6576                 dflt=y
6577                 case "$hostcat" in
6578                 nidump*) ;;
6579                 '') ;;
6580                 *) dflt=n;;
6581                 esac
6582                 . ./myread
6583                 case "$ans" in
6584                 y*) hostcat='nidump hosts .';;
6585                 *)      case "$hostcat" in
6586                         nidump*) hostcat='';;
6587                         esac
6588                         ;;
6589                 esac
6590         fi
6591         case "$hostcat" in
6592         nidump*) ;;
6593         *)
6594                 case "$hostcat" in
6595                 *ypcat*) dflt=y;;
6596                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6597                                 dflt=y
6598                         else
6599                                 dflt=n
6600                         fi;;
6601                 *) dflt=n;;
6602                 esac
6603                 echo " "
6604                 rp='Are you getting the hosts file via yellow pages?'
6605                 . ./myread
6606                 case "$ans" in
6607                 y*) hostcat='ypcat hosts';;
6608                 *) hostcat='cat /etc/hosts';;
6609                 esac
6610                 ;;
6611         esac
6612 fi
6613 case "$hostcat" in
6614 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6615 esac
6616 case "$groupcat" in
6617 '') test -f /etc/group && groupcat='cat /etc/group';;
6618 esac
6619 case "$passcat" in
6620 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6621 esac
6622
6623 : now get the host name
6624 echo " "
6625 echo "Figuring out host name..." >&4
6626 case "$myhostname" in
6627 '') cont=true
6628         echo 'Maybe "hostname" will work...'
6629         if tans=`sh -c hostname 2>&1` ; then
6630                 myhostname=$tans
6631                 phostname=hostname
6632                 cont=''
6633         fi
6634         ;;
6635 *) cont='';;
6636 esac
6637 if $test "$cont"; then
6638         if ./xenix; then
6639                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6640                 if tans=`cat /etc/systemid 2>&1` ; then
6641                         myhostname=$tans
6642                         phostname='cat /etc/systemid'
6643                         echo "Whadyaknow.  Xenix always was a bit strange..."
6644                         cont=''
6645                 fi
6646         elif $test -r /etc/systemid; then
6647                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6648         fi
6649 fi
6650 if $test "$cont"; then
6651         echo 'No, maybe "uuname -l" will work...'
6652         if tans=`sh -c 'uuname -l' 2>&1` ; then
6653                 myhostname=$tans
6654                 phostname='uuname -l'
6655         else
6656                 echo 'Strange.  Maybe "uname -n" will work...'
6657                 if tans=`sh -c 'uname -n' 2>&1` ; then
6658                         myhostname=$tans
6659                         phostname='uname -n'
6660                 else
6661                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6662                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6663                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6664                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6665                         else
6666                                 case "$myhostname" in
6667                                 '') echo "Does this machine have an identity crisis or something?"
6668                                         phostname='';;
6669                                 *)
6670                                         echo "Well, you said $myhostname before..."
6671                                         phostname='echo $myhostname';;
6672                                 esac
6673                         fi
6674                 fi
6675         fi
6676 fi
6677 : you do not want to know about this
6678 set $myhostname
6679 myhostname=$1
6680
6681 : verify guess
6682 if $test "$myhostname" ; then
6683         dflt=y
6684         rp='Your host name appears to be "'$myhostname'".'" Right?"
6685         . ./myread
6686         case "$ans" in
6687         y*) ;;
6688         *) myhostname='';;
6689         esac
6690 fi
6691
6692 : bad guess or no guess
6693 while $test "X$myhostname" = X ; do
6694         dflt=''
6695         rp="Please type the (one word) name of your host:"
6696         . ./myread
6697         myhostname="$ans"
6698 done
6699
6700 : translate upper to lower if necessary
6701 case "$myhostname" in
6702 *[A-Z]*)
6703         echo "(Normalizing case in your host name)"
6704         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6705         ;;
6706 esac
6707
6708 case "$myhostname" in
6709 *.*)
6710         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6711         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6712         echo "(Trimming domain name from host name--host name is now $myhostname)"
6713         ;;
6714 *) case "$mydomain" in
6715         '')
6716                 {
6717                         test "X$hostcat" = "Xypcat hosts" &&
6718                         ypmatch "$myhostname" hosts 2>/dev/null |\
6719                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6720                         $test -s hosts
6721                 } || {
6722                         test "X$hostcat" != "X" &&
6723                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6724                                         /[       ]$myhostname[  . ]/p" > hosts
6725                 }
6726                 tmp_re="[       . ]"
6727                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6728                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6729                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6730                         hosts | $sort | $uniq | \
6731                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6732                 case `$echo X$dflt` in
6733                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6734                         dflt=.
6735                         ;;
6736                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6737                         ;;
6738                 esac
6739                 case "$dflt" in
6740                 .)
6741                         tans=`./loc resolv.conf X /etc /usr/etc`
6742                         if $test -f "$tans"; then
6743                                 echo "(Attempting domain name extraction from $tans)"
6744                                 dflt=.`$sed -n -e 's/   / /g' \
6745                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6746                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6747                                 case "$dflt" in
6748                                 .) dflt=.`$sed -n -e 's/        / /g' \
6749                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6750                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6751                                         ;;
6752                                 esac
6753                         fi
6754                         ;;
6755                 esac
6756                 case "$dflt" in
6757                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6758                         dflt=.`sh -c domainname 2>/dev/null`
6759                         case "$dflt" in
6760                         '') dflt='.';;
6761                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6762                         esac
6763                         ;;
6764                 esac
6765                 case "$dflt" in
6766                 .) echo "(Lost all hope -- silly guess then)"
6767                         dflt='.uucp'
6768                         ;;
6769                 esac
6770                 $rm -f hosts
6771                 ;;
6772         *) dflt="$mydomain";;
6773         esac;;
6774 esac
6775 echo " "
6776 rp="What is your domain name?"
6777 . ./myread
6778 tans="$ans"
6779 case "$ans" in
6780 '') ;;
6781 .*) ;;
6782 *) tans=".$tans";;
6783 esac
6784 mydomain="$tans"
6785
6786 : translate upper to lower if necessary
6787 case "$mydomain" in
6788 *[A-Z]*)
6789         echo "(Normalizing case in your domain name)"
6790         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6791         ;;
6792 esac
6793
6794 : a little sanity check here
6795 case "$phostname" in
6796 '') ;;
6797 *)
6798         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6799         $myhostname$mydomain|$myhostname) ;;
6800         *)
6801                 case "$phostname" in
6802                 sed*)
6803                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6804                         ;;
6805                 *)
6806                         echo "(That doesn't agree with your $phostname command, by the way.)"
6807                         ;;
6808                 esac
6809         ;;
6810         esac
6811         ;;
6812 esac
6813
6814 $cat <<EOM
6815
6816 I need to get your e-mail address in Internet format if possible, i.e.
6817 something like user@host.domain. Please answer accurately since I have
6818 no easy means to double check it. The default value provided below
6819 is most probably close to reality but may not be valid from outside
6820 your organization...
6821
6822 EOM
6823 cont=x
6824 while test "$cont"; do
6825         case "$cf_email" in
6826         '') dflt="$cf_by@$myhostname$mydomain";;
6827         *) dflt="$cf_email";;
6828         esac
6829         rp='What is your e-mail address?'
6830         . ./myread
6831         cf_email="$ans"
6832         case "$cf_email" in
6833         *@*.*) cont='' ;;
6834         *)
6835                 rp='Address does not look like an Internet one.  Use it anyway?'
6836                 case "$fastread" in
6837                 yes) dflt=y ;;
6838                 *) dflt=n ;;
6839                 esac
6840                 . ./myread
6841                 case "$ans" in
6842                 y*) cont='' ;;
6843                 *) echo " " ;;
6844                 esac
6845                 ;;
6846         esac
6847 done
6848
6849 $cat <<EOM
6850
6851 If you or somebody else will be maintaining perl at your site, please
6852 fill in the correct e-mail address here so that they may be contacted
6853 if necessary. Currently, the "perlbug" program included with perl
6854 will send mail to this address in addition to perlbug@perl.com. You may
6855 enter "none" for no administrator.
6856
6857 EOM
6858 case "$perladmin" in
6859 '') dflt="$cf_email";;
6860 *) dflt="$perladmin";;
6861 esac
6862 rp='Perl administrator e-mail address'
6863 . ./myread
6864 perladmin="$ans"
6865
6866 : figure out how to guarantee perl startup
6867 case "$startperl" in
6868 '')
6869         case "$sharpbang" in
6870         *!)
6871                 $cat <<EOH
6872
6873 I can use the #! construct to start perl on your system. This will
6874 make startup of perl scripts faster, but may cause problems if you
6875 want to share those scripts and perl is not in a standard place
6876 ($binexp/perl) on all your platforms. The alternative is to force
6877 a shell by starting the script with a single ':' character.
6878
6879 EOH
6880                 dflt="$binexp/perl"
6881                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6882                 . ./myread
6883                 case "$ans" in
6884                 none)   startperl=": # use perl";;
6885                 *)      startperl="#!$ans"
6886                         if $test 30 -lt `echo "$ans" | wc -c`; then
6887                                 $cat >&4 <<EOM
6888
6889 WARNING:  Some systems limit the #! command to 32 characters.
6890 If you experience difficulty running Perl scripts with #!, try
6891 installing Perl in a directory with a shorter pathname.
6892
6893 EOM
6894                         fi ;;
6895                 esac
6896                 ;;
6897         *) startperl=": # use perl"
6898                 ;;
6899         esac
6900         ;;
6901 esac
6902 echo "I'll use $startperl to start perl scripts."
6903
6904 : figure best path for perl in scripts
6905 case "$perlpath" in
6906 '')
6907         perlpath="$binexp/perl"
6908         case "$startperl" in
6909         *!*) ;;
6910         *)
6911                 $cat <<EOH
6912
6913 I will use the "eval 'exec'" idiom to start Perl on your system.
6914 I can use the full path of your Perl binary for this purpose, but
6915 doing so may cause problems if you want to share those scripts and
6916 Perl is not always in a standard place ($binexp/perl).
6917
6918 EOH
6919                 dflt="$binexp/perl"
6920                 rp="What path shall I use in \"eval 'exec'\"?"
6921                 . ./myread
6922                 perlpath="$ans"
6923                 ;;
6924         esac
6925         ;;
6926 esac
6927 case "$startperl" in
6928 *!*)    ;;
6929 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6930 esac
6931
6932 : determine where public executable scripts go
6933 set scriptdir scriptdir
6934 eval $prefixit
6935 case "$scriptdir" in
6936 '')
6937         dflt="$bin"
6938         : guess some guesses
6939         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6940         $test -d /usr/share/bin     && dflt=/usr/share/bin
6941         $test -d /usr/local/script  && dflt=/usr/local/script
6942         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6943         $test -d $prefixexp/script  && dflt=$prefixexp/script
6944         set dflt
6945         eval $prefixup
6946         ;;
6947 *)  dflt="$scriptdir"
6948         ;;
6949 esac
6950 $cat <<EOM
6951  
6952 Some installations have a separate directory just for executable scripts so
6953 that they can mount it across multiple architectures but keep the scripts in
6954 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6955 Or you might just lump your scripts in with all your other executables.
6956  
6957 EOM
6958 fn=d~
6959 rp='Where do you keep publicly executable scripts?'
6960 . ./getfile
6961 if $test "X$ansexp" != "X$scriptdirexp"; then
6962         installscript=''
6963 fi
6964 scriptdir="$ans"
6965 scriptdirexp="$ansexp"
6966 : Change installation prefix, if necessary.
6967 if $test X"$prefix" != X"$installprefix"; then
6968         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6969 else
6970         installscript="$scriptdirexp"
6971 fi
6972
6973 : determine where site specific architecture-dependent libraries go.
6974 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6975 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6976 : sitelib may have an optional trailing /share.
6977 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6978 tdflt="$tdflt/$archname"
6979 set sitearch sitearch none
6980 eval $prefixit
6981 case "$sitearch" in
6982 '')     dflt="$tdflt" ;;
6983 *)      dflt="$sitearch" ;;
6984 esac
6985 $cat <<EOM
6986
6987 The installation process will also create a directory for
6988 architecture-dependent site-specific extensions and modules.
6989
6990 EOM
6991 fn=nd~+
6992 rp='Pathname for the site-specific architecture-dependent library files?'
6993 . ./getfile
6994 sitearch="$ans"
6995 sitearchexp="$ansexp"
6996 : Change installation prefix, if necessary.
6997 if $test X"$prefix" != X"$installprefix"; then
6998         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6999 else
7000         installsitearch="$sitearchexp"
7001 fi
7002
7003 : determine where add-on public executables go
7004 case "$sitebin" in
7005 '')     dflt=$siteprefix/bin ;;
7006 *)      dflt=$sitebin ;;
7007 esac
7008 fn=d~
7009 rp='Pathname where the add-on public executables should be installed?'
7010 . ./getfile
7011 sitebin="$ans"
7012 sitebinexp="$ansexp"
7013 : Change installation prefix, if necessary.
7014 if $test X"$prefix" != X"$installprefix"; then
7015         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7016 else
7017         installsitebin="$sitebinexp"
7018 fi
7019
7020 : see if sqrtl exists
7021 set sqrtl d_sqrtl
7022 eval $inlibc
7023
7024 case "$ccflags" in
7025 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7026 esac
7027
7028 case "$uselongdouble" in
7029 $define|true|[yY]*)     dflt='y';;
7030 *) dflt='n';;
7031 esac
7032 cat <<EOM
7033
7034 Perl can be built to take advantage of long doubles which
7035 (if available) may give more accuracy and range for floating point numbers.
7036
7037 If this doesn't make any sense to you, just accept the default '$dflt'.
7038 EOM
7039 rp='Try to use long doubles if available?'
7040 . ./myread
7041 case "$ans" in
7042 y|Y)    val="$define"   ;;
7043 *)      val="$undef"    ;;
7044 esac
7045 set uselongdouble
7046 eval $setvar
7047
7048 case "$uselongdouble" in
7049 true|[yY]*) uselongdouble="$define" ;;
7050 esac
7051
7052 case "$uselongdouble" in
7053 $define)
7054 : Look for a hint-file generated 'call-back-unit'.  If the
7055 : user has specified that long doubles should be used,
7056 : we may need to set or change some other defaults.
7057         if $test -f uselongdouble.cbu; then
7058                 echo "Your platform has some specific hints for long doubles, using them..."
7059                 . ./uselongdouble.cbu
7060         else
7061                 $cat <<EOM
7062 (Your platform doesn't have any specific hints for long doubles.)
7063 EOM
7064         fi
7065         ;;
7066 esac
7067
7068 case "$uselongdouble:$d_sqrtl" in
7069 $define:$undef)
7070                 $cat <<EOM >&4
7071
7072 You requested the use of long doubles but you do not seem to have
7073 the mathematic functions for long doubles.  I'm disabling the use
7074 of long doubles.
7075 EOM
7076         uselongdouble=$undef
7077         ;;
7078 esac
7079
7080 case "$useperlio" in
7081 $define|true|[yY]*)     dflt='y';;
7082 *) dflt='n';;
7083 esac
7084 cat <<EOM
7085
7086 Previous version of $package used the standard IO mechanisms as defined
7087 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7088 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7089 the default.  This abstraction layer can use AT&T's sfio (if you already
7090 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7091 problems with some extension modules.  Using PerlIO with stdio is safe,
7092 but it is slower than plain stdio and therefore is not the default.
7093
7094 If this doesn't make any sense to you, just accept the default '$dflt'.
7095 EOM
7096 rp='Use the experimental PerlIO abstraction layer?'
7097 . ./myread
7098 case "$ans" in
7099 y|Y) 
7100         val="$define"
7101         ;;     
7102 *)      
7103         echo "Ok, doing things the stdio way"
7104         val="$undef"
7105         ;;
7106 esac
7107 set useperlio
7108 eval $setvar 
7109
7110 case "$vendorprefix" in
7111 '')     d_vendorbin="$undef"
7112         vendorbin=''
7113         vendorbinexp=''
7114         ;;
7115 *)      d_vendorbin="$define"
7116         : determine where vendor-supplied executables go.
7117         dflt=$vendorprefix/bin
7118         fn=d~+
7119         rp='Pathname for the vendor-supplied executables directory?'
7120         . ./getfile
7121         vendorbin="$ans"
7122         vendorbinexp="$ansexp"
7123         : Change installation prefix, if necessary.
7124         if $test X"$prefix" != X"$installprefix"; then
7125                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7126         else
7127                 installvendorbin="$vendorbinexp"
7128         fi
7129         ;;
7130 esac
7131
7132 : check for length of double
7133 echo " "
7134 case "$doublesize" in
7135 '')
7136         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7137         $cat >try.c <<'EOCP'
7138 #include <stdio.h>
7139 int main()
7140 {
7141     printf("%d\n", (int)sizeof(double));
7142     exit(0);
7143 }
7144 EOCP
7145         set try
7146         if eval $compile_ok; then
7147                 doublesize=`./try`
7148                 $echo " $doublesize bytes." >&4
7149         else
7150                 dflt='8'
7151                 echo "(I can't seem to compile the test program.  Guessing...)"
7152                 rp="What is the size of a double precision number (in bytes)?"
7153                 . ./myread
7154                 doublesize="$ans"
7155         fi
7156         ;;
7157 esac
7158 $rm -f try.c try
7159
7160 : check for long doubles
7161 echo " "
7162 $echo $n "Checking to see if your system supports long double..." $c >&4
7163 echo 'int main() { long double x = 7.0; }' > try.c
7164 set try
7165 if eval $compile; then
7166         val="$define"
7167         echo " " >&4
7168         echo "You have long double."
7169 else
7170         val="$undef"
7171         echo " " >&4
7172         echo "You do not have long double."
7173 fi
7174 $rm try.*
7175 set d_longdbl
7176 eval $setvar
7177
7178 : check for length of long double
7179 case "${d_longdbl}${longdblsize}" in
7180 $define)
7181         echo " "
7182         $echo $n "Checking to see how big your long doubles are..." $c >&4
7183         $cat >try.c <<'EOCP'
7184 #include <stdio.h>
7185 int main()
7186 {
7187         printf("%d\n", sizeof(long double));
7188 }
7189 EOCP
7190         set try
7191         set try
7192         if eval $compile; then
7193                 longdblsize=`./try$exe_ext`
7194                 $echo " $longdblsize bytes." >&4
7195         else
7196                 dflt='8'
7197                 echo " "
7198                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7199                 rp="What is the size of a long double (in bytes)?"
7200                 . ./myread
7201                 longdblsize="$ans"
7202         fi
7203         if $test "X$doublesize" = "X$longdblsize"; then
7204                 echo "(That isn't any different from an ordinary double.)"
7205         fi      
7206         ;;
7207 esac
7208 $rm -f try.* try
7209
7210 : Check how to convert floats to strings.
7211 if test "X$d_Gconvert" = X; then
7212         echo " "
7213         echo "Checking for an efficient way to convert floats to strings."
7214         $cat >try.c <<EOP
7215 #ifdef TRY_gconvert
7216 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7217 char *myname = "gconvert";
7218 #endif
7219 #ifdef TRY_gcvt
7220 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7221 char *myname = "gcvt";
7222 #endif
7223 #ifdef TRY_qgcvt
7224 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7225 char *myname = "qgcvt";
7226 #define DOUBLETYPE long double
7227 #endif
7228 #ifdef TRY_sprintf
7229 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7230 char *myname = "sprintf";
7231 #endif
7232
7233 #ifndef DOUBLETYPE
7234 #define DOUBLETYPE double
7235 #endif
7236
7237 #include <stdio.h>
7238
7239 #define I_STDLIB $i_stdlib
7240 #ifdef I_STDLIB
7241 #include <stdlib.h>
7242 #endif
7243
7244 int
7245 checkit(expect, got)
7246 char *expect;
7247 char *got;
7248 {
7249     if (strcmp(expect, got)) {
7250                 printf("%s oddity:  Expected %s, got %s\n",
7251                         myname, expect, got);
7252                 exit(1);
7253         }
7254 }
7255
7256 int main()
7257
7258         char buf[64]; 
7259         buf[63] = '\0';
7260
7261         /* This must be 1st test on (which?) platform */
7262         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7263         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7264         checkit("0.1", buf);
7265
7266         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7267         checkit("1", buf);
7268
7269         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7270         checkit("0", buf);
7271
7272         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7273         checkit("-1", buf);
7274
7275         /* Some Linux gcvt's give 1.e+5 here. */
7276         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7277         checkit("100000", buf);
7278         
7279         /* Some Linux gcvt's give -1.e+5 here. */
7280         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7281         checkit("-100000", buf);
7282
7283         exit(0);
7284 }
7285 EOP
7286         case "$d_Gconvert" in
7287         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7288         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7289         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7290         *) xxx_list='gconvert gcvt sprintf' ;;
7291         esac
7292
7293         case "$d_longdbl$uselongdouble" in
7294         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7295         esac
7296
7297         for xxx_convert in $xxx_list; do
7298                 echo "Trying $xxx_convert..."
7299                 $rm -f try try$_o
7300                 set try -DTRY_$xxx_convert
7301                 if eval $compile; then
7302                         echo "$xxx_convert() found." >&4
7303                         if ./try; then
7304                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7305                                 break;
7306                         else
7307                                 echo "...But $xxx_convert didn't work as I expected."
7308                         fi
7309                 else
7310                         echo "$xxx_convert NOT found." >&4
7311                 fi
7312         done
7313                 
7314         case "$xxx_convert" in
7315         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7316         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7317         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7318         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7319         esac
7320 fi
7321
7322 echo " "
7323
7324 if $test X"$d_longdbl" = X"$define"; then
7325
7326 echo "Checking how to print long doubles..." >&4
7327
7328 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7329         $cat >try.c <<'EOCP'
7330 #include <sys/types.h>
7331 #include <stdio.h>
7332 int main() {
7333   double d = 123.456;
7334   printf("%.3f\n", d);
7335 }
7336 EOCP
7337         set try
7338         if eval $compile; then
7339                 yyy=`./try$exe_ext`
7340                 case "$yyy" in
7341                 123.456)
7342                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7343                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7344                         echo "We will use %f."
7345                         ;;
7346                 esac
7347         fi
7348 fi
7349
7350 if $test X"$sPRIfldbl" = X; then
7351         $cat >try.c <<'EOCP'
7352 #include <sys/types.h>
7353 #include <stdio.h>
7354 int main() {
7355   long double d = 123.456;
7356   printf("%.3llf\n", d);
7357 }
7358 EOCP
7359         set try
7360         if eval $compile; then
7361                 yyy=`./try$exe_ext`
7362                 case "$yyy" in
7363                 123.456)
7364                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7365                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7366                         echo "We will use %llf."
7367                         ;;
7368                 esac
7369         fi
7370 fi
7371
7372 if $test X"$sPRIfldbl" = X; then
7373         $cat >try.c <<'EOCP'
7374 #include <sys/types.h>
7375 #include <stdio.h>
7376 int main() {
7377   long double d = 123.456;
7378   printf("%.3Lf\n", d);
7379 }
7380 EOCP
7381         set try
7382         if eval $compile; then
7383                 yyy=`./try$exe_ext`
7384                 case "$yyy" in
7385                 123.456)
7386                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7387                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7388                         echo "We will use %Lf."
7389                         ;;
7390                 esac
7391         fi
7392 fi
7393
7394 if $test X"$sPRIfldbl" = X; then
7395         $cat >try.c <<'EOCP'
7396 #include <sys/types.h>
7397 #include <stdio.h>
7398 int main() {
7399   long double d = 123.456;
7400   printf("%.3lf\n", d);
7401 }
7402 EOCP
7403         set try
7404         if eval $compile; then
7405                 yyy=`./try$exe_ext`
7406                 case "$yyy" in
7407                 123.456)
7408                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7409                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7410                         echo "We will use %lf."
7411                         ;;
7412                 esac
7413         fi
7414 fi
7415
7416 if $test X"$sPRIfldbl" = X; then
7417         echo "Cannot figure out how to print long doubles." >&4
7418 fi
7419
7420 $rm -f try try.*
7421
7422 fi # d_longdbl
7423
7424 case "$sPRIfldbl" in
7425 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7426         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7427         ;;
7428 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7429         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7430         ;;
7431 esac
7432
7433 : Initialize h_fcntl
7434 h_fcntl=false
7435
7436 : Initialize h_sysfile
7437 h_sysfile=false
7438
7439 : access call always available on UNIX
7440 set access d_access
7441 eval $inlibc
7442
7443 : locate the flags for 'access()'
7444 case "$d_access" in
7445 "$define")
7446         echo " "
7447         $cat >access.c <<'EOCP'
7448 #include <sys/types.h>
7449 #ifdef I_FCNTL
7450 #include <fcntl.h>
7451 #endif
7452 #ifdef I_SYS_FILE
7453 #include <sys/file.h>
7454 #endif
7455 #ifdef I_UNISTD
7456 #include <unistd.h>
7457 #endif
7458 int main() {
7459         exit(R_OK);
7460 }
7461 EOCP
7462         : check sys/file.h first, no particular reason here
7463         if $test `./findhdr sys/file.h` && \
7464                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7465                 h_sysfile=true;
7466                 echo "<sys/file.h> defines the *_OK access constants." >&4
7467         elif $test `./findhdr fcntl.h` && \
7468                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7469                 h_fcntl=true;
7470                 echo "<fcntl.h> defines the *_OK access constants." >&4
7471         elif $test `./findhdr unistd.h` && \
7472                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7473                 echo "<unistd.h> defines the *_OK access constants." >&4
7474         else
7475                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7476         fi
7477         ;;
7478 esac
7479 $rm -f access*
7480
7481 : see if accessx exists
7482 set accessx d_accessx
7483 eval $inlibc
7484
7485 : see if alarm exists
7486 set alarm d_alarm
7487 eval $inlibc
7488
7489 : see if atolf exists
7490 set atolf d_atolf
7491 eval $inlibc
7492
7493 : see if atoll exists
7494 set atoll d_atoll
7495 eval $inlibc
7496
7497 : Look for GNU-cc style attribute checking
7498 echo " "
7499 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7500 $cat >attrib.c <<'EOCP'
7501 #include <stdio.h>
7502 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7503 EOCP
7504 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7505         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7506                 echo "Your C compiler doesn't fully support __attribute__."
7507                 val="$undef"
7508         else
7509                 echo "Your C compiler supports __attribute__."
7510                 val="$define"
7511         fi
7512 else
7513         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7514         val="$undef"
7515 fi
7516 set d_attribut
7517 eval $setvar
7518 $rm -f attrib*
7519
7520 : see if bcmp exists
7521 set bcmp d_bcmp
7522 eval $inlibc
7523
7524 : see if bcopy exists
7525 set bcopy d_bcopy
7526 eval $inlibc
7527
7528 : see if this is a unistd.h system
7529 set unistd.h i_unistd
7530 eval $inhdr
7531
7532 : see if getpgrp exists
7533 set getpgrp d_getpgrp
7534 eval $inlibc
7535
7536 case "$d_getpgrp" in
7537 "$define")
7538         echo " "
7539         echo "Checking to see which flavor of getpgrp is in use..."
7540         $cat >set.c <<EOP
7541 #$i_unistd I_UNISTD
7542 #include <sys/types.h>
7543 #ifdef I_UNISTD
7544 #  include <unistd.h>
7545 #endif
7546 int main()
7547 {
7548         if (getuid() == 0) {
7549                 printf("(I see you are running Configure as super-user...)\n");
7550                 setuid(1);
7551         }
7552 #ifdef TRY_BSD_PGRP
7553         if (getpgrp(1) == 0)
7554                 exit(0);
7555 #else
7556         if (getpgrp() > 0)
7557                 exit(0);
7558 #endif
7559         exit(1);
7560 }
7561 EOP
7562         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7563                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7564                 val="$define"
7565         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7566                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7567                 val="$undef"
7568         else
7569                 echo "I can't seem to compile and run the test program."
7570                 if ./usg; then
7571                         xxx="a USG one, i.e. you use getpgrp()."
7572                 else
7573                         # SVR4 systems can appear rather BSD-ish.
7574                         case "$i_unistd" in
7575                         $undef)
7576                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7577                                 val="$define"
7578                                 ;;
7579                         $define)
7580                                 xxx="probably a USG one, i.e. you use getpgrp()."
7581                                 val="$undef"
7582                                 ;;
7583                         esac
7584                 fi
7585                 echo "Assuming your getpgrp is $xxx" >&4
7586         fi
7587         ;;
7588 *) val="$undef";;
7589 esac
7590 set d_bsdgetpgrp
7591 eval $setvar
7592 $rm -f set set.c
7593
7594 : see if setpgrp exists
7595 set setpgrp d_setpgrp
7596 eval $inlibc
7597
7598 case "$d_setpgrp" in
7599 "$define")
7600         echo " "
7601         echo "Checking to see which flavor of setpgrp is in use..."
7602         $cat >set.c <<EOP
7603 #$i_unistd I_UNISTD
7604 #include <sys/types.h>
7605 #ifdef I_UNISTD
7606 #  include <unistd.h>
7607 #endif
7608 int main()
7609 {
7610         if (getuid() == 0) {
7611                 printf("(I see you are running Configure as super-user...)\n");
7612                 setuid(1);
7613         }
7614 #ifdef TRY_BSD_PGRP
7615         if (-1 == setpgrp(1, 1))
7616                 exit(0);
7617 #else
7618         if (setpgrp() != -1)
7619                 exit(0);
7620 #endif
7621         exit(1);
7622 }
7623 EOP
7624         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7625                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7626                 val="$define"
7627         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7628                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7629                 val="$undef"
7630         else
7631                 echo "(I can't seem to compile and run the test program.)"
7632                 if ./usg; then
7633                         xxx="a USG one, i.e. you use setpgrp()."
7634                 else
7635                         # SVR4 systems can appear rather BSD-ish.
7636                         case "$i_unistd" in
7637                         $undef)
7638                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7639                                 val="$define"
7640                                 ;;
7641                         $define)
7642                                 xxx="probably a USG one, i.e. you use setpgrp()."
7643                                 val="$undef"
7644                                 ;;
7645                         esac
7646                 fi
7647                 echo "Assuming your setpgrp is $xxx" >&4
7648         fi
7649         ;;
7650 *) val="$undef";;
7651 esac
7652 set d_bsdsetpgrp
7653 eval $setvar
7654 $rm -f set set.c
7655 : see if bzero exists
7656 set bzero d_bzero
7657 eval $inlibc
7658
7659 : see if signal is declared as pointer to function returning int or void
7660 echo " "
7661 xxx=`./findhdr signal.h`
7662 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7663 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7664         echo "You have int (*signal())() instead of void." >&4
7665         val="$undef"
7666 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7667         echo "You have void (*signal())()." >&4
7668         val="$define"
7669 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7670         echo "You have int (*signal())() instead of void." >&4
7671         val="$undef"
7672 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7673         echo "You have void (*signal())()." >&4
7674         val="$define"
7675 else
7676         case "$d_voidsig" in
7677         '')
7678         echo "I can't determine whether signal handler returns void or int..." >&4
7679                 dflt=void
7680                 rp="What type does your signal handler return?"
7681                 . ./myread
7682                 case "$ans" in
7683                 v*) val="$define";;
7684                 *) val="$undef";;
7685                 esac;;
7686         "$define")
7687                 echo "As you already told me, signal handler returns void." >&4
7688                 val="$define"
7689                 ;;
7690         *)      echo "As you already told me, signal handler returns int." >&4
7691                 val="$undef"
7692                 ;;
7693         esac
7694 fi
7695 set d_voidsig
7696 eval $setvar
7697 case "$d_voidsig" in
7698 "$define") signal_t="void";;
7699 *) signal_t="int";;
7700 esac
7701 $rm -f $$.tmp
7702
7703 : check for ability to cast large floats to 32-bit ints.
7704 echo " "
7705 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7706 if $test "$intsize" -ge 4; then
7707         xxx=int
7708 else
7709         xxx=long
7710 fi
7711 $cat >try.c <<EOCP
7712 #include <stdio.h>
7713 #include <sys/types.h>
7714 #include <signal.h>
7715 $signal_t blech(s) int s; { exit(3); }
7716 int main()
7717 {
7718         $xxx i32;
7719         double f, g;
7720         int result = 0;
7721         char str[16];
7722         signal(SIGFPE, blech);
7723
7724         /* Don't let compiler optimize the test away.  Store the number 
7725            in a writable string for gcc to pass to sscanf under HP/UX.
7726         */
7727         sprintf(str, "2147483647");
7728         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7729         g = 10 * f;
7730         i32  = ($xxx) g;
7731
7732         /* x86 processors will probably give 0x8000 0000, which is a
7733        sign change.  We don't want that.  We want to mimic SPARC
7734            behavior here, which is to preserve the sign and give
7735            back 0x7fff ffff.
7736         */
7737         if (i32 != ($xxx) f)
7738                 result |= 1;
7739         exit(result);
7740 }
7741 EOCP
7742 set try
7743 if eval $compile_ok; then
7744         ./try
7745         yyy=$?
7746 else
7747         echo "(I can't seem to compile the test program--assuming it can't)"
7748         yyy=1
7749 fi
7750 case "$yyy" in
7751 0)      val="$define"
7752         echo "Yup, it can."
7753         ;;
7754 *)      val="$undef"
7755         echo "Nope, it can't."
7756         ;;
7757 esac
7758 set d_casti32
7759 eval $setvar
7760 $rm -f try try.*
7761
7762 : check for ability to cast negative floats to unsigned
7763 echo " "
7764 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7765 $cat >try.c <<EOCP
7766 #include <stdio.h>
7767 #include <sys/types.h>
7768 #include <signal.h>
7769 $signal_t blech(s) int s; { exit(7); }
7770 $signal_t blech_in_list(s) int s; { exit(4); }
7771 unsigned long dummy_long(p) unsigned long p; { return p; }
7772 unsigned int dummy_int(p) unsigned int p; { return p; }
7773 unsigned short dummy_short(p) unsigned short p; { return p; }
7774 int main()
7775 {
7776         double f;
7777         unsigned long along;
7778         unsigned int aint;
7779         unsigned short ashort;
7780         int result = 0;
7781         char str[16];
7782         
7783         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7784            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7785            optimized the whole file away
7786         */
7787         /* Store the number in a writable string for gcc to pass to 
7788            sscanf under HP/UX.
7789         */
7790         sprintf(str, "-123");
7791         sscanf(str, "%lf", &f);  /* f = -123.; */
7792
7793         signal(SIGFPE, blech);
7794         along = (unsigned long)f;
7795         aint = (unsigned int)f;
7796         ashort = (unsigned short)f;
7797         if (along != (unsigned long)-123)
7798                 result |= 1;
7799         if (aint != (unsigned int)-123)
7800                 result |= 1;
7801         if (ashort != (unsigned short)-123)
7802                 result |= 1;
7803         sprintf(str, "1073741824.");
7804         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7805         f = f + f;
7806         along = 0;
7807         along = (unsigned long)f;
7808         if (along != 0x80000000)
7809                 result |= 2;
7810         f -= 1.;
7811         along = 0;
7812         along = (unsigned long)f;
7813         if (along != 0x7fffffff)
7814                 result |= 1;
7815         f += 2.;
7816         along = 0;
7817         along = (unsigned long)f;
7818         if (along != 0x80000001)
7819                 result |= 2;
7820         if (result)
7821                 exit(result);
7822         signal(SIGFPE, blech_in_list);
7823         sprintf(str, "123.");
7824         sscanf(str, "%lf", &f);  /* f = 123.; */
7825         along = dummy_long((unsigned long)f);
7826         aint = dummy_int((unsigned int)f);
7827         ashort = dummy_short((unsigned short)f);
7828         if (along != (unsigned long)123)
7829                 result |= 4;
7830         if (aint != (unsigned int)123)
7831                 result |= 4;
7832         if (ashort != (unsigned short)123)
7833                 result |= 4;
7834         exit(result);
7835
7836 }
7837 EOCP
7838 set try
7839 if eval $compile_ok; then
7840         ./try
7841         castflags=$?
7842 else
7843         echo "(I can't seem to compile the test program--assuming it can't)"
7844         castflags=7
7845 fi
7846 case "$castflags" in
7847 0)      val="$define"
7848         echo "Yup, it can."
7849         ;;
7850 *)      val="$undef"
7851         echo "Nope, it can't."
7852         ;;
7853 esac
7854 set d_castneg
7855 eval $setvar
7856 $rm -f try.*
7857
7858 : see if vprintf exists
7859 echo " "
7860 if set vprintf val -f d_vprintf; eval $csym; $val; then
7861         echo 'vprintf() found.' >&4
7862         val="$define"
7863         $cat >vprintf.c <<'EOF'
7864 #include <varargs.h>
7865
7866 int main() { xxx("foo"); }
7867
7868 xxx(va_alist)
7869 va_dcl
7870 {
7871         va_list args;
7872         char buf[10];
7873
7874         va_start(args);
7875         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7876 }
7877 EOF
7878         set vprintf
7879         if eval $compile && ./vprintf; then
7880                 echo "Your vsprintf() returns (int)." >&4
7881                 val2="$undef"
7882         else
7883                 echo "Your vsprintf() returns (char*)." >&4
7884                 val2="$define"
7885         fi
7886 else
7887         echo 'vprintf() NOT found.' >&4
7888                 val="$undef"
7889                 val2="$undef"
7890 fi
7891 set d_vprintf
7892 eval $setvar
7893 val=$val2
7894 set d_charvspr
7895 eval $setvar
7896
7897 : see if chown exists
7898 set chown d_chown
7899 eval $inlibc
7900
7901 : see if chroot exists
7902 set chroot d_chroot
7903 eval $inlibc
7904
7905 : see if chsize exists
7906 set chsize d_chsize
7907 eval $inlibc
7908
7909 : check for const keyword
7910 echo " "
7911 echo 'Checking to see if your C compiler knows about "const"...' >&4
7912 $cat >const.c <<'EOCP'
7913 typedef struct spug { int drokk; } spug;
7914 int main()
7915 {
7916         const char *foo;
7917         const spug y;
7918 }
7919 EOCP
7920 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7921         val="$define"
7922         echo "Yup, it does."
7923 else
7924         val="$undef"
7925         echo "Nope, it doesn't."
7926 fi
7927 set d_const
7928 eval $setvar
7929
7930 : see if crypt exists
7931 echo " "
7932 if set crypt val -f d_crypt; eval $csym; $val; then
7933         echo 'crypt() found.' >&4
7934         val="$define"
7935         cryptlib=''
7936 else
7937         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7938         if $test -z "$cryptlib"; then
7939                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7940         else
7941                 cryptlib=-lcrypt
7942         fi
7943         if $test -z "$cryptlib"; then
7944                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7945         else
7946                 cryptlib=-lcrypt
7947         fi
7948         if $test -z "$cryptlib"; then
7949                 cryptlib=`./loc libcrypt$_a "" $libpth`
7950         else
7951                 cryptlib=-lcrypt
7952         fi
7953         if $test -z "$cryptlib"; then
7954                 echo 'crypt() NOT found.' >&4
7955                 val="$undef"
7956         else
7957                 val="$define"
7958         fi
7959 fi
7960 set d_crypt
7961 eval $setvar
7962
7963 : get csh whereabouts
7964 case "$csh" in
7965 'csh') val="$undef" ;;
7966 *) val="$define" ;;
7967 esac
7968 set d_csh
7969 eval $setvar
7970 : Respect a hint or command line value for full_csh.
7971 case "$full_csh" in
7972 '') full_csh=$csh ;;
7973 esac
7974
7975 : see if cuserid exists
7976 set cuserid d_cuserid
7977 eval $inlibc
7978
7979 : see if this is a limits.h system
7980 set limits.h i_limits
7981 eval $inhdr
7982
7983 : see if this is a float.h system
7984 set float.h i_float
7985 eval $inhdr
7986
7987 : See if number of significant digits in a double precision number is known
7988 echo " "
7989 $cat >dbl_dig.c <<EOM
7990 #$i_limits I_LIMITS
7991 #$i_float I_FLOAT
7992 #ifdef I_LIMITS
7993 #include <limits.h>
7994 #endif
7995 #ifdef I_FLOAT
7996 #include <float.h>
7997 #endif
7998 #ifdef DBL_DIG
7999 printf("Contains DBL_DIG");
8000 #endif
8001 EOM
8002 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8003 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8004         echo "DBL_DIG found." >&4
8005         val="$define"
8006 else
8007         echo "DBL_DIG NOT found." >&4
8008         val="$undef"
8009 fi
8010 $rm -f dbl_dig.?
8011 set d_dbl_dig
8012 eval $setvar
8013
8014 : see if difftime exists
8015 set difftime d_difftime
8016 eval $inlibc
8017
8018 : see if this is a dirent system
8019 echo " "
8020 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8021         val="$define"
8022         echo "<dirent.h> found." >&4
8023 else
8024         val="$undef"
8025         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8026                 echo "<sys/dir.h> found." >&4
8027                 echo " "
8028         else
8029                 xinc=`./findhdr sys/ndir.h`
8030         fi
8031         echo "<dirent.h> NOT found." >&4
8032 fi
8033 set i_dirent
8034 eval $setvar
8035
8036 : Look for type of directory structure.
8037 echo " "
8038 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8039
8040 case "$direntrytype" in
8041 ''|' ')
8042         case "$i_dirent" in
8043         $define) guess1='struct dirent' ;;
8044         *) guess1='struct direct'  ;;
8045         esac
8046         ;;
8047 *)      guess1="$direntrytype"
8048         ;;
8049 esac
8050
8051 case "$guess1" in
8052 'struct dirent') guess2='struct direct' ;;
8053 *) guess2='struct dirent' ;;
8054 esac
8055                 
8056 if $contains "$guess1" try.c >/dev/null 2>&1; then
8057         direntrytype="$guess1"
8058         echo "Your directory entries are $direntrytype." >&4
8059 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8060         direntrytype="$guess2"
8061         echo "Your directory entries seem to be $direntrytype." >&4
8062 else
8063         echo "I don't recognize your system's directory entries." >&4
8064         rp="What type is used for directory entries on this system?"
8065         dflt="$guess1"
8066         . ./myread
8067         direntrytype="$ans"
8068 fi
8069 $rm -f try.c
8070
8071
8072 : see if the directory entry stores field length
8073 echo " "
8074 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8075 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8076         echo "Good, your directory entry keeps length information in d_namlen." >&4
8077         val="$define"
8078 else
8079         echo "Your directory entry does not know about the d_namlen field." >&4
8080         val="$undef"
8081 fi
8082 set d_dirnamlen
8083 eval $setvar
8084 $rm -f try.c
8085
8086 : see if dlerror exists
8087 xxx_runnm="$runnm"
8088 runnm=false
8089 set dlerror d_dlerror
8090 eval $inlibc
8091 runnm="$xxx_runnm"
8092
8093 : see if dlfcn is available
8094 set dlfcn.h i_dlfcn
8095 eval $inhdr
8096
8097 case "$usedl" in
8098 $define|y|true)
8099         $cat << EOM
8100
8101 On a few systems, the dynamically loaded modules that perl generates and uses
8102 will need a different extension than shared libs. The default will probably
8103 be appropriate.
8104
8105 EOM
8106         case "$dlext" in
8107         '')     dflt="$so" ;;
8108         *)      dflt="$dlext" ;;
8109         esac
8110         rp='What is the extension of dynamically loaded modules'
8111         . ./myread
8112         dlext="$ans"
8113         ;;
8114 *)
8115         dlext="none"
8116         ;;
8117 esac
8118
8119 : Check if dlsym need a leading underscore
8120 echo " "
8121 val="$undef"
8122
8123 case "$dlsrc" in
8124 dl_dlopen.xs)
8125         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8126         $cat >dyna.c <<'EOM'
8127 fred () { }
8128 EOM
8129
8130 $cat >fred.c<<EOM
8131
8132 #include <stdio.h>
8133 #$i_dlfcn I_DLFCN
8134 #ifdef I_DLFCN
8135 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8136 #else
8137 #include <sys/types.h>
8138 #include <nlist.h>
8139 #include <link.h>
8140 #endif
8141
8142 extern int fred() ;
8143
8144 int main()
8145 {
8146     void * handle ;
8147     void * symbol ;
8148 #ifndef RTLD_LAZY
8149     int mode = 1 ;
8150 #else
8151     int mode = RTLD_LAZY ;
8152 #endif
8153     handle = dlopen("./dyna.$dlext", mode) ;
8154     if (handle == NULL) {
8155         printf ("1\n") ;
8156         fflush (stdout) ;
8157         exit(0);
8158     }
8159     symbol = dlsym(handle, "fred") ;
8160     if (symbol == NULL) {
8161         /* try putting a leading underscore */
8162         symbol = dlsym(handle, "_fred") ;
8163         if (symbol == NULL) {
8164             printf ("2\n") ;
8165             fflush (stdout) ;
8166             exit(0);
8167         }
8168         printf ("3\n") ;
8169     }
8170     else
8171         printf ("4\n") ;
8172     fflush (stdout) ;
8173     exit(0);
8174 }
8175 EOM
8176         : Call the object file tmp-dyna.o in case dlext=o.
8177         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8178                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8179                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8180                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8181                 xxx=`./fred`
8182                 case $xxx in
8183                 1)      echo "Test program failed using dlopen." >&4
8184                         echo "Perhaps you should not use dynamic loading." >&4;;
8185                 2)      echo "Test program failed using dlsym." >&4
8186                         echo "Perhaps you should not use dynamic loading." >&4;;
8187                 3)      echo "dlsym needs a leading underscore" >&4
8188                         val="$define" ;;
8189                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8190                 esac
8191         else
8192                 echo "I can't compile and run the test program." >&4
8193                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8194         fi
8195         ;;
8196 esac
8197                 
8198 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8199
8200 set d_dlsymun
8201 eval $setvar
8202
8203 hasproto='varname=$1; func=$2; shift; shift;
8204 while $test $# -ge 2; do
8205         case "$1" in
8206         $define) echo "#include <$2>";;
8207         esac ;
8208     shift 2;
8209 done > try.c;
8210 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8211 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8212         echo "$func() prototype found.";
8213         val="$define";
8214 else
8215         echo "$func() prototype NOT found.";
8216         val="$undef";
8217 fi;
8218 set $varname;
8219 eval $setvar;
8220 $rm -f try.c tryout.c'
8221
8222 : see if prototype for drand48 is available
8223 echo " "
8224 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8225 eval $hasproto
8226
8227 : see if dup2 exists
8228 set dup2 d_dup2
8229 eval $inlibc
8230
8231 : see if eaccess exists
8232 set eaccess d_eaccess
8233 eval $inlibc
8234
8235 : see if endgrent exists
8236 set endgrent d_endgrent
8237 eval $inlibc
8238
8239 : see if endhostent exists
8240 set endhostent d_endhent
8241 eval $inlibc
8242
8243 : see if endnetent exists
8244 set endnetent d_endnent
8245 eval $inlibc
8246
8247 : see if endprotoent exists
8248 set endprotoent d_endpent
8249 eval $inlibc
8250
8251 : see if endpwent exists
8252 set endpwent d_endpwent
8253 eval $inlibc
8254
8255 : see if endservent exists
8256 set endservent d_endsent
8257 eval $inlibc
8258
8259 : see if endspent exists
8260 set endspent d_endspent
8261 eval $inlibc
8262
8263 : Locate the flags for 'open()'
8264 echo " "
8265 $cat >open3.c <<'EOCP'
8266 #include <sys/types.h>
8267 #ifdef I_FCNTL
8268 #include <fcntl.h>
8269 #endif
8270 #ifdef I_SYS_FILE
8271 #include <sys/file.h>
8272 #endif
8273 int main() {
8274         if(O_RDONLY);
8275 #ifdef O_TRUNC
8276         exit(0);
8277 #else
8278         exit(1);
8279 #endif
8280 }
8281 EOCP
8282 : check sys/file.h first to get FREAD on Sun
8283 if $test `./findhdr sys/file.h` && \
8284                 set open3 -DI_SYS_FILE && eval $compile; then
8285         h_sysfile=true;
8286         echo "<sys/file.h> defines the O_* constants..." >&4
8287         if ./open3; then
8288                 echo "and you have the 3 argument form of open()." >&4
8289                 val="$define"
8290         else
8291                 echo "but not the 3 argument form of open().  Oh, well." >&4
8292                 val="$undef"
8293         fi
8294 elif $test `./findhdr fcntl.h` && \
8295                 set open3 -DI_FCNTL && eval $compile; then
8296         h_fcntl=true;
8297         echo "<fcntl.h> defines the O_* constants..." >&4
8298         if ./open3; then
8299                 echo "and you have the 3 argument form of open()." >&4
8300                 val="$define"
8301         else
8302                 echo "but not the 3 argument form of open().  Oh, well." >&4
8303                 val="$undef"
8304         fi
8305 else
8306         val="$undef"
8307         echo "I can't find the O_* constant definitions!  You got problems." >&4
8308 fi
8309 set d_open3
8310 eval $setvar
8311 $rm -f open3*
8312
8313 : see which of string.h or strings.h is needed
8314 echo " "
8315 strings=`./findhdr string.h`
8316 if $test "$strings" && $test -r "$strings"; then
8317         echo "Using <string.h> instead of <strings.h>." >&4
8318         val="$define"
8319 else
8320         val="$undef"
8321         strings=`./findhdr strings.h`
8322         if $test "$strings" && $test -r "$strings"; then
8323                 echo "Using <strings.h> instead of <string.h>." >&4
8324         else
8325                 echo "No string header found -- You'll surely have problems." >&4
8326         fi
8327 fi
8328 set i_string
8329 eval $setvar
8330 case "$i_string" in
8331 "$undef") strings=`./findhdr strings.h`;;
8332 *)        strings=`./findhdr string.h`;;
8333 esac
8334
8335 : check for non-blocking I/O stuff
8336 case "$h_sysfile" in
8337 true) echo "#include <sys/file.h>" > head.c;;
8338 *)
8339         case "$h_fcntl" in
8340         true) echo "#include <fcntl.h>" > head.c;;
8341         *) echo "#include <sys/fcntl.h>" > head.c;;
8342         esac
8343         ;;
8344 esac
8345 echo " "
8346 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8347 case "$o_nonblock" in
8348 '')
8349         $cat head.c > try.c
8350         $cat >>try.c <<'EOCP'
8351 #include <stdio.h>
8352 int main() {
8353 #ifdef O_NONBLOCK
8354         printf("O_NONBLOCK\n");
8355         exit(0);
8356 #endif
8357 #ifdef O_NDELAY
8358         printf("O_NDELAY\n");
8359         exit(0);
8360 #endif
8361 #ifdef FNDELAY
8362         printf("FNDELAY\n");
8363         exit(0);
8364 #endif
8365         exit(0);
8366 }
8367 EOCP
8368         set try
8369         if eval $compile_ok; then
8370                 o_nonblock=`./try`
8371                 case "$o_nonblock" in
8372                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8373                 *) echo "Seems like we can use $o_nonblock.";;
8374                 esac
8375         else
8376                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8377         fi
8378         ;;
8379 *) echo "Using $hint value $o_nonblock.";;
8380 esac
8381 $rm -f try try.* .out core
8382
8383 echo " "
8384 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8385 case "$eagain" in
8386 '')
8387         $cat head.c > try.c
8388         $cat >>try.c <<EOCP
8389 #include <errno.h>
8390 #include <sys/types.h>
8391 #include <signal.h>
8392 #include <stdio.h> 
8393 #define MY_O_NONBLOCK $o_nonblock
8394 #ifndef errno  /* XXX need better Configure test */
8395 extern int errno;
8396 #endif
8397 #$i_unistd I_UNISTD
8398 #ifdef I_UNISTD
8399 #include <unistd.h>
8400 #endif
8401 #ifdef $i_string
8402 #include <string.h>
8403 #else
8404 #include <strings.h>
8405 #endif
8406 $signal_t blech(x) int x; { exit(3); }
8407 EOCP
8408         $cat >> try.c <<'EOCP'
8409 int main()
8410 {
8411         int pd[2];
8412         int pu[2];
8413         char buf[1];
8414         char string[100];
8415
8416         pipe(pd);       /* Down: child -> parent */
8417         pipe(pu);       /* Up: parent -> child */
8418         if (0 != fork()) {
8419                 int ret;
8420                 close(pd[1]);   /* Parent reads from pd[0] */
8421                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8422                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8423                         exit(1);
8424                 signal(SIGALRM, blech);
8425                 alarm(5);
8426                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8427                         exit(2);
8428                 sprintf(string, "%d\n", ret);
8429                 write(2, string, strlen(string));
8430                 alarm(0);
8431 #ifdef EAGAIN
8432                 if (errno == EAGAIN) {
8433                         printf("EAGAIN\n");
8434                         goto ok;
8435                 }
8436 #endif
8437 #ifdef EWOULDBLOCK
8438                 if (errno == EWOULDBLOCK)
8439                         printf("EWOULDBLOCK\n");
8440 #endif
8441         ok:
8442                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8443                 sleep(2);                               /* Give it time to close our pipe */
8444                 alarm(5);
8445                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8446                 alarm(0);
8447                 sprintf(string, "%d\n", ret);
8448                 write(3, string, strlen(string));
8449                 exit(0);
8450         }
8451
8452         close(pd[0]);                   /* We write to pd[1] */
8453         close(pu[1]);                   /* We read from pu[0] */
8454         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8455         close(pd[1]);                   /* Pipe pd is now fully closed! */
8456         exit(0);                                /* Bye bye, thank you for playing! */
8457 }
8458 EOCP
8459         set try
8460         if eval $compile_ok; then
8461                 echo "$startsh" >mtry
8462                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8463                 chmod +x mtry
8464                 ./mtry >/dev/null 2>&1
8465                 case $? in
8466                 0) eagain=`$cat try.out`;;
8467                 1) echo "Could not perform non-blocking setting!";;
8468                 2) echo "I did a successful read() for something that was not there!";;
8469                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8470                 *) echo "Something terribly wrong happened during testing.";;
8471                 esac
8472                 rd_nodata=`$cat try.ret`
8473                 echo "A read() system call with no data present returns $rd_nodata."
8474                 case "$rd_nodata" in
8475                 0|-1) ;;
8476                 *)
8477                         echo "(That's peculiar, fixing that to be -1.)"
8478                         rd_nodata=-1
8479                         ;;
8480                 esac
8481                 case "$eagain" in
8482                 '')
8483                         echo "Forcing errno EAGAIN on read() with no data available."
8484                         eagain=EAGAIN
8485                         ;;
8486                 *)
8487                         echo "Your read() sets errno to $eagain when no data is available."
8488                         ;;
8489                 esac
8490                 status=`$cat try.err`
8491                 case "$status" in
8492                 0) echo "And it correctly returns 0 to signal EOF.";;
8493                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8494                 *) echo "However, your read() returns '$status' on EOF??";;
8495                 esac
8496                 val="$define"
8497                 if test "$status" = "$rd_nodata"; then
8498                         echo "WARNING: you can't distinguish between EOF and no data!"
8499                         val="$undef"
8500                 fi
8501         else
8502                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8503                 eagain=EAGAIN
8504         fi
8505         set d_eofnblk
8506         eval $setvar
8507         ;;
8508 *)
8509         echo "Using $hint value $eagain."
8510         echo "Your read() returns $rd_nodata when no data is present."
8511         case "$d_eofnblk" in
8512         "$define") echo "And you can see EOF because read() returns 0.";;
8513         "$undef") echo "But you can't see EOF status from read() returned value.";;
8514         *)
8515                 echo "(Assuming you can't see EOF status from read anyway.)"
8516                 d_eofnblk=$undef
8517                 ;;
8518         esac
8519         ;;
8520 esac
8521 $rm -f try try.* .out core head.c mtry
8522
8523 : see if fchmod exists
8524 set fchmod d_fchmod
8525 eval $inlibc
8526
8527 : see if fchown exists
8528 set fchown d_fchown
8529 eval $inlibc
8530
8531 : see if this is an fcntl system
8532 set fcntl d_fcntl
8533 eval $inlibc
8534
8535 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8536 while $test $# -ge 2; do
8537         case "$1" in
8538         $define) echo "#include <$2>";;
8539         esac ;
8540     shift 2;
8541 done > try.c;
8542 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8543 set try;
8544 if eval $compile; then
8545         val="$define";
8546 else
8547         val="$undef";
8548 fi;
8549 set $varname;
8550 eval $setvar;
8551 $rm -f try.c try.o'
8552
8553 socketlib=''
8554 sockethdr=''
8555 : see whether socket exists
8556 echo " "
8557 $echo $n "Hmm... $c" >&4
8558 if set socket val -f d_socket; eval $csym; $val; then
8559         echo "Looks like you have Berkeley networking support." >&4
8560         d_socket="$define"
8561         if set setsockopt val -f; eval $csym; $val; then
8562                 d_oldsock="$undef"
8563         else
8564                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8565                 d_oldsock="$define"
8566         fi
8567 else
8568         if $contains socklib libc.list >/dev/null 2>&1; then
8569                 echo "Looks like you have Berkeley networking support." >&4
8570                 d_socket="$define"
8571                 : we will have to assume that it supports the 4.2 BSD interface
8572                 d_oldsock="$undef"
8573         else
8574                 echo "You don't have Berkeley networking in libc$_a..." >&4
8575                 if test "X$d_socket" = "X$define"; then
8576                    echo "...but you seem to believe that you have sockets." >&4
8577                 else
8578                         for net in net socket
8579                         do
8580                                 if test -f /usr/lib/lib$net$_a; then
8581                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8582                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8583                                         if $contains socket libc.list >/dev/null 2>&1; then
8584                                                 d_socket="$define"
8585                                                 socketlib="-l$net"
8586                                                 case "$net" in
8587                                                 net)
8588                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8589                                                         sockethdr="-I/usr/netinclude"
8590                                                         ;;
8591                                                 esac
8592                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8593                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8594                                                         d_oldsock="$undef"
8595                                                 else
8596                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8597                                                         d_oldsock="$define"
8598                                                 fi
8599                                                 break
8600                                         fi
8601                                 fi
8602                         done
8603                         if test "X$d_socket" != "X$define"; then
8604                            echo "or anywhere else I see." >&4
8605                            d_socket="$undef"
8606                            d_oldsock="$undef"
8607                         fi
8608                 fi
8609         fi
8610 fi
8611
8612 : see if socketpair exists
8613 set socketpair d_sockpair
8614 eval $inlibc
8615
8616
8617 echo " "
8618 echo "Checking the availability of certain socket constants..." >& 4
8619 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8620         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8621         $cat >try.c <<EOF
8622 #include <sys/types.h>
8623 #include <sys/socket.h>
8624 int main() {
8625     int i = $ENUM;
8626 }
8627 EOF
8628         val="$undef"
8629         set try; if eval $compile; then
8630                 val="$define"
8631         fi
8632         set d_${enum}; eval $setvar
8633         $rm -f try.c try
8634 done
8635
8636 : see if sys/select.h has to be included
8637 set sys/select.h i_sysselct
8638 eval $inhdr
8639
8640 : see if we should include time.h, sys/time.h, or both
8641 echo " "
8642 if test "X$timeincl" = X; then
8643         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8644         $echo $n "I'm now running the test program...$c"
8645         $cat >try.c <<'EOCP'
8646 #include <sys/types.h>
8647 #ifdef I_TIME
8648 #include <time.h>
8649 #endif
8650 #ifdef I_SYSTIME
8651 #ifdef SYSTIMEKERNEL
8652 #define KERNEL
8653 #endif
8654 #include <sys/time.h>
8655 #endif
8656 #ifdef I_SYSSELECT
8657 #include <sys/select.h>
8658 #endif
8659 int main()
8660 {
8661         struct tm foo;
8662 #ifdef S_TIMEVAL
8663         struct timeval bar;
8664 #endif
8665 #ifdef S_TIMEZONE
8666         struct timezone tzp;
8667 #endif
8668         if (foo.tm_sec == foo.tm_sec)
8669                 exit(0);
8670 #ifdef S_TIMEVAL
8671         if (bar.tv_sec == bar.tv_sec)
8672                 exit(0);
8673 #endif
8674         exit(1);
8675 }
8676 EOCP
8677         flags=''
8678         for s_timezone in '-DS_TIMEZONE' ''; do
8679         sysselect=''
8680         for s_timeval in '-DS_TIMEVAL' ''; do
8681         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8682         for i_time in '' '-DI_TIME'; do
8683         for i_systime in '-DI_SYSTIME' ''; do
8684                 case "$flags" in
8685                 '') $echo $n ".$c"
8686                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8687                         if eval $compile; then
8688                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8689                                 shift
8690                                 flags="$*"
8691                                 echo " "
8692                                 $echo $n "Succeeded with $flags$c"
8693                         fi
8694                         ;;
8695                 esac
8696         done
8697         done
8698         done
8699         done
8700         done
8701         timeincl=''
8702         echo " "
8703         case "$flags" in
8704         *SYSTIMEKERNEL*) i_systimek="$define"
8705                 timeincl=`./findhdr sys/time.h`
8706                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8707         *) i_systimek="$undef";;
8708         esac
8709         case "$flags" in
8710         *I_TIME*) i_time="$define"
8711                 timeincl=`./findhdr time.h`" $timeincl"
8712                 echo "We'll include <time.h>." >&4;;
8713         *) i_time="$undef";;
8714         esac
8715         case "$flags" in
8716         *I_SYSTIME*) i_systime="$define"
8717                 timeincl=`./findhdr sys/time.h`" $timeincl"
8718                 echo "We'll include <sys/time.h>." >&4;;
8719         *) i_systime="$undef";;
8720         esac
8721         $rm -f try.c try
8722 fi
8723
8724 : check for fd_set items
8725 $cat <<EOM
8726
8727 Checking to see how well your C compiler handles fd_set and friends ...
8728 EOM
8729 $cat >fd_set.c <<EOCP
8730 #$i_systime I_SYS_TIME
8731 #$i_sysselct I_SYS_SELECT
8732 #$d_socket HAS_SOCKET
8733 #include <sys/types.h>
8734 #ifdef HAS_SOCKET
8735 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8736 #endif
8737 #ifdef I_SYS_TIME
8738 #include <sys/time.h>
8739 #endif
8740 #ifdef I_SYS_SELECT
8741 #include <sys/select.h>
8742 #endif
8743 int main() {
8744         fd_set fds;
8745
8746 #ifdef TRYBITS
8747         if(fds.fds_bits);
8748 #endif
8749
8750 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8751         exit(0);
8752 #else
8753         exit(1);
8754 #endif
8755 }
8756 EOCP
8757 set fd_set -DTRYBITS
8758 if eval $compile; then
8759         d_fds_bits="$define"
8760         d_fd_set="$define"
8761         echo "Well, your system knows about the normal fd_set typedef..." >&4
8762         if ./fd_set; then
8763                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8764                 d_fd_macros="$define"
8765         else
8766                 $cat >&4 <<'EOM'
8767 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8768 EOM
8769                 d_fd_macros="$undef"
8770         fi
8771 else
8772         $cat <<'EOM'
8773 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8774 EOM
8775         set fd_set
8776         if eval $compile; then
8777                 d_fds_bits="$undef"
8778                 d_fd_set="$define"
8779                 echo "Well, your system has some sort of fd_set available..." >&4
8780                 if ./fd_set; then
8781                         echo "and you have the normal fd_set macros." >&4
8782                         d_fd_macros="$define"
8783                 else
8784                         $cat <<'EOM'
8785 but not the normal fd_set macros!  Gross!  More work for me...
8786 EOM
8787                         d_fd_macros="$undef"
8788                 fi
8789         else
8790         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8791                 d_fd_set="$undef"
8792                 d_fds_bits="$undef"
8793                 d_fd_macros="$undef"
8794         fi
8795 fi
8796 $rm -f fd_set*
8797
8798 : see if fgetpos exists
8799 set fgetpos d_fgetpos
8800 eval $inlibc
8801
8802 : see if flock exists
8803 set flock d_flock
8804 eval $inlibc
8805
8806 : see if fork exists
8807 set fork d_fork
8808 eval $inlibc
8809
8810 : see if pathconf exists
8811 set pathconf d_pathconf
8812 eval $inlibc
8813
8814 : see if fpathconf exists
8815 set fpathconf d_fpathconf
8816 eval $inlibc
8817
8818
8819 : check for off64_t
8820 echo " "
8821 echo "Checking to see if your system supports off64_t..." >&4
8822 $cat >try.c <<EOCP
8823 #include <sys/types.h>
8824 #include <unistd.h>
8825 int main() { off64_t x = 7; }
8826 EOCP
8827 set try
8828 if eval $compile; then
8829         val="$define"
8830         echo "Yes, it does."
8831 else
8832         val="$undef"
8833         echo "No, it doesn't."
8834         case "$lseeksize" in
8835         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8836         esac
8837 fi
8838 $rm -f try.* try
8839 set d_off64_t
8840 eval $setvar
8841
8842 : check for fpos64_t
8843 echo " "
8844 echo "Checking to see if your system supports fpos64_t..." >&4
8845 $cat >try.c <<EOCP
8846 #include <stdio.h>
8847 int main() { fpos64_t x x = 7; }
8848 EOCP
8849 set try
8850 if eval $compile; then
8851         val="$define"
8852         echo "Yes, it does."
8853 else
8854         val="$undef"
8855         echo "No, it doesn't."
8856         case "$fpossize" in
8857         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8858         esac
8859 fi
8860 $rm -f try.* try
8861 set d_fpos64_t
8862 eval $setvar
8863
8864 hasstruct='varname=$1; struct=$2; shift; shift;
8865 while $test $# -ge 2; do
8866         case "$1" in
8867         $define) echo "#include <$2>";;
8868         esac ;
8869     shift 2;
8870 done > try.c;
8871 echo "int main () { struct $struct foo; }" >> try.c;
8872 set try;
8873 if eval $compile; then
8874         val="$define";
8875 else
8876         val="$undef";
8877 fi;
8878 set $varname;
8879 eval $setvar;
8880 $rm -f try.c try.o'
8881
8882 : see if this is a sys/param system
8883 set sys/param.h i_sysparam
8884 eval $inhdr
8885
8886 : see if this is a sys/mount.h system
8887 set sys/mount.h i_sysmount
8888 eval $inhdr
8889
8890 : see if sys/types.h has to be included
8891 set sys/types.h i_systypes
8892 eval $inhdr
8893
8894
8895 echo " "
8896 echo "Checking to see if your system supports struct fs_data..." >&4
8897 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8898 eval $hasstruct
8899 case "$d_fs_data_s" in
8900 "$define")      echo "Yes, it does."   ;;
8901 *)              echo "No, it doesn't." ;;
8902 esac
8903
8904 : see if fseeko exists
8905 set fseeko d_fseeko
8906 eval $inlibc
8907 case "$longsize" in
8908 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8909 esac
8910
8911 : see if fsetpos exists
8912 set fsetpos d_fsetpos
8913 eval $inlibc
8914
8915
8916 : see if fstatfs exists
8917 set fstatfs d_fstatfs
8918 eval $inlibc
8919
8920
8921 : see if statvfs exists
8922 set statvfs d_statvfs
8923 eval $inlibc
8924
8925 : see if fstatvfs exists
8926 set fstatvfs d_fstatvfs
8927 eval $inlibc
8928
8929
8930 : see if ftello exists
8931 set ftello d_ftello
8932 eval $inlibc
8933 case "$longsize" in
8934 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
8935 esac
8936
8937 : see if getcwd exists
8938 set getcwd d_getcwd
8939 eval $inlibc
8940
8941 : see if getgrent exists
8942 set getgrent d_getgrent
8943 eval $inlibc
8944
8945 : see if gethostbyaddr exists
8946 set gethostbyaddr d_gethbyaddr
8947 eval $inlibc
8948
8949 : see if gethostbyname exists
8950 set gethostbyname d_gethbyname
8951 eval $inlibc
8952
8953 : see if gethostent exists
8954 set gethostent d_gethent
8955 eval $inlibc
8956
8957 : see how we will look up host name
8958 echo " "
8959 call=''
8960 if set gethostname val -f d_gethname; eval $csym; $val; then
8961         echo 'gethostname() found.' >&4
8962         d_gethname="$define"
8963         call=gethostname
8964 fi
8965 if set uname val -f d_uname; eval $csym; $val; then
8966         if ./xenix; then
8967                 $cat <<'EOM'
8968 uname() was found, but you're running xenix, and older versions of xenix
8969 have a broken uname(). If you don't really know whether your xenix is old
8970 enough to have a broken system call, use the default answer.
8971
8972 EOM
8973                 dflt=y
8974                 case "$d_uname" in
8975                 "$define") dflt=n;;
8976                 esac
8977                 rp='Is your uname() broken?'
8978                 . ./myread
8979                 case "$ans" in
8980                 n*) d_uname="$define"; call=uname;;
8981                 esac
8982         else
8983                 echo 'uname() found.' >&4
8984                 d_uname="$define"
8985                 case "$call" in
8986                 '') call=uname ;;
8987                 esac
8988         fi
8989 fi
8990 case "$d_gethname" in
8991 '') d_gethname="$undef";;
8992 esac
8993 case "$d_uname" in
8994 '') d_uname="$undef";;
8995 esac
8996 case "$d_uname$d_gethname" in
8997 *define*)
8998         dflt=n
8999         cat <<EOM
9000  
9001 Every now and then someone has a $call() that lies about the hostname
9002 but can't be fixed for political or economic reasons.  If you wish, I can
9003 pretend $call() isn't there and maybe compute hostname at run-time
9004 thanks to the '$phostname' command.
9005
9006 EOM
9007         rp="Shall I ignore $call() from now on?"
9008         . ./myread
9009         case "$ans" in
9010         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9011         esac;;
9012 esac
9013 case "$phostname" in
9014 '') aphostname='';;
9015 *) case "$aphostname" in
9016         /*) ;;
9017         *) set X $phostname
9018                 shift
9019                 file=$1
9020                 shift
9021                 file=`./loc $file $file $pth`
9022                 aphostname=`echo $file $*`
9023                 ;;
9024         esac
9025         ;;
9026 esac
9027 case "$d_uname$d_gethname" in
9028 *define*) ;;
9029 *)
9030         case "$phostname" in
9031         '')
9032                 echo "There will be no way for $package to get your hostname." >&4;;
9033         *)
9034         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9035                 ;;
9036         esac;;
9037 esac
9038 case "$d_phostname" in
9039 '') d_phostname="$undef";;
9040 esac
9041
9042 : see if this is a netdb.h system
9043 set netdb.h i_netdb
9044 eval $inhdr
9045
9046 : see if prototypes for various gethostxxx netdb.h functions are available
9047 echo " "
9048 set d_gethostprotos gethostent $i_netdb netdb.h
9049 eval $hasproto
9050
9051 : see if getlogin exists
9052 set getlogin d_getlogin
9053 eval $inlibc
9054
9055 : see if getmnt exists
9056 set getmnt d_getmnt
9057 eval $inlibc
9058
9059 : see if getmntent exists
9060 set getmntent d_getmntent
9061 eval $inlibc
9062
9063 : see if getnetbyaddr exists
9064 set getnetbyaddr d_getnbyaddr
9065 eval $inlibc
9066
9067 : see if getnetbyname exists
9068 set getnetbyname d_getnbyname
9069 eval $inlibc
9070
9071 : see if getnetent exists
9072 set getnetent d_getnent
9073 eval $inlibc
9074
9075 : see if prototypes for various getnetxxx netdb.h functions are available
9076 echo " "
9077 set d_getnetprotos getnetent $i_netdb netdb.h
9078 eval $hasproto
9079
9080
9081 : see if getprotobyname exists
9082 set getprotobyname d_getpbyname
9083 eval $inlibc
9084
9085 : see if getprotobynumber exists
9086 set getprotobynumber d_getpbynumber
9087 eval $inlibc
9088
9089 : see if getprotoent exists
9090 set getprotoent d_getpent
9091 eval $inlibc
9092
9093 : see if getpgid exists
9094 set getpgid d_getpgid
9095 eval $inlibc
9096
9097 : see if getpgrp2 exists
9098 set getpgrp2 d_getpgrp2
9099 eval $inlibc
9100
9101 : see if getppid exists
9102 set getppid d_getppid
9103 eval $inlibc
9104
9105 : see if getpriority exists
9106 set getpriority d_getprior
9107 eval $inlibc
9108
9109 : see if prototypes for various getprotoxxx netdb.h functions are available
9110 echo " "
9111 set d_getprotoprotos getprotoent $i_netdb netdb.h
9112 eval $hasproto
9113
9114 : see if getpwent exists
9115 set getpwent d_getpwent
9116 eval $inlibc
9117
9118
9119 : see if getservbyname exists
9120 set getservbyname d_getsbyname
9121 eval $inlibc
9122
9123 : see if getservbyport exists
9124 set getservbyport d_getsbyport
9125 eval $inlibc
9126
9127 : see if getservent exists
9128 set getservent d_getsent
9129 eval $inlibc
9130
9131 : see if prototypes for various getservxxx netdb.h functions are available
9132 echo " "
9133 set d_getservprotos getservent $i_netdb netdb.h
9134 eval $hasproto
9135
9136 : see if getspent exists
9137 set getspent d_getspent
9138 eval $inlibc
9139
9140 : see if getspnam exists
9141 set getspnam d_getspnam
9142 eval $inlibc
9143
9144 : see if gettimeofday or ftime exists
9145 set gettimeofday d_gettimeod
9146 eval $inlibc
9147 case "$d_gettimeod" in
9148 "$undef")
9149         set ftime d_ftime 
9150         eval $inlibc
9151         ;;
9152 *)
9153         val="$undef"; set d_ftime; eval $setvar
9154         ;;
9155 esac
9156 case "$d_gettimeod$d_ftime" in
9157 "$undef$undef")
9158         echo " "
9159         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9160         ;;
9161 esac
9162
9163 : see if this is an grp system
9164 set grp.h i_grp
9165 eval $inhdr
9166
9167 case "$i_grp" in
9168 $define)
9169         xxx=`./findhdr grp.h`
9170         $cppstdin $cppflags $cppminus < $xxx >$$.h
9171
9172         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9173                 val="$define"
9174         else
9175                 val="$undef"
9176         fi
9177         set d_grpasswd
9178         eval $setvar
9179
9180         $rm -f $$.h
9181         ;;
9182 *)
9183         val="$undef";
9184         set d_grpasswd; eval $setvar
9185         ;;
9186 esac
9187
9188 : see if hasmntopt exists
9189 set hasmntopt d_hasmntopt
9190 eval $inlibc
9191
9192 : see if this is a netinet/in.h or sys/in.h system
9193 set netinet/in.h i_niin sys/in.h i_sysin
9194 eval $inhdr
9195
9196 : see if arpa/inet.h has to be included
9197 set arpa/inet.h i_arpainet
9198 eval $inhdr
9199
9200 : see if htonl --and friends-- exists
9201 val=''
9202 set htonl val
9203 eval $inlibc
9204
9205 : Maybe they are macros.
9206 case "$val" in
9207 $undef)
9208         $cat >htonl.c <<EOM
9209 #include <stdio.h>
9210 #include <sys/types.h>
9211 #$i_niin I_NETINET_IN
9212 #$i_sysin I_SYS_IN
9213 #$i_arpainet I_ARPA_INET
9214 #ifdef I_NETINET_IN
9215 #include <netinet/in.h>
9216 #endif
9217 #ifdef I_SYS_IN
9218 #include <sys/in.h>
9219 #endif
9220 #ifdef I_ARPA_INET
9221 #include <arpa/inet.h>
9222 #endif
9223 #ifdef htonl
9224 printf("Defined as a macro.");
9225 #endif
9226 EOM
9227         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9228         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9229                 val="$define"
9230                 echo "But it seems to be defined as a macro." >&4
9231         fi
9232         $rm -f htonl.?
9233         ;;
9234 esac
9235 set d_htonl
9236 eval $setvar
9237
9238 : see if iconv exists
9239 set iconv d_iconv
9240 eval $inlibc
9241
9242 : index or strchr
9243 echo " "
9244 if set index val -f; eval $csym; $val; then
9245         if set strchr val -f d_strchr; eval $csym; $val; then
9246                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9247                         val="$define"
9248                         vali="$undef"
9249                         echo "strchr() found." >&4
9250                 else
9251                         val="$undef"
9252                         vali="$define"
9253                         echo "index() found." >&4
9254                 fi
9255         else
9256                 val="$undef"
9257                 vali="$define"
9258                 echo "index() found." >&4
9259         fi
9260 else
9261         if set strchr val -f d_strchr; eval $csym; $val; then
9262                 val="$define"
9263                 vali="$undef"
9264                 echo "strchr() found." >&4
9265         else
9266                 echo "No index() or strchr() found!" >&4
9267                 val="$undef"
9268                 vali="$undef"
9269         fi
9270 fi
9271 set d_strchr; eval $setvar
9272 val="$vali"
9273 set d_index; eval $setvar
9274
9275 : check whether inet_aton exists
9276 set inet_aton d_inetaton
9277 eval $inlibc
9278
9279 : see if inttypes.h is available
9280 : we want a real compile instead of Inhdr because some systems
9281 : have an inttypes.h which includes non-existent headers
9282 echo " "
9283 $cat >try.c <<EOCP
9284 #include <inttypes.h>
9285 int main() {
9286         static int32_t foo32 = 0x12345678;
9287 }
9288 EOCP
9289 set try
9290 if eval $compile; then
9291         echo "<inttypes.h> found." >&4
9292         val="$define"
9293 else
9294         echo "<inttypes.h> NOT found." >&4
9295         val="$undef"
9296 fi
9297 $rm -f try.c try
9298 set i_inttypes
9299 eval $setvar
9300
9301 : check for int64_t
9302 echo " "
9303 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9304 $cat >try.c <<EOCP
9305 #include <sys/types.h>
9306 #$i_inttypes I_INTTYPES
9307 #ifdef I_INTTYPES
9308 #include <inttypes.h>
9309 #endif
9310 int main() { int64_t x = 7; }
9311 EOCP
9312 set try
9313 if eval $compile; then
9314         val="$define"
9315         echo " " >&4
9316         echo "You have int64_t."
9317 else
9318         val="$undef"
9319         echo " " >&4
9320         echo "You do not have int64_t."
9321 fi
9322 $rm -f try try.*
9323 set d_int64_t
9324 eval $setvar
9325
9326 : Look for isascii
9327 echo " "
9328 $cat >isascii.c <<'EOCP'
9329 #include <stdio.h>
9330 #include <ctype.h>
9331 int main() {
9332         int c = 'A';
9333         if (isascii(c))
9334                 exit(0);
9335         else
9336                 exit(1);
9337 }
9338 EOCP
9339 set isascii
9340 if eval $compile; then
9341         echo "isascii() found." >&4
9342         val="$define"
9343 else
9344         echo "isascii() NOT found." >&4
9345         val="$undef"
9346 fi
9347 set d_isascii
9348 eval $setvar
9349 $rm -f isascii*
9350
9351 : see if killpg exists
9352 set killpg d_killpg
9353 eval $inlibc
9354
9355 : see if lchown exists
9356 echo " "
9357 $cat > try.c <<'EOCP'
9358 /* System header to define __stub macros and hopefully few prototypes,
9359     which can conflict with char lchown(); below.  */
9360 #include <assert.h>
9361 /* Override any gcc2 internal prototype to avoid an error.  */
9362 /* We use char because int might match the return type of a gcc2
9363    builtin and then its argument prototype would still apply.  */
9364 char lchown();
9365 int main() {
9366     /*  The GNU C library defines this for functions which it implements
9367         to always fail with ENOSYS.  Some functions are actually named
9368         something starting with __ and the normal name is an alias.  */
9369 #if defined (__stub_lchown) || defined (__stub___lchown)
9370 choke me
9371 #else
9372 lchown();
9373 #endif
9374 ; return 0; }
9375 EOCP
9376 set try
9377 if eval $compile; then
9378     $echo "lchown() found." >&4
9379     val="$define"
9380 else
9381     $echo "lchown() NOT found." >&4
9382     val="$undef"
9383 fi
9384 set d_lchown
9385 eval $setvar
9386
9387 : See if number of significant digits in a double precision number is known
9388 echo " "
9389 $cat >ldbl_dig.c <<EOM
9390 #$i_limits I_LIMITS
9391 #$i_float I_FLOAT
9392 #ifdef I_LIMITS
9393 #include <limits.h>
9394 #endif
9395 #ifdef I_FLOAT
9396 #include <float.h>
9397 #endif
9398 #ifdef LDBL_DIG
9399 printf("Contains LDBL_DIG");
9400 #endif
9401 EOM
9402 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9403 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9404         echo "LDBL_DIG found." >&4
9405         val="$define"
9406 else
9407         echo "LDBL_DIG NOT found." >&4
9408         val="$undef"
9409 fi
9410 $rm -f ldbl_dig.?
9411 set d_ldbl_dig
9412 eval $setvar
9413
9414 : see if link exists
9415 set link d_link
9416 eval $inlibc
9417
9418 : see if localeconv exists
9419 set localeconv d_locconv
9420 eval $inlibc
9421
9422 : see if lockf exists
9423 set lockf d_lockf
9424 eval $inlibc
9425
9426 : check for long long
9427 echo " "
9428 $echo $n "Checking to see if your system supports long long..." $c >&4
9429 echo 'int main() { long long x = 7; return 0; }' > try.c
9430 set try
9431 if eval $compile; then
9432         val="$define"
9433         echo " " >&4
9434         echo "You have have long long."
9435 else
9436         val="$undef"
9437         echo " " >&4
9438         echo "You do not have long long."
9439 fi
9440 $rm try.*
9441 set d_longlong
9442 eval $setvar
9443
9444 : check for length of long long
9445 case "${d_longlong}${longlongsize}" in
9446 $define)
9447         echo " "
9448         $echo $n "Checking to see how big your long longs are..." $c >&4
9449         $cat >try.c <<'EOCP'
9450 #include <stdio.h>
9451 int main()
9452 {
9453     printf("%d\n", (int)sizeof(long long));
9454     return(0);
9455 }
9456 EOCP
9457         set try
9458         if eval $compile_ok; then
9459                 longlongsize=`./try$exe_ext`
9460                 $echo " $longlongsize bytes." >&4
9461         else
9462                 dflt='8'
9463                 echo " "
9464                 echo "(I can't seem to compile the test program.  Guessing...)"
9465                 rp="What is the size of a long long (in bytes)?"
9466                 . ./myread
9467                 longlongsize="$ans"
9468         fi
9469         if $test "X$longsize" = "X$longlongsize"; then
9470                 echo "(That isn't any different from an ordinary long.)"
9471         fi      
9472         ;;
9473 esac
9474 $rm -f try.* try
9475
9476 : see if lstat exists
9477 set lstat d_lstat
9478 eval $inlibc
9479
9480 : see if mblen exists
9481 set mblen d_mblen
9482 eval $inlibc
9483
9484 : see if mbstowcs exists
9485 set mbstowcs d_mbstowcs
9486 eval $inlibc
9487
9488 : see if mbtowc exists
9489 set mbtowc d_mbtowc
9490 eval $inlibc
9491
9492 : see if memchr exists
9493 set memchr d_memchr
9494 eval $inlibc
9495
9496 : see if memcmp exists
9497 set memcmp d_memcmp
9498 eval $inlibc
9499
9500 : see if memcpy exists
9501 set memcpy d_memcpy
9502 eval $inlibc
9503
9504 : see if memmove exists
9505 set memmove d_memmove
9506 eval $inlibc
9507
9508 : see if memset exists
9509 set memset d_memset
9510 eval $inlibc
9511
9512 : see if mkdir exists
9513 set mkdir d_mkdir
9514 eval $inlibc
9515
9516 : see if mkdtemp exists
9517 set mkdtemp d_mkdtemp
9518 eval $inlibc
9519
9520 : see if mkfifo exists
9521 set mkfifo d_mkfifo
9522 eval $inlibc
9523
9524 : see if mkstemp exists
9525 set mkstemp d_mkstemp
9526 eval $inlibc
9527
9528 : see if mkstemps exists
9529 set mkstemps d_mkstemps
9530 eval $inlibc
9531
9532 : see if mktime exists
9533 set mktime d_mktime
9534 eval $inlibc
9535
9536 : see if this is a sys/mman.h system
9537 set sys/mman.h i_sysmman
9538 eval $inhdr
9539
9540 : see if mmap exists
9541 set mmap d_mmap
9542 eval $inlibc
9543 : see what shmat returns
9544 : default to something harmless
9545 mmaptype='void *'
9546 case "$i_sysmman$d_mmap" in
9547 "$define$define")
9548         $cat >mmap.c <<'END'
9549 #include <sys/mman.h>
9550 void *mmap();
9551 END
9552         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9553                 mmaptype='void *'
9554         else
9555                 mmaptype='caddr_t'
9556         fi
9557         echo "and it returns ($mmaptype)." >&4
9558         ;;
9559 esac
9560
9561
9562
9563 : see if mprotect exists
9564 set mprotect d_mprotect
9565 eval $inlibc
9566
9567 : see if msgctl exists
9568 set msgctl d_msgctl
9569 eval $inlibc
9570
9571 : see if msgget exists
9572 set msgget d_msgget
9573 eval $inlibc
9574
9575 : see if msgsnd exists
9576 set msgsnd d_msgsnd
9577 eval $inlibc
9578
9579 : see if msgrcv exists
9580 set msgrcv d_msgrcv
9581 eval $inlibc
9582
9583 : see how much of the 'msg*(2)' library is present.
9584 h_msg=true
9585 echo " "
9586 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9587 *"$undef"*) h_msg=false;;
9588 esac
9589 case "$osname" in
9590 freebsd)
9591     case "`ipcs 2>&1`" in
9592     "SVID messages"*"not configured"*)
9593         echo "Your $osname does not have the msg*(2) configured." >&4
9594         h_msg=false
9595         val="$undef"
9596         set msgctl d_msgctl
9597         eval $setvar
9598         set msgget d_msgget
9599         eval $setvar
9600         set msgsnd d_msgsnd
9601         eval $setvar
9602         set msgrcv d_msgrcv
9603         eval $setvar
9604         ;;
9605     esac
9606     ;;
9607 esac
9608 : we could also check for sys/ipc.h ...
9609 if $h_msg && $test `./findhdr sys/msg.h`; then
9610         echo "You have the full msg*(2) library." >&4
9611         val="$define"
9612 else
9613         echo "You don't have the full msg*(2) library." >&4
9614         val="$undef"
9615 fi
9616 set d_msg
9617 eval $setvar
9618
9619 : see if msync exists
9620 set msync d_msync
9621 eval $inlibc
9622
9623 : see if munmap exists
9624 set munmap d_munmap
9625 eval $inlibc
9626
9627 : see if nice exists
9628 set nice d_nice
9629 eval $inlibc
9630
9631
9632 echo " "
9633 echo "Checking which 64-bit integer type we could use..." >&4
9634
9635 case "$intsize" in
9636 8) val=int
9637    set quadtype
9638    eval $setvar
9639    val='"unsigned int"'
9640    set uquadtype
9641    eval $setvar
9642    quadkind=1
9643    ;;
9644 *) case "$longsize" in
9645    8) val=long
9646       set quadtype
9647       eval $setvar
9648       val='"unsigned long"'
9649       set uquadtype
9650       eval $setvar
9651       quadkind=2
9652       ;;
9653    *) case "$d_longlong:$longlongsize" in
9654       define:8)
9655         val='"long long"'
9656         set quadtype
9657         eval $setvar
9658         val='"unsigned long long"'
9659         set uquadtype
9660         eval $setvar
9661         quadkind=3
9662         ;;
9663       *) case "$d_int64_t" in
9664          define)
9665            val=int64_t
9666            set quadtype
9667            eval $setvar
9668            val=uint64_t
9669            set uquadtype
9670            eval $setvar
9671            quadkind=4
9672            ;;
9673          esac
9674          ;;
9675       esac
9676       ;;
9677    esac
9678    ;;
9679 esac
9680
9681 case "$quadtype" in
9682 '')     echo "Alas, no 64-bit integer types in sight." >&4
9683         d_quad="$undef"
9684         ;;
9685 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9686             verb="will"
9687         else
9688             verb="could"
9689         fi
9690         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9691         d_quad="$define"
9692         ;;
9693 esac
9694
9695 : check for length of character
9696 echo " "
9697 case "$charsize" in
9698 '')
9699         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9700         $cat >try.c <<'EOCP'
9701 #include <stdio.h>
9702 int main()
9703 {
9704     printf("%d\n", (int)sizeof(char));
9705     exit(0);
9706 }
9707 EOCP
9708         set try
9709         if eval $compile_ok; then
9710                 dflt=`./try`
9711         else
9712                 dflt='1'
9713                 echo "(I can't seem to compile the test program.  Guessing...)"
9714         fi
9715         ;;
9716 *)
9717         dflt="$charsize"
9718         ;;
9719 esac
9720 rp="What is the size of a character (in bytes)?"
9721 . ./myread
9722 charsize="$ans"
9723 $rm -f try.c try
9724
9725
9726 echo " "
9727 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9728
9729 case "$use64bits:$d_quad:$quadtype" in
9730 define:define:?*)
9731         ivtype="$quadtype"
9732         uvtype="$uquadtype"
9733         ivsize=8
9734         uvsize=8
9735         ;;
9736 *)      ivtype="long"
9737         uvtype="unsigned long"
9738         ivsize=$longsize
9739         uvsize=$longsize
9740         ;;
9741 esac
9742
9743 case "$uselongdouble:$d_longdbl" in
9744 define:define)
9745         nvtype="long double"
9746         nvsize=$longdblsize
9747         ;;
9748 *)      nvtype=double
9749         nvsize=$doublesize
9750         ;;
9751 esac
9752
9753 $echo "(IV will be "$ivtype", $ivsize bytes)"
9754 $echo "(UV will be "$uvtype", $uvsize bytes)"
9755 $echo "(NV will be "$nvtype", $nvsize bytes)"
9756
9757 $cat >try.c <<EOCP
9758 #$i_inttypes I_INTTYPES
9759 #ifdef I_INTTYPES
9760 #include <inttypes.h>
9761 #endif
9762 #include <stdio.h>
9763 int main() {
9764 #ifdef INT8
9765    int8_t i =  INT8_MAX;
9766   uint8_t u = UINT8_MAX;
9767   printf("int8_t\n");
9768 #endif
9769 #ifdef INT16
9770    int16_t i =  INT16_MAX;
9771   uint16_t i = UINT16_MAX;
9772   printf("int16_t\n");
9773 #endif
9774 #ifdef INT32
9775    int32_t i =  INT32_MAX;
9776   uint32_t u = UINT32_MAX;
9777   printf("int32_t\n");
9778 #endif
9779 }
9780 EOCP
9781
9782 case "$i8type" in
9783 '')     case "$charsize" in
9784         1)      i8type=char
9785                 u8type="unsigned char"
9786                 i8size=$charsize
9787                 u8size=$charsize
9788                 ;;
9789         esac
9790         ;;
9791 esac
9792 case "$i8type" in
9793 '')     set try -DINT8
9794         if eval $compile; then
9795                 case "`./try$exe_ext`" in
9796                 int8_t) i8type=int8_t
9797                         u8type=uint8_t
9798                         i8size=1
9799                         u8size=1
9800                         ;;
9801                 esac
9802         fi
9803         ;;
9804 esac
9805 case "$i8type" in
9806 '')     if $test $charsize -ge 1; then
9807                 i8type=char
9808                 u8type="unsigned char"
9809                 i8size=$charsize
9810                 u8size=$charsize
9811         fi
9812         ;;
9813 esac
9814
9815 case "$i16type" in
9816 '')     case "$shortsize" in
9817         2)      i16type=short
9818                 u16type="unsigned short"
9819                 i16size=$shortsize
9820                 u16size=$shortsize
9821                 ;;
9822         esac
9823         ;;
9824 esac
9825 case "$i16type" in
9826 '')     set try -DINT16
9827         if eval $compile; then
9828                 case "`./try$exe_ext`" in
9829                 int16_t)
9830                         i16type=int16_t
9831                         u16type=uint16_t
9832                         i16size=2
9833                         u16size=2
9834                         ;;
9835                 esac
9836         fi
9837         ;;
9838 esac
9839 case "$i16type" in
9840 '')     if $test $shortsize -ge 2; then
9841                 i16type=short
9842                 u16type="unsigned short"
9843                 i16size=$shortsize
9844                 u16size=$shortsize
9845         fi
9846         ;;
9847 esac
9848
9849 case "$i32type" in
9850 '')     case "$longsize" in
9851         4)      i32type=long
9852                 u32type="unsigned long"
9853                 i32size=$longsize
9854                 u32size=$longsize
9855                 ;;
9856         *)      case "$intsize" in
9857                 4)      i32type=int
9858                         u32type="unsigned int"
9859                         i32size=$intsize
9860                         u32size=$intsize
9861                         ;;
9862                 esac
9863                 ;;
9864         esac
9865         ;;
9866 esac
9867 case "$i32type" in
9868 '')     set try -DINT32
9869         if eval $compile; then
9870                 case "`./try$exe_ext`" in
9871                 int32_t)
9872                         i32type=int32_t
9873                         u32type=uint32_t
9874                         i32size=4
9875                         u32size=4
9876                         ;;
9877                 esac
9878         fi
9879         ;;
9880 esac
9881 case "$i32type" in
9882 '')     if $test $intsize -ge 4; then
9883                 i32type=int
9884                 u32type="unsigned int"
9885                 i32size=$intsize
9886                 u32size=$intsize
9887         fi
9888         ;;
9889 esac
9890
9891 case "$i64type" in
9892 '')     case "$d_quad:$quadtype" in
9893         define:?*)
9894                 i64type="$quadtype"
9895                 u64type="$uquadtype"
9896                 i64size=8
9897                 u64size=8
9898                 ;;
9899         esac
9900         ;;
9901 esac
9902
9903 $echo "Checking whether your NVs can preserve your UVs..." >&4
9904 $cat <<EOP >try.c
9905 #include <stdio.h>
9906 int main() {
9907     $uvtype k = ($uvtype)~0, l;
9908     $nvtype d;
9909     l = k;
9910     d = ($nvtype)l;
9911     l = ($uvtype)d;
9912     if (l == k)
9913        printf("preserve\n");
9914     exit(0);
9915 }
9916 EOP
9917 set try
9918 if eval $compile; then
9919         case "`./try$exe_ext`" in
9920         preserve) d_nv_preserves_uv="$define" ;;
9921         esac
9922 fi      
9923 case "$d_nv_preserves_uv" in
9924 $define) $echo "Yes, they can."  2>&1 ;;
9925 *)       $echo "No, they can't." 2>&1
9926          d_nv_preserves_uv="$undef"
9927          ;;
9928 esac
9929
9930 $rm -f try.* try
9931
9932 : see if POSIX threads are available
9933 set pthread.h i_pthread
9934 eval $inhdr
9935
9936
9937
9938
9939 : how to create joinable pthreads
9940 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9941         echo " "
9942         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9943         $cat >try.c <<'EOCP'
9944 #include <pthread.h>
9945 int main() {
9946     int detachstate = JOINABLE;
9947 }
9948 EOCP
9949         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9950         if eval $compile; then
9951                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9952                 val="$undef" # Yes, undef.
9953                 set d_old_pthread_create_joinable
9954                 eval $setvar
9955                 val=""
9956                 set old_pthread_create_joinable
9957                 eval $setvar
9958         else
9959                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9960                 if eval $compile; then
9961                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9962                         val="$define"
9963                         set d_old_pthread_create_joinable
9964                         eval $setvar
9965                         val=PTHREAD_CREATE_UNDETACHED
9966                         set old_pthread_create_joinable
9967                         eval $setvar
9968                 else            
9969                         set try -DJOINABLE=__UNDETACHED
9970                         if eval $compile; then
9971                                 echo "You seem to use __UNDETACHED." >&4
9972                                 val="$define"
9973                                 set d_old_pthread_create_joinable
9974                                 eval $setvar
9975                                 val=__UNDETACHED
9976                                 set old_pthread_create_joinable
9977                                 eval $setvar
9978                         else
9979                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9980                                 val="$define"
9981                                 set d_old_pthread_create_joinable
9982                                 eval $setvar
9983                                 val=0
9984                                 set old_pthread_create_joinable
9985                                 eval $setvar
9986                         fi
9987                 fi
9988         fi
9989         $rm -f try try.*
9990 else
9991     d_old_pthread_create_joinable="$undef"
9992     old_pthread_create_joinable=""
9993 fi
9994
9995 : see if pause exists
9996 set pause d_pause
9997 eval $inlibc
9998
9999 : see if pipe exists
10000 set pipe d_pipe
10001 eval $inlibc
10002
10003 : see if poll exists
10004 set poll d_poll
10005 eval $inlibc
10006
10007
10008 : see whether the various POSIXish _yields exist
10009 $cat >try.c <<EOP
10010 #include <pthread.h>
10011 #include <stdio.h>
10012 int main() {
10013 #ifdef SCHED_YIELD
10014         sched_yield();
10015 #else
10016 #ifdef PTHREAD_YIELD
10017         pthread_yield();
10018 #else
10019 #ifdef PTHREAD_YIELD_NULL
10020         pthread_yield(NULL);
10021 #endif
10022 #endif
10023 #endif
10024 }
10025 EOP
10026 : see if sched_yield exists
10027 set try -DSCHED_YIELD
10028 if eval $compile; then
10029     val="$define"
10030     sched_yield='sched_yield()'
10031 else
10032     val="$undef"
10033 fi
10034 case "$usethreads" in
10035 $define)
10036         case "$val" in
10037         $define) echo 'sched_yield() found.' >&4        ;;
10038         *)       echo 'sched_yield() NOT found.' >&4    ;;
10039         esac
10040 esac
10041 set d_sched_yield
10042 eval $setvar
10043
10044 : see if pthread_yield exists
10045 set try -DPTHREAD_YIELD
10046 if eval $compile; then
10047     val="$define"
10048     case "$sched_yield" in
10049     '') sched_yield='pthread_yield()' ;;
10050     esac
10051 else
10052     set try -DPTHREAD_YIELD_NULL
10053     if eval $compile; then
10054         val="$define"
10055         case "$sched_yield" in
10056         '') sched_yield='pthread_yield(NULL)' ;;
10057         esac
10058     else
10059         val="$undef"
10060     fi
10061 fi
10062 case "$usethreads" in
10063 $define)
10064         case "$val" in
10065         $define) echo 'pthread_yield() found.' >&4      ;;
10066         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10067         esac
10068         ;;
10069 esac
10070 set d_pthread_yield
10071 eval $setvar
10072
10073 case "$sched_yield" in
10074 '') sched_yield=undef ;;
10075 esac
10076
10077 $rm -f try try.*
10078
10079 : see if this is a pwd.h system
10080 set pwd.h i_pwd
10081 eval $inhdr
10082
10083 case "$i_pwd" in
10084 $define)
10085         xxx=`./findhdr pwd.h`
10086         $cppstdin $cppflags $cppminus < $xxx >$$.h
10087
10088         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10089                 val="$define"
10090         else
10091                 val="$undef"
10092         fi
10093         set d_pwquota
10094         eval $setvar
10095
10096         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10097                 val="$define"
10098         else
10099                 val="$undef"
10100         fi
10101         set d_pwage
10102         eval $setvar
10103
10104         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10105                 val="$define"
10106         else
10107                 val="$undef"
10108         fi
10109         set d_pwchange
10110         eval $setvar
10111
10112         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10113                 val="$define"
10114         else
10115                 val="$undef"
10116         fi
10117         set d_pwclass
10118         eval $setvar
10119
10120         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10121                 val="$define"
10122         else
10123                 val="$undef"
10124         fi
10125         set d_pwexpire
10126         eval $setvar
10127
10128         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10129                 val="$define"
10130         else
10131                 val="$undef"
10132         fi
10133         set d_pwcomment
10134         eval $setvar
10135
10136         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10137                 val="$define"
10138         else
10139                 val="$undef"
10140         fi
10141         set d_pwgecos
10142         eval $setvar
10143
10144         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10145                 val="$define"
10146         else
10147                 val="$undef"
10148         fi
10149         set d_pwpasswd
10150         eval $setvar
10151
10152         $rm -f $$.h
10153         ;;
10154 *)
10155         val="$undef"; 
10156         set d_pwquota; eval $setvar
10157         set d_pwage; eval $setvar
10158         set d_pwchange; eval $setvar
10159         set d_pwclass; eval $setvar
10160         set d_pwexpire; eval $setvar
10161         set d_pwcomment; eval $setvar
10162         set d_pwgecos; eval $setvar
10163         set d_pwpasswd; eval $setvar
10164         ;;
10165 esac
10166
10167 : see if readdir and friends exist
10168 set readdir d_readdir
10169 eval $inlibc
10170 set seekdir d_seekdir
10171 eval $inlibc
10172 set telldir d_telldir
10173 eval $inlibc
10174 set rewinddir d_rewinddir
10175 eval $inlibc
10176
10177 : see if readlink exists
10178 set readlink d_readlink
10179 eval $inlibc
10180
10181 : see if rename exists
10182 set rename d_rename
10183 eval $inlibc
10184
10185 : see if rmdir exists
10186 set rmdir d_rmdir
10187 eval $inlibc
10188
10189 : see if memory.h is available.
10190 val=''
10191 set memory.h val
10192 eval $inhdr
10193
10194 : See if it conflicts with string.h
10195 case "$val" in
10196 $define)
10197         case "$strings" in
10198         '') ;;
10199         *)
10200                 $cppstdin $cppflags $cppminus < $strings > mem.h
10201                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10202                         echo " "
10203                         echo "We won't be including <memory.h>."
10204                         val="$undef"
10205                 fi
10206                 $rm -f mem.h
10207                 ;;
10208         esac
10209 esac
10210 set i_memory
10211 eval $setvar
10212
10213 : can bcopy handle overlapping blocks?
10214 val="$undef"
10215 case "$d_bcopy" in
10216 "$define")
10217         echo " "
10218         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10219         $cat >try.c <<EOCP
10220 #$i_memory I_MEMORY
10221 #$i_stdlib I_STDLIB
10222 #$i_string I_STRING
10223 #$i_unistd I_UNISTD
10224 EOCP
10225         $cat >>try.c <<'EOCP'
10226 #include <stdio.h>
10227 #ifdef I_MEMORY
10228 #  include <memory.h>
10229 #endif
10230 #ifdef I_STDLIB
10231 #  include <stdlib.h>
10232 #endif
10233 #ifdef I_STRING
10234 #  include <string.h>
10235 #else
10236 #  include <strings.h>
10237 #endif
10238 #ifdef I_UNISTD
10239 #  include <unistd.h>  /* Needed for NetBSD */
10240 #endif
10241 int main()
10242 {
10243 char buf[128], abc[128];
10244 char *b;
10245 int len;
10246 int off;
10247 int align;
10248
10249 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10250
10251 for (align = 7; align >= 0; align--) {
10252         for (len = 36; len; len--) {
10253                 b = buf+align;
10254                 bcopy(abc, b, len);
10255                 for (off = 1; off <= len; off++) {
10256                         bcopy(b, b+off, len);
10257                         bcopy(b+off, b, len);
10258                         if (bcmp(b, abc, len))
10259                                 exit(1);
10260                 }
10261         }
10262 }
10263 exit(0);
10264 }
10265 EOCP
10266         set try
10267         if eval $compile_ok; then
10268                 if ./try 2>/dev/null; then
10269                         echo "Yes, it can."
10270                         val="$define"
10271                 else
10272                         echo "It can't, sorry."
10273                         case "$d_memmove" in
10274                         "$define") echo "But that's Ok since you have memmove()." ;;
10275                         esac
10276                 fi
10277         else
10278                 echo "(I can't compile the test program, so we'll assume not...)"
10279                 case "$d_memmove" in
10280                 "$define") echo "But that's Ok since you have memmove()." ;;
10281                 esac
10282         fi
10283         ;;
10284 esac
10285 $rm -f try.* try core
10286 set d_safebcpy
10287 eval $setvar
10288
10289 : can memcpy handle overlapping blocks?
10290 val="$undef"
10291 case "$d_memcpy" in
10292 "$define")
10293         echo " "
10294         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10295         $cat >try.c <<EOCP
10296 #$i_memory I_MEMORY
10297 #$i_stdlib I_STDLIB
10298 #$i_string I_STRING
10299 #$i_unistd I_UNISTD
10300 EOCP
10301         $cat >>try.c <<'EOCP'
10302 #include <stdio.h>
10303 #ifdef I_MEMORY
10304 #  include <memory.h>
10305 #endif
10306 #ifdef I_STDLIB
10307 #  include <stdlib.h>
10308 #endif
10309 #ifdef I_STRING
10310 #  include <string.h>
10311 #else
10312 #  include <strings.h>
10313 #endif
10314 #ifdef I_UNISTD
10315 #  include <unistd.h>  /* Needed for NetBSD */
10316 #endif
10317 int main()
10318 {
10319 char buf[128], abc[128];
10320 char *b;
10321 int len;
10322 int off;
10323 int align;
10324
10325 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10326    try to store the string in read-only memory. */
10327 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10328
10329 for (align = 7; align >= 0; align--) {
10330         for (len = 36; len; len--) {
10331                 b = buf+align;
10332                 memcpy(b, abc, len);
10333                 for (off = 1; off <= len; off++) {
10334                         memcpy(b+off, b, len);
10335                         memcpy(b, b+off, len);
10336                         if (memcmp(b, abc, len))
10337                                 exit(1);
10338                 }
10339         }
10340 }
10341 exit(0);
10342 }
10343 EOCP
10344         set try
10345         if eval $compile_ok; then
10346                 if ./try 2>/dev/null; then
10347                         echo "Yes, it can."
10348                         val="$define"
10349                 else
10350                         echo "It can't, sorry."
10351                         case "$d_memmove" in
10352                         "$define") echo "But that's Ok since you have memmove()." ;;
10353                         esac
10354                 fi
10355         else
10356                 echo "(I can't compile the test program, so we'll assume not...)"
10357                 case "$d_memmove" in
10358                 "$define") echo "But that's Ok since you have memmove()." ;;
10359                 esac
10360         fi
10361         ;;
10362 esac
10363 $rm -f try.* try core
10364 set d_safemcpy
10365 eval $setvar
10366
10367 : can memcmp be trusted to compare relative magnitude?
10368 val="$undef"
10369 case "$d_memcmp" in
10370 "$define")
10371         echo " "
10372         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10373         $cat >try.c <<EOCP
10374 #$i_memory I_MEMORY
10375 #$i_stdlib I_STDLIB
10376 #$i_string I_STRING
10377 #$i_unistd I_UNISTD
10378 EOCP
10379         $cat >>try.c <<'EOCP'
10380 #include <stdio.h>
10381 #ifdef I_MEMORY
10382 #  include <memory.h>
10383 #endif
10384 #ifdef I_STDLIB
10385 #  include <stdlib.h>
10386 #endif
10387 #ifdef I_STRING
10388 #  include <string.h>
10389 #else
10390 #  include <strings.h>
10391 #endif
10392 #ifdef I_UNISTD
10393 #  include <unistd.h>  /* Needed for NetBSD */
10394 #endif
10395 int main()
10396 {
10397 char a = -1;
10398 char b = 0;
10399 if ((a < b) && memcmp(&a, &b, 1) < 0)
10400         exit(1);
10401 exit(0);
10402 }
10403 EOCP
10404         set try
10405         if eval $compile_ok; then
10406                 if ./try 2>/dev/null; then
10407                         echo "Yes, it can."
10408                         val="$define"
10409                 else
10410                         echo "No, it can't (it uses signed chars)."
10411                 fi
10412         else
10413                 echo "(I can't compile the test program, so we'll assume not...)"
10414         fi
10415         ;;
10416 esac
10417 $rm -f try.* try core
10418 set d_sanemcmp
10419 eval $setvar
10420
10421 : see if select exists
10422 set select d_select
10423 eval $inlibc
10424
10425 : see if semctl exists
10426 set semctl d_semctl
10427 eval $inlibc
10428
10429 : see if semget exists
10430 set semget d_semget
10431 eval $inlibc
10432
10433 : see if semop exists
10434 set semop d_semop
10435 eval $inlibc
10436
10437 : see how much of the 'sem*(2)' library is present.
10438 h_sem=true
10439 echo " "
10440 case "$d_semctl$d_semget$d_semop" in
10441 *"$undef"*) h_sem=false;;
10442 esac
10443 case "$osname" in
10444 freebsd)
10445     case "`ipcs 2>&1`" in
10446     "SVID messages"*"not configured"*)
10447         echo "Your $osname does not have the sem*(2) configured." >&4
10448         h_sem=false
10449         val="$undef"
10450         set semctl d_semctl
10451         eval $setvar
10452         set semget d_semget
10453         eval $setvar
10454         set semop d_semop
10455         eval $setvar
10456         ;;
10457     esac
10458     ;;
10459 esac
10460 : we could also check for sys/ipc.h ...
10461 if $h_sem && $test `./findhdr sys/sem.h`; then
10462         echo "You have the full sem*(2) library." >&4
10463         val="$define"
10464 else
10465         echo "You don't have the full sem*(2) library." >&4
10466         val="$undef"
10467 fi
10468 set d_sem
10469 eval $setvar
10470
10471 : see whether sys/sem.h defines union semun
10472 echo " "
10473 $cat > try.c <<'END'
10474 #include <sys/types.h>
10475 #include <sys/ipc.h>
10476 #include <sys/sem.h>
10477 int main () { union semun semun; semun.buf = 0; }
10478 END
10479 set try
10480 if eval $compile; then
10481     echo "You have union semun in <sys/sem.h>." >&4
10482     val="$define"
10483 else
10484     echo "You do not have union semun in <sys/sem.h>." >&4
10485     val="$undef"
10486 fi
10487 $rm -f try try.c try.h
10488 set d_union_semun
10489 eval $setvar
10490
10491 : see how to do semctl IPC_STAT
10492 case "$d_sem" in
10493 $define)
10494     : see whether semctl IPC_STAT can use union semun
10495     echo " "
10496     $cat > try.h <<END
10497 #ifndef S_IRUSR
10498 #   ifdef S_IREAD
10499 #       define S_IRUSR S_IREAD
10500 #       define S_IWUSR S_IWRITE
10501 #       define S_IXUSR S_IEXEC
10502 #   else
10503 #       define S_IRUSR 0400
10504 #       define S_IWUSR 0200
10505 #       define S_IXUSR 0100
10506 #   endif
10507 #   define S_IRGRP (S_IRUSR>>3)
10508 #   define S_IWGRP (S_IWUSR>>3)
10509 #   define S_IXGRP (S_IXUSR>>3)
10510 #   define S_IROTH (S_IRUSR>>6)
10511 #   define S_IWOTH (S_IWUSR>>6)
10512 #   define S_IXOTH (S_IXUSR>>6)
10513 #endif
10514 #ifndef S_IRWXU
10515 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10516 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10517 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10518 #endif
10519 END
10520
10521     $cat > try.c <<END
10522 #include <sys/types.h>
10523 #include <sys/ipc.h>
10524 #include <sys/sem.h>
10525 #include <sys/stat.h>
10526 #include <stdio.h>
10527 #include <errno.h>
10528 #include "try.h"
10529 #ifndef errno
10530 extern int errno;
10531 #endif
10532 #$d_union_semun HAS_UNION_SEMUN
10533 int main() {
10534     union semun
10535 #ifndef HAS_UNION_SEMUN
10536     {
10537         int val;
10538         struct semid_ds *buf;
10539         unsigned short *array;
10540     }
10541 #endif
10542     arg;
10543     int sem, st;
10544
10545 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10546     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10547     if (sem > -1) {
10548         struct semid_ds argbuf;
10549         arg.buf = &argbuf;
10550 #       ifdef IPC_STAT
10551         st = semctl(sem, 0, IPC_STAT, arg);
10552         if (st == 0)
10553             printf("semun\n");
10554         else
10555 #       endif /* IPC_STAT */
10556             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10557 #       ifdef IPC_RMID
10558         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10559 #       endif /* IPC_RMID */
10560             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10561     } else
10562 #endif /* IPC_PRIVATE && ... */
10563         printf("semget failed: errno = %d\n", errno);
10564   return 0;
10565 }
10566 END
10567     val="$undef"
10568     set try
10569     if eval $compile; then
10570         xxx=`./try`
10571         case "$xxx" in
10572         semun) val="$define" ;;
10573         esac
10574     fi
10575     $rm -f try try.c
10576     set d_semctl_semun
10577     eval $setvar
10578     case "$d_semctl_semun" in
10579     $define)
10580         echo "You can use union semun for semctl IPC_STAT." >&4
10581         also='also'
10582         ;;
10583     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10584         also=''
10585         ;;
10586     esac
10587
10588     : see whether semctl IPC_STAT can use struct semid_ds pointer
10589     $cat > try.c <<'END'
10590 #include <sys/types.h>
10591 #include <sys/ipc.h>
10592 #include <sys/sem.h>
10593 #include <sys/stat.h>
10594 #include "try.h"
10595 #include <stdio.h>
10596 #include <errno.h>
10597 #ifndef errno
10598 extern int errno;
10599 #endif
10600 int main() {
10601     struct semid_ds arg;
10602     int sem, st;
10603
10604 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10605     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10606     if (sem > -1) {
10607 #       ifdef IPC_STAT
10608         st = semctl(sem, 0, IPC_STAT, &arg);
10609         if (st == 0)
10610             printf("semid_ds\n");
10611         else
10612 #       endif /* IPC_STAT */
10613             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10614 #       ifdef IPC_RMID
10615         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10616 #       endif /* IPC_RMID */
10617             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10618     } else
10619 #endif /* IPC_PRIVATE && ... */
10620         printf("semget failed: errno = %d\n", errno);
10621
10622     return 0;
10623 }
10624 END
10625     val="$undef"
10626     set try
10627     if eval $compile; then
10628         xxx=`./try`
10629         case "$xxx" in
10630         semid_ds) val="$define" ;;
10631         esac
10632     fi
10633     $rm -f try try.c
10634     set d_semctl_semid_ds
10635     eval $setvar
10636     case "$d_semctl_semid_ds" in
10637     $define)
10638         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10639         ;;
10640     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10641         ;;
10642     esac
10643     $rm -f try.h
10644     ;;
10645 *)  val="$undef"
10646
10647     # We do not have the full sem*(2) library, so assume we can not
10648     # use either.
10649
10650     set d_semctl_semun
10651     eval $setvar
10652
10653     set d_semctl_semid_ds
10654     eval $setvar
10655     ;;
10656 esac
10657
10658 : see if setegid exists
10659 set setegid d_setegid
10660 eval $inlibc
10661
10662 : see if seteuid exists
10663 set seteuid d_seteuid
10664 eval $inlibc
10665
10666 : see if setgrent exists
10667 set setgrent d_setgrent
10668 eval $inlibc
10669
10670 : see if sethostent exists
10671 set sethostent d_sethent
10672 eval $inlibc
10673
10674 : see if setlinebuf exists
10675 set setlinebuf d_setlinebuf
10676 eval $inlibc
10677
10678 : see if setlocale exists
10679 set setlocale d_setlocale
10680 eval $inlibc
10681
10682 : see if setnetent exists
10683 set setnetent d_setnent
10684 eval $inlibc
10685
10686 : see if setprotoent exists
10687 set setprotoent d_setpent
10688 eval $inlibc
10689
10690 : see if setpgid exists
10691 set setpgid d_setpgid
10692 eval $inlibc
10693
10694 : see if setpgrp2 exists
10695 set setpgrp2 d_setpgrp2
10696 eval $inlibc
10697
10698 : see if setpriority exists
10699 set setpriority d_setprior
10700 eval $inlibc
10701
10702 : see if setpwent exists
10703 set setpwent d_setpwent
10704 eval $inlibc
10705
10706 : see if setregid exists
10707 set setregid d_setregid
10708 eval $inlibc
10709 set setresgid d_setresgid
10710 eval $inlibc
10711
10712 : see if setreuid exists
10713 set setreuid d_setreuid
10714 eval $inlibc
10715 set setresuid d_setresuid
10716 eval $inlibc
10717
10718 : see if setrgid exists
10719 set setrgid d_setrgid
10720 eval $inlibc
10721
10722 : see if setruid exists
10723 set setruid d_setruid
10724 eval $inlibc
10725
10726 : see if setservent exists
10727 set setservent d_setsent
10728 eval $inlibc
10729
10730 : see if setsid exists
10731 set setsid d_setsid
10732 eval $inlibc
10733
10734 : see if setspent exists
10735 set setspent d_setspent
10736 eval $inlibc
10737
10738 : see if setvbuf exists
10739 set setvbuf d_setvbuf
10740 eval $inlibc
10741
10742 : see if sfio.h is available
10743 set sfio.h i_sfio
10744 eval $inhdr
10745
10746
10747 : see if sfio library is available
10748 case "$i_sfio" in
10749 $define)
10750         val=''
10751         set sfreserve val
10752         eval $inlibc
10753         ;;
10754 *)
10755         val="$undef"
10756         ;;
10757 esac
10758 : Ok, but do we want to use it.
10759 case "$val" in
10760 $define)
10761         case "$usesfio" in
10762         true|$define|[yY]*) dflt='y';;
10763         *) dflt='n';;
10764         esac
10765         echo "$package can use the sfio library, but it is experimental."
10766         rp="You seem to have sfio available, do you want to try using it?"
10767         . ./myread
10768         case "$ans" in
10769         y|Y) ;;
10770         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10771                 val="$undef"
10772                 : Remove sfio from list of libraries to use
10773                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10774                 shift
10775                 libs="$*"
10776                 echo "libs = $libs" >&4
10777                 ;;
10778         esac
10779         ;;
10780 *)      case "$usesfio" in
10781         true|$define|[yY]*)
10782                 echo "Sorry, cannot find sfio on this machine" >&4
10783                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10784                 ;;
10785         esac
10786         ;;
10787 esac
10788 set d_sfio
10789 eval $setvar
10790 case "$d_sfio" in
10791 $define) usesfio='true';;
10792 *) usesfio='false';;
10793 esac
10794
10795 : see if shmctl exists
10796 set shmctl d_shmctl
10797 eval $inlibc
10798
10799 : see if shmget exists
10800 set shmget d_shmget
10801 eval $inlibc
10802
10803 : see if shmat exists
10804 set shmat d_shmat
10805 eval $inlibc
10806 : see what shmat returns
10807 case "$d_shmat" in
10808 "$define")
10809         $cat >shmat.c <<'END'
10810 #include <sys/shm.h>
10811 void *shmat();
10812 END
10813         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10814                 shmattype='void *'
10815         else
10816                 shmattype='char *'
10817         fi
10818         echo "and it returns ($shmattype)." >&4
10819         : see if a prototype for shmat is available
10820         xxx=`./findhdr sys/shm.h`
10821         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10822         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10823                 val="$define"
10824         else
10825                 val="$undef"
10826         fi
10827         $rm -f shmat.[co]
10828         ;;
10829 *)
10830         val="$undef"
10831         ;;
10832 esac
10833 set d_shmatprototype
10834 eval $setvar
10835
10836 : see if shmdt exists
10837 set shmdt d_shmdt
10838 eval $inlibc
10839
10840 : see how much of the 'shm*(2)' library is present.
10841 h_shm=true
10842 echo " "
10843 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10844 *"$undef"*) h_shm=false;;
10845 esac
10846 case "$osname" in
10847 freebsd)
10848     case "`ipcs 2>&1`" in
10849     "SVID shared memory"*"not configured"*)
10850         echo "Your $osname does not have the shm*(2) configured." >&4
10851         h_shm=false
10852         val="$undef"
10853         set shmctl d_shmctl
10854         evat $setvar
10855         set shmget d_shmget
10856         evat $setvar
10857         set shmat d_shmat
10858         evat $setvar
10859         set shmdt d_shmdt
10860         evat $setvar
10861         ;;
10862     esac
10863     ;;
10864 esac
10865 : we could also check for sys/ipc.h ...
10866 if $h_shm && $test `./findhdr sys/shm.h`; then
10867         echo "You have the full shm*(2) library." >&4
10868         val="$define"
10869 else
10870         echo "You don't have the full shm*(2) library." >&4
10871         val="$undef"
10872 fi
10873 set d_shm
10874 eval $setvar
10875
10876 echo " "
10877 : see if we have sigaction
10878 if set sigaction val -f d_sigaction; eval $csym; $val; then
10879         echo 'sigaction() found.' >&4
10880         $cat > try.c <<'EOP'
10881 #include <stdio.h>
10882 #include <sys/types.h>
10883 #include <signal.h>
10884 int main()
10885 {
10886     struct sigaction act, oact;
10887     act.sa_flags = 0;
10888     oact.sa_handler = 0;
10889     /* so that act and oact are used */
10890     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10891 }
10892 EOP
10893         set try
10894         if eval $compile_ok; then
10895                 val="$define"
10896         else
10897                 echo "But you don't seem to have a useable struct sigaction." >&4
10898                 val="$undef"
10899         fi
10900 else
10901         echo 'sigaction NOT found.' >&4
10902         val="$undef"
10903 fi
10904 set d_sigaction; eval $setvar
10905 $rm -f try try$_o try.c
10906
10907 : see if sigsetjmp exists
10908 echo " "
10909 case "$d_sigsetjmp" in
10910 '')
10911         $cat >try.c <<'EOP'
10912 #include <setjmp.h>
10913 sigjmp_buf env;
10914 int set = 1;
10915 int main()
10916 {
10917         if (sigsetjmp(env,1))
10918                 exit(set);
10919         set = 0;
10920         siglongjmp(env, 1);
10921         exit(1);
10922 }
10923 EOP
10924         set try
10925         if eval $compile; then
10926                 if ./try >/dev/null 2>&1; then
10927                         echo "POSIX sigsetjmp found." >&4
10928                         val="$define"
10929                 else
10930                         $cat >&4 <<EOM
10931 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10932 I'll ignore them.
10933 EOM
10934                         val="$undef"
10935                 fi
10936         else
10937                 echo "sigsetjmp not found." >&4
10938                 val="$undef"
10939         fi
10940         ;;
10941 *) val="$d_sigsetjmp"
10942         case "$d_sigsetjmp" in
10943         $define) echo "POSIX sigsetjmp found." >&4;;
10944         $undef) echo "sigsetjmp not found." >&4;;
10945         esac
10946         ;;
10947 esac
10948 set d_sigsetjmp
10949 eval $setvar
10950 $rm -f try.c try
10951
10952 : check for socklen_t
10953 echo " "
10954 $echo $n "Checking to see if your system supports socklen_t...$c" >&4
10955 $cat >try.c <<EOCP
10956 #include <sys/types.h>
10957 #$d_socket HAS_SOCKET
10958 #ifdef HAS_SOCKET
10959 #include <sys/socket.h>
10960 #endif
10961 int main() { socklen_t x = 16; }
10962 EOCP
10963 set try
10964 if eval $compile; then
10965         val="$define"
10966         echo " " >&4
10967         echo "You have socklen_t."
10968 else
10969         val="$undef"
10970         echo " " >&4
10971         echo "You do not have socklen_t."
10972 fi
10973 $rm -f try try.*
10974 set d_socklen_t
10975 eval $setvar
10976
10977 : see if sys/stat.h is available
10978 set sys/stat.h i_sysstat
10979 eval $inhdr
10980
10981
10982 : see if stat knows about block sizes
10983 echo " "
10984 echo "Checking to see if your struct stat has st_blocks field..." >&4
10985 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10986 eval $hasfield
10987
10988
10989 : see if this is a sys/vfs.h system
10990 set sys/vfs.h i_sysvfs
10991 eval $inhdr
10992
10993
10994 : see if this is a sys/statfs.h system
10995 set sys/statfs.h i_sysstatfs
10996 eval $inhdr
10997
10998
10999 echo " "
11000 echo "Checking to see if your system supports struct statfs..." >&4
11001 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
11002 eval $hasstruct
11003 case "$d_statfs_s" in
11004 "$define")      echo "Yes, it does."   ;;
11005 *)              echo "No, it doesn't." ;;
11006 esac
11007
11008
11009
11010 : see if struct statfs knows about f_flags
11011 case "$d_statfs_s" in
11012 define) 
11013         echo " "
11014         echo "Checking to see if your struct statfs has f_flags field..." >&4
11015         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
11016         eval $hasfield
11017         ;;
11018 *)      val="$undef"
11019         set d_statfs_f_flags
11020         eval $setvar
11021         ;;
11022 esac
11023 case "$d_statfs_f_flags" in
11024 "$define")      echo "Yes, it does."   ;;
11025 *)              echo "No, it doesn't." ;;
11026 esac
11027
11028 : see if _ptr and _cnt from stdio act std
11029 echo " "
11030 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11031         echo "(Looks like you have stdio.h from Linux.)"
11032         case "$stdio_ptr" in
11033         '') stdio_ptr='((fp)->_IO_read_ptr)'
11034                 ptr_lval=$define
11035                 ;;
11036         *)      ptr_lval=$d_stdio_ptr_lval;;
11037         esac
11038         case "$stdio_cnt" in
11039         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11040                 cnt_lval=$undef
11041                 ;;
11042         *)      cnt_lval=$d_stdio_cnt_lval;;
11043         esac
11044         case "$stdio_base" in
11045         '') stdio_base='((fp)->_IO_read_base)';;
11046         esac
11047         case "$stdio_bufsiz" in
11048         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11049         esac
11050 else
11051         case "$stdio_ptr" in
11052         '') stdio_ptr='((fp)->_ptr)'
11053                 ptr_lval=$define
11054                 ;;
11055         *)      ptr_lval=$d_stdio_ptr_lval;;
11056         esac
11057         case "$stdio_cnt" in
11058         '') stdio_cnt='((fp)->_cnt)'
11059                 cnt_lval=$define
11060                 ;;
11061         *)      cnt_lval=$d_stdio_cnt_lval;;
11062         esac
11063         case "$stdio_base" in
11064         '') stdio_base='((fp)->_base)';;
11065         esac
11066         case "$stdio_bufsiz" in
11067         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11068         esac
11069 fi
11070 : test whether _ptr and _cnt really work
11071 echo "Checking how std your stdio is..." >&4
11072 $cat >try.c <<EOP
11073 #include <stdio.h>
11074 #define FILE_ptr(fp)    $stdio_ptr
11075 #define FILE_cnt(fp)    $stdio_cnt
11076 int main() {
11077         FILE *fp = fopen("try.c", "r");
11078         char c = getc(fp);
11079         if (
11080                 18 <= FILE_cnt(fp) &&
11081                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11082         )
11083                 exit(0);
11084         exit(1);
11085 }
11086 EOP
11087 val="$undef"
11088 set try
11089 if eval $compile; then
11090         if ./try; then
11091                 echo "Your stdio acts pretty std."
11092                 val="$define"
11093         else
11094                 echo "Your stdio isn't very std."
11095         fi
11096 else
11097         echo "Your stdio doesn't appear very std."
11098 fi
11099 $rm -f try.c try
11100 set d_stdstdio
11101 eval $setvar
11102
11103 : Can _ptr be used as an lvalue?
11104 case "$d_stdstdio$ptr_lval" in
11105 $define$define) val=$define ;;
11106 *) val=$undef ;;
11107 esac
11108 set d_stdio_ptr_lval
11109 eval $setvar
11110
11111 : Can _cnt be used as an lvalue?
11112 case "$d_stdstdio$cnt_lval" in
11113 $define$define) val=$define ;;
11114 *) val=$undef ;;
11115 esac
11116 set d_stdio_cnt_lval
11117 eval $setvar
11118
11119 : see if _base is also standard
11120 val="$undef"
11121 case "$d_stdstdio" in
11122 $define)
11123         $cat >try.c <<EOP
11124 #include <stdio.h>
11125 #define FILE_base(fp)   $stdio_base
11126 #define FILE_bufsiz(fp) $stdio_bufsiz
11127 int main() {
11128         FILE *fp = fopen("try.c", "r");
11129         char c = getc(fp);
11130         if (
11131                 19 <= FILE_bufsiz(fp) &&
11132                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11133         )
11134                 exit(0);
11135         exit(1);
11136 }
11137 EOP
11138         set try
11139         if eval $compile; then
11140                 if ./try; then
11141                         echo "And its _base field acts std."
11142                         val="$define"
11143                 else
11144                         echo "But its _base field isn't std."
11145                 fi
11146         else
11147                 echo "However, it seems to be lacking the _base field."
11148         fi
11149         $rm -f try.c try
11150         ;;
11151 esac
11152 set d_stdiobase
11153 eval $setvar
11154
11155 $cat >&4 <<EOM
11156 Checking how to access stdio streams by file descriptor number...
11157 EOM
11158 case "$stdio_stream_array" in
11159 '')     $cat >try.c <<EOCP
11160 #include <stdio.h>
11161 int main() {
11162   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11163     printf("yes\n");
11164 }
11165 EOCP
11166         for s in _iob __iob __sF
11167         do
11168                 set try -DSTDIO_STREAM_ARRAY=$s
11169                 if eval $compile; then
11170                         case "`./try$exe_ext`" in
11171                         yes)    stdio_stream_array=$s; break ;;
11172                         esac
11173                 fi
11174         done
11175         $rm -f try.* try$exe_ext
11176 esac
11177 case "$stdio_stream_array" in
11178 '')     $cat >&4 <<EOM
11179 I can't figure out how to access stdio streams by file descriptor number.
11180 EOM
11181         d_stdio_stream_array="$undef"
11182         ;;
11183 *)      $cat >&4 <<EOM
11184 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11185 EOM
11186         d_stdio_stream_array="$define"
11187         ;;
11188 esac
11189
11190 : see if strcoll exists
11191 set strcoll d_strcoll
11192 eval $inlibc
11193
11194 : check for structure copying
11195 echo " "
11196 echo "Checking to see if your C compiler can copy structs..." >&4
11197 $cat >try.c <<'EOCP'
11198 int main()
11199 {
11200         struct blurfl {
11201                 int dyick;
11202         } foo, bar;
11203
11204         foo = bar;
11205 }
11206 EOCP
11207 if $cc -c try.c >/dev/null 2>&1 ; then
11208         val="$define"
11209         echo "Yup, it can."
11210 else
11211         val="$undef"
11212         echo "Nope, it can't."
11213 fi
11214 set d_strctcpy
11215 eval $setvar
11216 $rm -f try.*
11217
11218 : see if strerror and/or sys_errlist[] exist
11219 echo " "
11220 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11221     if set strerror val -f d_strerror; eval $csym; $val; then
11222                 echo 'strerror() found.' >&4
11223                 d_strerror="$define"
11224                 d_strerrm='strerror(e)'
11225                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11226                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11227                         d_syserrlst="$define"
11228                 else
11229                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11230                         d_syserrlst="$undef"
11231                 fi
11232     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11233                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11234                 echo 'strerror() found in string header.' >&4
11235                 d_strerror="$define"
11236                 d_strerrm='strerror(e)'
11237                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11238                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11239                                 d_syserrlst="$define"
11240                 else
11241                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11242                         d_syserrlst="$undef"
11243                 fi
11244     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11245                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11246                 d_strerror="$undef"
11247                 d_syserrlst="$define"
11248                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11249     else
11250                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11251                 d_strerror="$undef"
11252                 d_syserrlst="$undef"
11253                 d_strerrm='"unknown"'
11254     fi
11255 fi
11256
11257 : see if strtod exists
11258 set strtod d_strtod
11259 eval $inlibc
11260
11261 : see if strtol exists
11262 set strtol d_strtol
11263 eval $inlibc
11264
11265 : see if strtold exists
11266 set strtold d_strtold
11267 eval $inlibc
11268
11269 : see if strtoll exists
11270 set strtoll d_strtoll
11271 eval $inlibc
11272
11273 : see if strtoul exists
11274 set strtoul d_strtoul
11275 eval $inlibc
11276
11277 : see if strtoull exists
11278 set strtoull d_strtoull
11279 eval $inlibc
11280
11281 : see if strtouq exists
11282 set strtouq d_strtouq
11283 eval $inlibc
11284
11285 : see if strxfrm exists
11286 set strxfrm d_strxfrm
11287 eval $inlibc
11288
11289 : see if symlink exists
11290 set symlink d_symlink
11291 eval $inlibc
11292
11293 : see if syscall exists
11294 set syscall d_syscall
11295 eval $inlibc
11296
11297 : see if sysconf exists
11298 set sysconf d_sysconf
11299 eval $inlibc
11300
11301 : see if system exists
11302 set system d_system
11303 eval $inlibc
11304
11305 : see if tcgetpgrp exists
11306 set tcgetpgrp d_tcgetpgrp
11307 eval $inlibc
11308
11309 : see if tcsetpgrp exists
11310 set tcsetpgrp d_tcsetpgrp
11311 eval $inlibc
11312
11313 : see if prototype for telldir is available
11314 echo " "
11315 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11316 eval $hasproto
11317
11318 : see if this is a sys/times.h system
11319 set sys/times.h i_systimes
11320 eval $inhdr
11321
11322 : see if times exists
11323 echo " "
11324 if set times val -f d_times; eval $csym; $val; then
11325         echo 'times() found.' >&4
11326         d_times="$define"
11327         inc=''
11328         case "$i_systimes" in
11329         "$define") inc='sys/times.h';;
11330         esac
11331         rp="What is the type returned by times() on this system?"
11332         set clock_t clocktype long stdio.h sys/types.h $inc
11333         eval $typedef_ask
11334 else
11335         echo 'times() NOT found, hope that will do.' >&4
11336         d_times="$undef"
11337         clocktype='int'
11338 fi
11339
11340 : see if truncate exists
11341 set truncate d_truncate
11342 eval $inlibc
11343
11344 : see if tzname[] exists
11345 echo " "
11346 if set tzname val -a d_tzname; eval $csym; $val; then
11347         val="$define"
11348         echo 'tzname[] found.' >&4
11349 else
11350         val="$undef"
11351         echo 'tzname[] NOT found.' >&4
11352 fi
11353 set d_tzname
11354 eval $setvar
11355
11356 : see if umask exists
11357 set umask d_umask
11358 eval $inlibc
11359
11360 : see if ustat exists
11361 set ustat d_ustat
11362 eval $inlibc
11363
11364 : backward compatibility for d_hvfork
11365 if test X$d_hvfork != X; then
11366         d_vfork="$d_hvfork"
11367         d_hvfork=''
11368 fi
11369 : see if there is a vfork
11370 val=''
11371 set vfork val
11372 eval $inlibc
11373
11374 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11375 : perl on Solaris 2.x, and probably elsewhere.
11376 case "$val" in
11377 $define)
11378         echo " "
11379         case "$usevfork" in
11380         false) dflt='n';;
11381         *) dflt='y';;
11382         esac
11383         cat <<'EOM'
11384  
11385 Perl can only use a vfork() that doesn't suffer from strict
11386 restrictions on calling functions or modifying global data in
11387 the child.  For example, glibc-2.1 contains such a vfork()
11388 that is unsuitable.  If your system provides a proper fork()
11389 call, chances are that you do NOT want perl to use vfork().
11390
11391 EOM
11392         rp="Do you still want to use vfork()?"
11393         . ./myread
11394         case "$ans" in
11395         y|Y) ;;
11396         *)
11397                 echo "Ok, we won't use vfork()."
11398                 val="$undef"
11399                 ;;
11400         esac
11401         ;;
11402 esac
11403 set d_vfork
11404 eval $setvar
11405 case "$d_vfork" in
11406 $define) usevfork='true';;
11407 *) usevfork='false';;
11408 esac
11409
11410 : see if this is an sysdir system
11411 set sys/dir.h i_sysdir
11412 eval $inhdr
11413
11414 : see if this is an sysndir system
11415 set sys/ndir.h i_sysndir
11416 eval $inhdr
11417
11418 : see if closedir exists
11419 set closedir d_closedir
11420 eval $inlibc
11421
11422 case "$d_closedir" in
11423 "$define")
11424         echo " "
11425         echo "Checking whether closedir() returns a status..." >&4
11426         cat > closedir.c <<EOM
11427 #$i_dirent I_DIRENT             /**/
11428 #$i_sysdir I_SYS_DIR            /**/
11429 #$i_sysndir I_SYS_NDIR          /**/
11430 #$i_systypes I_SYS_TYPES        /**/
11431
11432 #if defined(I_SYS_TYPES)
11433 #include <sys/types.h>
11434 #endif
11435 #if defined(I_DIRENT)
11436 #include <dirent.h>
11437 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11438 #include <sys/dir.h>
11439 #endif
11440 #else
11441 #ifdef I_SYS_NDIR
11442 #include <sys/ndir.h>
11443 #else
11444 #ifdef I_SYS_DIR
11445 #ifdef hp9000s500
11446 #include <ndir.h>       /* may be wrong in the future */
11447 #else
11448 #include <sys/dir.h>
11449 #endif
11450 #endif
11451 #endif
11452 #endif 
11453 int main() { return closedir(opendir(".")); }
11454 EOM
11455         set closedir
11456         if eval $compile_ok; then
11457                 if ./closedir > /dev/null 2>&1 ; then
11458                         echo "Yes, it does."
11459                         val="$undef"
11460                 else
11461                         echo "No, it doesn't."
11462                         val="$define"
11463                 fi
11464         else
11465                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11466                 val="$define"
11467         fi
11468         ;;
11469 *)
11470         val="$undef";
11471         ;;
11472 esac
11473 set d_void_closedir
11474 eval $setvar
11475 $rm -f closedir*
11476 : check for volatile keyword
11477 echo " "
11478 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11479 $cat >try.c <<'EOCP'
11480 int main()
11481 {
11482         typedef struct _goo_struct goo_struct;
11483         goo_struct * volatile goo = ((goo_struct *)0);
11484         struct _goo_struct {
11485                 long long_int;
11486                 int reg_int;
11487                 char char_var;
11488         };
11489         typedef unsigned short foo_t;
11490         char *volatile foo;
11491         volatile int bar;
11492         volatile foo_t blech;
11493         foo = foo;
11494 }
11495 EOCP
11496 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11497         val="$define"
11498         echo "Yup, it does."
11499 else
11500         val="$undef"
11501         echo "Nope, it doesn't."
11502 fi
11503 set d_volatile
11504 eval $setvar
11505 $rm -f try.*
11506
11507 : see if there is a wait4
11508 set wait4 d_wait4
11509 eval $inlibc
11510
11511 : see if waitpid exists
11512 set waitpid d_waitpid
11513 eval $inlibc
11514
11515 : see if wcstombs exists
11516 set wcstombs d_wcstombs
11517 eval $inlibc
11518
11519 : see if wctomb exists
11520 set wctomb d_wctomb
11521 eval $inlibc
11522
11523 : preserve RCS keywords in files with variable substitution, grrr
11524 Date='$Date'
11525 Id='$Id'
11526 Log='$Log'
11527 RCSfile='$RCSfile'
11528 Revision='$Revision'
11529
11530 case "$crosscompile" in
11531 ''|[nN]*) crosscompile="$undef" ;;
11532 esac
11533
11534 case "$osname" in
11535 next|rhapsody) multiarch="$define" ;;
11536 esac
11537 case "$multiarch" in
11538 ''|[nN]*) multiarch="$undef" ;;
11539 esac
11540
11541 : check for alignment requirements
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 memory alignment check.
11548
11549 EOM
11550         case "$alignbytes" in
11551         '') alignbytes=8 ;;
11552         esac
11553         ;;
11554 *)
11555         case "$alignbytes" in
11556         '') echo "Checking alignment constraints..." >&4
11557                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11558                         $cat >try.c <<'EOCP'
11559 typedef long double NV;
11560 EOCP
11561                 else
11562                         $cat >try.c <<'EOCP'
11563 typedef double NV;
11564 EOCP
11565                 fi
11566                 $cat >>try.c <<'EOCP'
11567 #include <stdio.h>
11568 struct foobar {
11569         char foo;
11570         NV bar;
11571 } try_algn;
11572 int main()
11573 {
11574     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11575     return(0);
11576 }
11577 EOCP
11578                 set try
11579                 if eval $compile_ok; then
11580                         dflt=`./try`
11581                 else
11582                         dflt='8'
11583                         echo "(I can't seem to compile the test program...)"
11584                 fi
11585                 ;;
11586         *) dflt="$alignbytes"
11587                 ;;
11588         esac
11589         rp="Doubles must be aligned on a how-many-byte boundary?"
11590         . ./myread
11591         alignbytes="$ans"
11592         $rm -f try.c try
11593         ;;
11594 esac
11595
11596
11597 : check for ordering of bytes in a long
11598 echo " "
11599 case "$crosscompile$multiarch" in
11600 *$define*)
11601         $cat <<EOM
11602 You seem to be either cross-compiling or doing a multiarchitecture build,
11603 skipping the byteorder check.
11604
11605 EOM
11606         byteorder='0xffff'
11607         ;;
11608 *)
11609         case "$byteorder" in
11610         '')
11611                 $cat <<'EOM'
11612 In the following, larger digits indicate more significance.  A big-endian
11613 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11614 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11615 machines may have weird orders like 3412.  A Cray will report 87654321,
11616 an Alpha will report 12345678. If the test program works the default is
11617 probably right.
11618 I'm now running the test program...
11619 EOM
11620                 $cat >try.c <<'EOCP'
11621 #include <stdio.h>
11622 int main()
11623 {
11624         int i;
11625         union {
11626                 unsigned long l;
11627                 char c[sizeof(long)];
11628         } u;
11629
11630         if (sizeof(long) > 4)
11631                 u.l = (0x08070605L << 32) | 0x04030201L;
11632         else
11633                 u.l = 0x04030201L;
11634         for (i = 0; i < sizeof(long); i++)
11635                 printf("%c", u.c[i]+'0');
11636         printf("\n");
11637         exit(0);
11638 }
11639 EOCP
11640                 xxx_prompt=y
11641                 set try
11642                 if eval $compile && ./try > /dev/null; then
11643                         dflt=`./try`
11644                         case "$dflt" in
11645                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11646                                 echo "(The test program ran ok.)"
11647                                 echo "byteorder=$dflt"
11648                                 xxx_prompt=n
11649                         ;;
11650                         ????|????????) echo "(The test program ran ok.)" ;;
11651                         *) echo "(The test program didn't run right for some reason.)" ;;
11652                         esac
11653                 else
11654                         dflt='4321'
11655                         cat <<'EOM'
11656 (I can't seem to compile the test program.  Guessing big-endian...)
11657 EOM
11658                 fi
11659                 case "$xxx_prompt" in
11660                 y)
11661                         rp="What is the order of bytes in a long?"
11662                         . ./myread
11663                         byteorder="$ans"
11664                         ;;
11665                 *)      byteorder=$dflt
11666                         ;;
11667                 esac
11668                 ;;
11669         esac
11670         $rm -f try.c try
11671         ;;
11672 esac
11673
11674
11675 : how do we catenate cpp tokens here?
11676 echo " "
11677 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11678 $cat >cpp_stuff.c <<'EOCP'
11679 #define RCAT(a,b)a/**/b
11680 #define ACAT(a,b)a ## b
11681 RCAT(Rei,ser)
11682 ACAT(Cir,cus)
11683 EOCP
11684 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11685 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11686         echo "Oh!  Smells like ANSI's been here." >&4
11687         echo "We can catify or stringify, separately or together!"
11688         cpp_stuff=42
11689 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11690         echo "Ah, yes!  The good old days!" >&4
11691         echo "However, in the good old days we don't know how to stringify and"
11692         echo "catify at the same time."
11693         cpp_stuff=1
11694 else
11695         $cat >&4 <<EOM
11696 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11697 to have to edit the values of CAT[2-5] in config.h...
11698 EOM
11699         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11700 fi
11701 $rm -f cpp_stuff.*
11702
11703 : see if this is a db.h system
11704 set db.h i_db
11705 eval $inhdr
11706
11707 case "$i_db" in
11708 $define)
11709         : Check db version.
11710         echo " "
11711         echo "Checking Berkeley DB version ..." >&4
11712         $cat >try.c <<EOCP
11713 #$d_const HASCONST
11714 #ifndef HASCONST
11715 #define const
11716 #endif
11717 #include <sys/types.h>
11718 #include <stdio.h>
11719 #include <db.h>
11720 int main()
11721 {
11722 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11723     int Major, Minor, Patch ;
11724     unsigned long Version ;
11725     (void)db_version(&Major, &Minor, &Patch) ;
11726     printf("You have Berkeley DB Version 2 or greater\n");
11727
11728     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11729                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11730     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11731                 Major, Minor, Patch) ;
11732
11733     /* check that db.h & libdb are compatible */
11734     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11735         printf("db.h and libdb are incompatible\n") ;
11736         exit(3);        
11737     }
11738
11739     printf("db.h and libdb are compatible\n") ;
11740
11741     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11742                 + DB_VERSION_PATCH ;
11743
11744     /* needs to be >= 2.3.4 */
11745     if (Version < 2003004) {
11746     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11747         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11748         exit(2);        
11749     }
11750
11751     exit(0);
11752 #else
11753 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11754     printf("You have Berkeley DB Version 1\n");
11755     exit(0);    /* DB version < 2: the coast is clear. */
11756 #else
11757     exit(1);    /* <db.h> not Berkeley DB? */
11758 #endif
11759 #endif
11760 }
11761 EOCP
11762         set try
11763         if eval $compile_ok && ./try; then
11764                 echo 'Looks OK.' >&4
11765         else
11766                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11767                 i_db=$undef
11768                 case " $libs " in
11769                 *"-ldb "*)
11770                         : Remove db from list of libraries to use
11771                         echo "Removing unusable -ldb from library list" >&4
11772                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11773                         shift
11774                         libs="$*"
11775                         echo "libs = $libs" >&4
11776                         ;;
11777                 esac
11778         fi
11779         $rm -f try.*
11780         ;;
11781 esac
11782
11783 case "$i_db" in
11784 define)
11785         : Check the return type needed for hash 
11786         echo " "
11787         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11788         $cat >try.c <<EOCP
11789 #$d_const HASCONST
11790 #ifndef HASCONST
11791 #define const
11792 #endif
11793 #include <sys/types.h>
11794 #include <db.h>
11795
11796 #ifndef DB_VERSION_MAJOR
11797 u_int32_t hash_cb (ptr, size)
11798 const void *ptr;
11799 size_t size;
11800 {
11801 }
11802 HASHINFO info;
11803 int main()
11804 {
11805         info.hash = hash_cb;
11806 }
11807 #endif
11808 EOCP
11809         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11810                 if $contains warning try.out >>/dev/null 2>&1 ; then
11811                         db_hashtype='int'
11812                 else
11813                         db_hashtype='u_int32_t'
11814                 fi
11815         else
11816                 : XXX Maybe we should just give up here.
11817                 db_hashtype=u_int32_t
11818                 $cat try.out >&4
11819                 echo "Help:  I can't seem to compile the db test program." >&4
11820                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11821         fi
11822         $rm -f try.*
11823         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11824         ;;
11825 *)      db_hashtype=u_int32_t
11826         ;;
11827 esac
11828 case "$i_db" in
11829 define)
11830         : Check the return type needed for prefix 
11831         echo " "
11832         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11833         cat >try.c <<EOCP
11834 #$d_const HASCONST
11835 #ifndef HASCONST
11836 #define const
11837 #endif
11838 #include <sys/types.h>
11839 #include <db.h>
11840
11841 #ifndef DB_VERSION_MAJOR
11842 size_t prefix_cb (key1, key2)
11843 const DBT *key1;
11844 const DBT *key2;
11845 {
11846 }
11847 BTREEINFO info;
11848 int main()
11849 {
11850         info.prefix = prefix_cb;
11851 }
11852 #endif
11853 EOCP
11854         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11855                 if $contains warning try.out >>/dev/null 2>&1 ; then
11856                         db_prefixtype='int'
11857                 else
11858                         db_prefixtype='size_t'
11859                 fi
11860         else
11861                 db_prefixtype='size_t'
11862                 : XXX Maybe we should just give up here.
11863                 $cat try.out >&4
11864                 echo "Help:  I can't seem to compile the db test program." >&4
11865                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11866         fi
11867         $rm -f try.*
11868         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11869         ;;
11870 *)      db_prefixtype='size_t'
11871         ;;
11872 esac
11873
11874 : check for void type
11875 echo " "
11876 echo "Checking to see how well your C compiler groks the void type..." >&4
11877 case "$voidflags" in
11878 '')
11879         $cat >try.c <<'EOCP'
11880 #if TRY & 1
11881 void sub() {
11882 #else
11883 sub() {
11884 #endif
11885         extern void moo();      /* function returning void */
11886         void (*goo)();          /* ptr to func returning void */
11887 #if TRY & 8
11888         void *hue;              /* generic ptr */
11889 #endif
11890 #if TRY & 2
11891         void (*foo[10])();
11892 #endif
11893
11894 #if TRY & 4
11895         if(goo == moo) {
11896                 exit(0);
11897         }
11898 #endif
11899         exit(0);
11900 }
11901 int main() { sub(); }
11902 EOCP
11903         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11904                 voidflags=$defvoidused
11905         echo "Good.  It appears to support void to the level $package wants.">&4
11906                 if $contains warning .out >/dev/null 2>&1; then
11907                         echo "However, you might get some warnings that look like this:"
11908                         $cat .out
11909                 fi
11910         else
11911 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11912                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11913                         echo "It supports 1..."
11914                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11915                                 echo "It also supports 2..."
11916                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11917                                         voidflags=7
11918                                         echo "And it supports 4 but not 8 definitely."
11919                                 else
11920                                         echo "It doesn't support 4..."
11921                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11922                                                 voidflags=11
11923                                                 echo "But it supports 8."
11924                                         else
11925                                                 voidflags=3
11926                                                 echo "Neither does it support 8."
11927                                         fi
11928                                 fi
11929                         else
11930                                 echo "It does not support 2..."
11931                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11932                                         voidflags=13
11933                                         echo "But it supports 4 and 8."
11934                                 else
11935                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11936                                                 voidflags=5
11937                                                 echo "And it supports 4 but has not heard about 8."
11938                                         else
11939                                                 echo "However it supports 8 but not 4."
11940                                         fi
11941                                 fi
11942                         fi
11943                 else
11944                         echo "There is no support at all for void."
11945                         voidflags=0
11946                 fi
11947         fi
11948 esac
11949 case "$voidflags" in
11950 "$defvoidused") ;;
11951 *)      $cat >&4 <<'EOM'
11952   Support flag bits are:
11953     1: basic void declarations.
11954     2: arrays of pointers to functions returning void.
11955     4: operations between pointers to and addresses of void functions.
11956     8: generic void pointers.
11957 EOM
11958         dflt="$voidflags";
11959         rp="Your void support flags add up to what?"
11960         . ./myread
11961         voidflags="$ans"
11962         ;;
11963 esac
11964 $rm -f try.* .out
11965
11966
11967 : How can we generate normalized random numbers ?
11968 echo " "
11969 echo "Looking for a random number function..." >&4
11970 case "$randfunc" in
11971 '')
11972         if set drand48 val -f; eval $csym; $val; then
11973                 dflt="drand48"
11974                 echo "Good, found drand48()." >&4
11975         elif set random val -f; eval $csym; $val; then
11976                 dflt="random"
11977                 echo "OK, found random()." >&4
11978         else
11979                 dflt="rand"
11980                 echo "Yick, looks like I have to use rand()." >&4
11981         fi
11982         echo " "
11983         ;;
11984 *)
11985         dflt="$randfunc"
11986         ;;
11987 esac
11988 cont=true
11989
11990 case "$ccflags" in
11991 *-Dmy_rand=*|*-Dmy_srand=*)
11992         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11993         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11994         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11995         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11996         ;;
11997 esac
11998
11999 while $test "$cont"; do
12000         rp="Use which function to generate random numbers?"
12001         . ./myread
12002         if $test "$ans" = "$dflt"; then
12003                 : null
12004         else
12005                 randbits=''
12006         fi
12007         randfunc="$ans"
12008         if set $ans val -f; eval $csym; $val; then
12009                 cont=''
12010         else
12011                 dflt=y
12012                 rp="I cannot find function $ans. Use that name anyway?"
12013                 . ./myread
12014                 dflt=rand
12015                 case "$ans" in
12016                         [yY]*) cont='';;
12017                 esac
12018         fi
12019         case "$cont" in
12020         '')
12021                 case "$randfunc" in
12022                 drand48)
12023                         drand01="drand48()"
12024                         seedfunc="srand48"
12025                         randbits=48
12026                         randseedtype=long
12027                         ;;
12028                 rand|random)
12029                         case "$randbits" in
12030                         '')
12031 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12032                                 $cat >try.c <<EOCP
12033 #$i_unistd I_UNISTD
12034 #$i_stdlib I_STDLIB
12035 #include <stdio.h>
12036 #ifdef I_UNISTD
12037 #  include <unistd.h>
12038 #endif
12039 #ifdef I_STDLIB
12040 #  include <stdlib.h>
12041 #endif
12042 int main()
12043 {
12044         register int i;
12045         register unsigned long tmp;
12046         register unsigned long max = 0L;
12047
12048         for (i = 1000; i; i--) {
12049                 tmp = (unsigned long) $randfunc();
12050                 if (tmp > max) max = tmp;
12051         }
12052         for (i = 0; max; i++)
12053                 max /= 2;
12054         printf("%d\n",i);
12055 }
12056 EOCP
12057                                 set try
12058                                 if eval $compile_ok; then
12059                                         dflt=`try`
12060                                 else
12061                                         dflt='?'
12062                                         echo "(I can't seem to compile the test program...)"
12063                                 fi
12064                                 ;;
12065                         *)
12066                                 dflt="$randbits"
12067                                 ;;
12068                         esac
12069                         rp="How many bits does your $randfunc() function produce?"
12070                         . ./myread
12071                         randbits="$ans"
12072                         $rm -f try.c try
12073                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12074                         seedfunc="s$randfunc"
12075                         randseedtype=unsigned
12076                         ;;
12077                 *)
12078                         dflt="31"
12079                         rp="How many bits does your $randfunc() function produce?"
12080                         . ./myread
12081                         randbits="$ans"
12082                         seedfunc="s$randfunc"
12083                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12084                         if set $seedfunc val -f; eval $csym; $val; then
12085                                 echo "(Using $seedfunc() to seed random generator)"
12086                         else
12087                                 echo "(Warning: no $seedfunc() to seed random generator)"
12088                                 seedfunc=rand
12089                         fi
12090                         randseedtype=unsigned
12091                         ;;
12092                 esac
12093                 ;;
12094         esac
12095 done
12096
12097 echo " "
12098 echo "Determining whether or not we are on an EBCDIC system..." >&4
12099 $cat >tebcdic.c <<'EOM'
12100 int main()
12101 {
12102   if ('M'==0xd4) return 0;
12103   return 1;
12104 }
12105 EOM
12106
12107 val=$undef
12108 set tebcdic
12109 if eval $compile_ok; then
12110         if ./tebcdic; then
12111                 echo "You have EBCDIC." >&4
12112                 val="$define"
12113         else
12114                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12115         fi
12116 else
12117         echo "I'm unable to compile the test program." >&4
12118         echo "I'll assume ASCII or some ISO Latin." >&4
12119 fi
12120 $rm -f tebcdic.c tebcdic
12121 set ebcdic
12122 eval $setvar
12123
12124 echo " "
12125 $cat >&4 <<EOM
12126 Checking how to flush all pending stdio output...
12127 EOM
12128 # I only know how to find the first 32 possibly open files on SunOS.
12129 # See also hints/sunos_4_1.sh and util.c  --AD
12130 case "$osname" in
12131 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12132 esac
12133 $cat >>try.c <<EOCP
12134 #include <stdio.h>
12135 #$i_unistd I_UNISTD
12136 #ifdef I_UNISTD
12137 # include <unistd.h>
12138 #endif
12139 #$d_sysconf HAS_SYSCONF
12140 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12141 #ifdef HAS_STDIO_STREAM_ARRAY
12142 # define STDIO_STREAM_ARRAY $stdio_stream_array
12143 #endif
12144 int main() {
12145   FILE* p = fopen("try.out", "w");
12146 #ifdef TRY_FPUTC
12147   fputc('x', p);
12148 #else
12149 # ifdef TRY_FPRINTF
12150   fprintf(p, "x");
12151 # endif
12152 #endif
12153 #ifdef TRY_FFLUSH_NULL
12154   fflush(NULL);
12155 #endif
12156 #ifdef TRY_FFLUSH_ALL
12157   {
12158     long open_max = -1;
12159 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12160     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12161 # else
12162 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12163     open_max = sysconf(_SC_OPEN_MAX);
12164 #  else
12165 #   ifdef FOPEN_MAX
12166     open_max = FOPEN_MAX;
12167 #   else
12168 #    ifdef OPEN_MAX
12169     open_max = OPEN_MAX;
12170 #    else
12171 #     ifdef _NFILE
12172     open_max = _NFILE;
12173 #     endif
12174 #    endif
12175 #   endif
12176 #  endif
12177 # endif 
12178 # ifdef HAS_STDIO_STREAM_ARRAY
12179     if (open_max > 0) {
12180       long i;
12181       for (i = 0; i < open_max; i++)
12182             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12183                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12184                 STDIO_STREAM_ARRAY[i]._flag)
12185                 fflush(&STDIO_STREAM_ARRAY[i]);
12186     }   
12187   }
12188 # endif
12189 #endif
12190   _exit(42);
12191 }
12192 EOCP
12193 : first we have to find out how _not_ to flush
12194 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12195     output=''
12196     set try -DTRY_FPUTC
12197     if eval $compile; then
12198             $rm -f try.out
12199             ./try$exe_ext 2>/dev/null
12200             if $test ! -s try.out -a "X$?" = X42; then
12201                 output=-DTRY_FPUTC
12202             fi
12203     fi
12204     case "$output" in
12205     '')
12206             set try -DTRY_FPRINTF
12207             $rm -f try.out
12208             if eval $compile; then
12209                     $rm -f try.out
12210                     ./try$exe_ext 2>/dev/null
12211                     if $test ! -s try.out -a "X$?" = X42; then
12212                         output=-DTRY_FPRINTF
12213                     fi
12214             fi
12215         ;;
12216     esac
12217 fi
12218 : check for fflush NULL behaviour
12219 case "$fflushNULL" in
12220 '')     set try -DTRY_FFLUSH_NULL $output
12221         if eval $compile; then
12222                 $rm -f try.out
12223                 ./try$exe_ext 2>/dev/null
12224                 code="$?"
12225                 if $test -s try.out -a "X$code" = X42; then
12226                         fflushNULL="`$cat try.out`"
12227                 else
12228                         if $test "X$code" != X42; then
12229                                 $cat >&4 <<EOM
12230 (If this test failed, don't worry, we'll try another method shortly.)
12231 EOM
12232                         fi
12233                 fi
12234         fi
12235         $rm -f core try.core core.try.*
12236         case "$fflushNULL" in
12237         x)      $cat >&4 <<EOM
12238 Your fflush(NULL) works okay.
12239 EOM
12240                 fflushNULL="$define"
12241                 ;;
12242         '')     $cat >&4 <<EOM
12243 Your fflush(NULL) isn't working (contrary to ANSI C).
12244 EOM
12245                 fflushNULL="$undef"
12246                 ;;
12247         *)      $cat >&4 <<EOM
12248 Cannot figure out whether your fflush(NULL) works or not.
12249 I'm assuming it doesn't (contrary to ANSI C).
12250 EOM
12251                 fflushNULL="$undef"
12252                 ;;
12253         esac
12254         ;;
12255 $define|true|[yY]*)
12256         fflushNULL="$define"
12257         ;;
12258 *)
12259         fflushNULL="$undef"
12260         ;;
12261 esac
12262 : check explicit looping only if NULL did not work
12263 case "$fflushNULL" in
12264 "$undef")
12265         : check for fflush all behaviour
12266         case "$fflushall" in
12267         '')     set try -DTRY_FFLUSH_ALL $output
12268                 if eval $compile; then
12269                         $cat >&4 <<EOM
12270 (Now testing the other method--but note that also this may fail.)
12271 EOM
12272                         $rm -f try.out
12273                         ./try$exe_ext 2>/dev/null
12274                         if $test -s try.out -a "X$?" = X42; then
12275                                 fflushall="`$cat try.out`"
12276                         fi
12277                 fi
12278                 $rm -f core try.core core.try.*
12279                 case "$fflushall" in
12280                 x)      $cat >&4 <<EOM
12281 Whew. Flushing explicitly all the stdio streams works.
12282 EOM
12283                         fflushall="$define"
12284                         ;;
12285                 '')     $cat >&4 <<EOM
12286 Sigh. Flushing explicitly all the stdio streams doesn't work.
12287 EOM
12288                         fflushall="$undef"
12289                         ;;
12290                 *)      $cat >&4 <<EOM
12291 Cannot figure out whether flushing stdio streams explicitly works or not.
12292 I'm assuming it doesn't.
12293 EOM
12294                         fflushall="$undef"
12295                         ;;
12296                 esac
12297                 ;;
12298         "$define"|true|[yY]*)
12299                 fflushall="$define"
12300                 ;;
12301         *)
12302                 fflushall="$undef"
12303                 ;;
12304         esac
12305         ;;
12306 *)      fflushall="$undef"      
12307         ;;
12308 esac
12309 case "$fflushNULL$fflushall" in
12310 undefundef)
12311         $cat <<EOM
12312 I cannot figure out how to flush pending stdio output.
12313 EOM
12314         ;;
12315 esac
12316 $rm -f try.* try$exe_ext
12317
12318 : Store the full pathname to the ar program for use in the C program
12319 : Respect a hint or command line value for full_ar.
12320 case "$full_ar" in
12321 '') full_ar=$ar ;;
12322 esac
12323
12324 : Store the full pathname to the sed program for use in the C program
12325 full_sed=$sed
12326
12327 : see what type gids are declared as in the kernel
12328 echo " "
12329 echo "Looking for the type for group ids returned by getgid()."
12330 set gid_t gidtype xxx stdio.h sys/types.h
12331 eval $typedef
12332 case "$gidtype" in
12333 xxx)
12334         xxx=`./findhdr sys/user.h`
12335         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12336         case $1 in
12337         unsigned) dflt="$1 $2" ;;
12338         *) dflt="$1" ;;
12339         esac
12340         ;;
12341 *) dflt="$gidtype";;
12342 esac
12343 case "$gidtype" in
12344 gid_t) echo "gid_t found." ;;
12345 *)      rp="What is the type for group ids returned by getgid()?"
12346         . ./myread
12347         gidtype="$ans"
12348         ;;
12349 esac
12350
12351 echo " "
12352 case "$gidtype" in
12353 *_t) zzz="$gidtype"     ;;
12354 *)   zzz="gid"          ;;
12355 esac
12356 echo "Checking the size of $zzz..." >&4 
12357 cat > try.c <<EOCP
12358 #include <sys/types.h>
12359 #include <stdio.h>
12360 int main() {
12361     printf("%d\n", (int)sizeof($gidtype));
12362     exit(0);
12363 }
12364 EOCP
12365 set try
12366 if eval $compile_ok; then
12367         yyy=`./try`
12368         case "$yyy" in
12369         '')     gidsize=4
12370                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12371                 ;;
12372         *)      gidsize=$yyy
12373                 echo "Your $zzz size is $gidsize bytes."
12374                 ;;
12375         esac
12376 else
12377         gidsize=4
12378         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12379 fi
12380
12381
12382 echo " "
12383 case "$gidtype" in
12384 *_t) zzz="$gidtype"     ;;
12385 *)   zzz="gid"          ;;
12386 esac
12387 echo "Checking the sign of $zzz..." >&4 
12388 cat > try.c <<EOCP
12389 #include <sys/types.h>
12390 #include <stdio.h>
12391 int main() {
12392         $gidtype foo = -1;
12393         if (foo < 0)
12394                 printf("-1\n");
12395         else
12396                 printf("1\n");
12397 }
12398 EOCP
12399 set try
12400 if eval $compile; then
12401         yyy=`./try`
12402         case "$yyy" in
12403         '')     gidsign=1
12404                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12405                 ;;
12406         *)      gidsign=$yyy
12407                 case "$gidsign" in
12408                  1) echo "Your $zzz is unsigned." ;;
12409                 -1) echo "Your $zzz is signed."   ;;
12410                 esac
12411                 ;;
12412         esac
12413 else
12414         gidsign=1
12415         echo "(I can't compile the test program--guessing unsigned.)" >&4
12416 fi
12417
12418
12419 echo " "
12420
12421 if $test X"$quadtype" != X; then
12422
12423 echo "Checking how to print 64-bit integers..." >&4
12424
12425 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12426         $cat >try.c <<'EOCP'
12427 #include <sys/types.h>
12428 #include <stdio.h>
12429 int main() {
12430   int q = 12345678901;
12431   printf("%ld\n", q);
12432 }
12433 EOCP
12434         set try
12435         if eval $compile; then
12436                 yyy=`./try$exe_ext`
12437                 case "$yyy" in
12438                 12345678901)
12439                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12440                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12441                         echo "We will use %d."
12442                         ;;
12443                 esac
12444         fi
12445 fi
12446
12447 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12448         $cat >try.c <<'EOCP'
12449 #include <sys/types.h>
12450 #include <stdio.h>
12451 int main() {
12452   long q = 12345678901;
12453   printf("%ld\n", q);
12454 }
12455 EOCP
12456         set try
12457         if eval $compile; then
12458                 yyy=`./try$exe_ext`
12459                 case "$yyy" in
12460                 12345678901)
12461                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12462                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12463                         echo "We will use %ld."
12464                         ;;
12465                 esac
12466         fi
12467 fi
12468
12469 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12470         $cat >try.c <<'EOCP'
12471 #include <sys/types.h>
12472 #include <inttypes.h>
12473 #include <stdio.h>
12474 int main() {
12475   int64_t q = 12345678901;
12476   printf("%" PRId64 "\n", q);
12477 }
12478 EOCP
12479         set try
12480         if eval $compile; then
12481                 yyy=`./try$exe_ext`
12482                 case "$yyy" in
12483                 12345678901)
12484                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12485                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12486                         echo "We will use the C9X style."
12487                         ;;
12488                 esac
12489         fi
12490 fi
12491
12492 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12493         $cat >try.c <<'EOCP'
12494 #include <sys/types.h>
12495 #include <stdio.h>
12496 int main() {
12497   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12498   printf("%lld\n", q);
12499 }
12500 EOCP
12501         set try
12502         if eval $compile; then
12503                 yyy=`./try$exe_ext`
12504                 case "$yyy" in
12505                 12345678901)
12506                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12507                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12508                         echo "We will use the %lld style."
12509                         ;;
12510                 esac
12511         fi
12512 fi
12513
12514 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12515         $cat >try.c <<EOCP
12516 #include <sys/types.h>
12517 #include <stdio.h>
12518 int main() {
12519   $quadtype q = 12345678901;
12520   printf("%Ld\n", q);
12521 }
12522 EOCP
12523         set try
12524         if eval $compile; then
12525                 yyy=`./try$exe_ext`
12526                 case "$yyy" in
12527                 12345678901)
12528                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12529                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12530                         echo "We will use %Ld."
12531                         ;;
12532                 esac
12533         fi
12534 fi
12535
12536 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12537         $cat >try.c <<EOCP
12538 #include <sys/types.h>
12539 #include <stdio.h>
12540 int main() {
12541   $quadtype q = 12345678901;
12542   printf("%qd\n", q);
12543 }
12544 EOCP
12545         set try
12546         if eval $compile; then
12547                 yyy=`./try$exe_ext`
12548                 case "$yyy" in
12549                 12345678901)
12550                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12551                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12552                         echo "We will use %qd."
12553                         ;;
12554                 esac
12555         fi
12556 fi
12557
12558 if $test X"$sPRId64" = X; then
12559         echo "Cannot figure out how to print 64-bit integers." >&4
12560 fi
12561
12562 $rm -f try try.*
12563
12564 fi
12565
12566 case "$sPRId64" in
12567 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12568         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12569         ;;
12570 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12571         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12572         ;;
12573 esac
12574
12575
12576 echo " "
12577 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12578
12579 if $test X"$ivsize" = X8; then
12580         ivdformat="$sPRId64"
12581         uvuformat="$sPRIu64"
12582         uvoformat="$sPRIo64"
12583         uvxformat="$sPRIx64"
12584 else
12585         if $test X"$ivsize" = X"$longsize"; then
12586                 ivdformat='"ld"'
12587                 uvuformat='"lu"'
12588                 uvoformat='"lo"'
12589                 uvxformat='"lx"'
12590         else
12591                 if $test X"$ivsize" = X"$intsize"; then
12592                         ivdformat='"d"'
12593                         uvuformat='"u"'
12594                         uvoformat='"o"'
12595                         uvxformat='"x"'
12596                 else
12597                         : far out
12598                         if $test X"$ivsize" = X"$shortsize"; then
12599                                 ivdformat='"hd"'
12600                                 uvuformat='"hu"'
12601                                 uvoformat='"ho"'
12602                                 uvxformat='"hx"'
12603                         fi
12604                 fi
12605         fi
12606 fi
12607
12608 case "$ivdformat" in
12609 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12610     exit 1
12611     ;;
12612 esac
12613
12614
12615 echo " "
12616 $echo "Checking the format string to be used for gids..." >&4
12617
12618 case "$gidsign" in
12619 -1)     if $test X"$gidsize" = X"$ivsize"; then
12620                 gidformat="$ivdformat"
12621         else
12622                 if $test X"$gidsize" = X"$longsize"; then
12623                         gidformat='"ld"'
12624                 else
12625                         if $test X"$gidsize" = X"$intsize"; then
12626                                 gidformat='"d"'
12627                         else
12628                                 if $test X"$gidsize" = X"$shortsize"; then
12629                                         gidformat='"hd"'
12630                                 fi
12631                         fi
12632                 fi
12633         fi
12634         ;;
12635 *)      if $test X"$gidsize" = X"$uvsize"; then
12636                 gidformat="$uvuformat"
12637         else
12638                 if $test X"$gidsize" = X"$longsize"; then
12639                         gidformat='"lu"'
12640                 else
12641                         if $test X"$gidsize" = X"$intsize"; then
12642                                 gidformat='"u"'
12643                         else
12644                                 if $test X"$gidsize" = X"$shortsize"; then
12645                                         gidformat='"hu"'
12646                                 fi
12647                         fi
12648                 fi
12649         fi
12650         ;;
12651 esac
12652
12653 : see if getgroups exists
12654 set getgroups d_getgrps
12655 eval $inlibc
12656
12657 : see if setgroups exists
12658 set setgroups d_setgrps
12659 eval $inlibc
12660
12661
12662 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12663 echo " "
12664 case "$d_getgrps$d_setgrps" in
12665 *define*)
12666         case "$groupstype" in
12667         '') dflt="$gidtype" ;;
12668         *)  dflt="$groupstype" ;;
12669         esac
12670         $cat <<EOM
12671 What type of pointer is the second argument to getgroups() and setgroups()?
12672 Usually this is the same as group ids, $gidtype, but not always.
12673
12674 EOM
12675         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12676         . ./myread
12677         groupstype="$ans"
12678         ;;
12679 *)  groupstype="$gidtype";;
12680 esac
12681
12682 echo " "
12683 echo "Checking if your $make program sets \$(MAKE)..." >&4
12684 case "$make_set_make" in
12685 '')
12686         $sed 's/^X //' > testmake.mak << 'EOF'
12687 Xall:
12688 X       @echo 'maketemp="$(MAKE)"'
12689 EOF
12690         case "`$make -f testmake.mak 2>/dev/null`" in
12691         *maketemp=*) make_set_make='#' ;;
12692         *)      make_set_make="MAKE=$make" ;;
12693         esac
12694         $rm -f testmake.mak
12695         ;;
12696 esac
12697 case "$make_set_make" in
12698 '#') echo "Yup, it does.";;
12699 *) echo "Nope, it doesn't.";;
12700 esac
12701
12702 : see what type is used for mode_t
12703 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12704 set mode_t modetype int stdio.h sys/types.h
12705 eval $typedef_ask
12706
12707 : define a fucntion to check prototypes
12708 $cat > protochk <<EOSH
12709 $startsh
12710 cc="$cc"
12711 optimize="$optimize"
12712 ccflags="$ccflags"
12713 prototype="$prototype"
12714 define="$define"
12715 rm=$rm
12716 EOSH
12717
12718 $cat >> protochk <<'EOSH'
12719
12720 $rm -f try.c
12721 foo="$1"
12722 shift
12723 while test $# -ge 2; do
12724         case "$1" in
12725                 $define) echo "#include <$2>" >> try.c ;;
12726                 literal) echo "$2" >> try.c ;;
12727         esac
12728     shift 2
12729 done
12730 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12731 cat >> try.c <<'EOCP'
12732 #ifdef CAN_PROTOTYPE
12733 #define _(args) args
12734 #else
12735 #define _(args) ()
12736 #endif
12737 EOCP
12738 echo "$foo" >> try.c
12739 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12740 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12741 status=$?
12742 $rm -f try.[co]
12743 exit $status
12744 EOSH
12745 chmod +x protochk
12746 $eunicefix protochk
12747
12748 : see what type is used for size_t
12749 rp="What is the type used for the length parameter for string functions?"
12750 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12751 eval $typedef_ask
12752
12753 : check for type of arguments to gethostbyaddr. 
12754 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12755         case "$d_gethbyaddr" in
12756         $define)
12757                 $cat <<EOM
12758
12759 Checking to see what type of arguments are accepted by gethostbyaddr().
12760 EOM
12761                 hdrs="$define sys/types.h
12762                         $d_socket sys/socket.h 
12763                         $i_niin netinet/in.h 
12764                         $i_netdb netdb.h
12765                         $i_unistd unistd.h"
12766                 : The first arg can 'char *' or 'void *'
12767                 : The second arg is some of integral type
12768                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12769                         for yyy in size_t long int; do
12770                                 case "$netdb_host_type" in
12771                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12772                                         if ./protochk "$try" $hdrs; then
12773                                                 echo "Your system accepts $xxx for the first arg."
12774                                                 echo "...and $yyy for the second arg."
12775                                                 netdb_host_type="$xxx"
12776                                                 netdb_hlen_type="$yyy"
12777                                         fi
12778                                         ;;
12779                                 esac
12780                         done
12781                 done
12782                 : In case none of those worked, prompt the user.
12783                 case "$netdb_host_type" in
12784                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12785                         dflt='char *'
12786                         . ./myread
12787                         netdb_host_type=$ans
12788                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12789                         dflt="$sizetype"
12790                         . ./myread
12791                         netdb_hlen_type=$ans
12792                         ;;
12793                 esac
12794                 ;;
12795         *)      : no gethostbyaddr, so pick harmless defaults
12796                 netdb_host_type='char *'
12797                 netdb_hlen_type="$sizetype"
12798                 ;;
12799         esac
12800         # Remove the "const" if needed. -- but then we'll have a 
12801         # prototype clash!
12802         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12803 fi
12804
12805 : check for type of argument to gethostbyname. 
12806 if test "X$netdb_name_type" = X ; then
12807         case "$d_gethbyname" in
12808         $define)
12809                 $cat <<EOM
12810
12811 Checking to see what type of argument is accepted by gethostbyname().
12812 EOM
12813                 hdrs="$define sys/types.h
12814                         $d_socket sys/socket.h 
12815                         $i_niin netinet/in.h 
12816                         $i_netdb netdb.h
12817                         $i_unistd unistd.h"
12818                 for xxx in "const char *" "char *"; do
12819                         case "$netdb_name_type" in
12820                         '')     try="extern struct hostent *gethostbyname($xxx);"
12821                                 if ./protochk "$try" $hdrs; then
12822                                         echo "Your system accepts $xxx."
12823                                         netdb_name_type="$xxx"
12824                                 fi
12825                                 ;;
12826                         esac
12827                 done
12828                 : In case none of those worked, prompt the user.
12829                 case "$netdb_name_type" in
12830                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12831                         dflt='char *'
12832                         . ./myread
12833                         netdb_name_type=$ans
12834                         ;;
12835                 esac
12836                 ;;
12837         *)      : no gethostbyname, so pick harmless default
12838                 netdb_name_type='char *'
12839                 ;;
12840         esac
12841 fi
12842
12843 : check for type of 1st argument to getnetbyaddr. 
12844 if test "X$netdb_net_type" = X ; then
12845         case "$d_getnbyaddr" in
12846         $define)
12847                 $cat <<EOM
12848
12849 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12850 EOM
12851                 hdrs="$define sys/types.h
12852                         $d_socket sys/socket.h 
12853                         $i_niin netinet/in.h 
12854                         $i_netdb netdb.h
12855                         $i_unistd unistd.h"
12856                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12857                         case "$netdb_net_type" in
12858                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12859                                 if ./protochk "$try" $hdrs; then
12860                                         echo "Your system accepts $xxx."
12861                                         netdb_net_type="$xxx"
12862                                 fi
12863                                 ;;
12864                         esac
12865                 done
12866                 : In case none of those worked, prompt the user.
12867                 case "$netdb_net_type" in
12868                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12869                         dflt='long'
12870                         . ./myread
12871                         netdb_net_type=$ans
12872                         ;;
12873                 esac
12874                 ;;
12875         *)      : no getnetbyaddr, so pick harmless default
12876                 netdb_net_type='long'
12877                 ;;
12878         esac
12879 fi
12880 : locate the preferred pager for this system
12881 case "$pager" in
12882 '')
12883         dflt=''
12884         case "$pg" in
12885         /*) dflt=$pg;;
12886         esac
12887         case "$more" in
12888         /*) dflt=$more;;
12889         esac
12890         case "$less" in
12891         /*) dflt=$less;;
12892         esac
12893         case "$dflt" in
12894         '') dflt=/usr/ucb/more;;
12895         esac
12896         ;;
12897 *) dflt="$pager";;
12898 esac
12899 echo " "
12900 fn=f/
12901 rp='What pager is used on your system?'
12902 . ./getfile
12903 pager="$ans"
12904
12905 : see what type pids are declared as in the kernel
12906 rp="What is the type of process ids on this system?"
12907 set pid_t pidtype int stdio.h sys/types.h
12908 eval $typedef_ask
12909
12910 : Find earliest binary compatible site_perl subdirectory perl can use.
12911 case "$bincompat5005" in
12912 "$define") xs_apiversion='5.005' ;;
12913 *) xs_apiversion=$version ;;   # The current site_perl version.
12914 esac
12915 : Find earliest pure perl site_perl subdirectory perl can use.
12916 : The versioned directories started at 5.005.
12917 pm_apiversion='5.005'
12918
12919 : check for length of pointer
12920 echo " "
12921 case "$ptrsize" in
12922 '')
12923         $echo $n "Checking to see how big your pointers are...$c" >&4
12924         if test "$voidflags" -gt 7; then
12925                 echo '#define VOID_PTR char *' > try.c
12926         else
12927                 echo '#define VOID_PTR void *' > try.c
12928         fi
12929         $cat >>try.c <<'EOCP'
12930 #include <stdio.h>
12931 int main()
12932 {
12933     printf("%d\n", (int)sizeof(VOID_PTR));
12934     exit(0);
12935 }
12936 EOCP
12937         set try
12938         if eval $compile_ok; then
12939                 ptrsize=`./try`
12940                 $echo " $ptrsize bytes." >&4
12941         else
12942                 dflt='4'
12943                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12944                 rp="What is the size of a pointer (in bytes)?"
12945                 . ./myread
12946                 ptrsize="$ans"
12947         fi
12948         ;;
12949 esac
12950 $rm -f try.c try
12951
12952 : see if ar generates random libraries by itself
12953 echo " "
12954 echo "Checking how to generate random libraries on your machine..." >&4
12955 echo 'int bar1() { return bar2(); }' > bar1.c
12956 echo 'int bar2() { return 2; }' > bar2.c
12957 $cat > foo.c <<'EOP'
12958 int main() { printf("%d\n", bar1()); exit(0); }
12959 EOP
12960 $cc $ccflags -c bar1.c >/dev/null 2>&1
12961 $cc $ccflags -c bar2.c >/dev/null 2>&1
12962 $cc $ccflags -c foo.c >/dev/null 2>&1
12963 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12964 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12965         ./foobar >/dev/null 2>&1; then
12966         echo "$ar appears to generate random libraries itself."
12967         orderlib=false
12968         ranlib=":"
12969 elif $ar ts bar$_a >/dev/null 2>&1 &&
12970         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12971         ./foobar >/dev/null 2>&1; then
12972                 echo "a table of contents needs to be added with '$ar ts'."
12973                 orderlib=false
12974                 ranlib="$ar ts"
12975 else
12976         case "$ranlib" in
12977         :) ranlib='';;
12978         '')
12979                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12980                 $test -f $ranlib || ranlib=''
12981                 ;;
12982         esac
12983         if $test -n "$ranlib"; then
12984                 echo "your system has '$ranlib'; we'll use that."
12985                 orderlib=false
12986         else
12987                 echo "your system doesn't seem to support random libraries"
12988                 echo "so we'll use lorder and tsort to order the libraries."
12989                 orderlib=true
12990                 ranlib=":"
12991         fi
12992 fi
12993 $rm -f foo* bar* 
12994
12995 : check for type of arguments to select. 
12996 case "$selecttype" in
12997 '') case "$d_select" in
12998         $define)
12999                 echo " "
13000                 $cat <<EOM
13001 Checking to see what type of arguments are accepted by select().
13002 EOM
13003                 hdrs="$define sys/types.h
13004                         $i_systime sys/time.h 
13005                         $i_sysselct sys/select.h
13006                         $d_socket sys/socket.h"
13007                 : The first arg can be int, unsigned, or size_t
13008                 : The last arg may or may not be 'const'
13009                 val=''
13010                 : void pointer has been seen but using that
13011                 : breaks the selectminbits test
13012                 for xxx in 'fd_set *' 'int *'; do
13013                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13014                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13015                                         case "$val" in
13016                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13017                                                 if ./protochk "$try" $hdrs; then
13018                                                         echo "Your system accepts $xxx."
13019                                                         val="$xxx"
13020                                                 fi
13021                                                 ;;
13022                                         esac
13023                                 done
13024                         done
13025                 done
13026                 case "$val" in
13027                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13028                         case "$d_fd_set" in
13029                                 $define) dflt="fd_set *" ;;
13030                                 *)              dflt="int *" ;;
13031                         esac
13032                         . ./myread
13033                         val=$ans
13034                         ;;
13035                 esac
13036                 selecttype="$val"
13037                 ;;
13038         *)      : no select, so pick a harmless default
13039                 selecttype='int *'
13040                 ;;
13041         esac
13042         ;;
13043 esac
13044
13045 : check for the select 'width'
13046 case "$selectminbits" in
13047 '') case "$d_select" in
13048         $define)
13049                 $cat <<EOM
13050
13051 Checking to see on how many bits at a time your select() operates...
13052 EOM
13053                 $cat >try.c <<EOCP
13054 #include <sys/types.h>
13055 #$i_time I_TIME
13056 #$i_systime I_SYS_TIME
13057 #$i_systimek I_SYS_TIME_KERNEL
13058 #ifdef I_TIME
13059 #   include <time.h>
13060 #endif
13061 #ifdef I_SYS_TIME
13062 #   ifdef I_SYS_TIME_KERNEL
13063 #       define KERNEL
13064 #   endif
13065 #   include <sys/time.h>
13066 #   ifdef I_SYS_TIME_KERNEL
13067 #       undef KERNEL
13068 #   endif
13069 #endif
13070 #$i_sysselct I_SYS_SELECT
13071 #ifdef I_SYS_SELECT
13072 #include <sys/select.h>
13073 #endif
13074 #$d_socket HAS_SOCKET
13075 #ifdef HAS_SOCKET
13076 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13077 #endif
13078 #include <stdio.h>
13079 $selecttype b;
13080 #define S sizeof(*(b))
13081 #define MINBITS 64
13082 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13083 #define NBITS  (NBYTES * 8)
13084 int main() {
13085     char s[NBYTES];
13086     struct timeval t;
13087     int i;
13088     FILE* fp;
13089     int fd;
13090
13091     fclose(stdin);
13092     fp = fopen("try.c", "r");
13093     if (fp == 0)
13094       exit(1);
13095     fd = fileno(fp);
13096     if (fd < 0)
13097       exit(2);
13098     b = ($selecttype)s;
13099     for (i = 0; i < NBITS; i++)
13100         FD_SET(i, b);
13101     t.tv_sec  = 0;
13102     t.tv_usec = 0;
13103     select(fd + 1, b, 0, 0, &t);
13104     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13105     printf("%d\n", i + 1);
13106     return 0;
13107 }
13108 EOCP
13109                 set try
13110                 if eval $compile_ok; then
13111                         selectminbits=`./try`
13112                         case "$selectminbits" in
13113                         '')     cat >&4 <<EOM
13114 Cannot figure out on how many bits at a time your select() operates.
13115 I'll play safe and guess it is 32 bits.
13116 EOM
13117                                 selectminbits=32
13118                                 bits="32 bits"
13119                                 ;;
13120                         1)      bits="1 bit" ;;
13121                         *)      bits="$selectminbits bits" ;;
13122                         esac
13123                         echo "Your select() operates on $bits at a time." >&4
13124                 else
13125                         rp='What is the minimum number of bits your select() operates on?'
13126                         case "$byteorder" in
13127                         1234|12345678)  dflt=32 ;;
13128                         *)              dflt=1  ;;
13129                         esac
13130                         . ./myread
13131                         val=$ans
13132                         selectminbits="$val"
13133                 fi
13134                 $rm -f try.* try
13135                 ;;
13136         *)      : no select, so pick a harmless default
13137                 selectminbits='32'
13138                 ;;
13139         esac
13140         ;;
13141 esac
13142
13143 : Trace out the files included by signal.h, then look for SIGxxx names.
13144 : Remove SIGARRAYSIZE used by HPUX.
13145 : Remove SIGSTKSIZE used by Linux.
13146 : Remove SIGSTKSZ used by Posix.
13147 : Remove SIGTYP void lines used by OS2.
13148 : Some cpps, like os390, dont give the file name anywhere
13149 if [ "X$fieldn" = X ]; then
13150         : Just make some guesses.  We check them later.
13151         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13152 else
13153         xxx=`echo '#include <signal.h>' |
13154         $cppstdin $cppminus $cppflags 2>/dev/null |
13155         $grep '^[       ]*#.*include' | 
13156         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13157 fi
13158 : Check this list of files to be sure we have parsed the cpp output ok.
13159 : This will also avoid potentially non-existent files, such 
13160 : as ../foo/bar.h
13161 xxxfiles=''
13162 for xx in $xxx /dev/null ; do
13163         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13164 done
13165 : If we have found no files, at least try signal.h
13166 case "$xxxfiles" in
13167 '')     xxxfiles=`./findhdr signal.h` ;;
13168 esac
13169 xxx=`awk '
13170 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13171         print substr($2, 4, 20)
13172 }
13173 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13174         print substr($3, 4, 20)
13175 }' $xxxfiles`
13176 : Append some common names just in case the awk scan failed.
13177 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13178 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13179 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13180 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13181 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13182
13183 : generate a few handy files for later
13184 $cat > signal.c <<'EOCP'
13185 #include <sys/types.h>
13186 #include <signal.h>
13187 #include <stdio.h>
13188 int main() {
13189
13190 /* Strange style to avoid deeply-nested #if/#else/#endif */
13191 #ifndef NSIG
13192 #  ifdef _NSIG
13193 #    define NSIG (_NSIG)
13194 #  endif
13195 #endif
13196
13197 #ifndef NSIG
13198 #  ifdef SIGMAX
13199 #    define NSIG (SIGMAX+1)
13200 #  endif
13201 #endif
13202
13203 #ifndef NSIG
13204 #  ifdef SIG_MAX
13205 #    define NSIG (SIG_MAX+1)
13206 #  endif
13207 #endif
13208
13209 #ifndef NSIG
13210 #  ifdef MAXSIG
13211 #    define NSIG (MAXSIG+1)
13212 #  endif
13213 #endif
13214
13215 #ifndef NSIG
13216 #  ifdef MAX_SIG
13217 #    define NSIG (MAX_SIG+1)
13218 #  endif
13219 #endif
13220
13221 #ifndef NSIG
13222 #  ifdef SIGARRAYSIZE
13223 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13224 #  endif
13225 #endif
13226
13227 #ifndef NSIG
13228 #  ifdef _sys_nsig
13229 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13230 #  endif
13231 #endif
13232
13233 /* Default to some arbitrary number that's big enough to get most
13234    of the common signals.
13235 */
13236 #ifndef NSIG
13237 #    define NSIG 50
13238 #endif
13239
13240 printf("NSIG %d\n", NSIG);
13241
13242 #ifndef JUST_NSIG
13243
13244 EOCP
13245
13246 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13247 {
13248         printf "#ifdef SIG"; printf $1; printf "\n"
13249         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13250         printf $1; printf ");\n"
13251         printf "#endif\n"
13252 }
13253 END {
13254         printf "#endif /* JUST_NSIG */\n";
13255         printf "exit(0);\n}\n";
13256 }
13257 ' >>signal.c
13258 $cat >signal.awk <<'EOP'
13259 BEGIN { ndups = 0 }
13260 $1 ~ /^NSIG$/ { nsig = $2 }
13261 ($1 !~ /^NSIG$/) && (NF == 2) {
13262     if ($2 > maxsig) { maxsig = $2 }
13263     if (sig_name[$2]) {
13264         dup_name[ndups] = $1
13265         dup_num[ndups] = $2
13266         ndups++ 
13267     }
13268     else {
13269         sig_name[$2] = $1
13270         sig_num[$2] = $2
13271     }
13272 }
13273 END { 
13274     if (nsig == 0) {
13275         nsig = maxsig + 1
13276     }
13277     printf("NSIG %d\n", nsig);
13278     for (n = 1; n < nsig; n++) {
13279         if (sig_name[n]) {
13280             printf("%s %d\n", sig_name[n], sig_num[n])
13281         }
13282         else {
13283             printf("NUM%d %d\n", n, n) 
13284         }
13285     }
13286     for (n = 0; n < ndups; n++) {
13287         printf("%s %d\n", dup_name[n], dup_num[n])
13288     }
13289 }
13290 EOP
13291 $cat >signal_cmd <<EOS
13292 $startsh
13293 if $test -s signal.lst; then
13294     echo "Using your existing signal.lst file"
13295         exit 0
13296 fi
13297 xxx="$xxx"
13298 EOS
13299 $cat >>signal_cmd <<'EOS'
13300
13301 set signal
13302 if eval $compile_ok; then
13303         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13304 else
13305         echo "(I can't seem be able to compile the whole test program)" >&4
13306         echo "(I'll try it in little pieces.)" >&4
13307         set signal -DJUST_NSIG
13308         if eval $compile_ok; then
13309                 ./signal$_exe > signal.nsg
13310                 $cat signal.nsg
13311         else
13312                 echo "I can't seem to figure out how many signals you have." >&4
13313                 echo "Guessing 50." >&4
13314                 echo 'NSIG 50' > signal.nsg
13315         fi
13316         : Now look at all the signal names, one at a time.
13317         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13318                 $cat > signal.c <<EOCP
13319 #include <sys/types.h>
13320 #include <signal.h>
13321 #include <stdio.h>
13322 int main() {
13323 printf("$xx %d\n", SIG${xx});
13324 return 0;
13325 }
13326 EOCP
13327                 set signal
13328                 if eval $compile; then
13329                         echo "SIG${xx} found."
13330                         ./signal$_exe  >> signal.ls1
13331                 else
13332                         echo "SIG${xx} NOT found."
13333                 fi
13334         done
13335         if $test -s signal.ls1; then
13336                 $cat signal.nsg signal.ls1 |
13337                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13338         fi
13339
13340 fi
13341 if $test -s signal.lst; then
13342         :
13343 else
13344         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13345         echo 'kill -l' >signal
13346         set X `csh -f <signal`
13347         $rm -f signal
13348         shift
13349         case $# in
13350         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13351         esac
13352         echo $@ | $tr ' ' $trnl | \
13353             $awk '{ printf "%s %d\n", $1, ++s; }
13354                   END { printf "NSIG %d\n", ++s }' >signal.lst
13355 fi
13356 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13357 EOS
13358 chmod a+x signal_cmd
13359 $eunicefix signal_cmd
13360
13361 : generate list of signal names
13362 echo " "
13363 case "$sig_name_init" in
13364 '') doinit=yes ;;
13365 *)  case "$sig_num_init" in
13366     ''|*,*) doinit=yes ;;
13367     esac ;;
13368 esac
13369 case "$doinit" in
13370 yes)
13371         echo "Generating a list of signal names and numbers..." >&4
13372         . ./signal_cmd
13373         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13374         sig_name=`$awk 'BEGIN { printf "ZERO " }
13375                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13376         sig_num=`$awk  'BEGIN { printf "0 " }
13377                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13378         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13379                              !/^NSIG/   { printf "\"%s\", ", $1 }
13380                              END        { printf "0\n" }' signal.lst`
13381         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13382                              !/^NSIG/   { printf "%d, ", $2}
13383                              END        { printf "0\n"}' signal.lst`
13384         ;;
13385 esac
13386 echo "The following $sig_count signals are available:"
13387 echo " "
13388 echo $sig_name | $awk \
13389 'BEGIN { linelen = 0 }
13390 {
13391         for (i = 1; i <= NF; i++) {
13392                 name = "SIG" $i " "
13393                 linelen = linelen + length(name)
13394                 if (linelen > 70) {
13395                         printf "\n"
13396                         linelen = length(name)
13397                 }
13398                 printf "%s", name
13399         }
13400         printf "\n"
13401 }'
13402 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13403
13404 : see what type is used for signed size_t
13405 set ssize_t ssizetype int stdio.h sys/types.h
13406 eval $typedef
13407 dflt="$ssizetype"
13408 $cat > ssize.c <<EOM
13409 #include <stdio.h>
13410 #include <sys/types.h>
13411 #define Size_t $sizetype
13412 #define SSize_t $dflt
13413 int main()
13414 {
13415         if (sizeof(Size_t) == sizeof(SSize_t))
13416                 printf("$dflt\n");
13417         else if (sizeof(Size_t) == sizeof(int))
13418                 printf("int\n");
13419         else 
13420                 printf("long\n");
13421         exit(0);
13422 }
13423 EOM
13424 echo " "
13425 set ssize
13426 if eval $compile_ok && ./ssize > /dev/null; then
13427         ssizetype=`./ssize`
13428         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13429 else
13430         $cat >&4 <<EOM
13431 Help! I can't compile and run the ssize_t test program: please enlighten me!
13432 (This is probably a misconfiguration in your system or libraries, and
13433 you really ought to fix it.  Still, I'll try anyway.)
13434
13435 I need a type that is the same size as $sizetype, but is guaranteed to
13436 be signed.  Common values are ssize_t, int and long.
13437
13438 EOM
13439         rp="What signed type is the same size as $sizetype?"
13440         . ./myread
13441         ssizetype="$ans"
13442 fi
13443 $rm -f ssize ssize.*
13444
13445 : see what type of char stdio uses.
13446 echo " "
13447 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13448         echo "Your stdio uses unsigned chars." >&4
13449         stdchar="unsigned char"
13450 else
13451         echo "Your stdio uses signed chars." >&4
13452         stdchar="char"
13453 fi
13454
13455 : see if time exists
13456 echo " "
13457 if test "X$d_time" = X -o X"$timetype" = X; then
13458     if set time val -f d_time; eval $csym; $val; then
13459                 echo 'time() found.' >&4
13460                 val="$define"
13461                 rp="What is the type returned by time() on this system?"
13462                 set time_t timetype long stdio.h sys/types.h
13463                 eval $typedef_ask
13464     else
13465                 echo 'time() not found, hope that will do.' >&4
13466                 val="$undef"
13467                 timetype='int';
13468     fi
13469     set d_time
13470     eval $setvar
13471 fi
13472
13473 : see what type uids are declared as in the kernel
13474 echo " "
13475 echo "Looking for the type for user ids returned by getuid()."
13476 set uid_t uidtype xxx stdio.h sys/types.h
13477 eval $typedef
13478 case "$uidtype" in
13479 xxx)
13480         xxx=`./findhdr sys/user.h`
13481         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13482         case $1 in
13483         unsigned) dflt="$1 $2" ;;
13484         *) dflt="$1" ;;
13485         esac
13486         ;;
13487 *) dflt="$uidtype";;
13488 esac
13489 case "$uidtype" in
13490 uid_t)  echo "uid_t found." ;;
13491 *)      rp="What is the type for user ids returned by getuid()?"
13492         . ./myread
13493         uidtype="$ans"
13494         ;;
13495 esac
13496
13497 echo " "
13498 case "$uidtype" in
13499 *_t) zzz="$uidtype"     ;;
13500 *)   zzz="uid"          ;;
13501 esac
13502 echo "Checking the size of $zzz..." >&4 
13503 cat > try.c <<EOCP
13504 #include <sys/types.h>
13505 #include <stdio.h>
13506 int main() {
13507     printf("%d\n", (int)sizeof($uidtype));
13508     exit(0);
13509 }
13510 EOCP
13511 set try
13512 if eval $compile_ok; then
13513         yyy=`./try`
13514         case "$yyy" in
13515         '')     uidsize=4
13516                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13517                 ;;
13518         *)      uidsize=$yyy
13519                 echo "Your $zzz size is $uidsize bytes."
13520                 ;;
13521         esac
13522 else
13523         uidsize=4
13524         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13525 fi
13526
13527 echo " "
13528 case "$uidtype" in
13529 *_t) zzz="$uidtype"     ;;
13530 *)   zzz="uid"          ;;
13531 esac
13532 echo "Checking the sign of $zzz..." >&4
13533 cat > try.c <<EOCP
13534 #include <sys/types.h>
13535 #include <stdio.h>
13536 int main() {
13537         $uidtype foo = -1;
13538         if (foo < 0)
13539                 printf("-1\n");
13540         else
13541                 printf("1\n");
13542 }
13543 EOCP
13544 set try
13545 if eval $compile; then
13546         yyy=`./try`
13547         case "$yyy" in
13548         '')     uidsign=1
13549                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13550                 ;;
13551         *)      uidsign=$yyy
13552                 case "$uidsign" in
13553                  1) echo "Your $zzz is unsigned." ;;
13554                 -1) echo "Your $zzz is signed."   ;;
13555                 esac
13556                 ;;
13557         esac
13558 else
13559         uidsign=1
13560         echo "(I can't compile the test program--guessing unsigned.)" >&4
13561 fi
13562
13563
13564
13565 echo " "
13566 $echo "Checking the format string to be used for uids..." >&4
13567
13568 case "$uidsign" in
13569 -1)     if $test X"$uidsize" = X"$ivsize"; then
13570                 uidformat="$ivdformat"
13571         else
13572                 if $test X"$uidsize" = X"$longsize"; then
13573                         uidformat='"ld"'
13574                 else
13575                         if $test X"$uidsize" = X"$intsize"; then
13576                                 uidformat='"d"'
13577                         else
13578                                 if $test X"$uidsize" = X"$shortsize"; then
13579                                         uidformat='"hd"'
13580                                 fi
13581                         fi
13582                 fi
13583         fi
13584         ;;
13585 *)      if $test X"$uidsize" = X"$uvsize"; then
13586                 uidformat="$uvuformat"
13587         else
13588                 if $test X"$uidsize" = X"$longsize"; then
13589                         uidformat='"lu"'
13590                 else
13591                         if $test X"$uidsize" = X"$intsize"; then
13592                                 uidformat='"u"'
13593                         else
13594                                 if $test X"$uidsize" = X"$shortsize"; then
13595                                         uidformat='"hu"'
13596                                 fi
13597                         fi
13598                 fi
13599         fi
13600         ;;
13601 esac
13602
13603 : see if dbm.h is available
13604 : see if dbmclose exists
13605 set dbmclose d_dbmclose
13606 eval $inlibc
13607
13608 case "$d_dbmclose" in
13609 $define)
13610         set dbm.h i_dbm
13611         eval $inhdr
13612         case "$i_dbm" in
13613         $define)
13614                 val="$undef"
13615                 set i_rpcsvcdbm
13616                 eval $setvar
13617                 ;;
13618         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13619                 eval $inhdr
13620                 ;;
13621         esac
13622         ;;
13623 *)      echo "We won't be including <dbm.h>"
13624         val="$undef"
13625         set i_dbm
13626         eval $setvar
13627         val="$undef"
13628         set i_rpcsvcdbm
13629         eval $setvar
13630         ;;
13631 esac
13632
13633 : see if this is a sys/file.h system
13634 val=''
13635 set sys/file.h val
13636 eval $inhdr
13637
13638 : do we need to include sys/file.h ?
13639 case "$val" in
13640 "$define")
13641         echo " "
13642         if $h_sysfile; then
13643                 val="$define"
13644                 echo "We'll be including <sys/file.h>." >&4
13645         else
13646                 val="$undef"
13647                 echo "We won't be including <sys/file.h>." >&4
13648         fi
13649         ;;
13650 *)
13651         h_sysfile=false
13652         ;;
13653 esac
13654 set i_sysfile
13655 eval $setvar
13656
13657 : see if fcntl.h is there
13658 val=''
13659 set fcntl.h val
13660 eval $inhdr
13661
13662 : see if we can include fcntl.h
13663 case "$val" in
13664 "$define")
13665         echo " "
13666         if $h_fcntl; then
13667                 val="$define"
13668                 echo "We'll be including <fcntl.h>." >&4
13669         else
13670                 val="$undef"
13671                 if $h_sysfile; then
13672         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13673                 else
13674                         echo "We won't be including <fcntl.h>." >&4
13675                 fi
13676         fi
13677         ;;
13678 *)
13679         h_fcntl=false
13680         val="$undef"
13681         ;;
13682 esac
13683 set i_fcntl
13684 eval $setvar
13685
13686 : see if this is a iconv.h system
13687 set iconv.h i_iconv
13688 eval $inhdr
13689
13690 : see if locale.h is available
13691 set locale.h i_locale
13692 eval $inhdr
13693
13694 : see if mach cthreads are available
13695 if test "X$usethreads" = "X$define"; then
13696         set mach/cthreads.h i_machcthr
13697         eval $inhdr
13698 else
13699         i_machcthr="$undef"
13700 fi
13701
13702
13703
13704 : see if this is a math.h system
13705 set math.h i_math
13706 eval $inhdr
13707
13708 : see if this is a mntent.h system
13709 set mntent.h i_mntent
13710 eval $inhdr
13711
13712 : see if ndbm.h is available
13713 set ndbm.h t_ndbm
13714 eval $inhdr
13715 case "$t_ndbm" in
13716 $define)
13717         : see if dbm_open exists
13718         set dbm_open d_dbm_open
13719         eval $inlibc
13720         case "$d_dbm_open" in
13721         $undef)
13722                 t_ndbm="$undef"
13723                 echo "We won't be including <ndbm.h>"
13724                 ;;
13725         esac
13726         ;;
13727 esac
13728 val="$t_ndbm"
13729 set i_ndbm
13730 eval $setvar
13731
13732 : see if net/errno.h is available
13733 val=''
13734 set net/errno.h val
13735 eval $inhdr
13736
13737 : Unfortunately, it causes problems on some systems.  Arrgh.
13738 case "$val" in
13739 $define)
13740         cat > try.c <<'EOM'
13741 #include <stdio.h>
13742 #include <errno.h>
13743 #include <net/errno.h>
13744 int func()
13745 {
13746         return ENOTSOCK;
13747 }
13748 EOM
13749         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13750                 echo "We'll be including <net/errno.h>." >&4
13751         else
13752                 echo "We won't be including <net/errno.h>." >&4
13753                 val="$undef"
13754         fi
13755         $rm -f try.* try
13756         ;;
13757 esac
13758 set i_neterrno
13759 eval $setvar
13760
13761 : see if netinet/tcp.h is available
13762 set netinet/tcp.h i_netinettcp
13763 eval $inhdr
13764
13765 : see if this is a poll.h system
13766 set poll.h i_poll
13767 eval $inhdr
13768
13769 echo " "
13770 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13771 $cat <<'EOSH' > Cppsym.know
13772 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13773 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13774 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13775 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13776 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13777 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13778 bull c cadmus clipper CMU COFF COMPILER_VERSION
13779 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13780 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13781 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13782 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13783 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13784 H3050R H3050RX hbullx20 hcx host_mips
13785 hp200 hp300 hp700 HP700 hp800 hp9000
13786 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13787 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13788 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13789 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13790 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13791 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13792 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13793 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13794 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13795 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13796 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13797 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13798 MATH_HAS_NO_SIDE_EFFECTS
13799 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13800 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13801 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13802 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13803 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13804 NetBSD news1500 news1700 news1800 news1900 news3700
13805 news700 news800 news900 NeXT NLS ns16000 ns32000
13806 ns32016 ns32332 ns32k nsc32000
13807 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13808 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13809 pc532 pdp11 PGC PIC plexus PORTAR posix
13810 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13811 POSIX_C_SOURCE POSIX_SOURCE POWER
13812 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13813 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13814 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13815 sony sony_news sonyrisc sparc sparclite spectrum
13816 stardent stdc STDC_EXT stratos sun sun3 sun386
13817 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13818 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13819 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13820 sysV68 sysV88 Tek4132 Tek4300 titan
13821 tower tower32 tower32_200 tower32_600 tower32_700
13822 tower32_800 tower32_850 tss
13823 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13824 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13825 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13826 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13827 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13828 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13829 z8000
13830 EOSH
13831 # Maybe put other stuff here too.
13832 cat <<EOSH >>Cppsym.know
13833 $osname
13834 EOSH
13835 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13836 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13837 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13838 $rm -f Cppsym.a Cppsym.b
13839 cat <<EOSH > Cppsym
13840 $startsh
13841 if $test \$# -gt 0; then
13842     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13843     if $test -s Cppsym.got; then
13844         $rm -f Cppsym.got
13845         exit 0
13846     fi
13847     $rm -f Cppsym.got
13848     exit 1
13849 else
13850     $tr " " "$trnl" | ./Cppsym.try
13851     exit 0
13852 fi
13853 EOSH
13854 chmod +x Cppsym
13855 $eunicefix Cppsym
13856 cat <<EOSH > Cppsym.try
13857 $startsh
13858 cat <<'EOCP' > try.c
13859 #include <stdio.h>
13860 int main() {
13861 EOCP
13862 $awk \\
13863 EOSH
13864 cat <<'EOSH' >> Cppsym.try
13865 'length($1) > 0 {
13866     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
13867     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
13868     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
13869     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
13870 }'       >> try.c
13871 echo '}' >> try.c
13872 EOSH
13873 cat <<EOSH >> Cppsym.try
13874 cc="$cc"
13875 optimize="$optimize"
13876 ccflags="$ccflags"
13877 ldflags="$ldflags"
13878 libs="$libs"
13879 exe_ext="$exe_ext"
13880 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
13881 EOSH
13882 chmod +x Cppsym.try
13883 $eunicefix Cppsym.try
13884 ./Cppsym < Cppsym.know > Cppsym.true
13885 : now check the C compiler for additional symbols
13886 postprocess_cc_v=''
13887 case "$osname" in
13888 aix) postprocess_cc_v="|$tr , ' '" ;;
13889 esac
13890 $cat >ccsym <<EOS
13891 $startsh
13892 $cat >tmp.c <<EOF
13893 extern int foo;
13894 EOF
13895 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13896 do
13897         case "\$i" in
13898         -D*) echo "\$i" | $sed 's/^-D//';;
13899         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13900         esac
13901 done
13902 $rm -f try.c
13903 EOS
13904 postprocess_cc_v=''
13905 chmod +x ccsym
13906 $eunicefix ccsym
13907 ./ccsym > ccsym1.raw
13908 if $test -s ccsym1.raw; then
13909        $sort ccsym1.raw | $uniq >ccsym.raw
13910 else
13911        mv ccsym1.raw ccsym.raw
13912 fi
13913
13914 $awk '/\=/ { print $0; next }
13915         { print $0"=1" }' ccsym.raw >ccsym.list
13916 $awk '/\=/ { print $0; next }
13917         { print $0"=1" }' Cppsym.true >ccsym.true
13918 $comm -13 ccsym.true ccsym.list >ccsym.own
13919 $comm -12 ccsym.true ccsym.list >ccsym.com
13920 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13921 also=''
13922 if $test -z ccsym.raw; then
13923         echo "Your C compiler doesn't seem to define any symbols!" >&4
13924         echo " "
13925         echo "However, your C preprocessor defines the following symbols:"
13926         $cat Cppsym.true
13927         ccsymbols=''
13928         cppsymbols=`$cat Cppsym.true`
13929         cppsymbols=`echo $cppsymbols`
13930         cppccsymbols="$cppsymbols"
13931 else
13932         if $test -s ccsym.com; then
13933                 echo "Your C compiler and pre-processor define these symbols:"
13934                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13935                 also='also '
13936                 symbols='ones'
13937                 cppccsymbols=`$cat ccsym.com`
13938                 cppccsymbols=`echo $cppccsymbols`
13939                 $test "$silent" || sleep 1
13940         fi
13941         if $test -s ccsym.cpp; then
13942                 $test "$also" && echo " "
13943                 echo "Your C pre-processor ${also}defines the following symbols:"
13944                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13945                 also='further '
13946                 cppsymbols=`$cat ccsym.cpp`
13947                 cppsymbols=`echo $cppsymbols`
13948                 $test "$silent" || sleep 1
13949         fi
13950         if $test -s ccsym.own; then
13951                 $test "$also" && echo " "
13952                 echo "Your C compiler ${also}defines the following cpp symbols:"
13953                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13954                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13955                 ccsymbols=`$cat ccsym.own`
13956                 ccsymbols=`echo $ccsymbols`
13957                 $test "$silent" || sleep 1
13958         fi
13959 fi
13960 $rm -f ccsym*
13961
13962 : see if this is a termio system
13963 val="$undef"
13964 val2="$undef"
13965 val3="$undef"
13966 if $test `./findhdr termios.h`; then
13967         set tcsetattr i_termios
13968         eval $inlibc
13969         val3="$i_termios"
13970 fi
13971 echo " "
13972 case "$val3" in
13973 "$define") echo "You have POSIX termios.h... good!" >&4;;
13974 *) if ./Cppsym pyr; then
13975                 case "`/bin/universe`" in
13976                 ucb) if $test `./findhdr sgtty.h`; then
13977                                 val2="$define"
13978                                 echo "<sgtty.h> found." >&4
13979                         else
13980                                 echo "System is pyramid with BSD universe."
13981                                 echo "<sgtty.h> not found--you could have problems." >&4
13982                         fi;;
13983                 *) if $test `./findhdr termio.h`; then
13984                                 val="$define"
13985                                 echo "<termio.h> found." >&4
13986                         else
13987                                 echo "System is pyramid with USG universe."
13988                                 echo "<termio.h> not found--you could have problems." >&4
13989                         fi;;
13990                 esac
13991         elif ./usg; then
13992                 if $test `./findhdr termio.h`; then
13993                         echo "<termio.h> found." >&4
13994                         val="$define"
13995                 elif $test `./findhdr sgtty.h`; then
13996                         echo "<sgtty.h> found." >&4
13997                         val2="$define"
13998                 else
13999 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14000                 fi
14001         else
14002                 if $test `./findhdr sgtty.h`; then
14003                         echo "<sgtty.h> found." >&4
14004                         val2="$define"
14005                 elif $test `./findhdr termio.h`; then
14006                         echo "<termio.h> found." >&4
14007                         val="$define"
14008                 else
14009 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14010                 fi
14011         fi;;
14012 esac
14013 set i_termio; eval $setvar
14014 val=$val2; set i_sgtty; eval $setvar
14015 val=$val3; set i_termios; eval $setvar
14016
14017 : see if this is a shadow.h system
14018 set shadow.h i_shadow
14019 eval $inhdr
14020
14021 : see if this is a socks.h system
14022 set socks.h i_socks
14023 eval $inhdr
14024
14025 : see if stdarg is available
14026 echo " "
14027 if $test `./findhdr stdarg.h`; then
14028         echo "<stdarg.h> found." >&4
14029         valstd="$define"
14030 else
14031         echo "<stdarg.h> NOT found." >&4
14032         valstd="$undef"
14033 fi
14034
14035 : see if varags is available
14036 echo " "
14037 if $test `./findhdr varargs.h`; then
14038         echo "<varargs.h> found." >&4
14039 else
14040         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14041 fi
14042
14043 : set up the varargs testing programs
14044 $cat > varargs.c <<EOP
14045 #ifdef I_STDARG
14046 #include <stdarg.h>
14047 #endif
14048 #ifdef I_VARARGS
14049 #include <varargs.h>
14050 #endif
14051
14052 #ifdef I_STDARG
14053 int f(char *p, ...)
14054 #else
14055 int f(va_alist)
14056 va_dcl
14057 #endif
14058 {
14059         va_list ap;
14060 #ifndef I_STDARG
14061         char *p;
14062 #endif
14063 #ifdef I_STDARG
14064         va_start(ap,p);
14065 #else
14066         va_start(ap);
14067         p = va_arg(ap, char *);
14068 #endif
14069         va_end(ap);
14070 }
14071 EOP
14072 $cat > varargs <<EOP
14073 $startsh
14074 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14075         echo "true"
14076 else
14077         echo "false"
14078 fi
14079 $rm -f varargs$_o
14080 EOP
14081 chmod +x varargs
14082
14083 : now check which varargs header should be included
14084 echo " "
14085 i_varhdr=''
14086 case "$valstd" in
14087 "$define")
14088         if `./varargs I_STDARG`; then
14089                 val='stdarg.h'
14090         elif `./varargs I_VARARGS`; then
14091                 val='varargs.h'
14092         fi
14093         ;;
14094 *)
14095         if `./varargs I_VARARGS`; then
14096                 val='varargs.h'
14097         fi
14098         ;;
14099 esac
14100 case "$val" in
14101 '')
14102 echo "I could not find the definition for va_dcl... You have problems..." >&4
14103         val="$undef"; set i_stdarg; eval $setvar
14104         val="$undef"; set i_varargs; eval $setvar
14105         ;;
14106 *) 
14107         set i_varhdr
14108         eval $setvar
14109         case "$i_varhdr" in
14110         stdarg.h)
14111                 val="$define"; set i_stdarg; eval $setvar
14112                 val="$undef"; set i_varargs; eval $setvar
14113                 ;;
14114         varargs.h)
14115                 val="$undef"; set i_stdarg; eval $setvar
14116                 val="$define"; set i_varargs; eval $setvar
14117                 ;;
14118         esac
14119         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14120 esac
14121 $rm -f varargs*
14122
14123 : see if stddef is available
14124 set stddef.h i_stddef
14125 eval $inhdr
14126
14127 : see if sys/access.h is available
14128 set sys/access.h i_sysaccess
14129 eval $inhdr
14130
14131 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14132 set sys/filio.h i_sysfilio
14133 eval $inhdr
14134 echo " "
14135 if $test `./findhdr sys/ioctl.h`; then
14136         val="$define"
14137         echo '<sys/ioctl.h> found.' >&4
14138 else
14139         val="$undef"
14140         if $test $i_sysfilio = "$define"; then
14141             echo '<sys/ioctl.h> NOT found.' >&4
14142         else
14143                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14144                 $test $i_termio = "$define" && xxx="termio.h"
14145                 $test $i_termios = "$define" && xxx="termios.h"
14146 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14147         fi
14148 fi
14149 set i_sysioctl
14150 eval $setvar
14151
14152
14153 : see if this is a syslog.h system
14154 set syslog.h i_syslog
14155 eval $inhdr
14156
14157
14158 : see if this is a sys/mode.h system
14159 set sys/mode.h i_sysmode
14160 eval $inhdr
14161
14162 : see if sys/resource.h has to be included
14163 set sys/resource.h i_sysresrc
14164 eval $inhdr
14165
14166 : see if sys/security.h is available
14167 set sys/security.h i_syssecrt
14168 eval $inhdr
14169
14170 : see if this is a sys/statvfs.h system
14171 set sys/statvfs.h i_sysstatvfs
14172 eval $inhdr
14173
14174 : see if this is a sys/uio.h system
14175 set sys/uio.h i_sysuio
14176 eval $inhdr
14177
14178 : see if this is a sys/un.h system
14179 set sys/un.h i_sysun
14180 eval $inhdr
14181
14182
14183 : see if this is a sys/utsname.h system
14184 set sys/utsname.h i_sysutsname
14185 eval $inhdr
14186
14187 : see if this is a syswait system
14188 set sys/wait.h i_syswait
14189 eval $inhdr
14190
14191 : see if this is a ustat.h system
14192 set ustat.h i_ustat
14193 eval $inhdr
14194
14195 : see if this is an utime system
14196 set utime.h i_utime
14197 eval $inhdr
14198
14199 : see if this is a values.h system
14200 set values.h i_values
14201 eval $inhdr
14202
14203 : see if this is a vfork system
14204 case "$d_vfork" in
14205 "$define")
14206         set vfork.h i_vfork
14207         eval $inhdr
14208         ;;
14209 *)
14210         i_vfork="$undef"
14211         ;;
14212 esac
14213
14214 : see if gdbm.h is available
14215 set gdbm.h t_gdbm
14216 eval $inhdr
14217 case "$t_gdbm" in
14218 $define)
14219         : see if gdbm_open exists
14220         set gdbm_open d_gdbm_open
14221         eval $inlibc
14222         case "$d_gdbm_open" in
14223         $undef)
14224                 t_gdbm="$undef"
14225                 echo "We won't be including <gdbm.h>"
14226                 ;;
14227         esac
14228         ;;
14229 esac
14230 val="$t_gdbm"
14231 set i_gdbm
14232 eval $setvar
14233
14234 echo " "
14235 echo "Looking for extensions..." >&4
14236 : If we are using the old config.sh, known_extensions may contain
14237 : old or inaccurate or duplicate values.
14238 known_extensions=''
14239 nonxs_extensions=''
14240 : We do not use find because it might not be available.
14241 : We do not just use MANIFEST because the user may have dropped
14242 : some additional extensions into the source tree and expect them
14243 : to be built.
14244
14245 : Function to recursively find available extensions, ignoring DynaLoader
14246 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14247 find_extensions='
14248     for xxx in *; do
14249        case "$xxx" in
14250            DynaLoader|dynaload) ;;
14251            *)
14252            if $test -f $xxx/$xxx.xs; then
14253                known_extensions="$known_extensions $1$xxx";
14254            elif $test -f $xxx/Makefile.PL; then
14255                nonxs_extensions="$nonxs_extensions $1$xxx";
14256            else
14257                if $test -d $xxx -a $# -lt 10; then
14258                    set $1$xxx/ $*;
14259                    cd $xxx;
14260                    eval $find_extensions;
14261                    cd ..;
14262                    shift;
14263                fi;
14264            fi
14265            ;;
14266        esac;
14267     done'
14268 tdir=`pwd`
14269 cd $rsrc/ext
14270 set X
14271 shift
14272 eval $find_extensions
14273 set X $nonxs_extensions
14274 shift
14275 nonxs_extensions="$*"
14276 set X $known_extensions
14277 shift
14278 known_extensions="$*"
14279 cd $tdir
14280
14281 : Now see which are supported on this system.
14282 avail_ext=''
14283 for xxx in $known_extensions ; do
14284         case "$xxx" in
14285         DB_File|db_file)
14286                 case "$i_db" in
14287                 $define) avail_ext="$avail_ext $xxx" ;;
14288                 esac
14289                 ;;
14290         GDBM_File|gdbm_fil)
14291                 case "$i_gdbm" in 
14292                 $define) avail_ext="$avail_ext $xxx" ;;
14293                 esac
14294                 ;;
14295         NDBM_File|ndbm_fil)
14296                 case "$i_ndbm" in
14297                 $define)
14298                     case "$osname-$use64bits" in
14299                     hpux-define)
14300                         case "$libs" in
14301                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14302                         esac
14303                         ;;
14304                     *) avail_ext="$avail_ext $xxx" ;;
14305                     esac
14306                     ;;
14307                 esac
14308                 ;;
14309         ODBM_File|odbm_fil) 
14310                 case "${i_dbm}${i_rpcsvcdbm}" in
14311                 *"${define}"*)
14312                     case "$osname-$use64bits" in
14313                     hpux-define)
14314                         case "$libs" in
14315                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14316                         esac
14317                         ;;
14318                     *) avail_ext="$avail_ext $xxx" ;;
14319                     esac
14320                     ;;
14321                 esac
14322                 ;;
14323         POSIX|posix)
14324                 case "$useposix" in
14325                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14326                 esac
14327                 ;;
14328         Opcode|opcode)
14329                 case "$useopcode" in
14330                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14331                 esac
14332                 ;;
14333         Socket|socket)
14334                 case "$d_socket" in 
14335                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14336                 esac
14337                 ;;
14338         Thread|thread)
14339                 case "$usethreads" in 
14340                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14341                 esac
14342                 ;;
14343         IPC/SysV|ipc/sysv)
14344                 : XXX Do we need a useipcsysv variable here
14345                 case "${d_msg}${d_sem}${d_shm}" in 
14346                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14347                 esac
14348                 ;;
14349         *)      avail_ext="$avail_ext $xxx"
14350                 ;;
14351         esac
14352 done
14353
14354 set X $avail_ext
14355 shift
14356 avail_ext="$*"
14357
14358 : Now see which nonxs extensions are supported on this system.
14359 : For now assume all are.
14360 nonxs_ext=''
14361 for xxx in $nonxs_extensions ; do
14362         case "$xxx" in
14363         *)      nonxs_ext="$nonxs_ext $xxx"
14364                 ;;
14365         esac
14366 done
14367
14368 set X $nonxs_ext
14369 shift
14370 nonxs_ext="$*"
14371
14372 case $usedl in
14373 $define)
14374         $cat <<EOM
14375 A number of extensions are supplied with $package.  You may choose to
14376 compile these extensions for dynamic loading (the default), compile
14377 them into the $package executable (static loading), or not include
14378 them at all.  Answer "none" to include no extensions.
14379 Note that DynaLoader is always built and need not be mentioned here.
14380
14381 EOM
14382         case "$dynamic_ext" in
14383         '') dflt="$avail_ext" ;;
14384         *)      dflt="$dynamic_ext"
14385                 # Perhaps we are reusing an old out-of-date config.sh.
14386                 case "$hint" in
14387                 previous)
14388                         if test X"$dynamic_ext" != X"$avail_ext"; then
14389                                 $cat <<EOM
14390 NOTICE:  Your previous config.sh list may be incorrect. 
14391 The extensions now available to you are 
14392         ${avail_ext}
14393 but the default list from your previous config.sh is
14394         ${dynamic_ext} 
14395
14396 EOM
14397                         fi
14398                         ;;
14399                 esac
14400                 ;;
14401         esac
14402         case "$dflt" in
14403         '')     dflt=none;;
14404         esac
14405         rp="What extensions do you wish to load dynamically?"
14406         . ./myread
14407         case "$ans" in
14408         none) dynamic_ext=' ' ;;
14409         *) dynamic_ext="$ans" ;;
14410         esac
14411
14412         case "$static_ext" in
14413         '')
14414                 : Exclude those already listed in dynamic linking
14415                 dflt=''
14416                 for xxx in $avail_ext; do
14417                         case " $dynamic_ext " in
14418                         *" $xxx "*) ;;
14419                         *) dflt="$dflt $xxx" ;;
14420                         esac
14421                 done
14422                 set X $dflt
14423                 shift
14424                 dflt="$*"
14425                 ;;
14426         *)  dflt="$static_ext" 
14427                 ;;
14428         esac
14429
14430         case "$dflt" in
14431         '')     dflt=none;;
14432         esac
14433         rp="What extensions do you wish to load statically?"
14434         . ./myread
14435         case "$ans" in
14436         none) static_ext=' ' ;;
14437         *) static_ext="$ans" ;;
14438         esac
14439         ;;
14440 *)
14441         $cat <<EOM
14442 A number of extensions are supplied with $package.  Answer "none" 
14443 to include no extensions. 
14444 Note that DynaLoader is always built and need not be mentioned here.
14445
14446 EOM
14447         case "$static_ext" in
14448         '') dflt="$avail_ext" ;;
14449         *)      dflt="$static_ext"
14450                 # Perhaps we are reusing an old out-of-date config.sh.
14451                 case "$hint" in
14452                 previous)
14453                         if test X"$static_ext" != X"$avail_ext"; then
14454                                 $cat <<EOM
14455 NOTICE:  Your previous config.sh list may be incorrect. 
14456 The extensions now available to you are 
14457         ${avail_ext}
14458 but the default list from your previous config.sh is
14459         ${static_ext} 
14460
14461 EOM
14462                         fi
14463                         ;;
14464                 esac
14465                 ;;
14466         esac
14467         : Exclude those that are not xs extensions
14468         case "$dflt" in
14469         '')     dflt=none;;
14470         esac
14471         rp="What extensions do you wish to include?"
14472         . ./myread
14473         case "$ans" in
14474         none) static_ext=' ' ;;
14475         *) static_ext="$ans" ;;
14476         esac
14477         ;;
14478 esac
14479
14480 set X $dynamic_ext $static_ext $nonxs_ext
14481 shift
14482 extensions="$*"
14483
14484 : Remove build directory name from cppstdin so it can be used from
14485 : either the present location or the final installed location.
14486 echo " "
14487 : Get out of the UU directory to get correct path name.
14488 cd ..
14489 case "$cppstdin" in
14490 `pwd`/cppstdin)
14491         echo "Stripping down cppstdin path name"
14492         cppstdin=cppstdin
14493         ;;
14494 esac
14495 cd UU
14496
14497 : end of configuration questions
14498 echo " "
14499 echo "End of configuration questions."
14500 echo " "
14501
14502 : back to where it started
14503 if test -d ../UU; then
14504         cd ..
14505 fi
14506
14507 : configuration may be patched via a 'config.over' file
14508 if $test -f config.over; then
14509         echo " "
14510         dflt=y
14511         rp='I see a config.over file.  Do you wish to load it?'
14512         . UU/myread
14513         case "$ans" in
14514         n*) echo "OK, I'll ignore it.";;
14515         *)      . ./config.over
14516                 echo "Configuration override changes have been loaded."
14517                 ;;
14518         esac
14519 fi
14520
14521 : in case they want portability, strip down executable paths
14522 case "$d_portable" in
14523 "$define")
14524         echo " "
14525         echo "Stripping down executable paths..." >&4
14526         for file in $loclist $trylist; do
14527                 eval temp=\$$file
14528                 eval $file=`basename $temp`
14529         done
14530         ;;
14531 esac
14532
14533 : create config.sh file
14534 echo " "
14535 echo "Creating config.sh..." >&4
14536 $spitshell <<EOT >config.sh
14537 $startsh
14538 #
14539 # This file was produced by running the Configure script. It holds all the
14540 # definitions figured out by Configure. Should you modify one of these values,
14541 # do not forget to propagate your changes by running "Configure -der". You may
14542 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14543 #
14544
14545 # Package name      : $package
14546 # Source directory  : $src
14547 # Configuration time: $cf_time
14548 # Configured by     : $cf_by
14549 # Target system     : $myuname
14550
14551 Author='$Author'
14552 Date='$Date'
14553 Header='$Header'
14554 Id='$Id'
14555 Locker='$Locker'
14556 Log='$Log'
14557 Mcc='$Mcc'
14558 RCSfile='$RCSfile'
14559 Revision='$Revision'
14560 Source='$Source'
14561 State='$State'
14562 _a='$_a'
14563 _exe='$_exe'
14564 _o='$_o'
14565 afs='$afs'
14566 alignbytes='$alignbytes'
14567 ansi2knr='$ansi2knr'
14568 aphostname='$aphostname'
14569 api_revision='$api_revision'
14570 api_subversion='$api_subversion'
14571 api_version='$api_version'
14572 api_versionstring='$api_versionstring'
14573 ar='$ar'
14574 archlib='$archlib'
14575 archlibexp='$archlibexp'
14576 archname64='$archname64'
14577 archname='$archname'
14578 archobjs='$archobjs'
14579 awk='$awk'
14580 baserev='$baserev'
14581 bash='$bash'
14582 bin='$bin'
14583 bincompat5005='$bincompat5005'
14584 binexp='$binexp'
14585 bison='$bison'
14586 byacc='$byacc'
14587 byteorder='$byteorder'
14588 c='$c'
14589 castflags='$castflags'
14590 cat='$cat'
14591 cc='$cc'
14592 cccdlflags='$cccdlflags'
14593 ccdlflags='$ccdlflags'
14594 ccflags='$ccflags'
14595 ccsymbols='$ccsymbols'
14596 cf_by='$cf_by'
14597 cf_email='$cf_email'
14598 cf_time='$cf_time'
14599 charsize='$charsize'
14600 chgrp='$chgrp'
14601 chmod='$chmod'
14602 chown='$chown'
14603 clocktype='$clocktype'
14604 comm='$comm'
14605 compress='$compress'
14606 contains='$contains'
14607 cp='$cp'
14608 cpio='$cpio'
14609 cpp='$cpp'
14610 cpp_stuff='$cpp_stuff'
14611 cppccsymbols='$cppccsymbols'
14612 cppflags='$cppflags'
14613 cpplast='$cpplast'
14614 cppminus='$cppminus'
14615 cpprun='$cpprun'
14616 cppstdin='$cppstdin'
14617 cppsymbols='$cppsymbols'
14618 crosscompile='$crosscompile'
14619 cryptlib='$cryptlib'
14620 csh='$csh'
14621 d_Gconvert='$d_Gconvert'
14622 d_PRIEldbl='$d_PRIEldbl'
14623 d_PRIFldbl='$d_PRIFldbl'
14624 d_PRIGldbl='$d_PRIGldbl'
14625 d_PRIX64='$d_PRIX64'
14626 d_PRId64='$d_PRId64'
14627 d_PRIeldbl='$d_PRIeldbl'
14628 d_PRIfldbl='$d_PRIfldbl'
14629 d_PRIgldbl='$d_PRIgldbl'
14630 d_PRIi64='$d_PRIi64'
14631 d_PRIo64='$d_PRIo64'
14632 d_PRIu64='$d_PRIu64'
14633 d_PRIx64='$d_PRIx64'
14634 d_access='$d_access'
14635 d_accessx='$d_accessx'
14636 d_alarm='$d_alarm'
14637 d_archlib='$d_archlib'
14638 d_atolf='$d_atolf'
14639 d_atoll='$d_atoll'
14640 d_attribut='$d_attribut'
14641 d_bcmp='$d_bcmp'
14642 d_bcopy='$d_bcopy'
14643 d_bincompat5005='$d_bincompat5005'
14644 d_bsd='$d_bsd'
14645 d_bsdgetpgrp='$d_bsdgetpgrp'
14646 d_bsdsetpgrp='$d_bsdsetpgrp'
14647 d_bzero='$d_bzero'
14648 d_casti32='$d_casti32'
14649 d_castneg='$d_castneg'
14650 d_charvspr='$d_charvspr'
14651 d_chown='$d_chown'
14652 d_chroot='$d_chroot'
14653 d_chsize='$d_chsize'
14654 d_closedir='$d_closedir'
14655 d_const='$d_const'
14656 d_crypt='$d_crypt'
14657 d_csh='$d_csh'
14658 d_cuserid='$d_cuserid'
14659 d_dbl_dig='$d_dbl_dig'
14660 d_difftime='$d_difftime'
14661 d_dirnamlen='$d_dirnamlen'
14662 d_dlerror='$d_dlerror'
14663 d_dlopen='$d_dlopen'
14664 d_dlsymun='$d_dlsymun'
14665 d_dosuid='$d_dosuid'
14666 d_drand48proto='$d_drand48proto'
14667 d_dup2='$d_dup2'
14668 d_eaccess='$d_eaccess'
14669 d_endgrent='$d_endgrent'
14670 d_endhent='$d_endhent'
14671 d_endnent='$d_endnent'
14672 d_endpent='$d_endpent'
14673 d_endpwent='$d_endpwent'
14674 d_endsent='$d_endsent'
14675 d_endspent='$d_endspent'
14676 d_eofnblk='$d_eofnblk'
14677 d_eunice='$d_eunice'
14678 d_fchmod='$d_fchmod'
14679 d_fchown='$d_fchown'
14680 d_fcntl='$d_fcntl'
14681 d_fd_macros='$d_fd_macros'
14682 d_fd_set='$d_fd_set'
14683 d_fds_bits='$d_fds_bits'
14684 d_fgetpos='$d_fgetpos'
14685 d_flexfnam='$d_flexfnam'
14686 d_flock='$d_flock'
14687 d_fork='$d_fork'
14688 d_fpathconf='$d_fpathconf'
14689 d_fpos64_t='$d_fpos64_t'
14690 d_fs_data_s='$d_fs_data_s'
14691 d_fseeko='$d_fseeko'
14692 d_fsetpos='$d_fsetpos'
14693 d_fstatfs='$d_fstatfs'
14694 d_fstatvfs='$d_fstatvfs'
14695 d_ftello='$d_ftello'
14696 d_ftime='$d_ftime'
14697 d_getcwd='$d_getcwd'
14698 d_getgrent='$d_getgrent'
14699 d_getgrps='$d_getgrps'
14700 d_gethbyaddr='$d_gethbyaddr'
14701 d_gethbyname='$d_gethbyname'
14702 d_gethent='$d_gethent'
14703 d_gethname='$d_gethname'
14704 d_gethostprotos='$d_gethostprotos'
14705 d_getlogin='$d_getlogin'
14706 d_getmnt='$d_getmnt'
14707 d_getmntent='$d_getmntent'
14708 d_getnbyaddr='$d_getnbyaddr'
14709 d_getnbyname='$d_getnbyname'
14710 d_getnent='$d_getnent'
14711 d_getnetprotos='$d_getnetprotos'
14712 d_getpbyname='$d_getpbyname'
14713 d_getpbynumber='$d_getpbynumber'
14714 d_getpent='$d_getpent'
14715 d_getpgid='$d_getpgid'
14716 d_getpgrp2='$d_getpgrp2'
14717 d_getpgrp='$d_getpgrp'
14718 d_getppid='$d_getppid'
14719 d_getprior='$d_getprior'
14720 d_getprotoprotos='$d_getprotoprotos'
14721 d_getpwent='$d_getpwent'
14722 d_getsbyname='$d_getsbyname'
14723 d_getsbyport='$d_getsbyport'
14724 d_getsent='$d_getsent'
14725 d_getservprotos='$d_getservprotos'
14726 d_getspent='$d_getspent'
14727 d_getspnam='$d_getspnam'
14728 d_gettimeod='$d_gettimeod'
14729 d_gnulibc='$d_gnulibc'
14730 d_grpasswd='$d_grpasswd'
14731 d_hasmntopt='$d_hasmntopt'
14732 d_htonl='$d_htonl'
14733 d_iconv='$d_iconv'
14734 d_index='$d_index'
14735 d_inetaton='$d_inetaton'
14736 d_int64_t='$d_int64_t'
14737 d_isascii='$d_isascii'
14738 d_killpg='$d_killpg'
14739 d_lchown='$d_lchown'
14740 d_ldbl_dig='$d_ldbl_dig'
14741 d_link='$d_link'
14742 d_locconv='$d_locconv'
14743 d_lockf='$d_lockf'
14744 d_longdbl='$d_longdbl'
14745 d_longlong='$d_longlong'
14746 d_lstat='$d_lstat'
14747 d_mblen='$d_mblen'
14748 d_mbstowcs='$d_mbstowcs'
14749 d_mbtowc='$d_mbtowc'
14750 d_memchr='$d_memchr'
14751 d_memcmp='$d_memcmp'
14752 d_memcpy='$d_memcpy'
14753 d_memmove='$d_memmove'
14754 d_memset='$d_memset'
14755 d_mkdir='$d_mkdir'
14756 d_mkdtemp='$d_mkdtemp'
14757 d_mkfifo='$d_mkfifo'
14758 d_mkstemp='$d_mkstemp'
14759 d_mkstemps='$d_mkstemps'
14760 d_mktime='$d_mktime'
14761 d_mmap='$d_mmap'
14762 d_mprotect='$d_mprotect'
14763 d_msg='$d_msg'
14764 d_msg_ctrunc='$d_msg_ctrunc'
14765 d_msg_dontroute='$d_msg_dontroute'
14766 d_msg_oob='$d_msg_oob'
14767 d_msg_peek='$d_msg_peek'
14768 d_msg_proxy='$d_msg_proxy'
14769 d_msgctl='$d_msgctl'
14770 d_msgget='$d_msgget'
14771 d_msgrcv='$d_msgrcv'
14772 d_msgsnd='$d_msgsnd'
14773 d_msync='$d_msync'
14774 d_munmap='$d_munmap'
14775 d_mymalloc='$d_mymalloc'
14776 d_nice='$d_nice'
14777 d_nv_preserves_uv='$d_nv_preserves_uv'
14778 d_off64_t='$d_off64_t'
14779 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14780 d_oldpthreads='$d_oldpthreads'
14781 d_oldsock='$d_oldsock'
14782 d_open3='$d_open3'
14783 d_pathconf='$d_pathconf'
14784 d_pause='$d_pause'
14785 d_phostname='$d_phostname'
14786 d_pipe='$d_pipe'
14787 d_poll='$d_poll'
14788 d_portable='$d_portable'
14789 d_pthread_yield='$d_pthread_yield'
14790 d_pwage='$d_pwage'
14791 d_pwchange='$d_pwchange'
14792 d_pwclass='$d_pwclass'
14793 d_pwcomment='$d_pwcomment'
14794 d_pwexpire='$d_pwexpire'
14795 d_pwgecos='$d_pwgecos'
14796 d_pwpasswd='$d_pwpasswd'
14797 d_pwquota='$d_pwquota'
14798 d_quad='$d_quad'
14799 d_readdir='$d_readdir'
14800 d_readlink='$d_readlink'
14801 d_rename='$d_rename'
14802 d_rewinddir='$d_rewinddir'
14803 d_rmdir='$d_rmdir'
14804 d_safebcpy='$d_safebcpy'
14805 d_safemcpy='$d_safemcpy'
14806 d_sanemcmp='$d_sanemcmp'
14807 d_sched_yield='$d_sched_yield'
14808 d_scm_rights='$d_scm_rights'
14809 d_seekdir='$d_seekdir'
14810 d_select='$d_select'
14811 d_sem='$d_sem'
14812 d_semctl='$d_semctl'
14813 d_semctl_semid_ds='$d_semctl_semid_ds'
14814 d_semctl_semun='$d_semctl_semun'
14815 d_semget='$d_semget'
14816 d_semop='$d_semop'
14817 d_setegid='$d_setegid'
14818 d_seteuid='$d_seteuid'
14819 d_setgrent='$d_setgrent'
14820 d_setgrps='$d_setgrps'
14821 d_sethent='$d_sethent'
14822 d_setlinebuf='$d_setlinebuf'
14823 d_setlocale='$d_setlocale'
14824 d_setnent='$d_setnent'
14825 d_setpent='$d_setpent'
14826 d_setpgid='$d_setpgid'
14827 d_setpgrp2='$d_setpgrp2'
14828 d_setpgrp='$d_setpgrp'
14829 d_setprior='$d_setprior'
14830 d_setpwent='$d_setpwent'
14831 d_setregid='$d_setregid'
14832 d_setresgid='$d_setresgid'
14833 d_setresuid='$d_setresuid'
14834 d_setreuid='$d_setreuid'
14835 d_setrgid='$d_setrgid'
14836 d_setruid='$d_setruid'
14837 d_setsent='$d_setsent'
14838 d_setsid='$d_setsid'
14839 d_setspent='$d_setspent'
14840 d_setvbuf='$d_setvbuf'
14841 d_sfio='$d_sfio'
14842 d_shm='$d_shm'
14843 d_shmat='$d_shmat'
14844 d_shmatprototype='$d_shmatprototype'
14845 d_shmctl='$d_shmctl'
14846 d_shmdt='$d_shmdt'
14847 d_shmget='$d_shmget'
14848 d_sigaction='$d_sigaction'
14849 d_sigsetjmp='$d_sigsetjmp'
14850 d_socket='$d_socket'
14851 d_socklen_t='$d_socklen_t'
14852 d_sockpair='$d_sockpair'
14853 d_sqrtl='$d_sqrtl'
14854 d_statblks='$d_statblks'
14855 d_statfs_f_flags='$d_statfs_f_flags'
14856 d_statfs_s='$d_statfs_s'
14857 d_statvfs='$d_statvfs'
14858 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14859 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14860 d_stdio_stream_array='$d_stdio_stream_array'
14861 d_stdiobase='$d_stdiobase'
14862 d_stdstdio='$d_stdstdio'
14863 d_strchr='$d_strchr'
14864 d_strcoll='$d_strcoll'
14865 d_strctcpy='$d_strctcpy'
14866 d_strerrm='$d_strerrm'
14867 d_strerror='$d_strerror'
14868 d_strtod='$d_strtod'
14869 d_strtol='$d_strtol'
14870 d_strtold='$d_strtold'
14871 d_strtoll='$d_strtoll'
14872 d_strtoul='$d_strtoul'
14873 d_strtoull='$d_strtoull'
14874 d_strtouq='$d_strtouq'
14875 d_strxfrm='$d_strxfrm'
14876 d_suidsafe='$d_suidsafe'
14877 d_symlink='$d_symlink'
14878 d_syscall='$d_syscall'
14879 d_sysconf='$d_sysconf'
14880 d_sysernlst='$d_sysernlst'
14881 d_syserrlst='$d_syserrlst'
14882 d_system='$d_system'
14883 d_tcgetpgrp='$d_tcgetpgrp'
14884 d_tcsetpgrp='$d_tcsetpgrp'
14885 d_telldir='$d_telldir'
14886 d_telldirproto='$d_telldirproto'
14887 d_time='$d_time'
14888 d_times='$d_times'
14889 d_truncate='$d_truncate'
14890 d_tzname='$d_tzname'
14891 d_umask='$d_umask'
14892 d_uname='$d_uname'
14893 d_union_semun='$d_union_semun'
14894 d_ustat='$d_ustat'
14895 d_vendorbin='$d_vendorbin'
14896 d_vendorlib='$d_vendorlib'
14897 d_vfork='$d_vfork'
14898 d_void_closedir='$d_void_closedir'
14899 d_voidsig='$d_voidsig'
14900 d_voidtty='$d_voidtty'
14901 d_volatile='$d_volatile'
14902 d_vprintf='$d_vprintf'
14903 d_wait4='$d_wait4'
14904 d_waitpid='$d_waitpid'
14905 d_wcstombs='$d_wcstombs'
14906 d_wctomb='$d_wctomb'
14907 d_xenix='$d_xenix'
14908 date='$date'
14909 db_hashtype='$db_hashtype'
14910 db_prefixtype='$db_prefixtype'
14911 defvoidused='$defvoidused'
14912 direntrytype='$direntrytype'
14913 dlext='$dlext'
14914 dlsrc='$dlsrc'
14915 doublesize='$doublesize'
14916 drand01='$drand01'
14917 dynamic_ext='$dynamic_ext'
14918 eagain='$eagain'
14919 ebcdic='$ebcdic'
14920 echo='$echo'
14921 egrep='$egrep'
14922 emacs='$emacs'
14923 eunicefix='$eunicefix'
14924 exe_ext='$exe_ext'
14925 expr='$expr'
14926 extensions='$extensions'
14927 fflushNULL='$fflushNULL'
14928 fflushall='$fflushall'
14929 find='$find'
14930 firstmakefile='$firstmakefile'
14931 flex='$flex'
14932 fpossize='$fpossize'
14933 fpostype='$fpostype'
14934 freetype='$freetype'
14935 full_ar='$full_ar'
14936 full_csh='$full_csh'
14937 full_sed='$full_sed'
14938 gccversion='$gccversion'
14939 gidformat='$gidformat'
14940 gidsign='$gidsign'
14941 gidsize='$gidsize'
14942 gidtype='$gidtype'
14943 glibpth='$glibpth'
14944 grep='$grep'
14945 groupcat='$groupcat'
14946 groupstype='$groupstype'
14947 gzip='$gzip'
14948 h_fcntl='$h_fcntl'
14949 h_sysfile='$h_sysfile'
14950 hint='$hint'
14951 hostcat='$hostcat'
14952 huge='$huge'
14953 i16size='$i16size'
14954 i16type='$i16type'
14955 i32size='$i32size'
14956 i32type='$i32type'
14957 i64size='$i64size'
14958 i64type='$i64type'
14959 i8size='$i8size'
14960 i8type='$i8type'
14961 i_arpainet='$i_arpainet'
14962 i_bsdioctl='$i_bsdioctl'
14963 i_db='$i_db'
14964 i_dbm='$i_dbm'
14965 i_dirent='$i_dirent'
14966 i_dld='$i_dld'
14967 i_dlfcn='$i_dlfcn'
14968 i_fcntl='$i_fcntl'
14969 i_float='$i_float'
14970 i_gdbm='$i_gdbm'
14971 i_grp='$i_grp'
14972 i_iconv='$i_iconv'
14973 i_inttypes='$i_inttypes'
14974 i_limits='$i_limits'
14975 i_locale='$i_locale'
14976 i_machcthr='$i_machcthr'
14977 i_malloc='$i_malloc'
14978 i_math='$i_math'
14979 i_memory='$i_memory'
14980 i_mntent='$i_mntent'
14981 i_ndbm='$i_ndbm'
14982 i_netdb='$i_netdb'
14983 i_neterrno='$i_neterrno'
14984 i_netinettcp='$i_netinettcp'
14985 i_niin='$i_niin'
14986 i_poll='$i_poll'
14987 i_pthread='$i_pthread'
14988 i_pwd='$i_pwd'
14989 i_rpcsvcdbm='$i_rpcsvcdbm'
14990 i_sfio='$i_sfio'
14991 i_sgtty='$i_sgtty'
14992 i_shadow='$i_shadow'
14993 i_socks='$i_socks'
14994 i_stdarg='$i_stdarg'
14995 i_stddef='$i_stddef'
14996 i_stdlib='$i_stdlib'
14997 i_string='$i_string'
14998 i_sysaccess='$i_sysaccess'
14999 i_sysdir='$i_sysdir'
15000 i_sysfile='$i_sysfile'
15001 i_sysfilio='$i_sysfilio'
15002 i_sysin='$i_sysin'
15003 i_sysioctl='$i_sysioctl'
15004 i_syslog='$i_syslog'
15005 i_sysmman='$i_sysmman'
15006 i_sysmode='$i_sysmode'
15007 i_sysmount='$i_sysmount'
15008 i_sysndir='$i_sysndir'
15009 i_sysparam='$i_sysparam'
15010 i_sysresrc='$i_sysresrc'
15011 i_syssecrt='$i_syssecrt'
15012 i_sysselct='$i_sysselct'
15013 i_syssockio='$i_syssockio'
15014 i_sysstat='$i_sysstat'
15015 i_sysstatfs='$i_sysstatfs'
15016 i_sysstatvfs='$i_sysstatvfs'
15017 i_systime='$i_systime'
15018 i_systimek='$i_systimek'
15019 i_systimes='$i_systimes'
15020 i_systypes='$i_systypes'
15021 i_sysuio='$i_sysuio'
15022 i_sysun='$i_sysun'
15023 i_sysutsname='$i_sysutsname'
15024 i_sysvfs='$i_sysvfs'
15025 i_syswait='$i_syswait'
15026 i_termio='$i_termio'
15027 i_termios='$i_termios'
15028 i_time='$i_time'
15029 i_unistd='$i_unistd'
15030 i_ustat='$i_ustat'
15031 i_utime='$i_utime'
15032 i_values='$i_values'
15033 i_varargs='$i_varargs'
15034 i_varhdr='$i_varhdr'
15035 i_vfork='$i_vfork'
15036 ignore_versioned_solibs='$ignore_versioned_solibs'
15037 inc_version_list='$inc_version_list'
15038 inc_version_list_init='$inc_version_list_init'
15039 incpath='$incpath'
15040 inews='$inews'
15041 installarchlib='$installarchlib'
15042 installbin='$installbin'
15043 installman1dir='$installman1dir'
15044 installman3dir='$installman3dir'
15045 installprefix='$installprefix'
15046 installprefixexp='$installprefixexp'
15047 installprivlib='$installprivlib'
15048 installscript='$installscript'
15049 installsitearch='$installsitearch'
15050 installsitebin='$installsitebin'
15051 installsitelib='$installsitelib'
15052 installstyle='$installstyle'
15053 installusrbinperl='$installusrbinperl'
15054 installvendorbin='$installvendorbin'
15055 installvendorlib='$installvendorlib'
15056 intsize='$intsize'
15057 ivdformat='$ivdformat'
15058 ivsize='$ivsize'
15059 ivtype='$ivtype'
15060 known_extensions='$known_extensions'
15061 ksh='$ksh'
15062 large='$large'
15063 ld='$ld'
15064 lddlflags='$lddlflags'
15065 ldflags='$ldflags'
15066 ldlibpthname='$ldlibpthname'
15067 less='$less'
15068 lib_ext='$lib_ext'
15069 libc='$libc'
15070 libperl='$libperl'
15071 libpth='$libpth'
15072 libs='$libs'
15073 libsdirs='$libsdirs'
15074 libsfiles='$libsfiles'
15075 libsfound='$libsfound'
15076 libspath='$libspath'
15077 libswanted='$libswanted'
15078 line='$line'
15079 lint='$lint'
15080 lkflags='$lkflags'
15081 ln='$ln'
15082 lns='$lns'
15083 locincpth='$locincpth'
15084 loclibpth='$loclibpth'
15085 longdblsize='$longdblsize'
15086 longlongsize='$longlongsize'
15087 longsize='$longsize'
15088 lp='$lp'
15089 lpr='$lpr'
15090 ls='$ls'
15091 lseeksize='$lseeksize'
15092 lseektype='$lseektype'
15093 mail='$mail'
15094 mailx='$mailx'
15095 make='$make'
15096 make_set_make='$make_set_make'
15097 mallocobj='$mallocobj'
15098 mallocsrc='$mallocsrc'
15099 malloctype='$malloctype'
15100 man1dir='$man1dir'
15101 man1direxp='$man1direxp'
15102 man1ext='$man1ext'
15103 man3dir='$man3dir'
15104 man3direxp='$man3direxp'
15105 man3ext='$man3ext'
15106 medium='$medium'
15107 mips_type='$mips_type'
15108 mkdir='$mkdir'
15109 mmaptype='$mmaptype'
15110 models='$models'
15111 modetype='$modetype'
15112 more='$more'
15113 multiarch='$multiarch'
15114 mv='$mv'
15115 myarchname='$myarchname'
15116 mydomain='$mydomain'
15117 myhostname='$myhostname'
15118 myuname='$myuname'
15119 n='$n'
15120 netdb_hlen_type='$netdb_hlen_type'
15121 netdb_host_type='$netdb_host_type'
15122 netdb_name_type='$netdb_name_type'
15123 netdb_net_type='$netdb_net_type'
15124 nm='$nm'
15125 nm_opt='$nm_opt'
15126 nm_so_opt='$nm_so_opt'
15127 nonxs_ext='$nonxs_ext'
15128 nroff='$nroff'
15129 nvsize='$nvsize'
15130 nvtype='$nvtype'
15131 o_nonblock='$o_nonblock'
15132 obj_ext='$obj_ext'
15133 old_pthread_create_joinable='$old_pthread_create_joinable'
15134 optimize='$optimize'
15135 orderlib='$orderlib'
15136 osname='$osname'
15137 osvers='$osvers'
15138 package='$package'
15139 pager='$pager'
15140 passcat='$passcat'
15141 patchlevel='$patchlevel'
15142 path_sep='$path_sep'
15143 perl='$perl'
15144 perladmin='$perladmin'
15145 perlpath='$perlpath'
15146 pg='$pg'
15147 phostname='$phostname'
15148 pidtype='$pidtype'
15149 plibpth='$plibpth'
15150 pm_apiversion='$pm_apiversion'
15151 pmake='$pmake'
15152 pr='$pr'
15153 prefix='$prefix'
15154 prefixexp='$prefixexp'
15155 privlib='$privlib'
15156 privlibexp='$privlibexp'
15157 prototype='$prototype'
15158 ptrsize='$ptrsize'
15159 quadkind='$quadkind'
15160 quadtype='$quadtype'
15161 randbits='$randbits'
15162 randfunc='$randfunc'
15163 randseedtype='$randseedtype'
15164 ranlib='$ranlib'
15165 rd_nodata='$rd_nodata'
15166 rm='$rm'
15167 rmail='$rmail'
15168 runnm='$runnm'
15169 sPRIEldbl='$sPRIEldbl'
15170 sPRIFldbl='$sPRIFldbl'
15171 sPRIGldbl='$sPRIGldbl'
15172 sPRIX64='$sPRIX64'
15173 sPRId64='$sPRId64'
15174 sPRIeldbl='$sPRIeldbl'
15175 sPRIfldbl='$sPRIfldbl'
15176 sPRIgldbl='$sPRIgldbl'
15177 sPRIi64='$sPRIi64'
15178 sPRIo64='$sPRIo64'
15179 sPRIu64='$sPRIu64'
15180 sPRIx64='$sPRIx64'
15181 sched_yield='$sched_yield'
15182 scriptdir='$scriptdir'
15183 scriptdirexp='$scriptdirexp'
15184 sed='$sed'
15185 seedfunc='$seedfunc'
15186 selectminbits='$selectminbits'
15187 selecttype='$selecttype'
15188 sendmail='$sendmail'
15189 sh='$sh'
15190 shar='$shar'
15191 sharpbang='$sharpbang'
15192 shmattype='$shmattype'
15193 shortsize='$shortsize'
15194 shrpenv='$shrpenv'
15195 shsharp='$shsharp'
15196 sig_count='$sig_count'
15197 sig_name='$sig_name'
15198 sig_name_init='$sig_name_init'
15199 sig_num='$sig_num'
15200 sig_num_init='$sig_num_init'
15201 signal_t='$signal_t'
15202 sitearch='$sitearch'
15203 sitearchexp='$sitearchexp'
15204 sitebin='$sitebin'
15205 sitebinexp='$sitebinexp'
15206 sitelib='$sitelib'
15207 sitelibexp='$sitelibexp'
15208 siteprefix='$siteprefix'
15209 siteprefixexp='$siteprefixexp'
15210 sizetype='$sizetype'
15211 sleep='$sleep'
15212 smail='$smail'
15213 small='$small'
15214 so='$so'
15215 sockethdr='$sockethdr'
15216 socketlib='$socketlib'
15217 sort='$sort'
15218 spackage='$spackage'
15219 spitshell='$spitshell'
15220 split='$split'
15221 src='$src'
15222 ssizetype='$ssizetype'
15223 startperl='$startperl'
15224 startsh='$startsh'
15225 static_ext='$static_ext'
15226 stdchar='$stdchar'
15227 stdio_base='$stdio_base'
15228 stdio_bufsiz='$stdio_bufsiz'
15229 stdio_cnt='$stdio_cnt'
15230 stdio_filbuf='$stdio_filbuf'
15231 stdio_ptr='$stdio_ptr'
15232 stdio_stream_array='$stdio_stream_array'
15233 strings='$strings'
15234 submit='$submit'
15235 subversion='$subversion'
15236 sysman='$sysman'
15237 tail='$tail'
15238 tar='$tar'
15239 tbl='$tbl'
15240 tee='$tee'
15241 test='$test'
15242 timeincl='$timeincl'
15243 timetype='$timetype'
15244 touch='$touch'
15245 tr='$tr'
15246 trnl='$trnl'
15247 troff='$troff'
15248 u16size='$u16size'
15249 u16type='$u16type'
15250 u32size='$u32size'
15251 u32type='$u32type'
15252 u64size='$u64size'
15253 u64type='$u64type'
15254 u8size='$u8size'
15255 u8type='$u8type'
15256 uidformat='$uidformat'
15257 uidsign='$uidsign'
15258 uidsize='$uidsize'
15259 uidtype='$uidtype'
15260 uname='$uname'
15261 uniq='$uniq'
15262 uquadtype='$uquadtype'
15263 use5005threads='$use5005threads'
15264 use64bits='$use64bits'
15265 usedl='$usedl'
15266 useithreads='$useithreads'
15267 uselargefiles='$uselargefiles'
15268 uselongdouble='$uselongdouble'
15269 usemorebits='$usemorebits'
15270 usemultiplicity='$usemultiplicity'
15271 usemymalloc='$usemymalloc'
15272 usenm='$usenm'
15273 useopcode='$useopcode'
15274 useperlio='$useperlio'
15275 useposix='$useposix'
15276 usesfio='$usesfio'
15277 useshrplib='$useshrplib'
15278 usesocks='$usesocks'
15279 usethreads='$usethreads'
15280 usevendorprefix='$usevendorprefix'
15281 usevfork='$usevfork'
15282 usrinc='$usrinc'
15283 uuname='$uuname'
15284 uvoformat='$uvoformat'
15285 uvsize='$uvsize'
15286 uvtype='$uvtype'
15287 uvuformat='$uvuformat'
15288 uvxformat='$uvxformat'
15289 vendorbin='$vendorbin'
15290 vendorbinexp='$vendorbinexp'
15291 vendorlib='$vendorlib'
15292 vendorlibexp='$vendorlibexp'
15293 vendorprefix='$vendorprefix'
15294 vendorprefixexp='$vendorprefixexp'
15295 version='$version'
15296 vi='$vi'
15297 voidflags='$voidflags'
15298 xlibpth='$xlibpth'
15299 xs_apiversion='$xs_apiversion'
15300 zcat='$zcat'
15301 zip='$zip'
15302 EOT
15303
15304 : Add in command line options if available
15305 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15306
15307 : add special variables
15308 $test -f $src/patchlevel.h && \
15309 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15310 echo "CONFIGDOTSH=true" >>config.sh
15311
15312 : propagate old symbols
15313 if $test -f UU/config.sh; then
15314         <UU/config.sh sort | uniq >UU/oldconfig.sh
15315         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15316         sort | uniq -u >UU/oldsyms
15317         set X `cat UU/oldsyms`
15318         shift
15319         case $# in
15320         0) ;;
15321         *)
15322                 cat <<EOM
15323 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15324 EOM
15325                 echo "# Variables propagated from previous config.sh file." >>config.sh
15326                 for sym in `cat UU/oldsyms`; do
15327                         echo "    Propagating $hint variable "'$'"$sym..."
15328                         eval 'tmp="$'"${sym}"'"'
15329                         echo "$tmp" | \
15330                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15331                 done
15332                 ;;
15333         esac
15334 fi
15335
15336 : Finish up by extracting the .SH files
15337 case "$alldone" in
15338 exit)
15339         $rm -rf UU
15340         echo "Done."
15341         exit 0
15342         ;;
15343 cont)
15344         ;;
15345 '')
15346         dflt=''
15347         nostick=true
15348         $cat <<EOM
15349
15350 If you'd like to make any changes to the config.sh file before I begin
15351 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15352
15353 EOM
15354         rp="Press return or use a shell escape to edit config.sh:"
15355         . UU/myread
15356         nostick=''
15357         case "$ans" in
15358         '') ;;
15359         *) : in case they cannot read
15360                 sh 1>&4 -c "$ans";;
15361         esac
15362         ;;
15363 esac
15364
15365 : if this fails, just run all the .SH files by hand
15366 . ./config.sh
15367
15368 echo " "
15369 exec 1>&4
15370 . ./UU/extract
15371
15372 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15373         dflt=y
15374         case "$silent" in
15375         true) ;;
15376         *)
15377                 $cat <<EOM
15378
15379 Now you need to generate make dependencies by running "$make depend".
15380 You might prefer to run it in background: "$make depend > makedepend.out &"
15381 It can take a while, so you might not want to run it right now.
15382
15383 EOM
15384                 ;;
15385         esac
15386         rp="Run $make depend now?"
15387         . UU/myread
15388         case "$ans" in
15389         y*)
15390                 $make depend && echo "Now you must run a $make."
15391                 ;;
15392         *)
15393                 echo "You must run '$make depend' then '$make'."
15394                 ;;
15395         esac
15396 elif test -f [Mm]akefile; then
15397         echo " "
15398         echo "Now you must run a $make."
15399 else
15400         echo "Done."
15401 fi
15402
15403 if $test -f Policy.sh; then
15404     $cat <<EOM
15405
15406 If you compile $package on a different machine or from a different object
15407 directory, copy the Policy.sh file from this object directory to the
15408 new one before you run Configure -- this will help you with most of
15409 the policy defaults.
15410
15411 EOM
15412 fi
15413 if $test -f config.msg; then
15414     echo "Hmm.  I also noted the following information while running:"
15415     echo " "
15416     $cat config.msg >&4
15417     $rm -f config.msg
15418 fi
15419 $rm -f kit*isdone ark*isdone
15420 $rm -rf UU
15421
15422 : End of Configure
15423