This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
integrate changes#6469..6484,6486..6501,6504..6505,6507..6509,
[perl5.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 Sat Aug  5 00:21:09 EET DST 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 ccflags=''
292 cppflags=''
293 ldflags=''
294 lkflags=''
295 locincpth=''
296 optimize=''
297 cf_email=''
298 cf_by=''
299 cf_time=''
300 charsize=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_fchmod=''
346 d_fchown=''
347 d_fcntl=''
348 d_fd_macros=''
349 d_fd_set=''
350 d_fds_bits=''
351 d_fgetpos=''
352 d_flexfnam=''
353 d_flock=''
354 d_fork=''
355 d_fpos64_t=''
356 d_frexpl=''
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_getespwnam=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getprpwnam=''
396 d_getpwent=''
397 d_getsent=''
398 d_getservprotos=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_isnan=''
410 d_isnanl=''
411 d_killpg=''
412 d_lchown=''
413 d_ldbl_dig=''
414 d_link=''
415 d_locconv=''
416 d_lockf=''
417 d_longdbl=''
418 longdblsize=''
419 d_longlong=''
420 longlongsize=''
421 d_lseekproto=''
422 d_lstat=''
423 d_madvise=''
424 d_mblen=''
425 d_mbstowcs=''
426 d_mbtowc=''
427 d_memchr=''
428 d_memcmp=''
429 d_memcpy=''
430 d_memmove=''
431 d_memset=''
432 d_mkdir=''
433 d_mkdtemp=''
434 d_mkfifo=''
435 d_mkstemp=''
436 d_mkstemps=''
437 d_mktime=''
438 d_mmap=''
439 mmaptype=''
440 d_modfl=''
441 d_mprotect=''
442 d_msg=''
443 d_msgctl=''
444 d_msgget=''
445 d_msgrcv=''
446 d_msgsnd=''
447 d_msync=''
448 d_munmap=''
449 d_nice=''
450 d_off64_t=''
451 d_open3=''
452 d_fpathconf=''
453 d_pathconf=''
454 d_pause=''
455 d_pipe=''
456 d_poll=''
457 d_portable=''
458 d_old_pthread_create_joinable=''
459 old_pthread_create_joinable=''
460 d_pthread_yield=''
461 d_sched_yield=''
462 sched_yield=''
463 d_qgcvt=''
464 d_readdir=''
465 d_rewinddir=''
466 d_seekdir=''
467 d_telldir=''
468 d_readlink=''
469 d_rename=''
470 d_rmdir=''
471 d_safebcpy=''
472 d_safemcpy=''
473 d_sanemcmp=''
474 d_select=''
475 d_sem=''
476 d_semctl=''
477 d_semget=''
478 d_semop=''
479 d_setegid=''
480 d_seteuid=''
481 d_setgrent=''
482 d_setgrps=''
483 d_sethent=''
484 d_setlinebuf=''
485 d_setlocale=''
486 d_setnent=''
487 d_setpent=''
488 d_setpgid=''
489 d_setpgrp2=''
490 d_bsdsetpgrp=''
491 d_setpgrp=''
492 d_setprior=''
493 d_setproctitle=''
494 d_setpwent=''
495 d_setregid=''
496 d_setresgid=''
497 d_setresuid=''
498 d_setreuid=''
499 d_setrgid=''
500 d_setruid=''
501 d_setsent=''
502 d_setsid=''
503 d_setvbuf=''
504 d_sfio=''
505 usesfio=''
506 d_shm=''
507 d_shmat=''
508 d_shmatprototype=''
509 shmattype=''
510 d_shmctl=''
511 d_shmdt=''
512 d_shmget=''
513 d_sigaction=''
514 d_sigsetjmp=''
515 d_msg_ctrunc=''
516 d_msg_dontroute=''
517 d_msg_oob=''
518 d_msg_peek=''
519 d_msg_proxy=''
520 d_oldsock=''
521 d_scm_rights=''
522 d_socket=''
523 d_sockpair=''
524 sockethdr=''
525 socketlib=''
526 d_socklen_t=''
527 d_sqrtl=''
528 d_statblks=''
529 d_statfs_f_flags=''
530 d_statfs_s=''
531 d_fstatvfs=''
532 d_statvfs=''
533 d_stdio_cnt_lval=''
534 d_stdio_ptr_lval=''
535 d_stdiobase=''
536 d_stdstdio=''
537 stdio_base=''
538 stdio_bufsiz=''
539 stdio_cnt=''
540 stdio_filbuf=''
541 stdio_ptr=''
542 d_index=''
543 d_strchr=''
544 d_strcoll=''
545 d_strctcpy=''
546 d_strerrm=''
547 d_strerror=''
548 d_sysernlst=''
549 d_syserrlst=''
550 d_strtod=''
551 d_strtol=''
552 d_strtold=''
553 d_strtoll=''
554 d_strtoul=''
555 d_strtoull=''
556 d_strtouq=''
557 d_strxfrm=''
558 d_symlink=''
559 d_syscall=''
560 d_sysconf=''
561 d_system=''
562 d_tcgetpgrp=''
563 d_tcsetpgrp=''
564 d_telldirproto=''
565 d_time=''
566 timetype=''
567 clocktype=''
568 d_times=''
569 d_truncate=''
570 d_tzname=''
571 d_umask=''
572 d_semctl_semid_ds=''
573 d_semctl_semun=''
574 d_union_semun=''
575 d_ustat=''
576 d_vfork=''
577 usevfork=''
578 d_voidsig=''
579 signal_t=''
580 d_volatile=''
581 d_charvspr=''
582 d_vprintf=''
583 d_wait4=''
584 d_waitpid=''
585 d_wcstombs=''
586 d_wctomb=''
587 dlext=''
588 cccdlflags=''
589 ccdlflags=''
590 dlsrc=''
591 ld=''
592 lddlflags=''
593 usedl=''
594 doublesize=''
595 ebcdic=''
596 fflushNULL=''
597 fflushall=''
598 fpossize=''
599 fpostype=''
600 gccosandvers=''
601 gccversion=''
602 gidformat=''
603 gidsign=''
604 gidsize=''
605 gidtype=''
606 groupstype=''
607 h_fcntl=''
608 h_sysfile=''
609 i_arpainet=''
610 db_hashtype=''
611 db_prefixtype=''
612 i_db=''
613 i_dbm=''
614 i_rpcsvcdbm=''
615 d_dirnamlen=''
616 direntrytype=''
617 i_dirent=''
618 i_dld=''
619 i_dlfcn=''
620 i_fcntl=''
621 i_float=''
622 i_gdbm=''
623 d_grpasswd=''
624 i_grp=''
625 i_iconv=''
626 i_ieeefp=''
627 i_inttypes=''
628 i_libutil=''
629 i_limits=''
630 i_locale=''
631 i_machcthr=''
632 i_malloc=''
633 i_math=''
634 i_memory=''
635 i_mntent=''
636 i_ndbm=''
637 i_netdb=''
638 i_neterrno=''
639 i_netinettcp=''
640 i_niin=''
641 i_sysin=''
642 i_poll=''
643 i_prot=''
644 i_pthread=''
645 d_pwage=''
646 d_pwchange=''
647 d_pwclass=''
648 d_pwcomment=''
649 d_pwexpire=''
650 d_pwgecos=''
651 d_pwpasswd=''
652 d_pwquota=''
653 i_pwd=''
654 i_sfio=''
655 i_shadow=''
656 i_socks=''
657 i_stddef=''
658 i_stdlib=''
659 i_string=''
660 strings=''
661 i_sunmath=''
662 i_sysaccess=''
663 i_sysdir=''
664 i_sysfile=''
665 d_voidtty=''
666 i_bsdioctl=''
667 i_sysfilio=''
668 i_sysioctl=''
669 i_syssockio=''
670 i_syslog=''
671 i_sysmman=''
672 i_sysmode=''
673 i_sysmount=''
674 i_sysndir=''
675 i_sysparam=''
676 i_sysresrc=''
677 i_syssecrt=''
678 i_sysselct=''
679 i_sysstat=''
680 i_sysstatfs=''
681 i_sysstatvfs=''
682 i_systimes=''
683 i_systypes=''
684 i_sysuio=''
685 i_sysun=''
686 i_sysutsname=''
687 i_sysvfs=''
688 i_syswait=''
689 i_sgtty=''
690 i_termio=''
691 i_termios=''
692 i_systime=''
693 i_systimek=''
694 i_time=''
695 timeincl=''
696 i_unistd=''
697 i_ustat=''
698 i_utime=''
699 i_values=''
700 i_stdarg=''
701 i_varargs=''
702 i_varhdr=''
703 i_vfork=''
704 inc_version_list=''
705 inc_version_list_init=''
706 installprefix=''
707 installprefixexp=''
708 installstyle=''
709 installusrbinperl=''
710 intsize=''
711 longsize=''
712 shortsize=''
713 libc=''
714 ldlibpthname=''
715 libperl=''
716 shrpenv=''
717 useshrplib=''
718 glibpth=''
719 libpth=''
720 loclibpth=''
721 plibpth=''
722 xlibpth=''
723 ignore_versioned_solibs=''
724 libs=''
725 libsdirs=''
726 libsfiles=''
727 libsfound=''
728 libspath=''
729 lns=''
730 d_PRIEldbl=''
731 d_PRIFldbl=''
732 d_PRIGldbl=''
733 d_PRIeldbl=''
734 d_PRIfldbl=''
735 d_PRIgldbl=''
736 sPRIEldbl=''
737 sPRIFldbl=''
738 sPRIGldbl=''
739 sPRIeldbl=''
740 sPRIfldbl=''
741 sPRIgldbl=''
742 lseeksize=''
743 lseektype=''
744 make_set_make=''
745 d_mymalloc=''
746 freetype=''
747 mallocobj=''
748 mallocsrc=''
749 malloctype=''
750 usemymalloc=''
751 installman1dir=''
752 man1dir=''
753 man1direxp=''
754 man1ext=''
755 installman3dir=''
756 man3dir=''
757 man3direxp=''
758 man3ext=''
759 huge=''
760 large=''
761 medium=''
762 models=''
763 small=''
764 split=''
765 modetype=''
766 multiarch=''
767 mydomain=''
768 myhostname=''
769 phostname=''
770 c=''
771 n=''
772 d_eofnblk=''
773 eagain=''
774 o_nonblock=''
775 rd_nodata=''
776 netdb_hlen_type=''
777 netdb_host_type=''
778 netdb_name_type=''
779 netdb_net_type=''
780 groupcat=''
781 hostcat=''
782 passcat=''
783 orderlib=''
784 ranlib=''
785 d_perl_otherlibdirs=''
786 otherlibdirs=''
787 package=''
788 spackage=''
789 pager=''
790 api_revision=''
791 api_subversion=''
792 api_version=''
793 api_versionstring=''
794 patchlevel=''
795 revision=''
796 subversion=''
797 version=''
798 perl5=''
799 perladmin=''
800 perlpath=''
801 d_nv_preserves_uv=''
802 d_nv_preserves_uv_bits=''
803 i16size=''
804 i16type=''
805 i32size=''
806 i32type=''
807 i64size=''
808 i64type=''
809 i8size=''
810 i8type=''
811 ivsize=''
812 ivtype=''
813 nvsize=''
814 nvtype=''
815 u16size=''
816 u16type=''
817 u32size=''
818 u32type=''
819 u64size=''
820 u64type=''
821 u8size=''
822 u8type=''
823 uvsize=''
824 uvtype=''
825 ivdformat=''
826 uvoformat=''
827 uvuformat=''
828 uvxformat=''
829 pidtype=''
830 prefix=''
831 prefixexp=''
832 installprivlib=''
833 privlib=''
834 privlibexp=''
835 prototype=''
836 ptrsize=''
837 d_PRIX64=''
838 d_PRId64=''
839 d_PRIi64=''
840 d_PRIo64=''
841 d_PRIu64=''
842 d_PRIx64=''
843 sPRIX64=''
844 sPRId64=''
845 sPRIi64=''
846 sPRIo64=''
847 sPRIu64=''
848 sPRIx64=''
849 d_quad=''
850 quadkind=''
851 quadtype=''
852 uquadtype=''
853 drand01=''
854 randbits=''
855 randfunc=''
856 randseedtype=''
857 seedfunc=''
858 installscript=''
859 scriptdir=''
860 scriptdirexp=''
861 selectminbits=''
862 selecttype=''
863 sh=''
864 sig_count=''
865 sig_name=''
866 sig_name_init=''
867 sig_num=''
868 sig_num_init=''
869 installsitearch=''
870 sitearch=''
871 sitearchexp=''
872 installsitebin=''
873 sitebin=''
874 sitebinexp=''
875 installsitelib=''
876 sitelib=''
877 sitelib_stem=''
878 sitelibexp=''
879 siteprefix=''
880 siteprefixexp=''
881 sizesize=''
882 sizetype=''
883 so=''
884 socksizetype=''
885 sharpbang=''
886 shsharp=''
887 spitshell=''
888 src=''
889 ssizetype=''
890 startperl=''
891 startsh=''
892 stdchar=''
893 d_stdio_stream_array=''
894 stdio_stream_array=''
895 sysman=''
896 trnl=''
897 uidformat=''
898 uidsign=''
899 uidsize=''
900 uidtype=''
901 archname64=''
902 use64bitall=''
903 use64bitint=''
904 ccflags_uselargefiles=''
905 ldflags_uselargefiles=''
906 libswanted_uselargefiles=''
907 uselargefiles=''
908 uselongdouble=''
909 usemorebits=''
910 usemultiplicity=''
911 nm_opt=''
912 nm_so_opt=''
913 runnm=''
914 usenm=''
915 useperlio=''
916 usesocks=''
917 d_oldpthreads=''
918 use5005threads=''
919 useithreads=''
920 usethreads=''
921 incpath=''
922 mips_type=''
923 usrinc=''
924 d_vendorarch=''
925 installvendorarch=''
926 vendorarch=''
927 vendorarchexp=''
928 d_vendorbin=''
929 installvendorbin=''
930 vendorbin=''
931 vendorbinexp=''
932 d_vendorlib=''
933 installvendorlib=''
934 vendorlib=''
935 vendorlib_stem=''
936 vendorlibexp=''
937 usevendorprefix=''
938 vendorprefix=''
939 vendorprefixexp=''
940 defvoidused=''
941 voidflags=''
942 pm_apiversion=''
943 xs_apiversion=''
944 CONFIG=''
945
946 define='define'
947 undef='undef'
948 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
949 rmlist=''
950
951 : We must find out about Eunice early
952 eunicefix=':'
953 if test -f /etc/unixtovms; then
954         eunicefix=/etc/unixtovms
955 fi
956 if test -f /etc/unixtovms.exe; then
957         eunicefix=/etc/unixtovms.exe
958 fi
959
960 i_whoami=''
961 : set useposix=false in your hint file to disable the POSIX extension.
962 useposix=true
963 : set useopcode=false in your hint file to disable the Opcode extension.
964 useopcode=true
965 : Trailing extension.  Override this in a hint file, if needed.
966 _exe=''
967 : Extra object files, if any, needed on this platform.
968 archobjs=''
969 : Possible local include directories to search.
970 : Set locincpth to "" in a hint file to defeat local include searches.
971 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
972 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
973 :
974 : no include file wanted by default
975 inclwanted=''
976
977 groupstype=''
978 : change the next line if compiling for Xenix/286 on Xenix/386
979 xlibpth='/usr/lib/386 /lib/386'
980 : Possible local library directories to search.
981 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
982 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
983
984 : general looking path for locating libraries
985 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
986 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
987 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
988 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
989 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
990
991 : Private path used by Configure to find libraries.  Its value
992 : is prepended to libpth. This variable takes care of special
993 : machines, like the mips.  Usually, it should be empty.
994 plibpth=''
995
996 : default library list
997 libswanted=''
998 : some systems want to use only the non-versioned libso:s
999 ignore_versioned_solibs=''
1000 ccflags_uselargefiles=''
1001 ldflags_uselargefiles=''
1002 libswanted_uselargefiles=''
1003 : set usemultiplicity on the Configure command line to enable multiplicity.
1004 : set usesocks on the Configure command line to enable socks.
1005 : set usethreads on the Configure command line to enable threads.
1006 : full support for void wanted by default
1007 defvoidused=15
1008
1009 : List of libraries we want.
1010 : If anyone needs -lnet, put it in a hint file.
1011 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1012 libswanted="$libswanted dld ld sun m c cposix posix"
1013 libswanted="$libswanted ndir dir crypt sec"
1014 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1015 : We probably want to search /usr/shlib before most other libraries.
1016 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1017 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1018 glibpth="/usr/shlib $glibpth"
1019 : Do not use vfork unless overridden by a hint file.
1020 usevfork=false
1021
1022 : Find the basic shell for Bourne shell scripts
1023 case "$sh" in
1024 '')
1025         case "$SYSTYPE" in
1026         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1027         *) xxx='/bin/sh';;
1028         esac
1029         if test -f "$xxx"; then
1030                 sh="$xxx"
1031         else
1032                 : Build up a list and do a single loop so we can 'break' out.
1033                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1034                 for xxx in sh bash ksh pdksh ash; do
1035                         for p in $pth; do
1036                                 try="$try ${p}/${xxx}"
1037                         done
1038                 done
1039                 for xxx in $try; do
1040                         if test -f "$xxx"; then
1041                                 sh="$xxx";
1042                                 break
1043                         elif test -f "$xxx.exe"; then
1044                                 sh="$xxx";
1045                                 break
1046                         fi
1047                 done
1048         fi
1049         ;;
1050 esac
1051
1052 case "$sh" in
1053 '')     cat <<EOM >&2
1054 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1055
1056 Usually it's in /bin/sh.  How did you even get this far?
1057 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1058 we'll try to straighten this all out.
1059 EOM
1060         exit 1
1061         ;;
1062 esac
1063
1064 : see if sh knows # comments
1065 if `$sh -c '#' >/dev/null 2>&1`; then
1066         shsharp=true
1067         spitshell=cat
1068         xcat=/bin/cat
1069         test -f $xcat || xcat=/usr/bin/cat
1070         echo "#!$xcat" >try
1071         $eunicefix try
1072         chmod +x try
1073         ./try > today
1074         if test -s today; then
1075                 sharpbang='#!'
1076         else
1077                 echo "#! $xcat" > try
1078                 $eunicefix try
1079                 chmod +x try
1080                 ./try > today
1081                 if test -s today; then
1082                         sharpbang='#! '
1083                 else
1084                         sharpbang=': use '
1085                 fi
1086         fi
1087 else
1088         echo " "
1089         echo "Your $sh doesn't grok # comments--I will strip them later on."
1090         shsharp=false
1091         cd ..
1092         echo "exec grep -v '^[  ]*#'" >spitshell
1093         chmod +x spitshell
1094         $eunicefix spitshell
1095         spitshell=`pwd`/spitshell
1096         cd UU
1097         echo "I presume that if # doesn't work, #! won't work either!"
1098         sharpbang=': use '
1099 fi
1100 rm -f try today
1101
1102 : figure out how to guarantee sh startup
1103 case "$startsh" in
1104 '') startsh=${sharpbang}${sh} ;;
1105 *)
1106 esac
1107 cat >try <<EOSS
1108 $startsh
1109 set abc
1110 test "$?abc" != 1
1111 EOSS
1112
1113 chmod +x try
1114 $eunicefix try
1115 if ./try; then
1116         : echo "Yup, it does."
1117 else
1118         echo "Hmm... '$startsh' does not guarantee sh startup..."
1119         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1120 fi
1121 rm -f try
1122
1123
1124 : Save command line options in file UU/cmdline.opt for later use in
1125 : generating config.sh.
1126 cat > cmdline.opt <<EOSH
1127 # Configure command line arguments.
1128 config_arg0='$0'
1129 config_args='$*'
1130 config_argc=$#
1131 EOSH
1132 argn=1
1133 for arg in "$@"; do
1134         cat >>cmdline.opt <<EOSH
1135 config_arg$argn='$arg'
1136 EOSH
1137         argn=`expr $argn + 1`
1138 done
1139
1140 : produce awk script to parse command line options
1141 cat >options.awk <<'EOF'
1142 BEGIN {
1143         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1144
1145         len = length(optstr);
1146         for (i = 1; i <= len; i++) {
1147                 c = substr(optstr, i, 1);
1148                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1149                 if (a == ":") {
1150                         arg[c] = 1;
1151                         i++;
1152                 }
1153                 opt[c] = 1;
1154         }
1155 }
1156 {
1157         expect = 0;
1158         str = $0;
1159         if (substr(str, 1, 1) != "-") {
1160                 printf("'%s'\n", str);
1161                 next;
1162         }
1163         len = length($0);
1164         for (i = 2; i <= len; i++) {
1165                 c = substr(str, i, 1);
1166                 if (!opt[c]) {
1167                         printf("-%s\n", substr(str, i));
1168                         next;
1169                 }
1170                 printf("-%s\n", c);
1171                 if (arg[c]) {
1172                         if (i < len)
1173                                 printf("'%s'\n", substr(str, i + 1));
1174                         else
1175                                 expect = 1;
1176                         next;
1177                 }
1178         }
1179 }
1180 END {
1181         if (expect)
1182                 print "?";
1183 }
1184 EOF
1185
1186 : process the command line options
1187 set X `for arg in "$@"; do echo "X$arg"; done |
1188         sed -e s/X// | awk -f options.awk`
1189 eval "set $*"
1190 shift
1191 rm -f options.awk
1192
1193 : set up default values
1194 fastread=''
1195 reuseval=false
1196 config_sh=''
1197 alldone=''
1198 error=''
1199 silent=''
1200 extractsh=''
1201 override=''
1202 knowitall=''
1203 rm -f optdef.sh posthint.sh
1204 cat >optdef.sh <<EOS
1205 $startsh
1206 EOS
1207
1208
1209 : option parsing
1210 while test $# -gt 0; do
1211         case "$1" in
1212         -d) shift; fastread=yes;;
1213         -e) shift; alldone=cont;;
1214         -f)
1215                 shift
1216                 cd ..
1217                 if test -r "$1"; then
1218                         config_sh="$1"
1219                 else
1220                         echo "$me: cannot read config file $1." >&2
1221                         error=true
1222                 fi
1223                 cd UU
1224                 shift;;
1225         -h) shift; error=true;;
1226         -r) shift; reuseval=true;;
1227         -s) shift; silent=true; realsilent=true;;
1228         -E) shift; alldone=exit;;
1229         -K) shift; knowitall=true;;
1230         -O) shift; override=true;;
1231         -S) shift; silent=true; extractsh=true;;
1232         -D)
1233                 shift
1234                 case "$1" in
1235                 *=)
1236                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1237                         echo "$me: ignoring -D $1" >&2
1238                         ;;
1239                 *=*) echo "$1" | \
1240                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1241                 *) echo "$1='define'" >> optdef.sh;;
1242                 esac
1243                 shift
1244                 ;;
1245         -U)
1246                 shift
1247                 case "$1" in
1248                 *=) echo "$1" >> optdef.sh;;
1249                 *=*)
1250                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1251                         echo "$me: ignoring -U $1" >&2
1252                         ;;
1253                 *) echo "$1='undef'" >> optdef.sh;;
1254                 esac
1255                 shift
1256                 ;;
1257         -A)
1258             shift
1259             xxx=''
1260             yyy="$1"
1261             zzz=''
1262             uuu=undef
1263             case "$yyy" in
1264             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1265                  case "$zzz" in
1266                  *:*) zzz='' ;;
1267                  *)   xxx=append
1268                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1269                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1270                  esac
1271                  ;;
1272             esac
1273             case "$xxx" in
1274             '')  case "$yyy" in
1275                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1276                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1277                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1278                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1279                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1280                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1281                  esac
1282                  ;;       
1283             esac
1284             case "$xxx" in
1285             append)
1286                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1287             clear)
1288                 echo "$yyy=''"                  >> posthint.sh ;;
1289             define)
1290                 case "$zzz" in
1291                 '') zzz=define ;;
1292                 esac
1293                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1294             eval)
1295                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1296             prepend)
1297                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1298             undef)
1299                 case "$zzz" in
1300                 '') zzz="$uuu" ;;
1301                 esac
1302                 echo "$yyy=$zzz"                >> posthint.sh ;;
1303             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1304             esac
1305             shift
1306             ;;
1307         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1308             exit 0;;
1309         --) break;;
1310         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1311         *) break;;
1312         esac
1313 done
1314
1315 case "$error" in
1316 true)
1317         cat >&2 <<EOM
1318 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1319                  [-U symbol] [-U symbol=] [-A command:symbol...]
1320   -d : use defaults for all answers.
1321   -e : go on without questioning past the production of config.sh.
1322   -f : specify an alternate default configuration file.
1323   -h : print this help message and exit (with an error status).
1324   -r : reuse C symbols value if possible (skips costly nm extraction).
1325   -s : silent mode, only echoes questions and essential information.
1326   -D : define symbol to have some value:
1327          -D symbol         symbol gets the value 'define'
1328          -D symbol=value   symbol gets the value 'value'
1329   -E : stop at the end of questions, after having produced config.sh.
1330   -K : do not use unless you know what you are doing.
1331   -O : let -D and -U override definitions from loaded configuration file.
1332   -S : perform variable substitutions on all .SH files (can mix with -f)
1333   -U : undefine symbol:
1334          -U symbol    symbol gets the value 'undef'
1335          -U symbol=   symbol gets completely empty
1336   -A : manipulate symbol after the platform specific hints have been applied:
1337          -A symbol=value                append " "value to symbol
1338          -A append:symbol=value         append value to symbol
1339          -A define:symbol=value         define symbol to have value
1340          -A clear:symbol                define symbol to be ''
1341          -A define:symbol               define symbol to be 'define'
1342          -A eval:symbol=value           define symbol to be eval of value
1343          -A prepend:symbol=value        prepend value to symbol
1344          -A undef:symbol                define symbol to be 'undef'
1345          -A undef:symbol=               define symbol to be ''
1346   -V : print version number and exit (with a zero status).
1347 EOM
1348         exit 1
1349         ;;
1350 esac
1351
1352 : Sanity checks
1353 case "$fastread$alldone" in
1354 yescont|yesexit) ;;
1355 *)
1356         case "$extractsh" in
1357         true) ;;
1358         *)
1359                 if test ! -t 0; then
1360                         echo "Say 'sh Configure', not 'sh <Configure'"
1361                         exit 1
1362                 fi
1363                 ;;
1364         esac
1365         ;;
1366 esac
1367
1368 exec 4>&1
1369 case "$silent" in
1370 true) exec 1>/dev/null;;
1371 esac
1372
1373 : run the defines and the undefines, if any, but leave the file out there...
1374 touch optdef.sh
1375 . ./optdef.sh
1376 : create the posthint manipulation script and leave the file out there...
1377 touch posthint.sh
1378
1379 : set package name
1380 package=perl5
1381 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1382 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1383 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1384 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1385 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1386 esac
1387
1388 : Some greps do not return status, grrr.
1389 echo "grimblepritz" >grimble
1390 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1391         contains=contains
1392 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1393         contains=grep
1394 else
1395         contains=contains
1396 fi
1397 rm -f grimble
1398 : the following should work in any shell
1399 case "$contains" in
1400 contains*)
1401         echo " "
1402         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1403         cat >contains <<'EOSS'
1404 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1405 EOSS
1406 chmod +x contains
1407 esac
1408
1409 : Find the path to the source tree
1410 case "$src" in
1411 '') case "$0" in
1412     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1413          case "$src" in
1414          /*)    ;;
1415          *)     src=`cd ../$src && pwd` ;;
1416          esac
1417          ;;
1418     *)   src='.';;
1419     esac;;
1420 esac
1421 case "$src" in
1422 '')     src=/
1423         rsrc=/
1424         ;;
1425 /*) rsrc="$src";;
1426 *) rsrc="../$src";;
1427 esac
1428 if test -f $rsrc/Configure && \
1429         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1430 then
1431    : found it, so we are ok.
1432 else
1433         rsrc=''
1434         for src in . .. ../.. ../../.. ../../../..; do
1435                 if test -f ../$src/Configure && \
1436                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1437                 then
1438                         rsrc=../$src
1439                         break
1440                 fi
1441         done
1442 fi
1443 case "$rsrc" in
1444 '')
1445         cat <<EOM >&4
1446
1447 Sorry, I can't seem to locate the source dir for $package.  Please start
1448 Configure with an explicit path -- i.e. /some/path/Configure.
1449
1450 EOM
1451         exit 1
1452         ;;
1453 ../.)   rsrc='..';;
1454 *)
1455         echo " "
1456         echo "Sources for $package found in \"$src\"." >&4
1457         ;;
1458 esac
1459
1460 : script used to extract .SH files with variable substitutions
1461 cat >extract <<'EOS'
1462 CONFIGDOTSH=true
1463 echo "Doing variable substitutions on .SH files..."
1464 if test -f $src/MANIFEST; then
1465         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1466 else
1467         echo "(Looking for .SH files under the source directory.)"
1468         set x `(cd $src; find . -name "*.SH" -print)`
1469 fi
1470 shift
1471 case $# in
1472 0) set x `(cd $src; echo *.SH)`; shift;;
1473 esac
1474 if test ! -f $src/$1; then
1475         shift
1476 fi
1477 mkdir_p='
1478 name=$1;
1479 create="";
1480 while test $name; do
1481         if test ! -d "$name"; then
1482                 create="$name $create";
1483                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1484                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1485         else
1486                 name="";
1487         fi;
1488 done;
1489 for file in $create; do
1490         mkdir $file;
1491 done
1492 '
1493 for file in $*; do
1494         case "$src" in
1495         ".")
1496                 case "$file" in
1497                 */*)
1498                         dir=`expr X$file : 'X\(.*\)/'`
1499                         file=`expr X$file : 'X.*/\(.*\)'`
1500                         (cd $dir && . ./$file)
1501                         ;;
1502                 *)
1503                         . ./$file
1504                         ;;
1505                 esac
1506                 ;;
1507         *)
1508                 case "$file" in
1509                 */*)
1510                         dir=`expr X$file : 'X\(.*\)/'`
1511                         file=`expr X$file : 'X.*/\(.*\)'`
1512                         (set x $dir; shift; eval $mkdir_p)
1513                         sh <$src/$dir/$file
1514                         ;;
1515                 *)
1516                         sh <$src/$file
1517                         ;;
1518                 esac
1519                 ;;
1520         esac
1521 done
1522 if test -f $src/config_h.SH; then
1523         if test ! -f config.h; then
1524         : oops, they left it out of MANIFEST, probably, so do it anyway.
1525         . $src/config_h.SH
1526         fi
1527 fi
1528 EOS
1529
1530 : extract files and exit if asked to do so
1531 case "$extractsh" in
1532 true)
1533         case "$realsilent" in
1534         true) ;;
1535         *) exec 1>&4;;
1536         esac
1537         case "$config_sh" in
1538         '') config_sh='config.sh';;
1539         esac
1540         echo " "
1541         echo "Fetching answers from $config_sh..."
1542         cd ..
1543         . $config_sh
1544         test "$override" && . ./optdef.sh
1545         echo " "
1546         . UU/extract
1547         rm -rf UU
1548         echo "Done."
1549         exit 0
1550         ;;
1551 esac
1552
1553 : Eunice requires " " instead of "", can you believe it
1554 echo " "
1555 : Here we go...
1556 echo "Beginning of configuration questions for $package."
1557
1558 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1559
1560 : first determine how to suppress newline on echo command
1561 echo " "
1562 echo "Checking echo to see how to suppress newlines..."
1563 (echo "hi there\c" ; echo " ") >.echotmp
1564 if $contains c .echotmp >/dev/null 2>&1 ; then
1565         echo "...using -n."
1566         n='-n'
1567         c=''
1568 else
1569         cat <<'EOM'
1570 ...using \c
1571 EOM
1572         n=''
1573         c='\c'
1574 fi
1575 echo $n "The star should be here-->$c"
1576 echo '*'
1577 rm -f .echotmp
1578
1579 : Now test for existence of everything in MANIFEST
1580 echo " "
1581 if test -f $rsrc/MANIFEST; then
1582         echo "First let's make sure your kit is complete.  Checking..." >&4
1583         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1584         rm -f missing
1585         tmppwd=`pwd`
1586         for filelist in x??; do
1587                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1588         done
1589         if test -s missing; then
1590                 cat missing >&4
1591                 cat >&4 <<'EOM'
1592
1593 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1594
1595 You have the option of continuing the configuration process, despite the
1596 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1597 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1598 and contact the author (perlbug@perl.com).
1599
1600 EOM
1601                 echo $n "Continue? [n] $c" >&4
1602                 read ans
1603                 case "$ans" in
1604                 y*)
1605                         echo "Continuing..." >&4
1606                         rm -f missing
1607                         ;;
1608                 *)
1609                         echo "ABORTING..." >&4
1610                         kill $$
1611                         ;;
1612                 esac
1613         else
1614                 echo "Looks good..."
1615         fi
1616 else
1617         echo "There is no MANIFEST file.  I hope your kit is complete !"
1618 fi
1619 rm -f missing x??
1620
1621 echo " "
1622 : Find the appropriate value for a newline for tr
1623 if test -n "$DJGPP"; then
1624        trnl='\012'
1625 fi
1626 if test X"$trnl" = X; then
1627         case "`echo foo|tr '\n' x 2>/dev/null`" in
1628         foox) trnl='\n' ;;
1629         esac
1630 fi
1631 if test X"$trnl" = X; then
1632         case "`echo foo|tr '\012' x 2>/dev/null`" in
1633         foox) trnl='\012' ;;
1634         esac
1635 fi
1636 if test X"$trnl" = X; then
1637         cat <<EOM >&2
1638
1639 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1640
1641 EOM
1642         exit 1
1643 fi
1644
1645 : compute the number of columns on the terminal for proper question formatting
1646 case "$COLUMNS" in
1647 '') COLUMNS='80';;
1648 esac
1649
1650 : set up the echo used in my read
1651 myecho="case \"\$xxxm\" in
1652 '') echo $n \"\$rp $c\" >&4;;
1653 *) case \"\$rp\" in
1654         '') echo $n \"[\$xxxm] $c\";;
1655         *)
1656                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1657                         echo \"\$rp\" >&4
1658                         echo $n \"[\$xxxm] $c\" >&4
1659                 else
1660                         echo $n \"\$rp [\$xxxm] $c\" >&4
1661                 fi
1662                 ;;
1663         esac;;
1664 esac"
1665
1666 : now set up to do reads with possible shell escape and default assignment
1667 cat <<EOSC >myread
1668 $startsh
1669 xxxm=\$dflt
1670 $myecho
1671 ans='!'
1672 case "\$fastread" in
1673 yes) case "\$dflt" in
1674         '') ;;
1675         *) ans='';
1676                 case "\$silent-\$rp" in
1677                 true-) ;;
1678                 *) echo " " >&4;;
1679                 esac;;
1680         esac;;
1681 *) case "\$silent" in
1682         true) case "\$rp" in
1683                 '') ans='';;
1684                 esac;;
1685         esac;;
1686 esac
1687 while expr "X\$ans" : "X!" >/dev/null; do
1688         read answ
1689         set x \$xxxm
1690         shift
1691         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1692         case  "\$answ" in
1693         "!")
1694                 sh 1>&4
1695                 echo " "
1696                 $myecho
1697                 ;;
1698         !*)
1699                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1700                 shift
1701                 sh 1>&4 -c "\$*"
1702                 echo " "
1703                 $myecho
1704                 ;;
1705         "\$ans")
1706                 case "\$ans" in
1707                 \\&*)
1708                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1709                         shift
1710                         case "\$1" in
1711                         -d)
1712                                 fastread=yes
1713                                 echo "(OK, I'll run with -d after this question.)" >&4
1714                                 ;;
1715                         -*)
1716                                 echo "*** Sorry, \$1 not supported yet." >&4
1717                                 ;;
1718                         esac
1719                         $myecho
1720                         ans=!
1721                         ;;
1722                 esac;;
1723         *)
1724                 case "\$aok" in
1725                 y)
1726                         echo "*** Substitution done -- please confirm."
1727                         xxxm="\$ans"
1728                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1729                         xxxm="\$ans"
1730                         ans=!
1731                         ;;
1732                 *)
1733                         echo "*** Error -- try again."
1734                         ans=!
1735                         ;;
1736                 esac
1737                 $myecho
1738                 ;;
1739         esac
1740         case "\$ans\$xxxm\$nostick" in
1741         '')
1742                 ans=!
1743                 $myecho
1744                 ;;
1745         esac
1746 done
1747 case "\$ans" in
1748 '') ans="\$xxxm";;
1749 esac
1750 EOSC
1751
1752 : create .config dir to save info across Configure sessions
1753 test -d ../.config || mkdir ../.config
1754 cat >../.config/README <<EOF
1755 This directory created by Configure to save information that should
1756 persist across sessions for $package.
1757
1758 You may safely delete it if you wish.
1759 EOF
1760
1761 : general instructions
1762 needman=true
1763 firsttime=true
1764 user=`(logname) 2>/dev/null`
1765 case "$user" in
1766 '') user=`whoami 2>&1`;;
1767 esac
1768 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1769         firsttime=false
1770         echo " "
1771         rp='Would you like to see the instructions?'
1772         dflt=n
1773         . ./myread
1774         case "$ans" in
1775         [yY]*) ;;
1776         *) needman=false;;
1777         esac
1778 fi
1779 if $needman; then
1780         cat <<EOH
1781
1782 This installation shell script will examine your system and ask you questions
1783 to determine how the perl5 package should be installed. If you get
1784 stuck on a question, you may use a ! shell escape to start a subshell or
1785 execute a command.  Many of the questions will have default answers in square
1786 brackets; typing carriage return will give you the default.
1787
1788 On some of the questions which ask for file or directory names you are allowed
1789 to use the ~name construct to specify the login directory belonging to "name",
1790 even if you don't have a shell which knows about that.  Questions where this is
1791 allowed will be marked "(~name ok)".
1792
1793 EOH
1794         rp=''
1795         dflt='Type carriage return to continue'
1796         . ./myread
1797         cat <<'EOH'
1798
1799 The prompter used in this script allows you to use shell variables and
1800 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1801 in the default answer, as if the default line was a set of arguments given to a
1802 script shell.  This means you may also use $* to repeat the whole default line,
1803 so you do not have to re-type everything to add something to the default.
1804
1805 Everytime there is a substitution, you will have to confirm.  If there is an
1806 error (e.g. an unmatched backtick), the default answer will remain unchanged
1807 and you will be prompted again.
1808
1809 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1810 the questions and use the computed defaults (or the previous answers if there
1811 was already a config.sh file). Type 'Configure -h' for a list of options.
1812 You may also start interactively and then answer '& -d' at any prompt to turn
1813 on the non-interactive behaviour for the remainder of the execution.
1814
1815 EOH
1816         . ./myread
1817         cat <<EOH
1818
1819 Much effort has been expended to ensure that this shell script will run on any
1820 Unix system.  If despite that it blows up on yours, your best bet is to edit
1821 Configure and run it again.  If you can't run Configure for some reason,
1822 you'll have to generate a config.sh file by hand.  Whatever problems you
1823 have, let me (perlbug@perl.com) know how I blew it.
1824
1825 This installation script affects things in two ways:
1826
1827 1) it may do direct variable substitutions on some of the files included
1828    in this kit.
1829 2) it builds a config.h file for inclusion in C programs.  You may edit
1830    any of these files as the need arises after running this script.
1831
1832 If you make a mistake on a question, there is no easy way to back up to it
1833 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1834 files.  Configure will offer to let you do this before it runs the SH files.
1835
1836 EOH
1837         dflt='Type carriage return to continue'
1838         . ./myread
1839         case "$firsttime" in
1840         true) echo $user >>../.config/instruct;;
1841         esac
1842 fi
1843
1844 : find out where common programs are
1845 echo " "
1846 echo "Locating common programs..." >&4
1847 cat <<EOSC >loc
1848 $startsh
1849 case \$# in
1850 0) exit 1;;
1851 esac
1852 thing=\$1
1853 shift
1854 dflt=\$1
1855 shift
1856 for dir in \$*; do
1857         case "\$thing" in
1858         .)
1859         if test -d \$dir/\$thing; then
1860                 echo \$dir
1861                 exit 0
1862         fi
1863         ;;
1864         *)
1865         for thisthing in \$dir/\$thing; do
1866                 : just loop through to pick last item
1867         done
1868         if test -f \$thisthing; then
1869                 echo \$thisthing
1870                 exit 0
1871         elif test -f \$dir/\$thing.exe; then
1872                 if test -n "$DJGPP"; then
1873                         echo \$dir/\$thing.exe
1874                 else
1875                         : on Eunice apparently
1876                         echo \$dir/\$thing
1877                 fi
1878                 exit 0
1879         fi
1880         ;;
1881         esac
1882 done
1883 echo \$dflt
1884 exit 1
1885 EOSC
1886 chmod +x loc
1887 $eunicefix loc
1888 loclist="
1889 awk
1890 cat
1891 comm
1892 cp
1893 echo
1894 expr
1895 grep
1896 ls
1897 make
1898 mkdir
1899 rm
1900 sed
1901 sort
1902 touch
1903 tr
1904 uniq
1905 "
1906 trylist="
1907 Mcc
1908 ar
1909 byacc
1910 cpp
1911 csh
1912 date
1913 egrep
1914 gzip
1915 less
1916 ln
1917 more
1918 nm
1919 nroff
1920 pg
1921 test
1922 uname
1923 zip
1924 "
1925 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1926 pth="$pth /lib /usr/lib"
1927 for file in $loclist; do
1928         eval xxx=\$$file
1929         case "$xxx" in
1930         /*|?:[\\/]*)
1931                 if test -f "$xxx"; then
1932                         : ok
1933                 else
1934                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1935                         xxx=`./loc $file $file $pth`
1936                 fi
1937                 ;;
1938         '') xxx=`./loc $file $file $pth`;;
1939         *) xxx=`./loc $xxx $xxx $pth`;;
1940         esac
1941         eval $file=$xxx
1942         eval _$file=$xxx
1943         case "$xxx" in
1944         /*)
1945                 echo $file is in $xxx.
1946                 ;;
1947         ?:[\\/]*)
1948                 echo $file is in $xxx.
1949                 ;;
1950         *)
1951                 echo "I don't know where '$file' is, and my life depends on it." >&4
1952                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1953                 exit 1
1954                 ;;
1955         esac
1956 done
1957 echo " "
1958 echo "Don't worry if any of the following aren't found..."
1959 say=offhand
1960 for file in $trylist; do
1961         eval xxx=\$$file
1962         case "$xxx" in
1963         /*|?:[\\/]*)
1964                 if test -f "$xxx"; then
1965                         : ok
1966                 else
1967                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1968                         xxx=`./loc $file $file $pth`
1969                 fi
1970                 ;;
1971         '') xxx=`./loc $file $file $pth`;;
1972         *) xxx=`./loc $xxx $xxx $pth`;;
1973         esac
1974         eval $file=$xxx
1975         eval _$file=$xxx
1976         case "$xxx" in
1977         /*)
1978                 echo $file is in $xxx.
1979                 ;;
1980         ?:[\\/]*)
1981                 echo $file is in $xxx.
1982                 ;;
1983         *)
1984                 echo "I don't see $file out there, $say."
1985                 say=either
1986                 ;;
1987         esac
1988 done
1989 case "$egrep" in
1990 egrep)
1991         echo "Substituting grep for egrep."
1992         egrep=$grep
1993         ;;
1994 esac
1995 case "$ln" in
1996 ln)
1997         echo "Substituting cp for ln."
1998         ln=$cp
1999         ;;
2000 esac
2001 case "$test" in
2002 test)
2003         echo "Hopefully test is built into your sh."
2004         ;;
2005 *)
2006         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2007                 echo "Using the test built into your sh."
2008                 test=test
2009                 _test=test
2010         fi
2011         ;;
2012 esac
2013 case "$echo" in
2014 echo)
2015         echo "Hopefully echo is built into your sh."
2016         ;;
2017 '') ;;
2018 *)
2019         echo " "
2020 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2021         $echo $n "hi there$c" >foo1
2022         echo $n "hi there$c" >foo2
2023         if cmp foo1 foo2 >/dev/null 2>&1; then
2024                 echo "They are compatible.  In fact, they may be identical."
2025         else
2026                 case "$n" in
2027                 '-n') n='' c='\c';;
2028                 *) n='-n' c='';;
2029                 esac
2030                 cat <<FOO
2031 They are not compatible!  You are probably running ksh on a non-USG system.
2032 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2033 have echo built in and we may have to run some Bourne shell scripts.  That
2034 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2035
2036 FOO
2037                 $echo $n "The star should be here-->$c"
2038                 $echo "*"
2039         fi
2040         $rm -f foo1 foo2
2041         ;;
2042 esac
2043
2044 cat <<EOS >checkcc
2045 $startsh
2046 EOS
2047 cat <<'EOSC' >>checkcc
2048 case "$cc" in
2049 '') ;;
2050 *)  $rm -f try try.*
2051     $cat >try.c <<EOM
2052 int main(int argc, char *argv[]) {
2053   return 0;
2054 }
2055 EOM
2056     if $cc -o try try.c; then
2057        :
2058     else
2059         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2060         despair=yes
2061         trygcc=yes
2062         case "$cc" in
2063         *gcc*) trygcc=no ;;
2064         esac
2065         case "`$cc -v -c try.c 2>&1`" in
2066         *gcc*) trygcc=no ;;
2067         esac
2068         if $test X"$trygcc" = Xyes; then
2069             if gcc -o try -c try.c; then
2070                 echo " "
2071                 echo "You seem to have a working gcc, though." >&4
2072                 rp="Would you like to use it?"
2073                 dflt=y
2074                 if $test -f myread; then
2075                     . ./myread
2076                 else
2077                     if $test -f UU/myread; then
2078                         . ./UU/myread
2079                     else
2080                         echo "Cannot find myread, sorry.  Aborting." >&2
2081                         exit 1
2082                     fi
2083                 fi  
2084                 case "$ans" in
2085                 [yY]*) cc=gcc; ccflags=''; despair=no ;;
2086                 esac
2087             fi
2088         fi
2089         if $test X"$despair" = Xyes; then
2090             echo "You need to find a working C compiler." >&4
2091             echo "I cannot continue any further, aborting." >&4
2092             exit 1
2093         fi
2094     fi
2095     $rm -f try try.*
2096     ;;
2097 esac
2098 EOSC
2099
2100 : determine whether symbolic links are supported
2101 echo " "
2102 $touch blurfl
2103 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2104         echo "Symbolic links are supported." >&4
2105         lns="$ln -s"
2106 else
2107         echo "Symbolic links are NOT supported." >&4
2108         lns="$ln"
2109 fi
2110 $rm -f blurfl sym
2111
2112 : see whether [:lower:] and [:upper:] are supported character classes
2113 echo " "
2114 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2115 ABYZ)
2116         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2117         up='[:upper:]'
2118         low='[:lower:]'
2119         ;;
2120 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2121         # (0xc9 and 0xd1), therefore that is a nice testing point.
2122         if test "X$up" = X -o "X$low" = X; then
2123             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2124             ij) up='[A-Z]'
2125                 low='[a-z]'
2126                 ;;
2127             esac
2128         fi
2129         if test "X$up" = X -o "X$low" = X; then
2130             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2131             ij) up='A-Z'
2132                 low='a-z'
2133                 ;;
2134             esac
2135         fi
2136         if test "X$up" = X -o "X$low" = X; then
2137             case "`echo IJ | od -x 2>/dev/null`" in
2138             *C9D1*|*c9d1*)
2139                 echo "Hey, this might be EBCDIC." >&4
2140                 if test "X$up" = X -o "X$low" = X; then
2141                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2142                     ij) up='[A-IJ-RS-Z]'
2143                         low='[a-ij-rs-z]'
2144                         ;;
2145                     esac
2146                 fi
2147                 if test "X$up" = X -o "X$low" = X; then
2148                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2149                     ij) up='A-IJ-RS-Z'
2150                         low='a-ij-rs-z'
2151                         ;;
2152                     esac
2153                 fi
2154                 ;;
2155             esac
2156         fi
2157 esac
2158 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2159 ij)
2160     echo "Using $up and $low to convert case." >&4
2161     ;;
2162 *)
2163     echo "I don't know how to translate letters from upper to lower case." >&4
2164     echo "Your tr is not acting any way I know of." >&4
2165     exit 1
2166     ;;
2167 esac
2168 : set up the translation script tr, must be called with ./tr of course
2169 cat >tr <<EOSC
2170 $startsh
2171 case "\$1\$2" in
2172 '[A-Z][a-z]') exec $tr '$up' '$low';;
2173 '[a-z][A-Z]') exec $tr '$low' '$up';;
2174 esac
2175 exec $tr "\$@"
2176 EOSC
2177 chmod +x tr
2178 $eunicefix tr
2179
2180 : Try to determine whether config.sh was made on this system
2181 case "$config_sh" in
2182 '')
2183 myuname=`$uname -a 2>/dev/null`
2184 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2185 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2186 # because the A-Z/a-z are not consecutive.
2187 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2188         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2189 newmyuname="$myuname"
2190 dflt=n
2191 case "$knowitall" in
2192 '')
2193         if test -f ../config.sh; then
2194                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2195                         eval "`grep myuname= ../config.sh`"
2196                 fi
2197                 if test "X$myuname" = "X$newmyuname"; then
2198                         dflt=y
2199                 fi
2200         fi
2201         ;;
2202 *) dflt=y;;
2203 esac
2204
2205 : Get old answers from old config file if Configure was run on the
2206 : same system, otherwise use the hints.
2207 hint=default
2208 cd ..
2209 if test -f config.sh; then
2210         echo " "
2211         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2212         . UU/myread
2213         case "$ans" in
2214         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2215         *)  echo "Fetching default answers from your old config.sh file..." >&4
2216                 tmp_n="$n"
2217                 tmp_c="$c"
2218                 tmp_sh="$sh"
2219                 . ./config.sh
2220                 cp config.sh UU
2221                 n="$tmp_n"
2222                 c="$tmp_c"
2223                 : Older versions did not always set $sh.  Catch re-use of such
2224                 : an old config.sh.
2225                 case "$sh" in
2226                 '') sh="$tmp_sh" ;;
2227                 esac
2228                 hint=previous
2229                 ;;
2230         esac
2231 fi
2232 . ./UU/checkcc
2233 if test ! -f config.sh; then
2234         $cat <<EOM
2235
2236 First time through, eh?  I have some defaults handy for some systems
2237 that need some extra help getting the Configure answers right:
2238
2239 EOM
2240         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2241         dflt=''
2242         : Half the following guesses are probably wrong... If you have better
2243         : tests or hints, please send them to perlbug@perl.com
2244         : The metaconfig authors would also appreciate a copy...
2245         $test -f /irix && osname=irix
2246         $test -f /xenix && osname=sco_xenix
2247         $test -f /dynix && osname=dynix
2248         $test -f /dnix && osname=dnix
2249         $test -f /lynx.os && osname=lynxos
2250         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2251         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2252         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2253         $test -f /bin/mips && /bin/mips && osname=mips
2254         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2255                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2256         $test -d /usr/apollo/bin && osname=apollo
2257         $test -f /etc/saf/_sactab && osname=svr4
2258         $test -d /usr/include/minix && osname=minix
2259         if $test -d /MachTen -o -d /MachTen_Folder; then
2260                 osname=machten
2261                 if $test -x /sbin/version; then
2262                         osvers=`/sbin/version | $awk '{print $2}' |
2263                         $sed -e 's/[A-Za-z]$//'`
2264                 elif $test -x /usr/etc/version; then
2265                         osvers=`/usr/etc/version | $awk '{print $2}' |
2266                         $sed -e 's/[A-Za-z]$//'`
2267                 else
2268                         osvers="$2.$3"
2269                 fi
2270         fi
2271
2272         $test -f /sys/posix.dll &&
2273                 $test -f /usr/bin/what &&
2274                 set X `/usr/bin/what /sys/posix.dll` &&
2275                 $test "$3" = UWIN &&
2276                 osname=uwin &&
2277                 osvers="$5"
2278
2279         if $test -f $uname; then
2280                 set X $myuname
2281                 shift
2282
2283                 case "$5" in
2284                 fps*) osname=fps ;;
2285                 mips*)
2286                         case "$4" in
2287                         umips) osname=umips ;;
2288                         *) osname=mips ;;
2289                         esac;;
2290                 [23]100) osname=mips ;;
2291                 next*) osname=next ;;
2292                 i386*)
2293                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2294                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2295                                 osname='sco'
2296                                 osvers=$tmp
2297                         elif $test -f /etc/kconfig; then
2298                                 osname=isc
2299                                 if test "$lns" = "$ln -s"; then
2300                                         osvers=4
2301                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2302                                         osvers=3
2303                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2304                                         osvers=2
2305                                 fi
2306                         fi
2307                         tmp=''
2308                         ;;
2309                 pc*)
2310                         if test -n "$DJGPP"; then
2311                                 osname=dos
2312                                 osvers=djgpp
2313                         fi
2314                         ;;
2315                 esac
2316
2317                 case "$1" in
2318                 aix) osname=aix
2319                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2320                         case "$tmp" in
2321                         'not found') osvers="$4"."$3" ;;
2322                         '<3240'|'<>3240') osvers=3.2.0 ;;
2323                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2324                         '=3250'|'>3250') osvers=3.2.5 ;;
2325                         *) osvers=$tmp;;
2326                         esac
2327                         ;;
2328                 bsd386) osname=bsd386
2329                         osvers=`$uname -r`
2330                         ;;
2331                 cygwin*) osname=cygwin
2332                         osvers="$3"
2333                         ;;
2334                 *dc.osx) osname=dcosx
2335                         osvers="$3"
2336                         ;;
2337                 dnix) osname=dnix
2338                         osvers="$3"
2339                         ;;
2340                 domainos) osname=apollo
2341                         osvers="$3"
2342                         ;;
2343                 dgux) osname=dgux 
2344                         osvers="$3"
2345                         ;;
2346                 dynixptx*) osname=dynixptx
2347                         osvers=`echo "$4"|sed 's/^v//'`
2348                         ;;
2349                 freebsd) osname=freebsd 
2350                         osvers="$3" ;;
2351                 genix) osname=genix ;;
2352                 hp*) osname=hpux 
2353                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2354                         ;;
2355                 irix*) osname=irix
2356                         case "$3" in
2357                         4*) osvers=4 ;;
2358                         5*) osvers=5 ;;
2359                         *)      osvers="$3" ;;
2360                         esac
2361                         ;;
2362                 linux) osname=linux
2363                         case "$3" in
2364                         *)      osvers="$3" ;;
2365                         esac
2366                         ;;
2367                 MiNT) osname=mint
2368                         ;;
2369                 netbsd*) osname=netbsd
2370                         osvers="$3"
2371                         ;;
2372                 news-os) osvers="$3"
2373                         case "$3" in
2374                         4*) osname=newsos4 ;;
2375                         *) osname=newsos ;;
2376                         esac
2377                         ;;
2378                 next*) osname=next ;;
2379                 POSIX-BC | posix-bc ) osname=posix-bc
2380                         osvers="$3"
2381                         ;;
2382                 powerux | power_ux | powermax_os | powermaxos | \
2383                 powerunix | power_unix) osname=powerux
2384                         osvers="$3"
2385                         ;;
2386                 qnx) osname=qnx
2387                         osvers="$4"
2388                         ;;
2389                 solaris) osname=solaris
2390                         case "$3" in
2391                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2392                         *)      osvers="$3" ;;
2393                         esac
2394                         ;;
2395                 sunos) osname=sunos
2396                         case "$3" in
2397                         5*) osname=solaris
2398                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2399                         *)      osvers="$3" ;;
2400                         esac
2401                         ;;
2402                 titanos) osname=titanos
2403                         case "$3" in
2404                         1*) osvers=1 ;;
2405                         2*) osvers=2 ;;
2406                         3*) osvers=3 ;;
2407                         4*) osvers=4 ;;
2408                         *)      osvers="$3" ;;
2409                         esac
2410                         ;;
2411                 ultrix) osname=ultrix
2412                         osvers="$3"
2413                         ;;
2414                 osf1|mls+)      case "$5" in
2415                                 alpha)
2416                                         osname=dec_osf
2417                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2418                                         ;;
2419                         hp*)    osname=hp_osf1  ;;
2420                         mips)   osname=mips_osf1 ;;
2421                         esac
2422                         ;;
2423                 unixware) osname=svr5
2424                         osvers="$4"
2425                         ;;
2426                 uts) osname=uts
2427                         osvers="$3"
2428                         ;;
2429                 $2) case "$osname" in
2430                         *isc*) ;;
2431                         *freebsd*) ;;
2432                         svr*)
2433                                 : svr4.x or possibly later
2434                                 case "svr$3" in 
2435                                 ${osname}*)
2436                                         osname=svr$3
2437                                         osvers=$4
2438                                         ;;
2439                                 esac
2440                                 case "$osname" in
2441                                 svr4.0)
2442                                         : Check for ESIX
2443                                         if test -f /stand/boot ; then
2444                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2445                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2446                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2447                                                         if test -n "$isesix"; then
2448                                                                 osname=esix4
2449                                                         fi
2450                                                 fi
2451                                         fi
2452                                         ;;
2453                                 esac
2454                                 ;;
2455                         *)      if test -f /etc/systemid; then
2456                                         osname=sco
2457                                         set `echo $3 | $sed 's/\./ /g'` $4
2458                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2459                                                 osvers=$1.$2.$3
2460                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2461                                                 osvers=$1.$2
2462                                         elif $test -f $src/hints/sco_$1.sh; then
2463                                                 osvers=$1
2464                                         fi
2465                                 else
2466                                         case "$osname" in
2467                                         '') : Still unknown.  Probably a generic Sys V.
2468                                                 osname="sysv"
2469                                                 osvers="$3"
2470                                                 ;;
2471                                         esac
2472                                 fi
2473                                 ;;
2474                         esac
2475                         ;;
2476                 *)      case "$osname" in
2477                         '') : Still unknown.  Probably a generic BSD.
2478                                 osname="$1"
2479                                 osvers="$3"
2480                                 ;;
2481                         esac
2482                         ;;
2483                 esac
2484         else
2485                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2486                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2487                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2488                                 osname=news_os
2489                         fi
2490                         $rm -f UU/kernel.what
2491                 elif test -d c:/.; then
2492                         set X $myuname
2493                         osname=os2
2494                         osvers="$5"
2495                 fi
2496         fi
2497         
2498         : Now look for a hint file osname_osvers, unless one has been
2499         : specified already.
2500         case "$hintfile" in
2501         ''|' ')
2502                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2503                 : Also try without trailing minor version numbers.
2504                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2505                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2506                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2507                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2508                 case "$file" in
2509                 '') dflt=none ;;
2510                 *)  case "$osvers" in
2511                         '') dflt=$file
2512                                 ;;
2513                         *)  if $test -f $src/hints/$file.sh ; then
2514                                         dflt=$file
2515                                 elif $test -f $src/hints/$xfile.sh ; then
2516                                         dflt=$xfile
2517                                 elif $test -f $src/hints/$xxfile.sh ; then
2518                                         dflt=$xxfile
2519                                 elif $test -f $src/hints/$xxxfile.sh ; then
2520                                         dflt=$xxxfile
2521                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2522                                         dflt=$xxxxfile
2523                                 elif $test -f "$src/hints/${osname}.sh" ; then
2524                                         dflt="${osname}"
2525                                 else
2526                                         dflt=none
2527                                 fi
2528                                 ;;
2529                         esac
2530                         ;;
2531                 esac
2532                 if $test -f Policy.sh ; then
2533                         case "$dflt" in
2534                         *Policy*) ;;
2535                         none) dflt="Policy" ;;
2536                         *) dflt="Policy $dflt" ;;
2537                         esac
2538                 fi
2539                 ;;
2540         *)
2541                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2542                 ;;
2543         esac
2544
2545         if $test -f Policy.sh ; then
2546                 $cat <<EOM
2547
2548 There's also a Policy hint file available, which should make the
2549 site-specific (policy) questions easier to answer.
2550 EOM
2551
2552         fi
2553
2554         $cat <<EOM
2555
2556 You may give one or more space-separated answers, or "none" if appropriate.
2557 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2558 is a good thing.  DO NOT give a wrong version or a wrong OS.
2559
2560 EOM
2561
2562         rp="Which of these apply, if any?"
2563         . UU/myread
2564         tans=$ans
2565         for file in $tans; do
2566                 if $test X$file = XPolicy -a -f Policy.sh; then
2567                         . Policy.sh
2568                         $cat Policy.sh >> UU/config.sh
2569                 elif $test -f $src/hints/$file.sh; then
2570                         . $src/hints/$file.sh
2571                         $cat $src/hints/$file.sh >> UU/config.sh
2572                 elif $test X$tans = X -o X$tans = Xnone ; then
2573                         : nothing
2574                 else
2575                         : Give one chance to correct a possible typo.
2576                         echo "$file.sh does not exist"
2577                         dflt=$file
2578                         rp="hint to use instead?"
2579                         . UU/myread
2580                         for file in $ans; do
2581                                 if $test -f "$src/hints/$file.sh"; then
2582                                         . $src/hints/$file.sh
2583                                         $cat $src/hints/$file.sh >> UU/config.sh
2584                                 elif $test X$ans = X -o X$ans = Xnone ; then
2585                                         : nothing
2586                                 else
2587                                         echo "$file.sh does not exist -- ignored."
2588                                 fi
2589                         done
2590                 fi
2591         done
2592
2593         hint=recommended
2594         : Remember our hint file for later.
2595         if $test -f "$src/hints/$file.sh" ; then
2596                 hintfile="$file"
2597         else
2598                 hintfile=''
2599         fi
2600 fi
2601 cd UU
2602 ;;
2603 *)
2604         echo " "
2605         echo "Fetching default answers from $config_sh..." >&4
2606         tmp_n="$n"
2607         tmp_c="$c"
2608         cd ..
2609         cp $config_sh config.sh 2>/dev/null
2610         chmod +w config.sh
2611         . ./config.sh
2612         cd UU
2613         cp ../config.sh .
2614         n="$tmp_n"
2615         c="$tmp_c"
2616         hint=previous
2617         ;;
2618 esac
2619 test "$override" && . ./optdef.sh
2620 myuname="$newmyuname"
2621
2622 : Restore computed paths
2623 for file in $loclist $trylist; do
2624         eval $file="\$_$file"
2625 done
2626
2627 cat << EOM
2628
2629 Configure uses the operating system name and version to set some defaults.
2630 The default value is probably right if the name rings a bell. Otherwise,
2631 since spelling matters for me, either accept the default or answer "none"
2632 to leave it blank.
2633
2634 EOM
2635 case "$osname" in
2636         ''|' ')
2637                 case "$hintfile" in
2638                 ''|' '|none) dflt=none ;;
2639                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2640                 esac
2641                 ;;
2642         *) dflt="$osname" ;;
2643 esac
2644 rp="Operating system name?"
2645 . ./myread
2646 case "$ans" in
2647 none)  osname='' ;;
2648 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2649 esac
2650 echo " "
2651 case "$osvers" in
2652         ''|' ')
2653                 case "$hintfile" in
2654                 ''|' '|none) dflt=none ;;
2655                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2656                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2657                         case "$dflt" in
2658                         ''|' ') dflt=none ;;
2659                         esac
2660                         ;;
2661                 esac
2662                 ;;
2663         *) dflt="$osvers" ;;
2664 esac
2665 rp="Operating system version?"
2666 . ./myread
2667 case "$ans" in
2668 none)  osvers='' ;;
2669 *) osvers="$ans" ;;
2670 esac
2671
2672
2673 . ./posthint.sh
2674
2675 : who configured the system
2676 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2677 cf_by=`(logname) 2>/dev/null`
2678 case "$cf_by" in
2679 "")
2680         cf_by=`(whoami) 2>/dev/null`
2681         case "$cf_by" in
2682         "") cf_by=unknown ;;
2683         esac ;;
2684 esac
2685
2686 : set up the script used to warn in case of inconsistency
2687 cat <<EOS >whoa
2688 $startsh
2689 EOS
2690 cat <<'EOSC' >>whoa
2691 dflt=y
2692 echo " "
2693 echo "*** WHOA THERE!!! ***" >&4
2694 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2695 rp="    Keep the $hint value?"
2696 . ./myread
2697 case "$ans" in
2698 y) td=$was; tu=$was;;
2699 esac
2700 EOSC
2701
2702 : function used to set $1 to $val
2703 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2704 case "$val$was" in
2705 $define$undef) . ./whoa; eval "$var=\$td";;
2706 $undef$define) . ./whoa; eval "$var=\$tu";;
2707 *) eval "$var=$val";;
2708 esac'
2709
2710 case "$usethreads" in
2711 $define|true|[yY]*)     dflt='y';;
2712 *) dflt='n';;
2713 esac
2714 cat <<EOM
2715
2716 Perl can be built to take advantage of threads on some systems.
2717 To do so, Configure can be run with -Dusethreads.
2718
2719 Note that threading is a highly experimental feature, and
2720 some known race conditions still remain.  If you choose to try
2721 it, be very sure to not actually deploy it for production
2722 purposes.  README.threads has more details, and is required
2723 reading if you enable threads.
2724
2725 If this doesn't make any sense to you, just accept the default '$dflt'.
2726 EOM
2727 rp='Build a threading Perl?'
2728 . ./myread
2729 case "$ans" in
2730 y|Y)    val="$define" ;;
2731 *)      val="$undef" ;;
2732 esac
2733 set usethreads
2734 eval $setvar
2735
2736 case "$usethreads" in
2737 $define)
2738         $cat <<EOM
2739
2740 As of 5.5.640, Perl has two different internal threading implementations,
2741 the 5.005 version (5005threads) and an interpreter-based version
2742 (ithreads) that has one interpreter per thread.  Both are very 
2743 experimental.  This arrangement exists to help developers work out
2744 which one is better.
2745
2746 If you're a casual user, you probably don't want interpreter-threads
2747 at this time.  There doesn't yet exist a way to create threads from
2748 within Perl in this model, i.e., "use Thread;" will NOT work.
2749 EOM
2750         : Default to ithreads unless overridden on command line or with
2751         : old config.sh
2752         dflt='y'
2753         case "$use5005threads" in
2754                 $define|true|[yY]*) dflt='n';;
2755         esac
2756         case "$useithreads" in
2757                 $undef|false|[nN]*) dflt='n';;
2758         esac
2759         rp='Use interpreter-based ithreads?'
2760         . ./myread
2761         case "$ans" in
2762         y|Y)    val="$define" ;;
2763         *)      val="$undef" ;;
2764         esac
2765         set useithreads
2766         eval $setvar
2767         : Now set use5005threads to the opposite value.
2768         case "$useithreads" in
2769         $define) val="$undef" ;;
2770         *) val="$define" ;;
2771         esac
2772         set use5005threads
2773         eval $setvar
2774         ;;
2775 *)
2776         useithreads="$undef"
2777         use5005threads="$undef"
2778         ;;
2779 esac
2780
2781 case "$d_oldpthreads" in
2782 '')     : Configure tests would be welcome here.  For now, assume undef.
2783         val="$undef" ;;
2784 *)      val="$d_oldpthreads" ;;
2785 esac
2786 set d_oldpthreads
2787 eval $setvar
2788
2789
2790 case "$usethreads" in
2791 "$define"|true|[yY]*)
2792 : Look for a hint-file generated 'call-back-unit'.  If the
2793 : user has specified that a threading perl is to be built,
2794 : we may need to set or change some other defaults.
2795         if $test -f usethreads.cbu; then
2796                 echo "Your platform has some specific hints for threaded builds, using them..."
2797                 . ./usethreads.cbu
2798         else
2799                 $cat <<EOM
2800 (Your platform doesn't have any specific hints for threaded builds.
2801  Assuming POSIX threads, then.)
2802 EOM
2803         fi
2804         ;;
2805 esac
2806
2807 cat <<EOM
2808
2809 Perl can be built so that multiple Perl interpreters can coexist
2810 within the same Perl executable.
2811 EOM
2812
2813 case "$useithreads" in
2814 $define)
2815         cat <<EOM
2816 This multiple interpreter support is required for interpreter-based threads.
2817 EOM
2818         val="$define"
2819         ;;
2820 *)      case "$usemultiplicity" in
2821         $define|true|[yY]*)     dflt='y';;
2822         *) dflt='n';;
2823         esac
2824         echo " "
2825         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2826         rp='Build Perl for multiplicity?'
2827         . ./myread
2828         case "$ans" in
2829         y|Y)    val="$define" ;;
2830         *)      val="$undef" ;;
2831         esac
2832         ;;
2833 esac
2834 set usemultiplicity
2835 eval $setvar
2836
2837 : determine where manual pages are on this system
2838 echo " "
2839 case "$sysman" in
2840 '') 
2841         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2842         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2843         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2844         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2845         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2846         sysman=`./loc . /usr/man/man1 $syspath`
2847         ;;
2848 esac
2849 if $test -d "$sysman"; then
2850         echo "System manual is in $sysman." >&4
2851 else
2852         echo "Could not find manual pages in source form." >&4
2853 fi
2854
2855 : see what memory models we can support
2856 case "$models" in
2857 '')
2858         $cat >pdp11.c <<'EOP'
2859 int main() {
2860 #ifdef pdp11
2861         exit(0);
2862 #else
2863         exit(1);
2864 #endif
2865 }
2866 EOP
2867         case "$cc" in
2868         '') modelcc="$cc" ;;
2869         *) modelcc="cc" ;;
2870         esac
2871         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2872         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2873                 dflt='unsplit split'
2874         else
2875                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2876                 case "$tans" in
2877                 X) dflt='none';;
2878                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2879                                 dflt='small'
2880                         else
2881                                 dflt=''
2882                         fi
2883                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2884                                 dflt="$dflt medium"
2885                         fi
2886                         if $test -d /lib/large || $test -d /usr/lib/large; then
2887                                 dflt="$dflt large"
2888                         fi
2889                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2890                                 dflt="$dflt huge"
2891                         fi
2892                 esac
2893         fi;;
2894 *) dflt="$models";;
2895 esac
2896 $cat <<EOM
2897  
2898 Some systems have different model sizes.  On most systems they are called
2899 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2900 split.  If your system doesn't support different memory models, say "none".
2901 If you wish to force everything to one memory model, say "none" here and
2902 put the appropriate flags later when it asks you for other cc and ld flags.
2903 Venix systems may wish to put "none" and let the compiler figure things out.
2904 (In the following question multiple model names should be space separated.)
2905
2906 The default for most systems is "none".
2907
2908 EOM
2909 rp="Which memory models are supported?"
2910 . ./myread
2911 models="$ans"
2912
2913 case "$models" in
2914 none)
2915         small=''
2916         medium=''
2917         large=''
2918         huge=''
2919         unsplit=''
2920         split=''
2921         ;;
2922 *split)
2923         case "$split" in
2924         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2925                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2926                         dflt='-i'
2927                 else
2928                         dflt='none'
2929                 fi;;
2930         *) dflt="$split";;
2931         esac
2932         rp="What flag indicates separate I and D space?"
2933         . ./myread
2934         tans="$ans"
2935         case "$tans" in
2936         none) tans='';;
2937         esac
2938         split="$tans"
2939         unsplit='';;
2940 *large*|*small*|*medium*|*huge*)
2941         case "$models" in
2942         *large*)
2943                 case "$large" in
2944                 '') dflt='-Ml';;
2945                 *) dflt="$large";;
2946                 esac
2947         rp="What flag indicates large model?"
2948         . ./myread
2949         tans="$ans"
2950         case "$tans" in
2951         none) tans='';
2952         esac
2953         large="$tans";;
2954         *) large='';;
2955         esac
2956         case "$models" in
2957         *huge*) case "$huge" in
2958                 '') dflt='-Mh';;
2959                 *) dflt="$huge";;
2960                 esac
2961                 rp="What flag indicates huge model?"
2962                 . ./myread
2963                 tans="$ans"
2964                 case "$tans" in
2965                 none) tans='';
2966                 esac
2967                 huge="$tans";;
2968         *) huge="$large";;
2969         esac
2970         case "$models" in
2971         *medium*) case "$medium" in
2972                 '') dflt='-Mm';;
2973                 *) dflt="$medium";;
2974                 esac
2975                 rp="What flag indicates medium model?"
2976                 . ./myread
2977                 tans="$ans"
2978                 case "$tans" in
2979                 none) tans='';
2980                 esac
2981                 medium="$tans";;
2982         *) medium="$large";;
2983         esac
2984         case "$models" in
2985         *small*) case "$small" in
2986                 '') dflt='none';;
2987                 *) dflt="$small";;
2988                 esac
2989                 rp="What flag indicates small model?"
2990                 . ./myread
2991                 tans="$ans"
2992                 case "$tans" in
2993                 none) tans='';
2994                 esac
2995                 small="$tans";;
2996         *) small='';;
2997         esac
2998         ;;
2999 *)
3000         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3001         ;;
3002 esac
3003 $rm -f pdp11.* pdp11
3004
3005 : make some quick guesses about what we are up against
3006 echo " "
3007 $echo $n "Hmm...  $c"
3008 echo exit 1 >bsd
3009 echo exit 1 >usg
3010 echo exit 1 >v7
3011 echo exit 1 >osf1
3012 echo exit 1 >eunice
3013 echo exit 1 >xenix
3014 echo exit 1 >venix
3015 echo exit 1 >os2
3016 d_bsd="$undef"
3017 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3018 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3019 then
3020         echo "Looks kind of like an OSF/1 system, but we'll see..."
3021         echo exit 0 >osf1
3022 elif test `echo abc | tr a-z A-Z` = Abc ; then
3023         xxx=`./loc addbib blurfl $pth`
3024         if $test -f $xxx; then
3025         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3026                 echo exit 0 >bsd
3027                 echo exit 0 >usg
3028         else
3029                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3030                         echo "Looks kind of like an extended USG system, but we'll see..."
3031                 else
3032                         echo "Looks kind of like a USG system, but we'll see..."
3033                 fi
3034                 echo exit 0 >usg
3035         fi
3036 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3037         echo "Looks kind of like a BSD system, but we'll see..."
3038         d_bsd="$define"
3039         echo exit 0 >bsd
3040 else
3041         echo "Looks kind of like a Version 7 system, but we'll see..."
3042         echo exit 0 >v7
3043 fi
3044 case "$eunicefix" in
3045 *unixtovms*)
3046         $cat <<'EOI'
3047 There is, however, a strange, musty smell in the air that reminds me of
3048 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3049 EOI
3050         echo exit 0 >eunice
3051         d_eunice="$define"
3052 : it so happens the Eunice I know will not run shell scripts in Unix format
3053         ;;
3054 *)
3055         echo " "
3056         echo "Congratulations.  You aren't running Eunice."
3057         d_eunice="$undef"
3058         ;;
3059 esac
3060 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3061 case "$p_" in
3062 :) ;;
3063 *)
3064         $cat <<'EOI'
3065 I have the feeling something is not exactly right, however...don't tell me...
3066 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3067 EOI
3068         echo exit 0 >os2
3069         ;;
3070 esac
3071 if test -f /xenix; then
3072         echo "Actually, this looks more like a XENIX system..."
3073         echo exit 0 >xenix
3074         d_xenix="$define"
3075 else
3076         echo " "
3077         echo "It's not Xenix..."
3078         d_xenix="$undef"
3079 fi
3080 chmod +x xenix
3081 $eunicefix xenix
3082 if test -f /venix; then
3083         echo "Actually, this looks more like a VENIX system..."
3084         echo exit 0 >venix
3085 else
3086         echo " "
3087         if ./xenix; then
3088                 : null
3089         else
3090                 echo "Nor is it Venix..."
3091         fi
3092 fi
3093 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3094 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3095 $rm -f foo
3096
3097 : see if we need a special compiler
3098 echo " "
3099 if ./usg; then
3100         case "$cc" in
3101         '') case "$Mcc" in
3102                 /*) dflt='Mcc';;
3103                 *) case "$large" in
3104                         -M*) dflt='cc';;
3105                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3106                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3107                                                 dflt='cc'
3108                                         else
3109                                                 dflt='cc -M'
3110                                         fi
3111                                 else
3112                                         dflt='cc'
3113                                 fi;;
3114                         esac;;
3115                 esac;;
3116         *)  dflt="$cc";;
3117         esac
3118         case "$dflt" in
3119         *M*)    $cat <<'EOM'
3120 On some older systems the default C compiler will not resolve multiple global
3121 references that happen to have the same name.  On some such systems the "Mcc"
3122 command may be used to force these to be resolved.  On other systems a "cc -M"
3123 command is required.  (Note that the -M flag on other systems indicates a
3124 memory model to use!) If you have the Gnu C compiler, you might wish to use
3125 that instead.
3126
3127 EOM
3128         ;;
3129         esac
3130         rp="Use which C compiler?"
3131         . ./myread
3132         cc="$ans"
3133 else
3134         case "$cc" in
3135         '') dflt=cc;;
3136         *) dflt="$cc";;
3137         esac
3138         rp="Use which C compiler?"
3139         . ./myread
3140         cc="$ans"
3141 fi
3142 : Look for a hint-file generated 'call-back-unit'.  Now that the
3143 : user has specified the compiler, we may need to set or change some
3144 : other defaults.
3145 if $test -f cc.cbu; then
3146     . ./cc.cbu
3147 fi
3148 . ./checkcc
3149
3150 echo " "
3151 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3152 $cat >gccvers.c <<EOM
3153 #include <stdio.h>
3154 int main() {
3155 #ifdef __GNUC__
3156 #ifdef __VERSION__
3157         printf("%s\n", __VERSION__);
3158 #else
3159         printf("%s\n", "1");
3160 #endif
3161 #endif
3162         exit(0);
3163 }
3164 EOM
3165 if $cc $ldflags -o gccvers gccvers.c; then
3166         gccversion=`./gccvers`
3167         case "$gccversion" in
3168         '') echo "You are not using GNU cc." ;;
3169         *)  echo "You are using GNU cc $gccversion."
3170             ;;
3171         esac
3172 else
3173         echo " "
3174         echo "*** WHOA THERE!!! ***" >&4
3175         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3176         case "$knowitall" in
3177         '')
3178         echo "    You'd better start hunting for one and let me know about it." >&4
3179                 exit 1
3180                 ;;
3181         esac
3182 fi
3183 $rm -f gccvers*
3184 case "$gccversion" in
3185 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3186 esac
3187 case "$gccversion" in
3188 '') gccosandvers='' ;;
3189 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3190    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3191    gccshortvers=''
3192    case "$gccosandvers" in
3193    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3194    $osname$osvers) ;; # looking good
3195    $osname*) cat <<EOM >&4
3196
3197 *** WHOA THERE!!! ***
3198
3199     Your gcc has not been compiled for the exact release of
3200     your operating system ($gccosandvers versus $osname$osvers).
3201
3202     In general it is a good idea to keep gcc synchronized with
3203     the operating system because otherwise serious problems
3204     may ensue when trying to compile software, like Perl.
3205
3206     I'm trying to be optimistic here, though, and will continue.
3207     If later during the configuration and build icky compilation
3208     problems appear (headerfile conflicts being the most common
3209     manifestation), I suggest reinstalling the gcc to match
3210     your operating system release.
3211
3212 EOM
3213       ;;
3214    *) gccosandvers='' ;; # failed to parse, better be silent
3215    esac
3216    ;;
3217 esac
3218
3219
3220
3221
3222 : see how we invoke the C preprocessor
3223 echo " "
3224 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3225 cat <<'EOT' >testcpp.c
3226 #define ABC abc
3227 #define XYZ xyz
3228 ABC.XYZ
3229 EOT
3230 cd ..
3231 if test ! -f cppstdin; then
3232         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3233                 # AIX cc -E doesn't show the absolute headerfile
3234                 # locations but we'll cheat by using the -M flag.
3235                 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
3236         else
3237                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3238         fi
3239 else
3240         echo "Keeping your $hint cppstdin wrapper."
3241 fi
3242 chmod 755 cppstdin
3243 wrapper=`pwd`/cppstdin
3244 ok='false'
3245 cd UU
3246
3247 if $test "X$cppstdin" != "X" && \
3248         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3249         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3250 then
3251         echo "You used to use $cppstdin $cppminus so we'll use that again."
3252         case "$cpprun" in
3253         '') echo "But let's see if we can live without a wrapper..." ;;
3254         *)
3255                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3256                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3257                 then
3258                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3259                         ok='true'
3260                 else
3261                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3262                 fi
3263                 ;;
3264         esac
3265 else
3266         case "$cppstdin" in
3267         '') ;;
3268         *)
3269                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3270                 ;;
3271         esac
3272 fi
3273
3274 if $ok; then
3275         : nothing
3276 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3277         $cc -E <testcpp.c >testcpp.out 2>&1; \
3278         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3279         echo "Yup, it does."
3280         x_cpp="$cc -E"
3281         x_minus='';
3282 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3283         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3284         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3285         echo "Yup, it does."
3286         x_cpp="$cc -E"
3287         x_minus='-';
3288 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3289         $cc -P <testcpp.c >testcpp.out 2>&1; \
3290         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3291         echo "Yipee, that works!"
3292         x_cpp="$cc -P"
3293         x_minus='';
3294 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3295         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3296         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3297         echo "At long last!"
3298         x_cpp="$cc -P"
3299         x_minus='-';
3300 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3301         $cpp <testcpp.c >testcpp.out 2>&1; \
3302         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3303         echo "It works!"
3304         x_cpp="$cpp"
3305         x_minus='';
3306 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3307         $cpp - <testcpp.c >testcpp.out 2>&1; \
3308         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3309         echo "Hooray, it works!  I was beginning to wonder."
3310         x_cpp="$cpp"
3311         x_minus='-';
3312 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3313         $wrapper <testcpp.c >testcpp.out 2>&1; \
3314         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3315         x_cpp="$wrapper"
3316         x_minus=''
3317         echo "Eureka!"
3318 else
3319         dflt=''
3320         rp="No dice.  I can't find a C preprocessor.  Name one:"
3321         . ./myread
3322         x_cpp="$ans"
3323         x_minus=''
3324         $x_cpp <testcpp.c >testcpp.out 2>&1
3325         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3326                 echo "OK, that will do." >&4
3327         else
3328 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3329                 exit 1
3330         fi
3331 fi
3332
3333 case "$ok" in
3334 false)
3335         cppstdin="$x_cpp"
3336         cppminus="$x_minus"
3337         cpprun="$x_cpp"
3338         cpplast="$x_minus"
3339         set X $x_cpp
3340         shift
3341         case "$1" in
3342         "$cpp")
3343                 echo "Perhaps can we force $cc -E using a wrapper..."
3344                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3345                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3346                 then
3347                         echo "Yup, we can."
3348                         cppstdin="$wrapper"
3349                         cppminus='';
3350                 else
3351                         echo "Nope, we'll have to live without it..."
3352                 fi
3353                 ;;
3354         esac
3355         case "$cpprun" in
3356         "$wrapper")
3357                 cpprun=''
3358                 cpplast=''
3359                 ;;
3360         esac
3361         ;;
3362 esac
3363
3364 case "$cppstdin" in
3365 "$wrapper"|'cppstdin') ;;
3366 *) $rm -f $wrapper;;
3367 esac
3368 $rm -f testcpp.c testcpp.out
3369
3370 : decide how portable to be.  Allow command line overrides.
3371 case "$d_portable" in
3372 "$undef") ;;
3373 *)      d_portable="$define" ;;
3374 esac
3375
3376 : set up shell script to do ~ expansion
3377 cat >filexp <<EOSS
3378 $startsh
3379 : expand filename
3380 case "\$1" in
3381  ~/*|~)
3382         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3383         ;;
3384  ~*)
3385         if $test -f /bin/csh; then
3386                 /bin/csh -f -c "glob \$1"
3387                 failed=\$?
3388                 echo ""
3389                 exit \$failed
3390         else
3391                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3392                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3393                 if $test ! -d "\$dir"; then
3394                         me=\`basename \$0\`
3395                         echo "\$me: can't locate home directory for: \$name" >&2
3396                         exit 1
3397                 fi
3398                 case "\$1" in
3399                 */*)
3400                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3401                         ;;
3402                 *)
3403                         echo \$dir
3404                         ;;
3405                 esac
3406         fi
3407         ;;
3408 *)
3409         echo \$1
3410         ;;
3411 esac
3412 EOSS
3413 chmod +x filexp
3414 $eunicefix filexp
3415
3416 : now set up to get a file name
3417 cat <<EOS >getfile
3418 $startsh
3419 EOS
3420 cat <<'EOSC' >>getfile
3421 tilde=''
3422 fullpath=''
3423 already=''
3424 skip=''
3425 none_ok=''
3426 exp_file=''
3427 nopath_ok=''
3428 orig_rp="$rp"
3429 orig_dflt="$dflt"
3430 case "$gfpth" in
3431 '') gfpth='.' ;;
3432 esac
3433
3434 case "$fn" in
3435 *\(*)
3436         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3437         fn=`echo $fn | sed 's/(.*)//'`
3438         ;;
3439 esac
3440
3441 case "$fn" in
3442 *:*)
3443         loc_file=`expr $fn : '.*:\(.*\)'`
3444         fn=`expr $fn : '\(.*\):.*'`
3445         ;;
3446 esac
3447
3448 case "$fn" in
3449 *~*) tilde=true;;
3450 esac
3451 case "$fn" in
3452 */*) fullpath=true;;
3453 esac
3454 case "$fn" in
3455 *+*) skip=true;;
3456 esac
3457 case "$fn" in
3458 *n*) none_ok=true;;
3459 esac
3460 case "$fn" in
3461 *e*) exp_file=true;;
3462 esac
3463 case "$fn" in
3464 *p*) nopath_ok=true;;
3465 esac
3466
3467 case "$fn" in
3468 *f*) type='File';;
3469 *d*) type='Directory';;
3470 *l*) type='Locate';;
3471 esac
3472
3473 what="$type"
3474 case "$what" in
3475 Locate) what='File';;
3476 esac
3477
3478 case "$exp_file" in
3479 '')
3480         case "$d_portable" in
3481         "$define") ;;
3482         *) exp_file=true;;
3483         esac
3484         ;;
3485 esac
3486
3487 cd ..
3488 while test "$type"; do
3489         redo=''
3490         rp="$orig_rp"
3491         dflt="$orig_dflt"
3492         case "$tilde" in
3493         true) rp="$rp (~name ok)";;
3494         esac
3495         . UU/myread
3496         if test -f UU/getfile.ok && \
3497                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3498         then
3499                 value="$ans"
3500                 ansexp="$ans"
3501                 break
3502         fi
3503         case "$ans" in
3504         none)
3505                 value=''
3506                 ansexp=''
3507                 case "$none_ok" in
3508                 true) type='';;
3509                 esac
3510                 ;;
3511         *)
3512                 case "$tilde" in
3513                 '') value="$ans"
3514                         ansexp="$ans";;
3515                 *)
3516                         value=`UU/filexp $ans`
3517                         case $? in
3518                         0)
3519                                 if test "$ans" != "$value"; then
3520                                         echo "(That expands to $value on this system.)"
3521                                 fi
3522                                 ;;
3523                         *) value="$ans";;
3524                         esac
3525                         ansexp="$value"
3526                         case "$exp_file" in
3527                         '') value="$ans";;
3528                         esac
3529                         ;;
3530                 esac
3531                 case "$fullpath" in
3532                 true)
3533                         case "$ansexp" in
3534                         /*) value="$ansexp" ;;
3535                         [a-zA-Z]:/*) value="$ansexp" ;;
3536                         *)
3537                                 redo=true
3538                                 case "$already" in
3539                                 true)
3540                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3541                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3542                                         ;;
3543                                 *)
3544                                 echo "Please give a full path name, starting with slash." >&4
3545                                         case "$tilde" in
3546                                         true)
3547                                 echo "Note that using ~name is ok provided it expands well." >&4
3548                                                 already=true
3549                                                 ;;
3550                                         esac
3551                                 esac
3552                                 ;;
3553                         esac
3554                         ;;
3555                 esac
3556                 case "$redo" in
3557                 '')
3558                         case "$type" in
3559                         File)
3560                                 for fp in $gfpth; do
3561                                         if test "X$fp" = X.; then
3562                                             pf="$ansexp"
3563                                         else    
3564                                             pf="$fp/$ansexp"
3565                                         fi
3566                                         if test -f "$pf"; then
3567                                                 type=''
3568                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3569                                         then
3570                                                 echo "($value is not a plain file, but that's ok.)"
3571                                                 type=''
3572                                         fi
3573                                         if test X"$type" = X; then
3574                                             value="$pf"
3575                                             break
3576                                         fi
3577                                 done
3578                                 ;;
3579                         Directory)
3580                                 for fp in $gfpth; do
3581                                         if test "X$fp" = X.; then
3582                                             dir="$ans"
3583                                             direxp="$ansexp"
3584                                         else    
3585                                             dir="$fp/$ansexp"
3586                                             direxp="$fp/$ansexp"
3587                                         fi
3588                                         if test -d "$direxp"; then
3589                                                 type=''
3590                                                 value="$dir"
3591                                                 break
3592                                         fi
3593                                 done
3594                                 ;;
3595                         Locate)
3596                                 if test -d "$ansexp"; then
3597                                         echo "(Looking for $loc_file in directory $value.)"
3598                                         value="$value/$loc_file"
3599                                         ansexp="$ansexp/$loc_file"
3600                                 fi
3601                                 if test -f "$ansexp"; then
3602                                         type=''
3603                                 fi
3604                                 case "$nopath_ok" in
3605                                 true)   case "$value" in
3606                                         */*) ;;
3607                                         *)      echo "Assuming $value will be in people's path."
3608                                                 type=''
3609                                                 ;;
3610                                         esac
3611                                         ;;
3612                                 esac
3613                                 ;;
3614                         esac
3615
3616                         case "$skip" in
3617                         true) type='';
3618                         esac
3619
3620                         case "$type" in
3621                         '') ;;
3622                         *)
3623                                 if test "$fastread" = yes; then
3624                                         dflt=y
3625                                 else
3626                                         dflt=n
3627                                 fi
3628                                 rp="$what $value doesn't exist.  Use that name anyway?"
3629                                 . UU/myread
3630                                 dflt=''
3631                                 case "$ans" in
3632                                 y*) type='';;
3633                                 *) echo " ";;
3634                                 esac
3635                                 ;;
3636                         esac
3637                         ;;
3638                 esac
3639                 ;;
3640         esac
3641 done
3642 cd UU
3643 ans="$value"
3644 rp="$orig_rp"
3645 dflt="$orig_dflt"
3646 rm -f getfile.ok
3647 test "X$gfpthkeep" != Xy && gfpth=""
3648 EOSC
3649
3650 : What should the include directory be ?
3651 echo " "
3652 $echo $n "Hmm...  $c"
3653 dflt='/usr/include'
3654 incpath=''
3655 mips_type=''
3656 if $test -f /bin/mips && /bin/mips; then
3657         echo "Looks like a MIPS system..."
3658         $cat >usr.c <<'EOCP'
3659 #ifdef SYSTYPE_BSD43
3660 /bsd43
3661 #endif
3662 EOCP
3663         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3664                 dflt='/bsd43/usr/include'
3665                 incpath='/bsd43'
3666                 mips_type='BSD 4.3'
3667         else
3668                 mips_type='System V'
3669         fi
3670         $rm -f usr.c usr.out
3671         echo "and you're compiling with the $mips_type compiler and libraries."
3672         xxx_prompt=y
3673         echo "exit 0" >mips
3674 else
3675         echo "Doesn't look like a MIPS system."
3676         xxx_prompt=n
3677         echo "exit 1" >mips
3678 fi
3679 chmod +x mips
3680 $eunicefix mips
3681 case "$usrinc" in
3682 '') ;;
3683 *) dflt="$usrinc";;
3684 esac
3685 case "$xxx_prompt" in
3686 y)      fn=d/
3687         echo " "
3688         rp='Where are the include files you want to use?'
3689         . ./getfile
3690         usrinc="$ans"
3691         ;;
3692 *)      usrinc="$dflt"
3693         ;;
3694 esac
3695
3696 : Set private lib path
3697 case "$plibpth" in
3698 '') if ./mips; then
3699                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3700         fi;;
3701 esac
3702 case "$libpth" in
3703 ' ') dlist='';;
3704 '') dlist="$loclibpth $plibpth $glibpth";;
3705 *) dlist="$libpth";;
3706 esac
3707
3708 : Now check and see which directories actually exist, avoiding duplicates
3709 libpth=''
3710 for xxx in $dlist
3711 do
3712     if $test -d $xxx; then
3713                 case " $libpth " in
3714                 *" $xxx "*) ;;
3715                 *) libpth="$libpth $xxx";;
3716                 esac
3717     fi
3718 done
3719 $cat <<'EOM'
3720
3721 Some systems have incompatible or broken versions of libraries.  Among
3722 the directories listed in the question below, please remove any you
3723 know not to be holding relevant libraries, and add any that are needed.
3724 Say "none" for none.
3725
3726 EOM
3727 case "$libpth" in
3728 '') dflt='none';;
3729 *)
3730         set X $libpth
3731         shift
3732         dflt=${1+"$@"}
3733         ;;
3734 esac
3735 rp="Directories to use for library searches?"
3736 . ./myread
3737 case "$ans" in
3738 none) libpth=' ';;
3739 *) libpth="$ans";;
3740 esac
3741
3742 : compute shared library extension
3743 case "$so" in
3744 '')
3745         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3746                 dflt='sl'
3747         else
3748                 dflt='so'
3749         fi
3750         ;;
3751 *) dflt="$so";;
3752 esac
3753 $cat <<EOM
3754
3755 On some systems, shared libraries may be available.  Answer 'none' if
3756 you want to suppress searching of shared libraries for the remainder
3757 of this configuration.
3758
3759 EOM
3760 rp='What is the file extension used for shared libraries?'
3761 . ./myread
3762 so="$ans"
3763
3764 : Define several unixisms.
3765 : Hints files or command line option can be used to override them.
3766 : The convoluted testing is in case hints files set either the old
3767 : or the new name.
3768 case "$_exe" in
3769 '')     case "$exe_ext" in
3770     '') ;;
3771         *)      _exe="$exe_ext" ;;
3772         esac
3773         ;;
3774 esac
3775 case "$_a" in
3776 '')     case "$lib_ext" in
3777     '') _a='.a';;
3778         *)      _a="$lib_ext" ;;
3779         esac
3780         ;;
3781 esac
3782 case "$_o" in
3783 '') case "$obj_ext" in
3784         '')     _o='.o';;
3785         *)      _o="$obj_ext";;
3786         esac
3787         ;;
3788 esac
3789 case "$p_" in
3790 '') case "$path_sep" in
3791         '')     p_=':';;
3792         *)      p_="$path_sep";;
3793         esac
3794         ;;
3795 esac
3796 exe_ext=$_exe
3797 lib_ext=$_a
3798 obj_ext=$_o
3799 path_sep=$p_
3800
3801 : Which makefile gets called first.  This is used by make depend.
3802 case "$firstmakefile" in
3803 '') firstmakefile='makefile';;
3804 esac
3805
3806 case "$usesocks" in
3807 $define|true|[yY]*)     dflt='y';;
3808 *) dflt='n';;
3809 esac
3810 cat <<EOM
3811
3812 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3813 Configure must be run with -Dusesocks.
3814
3815 If this doesn't make any sense to you, just accept the default '$dflt'.
3816 EOM
3817 rp='Build Perl for SOCKS?'
3818 . ./myread
3819 case "$ans" in
3820 y|Y)    val="$define" ;;     
3821 *)      val="$undef" ;;
3822 esac
3823 set usesocks
3824 eval $setvar
3825
3826 : Looking for optional libraries
3827 echo " "
3828 echo "Checking for optional libraries..." >&4
3829 case "$libs" in
3830 ' '|'') dflt='';;
3831 *) dflt="$libs";;
3832 esac
3833 case "$libswanted" in
3834 '') libswanted='c_s';;
3835 esac
3836 case "$usesocks" in
3837 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3838 esac
3839 libsfound=''
3840 libsfiles=''
3841 libsdirs=''
3842 libspath=''
3843 for thisdir in $libpth $xlibpth; do
3844   test -d $thisdir && libspath="$libspath $thisdir"
3845 done
3846 for thislib in $libswanted; do
3847         for thisdir in $libspath; do
3848             xxx=''
3849             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3850                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3851                 $test -f "$xxx" && eval $libscheck
3852                 $test -f "$xxx" && libstyle=shared
3853             fi
3854             if test ! -f "$xxx"; then
3855                 xxx=$thisdir/lib$thislib.$so
3856                 $test -f "$xxx" && eval $libscheck
3857                 $test -f "$xxx" && libstyle=shared
3858             fi  
3859             if test ! -f "$xxx"; then
3860                 xxx=$thisdir/lib$thislib$_a
3861                 $test -f "$xxx" && eval $libscheck
3862                 $test -f "$xxx" && libstyle=static
3863             fi
3864             if test ! -f "$xxx"; then
3865                 xxx=$thisdir/$thislib$_a
3866                 $test -f "$xxx" && eval $libscheck
3867                 $test -f "$xxx" && libstyle=static
3868             fi
3869             if test ! -f "$xxx"; then
3870                 xxx=$thisdir/lib${thislib}_s$_a
3871                 $test -f "$xxx" && eval $libscheck
3872                 $test -f "$xxx" && libstyle=static
3873                 $test -f "$xxx" && thislib=${thislib}_s
3874             fi
3875             if test ! -f "$xxx"; then
3876                 xxx=$thisdir/Slib$thislib$_a
3877                 $test -f "$xxx" && eval $libscheck
3878                 $test -f "$xxx" && libstyle=static
3879             fi
3880             if $test -f "$xxx"; then
3881                 case "$libstyle" in
3882                 shared) echo "Found -l$thislib (shared)." ;;
3883                 static) echo "Found -l$thislib." ;;
3884                 *)      echo "Found -l$thislib ($libstyle)." ;;
3885                 esac
3886                 case " $dflt " in
3887                 *"-l$thislib "*);;
3888                 *) dflt="$dflt -l$thislib"
3889                    libsfound="$libsfound $xxx"
3890                    yyy=`basename $xxx`
3891                    libsfiles="$libsfiles $yyy"
3892                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3893                    case " $libsdirs " in
3894                    *" $yyy "*) ;;
3895                    *) libsdirs="$libsdirs $yyy" ;;
3896                    esac
3897                    ;;
3898                 esac
3899                 break
3900             fi  
3901         done
3902         if $test ! -f "$xxx"; then
3903             echo "No -l$thislib."
3904         fi
3905 done
3906 set X $dflt
3907 shift
3908 dflt="$*"
3909 case "$libs" in
3910 '') dflt="$dflt";;
3911 *) dflt="$libs";;
3912 esac
3913 case "$dflt" in
3914 ' '|'') dflt='none';;
3915 esac
3916
3917 $cat <<EOM
3918
3919 In order to compile $package on your machine, a number of libraries
3920 are usually needed.  Include any other special libraries here as well.
3921 Say "none" for none.  The default list is almost always right.
3922 EOM
3923
3924 echo " "
3925 rp="What libraries to use?"
3926 . ./myread
3927 case "$ans" in
3928 none) libs=' ';;
3929 *) libs="$ans";;
3930 esac
3931
3932 : determine optimization, if desired, or use for debug flag also
3933 case "$optimize" in
3934 ' '|$undef) dflt='none';;
3935 '') dflt='-O';;
3936 *) dflt="$optimize";;
3937 esac
3938 $cat <<EOH
3939
3940 By default, $package compiles with the -O flag to use the optimizer.
3941 Alternately, you might want to use the symbolic debugger, which uses
3942 the -g flag (on traditional Unix systems).  Either flag can be
3943 specified here.  To use neither flag, specify the word "none".
3944
3945 EOH
3946 rp="What optimizer/debugger flag should be used?"
3947 . ./myread
3948 optimize="$ans"
3949 case "$optimize" in
3950 'none') optimize=" ";;
3951 esac
3952
3953 dflt=''
3954 : We will not override a previous value, but we might want to
3955 : augment a hint file
3956 case "$hint" in
3957 default|recommended)
3958         case "$gccversion" in
3959         1*) dflt='-fpcc-struct-return' ;;
3960         esac
3961         case "$optimize" in
3962         *-g*) dflt="$dflt -DDEBUGGING";;
3963         esac
3964         case "$gccversion" in
3965         2*) if test -d /etc/conf/kconfig.d &&
3966                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3967                 then
3968                         dflt="$dflt -posix"
3969                 fi
3970                 ;;
3971         esac
3972         case "$gccversion" in
3973         1*) ;;
3974         2.[0-8]*) ;;
3975         ?*)     echo " "
3976                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3977                 echo 'int main(void) { return 0; }' > gcctest.c
3978                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3979                         echo "Yes, it does." 2>&1
3980                         case "$ccflags" in
3981                         *strict-aliasing*) 
3982                                 echo "Leaving current flags $ccflags alone." 2>&1
3983                                 ;;
3984                         *) dflt="$dflt -fno-strict-aliasing" ;;
3985                         esac
3986                 else
3987                         echo "Nope, it doesn't, but that's ok." 2>&1
3988                 fi
3989                 ;;
3990         esac
3991         ;;
3992 esac
3993
3994 case "$mips_type" in
3995 *BSD*|'') inclwanted="$locincpth $usrinc";;
3996 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3997 esac
3998 for thisincl in $inclwanted; do
3999         if $test -d $thisincl; then
4000                 if $test x$thisincl != x$usrinc; then
4001                         case "$dflt" in
4002                         *$thisincl*);;
4003                         *) dflt="$dflt -I$thisincl";;
4004                         esac
4005                 fi
4006         fi
4007 done
4008
4009 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4010         xxx=true;
4011 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4012         xxx=true;
4013 else
4014         xxx=false;
4015 fi;
4016 if $xxx; then
4017         case "$dflt" in
4018         *$2*);;
4019         *) dflt="$dflt -D$2";;
4020         esac;
4021 fi'
4022
4023 set signal.h LANGUAGE_C; eval $inctest
4024
4025 case "$usesocks" in
4026 $define)
4027         ccflags="$ccflags -DSOCKS"
4028         ;;
4029 esac
4030
4031 case "$hint" in
4032 default|recommended) dflt="$ccflags $dflt" ;;
4033 *) dflt="$ccflags";;
4034 esac
4035
4036 case "$dflt" in
4037 ''|' ') dflt=none;;
4038 esac
4039 $cat <<EOH
4040
4041 Your C compiler may want other flags.  For this question you should include
4042 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4043 but you should NOT include libraries or ld flags like -lwhatever.  If you
4044 want $package to honor its debug switch, you should include -DDEBUGGING here.
4045 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4046
4047 To use no flags, specify the word "none".
4048
4049 EOH
4050 set X $dflt
4051 shift
4052 dflt=${1+"$@"}
4053 rp="Any additional cc flags?"
4054 . ./myread
4055 case "$ans" in
4056 none) ccflags='';;
4057 *) ccflags="$ans";;
4058 esac
4059
4060 : the following weeds options from ccflags that are of no interest to cpp
4061 cppflags="$ccflags"
4062 case "$gccversion" in
4063 1*) cppflags="$cppflags -D__GNUC__"
4064 esac
4065 case "$mips_type" in
4066 '');;
4067 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4068 esac
4069 case "$cppflags" in
4070 '');;
4071 *)
4072         echo " "
4073         echo "Let me guess what the preprocessor flags are..." >&4
4074         set X $cppflags
4075         shift
4076         cppflags=''
4077         $cat >cpp.c <<'EOM'
4078 #define BLURFL foo
4079
4080 BLURFL xx LFRULB
4081 EOM
4082         previous=''
4083         for flag in $*
4084         do
4085                 case "$flag" in
4086                 -*) ftry="$flag";;
4087                 *) ftry="$previous $flag";;
4088                 esac
4089                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4090                         >cpp1.out 2>/dev/null && \
4091                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4092                         >cpp2.out 2>/dev/null && \
4093                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4094                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4095                 then
4096                         cppflags="$cppflags $ftry"
4097                         previous=''
4098                 else
4099                         previous="$flag"
4100                 fi
4101         done
4102         set X $cppflags
4103         shift
4104         cppflags=${1+"$@"}
4105         case "$cppflags" in
4106         *-*)  echo "They appear to be: $cppflags";;
4107         esac
4108         $rm -f cpp.c cpp?.out
4109         ;;
4110 esac
4111
4112 : flags used in final linking phase
4113 case "$ldflags" in
4114 '') if ./venix; then
4115                 dflt='-i -z'
4116         else
4117                 dflt=''
4118         fi
4119         case "$ccflags" in
4120         *-posix*) dflt="$dflt -posix" ;;
4121         esac
4122         ;;
4123 *) dflt="$ldflags";;
4124 esac
4125
4126 : Try to guess additional flags to pick up local libraries.
4127 for thislibdir in $libpth; do
4128         case " $loclibpth " in
4129         *" $thislibdir "*)
4130                 case "$dflt " in 
4131                 *"-L$thislibdir "*) ;;
4132                 *)  dflt="$dflt -L$thislibdir" ;;
4133                 esac
4134                 ;;
4135         esac
4136 done
4137
4138 case "$dflt" in
4139 '') dflt='none' ;;
4140 esac
4141
4142 $cat <<EOH
4143
4144 Your C linker may need flags.  For this question you should
4145 include -L/whatever and any other flags used by the C linker, but you
4146 should NOT include libraries like -lwhatever.
4147
4148 Make sure you include the appropriate -L/path flags if your C linker
4149 does not normally search all of the directories you specified above,
4150 namely
4151         $libpth
4152 To use no flags, specify the word "none".
4153
4154 EOH
4155
4156 rp="Any additional ld flags (NOT including libraries)?"
4157 . ./myread
4158 case "$ans" in
4159 none) ldflags='';;
4160 *) ldflags="$ans";;
4161 esac
4162 rmlist="$rmlist pdp11"
4163
4164 : coherency check
4165 echo " "
4166 echo "Checking your choice of C compiler and flags for coherency..." >&4
4167 $cat > try.c <<'EOF'
4168 #include <stdio.h>
4169 int main() { printf("Ok\n"); exit(0); }
4170 EOF
4171 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4172 shift
4173 $cat >try.msg <<'EOM'
4174 I've tried to compile and run the following simple program:
4175
4176 EOM
4177 $cat try.c >> try.msg
4178
4179 $cat >> try.msg <<EOM
4180
4181 I used the command:
4182
4183         $*
4184         ./try
4185
4186 and I got the following output:
4187
4188 EOM
4189 dflt=y
4190 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4191         if sh -c './try' >>try.msg 2>&1; then
4192                 xxx=`./try`
4193                 case "$xxx" in
4194                 "Ok") dflt=n ;;
4195                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4196                         case " $libs " in
4197                         *" -lsfio "*)
4198                                 cat >> try.msg <<'EOQS'
4199 If $libs contains -lsfio, and sfio is mis-configured, then it
4200 sometimes (apparently) runs and exits with a 0 status, but with no
4201 output!  It may have to do with sfio's use of _exit vs. exit.
4202
4203 EOQS
4204                                 rp="You have a big problem.  Shall I abort Configure"
4205                                 dflt=y
4206                                 ;;
4207                         esac
4208                         ;;
4209                 esac
4210         else
4211                 echo "The program compiled OK, but exited with status $?." >>try.msg
4212                 rp="You have a problem.  Shall I abort Configure"
4213                 dflt=y
4214         fi
4215 else
4216         echo "I can't compile the test program." >>try.msg
4217         rp="You have a BIG problem.  Shall I abort Configure"
4218         dflt=y
4219 fi
4220 case "$dflt" in
4221 y)
4222         $cat try.msg >&4
4223         case "$knowitall" in
4224         '')
4225                 echo "(The supplied flags or libraries might be incorrect.)"
4226                 ;;
4227         *) dflt=n;;
4228         esac
4229         echo " "
4230         . ./myread
4231         case "$ans" in
4232         n*|N*) ;;
4233         *)      echo "Ok.  Stopping Configure." >&4
4234                 exit 1
4235                 ;;
4236         esac
4237         ;;
4238 n) echo "OK, that should do.";;
4239 esac
4240 $rm -f try try.* core
4241
4242 : define an is-a-typedef? function
4243 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4244 case "$inclist" in
4245 "") inclist="sys/types.h";;
4246 esac;
4247 eval "varval=\$$var";
4248 case "$varval" in
4249 "")
4250         $rm -f temp.c;
4251         for inc in $inclist; do
4252                 echo "#include <$inc>" >>temp.c;
4253         done;
4254         echo "#ifdef $type" >> temp.c;
4255         echo "printf(\"We have $type\");" >> temp.c;
4256         echo "#endif" >> temp.c;
4257         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4258         if $contains $type temp.E >/dev/null 2>&1; then
4259                 eval "$var=\$type";
4260         else
4261                 eval "$var=\$def";
4262         fi;
4263         $rm -f temp.?;;
4264 *) eval "$var=\$varval";;
4265 esac'
4266
4267 : define an is-a-typedef? function that prompts if the type is not available.
4268 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4269 case "$inclist" in
4270 "") inclist="sys/types.h";;
4271 esac;
4272 eval "varval=\$$var";
4273 case "$varval" in
4274 "")
4275         $rm -f temp.c;
4276         for inc in $inclist; do
4277                 echo "#include <$inc>" >>temp.c;
4278         done;
4279         echo "#ifdef $type" >> temp.c;
4280         echo "printf(\"We have $type\");" >> temp.c;
4281         echo "#endif" >> temp.c;
4282         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4283         echo " " ;
4284         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4285         if $contains $type temp.E >/dev/null 2>&1; then
4286                 echo "$type found." >&4;
4287                 eval "$var=\$type";
4288         else
4289                 echo "$type NOT found." >&4;
4290                 dflt="$def";
4291                 . ./myread ;
4292                 eval "$var=\$ans";
4293         fi;
4294         $rm -f temp.?;;
4295 *) eval "$var=\$varval";;
4296 esac'
4297
4298 : define a shorthand compile call
4299 compile='
4300 mc_file=$1;
4301 shift;
4302 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4303 : define a shorthand compile call for compilations that should be ok.
4304 compile_ok='
4305 mc_file=$1;
4306 shift;
4307 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4308
4309 : check for lengths of integral types
4310 echo " "
4311 case "$intsize" in
4312 '')
4313         echo "Checking to see how big your integers are..." >&4
4314         $cat >intsize.c <<'EOCP'
4315 #include <stdio.h>
4316 int main()
4317 {
4318         printf("intsize=%d;\n", (int)sizeof(int));
4319         printf("longsize=%d;\n", (int)sizeof(long));
4320         printf("shortsize=%d;\n", (int)sizeof(short));
4321         exit(0);
4322 }
4323 EOCP
4324         set intsize
4325         if eval $compile_ok && ./intsize > /dev/null; then
4326                 eval `./intsize`
4327                 echo "Your integers are $intsize bytes long."
4328                 echo "Your long integers are $longsize bytes long."
4329                 echo "Your short integers are $shortsize bytes long."
4330         else
4331                 $cat >&4 <<EOM
4332 !
4333 Help! I can't compile and run the intsize test program: please enlighten me!
4334 (This is probably a misconfiguration in your system or libraries, and
4335 you really ought to fix it.  Still, I'll try anyway.)
4336 !
4337 EOM
4338                 dflt=4
4339                 rp="What is the size of an integer (in bytes)?"
4340                 . ./myread
4341                 intsize="$ans"
4342                 dflt=$intsize
4343                 rp="What is the size of a long integer (in bytes)?"
4344                 . ./myread
4345                 longsize="$ans"
4346                 dflt=2
4347                 rp="What is the size of a short integer (in bytes)?"
4348                 . ./myread
4349                 shortsize="$ans"
4350         fi
4351         ;;
4352 esac
4353 $rm -f intsize intsize.*
4354
4355 : see what type lseek is declared as in the kernel
4356 rp="What is the type used for lseek's offset on this system?"
4357 set off_t lseektype long stdio.h sys/types.h
4358 eval $typedef_ask
4359
4360 echo " "
4361 echo "Checking to see how big your file offsets are..." >&4
4362 $cat >try.c <<EOCP
4363 #include <sys/types.h>
4364 #include <stdio.h>
4365 int main()
4366 {
4367     printf("%d\n", (int)sizeof($lseektype));
4368     return(0); 
4369 }
4370 EOCP
4371 set try
4372 if eval $compile_ok; then
4373         lseeksize=`./try`
4374         echo "Your file offsets are $lseeksize bytes long."
4375 else
4376         dflt=$longsize
4377         echo " "
4378         echo "(I can't seem to compile the test program.  Guessing...)"
4379         rp="What is the size of your file offsets (in bytes)?"
4380         . ./myread
4381         lseeksize="$ans"
4382 fi
4383 $rm -f try.c try
4384
4385 : see what type file positions are declared as in the library
4386 rp="What is the type for file position used by fsetpos()?"
4387 set fpos_t fpostype long stdio.h sys/types.h
4388 eval $typedef_ask
4389
4390 echo " "
4391 case "$fpostype" in
4392 *_t) zzz="$fpostype"    ;;
4393 *)   zzz="fpos_t"       ;;
4394 esac
4395 echo "Checking the size of $zzz..." >&4 
4396 cat > try.c <<EOCP
4397 #include <sys/types.h>
4398 #include <stdio.h>
4399 int main() {
4400     printf("%d\n", (int)sizeof($fpostype));
4401     exit(0);
4402 }
4403 EOCP
4404 set try
4405 if eval $compile_ok; then
4406         yyy=`./try`
4407         case "$yyy" in
4408         '')     fpossize=4
4409                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4410                 ;;
4411         *)      fpossize=$yyy
4412                 echo "Your $zzz is $fpossize bytes long."
4413                 ;;
4414         esac
4415 else
4416         dflt="$longsize"
4417         echo " " >&4
4418         echo "(I can't compile the test program.  Guessing...)" >&4
4419         rp="What is the size of your file positions (in bytes)?"
4420         . ./myread
4421         fpossize="$ans"
4422 fi
4423
4424
4425
4426 # Backward compatibility (uselfs is deprecated).
4427 case "$uselfs" in
4428 "$define"|true|[yY]*)
4429         cat <<EOM >&4
4430
4431 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4432 EOM
4433         uselargefiles="$define"
4434         ;;
4435 esac                          
4436
4437 case "$lseeksize:$fpossize" in
4438 8:8) cat <<EOM
4439
4440 You can have files larger than 2 gigabytes.
4441 EOM
4442    val="$define" ;;
4443 *)    case "$uselargefiles" in
4444    "$undef"|false|[nN]*) dflt='n' ;;
4445    *)   dflt='y' ;;
4446    esac
4447    cat <<EOM
4448
4449 Perl can be built to understand large files (files larger than 2 gigabytes)
4450 on some systems.  To do so, Configure can be run with -Duselargefiles.
4451
4452 If this doesn't make any sense to you, just accept the default '$dflt'.
4453 EOM
4454    rp='Try to understand large files, if available?'
4455    . ./myread
4456    case "$ans" in
4457    y|Y)         val="$define" ;;
4458    *)           val="$undef"  ;;
4459    esac
4460    ;;
4461 esac
4462 set uselargefiles
4463 eval $setvar
4464 case "$uselargefiles" in
4465 "$define")
4466 : Look for a hint-file generated 'call-back-unit'.  If the
4467 : user has specified that a large files perl is to be built,
4468 : we may need to set or change some other defaults.
4469         if $test -f uselargefiles.cbu; then
4470                 echo "Your platform has some specific hints for large file builds, using them..."
4471                 . ./uselargefiles.cbu
4472                 echo " "
4473                 echo "Rechecking to see how big your file offsets are..." >&4
4474                 $cat >try.c <<EOCP
4475 #include <sys/types.h>
4476 #include <stdio.h>
4477 int main()
4478 {
4479     printf("%d\n", (int)sizeof($lseektype));
4480     return(0); 
4481 }
4482 EOCP
4483                 set try
4484                 if eval $compile_ok; then
4485                         lseeksize=`./try`
4486                         $echo "Your file offsets are now $lseeksize bytes long."
4487                 else
4488                         dflt="$lseeksize"
4489                         echo " "
4490                         echo "(I can't seem to compile the test program.  Guessing...)"
4491                         rp="What is the size of your file offsets (in bytes)?"
4492                         . ./myread
4493                         lseeksize="$ans"
4494                 fi
4495                 case "$fpostype" in
4496                 *_t) zzz="$fpostype"    ;;
4497                 *)   zzz="fpos_t"       ;;
4498                 esac
4499                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4500                 $cat > try.c <<EOCP
4501 #include <sys/types.h>
4502 #include <stdio.h>
4503 int main() {
4504     printf("%d\n", (int)sizeof($fpostype));
4505     exit(0);
4506 }
4507 EOCP
4508                 set try
4509                 if eval $compile_ok; then
4510                         yyy=`./try`
4511                         dflt="$lseeksize"
4512                         case "$yyy" in
4513                         '')     echo " "
4514                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4515                                 ;;
4516                         *)      fpossize=$yyy
4517                                 echo " $fpossize bytes." >&4
4518                                 ;;
4519                         esac
4520                 else
4521                         dflt="$fpossize"
4522                         echo " "
4523                         echo "(I can't compile the test program.  Guessing...)" >&4
4524                         rp="What is the size of your file positions (in bytes)?"
4525                         . ./myread
4526                         fpossize="$ans"
4527                 fi
4528                 $rm -f try.c try
4529         fi
4530         ;;
4531 esac
4532
4533
4534 case "$usemorebits" in
4535 "$define"|true|[yY]*)
4536         use64bitint="$define"
4537         uselongdouble="$define"
4538         usemorebits="$define"
4539         ;;
4540 *)      usemorebits="$undef"
4541         ;;
4542 esac
4543
4544
4545 case "$uselonglong" in
4546 "$define"|true|[yY]*)
4547         cat <<EOM >&4
4548
4549 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4550 EOM
4551         use64bitint="$define"
4552         ;;
4553 esac                          
4554 case "$use64bits" in
4555 "$define"|true|[yY]*)
4556         cat <<EOM >&4
4557
4558 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4559 EOM
4560         use64bitint="$define"
4561         ;;
4562 esac                          
4563 case "$use64bitints" in
4564 "$define"|true|[yY]*)
4565         cat <<EOM >&4
4566
4567 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4568 EOM
4569         use64bitint="$define"
4570         ;;
4571 esac                          
4572 case "$use64bitsint" in
4573 "$define"|true|[yY]*)
4574         cat <<EOM >&4
4575
4576 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4577 EOM
4578         use64bitint="$define"
4579         ;;
4580 esac                          
4581 case "$uselonglongs" in
4582 "$define"|true|[yY]*)
4583         cat <<EOM >&4
4584
4585 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4586 EOM
4587         use64bitint="$define"
4588         ;;
4589 esac                          
4590 case "$use64bitsall" in
4591 "$define"|true|[yY]*)
4592         cat <<EOM >&4
4593
4594 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4595 EOM
4596         use64bitall="$define"
4597         ;;
4598 esac                          
4599
4600 case "$ccflags" in
4601 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4602 esac
4603 case "$use64bitall" in
4604 "$define"|true|[yY]*) use64bitint="$define" ;;
4605 esac
4606
4607 case "$longsize" in
4608 8) cat <<EOM
4609
4610 You have natively 64-bit long integers.
4611 EOM
4612    val="$define"
4613    ;;
4614 *) case "$use64bitint" in
4615    "$define"|true|[yY]*) dflt='y';;
4616    *) dflt='n';;
4617    esac
4618    cat <<EOM
4619
4620 Perl can be built to take advantage of 64-bit integer types
4621 on some systems.  To do so, Configure can be run with -Duse64bitint.
4622 Choosing this option will most probably introduce binary incompatibilities.
4623
4624 If this doesn't make any sense to you, just accept the default '$dflt'.
4625 EOM
4626    rp='Try to use 64-bit integers, if available?'
4627    . ./myread
4628    case "$ans" in
4629    [yY]*) val="$define" ;;
4630    *)     val="$undef"  ;;
4631    esac
4632    ;;
4633 esac
4634 set use64bitint
4635 eval $setvar
4636
4637 case "$use64bitall" in
4638 "$define"|true|[yY]*) dflt='y' ;;
4639 *) case "$longsize" in
4640    8) dflt='y' ;;
4641    *) dflt='n' ;;
4642    esac
4643    ;;
4644 esac    
4645 cat <<EOM
4646
4647 You may also choose to try maximal 64-bitness.  It means using as much
4648 64-bitness as possible on the platform.  This in turn means even more
4649 binary incompatibilities.  On the other hand, your platform may not
4650 have any more 64-bitness available than what you already have chosen.
4651
4652 If this doesn't make any sense to you, just accept the default '$dflt'.
4653 EOM
4654 rp='Try to use maximal 64-bit support, if available?'
4655 . ./myread
4656 case "$ans" in
4657 [yY]*) val="$define" ;;
4658 *)     val="$undef"  ;;
4659 esac
4660 set use64bitall
4661 eval $setvar
4662 case "$use64bitall" in
4663 "$define")
4664         case "$use64bitint" in
4665         "$undef")
4666                 cat <<EOM
4667
4668 Since you have chosen a maximally 64-bit build, I'm also turning on
4669 the use of 64-bit integers.
4670 EOM
4671                 use64bitint="$define" ;;
4672         esac
4673         ;;
4674 esac
4675
4676 case "$use64bitint" in
4677 "$define"|true|[yY]*)
4678 : Look for a hint-file generated 'call-back-unit'.  If the
4679 : user has specified that a 64-bit perl is to be built,
4680 : we may need to set or change some other defaults.
4681         if $test -f use64bitint.cbu; then
4682                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4683                 . ./use64bitint.cbu
4684         fi
4685         case "$longsize" in
4686         4) case "$archname64" in
4687            '') archname64=64int ;;
4688            esac
4689            ;;
4690         esac
4691         ;;
4692 esac
4693
4694 case "$use64bitall" in
4695 "$define"|true|[yY]*)
4696 : Look for a hint-file generated 'call-back-unit'.  If the
4697 : user has specified that a maximally 64-bit perl is to be built,
4698 : we may need to set or change some other defaults.
4699         if $test -f use64bitall.cbu; then
4700                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4701                 . ./use64bitall.cbu
4702         fi
4703         case "$longsize" in
4704         4) case "$archname64" in
4705            ''|64int) archname64=64all ;;
4706            esac
4707            ;;
4708         esac
4709         ;;
4710 esac
4711
4712 : determine the architecture name
4713 echo " "
4714 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4715         tarch=`arch`"-$osname"
4716 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4717         if uname -m > tmparch 2>&1 ; then
4718                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4719                         -e 's/$/'"-$osname/" tmparch`
4720         else
4721                 tarch="$osname"
4722         fi
4723         $rm -f tmparch
4724 else
4725         tarch="$osname"
4726 fi
4727 case "$myarchname" in
4728 ''|"$tarch") ;;
4729 *)
4730         echo "(Your architecture name used to be $myarchname.)"
4731         archname=''
4732         ;;
4733 esac
4734 myarchname="$tarch"
4735 case "$archname" in
4736 '') dflt="$tarch";;
4737 *) dflt="$archname";;
4738 esac
4739 rp='What is your architecture name'
4740 . ./myread
4741 archname="$ans"
4742 case "$usethreads" in
4743 $define)
4744         echo "Threads selected." >&4
4745         case "$archname" in
4746         *-thread*) echo "...and architecture name already has -thread." >&4
4747                 ;;
4748         *)      archname="$archname-thread"
4749                 echo "...setting architecture name to $archname." >&4
4750                 ;;
4751         esac
4752         ;;
4753 esac
4754 case "$usemultiplicity" in
4755 $define)
4756         echo "Multiplicity selected." >&4
4757         case "$archname" in
4758         *-multi*) echo "...and architecture name already has -multi." >&4
4759                 ;;
4760         *)      archname="$archname-multi"
4761                 echo "...setting architecture name to $archname." >&4
4762                 ;;
4763         esac
4764         ;;
4765 esac
4766 case "$use64bitint" in
4767 $define)
4768         case "$archname64" in
4769         '')
4770                 ;;
4771         *)
4772                 case "$archname" in
4773                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4774                         ;;
4775                 *)      archname="$archname-$archname64"
4776                         echo "...setting architecture name to $archname." >&4
4777                         ;;
4778                 esac
4779                 ;;
4780         esac
4781 esac
4782
4783 : determine root of directory hierarchy where package will be installed.
4784 case "$prefix" in
4785 '')
4786         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4787         ;;
4788 *)
4789         dflt="$prefix"
4790         ;;
4791 esac
4792 $cat <<EOM
4793
4794 By default, $package will be installed in $dflt/bin, manual pages
4795 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4796 installation directories. Typically this is something like /usr/local.
4797 If you wish to have binaries under /usr/bin but other parts of the
4798 installation under /usr/local, that's ok: you will be prompted
4799 separately for each of the installation directories, the prefix being
4800 only used to set the defaults.
4801
4802 EOM
4803 fn=d~
4804 rp='Installation prefix to use?'
4805 . ./getfile
4806 oldprefix=''
4807 case "$prefix" in
4808 '') ;;
4809 *)
4810         case "$ans" in
4811         "$prefix") ;;
4812         *) oldprefix="$prefix";;
4813         esac
4814         ;;
4815 esac
4816 prefix="$ans"
4817 prefixexp="$ansexp"
4818
4819 : is AFS running?
4820 echo " "
4821 case "$afs" in
4822 $define|true)   afs=true ;;
4823 $undef|false)   afs=false ;;
4824 *)      if test -d /afs; then
4825                 afs=true
4826         else
4827                 afs=false
4828         fi
4829         ;;
4830 esac
4831 if $afs; then
4832         echo "AFS may be running... I'll be extra cautious then..." >&4
4833 else
4834         echo "AFS does not seem to be running..." >&4
4835 fi
4836
4837 : determine installation prefix for where package is to be installed.
4838 if $afs; then 
4839 $cat <<EOM
4840
4841 Since you are running AFS, I need to distinguish the directory in which
4842 files will reside from the directory in which they are installed (and from
4843 which they are presumably copied to the former directory by occult means).
4844
4845 EOM
4846         case "$installprefix" in
4847         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4848         *) dflt="$installprefix";;
4849         esac
4850 else
4851 $cat <<EOM
4852
4853 In some special cases, particularly when building $package for distribution,
4854 it is convenient to distinguish between the directory in which files should 
4855 be installed from the directory ($prefix) in which they 
4856 will eventually reside.  For most users, these two directories are the same.
4857
4858 EOM
4859         case "$installprefix" in
4860         '') dflt=$prefix ;;
4861         *) dflt=$installprefix;;
4862         esac
4863 fi
4864 fn=d~
4865 rp='What installation prefix should I use for installing files?'
4866 . ./getfile
4867 installprefix="$ans"
4868 installprefixexp="$ansexp"
4869
4870 : set the prefixit variable, to compute a suitable default value
4871 prefixit='case "$3" in
4872 ""|none)
4873         case "$oldprefix" in
4874         "") eval "$1=\"\$$2\"";;
4875         *)
4876                 case "$3" in
4877                 "") eval "$1=";;
4878                 none)
4879                         eval "tp=\"\$$2\"";
4880                         case "$tp" in
4881                         ""|" ") eval "$1=\"\$$2\"";;
4882                         *) eval "$1=";;
4883                         esac;;
4884                 esac;;
4885         esac;;
4886 *)
4887         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4888         case "$tp" in
4889         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4890         /*-$oldprefix/*|\~*-$oldprefix/*)
4891                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4892         *) eval "$1=\"\$$2\"";;
4893         esac;;
4894 esac'
4895
4896
4897 : get the patchlevel
4898 echo " "
4899 echo "Getting the current patchlevel..." >&4
4900 if $test -r $rsrc/patchlevel.h;then
4901         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4902         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4903         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4904         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4905         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4906         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4907 else
4908         revision=0
4909         patchlevel=0
4910         subversion=0
4911         api_revision=0
4912         api_version=0
4913         api_subversion=0
4914 fi
4915 $echo $n "(You have $package revision $revision" $c
4916 $echo $n " patchlevel $patchlevel" $c
4917 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4918 echo ".)"
4919 case "$osname" in
4920 dos|vms)
4921         : XXX Should be a Configure test for double-dots in filenames.
4922         version=`echo $revision $patchlevel $subversion | \
4923                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4924         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4925                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4926         ;;
4927 *)
4928         version=`echo $revision $patchlevel $subversion | \
4929                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4930         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4931                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4932         ;;
4933 esac
4934 : Special case the 5.005_xx maintenance series, which used 5.005
4935 : without any subversion label as a subdirectory in $sitelib
4936 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4937         api_versionstring='5.005'
4938 fi
4939
4940 : determine installation style
4941 : For now, try to deduce it from prefix unless it is already set.
4942 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4943 case "$installstyle" in
4944 '')     case "$prefix" in
4945                 *perl*) dflt='lib';;
4946                 *) dflt='lib/perl5' ;;
4947         esac
4948         ;;
4949 *)      dflt="$installstyle" ;;
4950 esac
4951 : Probably not worth prompting for this since we prompt for all
4952 : the directories individually, and the prompt would be too long and
4953 : confusing anyway.
4954 installstyle=$dflt
4955
4956 : determine where private library files go
4957 : Usual default is /usr/local/lib/perl5/$version.
4958 : Also allow things like /opt/perl/lib/$version, since 
4959 : /opt/perl/lib/perl5... would be redundant.
4960 : The default "style" setting is made in installstyle.U
4961 case "$installstyle" in
4962 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4963 *)       set dflt privlib lib/$version ;;
4964 esac
4965 eval $prefixit
4966 $cat <<EOM
4967
4968 There are some auxiliary files for $package that need to be put into a
4969 private library directory that is accessible by everyone.
4970
4971 EOM
4972 fn=d~+
4973 rp='Pathname where the private library files will reside?'
4974 . ./getfile
4975 privlib="$ans"
4976 privlibexp="$ansexp"
4977 : Change installation prefix, if necessary.
4978 if $test X"$prefix" != X"$installprefix"; then
4979         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4980 else
4981         installprivlib="$privlibexp"
4982 fi
4983
4984 : set the prefixup variable, to restore leading tilda escape
4985 prefixup='case "$prefixexp" in
4986 "$prefix") ;;
4987 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4988 esac'
4989
4990 : determine where public architecture dependent libraries go
4991 set archlib archlib
4992 eval $prefixit
4993 : privlib default is /usr/local/lib/$package/$version
4994 : archlib default is /usr/local/lib/$package/$version/$archname
4995 : privlib may have an optional trailing /share.
4996 tdflt=`echo $privlib | $sed 's,/share$,,'`
4997 tdflt=$tdflt/$archname
4998 case "$archlib" in
4999 '')     dflt=$tdflt
5000         ;;
5001 *)      dflt="$archlib"
5002     ;;
5003 esac
5004 $cat <<EOM
5005
5006 $spackage contains architecture-dependent library files.  If you are
5007 sharing libraries in a heterogeneous environment, you might store
5008 these files in a separate location.  Otherwise, you can just include
5009 them with the rest of the public library files.
5010
5011 EOM
5012 fn=d+~
5013 rp='Where do you want to put the public architecture-dependent libraries?'
5014 . ./getfile
5015 archlib="$ans"
5016 archlibexp="$ansexp"
5017 if $test X"$archlib" = X"$privlib"; then
5018         d_archlib="$undef"
5019 else
5020         d_archlib="$define"
5021 fi
5022 : Change installation prefix, if necessary.
5023 if $test X"$prefix" != X"$installprefix"; then
5024         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5025 else
5026         installarchlib="$archlibexp"
5027 fi
5028
5029
5030 : Binary compatibility with 5.005 is not possible for builds
5031 : with advanced features
5032 case "$usethreads$usemultiplicity" in
5033 *define*)
5034         bincompat5005="$undef"
5035         d_bincompat5005="$undef"
5036         ;;
5037 *)      $cat <<EOM
5038
5039 This version of Perl can be compiled for binary compatibility with 5.005.
5040 If you decide to do so, you will be able to continue using most of the
5041 extensions that were compiled for Perl 5.005.
5042
5043 EOM
5044         case "$bincompat5005$d_bincompat5005" in
5045         *"$undef"*) dflt=n ;;
5046         *) dflt=y ;;
5047         esac
5048         rp='Binary compatibility with Perl 5.005?'
5049         . ./myread
5050         case "$ans" in
5051         y*) val="$define" ;;
5052         *)  val="$undef" ;;
5053         esac
5054         set d_bincompat5005
5055         eval $setvar
5056         case "$d_bincompat5005" in
5057         "$define")
5058                 bincompat5005="$define"
5059                 ;;
5060         *)      bincompat5005="$undef"
5061                 d_bincompat5005="$undef"
5062                 ;;
5063         esac
5064         ;;
5065 esac
5066
5067
5068 : see if setuid scripts can be secure
5069 $cat <<EOM
5070
5071 Some kernels have a bug that prevents setuid #! scripts from being
5072 secure.  Some sites have disabled setuid #! scripts because of this.
5073
5074 First let's decide if your kernel supports secure setuid #! scripts.
5075 (If setuid #! scripts would be secure but have been disabled anyway,
5076 don't say that they are secure if asked.)
5077
5078 EOM
5079
5080 val="$undef"
5081 if $test -d /dev/fd; then
5082         echo "#!$ls" >reflect
5083         chmod +x,u+s reflect
5084         ./reflect >flect 2>&1
5085         if $contains "/dev/fd" flect >/dev/null; then
5086                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5087                 val="$define"
5088         else
5089                 $cat <<EOM
5090 If you are not sure if they are secure, I can check but I'll need a
5091 username and password different from the one you are using right now.
5092 If you don't have such a username or don't want me to test, simply
5093 enter 'none'.
5094
5095 EOM
5096                 rp='Other username to test security of setuid scripts with?'
5097                 dflt='none'
5098                 . ./myread
5099                 case "$ans" in
5100                 n|none)
5101                         case "$d_suidsafe" in
5102                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5103                                 dflt=n;;
5104                         "$undef")
5105                                 echo "Well, the $hint value is *not* secure." >&4
5106                                 dflt=n;;
5107                         *)      echo "Well, the $hint value *is* secure." >&4
5108                                 dflt=y;;
5109                         esac
5110                         ;;
5111                 *)
5112                         $rm -f reflect flect
5113                         echo "#!$ls" >reflect
5114                         chmod +x,u+s reflect
5115                         echo >flect
5116                         chmod a+w flect
5117                         echo '"su" will (probably) prompt you for '"$ans's password."
5118                         su $ans -c './reflect >flect'
5119                         if $contains "/dev/fd" flect >/dev/null; then
5120                                 echo "Okay, it looks like setuid scripts are secure." >&4
5121                                 dflt=y
5122                         else
5123                                 echo "I don't think setuid scripts are secure." >&4
5124                                 dflt=n
5125                         fi
5126                         ;;
5127                 esac
5128                 rp='Does your kernel have *secure* setuid scripts?'
5129                 . ./myread
5130                 case "$ans" in
5131                 [yY]*)  val="$define";;
5132                 *)      val="$undef";;
5133                 esac
5134         fi
5135 else
5136         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5137         echo "(That's for file descriptors, not floppy disks.)"
5138         val="$undef"
5139 fi
5140 set d_suidsafe
5141 eval $setvar
5142
5143 $rm -f reflect flect
5144
5145 : now see if they want to do setuid emulation
5146 echo " "
5147 val="$undef"
5148 case "$d_suidsafe" in
5149 "$define")
5150         val="$undef"
5151         echo "No need to emulate SUID scripts since they are secure here." >& 4
5152         ;;
5153 *)
5154         $cat <<EOM
5155 Some systems have disabled setuid scripts, especially systems where
5156 setuid scripts cannot be secure.  On systems where setuid scripts have
5157 been disabled, the setuid/setgid bits on scripts are currently
5158 useless.  It is possible for $package to detect those bits and emulate
5159 setuid/setgid in a secure fashion.  This emulation will only work if
5160 setuid scripts have been disabled in your kernel.
5161
5162 EOM
5163         case "$d_dosuid" in
5164         "$define") dflt=y ;;
5165         *) dflt=n ;;
5166         esac
5167         rp="Do you want to do setuid/setgid emulation?"
5168         . ./myread
5169         case "$ans" in
5170         [yY]*)  val="$define";;
5171         *)      val="$undef";;
5172         esac
5173         ;;
5174 esac
5175 set d_dosuid
5176 eval $setvar
5177
5178 : determine filename position in cpp output
5179 echo " "
5180 echo "Computing filename position in cpp output for #include directives..." >&4
5181 echo '#include <stdio.h>' > foo.c
5182 $cat >fieldn <<EOF
5183 $startsh
5184 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5185 $grep '^[       ]*#.*stdio\.h' | \
5186 while read cline; do
5187         pos=1
5188         set \$cline
5189         while $test \$# -gt 0; do
5190                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5191                         echo "\$pos"
5192                         exit 0
5193                 fi
5194                 shift
5195                 pos=\`expr \$pos + 1\`
5196         done
5197 done
5198 EOF
5199 chmod +x fieldn
5200 fieldn=`./fieldn`
5201 $rm -f foo.c fieldn
5202 case $fieldn in
5203 '') pos='???';;
5204 1) pos=first;;
5205 2) pos=second;;
5206 3) pos=third;;
5207 *) pos="${fieldn}th";;
5208 esac
5209 echo "Your cpp writes the filename in the $pos field of the line."
5210
5211 : locate header file
5212 $cat >findhdr <<EOF
5213 $startsh
5214 wanted=\$1
5215 name=''
5216 for usrincdir in $usrinc
5217 do
5218         if test -f \$usrincdir/\$wanted; then
5219                 echo "\$usrincdir/\$wanted"
5220                 exit 0
5221         fi
5222 done
5223 awkprg='{ print \$$fieldn }'
5224 echo "#include <\$wanted>" > foo\$\$.c
5225 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5226 $grep "^[       ]*#.*\$wanted" | \
5227 while read cline; do
5228         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5229         case "\$name" in
5230         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5231         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5232         *) exit 2;;
5233         esac;
5234 done;
5235 #
5236 # status = 0: grep returned 0 lines, case statement not executed
5237 # status = 1: headerfile found
5238 # status = 2: while loop executed, no headerfile found
5239 #
5240 status=\$?
5241 $rm -f foo\$\$.c;
5242 if test \$status -eq 1; then
5243         exit 0;
5244 fi
5245 exit 1
5246 EOF
5247 chmod +x findhdr
5248
5249 : define an alternate in-header-list? function
5250 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5251 cont=true; xxf="echo \"<\$1> found.\" >&4";
5252 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5253 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5254 esac;
5255 case $# in 4) instead=instead;; *) instead="at last";; esac;
5256 while $test "$cont"; do
5257         xxx=`./findhdr $1`
5258         var=$2; eval "was=\$$2";
5259         if $test "$xxx" && $test -r "$xxx";
5260         then eval $xxf;
5261         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5262                 cont="";
5263         else eval $xxnf;
5264         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5265         set $yyy; shift; shift; yyy=$@;
5266         case $# in 0) cont="";;
5267         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5268                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5269         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5270                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5271         esac;
5272 done;
5273 while $test "$yyy";
5274 do set $yyy; var=$2; eval "was=\$$2";
5275         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5276         set $yyy; shift; shift; yyy=$@;
5277 done'
5278
5279 : see if this is a malloc.h system
5280 set malloc.h i_malloc
5281 eval $inhdr
5282
5283 : see if stdlib is available
5284 set stdlib.h i_stdlib
5285 eval $inhdr
5286
5287 : determine which malloc to compile in
5288 echo " "
5289 case "$usemymalloc" in
5290 ''|[yY]*|true|$define)  dflt='y' ;;
5291 *)      dflt='n' ;;
5292 esac
5293 rp="Do you wish to attempt to use the malloc that comes with $package?"
5294 . ./myread
5295 usemymalloc="$ans"
5296 case "$ans" in
5297 y*|true)
5298         usemymalloc='y'
5299         mallocsrc='malloc.c'
5300         mallocobj="malloc$_o"
5301         d_mymalloc="$define"
5302         case "$libs" in
5303         *-lmalloc*)
5304                 : Remove malloc from list of libraries to use
5305                 echo "Removing unneeded -lmalloc from library list" >&4
5306                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5307                 shift
5308                 libs="$*"
5309                 echo "libs = $libs" >&4
5310                 ;;
5311         esac
5312         ;;
5313 *)
5314         usemymalloc='n'
5315         mallocsrc=''
5316         mallocobj=''
5317         d_mymalloc="$undef"
5318         ;;
5319 esac
5320
5321 : compute the return types of malloc and free
5322 echo " "
5323 $cat >malloc.c <<END
5324 #$i_malloc I_MALLOC
5325 #$i_stdlib I_STDLIB
5326 #include <stdio.h>
5327 #include <sys/types.h>
5328 #ifdef I_MALLOC
5329 #include <malloc.h>
5330 #endif
5331 #ifdef I_STDLIB
5332 #include <stdlib.h>
5333 #endif
5334 #ifdef TRY_MALLOC
5335 void *malloc();
5336 #endif
5337 #ifdef TRY_FREE
5338 void free();
5339 #endif
5340 END
5341 case "$malloctype" in
5342 '')
5343         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5344                 malloctype='void *'
5345         else
5346                 malloctype='char *'
5347         fi
5348         ;;
5349 esac
5350 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5351
5352 case "$freetype" in
5353 '')
5354         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5355                 freetype='void'
5356         else
5357                 freetype='int'
5358         fi
5359         ;;
5360 esac
5361 echo "Your system uses $freetype free(), it would seem." >&4
5362 $rm -f malloc.[co]
5363 $cat <<EOM
5364
5365 After $package is installed, you may wish to install various
5366 add-on modules and utilities.  Typically, these add-ons will
5367 be installed under $prefix with the rest
5368 of this package.  However, you may wish to install such add-ons
5369 elsewhere under a different prefix.
5370
5371 If you do not wish to put everything under a single prefix, that's
5372 ok.  You will be prompted for the individual locations; this siteprefix
5373 is only used to suggest the defaults.
5374
5375 The default should be fine for most people.
5376
5377 EOM
5378 fn=d~+
5379 rp='Installation prefix to use for add-on modules and utilities?'
5380 : XXX Here might be another good place for an installstyle setting.
5381 case "$siteprefix" in
5382 '') dflt=$prefix ;;
5383 *)  dflt=$siteprefix ;;
5384 esac
5385 . ./getfile
5386 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5387 oldsiteprefix=''
5388 case "$siteprefix" in
5389 '') ;;
5390 *)      case "$ans" in
5391         "$prefix") ;;
5392         *) oldsiteprefix="$prefix";;
5393         esac
5394         ;;
5395 esac
5396 siteprefix="$ans"
5397 siteprefixexp="$ansexp"
5398
5399 : determine where site specific libraries go.
5400 : Usual default is /usr/local/lib/perl5/site_perl/$version
5401 : The default "style" setting is made in installstyle.U
5402 : XXX No longer works with Prefixit stuff.
5403 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5404 case "$sitelib" in
5405 '') case "$installstyle" in
5406         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5407         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5408         esac
5409         ;;
5410 *)      dflt="$sitelib"
5411         ;;
5412 esac
5413 $cat <<EOM
5414
5415 The installation process will create a directory for
5416 site-specific extensions and modules.  Most users find it convenient
5417 to place all site-specific files in this directory rather than in the
5418 main distribution directory.
5419
5420 EOM
5421 fn=d~+
5422 rp='Pathname for the site-specific library files?'
5423 . ./getfile
5424 sitelib="$ans"
5425 sitelibexp="$ansexp"
5426 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5427 : Change installation prefix, if necessary.
5428 if $test X"$prefix" != X"$installprefix"; then
5429         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5430 else
5431         installsitelib="$sitelibexp"
5432 fi
5433
5434 : determine where site specific architecture-dependent libraries go.
5435 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5436 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5437 : sitelib may have an optional trailing /share.
5438 case "$sitearch" in
5439 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5440         dflt="$dflt/$archname"
5441         ;;
5442 *)      dflt="$sitearch"
5443         ;;
5444 esac
5445 set sitearch sitearch none
5446 eval $prefixit
5447 $cat <<EOM
5448
5449 The installation process will also create a directory for
5450 architecture-dependent site-specific extensions and modules.
5451
5452 EOM
5453 fn=d~+
5454 rp='Pathname for the site-specific architecture-dependent library files?'
5455 . ./getfile
5456 sitearch="$ans"
5457 sitearchexp="$ansexp"
5458 : Change installation prefix, if necessary.
5459 if $test X"$prefix" != X"$installprefix"; then
5460         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5461 else
5462         installsitearch="$sitearchexp"
5463 fi
5464
5465 $cat <<EOM
5466
5467 The installation process will also create a directory for
5468 vendor-supplied add-ons.  Vendors who supply perl with their system
5469 may find it convenient to place all vendor-supplied files in this
5470 directory rather than in the main distribution directory.  This will
5471 ease upgrades between binary-compatible maintenance versions of perl.
5472
5473 Of course you may also use these directories in whatever way you see
5474 fit.  For example, you might use them to access modules shared over a
5475 company-wide network.
5476
5477 The default answer should be fine for most people.
5478 This causes further questions about vendor add-ons to be skipped
5479 and no vendor-specific directories will be configured for perl.
5480
5481 EOM
5482 rp='Do you want to configure vendor-specific add-on directories?'
5483 case "$usevendorprefix" in
5484 define|true|[yY]*) dflt=y ;;
5485 *)      : User may have set vendorprefix directly on Configure command line.
5486         case "$vendorprefix" in
5487         ''|' ') dflt=n ;;
5488         *)      dflt=y ;;
5489         esac
5490         ;;
5491 esac
5492 . ./myread
5493 case "$ans" in
5494 [yY]*)  fn=d~+
5495         rp='Installation prefix to use for vendor-supplied add-ons?'
5496         case "$vendorprefix" in
5497         '') dflt='' ;;
5498         *)  dflt=$vendorprefix ;;
5499         esac
5500         . ./getfile
5501         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5502         oldvendorprefix=''
5503         case "$vendorprefix" in
5504         '') ;;
5505         *)      case "$ans" in
5506                 "$prefix") ;;
5507                 *) oldvendorprefix="$prefix";;
5508                 esac
5509                 ;;
5510         esac
5511         usevendorprefix="$define"
5512         vendorprefix="$ans"
5513         vendorprefixexp="$ansexp"
5514         ;;
5515 *)      usevendorprefix="$undef"
5516         vendorprefix=''
5517         vendorprefixexp=''
5518         ;;
5519 esac
5520
5521 case "$vendorprefix" in
5522 '')     d_vendorlib="$undef"
5523         vendorlib=''
5524         vendorlibexp=''
5525         ;;
5526 *)      d_vendorlib="$define"
5527         : determine where vendor-supplied modules go.
5528         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5529         case "$vendorlib" in
5530         '')
5531                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5532                 case "$installstyle" in
5533                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5534                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5535                 esac
5536                 ;;
5537         *)      dflt="$vendorlib"
5538                 ;;
5539         esac
5540         fn=d~+
5541         rp='Pathname for the vendor-supplied library files?'
5542         . ./getfile
5543         vendorlib="$ans"
5544         vendorlibexp="$ansexp"
5545         ;;
5546 esac
5547 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5548 : Change installation prefix, if necessary.
5549 if $test X"$prefix" != X"$installprefix"; then
5550         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5551 else
5552         installvendorlib="$vendorlibexp"
5553 fi
5554
5555 case "$vendorprefix" in
5556 '')     d_vendorarch="$undef"
5557         vendorarch=''
5558         vendorarchexp=''
5559         ;;
5560 *)      d_vendorarch="$define"
5561         : determine where vendor-supplied architecture-dependent libraries go.
5562         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5563         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5564         : vendorlib may have an optional trailing /share.
5565         case "$vendorarch" in
5566         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5567                 dflt="$dflt/$archname"
5568                 ;;
5569         *)      dflt="$vendorarch" ;;
5570         esac
5571         fn=d~+
5572         rp='Pathname for vendor-supplied architecture-dependent files?'
5573         . ./getfile
5574         vendorarch="$ans"
5575         vendorarchexp="$ansexp"
5576         ;;
5577 esac
5578 : Change installation prefix, if necessary.
5579 if $test X"$prefix" != X"$installprefix"; then
5580         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5581 else
5582         installvendorarch="$vendorarchexp"
5583 fi
5584
5585 : Final catch-all directories to search
5586 $cat <<EOM
5587
5588 Lastly, you can have perl look in other directories for extensions and
5589 modules in addition to those already specified.
5590 These directories will be searched after 
5591         $sitearch 
5592         $sitelib 
5593 EOM
5594 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5595 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5596 echo ' '
5597 case "$otherlibdirs" in
5598 ''|' ') dflt='none' ;;
5599 *)      dflt="$otherlibdirs" ;;
5600 esac
5601 $cat <<EOM
5602 Enter a colon-separated set of extra paths to include in perl's @INC
5603 search path, or enter 'none' for no extra paths.
5604
5605 EOM
5606
5607 rp='Colon-separated list of additional directories for perl to search?'
5608 . ./myread
5609 case "$ans" in
5610 ' '|''|none)    otherlibdirs=' ' ;;     
5611 *)      otherlibdirs="$ans" ;;
5612 esac
5613 case "$otherlibdirs" in
5614 ' ') val=$undef ;;
5615 *)      val=$define ;;
5616 esac
5617 set d_perl_otherlibdirs
5618 eval $setvar
5619
5620 : Cruising for prototypes
5621 echo " "
5622 echo "Checking out function prototypes..." >&4
5623 $cat >prototype.c <<'EOCP'
5624 int main(int argc, char *argv[]) {
5625         exit(0);}
5626 EOCP
5627 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5628         echo "Your C compiler appears to support function prototypes."
5629         val="$define"
5630 else
5631         echo "Your C compiler doesn't seem to understand function prototypes."
5632         val="$undef"
5633 fi
5634 set prototype
5635 eval $setvar
5636 $rm -f prototype*
5637
5638 case "$prototype" in
5639 "$define") ;;
5640 *)      ansi2knr='ansi2knr'
5641         echo " "
5642         cat <<EOM >&4
5643
5644 $me:  FATAL ERROR:
5645 This version of $package can only be compiled by a compiler that 
5646 understands function prototypes.  Unfortunately, your C compiler 
5647         $cc $ccflags
5648 doesn't seem to understand them.  Sorry about that.
5649
5650 If GNU cc is available for your system, perhaps you could try that instead.  
5651
5652 Eventually, we hope to support building Perl with pre-ANSI compilers.
5653 If you would like to help in that effort, please contact <perlbug@perl.org>.
5654
5655 Aborting Configure now.
5656 EOM
5657         exit 2
5658         ;;
5659 esac
5660
5661 : determine where public executables go
5662 echo " "
5663 set dflt bin bin
5664 eval $prefixit
5665 fn=d~
5666 rp='Pathname where the public executables will reside?'
5667 . ./getfile
5668 if $test "X$ansexp" != "X$binexp"; then
5669         installbin=''
5670 fi
5671 bin="$ans"
5672 binexp="$ansexp"
5673 : Change installation prefix, if necessary.
5674 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5675 if $test X"$prefix" != X"$installprefix"; then
5676         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5677 else
5678         installbin="$binexp"
5679 fi
5680
5681 : Find perl5.005 or later.
5682 echo "Looking for a previously installed perl5.005 or later... "
5683 case "$perl5" in
5684 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5685                 : Check if this perl is recent and can load a simple module
5686                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5687                         perl5=$tdir/perl
5688                         break;
5689                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5690                         perl5=$tdir/perl
5691                         break;
5692                 fi
5693         done
5694         ;;
5695 *)      perl5="$perl5"
5696         ;;
5697 esac
5698 case "$perl5" in
5699 '')     echo "None found.  That's ok.";;
5700 *)      echo "Using $perl5." ;;
5701 esac
5702
5703 : Determine list of previous versions to include in @INC
5704 $cat > getverlist <<EOPL
5705 #!$perl5 -w
5706 use File::Basename;
5707 \$api_versionstring = "$api_versionstring";
5708 \$version = "$version";
5709 \$stem = "$sitelib_stem";
5710 \$archname = "$archname";
5711 EOPL
5712         $cat >> getverlist <<'EOPL'
5713 # Can't have leading @ because metaconfig interprets it as a command!
5714 ;@inc_version_list=();
5715 # XXX Redo to do opendir/readdir? 
5716 if (-d $stem) {
5717     chdir($stem);
5718     ;@candidates = glob("5.*");
5719 }
5720 else {
5721     ;@candidates = ();
5722 }
5723
5724 # XXX ToDo:  These comparisons must be reworked when two-digit
5725 # subversions come along, so that 5.7.10 compares as greater than
5726 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5727 # widespread that we can use the built-in version vectors rather
5728 # than reinventing them here.  For 5.6.0, however, we must
5729 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5730 foreach $d (@candidates) {
5731     if ($d lt $version) {
5732         if ($d ge $api_versionstring) {
5733             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5734         }
5735         elsif ($d ge "5.005") {
5736             unshift(@inc_version_list, grep { -d } $d);
5737         }
5738     }
5739     else {
5740         # Skip newer version.  I.e. don't look in
5741         # 5.7.0 if we're installing 5.6.1.
5742     }
5743 }
5744
5745 if (@inc_version_list) {
5746     print join(' ', @inc_version_list);
5747 }
5748 else {
5749     # Blank space to preserve value for next Configure run.
5750     print " ";
5751 }
5752 EOPL
5753 chmod +x getverlist
5754 case "$inc_version_list" in
5755 '')     if test -x "$perl5"; then
5756                 dflt=`$perl5 getverlist`
5757         else
5758                 dflt='none'
5759         fi
5760         ;;
5761 $undef) dflt='none' ;;
5762 *)  dflt="$inc_version_list" ;;
5763 esac
5764 case "$dflt" in
5765 ''|' ') dflt=none ;;
5766 esac
5767 $cat <<'EOM'
5768
5769 In order to ease the process of upgrading, this version of perl 
5770 can be configured to use modules built and installed with earlier 
5771 versions of perl that were installed under $prefix.  Specify here
5772 the list of earlier versions that this version of perl should check.
5773 If Configure detected no earlier versions of perl installed under
5774 $prefix, then the list will be empty.  Answer 'none' to tell perl
5775 to not search earlier versions.
5776
5777 The default should almost always be sensible, so if you're not sure,
5778 just accept the default.
5779 EOM
5780
5781 rp='List of earlier versions to include in @INC?'
5782 . ./myread
5783 case "$ans" in
5784 [Nn]one|''|' ') inc_version_list=' ' ;;
5785 *) inc_version_list="$ans" ;;
5786 esac
5787 case "$inc_version_list" in
5788 ''|' ') 
5789         inc_version_list_init='0';;
5790 *)      inc_version_list_init=`echo $inc_version_list |
5791                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5792         ;;
5793 esac
5794 $rm -f getverlist
5795
5796 : determine whether to install perl also as /usr/bin/perl
5797
5798 echo " "
5799 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5800         $cat <<EOM
5801 Many scripts expect perl to be installed as /usr/bin/perl.
5802 I can install the perl you are about to compile also as /usr/bin/perl
5803 (in addition to $installbin/perl).
5804 EOM
5805         case "$installusrbinperl" in
5806         "$undef"|[nN]*) dflt='n';;
5807         *)              dflt='y';;
5808         esac
5809         rp="Do you want to install perl as /usr/bin/perl?"
5810         . ./myread
5811         case "$ans" in
5812         [yY]*)  val="$define";;
5813         *)      val="$undef" ;;
5814         esac
5815 else
5816         val="$undef"
5817 fi
5818 set installusrbinperl
5819 eval $setvar
5820
5821 echo " "
5822 echo "Checking for GNU C Library..." >&4
5823 cat >gnulibc.c <<EOM
5824 #include <stdio.h>
5825 int main()
5826 {
5827 #ifdef __GLIBC__
5828     exit(0);
5829 #else
5830     exit(1);
5831 #endif
5832 }
5833 EOM
5834 set gnulibc
5835 if eval $compile_ok && ./gnulibc; then
5836         val="$define"
5837         echo "You are using the GNU C Library"
5838 else
5839         val="$undef"
5840         echo "You are not using the GNU C Library"
5841 fi
5842 $rm -f gnulibc*
5843 set d_gnulibc
5844 eval $setvar
5845
5846 : see if nm is to be used to determine whether a symbol is defined or not
5847 case "$usenm" in
5848 '')
5849         dflt=''
5850         case "$d_gnulibc" in
5851         "$define")
5852                 echo " "
5853                 echo "nm probably won't work on the GNU C Library." >&4
5854                 dflt=n
5855                 ;;
5856         esac
5857         case "$dflt" in
5858         '') 
5859                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5860                         echo " "
5861                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5862                         echo "'nm' won't be sufficient on this sytem." >&4
5863                         dflt=n
5864                 fi
5865                 ;;
5866         esac
5867         case "$dflt" in
5868         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5869                 if $test $dflt -gt 20; then
5870                         dflt=y
5871                 else
5872                         dflt=n
5873                 fi
5874                 ;;
5875         esac
5876         ;;
5877 *)
5878         case "$usenm" in
5879         true|$define) dflt=y;;
5880         *) dflt=n;;
5881         esac
5882         ;;
5883 esac
5884 $cat <<EOM
5885
5886 I can use $nm to extract the symbols from your C libraries. This
5887 is a time consuming task which may generate huge output on the disk (up
5888 to 3 megabytes) but that should make the symbols extraction faster. The
5889 alternative is to skip the 'nm' extraction part and to compile a small
5890 test program instead to determine whether each symbol is present. If
5891 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5892 this may be the best solution.
5893
5894 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5895
5896 EOM
5897 rp="Shall I use $nm to extract C symbols from the libraries?"
5898 . ./myread
5899 case "$ans" in
5900 [Nn]*) usenm=false;;
5901 *) usenm=true;;
5902 esac
5903
5904 runnm=$usenm
5905 case "$reuseval" in
5906 true) runnm=false;;
5907 esac
5908
5909 : nm options which may be necessary
5910 case "$nm_opt" in
5911 '') if $test -f /mach_boot; then
5912                 nm_opt=''       # Mach
5913         elif $test -d /usr/ccs/lib; then
5914                 nm_opt='-p'     # Solaris (and SunOS?)
5915         elif $test -f /dgux; then
5916                 nm_opt='-p'     # DG-UX
5917         elif $test -f /lib64/rld; then
5918                 nm_opt='-p'     # 64-bit Irix
5919         else
5920                 nm_opt=''
5921         fi;;
5922 esac
5923
5924 : nm options which may be necessary for shared libraries but illegal
5925 : for archive libraries.  Thank you, Linux.
5926 case "$nm_so_opt" in
5927 '')     case "$myuname" in
5928         *linux*)
5929                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5930                         nm_so_opt='--dynamic'
5931                 fi
5932                 ;;
5933         esac
5934         ;;
5935 esac
5936
5937 case "$runnm" in
5938 true)
5939 : get list of predefined functions in a handy place
5940 echo " "
5941 case "$libc" in
5942 '') libc=unknown
5943         case "$libs" in
5944         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5945         esac
5946         ;;
5947 esac
5948 libnames='';
5949 case "$libs" in
5950 '') ;;
5951 *)  for thislib in $libs; do
5952         case "$thislib" in
5953         -lc|-lc_s)
5954                 : Handle C library specially below.
5955                 ;;
5956         -l*)
5957                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5958                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5959                         :
5960                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5961                         :
5962                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5963                         :
5964                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5965                         :
5966                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5967                         :
5968                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5969                         :
5970                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5971                         :
5972                 else
5973                         try=''
5974                 fi
5975                 libnames="$libnames $try"
5976                 ;;
5977         *) libnames="$libnames $thislib" ;;
5978         esac
5979         done
5980         ;;
5981 esac
5982 xxx=normal
5983 case "$libc" in
5984 unknown)
5985         set /lib/libc.$so
5986         for xxx in $libpth; do
5987                 $test -r $1 || set $xxx/libc.$so
5988                 : The messy sed command sorts on library version numbers.
5989                 $test -r $1 || \
5990                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5991                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5992                                 h
5993                                 s/[0-9][0-9]*/0000&/g
5994                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5995                                 G
5996                                 s/\n/ /' | \
5997                          sort | $sed -e 's/^.* //'`
5998                 eval set \$$#
5999         done
6000         $test -r $1 || set /usr/ccs/lib/libc.$so
6001         $test -r $1 || set /lib/libsys_s$_a
6002         ;;
6003 *)
6004         set blurfl
6005         ;;
6006 esac
6007 if $test -r "$1"; then
6008         echo "Your (shared) C library seems to be in $1."
6009         libc="$1"
6010 elif $test -r /lib/libc && $test -r /lib/clib; then
6011         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6012         xxx=apollo
6013         libc='/lib/clib /lib/libc'
6014         if $test -r /lib/syslib; then
6015                 echo "(Your math library is in /lib/syslib.)"
6016                 libc="$libc /lib/syslib"
6017         fi
6018 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6019         echo "Your C library seems to be in $libc, as you said before."
6020 elif $test -r $incpath/usr/lib/libc$_a; then
6021         libc=$incpath/usr/lib/libc$_a;
6022         echo "Your C library seems to be in $libc.  That's fine."
6023 elif $test -r /lib/libc$_a; then
6024         libc=/lib/libc$_a;
6025         echo "Your C library seems to be in $libc.  You're normal."
6026 else
6027         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6028                 :
6029         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6030                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6031         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6032                 :
6033         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6034                 :
6035         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6036                 :
6037         else
6038                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6039         fi
6040         if $test -r "$tans"; then
6041                 echo "Your C library seems to be in $tans, of all places."
6042                 libc=$tans
6043         else
6044                 libc='blurfl'
6045         fi
6046 fi
6047 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6048         dflt="$libc"
6049         cat <<EOM
6050
6051 If the guess above is wrong (which it might be if you're using a strange
6052 compiler, or your machine supports multiple models), you can override it here.
6053
6054 EOM
6055 else
6056         dflt=''
6057         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
6058         cat >&4 <<EOM
6059 I can't seem to find your C library.  I've looked in the following places:
6060
6061 EOM
6062         $sed 's/^/      /' libpath
6063         cat <<EOM
6064
6065 None of these seems to contain your C library. I need to get its name...
6066
6067 EOM
6068 fi
6069 fn=f
6070 rp='Where is your C library?'
6071 . ./getfile
6072 libc="$ans"
6073
6074 echo " "
6075 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
6076 set X `cat libnames`
6077 shift
6078 xxx=files
6079 case $# in 1) xxx=file; esac
6080 echo "Extracting names from the following $xxx for later perusal:" >&4
6081 echo " "
6082 $sed 's/^/      /' libnames >&4
6083 echo " "
6084 $echo $n "This may take a while...$c" >&4
6085
6086 for file in $*; do
6087         case $file in
6088         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6089         *) $nm $nm_opt $file 2>/dev/null;;
6090         esac
6091 done >libc.tmp
6092
6093 $echo $n ".$c"
6094 $grep fprintf libc.tmp > libc.ptf
6095 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6096 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
6097 xxx='[ADTSIW]'
6098 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
6099         eval $xscan;\
6100         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6101                 eval $xrun
6102 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6103         eval $xscan;\
6104         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6105                 eval $xrun
6106 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6107         eval $xscan;\
6108         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6109                 eval $xrun
6110 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6111         eval $xscan;\
6112         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6113                 eval $xrun
6114 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6115         eval $xscan;\
6116         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6117                 eval $xrun
6118 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6119         eval $xscan;\
6120         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6121                 eval $xrun
6122 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6123                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6124         eval $xscan;\
6125         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6126                 eval $xrun
6127 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6128         eval $xscan;\
6129         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6130                 eval $xrun
6131 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6132         eval $xscan;\
6133         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6134                 eval $xrun
6135 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6136         eval $xscan;\
6137         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6138                 eval $xrun
6139 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6140         eval $xscan;\
6141         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6142                 eval $xrun
6143 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6144         eval $xscan;\
6145         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6146                 eval $xrun
6147 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6148         eval $xscan;\
6149         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6150                 eval $xrun
6151 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6152         eval $xscan;\
6153         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6154                 eval $xrun
6155 else
6156         $nm -p $* 2>/dev/null >libc.tmp
6157         $grep fprintf libc.tmp > libc.ptf
6158         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6159                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6160         then
6161                 nm_opt='-p'
6162                 eval $xrun
6163         else
6164                 echo " "
6165                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6166                 com=''
6167                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6168                         for thisname in $libnames $libc; do
6169                                 $ar t $thisname >>libc.tmp
6170                         done
6171                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6172                         echo "Ok." >&4
6173                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6174                         # Repeat libc to extract forwarders to DLL entries too
6175                         for thisname in $libnames $libc; do
6176                                 $ar tv $thisname >>libc.tmp
6177                                 # Revision 50 of EMX has bug in $ar.
6178                                 # it will not extract forwarders to DLL entries
6179                                 # Use emximp which will extract exactly them.
6180                                 emximp -o tmp.imp $thisname \
6181                                     2>/dev/null && \
6182                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6183                                     < tmp.imp >>libc.tmp
6184                                 $rm tmp.imp
6185                         done
6186                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6187                         echo "Ok." >&4
6188                 else
6189                         echo "$ar didn't seem to work right." >&4
6190                         echo "Maybe this is a Cray...trying bld instead..." >&4
6191                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6192                         then
6193                                 for thisname in $libnames; do
6194                                         bld t $libnames | \
6195                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6196                                         $ar t $thisname >>libc.tmp
6197                                 done
6198                                 echo "Ok." >&4
6199                         else
6200                                 echo "That didn't work either.  Giving up." >&4
6201                                 exit 1
6202                         fi
6203                 fi
6204         fi
6205 fi
6206 nm_extract="$com"
6207 if $test -f /lib/syscalls.exp; then
6208         echo " "
6209         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6210         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6211 fi
6212 ;;
6213 esac
6214 $rm -f libnames libpath
6215
6216 : see if dld is available
6217 set dld.h i_dld
6218 eval $inhdr
6219
6220 : is a C symbol defined?
6221 csym='tlook=$1;
6222 case "$3" in
6223 -v) tf=libc.tmp; tc=""; tdc="";;
6224 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6225 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6226 esac;
6227 tx=yes;
6228 case "$reuseval-$4" in
6229 true-) ;;
6230 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6231 esac;
6232 case "$tx" in
6233 yes)
6234         case "$runnm" in
6235         true)
6236                 if $contains $tlook $tf >/dev/null 2>&1;
6237                 then tval=true;
6238                 else tval=false;
6239                 fi;;
6240         *)
6241                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6242                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6243                 then tval=true;
6244                 else tval=false;
6245                 fi;
6246                 $rm -f t t.c;;
6247         esac;;
6248 *)
6249         case "$tval" in
6250         $define) tval=true;;
6251         *) tval=false;;
6252         esac;;
6253 esac;
6254 eval "$2=$tval"'
6255
6256 : define an is-in-libc? function
6257 inlibc='echo " "; td=$define; tu=$undef;
6258 sym=$1; var=$2; eval "was=\$$2";
6259 tx=yes;
6260 case "$reuseval$was" in
6261 true) ;;
6262 true*) tx=no;;
6263 esac;
6264 case "$tx" in
6265 yes)
6266         set $sym tres -f;
6267         eval $csym;
6268         case "$tres" in
6269         true)
6270                 echo "$sym() found." >&4;
6271                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6272         *)
6273                 echo "$sym() NOT found." >&4;
6274                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6275         esac;;
6276 *)
6277         case "$was" in
6278         $define) echo "$sym() found." >&4;;
6279         *) echo "$sym() NOT found." >&4;;
6280         esac;;
6281 esac'
6282
6283 : see if dlopen exists
6284 xxx_runnm="$runnm"
6285 runnm=false
6286 set dlopen d_dlopen
6287 eval $inlibc
6288 runnm="$xxx_runnm"
6289
6290 : determine which dynamic loading, if any, to compile in
6291 echo " "
6292 dldir="ext/DynaLoader"
6293 case "$usedl" in
6294 $define|y|true)
6295         dflt='y'
6296         usedl="$define"
6297         ;;
6298 $undef|n|false)
6299         dflt='n'
6300         usedl="$undef"
6301         ;;
6302 *) 
6303         dflt='n'
6304         case "$d_dlopen" in
6305             $define) dflt='y' ;;
6306         esac
6307         case "$i_dld" in
6308             $define) dflt='y' ;;
6309         esac
6310         : Does a dl_xxx.xs file exist for this operating system
6311         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6312         ;;
6313 esac
6314 rp="Do you wish to use dynamic loading?"
6315 . ./myread
6316 usedl="$ans"
6317 case "$ans" in
6318 y*) usedl="$define"
6319         case "$dlsrc" in
6320         '')
6321                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6322                         dflt="$dldir/dl_${osname}.xs"
6323                 elif $test "$d_dlopen" = "$define" ; then
6324                         dflt="$dldir/dl_dlopen.xs"
6325                 elif $test "$i_dld" = "$define" ; then
6326                         dflt="$dldir/dl_dld.xs"
6327                 else
6328                         dflt=''
6329                 fi
6330                 ;;
6331         *)      dflt="$dldir/$dlsrc"
6332                 ;;
6333         esac
6334     echo "The following dynamic loading files are available:"
6335         : Can not go over to $dldir because getfile has path hard-coded in.
6336         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6337         rp="Source file to use for dynamic loading"
6338         fn="fne"
6339         gfpth="$src"
6340         . ./getfile
6341         usedl="$define"
6342         : emulate basename
6343         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6344
6345         $cat << EOM
6346
6347 Some systems may require passing special flags to $cc -c to
6348 compile modules that will be used to create a shared library.
6349 To use no flags, say "none".
6350
6351 EOM
6352     case "$cccdlflags" in
6353     '') case "$gccversion" in
6354                 '') case "$osname" in
6355                         hpux)   dflt='+z' ;;
6356                         next)   dflt='none' ;;
6357                         irix*)  dflt='-KPIC' ;;
6358                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6359                         sunos)  dflt='-pic' ;;
6360                         *)      dflt='none' ;;
6361                     esac
6362                         ;;
6363                 *)  case "$osname" in
6364                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6365                         *)      dflt='-fpic' ;;
6366                     esac ;;
6367             esac ;;
6368         ' ') dflt='none' ;;
6369     *)  dflt="$cccdlflags" ;;
6370     esac
6371     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6372     . ./myread
6373     case "$ans" in
6374     none) cccdlflags=' ' ;;
6375     *) cccdlflags="$ans" ;;
6376     esac
6377
6378     cat << EOM
6379
6380 Some systems use ld to create libraries that can be dynamically loaded,
6381 while other systems (such as those using ELF) use $cc.
6382
6383 EOM
6384         case "$ld" in
6385         '')     $cat >try.c <<'EOM'
6386 /* Test for whether ELF binaries are produced */
6387 #include <fcntl.h>
6388 #include <stdlib.h>
6389 int main() {
6390         char b[4];
6391         int i = open("a.out",O_RDONLY);
6392         if(i == -1) 
6393                 exit(1); /* fail */
6394         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6395                 exit(0); /* succeed (yes, it's ELF) */
6396         else
6397                 exit(1); /* fail */
6398 }
6399 EOM
6400                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6401                         cat <<EOM
6402 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6403 EOM
6404                         dflt="$cc"
6405                 else
6406                         echo "I'll use ld to build dynamic libraries."
6407                         dflt='ld'
6408                 fi
6409                 rm -f try.c a.out
6410                 ;;
6411         *)      dflt="$ld"
6412                 ;;
6413         esac
6414
6415     rp="What command should be used to create dynamic libraries?"
6416     . ./myread
6417         ld="$ans"
6418
6419     cat << EOM
6420
6421 Some systems may require passing special flags to $ld to create a
6422 library that can be dynamically loaded.  If your ld flags include
6423 -L/other/path options to locate libraries outside your loader's normal
6424 search path, you may need to specify those -L options here as well.  To
6425 use no flags, say "none".
6426
6427 EOM
6428     case "$lddlflags" in
6429     '') case "$osname" in
6430                         beos) dflt='-nostart' ;;
6431                         hpux) dflt='-b';
6432                               case "$gccversion" in
6433                               '') dflt="$dflt +vnocompatwarnings" ;;
6434                               esac
6435                               ;;        
6436                         linux|irix*)    dflt='-shared' ;;
6437                         next)  dflt='none' ;;
6438                         solaris) dflt='-G' ;;
6439                         sunos) dflt='-assert nodefinitions' ;;
6440                         svr4*|esix*) dflt="-G $ldflags" ;;
6441                 *)     dflt='none' ;;
6442                         esac
6443                         ;;
6444     *) dflt="$lddlflags" ;;
6445     esac
6446
6447         : Try to guess additional flags to pick up local libraries.
6448         : Be careful not to append to a plain 'none'
6449         case "$dflt" in
6450         none) dflt='' ;;
6451         esac
6452         for thisflag in $ldflags; do
6453                 case "$thisflag" in
6454                 -L*)
6455                         case " $dflt " in
6456                         *" $thisflag "*) ;;
6457                         *) dflt="$dflt $thisflag" ;;
6458                         esac
6459                         ;;
6460                 esac
6461         done
6462
6463         case "$dflt" in
6464         ''|' ') dflt='none' ;;
6465         esac
6466
6467     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6468     . ./myread
6469     case "$ans" in
6470     none) lddlflags=' ' ;;
6471     *) lddlflags="$ans" ;;
6472     esac
6473
6474         cat <<EOM
6475
6476 Some systems may require passing special flags to $cc to indicate that
6477 the resulting executable will use dynamic linking.  To use no flags,
6478 say "none".
6479
6480 EOM
6481     case "$ccdlflags" in
6482     '') case "$osname" in
6483                 hpux)   dflt='-Wl,-E' ;;
6484                 linux)  dflt='-rdynamic' ;;
6485                 next)   dflt='none' ;;
6486                 sunos)  dflt='none' ;;
6487                 *)      dflt='none' ;;
6488             esac ;;
6489     ' ')  dflt='none' ;;
6490     *)  dflt="$ccdlflags" ;;
6491     esac
6492     rp="Any special flags to pass to $cc to use dynamic linking?"
6493     . ./myread
6494     case "$ans" in
6495     none) ccdlflags=' ' ;;
6496     *) ccdlflags="$ans" ;;
6497     esac
6498     ;;
6499 *)  usedl="$undef"
6500         ld='ld'
6501     dlsrc='dl_none.xs'
6502     lddlflags=''
6503     ccdlflags=''
6504     ;;
6505 esac
6506
6507 also=''
6508 case "$usedl" in
6509 $undef)
6510         # No dynamic loading being used, so don't bother even to prompt.
6511         useshrplib='false'
6512         ;;
6513 *)      case "$useshrplib" in
6514         '')     case "$osname" in
6515                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6516                         dflt=y
6517                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6518                         ;;
6519                 next*)
6520                         case "$osvers" in
6521                         4*)     dflt=y
6522                                 also='Building a shared libperl is needed for MAB support.'
6523                                 ;;
6524                         *)      dflt=n
6525                                 ;;
6526                         esac
6527                         ;;
6528                 *)      dflt=n
6529                         ;;
6530                 esac
6531                 ;;
6532         $define|true|[Yy]*)
6533                 dflt=y
6534                 ;;
6535         *)      dflt=n
6536                 ;;
6537         esac
6538         $cat << EOM
6539
6540 The perl executable is normally obtained by linking perlmain.c with
6541 libperl${_a}, any static extensions (usually just DynaLoader), and
6542 any other libraries needed on this system (such as -lm, etc.).  Since
6543 your system supports dynamic loading, it is probably possible to build
6544 a shared libperl.$so.  If you will have more than one executable linked
6545 to libperl.$so, this will significantly reduce the size of each
6546 executable, but it may have a noticeable affect on performance.  The
6547 default is probably sensible for your system.
6548 $also
6549
6550 EOM
6551         rp="Build a shared libperl.$so (y/n)"
6552         . ./myread
6553         case "$ans" in
6554         true|$define|[Yy]*)
6555                 useshrplib='true'  ;;
6556         *)      useshrplib='false' ;;
6557         esac
6558         ;;
6559 esac
6560
6561 case "$useshrplib" in
6562 true)
6563         case "$libperl" in
6564         '')
6565                 # Figure out a good name for libperl.so.  Since it gets stored in
6566                 # a version-specific architecture-dependent library, the version
6567                 # number isn't really that important, except for making cc/ld happy.
6568                 #
6569                 # A name such as libperl.so.3.1
6570                 majmin="libperl.$so.$patchlevel.$subversion"
6571                 # A name such as libperl.so.301
6572                 majonly=`echo $patchlevel $subversion |
6573                         $awk '{printf "%d%02d", $1, $2}'`
6574                 majonly=libperl.$so.$majonly
6575                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6576                 # rely on figuring it out from the naming of libc.
6577                 case "${osname}${osvers}" in
6578                 next4*)
6579                         dflt=libperl.5.$so
6580                         # XXX How handle the --version stuff for MAB?
6581                         ;;
6582                 linux*)  # ld won't link with a bare -lperl otherwise.
6583                         dflt=libperl.$so
6584                         ;;
6585                 cygwin*) # include version
6586                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6587                         ;;
6588                 *)      # Try to guess based on whether libc has major.minor.
6589                         case "$libc" in
6590                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6591                         *libc.$so.[0-9]*) dflt=$majonly ;;
6592                         *)      dflt=libperl.$so ;;
6593                         esac
6594                         ;;
6595                 esac
6596                 ;;
6597         *)      dflt=$libperl
6598                 ;;
6599         esac
6600         cat << EOM
6601
6602 I need to select a good name for the shared libperl.  If your system uses
6603 library names with major and minor numbers, then you might want something
6604 like $majmin.  Alternatively, if your system uses a single version
6605 number for shared libraries, then you might want to use $majonly.
6606 Or, your system might be quite happy with a simple libperl.$so.
6607
6608 Since the shared libperl will get installed into a version-specific
6609 architecture-dependent directory, the version number of the shared perl
6610 library probably isn't important, so the default should be o.k.
6611
6612 EOM
6613         rp='What name do you want to give to the shared libperl?'
6614         . ./myread
6615         libperl=$ans
6616         echo "Ok, I'll use $libperl"
6617         ;;
6618 *)
6619         libperl="libperl${_a}"
6620         ;;
6621 esac
6622
6623 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6624 case "$shrpdir" in
6625 '') ;;
6626 *)      $cat >&4 <<EOM
6627 WARNING:  Use of the shrpdir variable for the installation location of
6628 the shared $libperl is not supported.  It was never documented and
6629 will not work in this version.  Let me (perlbug@perl.com)
6630 know of any problems this may cause.
6631
6632 EOM
6633         case "$shrpdir" in
6634         "$archlibexp/CORE")
6635                 $cat >&4 <<EOM
6636 But your current setting of $shrpdir is
6637 the default anyway, so it's harmless.
6638 EOM
6639                 ;;
6640         *)
6641                 $cat >&4 <<EOM
6642 Further, your current attempted setting of $shrpdir
6643 conflicts with the value of $archlibexp/CORE
6644 that installperl will use.
6645 EOM
6646                 ;;
6647         esac
6648         ;;
6649 esac
6650
6651 # How will the perl executable find the installed shared $libperl?
6652 # Add $xxx to ccdlflags.
6653 # If we can't figure out a command-line option, use $shrpenv to
6654 # set env LD_RUN_PATH.  The main perl makefile uses this.
6655 shrpdir=$archlibexp/CORE
6656 xxx=''
6657 tmp_shrpenv=''
6658 if "$useshrplib"; then
6659     case "$osname" in 
6660         aix)
6661                 # We'll set it in Makefile.SH...
6662                 ;;
6663         solaris|netbsd)
6664                 xxx="-R $shrpdir"
6665                 ;;
6666         freebsd)
6667                 xxx="-Wl,-R$shrpdir"
6668                 ;;
6669         linux|irix*|dec_osf)
6670                 xxx="-Wl,-rpath,$shrpdir"
6671                 ;;
6672         next)
6673                 # next doesn't like the default...
6674                 ;;
6675         beos)
6676                 # beos doesn't like the default, either.
6677                 ;;
6678         hpux*)
6679                 # hpux doesn't like the default, either.
6680                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6681                 ;;
6682         *)
6683                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6684                 ;;
6685         esac
6686         case "$xxx" in
6687         '') ;;
6688         *)      
6689                 # Only add $xxx if it isn't already in ccdlflags.
6690                 case " $ccdlflags " in
6691                 *" $xxx "*)     ;;
6692                 *)      ccdlflags="$ccdlflags $xxx"
6693                         cat <<EOM >&4
6694
6695 Adding $xxx to the flags
6696 passed to $ld so that the perl executable will find the 
6697 installed shared $libperl.
6698
6699 EOM
6700                         ;;
6701                 esac
6702                 ;;
6703         esac
6704 fi
6705 # Fix ccdlflags in AIX for building external extensions.
6706 # (For building Perl itself bare -bE:perl.exp is needed,
6707 #  Makefile.SH takes care of this.)
6708 case "$osname" in
6709 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6710 esac
6711 # Respect a hint or command-line value.
6712 case "$shrpenv" in
6713 '') shrpenv="$tmp_shrpenv" ;;
6714 esac
6715 case "$ldlibpthname" in
6716 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6717 none)   ldlibpthname='' ;;
6718 esac
6719
6720 : determine where manual pages go
6721 set man1dir man1dir none
6722 eval $prefixit
6723 $cat <<EOM
6724
6725 $spackage has manual pages available in source form.
6726 EOM
6727 case "$nroff" in
6728 nroff)
6729         echo "However, you don't have nroff, so they're probably useless to you."
6730         case "$man1dir" in
6731         '') man1dir="none";;
6732         esac;;
6733 esac
6734 echo "If you don't want the manual sources installed, answer 'none'."
6735 case "$man1dir" in
6736 ' ') dflt=none
6737         ;;
6738 '')
6739         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6740         lookpath="$lookpath $prefixexp/man/p_man/man1"
6741         lookpath="$lookpath $prefixexp/man/u_man/man1"
6742         lookpath="$lookpath $prefixexp/man/man.1"
6743         case "$sysman" in
6744         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6745         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6746         esac
6747         set dflt
6748         eval $prefixup
6749         ;;
6750 *)  dflt="$man1dir"
6751         ;;
6752 esac
6753 echo " "
6754 fn=dn+~
6755 rp="Where do the main $spackage manual pages (source) go?"
6756 . ./getfile
6757 if $test "X$man1direxp" != "X$ansexp"; then
6758         installman1dir=''
6759 fi
6760 man1dir="$ans"
6761 man1direxp="$ansexp"
6762 case "$man1dir" in
6763 '')     man1dir=' '
6764         installman1dir='';;
6765 esac
6766
6767 : Change installation prefix, if necessary.
6768 if $test X"$prefix" != X"$installprefix"; then
6769         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6770 else
6771         installman1dir="$man1direxp"
6772 fi
6773
6774 : What suffix to use on installed man pages
6775
6776 case "$man1dir" in
6777 ' ')
6778         man1ext='0'
6779         ;;
6780 *)
6781         rp="What suffix should be used for the main $spackage man pages?"
6782         case "$man1ext" in
6783         '')     case "$man1dir" in
6784                 *1)  dflt=1 ;;
6785                 *1p) dflt=1p ;;
6786                 *1pm) dflt=1pm ;;
6787                 *l) dflt=l;;
6788                 *n) dflt=n;;
6789                 *o) dflt=o;;
6790                 *p) dflt=p;;
6791                 *C) dflt=C;;
6792                 *L) dflt=L;;
6793                 *L1) dflt=L1;;
6794                 *) dflt=1;;
6795                 esac
6796                 ;;
6797         *)      dflt="$man1ext";;
6798         esac
6799         . ./myread
6800         man1ext="$ans"
6801         ;;
6802 esac
6803
6804 : see if we can have long filenames
6805 echo " "
6806 first=123456789abcdef
6807 $rm -f $first
6808 if (echo hi >$first) 2>/dev/null; then
6809         if $test -f 123456789abcde; then
6810                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6811                 val="$undef"
6812         else
6813                 echo 'You can have filenames longer than 14 characters.'>&4
6814                 val="$define"
6815         fi
6816 else
6817         $cat <<'EOM'
6818 You can't have filenames longer than 14 chars.
6819 You can't even think about them!
6820 EOM
6821         val="$undef"
6822 fi 
6823 set d_flexfnam
6824 eval $setvar
6825 $rm -rf 123456789abcde*
6826
6827 : determine where library module manual pages go
6828 set man3dir man3dir none
6829 eval $prefixit
6830 $cat <<EOM
6831
6832 $spackage has manual pages for many of the library modules.
6833 EOM
6834
6835 case "$nroff" in
6836 nroff)
6837         $cat <<'EOM'
6838 However, you don't have nroff, so they're probably useless to you.
6839 EOM
6840         case "$man3dir" in
6841         '') man3dir="none";;
6842         esac;;
6843 esac
6844
6845 case "$d_flexfnam" in
6846 undef)
6847         $cat <<'EOM'
6848 However, your system can't handle the long file names like File::Basename.3. 
6849 EOM
6850         case "$man3dir" in
6851         '') man3dir="none";;
6852         esac;;
6853 esac
6854
6855 echo "If you don't want the manual sources installed, answer 'none'."
6856 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6857 case "$man3dir" in
6858 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6859         if $test -d "$privlib/man/man3"; then
6860                 cat <<EOM >&4
6861
6862 WARNING:  Previous versions of perl installed man3 pages into
6863 $privlib/man/man3.  This version will suggest a 
6864 new default of $dflt.  
6865 EOM
6866                 tdflt=$dflt
6867                 dflt='n'
6868                 rp='Do you wish to preserve the old behavior?(y/n)'
6869                 . ./myread
6870                 case "$ans" in
6871                 y*) dflt="$privlib/man/man3" ;;
6872                 *)  dflt=$tdflt ;;
6873                 esac
6874     fi
6875         ;;
6876 *)      dflt="$man3dir" ;;
6877 esac
6878 case "$dflt" in
6879 ' ') dflt=none ;;
6880 esac
6881 echo " "
6882 fn=dn+~
6883 rp="Where do the $package library man pages (source) go?"
6884 . ./getfile
6885 man3dir="$ans"
6886 man3direxp="$ansexp"
6887 case "$man3dir" in
6888 '')     man3dir=' '
6889         installman3dir='';;
6890 esac
6891
6892 : Change installation prefix, if necessary.
6893 if $test X"$prefix" != X"$installprefix"; then
6894         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6895 else
6896         installman3dir="$man3direxp"
6897 fi
6898
6899 : What suffix to use on installed man pages
6900 case "$man3dir" in
6901 ' ')
6902         man3ext='0'
6903         ;;
6904 *)
6905         rp="What suffix should be used for the $package library man pages?"
6906         case "$man3ext" in
6907         '')     case "$man3dir" in
6908                 *3)  dflt=3 ;;
6909                 *3p) dflt=3p ;;
6910                 *3pm) dflt=3pm ;;
6911                 *l) dflt=l;;
6912                 *n) dflt=n;;
6913                 *o) dflt=o;;
6914                 *p) dflt=p;;
6915                 *C) dflt=C;;
6916                 *L) dflt=L;;
6917                 *L3) dflt=L3;;
6918                 *) dflt=3;;
6919                 esac
6920                 ;;
6921         *)      dflt="$man3ext";;
6922         esac
6923         . ./myread
6924         man3ext="$ans"
6925         ;;
6926 esac
6927
6928 : see if we have to deal with yellow pages, now NIS.
6929 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6930         if $test -f /usr/etc/nibindd; then
6931                 echo " "
6932                 echo "I'm fairly confident you're on a NeXT."
6933                 echo " "
6934                 rp='Do you get the hosts file via NetInfo?'
6935                 dflt=y
6936                 case "$hostcat" in
6937                 nidump*) ;;
6938                 '') ;;
6939                 *) dflt=n;;
6940                 esac
6941                 . ./myread
6942                 case "$ans" in
6943                 y*) hostcat='nidump hosts .';;
6944                 *)      case "$hostcat" in
6945                         nidump*) hostcat='';;
6946                         esac
6947                         ;;
6948                 esac
6949         fi
6950         case "$hostcat" in
6951         nidump*) ;;
6952         *)
6953                 case "$hostcat" in
6954                 *ypcat*) dflt=y;;
6955                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6956                                 dflt=y
6957                         else
6958                                 dflt=n
6959                         fi;;
6960                 *) dflt=n;;
6961                 esac
6962                 echo " "
6963                 rp='Are you getting the hosts file via yellow pages?'
6964                 . ./myread
6965                 case "$ans" in
6966                 y*) hostcat='ypcat hosts';;
6967                 *) hostcat='cat /etc/hosts';;
6968                 esac
6969                 ;;
6970         esac
6971 fi
6972 case "$hostcat" in
6973 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6974 esac
6975 case "$groupcat" in
6976 '') test -f /etc/group && groupcat='cat /etc/group';;
6977 esac
6978 case "$passcat" in
6979 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6980 esac
6981
6982 : now get the host name
6983 echo " "
6984 echo "Figuring out host name..." >&4
6985 case "$myhostname" in
6986 '') cont=true
6987         echo 'Maybe "hostname" will work...'
6988         if tans=`sh -c hostname 2>&1` ; then
6989                 myhostname=$tans
6990                 phostname=hostname
6991                 cont=''
6992         fi
6993         ;;
6994 *) cont='';;
6995 esac
6996 if $test "$cont"; then
6997         if ./xenix; then
6998                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6999                 if tans=`cat /etc/systemid 2>&1` ; then
7000                         myhostname=$tans
7001                         phostname='cat /etc/systemid'
7002                         echo "Whadyaknow.  Xenix always was a bit strange..."
7003                         cont=''
7004                 fi
7005         elif $test -r /etc/systemid; then
7006                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7007         fi
7008 fi
7009 if $test "$cont"; then
7010         echo 'No, maybe "uuname -l" will work...'
7011         if tans=`sh -c 'uuname -l' 2>&1` ; then
7012                 myhostname=$tans
7013                 phostname='uuname -l'
7014         else
7015                 echo 'Strange.  Maybe "uname -n" will work...'
7016                 if tans=`sh -c 'uname -n' 2>&1` ; then
7017                         myhostname=$tans
7018                         phostname='uname -n'
7019                 else
7020                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7021                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7022                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7023                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7024                         else
7025                                 case "$myhostname" in
7026                                 '') echo "Does this machine have an identity crisis or something?"
7027                                         phostname='';;
7028                                 *)
7029                                         echo "Well, you said $myhostname before..."
7030                                         phostname='echo $myhostname';;
7031                                 esac
7032                         fi
7033                 fi
7034         fi
7035 fi
7036 : you do not want to know about this
7037 set $myhostname
7038 myhostname=$1
7039
7040 : verify guess
7041 if $test "$myhostname" ; then
7042         dflt=y
7043         rp='Your host name appears to be "'$myhostname'".'" Right?"
7044         . ./myread
7045         case "$ans" in
7046         y*) ;;
7047         *) myhostname='';;
7048         esac
7049 fi
7050
7051 : bad guess or no guess
7052 while $test "X$myhostname" = X ; do
7053         dflt=''
7054         rp="Please type the (one word) name of your host:"
7055         . ./myread
7056         myhostname="$ans"
7057 done
7058
7059 : translate upper to lower if necessary
7060 case "$myhostname" in
7061 *[A-Z]*)
7062         echo "(Normalizing case in your host name)"
7063         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7064         ;;
7065 esac
7066
7067 case "$myhostname" in
7068 *.*)
7069         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7070         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7071         echo "(Trimming domain name from host name--host name is now $myhostname)"
7072         ;;
7073 *) case "$mydomain" in
7074         '')
7075                 {
7076                         test "X$hostcat" = "Xypcat hosts" &&
7077                         ypmatch "$myhostname" hosts 2>/dev/null |\
7078                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7079                         $test -s hosts
7080                 } || {
7081                         test "X$hostcat" != "X" &&
7082                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7083                                         /[       ]$myhostname[  . ]/p" > hosts
7084                 }
7085                 tmp_re="[       . ]"
7086                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7087                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7088                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7089                         hosts | $sort | $uniq | \
7090                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7091                 case `$echo X$dflt` in
7092                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7093                         dflt=.
7094                         ;;
7095                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7096                         ;;
7097                 esac
7098                 case "$dflt" in
7099                 .)
7100                         tans=`./loc resolv.conf X /etc /usr/etc`
7101                         if $test -f "$tans"; then
7102                                 echo "(Attempting domain name extraction from $tans)"
7103                                 dflt=.`$sed -n -e 's/   / /g' \
7104                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7105                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7106                                 case "$dflt" in
7107                                 .) dflt=.`$sed -n -e 's/        / /g' \
7108                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7109                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7110                                         ;;
7111                                 esac
7112                         fi
7113                         ;;
7114                 esac
7115                 case "$dflt" in
7116                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7117                         dflt=.`sh -c domainname 2>/dev/null`
7118                         case "$dflt" in
7119                         '') dflt='.';;
7120                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7121                         esac
7122                         ;;
7123                 esac
7124                 case "$dflt" in
7125                 .) echo "(Lost all hope -- silly guess then)"
7126                         dflt='.uucp'
7127                         ;;
7128                 esac
7129                 $rm -f hosts
7130                 ;;
7131         *) dflt="$mydomain";;
7132         esac;;
7133 esac
7134 echo " "
7135 rp="What is your domain name?"
7136 . ./myread
7137 tans="$ans"
7138 case "$ans" in
7139 '') ;;
7140 .*) ;;
7141 *) tans=".$tans";;
7142 esac
7143 mydomain="$tans"
7144
7145 : translate upper to lower if necessary
7146 case "$mydomain" in
7147 *[A-Z]*)
7148         echo "(Normalizing case in your domain name)"
7149         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7150         ;;
7151 esac
7152
7153 : a little sanity check here
7154 case "$phostname" in
7155 '') ;;
7156 *)
7157         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7158         $myhostname$mydomain|$myhostname) ;;
7159         *)
7160                 case "$phostname" in
7161                 sed*)
7162                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7163                         ;;
7164                 *)
7165                         echo "(That doesn't agree with your $phostname command, by the way.)"
7166                         ;;
7167                 esac
7168         ;;
7169         esac
7170         ;;
7171 esac
7172
7173 $cat <<EOM
7174
7175 I need to get your e-mail address in Internet format if possible, i.e.
7176 something like user@host.domain. Please answer accurately since I have
7177 no easy means to double check it. The default value provided below
7178 is most probably close to reality but may not be valid from outside
7179 your organization...
7180
7181 EOM
7182 cont=x
7183 while test "$cont"; do
7184         case "$cf_email" in
7185         '') dflt="$cf_by@$myhostname$mydomain";;
7186         *) dflt="$cf_email";;
7187         esac
7188         rp='What is your e-mail address?'
7189         . ./myread
7190         cf_email="$ans"
7191         case "$cf_email" in
7192         *@*.*) cont='' ;;
7193         *)
7194                 rp='Address does not look like an Internet one.  Use it anyway?'
7195                 case "$fastread" in
7196                 yes) dflt=y ;;
7197                 *) dflt=n ;;
7198                 esac
7199                 . ./myread
7200                 case "$ans" in
7201                 y*) cont='' ;;
7202                 *) echo " " ;;
7203                 esac
7204                 ;;
7205         esac
7206 done
7207
7208 $cat <<EOM
7209
7210 If you or somebody else will be maintaining perl at your site, please
7211 fill in the correct e-mail address here so that they may be contacted
7212 if necessary. Currently, the "perlbug" program included with perl
7213 will send mail to this address in addition to perlbug@perl.com. You may
7214 enter "none" for no administrator.
7215
7216 EOM
7217 case "$perladmin" in
7218 '') dflt="$cf_email";;
7219 *) dflt="$perladmin";;
7220 esac
7221 rp='Perl administrator e-mail address'
7222 . ./myread
7223 perladmin="$ans"
7224
7225 : figure out how to guarantee perl startup
7226 case "$startperl" in
7227 '')
7228         case "$sharpbang" in
7229         *!)
7230                 $cat <<EOH
7231
7232 I can use the #! construct to start perl on your system. This will
7233 make startup of perl scripts faster, but may cause problems if you
7234 want to share those scripts and perl is not in a standard place
7235 ($binexp/perl) on all your platforms. The alternative is to force
7236 a shell by starting the script with a single ':' character.
7237
7238 EOH
7239                 dflt="$binexp/perl"
7240                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7241                 . ./myread
7242                 case "$ans" in
7243                 none)   startperl=": # use perl";;
7244                 *)      startperl="#!$ans"
7245                         if $test 30 -lt `echo "$ans" | wc -c`; then
7246                                 $cat >&4 <<EOM
7247
7248 WARNING:  Some systems limit the #! command to 32 characters.
7249 If you experience difficulty running Perl scripts with #!, try
7250 installing Perl in a directory with a shorter pathname.
7251
7252 EOM
7253                         fi ;;
7254                 esac
7255                 ;;
7256         *) startperl=": # use perl"
7257                 ;;
7258         esac
7259         ;;
7260 esac
7261 echo "I'll use $startperl to start perl scripts."
7262
7263 : figure best path for perl in scripts
7264 case "$perlpath" in
7265 '')
7266         perlpath="$binexp/perl"
7267         case "$startperl" in
7268         *!*) ;;
7269         *)
7270                 $cat <<EOH
7271
7272 I will use the "eval 'exec'" idiom to start Perl on your system.
7273 I can use the full path of your Perl binary for this purpose, but
7274 doing so may cause problems if you want to share those scripts and
7275 Perl is not always in a standard place ($binexp/perl).
7276
7277 EOH
7278                 dflt="$binexp/perl"
7279                 rp="What path shall I use in \"eval 'exec'\"?"
7280                 . ./myread
7281                 perlpath="$ans"
7282                 ;;
7283         esac
7284         ;;
7285 esac
7286 case "$startperl" in
7287 *!*)    ;;
7288 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7289 esac
7290
7291 : determine where public executable scripts go
7292 set scriptdir scriptdir
7293 eval $prefixit
7294 case "$scriptdir" in
7295 '')
7296         dflt="$bin"
7297         : guess some guesses
7298         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7299         $test -d /usr/share/bin     && dflt=/usr/share/bin
7300         $test -d /usr/local/script  && dflt=/usr/local/script
7301         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7302         $test -d $prefixexp/script  && dflt=$prefixexp/script
7303         set dflt
7304         eval $prefixup
7305         ;;
7306 *)  dflt="$scriptdir"
7307         ;;
7308 esac
7309 $cat <<EOM
7310  
7311 Some installations have a separate directory just for executable scripts so
7312 that they can mount it across multiple architectures but keep the scripts in
7313 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7314 Or you might just lump your scripts in with all your other executables.
7315  
7316 EOM
7317 fn=d~
7318 rp='Where do you keep publicly executable scripts?'
7319 . ./getfile
7320 if $test "X$ansexp" != "X$scriptdirexp"; then
7321         installscript=''
7322 fi
7323 scriptdir="$ans"
7324 scriptdirexp="$ansexp"
7325 : Change installation prefix, if necessary.
7326 if $test X"$prefix" != X"$installprefix"; then
7327         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7328 else
7329         installscript="$scriptdirexp"
7330 fi
7331
7332 : determine where add-on public executables go
7333 case "$sitebin" in
7334 '')     dflt=$siteprefix/bin ;;
7335 *)      dflt=$sitebin ;;
7336 esac
7337 fn=d~
7338 rp='Pathname where the add-on public executables should be installed?'
7339 . ./getfile
7340 sitebin="$ans"
7341 sitebinexp="$ansexp"
7342 : Change installation prefix, if necessary.
7343 if $test X"$prefix" != X"$installprefix"; then
7344         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7345 else
7346         installsitebin="$sitebinexp"
7347 fi
7348
7349 : see if sqrtl exists
7350 set sqrtl d_sqrtl
7351 eval $inlibc
7352
7353 case "$ccflags" in
7354 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7355 esac
7356
7357 case "$uselongdouble" in
7358 $define|true|[yY]*)     dflt='y';;
7359 *) dflt='n';;
7360 esac
7361 cat <<EOM
7362
7363 Perl can be built to take advantage of long doubles which
7364 (if available) may give more accuracy and range for floating point numbers.
7365
7366 If this doesn't make any sense to you, just accept the default '$dflt'.
7367 EOM
7368 rp='Try to use long doubles if available?'
7369 . ./myread
7370 case "$ans" in
7371 y|Y)    val="$define"   ;;
7372 *)      val="$undef"    ;;
7373 esac
7374 set uselongdouble
7375 eval $setvar
7376
7377 case "$uselongdouble" in
7378 true|[yY]*) uselongdouble="$define" ;;
7379 esac
7380
7381 case "$uselongdouble" in
7382 $define)
7383 : Look for a hint-file generated 'call-back-unit'.  If the
7384 : user has specified that long doubles should be used,
7385 : we may need to set or change some other defaults.
7386         if $test -f uselongdouble.cbu; then
7387                 echo "Your platform has some specific hints for long doubles, using them..."
7388                 . ./uselongdouble.cbu
7389         else
7390                 $cat <<EOM
7391 (Your platform doesn't have any specific hints for long doubles.)
7392 EOM
7393         fi
7394         ;;
7395 esac
7396
7397 case "$uselongdouble:$d_sqrtl" in
7398 $define:$undef)
7399                 $cat <<EOM >&4
7400
7401 *** You requested the use of long doubles but you do not seem to have
7402 *** the mathematic functions for long doubles.  I'm disabling the use
7403 *** of long doubles.
7404
7405 EOM
7406         uselongdouble=$undef
7407         ;;
7408 esac
7409
7410 case "$useperlio" in
7411 $define|true|[yY]*)     dflt='y';;
7412 *) dflt='n';;
7413 esac
7414 cat <<EOM
7415
7416 Previous version of $package used the standard IO mechanisms as defined
7417 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7418 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7419 the default.  This abstraction layer can use AT&T's sfio (if you already
7420 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7421 problems with some extension modules.  Using PerlIO with stdio is safe,
7422 but it is slower than plain stdio and therefore is not the default.
7423
7424 If this doesn't make any sense to you, just accept the default '$dflt'.
7425 EOM
7426 rp='Use the experimental PerlIO abstraction layer?'
7427 . ./myread
7428 case "$ans" in
7429 y|Y) 
7430         val="$define"
7431         ;;     
7432 *)      
7433         echo "Ok, doing things the stdio way"
7434         val="$undef"
7435         ;;
7436 esac
7437 set useperlio
7438 eval $setvar 
7439
7440 case "$vendorprefix" in
7441 '')     d_vendorbin="$undef"
7442         vendorbin=''
7443         vendorbinexp=''
7444         ;;
7445 *)      d_vendorbin="$define"
7446         : determine where vendor-supplied executables go.
7447         case "$vendorbin" in
7448         '') dflt=$vendorprefix/bin ;;
7449         *)      dflt="$vendorbin" ;;
7450         esac
7451         fn=d~+
7452         rp='Pathname for the vendor-supplied executables directory?'
7453         . ./getfile
7454         vendorbin="$ans"
7455         vendorbinexp="$ansexp"
7456         ;;
7457 esac
7458 : Change installation prefix, if necessary.
7459 if $test X"$prefix" != X"$installprefix"; then
7460         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7461 else
7462         installvendorbin="$vendorbinexp"
7463 fi
7464
7465 : see if qgcvt exists
7466 set qgcvt d_qgcvt
7467 eval $inlibc
7468
7469 : check for length of double
7470 echo " "
7471 case "$doublesize" in
7472 '')
7473         echo "Checking to see how big your double precision numbers are..." >&4
7474         $cat >try.c <<'EOCP'
7475 #include <stdio.h>
7476 int main()
7477 {
7478     printf("%d\n", (int)sizeof(double));
7479     exit(0);
7480 }
7481 EOCP
7482         set try
7483         if eval $compile_ok; then
7484                 doublesize=`./try`
7485                 echo "Your double is $doublesize bytes long."
7486         else
7487                 dflt='8'
7488                 echo "(I can't seem to compile the test program.  Guessing...)"
7489                 rp="What is the size of a double precision number (in bytes)?"
7490                 . ./myread
7491                 doublesize="$ans"
7492         fi
7493         ;;
7494 esac
7495 $rm -f try.c try
7496
7497 : check for long doubles
7498 echo " "
7499 echo "Checking to see if you have long double..." >&4
7500 echo 'int main() { long double x = 7.0; }' > try.c
7501 set try
7502 if eval $compile; then
7503         val="$define"
7504         echo "You have long double."
7505 else
7506         val="$undef"
7507         echo "You do not have long double."
7508 fi
7509 $rm try.*
7510 set d_longdbl
7511 eval $setvar
7512
7513 : check for length of long double
7514 case "${d_longdbl}${longdblsize}" in
7515 $define)
7516         echo " "
7517         echo "Checking to see how big your long doubles are..." >&4
7518         $cat >try.c <<'EOCP'
7519 #include <stdio.h>
7520 int main()
7521 {
7522         printf("%d\n", sizeof(long double));
7523 }
7524 EOCP
7525         set try
7526         set try
7527         if eval $compile; then
7528                 longdblsize=`./try$exe_ext`
7529                 echo "Your long doubles are $longdblsize bytes long."
7530         else
7531                 dflt='8'
7532                 echo " "
7533                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7534                 rp="What is the size of a long double (in bytes)?"
7535                 . ./myread
7536                 longdblsize="$ans"
7537         fi
7538         if $test "X$doublesize" = "X$longdblsize"; then
7539                 echo "(That isn't any different from an ordinary double.)"
7540         fi      
7541         ;;
7542 esac
7543 $rm -f try.* try
7544
7545 echo " "
7546
7547 if $test X"$d_longdbl" = X"$define"; then
7548
7549 echo "Checking how to print long doubles..." >&4
7550
7551 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7552         $cat >try.c <<'EOCP'
7553 #include <sys/types.h>
7554 #include <stdio.h>
7555 int main() {
7556   double d = 123.456;
7557   printf("%.3f\n", d);
7558 }
7559 EOCP
7560         set try
7561         if eval $compile; then
7562                 yyy=`./try$exe_ext`
7563                 case "$yyy" in
7564                 123.456)
7565                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7566                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7567                         echo "We will use %f."
7568                         ;;
7569                 esac
7570         fi
7571 fi
7572
7573 if $test X"$sPRIfldbl" = X; then
7574         $cat >try.c <<'EOCP'
7575 #include <sys/types.h>
7576 #include <stdio.h>
7577 int main() {
7578   long double d = 123.456;
7579   printf("%.3llf\n", d);
7580 }
7581 EOCP
7582         set try
7583         if eval $compile; then
7584                 yyy=`./try$exe_ext`
7585                 case "$yyy" in
7586                 123.456)
7587                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7588                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7589                         echo "We will use %llf."
7590                         ;;
7591                 esac
7592         fi
7593 fi
7594
7595 if $test X"$sPRIfldbl" = X; then
7596         $cat >try.c <<'EOCP'
7597 #include <sys/types.h>
7598 #include <stdio.h>
7599 int main() {
7600   long double d = 123.456;
7601   printf("%.3Lf\n", d);
7602 }
7603 EOCP
7604         set try
7605         if eval $compile; then
7606                 yyy=`./try$exe_ext`
7607                 case "$yyy" in
7608                 123.456)
7609                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7610                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7611                         echo "We will use %Lf."
7612                         ;;
7613                 esac
7614         fi
7615 fi
7616
7617 if $test X"$sPRIfldbl" = X; then
7618         $cat >try.c <<'EOCP'
7619 #include <sys/types.h>
7620 #include <stdio.h>
7621 int main() {
7622   long double d = 123.456;
7623   printf("%.3lf\n", d);
7624 }
7625 EOCP
7626         set try
7627         if eval $compile; then
7628                 yyy=`./try$exe_ext`
7629                 case "$yyy" in
7630                 123.456)
7631                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7632                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7633                         echo "We will use %lf."
7634                         ;;
7635                 esac
7636         fi
7637 fi
7638
7639 if $test X"$sPRIfldbl" = X; then
7640         echo "Cannot figure out how to print long doubles." >&4
7641 fi
7642
7643 $rm -f try try.*
7644
7645 fi # d_longdbl
7646
7647 case "$sPRIfldbl" in
7648 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7649         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7650         ;;
7651 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7652         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7653         ;;
7654 esac
7655
7656 : Check how to convert floats to strings.
7657 if test "X$d_Gconvert" = X; then
7658         echo " "
7659         echo "Checking for an efficient way to convert floats to strings."
7660         echo " " > try.c
7661         case "$uselongdouble" in
7662         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7663         esac
7664         case "$d_longdbl" in
7665         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7666         esac
7667         case "$d_PRIgldbl" in
7668         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7669         esac
7670         $cat >>try.c <<EOP
7671 #ifdef TRY_gconvert
7672 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7673 char *myname = "gconvert";
7674 #endif
7675 #ifdef TRY_gcvt
7676 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7677 char *myname = "gcvt";
7678 #endif
7679 #ifdef TRY_qgcvt
7680 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7681 char *myname = "qgcvt";
7682 #define DOUBLETYPE long double
7683 #endif
7684 #ifdef TRY_sprintf
7685 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7686 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7687 #else
7688 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7689 #endif
7690 char *myname = "sprintf";
7691 #endif
7692
7693 #ifndef DOUBLETYPE
7694 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7695 #define DOUBLETYPE long double
7696 #else
7697 #define DOUBLETYPE double
7698 #endif
7699 #endif
7700
7701 #include <stdio.h>
7702
7703 #define I_STDLIB $i_stdlib
7704 #ifdef I_STDLIB
7705 #include <stdlib.h>
7706 #endif
7707
7708 int
7709 checkit(expect, got)
7710 char *expect;
7711 char *got;
7712 {
7713     if (strcmp(expect, got)) {
7714                 printf("%s oddity:  Expected %s, got %s\n",
7715                         myname, expect, got);
7716                 exit(1);
7717         }
7718 }
7719
7720 int main()
7721
7722         char buf[64]; 
7723         buf[63] = '\0';
7724
7725         /* This must be 1st test on (which?) platform */
7726         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7727         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7728         checkit("0.1", buf);
7729
7730         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7731         checkit("1", buf);
7732
7733         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7734         checkit("1.1", buf);
7735
7736         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7737         checkit("1.01", buf);
7738
7739         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7740         checkit("1.001", buf);
7741
7742         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7743         checkit("1.0001", buf);
7744
7745         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7746         checkit("1.00001", buf);
7747
7748         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7749         checkit("1.000001", buf);
7750
7751         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7752         checkit("0", buf);
7753
7754         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7755         checkit("-1", buf);
7756
7757         /* Some Linux gcvt's give 1.e+5 here. */
7758         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7759         checkit("100000", buf);
7760         
7761         /* Some Linux gcvt's give -1.e+5 here. */
7762         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7763         checkit("-100000", buf);
7764
7765         exit(0);
7766 }
7767 EOP
7768         case "$d_Gconvert" in
7769         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7770         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7771         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7772         *) xxx_list='gconvert gcvt sprintf' ;;
7773         esac
7774
7775         case "$d_longdbl$uselongdouble$d_qgcvt" in
7776         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7777         esac
7778
7779         for xxx_convert in $xxx_list; do
7780                 echo "Trying $xxx_convert..."
7781                 $rm -f try try$_o
7782                 set try -DTRY_$xxx_convert
7783                 if eval $compile; then
7784                         echo "$xxx_convert() found." >&4
7785                         if ./try; then
7786                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7787                                 break;
7788                         else
7789                                 echo "...But $xxx_convert didn't work as I expected."
7790                         fi
7791                 else
7792                         echo "$xxx_convert NOT found." >&4
7793                 fi
7794         done
7795                 
7796         case "$xxx_convert" in
7797         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7798         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7799         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7800         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7801            "$define$define$define")
7802               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7803            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7804            esac
7805            ;;  
7806         esac
7807 fi
7808
7809 : Initialize h_fcntl
7810 h_fcntl=false
7811
7812 : Initialize h_sysfile
7813 h_sysfile=false
7814
7815 : access call always available on UNIX
7816 set access d_access
7817 eval $inlibc
7818
7819 : locate the flags for 'access()'
7820 case "$d_access" in
7821 "$define")
7822         echo " "
7823         $cat >access.c <<'EOCP'
7824 #include <sys/types.h>
7825 #ifdef I_FCNTL
7826 #include <fcntl.h>
7827 #endif
7828 #ifdef I_SYS_FILE
7829 #include <sys/file.h>
7830 #endif
7831 #ifdef I_UNISTD
7832 #include <unistd.h>
7833 #endif
7834 int main() {
7835         exit(R_OK);
7836 }
7837 EOCP
7838         : check sys/file.h first, no particular reason here
7839         if $test `./findhdr sys/file.h` && \
7840                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7841                 h_sysfile=true;
7842                 echo "<sys/file.h> defines the *_OK access constants." >&4
7843         elif $test `./findhdr fcntl.h` && \
7844                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7845                 h_fcntl=true;
7846                 echo "<fcntl.h> defines the *_OK access constants." >&4
7847         elif $test `./findhdr unistd.h` && \
7848                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7849                 echo "<unistd.h> defines the *_OK access constants." >&4
7850         else
7851                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7852         fi
7853         ;;
7854 esac
7855 $rm -f access*
7856
7857 : see if accessx exists
7858 set accessx d_accessx
7859 eval $inlibc
7860
7861 : see if alarm exists
7862 set alarm d_alarm
7863 eval $inlibc
7864
7865 : see if atolf exists
7866 set atolf d_atolf
7867 eval $inlibc
7868
7869 : see if atoll exists
7870 set atoll d_atoll
7871 eval $inlibc
7872
7873 : Look for GNU-cc style attribute checking
7874 echo " "
7875 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7876 $cat >attrib.c <<'EOCP'
7877 #include <stdio.h>
7878 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7879 EOCP
7880 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7881         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7882                 echo "Your C compiler doesn't fully support __attribute__."
7883                 val="$undef"
7884         else
7885                 echo "Your C compiler supports __attribute__."
7886                 val="$define"
7887         fi
7888 else
7889         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7890         val="$undef"
7891 fi
7892 set d_attribut
7893 eval $setvar
7894 $rm -f attrib*
7895
7896 : see if bcmp exists
7897 set bcmp d_bcmp
7898 eval $inlibc
7899
7900 : see if bcopy exists
7901 set bcopy d_bcopy
7902 eval $inlibc
7903
7904 : see if this is a unistd.h system
7905 set unistd.h i_unistd
7906 eval $inhdr
7907
7908 : see if getpgrp exists
7909 set getpgrp d_getpgrp
7910 eval $inlibc
7911
7912 case "$d_getpgrp" in
7913 "$define")
7914         echo " "
7915         echo "Checking to see which flavor of getpgrp is in use..."
7916         $cat >set.c <<EOP
7917 #$i_unistd I_UNISTD
7918 #include <sys/types.h>
7919 #ifdef I_UNISTD
7920 #  include <unistd.h>
7921 #endif
7922 int main()
7923 {
7924         if (getuid() == 0) {
7925                 printf("(I see you are running Configure as super-user...)\n");
7926                 setuid(1);
7927         }
7928 #ifdef TRY_BSD_PGRP
7929         if (getpgrp(1) == 0)
7930                 exit(0);
7931 #else
7932         if (getpgrp() > 0)
7933                 exit(0);
7934 #endif
7935         exit(1);
7936 }
7937 EOP
7938         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7939                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7940                 val="$define"
7941         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7942                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7943                 val="$undef"
7944         else
7945                 echo "I can't seem to compile and run the test program."
7946                 if ./usg; then
7947                         xxx="a USG one, i.e. you use getpgrp()."
7948                 else
7949                         # SVR4 systems can appear rather BSD-ish.
7950                         case "$i_unistd" in
7951                         $undef)
7952                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7953                                 val="$define"
7954                                 ;;
7955                         $define)
7956                                 xxx="probably a USG one, i.e. you use getpgrp()."
7957                                 val="$undef"
7958                                 ;;
7959                         esac
7960                 fi
7961                 echo "Assuming your getpgrp is $xxx" >&4
7962         fi
7963         ;;
7964 *) val="$undef";;
7965 esac
7966 set d_bsdgetpgrp
7967 eval $setvar
7968 $rm -f set set.c
7969
7970 : see if setpgrp exists
7971 set setpgrp d_setpgrp
7972 eval $inlibc
7973
7974 case "$d_setpgrp" in
7975 "$define")
7976         echo " "
7977         echo "Checking to see which flavor of setpgrp is in use..."
7978         $cat >set.c <<EOP
7979 #$i_unistd I_UNISTD
7980 #include <sys/types.h>
7981 #ifdef I_UNISTD
7982 #  include <unistd.h>
7983 #endif
7984 int main()
7985 {
7986         if (getuid() == 0) {
7987                 printf("(I see you are running Configure as super-user...)\n");
7988                 setuid(1);
7989         }
7990 #ifdef TRY_BSD_PGRP
7991         if (-1 == setpgrp(1, 1))
7992                 exit(0);
7993 #else
7994         if (setpgrp() != -1)
7995                 exit(0);
7996 #endif
7997         exit(1);
7998 }
7999 EOP
8000         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8001                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8002                 val="$define"
8003         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8004                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8005                 val="$undef"
8006         else
8007                 echo "(I can't seem to compile and run the test program.)"
8008                 if ./usg; then
8009                         xxx="a USG one, i.e. you use setpgrp()."
8010                 else
8011                         # SVR4 systems can appear rather BSD-ish.
8012                         case "$i_unistd" in
8013                         $undef)
8014                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8015                                 val="$define"
8016                                 ;;
8017                         $define)
8018                                 xxx="probably a USG one, i.e. you use setpgrp()."
8019                                 val="$undef"
8020                                 ;;
8021                         esac
8022                 fi
8023                 echo "Assuming your setpgrp is $xxx" >&4
8024         fi
8025         ;;
8026 *) val="$undef";;
8027 esac
8028 set d_bsdsetpgrp
8029 eval $setvar
8030 $rm -f set set.c
8031 : see if bzero exists
8032 set bzero d_bzero
8033 eval $inlibc
8034
8035 : see if signal is declared as pointer to function returning int or void
8036 echo " "
8037 xxx=`./findhdr signal.h`
8038 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8039 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8040         echo "You have int (*signal())() instead of void." >&4
8041         val="$undef"
8042 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8043         echo "You have void (*signal())()." >&4
8044         val="$define"
8045 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8046         echo "You have int (*signal())() instead of void." >&4
8047         val="$undef"
8048 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8049         echo "You have void (*signal())()." >&4
8050         val="$define"
8051 else
8052         case "$d_voidsig" in
8053         '')
8054         echo "I can't determine whether signal handler returns void or int..." >&4
8055                 dflt=void
8056                 rp="What type does your signal handler return?"
8057                 . ./myread
8058                 case "$ans" in
8059                 v*) val="$define";;
8060                 *) val="$undef";;
8061                 esac;;
8062         "$define")
8063                 echo "As you already told me, signal handler returns void." >&4
8064                 val="$define"
8065                 ;;
8066         *)      echo "As you already told me, signal handler returns int." >&4
8067                 val="$undef"
8068                 ;;
8069         esac
8070 fi
8071 set d_voidsig
8072 eval $setvar
8073 case "$d_voidsig" in
8074 "$define") signal_t="void";;
8075 *) signal_t="int";;
8076 esac
8077 $rm -f $$.tmp
8078
8079 : check for ability to cast large floats to 32-bit ints.
8080 echo " "
8081 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8082 if $test "$intsize" -ge 4; then
8083         xxx=int
8084 else
8085         xxx=long
8086 fi
8087 $cat >try.c <<EOCP
8088 #include <stdio.h>
8089 #include <sys/types.h>
8090 #include <signal.h>
8091 $signal_t blech(s) int s; { exit(3); }
8092 int main()
8093 {
8094         $xxx i32;
8095         double f, g;
8096         int result = 0;
8097         char str[16];
8098         signal(SIGFPE, blech);
8099
8100         /* Don't let compiler optimize the test away.  Store the number 
8101            in a writable string for gcc to pass to sscanf under HP/UX.
8102         */
8103         sprintf(str, "2147483647");
8104         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8105         g = 10 * f;
8106         i32  = ($xxx) g;
8107
8108         /* x86 processors will probably give 0x8000 0000, which is a
8109        sign change.  We don't want that.  We want to mimic SPARC
8110            behavior here, which is to preserve the sign and give
8111            back 0x7fff ffff.
8112         */
8113         if (i32 != ($xxx) f)
8114                 result |= 1;
8115         exit(result);
8116 }
8117 EOCP
8118 set try
8119 if eval $compile_ok; then
8120         ./try
8121         yyy=$?
8122 else
8123         echo "(I can't seem to compile the test program--assuming it can't)"
8124         yyy=1
8125 fi
8126 case "$yyy" in
8127 0)      val="$define"
8128         echo "Yup, it can."
8129         ;;
8130 *)      val="$undef"
8131         echo "Nope, it can't."
8132         ;;
8133 esac
8134 set d_casti32
8135 eval $setvar
8136 $rm -f try try.*
8137
8138 : check for ability to cast negative floats to unsigned
8139 echo " "
8140 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8141 $cat >try.c <<EOCP
8142 #include <stdio.h>
8143 #include <sys/types.h>
8144 #include <signal.h>
8145 $signal_t blech(s) int s; { exit(7); }
8146 $signal_t blech_in_list(s) int s; { exit(4); }
8147 unsigned long dummy_long(p) unsigned long p; { return p; }
8148 unsigned int dummy_int(p) unsigned int p; { return p; }
8149 unsigned short dummy_short(p) unsigned short p; { return p; }
8150 int main()
8151 {
8152         double f;
8153         unsigned long along;
8154         unsigned int aint;
8155         unsigned short ashort;
8156         int result = 0;
8157         char str[16];
8158         
8159         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8160            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8161            optimized the whole file away
8162         */
8163         /* Store the number in a writable string for gcc to pass to 
8164            sscanf under HP/UX.
8165         */
8166         sprintf(str, "-123");
8167         sscanf(str, "%lf", &f);  /* f = -123.; */
8168
8169         signal(SIGFPE, blech);
8170         along = (unsigned long)f;
8171         aint = (unsigned int)f;
8172         ashort = (unsigned short)f;
8173         if (along != (unsigned long)-123)
8174                 result |= 1;
8175         if (aint != (unsigned int)-123)
8176                 result |= 1;
8177         if (ashort != (unsigned short)-123)
8178                 result |= 1;
8179         sprintf(str, "1073741824.");
8180         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8181         f = f + f;
8182         along = 0;
8183         along = (unsigned long)f;
8184         if (along != 0x80000000)
8185                 result |= 2;
8186         f -= 1.;
8187         along = 0;
8188         along = (unsigned long)f;
8189         if (along != 0x7fffffff)
8190                 result |= 1;
8191         f += 2.;
8192         along = 0;
8193         along = (unsigned long)f;
8194         if (along != 0x80000001)
8195                 result |= 2;
8196         if (result)
8197                 exit(result);
8198         signal(SIGFPE, blech_in_list);
8199         sprintf(str, "123.");
8200         sscanf(str, "%lf", &f);  /* f = 123.; */
8201         along = dummy_long((unsigned long)f);
8202         aint = dummy_int((unsigned int)f);
8203         ashort = dummy_short((unsigned short)f);
8204         if (along != (unsigned long)123)
8205                 result |= 4;
8206         if (aint != (unsigned int)123)
8207                 result |= 4;
8208         if (ashort != (unsigned short)123)
8209                 result |= 4;
8210         exit(result);
8211
8212 }
8213 EOCP
8214 set try
8215 if eval $compile_ok; then
8216         ./try
8217         castflags=$?
8218 else
8219         echo "(I can't seem to compile the test program--assuming it can't)"
8220         castflags=7
8221 fi
8222 case "$castflags" in
8223 0)      val="$define"
8224         echo "Yup, it can."
8225         ;;
8226 *)      val="$undef"
8227         echo "Nope, it can't."
8228         ;;
8229 esac
8230 set d_castneg
8231 eval $setvar
8232 $rm -f try.*
8233
8234 : see if vprintf exists
8235 echo " "
8236 if set vprintf val -f d_vprintf; eval $csym; $val; then
8237         echo 'vprintf() found.' >&4
8238         val="$define"
8239         $cat >vprintf.c <<'EOF'
8240 #include <varargs.h>
8241
8242 int main() { xxx("foo"); }
8243
8244 xxx(va_alist)
8245 va_dcl
8246 {
8247         va_list args;
8248         char buf[10];
8249
8250         va_start(args);
8251         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8252 }
8253 EOF
8254         set vprintf
8255         if eval $compile && ./vprintf; then
8256                 echo "Your vsprintf() returns (int)." >&4
8257                 val2="$undef"
8258         else
8259                 echo "Your vsprintf() returns (char*)." >&4
8260                 val2="$define"
8261         fi
8262 else
8263         echo 'vprintf() NOT found.' >&4
8264                 val="$undef"
8265                 val2="$undef"
8266 fi
8267 set d_vprintf
8268 eval $setvar
8269 val=$val2
8270 set d_charvspr
8271 eval $setvar
8272
8273 : see if chown exists
8274 set chown d_chown
8275 eval $inlibc
8276
8277 : see if chroot exists
8278 set chroot d_chroot
8279 eval $inlibc
8280
8281 : see if chsize exists
8282 set chsize d_chsize
8283 eval $inlibc
8284
8285 : check for const keyword
8286 echo " "
8287 echo 'Checking to see if your C compiler knows about "const"...' >&4
8288 $cat >const.c <<'EOCP'
8289 typedef struct spug { int drokk; } spug;
8290 int main()
8291 {
8292         const char *foo;
8293         const spug y;
8294 }
8295 EOCP
8296 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8297         val="$define"
8298         echo "Yup, it does."
8299 else
8300         val="$undef"
8301         echo "Nope, it doesn't."
8302 fi
8303 set d_const
8304 eval $setvar
8305
8306 : see if crypt exists
8307 echo " "
8308 if set crypt val -f d_crypt; eval $csym; $val; then
8309         echo 'crypt() found.' >&4
8310         val="$define"
8311         cryptlib=''
8312 else
8313         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8314         if $test -z "$cryptlib"; then
8315                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8316         else
8317                 cryptlib=-lcrypt
8318         fi
8319         if $test -z "$cryptlib"; then
8320                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8321         else
8322                 cryptlib=-lcrypt
8323         fi
8324         if $test -z "$cryptlib"; then
8325                 cryptlib=`./loc libcrypt$_a "" $libpth`
8326         else
8327                 cryptlib=-lcrypt
8328         fi
8329         if $test -z "$cryptlib"; then
8330                 echo 'crypt() NOT found.' >&4
8331                 val="$undef"
8332         else
8333                 val="$define"
8334         fi
8335 fi
8336 set d_crypt
8337 eval $setvar
8338
8339 : get csh whereabouts
8340 case "$csh" in
8341 'csh') val="$undef" ;;
8342 *) val="$define" ;;
8343 esac
8344 set d_csh
8345 eval $setvar
8346 : Respect a hint or command line value for full_csh.
8347 case "$full_csh" in
8348 '') full_csh=$csh ;;
8349 esac
8350
8351 : see if cuserid exists
8352 set cuserid d_cuserid
8353 eval $inlibc
8354
8355 : see if this is a limits.h system
8356 set limits.h i_limits
8357 eval $inhdr
8358
8359 : see if this is a float.h system
8360 set float.h i_float
8361 eval $inhdr
8362
8363 : See if number of significant digits in a double precision number is known
8364 echo " "
8365 $cat >dbl_dig.c <<EOM
8366 #$i_limits I_LIMITS
8367 #$i_float I_FLOAT
8368 #ifdef I_LIMITS
8369 #include <limits.h>
8370 #endif
8371 #ifdef I_FLOAT
8372 #include <float.h>
8373 #endif
8374 #ifdef DBL_DIG
8375 printf("Contains DBL_DIG");
8376 #endif
8377 EOM
8378 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8379 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8380         echo "DBL_DIG found." >&4
8381         val="$define"
8382 else
8383         echo "DBL_DIG NOT found." >&4
8384         val="$undef"
8385 fi
8386 $rm -f dbl_dig.?
8387 set d_dbl_dig
8388 eval $setvar
8389
8390 : see if difftime exists
8391 set difftime d_difftime
8392 eval $inlibc
8393
8394 : see if this is a dirent system
8395 echo " "
8396 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8397         val="$define"
8398         echo "<dirent.h> found." >&4
8399 else
8400         val="$undef"
8401         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8402                 echo "<sys/dir.h> found." >&4
8403                 echo " "
8404         else
8405                 xinc=`./findhdr sys/ndir.h`
8406         fi
8407         echo "<dirent.h> NOT found." >&4
8408 fi
8409 set i_dirent
8410 eval $setvar
8411
8412 : Look for type of directory structure.
8413 echo " "
8414 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8415
8416 case "$direntrytype" in
8417 ''|' ')
8418         case "$i_dirent" in
8419         $define) guess1='struct dirent' ;;
8420         *) guess1='struct direct'  ;;
8421         esac
8422         ;;
8423 *)      guess1="$direntrytype"
8424         ;;
8425 esac
8426
8427 case "$guess1" in
8428 'struct dirent') guess2='struct direct' ;;
8429 *) guess2='struct dirent' ;;
8430 esac
8431                 
8432 if $contains "$guess1" try.c >/dev/null 2>&1; then
8433         direntrytype="$guess1"
8434         echo "Your directory entries are $direntrytype." >&4
8435 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8436         direntrytype="$guess2"
8437         echo "Your directory entries seem to be $direntrytype." >&4
8438 else
8439         echo "I don't recognize your system's directory entries." >&4
8440         rp="What type is used for directory entries on this system?"
8441         dflt="$guess1"
8442         . ./myread
8443         direntrytype="$ans"
8444 fi
8445 $rm -f try.c
8446
8447
8448 : see if the directory entry stores field length
8449 echo " "
8450 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8451 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8452         echo "Good, your directory entry keeps length information in d_namlen." >&4
8453         val="$define"
8454 else
8455         echo "Your directory entry does not know about the d_namlen field." >&4
8456         val="$undef"
8457 fi
8458 set d_dirnamlen
8459 eval $setvar
8460 $rm -f try.c
8461
8462 : see if dlerror exists
8463 xxx_runnm="$runnm"
8464 runnm=false
8465 set dlerror d_dlerror
8466 eval $inlibc
8467 runnm="$xxx_runnm"
8468
8469 : see if dlfcn is available
8470 set dlfcn.h i_dlfcn
8471 eval $inhdr
8472
8473 case "$usedl" in
8474 $define|y|true)
8475         $cat << EOM
8476
8477 On a few systems, the dynamically loaded modules that perl generates and uses
8478 will need a different extension than shared libs. The default will probably
8479 be appropriate.
8480
8481 EOM
8482         case "$dlext" in
8483         '')     dflt="$so" ;;
8484         *)      dflt="$dlext" ;;
8485         esac
8486         rp='What is the extension of dynamically loaded modules'
8487         . ./myread
8488         dlext="$ans"
8489         ;;
8490 *)
8491         dlext="none"
8492         ;;
8493 esac
8494
8495 : Check if dlsym need a leading underscore
8496 echo " "
8497 val="$undef"
8498
8499 case "$dlsrc" in
8500 dl_dlopen.xs)
8501         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8502         $cat >dyna.c <<'EOM'
8503 fred () { }
8504 EOM
8505
8506 $cat >fred.c<<EOM
8507
8508 #include <stdio.h>
8509 #$i_dlfcn I_DLFCN
8510 #ifdef I_DLFCN
8511 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8512 #else
8513 #include <sys/types.h>
8514 #include <nlist.h>
8515 #include <link.h>
8516 #endif
8517
8518 extern int fred() ;
8519
8520 int main()
8521 {
8522     void * handle ;
8523     void * symbol ;
8524 #ifndef RTLD_LAZY
8525     int mode = 1 ;
8526 #else
8527     int mode = RTLD_LAZY ;
8528 #endif
8529     handle = dlopen("./dyna.$dlext", mode) ;
8530     if (handle == NULL) {
8531         printf ("1\n") ;
8532         fflush (stdout) ;
8533         exit(0);
8534     }
8535     symbol = dlsym(handle, "fred") ;
8536     if (symbol == NULL) {
8537         /* try putting a leading underscore */
8538         symbol = dlsym(handle, "_fred") ;
8539         if (symbol == NULL) {
8540             printf ("2\n") ;
8541             fflush (stdout) ;
8542             exit(0);
8543         }
8544         printf ("3\n") ;
8545     }
8546     else
8547         printf ("4\n") ;
8548     fflush (stdout) ;
8549     exit(0);
8550 }
8551 EOM
8552         : Call the object file tmp-dyna.o in case dlext=o.
8553         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8554                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8555                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8556                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8557                 xxx=`./fred`
8558                 case $xxx in
8559                 1)      echo "Test program failed using dlopen." >&4
8560                         echo "Perhaps you should not use dynamic loading." >&4;;
8561                 2)      echo "Test program failed using dlsym." >&4
8562                         echo "Perhaps you should not use dynamic loading." >&4;;
8563                 3)      echo "dlsym needs a leading underscore" >&4
8564                         val="$define" ;;
8565                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8566                 esac
8567         else
8568                 echo "I can't compile and run the test program." >&4
8569                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8570         fi
8571         ;;
8572 esac
8573                 
8574 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8575
8576 set d_dlsymun
8577 eval $setvar
8578
8579 hasproto='varname=$1; func=$2; shift; shift;
8580 while $test $# -ge 2; do
8581         case "$1" in
8582         $define) echo "#include <$2>";;
8583         esac ;
8584     shift 2;
8585 done > try.c;
8586 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8587 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8588         echo "$func() prototype found.";
8589         val="$define";
8590 else
8591         echo "$func() prototype NOT found.";
8592         val="$undef";
8593 fi;
8594 set $varname;
8595 eval $setvar;
8596 $rm -f try.c tryout.c'
8597
8598 : see if prototype for drand48 is available
8599 echo " "
8600 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8601 eval $hasproto
8602
8603 : see if dup2 exists
8604 set dup2 d_dup2
8605 eval $inlibc
8606
8607 : see if eaccess exists
8608 set eaccess d_eaccess
8609 eval $inlibc
8610
8611 : see if endgrent exists
8612 set endgrent d_endgrent
8613 eval $inlibc
8614
8615 : see if endhostent exists
8616 set endhostent d_endhent
8617 eval $inlibc
8618
8619 : see if endnetent exists
8620 set endnetent d_endnent
8621 eval $inlibc
8622
8623 : see if endprotoent exists
8624 set endprotoent d_endpent
8625 eval $inlibc
8626
8627 : see if endpwent exists
8628 set endpwent d_endpwent
8629 eval $inlibc
8630
8631 : see if endservent exists
8632 set endservent d_endsent
8633 eval $inlibc
8634
8635 : Locate the flags for 'open()'
8636 echo " "
8637 $cat >open3.c <<'EOCP'
8638 #include <sys/types.h>
8639 #ifdef I_FCNTL
8640 #include <fcntl.h>
8641 #endif
8642 #ifdef I_SYS_FILE
8643 #include <sys/file.h>
8644 #endif
8645 int main() {
8646         if(O_RDONLY);
8647 #ifdef O_TRUNC
8648         exit(0);
8649 #else
8650         exit(1);
8651 #endif
8652 }
8653 EOCP
8654 : check sys/file.h first to get FREAD on Sun
8655 if $test `./findhdr sys/file.h` && \
8656                 set open3 -DI_SYS_FILE && eval $compile; then
8657         h_sysfile=true;
8658         echo "<sys/file.h> defines the O_* constants..." >&4
8659         if ./open3; then
8660                 echo "and you have the 3 argument form of open()." >&4
8661                 val="$define"
8662         else
8663                 echo "but not the 3 argument form of open().  Oh, well." >&4
8664                 val="$undef"
8665         fi
8666 elif $test `./findhdr fcntl.h` && \
8667                 set open3 -DI_FCNTL && eval $compile; then
8668         h_fcntl=true;
8669         echo "<fcntl.h> defines the O_* constants..." >&4
8670         if ./open3; then
8671                 echo "and you have the 3 argument form of open()." >&4
8672                 val="$define"
8673         else
8674                 echo "but not the 3 argument form of open().  Oh, well." >&4
8675                 val="$undef"
8676         fi
8677 else
8678         val="$undef"
8679         echo "I can't find the O_* constant definitions!  You got problems." >&4
8680 fi
8681 set d_open3
8682 eval $setvar
8683 $rm -f open3*
8684
8685 : see which of string.h or strings.h is needed
8686 echo " "
8687 strings=`./findhdr string.h`
8688 if $test "$strings" && $test -r "$strings"; then
8689         echo "Using <string.h> instead of <strings.h>." >&4
8690         val="$define"
8691 else
8692         val="$undef"
8693         strings=`./findhdr strings.h`
8694         if $test "$strings" && $test -r "$strings"; then
8695                 echo "Using <strings.h> instead of <string.h>." >&4
8696         else
8697                 echo "No string header found -- You'll surely have problems." >&4
8698         fi
8699 fi
8700 set i_string
8701 eval $setvar
8702 case "$i_string" in
8703 "$undef") strings=`./findhdr strings.h`;;
8704 *)        strings=`./findhdr string.h`;;
8705 esac
8706
8707 : check for non-blocking I/O stuff
8708 case "$h_sysfile" in
8709 true) echo "#include <sys/file.h>" > head.c;;
8710 *)
8711         case "$h_fcntl" in
8712         true) echo "#include <fcntl.h>" > head.c;;
8713         *) echo "#include <sys/fcntl.h>" > head.c;;
8714         esac
8715         ;;
8716 esac
8717 echo " "
8718 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8719 case "$o_nonblock" in
8720 '')
8721         $cat head.c > try.c
8722         $cat >>try.c <<'EOCP'
8723 #include <stdio.h>
8724 int main() {
8725 #ifdef O_NONBLOCK
8726         printf("O_NONBLOCK\n");
8727         exit(0);
8728 #endif
8729 #ifdef O_NDELAY
8730         printf("O_NDELAY\n");
8731         exit(0);
8732 #endif
8733 #ifdef FNDELAY
8734         printf("FNDELAY\n");
8735         exit(0);
8736 #endif
8737         exit(0);
8738 }
8739 EOCP
8740         set try
8741         if eval $compile_ok; then
8742                 o_nonblock=`./try`
8743                 case "$o_nonblock" in
8744                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8745                 *) echo "Seems like we can use $o_nonblock.";;
8746                 esac
8747         else
8748                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8749         fi
8750         ;;
8751 *) echo "Using $hint value $o_nonblock.";;
8752 esac
8753 $rm -f try try.* .out core
8754
8755 echo " "
8756 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8757 case "$eagain" in
8758 '')
8759         $cat head.c > try.c
8760         $cat >>try.c <<EOCP
8761 #include <errno.h>
8762 #include <sys/types.h>
8763 #include <signal.h>
8764 #include <stdio.h> 
8765 #define MY_O_NONBLOCK $o_nonblock
8766 #ifndef errno  /* XXX need better Configure test */
8767 extern int errno;
8768 #endif
8769 #$i_unistd I_UNISTD
8770 #ifdef I_UNISTD
8771 #include <unistd.h>
8772 #endif
8773 #$i_string I_STRING
8774 #ifdef I_STRING
8775 #include <string.h>
8776 #else
8777 #include <strings.h>
8778 #endif
8779 $signal_t blech(x) int x; { exit(3); }
8780 EOCP
8781         $cat >> try.c <<'EOCP'
8782 int main()
8783 {
8784         int pd[2];
8785         int pu[2];
8786         char buf[1];
8787         char string[100];
8788
8789         pipe(pd);       /* Down: child -> parent */
8790         pipe(pu);       /* Up: parent -> child */
8791         if (0 != fork()) {
8792                 int ret;
8793                 close(pd[1]);   /* Parent reads from pd[0] */
8794                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8795                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8796                         exit(1);
8797                 signal(SIGALRM, blech);
8798                 alarm(5);
8799                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8800                         exit(2);
8801                 sprintf(string, "%d\n", ret);
8802                 write(2, string, strlen(string));
8803                 alarm(0);
8804 #ifdef EAGAIN
8805                 if (errno == EAGAIN) {
8806                         printf("EAGAIN\n");
8807                         goto ok;
8808                 }
8809 #endif
8810 #ifdef EWOULDBLOCK
8811                 if (errno == EWOULDBLOCK)
8812                         printf("EWOULDBLOCK\n");
8813 #endif
8814         ok:
8815                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8816                 sleep(2);                               /* Give it time to close our pipe */
8817                 alarm(5);
8818                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8819                 alarm(0);
8820                 sprintf(string, "%d\n", ret);
8821                 write(3, string, strlen(string));
8822                 exit(0);
8823         }
8824
8825         close(pd[0]);                   /* We write to pd[1] */
8826         close(pu[1]);                   /* We read from pu[0] */
8827         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8828         close(pd[1]);                   /* Pipe pd is now fully closed! */
8829         exit(0);                                /* Bye bye, thank you for playing! */
8830 }
8831 EOCP
8832         set try
8833         if eval $compile_ok; then
8834                 echo "$startsh" >mtry
8835                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8836                 chmod +x mtry
8837                 ./mtry >/dev/null 2>&1
8838                 case $? in
8839                 0) eagain=`$cat try.out`;;
8840                 1) echo "Could not perform non-blocking setting!";;
8841                 2) echo "I did a successful read() for something that was not there!";;
8842                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8843                 *) echo "Something terribly wrong happened during testing.";;
8844                 esac
8845                 rd_nodata=`$cat try.ret`
8846                 echo "A read() system call with no data present returns $rd_nodata."
8847                 case "$rd_nodata" in
8848                 0|-1) ;;
8849                 *)
8850                         echo "(That's peculiar, fixing that to be -1.)"
8851                         rd_nodata=-1
8852                         ;;
8853                 esac
8854                 case "$eagain" in
8855                 '')
8856                         echo "Forcing errno EAGAIN on read() with no data available."
8857                         eagain=EAGAIN
8858                         ;;
8859                 *)
8860                         echo "Your read() sets errno to $eagain when no data is available."
8861                         ;;
8862                 esac
8863                 status=`$cat try.err`
8864                 case "$status" in
8865                 0) echo "And it correctly returns 0 to signal EOF.";;
8866                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8867                 *) echo "However, your read() returns '$status' on EOF??";;
8868                 esac
8869                 val="$define"
8870                 if test "$status" = "$rd_nodata"; then
8871                         echo "WARNING: you can't distinguish between EOF and no data!"
8872                         val="$undef"
8873                 fi
8874         else
8875                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8876                 eagain=EAGAIN
8877         fi
8878         set d_eofnblk
8879         eval $setvar
8880         ;;
8881 *)
8882         echo "Using $hint value $eagain."
8883         echo "Your read() returns $rd_nodata when no data is present."
8884         case "$d_eofnblk" in
8885         "$define") echo "And you can see EOF because read() returns 0.";;
8886         "$undef") echo "But you can't see EOF status from read() returned value.";;
8887         *)
8888                 echo "(Assuming you can't see EOF status from read anyway.)"
8889                 d_eofnblk=$undef
8890                 ;;
8891         esac
8892         ;;
8893 esac
8894 $rm -f try try.* .out core head.c mtry
8895
8896 : see if fchmod exists
8897 set fchmod d_fchmod
8898 eval $inlibc
8899
8900 : see if fchown exists
8901 set fchown d_fchown
8902 eval $inlibc
8903
8904 : see if this is an fcntl system
8905 set fcntl d_fcntl
8906 eval $inlibc
8907
8908 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8909 while $test $# -ge 2; do
8910         case "$1" in
8911         $define) echo "#include <$2>";;
8912         esac ;
8913     shift 2;
8914 done > try.c;
8915 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8916 set try;
8917 if eval $compile; then
8918         val="$define";
8919 else
8920         val="$undef";
8921 fi;
8922 set $varname;
8923 eval $setvar;
8924 $rm -f try.c try.o'
8925
8926 socketlib=''
8927 sockethdr=''
8928 : see whether socket exists
8929 echo " "
8930 $echo $n "Hmm... $c" >&4
8931 if set socket val -f d_socket; eval $csym; $val; then
8932         echo "Looks like you have Berkeley networking support." >&4
8933         d_socket="$define"
8934         if set setsockopt val -f; eval $csym; $val; then
8935                 d_oldsock="$undef"
8936         else
8937                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8938                 d_oldsock="$define"
8939         fi
8940 else
8941         if $contains socklib libc.list >/dev/null 2>&1; then
8942                 echo "Looks like you have Berkeley networking support." >&4
8943                 d_socket="$define"
8944                 : we will have to assume that it supports the 4.2 BSD interface
8945                 d_oldsock="$undef"
8946         else
8947                 echo "You don't have Berkeley networking in libc$_a..." >&4
8948                 if test "X$d_socket" = "X$define"; then
8949                    echo "...but you seem to believe that you have sockets." >&4
8950                 else
8951                         for net in net socket
8952                         do
8953                                 if test -f /usr/lib/lib$net$_a; then
8954                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8955                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8956                                         if $contains socket libc.list >/dev/null 2>&1; then
8957                                                 d_socket="$define"
8958                                                 socketlib="-l$net"
8959                                                 case "$net" in
8960                                                 net)
8961                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8962                                                         sockethdr="-I/usr/netinclude"
8963                                                         ;;
8964                                                 esac
8965                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8966                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8967                                                         d_oldsock="$undef"
8968                                                 else
8969                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8970                                                         d_oldsock="$define"
8971                                                 fi
8972                                                 break
8973                                         fi
8974                                 fi
8975                         done
8976                         if test "X$d_socket" != "X$define"; then
8977                            echo "or anywhere else I see." >&4
8978                            d_socket="$undef"
8979                            d_oldsock="$undef"
8980                         fi
8981                 fi
8982         fi
8983 fi
8984
8985 : see if socketpair exists
8986 set socketpair d_sockpair
8987 eval $inlibc
8988
8989
8990 echo " "
8991 echo "Checking the availability of certain socket constants..." >& 4
8992 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8993         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8994         $cat >try.c <<EOF
8995 #include <sys/types.h>
8996 #include <sys/socket.h>
8997 int main() {
8998     int i = $ENUM;
8999 }
9000 EOF
9001         val="$undef"
9002         set try; if eval $compile; then
9003                 val="$define"
9004         fi
9005         set d_${enum}; eval $setvar
9006         $rm -f try.c try
9007 done
9008
9009 : see if sys/select.h has to be included
9010 set sys/select.h i_sysselct
9011 eval $inhdr
9012
9013 : see if we should include time.h, sys/time.h, or both
9014 echo " "
9015 if test "X$timeincl" = X; then
9016         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9017         $echo $n "I'm now running the test program...$c"
9018         $cat >try.c <<'EOCP'
9019 #include <sys/types.h>
9020 #ifdef I_TIME
9021 #include <time.h>
9022 #endif
9023 #ifdef I_SYSTIME
9024 #ifdef SYSTIMEKERNEL
9025 #define KERNEL
9026 #endif
9027 #include <sys/time.h>
9028 #endif
9029 #ifdef I_SYSSELECT
9030 #include <sys/select.h>
9031 #endif
9032 int main()
9033 {
9034         struct tm foo;
9035 #ifdef S_TIMEVAL
9036         struct timeval bar;
9037 #endif
9038 #ifdef S_TIMEZONE
9039         struct timezone tzp;
9040 #endif
9041         if (foo.tm_sec == foo.tm_sec)
9042                 exit(0);
9043 #ifdef S_TIMEVAL
9044         if (bar.tv_sec == bar.tv_sec)
9045                 exit(0);
9046 #endif
9047         exit(1);
9048 }
9049 EOCP
9050         flags=''
9051         for s_timezone in '-DS_TIMEZONE' ''; do
9052         sysselect=''
9053         for s_timeval in '-DS_TIMEVAL' ''; do
9054         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9055         for i_time in '' '-DI_TIME'; do
9056         for i_systime in '-DI_SYSTIME' ''; do
9057                 case "$flags" in
9058                 '') $echo $n ".$c"
9059                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9060                         if eval $compile; then
9061                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9062                                 shift
9063                                 flags="$*"
9064                                 echo " "
9065                                 $echo $n "Succeeded with $flags$c"
9066                         fi
9067                         ;;
9068                 esac
9069         done
9070         done
9071         done
9072         done
9073         done
9074         timeincl=''
9075         echo " "
9076         case "$flags" in
9077         *SYSTIMEKERNEL*) i_systimek="$define"
9078                 timeincl=`./findhdr sys/time.h`
9079                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9080         *) i_systimek="$undef";;
9081         esac
9082         case "$flags" in
9083         *I_TIME*) i_time="$define"
9084                 timeincl=`./findhdr time.h`" $timeincl"
9085                 echo "We'll include <time.h>." >&4;;
9086         *) i_time="$undef";;
9087         esac
9088         case "$flags" in
9089         *I_SYSTIME*) i_systime="$define"
9090                 timeincl=`./findhdr sys/time.h`" $timeincl"
9091                 echo "We'll include <sys/time.h>." >&4;;
9092         *) i_systime="$undef";;
9093         esac
9094         $rm -f try.c try
9095 fi
9096
9097 : check for fd_set items
9098 $cat <<EOM
9099
9100 Checking to see how well your C compiler handles fd_set and friends ...
9101 EOM
9102 $cat >fd_set.c <<EOCP
9103 #$i_systime I_SYS_TIME
9104 #$i_sysselct I_SYS_SELECT
9105 #$d_socket HAS_SOCKET
9106 #include <sys/types.h>
9107 #ifdef HAS_SOCKET
9108 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9109 #endif
9110 #ifdef I_SYS_TIME
9111 #include <sys/time.h>
9112 #endif
9113 #ifdef I_SYS_SELECT
9114 #include <sys/select.h>
9115 #endif
9116 int main() {
9117         fd_set fds;
9118
9119 #ifdef TRYBITS
9120         if(fds.fds_bits);
9121 #endif
9122
9123 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9124         exit(0);
9125 #else
9126         exit(1);
9127 #endif
9128 }
9129 EOCP
9130 set fd_set -DTRYBITS
9131 if eval $compile; then
9132         d_fds_bits="$define"
9133         d_fd_set="$define"
9134         echo "Well, your system knows about the normal fd_set typedef..." >&4
9135         if ./fd_set; then
9136                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9137                 d_fd_macros="$define"
9138         else
9139                 $cat >&4 <<'EOM'
9140 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9141 EOM
9142                 d_fd_macros="$undef"
9143         fi
9144 else
9145         $cat <<'EOM'
9146 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9147 EOM
9148         set fd_set
9149         if eval $compile; then
9150                 d_fds_bits="$undef"
9151                 d_fd_set="$define"
9152                 echo "Well, your system has some sort of fd_set available..." >&4
9153                 if ./fd_set; then
9154                         echo "and you have the normal fd_set macros." >&4
9155                         d_fd_macros="$define"
9156                 else
9157                         $cat <<'EOM'
9158 but not the normal fd_set macros!  Gross!  More work for me...
9159 EOM
9160                         d_fd_macros="$undef"
9161                 fi
9162         else
9163         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9164                 d_fd_set="$undef"
9165                 d_fds_bits="$undef"
9166                 d_fd_macros="$undef"
9167         fi
9168 fi
9169 $rm -f fd_set*
9170
9171 : see if fgetpos exists
9172 set fgetpos d_fgetpos
9173 eval $inlibc
9174
9175 : see if flock exists
9176 set flock d_flock
9177 eval $inlibc
9178
9179 : see if fork exists
9180 set fork d_fork
9181 eval $inlibc
9182
9183 : see if pathconf exists
9184 set pathconf d_pathconf
9185 eval $inlibc
9186
9187 : see if fpathconf exists
9188 set fpathconf d_fpathconf
9189 eval $inlibc
9190
9191
9192 : check for fpos64_t
9193 echo " "
9194 echo "Checking to see if you have fpos64_t..." >&4
9195 $cat >try.c <<EOCP
9196 #include <stdio.h>
9197 int main() { fpos64_t x = 7; }
9198 EOCP
9199 set try
9200 if eval $compile; then
9201         val="$define"
9202         echo "You have fpos64_t."
9203 else
9204         val="$undef"
9205         echo "You do not have fpos64_t."
9206         case "$fpossize" in
9207         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9208         esac
9209 fi
9210 $rm -f try.* try
9211 set d_fpos64_t
9212 eval $setvar
9213
9214 : see if frexpl exists
9215 set frexpl d_frexpl
9216 eval $inlibc
9217
9218 hasstruct='varname=$1; struct=$2; shift; shift;
9219 while $test $# -ge 2; do
9220         case "$1" in
9221         $define) echo "#include <$2>";;
9222         esac ;
9223     shift 2;
9224 done > try.c;
9225 echo "int main () { struct $struct foo; }" >> try.c;
9226 set try;
9227 if eval $compile; then
9228         val="$define";
9229 else
9230         val="$undef";
9231 fi;
9232 set $varname;
9233 eval $setvar;
9234 $rm -f try.c try.o'
9235
9236 : see if this is a sys/param system
9237 set sys/param.h i_sysparam
9238 eval $inhdr
9239
9240 : see if this is a sys/mount.h system
9241 set sys/mount.h i_sysmount
9242 eval $inhdr
9243
9244 : see if sys/types.h has to be included
9245 set sys/types.h i_systypes
9246 eval $inhdr
9247
9248
9249 echo " "
9250 echo "Checking to see if your system supports struct fs_data..." >&4
9251 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9252 eval $hasstruct
9253 case "$d_fs_data_s" in
9254 "$define")      echo "Yes, it does."   ;;
9255 *)              echo "No, it doesn't." ;;
9256 esac
9257
9258 : see if fseeko exists
9259 set fseeko d_fseeko
9260 eval $inlibc
9261 case "$longsize" in
9262 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9263 esac
9264
9265 : see if fsetpos exists
9266 set fsetpos d_fsetpos
9267 eval $inlibc
9268
9269
9270 : see if fstatfs exists
9271 set fstatfs d_fstatfs
9272 eval $inlibc
9273
9274
9275 : see if statvfs exists
9276 set statvfs d_statvfs
9277 eval $inlibc
9278
9279 : see if fstatvfs exists
9280 set fstatvfs d_fstatvfs
9281 eval $inlibc
9282
9283
9284 : see if ftello exists
9285 set ftello d_ftello
9286 eval $inlibc
9287 case "$longsize" in
9288 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9289 esac
9290
9291 : see if getcwd exists
9292 set getcwd d_getcwd
9293 eval $inlibc
9294
9295 : see if getespwnam exists
9296 set getespwnam d_getespwnam
9297 eval $inlibc
9298
9299
9300 : see if getfsstat exists
9301 set getfsstat d_getfsstat
9302 eval $inlibc
9303
9304 : see if getgrent exists
9305 set getgrent d_getgrent
9306 eval $inlibc
9307
9308 : see if gethostbyaddr exists
9309 set gethostbyaddr d_gethbyaddr
9310 eval $inlibc
9311
9312 : see if gethostbyname exists
9313 set gethostbyname d_gethbyname
9314 eval $inlibc
9315
9316 : see if gethostent exists
9317 set gethostent d_gethent
9318 eval $inlibc
9319
9320 : see how we will look up host name
9321 echo " "
9322 call=''
9323 if set gethostname val -f d_gethname; eval $csym; $val; then
9324         echo 'gethostname() found.' >&4
9325         d_gethname="$define"
9326         call=gethostname
9327 fi
9328 if set uname val -f d_uname; eval $csym; $val; then
9329         if ./xenix; then
9330                 $cat <<'EOM'
9331 uname() was found, but you're running xenix, and older versions of xenix
9332 have a broken uname(). If you don't really know whether your xenix is old
9333 enough to have a broken system call, use the default answer.
9334
9335 EOM
9336                 dflt=y
9337                 case "$d_uname" in
9338                 "$define") dflt=n;;
9339                 esac
9340                 rp='Is your uname() broken?'
9341                 . ./myread
9342                 case "$ans" in
9343                 n*) d_uname="$define"; call=uname;;
9344                 esac
9345         else
9346                 echo 'uname() found.' >&4
9347                 d_uname="$define"
9348                 case "$call" in
9349                 '') call=uname ;;
9350                 esac
9351         fi
9352 fi
9353 case "$d_gethname" in
9354 '') d_gethname="$undef";;
9355 esac
9356 case "$d_uname" in
9357 '') d_uname="$undef";;
9358 esac
9359 case "$d_uname$d_gethname" in
9360 *define*)
9361         dflt=n
9362         cat <<EOM
9363  
9364 Every now and then someone has a $call() that lies about the hostname
9365 but can't be fixed for political or economic reasons.  If you wish, I can
9366 pretend $call() isn't there and maybe compute hostname at run-time
9367 thanks to the '$phostname' command.
9368
9369 EOM
9370         rp="Shall I ignore $call() from now on?"
9371         . ./myread
9372         case "$ans" in
9373         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9374         esac;;
9375 esac
9376 case "$phostname" in
9377 '') aphostname='';;
9378 *) case "$aphostname" in
9379         /*) ;;
9380         *) set X $phostname
9381                 shift
9382                 file=$1
9383                 shift
9384                 file=`./loc $file $file $pth`
9385                 aphostname=`echo $file $*`
9386                 ;;
9387         esac
9388         ;;
9389 esac
9390 case "$d_uname$d_gethname" in
9391 *define*) ;;
9392 *)
9393         case "$phostname" in
9394         '')
9395                 echo "There will be no way for $package to get your hostname." >&4;;
9396         *)
9397         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9398                 ;;
9399         esac;;
9400 esac
9401 case "$d_phostname" in
9402 '') d_phostname="$undef";;
9403 esac
9404
9405 : see if this is a netdb.h system
9406 set netdb.h i_netdb
9407 eval $inhdr
9408
9409 : see if prototypes for various gethostxxx netdb.h functions are available
9410 echo " "
9411 set d_gethostprotos gethostent $i_netdb netdb.h
9412 eval $hasproto
9413
9414 : see if getlogin exists
9415 set getlogin d_getlogin
9416 eval $inlibc
9417
9418 : see if getmnt exists
9419 set getmnt d_getmnt
9420 eval $inlibc
9421
9422 : see if getmntent exists
9423 set getmntent d_getmntent
9424 eval $inlibc
9425
9426 : see if getnetbyaddr exists
9427 set getnetbyaddr d_getnbyaddr
9428 eval $inlibc
9429
9430 : see if getnetbyname exists
9431 set getnetbyname d_getnbyname
9432 eval $inlibc
9433
9434 : see if getnetent exists
9435 set getnetent d_getnent
9436 eval $inlibc
9437
9438 : see if prototypes for various getnetxxx netdb.h functions are available
9439 echo " "
9440 set d_getnetprotos getnetent $i_netdb netdb.h
9441 eval $hasproto
9442
9443
9444 : see if getprotobyname exists
9445 set getprotobyname d_getpbyname
9446 eval $inlibc
9447
9448 : see if getprotobynumber exists
9449 set getprotobynumber d_getpbynumber
9450 eval $inlibc
9451
9452 : see if getprotoent exists
9453 set getprotoent d_getpent
9454 eval $inlibc
9455
9456 : see if getpgid exists
9457 set getpgid d_getpgid
9458 eval $inlibc
9459
9460 : see if getpgrp2 exists
9461 set getpgrp2 d_getpgrp2
9462 eval $inlibc
9463
9464 : see if getppid exists
9465 set getppid d_getppid
9466 eval $inlibc
9467
9468 : see if getpriority exists
9469 set getpriority d_getprior
9470 eval $inlibc
9471
9472 : see if prototypes for various getprotoxxx netdb.h functions are available
9473 echo " "
9474 set d_getprotoprotos getprotoent $i_netdb netdb.h
9475 eval $hasproto
9476
9477 : see if getprpwnam exists
9478 set getprpwnam d_getprpwnam
9479 eval $inlibc
9480
9481 : see if getpwent exists
9482 set getpwent d_getpwent
9483 eval $inlibc
9484
9485
9486 : see if getservbyname exists
9487 set getservbyname d_getsbyname
9488 eval $inlibc
9489
9490 : see if getservbyport exists
9491 set getservbyport d_getsbyport
9492 eval $inlibc
9493
9494 : see if getservent exists
9495 set getservent d_getsent
9496 eval $inlibc
9497
9498 : see if prototypes for various getservxxx netdb.h functions are available
9499 echo " "
9500 set d_getservprotos getservent $i_netdb netdb.h
9501 eval $hasproto
9502
9503 : see if getspnam exists
9504 set getspnam d_getspnam
9505 eval $inlibc
9506
9507 : see if gettimeofday or ftime exists
9508 set gettimeofday d_gettimeod
9509 eval $inlibc
9510 case "$d_gettimeod" in
9511 "$undef")
9512         set ftime d_ftime 
9513         eval $inlibc
9514         ;;
9515 *)
9516         val="$undef"; set d_ftime; eval $setvar
9517         ;;
9518 esac
9519 case "$d_gettimeod$d_ftime" in
9520 "$undef$undef")
9521         echo " "
9522         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9523         ;;
9524 esac
9525
9526 : see if this is an grp system
9527 set grp.h i_grp
9528 eval $inhdr
9529
9530 case "$i_grp" in
9531 $define)
9532         xxx=`./findhdr grp.h`
9533         $cppstdin $cppflags $cppminus < $xxx >$$.h
9534
9535         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9536                 val="$define"
9537         else
9538                 val="$undef"
9539         fi
9540         set d_grpasswd
9541         eval $setvar
9542
9543         $rm -f $$.h
9544         ;;
9545 *)
9546         val="$undef";
9547         set d_grpasswd; eval $setvar
9548         ;;
9549 esac
9550
9551 : see if hasmntopt exists
9552 set hasmntopt d_hasmntopt
9553 eval $inlibc
9554
9555 : see if this is a netinet/in.h or sys/in.h system
9556 set netinet/in.h i_niin sys/in.h i_sysin
9557 eval $inhdr
9558
9559 : see if arpa/inet.h has to be included
9560 set arpa/inet.h i_arpainet
9561 eval $inhdr
9562
9563 : see if htonl --and friends-- exists
9564 val=''
9565 set htonl val
9566 eval $inlibc
9567
9568 : Maybe they are macros.
9569 case "$val" in
9570 $undef)
9571         $cat >htonl.c <<EOM
9572 #include <stdio.h>
9573 #include <sys/types.h>
9574 #$i_niin I_NETINET_IN
9575 #$i_sysin I_SYS_IN
9576 #$i_arpainet I_ARPA_INET
9577 #ifdef I_NETINET_IN
9578 #include <netinet/in.h>
9579 #endif
9580 #ifdef I_SYS_IN
9581 #include <sys/in.h>
9582 #endif
9583 #ifdef I_ARPA_INET
9584 #include <arpa/inet.h>
9585 #endif
9586 #ifdef htonl
9587 printf("Defined as a macro.");
9588 #endif
9589 EOM
9590         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9591         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9592                 val="$define"
9593                 echo "But it seems to be defined as a macro." >&4
9594         fi
9595         $rm -f htonl.?
9596         ;;
9597 esac
9598 set d_htonl
9599 eval $setvar
9600
9601 : see if iconv exists
9602 set iconv d_iconv
9603 eval $inlibc
9604
9605 : index or strchr
9606 echo " "
9607 if set index val -f; eval $csym; $val; then
9608         if set strchr val -f d_strchr; eval $csym; $val; then
9609                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9610                         val="$define"
9611                         vali="$undef"
9612                         echo "strchr() found." >&4
9613                 else
9614                         val="$undef"
9615                         vali="$define"
9616                         echo "index() found." >&4
9617                 fi
9618         else
9619                 val="$undef"
9620                 vali="$define"
9621                 echo "index() found." >&4
9622         fi
9623 else
9624         if set strchr val -f d_strchr; eval $csym; $val; then
9625                 val="$define"
9626                 vali="$undef"
9627                 echo "strchr() found." >&4
9628         else
9629                 echo "No index() or strchr() found!" >&4
9630                 val="$undef"
9631                 vali="$undef"
9632         fi
9633 fi
9634 set d_strchr; eval $setvar
9635 val="$vali"
9636 set d_index; eval $setvar
9637
9638 : check whether inet_aton exists
9639 set inet_aton d_inetaton
9640 eval $inlibc
9641
9642 : see if inttypes.h is available
9643 : we want a real compile instead of Inhdr because some systems
9644 : have an inttypes.h which includes non-existent headers
9645 echo " "
9646 $cat >try.c <<EOCP
9647 #include <inttypes.h>
9648 int main() {
9649         static int32_t foo32 = 0x12345678;
9650 }
9651 EOCP
9652 set try
9653 if eval $compile; then
9654         echo "<inttypes.h> found." >&4
9655         val="$define"
9656 else
9657         echo "<inttypes.h> NOT found." >&4
9658         val="$undef"
9659 fi
9660 $rm -f try.c try
9661 set i_inttypes
9662 eval $setvar
9663
9664 : check for int64_t
9665 echo " "
9666 echo "Checking to see if you have int64_t..." >&4
9667 $cat >try.c <<EOCP
9668 #include <sys/types.h>
9669 #$i_inttypes I_INTTYPES
9670 #ifdef I_INTTYPES
9671 #include <inttypes.h>
9672 #endif
9673 int main() { int64_t x = 7; }
9674 EOCP
9675 set try
9676 if eval $compile; then
9677         val="$define"
9678         echo "You have int64_t."
9679 else
9680         val="$undef"
9681         echo "You do not have int64_t."
9682 fi
9683 $rm -f try try.*
9684 set d_int64_t
9685 eval $setvar
9686
9687 : Look for isascii
9688 echo " "
9689 $cat >isascii.c <<'EOCP'
9690 #include <stdio.h>
9691 #include <ctype.h>
9692 int main() {
9693         int c = 'A';
9694         if (isascii(c))
9695                 exit(0);
9696         else
9697                 exit(1);
9698 }
9699 EOCP
9700 set isascii
9701 if eval $compile; then
9702         echo "isascii() found." >&4
9703         val="$define"
9704 else
9705         echo "isascii() NOT found." >&4
9706         val="$undef"
9707 fi
9708 set d_isascii
9709 eval $setvar
9710 $rm -f isascii*
9711
9712 : see if isnan exists
9713 set isnan d_isnan
9714 eval $inlibc
9715
9716 : see if isnanl exists
9717 set isnanl d_isnanl
9718 eval $inlibc
9719
9720 : see if killpg exists
9721 set killpg d_killpg
9722 eval $inlibc
9723
9724 : see if lchown exists
9725 echo " "
9726 $cat > try.c <<'EOCP'
9727 /* System header to define __stub macros and hopefully few prototypes,
9728     which can conflict with char lchown(); below.  */
9729 #include <assert.h>
9730 /* Override any gcc2 internal prototype to avoid an error.  */
9731 /* We use char because int might match the return type of a gcc2
9732    builtin and then its argument prototype would still apply.  */
9733 char lchown();
9734 int main() {
9735     /*  The GNU C library defines this for functions which it implements
9736         to always fail with ENOSYS.  Some functions are actually named
9737         something starting with __ and the normal name is an alias.  */
9738 #if defined (__stub_lchown) || defined (__stub___lchown)
9739 choke me
9740 #else
9741 lchown();
9742 #endif
9743 ; return 0; }
9744 EOCP
9745 set try
9746 if eval $compile; then
9747     $echo "lchown() found." >&4
9748     val="$define"
9749 else
9750     $echo "lchown() NOT found." >&4
9751     val="$undef"
9752 fi
9753 set d_lchown
9754 eval $setvar
9755
9756 : See if number of significant digits in a double precision number is known
9757 echo " "
9758 $cat >ldbl_dig.c <<EOM
9759 #$i_limits I_LIMITS
9760 #$i_float I_FLOAT
9761 #ifdef I_LIMITS
9762 #include <limits.h>
9763 #endif
9764 #ifdef I_FLOAT
9765 #include <float.h>
9766 #endif
9767 #ifdef LDBL_DIG
9768 printf("Contains LDBL_DIG");
9769 #endif
9770 EOM
9771 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9772 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9773         echo "LDBL_DIG found." >&4
9774         val="$define"
9775 else
9776         echo "LDBL_DIG NOT found." >&4
9777         val="$undef"
9778 fi
9779 $rm -f ldbl_dig.?
9780 set d_ldbl_dig
9781 eval $setvar
9782
9783 : see if link exists
9784 set link d_link
9785 eval $inlibc
9786
9787 : see if localeconv exists
9788 set localeconv d_locconv
9789 eval $inlibc
9790
9791 : see if lockf exists
9792 set lockf d_lockf
9793 eval $inlibc
9794
9795 : check for long long
9796 echo " "
9797 echo "Checking to see if you have long long..." >&4
9798 echo 'int main() { long long x = 7; return 0; }' > try.c
9799 set try
9800 if eval $compile; then
9801         val="$define"
9802         echo "You have long long."
9803 else
9804         val="$undef"
9805         echo "You do not have long long."
9806 fi
9807 $rm try.*
9808 set d_longlong
9809 eval $setvar
9810
9811 : check for length of long long
9812 case "${d_longlong}${longlongsize}" in
9813 $define)
9814         echo " "
9815         echo "Checking to see how big your long longs are..." >&4
9816         $cat >try.c <<'EOCP'
9817 #include <stdio.h>
9818 int main()
9819 {
9820     printf("%d\n", (int)sizeof(long long));
9821     return(0);
9822 }
9823 EOCP
9824         set try
9825         if eval $compile_ok; then
9826                 longlongsize=`./try$exe_ext`
9827                 echo "Your long longs are $longlongsize bytes long."
9828         else
9829                 dflt='8'
9830                 echo " "
9831                 echo "(I can't seem to compile the test program.  Guessing...)"
9832                 rp="What is the size of a long long (in bytes)?"
9833                 . ./myread
9834                 longlongsize="$ans"
9835         fi
9836         if $test "X$longsize" = "X$longlongsize"; then
9837                 echo "(That isn't any different from an ordinary long.)"
9838         fi      
9839         ;;
9840 esac
9841 $rm -f try.* try
9842
9843 : see if prototype for lseek is available
9844 echo " "
9845 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9846 eval $hasproto
9847
9848 : see if lstat exists
9849 set lstat d_lstat
9850 eval $inlibc
9851
9852 : see if madvise exists
9853 set madvise d_madvise
9854 eval $inlibc
9855
9856 : see if mblen exists
9857 set mblen d_mblen
9858 eval $inlibc
9859
9860 : see if mbstowcs exists
9861 set mbstowcs d_mbstowcs
9862 eval $inlibc
9863
9864 : see if mbtowc exists
9865 set mbtowc d_mbtowc
9866 eval $inlibc
9867
9868 : see if memchr exists
9869 set memchr d_memchr
9870 eval $inlibc
9871
9872 : see if memcmp exists
9873 set memcmp d_memcmp
9874 eval $inlibc
9875
9876 : see if memcpy exists
9877 set memcpy d_memcpy
9878 eval $inlibc
9879
9880 : see if memmove exists
9881 set memmove d_memmove
9882 eval $inlibc
9883
9884 : see if memset exists
9885 set memset d_memset
9886 eval $inlibc
9887
9888 : see if mkdir exists
9889 set mkdir d_mkdir
9890 eval $inlibc
9891
9892 : see if mkdtemp exists
9893 set mkdtemp d_mkdtemp
9894 eval $inlibc
9895
9896 : see if mkfifo exists
9897 set mkfifo d_mkfifo
9898 eval $inlibc
9899
9900 : see if mkstemp exists
9901 set mkstemp d_mkstemp
9902 eval $inlibc
9903
9904 : see if mkstemps exists
9905 set mkstemps d_mkstemps
9906 eval $inlibc
9907
9908 : see if mktime exists
9909 set mktime d_mktime
9910 eval $inlibc
9911
9912 : see if this is a sys/mman.h system
9913 set sys/mman.h i_sysmman
9914 eval $inhdr
9915
9916 : see if mmap exists
9917 set mmap d_mmap
9918 eval $inlibc
9919 : see what shmat returns
9920 : default to something harmless
9921 mmaptype='void *'
9922 case "$i_sysmman$d_mmap" in
9923 "$define$define")
9924         $cat >mmap.c <<'END'
9925 #include <sys/mman.h>
9926 void *mmap();
9927 END
9928         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9929                 mmaptype='void *'
9930         else
9931                 mmaptype='caddr_t'
9932         fi
9933         echo "and it returns ($mmaptype)." >&4
9934         ;;
9935 esac
9936
9937
9938
9939 : see if modfl exists
9940 set modfl d_modfl
9941 eval $inlibc
9942
9943 : see if mprotect exists
9944 set mprotect d_mprotect
9945 eval $inlibc
9946
9947 : see if msgctl exists
9948 set msgctl d_msgctl
9949 eval $inlibc
9950
9951 : see if msgget exists
9952 set msgget d_msgget
9953 eval $inlibc
9954
9955 : see if msgsnd exists
9956 set msgsnd d_msgsnd
9957 eval $inlibc
9958
9959 : see if msgrcv exists
9960 set msgrcv d_msgrcv
9961 eval $inlibc
9962
9963 : see how much of the 'msg*(2)' library is present.
9964 h_msg=true
9965 echo " "
9966 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9967 *"$undef"*) h_msg=false;;
9968 esac
9969 case "$osname" in
9970 freebsd)
9971     case "`ipcs 2>&1`" in
9972     "SVID messages"*"not configured"*)
9973         echo "Your $osname does not have the msg*(2) configured." >&4
9974         h_msg=false
9975         val="$undef"
9976         set msgctl d_msgctl
9977         eval $setvar
9978         set msgget d_msgget
9979         eval $setvar
9980         set msgsnd d_msgsnd
9981         eval $setvar
9982         set msgrcv d_msgrcv
9983         eval $setvar
9984         ;;
9985     esac
9986     ;;
9987 esac
9988 : we could also check for sys/ipc.h ...
9989 if $h_msg && $test `./findhdr sys/msg.h`; then
9990         echo "You have the full msg*(2) library." >&4
9991         val="$define"
9992 else
9993         echo "You don't have the full msg*(2) library." >&4
9994         val="$undef"
9995 fi
9996 set d_msg
9997 eval $setvar
9998
9999 : see if msync exists
10000 set msync d_msync
10001 eval $inlibc
10002
10003 : see if munmap exists
10004 set munmap d_munmap
10005 eval $inlibc
10006
10007 : see if nice exists
10008 set nice d_nice
10009 eval $inlibc
10010
10011
10012 echo " "
10013 echo "Checking which 64-bit integer type we could use..." >&4
10014
10015 case "$intsize" in
10016 8) val=int
10017    set quadtype
10018    eval $setvar
10019    val='"unsigned int"'
10020    set uquadtype
10021    eval $setvar
10022    quadkind=1
10023    ;;
10024 *) case "$longsize" in
10025    8) val=long
10026       set quadtype
10027       eval $setvar
10028       val='"unsigned long"'
10029       set uquadtype
10030       eval $setvar
10031       quadkind=2
10032       ;;
10033    *) case "$d_longlong:$longlongsize" in
10034       define:8)
10035         val='"long long"'
10036         set quadtype
10037         eval $setvar
10038         val='"unsigned long long"'
10039         set uquadtype
10040         eval $setvar
10041         quadkind=3
10042         ;;
10043       *) case "$d_int64_t" in
10044          define)
10045            val=int64_t
10046            set quadtype
10047            eval $setvar
10048            val=uint64_t
10049            set uquadtype
10050            eval $setvar
10051            quadkind=4
10052            ;;
10053          esac
10054          ;;
10055       esac
10056       ;;
10057    esac
10058    ;;
10059 esac
10060
10061 case "$quadtype" in
10062 '')     echo "Alas, no 64-bit integer types in sight." >&4
10063         d_quad="$undef"
10064         ;;
10065 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10066             verb="will"
10067         else
10068             verb="could"
10069         fi
10070         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10071         d_quad="$define"
10072         ;;
10073 esac
10074
10075 : check for length of character
10076 echo " "
10077 case "$charsize" in
10078 '')
10079         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10080         $cat >try.c <<'EOCP'
10081 #include <stdio.h>
10082 int main()
10083 {
10084     printf("%d\n", (int)sizeof(char));
10085     exit(0);
10086 }
10087 EOCP
10088         set try
10089         if eval $compile_ok; then
10090                 dflt=`./try`
10091         else
10092                 dflt='1'
10093                 echo "(I can't seem to compile the test program.  Guessing...)"
10094         fi
10095         ;;
10096 *)
10097         dflt="$charsize"
10098         ;;
10099 esac
10100 rp="What is the size of a character (in bytes)?"
10101 . ./myread
10102 charsize="$ans"
10103 $rm -f try.c try
10104
10105
10106 echo " "
10107 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10108
10109 case "$use64bitint:$d_quad:$quadtype" in
10110 define:define:?*)
10111         ivtype="$quadtype"
10112         uvtype="$uquadtype"
10113         ivsize=8
10114         uvsize=8
10115         ;;
10116 *)      ivtype="long"
10117         uvtype="unsigned long"
10118         ivsize=$longsize
10119         uvsize=$longsize
10120         ;;
10121 esac
10122
10123 case "$uselongdouble:$d_longdbl" in
10124 define:define)
10125         nvtype="long double"
10126         nvsize=$longdblsize
10127         ;;
10128 *)      nvtype=double
10129         nvsize=$doublesize
10130         ;;
10131 esac
10132
10133 $echo "(IV will be "$ivtype", $ivsize bytes)"
10134 $echo "(UV will be "$uvtype", $uvsize bytes)"
10135 $echo "(NV will be "$nvtype", $nvsize bytes)"
10136
10137 $cat >try.c <<EOCP
10138 #$i_inttypes I_INTTYPES
10139 #ifdef I_INTTYPES
10140 #include <inttypes.h>
10141 #endif
10142 #include <stdio.h>
10143 int main() {
10144 #ifdef INT8
10145    int8_t i =  INT8_MAX;
10146   uint8_t u = UINT8_MAX;
10147   printf("int8_t\n");
10148 #endif
10149 #ifdef INT16
10150    int16_t i =  INT16_MAX;
10151   uint16_t i = UINT16_MAX;
10152   printf("int16_t\n");
10153 #endif
10154 #ifdef INT32
10155    int32_t i =  INT32_MAX;
10156   uint32_t u = UINT32_MAX;
10157   printf("int32_t\n");
10158 #endif
10159 }
10160 EOCP
10161
10162 case "$i8type" in
10163 '')     case "$charsize" in
10164         1)      i8type=char
10165                 u8type="unsigned char"
10166                 i8size=$charsize
10167                 u8size=$charsize
10168                 ;;
10169         esac
10170         ;;
10171 esac
10172 case "$i8type" in
10173 '')     set try -DINT8
10174         if eval $compile; then
10175                 case "`./try$exe_ext`" in
10176                 int8_t) i8type=int8_t
10177                         u8type=uint8_t
10178                         i8size=1
10179                         u8size=1
10180                         ;;
10181                 esac
10182         fi
10183         ;;
10184 esac
10185 case "$i8type" in
10186 '')     if $test $charsize -ge 1; then
10187                 i8type=char
10188                 u8type="unsigned char"
10189                 i8size=$charsize
10190                 u8size=$charsize
10191         fi
10192         ;;
10193 esac
10194
10195 case "$i16type" in
10196 '')     case "$shortsize" in
10197         2)      i16type=short
10198                 u16type="unsigned short"
10199                 i16size=$shortsize
10200                 u16size=$shortsize
10201                 ;;
10202         esac
10203         ;;
10204 esac
10205 case "$i16type" in
10206 '')     set try -DINT16
10207         if eval $compile; then
10208                 case "`./try$exe_ext`" in
10209                 int16_t)
10210                         i16type=int16_t
10211                         u16type=uint16_t
10212                         i16size=2
10213                         u16size=2
10214                         ;;
10215                 esac
10216         fi
10217         ;;
10218 esac
10219 case "$i16type" in
10220 '')     if $test $shortsize -ge 2; then
10221                 i16type=short
10222                 u16type="unsigned short"
10223                 i16size=$shortsize
10224                 u16size=$shortsize
10225         fi
10226         ;;
10227 esac
10228
10229 case "$i32type" in
10230 '')     case "$longsize" in
10231         4)      i32type=long
10232                 u32type="unsigned long"
10233                 i32size=$longsize
10234                 u32size=$longsize
10235                 ;;
10236         *)      case "$intsize" in
10237                 4)      i32type=int
10238                         u32type="unsigned int"
10239                         i32size=$intsize
10240                         u32size=$intsize
10241                         ;;
10242                 esac
10243                 ;;
10244         esac
10245         ;;
10246 esac
10247 case "$i32type" in
10248 '')     set try -DINT32
10249         if eval $compile; then
10250                 case "`./try$exe_ext`" in
10251                 int32_t)
10252                         i32type=int32_t
10253                         u32type=uint32_t
10254                         i32size=4
10255                         u32size=4
10256                         ;;
10257                 esac
10258         fi
10259         ;;
10260 esac
10261 case "$i32type" in
10262 '')     if $test $intsize -ge 4; then
10263                 i32type=int
10264                 u32type="unsigned int"
10265                 i32size=$intsize
10266                 u32size=$intsize
10267         fi
10268         ;;
10269 esac
10270
10271 case "$i64type" in
10272 '')     case "$d_quad:$quadtype" in
10273         define:?*)
10274                 i64type="$quadtype"
10275                 u64type="$uquadtype"
10276                 i64size=8
10277                 u64size=8
10278                 ;;
10279         esac
10280         ;;
10281 esac
10282
10283 $echo "Checking whether your NVs can preserve your UVs..." >&4
10284 $cat <<EOP >try.c
10285 #include <stdio.h>
10286 int main() {
10287     $uvtype k = ($uvtype)~0, l;
10288     $nvtype d;
10289     l = k;
10290     d = ($nvtype)l;
10291     l = ($uvtype)d;
10292     if (l == k)
10293        printf("preserve\n");
10294     exit(0);
10295 }
10296 EOP
10297 set try
10298 if eval $compile; then
10299         case "`./try$exe_ext`" in
10300         preserve) d_nv_preserves_uv="$define" ;;
10301         esac
10302 fi      
10303 case "$d_nv_preserves_uv" in
10304 $define) $echo "Yes, they can."  2>&1 ;;
10305 *)       $echo "No, they can't." 2>&1
10306          d_nv_preserves_uv="$undef"
10307          ;;
10308 esac
10309
10310 $rm -f try.* try
10311
10312 case "$d_nv_preserves_uv" in
10313 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10314 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10315         $cat <<EOP >try.c
10316 #include <stdio.h>
10317 int main() {
10318     $uvtype u = 0;
10319     int     n = 8 * $uvsize;
10320     int     i;
10321     for (i = 0; i < n; i++) {
10322       u = u << 1 | ($uvtype)1;
10323       if (($uvtype)($nvtype)u != u)
10324         break;
10325     }
10326     printf("%d\n", i);
10327     exit(0);
10328 }
10329 EOP
10330         set try
10331         if eval $compile; then
10332                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10333         fi
10334         case "$d_nv_preserves_uv_bits" in
10335         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10336         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10337                 d_nv_preserves_uv_bits="$undef"
10338                 ;;
10339         esac
10340         $rm -f try.* try
10341         ;;
10342 esac
10343
10344
10345
10346 : check for off64_t
10347 echo " "
10348 echo "Checking to see if you have off64_t..." >&4
10349 $cat >try.c <<EOCP
10350 #include <sys/types.h>
10351 #include <unistd.h>
10352 int main() { off64_t x = 7; }
10353 EOCP
10354 set try
10355 if eval $compile; then
10356         val="$define"
10357         echo "You have off64_t."
10358 else
10359         val="$undef"
10360         echo "You do not have off64_t."
10361         case "$lseeksize" in
10362         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10363         esac
10364 fi
10365 $rm -f try.* try
10366 set d_off64_t
10367 eval $setvar
10368
10369 : see if POSIX threads are available
10370 set pthread.h i_pthread
10371 eval $inhdr
10372
10373
10374
10375
10376 : how to create joinable pthreads
10377 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10378         echo " "
10379         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10380         $cat >try.c <<'EOCP'
10381 #include <pthread.h>
10382 int main() {
10383     int detachstate = JOINABLE;
10384 }
10385 EOCP
10386         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10387         if eval $compile; then
10388                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10389                 val="$undef" # Yes, undef.
10390                 set d_old_pthread_create_joinable
10391                 eval $setvar
10392                 val=""
10393                 set old_pthread_create_joinable
10394                 eval $setvar
10395         else
10396                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10397                 if eval $compile; then
10398                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10399                         val="$define"
10400                         set d_old_pthread_create_joinable
10401                         eval $setvar
10402                         val=PTHREAD_CREATE_UNDETACHED
10403                         set old_pthread_create_joinable
10404                         eval $setvar
10405                 else            
10406                         set try -DJOINABLE=__UNDETACHED
10407                         if eval $compile; then
10408                                 echo "You seem to use __UNDETACHED." >&4
10409                                 val="$define"
10410                                 set d_old_pthread_create_joinable
10411                                 eval $setvar
10412                                 val=__UNDETACHED
10413                                 set old_pthread_create_joinable
10414                                 eval $setvar
10415                         else
10416                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10417                                 val="$define"
10418                                 set d_old_pthread_create_joinable
10419                                 eval $setvar
10420                                 val=0
10421                                 set old_pthread_create_joinable
10422                                 eval $setvar
10423                         fi
10424                 fi
10425         fi
10426         $rm -f try try.*
10427 else
10428     d_old_pthread_create_joinable="$undef"
10429     old_pthread_create_joinable=""
10430 fi
10431
10432 : see if pause exists
10433 set pause d_pause
10434 eval $inlibc
10435
10436 : see if pipe exists
10437 set pipe d_pipe
10438 eval $inlibc
10439
10440 : see if poll exists
10441 set poll d_poll
10442 eval $inlibc
10443
10444
10445 : see whether the various POSIXish _yields exist
10446 $cat >try.c <<EOP
10447 #include <pthread.h>
10448 #include <stdio.h>
10449 int main() {
10450 #ifdef SCHED_YIELD
10451         sched_yield();
10452 #else
10453 #ifdef PTHREAD_YIELD
10454         pthread_yield();
10455 #else
10456 #ifdef PTHREAD_YIELD_NULL
10457         pthread_yield(NULL);
10458 #endif
10459 #endif
10460 #endif
10461 }
10462 EOP
10463 : see if sched_yield exists
10464 set try -DSCHED_YIELD
10465 if eval $compile; then
10466     val="$define"
10467     sched_yield='sched_yield()'
10468 else
10469     val="$undef"
10470 fi
10471 case "$usethreads" in
10472 $define)
10473         case "$val" in
10474         $define) echo 'sched_yield() found.' >&4        ;;
10475         *)       echo 'sched_yield() NOT found.' >&4    ;;
10476         esac
10477 esac
10478 set d_sched_yield
10479 eval $setvar
10480
10481 : see if pthread_yield exists
10482 set try -DPTHREAD_YIELD
10483 if eval $compile; then
10484     val="$define"
10485     case "$sched_yield" in
10486     '') sched_yield='pthread_yield()' ;;
10487     esac
10488 else
10489     set try -DPTHREAD_YIELD_NULL
10490     if eval $compile; then
10491         val="$define"
10492         case "$sched_yield" in
10493         '') sched_yield='pthread_yield(NULL)' ;;
10494         esac
10495     else
10496         val="$undef"
10497     fi
10498 fi
10499 case "$usethreads" in
10500 $define)
10501         case "$val" in
10502         $define) echo 'pthread_yield() found.' >&4      ;;
10503         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10504         esac
10505         ;;
10506 esac
10507 set d_pthread_yield
10508 eval $setvar
10509
10510 case "$sched_yield" in
10511 '') sched_yield=undef ;;
10512 esac
10513
10514 $rm -f try try.*
10515
10516 : see if this is a pwd.h system
10517 set pwd.h i_pwd
10518 eval $inhdr
10519
10520 case "$i_pwd" in
10521 $define)
10522         xxx=`./findhdr pwd.h`
10523         $cppstdin $cppflags $cppminus < $xxx >$$.h
10524
10525         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10526                 val="$define"
10527         else
10528                 val="$undef"
10529         fi
10530         set d_pwquota
10531         eval $setvar
10532
10533         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10534                 val="$define"
10535         else
10536                 val="$undef"
10537         fi
10538         set d_pwage
10539         eval $setvar
10540
10541         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10542                 val="$define"
10543         else
10544                 val="$undef"
10545         fi
10546         set d_pwchange
10547         eval $setvar
10548
10549         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10550                 val="$define"
10551         else
10552                 val="$undef"
10553         fi
10554         set d_pwclass
10555         eval $setvar
10556
10557         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10558                 val="$define"
10559         else
10560                 val="$undef"
10561         fi
10562         set d_pwexpire
10563         eval $setvar
10564
10565         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10566                 val="$define"
10567         else
10568                 val="$undef"
10569         fi
10570         set d_pwcomment
10571         eval $setvar
10572
10573         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10574                 val="$define"
10575         else
10576                 val="$undef"
10577         fi
10578         set d_pwgecos
10579         eval $setvar
10580
10581         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10582                 val="$define"
10583         else
10584                 val="$undef"
10585         fi
10586         set d_pwpasswd
10587         eval $setvar
10588
10589         $rm -f $$.h
10590         ;;
10591 *)
10592         val="$undef"; 
10593         set d_pwquota; eval $setvar
10594         set d_pwage; eval $setvar
10595         set d_pwchange; eval $setvar
10596         set d_pwclass; eval $setvar
10597         set d_pwexpire; eval $setvar
10598         set d_pwcomment; eval $setvar
10599         set d_pwgecos; eval $setvar
10600         set d_pwpasswd; eval $setvar
10601         ;;
10602 esac
10603
10604 : see if readdir and friends exist
10605 set readdir d_readdir
10606 eval $inlibc
10607 set seekdir d_seekdir
10608 eval $inlibc
10609 set telldir d_telldir
10610 eval $inlibc
10611 set rewinddir d_rewinddir
10612 eval $inlibc
10613
10614 : see if readlink exists
10615 set readlink d_readlink
10616 eval $inlibc
10617
10618 : see if rename exists
10619 set rename d_rename
10620 eval $inlibc
10621
10622 : see if rmdir exists
10623 set rmdir d_rmdir
10624 eval $inlibc
10625
10626 : see if memory.h is available.
10627 val=''
10628 set memory.h val
10629 eval $inhdr
10630
10631 : See if it conflicts with string.h
10632 case "$val" in
10633 $define)
10634         case "$strings" in
10635         '') ;;
10636         *)
10637                 $cppstdin $cppflags $cppminus < $strings > mem.h
10638                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10639                         echo " "
10640                         echo "We won't be including <memory.h>."
10641                         val="$undef"
10642                 fi
10643                 $rm -f mem.h
10644                 ;;
10645         esac
10646 esac
10647 set i_memory
10648 eval $setvar
10649
10650 : can bcopy handle overlapping blocks?
10651 val="$undef"
10652 case "$d_bcopy" in
10653 "$define")
10654         echo " "
10655         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10656         $cat >try.c <<EOCP
10657 #$i_memory I_MEMORY
10658 #$i_stdlib I_STDLIB
10659 #$i_string I_STRING
10660 #$i_unistd I_UNISTD
10661 EOCP
10662         $cat >>try.c <<'EOCP'
10663 #include <stdio.h>
10664 #ifdef I_MEMORY
10665 #  include <memory.h>
10666 #endif
10667 #ifdef I_STDLIB
10668 #  include <stdlib.h>
10669 #endif
10670 #ifdef I_STRING
10671 #  include <string.h>
10672 #else
10673 #  include <strings.h>
10674 #endif
10675 #ifdef I_UNISTD
10676 #  include <unistd.h>  /* Needed for NetBSD */
10677 #endif
10678 int main()
10679 {
10680 char buf[128], abc[128];
10681 char *b;
10682 int len;
10683 int off;
10684 int align;
10685
10686 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10687
10688 for (align = 7; align >= 0; align--) {
10689         for (len = 36; len; len--) {
10690                 b = buf+align;
10691                 bcopy(abc, b, len);
10692                 for (off = 1; off <= len; off++) {
10693                         bcopy(b, b+off, len);
10694                         bcopy(b+off, b, len);
10695                         if (bcmp(b, abc, len))
10696                                 exit(1);
10697                 }
10698         }
10699 }
10700 exit(0);
10701 }
10702 EOCP
10703         set try
10704         if eval $compile_ok; then
10705                 if ./try 2>/dev/null; then
10706                         echo "Yes, it can."
10707                         val="$define"
10708                 else
10709                         echo "It can't, sorry."
10710                         case "$d_memmove" in
10711                         "$define") echo "But that's Ok since you have memmove()." ;;
10712                         esac
10713                 fi
10714         else
10715                 echo "(I can't compile the test program, so we'll assume not...)"
10716                 case "$d_memmove" in
10717                 "$define") echo "But that's Ok since you have memmove()." ;;
10718                 esac
10719         fi
10720         ;;
10721 esac
10722 $rm -f try.* try core
10723 set d_safebcpy
10724 eval $setvar
10725
10726 : can memcpy handle overlapping blocks?
10727 val="$undef"
10728 case "$d_memcpy" in
10729 "$define")
10730         echo " "
10731         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10732         $cat >try.c <<EOCP
10733 #$i_memory I_MEMORY
10734 #$i_stdlib I_STDLIB
10735 #$i_string I_STRING
10736 #$i_unistd I_UNISTD
10737 EOCP
10738         $cat >>try.c <<'EOCP'
10739 #include <stdio.h>
10740 #ifdef I_MEMORY
10741 #  include <memory.h>
10742 #endif
10743 #ifdef I_STDLIB
10744 #  include <stdlib.h>
10745 #endif
10746 #ifdef I_STRING
10747 #  include <string.h>
10748 #else
10749 #  include <strings.h>
10750 #endif
10751 #ifdef I_UNISTD
10752 #  include <unistd.h>  /* Needed for NetBSD */
10753 #endif
10754 int main()
10755 {
10756 char buf[128], abc[128];
10757 char *b;
10758 int len;
10759 int off;
10760 int align;
10761
10762 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10763    try to store the string in read-only memory. */
10764 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10765
10766 for (align = 7; align >= 0; align--) {
10767         for (len = 36; len; len--) {
10768                 b = buf+align;
10769                 memcpy(b, abc, len);
10770                 for (off = 1; off <= len; off++) {
10771                         memcpy(b+off, b, len);
10772                         memcpy(b, b+off, len);
10773                         if (memcmp(b, abc, len))
10774                                 exit(1);
10775                 }
10776         }
10777 }
10778 exit(0);
10779 }
10780 EOCP
10781         set try
10782         if eval $compile_ok; then
10783                 if ./try 2>/dev/null; then
10784                         echo "Yes, it can."
10785                         val="$define"
10786                 else
10787                         echo "It can't, sorry."
10788                         case "$d_memmove" in
10789                         "$define") echo "But that's Ok since you have memmove()." ;;
10790                         esac
10791                 fi
10792         else
10793                 echo "(I can't compile the test program, so we'll assume not...)"
10794                 case "$d_memmove" in
10795                 "$define") echo "But that's Ok since you have memmove()." ;;
10796                 esac
10797         fi
10798         ;;
10799 esac
10800 $rm -f try.* try core
10801 set d_safemcpy
10802 eval $setvar
10803
10804 : can memcmp be trusted to compare relative magnitude?
10805 val="$undef"
10806 case "$d_memcmp" in
10807 "$define")
10808         echo " "
10809         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10810         $cat >try.c <<EOCP
10811 #$i_memory I_MEMORY
10812 #$i_stdlib I_STDLIB
10813 #$i_string I_STRING
10814 #$i_unistd I_UNISTD
10815 EOCP
10816         $cat >>try.c <<'EOCP'
10817 #include <stdio.h>
10818 #ifdef I_MEMORY
10819 #  include <memory.h>
10820 #endif
10821 #ifdef I_STDLIB
10822 #  include <stdlib.h>
10823 #endif
10824 #ifdef I_STRING
10825 #  include <string.h>
10826 #else
10827 #  include <strings.h>
10828 #endif
10829 #ifdef I_UNISTD
10830 #  include <unistd.h>  /* Needed for NetBSD */
10831 #endif
10832 int main()
10833 {
10834 char a = -1;
10835 char b = 0;
10836 if ((a < b) && memcmp(&a, &b, 1) < 0)
10837         exit(1);
10838 exit(0);
10839 }
10840 EOCP
10841         set try
10842         if eval $compile_ok; then
10843                 if ./try 2>/dev/null; then
10844                         echo "Yes, it can."
10845                         val="$define"
10846                 else
10847                         echo "No, it can't (it uses signed chars)."
10848                 fi
10849         else
10850                 echo "(I can't compile the test program, so we'll assume not...)"
10851         fi
10852         ;;
10853 esac
10854 $rm -f try.* try core
10855 set d_sanemcmp
10856 eval $setvar
10857
10858 : see if select exists
10859 set select d_select
10860 eval $inlibc
10861
10862 : see if semctl exists
10863 set semctl d_semctl
10864 eval $inlibc
10865
10866 : see if semget exists
10867 set semget d_semget
10868 eval $inlibc
10869
10870 : see if semop exists
10871 set semop d_semop
10872 eval $inlibc
10873
10874 : see how much of the 'sem*(2)' library is present.
10875 h_sem=true
10876 echo " "
10877 case "$d_semctl$d_semget$d_semop" in
10878 *"$undef"*) h_sem=false;;
10879 esac
10880 case "$osname" in
10881 freebsd)
10882     case "`ipcs 2>&1`" in
10883     "SVID messages"*"not configured"*)
10884         echo "Your $osname does not have the sem*(2) configured." >&4
10885         h_sem=false
10886         val="$undef"
10887         set semctl d_semctl
10888         eval $setvar
10889         set semget d_semget
10890         eval $setvar
10891         set semop d_semop
10892         eval $setvar
10893         ;;
10894     esac
10895     ;;
10896 esac
10897 : we could also check for sys/ipc.h ...
10898 if $h_sem && $test `./findhdr sys/sem.h`; then
10899         echo "You have the full sem*(2) library." >&4
10900         val="$define"
10901 else
10902         echo "You don't have the full sem*(2) library." >&4
10903         val="$undef"
10904 fi
10905 set d_sem
10906 eval $setvar
10907
10908 : see whether sys/sem.h defines union semun
10909 echo " "
10910 $cat > try.c <<'END'
10911 #include <sys/types.h>
10912 #include <sys/ipc.h>
10913 #include <sys/sem.h>
10914 int main () { union semun semun; semun.buf = 0; }
10915 END
10916 set try
10917 if eval $compile; then
10918     echo "You have union semun in <sys/sem.h>." >&4
10919     val="$define"
10920 else
10921     echo "You do not have union semun in <sys/sem.h>." >&4
10922     val="$undef"
10923 fi
10924 $rm -f try try.c try.h
10925 set d_union_semun
10926 eval $setvar
10927
10928 : see how to do semctl IPC_STAT
10929 case "$d_sem" in
10930 $define)
10931     : see whether semctl IPC_STAT can use union semun
10932     echo " "
10933     $cat > try.h <<END
10934 #ifndef S_IRUSR
10935 #   ifdef S_IREAD
10936 #       define S_IRUSR S_IREAD
10937 #       define S_IWUSR S_IWRITE
10938 #       define S_IXUSR S_IEXEC
10939 #   else
10940 #       define S_IRUSR 0400
10941 #       define S_IWUSR 0200
10942 #       define S_IXUSR 0100
10943 #   endif
10944 #   define S_IRGRP (S_IRUSR>>3)
10945 #   define S_IWGRP (S_IWUSR>>3)
10946 #   define S_IXGRP (S_IXUSR>>3)
10947 #   define S_IROTH (S_IRUSR>>6)
10948 #   define S_IWOTH (S_IWUSR>>6)
10949 #   define S_IXOTH (S_IXUSR>>6)
10950 #endif
10951 #ifndef S_IRWXU
10952 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10953 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10954 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10955 #endif
10956 END
10957
10958     $cat > try.c <<END
10959 #include <sys/types.h>
10960 #include <sys/ipc.h>
10961 #include <sys/sem.h>
10962 #include <sys/stat.h>
10963 #include <stdio.h>
10964 #include <errno.h>
10965 #include "try.h"
10966 #ifndef errno
10967 extern int errno;
10968 #endif
10969 #$d_union_semun HAS_UNION_SEMUN
10970 int main() {
10971     union semun
10972 #ifndef HAS_UNION_SEMUN
10973     {
10974         int val;
10975         struct semid_ds *buf;
10976         unsigned short *array;
10977     }
10978 #endif
10979     arg;
10980     int sem, st;
10981
10982 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10983     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10984     if (sem > -1) {
10985         struct semid_ds argbuf;
10986         arg.buf = &argbuf;
10987 #       ifdef IPC_STAT
10988         st = semctl(sem, 0, IPC_STAT, arg);
10989         if (st == 0)
10990             printf("semun\n");
10991         else
10992 #       endif /* IPC_STAT */
10993             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10994 #       ifdef IPC_RMID
10995         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10996 #       endif /* IPC_RMID */
10997             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10998     } else
10999 #endif /* IPC_PRIVATE && ... */
11000         printf("semget failed: errno = %d\n", errno);
11001   return 0;
11002 }
11003 END
11004     val="$undef"
11005     set try
11006     if eval $compile; then
11007         xxx=`./try`
11008         case "$xxx" in
11009         semun) val="$define" ;;
11010         esac
11011     fi
11012     $rm -f try try.c
11013     set d_semctl_semun
11014     eval $setvar
11015     case "$d_semctl_semun" in
11016     $define)
11017         echo "You can use union semun for semctl IPC_STAT." >&4
11018         also='also'
11019         ;;
11020     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11021         also=''
11022         ;;
11023     esac
11024
11025     : see whether semctl IPC_STAT can use struct semid_ds pointer
11026     $cat > try.c <<'END'
11027 #include <sys/types.h>
11028 #include <sys/ipc.h>
11029 #include <sys/sem.h>
11030 #include <sys/stat.h>
11031 #include "try.h"
11032 #include <stdio.h>
11033 #include <errno.h>
11034 #ifndef errno
11035 extern int errno;
11036 #endif
11037 int main() {
11038     struct semid_ds arg;
11039     int sem, st;
11040
11041 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11042     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11043     if (sem > -1) {
11044 #       ifdef IPC_STAT
11045         st = semctl(sem, 0, IPC_STAT, &arg);
11046         if (st == 0)
11047             printf("semid_ds\n");
11048         else
11049 #       endif /* IPC_STAT */
11050             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11051 #       ifdef IPC_RMID
11052         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11053 #       endif /* IPC_RMID */
11054             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11055     } else
11056 #endif /* IPC_PRIVATE && ... */
11057         printf("semget failed: errno = %d\n", errno);
11058
11059     return 0;
11060 }
11061 END
11062     val="$undef"
11063     set try
11064     if eval $compile; then
11065         xxx=`./try`
11066         case "$xxx" in
11067         semid_ds) val="$define" ;;
11068         esac
11069     fi
11070     $rm -f try try.c
11071     set d_semctl_semid_ds
11072     eval $setvar
11073     case "$d_semctl_semid_ds" in
11074     $define)
11075         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11076         ;;
11077     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11078         ;;
11079     esac
11080     $rm -f try.h
11081     ;;
11082 *)  val="$undef"
11083
11084     # We do not have the full sem*(2) library, so assume we can not
11085     # use either.
11086
11087     set d_semctl_semun
11088     eval $setvar
11089
11090     set d_semctl_semid_ds
11091     eval $setvar
11092     ;;
11093 esac
11094
11095 : see if setegid exists
11096 set setegid d_setegid
11097 eval $inlibc
11098
11099 : see if seteuid exists
11100 set seteuid d_seteuid
11101 eval $inlibc
11102
11103 : see if setgrent exists
11104 set setgrent d_setgrent
11105 eval $inlibc
11106
11107 : see if sethostent exists
11108 set sethostent d_sethent
11109 eval $inlibc
11110
11111 : see if setlinebuf exists
11112 set setlinebuf d_setlinebuf
11113 eval $inlibc
11114
11115 : see if setlocale exists
11116 set setlocale d_setlocale
11117 eval $inlibc
11118
11119 : see if setnetent exists
11120 set setnetent d_setnent
11121 eval $inlibc
11122
11123 : see if setprotoent exists
11124 set setprotoent d_setpent
11125 eval $inlibc
11126
11127 : see if setpgid exists
11128 set setpgid d_setpgid
11129 eval $inlibc
11130
11131 : see if setpgrp2 exists
11132 set setpgrp2 d_setpgrp2
11133 eval $inlibc
11134
11135 : see if setpriority exists
11136 set setpriority d_setprior
11137 eval $inlibc
11138
11139 : see if setproctitle exists
11140 set setproctitle d_setproctitle
11141 eval $inlibc
11142
11143 : see if setpwent exists
11144 set setpwent d_setpwent
11145 eval $inlibc
11146
11147 : see if setregid exists
11148 set setregid d_setregid
11149 eval $inlibc
11150 set setresgid d_setresgid
11151 eval $inlibc
11152
11153 : see if setreuid exists
11154 set setreuid d_setreuid
11155 eval $inlibc
11156 set setresuid d_setresuid
11157 eval $inlibc
11158
11159 : see if setrgid exists
11160 set setrgid d_setrgid
11161 eval $inlibc
11162
11163 : see if setruid exists
11164 set setruid d_setruid
11165 eval $inlibc
11166
11167 : see if setservent exists
11168 set setservent d_setsent
11169 eval $inlibc
11170
11171 : see if setsid exists
11172 set setsid d_setsid
11173 eval $inlibc
11174
11175 : see if setvbuf exists
11176 set setvbuf d_setvbuf
11177 eval $inlibc
11178
11179 : see if sfio.h is available
11180 set sfio.h i_sfio
11181 eval $inhdr
11182
11183
11184 : see if sfio library is available
11185 case "$i_sfio" in
11186 $define)
11187         val=''
11188         set sfreserve val
11189         eval $inlibc
11190         ;;
11191 *)
11192         val="$undef"
11193         ;;
11194 esac
11195 : Ok, but do we want to use it.
11196 case "$val" in
11197 $define)
11198         case "$usesfio" in
11199         true|$define|[yY]*) dflt='y';;
11200         *) dflt='n';;
11201         esac
11202         echo "$package can use the sfio library, but it is experimental."
11203         rp="You seem to have sfio available, do you want to try using it?"
11204         . ./myread
11205         case "$ans" in
11206         y|Y) ;;
11207         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11208                 val="$undef"
11209                 : Remove sfio from list of libraries to use
11210                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11211                 shift
11212                 libs="$*"
11213                 echo "libs = $libs" >&4
11214                 ;;
11215         esac
11216         ;;
11217 *)      case "$usesfio" in
11218         true|$define|[yY]*)
11219                 echo "Sorry, cannot find sfio on this machine" >&4
11220                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11221                 ;;
11222         esac
11223         ;;
11224 esac
11225 set d_sfio
11226 eval $setvar
11227 case "$d_sfio" in
11228 $define) usesfio='true';;
11229 *) usesfio='false';;
11230 esac
11231
11232 : see if shmctl exists
11233 set shmctl d_shmctl
11234 eval $inlibc
11235
11236 : see if shmget exists
11237 set shmget d_shmget
11238 eval $inlibc
11239
11240 : see if shmat exists
11241 set shmat d_shmat
11242 eval $inlibc
11243 : see what shmat returns
11244 case "$d_shmat" in
11245 "$define")
11246         $cat >shmat.c <<'END'
11247 #include <sys/shm.h>
11248 void *shmat();
11249 END
11250         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11251                 shmattype='void *'
11252         else
11253                 shmattype='char *'
11254         fi
11255         echo "and it returns ($shmattype)." >&4
11256         : see if a prototype for shmat is available
11257         xxx=`./findhdr sys/shm.h`
11258         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11259         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11260                 val="$define"
11261         else
11262                 val="$undef"
11263         fi
11264         $rm -f shmat.[co]
11265         ;;
11266 *)
11267         val="$undef"
11268         ;;
11269 esac
11270 set d_shmatprototype
11271 eval $setvar
11272
11273 : see if shmdt exists
11274 set shmdt d_shmdt
11275 eval $inlibc
11276
11277 : see how much of the 'shm*(2)' library is present.
11278 h_shm=true
11279 echo " "
11280 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11281 *"$undef"*) h_shm=false;;
11282 esac
11283 case "$osname" in
11284 freebsd)
11285     case "`ipcs 2>&1`" in
11286     "SVID shared memory"*"not configured"*)
11287         echo "Your $osname does not have the shm*(2) configured." >&4
11288         h_shm=false
11289         val="$undef"
11290         set shmctl d_shmctl
11291         evat $setvar
11292         set shmget d_shmget
11293         evat $setvar
11294         set shmat d_shmat
11295         evat $setvar
11296         set shmdt d_shmdt
11297         evat $setvar
11298         ;;
11299     esac
11300     ;;
11301 esac
11302 : we could also check for sys/ipc.h ...
11303 if $h_shm && $test `./findhdr sys/shm.h`; then
11304         echo "You have the full shm*(2) library." >&4
11305         val="$define"
11306 else
11307         echo "You don't have the full shm*(2) library." >&4
11308         val="$undef"
11309 fi
11310 set d_shm
11311 eval $setvar
11312
11313 echo " "
11314 : see if we have sigaction
11315 if set sigaction val -f d_sigaction; eval $csym; $val; then
11316         echo 'sigaction() found.' >&4
11317         $cat > try.c <<'EOP'
11318 #include <stdio.h>
11319 #include <sys/types.h>
11320 #include <signal.h>
11321 int main()
11322 {
11323     struct sigaction act, oact;
11324     act.sa_flags = 0;
11325     oact.sa_handler = 0;
11326     /* so that act and oact are used */
11327     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11328 }
11329 EOP
11330         set try
11331         if eval $compile_ok; then
11332                 val="$define"
11333         else
11334                 echo "But you don't seem to have a useable struct sigaction." >&4
11335                 val="$undef"
11336         fi
11337 else
11338         echo 'sigaction NOT found.' >&4
11339         val="$undef"
11340 fi
11341 set d_sigaction; eval $setvar
11342 $rm -f try try$_o try.c
11343
11344 : see if sigsetjmp exists
11345 echo " "
11346 case "$d_sigsetjmp" in
11347 '')
11348         $cat >try.c <<'EOP'
11349 #include <setjmp.h>
11350 sigjmp_buf env;
11351 int set = 1;
11352 int main()
11353 {
11354         if (sigsetjmp(env,1))
11355                 exit(set);
11356         set = 0;
11357         siglongjmp(env, 1);
11358         exit(1);
11359 }
11360 EOP
11361         set try
11362         if eval $compile; then
11363                 if ./try >/dev/null 2>&1; then
11364                         echo "POSIX sigsetjmp found." >&4
11365                         val="$define"
11366                 else
11367                         $cat >&4 <<EOM
11368 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11369 I'll ignore them.
11370 EOM
11371                         val="$undef"
11372                 fi
11373         else
11374                 echo "sigsetjmp not found." >&4
11375                 val="$undef"
11376         fi
11377         ;;
11378 *) val="$d_sigsetjmp"
11379         case "$d_sigsetjmp" in
11380         $define) echo "POSIX sigsetjmp found." >&4;;
11381         $undef) echo "sigsetjmp not found." >&4;;
11382         esac
11383         ;;
11384 esac
11385 set d_sigsetjmp
11386 eval $setvar
11387 $rm -f try.c try
11388
11389 : see if sys/stat.h is available
11390 set sys/stat.h i_sysstat
11391 eval $inhdr
11392
11393
11394 : see if stat knows about block sizes
11395 echo " "
11396 echo "Checking to see if your struct stat has st_blocks field..." >&4
11397 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11398 eval $hasfield
11399
11400
11401 : see if this is a sys/vfs.h system
11402 set sys/vfs.h i_sysvfs
11403 eval $inhdr
11404
11405
11406 : see if this is a sys/statfs.h system
11407 set sys/statfs.h i_sysstatfs
11408 eval $inhdr
11409
11410
11411 echo " "
11412 echo "Checking to see if your system supports struct statfs..." >&4
11413 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
11414 eval $hasstruct
11415 case "$d_statfs_s" in
11416 "$define")      echo "Yes, it does."   ;;
11417 *)              echo "No, it doesn't." ;;
11418 esac
11419
11420
11421
11422 : see if struct statfs knows about f_flags
11423 case "$d_statfs_s" in
11424 define) 
11425         echo " "
11426         echo "Checking to see if your struct statfs has f_flags field..." >&4
11427         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
11428         eval $hasfield
11429         ;;
11430 *)      val="$undef"
11431         set d_statfs_f_flags
11432         eval $setvar
11433         ;;
11434 esac
11435 case "$d_statfs_f_flags" in
11436 "$define")      echo "Yes, it does."   ;;
11437 *)              echo "No, it doesn't." ;;
11438 esac
11439
11440 : see if _ptr and _cnt from stdio act std
11441 echo " "
11442 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11443         echo "(Looks like you have stdio.h from Linux.)"
11444         case "$stdio_ptr" in
11445         '') stdio_ptr='((fp)->_IO_read_ptr)'
11446                 ptr_lval=$define
11447                 ;;
11448         *)      ptr_lval=$d_stdio_ptr_lval;;
11449         esac
11450         case "$stdio_cnt" in
11451         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11452                 cnt_lval=$undef
11453                 ;;
11454         *)      cnt_lval=$d_stdio_cnt_lval;;
11455         esac
11456         case "$stdio_base" in
11457         '') stdio_base='((fp)->_IO_read_base)';;
11458         esac
11459         case "$stdio_bufsiz" in
11460         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11461         esac
11462 else
11463         case "$stdio_ptr" in
11464         '') stdio_ptr='((fp)->_ptr)'
11465                 ptr_lval=$define
11466                 ;;
11467         *)      ptr_lval=$d_stdio_ptr_lval;;
11468         esac
11469         case "$stdio_cnt" in
11470         '') stdio_cnt='((fp)->_cnt)'
11471                 cnt_lval=$define
11472                 ;;
11473         *)      cnt_lval=$d_stdio_cnt_lval;;
11474         esac
11475         case "$stdio_base" in
11476         '') stdio_base='((fp)->_base)';;
11477         esac
11478         case "$stdio_bufsiz" in
11479         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11480         esac
11481 fi
11482 : test whether _ptr and _cnt really work
11483 echo "Checking how std your stdio is..." >&4
11484 $cat >try.c <<EOP
11485 #include <stdio.h>
11486 #define FILE_ptr(fp)    $stdio_ptr
11487 #define FILE_cnt(fp)    $stdio_cnt
11488 int main() {
11489         FILE *fp = fopen("try.c", "r");
11490         char c = getc(fp);
11491         if (
11492                 18 <= FILE_cnt(fp) &&
11493                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11494         )
11495                 exit(0);
11496         exit(1);
11497 }
11498 EOP
11499 val="$undef"
11500 set try
11501 if eval $compile; then
11502         if ./try; then
11503                 echo "Your stdio acts pretty std."
11504                 val="$define"
11505         else
11506                 echo "Your stdio isn't very std."
11507         fi
11508 else
11509         echo "Your stdio doesn't appear very std."
11510 fi
11511 $rm -f try.c try
11512 set d_stdstdio
11513 eval $setvar
11514
11515 : Can _ptr be used as an lvalue?
11516 case "$d_stdstdio$ptr_lval" in
11517 $define$define) val=$define ;;
11518 *) val=$undef ;;
11519 esac
11520 set d_stdio_ptr_lval
11521 eval $setvar
11522
11523 : Can _cnt be used as an lvalue?
11524 case "$d_stdstdio$cnt_lval" in
11525 $define$define) val=$define ;;
11526 *) val=$undef ;;
11527 esac
11528 set d_stdio_cnt_lval
11529 eval $setvar
11530
11531 : see if _base is also standard
11532 val="$undef"
11533 case "$d_stdstdio" in
11534 $define)
11535         $cat >try.c <<EOP
11536 #include <stdio.h>
11537 #define FILE_base(fp)   $stdio_base
11538 #define FILE_bufsiz(fp) $stdio_bufsiz
11539 int main() {
11540         FILE *fp = fopen("try.c", "r");
11541         char c = getc(fp);
11542         if (
11543                 19 <= FILE_bufsiz(fp) &&
11544                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11545         )
11546                 exit(0);
11547         exit(1);
11548 }
11549 EOP
11550         set try
11551         if eval $compile; then
11552                 if ./try; then
11553                         echo "And its _base field acts std."
11554                         val="$define"
11555                 else
11556                         echo "But its _base field isn't std."
11557                 fi
11558         else
11559                 echo "However, it seems to be lacking the _base field."
11560         fi
11561         $rm -f try.c try
11562         ;;
11563 esac
11564 set d_stdiobase
11565 eval $setvar
11566
11567 $cat >&4 <<EOM
11568 Checking how to access stdio streams by file descriptor number...
11569 EOM
11570 case "$stdio_stream_array" in
11571 '')     $cat >try.c <<EOCP
11572 #include <stdio.h>
11573 int main() {
11574   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11575     printf("yes\n");
11576 }
11577 EOCP
11578         for s in _iob __iob __sF
11579         do
11580                 set try -DSTDIO_STREAM_ARRAY=$s
11581                 if eval $compile; then
11582                         case "`./try$exe_ext`" in
11583                         yes)    stdio_stream_array=$s; break ;;
11584                         esac
11585                 fi
11586         done
11587         $rm -f try.* try$exe_ext
11588 esac
11589 case "$stdio_stream_array" in
11590 '')     $cat >&4 <<EOM
11591 I can't figure out how to access stdio streams by file descriptor number.
11592 EOM
11593         d_stdio_stream_array="$undef"
11594         ;;
11595 *)      $cat >&4 <<EOM
11596 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11597 EOM
11598         d_stdio_stream_array="$define"
11599         ;;
11600 esac
11601
11602 : see if strcoll exists
11603 set strcoll d_strcoll
11604 eval $inlibc
11605
11606 : check for structure copying
11607 echo " "
11608 echo "Checking to see if your C compiler can copy structs..." >&4
11609 $cat >try.c <<'EOCP'
11610 int main()
11611 {
11612         struct blurfl {
11613                 int dyick;
11614         } foo, bar;
11615
11616         foo = bar;
11617 }
11618 EOCP
11619 if $cc -c try.c >/dev/null 2>&1 ; then
11620         val="$define"
11621         echo "Yup, it can."
11622 else
11623         val="$undef"
11624         echo "Nope, it can't."
11625 fi
11626 set d_strctcpy
11627 eval $setvar
11628 $rm -f try.*
11629
11630 : see if strerror and/or sys_errlist[] exist
11631 echo " "
11632 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11633     if set strerror val -f d_strerror; eval $csym; $val; then
11634                 echo 'strerror() found.' >&4
11635                 d_strerror="$define"
11636                 d_strerrm='strerror(e)'
11637                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11638                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11639                         d_syserrlst="$define"
11640                 else
11641                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11642                         d_syserrlst="$undef"
11643                 fi
11644     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11645                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11646                 echo 'strerror() found in string header.' >&4
11647                 d_strerror="$define"
11648                 d_strerrm='strerror(e)'
11649                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11650                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11651                                 d_syserrlst="$define"
11652                 else
11653                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11654                         d_syserrlst="$undef"
11655                 fi
11656     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11657                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11658                 d_strerror="$undef"
11659                 d_syserrlst="$define"
11660                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11661     else
11662                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11663                 d_strerror="$undef"
11664                 d_syserrlst="$undef"
11665                 d_strerrm='"unknown"'
11666     fi
11667 fi
11668
11669 : see if strtod exists
11670 set strtod d_strtod
11671 eval $inlibc
11672
11673 : see if strtol exists
11674 set strtol d_strtol
11675 eval $inlibc
11676
11677 : see if strtold exists
11678 set strtold d_strtold
11679 eval $inlibc
11680
11681 : see if strtoll exists
11682 set strtoll d_strtoll
11683 eval $inlibc
11684
11685 case "$d_longlong-$d_strtoll" in
11686 "$define-$define")
11687         $cat <<EOM
11688 Checking whether your strtoll() works okay...
11689 EOM
11690         $cat >try.c <<'EOCP'
11691 #include <errno.h>
11692 #ifdef __hpux
11693 #define strtoll __strtoll
11694 #endif
11695 #include <stdio.h>
11696 extern long long int strtoll(char *s, char **, int); 
11697 static int bad = 0;
11698 int check(char *s, long long ell, int een) {
11699         long long gll;
11700         errno = 0;
11701         gll = strtoll(s, 0, 10);
11702         if (!((gll == ell) && (errno == een)))
11703                 bad++;
11704 }
11705 int main() {
11706         check(" 1",                                      1LL, 0);
11707         check(" 0",                                      0LL, 0);
11708         check("-1",                                     -1LL, 0);
11709         check("-9223372036854775808", -9223372036854775808LL, 0);
11710         check("-9223372036854775808", -9223372036854775808LL, 0);
11711         check(" 9223372036854775807",  9223372036854775807LL, 0);
11712         check("-9223372036854775808", -9223372036854775808LL, 0);
11713         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11714         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11715         if (!bad)
11716                 printf("ok\n");
11717 }
11718 EOCP
11719         set try
11720         if eval $compile; then
11721                 case "`./try`" in
11722                 ok) echo "Your strtoll() seems to be working okay." ;;
11723                 *) cat <<EOM >&4
11724 Your strtoll() doesn't seem to be working okay.
11725 EOM
11726                    d_strtoll="$undef"
11727                    ;;
11728                 esac
11729         fi
11730         ;;
11731 esac
11732
11733 : see if strtoul exists
11734 set strtoul d_strtoul
11735 eval $inlibc
11736
11737 : see if strtoull exists
11738 set strtoull d_strtoull
11739 eval $inlibc
11740
11741 case "$d_longlong-$d_strtoull" in
11742 "$define-$define")
11743         $cat <<EOM
11744 Checking whether your strtoull() works okay...
11745 EOM
11746         $cat >try.c <<'EOCP'
11747 #include <errno.h>
11748 #ifdef __hpux
11749 #define strtoull __strtoull
11750 #endif
11751 #include <stdio.h>
11752 extern unsigned long long int strtoull(char *s, char **, int); 
11753 static int bad = 0;
11754 int check(char *s, long long eull, int een) {
11755         long long gull;
11756         errno = 0;
11757         gull = strtoull(s, 0, 10);
11758         if (!((gull == eull) && (errno == een)))
11759                 bad++;
11760 }
11761 int main() {
11762         check(" 1",                                       1LL, 0);
11763         check(" 0",                                       0LL, 0);
11764         check("18446744073709551615", 18446744073709551615ULL, 0);
11765         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11766         if (!bad)
11767                 printf("ok\n");
11768 }
11769 EOCP
11770         set try
11771         if eval $compile; then
11772                 case "`./try`" in
11773                 ok) echo "Your strtoull() seems to be working okay." ;;
11774                 *) cat <<EOM >&4
11775 Your strtoull() doesn't seem to be working okay.
11776 EOM
11777                    d_strtoull="$undef"
11778                    ;;
11779                 esac
11780         fi
11781         ;;
11782 esac
11783
11784 : see if strtouq exists
11785 set strtouq d_strtouq
11786 eval $inlibc
11787
11788 : see if strxfrm exists
11789 set strxfrm d_strxfrm
11790 eval $inlibc
11791
11792 : see if symlink exists
11793 set symlink d_symlink
11794 eval $inlibc
11795
11796 : see if syscall exists
11797 set syscall d_syscall
11798 eval $inlibc
11799
11800 : see if sysconf exists
11801 set sysconf d_sysconf
11802 eval $inlibc
11803
11804 : see if system exists
11805 set system d_system
11806 eval $inlibc
11807
11808 : see if tcgetpgrp exists
11809 set tcgetpgrp d_tcgetpgrp
11810 eval $inlibc
11811
11812 : see if tcsetpgrp exists
11813 set tcsetpgrp d_tcsetpgrp
11814 eval $inlibc
11815
11816 : see if prototype for telldir is available
11817 echo " "
11818 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11819 eval $hasproto
11820
11821 : see if this is a sys/times.h system
11822 set sys/times.h i_systimes
11823 eval $inhdr
11824
11825 : see if times exists
11826 echo " "
11827 if set times val -f d_times; eval $csym; $val; then
11828         echo 'times() found.' >&4
11829         d_times="$define"
11830         inc=''
11831         case "$i_systimes" in
11832         "$define") inc='sys/times.h';;
11833         esac
11834         rp="What is the type returned by times() on this system?"
11835         set clock_t clocktype long stdio.h sys/types.h $inc
11836         eval $typedef_ask
11837 else
11838         echo 'times() NOT found, hope that will do.' >&4
11839         d_times="$undef"
11840         clocktype='int'
11841 fi
11842
11843 : see if truncate exists
11844 set truncate d_truncate
11845 eval $inlibc
11846
11847 : see if tzname[] exists
11848 echo " "
11849 if set tzname val -a d_tzname; eval $csym; $val; then
11850         val="$define"
11851         echo 'tzname[] found.' >&4
11852 else
11853         val="$undef"
11854         echo 'tzname[] NOT found.' >&4
11855 fi
11856 set d_tzname
11857 eval $setvar
11858
11859 : see if umask exists
11860 set umask d_umask
11861 eval $inlibc
11862
11863 : see if ustat exists
11864 set ustat d_ustat
11865 eval $inlibc
11866
11867 : backward compatibility for d_hvfork
11868 if test X$d_hvfork != X; then
11869         d_vfork="$d_hvfork"
11870         d_hvfork=''
11871 fi
11872 : see if there is a vfork
11873 val=''
11874 set vfork val
11875 eval $inlibc
11876
11877 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11878 : perl on Solaris 2.x, and probably elsewhere.
11879 case "$val" in
11880 $define)
11881         echo " "
11882         case "$usevfork" in
11883         false) dflt='n';;
11884         *) dflt='y';;
11885         esac
11886         cat <<'EOM'
11887  
11888 Perl can only use a vfork() that doesn't suffer from strict
11889 restrictions on calling functions or modifying global data in
11890 the child.  For example, glibc-2.1 contains such a vfork()
11891 that is unsuitable.  If your system provides a proper fork()
11892 call, chances are that you do NOT want perl to use vfork().
11893
11894 EOM
11895         rp="Do you still want to use vfork()?"
11896         . ./myread
11897         case "$ans" in
11898         y|Y) ;;
11899         *)
11900                 echo "Ok, we won't use vfork()."
11901                 val="$undef"
11902                 ;;
11903         esac
11904         ;;
11905 esac
11906 set d_vfork
11907 eval $setvar
11908 case "$d_vfork" in
11909 $define) usevfork='true';;
11910 *) usevfork='false';;
11911 esac
11912
11913 : see if this is an sysdir system
11914 set sys/dir.h i_sysdir
11915 eval $inhdr
11916
11917 : see if this is an sysndir system
11918 set sys/ndir.h i_sysndir
11919 eval $inhdr
11920
11921 : see if closedir exists
11922 set closedir d_closedir
11923 eval $inlibc
11924
11925 case "$d_closedir" in
11926 "$define")
11927         echo " "
11928         echo "Checking whether closedir() returns a status..." >&4
11929         cat > closedir.c <<EOM
11930 #$i_dirent I_DIRENT             /**/
11931 #$i_sysdir I_SYS_DIR            /**/
11932 #$i_sysndir I_SYS_NDIR          /**/
11933 #$i_systypes I_SYS_TYPES        /**/
11934
11935 #if defined(I_SYS_TYPES)
11936 #include <sys/types.h>
11937 #endif
11938 #if defined(I_DIRENT)
11939 #include <dirent.h>
11940 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11941 #include <sys/dir.h>
11942 #endif
11943 #else
11944 #ifdef I_SYS_NDIR
11945 #include <sys/ndir.h>
11946 #else
11947 #ifdef I_SYS_DIR
11948 #ifdef hp9000s500
11949 #include <ndir.h>       /* may be wrong in the future */
11950 #else
11951 #include <sys/dir.h>
11952 #endif
11953 #endif
11954 #endif
11955 #endif 
11956 int main() { return closedir(opendir(".")); }
11957 EOM
11958         set closedir
11959         if eval $compile_ok; then
11960                 if ./closedir > /dev/null 2>&1 ; then
11961                         echo "Yes, it does."
11962                         val="$undef"
11963                 else
11964                         echo "No, it doesn't."
11965                         val="$define"
11966                 fi
11967         else
11968                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11969                 val="$define"
11970         fi
11971         ;;
11972 *)
11973         val="$undef";
11974         ;;
11975 esac
11976 set d_void_closedir
11977 eval $setvar
11978 $rm -f closedir*
11979 : check for volatile keyword
11980 echo " "
11981 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11982 $cat >try.c <<'EOCP'
11983 int main()
11984 {
11985         typedef struct _goo_struct goo_struct;
11986         goo_struct * volatile goo = ((goo_struct *)0);
11987         struct _goo_struct {
11988                 long long_int;
11989                 int reg_int;
11990                 char char_var;
11991         };
11992         typedef unsigned short foo_t;
11993         char *volatile foo;
11994         volatile int bar;
11995         volatile foo_t blech;
11996         foo = foo;
11997 }
11998 EOCP
11999 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12000         val="$define"
12001         echo "Yup, it does."
12002 else
12003         val="$undef"
12004         echo "Nope, it doesn't."
12005 fi
12006 set d_volatile
12007 eval $setvar
12008 $rm -f try.*
12009
12010 : see if there is a wait4
12011 set wait4 d_wait4
12012 eval $inlibc
12013
12014 : see if waitpid exists
12015 set waitpid d_waitpid
12016 eval $inlibc
12017
12018 : see if wcstombs exists
12019 set wcstombs d_wcstombs
12020 eval $inlibc
12021
12022 : see if wctomb exists
12023 set wctomb d_wctomb
12024 eval $inlibc
12025
12026 : preserve RCS keywords in files with variable substitution, grrr
12027 Date='$Date'
12028 Id='$Id'
12029 Log='$Log'
12030 RCSfile='$RCSfile'
12031 Revision='$Revision'
12032
12033 case "$crosscompile" in
12034 ''|[nN]*) crosscompile="$undef" ;;
12035 esac
12036
12037 case "$osname" in
12038 next|rhapsody|darwin) multiarch="$define" ;;
12039 esac
12040 case "$multiarch" in
12041 ''|[nN]*) multiarch="$undef" ;;
12042 esac
12043
12044 : check for alignment requirements
12045 echo " "
12046 case "$crosscompile$multiarch" in
12047 *$define*)
12048         $cat <<EOM
12049 You seem to be either cross-compiling or doing a multiarchitecture build,
12050 skipping the memory alignment check.
12051
12052 EOM
12053         case "$alignbytes" in
12054         '') alignbytes=8 ;;
12055         esac
12056         ;;
12057 *)
12058         case "$alignbytes" in
12059         '') echo "Checking alignment constraints..." >&4
12060                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12061                         $cat >try.c <<'EOCP'
12062 typedef long double NV;
12063 EOCP
12064                 else
12065                         $cat >try.c <<'EOCP'
12066 typedef double NV;
12067 EOCP
12068                 fi
12069                 $cat >>try.c <<'EOCP'
12070 #include <stdio.h>
12071 struct foobar {
12072         char foo;
12073         NV bar;
12074 } try_algn;
12075 int main()
12076 {
12077     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12078     return(0);
12079 }
12080 EOCP
12081                 set try
12082                 if eval $compile_ok; then
12083                         dflt=`./try`
12084                 else
12085                         dflt='8'
12086                         echo "(I can't seem to compile the test program...)"
12087                 fi
12088                 ;;
12089         *) dflt="$alignbytes"
12090                 ;;
12091         esac
12092         rp="Doubles must be aligned on a how-many-byte boundary?"
12093         . ./myread
12094         alignbytes="$ans"
12095         $rm -f try.c try
12096         ;;
12097 esac
12098
12099
12100 : set the base revision
12101 baserev=5.0
12102
12103 : check for ordering of bytes in a long
12104 echo " "
12105 case "$crosscompile$multiarch" in
12106 *$define*)
12107         $cat <<EOM
12108 You seem to be either cross-compiling or doing a multiarchitecture build,
12109 skipping the byteorder check.
12110
12111 EOM
12112         byteorder='0xffff'
12113         ;;
12114 *)
12115         case "$byteorder" in
12116         '')
12117                 $cat <<'EOM'
12118 In the following, larger digits indicate more significance.  A big-endian
12119 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12120 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12121 machines may have weird orders like 3412.  A Cray will report 87654321,
12122 an Alpha will report 12345678. If the test program works the default is
12123 probably right.
12124 I'm now running the test program...
12125 EOM
12126                 $cat >try.c <<'EOCP'
12127 #include <stdio.h>
12128 int main()
12129 {
12130         int i;
12131         union {
12132                 unsigned long l;
12133                 char c[sizeof(long)];
12134         } u;
12135
12136         if (sizeof(long) > 4)
12137                 u.l = (0x08070605L << 32) | 0x04030201L;
12138         else
12139                 u.l = 0x04030201L;
12140         for (i = 0; i < sizeof(long); i++)
12141                 printf("%c", u.c[i]+'0');
12142         printf("\n");
12143         exit(0);
12144 }
12145 EOCP
12146                 xxx_prompt=y
12147                 set try
12148                 if eval $compile && ./try > /dev/null; then
12149                         dflt=`./try`
12150                         case "$dflt" in
12151                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12152                                 echo "(The test program ran ok.)"
12153                                 echo "byteorder=$dflt"
12154                                 xxx_prompt=n
12155                         ;;
12156                         ????|????????) echo "(The test program ran ok.)" ;;
12157                         *) echo "(The test program didn't run right for some reason.)" ;;
12158                         esac
12159                 else
12160                         dflt='4321'
12161                         cat <<'EOM'
12162 (I can't seem to compile the test program.  Guessing big-endian...)
12163 EOM
12164                 fi
12165                 case "$xxx_prompt" in
12166                 y)
12167                         rp="What is the order of bytes in a long?"
12168                         . ./myread
12169                         byteorder="$ans"
12170                         ;;
12171                 *)      byteorder=$dflt
12172                         ;;
12173                 esac
12174                 ;;
12175         esac
12176         $rm -f try.c try
12177         ;;
12178 esac
12179
12180
12181 : how do we catenate cpp tokens here?
12182 echo " "
12183 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12184 $cat >cpp_stuff.c <<'EOCP'
12185 #define RCAT(a,b)a/**/b
12186 #define ACAT(a,b)a ## b
12187 RCAT(Rei,ser)
12188 ACAT(Cir,cus)
12189 EOCP
12190 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12191 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12192         echo "Oh!  Smells like ANSI's been here." >&4
12193         echo "We can catify or stringify, separately or together!"
12194         cpp_stuff=42
12195 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12196         echo "Ah, yes!  The good old days!" >&4
12197         echo "However, in the good old days we don't know how to stringify and"
12198         echo "catify at the same time."
12199         cpp_stuff=1
12200 else
12201         $cat >&4 <<EOM
12202 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12203 to have to edit the values of CAT[2-5] in config.h...
12204 EOM
12205         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12206 fi
12207 $rm -f cpp_stuff.*
12208
12209 : see if this is a db.h system
12210 set db.h i_db
12211 eval $inhdr
12212
12213 case "$i_db" in
12214 $define)
12215         : Check db version.
12216         echo " "
12217         echo "Checking Berkeley DB version ..." >&4
12218         $cat >try.c <<EOCP
12219 #$d_const HASCONST
12220 #ifndef HASCONST
12221 #define const
12222 #endif
12223 #include <sys/types.h>
12224 #include <stdio.h>
12225 #include <db.h>
12226 int main()
12227 {
12228 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12229     int Major, Minor, Patch ;
12230     unsigned long Version ;
12231     (void)db_version(&Major, &Minor, &Patch) ;
12232     printf("You have Berkeley DB Version 2 or greater\n");
12233
12234     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12235                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12236     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12237                 Major, Minor, Patch) ;
12238
12239     /* check that db.h & libdb are compatible */
12240     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12241         printf("db.h and libdb are incompatible\n") ;
12242         exit(3);        
12243     }
12244
12245     printf("db.h and libdb are compatible\n") ;
12246
12247     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12248                 + DB_VERSION_PATCH ;
12249
12250     /* needs to be >= 2.3.4 */
12251     if (Version < 2003004) {
12252     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12253         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12254         exit(2);        
12255     }
12256
12257     exit(0);
12258 #else
12259 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12260     printf("You have Berkeley DB Version 1\n");
12261     exit(0);    /* DB version < 2: the coast is clear. */
12262 #else
12263     exit(1);    /* <db.h> not Berkeley DB? */
12264 #endif
12265 #endif
12266 }
12267 EOCP
12268         set try
12269         if eval $compile_ok && ./try; then
12270                 echo 'Looks OK.' >&4
12271         else
12272                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12273                 i_db=$undef
12274                 case " $libs " in
12275                 *"-ldb "*)
12276                         : Remove db from list of libraries to use
12277                         echo "Removing unusable -ldb from library list" >&4
12278                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12279                         shift
12280                         libs="$*"
12281                         echo "libs = $libs" >&4
12282                         ;;
12283                 esac
12284         fi
12285         $rm -f try.*
12286         ;;
12287 esac
12288
12289 case "$i_db" in
12290 define)
12291         : Check the return type needed for hash 
12292         echo " "
12293         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12294         $cat >try.c <<EOCP
12295 #$d_const HASCONST
12296 #ifndef HASCONST
12297 #define const
12298 #endif
12299 #include <sys/types.h>
12300 #include <db.h>
12301
12302 #ifndef DB_VERSION_MAJOR
12303 u_int32_t hash_cb (ptr, size)
12304 const void *ptr;
12305 size_t size;
12306 {
12307 }
12308 HASHINFO info;
12309 int main()
12310 {
12311         info.hash = hash_cb;
12312 }
12313 #endif
12314 EOCP
12315         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12316                 if $contains warning try.out >>/dev/null 2>&1 ; then
12317                         db_hashtype='int'
12318                 else
12319                         db_hashtype='u_int32_t'
12320                 fi
12321         else
12322                 : XXX Maybe we should just give up here.
12323                 db_hashtype=u_int32_t
12324                 $cat try.out >&4
12325                 echo "Help:  I can't seem to compile the db test program." >&4
12326                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12327         fi
12328         $rm -f try.*
12329         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12330         ;;
12331 *)      db_hashtype=u_int32_t
12332         ;;
12333 esac
12334 case "$i_db" in
12335 define)
12336         : Check the return type needed for prefix 
12337         echo " "
12338         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12339         cat >try.c <<EOCP
12340 #$d_const HASCONST
12341 #ifndef HASCONST
12342 #define const
12343 #endif
12344 #include <sys/types.h>
12345 #include <db.h>
12346
12347 #ifndef DB_VERSION_MAJOR
12348 size_t prefix_cb (key1, key2)
12349 const DBT *key1;
12350 const DBT *key2;
12351 {
12352 }
12353 BTREEINFO info;
12354 int main()
12355 {
12356         info.prefix = prefix_cb;
12357 }
12358 #endif
12359 EOCP
12360         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12361                 if $contains warning try.out >>/dev/null 2>&1 ; then
12362                         db_prefixtype='int'
12363                 else
12364                         db_prefixtype='size_t'
12365                 fi
12366         else
12367                 db_prefixtype='size_t'
12368                 : XXX Maybe we should just give up here.
12369                 $cat try.out >&4
12370                 echo "Help:  I can't seem to compile the db test program." >&4
12371                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12372         fi
12373         $rm -f try.*
12374         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12375         ;;
12376 *)      db_prefixtype='size_t'
12377         ;;
12378 esac
12379
12380 : check for void type
12381 echo " "
12382 echo "Checking to see how well your C compiler groks the void type..." >&4
12383 case "$voidflags" in
12384 '')
12385         $cat >try.c <<'EOCP'
12386 #if TRY & 1
12387 void sub() {
12388 #else
12389 sub() {
12390 #endif
12391         extern void moo();      /* function returning void */
12392         void (*goo)();          /* ptr to func returning void */
12393 #if TRY & 8
12394         void *hue;              /* generic ptr */
12395 #endif
12396 #if TRY & 2
12397         void (*foo[10])();
12398 #endif
12399
12400 #if TRY & 4
12401         if(goo == moo) {
12402                 exit(0);
12403         }
12404 #endif
12405         exit(0);
12406 }
12407 int main() { sub(); }
12408 EOCP
12409         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12410                 voidflags=$defvoidused
12411         echo "Good.  It appears to support void to the level $package wants.">&4
12412                 if $contains warning .out >/dev/null 2>&1; then
12413                         echo "However, you might get some warnings that look like this:"
12414                         $cat .out
12415                 fi
12416         else
12417 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12418                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12419                         echo "It supports 1..."
12420                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12421                                 echo "It also supports 2..."
12422                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12423                                         voidflags=7
12424                                         echo "And it supports 4 but not 8 definitely."
12425                                 else
12426                                         echo "It doesn't support 4..."
12427                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12428                                                 voidflags=11
12429                                                 echo "But it supports 8."
12430                                         else
12431                                                 voidflags=3
12432                                                 echo "Neither does it support 8."
12433                                         fi
12434                                 fi
12435                         else
12436                                 echo "It does not support 2..."
12437                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12438                                         voidflags=13
12439                                         echo "But it supports 4 and 8."
12440                                 else
12441                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12442                                                 voidflags=5
12443                                                 echo "And it supports 4 but has not heard about 8."
12444                                         else
12445                                                 echo "However it supports 8 but not 4."
12446                                         fi
12447                                 fi
12448                         fi
12449                 else
12450                         echo "There is no support at all for void."
12451                         voidflags=0
12452                 fi
12453         fi
12454 esac
12455 case "$voidflags" in
12456 "$defvoidused") ;;
12457 *)      $cat >&4 <<'EOM'
12458   Support flag bits are:
12459     1: basic void declarations.
12460     2: arrays of pointers to functions returning void.
12461     4: operations between pointers to and addresses of void functions.
12462     8: generic void pointers.
12463 EOM
12464         dflt="$voidflags";
12465         rp="Your void support flags add up to what?"
12466         . ./myread
12467         voidflags="$ans"
12468         ;;
12469 esac
12470 $rm -f try.* .out
12471
12472
12473 : How can we generate normalized random numbers ?
12474 echo " "
12475 echo "Looking for a random number function..." >&4
12476 case "$randfunc" in
12477 '')
12478         if set drand48 val -f; eval $csym; $val; then
12479                 dflt="drand48"
12480                 echo "Good, found drand48()." >&4
12481         elif set random val -f; eval $csym; $val; then
12482                 dflt="random"
12483                 echo "OK, found random()." >&4
12484         else
12485                 dflt="rand"
12486                 echo "Yick, looks like I have to use rand()." >&4
12487         fi
12488         echo " "
12489         ;;
12490 *)
12491         dflt="$randfunc"
12492         ;;
12493 esac
12494 cont=true
12495
12496 case "$ccflags" in
12497 *-Dmy_rand=*|*-Dmy_srand=*)
12498         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12499         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12500         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12501         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12502         ;;
12503 esac
12504
12505 while $test "$cont"; do
12506         rp="Use which function to generate random numbers?"
12507         . ./myread
12508         if $test "$ans" = "$dflt"; then
12509                 : null
12510         else
12511                 randbits=''
12512         fi
12513         randfunc="$ans"
12514         if set $ans val -f; eval $csym; $val; then
12515                 cont=''
12516         else
12517                 dflt=y
12518                 rp="I cannot find function $ans. Use that name anyway?"
12519                 . ./myread
12520                 dflt=rand
12521                 case "$ans" in
12522                         [yY]*) cont='';;
12523                 esac
12524         fi
12525         case "$cont" in
12526         '')
12527                 case "$randfunc" in
12528                 drand48)
12529                         drand01="drand48()"
12530                         seedfunc="srand48"
12531                         randbits=48
12532                         randseedtype=long
12533                         ;;
12534                 rand|random)
12535                         case "$randbits" in
12536                         '')
12537 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12538                                 $cat >try.c <<EOCP
12539 #$i_unistd I_UNISTD
12540 #$i_stdlib I_STDLIB
12541 #include <stdio.h>
12542 #ifdef I_UNISTD
12543 #  include <unistd.h>
12544 #endif
12545 #ifdef I_STDLIB
12546 #  include <stdlib.h>
12547 #endif
12548 int main()
12549 {
12550         register int i;
12551         register unsigned long tmp;
12552         register unsigned long max = 0L;
12553
12554         for (i = 1000; i; i--) {
12555                 tmp = (unsigned long) $randfunc();
12556                 if (tmp > max) max = tmp;
12557         }
12558         for (i = 0; max; i++)
12559                 max /= 2;
12560         printf("%d\n",i);
12561 }
12562 EOCP
12563                                 set try
12564                                 if eval $compile_ok; then
12565                                         dflt=`try`
12566                                 else
12567                                         dflt='?'
12568                                         echo "(I can't seem to compile the test program...)"
12569                                 fi
12570                                 ;;
12571                         *)
12572                                 dflt="$randbits"
12573                                 ;;
12574                         esac
12575                         rp="How many bits does your $randfunc() function produce?"
12576                         . ./myread
12577                         randbits="$ans"
12578                         $rm -f try.c try
12579                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12580                         seedfunc="s$randfunc"
12581                         randseedtype=unsigned
12582                         ;;
12583                 *)
12584                         dflt="31"
12585                         rp="How many bits does your $randfunc() function produce?"
12586                         . ./myread
12587                         randbits="$ans"
12588                         seedfunc="s$randfunc"
12589                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12590                         if set $seedfunc val -f; eval $csym; $val; then
12591                                 echo "(Using $seedfunc() to seed random generator)"
12592                         else
12593                                 echo "(Warning: no $seedfunc() to seed random generator)"
12594                                 seedfunc=rand
12595                         fi
12596                         randseedtype=unsigned
12597                         ;;
12598                 esac
12599                 ;;
12600         esac
12601 done
12602
12603 echo " "
12604 echo "Determining whether or not we are on an EBCDIC system..." >&4
12605 $cat >tebcdic.c <<'EOM'
12606 int main()
12607 {
12608   if ('M'==0xd4) return 0;
12609   return 1;
12610 }
12611 EOM
12612
12613 val=$undef
12614 set tebcdic
12615 if eval $compile_ok; then
12616         if ./tebcdic; then
12617                 echo "You have EBCDIC." >&4
12618                 val="$define"
12619         else
12620                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12621         fi
12622 else
12623         echo "I'm unable to compile the test program." >&4
12624         echo "I'll assume ASCII or some ISO Latin." >&4
12625 fi
12626 $rm -f tebcdic.c tebcdic
12627 set ebcdic
12628 eval $setvar
12629
12630 echo " "
12631 $cat >&4 <<EOM
12632 Checking how to flush all pending stdio output...
12633 EOM
12634 # I only know how to find the first 32 possibly open files on SunOS.
12635 # See also hints/sunos_4_1.sh and util.c  --AD
12636 case "$osname" in
12637 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12638 esac
12639 $cat >>try.c <<EOCP
12640 #include <stdio.h>
12641 #$i_unistd I_UNISTD
12642 #ifdef I_UNISTD
12643 # include <unistd.h>
12644 #endif
12645 #$d_sysconf HAS_SYSCONF
12646 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12647 #ifdef HAS_STDIO_STREAM_ARRAY
12648 # define STDIO_STREAM_ARRAY $stdio_stream_array
12649 #endif
12650 int main() {
12651   FILE* p = fopen("try.out", "w");
12652 #ifdef TRY_FPUTC
12653   fputc('x', p);
12654 #else
12655 # ifdef TRY_FPRINTF
12656   fprintf(p, "x");
12657 # endif
12658 #endif
12659 #ifdef TRY_FFLUSH_NULL
12660   fflush(NULL);
12661 #endif
12662 #ifdef TRY_FFLUSH_ALL
12663   {
12664     long open_max = -1;
12665 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12666     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12667 # else
12668 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12669     open_max = sysconf(_SC_OPEN_MAX);
12670 #  else
12671 #   ifdef FOPEN_MAX
12672     open_max = FOPEN_MAX;
12673 #   else
12674 #    ifdef OPEN_MAX
12675     open_max = OPEN_MAX;
12676 #    else
12677 #     ifdef _NFILE
12678     open_max = _NFILE;
12679 #     endif
12680 #    endif
12681 #   endif
12682 #  endif
12683 # endif 
12684 # ifdef HAS_STDIO_STREAM_ARRAY
12685     if (open_max > 0) {
12686       long i;
12687       for (i = 0; i < open_max; i++)
12688             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12689                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12690                 STDIO_STREAM_ARRAY[i]._flag)
12691                 fflush(&STDIO_STREAM_ARRAY[i]);
12692     }   
12693   }
12694 # endif
12695 #endif
12696   _exit(42);
12697 }
12698 EOCP
12699 : first we have to find out how _not_ to flush
12700 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12701     output=''
12702     set try -DTRY_FPUTC
12703     if eval $compile; then
12704             $rm -f try.out
12705             ./try$exe_ext 2>/dev/null
12706             if $test ! -s try.out -a "X$?" = X42; then
12707                 output=-DTRY_FPUTC
12708             fi
12709     fi
12710     case "$output" in
12711     '')
12712             set try -DTRY_FPRINTF
12713             $rm -f try.out
12714             if eval $compile; then
12715                     $rm -f try.out
12716                     ./try$exe_ext 2>/dev/null
12717                     if $test ! -s try.out -a "X$?" = X42; then
12718                         output=-DTRY_FPRINTF
12719                     fi
12720             fi
12721         ;;
12722     esac
12723 fi
12724 : check for fflush NULL behaviour
12725 case "$fflushNULL" in
12726 '')     set try -DTRY_FFLUSH_NULL $output
12727         if eval $compile; then
12728                 $rm -f try.out
12729                 ./try$exe_ext 2>/dev/null
12730                 code="$?"
12731                 if $test -s try.out -a "X$code" = X42; then
12732                         fflushNULL="`$cat try.out`"
12733                 else
12734                         if $test "X$code" != X42; then
12735                                 $cat >&4 <<EOM
12736 (If this test failed, don't worry, we'll try another method shortly.)
12737 EOM
12738                         fi
12739                 fi
12740         fi
12741         $rm -f core try.core core.try.*
12742         case "$fflushNULL" in
12743         x)      $cat >&4 <<EOM
12744 Your fflush(NULL) works okay for output streams.
12745 Let's see if it clobbers input pipes...
12746 EOM
12747 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12748 # bug that improperly flushes the input end of pipes.  So we avoid the
12749 # autoflush on fork/system/exec support for now. :-(
12750 $cat >tryp.c <<EOCP
12751 #include <stdio.h>
12752 int
12753 main(int argc, char **argv)
12754 {
12755     char buf[1024];
12756     int i;
12757     char *bp = buf;
12758     while (1) {
12759         while ((i = getc(stdin)) != -1
12760                && (*bp++ = i) != '\n'
12761                && bp < &buf[1024])
12762         /* DO NOTHING */ ;
12763         *bp = '\0';
12764         fprintf(stdout, "%s", buf);
12765         fflush(NULL);
12766         if (i == -1)
12767             return 0;
12768         bp = buf;
12769     }
12770 }
12771 EOCP
12772                 fflushNULL="$define"
12773                 set tryp
12774                 if eval $compile; then
12775                     $rm -f tryp.out
12776                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12777                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12778                        $cat >&4 <<EOM
12779 fflush(NULL) seems to behave okay with input streams.
12780 EOM
12781                         fflushNULL="$define"
12782                     else
12783                         $cat >&4 <<EOM
12784 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12785 EOM
12786                         fflushNULL="$undef"
12787                     fi
12788                 fi
12789                 $rm -f core tryp.c tryp.core core.tryp.*
12790                 ;;
12791         '')     $cat >&4 <<EOM
12792 Your fflush(NULL) isn't working (contrary to ANSI C).
12793 EOM
12794                 fflushNULL="$undef"
12795                 ;;
12796         *)      $cat >&4 <<EOM
12797 Cannot figure out whether your fflush(NULL) works or not.
12798 I'm assuming it doesn't (contrary to ANSI C).
12799 EOM
12800                 fflushNULL="$undef"
12801                 ;;
12802         esac
12803         ;;
12804 $define|true|[yY]*)
12805         fflushNULL="$define"
12806         ;;
12807 *)
12808         fflushNULL="$undef"
12809         ;;
12810 esac
12811 : check explicit looping only if NULL did not work, and if the pipe
12812 : bug does not show up on an explicit flush too
12813 case "$fflushNULL" in
12814 "$undef")
12815         $cat >tryp.c <<EOCP
12816 #include <stdio.h>
12817 int
12818 main(int argc, char **argv)
12819 {
12820     char buf[1024];
12821     int i;
12822     char *bp = buf;
12823     while (1) {
12824         while ((i = getc(stdin)) != -1
12825                && (*bp++ = i) != '\n'
12826                && bp < &buf[1024])
12827         /* DO NOTHING */ ;
12828         *bp = '\0';
12829         fprintf(stdout, "%s", buf);
12830         fflush(stdin);
12831         if (i == -1)
12832             return 0;
12833         bp = buf;
12834     }
12835 }
12836 EOCP
12837         set tryp
12838         if eval $compile; then
12839             $rm -f tryp.out
12840             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12841             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12842                $cat >&4 <<EOM
12843 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12844 EOM
12845                 : now check for fflushall behaviour
12846                 case "$fflushall" in
12847                 '')     set try -DTRY_FFLUSH_ALL $output
12848                         if eval $compile; then
12849                                 $cat >&4 <<EOM
12850 (Now testing the other method--but note that this also may fail.)
12851 EOM
12852                                 $rm -f try.out
12853                                 ./try$exe_ext 2>/dev/null
12854                                 if $test -s try.out -a "X$?" = X42; then
12855                                         fflushall="`$cat try.out`"
12856                                 fi
12857                         fi
12858                         $rm -f core try.core core.try.*
12859                         case "$fflushall" in
12860                         x)      $cat >&4 <<EOM
12861 Whew. Flushing explicitly all the stdio streams works.
12862 EOM
12863                                 fflushall="$define"
12864                                 ;;
12865                         '')     $cat >&4 <<EOM
12866 Sigh. Flushing explicitly all the stdio streams doesn't work.
12867 EOM
12868                                 fflushall="$undef"
12869                                 ;;
12870                         *)      $cat >&4 <<EOM
12871 Cannot figure out whether flushing stdio streams explicitly works or not.
12872 I'm assuming it doesn't.
12873 EOM
12874                                 fflushall="$undef"
12875                                 ;;
12876                         esac
12877                         ;;
12878                 "$define"|true|[yY]*)
12879                         fflushall="$define"
12880                         ;;
12881                 *)
12882                         fflushall="$undef"
12883                         ;;
12884                 esac
12885             else
12886                 $cat >&4 <<EOM
12887 All is futile.  Even fflush(stdin) clobbers input pipes!
12888 EOM
12889                 fflushall="$undef"
12890             fi
12891         else
12892             fflushall="$undef"
12893         fi
12894         $rm -f core tryp.c tryp.core core.tryp.*
12895         ;;
12896 *)      fflushall="$undef"
12897         ;;
12898 esac
12899
12900 case "$fflushNULL$fflushall" in
12901 undefundef)
12902         $cat <<EOM
12903 OK, I give up.  I cannot figure out how to flush pending stdio output.
12904 We won't be flushing handles at all before fork/exec/popen.
12905 EOM
12906         ;;
12907 esac
12908 $rm -f try.* try$exe_ext
12909
12910 : Store the full pathname to the ar program for use in the C program
12911 : Respect a hint or command line value for full_ar.
12912 case "$full_ar" in
12913 '') full_ar=$ar ;;
12914 esac
12915
12916 : Store the full pathname to the sed program for use in the C program
12917 full_sed=$sed
12918
12919 : see what type gids are declared as in the kernel
12920 echo " "
12921 echo "Looking for the type for group ids returned by getgid()."
12922 set gid_t gidtype xxx stdio.h sys/types.h
12923 eval $typedef
12924 case "$gidtype" in
12925 xxx)
12926         xxx=`./findhdr sys/user.h`
12927         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12928         case $1 in
12929         unsigned) dflt="$1 $2" ;;
12930         *) dflt="$1" ;;
12931         esac
12932         ;;
12933 *) dflt="$gidtype";;
12934 esac
12935 case "$gidtype" in
12936 gid_t) echo "gid_t found." ;;
12937 *)      rp="What is the type for group ids returned by getgid()?"
12938         . ./myread
12939         gidtype="$ans"
12940         ;;
12941 esac
12942
12943 echo " "
12944 case "$gidtype" in
12945 *_t) zzz="$gidtype"     ;;
12946 *)   zzz="gid"          ;;
12947 esac
12948 echo "Checking the size of $zzz..." >&4 
12949 cat > try.c <<EOCP
12950 #include <sys/types.h>
12951 #include <stdio.h>
12952 int main() {
12953     printf("%d\n", (int)sizeof($gidtype));
12954     exit(0);
12955 }
12956 EOCP
12957 set try
12958 if eval $compile_ok; then
12959         yyy=`./try`
12960         case "$yyy" in
12961         '')     gidsize=4
12962                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12963                 ;;
12964         *)      gidsize=$yyy
12965                 echo "Your $zzz is $gidsize bytes long."
12966                 ;;
12967         esac
12968 else
12969         gidsize=4
12970         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12971 fi
12972
12973
12974 echo " "
12975 case "$gidtype" in
12976 *_t) zzz="$gidtype"     ;;
12977 *)   zzz="gid"          ;;
12978 esac
12979 echo "Checking the sign of $zzz..." >&4 
12980 cat > try.c <<EOCP
12981 #include <sys/types.h>
12982 #include <stdio.h>
12983 int main() {
12984         $gidtype foo = -1;
12985         if (foo < 0)
12986                 printf("-1\n");
12987         else
12988                 printf("1\n");
12989 }
12990 EOCP
12991 set try
12992 if eval $compile; then
12993         yyy=`./try`
12994         case "$yyy" in
12995         '')     gidsign=1
12996                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12997                 ;;
12998         *)      gidsign=$yyy
12999                 case "$gidsign" in
13000                  1) echo "Your $zzz is unsigned." ;;
13001                 -1) echo "Your $zzz is signed."   ;;
13002                 esac
13003                 ;;
13004         esac
13005 else
13006         gidsign=1
13007         echo "(I can't compile the test program--guessing unsigned.)" >&4
13008 fi
13009
13010
13011 echo " "
13012
13013 if $test X"$quadtype" != X; then
13014
13015 echo "Checking how to print 64-bit integers..." >&4
13016
13017 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13018         $cat >try.c <<'EOCP'
13019 #include <sys/types.h>
13020 #include <stdio.h>
13021 int main() {
13022   int q = 12345678901;
13023   printf("%ld\n", q);
13024 }
13025 EOCP
13026         set try
13027         if eval $compile; then
13028                 yyy=`./try$exe_ext`
13029                 case "$yyy" in
13030                 12345678901)
13031                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13032                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
13033                         echo "We will use %d."
13034                         ;;
13035                 esac
13036         fi
13037 fi
13038
13039 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13040         $cat >try.c <<'EOCP'
13041 #include <sys/types.h>
13042 #include <stdio.h>
13043 int main() {
13044   long q = 12345678901;
13045   printf("%ld\n", q);
13046 }
13047 EOCP
13048         set try
13049         if eval $compile; then
13050                 yyy=`./try$exe_ext`
13051                 case "$yyy" in
13052                 12345678901)
13053                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13054                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
13055                         echo "We will use %ld."
13056                         ;;
13057                 esac
13058         fi
13059 fi
13060
13061 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13062         $cat >try.c <<'EOCP'
13063 #include <sys/types.h>
13064 #include <inttypes.h>
13065 #include <stdio.h>
13066 int main() {
13067   int64_t q = 12345678901;
13068   printf("%" PRId64 "\n", q);
13069 }
13070 EOCP
13071         set try
13072         if eval $compile; then
13073                 yyy=`./try$exe_ext`
13074                 case "$yyy" in
13075                 12345678901)
13076                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13077                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13078                         echo "We will use the C9X style."
13079                         ;;
13080                 esac
13081         fi
13082 fi
13083
13084 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13085         $cat >try.c <<'EOCP'
13086 #include <sys/types.h>
13087 #include <stdio.h>
13088 int main() {
13089   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13090   printf("%lld\n", q);
13091 }
13092 EOCP
13093         set try
13094         if eval $compile; then
13095                 yyy=`./try$exe_ext`
13096                 case "$yyy" in
13097                 12345678901)
13098                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13099                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13100                         echo "We will use the %lld style."
13101                         ;;
13102                 esac
13103         fi
13104 fi
13105
13106 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13107         $cat >try.c <<EOCP
13108 #include <sys/types.h>
13109 #include <stdio.h>
13110 int main() {
13111   $quadtype q = 12345678901;
13112   printf("%Ld\n", q);
13113 }
13114 EOCP
13115         set try
13116         if eval $compile; then
13117                 yyy=`./try$exe_ext`
13118                 case "$yyy" in
13119                 12345678901)
13120                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13121                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13122                         echo "We will use %Ld."
13123                         ;;
13124                 esac
13125         fi
13126 fi
13127
13128 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13129         $cat >try.c <<EOCP
13130 #include <sys/types.h>
13131 #include <stdio.h>
13132 int main() {
13133   $quadtype q = 12345678901;
13134   printf("%qd\n", q);
13135 }
13136 EOCP
13137         set try
13138         if eval $compile; then
13139                 yyy=`./try$exe_ext`
13140                 case "$yyy" in
13141                 12345678901)
13142                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13143                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13144                         echo "We will use %qd."
13145                         ;;
13146                 esac
13147         fi
13148 fi
13149
13150 if $test X"$sPRId64" = X; then
13151         echo "Cannot figure out how to print 64-bit integers." >&4
13152 fi
13153
13154 $rm -f try try.*
13155
13156 fi
13157
13158 case "$sPRId64" in
13159 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13160         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13161         ;;
13162 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13163         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13164         ;;
13165 esac
13166
13167
13168 echo " "
13169 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13170
13171 if $test X"$ivsize" = X8; then
13172         ivdformat="$sPRId64"
13173         uvuformat="$sPRIu64"
13174         uvoformat="$sPRIo64"
13175         uvxformat="$sPRIx64"
13176 else
13177         if $test X"$ivsize" = X"$longsize"; then
13178                 ivdformat='"ld"'
13179                 uvuformat='"lu"'
13180                 uvoformat='"lo"'
13181                 uvxformat='"lx"'
13182         else
13183                 if $test X"$ivsize" = X"$intsize"; then
13184                         ivdformat='"d"'
13185                         uvuformat='"u"'
13186                         uvoformat='"o"'
13187                         uvxformat='"x"'
13188                 else
13189                         : far out
13190                         if $test X"$ivsize" = X"$shortsize"; then
13191                                 ivdformat='"hd"'
13192                                 uvuformat='"hu"'
13193                                 uvoformat='"ho"'
13194                                 uvxformat='"hx"'
13195                         fi
13196                 fi
13197         fi
13198 fi
13199
13200 case "$ivdformat" in
13201 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13202     exit 1
13203     ;;
13204 esac
13205
13206
13207 echo " "
13208 $echo "Checking the format string to be used for gids..." >&4
13209
13210 case "$gidsign" in
13211 -1)     if $test X"$gidsize" = X"$ivsize"; then
13212                 gidformat="$ivdformat"
13213         else
13214                 if $test X"$gidsize" = X"$longsize"; then
13215                         gidformat='"ld"'
13216                 else
13217                         if $test X"$gidsize" = X"$intsize"; then
13218                                 gidformat='"d"'
13219                         else
13220                                 if $test X"$gidsize" = X"$shortsize"; then
13221                                         gidformat='"hd"'
13222                                 fi
13223                         fi
13224                 fi
13225         fi
13226         ;;
13227 *)      if $test X"$gidsize" = X"$uvsize"; then
13228                 gidformat="$uvuformat"
13229         else
13230                 if $test X"$gidsize" = X"$longsize"; then
13231                         gidformat='"lu"'
13232                 else
13233                         if $test X"$gidsize" = X"$intsize"; then
13234                                 gidformat='"u"'
13235                         else
13236                                 if $test X"$gidsize" = X"$shortsize"; then
13237                                         gidformat='"hu"'
13238                                 fi
13239                         fi
13240                 fi
13241         fi
13242         ;;
13243 esac
13244
13245 : see if getgroups exists
13246 set getgroups d_getgrps
13247 eval $inlibc
13248
13249 : see if setgroups exists
13250 set setgroups d_setgrps
13251 eval $inlibc
13252
13253
13254 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13255 echo " "
13256 case "$d_getgrps$d_setgrps" in
13257 *define*)
13258         case "$groupstype" in
13259         '') dflt="$gidtype" ;;
13260         *)  dflt="$groupstype" ;;
13261         esac
13262         $cat <<EOM
13263 What type of pointer is the second argument to getgroups() and setgroups()?
13264 Usually this is the same as group ids, $gidtype, but not always.
13265
13266 EOM
13267         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13268         . ./myread
13269         groupstype="$ans"
13270         ;;
13271 *)  groupstype="$gidtype";;
13272 esac
13273
13274 echo " "
13275 echo "Checking if your $make program sets \$(MAKE)..." >&4
13276 case "$make_set_make" in
13277 '')
13278         $sed 's/^X //' > testmake.mak << 'EOF'
13279 Xall:
13280 X       @echo 'maketemp="$(MAKE)"'
13281 EOF
13282         case "`$make -f testmake.mak 2>/dev/null`" in
13283         *maketemp=*) make_set_make='#' ;;
13284         *)      make_set_make="MAKE=$make" ;;
13285         esac
13286         $rm -f testmake.mak
13287         ;;
13288 esac
13289 case "$make_set_make" in
13290 '#') echo "Yup, it does.";;
13291 *) echo "Nope, it doesn't.";;
13292 esac
13293
13294 : see what type is used for mode_t
13295 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13296 set mode_t modetype int stdio.h sys/types.h
13297 eval $typedef_ask
13298
13299 : define a fucntion to check prototypes
13300 $cat > protochk <<EOSH
13301 $startsh
13302 cc="$cc"
13303 optimize="$optimize"
13304 ccflags="$ccflags"
13305 prototype="$prototype"
13306 define="$define"
13307 rm=$rm
13308 EOSH
13309
13310 $cat >> protochk <<'EOSH'
13311
13312 $rm -f try.c
13313 foo="$1"
13314 shift
13315 while test $# -ge 2; do
13316         case "$1" in
13317                 $define) echo "#include <$2>" >> try.c ;;
13318                 literal) echo "$2" >> try.c ;;
13319         esac
13320     shift 2
13321 done
13322 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13323 cat >> try.c <<'EOCP'
13324 #ifdef CAN_PROTOTYPE
13325 #define _(args) args
13326 #else
13327 #define _(args) ()
13328 #endif
13329 EOCP
13330 echo "$foo" >> try.c
13331 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13332 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13333 status=$?
13334 $rm -f try.[co]
13335 exit $status
13336 EOSH
13337 chmod +x protochk
13338 $eunicefix protochk
13339
13340 : see what type is used for size_t
13341 rp="What is the type used for the length parameter for string functions?"
13342 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13343 eval $typedef_ask
13344
13345 : check for type of arguments to gethostbyaddr. 
13346 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13347         case "$d_gethbyaddr" in
13348         $define)
13349                 $cat <<EOM
13350
13351 Checking to see what type of arguments are accepted by gethostbyaddr().
13352 EOM
13353                 hdrs="$define sys/types.h
13354                         $d_socket sys/socket.h 
13355                         $i_niin netinet/in.h 
13356                         $i_netdb netdb.h
13357                         $i_unistd unistd.h"
13358                 : The first arg can 'char *' or 'void *'
13359                 : The second arg is some of integral type
13360                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13361                         for yyy in size_t long int; do
13362                                 case "$netdb_host_type" in
13363                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13364                                         if ./protochk "$try" $hdrs; then
13365                                                 echo "Your system accepts $xxx for the first arg."
13366                                                 echo "...and $yyy for the second arg."
13367                                                 netdb_host_type="$xxx"
13368                                                 netdb_hlen_type="$yyy"
13369                                         fi
13370                                         ;;
13371                                 esac
13372                         done
13373                 done
13374                 : In case none of those worked, prompt the user.
13375                 case "$netdb_host_type" in
13376                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13377                         dflt='char *'
13378                         . ./myread
13379                         netdb_host_type=$ans
13380                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13381                         dflt="$sizetype"
13382                         . ./myread
13383                         netdb_hlen_type=$ans
13384                         ;;
13385                 esac
13386                 ;;
13387         *)      : no gethostbyaddr, so pick harmless defaults
13388                 netdb_host_type='char *'
13389                 netdb_hlen_type="$sizetype"
13390                 ;;
13391         esac
13392         # Remove the "const" if needed. -- but then we'll have a 
13393         # prototype clash!
13394         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13395 fi
13396
13397 : check for type of argument to gethostbyname. 
13398 if test "X$netdb_name_type" = X ; then
13399         case "$d_gethbyname" in
13400         $define)
13401                 $cat <<EOM
13402
13403 Checking to see what type of argument is accepted by gethostbyname().
13404 EOM
13405                 hdrs="$define sys/types.h
13406                         $d_socket sys/socket.h 
13407                         $i_niin netinet/in.h 
13408                         $i_netdb netdb.h
13409                         $i_unistd unistd.h"
13410                 for xxx in "const char *" "char *"; do
13411                         case "$netdb_name_type" in
13412                         '')     try="extern struct hostent *gethostbyname($xxx);"
13413                                 if ./protochk "$try" $hdrs; then
13414                                         echo "Your system accepts $xxx."
13415                                         netdb_name_type="$xxx"
13416                                 fi
13417                                 ;;
13418                         esac
13419                 done
13420                 : In case none of those worked, prompt the user.
13421                 case "$netdb_name_type" in
13422                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13423                         dflt='char *'
13424                         . ./myread
13425                         netdb_name_type=$ans
13426                         ;;
13427                 esac
13428                 ;;
13429         *)      : no gethostbyname, so pick harmless default
13430                 netdb_name_type='char *'
13431                 ;;
13432         esac
13433 fi
13434
13435 : check for type of 1st argument to getnetbyaddr. 
13436 if test "X$netdb_net_type" = X ; then
13437         case "$d_getnbyaddr" in
13438         $define)
13439                 $cat <<EOM
13440
13441 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13442 EOM
13443                 hdrs="$define sys/types.h
13444                         $d_socket sys/socket.h 
13445                         $i_niin netinet/in.h 
13446                         $i_netdb netdb.h
13447                         $i_unistd unistd.h"
13448                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13449                         case "$netdb_net_type" in
13450                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13451                                 if ./protochk "$try" $hdrs; then
13452                                         echo "Your system accepts $xxx."
13453                                         netdb_net_type="$xxx"
13454                                 fi
13455                                 ;;
13456                         esac
13457                 done
13458                 : In case none of those worked, prompt the user.
13459                 case "$netdb_net_type" in
13460                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13461                         dflt='long'
13462                         . ./myread
13463                         netdb_net_type=$ans
13464                         ;;
13465                 esac
13466                 ;;
13467         *)      : no getnetbyaddr, so pick harmless default
13468                 netdb_net_type='long'
13469                 ;;
13470         esac
13471 fi
13472 : locate the preferred pager for this system
13473 case "$pager" in
13474 '')
13475         dflt=''
13476         case "$pg" in
13477         /*) dflt=$pg;;
13478         esac
13479         case "$more" in
13480         /*) dflt=$more;;
13481         esac
13482         case "$less" in
13483         /*) dflt=$less;;
13484         esac
13485         case "$dflt" in
13486         '') dflt=/usr/ucb/more;;
13487         esac
13488         ;;
13489 *) dflt="$pager";;
13490 esac
13491 echo " "
13492 fn=f/
13493 rp='What pager is used on your system?'
13494 . ./getfile
13495 pager="$ans"
13496
13497 : see what type pids are declared as in the kernel
13498 rp="What is the type of process ids on this system?"
13499 set pid_t pidtype int stdio.h sys/types.h
13500 eval $typedef_ask
13501
13502 : Find earliest binary compatible site_perl subdirectory perl can use.
13503 case "$bincompat5005" in
13504 "$define") xs_apiversion='5.005' ;;
13505 *) xs_apiversion=$version ;;   # The current site_perl version.
13506 esac
13507 : Find earliest pure perl site_perl subdirectory perl can use.
13508 : The versioned directories started at 5.005.
13509 pm_apiversion='5.005'
13510
13511 : check for length of pointer
13512 echo " "
13513 case "$ptrsize" in
13514 '')
13515         echo "Checking to see how big your pointers are..." >&4
13516         if test "$voidflags" -gt 7; then
13517                 echo '#define VOID_PTR char *' > try.c
13518         else
13519                 echo '#define VOID_PTR void *' > try.c
13520         fi
13521         $cat >>try.c <<'EOCP'
13522 #include <stdio.h>
13523 int main()
13524 {
13525     printf("%d\n", (int)sizeof(VOID_PTR));
13526     exit(0);
13527 }
13528 EOCP
13529         set try
13530         if eval $compile_ok; then
13531                 ptrsize=`./try`
13532                 echo "Your pointers are $ptrsize bytes long."
13533         else
13534                 dflt='4'
13535                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13536                 rp="What is the size of a pointer (in bytes)?"
13537                 . ./myread
13538                 ptrsize="$ans"
13539         fi
13540         ;;
13541 esac
13542 $rm -f try.c try
13543
13544 : see if ar generates random libraries by itself
13545 echo " "
13546 echo "Checking how to generate random libraries on your machine..." >&4
13547 echo 'int bar1() { return bar2(); }' > bar1.c
13548 echo 'int bar2() { return 2; }' > bar2.c
13549 $cat > foo.c <<'EOP'
13550 int main() { printf("%d\n", bar1()); exit(0); }
13551 EOP
13552 $cc $ccflags -c bar1.c >/dev/null 2>&1
13553 $cc $ccflags -c bar2.c >/dev/null 2>&1
13554 $cc $ccflags -c foo.c >/dev/null 2>&1
13555 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13556 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13557         ./foobar >/dev/null 2>&1; then
13558         echo "$ar appears to generate random libraries itself."
13559         orderlib=false
13560         ranlib=":"
13561 elif $ar ts bar$_a >/dev/null 2>&1 &&
13562         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13563         ./foobar >/dev/null 2>&1; then
13564                 echo "a table of contents needs to be added with '$ar ts'."
13565                 orderlib=false
13566                 ranlib="$ar ts"
13567 else
13568         case "$ranlib" in
13569         :) ranlib='';;
13570         '')
13571                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13572                 $test -f $ranlib || ranlib=''
13573                 ;;
13574         esac
13575         if $test -n "$ranlib"; then
13576                 echo "your system has '$ranlib'; we'll use that."
13577                 orderlib=false
13578         else
13579                 echo "your system doesn't seem to support random libraries"
13580                 echo "so we'll use lorder and tsort to order the libraries."
13581                 orderlib=true
13582                 ranlib=":"
13583         fi
13584 fi
13585 $rm -f foo* bar* 
13586
13587 : check for type of arguments to select. 
13588 case "$selecttype" in
13589 '') case "$d_select" in
13590         $define)
13591                 echo " "
13592                 $cat <<EOM
13593 Checking to see what type of arguments are accepted by select().
13594 EOM
13595                 hdrs="$define sys/types.h
13596                         $i_systime sys/time.h 
13597                         $i_sysselct sys/select.h
13598                         $d_socket sys/socket.h"
13599                 : The first arg can be int, unsigned, or size_t
13600                 : The last arg may or may not be 'const'
13601                 val=''
13602                 : void pointer has been seen but using that
13603                 : breaks the selectminbits test
13604                 for xxx in 'fd_set *' 'int *'; do
13605                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13606                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13607                                         case "$val" in
13608                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13609                                                 if ./protochk "$try" $hdrs; then
13610                                                         echo "Your system accepts $xxx."
13611                                                         val="$xxx"
13612                                                 fi
13613                                                 ;;
13614                                         esac
13615                                 done
13616                         done
13617                 done
13618                 case "$val" in
13619                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13620                         case "$d_fd_set" in
13621                                 $define) dflt="fd_set *" ;;
13622                                 *)              dflt="int *" ;;
13623                         esac
13624                         . ./myread
13625                         val=$ans
13626                         ;;
13627                 esac
13628                 selecttype="$val"
13629                 ;;
13630         *)      : no select, so pick a harmless default
13631                 selecttype='int *'
13632                 ;;
13633         esac
13634         ;;
13635 esac
13636
13637 : check for the select 'width'
13638 case "$selectminbits" in
13639 '') case "$d_select" in
13640         $define)
13641                 $cat <<EOM
13642
13643 Checking to see on how many bits at a time your select() operates...
13644 EOM
13645                 $cat >try.c <<EOCP
13646 #include <sys/types.h>
13647 #$i_time I_TIME
13648 #$i_systime I_SYS_TIME
13649 #$i_systimek I_SYS_TIME_KERNEL
13650 #ifdef I_TIME
13651 #   include <time.h>
13652 #endif
13653 #ifdef I_SYS_TIME
13654 #   ifdef I_SYS_TIME_KERNEL
13655 #       define KERNEL
13656 #   endif
13657 #   include <sys/time.h>
13658 #   ifdef I_SYS_TIME_KERNEL
13659 #       undef KERNEL
13660 #   endif
13661 #endif
13662 #$i_sysselct I_SYS_SELECT
13663 #ifdef I_SYS_SELECT
13664 #include <sys/select.h>
13665 #endif
13666 #$d_socket HAS_SOCKET
13667 #ifdef HAS_SOCKET
13668 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13669 #endif
13670 #include <stdio.h>
13671 $selecttype b;
13672 #define S sizeof(*(b))
13673 #define MINBITS 64
13674 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13675 #define NBITS  (NBYTES * 8)
13676 int main() {
13677     char s[NBYTES];
13678     struct timeval t;
13679     int i;
13680     FILE* fp;
13681     int fd;
13682
13683     fclose(stdin);
13684     fp = fopen("try.c", "r");
13685     if (fp == 0)
13686       exit(1);
13687     fd = fileno(fp);
13688     if (fd < 0)
13689       exit(2);
13690     b = ($selecttype)s;
13691     for (i = 0; i < NBITS; i++)
13692         FD_SET(i, b);
13693     t.tv_sec  = 0;
13694     t.tv_usec = 0;
13695     select(fd + 1, b, 0, 0, &t);
13696     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13697     printf("%d\n", i + 1);
13698     return 0;
13699 }
13700 EOCP
13701                 set try
13702                 if eval $compile_ok; then
13703                         selectminbits=`./try`
13704                         case "$selectminbits" in
13705                         '')     cat >&4 <<EOM
13706 Cannot figure out on how many bits at a time your select() operates.
13707 I'll play safe and guess it is 32 bits.
13708 EOM
13709                                 selectminbits=32
13710                                 bits="32 bits"
13711                                 ;;
13712                         1)      bits="1 bit" ;;
13713                         *)      bits="$selectminbits bits" ;;
13714                         esac
13715                         echo "Your select() operates on $bits at a time." >&4
13716                 else
13717                         rp='What is the minimum number of bits your select() operates on?'
13718                         case "$byteorder" in
13719                         1234|12345678)  dflt=32 ;;
13720                         *)              dflt=1  ;;
13721                         esac
13722                         . ./myread
13723                         val=$ans
13724                         selectminbits="$val"
13725                 fi
13726                 $rm -f try.* try
13727                 ;;
13728         *)      : no select, so pick a harmless default
13729                 selectminbits='32'
13730                 ;;
13731         esac
13732         ;;
13733 esac
13734
13735 : Trace out the files included by signal.h, then look for SIGxxx names.
13736 : Remove SIGARRAYSIZE used by HPUX.
13737 : Remove SIGSTKSIZE used by Linux.
13738 : Remove SIGSTKSZ used by Posix.
13739 : Remove SIGTYP void lines used by OS2.
13740 : Some cpps, like os390, dont give the file name anywhere
13741 if [ "X$fieldn" = X ]; then
13742         : Just make some guesses.  We check them later.
13743         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13744 else
13745         xxx=`echo '#include <signal.h>' |
13746         $cppstdin $cppminus $cppflags 2>/dev/null |
13747         $grep '^[       ]*#.*include' | 
13748         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13749 fi
13750 : Check this list of files to be sure we have parsed the cpp output ok.
13751 : This will also avoid potentially non-existent files, such 
13752 : as ../foo/bar.h
13753 xxxfiles=''
13754 for xx in $xxx /dev/null ; do
13755         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13756 done
13757 : If we have found no files, at least try signal.h
13758 case "$xxxfiles" in
13759 '')     xxxfiles=`./findhdr signal.h` ;;
13760 esac
13761 xxx=`awk '
13762 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13763         print substr($2, 4, 20)
13764 }
13765 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13766         print substr($3, 4, 20)
13767 }' $xxxfiles`
13768 : Append some common names just in case the awk scan failed.
13769 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13770 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13771 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13772 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13773 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13774
13775 : generate a few handy files for later
13776 $cat > signal.c <<'EOCP'
13777 #include <sys/types.h>
13778 #include <signal.h>
13779 #include <stdio.h>
13780 int main() {
13781
13782 /* Strange style to avoid deeply-nested #if/#else/#endif */
13783 #ifndef NSIG
13784 #  ifdef _NSIG
13785 #    define NSIG (_NSIG)
13786 #  endif
13787 #endif
13788
13789 #ifndef NSIG
13790 #  ifdef SIGMAX
13791 #    define NSIG (SIGMAX+1)
13792 #  endif
13793 #endif
13794
13795 #ifndef NSIG
13796 #  ifdef SIG_MAX
13797 #    define NSIG (SIG_MAX+1)
13798 #  endif
13799 #endif
13800
13801 #ifndef NSIG
13802 #  ifdef MAXSIG
13803 #    define NSIG (MAXSIG+1)
13804 #  endif
13805 #endif
13806
13807 #ifndef NSIG
13808 #  ifdef MAX_SIG
13809 #    define NSIG (MAX_SIG+1)
13810 #  endif
13811 #endif
13812
13813 #ifndef NSIG
13814 #  ifdef SIGARRAYSIZE
13815 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13816 #  endif
13817 #endif
13818
13819 #ifndef NSIG
13820 #  ifdef _sys_nsig
13821 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13822 #  endif
13823 #endif
13824
13825 /* Default to some arbitrary number that's big enough to get most
13826    of the common signals.
13827 */
13828 #ifndef NSIG
13829 #    define NSIG 50
13830 #endif
13831
13832 printf("NSIG %d\n", NSIG);
13833
13834 #ifndef JUST_NSIG
13835
13836 EOCP
13837
13838 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13839 {
13840         printf "#ifdef SIG"; printf $1; printf "\n"
13841         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13842         printf $1; printf ");\n"
13843         printf "#endif\n"
13844 }
13845 END {
13846         printf "#endif /* JUST_NSIG */\n";
13847         printf "exit(0);\n}\n";
13848 }
13849 ' >>signal.c
13850 $cat >signal.awk <<'EOP'
13851 BEGIN { ndups = 0 }
13852 $1 ~ /^NSIG$/ { nsig = $2 }
13853 ($1 !~ /^NSIG$/) && (NF == 2) {
13854     if ($2 > maxsig) { maxsig = $2 }
13855     if (sig_name[$2]) {
13856         dup_name[ndups] = $1
13857         dup_num[ndups] = $2
13858         ndups++ 
13859     }
13860     else {
13861         sig_name[$2] = $1
13862         sig_num[$2] = $2
13863     }
13864 }
13865 END { 
13866     if (nsig == 0) {
13867         nsig = maxsig + 1
13868     }
13869     printf("NSIG %d\n", nsig);
13870     for (n = 1; n < nsig; n++) {
13871         if (sig_name[n]) {
13872             printf("%s %d\n", sig_name[n], sig_num[n])
13873         }
13874         else {
13875             printf("NUM%d %d\n", n, n) 
13876         }
13877     }
13878     for (n = 0; n < ndups; n++) {
13879         printf("%s %d\n", dup_name[n], dup_num[n])
13880     }
13881 }
13882 EOP
13883 $cat >signal_cmd <<EOS
13884 $startsh
13885 if $test -s signal.lst; then
13886     echo "Using your existing signal.lst file"
13887         exit 0
13888 fi
13889 xxx="$xxx"
13890 EOS
13891 $cat >>signal_cmd <<'EOS'
13892
13893 set signal
13894 if eval $compile_ok; then
13895         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13896 else
13897         echo "(I can't seem be able to compile the whole test program)" >&4
13898         echo "(I'll try it in little pieces.)" >&4
13899         set signal -DJUST_NSIG
13900         if eval $compile_ok; then
13901                 ./signal$_exe > signal.nsg
13902                 $cat signal.nsg
13903         else
13904                 echo "I can't seem to figure out how many signals you have." >&4
13905                 echo "Guessing 50." >&4
13906                 echo 'NSIG 50' > signal.nsg
13907         fi
13908         : Now look at all the signal names, one at a time.
13909         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13910                 $cat > signal.c <<EOCP
13911 #include <sys/types.h>
13912 #include <signal.h>
13913 #include <stdio.h>
13914 int main() {
13915 printf("$xx %d\n", SIG${xx});
13916 return 0;
13917 }
13918 EOCP
13919                 set signal
13920                 if eval $compile; then
13921                         echo "SIG${xx} found."
13922                         ./signal$_exe  >> signal.ls1
13923                 else
13924                         echo "SIG${xx} NOT found."
13925                 fi
13926         done
13927         if $test -s signal.ls1; then
13928                 $cat signal.nsg signal.ls1 |
13929                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13930         fi
13931
13932 fi
13933 if $test -s signal.lst; then
13934         :
13935 else
13936         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13937         echo 'kill -l' >signal
13938         set X `csh -f <signal`
13939         $rm -f signal
13940         shift
13941         case $# in
13942         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13943         esac
13944         echo $@ | $tr ' ' $trnl | \
13945             $awk '{ printf "%s %d\n", $1, ++s; }
13946                   END { printf "NSIG %d\n", ++s }' >signal.lst
13947 fi
13948 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13949 EOS
13950 chmod a+x signal_cmd
13951 $eunicefix signal_cmd
13952
13953 : generate list of signal names
13954 echo " "
13955 case "$sig_name_init" in
13956 '') doinit=yes ;;
13957 *)  case "$sig_num_init" in
13958     ''|*,*) doinit=yes ;;
13959     esac ;;
13960 esac
13961 case "$doinit" in
13962 yes)
13963         echo "Generating a list of signal names and numbers..." >&4
13964         . ./signal_cmd
13965         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13966         sig_name=`$awk 'BEGIN { printf "ZERO " }
13967                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13968         sig_num=`$awk  'BEGIN { printf "0 " }
13969                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13970         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13971                              !/^NSIG/   { printf "\"%s\", ", $1 }
13972                              END        { printf "0\n" }' signal.lst`
13973         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13974                              !/^NSIG/   { printf "%d, ", $2}
13975                              END        { printf "0\n"}' signal.lst`
13976         ;;
13977 esac
13978 echo "The following $sig_count signals are available:"
13979 echo " "
13980 echo $sig_name | $awk \
13981 'BEGIN { linelen = 0 }
13982 {
13983         for (i = 1; i <= NF; i++) {
13984                 name = "SIG" $i " "
13985                 linelen = linelen + length(name)
13986                 if (linelen > 70) {
13987                         printf "\n"
13988                         linelen = length(name)
13989                 }
13990                 printf "%s", name
13991         }
13992         printf "\n"
13993 }'
13994 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13995
13996 echo " "
13997 case "$sizetype" in
13998 *_t) zzz="$sizetype"    ;;
13999 *)   zzz="filesize"     ;;
14000 esac
14001 echo "Checking the size of $zzz..." >&4 
14002 cat > try.c <<EOCP
14003 #include <sys/types.h>
14004 #include <stdio.h>
14005 int main() {
14006     printf("%d\n", (int)sizeof($sizetype));
14007     exit(0);
14008 }
14009 EOCP
14010 set try
14011 if eval $compile_ok; then
14012         yyy=`./try`
14013         case "$yyy" in
14014         '')     sizesize=4
14015                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14016                 ;;
14017         *)      sizesize=$yyy
14018                 echo "Your $zzz size is $sizesize bytes."
14019                 ;;
14020         esac
14021 else
14022         sizesize=4
14023         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14024 fi
14025
14026
14027 : check for socklen_t
14028 echo " "
14029 echo "Checking to see if you have socklen_t..." >&4
14030 $cat >try.c <<EOCP
14031 #include <sys/types.h>
14032 #$d_socket HAS_SOCKET
14033 #ifdef HAS_SOCKET
14034 #include <sys/socket.h>
14035 #endif
14036 int main() { socklen_t x = 16; }
14037 EOCP
14038 set try
14039 if eval $compile; then
14040         val="$define"
14041         echo "You have socklen_t."
14042 else
14043         val="$undef"
14044         echo "You do not have socklen_t."
14045         case "$sizetype" in
14046         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14047         esac
14048 fi
14049 $rm -f try try.*
14050 set d_socklen_t
14051 eval $setvar
14052
14053 : check for type of the size argument to socket calls
14054 case "$d_socket" in
14055 "$define")
14056         $cat <<EOM
14057
14058 Checking to see what type is the last argument of accept().
14059 EOM
14060         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14061         yyy=''
14062         case "$d_socklen_t" in
14063         "$define") yyy="$yyy socklen_t"
14064         esac
14065         yyy="$yyy $sizetype int long unsigned"
14066         for xxx in $yyy; do
14067                 case "$socksizetype" in
14068                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14069                         if ./protochk "$try" $hdrs; then
14070                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14071                                 socksizetype="$xxx"
14072                         fi
14073                         ;;
14074                 esac
14075         done
14076 : In case none of those worked, prompt the user.
14077         case "$socksizetype" in
14078         '')     rp='What is the type for socket address structure sizes?'
14079                 dflt='int'
14080                 . ./myread
14081                 socksizetype=$ans
14082                 ;;
14083         esac
14084         ;;
14085 *)      : no sockets, so pick relatively harmless default
14086         socksizetype='int'
14087         ;;
14088 esac
14089
14090 : see what type is used for signed size_t
14091 set ssize_t ssizetype int stdio.h sys/types.h
14092 eval $typedef
14093 dflt="$ssizetype"
14094 $cat > ssize.c <<EOM
14095 #include <stdio.h>
14096 #include <sys/types.h>
14097 #define Size_t $sizetype
14098 #define SSize_t $dflt
14099 int main()
14100 {
14101         if (sizeof(Size_t) == sizeof(SSize_t))
14102                 printf("$dflt\n");
14103         else if (sizeof(Size_t) == sizeof(int))
14104                 printf("int\n");
14105         else 
14106                 printf("long\n");
14107         exit(0);
14108 }
14109 EOM
14110 echo " "
14111 set ssize
14112 if eval $compile_ok && ./ssize > /dev/null; then
14113         ssizetype=`./ssize`
14114         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14115 else
14116         $cat >&4 <<EOM
14117 Help! I can't compile and run the ssize_t test program: please enlighten me!
14118 (This is probably a misconfiguration in your system or libraries, and
14119 you really ought to fix it.  Still, I'll try anyway.)
14120
14121 I need a type that is the same size as $sizetype, but is guaranteed to
14122 be signed.  Common values are ssize_t, int and long.
14123
14124 EOM
14125         rp="What signed type is the same size as $sizetype?"
14126         . ./myread
14127         ssizetype="$ans"
14128 fi
14129 $rm -f ssize ssize.*
14130
14131 : see what type of char stdio uses.
14132 echo " "
14133 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14134         echo "Your stdio uses unsigned chars." >&4
14135         stdchar="unsigned char"
14136 else
14137         echo "Your stdio uses signed chars." >&4
14138         stdchar="char"
14139 fi
14140
14141 : see if time exists
14142 echo " "
14143 if test "X$d_time" = X -o X"$timetype" = X; then
14144     if set time val -f d_time; eval $csym; $val; then
14145                 echo 'time() found.' >&4
14146                 val="$define"
14147                 rp="What is the type returned by time() on this system?"
14148                 set time_t timetype long stdio.h sys/types.h
14149                 eval $typedef_ask
14150     else
14151                 echo 'time() not found, hope that will do.' >&4
14152                 val="$undef"
14153                 timetype='int';
14154     fi
14155     set d_time
14156     eval $setvar
14157 fi
14158
14159 : see what type uids are declared as in the kernel
14160 echo " "
14161 echo "Looking for the type for user ids returned by getuid()."
14162 set uid_t uidtype xxx stdio.h sys/types.h
14163 eval $typedef
14164 case "$uidtype" in
14165 xxx)
14166         xxx=`./findhdr sys/user.h`
14167         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14168         case $1 in
14169         unsigned) dflt="$1 $2" ;;
14170         *) dflt="$1" ;;
14171         esac
14172         ;;
14173 *) dflt="$uidtype";;
14174 esac
14175 case "$uidtype" in
14176 uid_t)  echo "uid_t found." ;;
14177 *)      rp="What is the type for user ids returned by getuid()?"
14178         . ./myread
14179         uidtype="$ans"
14180         ;;
14181 esac
14182
14183 echo " "
14184 case "$uidtype" in
14185 *_t) zzz="$uidtype"     ;;
14186 *)   zzz="uid"          ;;
14187 esac
14188 echo "Checking the size of $zzz..." >&4 
14189 cat > try.c <<EOCP
14190 #include <sys/types.h>
14191 #include <stdio.h>
14192 int main() {
14193     printf("%d\n", (int)sizeof($uidtype));
14194     exit(0);
14195 }
14196 EOCP
14197 set try
14198 if eval $compile_ok; then
14199         yyy=`./try`
14200         case "$yyy" in
14201         '')     uidsize=4
14202                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14203                 ;;
14204         *)      uidsize=$yyy
14205                 echo "Your $zzz is $uidsize bytes long."
14206                 ;;
14207         esac
14208 else
14209         uidsize=4
14210         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14211 fi
14212
14213 echo " "
14214 case "$uidtype" in
14215 *_t) zzz="$uidtype"     ;;
14216 *)   zzz="uid"          ;;
14217 esac
14218 echo "Checking the sign of $zzz..." >&4
14219 cat > try.c <<EOCP
14220 #include <sys/types.h>
14221 #include <stdio.h>
14222 int main() {
14223         $uidtype foo = -1;
14224         if (foo < 0)
14225                 printf("-1\n");
14226         else
14227                 printf("1\n");
14228 }
14229 EOCP
14230 set try
14231 if eval $compile; then
14232         yyy=`./try`
14233         case "$yyy" in
14234         '')     uidsign=1
14235                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14236                 ;;
14237         *)      uidsign=$yyy
14238                 case "$uidsign" in
14239                  1) echo "Your $zzz is unsigned." ;;
14240                 -1) echo "Your $zzz is signed."   ;;
14241                 esac
14242                 ;;
14243         esac
14244 else
14245         uidsign=1
14246         echo "(I can't compile the test program--guessing unsigned.)" >&4
14247 fi
14248
14249
14250
14251 echo " "
14252 $echo "Checking the format string to be used for uids..." >&4
14253
14254 case "$uidsign" in
14255 -1)     if $test X"$uidsize" = X"$ivsize"; then
14256                 uidformat="$ivdformat"
14257         else
14258                 if $test X"$uidsize" = X"$longsize"; then
14259                         uidformat='"ld"'
14260                 else
14261                         if $test X"$uidsize" = X"$intsize"; then
14262                                 uidformat='"d"'
14263                         else
14264                                 if $test X"$uidsize" = X"$shortsize"; then
14265                                         uidformat='"hd"'
14266                                 fi
14267                         fi
14268                 fi
14269         fi
14270         ;;
14271 *)      if $test X"$uidsize" = X"$uvsize"; then
14272                 uidformat="$uvuformat"
14273         else
14274                 if $test X"$uidsize" = X"$longsize"; then
14275                         uidformat='"lu"'
14276                 else
14277                         if $test X"$uidsize" = X"$intsize"; then
14278                                 uidformat='"u"'
14279                         else
14280                                 if $test X"$uidsize" = X"$shortsize"; then
14281                                         uidformat='"hu"'
14282                                 fi
14283                         fi
14284                 fi
14285         fi
14286         ;;
14287 esac
14288
14289 : see if dbm.h is available
14290 : see if dbmclose exists
14291 set dbmclose d_dbmclose
14292 eval $inlibc
14293
14294 case "$d_dbmclose" in
14295 $define)
14296         set dbm.h i_dbm
14297         eval $inhdr
14298         case "$i_dbm" in
14299         $define)
14300                 val="$undef"
14301                 set i_rpcsvcdbm
14302                 eval $setvar
14303                 ;;
14304         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14305                 eval $inhdr
14306                 ;;
14307         esac
14308         ;;
14309 *)      echo "We won't be including <dbm.h>"
14310         val="$undef"
14311         set i_dbm
14312         eval $setvar
14313         val="$undef"
14314         set i_rpcsvcdbm
14315         eval $setvar
14316         ;;
14317 esac
14318
14319 : see if this is a sys/file.h system
14320 val=''
14321 set sys/file.h val
14322 eval $inhdr
14323
14324 : do we need to include sys/file.h ?
14325 case "$val" in
14326 "$define")
14327         echo " "
14328         if $h_sysfile; then
14329                 val="$define"
14330                 echo "We'll be including <sys/file.h>." >&4
14331         else
14332                 val="$undef"
14333                 echo "We won't be including <sys/file.h>." >&4
14334         fi
14335         ;;
14336 *)
14337         h_sysfile=false
14338         ;;
14339 esac
14340 set i_sysfile
14341 eval $setvar
14342
14343 : see if fcntl.h is there
14344 val=''
14345 set fcntl.h val
14346 eval $inhdr
14347
14348 : see if we can include fcntl.h
14349 case "$val" in
14350 "$define")
14351         echo " "
14352         if $h_fcntl; then
14353                 val="$define"
14354                 echo "We'll be including <fcntl.h>." >&4
14355         else
14356                 val="$undef"
14357                 if $h_sysfile; then
14358         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14359                 else
14360                         echo "We won't be including <fcntl.h>." >&4
14361                 fi
14362         fi
14363         ;;
14364 *)
14365         h_fcntl=false
14366         val="$undef"
14367         ;;
14368 esac
14369 set i_fcntl
14370 eval $setvar
14371
14372 : see if this is a iconv.h system
14373 set iconv.h i_iconv
14374 eval $inhdr
14375
14376 : see if this is a ieeefp.h system
14377 set ieeefp.h i_ieeefp
14378 eval $inhdr
14379
14380 : see if this is a libutil.h system
14381 set libutil.h i_libutil
14382 eval $inhdr
14383
14384 : see if locale.h is available
14385 set locale.h i_locale
14386 eval $inhdr
14387
14388 : see if mach cthreads are available
14389 if test "X$usethreads" = "X$define"; then
14390         set mach/cthreads.h i_machcthr
14391         eval $inhdr
14392 else
14393         i_machcthr="$undef"
14394 fi
14395
14396
14397
14398 : see if this is a math.h system
14399 set math.h i_math
14400 eval $inhdr
14401
14402 : see if this is a mntent.h system
14403 set mntent.h i_mntent
14404 eval $inhdr
14405
14406 : see if ndbm.h is available
14407 set ndbm.h t_ndbm
14408 eval $inhdr
14409 case "$t_ndbm" in
14410 $define)
14411         : see if dbm_open exists
14412         set dbm_open d_dbm_open
14413         eval $inlibc
14414         case "$d_dbm_open" in
14415         $undef)
14416                 t_ndbm="$undef"
14417                 echo "We won't be including <ndbm.h>"
14418                 ;;
14419         esac
14420         ;;
14421 esac
14422 val="$t_ndbm"
14423 set i_ndbm
14424 eval $setvar
14425
14426 : see if net/errno.h is available
14427 val=''
14428 set net/errno.h val
14429 eval $inhdr
14430
14431 : Unfortunately, it causes problems on some systems.  Arrgh.
14432 case "$val" in
14433 $define)
14434         cat > try.c <<'EOM'
14435 #include <stdio.h>
14436 #include <errno.h>
14437 #include <net/errno.h>
14438 int func()
14439 {
14440         return ENOTSOCK;
14441 }
14442 EOM
14443         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14444                 echo "We'll be including <net/errno.h>." >&4
14445         else
14446                 echo "We won't be including <net/errno.h>." >&4
14447                 val="$undef"
14448         fi
14449         $rm -f try.* try
14450         ;;
14451 esac
14452 set i_neterrno
14453 eval $setvar
14454
14455 : see if netinet/tcp.h is available
14456 set netinet/tcp.h i_netinettcp
14457 eval $inhdr
14458
14459 : see if this is a poll.h system
14460 set poll.h i_poll
14461 eval $inhdr
14462
14463 : see if this is a prot.h system
14464 set prot.h i_prot
14465 eval $inhdr
14466
14467 echo " "
14468 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14469 $cat <<'EOSH' > Cppsym.know
14470 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14471 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14472 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14473 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14474 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14475 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14476 bull c cadmus clipper CMU COFF COMPILER_VERSION
14477 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14478 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14479 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14480 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14481 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14482 H3050R H3050RX hbullx20 hcx host_mips
14483 hp200 hp300 hp700 HP700 hp800 hp9000
14484 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14485 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14486 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14487 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14488 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14489 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14490 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14491 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14492 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14493 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14494 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14495 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14496 MATH_HAS_NO_SIDE_EFFECTS
14497 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14498 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14499 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14500 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14501 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14502 NetBSD news1500 news1700 news1800 news1900 news3700
14503 news700 news800 news900 NeXT NLS ns16000 ns32000
14504 ns32016 ns32332 ns32k nsc32000
14505 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14506 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14507 pc532 pdp11 PGC PIC plexus PORTAR posix
14508 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14509 POSIX_C_SOURCE POSIX_SOURCE POWER
14510 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14511 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14512 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14513 sony sony_news sonyrisc sparc sparclite spectrum
14514 stardent stdc STDC_EXT stratos sun sun3 sun386
14515 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14516 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14517 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14518 sysV68 sysV88 Tek4132 Tek4300 titan
14519 tower tower32 tower32_200 tower32_600 tower32_700
14520 tower32_800 tower32_850 tss
14521 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14522 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14523 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14524 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14525 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14526 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14527 z8000
14528 EOSH
14529 # Maybe put other stuff here too.
14530 cat <<EOSH >>Cppsym.know
14531 $osname
14532 EOSH
14533 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14534 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14535 $cat Cppsym.know > Cppsym.c
14536 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14537 $rm -f Cppsym.a Cppsym.b Cppsym.c
14538 cat <<EOSH > Cppsym
14539 $startsh
14540 if $test \$# -gt 0; then
14541     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14542     if $test -s Cppsym.got; then
14543         $rm -f Cppsym.got
14544         exit 0
14545     fi
14546     $rm -f Cppsym.got
14547     exit 1
14548 else
14549     $tr " " "$trnl" | ./Cppsym.try
14550     exit 0
14551 fi
14552 EOSH
14553 chmod +x Cppsym
14554 $eunicefix Cppsym
14555 cat <<EOSH > Cppsym.try
14556 $startsh
14557 cat <<'EOCP' > try.c
14558 #include <stdio.h>
14559 int main() {
14560 EOCP
14561 $awk \\
14562 EOSH
14563 cat <<'EOSH' >> Cppsym.try
14564 'length($1) > 0 {
14565     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
14566     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
14567     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
14568     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
14569 }'       >> try.c
14570 echo '}' >> try.c
14571 EOSH
14572 cat <<EOSH >> Cppsym.try
14573 ccflags="$ccflags"
14574 case "$osname-$gccversion" in
14575 irix-) ccflags="\$ccflags -woff 1178" ;;
14576 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14577 esac
14578 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14579 EOSH
14580 chmod +x Cppsym.try
14581 $eunicefix Cppsym.try
14582 ./Cppsym < Cppsym.know > Cppsym.true
14583 : now check the C compiler for additional symbols
14584 postprocess_cc_v=''
14585 case "$osname" in
14586 aix) postprocess_cc_v="|$tr , ' '" ;;
14587 esac
14588 $cat >ccsym <<EOS
14589 $startsh
14590 $cat >tmp.c <<EOF
14591 extern int foo;
14592 EOF
14593 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14594 do
14595         case "\$i" in
14596         -D*) echo "\$i" | $sed 's/^-D//';;
14597         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14598         esac
14599 done
14600 $rm -f try.c
14601 EOS
14602 postprocess_cc_v=''
14603 chmod +x ccsym
14604 $eunicefix ccsym
14605 ./ccsym > ccsym1.raw
14606 if $test -s ccsym1.raw; then
14607        $sort ccsym1.raw | $uniq >ccsym.raw
14608 else
14609        mv ccsym1.raw ccsym.raw
14610 fi
14611
14612 $awk '/\=/ { print $0; next }
14613         { print $0"=1" }' ccsym.raw >ccsym.list
14614 $awk '/\=/ { print $0; next }
14615         { print $0"=1" }' Cppsym.true >ccsym.true
14616 $comm -13 ccsym.true ccsym.list >ccsym.own
14617 $comm -12 ccsym.true ccsym.list >ccsym.com
14618 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14619 also=''
14620 if $test -z ccsym.raw; then
14621         echo "Your C compiler doesn't seem to define any symbols!" >&4
14622         echo " "
14623         echo "However, your C preprocessor defines the following symbols:"
14624         $cat Cppsym.true
14625         ccsymbols=''
14626         cppsymbols=`$cat Cppsym.true`
14627         cppsymbols=`echo $cppsymbols`
14628         cppccsymbols="$cppsymbols"
14629 else
14630         if $test -s ccsym.com; then
14631                 echo "Your C compiler and pre-processor define these symbols:"
14632                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14633                 also='also '
14634                 symbols='ones'
14635                 cppccsymbols=`$cat ccsym.com`
14636                 cppccsymbols=`echo $cppccsymbols`
14637                 $test "$silent" || sleep 1
14638         fi
14639         if $test -s ccsym.cpp; then
14640                 $test "$also" && echo " "
14641                 echo "Your C pre-processor ${also}defines the following symbols:"
14642                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14643                 also='further '
14644                 cppsymbols=`$cat ccsym.cpp`
14645                 cppsymbols=`echo $cppsymbols`
14646                 $test "$silent" || sleep 1
14647         fi
14648         if $test -s ccsym.own; then
14649                 $test "$also" && echo " "
14650                 echo "Your C compiler ${also}defines the following cpp symbols:"
14651                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14652                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14653                 ccsymbols=`$cat ccsym.own`
14654                 ccsymbols=`echo $ccsymbols`
14655                 $test "$silent" || sleep 1
14656         fi
14657 fi
14658 $rm -f ccsym* Cppsym.*
14659
14660 : see if this is a termio system
14661 val="$undef"
14662 val2="$undef"
14663 val3="$undef"
14664 if $test `./findhdr termios.h`; then
14665         set tcsetattr i_termios
14666         eval $inlibc
14667         val3="$i_termios"
14668 fi
14669 echo " "
14670 case "$val3" in
14671 "$define") echo "You have POSIX termios.h... good!" >&4;;
14672 *) if ./Cppsym pyr; then
14673                 case "`/bin/universe`" in
14674                 ucb) if $test `./findhdr sgtty.h`; then
14675                                 val2="$define"
14676                                 echo "<sgtty.h> found." >&4
14677                         else
14678                                 echo "System is pyramid with BSD universe."
14679                                 echo "<sgtty.h> not found--you could have problems." >&4
14680                         fi;;
14681                 *) if $test `./findhdr termio.h`; then
14682                                 val="$define"
14683                                 echo "<termio.h> found." >&4
14684                         else
14685                                 echo "System is pyramid with USG universe."
14686                                 echo "<termio.h> not found--you could have problems." >&4
14687                         fi;;
14688                 esac
14689         elif ./usg; then
14690                 if $test `./findhdr termio.h`; then
14691                         echo "<termio.h> found." >&4
14692                         val="$define"
14693                 elif $test `./findhdr sgtty.h`; then
14694                         echo "<sgtty.h> found." >&4
14695                         val2="$define"
14696                 else
14697 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14698                 fi
14699         else
14700                 if $test `./findhdr sgtty.h`; then
14701                         echo "<sgtty.h> found." >&4
14702                         val2="$define"
14703                 elif $test `./findhdr termio.h`; then
14704                         echo "<termio.h> found." >&4
14705                         val="$define"
14706                 else
14707 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14708                 fi
14709         fi;;
14710 esac
14711 set i_termio; eval $setvar
14712 val=$val2; set i_sgtty; eval $setvar
14713 val=$val3; set i_termios; eval $setvar
14714
14715 : see if this is a shadow.h system
14716 set shadow.h i_shadow
14717 eval $inhdr
14718
14719 : see if this is a socks.h system
14720 set socks.h i_socks
14721 eval $inhdr
14722
14723 : see if stdarg is available
14724 echo " "
14725 if $test `./findhdr stdarg.h`; then
14726         echo "<stdarg.h> found." >&4
14727         valstd="$define"
14728 else
14729         echo "<stdarg.h> NOT found." >&4
14730         valstd="$undef"
14731 fi
14732
14733 : see if varags is available
14734 echo " "
14735 if $test `./findhdr varargs.h`; then
14736         echo "<varargs.h> found." >&4
14737 else
14738         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14739 fi
14740
14741 : set up the varargs testing programs
14742 $cat > varargs.c <<EOP
14743 #ifdef I_STDARG
14744 #include <stdarg.h>
14745 #endif
14746 #ifdef I_VARARGS
14747 #include <varargs.h>
14748 #endif
14749
14750 #ifdef I_STDARG
14751 int f(char *p, ...)
14752 #else
14753 int f(va_alist)
14754 va_dcl
14755 #endif
14756 {
14757         va_list ap;
14758 #ifndef I_STDARG
14759         char *p;
14760 #endif
14761 #ifdef I_STDARG
14762         va_start(ap,p);
14763 #else
14764         va_start(ap);
14765         p = va_arg(ap, char *);
14766 #endif
14767         va_end(ap);
14768 }
14769 EOP
14770 $cat > varargs <<EOP
14771 $startsh
14772 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14773         echo "true"
14774 else
14775         echo "false"
14776 fi
14777 $rm -f varargs$_o
14778 EOP
14779 chmod +x varargs
14780
14781 : now check which varargs header should be included
14782 echo " "
14783 i_varhdr=''
14784 case "$valstd" in
14785 "$define")
14786         if `./varargs I_STDARG`; then
14787                 val='stdarg.h'
14788         elif `./varargs I_VARARGS`; then
14789                 val='varargs.h'
14790         fi
14791         ;;
14792 *)
14793         if `./varargs I_VARARGS`; then
14794                 val='varargs.h'
14795         fi
14796         ;;
14797 esac
14798 case "$val" in
14799 '')
14800 echo "I could not find the definition for va_dcl... You have problems..." >&4
14801         val="$undef"; set i_stdarg; eval $setvar
14802         val="$undef"; set i_varargs; eval $setvar
14803         ;;
14804 *) 
14805         set i_varhdr
14806         eval $setvar
14807         case "$i_varhdr" in
14808         stdarg.h)
14809                 val="$define"; set i_stdarg; eval $setvar
14810                 val="$undef"; set i_varargs; eval $setvar
14811                 ;;
14812         varargs.h)
14813                 val="$undef"; set i_stdarg; eval $setvar
14814                 val="$define"; set i_varargs; eval $setvar
14815                 ;;
14816         esac
14817         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14818 esac
14819 $rm -f varargs*
14820
14821 : see if stddef is available
14822 set stddef.h i_stddef
14823 eval $inhdr
14824
14825 : see if this is a sunmath.h system
14826 set sunmath.h i_sunmath
14827 eval $inhdr
14828
14829 : see if sys/access.h is available
14830 set sys/access.h i_sysaccess
14831 eval $inhdr
14832
14833 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14834 set sys/filio.h i_sysfilio
14835 eval $inhdr
14836 echo " "
14837 if $test `./findhdr sys/ioctl.h`; then
14838         val="$define"
14839         echo '<sys/ioctl.h> found.' >&4
14840 else
14841         val="$undef"
14842         if $test $i_sysfilio = "$define"; then
14843             echo '<sys/ioctl.h> NOT found.' >&4
14844         else
14845                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14846                 $test $i_termio = "$define" && xxx="termio.h"
14847                 $test $i_termios = "$define" && xxx="termios.h"
14848 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14849         fi
14850 fi
14851 set i_sysioctl
14852 eval $setvar
14853
14854
14855 : see if this is a syslog.h system
14856 set syslog.h i_syslog
14857 eval $inhdr
14858
14859
14860 : see if this is a sys/mode.h system
14861 set sys/mode.h i_sysmode
14862 eval $inhdr
14863
14864 : see if sys/resource.h has to be included
14865 set sys/resource.h i_sysresrc
14866 eval $inhdr
14867
14868 : see if sys/security.h is available
14869 set sys/security.h i_syssecrt
14870 eval $inhdr
14871
14872 : see if this is a sys/statvfs.h system
14873 set sys/statvfs.h i_sysstatvfs
14874 eval $inhdr
14875
14876 : see if this is a sys/uio.h system
14877 set sys/uio.h i_sysuio
14878 eval $inhdr
14879
14880 : see if this is a sys/un.h system
14881 set sys/un.h i_sysun
14882 eval $inhdr
14883
14884
14885 : see if this is a sys/utsname.h system
14886 set sys/utsname.h i_sysutsname
14887 eval $inhdr
14888
14889 : see if this is a syswait system
14890 set sys/wait.h i_syswait
14891 eval $inhdr
14892
14893 : see if this is a ustat.h system
14894 set ustat.h i_ustat
14895 eval $inhdr
14896
14897 : see if this is an utime system
14898 set utime.h i_utime
14899 eval $inhdr
14900
14901 : see if this is a values.h system
14902 set values.h i_values
14903 eval $inhdr
14904
14905 : see if this is a vfork system
14906 case "$d_vfork" in
14907 "$define")
14908         set vfork.h i_vfork
14909         eval $inhdr
14910         ;;
14911 *)
14912         i_vfork="$undef"
14913         ;;
14914 esac
14915
14916 : see if gdbm.h is available
14917 set gdbm.h t_gdbm
14918 eval $inhdr
14919 case "$t_gdbm" in
14920 $define)
14921         : see if gdbm_open exists
14922         set gdbm_open d_gdbm_open
14923         eval $inlibc
14924         case "$d_gdbm_open" in
14925         $undef)
14926                 t_gdbm="$undef"
14927                 echo "We won't be including <gdbm.h>"
14928                 ;;
14929         esac
14930         ;;
14931 esac
14932 val="$t_gdbm"
14933 set i_gdbm
14934 eval $setvar
14935
14936 echo " "
14937 echo "Looking for extensions..." >&4
14938 : If we are using the old config.sh, known_extensions may contain
14939 : old or inaccurate or duplicate values.
14940 known_extensions=''
14941 nonxs_extensions=''
14942 : We do not use find because it might not be available.
14943 : We do not just use MANIFEST because the user may have dropped
14944 : some additional extensions into the source tree and expect them
14945 : to be built.
14946
14947 : Function to recursively find available extensions, ignoring DynaLoader
14948 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14949 find_extensions='
14950     for xxx in *; do
14951        case "$xxx" in
14952            DynaLoader|dynaload) ;;
14953            *)
14954            if $test -f $xxx/$xxx.xs; then
14955                known_extensions="$known_extensions $1$xxx";
14956            elif $test -f $xxx/Makefile.PL; then
14957                nonxs_extensions="$nonxs_extensions $1$xxx";
14958            else
14959                if $test -d $xxx -a $# -lt 10; then
14960                    set $1$xxx/ $*;
14961                    cd $xxx;
14962                    eval $find_extensions;
14963                    cd ..;
14964                    shift;
14965                fi;
14966            fi
14967            ;;
14968        esac;
14969     done'
14970 tdir=`pwd`
14971 cd $rsrc/ext
14972 set X
14973 shift
14974 eval $find_extensions
14975 set X $nonxs_extensions
14976 shift
14977 nonxs_extensions="$*"
14978 set X $known_extensions
14979 shift
14980 known_extensions="$*"
14981 cd $tdir
14982
14983 : Now see which are supported on this system.
14984 avail_ext=''
14985 for xxx in $known_extensions ; do
14986         case "$xxx" in
14987         DB_File|db_file)
14988                 case "$i_db" in
14989                 $define) avail_ext="$avail_ext $xxx" ;;
14990                 esac
14991                 ;;
14992         GDBM_File|gdbm_fil)
14993                 case "$i_gdbm" in 
14994                 $define) avail_ext="$avail_ext $xxx" ;;
14995                 esac
14996                 ;;
14997         NDBM_File|ndbm_fil)
14998                 case "$i_ndbm" in
14999                 $define)
15000                     case "$osname-$use64bitint" in
15001                     hpux-define)
15002                         case "$libs" in
15003                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15004                         esac
15005                         ;;
15006                     *) avail_ext="$avail_ext $xxx" ;;
15007                     esac
15008                     ;;
15009                 esac
15010                 ;;
15011         ODBM_File|odbm_fil) 
15012                 case "${i_dbm}${i_rpcsvcdbm}" in
15013                 *"${define}"*)
15014                     case "$osname-$use64bitint" in
15015                     hpux-define)
15016                         case "$libs" in
15017                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15018                         esac
15019                         ;;
15020                     *) avail_ext="$avail_ext $xxx" ;;
15021                     esac
15022                     ;;
15023                 esac
15024                 ;;
15025         POSIX|posix)
15026                 case "$useposix" in
15027                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15028                 esac
15029                 ;;
15030         Opcode|opcode)
15031                 case "$useopcode" in
15032                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15033                 esac
15034                 ;;
15035         Socket|socket)
15036                 case "$d_socket" in 
15037                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15038                 esac
15039                 ;;
15040         Sys/Syslog|sys/syslog)
15041                 : XXX syslog requires socket
15042                 case "$d_socket" in 
15043                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15044                 esac
15045                 ;;
15046         Thread|thread)
15047                 case "$usethreads" in 
15048                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15049                 esac
15050                 ;;
15051         IPC/SysV|ipc/sysv)
15052                 : XXX Do we need a useipcsysv variable here
15053                 case "${d_msg}${d_sem}${d_shm}" in 
15054                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15055                 esac
15056                 ;;
15057         *)      avail_ext="$avail_ext $xxx"
15058                 ;;
15059         esac
15060 done
15061
15062 set X $avail_ext
15063 shift
15064 avail_ext="$*"
15065
15066 : Now see which nonxs extensions are supported on this system.
15067 : For now assume all are.
15068 nonxs_ext=''
15069 for xxx in $nonxs_extensions ; do
15070         case "$xxx" in
15071         *)      nonxs_ext="$nonxs_ext $xxx"
15072                 ;;
15073         esac
15074 done
15075
15076 set X $nonxs_ext
15077 shift
15078 nonxs_ext="$*"
15079
15080 case $usedl in
15081 $define)
15082         $cat <<EOM
15083 A number of extensions are supplied with $package.  You may choose to
15084 compile these extensions for dynamic loading (the default), compile
15085 them into the $package executable (static loading), or not include
15086 them at all.  Answer "none" to include no extensions.
15087 Note that DynaLoader is always built and need not be mentioned here.
15088
15089 EOM
15090         case "$dynamic_ext" in
15091         '') dflt="$avail_ext" ;;
15092         *)      dflt="$dynamic_ext"
15093                 # Perhaps we are reusing an old out-of-date config.sh.
15094                 case "$hint" in
15095                 previous)
15096                         if test X"$dynamic_ext" != X"$avail_ext"; then
15097                                 $cat <<EOM
15098 NOTICE:  Your previous config.sh list may be incorrect. 
15099 The extensions now available to you are 
15100         ${avail_ext}
15101 but the default list from your previous config.sh is
15102         ${dynamic_ext} 
15103
15104 EOM
15105                         fi
15106                         ;;
15107                 esac
15108                 ;;
15109         esac
15110         case "$dflt" in
15111         '')     dflt=none;;
15112         esac
15113         rp="What extensions do you wish to load dynamically?"
15114         . ./myread
15115         case "$ans" in
15116         none) dynamic_ext=' ' ;;
15117         *) dynamic_ext="$ans" ;;
15118         esac
15119
15120         case "$static_ext" in
15121         '')
15122                 : Exclude those already listed in dynamic linking
15123                 dflt=''
15124                 for xxx in $avail_ext; do
15125                         case " $dynamic_ext " in
15126                         *" $xxx "*) ;;
15127                         *) dflt="$dflt $xxx" ;;
15128                         esac
15129                 done
15130                 set X $dflt
15131                 shift
15132                 dflt="$*"
15133                 ;;
15134         *)  dflt="$static_ext" 
15135                 ;;
15136         esac
15137
15138         case "$dflt" in
15139         '')     dflt=none;;
15140         esac
15141         rp="What extensions do you wish to load statically?"
15142         . ./myread
15143         case "$ans" in
15144         none) static_ext=' ' ;;
15145         *) static_ext="$ans" ;;
15146         esac
15147         ;;
15148 *)
15149         $cat <<EOM
15150 A number of extensions are supplied with $package.  Answer "none" 
15151 to include no extensions. 
15152 Note that DynaLoader is always built and need not be mentioned here.
15153
15154 EOM
15155         case "$static_ext" in
15156         '') dflt="$avail_ext" ;;
15157         *)      dflt="$static_ext"
15158                 # Perhaps we are reusing an old out-of-date config.sh.
15159                 case "$hint" in
15160                 previous)
15161                         if test X"$static_ext" != X"$avail_ext"; then
15162                                 $cat <<EOM
15163 NOTICE:  Your previous config.sh list may be incorrect. 
15164 The extensions now available to you are 
15165         ${avail_ext}
15166 but the default list from your previous config.sh is
15167         ${static_ext} 
15168
15169 EOM
15170                         fi
15171                         ;;
15172                 esac
15173                 ;;
15174         esac
15175         : Exclude those that are not xs extensions
15176         case "$dflt" in
15177         '')     dflt=none;;
15178         esac
15179         rp="What extensions do you wish to include?"
15180         . ./myread
15181         case "$ans" in
15182         none) static_ext=' ' ;;
15183         *) static_ext="$ans" ;;
15184         esac
15185         ;;
15186 esac
15187
15188 set X $dynamic_ext $static_ext $nonxs_ext
15189 shift
15190 extensions="$*"
15191
15192 : Remove build directory name from cppstdin so it can be used from
15193 : either the present location or the final installed location.
15194 echo " "
15195 : Get out of the UU directory to get correct path name.
15196 cd ..
15197 case "$cppstdin" in
15198 `pwd`/cppstdin)
15199         echo "Stripping down cppstdin path name"
15200         cppstdin=cppstdin
15201         ;;
15202 esac
15203 cd UU
15204
15205 : end of configuration questions
15206 echo " "
15207 echo "End of configuration questions."
15208 echo " "
15209
15210 : back to where it started
15211 if test -d ../UU; then
15212         cd ..
15213 fi
15214
15215 : configuration may be patched via a 'config.over' file
15216 if $test -f config.over; then
15217         echo " "
15218         dflt=y
15219         rp='I see a config.over file.  Do you wish to load it?'
15220         . UU/myread
15221         case "$ans" in
15222         n*) echo "OK, I'll ignore it.";;
15223         *)      . ./config.over
15224                 echo "Configuration override changes have been loaded."
15225                 ;;
15226         esac
15227 fi
15228
15229 : in case they want portability, strip down executable paths
15230 case "$d_portable" in
15231 "$define")
15232         echo " "
15233         echo "Stripping down executable paths..." >&4
15234         for file in $loclist $trylist; do
15235                 eval temp=\$$file
15236                 eval $file=`basename $temp`
15237         done
15238         ;;
15239 esac
15240
15241 : create config.sh file
15242 echo " "
15243 echo "Creating config.sh..." >&4
15244 $spitshell <<EOT >config.sh
15245 $startsh
15246 #
15247 # This file was produced by running the Configure script. It holds all the
15248 # definitions figured out by Configure. Should you modify one of these values,
15249 # do not forget to propagate your changes by running "Configure -der". You may
15250 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15251 #
15252
15253 # Package name      : $package
15254 # Source directory  : $src
15255 # Configuration time: $cf_time
15256 # Configured by     : $cf_by
15257 # Target system     : $myuname
15258
15259 Author='$Author'
15260 Date='$Date'
15261 Header='$Header'
15262 Id='$Id'
15263 Locker='$Locker'
15264 Log='$Log'
15265 Mcc='$Mcc'
15266 RCSfile='$RCSfile'
15267 Revision='$Revision'
15268 Source='$Source'
15269 State='$State'
15270 _a='$_a'
15271 _exe='$_exe'
15272 _o='$_o'
15273 afs='$afs'
15274 alignbytes='$alignbytes'
15275 ansi2knr='$ansi2knr'
15276 aphostname='$aphostname'
15277 api_revision='$api_revision'
15278 api_subversion='$api_subversion'
15279 api_version='$api_version'
15280 api_versionstring='$api_versionstring'
15281 ar='$ar'
15282 archlib='$archlib'
15283 archlibexp='$archlibexp'
15284 archname64='$archname64'
15285 archname='$archname'
15286 archobjs='$archobjs'
15287 awk='$awk'
15288 baserev='$baserev'
15289 bash='$bash'
15290 bin='$bin'
15291 bincompat5005='$bincompat5005'
15292 binexp='$binexp'
15293 bison='$bison'
15294 byacc='$byacc'
15295 byteorder='$byteorder'
15296 c='$c'
15297 castflags='$castflags'
15298 cat='$cat'
15299 cc='$cc'
15300 cccdlflags='$cccdlflags'
15301 ccdlflags='$ccdlflags'
15302 ccflags='$ccflags'
15303 ccflags_uselargefiles='$ccflags_uselargefiles'
15304 ccsymbols='$ccsymbols'
15305 cf_by='$cf_by'
15306 cf_email='$cf_email'
15307 cf_time='$cf_time'
15308 charsize='$charsize'
15309 chgrp='$chgrp'
15310 chmod='$chmod'
15311 chown='$chown'
15312 clocktype='$clocktype'
15313 comm='$comm'
15314 compress='$compress'
15315 contains='$contains'
15316 cp='$cp'
15317 cpio='$cpio'
15318 cpp='$cpp'
15319 cpp_stuff='$cpp_stuff'
15320 cppccsymbols='$cppccsymbols'
15321 cppflags='$cppflags'
15322 cpplast='$cpplast'
15323 cppminus='$cppminus'
15324 cpprun='$cpprun'
15325 cppstdin='$cppstdin'
15326 cppsymbols='$cppsymbols'
15327 crosscompile='$crosscompile'
15328 cryptlib='$cryptlib'
15329 csh='$csh'
15330 d_Gconvert='$d_Gconvert'
15331 d_PRIEldbl='$d_PRIEldbl'
15332 d_PRIFldbl='$d_PRIFldbl'
15333 d_PRIGldbl='$d_PRIGldbl'
15334 d_PRIX64='$d_PRIX64'
15335 d_PRId64='$d_PRId64'
15336 d_PRIeldbl='$d_PRIeldbl'
15337 d_PRIfldbl='$d_PRIfldbl'
15338 d_PRIgldbl='$d_PRIgldbl'
15339 d_PRIi64='$d_PRIi64'
15340 d_PRIo64='$d_PRIo64'
15341 d_PRIu64='$d_PRIu64'
15342 d_PRIx64='$d_PRIx64'
15343 d_access='$d_access'
15344 d_accessx='$d_accessx'
15345 d_alarm='$d_alarm'
15346 d_archlib='$d_archlib'
15347 d_atolf='$d_atolf'
15348 d_atoll='$d_atoll'
15349 d_attribut='$d_attribut'
15350 d_bcmp='$d_bcmp'
15351 d_bcopy='$d_bcopy'
15352 d_bincompat5005='$d_bincompat5005'
15353 d_bsd='$d_bsd'
15354 d_bsdgetpgrp='$d_bsdgetpgrp'
15355 d_bsdsetpgrp='$d_bsdsetpgrp'
15356 d_bzero='$d_bzero'
15357 d_casti32='$d_casti32'
15358 d_castneg='$d_castneg'
15359 d_charvspr='$d_charvspr'
15360 d_chown='$d_chown'
15361 d_chroot='$d_chroot'
15362 d_chsize='$d_chsize'
15363 d_closedir='$d_closedir'
15364 d_const='$d_const'
15365 d_crypt='$d_crypt'
15366 d_csh='$d_csh'
15367 d_cuserid='$d_cuserid'
15368 d_dbl_dig='$d_dbl_dig'
15369 d_difftime='$d_difftime'
15370 d_dirnamlen='$d_dirnamlen'
15371 d_dlerror='$d_dlerror'
15372 d_dlopen='$d_dlopen'
15373 d_dlsymun='$d_dlsymun'
15374 d_dosuid='$d_dosuid'
15375 d_drand48proto='$d_drand48proto'
15376 d_dup2='$d_dup2'
15377 d_eaccess='$d_eaccess'
15378 d_endgrent='$d_endgrent'
15379 d_endhent='$d_endhent'
15380 d_endnent='$d_endnent'
15381 d_endpent='$d_endpent'
15382 d_endpwent='$d_endpwent'
15383 d_endsent='$d_endsent'
15384 d_eofnblk='$d_eofnblk'
15385 d_eunice='$d_eunice'
15386 d_fchmod='$d_fchmod'
15387 d_fchown='$d_fchown'
15388 d_fcntl='$d_fcntl'
15389 d_fd_macros='$d_fd_macros'
15390 d_fd_set='$d_fd_set'
15391 d_fds_bits='$d_fds_bits'
15392 d_fgetpos='$d_fgetpos'
15393 d_flexfnam='$d_flexfnam'
15394 d_flock='$d_flock'
15395 d_fork='$d_fork'
15396 d_fpathconf='$d_fpathconf'
15397 d_fpos64_t='$d_fpos64_t'
15398 d_frexpl='$d_frexpl'
15399 d_fs_data_s='$d_fs_data_s'
15400 d_fseeko='$d_fseeko'
15401 d_fsetpos='$d_fsetpos'
15402 d_fstatfs='$d_fstatfs'
15403 d_fstatvfs='$d_fstatvfs'
15404 d_ftello='$d_ftello'
15405 d_ftime='$d_ftime'
15406 d_getcwd='$d_getcwd'
15407 d_getespwnam='$d_getespwnam'
15408 d_getfsstat='$d_getfsstat'
15409 d_getgrent='$d_getgrent'
15410 d_getgrps='$d_getgrps'
15411 d_gethbyaddr='$d_gethbyaddr'
15412 d_gethbyname='$d_gethbyname'
15413 d_gethent='$d_gethent'
15414 d_gethname='$d_gethname'
15415 d_gethostprotos='$d_gethostprotos'
15416 d_getlogin='$d_getlogin'
15417 d_getmnt='$d_getmnt'
15418 d_getmntent='$d_getmntent'
15419 d_getnbyaddr='$d_getnbyaddr'
15420 d_getnbyname='$d_getnbyname'
15421 d_getnent='$d_getnent'
15422 d_getnetprotos='$d_getnetprotos'
15423 d_getpbyname='$d_getpbyname'
15424 d_getpbynumber='$d_getpbynumber'
15425 d_getpent='$d_getpent'
15426 d_getpgid='$d_getpgid'
15427 d_getpgrp2='$d_getpgrp2'
15428 d_getpgrp='$d_getpgrp'
15429 d_getppid='$d_getppid'
15430 d_getprior='$d_getprior'
15431 d_getprotoprotos='$d_getprotoprotos'
15432 d_getprpwnam='$d_getprpwnam'
15433 d_getpwent='$d_getpwent'
15434 d_getsbyname='$d_getsbyname'
15435 d_getsbyport='$d_getsbyport'
15436 d_getsent='$d_getsent'
15437 d_getservprotos='$d_getservprotos'
15438 d_getspnam='$d_getspnam'
15439 d_gettimeod='$d_gettimeod'
15440 d_gnulibc='$d_gnulibc'
15441 d_grpasswd='$d_grpasswd'
15442 d_hasmntopt='$d_hasmntopt'
15443 d_htonl='$d_htonl'
15444 d_iconv='$d_iconv'
15445 d_index='$d_index'
15446 d_inetaton='$d_inetaton'
15447 d_int64_t='$d_int64_t'
15448 d_isascii='$d_isascii'
15449 d_isnan='$d_isnan'
15450 d_isnanl='$d_isnanl'
15451 d_killpg='$d_killpg'
15452 d_lchown='$d_lchown'
15453 d_ldbl_dig='$d_ldbl_dig'
15454 d_link='$d_link'
15455 d_locconv='$d_locconv'
15456 d_lockf='$d_lockf'
15457 d_longdbl='$d_longdbl'
15458 d_longlong='$d_longlong'
15459 d_lseekproto='$d_lseekproto'
15460 d_lstat='$d_lstat'
15461 d_madvise='$d_madvise'
15462 d_mblen='$d_mblen'
15463 d_mbstowcs='$d_mbstowcs'
15464 d_mbtowc='$d_mbtowc'
15465 d_memchr='$d_memchr'
15466 d_memcmp='$d_memcmp'
15467 d_memcpy='$d_memcpy'
15468 d_memmove='$d_memmove'
15469 d_memset='$d_memset'
15470 d_mkdir='$d_mkdir'
15471 d_mkdtemp='$d_mkdtemp'
15472 d_mkfifo='$d_mkfifo'
15473 d_mkstemp='$d_mkstemp'
15474 d_mkstemps='$d_mkstemps'
15475 d_mktime='$d_mktime'
15476 d_mmap='$d_mmap'
15477 d_modfl='$d_modfl'
15478 d_mprotect='$d_mprotect'
15479 d_msg='$d_msg'
15480 d_msg_ctrunc='$d_msg_ctrunc'
15481 d_msg_dontroute='$d_msg_dontroute'
15482 d_msg_oob='$d_msg_oob'
15483 d_msg_peek='$d_msg_peek'
15484 d_msg_proxy='$d_msg_proxy'
15485 d_msgctl='$d_msgctl'
15486 d_msgget='$d_msgget'
15487 d_msgrcv='$d_msgrcv'
15488 d_msgsnd='$d_msgsnd'
15489 d_msync='$d_msync'
15490 d_munmap='$d_munmap'
15491 d_mymalloc='$d_mymalloc'
15492 d_nice='$d_nice'
15493 d_nv_preserves_uv='$d_nv_preserves_uv'
15494 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15495 d_off64_t='$d_off64_t'
15496 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15497 d_oldpthreads='$d_oldpthreads'
15498 d_oldsock='$d_oldsock'
15499 d_open3='$d_open3'
15500 d_pathconf='$d_pathconf'
15501 d_pause='$d_pause'
15502 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15503 d_phostname='$d_phostname'
15504 d_pipe='$d_pipe'
15505 d_poll='$d_poll'
15506 d_portable='$d_portable'
15507 d_pthread_yield='$d_pthread_yield'
15508 d_pwage='$d_pwage'
15509 d_pwchange='$d_pwchange'
15510 d_pwclass='$d_pwclass'
15511 d_pwcomment='$d_pwcomment'
15512 d_pwexpire='$d_pwexpire'
15513 d_pwgecos='$d_pwgecos'
15514 d_pwpasswd='$d_pwpasswd'
15515 d_pwquota='$d_pwquota'
15516 d_qgcvt='$d_qgcvt'
15517 d_quad='$d_quad'
15518 d_readdir='$d_readdir'
15519 d_readlink='$d_readlink'
15520 d_rename='$d_rename'
15521 d_rewinddir='$d_rewinddir'
15522 d_rmdir='$d_rmdir'
15523 d_safebcpy='$d_safebcpy'
15524 d_safemcpy='$d_safemcpy'
15525 d_sanemcmp='$d_sanemcmp'
15526 d_sched_yield='$d_sched_yield'
15527 d_scm_rights='$d_scm_rights'
15528 d_seekdir='$d_seekdir'
15529 d_select='$d_select'
15530 d_sem='$d_sem'
15531 d_semctl='$d_semctl'
15532 d_semctl_semid_ds='$d_semctl_semid_ds'
15533 d_semctl_semun='$d_semctl_semun'
15534 d_semget='$d_semget'
15535 d_semop='$d_semop'
15536 d_setegid='$d_setegid'
15537 d_seteuid='$d_seteuid'
15538 d_setgrent='$d_setgrent'
15539 d_setgrps='$d_setgrps'
15540 d_sethent='$d_sethent'
15541 d_setlinebuf='$d_setlinebuf'
15542 d_setlocale='$d_setlocale'
15543 d_setnent='$d_setnent'
15544 d_setpent='$d_setpent'
15545 d_setpgid='$d_setpgid'
15546 d_setpgrp2='$d_setpgrp2'
15547 d_setpgrp='$d_setpgrp'
15548 d_setprior='$d_setprior'
15549 d_setproctitle='$d_setproctitle'
15550 d_setpwent='$d_setpwent'
15551 d_setregid='$d_setregid'
15552 d_setresgid='$d_setresgid'
15553 d_setresuid='$d_setresuid'
15554 d_setreuid='$d_setreuid'
15555 d_setrgid='$d_setrgid'
15556 d_setruid='$d_setruid'
15557 d_setsent='$d_setsent'
15558 d_setsid='$d_setsid'
15559 d_setvbuf='$d_setvbuf'
15560 d_sfio='$d_sfio'
15561 d_shm='$d_shm'
15562 d_shmat='$d_shmat'
15563 d_shmatprototype='$d_shmatprototype'
15564 d_shmctl='$d_shmctl'
15565 d_shmdt='$d_shmdt'
15566 d_shmget='$d_shmget'
15567 d_sigaction='$d_sigaction'
15568 d_sigsetjmp='$d_sigsetjmp'
15569 d_socket='$d_socket'
15570 d_socklen_t='$d_socklen_t'
15571 d_sockpair='$d_sockpair'
15572 d_sqrtl='$d_sqrtl'
15573 d_statblks='$d_statblks'
15574 d_statfs_f_flags='$d_statfs_f_flags'
15575 d_statfs_s='$d_statfs_s'
15576 d_statvfs='$d_statvfs'
15577 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15578 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15579 d_stdio_stream_array='$d_stdio_stream_array'
15580 d_stdiobase='$d_stdiobase'
15581 d_stdstdio='$d_stdstdio'
15582 d_strchr='$d_strchr'
15583 d_strcoll='$d_strcoll'
15584 d_strctcpy='$d_strctcpy'
15585 d_strerrm='$d_strerrm'
15586 d_strerror='$d_strerror'
15587 d_strtod='$d_strtod'
15588 d_strtol='$d_strtol'
15589 d_strtold='$d_strtold'
15590 d_strtoll='$d_strtoll'
15591 d_strtoul='$d_strtoul'
15592 d_strtoull='$d_strtoull'
15593 d_strtouq='$d_strtouq'
15594 d_strxfrm='$d_strxfrm'
15595 d_suidsafe='$d_suidsafe'
15596 d_symlink='$d_symlink'
15597 d_syscall='$d_syscall'
15598 d_sysconf='$d_sysconf'
15599 d_sysernlst='$d_sysernlst'
15600 d_syserrlst='$d_syserrlst'
15601 d_system='$d_system'
15602 d_tcgetpgrp='$d_tcgetpgrp'
15603 d_tcsetpgrp='$d_tcsetpgrp'
15604 d_telldir='$d_telldir'
15605 d_telldirproto='$d_telldirproto'
15606 d_time='$d_time'
15607 d_times='$d_times'
15608 d_truncate='$d_truncate'
15609 d_tzname='$d_tzname'
15610 d_umask='$d_umask'
15611 d_uname='$d_uname'
15612 d_union_semun='$d_union_semun'
15613 d_ustat='$d_ustat'
15614 d_vendorarch='$d_vendorarch'
15615 d_vendorbin='$d_vendorbin'
15616 d_vendorlib='$d_vendorlib'
15617 d_vfork='$d_vfork'
15618 d_void_closedir='$d_void_closedir'
15619 d_voidsig='$d_voidsig'
15620 d_voidtty='$d_voidtty'
15621 d_volatile='$d_volatile'
15622 d_vprintf='$d_vprintf'
15623 d_wait4='$d_wait4'
15624 d_waitpid='$d_waitpid'
15625 d_wcstombs='$d_wcstombs'
15626 d_wctomb='$d_wctomb'
15627 d_xenix='$d_xenix'
15628 date='$date'
15629 db_hashtype='$db_hashtype'
15630 db_prefixtype='$db_prefixtype'
15631 defvoidused='$defvoidused'
15632 direntrytype='$direntrytype'
15633 dlext='$dlext'
15634 dlsrc='$dlsrc'
15635 doublesize='$doublesize'
15636 drand01='$drand01'
15637 dynamic_ext='$dynamic_ext'
15638 eagain='$eagain'
15639 ebcdic='$ebcdic'
15640 echo='$echo'
15641 egrep='$egrep'
15642 emacs='$emacs'
15643 eunicefix='$eunicefix'
15644 exe_ext='$exe_ext'
15645 expr='$expr'
15646 extensions='$extensions'
15647 fflushNULL='$fflushNULL'
15648 fflushall='$fflushall'
15649 find='$find'
15650 firstmakefile='$firstmakefile'
15651 flex='$flex'
15652 fpossize='$fpossize'
15653 fpostype='$fpostype'
15654 freetype='$freetype'
15655 full_ar='$full_ar'
15656 full_csh='$full_csh'
15657 full_sed='$full_sed'
15658 gccosandvers='$gccosandvers'
15659 gccversion='$gccversion'
15660 gidformat='$gidformat'
15661 gidsign='$gidsign'
15662 gidsize='$gidsize'
15663 gidtype='$gidtype'
15664 glibpth='$glibpth'
15665 grep='$grep'
15666 groupcat='$groupcat'
15667 groupstype='$groupstype'
15668 gzip='$gzip'
15669 h_fcntl='$h_fcntl'
15670 h_sysfile='$h_sysfile'
15671 hint='$hint'
15672 hostcat='$hostcat'
15673 huge='$huge'
15674 i16size='$i16size'
15675 i16type='$i16type'
15676 i32size='$i32size'
15677 i32type='$i32type'
15678 i64size='$i64size'
15679 i64type='$i64type'
15680 i8size='$i8size'
15681 i8type='$i8type'
15682 i_arpainet='$i_arpainet'
15683 i_bsdioctl='$i_bsdioctl'
15684 i_db='$i_db'
15685 i_dbm='$i_dbm'
15686 i_dirent='$i_dirent'
15687 i_dld='$i_dld'
15688 i_dlfcn='$i_dlfcn'
15689 i_fcntl='$i_fcntl'
15690 i_float='$i_float'
15691 i_gdbm='$i_gdbm'
15692 i_grp='$i_grp'
15693 i_iconv='$i_iconv'
15694 i_ieeefp='$i_ieeefp'
15695 i_inttypes='$i_inttypes'
15696 i_libutil='$i_libutil'
15697 i_limits='$i_limits'
15698 i_locale='$i_locale'
15699 i_machcthr='$i_machcthr'
15700 i_malloc='$i_malloc'
15701 i_math='$i_math'
15702 i_memory='$i_memory'
15703 i_mntent='$i_mntent'
15704 i_ndbm='$i_ndbm'
15705 i_netdb='$i_netdb'
15706 i_neterrno='$i_neterrno'
15707 i_netinettcp='$i_netinettcp'
15708 i_niin='$i_niin'
15709 i_poll='$i_poll'
15710 i_prot='$i_prot'
15711 i_pthread='$i_pthread'
15712 i_pwd='$i_pwd'
15713 i_rpcsvcdbm='$i_rpcsvcdbm'
15714 i_sfio='$i_sfio'
15715 i_sgtty='$i_sgtty'
15716 i_shadow='$i_shadow'
15717 i_socks='$i_socks'
15718 i_stdarg='$i_stdarg'
15719 i_stddef='$i_stddef'
15720 i_stdlib='$i_stdlib'
15721 i_string='$i_string'
15722 i_sunmath='$i_sunmath'
15723 i_sysaccess='$i_sysaccess'
15724 i_sysdir='$i_sysdir'
15725 i_sysfile='$i_sysfile'
15726 i_sysfilio='$i_sysfilio'
15727 i_sysin='$i_sysin'
15728 i_sysioctl='$i_sysioctl'
15729 i_syslog='$i_syslog'
15730 i_sysmman='$i_sysmman'
15731 i_sysmode='$i_sysmode'
15732 i_sysmount='$i_sysmount'
15733 i_sysndir='$i_sysndir'
15734 i_sysparam='$i_sysparam'
15735 i_sysresrc='$i_sysresrc'
15736 i_syssecrt='$i_syssecrt'
15737 i_sysselct='$i_sysselct'
15738 i_syssockio='$i_syssockio'
15739 i_sysstat='$i_sysstat'
15740 i_sysstatfs='$i_sysstatfs'
15741 i_sysstatvfs='$i_sysstatvfs'
15742 i_systime='$i_systime'
15743 i_systimek='$i_systimek'
15744 i_systimes='$i_systimes'
15745 i_systypes='$i_systypes'
15746 i_sysuio='$i_sysuio'
15747 i_sysun='$i_sysun'
15748 i_sysutsname='$i_sysutsname'
15749 i_sysvfs='$i_sysvfs'
15750 i_syswait='$i_syswait'
15751 i_termio='$i_termio'
15752 i_termios='$i_termios'
15753 i_time='$i_time'
15754 i_unistd='$i_unistd'
15755 i_ustat='$i_ustat'
15756 i_utime='$i_utime'
15757 i_values='$i_values'
15758 i_varargs='$i_varargs'
15759 i_varhdr='$i_varhdr'
15760 i_vfork='$i_vfork'
15761 ignore_versioned_solibs='$ignore_versioned_solibs'
15762 inc_version_list='$inc_version_list'
15763 inc_version_list_init='$inc_version_list_init'
15764 incpath='$incpath'
15765 inews='$inews'
15766 installarchlib='$installarchlib'
15767 installbin='$installbin'
15768 installman1dir='$installman1dir'
15769 installman3dir='$installman3dir'
15770 installprefix='$installprefix'
15771 installprefixexp='$installprefixexp'
15772 installprivlib='$installprivlib'
15773 installscript='$installscript'
15774 installsitearch='$installsitearch'
15775 installsitebin='$installsitebin'
15776 installsitelib='$installsitelib'
15777 installstyle='$installstyle'
15778 installusrbinperl='$installusrbinperl'
15779 installvendorarch='$installvendorarch'
15780 installvendorbin='$installvendorbin'
15781 installvendorlib='$installvendorlib'
15782 intsize='$intsize'
15783 ivdformat='$ivdformat'
15784 ivsize='$ivsize'
15785 ivtype='$ivtype'
15786 known_extensions='$known_extensions'
15787 ksh='$ksh'
15788 large='$large'
15789 ld='$ld'
15790 lddlflags='$lddlflags'
15791 ldflags='$ldflags'
15792 ldflags_uselargefiles='$ldflags_uselargefiles'
15793 ldlibpthname='$ldlibpthname'
15794 less='$less'
15795 lib_ext='$lib_ext'
15796 libc='$libc'
15797 libperl='$libperl'
15798 libpth='$libpth'
15799 libs='$libs'
15800 libsdirs='$libsdirs'
15801 libsfiles='$libsfiles'
15802 libsfound='$libsfound'
15803 libspath='$libspath'
15804 libswanted='$libswanted'
15805 libswanted_uselargefiles='$libswanted_uselargefiles'
15806 line='$line'
15807 lint='$lint'
15808 lkflags='$lkflags'
15809 ln='$ln'
15810 lns='$lns'
15811 locincpth='$locincpth'
15812 loclibpth='$loclibpth'
15813 longdblsize='$longdblsize'
15814 longlongsize='$longlongsize'
15815 longsize='$longsize'
15816 lp='$lp'
15817 lpr='$lpr'
15818 ls='$ls'
15819 lseeksize='$lseeksize'
15820 lseektype='$lseektype'
15821 mail='$mail'
15822 mailx='$mailx'
15823 make='$make'
15824 make_set_make='$make_set_make'
15825 mallocobj='$mallocobj'
15826 mallocsrc='$mallocsrc'
15827 malloctype='$malloctype'
15828 man1dir='$man1dir'
15829 man1direxp='$man1direxp'
15830 man1ext='$man1ext'
15831 man3dir='$man3dir'
15832 man3direxp='$man3direxp'
15833 man3ext='$man3ext'
15834 medium='$medium'
15835 mips_type='$mips_type'
15836 mkdir='$mkdir'
15837 mmaptype='$mmaptype'
15838 models='$models'
15839 modetype='$modetype'
15840 more='$more'
15841 multiarch='$multiarch'
15842 mv='$mv'
15843 myarchname='$myarchname'
15844 mydomain='$mydomain'
15845 myhostname='$myhostname'
15846 myuname='$myuname'
15847 n='$n'
15848 netdb_hlen_type='$netdb_hlen_type'
15849 netdb_host_type='$netdb_host_type'
15850 netdb_name_type='$netdb_name_type'
15851 netdb_net_type='$netdb_net_type'
15852 nm='$nm'
15853 nm_opt='$nm_opt'
15854 nm_so_opt='$nm_so_opt'
15855 nonxs_ext='$nonxs_ext'
15856 nroff='$nroff'
15857 nvsize='$nvsize'
15858 nvtype='$nvtype'
15859 o_nonblock='$o_nonblock'
15860 obj_ext='$obj_ext'
15861 old_pthread_create_joinable='$old_pthread_create_joinable'
15862 optimize='$optimize'
15863 orderlib='$orderlib'
15864 osname='$osname'
15865 osvers='$osvers'
15866 otherlibdirs='$otherlibdirs'
15867 package='$package'
15868 pager='$pager'
15869 passcat='$passcat'
15870 patchlevel='$patchlevel'
15871 path_sep='$path_sep'
15872 perl5='$perl5'
15873 perl='$perl'
15874 perladmin='$perladmin'
15875 perlpath='$perlpath'
15876 pg='$pg'
15877 phostname='$phostname'
15878 pidtype='$pidtype'
15879 plibpth='$plibpth'
15880 pm_apiversion='$pm_apiversion'
15881 pmake='$pmake'
15882 pr='$pr'
15883 prefix='$prefix'
15884 prefixexp='$prefixexp'
15885 privlib='$privlib'
15886 privlibexp='$privlibexp'
15887 prototype='$prototype'
15888 ptrsize='$ptrsize'
15889 quadkind='$quadkind'
15890 quadtype='$quadtype'
15891 randbits='$randbits'
15892 randfunc='$randfunc'
15893 randseedtype='$randseedtype'
15894 ranlib='$ranlib'
15895 rd_nodata='$rd_nodata'
15896 revision='$revision'
15897 rm='$rm'
15898 rmail='$rmail'
15899 runnm='$runnm'
15900 sPRIEldbl='$sPRIEldbl'
15901 sPRIFldbl='$sPRIFldbl'
15902 sPRIGldbl='$sPRIGldbl'
15903 sPRIX64='$sPRIX64'
15904 sPRId64='$sPRId64'
15905 sPRIeldbl='$sPRIeldbl'
15906 sPRIfldbl='$sPRIfldbl'
15907 sPRIgldbl='$sPRIgldbl'
15908 sPRIi64='$sPRIi64'
15909 sPRIo64='$sPRIo64'
15910 sPRIu64='$sPRIu64'
15911 sPRIx64='$sPRIx64'
15912 sched_yield='$sched_yield'
15913 scriptdir='$scriptdir'
15914 scriptdirexp='$scriptdirexp'
15915 sed='$sed'
15916 seedfunc='$seedfunc'
15917 selectminbits='$selectminbits'
15918 selecttype='$selecttype'
15919 sendmail='$sendmail'
15920 sh='$sh'
15921 shar='$shar'
15922 sharpbang='$sharpbang'
15923 shmattype='$shmattype'
15924 shortsize='$shortsize'
15925 shrpenv='$shrpenv'
15926 shsharp='$shsharp'
15927 sig_count='$sig_count'
15928 sig_name='$sig_name'
15929 sig_name_init='$sig_name_init'
15930 sig_num='$sig_num'
15931 sig_num_init='$sig_num_init'
15932 signal_t='$signal_t'
15933 sitearch='$sitearch'
15934 sitearchexp='$sitearchexp'
15935 sitebin='$sitebin'
15936 sitebinexp='$sitebinexp'
15937 sitelib='$sitelib'
15938 sitelib_stem='$sitelib_stem'
15939 sitelibexp='$sitelibexp'
15940 siteprefix='$siteprefix'
15941 siteprefixexp='$siteprefixexp'
15942 sizesize='$sizesize'
15943 sizetype='$sizetype'
15944 sleep='$sleep'
15945 smail='$smail'
15946 small='$small'
15947 so='$so'
15948 sockethdr='$sockethdr'
15949 socketlib='$socketlib'
15950 socksizetype='$socksizetype'
15951 sort='$sort'
15952 spackage='$spackage'
15953 spitshell='$spitshell'
15954 split='$split'
15955 src='$src'
15956 ssizetype='$ssizetype'
15957 startperl='$startperl'
15958 startsh='$startsh'
15959 static_ext='$static_ext'
15960 stdchar='$stdchar'
15961 stdio_base='$stdio_base'
15962 stdio_bufsiz='$stdio_bufsiz'
15963 stdio_cnt='$stdio_cnt'
15964 stdio_filbuf='$stdio_filbuf'
15965 stdio_ptr='$stdio_ptr'
15966 stdio_stream_array='$stdio_stream_array'
15967 strings='$strings'
15968 submit='$submit'
15969 subversion='$subversion'
15970 sysman='$sysman'
15971 tail='$tail'
15972 tar='$tar'
15973 tbl='$tbl'
15974 tee='$tee'
15975 test='$test'
15976 timeincl='$timeincl'
15977 timetype='$timetype'
15978 touch='$touch'
15979 tr='$tr'
15980 trnl='$trnl'
15981 troff='$troff'
15982 u16size='$u16size'
15983 u16type='$u16type'
15984 u32size='$u32size'
15985 u32type='$u32type'
15986 u64size='$u64size'
15987 u64type='$u64type'
15988 u8size='$u8size'
15989 u8type='$u8type'
15990 uidformat='$uidformat'
15991 uidsign='$uidsign'
15992 uidsize='$uidsize'
15993 uidtype='$uidtype'
15994 uname='$uname'
15995 uniq='$uniq'
15996 uquadtype='$uquadtype'
15997 use5005threads='$use5005threads'
15998 use64bitall='$use64bitall'
15999 use64bitint='$use64bitint'
16000 usedl='$usedl'
16001 useithreads='$useithreads'
16002 uselargefiles='$uselargefiles'
16003 uselongdouble='$uselongdouble'
16004 usemorebits='$usemorebits'
16005 usemultiplicity='$usemultiplicity'
16006 usemymalloc='$usemymalloc'
16007 usenm='$usenm'
16008 useopcode='$useopcode'
16009 useperlio='$useperlio'
16010 useposix='$useposix'
16011 usesfio='$usesfio'
16012 useshrplib='$useshrplib'
16013 usesocks='$usesocks'
16014 usethreads='$usethreads'
16015 usevendorprefix='$usevendorprefix'
16016 usevfork='$usevfork'
16017 usrinc='$usrinc'
16018 uuname='$uuname'
16019 uvoformat='$uvoformat'
16020 uvsize='$uvsize'
16021 uvtype='$uvtype'
16022 uvuformat='$uvuformat'
16023 uvxformat='$uvxformat'
16024 vendorarch='$vendorarch'
16025 vendorarchexp='$vendorarchexp'
16026 vendorbin='$vendorbin'
16027 vendorbinexp='$vendorbinexp'
16028 vendorlib='$vendorlib'
16029 vendorlib_stem='$vendorlib_stem'
16030 vendorlibexp='$vendorlibexp'
16031 vendorprefix='$vendorprefix'
16032 vendorprefixexp='$vendorprefixexp'
16033 version='$version'
16034 vi='$vi'
16035 voidflags='$voidflags'
16036 xlibpth='$xlibpth'
16037 xs_apiversion='$xs_apiversion'
16038 zcat='$zcat'
16039 zip='$zip'
16040 EOT
16041
16042 : Add in command line options if available
16043 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16044
16045 : add special variables
16046 $test -f $src/patchlevel.h && \
16047 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16048 echo "CONFIGDOTSH=true" >>config.sh
16049
16050 : propagate old symbols
16051 if $test -f UU/config.sh; then
16052         <UU/config.sh sort | uniq >UU/oldconfig.sh
16053         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16054         sort | uniq -u >UU/oldsyms
16055         set X `cat UU/oldsyms`
16056         shift
16057         case $# in
16058         0) ;;
16059         *)
16060                 cat <<EOM
16061 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16062 EOM
16063                 echo "# Variables propagated from previous config.sh file." >>config.sh
16064                 for sym in `cat UU/oldsyms`; do
16065                         echo "    Propagating $hint variable "'$'"$sym..."
16066                         eval 'tmp="$'"${sym}"'"'
16067                         echo "$tmp" | \
16068                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16069                 done
16070                 ;;
16071         esac
16072 fi
16073
16074 : Finish up by extracting the .SH files
16075 case "$alldone" in
16076 exit)
16077         $rm -rf UU
16078         echo "Done."
16079         exit 0
16080         ;;
16081 cont)
16082         ;;
16083 '')
16084         dflt=''
16085         nostick=true
16086         $cat <<EOM
16087
16088 If you'd like to make any changes to the config.sh file before I begin
16089 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16090
16091 EOM
16092         rp="Press return or use a shell escape to edit config.sh:"
16093         . UU/myread
16094         nostick=''
16095         case "$ans" in
16096         '') ;;
16097         *) : in case they cannot read
16098                 sh 1>&4 -c "$ans";;
16099         esac
16100         ;;
16101 esac
16102
16103 : if this fails, just run all the .SH files by hand
16104 . ./config.sh
16105
16106 echo " "
16107 exec 1>&4
16108 . ./UU/extract
16109
16110 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16111         dflt=y
16112         case "$silent" in
16113         true) ;;
16114         *)
16115                 $cat <<EOM
16116
16117 Now you need to generate make dependencies by running "$make depend".
16118 You might prefer to run it in background: "$make depend > makedepend.out &"
16119 It can take a while, so you might not want to run it right now.
16120
16121 EOM
16122                 ;;
16123         esac
16124         rp="Run $make depend now?"
16125         . UU/myread
16126         case "$ans" in
16127         y*)
16128                 $make depend && echo "Now you must run a $make."
16129                 ;;
16130         *)
16131                 echo "You must run '$make depend' then '$make'."
16132                 ;;
16133         esac
16134 elif test -f [Mm]akefile; then
16135         echo " "
16136         echo "Now you must run a $make."
16137 else
16138         echo "Done."
16139 fi
16140
16141 if $test -f Policy.sh; then
16142     $cat <<EOM
16143
16144 If you compile $package on a different machine or from a different object
16145 directory, copy the Policy.sh file from this object directory to the
16146 new one before you run Configure -- this will help you with most of
16147 the policy defaults.
16148
16149 EOM
16150 fi
16151 if $test -f config.msg; then
16152     echo "Hmm.  I also noted the following information while running:"
16153     echo " "
16154     $cat config.msg >&4
16155     $rm -f config.msg
16156 fi
16157 $rm -f kit*isdone ark*isdone
16158 $rm -rf UU
16159
16160 : End of Configure
16161