759e2010a7a087d3d2e850590ec03cf374b8bae4
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Jan 18 23:09:49 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtold=''
533 d_strtoll=''
534 d_strtoul=''
535 d_strtoull=''
536 d_strtouq=''
537 d_strxfrm=''
538 d_symlink=''
539 d_syscall=''
540 d_sysconf=''
541 d_system=''
542 d_tcgetpgrp=''
543 d_tcsetpgrp=''
544 d_telldirproto=''
545 d_time=''
546 timetype=''
547 clocktype=''
548 d_times=''
549 d_truncate=''
550 d_tzname=''
551 d_umask=''
552 d_semctl_semid_ds=''
553 d_semctl_semun=''
554 d_union_semun=''
555 d_ustat=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 dlext=''
568 cccdlflags=''
569 ccdlflags=''
570 dlsrc=''
571 ld=''
572 lddlflags=''
573 usedl=''
574 doublesize=''
575 ebcdic=''
576 fflushNULL=''
577 fflushall=''
578 fpossize=''
579 fpostype=''
580 gidformat=''
581 gidsign=''
582 gidsize=''
583 gidtype=''
584 groupstype=''
585 h_fcntl=''
586 h_sysfile=''
587 i_arpainet=''
588 db_hashtype=''
589 db_prefixtype=''
590 i_db=''
591 i_dbm=''
592 i_rpcsvcdbm=''
593 d_dirnamlen=''
594 direntrytype=''
595 i_dirent=''
596 i_dld=''
597 i_dlfcn=''
598 i_fcntl=''
599 i_float=''
600 i_gdbm=''
601 d_grpasswd=''
602 i_grp=''
603 i_inttypes=''
604 i_limits=''
605 i_locale=''
606 i_machcthr=''
607 i_malloc=''
608 i_math=''
609 i_memory=''
610 i_mntent=''
611 i_ndbm=''
612 i_netdb=''
613 i_neterrno=''
614 i_netinettcp=''
615 i_niin=''
616 i_sysin=''
617 i_poll=''
618 i_pthread=''
619 d_pwage=''
620 d_pwchange=''
621 d_pwclass=''
622 d_pwcomment=''
623 d_pwexpire=''
624 d_pwgecos=''
625 d_pwpasswd=''
626 d_pwquota=''
627 i_pwd=''
628 i_sfio=''
629 i_shadow=''
630 i_socks=''
631 i_stddef=''
632 i_stdlib=''
633 i_string=''
634 strings=''
635 i_sysaccess=''
636 i_sysdir=''
637 i_sysfile=''
638 d_voidtty=''
639 i_bsdioctl=''
640 i_sysfilio=''
641 i_sysioctl=''
642 i_syssockio=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatfs=''
651 i_sysstatvfs=''
652 i_systimes=''
653 i_systypes=''
654 i_sysuio=''
655 i_sysun=''
656 i_sysvfs=''
657 i_syswait=''
658 i_sgtty=''
659 i_termio=''
660 i_termios=''
661 i_systime=''
662 i_systimek=''
663 i_time=''
664 timeincl=''
665 i_unistd=''
666 i_ustat=''
667 i_utime=''
668 i_values=''
669 i_stdarg=''
670 i_varargs=''
671 i_varhdr=''
672 i_vfork=''
673 inc_version_list=''
674 installprefix=''
675 installprefixexp=''
676 installstyle=''
677 installusrbinperl=''
678 intsize=''
679 longsize=''
680 shortsize=''
681 d_fpos64_t=''
682 d_off64_t=''
683 libc=''
684 ldlibpthname=''
685 libperl=''
686 shrpenv=''
687 useshrplib=''
688 glibpth=''
689 libpth=''
690 loclibpth=''
691 plibpth=''
692 xlibpth=''
693 ignore_versioned_solibs=''
694 libs=''
695 lns=''
696 d_PRIEldbl=''
697 d_PRIFldbl=''
698 d_PRIGldbl=''
699 d_PRIeldbl=''
700 d_PRIfldbl=''
701 d_PRIgldbl=''
702 sPRIEldbl=''
703 sPRIFldbl=''
704 sPRIGldbl=''
705 sPRIeldbl=''
706 sPRIfldbl=''
707 sPRIgldbl=''
708 lseeksize=''
709 lseektype=''
710 make_set_make=''
711 d_mymalloc=''
712 freetype=''
713 mallocobj=''
714 mallocsrc=''
715 malloctype=''
716 usemymalloc=''
717 installman1dir=''
718 man1dir=''
719 man1direxp=''
720 man1ext=''
721 installman3dir=''
722 man3dir=''
723 man3direxp=''
724 man3ext=''
725 huge=''
726 large=''
727 medium=''
728 models=''
729 small=''
730 split=''
731 modetype=''
732 multiarch=''
733 mydomain=''
734 myhostname=''
735 phostname=''
736 c=''
737 n=''
738 d_eofnblk=''
739 eagain=''
740 o_nonblock=''
741 rd_nodata=''
742 netdb_hlen_type=''
743 netdb_host_type=''
744 netdb_name_type=''
745 netdb_net_type=''
746 groupcat=''
747 hostcat=''
748 passcat=''
749 orderlib=''
750 ranlib=''
751 package=''
752 spackage=''
753 pager=''
754 api_revision=''
755 api_subversion=''
756 api_version=''
757 api_versionstring=''
758 patchlevel=''
759 subversion=''
760 version=''
761 perladmin=''
762 perlpath=''
763 i16size=''
764 i16type=''
765 i32size=''
766 i32type=''
767 i64size=''
768 i64type=''
769 i8size=''
770 i8type=''
771 ivsize=''
772 ivtype=''
773 nvsize=''
774 nvtype=''
775 u16size=''
776 u16type=''
777 u32size=''
778 u32type=''
779 u64size=''
780 u64type=''
781 u8size=''
782 u8type=''
783 uvsize=''
784 uvtype=''
785 ivdformat=''
786 uvoformat=''
787 uvuformat=''
788 uvxformat=''
789 pidtype=''
790 prefix=''
791 prefixexp=''
792 installprivlib=''
793 privlib=''
794 privlibexp=''
795 prototype=''
796 ptrsize=''
797 d_PRIX64=''
798 d_PRId64=''
799 d_PRIi64=''
800 d_PRIo64=''
801 d_PRIu64=''
802 d_PRIx64=''
803 sPRIX64=''
804 sPRId64=''
805 sPRIi64=''
806 sPRIo64=''
807 sPRIu64=''
808 sPRIx64=''
809 d_quad=''
810 quadkind=''
811 quadtype=''
812 uquadtype=''
813 drand01=''
814 randbits=''
815 randfunc=''
816 randseedtype=''
817 seedfunc=''
818 installscript=''
819 scriptdir=''
820 scriptdirexp=''
821 selectminbits=''
822 selecttype=''
823 sh=''
824 sig_count=''
825 sig_name=''
826 sig_name_init=''
827 sig_num=''
828 sig_num_init=''
829 installsitearch=''
830 sitearch=''
831 sitearchexp=''
832 installsitebin=''
833 sitebin=''
834 sitebinexp=''
835 installsitelib=''
836 sitelib=''
837 sitelibexp=''
838 siteprefix=''
839 siteprefixexp=''
840 sizetype=''
841 so=''
842 sharpbang=''
843 shsharp=''
844 spitshell=''
845 src=''
846 ssizetype=''
847 startperl=''
848 startsh=''
849 stdchar=''
850 d_stdio_stream_array=''
851 stdio_stream_array=''
852 sysman=''
853 trnl=''
854 uidformat=''
855 uidsign=''
856 uidsize=''
857 uidtype=''
858 archname64=''
859 use64bits=''
860 uselargefiles=''
861 uselongdouble=''
862 uselonglong=''
863 usemorebits=''
864 usemultiplicity=''
865 nm_opt=''
866 nm_so_opt=''
867 runnm=''
868 usenm=''
869 useperlio=''
870 usesocks=''
871 d_oldpthreads=''
872 use5005threads=''
873 useithreads=''
874 usethreads=''
875 incpath=''
876 mips_type=''
877 usrinc=''
878 d_vendorbin=''
879 installvendorbin=''
880 vendorbin=''
881 vendorbinexp=''
882 d_vendorlib=''
883 installvendorlib=''
884 vendorlib=''
885 vendorlibexp=''
886 usevendorprefix=''
887 vendorprefix=''
888 vendorprefixexp=''
889 defvoidused=''
890 voidflags=''
891 CONFIG=''
892
893 define='define'
894 undef='undef'
895 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
896 rmlist=''
897
898 : We must find out about Eunice early
899 eunicefix=':'
900 if test -f /etc/unixtovms; then
901         eunicefix=/etc/unixtovms
902 fi
903 if test -f /etc/unixtovms.exe; then
904         eunicefix=/etc/unixtovms.exe
905 fi
906
907 i_whoami=''
908 : list of known cpp symbols, sorted alphabetically
909 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
910 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
911 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
912 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
913 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
914 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
915 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
916 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
917 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
918 al="$al VMS Xenix286"
919 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
920 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
921 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
922 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
923 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
924 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
925 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
926 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
927 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
928 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
929 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
930 al="$al __SVR4_2__ __UMAXV__"
931 al="$al ____386BSD____ __alpha __alpha__ __amiga"
932 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
933 al="$al __host_mips__"
934 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
935 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
936 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
937 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
938 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
939 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
940 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
941 al="$al __mc88100 __mc88100__ __mips __mips__"
942 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
943 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
944 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
945 al="$al _host_mips _mips _unix"
946 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
947 al="$al apollo ardent att386 att3b"
948 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
949 al="$al cadmus clipper concurrent convex cray ctix"
950 al="$al dmert encore gcos gcx gimpel gould"
951 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
952 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
953 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
954 al="$al i186 i286 i386 i486 i8086"
955 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
956 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
957 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
958 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
959 al="$al mc88000 mc88100 merlin mert mips mvs n16"
960 al="$al ncl_el ncl_mr"
961 al="$al news1500 news1700 news1800 news1900 news3700"
962 al="$al news700 news800 news900 ns16000 ns32000"
963 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
964 al="$al parisc pc532 pdp11 plexus posix pyr"
965 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
966 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
967 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
968 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
969 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
970 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
971 al="$al xenix z8000"
972
973 : set useposix=false in your hint file to disable the POSIX extension.
974 useposix=true
975 : set useopcode=false in your hint file to disable the Opcode extension.
976 useopcode=true
977 : Trailing extension.  Override this in a hint file, if needed.
978 _exe=''
979 : Extra object files, if any, needed on this platform.
980 archobjs=''
981 : Possible local include directories to search.
982 : Set locincpth to "" in a hint file to defeat local include searches.
983 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
984 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
985 :
986 : no include file wanted by default
987 inclwanted=''
988
989 groupstype=''
990 : change the next line if compiling for Xenix/286 on Xenix/386
991 xlibpth='/usr/lib/386 /lib/386'
992
993 : Possible local library directories to search.
994 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
995 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
996
997 : general looking path for locating libraries
998 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
999 glibpth="$glibpth /lib /usr/lib $xlibpth"
1000 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
1001 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1002
1003 : Private path used by Configure to find libraries.  Its value
1004 : is prepended to libpth. This variable takes care of special
1005 : machines, like the mips.  Usually, it should be empty.
1006 plibpth=''
1007
1008 : default library list
1009 libswanted=''
1010 : some systems want to use only the non-versioned libso:s
1011 ignore_versioned_solibs=''
1012 : set usemultiplicity on the Configure command line to enable multiplicity.
1013 : set usesocks on the Configure command line to enable socks.
1014 : set usethreads on the Configure command line to enable threads.
1015 : full support for void wanted by default
1016 defvoidused=15
1017
1018 : List of libraries we want.
1019 : If anyone needs -lnet, put it in a hint file.
1020 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1021 libswanted="$libswanted dld ld sun m c cposix posix"
1022 libswanted="$libswanted ndir dir crypt sec"
1023 libswanted="$libswanted ucb bsd BSD PW x"
1024 : We probably want to search /usr/shlib before most other libraries.
1025 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1026 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1027 glibpth="/usr/shlib $glibpth"
1028 : Do not use vfork unless overridden by a hint file.
1029 usevfork=false
1030
1031 : Find the basic shell for Bourne shell scripts
1032 case "$sh" in
1033 '')
1034         case "$SYSTYPE" in
1035         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1036         *) xxx='/bin/sh';;
1037         esac
1038         if test -f "$xxx"; then
1039                 sh="$xxx"
1040         else
1041                 : Build up a list and do a single loop so we can 'break' out.
1042                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1043                 for xxx in sh bash ksh pdksh ash; do
1044                         for p in $pth; do
1045                                 try="$try ${p}/${xxx}"
1046                         done
1047                 done
1048                 for xxx in $try; do
1049                         if test -f "$xxx"; then
1050                                 sh="$xxx";
1051                                 break
1052                         elif test -f "$xxx.exe"; then
1053                                 sh="$xxx";
1054                                 break
1055                         fi
1056                 done
1057         fi
1058         ;;
1059 esac
1060
1061 case "$sh" in
1062 '')     cat <<EOM >&2
1063 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1064
1065 Usually it's in /bin/sh.  How did you even get this far?
1066 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1067 we'll try to straighten this all out.
1068 EOM
1069         exit 1
1070         ;;
1071 esac
1072
1073 : see if sh knows # comments
1074 if `$sh -c '#' >/dev/null 2>&1`; then
1075         shsharp=true
1076         spitshell=cat
1077         xcat=/bin/cat
1078         test -f $xcat || xcat=/usr/bin/cat
1079         echo "#!$xcat" >try
1080         $eunicefix try
1081         chmod +x try
1082         ./try > today
1083         if test -s today; then
1084                 sharpbang='#!'
1085         else
1086                 echo "#! $xcat" > try
1087                 $eunicefix try
1088                 chmod +x try
1089                 ./try > today
1090                 if test -s today; then
1091                         sharpbang='#! '
1092                 else
1093                         sharpbang=': use '
1094                 fi
1095         fi
1096 else
1097         echo " "
1098         echo "Your $sh doesn't grok # comments--I will strip them later on."
1099         shsharp=false
1100         cd ..
1101         echo "exec grep -v '^[  ]*#'" >spitshell
1102         chmod +x spitshell
1103         $eunicefix spitshell
1104         spitshell=`pwd`/spitshell
1105         cd UU
1106         echo "I presume that if # doesn't work, #! won't work either!"
1107         sharpbang=': use '
1108 fi
1109 rm -f try today
1110
1111 : figure out how to guarantee sh startup
1112 case "$startsh" in
1113 '') startsh=${sharpbang}${sh} ;;
1114 *)
1115 esac
1116 cat >try <<EOSS
1117 $startsh
1118 set abc
1119 test "$?abc" != 1
1120 EOSS
1121
1122 chmod +x try
1123 $eunicefix try
1124 if ./try; then
1125         : echo "Yup, it does."
1126 else
1127         echo "Hmm... '$startsh' does not guarantee sh startup..."
1128         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1129 fi
1130 rm -f try
1131
1132
1133 : Save command line options in file UU/cmdline.opt for later use in
1134 : generating config.sh.
1135 cat > cmdline.opt <<EOSH
1136 # Configure command line arguments.
1137 config_arg0='$0'
1138 config_args='$*'
1139 config_argc=$#
1140 EOSH
1141 argn=1
1142 for arg in "$@"; do
1143         cat >>cmdline.opt <<EOSH
1144 config_arg$argn='$arg'
1145 EOSH
1146         argn=`expr $argn + 1`
1147 done
1148
1149 : produce awk script to parse command line options
1150 cat >options.awk <<'EOF'
1151 BEGIN {
1152         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1153
1154         len = length(optstr);
1155         for (i = 1; i <= len; i++) {
1156                 c = substr(optstr, i, 1);
1157                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1158                 if (a == ":") {
1159                         arg[c] = 1;
1160                         i++;
1161                 }
1162                 opt[c] = 1;
1163         }
1164 }
1165 {
1166         expect = 0;
1167         str = $0;
1168         if (substr(str, 1, 1) != "-") {
1169                 printf("'%s'\n", str);
1170                 next;
1171         }
1172         len = length($0);
1173         for (i = 2; i <= len; i++) {
1174                 c = substr(str, i, 1);
1175                 if (!opt[c]) {
1176                         printf("-%s\n", substr(str, i));
1177                         next;
1178                 }
1179                 printf("-%s\n", c);
1180                 if (arg[c]) {
1181                         if (i < len)
1182                                 printf("'%s'\n", substr(str, i + 1));
1183                         else
1184                                 expect = 1;
1185                         next;
1186                 }
1187         }
1188 }
1189 END {
1190         if (expect)
1191                 print "?";
1192 }
1193 EOF
1194
1195 : process the command line options
1196 set X `for arg in "$@"; do echo "X$arg"; done |
1197         sed -e s/X// | awk -f options.awk`
1198 eval "set $*"
1199 shift
1200 rm -f options.awk
1201
1202 : set up default values
1203 fastread=''
1204 reuseval=false
1205 config_sh=''
1206 alldone=''
1207 error=''
1208 silent=''
1209 extractsh=''
1210 override=''
1211 knowitall=''
1212 rm -f optdef.sh posthint.sh
1213 cat >optdef.sh <<EOS
1214 $startsh
1215 EOS
1216
1217
1218 : option parsing
1219 while test $# -gt 0; do
1220         case "$1" in
1221         -d) shift; fastread=yes;;
1222         -e) shift; alldone=cont;;
1223         -f)
1224                 shift
1225                 cd ..
1226                 if test -r "$1"; then
1227                         config_sh="$1"
1228                 else
1229                         echo "$me: cannot read config file $1." >&2
1230                         error=true
1231                 fi
1232                 cd UU
1233                 shift;;
1234         -h) shift; error=true;;
1235         -r) shift; reuseval=true;;
1236         -s) shift; silent=true; realsilent=true;;
1237         -E) shift; alldone=exit;;
1238         -K) shift; knowitall=true;;
1239         -O) shift; override=true;;
1240         -S) shift; silent=true; extractsh=true;;
1241         -D)
1242                 shift
1243                 case "$1" in
1244                 *=)
1245                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1246                         echo "$me: ignoring -D $1" >&2
1247                         ;;
1248                 *=*) echo "$1" | \
1249                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1250                 *) echo "$1='define'" >> optdef.sh;;
1251                 esac
1252                 shift
1253                 ;;
1254         -U)
1255                 shift
1256                 case "$1" in
1257                 *=) echo "$1" >> optdef.sh;;
1258                 *=*)
1259                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1260                         echo "$me: ignoring -U $1" >&2
1261                         ;;
1262                 *) echo "$1='undef'" >> optdef.sh;;
1263                 esac
1264                 shift
1265                 ;;
1266         -A)
1267             shift
1268             xxx=''
1269             yyy="$1"
1270             zzz=''
1271             uuu=undef
1272             case "$yyy" in
1273             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1274                  case "$zzz" in
1275                  *:*) zzz='' ;;
1276                  *)   xxx=append
1277                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1278                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1279                  esac
1280                  ;;
1281             esac
1282             case "$xxx" in
1283             '')  case "$yyy" in
1284                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1285                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1286                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1287                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1288                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1289                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1290                  esac
1291                  ;;       
1292             esac
1293             case "$xxx" in
1294             append)
1295                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1296             clear)
1297                 echo "$yyy=''"                  >> posthint.sh ;;
1298             define)
1299                 case "$zzz" in
1300                 '') zzz=define ;;
1301                 esac
1302                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1303             eval)
1304                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1305             prepend)
1306                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1307             undef)
1308                 case "$zzz" in
1309                 '') zzz="$uuu" ;;
1310                 esac
1311                 echo "$yyy=$zzz"                >> posthint.sh ;;
1312             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1313             esac
1314             ;;
1315         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1316             exit 0;;
1317         --) break;;
1318         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1319         *) break;;
1320         esac
1321 done
1322
1323 case "$error" in
1324 true)
1325         cat >&2 <<EOM
1326 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1327                  [-U symbol] [-U symbol=] [-A command:symbol...]
1328   -d : use defaults for all answers.
1329   -e : go on without questioning past the production of config.sh.
1330   -f : specify an alternate default configuration file.
1331   -h : print this help message and exit (with an error status).
1332   -r : reuse C symbols value if possible (skips costly nm extraction).
1333   -s : silent mode, only echoes questions and essential information.
1334   -D : define symbol to have some value:
1335          -D symbol         symbol gets the value 'define'
1336          -D symbol=value   symbol gets the value 'value'
1337   -E : stop at the end of questions, after having produced config.sh.
1338   -K : do not use unless you know what you are doing.
1339   -O : let -D and -U override definitions from loaded configuration file.
1340   -S : perform variable substitutions on all .SH files (can mix with -f)
1341   -U : undefine symbol:
1342          -U symbol    symbol gets the value 'undef'
1343          -U symbol=   symbol gets completely empty
1344   -A : manipulate symbol after the platform specific hints have been applied:
1345          -A symbol=value                append " "value to symbol
1346          -A append:symbol=value         append value to symbol
1347          -A define:symbol=value         define symbol to have value
1348          -A clear:symbol                define symbol to be ''
1349          -A define:symbol               define symbol to be 'define'
1350          -A eval:symbol=value           define symbol to be eval of value
1351          -A prepend:symbol=value        prepend value to symbol
1352          -A undef:symbol                define symbol to be 'undef'
1353          -A undef:symbol=               define symbol to be ''
1354   -V : print version number and exit (with a zero status).
1355 EOM
1356         exit 1
1357         ;;
1358 esac
1359
1360 : Sanity checks
1361 case "$fastread$alldone" in
1362 yescont|yesexit) ;;
1363 *)
1364         if test ! -t 0; then
1365                 echo "Say 'sh Configure', not 'sh <Configure'"
1366                 exit 1
1367         fi
1368         ;;
1369 esac
1370
1371 exec 4>&1
1372 case "$silent" in
1373 true) exec 1>/dev/null;;
1374 esac
1375
1376 : run the defines and the undefines, if any, but leave the file out there...
1377 touch optdef.sh
1378 . ./optdef.sh
1379 : create the posthint manipulation script and leave the file out there...
1380 touch posthint.sh
1381
1382 : set package name
1383 package=perl5
1384 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1385 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1386 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1387 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1388 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1389 esac
1390
1391 : Some greps do not return status, grrr.
1392 echo "grimblepritz" >grimble
1393 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1394         contains=contains
1395 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1396         contains=grep
1397 else
1398         contains=contains
1399 fi
1400 rm -f grimble
1401 : the following should work in any shell
1402 case "$contains" in
1403 contains*)
1404         echo " "
1405         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1406         cat >contains <<'EOSS'
1407 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1408 EOSS
1409 chmod +x contains
1410 esac
1411
1412 : Find the path to the source tree
1413 case "$src" in
1414 '') case "$0" in
1415     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1416          case "$src" in
1417          /*)    ;;
1418          *)     src=`cd ../$src && pwd` ;;
1419          esac
1420          ;;
1421     *)   src='.';;
1422     esac;;
1423 esac
1424 case "$src" in
1425 '')     src=/
1426         rsrc=/
1427         ;;
1428 /*) rsrc="$src";;
1429 *) rsrc="../$src";;
1430 esac
1431 if test -f $rsrc/Configure && \
1432         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1433 then
1434    : found it, so we are ok.
1435 else
1436         rsrc=''
1437         for src in . .. ../.. ../../.. ../../../..; do
1438                 if test -f ../$src/Configure && \
1439                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1440                 then
1441                         rsrc=../$src
1442                         break
1443                 fi
1444         done
1445 fi
1446 case "$rsrc" in
1447 '')
1448         cat <<EOM >&4
1449
1450 Sorry, I can't seem to locate the source dir for $package.  Please start
1451 Configure with an explicit path -- i.e. /some/path/Configure.
1452
1453 EOM
1454         exit 1
1455         ;;
1456 ../.)   rsrc='..';;
1457 *)
1458         echo " "
1459         echo "Sources for $package found in \"$src\"." >&4
1460         ;;
1461 esac
1462
1463 : script used to extract .SH files with variable substitutions
1464 cat >extract <<'EOS'
1465 CONFIGDOTSH=true
1466 echo "Doing variable substitutions on .SH files..."
1467 if test -f $src/MANIFEST; then
1468         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1469 else
1470         echo "(Looking for .SH files under the source directory.)"
1471         set x `(cd $src; find . -name "*.SH" -print)`
1472 fi
1473 shift
1474 case $# in
1475 0) set x `(cd $src; echo *.SH)`; shift;;
1476 esac
1477 if test ! -f $src/$1; then
1478         shift
1479 fi
1480 mkdir_p='
1481 name=$1;
1482 create="";
1483 while test $name; do
1484         if test ! -d "$name"; then
1485                 create="$name $create";
1486                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1487                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1488         else
1489                 name="";
1490         fi;
1491 done;
1492 for file in $create; do
1493         mkdir $file;
1494 done
1495 '
1496 for file in $*; do
1497         case "$src" in
1498         ".")
1499                 case "$file" in
1500                 */*)
1501                         dir=`expr X$file : 'X\(.*\)/'`
1502                         file=`expr X$file : 'X.*/\(.*\)'`
1503                         (cd $dir && . ./$file)
1504                         ;;
1505                 *)
1506                         . ./$file
1507                         ;;
1508                 esac
1509                 ;;
1510         *)
1511                 case "$file" in
1512                 */*)
1513                         dir=`expr X$file : 'X\(.*\)/'`
1514                         file=`expr X$file : 'X.*/\(.*\)'`
1515                         (set x $dir; shift; eval $mkdir_p)
1516                         sh <$src/$dir/$file
1517                         ;;
1518                 *)
1519                         sh <$src/$file
1520                         ;;
1521                 esac
1522                 ;;
1523         esac
1524 done
1525 if test -f $src/config_h.SH; then
1526         if test ! -f config.h; then
1527         : oops, they left it out of MANIFEST, probably, so do it anyway.
1528         . $src/config_h.SH
1529         fi
1530 fi
1531 EOS
1532
1533 : extract files and exit if asked to do so
1534 case "$extractsh" in
1535 true)
1536         case "$realsilent" in
1537         true) ;;
1538         *) exec 1>&4;;
1539         esac
1540         case "$config_sh" in
1541         '') config_sh='config.sh';;
1542         esac
1543         echo " "
1544         echo "Fetching answers from $config_sh..."
1545         cd ..
1546         . $config_sh
1547         test "$override" && . ./optdef.sh
1548         echo " "
1549         . UU/extract
1550         rm -rf UU
1551         echo "Done."
1552         exit 0
1553         ;;
1554 esac
1555
1556 : Eunice requires " " instead of "", can you believe it
1557 echo " "
1558 : Here we go...
1559 echo "Beginning of configuration questions for $package."
1560
1561 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1562
1563 : first determine how to suppress newline on echo command
1564 echo " "
1565 echo "Checking echo to see how to suppress newlines..."
1566 (echo "hi there\c" ; echo " ") >.echotmp
1567 if $contains c .echotmp >/dev/null 2>&1 ; then
1568         echo "...using -n."
1569         n='-n'
1570         c=''
1571 else
1572         cat <<'EOM'
1573 ...using \c
1574 EOM
1575         n=''
1576         c='\c'
1577 fi
1578 echo $n "The star should be here-->$c"
1579 echo '*'
1580 rm -f .echotmp
1581
1582 : Now test for existence of everything in MANIFEST
1583 echo " "
1584 if test -f $rsrc/MANIFEST; then
1585         echo "First let's make sure your kit is complete.  Checking..." >&4
1586         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1587         rm -f missing
1588         tmppwd=`pwd`
1589         for filelist in x??; do
1590                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1591         done
1592         if test -s missing; then
1593                 cat missing >&4
1594                 cat >&4 <<'EOM'
1595
1596 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1597
1598 You have the option of continuing the configuration process, despite the
1599 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1600 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1601 and contact the author (perlbug@perl.com).
1602
1603 EOM
1604                 echo $n "Continue? [n] $c" >&4
1605                 read ans
1606                 case "$ans" in
1607                 y*)
1608                         echo "Continuing..." >&4
1609                         rm -f missing
1610                         ;;
1611                 *)
1612                         echo "ABORTING..." >&4
1613                         kill $$
1614                         ;;
1615                 esac
1616         else
1617                 echo "Looks good..."
1618         fi
1619 else
1620         echo "There is no MANIFEST file.  I hope your kit is complete !"
1621 fi
1622 rm -f missing x??
1623
1624 echo " "
1625 : Find the appropriate value for a newline for tr
1626 if test -n "$DJGPP"; then
1627        trnl='\012'
1628 fi
1629 if test X"$trnl" = X; then
1630         case "`echo foo|tr '\n' x 2>/dev/null`" in
1631         foox) trnl='\n' ;;
1632         esac
1633 fi
1634 if test X"$trnl" = X; then
1635         case "`echo foo|tr '\012' x 2>/dev/null`" in
1636         foox) trnl='\012' ;;
1637         esac
1638 fi
1639 if test X"$trnl" = X; then
1640         cat <<EOM >&2
1641
1642 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1643
1644 EOM
1645         exit 1
1646 fi
1647
1648 : compute the number of columns on the terminal for proper question formatting
1649 case "$COLUMNS" in
1650 '') COLUMNS='80';;
1651 esac
1652
1653 : set up the echo used in my read
1654 myecho="case \"\$xxxm\" in
1655 '') echo $n \"\$rp $c\" >&4;;
1656 *) case \"\$rp\" in
1657         '') echo $n \"[\$xxxm] $c\";;
1658         *)
1659                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1660                         echo \"\$rp\" >&4
1661                         echo $n \"[\$xxxm] $c\" >&4
1662                 else
1663                         echo $n \"\$rp [\$xxxm] $c\" >&4
1664                 fi
1665                 ;;
1666         esac;;
1667 esac"
1668
1669 : now set up to do reads with possible shell escape and default assignment
1670 cat <<EOSC >myread
1671 $startsh
1672 xxxm=\$dflt
1673 $myecho
1674 ans='!'
1675 case "\$fastread" in
1676 yes) case "\$dflt" in
1677         '') ;;
1678         *) ans='';
1679                 case "\$silent-\$rp" in
1680                 true-) ;;
1681                 *) echo " " >&4;;
1682                 esac;;
1683         esac;;
1684 *) case "\$silent" in
1685         true) case "\$rp" in
1686                 '') ans='';;
1687                 esac;;
1688         esac;;
1689 esac
1690 while expr "X\$ans" : "X!" >/dev/null; do
1691         read answ
1692         set x \$xxxm
1693         shift
1694         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1695         case  "\$answ" in
1696         "!")
1697                 sh 1>&4
1698                 echo " "
1699                 $myecho
1700                 ;;
1701         !*)
1702                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1703                 shift
1704                 sh 1>&4 -c "\$*"
1705                 echo " "
1706                 $myecho
1707                 ;;
1708         "\$ans")
1709                 case "\$ans" in
1710                 \\&*)
1711                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1712                         shift
1713                         case "\$1" in
1714                         -d)
1715                                 fastread=yes
1716                                 echo "(OK, I'll run with -d after this question.)" >&4
1717                                 ;;
1718                         -*)
1719                                 echo "*** Sorry, \$1 not supported yet." >&4
1720                                 ;;
1721                         esac
1722                         $myecho
1723                         ans=!
1724                         ;;
1725                 esac;;
1726         *)
1727                 case "\$aok" in
1728                 y)
1729                         echo "*** Substitution done -- please confirm."
1730                         xxxm="\$ans"
1731                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1732                         xxxm="\$ans"
1733                         ans=!
1734                         ;;
1735                 *)
1736                         echo "*** Error -- try again."
1737                         ans=!
1738                         ;;
1739                 esac
1740                 $myecho
1741                 ;;
1742         esac
1743         case "\$ans\$xxxm\$nostick" in
1744         '')
1745                 ans=!
1746                 $myecho
1747                 ;;
1748         esac
1749 done
1750 case "\$ans" in
1751 '') ans="\$xxxm";;
1752 esac
1753 EOSC
1754
1755 : create .config dir to save info across Configure sessions
1756 test -d ../.config || mkdir ../.config
1757 cat >../.config/README <<EOF
1758 This directory created by Configure to save information that should
1759 persist across sessions for $package.
1760
1761 You may safely delete it if you wish.
1762 EOF
1763
1764 : general instructions
1765 needman=true
1766 firsttime=true
1767 user=`(logname) 2>/dev/null`
1768 case "$user" in
1769 '') user=`whoami 2>&1`;;
1770 esac
1771 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1772         firsttime=false
1773         echo " "
1774         rp='Would you like to see the instructions?'
1775         dflt=n
1776         . ./myread
1777         case "$ans" in
1778         [yY]*) ;;
1779         *) needman=false;;
1780         esac
1781 fi
1782 if $needman; then
1783         cat <<EOH
1784
1785 This installation shell script will examine your system and ask you questions
1786 to determine how the perl5 package should be installed. If you get
1787 stuck on a question, you may use a ! shell escape to start a subshell or
1788 execute a command.  Many of the questions will have default answers in square
1789 brackets; typing carriage return will give you the default.
1790
1791 On some of the questions which ask for file or directory names you are allowed
1792 to use the ~name construct to specify the login directory belonging to "name",
1793 even if you don't have a shell which knows about that.  Questions where this is
1794 allowed will be marked "(~name ok)".
1795
1796 EOH
1797         rp=''
1798         dflt='Type carriage return to continue'
1799         . ./myread
1800         cat <<'EOH'
1801
1802 The prompter used in this script allows you to use shell variables and
1803 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1804 in the default answer, as if the default line was a set of arguments given to a
1805 script shell.  This means you may also use $* to repeat the whole default line,
1806 so you do not have to re-type everything to add something to the default.
1807
1808 Everytime there is a substitution, you will have to confirm.  If there is an
1809 error (e.g. an unmatched backtick), the default answer will remain unchanged
1810 and you will be prompted again.
1811
1812 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1813 the questions and use the computed defaults (or the previous answers if there
1814 was already a config.sh file). Type 'Configure -h' for a list of options.
1815 You may also start interactively and then answer '& -d' at any prompt to turn
1816 on the non-interactive behaviour for the remainder of the execution.
1817
1818 EOH
1819         . ./myread
1820         cat <<EOH
1821
1822 Much effort has been expended to ensure that this shell script will run on any
1823 Unix system.  If despite that it blows up on yours, your best bet is to edit
1824 Configure and run it again.  If you can't run Configure for some reason,
1825 you'll have to generate a config.sh file by hand.  Whatever problems you
1826 have, let me (perlbug@perl.com) know how I blew it.
1827
1828 This installation script affects things in two ways:
1829
1830 1) it may do direct variable substitutions on some of the files included
1831    in this kit.
1832 2) it builds a config.h file for inclusion in C programs.  You may edit
1833    any of these files as the need arises after running this script.
1834
1835 If you make a mistake on a question, there is no easy way to back up to it
1836 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1837 files.  Configure will offer to let you do this before it runs the SH files.
1838
1839 EOH
1840         dflt='Type carriage return to continue'
1841         . ./myread
1842         case "$firsttime" in
1843         true) echo $user >>../.config/instruct;;
1844         esac
1845 fi
1846
1847 : find out where common programs are
1848 echo " "
1849 echo "Locating common programs..." >&4
1850 cat <<EOSC >loc
1851 $startsh
1852 case \$# in
1853 0) exit 1;;
1854 esac
1855 thing=\$1
1856 shift
1857 dflt=\$1
1858 shift
1859 for dir in \$*; do
1860         case "\$thing" in
1861         .)
1862         if test -d \$dir/\$thing; then
1863                 echo \$dir
1864                 exit 0
1865         fi
1866         ;;
1867         *)
1868         for thisthing in \$dir/\$thing; do
1869                 : just loop through to pick last item
1870         done
1871         if test -f \$thisthing; then
1872                 echo \$thisthing
1873                 exit 0
1874         elif test -f \$dir/\$thing.exe; then
1875                 if test -n "$DJGPP"; then
1876                         echo \$dir/\$thing.exe
1877                 else
1878                         : on Eunice apparently
1879                         echo \$dir/\$thing
1880                 fi
1881                 exit 0
1882         fi
1883         ;;
1884         esac
1885 done
1886 echo \$dflt
1887 exit 1
1888 EOSC
1889 chmod +x loc
1890 $eunicefix loc
1891 loclist="
1892 awk
1893 cat
1894 comm
1895 cp
1896 echo
1897 expr
1898 grep
1899 ls
1900 make
1901 mkdir
1902 rm
1903 sed
1904 sort
1905 touch
1906 tr
1907 uniq
1908 "
1909 trylist="
1910 Mcc
1911 ar
1912 byacc
1913 cpp
1914 csh
1915 date
1916 egrep
1917 gzip
1918 less
1919 ln
1920 more
1921 nm
1922 nroff
1923 perl
1924 pg
1925 test
1926 uname
1927 zip
1928 "
1929 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1930 pth="$pth /lib /usr/lib"
1931 for file in $loclist; do
1932         eval xxx=\$$file
1933         case "$xxx" in
1934         /*|?:[\\/]*)
1935                 if test -f "$xxx"; then
1936                         : ok
1937                 else
1938                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1939                         xxx=`./loc $file $file $pth`
1940                 fi
1941                 ;;
1942         '') xxx=`./loc $file $file $pth`;;
1943         *) xxx=`./loc $xxx $xxx $pth`;;
1944         esac
1945         eval $file=$xxx
1946         eval _$file=$xxx
1947         case "$xxx" in
1948         /*)
1949                 echo $file is in $xxx.
1950                 ;;
1951         ?:[\\/]*)
1952                 echo $file is in $xxx.
1953                 ;;
1954         *)
1955                 echo "I don't know where '$file' is, and my life depends on it." >&4
1956                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1957                 exit 1
1958                 ;;
1959         esac
1960 done
1961 echo " "
1962 echo "Don't worry if any of the following aren't found..."
1963 say=offhand
1964 for file in $trylist; do
1965         eval xxx=\$$file
1966         case "$xxx" in
1967         /*|?:[\\/]*)
1968                 if test -f "$xxx"; then
1969                         : ok
1970                 else
1971                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1972                         xxx=`./loc $file $file $pth`
1973                 fi
1974                 ;;
1975         '') xxx=`./loc $file $file $pth`;;
1976         *) xxx=`./loc $xxx $xxx $pth`;;
1977         esac
1978         eval $file=$xxx
1979         eval _$file=$xxx
1980         case "$xxx" in
1981         /*)
1982                 echo $file is in $xxx.
1983                 ;;
1984         ?:[\\/]*)
1985                 echo $file is in $xxx.
1986                 ;;
1987         *)
1988                 echo "I don't see $file out there, $say."
1989                 say=either
1990                 ;;
1991         esac
1992 done
1993 case "$egrep" in
1994 egrep)
1995         echo "Substituting grep for egrep."
1996         egrep=$grep
1997         ;;
1998 esac
1999 case "$ln" in
2000 ln)
2001         echo "Substituting cp for ln."
2002         ln=$cp
2003         ;;
2004 esac
2005 case "$test" in
2006 test)
2007         echo "Hopefully test is built into your sh."
2008         ;;
2009 *)
2010         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2011                 echo "Using the test built into your sh."
2012                 test=test
2013                 _test=test
2014         fi
2015         ;;
2016 esac
2017 case "$echo" in
2018 echo)
2019         echo "Hopefully echo is built into your sh."
2020         ;;
2021 '') ;;
2022 *)
2023         echo " "
2024 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2025         $echo $n "hi there$c" >foo1
2026         echo $n "hi there$c" >foo2
2027         if cmp foo1 foo2 >/dev/null 2>&1; then
2028                 echo "They are compatible.  In fact, they may be identical."
2029         else
2030                 case "$n" in
2031                 '-n') n='' c='\c';;
2032                 *) n='-n' c='';;
2033                 esac
2034                 cat <<FOO
2035 They are not compatible!  You are probably running ksh on a non-USG system.
2036 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2037 have echo built in and we may have to run some Bourne shell scripts.  That
2038 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2039
2040 FOO
2041                 $echo $n "The star should be here-->$c"
2042                 $echo "*"
2043         fi
2044         $rm -f foo1 foo2
2045         ;;
2046 esac
2047
2048 : determine whether symbolic links are supported
2049 echo " "
2050 $touch blurfl
2051 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2052         echo "Symbolic links are supported." >&4
2053         lns="$ln -s"
2054 else
2055         echo "Symbolic links are NOT supported." >&4
2056         lns="$ln"
2057 fi
2058 $rm -f blurfl sym
2059
2060 : see whether [:lower:] and [:upper:] are supported character classes
2061 echo " "
2062 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2063 ABYZ)
2064         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2065         up='[:upper:]'
2066         low='[:lower:]'
2067         ;;
2068 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2069         # (0xc9 and 0xd1), therefore that is a nice testing point.
2070         if test "X$up" = X -o "X$low" = X; then
2071             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2072             ij) up='[A-Z]'
2073                 low='[a-z]'
2074                 ;;
2075             esac
2076         fi
2077         if test "X$up" = X -o "X$low" = X; then
2078             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2079             ij) up='A-Z'
2080                 low='a-z'
2081                 ;;
2082             esac
2083         fi
2084         if test "X$up" = X -o "X$low" = X; then
2085             case "`echo IJ | od -x 2>/dev/null`" in
2086             *C9D1*|*c9d1*)
2087                 echo "Hey, this might be EBCDIC." >&4
2088                 if test "X$up" = X -o "X$low" = X; then
2089                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2090                     ij) up='[A-IJ-RS-Z]'
2091                         low='[a-ij-rs-z]'
2092                         ;;
2093                     esac
2094                 fi
2095                 if test "X$up" = X -o "X$low" = X; then
2096                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2097                     ij) up='A-IJ-RS-Z'
2098                         low='a-ij-rs-z'
2099                         ;;
2100                     esac
2101                 fi
2102                 ;;
2103             esac
2104         fi
2105 esac
2106 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2107 ij)
2108     echo "Using $up and $low to convert case." >&4
2109     ;;
2110 *)
2111     echo "I don't know how to translate letters from upper to lower case." >&4
2112     echo "Your tr is not acting any way I know of." >&4
2113     exit 1
2114     ;;
2115 esac
2116 : set up the translation script tr, must be called with ./tr of course
2117 cat >tr <<EOSC
2118 $startsh
2119 case "\$1\$2" in
2120 '[A-Z][a-z]') exec $tr '$up' '$low';;
2121 '[a-z][A-Z]') exec $tr '$low' '$up';;
2122 esac
2123 exec $tr "\$@"
2124 EOSC
2125 chmod +x tr
2126 $eunicefix tr
2127
2128 : Try to determine whether config.sh was made on this system
2129 case "$config_sh" in
2130 '')
2131 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2132 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2133 # because the A-Z/a-z are not consecutive.
2134 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2135         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2136 newmyuname="$myuname"
2137 dflt=n
2138 case "$knowitall" in
2139 '')
2140         if test -f ../config.sh; then
2141                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2142                         eval "`grep myuname= ../config.sh`"
2143                 fi
2144                 if test "X$myuname" = "X$newmyuname"; then
2145                         dflt=y
2146                 fi
2147         fi
2148         ;;
2149 *) dflt=y;;
2150 esac
2151
2152 : Get old answers from old config file if Configure was run on the
2153 : same system, otherwise use the hints.
2154 hint=default
2155 cd ..
2156 if test -f config.sh; then
2157         echo " "
2158         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2159         . UU/myread
2160         case "$ans" in
2161         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2162         *)  echo "Fetching default answers from your old config.sh file..." >&4
2163                 tmp_n="$n"
2164                 tmp_c="$c"
2165                 tmp_sh="$sh"
2166                 . ./config.sh
2167                 cp config.sh UU
2168                 n="$tmp_n"
2169                 c="$tmp_c"
2170                 : Older versions did not always set $sh.  Catch re-use of such
2171                 : an old config.sh.
2172                 case "$sh" in
2173                 '') sh="$tmp_sh" ;;
2174                 esac
2175                 hint=previous
2176                 ;;
2177         esac
2178 fi
2179 if test ! -f config.sh; then
2180         $cat <<EOM
2181
2182 First time through, eh?  I have some defaults handy for some systems
2183 that need some extra help getting the Configure answers right:
2184
2185 EOM
2186         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2187         dflt=''
2188         : Half the following guesses are probably wrong... If you have better
2189         : tests or hints, please send them to perlbug@perl.com
2190         : The metaconfig authors would also appreciate a copy...
2191         $test -f /irix && osname=irix
2192         $test -f /xenix && osname=sco_xenix
2193         $test -f /dynix && osname=dynix
2194         $test -f /dnix && osname=dnix
2195         $test -f /lynx.os && osname=lynxos
2196         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2197         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2198         $test -f /bin/mips && /bin/mips && osname=mips
2199         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2200                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2201         $test -d /usr/apollo/bin && osname=apollo
2202         $test -f /etc/saf/_sactab && osname=svr4
2203         $test -d /usr/include/minix && osname=minix
2204         if $test -d /MachTen -o -d /MachTen_Folder; then
2205                 osname=machten
2206                 if $test -x /sbin/version; then
2207                         osvers=`/sbin/version | $awk '{print $2}' |
2208                         $sed -e 's/[A-Za-z]$//'`
2209                 elif $test -x /usr/etc/version; then
2210                         osvers=`/usr/etc/version | $awk '{print $2}' |
2211                         $sed -e 's/[A-Za-z]$//'`
2212                 else
2213                         osvers="$2.$3"
2214                 fi
2215         fi
2216
2217         $test -f /sys/posix.dll &&
2218                 $test -f /usr/bin/what &&
2219                 set X `/usr/bin/what /sys/posix.dll` &&
2220                 $test "$3" = UWIN &&
2221                 osname=uwin &&
2222                 osvers="$5"
2223
2224         if $test -f $uname; then
2225                 set X $myuname
2226                 shift
2227
2228                 case "$5" in
2229                 fps*) osname=fps ;;
2230                 mips*)
2231                         case "$4" in
2232                         umips) osname=umips ;;
2233                         *) osname=mips ;;
2234                         esac;;
2235                 [23]100) osname=mips ;;
2236                 next*) osname=next ;;
2237                 i386*)
2238                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2239                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2240                                 osname='sco'
2241                                 osvers=$tmp
2242                         elif $test -f /etc/kconfig; then
2243                                 osname=isc
2244                                 if test "$lns" = "$ln -s"; then
2245                                         osvers=4
2246                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2247                                         osvers=3
2248                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2249                                         osvers=2
2250                                 fi
2251                         fi
2252                         tmp=''
2253                         ;;
2254                 pc*)
2255                         if test -n "$DJGPP"; then
2256                                 osname=dos
2257                                 osvers=djgpp
2258                         fi
2259                         ;;
2260                 esac
2261
2262                 case "$1" in
2263                 aix) osname=aix
2264                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2265                         case "$tmp" in
2266                         'not found') osvers="$4"."$3" ;;
2267                         '<3240'|'<>3240') osvers=3.2.0 ;;
2268                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2269                         '=3250'|'>3250') osvers=3.2.5 ;;
2270                         *) osvers=$tmp;;
2271                         esac
2272                         ;;
2273                 bsd386) osname=bsd386
2274                         osvers=`$uname -r`
2275                         ;;
2276                 cygwin*) osname=cygwin
2277                         osvers="$3"
2278                         ;;
2279                 *dc.osx) osname=dcosx
2280                         osvers="$3"
2281                         ;;
2282                 dnix) osname=dnix
2283                         osvers="$3"
2284                         ;;
2285                 domainos) osname=apollo
2286                         osvers="$3"
2287                         ;;
2288                 dgux) osname=dgux 
2289                         osvers="$3"
2290                         ;;
2291                 dynixptx*) osname=dynixptx
2292                         osvers=`echo "$4"|sed 's/^v//'`
2293                         ;;
2294                 freebsd) osname=freebsd 
2295                         osvers="$3" ;;
2296                 genix) osname=genix ;;
2297                 hp*) osname=hpux 
2298                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2299                         ;;
2300                 irix*) osname=irix
2301                         case "$3" in
2302                         4*) osvers=4 ;;
2303                         5*) osvers=5 ;;
2304                         *)      osvers="$3" ;;
2305                         esac
2306                         ;;
2307                 linux) osname=linux
2308                         case "$3" in
2309                         *)      osvers="$3" ;;
2310                         esac
2311                         ;;
2312                 MiNT) osname=mint
2313                         ;;
2314                 netbsd*) osname=netbsd
2315                         osvers="$3"
2316                         ;;
2317                 news-os) osvers="$3"
2318                         case "$3" in
2319                         4*) osname=newsos4 ;;
2320                         *) osname=newsos ;;
2321                         esac
2322                         ;;
2323                 next*) osname=next ;;
2324                 POSIX-BC | posix-bc ) osname=posix-bc
2325                         osvers="$3"
2326                         ;;
2327                 powerux | power_ux | powermax_os | powermaxos | \
2328                 powerunix | power_unix) osname=powerux
2329                         osvers="$3"
2330                         ;;
2331                 qnx) osname=qnx
2332                         osvers="$4"
2333                         ;;
2334                 solaris) osname=solaris
2335                         case "$3" in
2336                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2337                         *)      osvers="$3" ;;
2338                         esac
2339                         ;;
2340                 sunos) osname=sunos
2341                         case "$3" in
2342                         5*) osname=solaris
2343                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2344                         *)      osvers="$3" ;;
2345                         esac
2346                         ;;
2347                 titanos) osname=titanos
2348                         case "$3" in
2349                         1*) osvers=1 ;;
2350                         2*) osvers=2 ;;
2351                         3*) osvers=3 ;;
2352                         4*) osvers=4 ;;
2353                         *)      osvers="$3" ;;
2354                         esac
2355                         ;;
2356                 ultrix) osname=ultrix
2357                         osvers="$3"
2358                         ;;
2359                 osf1|mls+)      case "$5" in
2360                                 alpha)
2361                                         osname=dec_osf
2362                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2363                                         ;;
2364                         hp*)    osname=hp_osf1  ;;
2365                         mips)   osname=mips_osf1 ;;
2366                         esac
2367                         ;;
2368                 unixware) osname=svr5
2369                         osvers="$4"
2370                         ;;
2371                 uts) osname=uts
2372                         osvers="$3"
2373                         ;;
2374                 $2) case "$osname" in
2375                         *isc*) ;;
2376                         *freebsd*) ;;
2377                         svr*)
2378                                 : svr4.x or possibly later
2379                                 case "svr$3" in 
2380                                 ${osname}*)
2381                                         osname=svr$3
2382                                         osvers=$4
2383                                         ;;
2384                                 esac
2385                                 case "$osname" in
2386                                 svr4.0)
2387                                         : Check for ESIX
2388                                         if test -f /stand/boot ; then
2389                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2390                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2391                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2392                                                         if test -n "$isesix"; then
2393                                                                 osname=esix4
2394                                                         fi
2395                                                 fi
2396                                         fi
2397                                         ;;
2398                                 esac
2399                                 ;;
2400                         *)      if test -f /etc/systemid; then
2401                                         osname=sco
2402                                         set `echo $3 | $sed 's/\./ /g'` $4
2403                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2404                                                 osvers=$1.$2.$3
2405                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2406                                                 osvers=$1.$2
2407                                         elif $test -f $src/hints/sco_$1.sh; then
2408                                                 osvers=$1
2409                                         fi
2410                                 else
2411                                         case "$osname" in
2412                                         '') : Still unknown.  Probably a generic Sys V.
2413                                                 osname="sysv"
2414                                                 osvers="$3"
2415                                                 ;;
2416                                         esac
2417                                 fi
2418                                 ;;
2419                         esac
2420                         ;;
2421                 *)      case "$osname" in
2422                         '') : Still unknown.  Probably a generic BSD.
2423                                 osname="$1"
2424                                 osvers="$3"
2425                                 ;;
2426                         esac
2427                         ;;
2428                 esac
2429         else
2430                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2431                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2432                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2433                                 osname=news_os
2434                         fi
2435                         $rm -f UU/kernel.what
2436                 elif test -d c:/.; then
2437                         set X $myuname
2438                         osname=os2
2439                         osvers="$5"
2440                 fi
2441         fi
2442         
2443         : Now look for a hint file osname_osvers, unless one has been
2444         : specified already.
2445         case "$hintfile" in
2446         ''|' ')
2447                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2448                 : Also try without trailing minor version numbers.
2449                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2450                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2451                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2452                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2453                 case "$file" in
2454                 '') dflt=none ;;
2455                 *)  case "$osvers" in
2456                         '') dflt=$file
2457                                 ;;
2458                         *)  if $test -f $src/hints/$file.sh ; then
2459                                         dflt=$file
2460                                 elif $test -f $src/hints/$xfile.sh ; then
2461                                         dflt=$xfile
2462                                 elif $test -f $src/hints/$xxfile.sh ; then
2463                                         dflt=$xxfile
2464                                 elif $test -f $src/hints/$xxxfile.sh ; then
2465                                         dflt=$xxxfile
2466                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2467                                         dflt=$xxxxfile
2468                                 elif $test -f "$src/hints/${osname}.sh" ; then
2469                                         dflt="${osname}"
2470                                 else
2471                                         dflt=none
2472                                 fi
2473                                 ;;
2474                         esac
2475                         ;;
2476                 esac
2477                 if $test -f Policy.sh ; then
2478                         case "$dflt" in
2479                         *Policy*) ;;
2480                         none) dflt="Policy" ;;
2481                         *) dflt="Policy $dflt" ;;
2482                         esac
2483                 fi
2484                 ;;
2485         *)
2486                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2487                 ;;
2488         esac
2489
2490         if $test -f Policy.sh ; then
2491                 $cat <<EOM
2492
2493 There's also a Policy hint file available, which should make the
2494 site-specific (policy) questions easier to answer.
2495 EOM
2496
2497         fi
2498
2499         $cat <<EOM
2500
2501 You may give one or more space-separated answers, or "none" if appropriate.
2502 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2503 is a good thing.  DO NOT give a wrong version or a wrong OS.
2504
2505 EOM
2506
2507         rp="Which of these apply, if any?"
2508         . UU/myread
2509         tans=$ans
2510         for file in $tans; do
2511                 if $test X$file = XPolicy -a -f Policy.sh; then
2512                         . Policy.sh
2513                         $cat Policy.sh >> UU/config.sh
2514                 elif $test -f $src/hints/$file.sh; then
2515                         . $src/hints/$file.sh
2516                         $cat $src/hints/$file.sh >> UU/config.sh
2517                 elif $test X$tans = X -o X$tans = Xnone ; then
2518                         : nothing
2519                 else
2520                         : Give one chance to correct a possible typo.
2521                         echo "$file.sh does not exist"
2522                         dflt=$file
2523                         rp="hint to use instead?"
2524                         . UU/myread
2525                         for file in $ans; do
2526                                 if $test -f "$src/hints/$file.sh"; then
2527                                         . $src/hints/$file.sh
2528                                         $cat $src/hints/$file.sh >> UU/config.sh
2529                                 elif $test X$ans = X -o X$ans = Xnone ; then
2530                                         : nothing
2531                                 else
2532                                         echo "$file.sh does not exist -- ignored."
2533                                 fi
2534                         done
2535                 fi
2536         done
2537
2538         hint=recommended
2539         : Remember our hint file for later.
2540         if $test -f "$src/hints/$file.sh" ; then
2541                 hintfile="$file"
2542         else
2543                 hintfile=''
2544         fi
2545 fi
2546 cd UU
2547 ;;
2548 *)
2549         echo " "
2550         echo "Fetching default answers from $config_sh..." >&4
2551         tmp_n="$n"
2552         tmp_c="$c"
2553         cd ..
2554         cp $config_sh config.sh 2>/dev/null
2555         chmod +w config.sh
2556         . ./config.sh
2557         cd UU
2558         cp ../config.sh .
2559         n="$tmp_n"
2560         c="$tmp_c"
2561         hint=previous
2562         ;;
2563 esac
2564 test "$override" && . ./optdef.sh
2565 myuname="$newmyuname"
2566
2567 : Restore computed paths
2568 for file in $loclist $trylist; do
2569         eval $file="\$_$file"
2570 done
2571
2572 cat << EOM
2573
2574 Configure uses the operating system name and version to set some defaults.
2575 The default value is probably right if the name rings a bell. Otherwise,
2576 since spelling matters for me, either accept the default or answer "none"
2577 to leave it blank.
2578
2579 EOM
2580 case "$osname" in
2581         ''|' ')
2582                 case "$hintfile" in
2583                 ''|' '|none) dflt=none ;;
2584                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2585                 esac
2586                 ;;
2587         *) dflt="$osname" ;;
2588 esac
2589 rp="Operating system name?"
2590 . ./myread
2591 case "$ans" in
2592 none)  osname='' ;;
2593 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2594 esac
2595 echo " "
2596 case "$osvers" in
2597         ''|' ')
2598                 case "$hintfile" in
2599                 ''|' '|none) dflt=none ;;
2600                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2601                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2602                         case "$dflt" in
2603                         ''|' ') dflt=none ;;
2604                         esac
2605                         ;;
2606                 esac
2607                 ;;
2608         *) dflt="$osvers" ;;
2609 esac
2610 rp="Operating system version?"
2611 . ./myread
2612 case "$ans" in
2613 none)  osvers='' ;;
2614 *) osvers="$ans" ;;
2615 esac
2616
2617
2618 . ./posthint.sh
2619
2620 : who configured the system
2621 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2622 cf_by=`(logname) 2>/dev/null`
2623 case "$cf_by" in
2624 "")
2625         cf_by=`(whoami) 2>/dev/null`
2626         case "$cf_by" in
2627         "") cf_by=unknown ;;
2628         esac ;;
2629 esac
2630
2631 : set up the script used to warn in case of inconsistency
2632 cat <<EOS >whoa
2633 $startsh
2634 EOS
2635 cat <<'EOSC' >>whoa
2636 dflt=y
2637 echo " "
2638 echo "*** WHOA THERE!!! ***" >&4
2639 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2640 rp="    Keep the $hint value?"
2641 . ./myread
2642 case "$ans" in
2643 y) td=$was; tu=$was;;
2644 esac
2645 EOSC
2646
2647 : function used to set $1 to $val
2648 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2649 case "$val$was" in
2650 $define$undef) . ./whoa; eval "$var=\$td";;
2651 $undef$define) . ./whoa; eval "$var=\$tu";;
2652 *) eval "$var=$val";;
2653 esac'
2654
2655 cat <<EOM
2656
2657 Perl can be built to take advantage of threads, on some systems.
2658 To do so, Configure must be run with -Dusethreads.
2659
2660 Note that threading is a highly experimental feature, and
2661 some known race conditions still remain.  If you choose to try
2662 it, be very sure to not actually deploy it for production
2663 purposes.  README.threads has more details, and is required
2664 reading if you enable threads.
2665 EOM
2666 case "$usethreads" in
2667 $define|true|[yY]*)     dflt='y';;
2668 *) dflt='n';;
2669 esac
2670 rp='Build a threading Perl?'
2671 . ./myread
2672 case "$ans" in
2673 y|Y)    val="$define" ;;
2674 *)      val="$undef" ;;
2675 esac
2676 set usethreads
2677 eval $setvar
2678
2679 case "$usethreads" in
2680 $define)
2681         $cat <<EOM
2682
2683 As of 5.5.640, Perl has two different internal threading implementations,
2684 the 5.005 version (5005threads) and an interpreter-based version
2685 (ithreads) that has one interpreter per thread.  Both are very 
2686 experimental.  This arrangement exists to help developers work out
2687 which one is better.
2688 EOM
2689         : Default to ithreads unless overridden on command line or with
2690         : old config.sh
2691         dflt='y'
2692         case "$use5005threads" in
2693                 $define|true|[yY]*) dflt='n';;
2694         esac
2695         case "$useithreads" in
2696                 $undef|false|[nN]*) dflt='n';;
2697         esac
2698         rp='Use interpreter-based ithreads?'
2699         . ./myread
2700         case "$ans" in
2701         y|Y)    val="$define" ;;
2702         *)      val="$undef" ;;
2703         esac
2704         set useithreads
2705         eval $setvar
2706         : Now set use5005threads to the opposite value.
2707         case "$useithreads" in
2708         $define) val="$undef" ;;
2709         *) val="$define" ;;
2710         esac
2711         set use5005threads
2712         eval $setvar
2713         ;;
2714 *)
2715         useithreads="$undef"
2716         use5005threads="$undef"
2717         ;;
2718 esac
2719
2720 case "$d_oldpthreads" in
2721 '')     : Configure tests would be welcome here.  For now, assume undef.
2722         val="$undef" ;;
2723 *)      val="$d_oldpthreads" ;;
2724 esac
2725 set d_oldpthreads
2726 eval $setvar
2727
2728
2729 case "$usethreads" in
2730 "$define"|true|[yY]*)
2731 : Look for a hint-file generated 'call-back-unit'.  If the
2732 : user has specified that a threading perl is to be built,
2733 : we may need to set or change some other defaults.
2734         if $test -f usethreads.cbu; then
2735                 echo "Your platform has some specific hints for threaded builds, using them..."
2736                 . ./usethreads.cbu
2737         else
2738                 $cat <<EOM
2739 (Your platform doesn't have any specific hints for threaded builds.
2740  Assuming POSIX threads, then.)
2741 EOM
2742         fi
2743         ;;
2744 esac
2745
2746 cat <<EOM
2747
2748 Perl can be built so that multiple Perl interpreters can coexist
2749 within the same Perl executable.
2750 EOM
2751
2752 case "$useithreads" in
2753 $define)
2754         cat <<EOM
2755 This multiple interpreter support is required for interpreter-based threads.
2756 EOM
2757         val="$define"
2758         ;;
2759 *)
2760         echo 'Normally you do not need this and you should answer no.'
2761         case "$usemultiplicity" in
2762         $define|true|[yY]*)     dflt='y';;
2763         *) dflt='n';;
2764         esac
2765         rp='Build Perl for multiplicity?'
2766         . ./myread
2767         case "$ans" in
2768         y|Y)    val="$define" ;;
2769         *)      val="$undef" ;;
2770         esac
2771         ;;
2772 esac
2773 set usemultiplicity
2774 eval $setvar
2775
2776 : determine where manual pages are on this system
2777 echo " "
2778 case "$sysman" in
2779 '') 
2780         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2781         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2782         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2783         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2784         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2785         sysman=`./loc . /usr/man/man1 $syspath`
2786         ;;
2787 esac
2788 if $test -d "$sysman"; then
2789         echo "System manual is in $sysman." >&4
2790 else
2791         echo "Could not find manual pages in source form." >&4
2792 fi
2793
2794 : see what memory models we can support
2795 case "$models" in
2796 '')
2797         $cat >pdp11.c <<'EOP'
2798 int main() {
2799 #ifdef pdp11
2800         exit(0);
2801 #else
2802         exit(1);
2803 #endif
2804 }
2805 EOP
2806         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2807         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2808                 dflt='unsplit split'
2809         else
2810                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2811                 case "$tans" in
2812                 X) dflt='none';;
2813                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2814                                 dflt='small'
2815                         else
2816                                 dflt=''
2817                         fi
2818                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2819                                 dflt="$dflt medium"
2820                         fi
2821                         if $test -d /lib/large || $test -d /usr/lib/large; then
2822                                 dflt="$dflt large"
2823                         fi
2824                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2825                                 dflt="$dflt huge"
2826                         fi
2827                 esac
2828         fi;;
2829 *) dflt="$models";;
2830 esac
2831 $cat <<EOM
2832  
2833 Some systems have different model sizes.  On most systems they are called
2834 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2835 split.  If your system doesn't support different memory models, say "none".
2836 If you wish to force everything to one memory model, say "none" here and
2837 put the appropriate flags later when it asks you for other cc and ld flags.
2838 Venix systems may wish to put "none" and let the compiler figure things out.
2839 (In the following question multiple model names should be space separated.)
2840
2841 The default for most systems is "none".
2842
2843 EOM
2844 rp="Which memory models are supported?"
2845 . ./myread
2846 models="$ans"
2847
2848 case "$models" in
2849 none)
2850         small=''
2851         medium=''
2852         large=''
2853         huge=''
2854         unsplit=''
2855         split=''
2856         ;;
2857 *split)
2858         case "$split" in
2859         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2860                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2861                         dflt='-i'
2862                 else
2863                         dflt='none'
2864                 fi;;
2865         *) dflt="$split";;
2866         esac
2867         rp="What flag indicates separate I and D space?"
2868         . ./myread
2869         tans="$ans"
2870         case "$tans" in
2871         none) tans='';;
2872         esac
2873         split="$tans"
2874         unsplit='';;
2875 *large*|*small*|*medium*|*huge*)
2876         case "$models" in
2877         *large*)
2878                 case "$large" in
2879                 '') dflt='-Ml';;
2880                 *) dflt="$large";;
2881                 esac
2882         rp="What flag indicates large model?"
2883         . ./myread
2884         tans="$ans"
2885         case "$tans" in
2886         none) tans='';
2887         esac
2888         large="$tans";;
2889         *) large='';;
2890         esac
2891         case "$models" in
2892         *huge*) case "$huge" in
2893                 '') dflt='-Mh';;
2894                 *) dflt="$huge";;
2895                 esac
2896                 rp="What flag indicates huge model?"
2897                 . ./myread
2898                 tans="$ans"
2899                 case "$tans" in
2900                 none) tans='';
2901                 esac
2902                 huge="$tans";;
2903         *) huge="$large";;
2904         esac
2905         case "$models" in
2906         *medium*) case "$medium" in
2907                 '') dflt='-Mm';;
2908                 *) dflt="$medium";;
2909                 esac
2910                 rp="What flag indicates medium model?"
2911                 . ./myread
2912                 tans="$ans"
2913                 case "$tans" in
2914                 none) tans='';
2915                 esac
2916                 medium="$tans";;
2917         *) medium="$large";;
2918         esac
2919         case "$models" in
2920         *small*) case "$small" in
2921                 '') dflt='none';;
2922                 *) dflt="$small";;
2923                 esac
2924                 rp="What flag indicates small model?"
2925                 . ./myread
2926                 tans="$ans"
2927                 case "$tans" in
2928                 none) tans='';
2929                 esac
2930                 small="$tans";;
2931         *) small='';;
2932         esac
2933         ;;
2934 *)
2935         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2936         ;;
2937 esac
2938 $rm -f pdp11.* pdp11
2939
2940 : make some quick guesses about what we are up against
2941 echo " "
2942 $echo $n "Hmm...  $c"
2943 echo exit 1 >bsd
2944 echo exit 1 >usg
2945 echo exit 1 >v7
2946 echo exit 1 >osf1
2947 echo exit 1 >eunice
2948 echo exit 1 >xenix
2949 echo exit 1 >venix
2950 echo exit 1 >os2
2951 d_bsd="$undef"
2952 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2953 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2954 then
2955         echo "Looks kind of like an OSF/1 system, but we'll see..."
2956         echo exit 0 >osf1
2957 elif test `echo abc | tr a-z A-Z` = Abc ; then
2958         xxx=`./loc addbib blurfl $pth`
2959         if $test -f $xxx; then
2960         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2961                 echo exit 0 >bsd
2962                 echo exit 0 >usg
2963         else
2964                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2965                         echo "Looks kind of like an extended USG system, but we'll see..."
2966                 else
2967                         echo "Looks kind of like a USG system, but we'll see..."
2968                 fi
2969                 echo exit 0 >usg
2970         fi
2971 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2972         echo "Looks kind of like a BSD system, but we'll see..."
2973         d_bsd="$define"
2974         echo exit 0 >bsd
2975 else
2976         echo "Looks kind of like a Version 7 system, but we'll see..."
2977         echo exit 0 >v7
2978 fi
2979 case "$eunicefix" in
2980 *unixtovms*)
2981         $cat <<'EOI'
2982 There is, however, a strange, musty smell in the air that reminds me of
2983 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2984 EOI
2985         echo exit 0 >eunice
2986         d_eunice="$define"
2987 : it so happens the Eunice I know will not run shell scripts in Unix format
2988         ;;
2989 *)
2990         echo " "
2991         echo "Congratulations.  You aren't running Eunice."
2992         d_eunice="$undef"
2993         ;;
2994 esac
2995 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2996 case "$p_" in
2997 :) ;;
2998 *)
2999         $cat <<'EOI'
3000 I have the feeling something is not exactly right, however...don't tell me...
3001 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3002 EOI
3003         echo exit 0 >os2
3004         ;;
3005 esac
3006 if test -f /xenix; then
3007         echo "Actually, this looks more like a XENIX system..."
3008         echo exit 0 >xenix
3009         d_xenix="$define"
3010 else
3011         echo " "
3012         echo "It's not Xenix..."
3013         d_xenix="$undef"
3014 fi
3015 chmod +x xenix
3016 $eunicefix xenix
3017 if test -f /venix; then
3018         echo "Actually, this looks more like a VENIX system..."
3019         echo exit 0 >venix
3020 else
3021         echo " "
3022         if ./xenix; then
3023                 : null
3024         else
3025                 echo "Nor is it Venix..."
3026         fi
3027 fi
3028 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3029 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3030 $rm -f foo
3031
3032 : see if we need a special compiler
3033 echo " "
3034 if ./usg; then
3035         case "$cc" in
3036         '') case "$Mcc" in
3037                 /*) dflt='Mcc';;
3038                 *) case "$large" in
3039                         -M*) dflt='cc';;
3040                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3041                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3042                                                 dflt='cc'
3043                                         else
3044                                                 dflt='cc -M'
3045                                         fi
3046                                 else
3047                                         dflt='cc'
3048                                 fi;;
3049                         esac;;
3050                 esac;;
3051         *)  dflt="$cc";;
3052         esac
3053         case "$dflt" in
3054         *M*)    $cat <<'EOM'
3055 On some older systems the default C compiler will not resolve multiple global
3056 references that happen to have the same name.  On some such systems the "Mcc"
3057 command may be used to force these to be resolved.  On other systems a "cc -M"
3058 command is required.  (Note that the -M flag on other systems indicates a
3059 memory model to use!) If you have the Gnu C compiler, you might wish to use
3060 that instead.
3061
3062 EOM
3063         ;;
3064         esac
3065         rp="Use which C compiler?"
3066         . ./myread
3067         cc="$ans"
3068 else
3069         case "$cc" in
3070         '') dflt=cc;;
3071         *) dflt="$cc";;
3072         esac
3073         rp="Use which C compiler?"
3074         . ./myread
3075         cc="$ans"
3076 fi
3077 : Look for a hint-file generated 'call-back-unit'.  Now that the
3078 : user has specified the compiler, we may need to set or change some
3079 : other defaults.
3080 if $test -f cc.cbu; then
3081     . ./cc.cbu
3082 fi
3083 echo " "
3084 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3085 $cat >gccvers.c <<EOM
3086 #include <stdio.h>
3087 int main() {
3088 #ifdef __GNUC__
3089 #ifdef __VERSION__
3090         printf("%s\n", __VERSION__);
3091 #else
3092         printf("%s\n", "1");
3093 #endif
3094 #endif
3095         exit(0);
3096 }
3097 EOM
3098 if $cc -o gccvers gccvers.c; then
3099         gccversion=`./gccvers`
3100         case "$gccversion" in
3101         '') echo "You are not using GNU cc." ;;
3102         *)  echo "You are using GNU cc $gccversion."
3103             ;;
3104         esac
3105 else
3106         echo " "
3107         echo "*** WHOA THERE!!! ***" >&4
3108         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3109         case "$knowitall" in
3110         '')
3111         echo "    You'd better start hunting for one and let me know about it." >&4
3112                 exit 1
3113                 ;;
3114         esac
3115 fi
3116 $rm -f gccvers*
3117 case "$gccversion" in
3118 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3119 esac
3120
3121 : decide how portable to be.  Allow command line overrides.
3122 case "$d_portable" in
3123 "$undef") ;;
3124 *)      d_portable="$define" ;;
3125 esac
3126
3127 : set up shell script to do ~ expansion
3128 cat >filexp <<EOSS
3129 $startsh
3130 : expand filename
3131 case "\$1" in
3132  ~/*|~)
3133         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3134         ;;
3135  ~*)
3136         if $test -f /bin/csh; then
3137                 /bin/csh -f -c "glob \$1"
3138                 failed=\$?
3139                 echo ""
3140                 exit \$failed
3141         else
3142                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3143                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3144                 if $test ! -d "\$dir"; then
3145                         me=\`basename \$0\`
3146                         echo "\$me: can't locate home directory for: \$name" >&2
3147                         exit 1
3148                 fi
3149                 case "\$1" in
3150                 */*)
3151                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3152                         ;;
3153                 *)
3154                         echo \$dir
3155                         ;;
3156                 esac
3157         fi
3158         ;;
3159 *)
3160         echo \$1
3161         ;;
3162 esac
3163 EOSS
3164 chmod +x filexp
3165 $eunicefix filexp
3166
3167 : now set up to get a file name
3168 cat <<EOS >getfile
3169 $startsh
3170 EOS
3171 cat <<'EOSC' >>getfile
3172 tilde=''
3173 fullpath=''
3174 already=''
3175 skip=''
3176 none_ok=''
3177 exp_file=''
3178 nopath_ok=''
3179 orig_rp="$rp"
3180 orig_dflt="$dflt"
3181 case "$gfpth" in
3182 '') gfpth='.' ;;
3183 esac
3184
3185 case "$fn" in
3186 *\(*)
3187         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3188         fn=`echo $fn | sed 's/(.*)//'`
3189         ;;
3190 esac
3191
3192 case "$fn" in
3193 *:*)
3194         loc_file=`expr $fn : '.*:\(.*\)'`
3195         fn=`expr $fn : '\(.*\):.*'`
3196         ;;
3197 esac
3198
3199 case "$fn" in
3200 *~*) tilde=true;;
3201 esac
3202 case "$fn" in
3203 */*) fullpath=true;;
3204 esac
3205 case "$fn" in
3206 *+*) skip=true;;
3207 esac
3208 case "$fn" in
3209 *n*) none_ok=true;;
3210 esac
3211 case "$fn" in
3212 *e*) exp_file=true;;
3213 esac
3214 case "$fn" in
3215 *p*) nopath_ok=true;;
3216 esac
3217
3218 case "$fn" in
3219 *f*) type='File';;
3220 *d*) type='Directory';;
3221 *l*) type='Locate';;
3222 esac
3223
3224 what="$type"
3225 case "$what" in
3226 Locate) what='File';;
3227 esac
3228
3229 case "$exp_file" in
3230 '')
3231         case "$d_portable" in
3232         "$define") ;;
3233         *) exp_file=true;;
3234         esac
3235         ;;
3236 esac
3237
3238 cd ..
3239 while test "$type"; do
3240         redo=''
3241         rp="$orig_rp"
3242         dflt="$orig_dflt"
3243         case "$tilde" in
3244         true) rp="$rp (~name ok)";;
3245         esac
3246         . UU/myread
3247         if test -f UU/getfile.ok && \
3248                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3249         then
3250                 value="$ans"
3251                 ansexp="$ans"
3252                 break
3253         fi
3254         case "$ans" in
3255         none)
3256                 value=''
3257                 ansexp=''
3258                 case "$none_ok" in
3259                 true) type='';;
3260                 esac
3261                 ;;
3262         *)
3263                 case "$tilde" in
3264                 '') value="$ans"
3265                         ansexp="$ans";;
3266                 *)
3267                         value=`UU/filexp $ans`
3268                         case $? in
3269                         0)
3270                                 if test "$ans" != "$value"; then
3271                                         echo "(That expands to $value on this system.)"
3272                                 fi
3273                                 ;;
3274                         *) value="$ans";;
3275                         esac
3276                         ansexp="$value"
3277                         case "$exp_file" in
3278                         '') value="$ans";;
3279                         esac
3280                         ;;
3281                 esac
3282                 case "$fullpath" in
3283                 true)
3284                         case "$ansexp" in
3285                         /*) value="$ansexp" ;;
3286                         *)
3287                                 redo=true
3288                                 case "$already" in
3289                                 true)
3290                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3291                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3292                                         ;;
3293                                 *)
3294                                 echo "Please give a full path name, starting with slash." >&4
3295                                         case "$tilde" in
3296                                         true)
3297                                 echo "Note that using ~name is ok provided it expands well." >&4
3298                                                 already=true
3299                                                 ;;
3300                                         esac
3301                                 esac
3302                                 ;;
3303                         esac
3304                         ;;
3305                 esac
3306                 case "$redo" in
3307                 '')
3308                         case "$type" in
3309                         File)
3310                                 for fp in $gfpth; do
3311                                         if test "X$fp" = X.; then
3312                                             pf="$ansexp"
3313                                         else    
3314                                             pf="$fp/$ansexp"
3315                                         fi
3316                                         if test -f "$pf"; then
3317                                                 type=''
3318                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3319                                         then
3320                                                 echo "($value is not a plain file, but that's ok.)"
3321                                                 type=''
3322                                         fi
3323                                         if test X"$type" = X; then
3324                                             value="$pf"
3325                                             break
3326                                         fi
3327                                 done
3328                                 ;;
3329                         Directory)
3330                                 for fp in $gfpth; do
3331                                         if test "X$fp" = X.; then
3332                                             pf="$ansexp"
3333                                         else    
3334                                             pf="$fp/$ansexp"
3335                                         fi
3336                                         if test -d "$pf"; then
3337                                                 type=''
3338                                                 value="$pf"
3339                                                 break
3340                                         fi
3341                                 done
3342                                 ;;
3343                         Locate)
3344                                 if test -d "$ansexp"; then
3345                                         echo "(Looking for $loc_file in directory $value.)"
3346                                         value="$value/$loc_file"
3347                                         ansexp="$ansexp/$loc_file"
3348                                 fi
3349                                 if test -f "$ansexp"; then
3350                                         type=''
3351                                 fi
3352                                 case "$nopath_ok" in
3353                                 true)   case "$value" in
3354                                         */*) ;;
3355                                         *)      echo "Assuming $value will be in people's path."
3356                                                 type=''
3357                                                 ;;
3358                                         esac
3359                                         ;;
3360                                 esac
3361                                 ;;
3362                         esac
3363
3364                         case "$skip" in
3365                         true) type='';
3366                         esac
3367
3368                         case "$type" in
3369                         '') ;;
3370                         *)
3371                                 if test "$fastread" = yes; then
3372                                         dflt=y
3373                                 else
3374                                         dflt=n
3375                                 fi
3376                                 rp="$what $value doesn't exist.  Use that name anyway?"
3377                                 . UU/myread
3378                                 dflt=''
3379                                 case "$ans" in
3380                                 y*) type='';;
3381                                 *) echo " ";;
3382                                 esac
3383                                 ;;
3384                         esac
3385                         ;;
3386                 esac
3387                 ;;
3388         esac
3389 done
3390 cd UU
3391 ans="$value"
3392 rp="$orig_rp"
3393 dflt="$orig_dflt"
3394 rm -f getfile.ok
3395 test "X$gfpthkeep" != Xy && gfpth=""
3396 EOSC
3397
3398 : What should the include directory be ?
3399 echo " "
3400 $echo $n "Hmm...  $c"
3401 dflt='/usr/include'
3402 incpath=''
3403 mips_type=''
3404 if $test -f /bin/mips && /bin/mips; then
3405         echo "Looks like a MIPS system..."
3406         $cat >usr.c <<'EOCP'
3407 #ifdef SYSTYPE_BSD43
3408 /bsd43
3409 #endif
3410 EOCP
3411         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3412                 dflt='/bsd43/usr/include'
3413                 incpath='/bsd43'
3414                 mips_type='BSD 4.3'
3415         else
3416                 mips_type='System V'
3417         fi
3418         $rm -f usr.c usr.out
3419         echo "and you're compiling with the $mips_type compiler and libraries."
3420         xxx_prompt=y
3421         echo "exit 0" >mips
3422 else
3423         echo "Doesn't look like a MIPS system."
3424         xxx_prompt=n
3425         echo "exit 1" >mips
3426 fi
3427 chmod +x mips
3428 $eunicefix mips
3429 case "$usrinc" in
3430 '') ;;
3431 *) dflt="$usrinc";;
3432 esac
3433 case "$xxx_prompt" in
3434 y)      fn=d/
3435         echo " "
3436         rp='Where are the include files you want to use?'
3437         . ./getfile
3438         usrinc="$ans"
3439         ;;
3440 *)      usrinc="$dflt"
3441         ;;
3442 esac
3443
3444 : see how we invoke the C preprocessor
3445 echo " "
3446 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3447 cat <<'EOT' >testcpp.c
3448 #define ABC abc
3449 #define XYZ xyz
3450 ABC.XYZ
3451 EOT
3452 cd ..
3453 if test ! -f cppstdin; then
3454         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3455                 # AIX cc -E doesn't show the absolute headerfile
3456                 # locations but we'll cheat by using the -M flag.
3457                 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
3458         else
3459                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3460         fi
3461 else
3462         echo "Keeping your $hint cppstdin wrapper."
3463 fi
3464 chmod 755 cppstdin
3465 wrapper=`pwd`/cppstdin
3466 ok='false'
3467 cd UU
3468
3469 if $test "X$cppstdin" != "X" && \
3470         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3471         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3472 then
3473         echo "You used to use $cppstdin $cppminus so we'll use that again."
3474         case "$cpprun" in
3475         '') echo "But let's see if we can live without a wrapper..." ;;
3476         *)
3477                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3478                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3479                 then
3480                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3481                         ok='true'
3482                 else
3483                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3484                 fi
3485                 ;;
3486         esac
3487 else
3488         case "$cppstdin" in
3489         '') ;;
3490         *)
3491                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3492                 ;;
3493         esac
3494 fi
3495
3496 if $ok; then
3497         : nothing
3498 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3499         $cc -E <testcpp.c >testcpp.out 2>&1; \
3500         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3501         echo "Yup, it does."
3502         x_cpp="$cc -E"
3503         x_minus='';
3504 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3505         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3506         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3507         echo "Yup, it does."
3508         x_cpp="$cc -E"
3509         x_minus='-';
3510 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3511         $cc -P <testcpp.c >testcpp.out 2>&1; \
3512         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3513         echo "Yipee, that works!"
3514         x_cpp="$cc -P"
3515         x_minus='';
3516 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3517         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3518         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3519         echo "At long last!"
3520         x_cpp="$cc -P"
3521         x_minus='-';
3522 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3523         $cpp <testcpp.c >testcpp.out 2>&1; \
3524         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3525         echo "It works!"
3526         x_cpp="$cpp"
3527         x_minus='';
3528 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3529         $cpp - <testcpp.c >testcpp.out 2>&1; \
3530         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3531         echo "Hooray, it works!  I was beginning to wonder."
3532         x_cpp="$cpp"
3533         x_minus='-';
3534 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3535         $wrapper <testcpp.c >testcpp.out 2>&1; \
3536         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3537         x_cpp="$wrapper"
3538         x_minus=''
3539         echo "Eureka!"
3540 else
3541         dflt=''
3542         rp="No dice.  I can't find a C preprocessor.  Name one:"
3543         . ./myread
3544         x_cpp="$ans"
3545         x_minus=''
3546         $x_cpp <testcpp.c >testcpp.out 2>&1
3547         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3548                 echo "OK, that will do." >&4
3549         else
3550 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3551                 exit 1
3552         fi
3553 fi
3554
3555 case "$ok" in
3556 false)
3557         cppstdin="$x_cpp"
3558         cppminus="$x_minus"
3559         cpprun="$x_cpp"
3560         cpplast="$x_minus"
3561         set X $x_cpp
3562         shift
3563         case "$1" in
3564         "$cpp")
3565                 echo "Perhaps can we force $cc -E using a wrapper..."
3566                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3567                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3568                 then
3569                         echo "Yup, we can."
3570                         cppstdin="$wrapper"
3571                         cppminus='';
3572                 else
3573                         echo "Nope, we'll have to live without it..."
3574                 fi
3575                 ;;
3576         esac
3577         case "$cpprun" in
3578         "$wrapper")
3579                 cpprun=''
3580                 cpplast=''
3581                 ;;
3582         esac
3583         ;;
3584 esac
3585
3586 case "$cppstdin" in
3587 "$wrapper"|'cppstdin') ;;
3588 *) $rm -f $wrapper;;
3589 esac
3590 $rm -f testcpp.c testcpp.out
3591
3592 : Set private lib path
3593 case "$plibpth" in
3594 '') if ./mips; then
3595                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3596         fi;;
3597 esac
3598 case "$libpth" in
3599 ' ') dlist='';;
3600 '') dlist="$loclibpth $plibpth $glibpth";;
3601 *) dlist="$libpth";;
3602 esac
3603
3604 : Now check and see which directories actually exist, avoiding duplicates
3605 libpth=''
3606 for xxx in $dlist
3607 do
3608     if $test -d $xxx; then
3609                 case " $libpth " in
3610                 *" $xxx "*) ;;
3611                 *) libpth="$libpth $xxx";;
3612                 esac
3613     fi
3614 done
3615 $cat <<'EOM'
3616
3617 Some systems have incompatible or broken versions of libraries.  Among
3618 the directories listed in the question below, please remove any you
3619 know not to be holding relevant libraries, and add any that are needed.
3620 Say "none" for none.
3621
3622 EOM
3623 case "$libpth" in
3624 '') dflt='none';;
3625 *)
3626         set X $libpth
3627         shift
3628         dflt=${1+"$@"}
3629         ;;
3630 esac
3631 rp="Directories to use for library searches?"
3632 . ./myread
3633 case "$ans" in
3634 none) libpth=' ';;
3635 *) libpth="$ans";;
3636 esac
3637
3638 : compute shared library extension
3639 case "$so" in
3640 '')
3641         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3642                 dflt='sl'
3643         else
3644                 dflt='so'
3645         fi
3646         ;;
3647 *) dflt="$so";;
3648 esac
3649 $cat <<EOM
3650
3651 On some systems, shared libraries may be available.  Answer 'none' if
3652 you want to suppress searching of shared libraries for the remaining
3653 of this configuration.
3654
3655 EOM
3656 rp='What is the file extension used for shared libraries?'
3657 . ./myread
3658 so="$ans"
3659
3660 : Define several unixisms.
3661 : Hints files or command line option can be used to override them.
3662 : The convoluted testing is in case hints files set either the old
3663 : or the new name.
3664 case "$_exe" in
3665 '')     case "$exe_ext" in
3666     '') ;;
3667         *)      _exe="$exe_ext" ;;
3668         esac
3669         ;;
3670 esac
3671 case "$_a" in
3672 '')     case "$lib_ext" in
3673     '') _a='.a';;
3674         *)      _a="$lib_ext" ;;
3675         esac
3676         ;;
3677 esac
3678 case "$_o" in
3679 '') case "$obj_ext" in
3680         '')     _o='.o';;
3681         *)      _o="$obj_ext";;
3682         esac
3683         ;;
3684 esac
3685 case "$p_" in
3686 '') case "$path_sep" in
3687         '')     p_=':';;
3688         *)      p_="$path_sep";;
3689         esac
3690         ;;
3691 esac
3692 exe_ext=$_exe
3693 lib_ext=$_a
3694 obj_ext=$_o
3695 path_sep=$p_
3696
3697 : Which makefile gets called first.  This is used by make depend.
3698 case "$firstmakefile" in
3699 '') firstmakefile='makefile';;
3700 esac
3701
3702 cat <<EOM
3703
3704 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3705 Configure must be run with -Dusesocks.
3706
3707 Normally you do not need this and you should answer no.
3708
3709 EOM
3710 case "$usesocks" in
3711 $define|true|[yY]*)     dflt='y';;
3712 *) dflt='n';;
3713 esac
3714 rp='Build Perl for SOCKS?'
3715 . ./myread
3716 case "$ans" in
3717 y|Y)    val="$define" ;;     
3718 *)      val="$undef" ;;
3719 esac
3720 set usesocks
3721 eval $setvar
3722
3723 : Looking for optional libraries
3724 echo " "
3725 echo "Checking for optional libraries..." >&4
3726 case "$libs" in
3727 ' '|'') dflt='';;
3728 *) dflt="$libs";;
3729 esac
3730 case "$libswanted" in
3731 '') libswanted='c_s';;
3732 esac
3733 case "$usesocks" in
3734 $define)
3735         libswanted="$libswanted socks5 socks5_sh"
3736         ;;
3737 esac
3738 for thislib in $libswanted; do
3739         
3740         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3741                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3742                 echo "Found -l$thislib (shared)."
3743                 case " $dflt " in
3744                 *"-l$thislib "*);;
3745                 *) dflt="$dflt -l$thislib";;
3746                 esac
3747         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3748                 echo "Found -l$thislib (shared)."
3749                 case " $dflt " in
3750                 *"-l$thislib "*);;
3751                 *) dflt="$dflt -l$thislib";;
3752                 esac
3753         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3754                 echo "Found -l$thislib."
3755                 case " $dflt " in
3756                 *"-l$thislib "*);;
3757                 *) dflt="$dflt -l$thislib";;
3758                 esac
3759         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3760                 echo "Found -l$thislib."
3761                 case " $dflt " in
3762                 *"-l$thislib "*);;
3763                 *) dflt="$dflt -l$thislib";;
3764                 esac
3765         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3766                 echo "Found -l${thislib}_s."
3767                 case " $dflt " in
3768                 *"-l$thislib "*);;
3769                 *) dflt="$dflt -l${thislib}_s";;
3770                 esac
3771         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3772                 echo "Found -l$thislib."
3773                 case " $dflt " in
3774                 *"-l$thislib "*);;
3775                 *) dflt="$dflt -l$thislib";;
3776                 esac
3777         else
3778                 echo "No -l$thislib."
3779         fi
3780 done
3781 set X $dflt
3782 shift
3783 dflt="$*"
3784 case "$libs" in
3785 '') dflt="$dflt";;
3786 *) dflt="$libs";;
3787 esac
3788 case "$dflt" in
3789 ' '|'') dflt='none';;
3790 esac
3791
3792 $cat <<EOM
3793
3794 In order to compile $package on your machine, a number of libraries
3795 are usually needed.  Include any other special libraries here as well.
3796 Say "none" for none.  The default list is almost always right.
3797 EOM
3798
3799 echo " "
3800 rp="What libraries to use?"
3801 . ./myread
3802 case "$ans" in
3803 none) libs=' ';;
3804 *) libs="$ans";;
3805 esac
3806
3807 : determine optimization, if desired, or use for debug flag also
3808 case "$optimize" in
3809 ' '|$undef) dflt='none';;
3810 '') dflt='-O';;
3811 *) dflt="$optimize";;
3812 esac
3813 $cat <<EOH
3814
3815 By default, $package compiles with the -O flag to use the optimizer.
3816 Alternately, you might want to use the symbolic debugger, which uses
3817 the -g flag (on traditional Unix systems).  Either flag can be
3818 specified here.  To use neither flag, specify the word "none".
3819
3820 EOH
3821 rp="What optimizer/debugger flag should be used?"
3822 . ./myread
3823 optimize="$ans"
3824 case "$optimize" in
3825 'none') optimize=" ";;
3826 esac
3827
3828 dflt=''
3829 : We will not override a previous value, but we might want to
3830 : augment a hint file
3831 case "$hint" in
3832 default|recommended)
3833         case "$gccversion" in
3834         1*) dflt='-fpcc-struct-return' ;;
3835         esac
3836         case "$optimize" in
3837         *-g*) dflt="$dflt -DDEBUGGING";;
3838         esac
3839         case "$gccversion" in
3840         2*) if test -d /etc/conf/kconfig.d &&
3841                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3842                 then
3843                         dflt="$dflt -posix"
3844                 fi
3845                 ;;
3846         esac
3847         case "$gccversion" in
3848         1*) ;;
3849         2.[0-8]*) ;;
3850         ?*)     echo " "
3851                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3852                 echo 'int main(void) { return 0; }' > gcctest.c
3853                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3854                         echo "Yes, it does." 2>&1
3855                         case "$ccflags" in
3856                         *strict-aliasing*) 
3857                                 echo "Leaving current flags $ccflags alone." 2>&1
3858                                 ;;
3859                         *) dflt="$dflt -fno-strict-aliasing" ;;
3860                         esac
3861                 else
3862                         echo "Nope, it doesn't, but that's ok." 2>&1
3863                 fi
3864                 ;;
3865         esac
3866         ;;
3867 esac
3868
3869 case "$mips_type" in
3870 *BSD*|'') inclwanted="$locincpth $usrinc";;
3871 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3872 esac
3873 for thisincl in $inclwanted; do
3874         if $test -d $thisincl; then
3875                 if $test x$thisincl != x$usrinc; then
3876                         case "$dflt" in
3877                         *$thisincl*);;
3878                         *) dflt="$dflt -I$thisincl";;
3879                         esac
3880                 fi
3881         fi
3882 done
3883
3884 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3885         xxx=true;
3886 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3887         xxx=true;
3888 else
3889         xxx=false;
3890 fi;
3891 if $xxx; then
3892         case "$dflt" in
3893         *$2*);;
3894         *) dflt="$dflt -D$2";;
3895         esac;
3896 fi'
3897
3898 set signal.h LANGUAGE_C; eval $inctest
3899
3900 case "$usesocks" in
3901 $define)
3902         ccflags="$ccflags -DSOCKS"
3903         ;;
3904 esac
3905
3906 case "$hint" in
3907 default|recommended) dflt="$ccflags $dflt" ;;
3908 *) dflt="$ccflags";;
3909 esac
3910
3911 case "$dflt" in
3912 ''|' ') dflt=none;;
3913 esac
3914 $cat <<EOH
3915
3916 Your C compiler may want other flags.  For this question you should include
3917 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3918 but you should NOT include libraries or ld flags like -lwhatever.  If you
3919 want $package to honor its debug switch, you should include -DDEBUGGING here.
3920 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3921
3922 To use no flags, specify the word "none".
3923
3924 EOH
3925 set X $dflt
3926 shift
3927 dflt=${1+"$@"}
3928 rp="Any additional cc flags?"
3929 . ./myread
3930 case "$ans" in
3931 none) ccflags='';;
3932 *) ccflags="$ans";;
3933 esac
3934
3935 : the following weeds options from ccflags that are of no interest to cpp
3936 cppflags="$ccflags"
3937 case "$gccversion" in
3938 1*) cppflags="$cppflags -D__GNUC__"
3939 esac
3940 case "$mips_type" in
3941 '');;
3942 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3943 esac
3944 case "$cppflags" in
3945 '');;
3946 *)
3947         echo " "
3948         echo "Let me guess what the preprocessor flags are..." >&4
3949         set X $cppflags
3950         shift
3951         cppflags=''
3952         $cat >cpp.c <<'EOM'
3953 #define BLURFL foo
3954
3955 BLURFL xx LFRULB
3956 EOM
3957         previous=''
3958         for flag in $*
3959         do
3960                 case "$flag" in
3961                 -*) ftry="$flag";;
3962                 *) ftry="$previous $flag";;
3963                 esac
3964                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3965                         >cpp1.out 2>/dev/null && \
3966                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3967                         >cpp2.out 2>/dev/null && \
3968                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3969                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3970                 then
3971                         cppflags="$cppflags $ftry"
3972                         previous=''
3973                 else
3974                         previous="$flag"
3975                 fi
3976         done
3977         set X $cppflags
3978         shift
3979         cppflags=${1+"$@"}
3980         case "$cppflags" in
3981         *-*)  echo "They appear to be: $cppflags";;
3982         esac
3983         $rm -f cpp.c cpp?.out
3984         ;;
3985 esac
3986
3987 : flags used in final linking phase
3988 case "$ldflags" in
3989 '') if ./venix; then
3990                 dflt='-i -z'
3991         else
3992                 dflt=''
3993         fi
3994         case "$ccflags" in
3995         *-posix*) dflt="$dflt -posix" ;;
3996         esac
3997         ;;
3998 *) dflt="$ldflags";;
3999 esac
4000
4001 : Try to guess additional flags to pick up local libraries.
4002 for thislibdir in $libpth; do
4003         case " $loclibpth " in
4004         *" $thislibdir "*)
4005                 case "$dflt " in 
4006                 *"-L$thislibdir "*) ;;
4007                 *)  dflt="$dflt -L$thislibdir" ;;
4008                 esac
4009                 ;;
4010         esac
4011 done
4012
4013 case "$dflt" in
4014 '') dflt='none' ;;
4015 esac
4016
4017 $cat <<EOH
4018
4019 Your C linker may need flags.  For this question you should
4020 include -L/whatever and any other flags used by the C linker, but you
4021 should NOT include libraries like -lwhatever.
4022
4023 Make sure you include the appropriate -L/path flags if your C linker
4024 does not normally search all of the directories you specified above,
4025 namely
4026         $libpth
4027 To use no flags, specify the word "none".
4028
4029 EOH
4030
4031 rp="Any additional ld flags (NOT including libraries)?"
4032 . ./myread
4033 case "$ans" in
4034 none) ldflags='';;
4035 *) ldflags="$ans";;
4036 esac
4037 rmlist="$rmlist pdp11"
4038
4039 : coherency check
4040 echo " "
4041 echo "Checking your choice of C compiler and flags for coherency..." >&4
4042 $cat > try.c <<'EOF'
4043 #include <stdio.h>
4044 int main() { printf("Ok\n"); exit(0); }
4045 EOF
4046 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4047 shift
4048 $cat >try.msg <<'EOM'
4049 I've tried to compile and run the following simple program:
4050
4051 EOM
4052 $cat try.c >> try.msg
4053
4054 $cat >> try.msg <<EOM
4055
4056 I used the command:
4057
4058         $*
4059         ./try
4060
4061 and I got the following output:
4062
4063 EOM
4064 dflt=y
4065 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4066         if sh -c './try' >>try.msg 2>&1; then
4067                 xxx=`./try`
4068                 case "$xxx" in
4069                 "Ok") dflt=n ;;
4070                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4071                         case " $libs " in
4072                         *" -lsfio "*)
4073                                 cat >> try.msg <<'EOQS'
4074 If $libs contains -lsfio, and sfio is mis-configured, then it
4075 sometimes (apparently) runs and exits with a 0 status, but with no
4076 output!  It may have to do with sfio's use of _exit vs. exit.
4077
4078 EOQS
4079                                 rp="You have a big problem.  Shall I abort Configure"
4080                                 dflt=y
4081                                 ;;
4082                         esac
4083                         ;;
4084                 esac
4085         else
4086                 echo "The program compiled OK, but exited with status $?." >>try.msg
4087                 rp="You have a problem.  Shall I abort Configure"
4088                 dflt=y
4089         fi
4090 else
4091         echo "I can't compile the test program." >>try.msg
4092         rp="You have a BIG problem.  Shall I abort Configure"
4093         dflt=y
4094 fi
4095 case "$dflt" in
4096 y)
4097         $cat try.msg >&4
4098         case "$knowitall" in
4099         '')
4100                 echo "(The supplied flags or libraries might be incorrect.)"
4101                 ;;
4102         *) dflt=n;;
4103         esac
4104         echo " "
4105         . ./myread
4106         case "$ans" in
4107         n*|N*) ;;
4108         *)      echo "Ok.  Stopping Configure." >&4
4109                 exit 1
4110                 ;;
4111         esac
4112         ;;
4113 n) echo "OK, that should do.";;
4114 esac
4115 $rm -f try try.* core
4116
4117 : define an is-a-typedef? function
4118 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4119 case "$inclist" in
4120 "") inclist="sys/types.h";;
4121 esac;
4122 eval "varval=\$$var";
4123 case "$varval" in
4124 "")
4125         $rm -f temp.c;
4126         for inc in $inclist; do
4127                 echo "#include <$inc>" >>temp.c;
4128         done;
4129         echo "#ifdef $type" >> temp.c;
4130         echo "printf(\"We have $type\");" >> temp.c;
4131         echo "#endif" >> temp.c;
4132         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4133         if $contains $type temp.E >/dev/null 2>&1; then
4134                 eval "$var=\$type";
4135         else
4136                 eval "$var=\$def";
4137         fi;
4138         $rm -f temp.?;;
4139 *) eval "$var=\$varval";;
4140 esac'
4141
4142 : define an is-a-typedef? function that prompts if the type is not available.
4143 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4144 case "$inclist" in
4145 "") inclist="sys/types.h";;
4146 esac;
4147 eval "varval=\$$var";
4148 case "$varval" in
4149 "")
4150         $rm -f temp.c;
4151         for inc in $inclist; do
4152                 echo "#include <$inc>" >>temp.c;
4153         done;
4154         echo "#ifdef $type" >> temp.c;
4155         echo "printf(\"We have $type\");" >> temp.c;
4156         echo "#endif" >> temp.c;
4157         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4158         echo " " ;
4159         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4160         if $contains $type temp.E >/dev/null 2>&1; then
4161                 echo "$type found." >&4;
4162                 eval "$var=\$type";
4163         else
4164                 echo "$type NOT found." >&4;
4165                 dflt="$def";
4166                 . ./myread ;
4167                 eval "$var=\$ans";
4168         fi;
4169         $rm -f temp.?;;
4170 *) eval "$var=\$varval";;
4171 esac'
4172
4173 : define a shorthand compile call
4174 compile='
4175 mc_file=$1;
4176 shift;
4177 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4178 : define a shorthand compile call for compilations that should be ok.
4179 compile_ok='
4180 mc_file=$1;
4181 shift;
4182 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4183
4184 : check for lengths of integral types
4185 echo " "
4186 case "$intsize" in
4187 '')
4188         echo "Checking to see how big your integers are..." >&4
4189         $cat >intsize.c <<'EOCP'
4190 #include <stdio.h>
4191 int main()
4192 {
4193         printf("intsize=%d;\n", (int)sizeof(int));
4194         printf("longsize=%d;\n", (int)sizeof(long));
4195         printf("shortsize=%d;\n", (int)sizeof(short));
4196         exit(0);
4197 }
4198 EOCP
4199         set intsize
4200         if eval $compile_ok && ./intsize > /dev/null; then
4201                 eval `./intsize`
4202                 echo "Your integers are $intsize bytes long."
4203                 echo "Your long integers are $longsize bytes long."
4204                 echo "Your short integers are $shortsize bytes long."
4205         else
4206                 $cat >&4 <<EOM
4207 !
4208 Help! I can't compile and run the intsize test program: please enlighten me!
4209 (This is probably a misconfiguration in your system or libraries, and
4210 you really ought to fix it.  Still, I'll try anyway.)
4211 !
4212 EOM
4213                 dflt=4
4214                 rp="What is the size of an integer (in bytes)?"
4215                 . ./myread
4216                 intsize="$ans"
4217                 dflt=$intsize
4218                 rp="What is the size of a long integer (in bytes)?"
4219                 . ./myread
4220                 longsize="$ans"
4221                 dflt=2
4222                 rp="What is the size of a short integer (in bytes)?"
4223                 . ./myread
4224                 shortsize="$ans"
4225         fi
4226         ;;
4227 esac
4228 $rm -f intsize intsize.*
4229
4230 : see what type lseek is declared as in the kernel
4231 rp="What is the type used for lseek's offset on this system?"
4232 set off_t lseektype long stdio.h sys/types.h
4233 eval $typedef_ask
4234
4235 echo " "
4236 $echo $n "Checking to see how big your file offsets are...$c" >&4
4237 $cat >try.c <<EOCP
4238 #include <sys/types.h>
4239 #include <stdio.h>
4240 int main()
4241 {
4242     printf("%d\n", (int)sizeof($lseektype));
4243     return(0); 
4244 }
4245 EOCP
4246 set try
4247 if eval $compile_ok; then
4248         lseeksize=`./try`
4249         $echo " $lseeksize bytes." >&4
4250 else
4251         dflt=$longsize
4252         echo " "
4253         echo "(I can't seem to compile the test program.  Guessing...)"
4254         rp="What is the size of your file offsets (in bytes)?"
4255         . ./myread
4256         lseeksize="$ans"
4257 fi
4258 $rm -f try.c try
4259
4260 : see what type file positions are declared as in the library
4261 rp="What is the type for file position used by fsetpos()?"
4262 set fpos_t fpostype long stdio.h sys/types.h
4263 eval $typedef_ask
4264
4265 echo " "
4266 case "$fpostype" in
4267 *_t) zzz="$fpostype"    ;;
4268 *)   zzz="fpos_t"       ;;
4269 esac
4270 $echo $n "Checking the size of $zzz...$c" >&4 
4271 cat > try.c <<EOCP
4272 #include <sys/types.h>
4273 #include <stdio.h>
4274 int main() {
4275     printf("%d\n", (int)sizeof($fpostype));
4276     exit(0);
4277 }
4278 EOCP
4279 set try
4280 if eval $compile_ok; then
4281         yyy=`./try`
4282         case "$yyy" in
4283         '')     fpossize=4
4284                 echo " "
4285                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4286                 ;;
4287         *)      fpossize=$yyy
4288                 echo " $fpossize bytes."
4289                 ;;
4290         esac
4291 else
4292         dflt="$longsize"
4293         echo " "
4294         echo "(I can't compile the test program.  Guessing...)" >&4
4295         rp="What is the size of your file positions (in bytes)?"
4296         . ./myread
4297         fpossize="$ans"
4298 fi
4299
4300
4301
4302 case "$lseeksize:$fpossize" in
4303 8:8) cat <<EOM
4304
4305 You can have files larger than 2 gigabytes.
4306 EOM
4307    val="$define" ;;
4308 *) cat <<EOM
4309
4310 Perl can be built to understand large files (files larger than 2 gigabytes)
4311 on some systems.  To do so, Configure must be run with -Duselargefiles.
4312
4313 If this doesn't make any sense to you, just accept the default 'y'.
4314 EOM
4315    case "$uselargefiles" in
4316    "$undef"|false|[nN]*) dflt='n' ;;
4317    *)   dflt='y' ;;
4318    esac
4319    rp='Try to understand large files, if available?'
4320    . ./myread
4321    case "$ans" in
4322    y|Y)         val="$define" ;;
4323    *)           val="$undef"  ;;
4324    esac
4325    ;;
4326 esac
4327 set uselargefiles
4328 eval $setvar
4329 case "$uselargefiles" in
4330 "$define")
4331 : Look for a hint-file generated 'call-back-unit'.  If the
4332 : user has specified that a large files perl is to be built,
4333 : we may need to set or change some other defaults.
4334         if $test -f uselfs.cbu; then
4335                 echo "Your platform has some specific hints for large file builds, using them..."
4336                 . ./uselfs.cbu
4337                 echo " "
4338                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4339                 $cat >try.c <<EOCP
4340 #include <sys/types.h>
4341 #include <stdio.h>
4342 int main()
4343 {
4344     printf("%d\n", (int)sizeof($lseektype));
4345     return(0); 
4346 }
4347 EOCP
4348                 set try
4349                 if eval $compile_ok; then
4350                         lseeksize=`./try`
4351                         $echo " $lseeksize bytes." >&4
4352                 else
4353                         dflt="$lseeksize"
4354                         echo " "
4355                         echo "(I can't seem to compile the test program.  Guessing...)"
4356                         rp="What is the size of your file offsets (in bytes)?"
4357                         . ./myread
4358                         lseeksize="$ans"
4359                 fi
4360                 case "$fpostype" in
4361                 *_t) zzz="$fpostype"    ;;
4362                 *)   zzz="fpos_t"       ;;
4363                 esac
4364                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4365                 $cat > try.c <<EOCP
4366 #include <sys/types.h>
4367 #include <stdio.h>
4368 int main() {
4369     printf("%d\n", (int)sizeof($fpostype));
4370     exit(0);
4371 }
4372 EOCP
4373                 set try
4374                 if eval $compile_ok; then
4375                         yyy=`./try`
4376                         dflt="$lseeksize"
4377                         case "$yyy" in
4378                         '')     echo " "
4379                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4380                                 ;;
4381                         *)      fpossize=$yyy
4382                                 echo " $fpossize bytes."
4383                                 ;;
4384                         esac
4385                 else
4386                         dflt="$fpossize"
4387                         echo " "
4388                         echo "(I can't compile the test program.  Guessing...)" >&4
4389                         rp="What is the size of your file positions (in bytes)?"
4390                         . ./myread
4391                         fpossize="$ans"
4392                 fi
4393                 $rm -f try.c try
4394         fi
4395         ;;
4396 esac
4397
4398
4399 case "$usemorebits" in
4400 "$define"|true|[yY]*)
4401         use64bits="$define"
4402         uselongdouble="$define"
4403         usemorebits="$define"
4404         ;;
4405 *)      usemorebits="$undef"
4406         ;;
4407 esac
4408
4409
4410 case "$intsize:$longsize" in
4411 8:*|*:8) cat <<EOM
4412
4413 You have natively 64-bit integers.
4414 EOM
4415    val="$define" ;;
4416 *) cat <<EOM
4417
4418 Perl can be built to take advantage of 64-bit integer types
4419 on some systems.  To do so, Configure must be run with -Duse64bits.
4420
4421 If this doesn't make any sense to you, just accept the default.
4422 EOM
4423   case "$use64bits" in
4424   $define|true|[yY]*)   dflt='y';;
4425   *) dflt='n';;
4426   esac
4427   rp='Try to use 64-bit integers, if available?'
4428   . ./myread
4429   case "$ans" in
4430   y|Y) val="$define" ;;
4431   *)   val="$undef"  ;;
4432   esac
4433   ;;
4434 esac
4435 set use64bits
4436 eval $setvar
4437
4438 case "$archname64" in
4439 '') archname64='' ;;    # not a typo
4440 esac
4441
4442 case "$use64bits" in
4443 "$define"|true|[yY]*)
4444 : Look for a hint-file generated 'call-back-unit'.  If the
4445 : user has specified that a 64-bit perl is to be built,
4446 : we may need to set or change some other defaults.
4447         if $test -f use64bits.cbu; then
4448                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4449                 . ./use64bits.cbu
4450         else
4451                 $cat <<EOM
4452 (Your platform doesn't have any specific hints for 64-bit builds.)
4453 EOM
4454                 case "$intsize:$longsize" in
4455 8:*|*:8) cat <<EOM
4456 (This is probably okay, as your system is a natively 64-bit system.)
4457 EOM
4458                   ;;
4459                 esac
4460                 case "$gccversion" in
4461                 '')     ;;
4462                 *)      case "$ccflags" in
4463                         *-DUSE_LONG_LONG*) ;;
4464                         *) $cat <<EOM
4465 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4466 to the compilation flags.
4467 EOM
4468                            ccflags="$ccflags -DUSE_LONG_LONG"
4469                            ;;
4470                         esac
4471                         ;;
4472                 esac
4473         fi
4474         ;;
4475 esac
4476
4477 : determine the architecture name
4478 echo " "
4479 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4480         tarch=`arch`"-$osname"
4481 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4482         if uname -m > tmparch 2>&1 ; then
4483                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4484                         -e 's/$/'"-$osname/" tmparch`
4485         else
4486                 tarch="$osname"
4487         fi
4488         $rm -f tmparch
4489 else
4490         tarch="$osname"
4491 fi
4492 case "$myarchname" in
4493 ''|"$tarch") ;;
4494 *)
4495         echo "(Your architecture name used to be $myarchname.)"
4496         archname=''
4497         ;;
4498 esac
4499 myarchname="$tarch"
4500 case "$archname" in
4501 '') dflt="$tarch";;
4502 *) dflt="$archname";;
4503 esac
4504 rp='What is your architecture name'
4505 . ./myread
4506 archname="$ans"
4507 case "$usethreads" in
4508 $define)
4509         echo "Threads selected." >&4
4510         case "$archname" in
4511         *-thread*) echo "...and architecture name already has -thread." >&4
4512                 ;;
4513         *)      archname="$archname-thread"
4514                 echo "...setting architecture name to $archname." >&4
4515                 ;;
4516         esac
4517         ;;
4518 esac
4519 case "$usemultiplicity" in
4520 $define)
4521         echo "Multiplicity selected." >&4
4522         case "$archname" in
4523         *-multi*) echo "...and architecture name already has -multi." >&4
4524                 ;;
4525         *)      archname="$archname-multi"
4526                 echo "...setting architecture name to $archname." >&4
4527                 ;;
4528         esac
4529         ;;
4530 esac
4531 case "$use64bits" in
4532 $define)
4533         case "$archname64" in
4534         '')
4535                 ;;
4536         *)
4537                 case "$archname" in
4538                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4539                         ;;
4540                 *)      archname="$archname-$archname64"
4541                         echo "...setting architecture name to $archname." >&4
4542                         ;;
4543                 esac
4544                 ;;
4545         esac
4546 esac
4547
4548 : determine root of directory hierarchy where package will be installed.
4549 case "$prefix" in
4550 '')
4551         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4552         ;;
4553 *)
4554         dflt="$prefix"
4555         ;;
4556 esac
4557 $cat <<EOM
4558
4559 By default, $package will be installed in $dflt/bin, manual pages
4560 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4561 installation directories. Typically this is something like /usr/local.
4562 If you wish to have binaries under /usr/bin but other parts of the
4563 installation under /usr/local, that's ok: you will be prompted
4564 separately for each of the installation directories, the prefix being
4565 only used to set the defaults.
4566
4567 EOM
4568 fn=d~
4569 rp='Installation prefix to use?'
4570 . ./getfile
4571 oldprefix=''
4572 case "$prefix" in
4573 '') ;;
4574 *)
4575         case "$ans" in
4576         "$prefix") ;;
4577         *) oldprefix="$prefix";;
4578         esac
4579         ;;
4580 esac
4581 prefix="$ans"
4582 prefixexp="$ansexp"
4583
4584 : is AFS running?
4585 echo " "
4586 case "$afs" in
4587 $define|true)   afs=true ;;
4588 $undef|false)   afs=false ;;
4589 *)      if test -d /afs; then
4590                 afs=true
4591         else
4592                 afs=false
4593         fi
4594         ;;
4595 esac
4596 if $afs; then
4597         echo "AFS may be running... I'll be extra cautious then..." >&4
4598 else
4599         echo "AFS does not seem to be running..." >&4
4600 fi
4601
4602 : determine installation prefix for where package is to be installed.
4603 if $afs; then 
4604 $cat <<EOM
4605
4606 Since you are running AFS, I need to distinguish the directory in which
4607 files will reside from the directory in which they are installed (and from
4608 which they are presumably copied to the former directory by occult means).
4609
4610 EOM
4611         case "$installprefix" in
4612         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4613         *) dflt="$installprefix";;
4614         esac
4615 else
4616 $cat <<EOM
4617
4618 In some special cases, particularly when building $package for distribution,
4619 it is convenient to distinguish between the directory in which files should 
4620 be installed from the directory ($prefix) in which they 
4621 will eventually reside.  For most users, these two directories are the same.
4622
4623 EOM
4624         case "$installprefix" in
4625         '') dflt=$prefix ;;
4626         *) dflt=$installprefix;;
4627         esac
4628 fi
4629 fn=d~
4630 rp='What installation prefix should I use for installing files?'
4631 . ./getfile
4632 installprefix="$ans"
4633 installprefixexp="$ansexp"
4634
4635 : set the prefixit variable, to compute a suitable default value
4636 prefixit='case "$3" in
4637 ""|none)
4638         case "$oldprefix" in
4639         "") eval "$1=\"\$$2\"";;
4640         *)
4641                 case "$3" in
4642                 "") eval "$1=";;
4643                 none)
4644                         eval "tp=\"\$$2\"";
4645                         case "$tp" in
4646                         ""|" ") eval "$1=\"\$$2\"";;
4647                         *) eval "$1=";;
4648                         esac;;
4649                 esac;;
4650         esac;;
4651 *)
4652         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4653         case "$tp" in
4654         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4655         /*-$oldprefix/*|\~*-$oldprefix/*)
4656                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4657         *) eval "$1=\"\$$2\"";;
4658         esac;;
4659 esac'
4660
4661 : set the base revision
4662 baserev=5.0
4663
4664
4665 : get the patchlevel
4666 echo " "
4667 echo "Getting the current patchlevel..." >&4
4668 if $test -r $rsrc/patchlevel.h;then
4669         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4670         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4671         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4672         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4673         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4674 else
4675         patchlevel=0
4676         subversion=0
4677         api_revision=0
4678         api_version=0
4679         api_subversion=0
4680 fi
4681 $echo $n "(You have $package" $c
4682 case "$package" in
4683 "*$baserev")    ;;
4684 *)              $echo $n " $baserev" $c ;;
4685 esac
4686 $echo $n " patchlevel $patchlevel" $c
4687 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4688 echo ".)"
4689 case "$osname" in
4690 dos|cygwin|vms|win32)
4691         : XXX Should be a Configure test for double-dots in filenames.
4692         version=`echo $baserev $patchlevel $subversion | \
4693                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4694         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4695                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4696         ;;
4697 *)
4698         version=`echo $baserev $patchlevel $subversion | \
4699                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4700         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4701                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4702         ;;
4703 esac
4704 : Special case the 5.005_xx maintenance series, which used 5.005
4705 : without any subversion label as a subdirectory in $sitelib
4706 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4707         api_versionstring='5.005'
4708 fi
4709
4710 : determine installation style
4711 : For now, try to deduce it from prefix unless it is already set.
4712 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4713 case "$installstyle" in
4714 '')     case "$prefix" in
4715                 *perl*) dflt='lib';;
4716                 *) dflt='lib/perl5' ;;
4717         esac
4718         ;;
4719 *)      dflt='lib/perl5' ;;
4720 esac
4721 : Probably not worth prompting for this since we prompt for all
4722 : the directories individually, and the prompt would be too long and
4723 : confusing anyway.
4724 installstyle=$dflt
4725
4726 : determine where private library files go
4727 : Usual default is /usr/local/lib/perl5/$version.
4728 : Also allow things like /opt/perl/lib/$version, since 
4729 : /opt/perl/lib/perl5... would be redundant.
4730 : The default "style" setting is made in installstyle.U
4731 case "$installstyle" in
4732 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4733 *)       set dflt privlib lib/$version ;;
4734 esac
4735 eval $prefixit
4736 $cat <<EOM
4737
4738 There are some auxiliary files for $package that need to be put into a
4739 private library directory that is accessible by everyone.
4740
4741 EOM
4742 fn=d~+
4743 rp='Pathname where the private library files will reside?'
4744 . ./getfile
4745 privlib="$ans"
4746 privlibexp="$ansexp"
4747 : Change installation prefix, if necessary.
4748 if $test X"$prefix" != X"$installprefix"; then
4749         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4750 else
4751         installprivlib="$privlibexp"
4752 fi
4753
4754 : set the prefixup variable, to restore leading tilda escape
4755 prefixup='case "$prefixexp" in
4756 "$prefix") ;;
4757 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4758 esac'
4759
4760 : determine where public architecture dependent libraries go
4761 set archlib archlib
4762 eval $prefixit
4763 : privlib default is /usr/local/lib/$package/$version
4764 : archlib default is /usr/local/lib/$package/$version/$archname
4765 : privlib may have an optional trailing /share.
4766 tdflt=`echo $privlib | $sed 's,/share$,,'`
4767 tdflt=$tdflt/$archname
4768 case "$archlib" in
4769 '')     dflt=$tdflt
4770         ;;
4771 *)      dflt="$archlib"
4772     ;;
4773 esac
4774 $cat <<EOM
4775
4776 $spackage contains architecture-dependent library files.  If you are
4777 sharing libraries in a heterogeneous environment, you might store
4778 these files in a separate location.  Otherwise, you can just include
4779 them with the rest of the public library files.
4780
4781 EOM
4782 fn=d+~
4783 rp='Where do you want to put the public architecture-dependent libraries?'
4784 . ./getfile
4785 archlib="$ans"
4786 archlibexp="$ansexp"
4787 if $test X"$archlib" = X"$privlib"; then
4788         d_archlib="$undef"
4789 else
4790         d_archlib="$define"
4791 fi
4792 : Change installation prefix, if necessary.
4793 if $test X"$prefix" != X"$installprefix"; then
4794         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4795 else
4796         installarchlib="$archlibexp"
4797 fi
4798
4799
4800 : Binary compatibility with 5.005 is not possible for builds
4801 : with advanced features
4802 case "$usethreads$usemultiplicity" in
4803 *define*)
4804         bincompat5005="$undef"
4805         d_bincompat5005="$undef"
4806         ;;
4807 *)      $cat <<EOM
4808
4809 Perl 5.006 can be compiled for binary compatibility with 5.005.
4810 If you decide to do so, you will be able to continue using most
4811 of the extensions that were compiled for Perl 5.005.
4812
4813 EOM
4814         case "$bincompat5005$d_bincompat5005" in
4815         *"$undef"*) dflt=n ;;
4816         *) dflt=y ;;
4817         esac
4818         rp='Binary compatibility with Perl 5.005?'
4819         . ./myread
4820         case "$ans" in
4821         y*) val="$define" ;;
4822         *)  val="$undef" ;;
4823         esac
4824         set d_bincompat5005
4825         eval $setvar
4826         case "$d_bincompat5005" in
4827         "$define")
4828                 bincompat5005="$define"
4829                 ;;
4830         *)      bincompat5005="$undef"
4831                 d_bincompat5005="$undef"
4832                 ;;
4833         esac
4834         ;;
4835 esac
4836
4837
4838 : see if setuid scripts can be secure
4839 $cat <<EOM
4840
4841 Some kernels have a bug that prevents setuid #! scripts from being
4842 secure.  Some sites have disabled setuid #! scripts because of this.
4843
4844 First let's decide if your kernel supports secure setuid #! scripts.
4845 (If setuid #! scripts would be secure but have been disabled anyway,
4846 don't say that they are secure if asked.)
4847
4848 EOM
4849
4850 val="$undef"
4851 if $test -d /dev/fd; then
4852         echo "#!$ls" >reflect
4853         chmod +x,u+s reflect
4854         ./reflect >flect 2>&1
4855         if $contains "/dev/fd" flect >/dev/null; then
4856                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4857                 val="$define"
4858         else
4859                 $cat <<EOM
4860 If you are not sure if they are secure, I can check but I'll need a
4861 username and password different from the one you are using right now.
4862 If you don't have such a username or don't want me to test, simply
4863 enter 'none'.
4864
4865 EOM
4866                 rp='Other username to test security of setuid scripts with?'
4867                 dflt='none'
4868                 . ./myread
4869                 case "$ans" in
4870                 n|none)
4871                         case "$d_suidsafe" in
4872                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4873                                 dflt=n;;
4874                         "$undef")
4875                                 echo "Well, the $hint value is *not* secure." >&4
4876                                 dflt=n;;
4877                         *)      echo "Well, the $hint value *is* secure." >&4
4878                                 dflt=y;;
4879                         esac
4880                         ;;
4881                 *)
4882                         $rm -f reflect flect
4883                         echo "#!$ls" >reflect
4884                         chmod +x,u+s reflect
4885                         echo >flect
4886                         chmod a+w flect
4887                         echo '"su" will (probably) prompt you for '"$ans's password."
4888                         su $ans -c './reflect >flect'
4889                         if $contains "/dev/fd" flect >/dev/null; then
4890                                 echo "Okay, it looks like setuid scripts are secure." >&4
4891                                 dflt=y
4892                         else
4893                                 echo "I don't think setuid scripts are secure." >&4
4894                                 dflt=n
4895                         fi
4896                         ;;
4897                 esac
4898                 rp='Does your kernel have *secure* setuid scripts?'
4899                 . ./myread
4900                 case "$ans" in
4901                 [yY]*)  val="$define";;
4902                 *)      val="$undef";;
4903                 esac
4904         fi
4905 else
4906         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4907         echo "(That's for file descriptors, not floppy disks.)"
4908         val="$undef"
4909 fi
4910 set d_suidsafe
4911 eval $setvar
4912
4913 $rm -f reflect flect
4914
4915 : now see if they want to do setuid emulation
4916 echo " "
4917 val="$undef"
4918 case "$d_suidsafe" in
4919 "$define")
4920         val="$undef"
4921         echo "No need to emulate SUID scripts since they are secure here." >& 4
4922         ;;
4923 *)
4924         $cat <<EOM
4925 Some systems have disabled setuid scripts, especially systems where
4926 setuid scripts cannot be secure.  On systems where setuid scripts have
4927 been disabled, the setuid/setgid bits on scripts are currently
4928 useless.  It is possible for $package to detect those bits and emulate
4929 setuid/setgid in a secure fashion.  This emulation will only work if
4930 setuid scripts have been disabled in your kernel.
4931
4932 EOM
4933         case "$d_dosuid" in
4934         "$define") dflt=y ;;
4935         *) dflt=n ;;
4936         esac
4937         rp="Do you want to do setuid/setgid emulation?"
4938         . ./myread
4939         case "$ans" in
4940         [yY]*)  val="$define";;
4941         *)      val="$undef";;
4942         esac
4943         ;;
4944 esac
4945 set d_dosuid
4946 eval $setvar
4947
4948 : determine filename position in cpp output
4949 echo " "
4950 echo "Computing filename position in cpp output for #include directives..." >&4
4951 echo '#include <stdio.h>' > foo.c
4952 $cat >fieldn <<EOF
4953 $startsh
4954 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4955 $grep '^[       ]*#.*stdio\.h' | \
4956 while read cline; do
4957         pos=1
4958         set \$cline
4959         while $test \$# -gt 0; do
4960                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4961                         echo "\$pos"
4962                         exit 0
4963                 fi
4964                 shift
4965                 pos=\`expr \$pos + 1\`
4966         done
4967 done
4968 EOF
4969 chmod +x fieldn
4970 fieldn=`./fieldn`
4971 $rm -f foo.c fieldn
4972 case $fieldn in
4973 '') pos='???';;
4974 1) pos=first;;
4975 2) pos=second;;
4976 3) pos=third;;
4977 *) pos="${fieldn}th";;
4978 esac
4979 echo "Your cpp writes the filename in the $pos field of the line."
4980
4981 : locate header file
4982 $cat >findhdr <<EOF
4983 $startsh
4984 wanted=\$1
4985 name=''
4986 for usrincdir in $usrinc
4987 do
4988         if test -f \$usrincdir/\$wanted; then
4989                 echo "\$usrincdir/\$wanted"
4990                 exit 0
4991         fi
4992 done
4993 awkprg='{ print \$$fieldn }'
4994 echo "#include <\$wanted>" > foo\$\$.c
4995 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4996 $grep "^[       ]*#.*\$wanted" | \
4997 while read cline; do
4998         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4999         case "\$name" in
5000         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5001         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5002         *) exit 2;;
5003         esac;
5004 done;
5005 #
5006 # status = 0: grep returned 0 lines, case statement not executed
5007 # status = 1: headerfile found
5008 # status = 2: while loop executed, no headerfile found
5009 #
5010 status=\$?
5011 $rm -f foo\$\$.c;
5012 if test \$status -eq 1; then
5013         exit 0;
5014 fi
5015 exit 1
5016 EOF
5017 chmod +x findhdr
5018
5019 : define an alternate in-header-list? function
5020 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5021 cont=true; xxf="echo \"<\$1> found.\" >&4";
5022 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5023 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5024 esac;
5025 case $# in 4) instead=instead;; *) instead="at last";; esac;
5026 while $test "$cont"; do
5027         xxx=`./findhdr $1`
5028         var=$2; eval "was=\$$2";
5029         if $test "$xxx" && $test -r "$xxx";
5030         then eval $xxf;
5031         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5032                 cont="";
5033         else eval $xxnf;
5034         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5035         set $yyy; shift; shift; yyy=$@;
5036         case $# in 0) cont="";;
5037         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5038                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5039         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5040                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5041         esac;
5042 done;
5043 while $test "$yyy";
5044 do set $yyy; var=$2; eval "was=\$$2";
5045         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5046         set $yyy; shift; shift; yyy=$@;
5047 done'
5048
5049 : see if this is a malloc.h system
5050 set malloc.h i_malloc
5051 eval $inhdr
5052
5053 : see if stdlib is available
5054 set stdlib.h i_stdlib
5055 eval $inhdr
5056
5057 : determine which malloc to compile in
5058 echo " "
5059 case "$usemymalloc" in
5060 ''|[yY]*|true|$define)  dflt='y' ;;
5061 *)      dflt='n' ;;
5062 esac
5063 rp="Do you wish to attempt to use the malloc that comes with $package?"
5064 . ./myread
5065 usemymalloc="$ans"
5066 case "$ans" in
5067 y*|true)
5068         usemymalloc='y'
5069         mallocsrc='malloc.c'
5070         mallocobj="malloc$_o"
5071         d_mymalloc="$define"
5072         case "$libs" in
5073         *-lmalloc*)
5074                 : Remove malloc from list of libraries to use
5075                 echo "Removing unneeded -lmalloc from library list" >&4
5076                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5077                 shift
5078                 libs="$*"
5079                 echo "libs = $libs" >&4
5080                 ;;
5081         esac
5082         ;;
5083 *)
5084         usemymalloc='n'
5085         mallocsrc=''
5086         mallocobj=''
5087         d_mymalloc="$undef"
5088         ;;
5089 esac
5090
5091 : compute the return types of malloc and free
5092 echo " "
5093 $cat >malloc.c <<END
5094 #$i_malloc I_MALLOC
5095 #$i_stdlib I_STDLIB
5096 #include <stdio.h>
5097 #include <sys/types.h>
5098 #ifdef I_MALLOC
5099 #include <malloc.h>
5100 #endif
5101 #ifdef I_STDLIB
5102 #include <stdlib.h>
5103 #endif
5104 #ifdef TRY_MALLOC
5105 void *malloc();
5106 #endif
5107 #ifdef TRY_FREE
5108 void free();
5109 #endif
5110 END
5111 case "$malloctype" in
5112 '')
5113         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5114                 malloctype='void *'
5115         else
5116                 malloctype='char *'
5117         fi
5118         ;;
5119 esac
5120 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5121
5122 case "$freetype" in
5123 '')
5124         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5125                 freetype='void'
5126         else
5127                 freetype='int'
5128         fi
5129         ;;
5130 esac
5131 echo "Your system uses $freetype free(), it would seem." >&4
5132 $rm -f malloc.[co]
5133 $cat <<EOM
5134
5135 The installation process will also create a directory for
5136 vendor-supplied add-ons.  Vendors who supply perl with their system
5137 may find it convenient to place all vendor-supplied files in this
5138 directory rather than in the main distribution directory.  This will
5139 ease upgrades between binary-compatible maintenance versions of perl.
5140
5141 Of course you may also use these directories in whatever way you see
5142 fit.  For example, you might use them to access modules shared over a
5143 company-wide network.
5144
5145 The default answer should be fine for most people.
5146 This causes further questions about vendor add-ons to be skipped
5147 and no vendor-specific directories will be configured for perl.
5148
5149 EOM
5150 rp='Do you want to configure vendor-specific add-on directories?'
5151 case "$usevendorprefix" in
5152 define|true|[yY]*) dflt=y ;;
5153 *) dflt=n ;;
5154 esac
5155 . ./myread
5156 case "$ans" in
5157 [yY]*)  fn=d~+
5158         rp='Installation prefix to use for vendor-supplied add-ons?'
5159         case "$vendorprefix" in
5160         '') dflt='' ;;
5161         *)  dflt=$vendorprefix ;;
5162         esac
5163         . ./getfile
5164         oldvendorprefix=''
5165         case "$vendorprefix" in
5166         '') ;;
5167         *)      case "$ans" in
5168                 "$prefix") ;;
5169                 *) oldvendorprefix="$prefix";;
5170                 esac
5171                 ;;
5172         esac
5173         usevendorprefix="$define"
5174         vendorprefix="$ans"
5175         vendorprefixexp="$ansexp"
5176         ;;
5177 *)      usevendorprefix="$undef"
5178         vendorprefix=''
5179         vendorprefixexp=''
5180         ;;
5181 esac
5182
5183 case "$vendorprefix" in
5184 '')     d_vendorlib="$undef"
5185         vendorlib=''
5186         vendorlibexp=''
5187         ;;
5188 *)      d_vendorlib="$define"
5189         : determine where vendor-supplied modules go.
5190         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5191         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5192         case "$installstyle" in
5193         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5194         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5195         esac
5196         fn=d~+
5197         rp='Pathname for the vendor-supplied library files?'
5198         . ./getfile
5199         vendorlib="$ans"
5200         vendorlibexp="$ansexp"
5201         : Change installation prefix, if necessary.
5202         if $test X"$prefix" != X"$installprefix"; then
5203                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5204         else
5205                 installvendorlib="$vendorlibexp"
5206         fi
5207         ;;
5208 esac
5209
5210 : Cruising for prototypes
5211 echo " "
5212 echo "Checking out function prototypes..." >&4
5213 $cat >prototype.c <<'EOCP'
5214 int main(int argc, char *argv[]) {
5215         exit(0);}
5216 EOCP
5217 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5218         echo "Your C compiler appears to support function prototypes."
5219         val="$define"
5220 else
5221         echo "Your C compiler doesn't seem to understand function prototypes."
5222         val="$undef"
5223 fi
5224 set prototype
5225 eval $setvar
5226 $rm -f prototype*
5227
5228 case "$prototype" in
5229 "$define") ;;
5230 *)      ansi2knr='ansi2knr'
5231         echo " "
5232         cat <<EOM >&4
5233
5234 $me:  FATAL ERROR:
5235 This version of $package can only be compiled by a compiler that 
5236 understands function prototypes.  Unfortunately, your C compiler 
5237         $cc $ccflags
5238 doesn't seem to understand them.  Sorry about that.
5239
5240 If GNU cc is available for your system, perhaps you could try that instead.  
5241
5242 Eventually, we hope to support building Perl with pre-ANSI compilers.
5243 If you would like to help in that effort, please contact <perlbug@perl.org>.
5244
5245 Aborting Configure now.
5246 EOM
5247         exit 2
5248         ;;
5249 esac
5250
5251 : determine where public executables go
5252 echo " "
5253 set dflt bin bin
5254 eval $prefixit
5255 fn=d~
5256 rp='Pathname where the public executables will reside?'
5257 . ./getfile
5258 if $test "X$ansexp" != "X$binexp"; then
5259         installbin=''
5260 fi
5261 bin="$ans"
5262 binexp="$ansexp"
5263 : Change installation prefix, if necessary.
5264 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5265 if $test X"$prefix" != X"$installprefix"; then
5266         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5267 else
5268         installbin="$binexp"
5269 fi
5270
5271 $cat <<EOM
5272
5273 After $package is installed, you may wish to install various
5274 add-on modules and utilities.  Typically, these add-ons will
5275 be installed under $prefix with the rest
5276 of this package.  However, you may wish to install such add-ons
5277 elsewhere under a different prefix.
5278
5279 If you do not wish to put everything under a single prefix, that's
5280 ok.  You will be prompted for the individual locations; this siteprefix
5281 is only used to suggest the defaults.
5282
5283 The default should be fine for most people.
5284
5285 EOM
5286 fn=d~+
5287 rp='Installation prefix to use for add-on modules and utilities?'
5288 : XXX Here might be another good place for an installstyle setting.
5289 case "$siteprefix" in
5290 '') dflt=$prefix ;;
5291 *)  dflt=$siteprefix ;;
5292 esac
5293 . ./getfile
5294 oldsiteprefix=''
5295 case "$siteprefix" in
5296 '') ;;
5297 *)
5298         case "$ans" in
5299         "$prefix") ;;
5300         *) oldsiteprefix="$prefix";;
5301         esac
5302         ;;
5303 esac
5304 siteprefix="$ans"
5305 siteprefixexp="$ansexp"
5306
5307 : determine where site specific libraries go.
5308 : Usual default is /usr/local/lib/perl5/site_perl/$version
5309 : The default "style" setting is made in installstyle.U
5310 : XXX No longer works with Prefixit stuff.
5311 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5312 case "$installstyle" in
5313 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5314 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5315 esac
5316 $cat <<EOM
5317
5318 The installation process will create a directory for
5319 site-specific extensions and modules.  Most users find it convenient
5320 to place all site-specific files in this directory rather than in the
5321 main distribution directory.
5322
5323 EOM
5324 fn=d~+
5325 rp='Pathname for the site-specific library files?'
5326 . ./getfile
5327 sitelib="$ans"
5328 sitelibexp="$ansexp"
5329 : Change installation prefix, if necessary.
5330 if $test X"$prefix" != X"$installprefix"; then
5331         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5332 else
5333         installsitelib="$sitelibexp"
5334 fi
5335
5336 : Determine list of previous versions to include in @INC
5337 $cat > getverlist <<EOPL
5338 #!$perl -w
5339 use File::Basename;
5340 \$api_versionstring = "$api_versionstring";
5341 \$version = "$version";
5342 \$sitelib = "$sitelib";
5343 \$archname = "$archname";
5344 EOPL
5345         $cat >> getverlist <<'EOPL'
5346 # Can't have leading @ because metaconfig interprets it as a command!
5347 ;@inc_version_list=();
5348 $stem=dirname($sitelib);
5349 # Redo to do opendir/readdir? 
5350 if (-d $stem) {
5351     chdir($stem);
5352     ;@candidates = glob("5.*");
5353 }
5354 else {
5355     ;@candidates = ();
5356 }
5357
5358 # XXX ToDo:  These comparisons must be reworked when two-digit
5359 # subversions come along, so that 5.7.10 compares as greater than
5360 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5361 # widespread that we can use the built-in version vectors rather
5362 # than reinventing them here.  For 5.6.0, however, we must
5363 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5364 foreach $d (@candidates) {
5365     if ($d lt $version) {
5366         if ($d ge $api_versionstring) {
5367             unshift(@inc_version_list, "$d/$archname", $d);
5368         }
5369         elsif ($d ge "5.005") {
5370             unshift(@inc_version_list, $d);
5371         }
5372     }
5373     else {
5374         # Skip newer version.  I.e. don't look in
5375         # 5.7.0 if we're installing 5.6.1.
5376     }
5377 }
5378
5379 if (@inc_version_list) {
5380     print '"';
5381     print join('", "', @inc_version_list);
5382     print '"';
5383 }
5384 else {
5385     # Blank space to preserve value for next Configure run.
5386     print " ";
5387 }
5388 EOPL
5389 chmod +x getverlist
5390 case "$inc_version_list" in
5391 '')     if test -x $perl; then
5392                 dflt=`$perl getverlist`
5393         else
5394                 dflt=''
5395         fi
5396         ;;
5397 *)  dflt="$inc_version_list" ;;
5398 esac
5399 $cat <<'EOM'
5400
5401 In order to ease the process of upgrading, this version of perl 
5402 can be configured to use modules built and installed with earlier 
5403 versions of perl that were installed under $prefix.  Specify here
5404 the list of earlier versions that this version of perl should check.
5405 If Configure detected no earlier versions of perl installed under
5406 $prefix, then the list will be empty.
5407
5408 The default should almost always be sensible, so if you're not sure,
5409 just accept the default.
5410 EOM
5411
5412 rp='list of earlier versions to include in @INC?'
5413 . ./myread
5414 inc_version_list="$ans"
5415 $rm -f getverlist
5416
5417 : determine whether to install perl also as /usr/bin/perl
5418
5419 echo " "
5420 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5421         $cat <<EOM
5422 Many scripts expect to perl to be installed as /usr/bin/perl.
5423 I can install the perl you are about to compile also as /usr/bin/perl
5424 (in addition to $installbin/perl).
5425 EOM
5426         case "$installusrbinperl" in
5427         "$undef"|[nN]*) dflt='n';;
5428         *)              dflt='y';;
5429         esac
5430         rp="Do you want to install perl as /usr/bin/perl?"
5431         . ./myread
5432         case "$ans" in
5433         [yY]*)  val="$define";;
5434         *)      val="$undef" ;;
5435         esac
5436 else
5437         val="$undef"
5438 fi
5439 set installusrbinperl
5440 eval $setvar
5441
5442 echo " "
5443 echo "Checking for GNU C Library..." >&4
5444 cat >gnulibc.c <<EOM
5445 #include <stdio.h>
5446 int main()
5447 {
5448 #ifdef __GLIBC__
5449     exit(0);
5450 #else
5451     exit(1);
5452 #endif
5453 }
5454 EOM
5455 set gnulibc
5456 if eval $compile_ok && ./gnulibc; then
5457         val="$define"
5458         echo "You are using the GNU C Library"
5459 else
5460         val="$undef"
5461         echo "You are not using the GNU C Library"
5462 fi
5463 $rm -f gnulibc*
5464 set d_gnulibc
5465 eval $setvar
5466
5467 : see if nm is to be used to determine whether a symbol is defined or not
5468 case "$usenm" in
5469 '')
5470         dflt=''
5471         case "$d_gnulibc" in
5472         "$define")
5473                 echo " "
5474                 echo "nm probably won't work on the GNU C Library." >&4
5475                 dflt=n
5476                 ;;
5477         esac
5478         case "$dflt" in
5479         '') 
5480                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5481                         echo " "
5482                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5483                         echo "'nm' won't be sufficient on this sytem." >&4
5484                         dflt=n
5485                 fi
5486                 ;;
5487         esac
5488         case "$dflt" in
5489         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5490                 if $test $dflt -gt 20; then
5491                         dflt=y
5492                 else
5493                         dflt=n
5494                 fi
5495                 ;;
5496         esac
5497         ;;
5498 *)
5499         case "$usenm" in
5500         true|$define) dflt=y;;
5501         *) dflt=n;;
5502         esac
5503         ;;
5504 esac
5505 $cat <<EOM
5506
5507 I can use $nm to extract the symbols from your C libraries. This
5508 is a time consuming task which may generate huge output on the disk (up
5509 to 3 megabytes) but that should make the symbols extraction faster. The
5510 alternative is to skip the 'nm' extraction part and to compile a small
5511 test program instead to determine whether each symbol is present. If
5512 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5513 this may be the best solution.
5514
5515 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5516
5517 EOM
5518 rp="Shall I use $nm to extract C symbols from the libraries?"
5519 . ./myread
5520 case "$ans" in
5521 [Nn]*) usenm=false;;
5522 *) usenm=true;;
5523 esac
5524
5525 runnm=$usenm
5526 case "$reuseval" in
5527 true) runnm=false;;
5528 esac
5529
5530 : nm options which may be necessary
5531 case "$nm_opt" in
5532 '') if $test -f /mach_boot; then
5533                 nm_opt=''       # Mach
5534         elif $test -d /usr/ccs/lib; then
5535                 nm_opt='-p'     # Solaris (and SunOS?)
5536         elif $test -f /dgux; then
5537                 nm_opt='-p'     # DG-UX
5538         elif $test -f /lib64/rld; then
5539                 nm_opt='-p'     # 64-bit Irix
5540         else
5541                 nm_opt=''
5542         fi;;
5543 esac
5544
5545 : nm options which may be necessary for shared libraries but illegal
5546 : for archive libraries.  Thank you, Linux.
5547 case "$nm_so_opt" in
5548 '')     case "$myuname" in
5549         *linux*)
5550                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5551                         nm_so_opt='--dynamic'
5552                 fi
5553                 ;;
5554         esac
5555         ;;
5556 esac
5557
5558 case "$runnm" in
5559 true)
5560 : get list of predefined functions in a handy place
5561 echo " "
5562 case "$libc" in
5563 '') libc=unknown
5564         case "$libs" in
5565         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5566         esac
5567         ;;
5568 esac
5569 libnames='';
5570 case "$libs" in
5571 '') ;;
5572 *)  for thislib in $libs; do
5573         case "$thislib" in
5574         -lc|-lc_s)
5575                 : Handle C library specially below.
5576                 ;;
5577         -l*)
5578                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5579                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5580                         :
5581                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5582                         :
5583                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5584                         :
5585                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5586                         :
5587                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5588                         :
5589                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5590                         :
5591                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5592                         :
5593                 else
5594                         try=''
5595                 fi
5596                 libnames="$libnames $try"
5597                 ;;
5598         *) libnames="$libnames $thislib" ;;
5599         esac
5600         done
5601         ;;
5602 esac
5603 xxx=normal
5604 case "$libc" in
5605 unknown)
5606         set /lib/libc.$so
5607         for xxx in $libpth; do
5608                 $test -r $1 || set $xxx/libc.$so
5609                 : The messy sed command sorts on library version numbers.
5610                 $test -r $1 || \
5611                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5612                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5613                                 h
5614                                 s/[0-9][0-9]*/0000&/g
5615                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5616                                 G
5617                                 s/\n/ /' | \
5618                          sort | $sed -e 's/^.* //'`
5619                 eval set \$$#
5620         done
5621         $test -r $1 || set /usr/ccs/lib/libc.$so
5622         $test -r $1 || set /lib/libsys_s$_a
5623         ;;
5624 *)
5625         set blurfl
5626         ;;
5627 esac
5628 if $test -r "$1"; then
5629         echo "Your (shared) C library seems to be in $1."
5630         libc="$1"
5631 elif $test -r /lib/libc && $test -r /lib/clib; then
5632         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5633         xxx=apollo
5634         libc='/lib/clib /lib/libc'
5635         if $test -r /lib/syslib; then
5636                 echo "(Your math library is in /lib/syslib.)"
5637                 libc="$libc /lib/syslib"
5638         fi
5639 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5640         echo "Your C library seems to be in $libc, as you said before."
5641 elif $test -r $incpath/usr/lib/libc$_a; then
5642         libc=$incpath/usr/lib/libc$_a;
5643         echo "Your C library seems to be in $libc.  That's fine."
5644 elif $test -r /lib/libc$_a; then
5645         libc=/lib/libc$_a;
5646         echo "Your C library seems to be in $libc.  You're normal."
5647 else
5648         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5649                 :
5650         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5651                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5652         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5653                 :
5654         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5655                 :
5656         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5657                 :
5658         else
5659                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5660         fi
5661         if $test -r "$tans"; then
5662                 echo "Your C library seems to be in $tans, of all places."
5663                 libc=$tans
5664         else
5665                 libc='blurfl'
5666         fi
5667 fi
5668 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5669         dflt="$libc"
5670         cat <<EOM
5671
5672 If the guess above is wrong (which it might be if you're using a strange
5673 compiler, or your machine supports multiple models), you can override it here.
5674
5675 EOM
5676 else
5677         dflt=''
5678         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5679         cat >&4 <<EOM
5680 I can't seem to find your C library.  I've looked in the following places:
5681
5682 EOM
5683         $sed 's/^/      /' libpath
5684         cat <<EOM
5685
5686 None of these seems to contain your C library. I need to get its name...
5687
5688 EOM
5689 fi
5690 fn=f
5691 rp='Where is your C library?'
5692 . ./getfile
5693 libc="$ans"
5694
5695 echo " "
5696 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5697 set X `cat libnames`
5698 shift
5699 xxx=files
5700 case $# in 1) xxx=file; esac
5701 echo "Extracting names from the following $xxx for later perusal:" >&4
5702 echo " "
5703 $sed 's/^/      /' libnames >&4
5704 echo " "
5705 $echo $n "This may take a while...$c" >&4
5706
5707 for file in $*; do
5708         case $file in
5709         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5710         *) $nm $nm_opt $file 2>/dev/null;;
5711         esac
5712 done >libc.tmp
5713
5714 $echo $n ".$c"
5715 $grep fprintf libc.tmp > libc.ptf
5716 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5717 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5718 xxx='[ADTSIW]'
5719 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5720         eval $xscan;\
5721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722                 eval $xrun
5723 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5724         eval $xscan;\
5725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5726                 eval $xrun
5727 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5728         eval $xscan;\
5729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5730                 eval $xrun
5731 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5732         eval $xscan;\
5733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734                 eval $xrun
5735 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5736         eval $xscan;\
5737         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5738                 eval $xrun
5739 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5740         eval $xscan;\
5741         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5742                 eval $xrun
5743 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5744                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5745         eval $xscan;\
5746         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747                 eval $xrun
5748 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5749         eval $xscan;\
5750         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751                 eval $xrun
5752 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5753         eval $xscan;\
5754         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755                 eval $xrun
5756 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5757         eval $xscan;\
5758         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5759                 eval $xrun
5760 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5761         eval $xscan;\
5762         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5763                 eval $xrun
5764 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5765         eval $xscan;\
5766         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5767                 eval $xrun
5768 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5769         eval $xscan;\
5770         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5771                 eval $xrun
5772 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5773         eval $xscan;\
5774         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5775                 eval $xrun
5776 else
5777         $nm -p $* 2>/dev/null >libc.tmp
5778         $grep fprintf libc.tmp > libc.ptf
5779         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5780                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5781         then
5782                 nm_opt='-p'
5783                 eval $xrun
5784         else
5785                 echo " "
5786                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5787                 com=''
5788                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5789                         for thisname in $libnames $libc; do
5790                                 $ar t $thisname >>libc.tmp
5791                         done
5792                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5793                         echo "Ok." >&4
5794                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5795                         # Repeat libc to extract forwarders to DLL entries too
5796                         for thisname in $libnames $libc; do
5797                                 $ar tv $thisname >>libc.tmp
5798                                 # Revision 50 of EMX has bug in $ar.
5799                                 # it will not extract forwarders to DLL entries
5800                                 # Use emximp which will extract exactly them.
5801                                 emximp -o tmp.imp $thisname \
5802                                     2>/dev/null && \
5803                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5804                                     < tmp.imp >>libc.tmp
5805                                 $rm tmp.imp
5806                         done
5807                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5808                         echo "Ok." >&4
5809                 else
5810                         echo "$ar didn't seem to work right." >&4
5811                         echo "Maybe this is a Cray...trying bld instead..." >&4
5812                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5813                         then
5814                                 for thisname in $libnames; do
5815                                         bld t $libnames | \
5816                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5817                                         $ar t $thisname >>libc.tmp
5818                                 done
5819                                 echo "Ok." >&4
5820                         else
5821                                 echo "That didn't work either.  Giving up." >&4
5822                                 exit 1
5823                         fi
5824                 fi
5825         fi
5826 fi
5827 nm_extract="$com"
5828 if $test -f /lib/syscalls.exp; then
5829         echo " "
5830         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5831         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5832 fi
5833 ;;
5834 esac
5835 $rm -f libnames libpath
5836
5837 : see if dld is available
5838 set dld.h i_dld
5839 eval $inhdr
5840
5841 : is a C symbol defined?
5842 csym='tlook=$1;
5843 case "$3" in
5844 -v) tf=libc.tmp; tc=""; tdc="";;
5845 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5846 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5847 esac;
5848 tx=yes;
5849 case "$reuseval-$4" in
5850 true-) ;;
5851 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5852 esac;
5853 case "$tx" in
5854 yes)
5855         case "$runnm" in
5856         true)
5857                 if $contains $tlook $tf >/dev/null 2>&1;
5858                 then tval=true;
5859                 else tval=false;
5860                 fi;;
5861         *)
5862                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5863                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5864                 then tval=true;
5865                 else tval=false;
5866                 fi;
5867                 $rm -f t t.c;;
5868         esac;;
5869 *)
5870         case "$tval" in
5871         $define) tval=true;;
5872         *) tval=false;;
5873         esac;;
5874 esac;
5875 eval "$2=$tval"'
5876
5877 : define an is-in-libc? function
5878 inlibc='echo " "; td=$define; tu=$undef;
5879 sym=$1; var=$2; eval "was=\$$2";
5880 tx=yes;
5881 case "$reuseval$was" in
5882 true) ;;
5883 true*) tx=no;;
5884 esac;
5885 case "$tx" in
5886 yes)
5887         set $sym tres -f;
5888         eval $csym;
5889         case "$tres" in
5890         true)
5891                 echo "$sym() found." >&4;
5892                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5893         *)
5894                 echo "$sym() NOT found." >&4;
5895                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5896         esac;;
5897 *)
5898         case "$was" in
5899         $define) echo "$sym() found." >&4;;
5900         *) echo "$sym() NOT found." >&4;;
5901         esac;;
5902 esac'
5903
5904 : see if dlopen exists
5905 xxx_runnm="$runnm"
5906 runnm=false
5907 set dlopen d_dlopen
5908 eval $inlibc
5909 runnm="$xxx_runnm"
5910
5911 : determine which dynamic loading, if any, to compile in
5912 echo " "
5913 dldir="ext/DynaLoader"
5914 case "$usedl" in
5915 $define|y|true)
5916         dflt='y'
5917         usedl="$define"
5918         ;;
5919 $undef|n|false)
5920         dflt='n'
5921         usedl="$undef"
5922         ;;
5923 *) 
5924         dflt='n'
5925         case "$d_dlopen" in
5926             $define) dflt='y' ;;
5927         esac
5928         case "$i_dld" in
5929             $define) dflt='y' ;;
5930         esac
5931         : Does a dl_xxx.xs file exist for this operating system
5932         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5933         ;;
5934 esac
5935 rp="Do you wish to use dynamic loading?"
5936 . ./myread
5937 usedl="$ans"
5938 case "$ans" in
5939 y*) usedl="$define"
5940         case "$dlsrc" in
5941         '')
5942                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5943                         dflt="$dldir/dl_${osname}.xs"
5944                 elif $test "$d_dlopen" = "$define" ; then
5945                         dflt="$dldir/dl_dlopen.xs"
5946                 elif $test "$i_dld" = "$define" ; then
5947                         dflt="$dldir/dl_dld.xs"
5948                 else
5949                         dflt=''
5950                 fi
5951                 ;;
5952         *)      dflt="$dldir/$dlsrc"
5953                 ;;
5954         esac
5955     echo "The following dynamic loading files are available:"
5956         : Can not go over to $dldir because getfile has path hard-coded in.
5957         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5958         rp="Source file to use for dynamic loading"
5959         fn="fne"
5960         gfpth="$src"
5961         . ./getfile
5962         usedl="$define"
5963         : emulate basename
5964         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5965
5966         $cat << EOM
5967
5968 Some systems may require passing special flags to $cc -c to
5969 compile modules that will be used to create a shared library.
5970 To use no flags, say "none".
5971
5972 EOM
5973     case "$cccdlflags" in
5974     '') case "$gccversion" in
5975                 '') case "$osname" in
5976                         hpux)   dflt='+z' ;;
5977                         next)   dflt='none' ;;
5978                         irix*)  dflt='-KPIC' ;;
5979                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5980                         sunos)  dflt='-pic' ;;
5981                         *)      dflt='none' ;;
5982                     esac
5983                         ;;
5984                 *)  case "$osname" in
5985                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5986                         *)      dflt='-fpic' ;;
5987                     esac ;;
5988             esac ;;
5989         ' ') dflt='none' ;;
5990     *)  dflt="$cccdlflags" ;;
5991     esac
5992     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5993     . ./myread
5994     case "$ans" in
5995     none) cccdlflags=' ' ;;
5996     *) cccdlflags="$ans" ;;
5997     esac
5998
5999     cat << EOM
6000
6001 Some systems use ld to create libraries that can be dynamically loaded,
6002 while other systems (such as those using ELF) use $cc.
6003
6004 EOM
6005         case "$ld" in
6006         '')     $cat >try.c <<'EOM'
6007 /* Test for whether ELF binaries are produced */
6008 #include <fcntl.h>
6009 #include <stdlib.h>
6010 int main() {
6011         char b[4];
6012         int i = open("a.out",O_RDONLY);
6013         if(i == -1) 
6014                 exit(1); /* fail */
6015         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6016                 exit(0); /* succeed (yes, it's ELF) */
6017         else
6018                 exit(1); /* fail */
6019 }
6020 EOM
6021                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6022                         cat <<EOM
6023 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6024 EOM
6025                         dflt="$cc"
6026                 else
6027                         echo "I'll use ld to build dynamic libraries."
6028                         dflt='ld'
6029                 fi
6030                 rm -f try.c a.out
6031                 ;;
6032         *)      dflt="$ld"
6033                 ;;
6034         esac
6035
6036     rp="What command should be used to create dynamic libraries?"
6037     . ./myread
6038         ld="$ans"
6039
6040     cat << EOM
6041
6042 Some systems may require passing special flags to $ld to create a
6043 library that can be dynamically loaded.  If your ld flags include
6044 -L/other/path options to locate libraries outside your loader's normal
6045 search path, you may need to specify those -L options here as well.  To
6046 use no flags, say "none".
6047
6048 EOM
6049     case "$lddlflags" in
6050     '') case "$osname" in
6051                         beos) dflt='-nostart' ;;
6052                         hpux)  dflt='-b' ;;
6053                         linux|irix*)    dflt='-shared' ;;
6054                         next)  dflt='none' ;;
6055                         solaris) dflt='-G' ;;
6056                         sunos) dflt='-assert nodefinitions' ;;
6057                         svr4*|esix*) dflt="-G $ldflags" ;;
6058                 *)     dflt='none' ;;
6059                         esac
6060                         ;;
6061     *) dflt="$lddlflags" ;;
6062     esac
6063
6064         : Try to guess additional flags to pick up local libraries.
6065         : Be careful not to append to a plain 'none'
6066         case "$dflt" in
6067         none) dflt='' ;;
6068         esac
6069         for thisflag in $ldflags; do
6070                 case "$thisflag" in
6071                 -L*)
6072                         case " $dflt " in
6073                         *" $thisflag "*) ;;
6074                         *) dflt="$dflt $thisflag" ;;
6075                         esac
6076                         ;;
6077                 esac
6078         done
6079
6080         case "$dflt" in
6081         ''|' ') dflt='none' ;;
6082         esac
6083
6084     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6085     . ./myread
6086     case "$ans" in
6087     none) lddlflags=' ' ;;
6088     *) lddlflags="$ans" ;;
6089     esac
6090
6091         cat <<EOM
6092
6093 Some systems may require passing special flags to $cc to indicate that
6094 the resulting executable will use dynamic linking.  To use no flags,
6095 say "none".
6096
6097 EOM
6098     case "$ccdlflags" in
6099     '') case "$osname" in
6100                 hpux)   dflt='-Wl,-E' ;;
6101                 linux)  dflt='-rdynamic' ;;
6102                 next)   dflt='none' ;;
6103                 sunos)  dflt='none' ;;
6104                 *)      dflt='none' ;;
6105             esac ;;
6106     ' ')  dflt='none' ;;
6107     *)  dflt="$ccdlflags" ;;
6108     esac
6109     rp="Any special flags to pass to $cc to use dynamic loading?"
6110     . ./myread
6111     case "$ans" in
6112     none) ccdlflags=' ' ;;
6113     *) ccdlflags="$ans" ;;
6114     esac
6115     ;;
6116 *)  usedl="$undef"
6117         ld='ld'
6118     dlsrc='dl_none.xs'
6119     lddlflags=''
6120     ccdlflags=''
6121     ;;
6122 esac
6123
6124 also=''
6125 case "$usedl" in
6126 $undef)
6127         # No dynamic loading being used, so don't bother even to prompt.
6128         useshrplib='false'
6129         ;;
6130 *)      case "$useshrplib" in
6131         '')     case "$osname" in
6132                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6133                         dflt=y
6134                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6135                         ;;
6136                 next*)
6137                         case "$osvers" in
6138                         4*)     dflt=y
6139                                 also='Building a shared libperl is needed for MAB support.'
6140                                 ;;
6141                         *)      dflt=n
6142                                 ;;
6143                         esac
6144                         ;;
6145                 *)      dflt=n
6146                         ;;
6147                 esac
6148                 ;;
6149         $define|true|[Yy]*)
6150                 dflt=y
6151                 ;;
6152         *)      dflt=n
6153                 ;;
6154         esac
6155         $cat << EOM
6156
6157 The perl executable is normally obtained by linking perlmain.c with
6158 libperl${_a}, any static extensions (usually just DynaLoader), and
6159 any other libraries needed on this system (such as -lm, etc.).  Since
6160 your system supports dynamic loading, it is probably possible to build
6161 a shared libperl.$so.  If you will have more than one executable linked
6162 to libperl.$so, this will significantly reduce the size of each
6163 executable, but it may have a noticeable affect on performance.  The
6164 default is probably sensible for your system.
6165 $also
6166
6167 EOM
6168         rp="Build a shared libperl.$so (y/n)"
6169         . ./myread
6170         case "$ans" in
6171         true|$define|[Yy]*)
6172                 useshrplib='true'  ;;
6173         *)      useshrplib='false' ;;
6174         esac
6175         ;;
6176 esac
6177
6178 case "$useshrplib" in
6179 true)
6180         case "$libperl" in
6181         '')
6182                 # Figure out a good name for libperl.so.  Since it gets stored in
6183                 # a version-specific architecture-dependent library, the version
6184                 # number isn't really that important, except for making cc/ld happy.
6185                 #
6186                 # A name such as libperl.so.3.1
6187                 majmin="libperl.$so.$patchlevel.$subversion"
6188                 # A name such as libperl.so.301
6189                 majonly=`echo $patchlevel $subversion |
6190                         $awk '{printf "%d%02d", $1, $2}'`
6191                 majonly=libperl.$so.$majonly
6192                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6193                 # rely on figuring it out from the naming of libc.
6194                 case "${osname}${osvers}" in
6195                 next4*)
6196                         dflt=libperl.5.$so
6197                         # XXX How handle the --version stuff for MAB?
6198                         ;;
6199                 linux*)  # ld won't link with a bare -lperl otherwise.
6200                         dflt=libperl.$so
6201                         ;;
6202                 cygwin*) # include version
6203                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6204                         ;;
6205                 *)      # Try to guess based on whether libc has major.minor.
6206                         case "$libc" in
6207                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6208                         *libc.$so.[0-9]*) dflt=$majonly ;;
6209                         *)      dflt=libperl.$so ;;
6210                         esac
6211                         ;;
6212                 esac
6213                 ;;
6214         *)      dflt=$libperl
6215                 ;;
6216         esac
6217         cat << EOM
6218
6219 I need to select a good name for the shared libperl.  If your system uses
6220 library names with major and minor numbers, then you might want something
6221 like $majmin.  Alternatively, if your system uses a single version
6222 number for shared libraries, then you might want to use $majonly.
6223 Or, your system might be quite happy with a simple libperl.$so.
6224
6225 Since the shared libperl will get installed into a version-specific
6226 architecture-dependent directory, the version number of the shared perl
6227 library probably isn't important, so the default should be o.k.
6228
6229 EOM
6230         rp='What name do you want to give to the shared libperl?'
6231         . ./myread
6232         libperl=$ans
6233         echo "Ok, I'll use $libperl"
6234         ;;
6235 *)
6236         libperl="libperl${_a}"
6237         ;;
6238 esac
6239
6240 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6241 case "$shrpdir" in
6242 '') ;;
6243 *)      $cat >&4 <<EOM
6244 WARNING:  Use of the shrpdir variable for the installation location of
6245 the shared $libperl is not supported.  It was never documented and
6246 will not work in this version.  Let me (perlbug@perl.com)
6247 know of any problems this may cause.
6248
6249 EOM
6250         case "$shrpdir" in
6251         "$archlibexp/CORE")
6252                 $cat >&4 <<EOM
6253 But your current setting of $shrpdir is
6254 the default anyway, so it's harmless.
6255 EOM
6256                 ;;
6257         *)
6258                 $cat >&4 <<EOM
6259 Further, your current attempted setting of $shrpdir
6260 conflicts with the value of $archlibexp/CORE
6261 that installperl will use.
6262 EOM
6263                 ;;
6264         esac
6265         ;;
6266 esac
6267
6268 # How will the perl executable find the installed shared $libperl?
6269 # Add $xxx to ccdlflags.
6270 # If we can't figure out a command-line option, use $shrpenv to
6271 # set env LD_RUN_PATH.  The main perl makefile uses this.
6272 shrpdir=$archlibexp/CORE
6273 xxx=''
6274 tmp_shrpenv=''
6275 if "$useshrplib"; then
6276     case "$osname" in 
6277         aix)
6278                 # We'll set it in Makefile.SH...
6279                 ;;
6280         solaris|netbsd)
6281                 xxx="-R $shrpdir"
6282                 ;;
6283         freebsd)
6284                 xxx="-Wl,-R$shrpdir"
6285                 ;;
6286         linux|irix*|dec_osf)
6287                 xxx="-Wl,-rpath,$shrpdir"
6288                 ;;
6289         next)
6290                 # next doesn't like the default...
6291                 ;;
6292         beos)
6293                 # beos doesn't like the default, either.
6294                 ;;
6295         hpux*)
6296                 # hpux doesn't like the default, either.
6297                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6298                 ;;
6299         *)
6300                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6301                 ;;
6302         esac
6303         case "$xxx" in
6304         '') ;;
6305         *)      
6306                 # Only add $xxx if it isn't already in ccdlflags.
6307                 case " $ccdlflags " in
6308                 *" $xxx "*)     ;;
6309                 *)      ccdlflags="$ccdlflags $xxx"
6310                         cat <<EOM >&4
6311
6312 Adding $xxx to the flags
6313 passed to $ld so that the perl executable will find the 
6314 installed shared $libperl.
6315
6316 EOM
6317                         ;;
6318                 esac
6319                 ;;
6320         esac
6321 fi
6322 # Fix ccdlflags in AIX for building external extensions.
6323 # (For building Perl itself bare -bE:perl.exp is needed,
6324 #  Makefile.SH takes care of this.)
6325 case "$osname" in
6326 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6327 esac
6328 # Respect a hint or command-line value.
6329 case "$shrpenv" in
6330 '') shrpenv="$tmp_shrpenv" ;;
6331 esac
6332 case "$ldlibpthname" in
6333 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6334 none)   ldlibpthname='' ;;
6335 esac
6336
6337 : determine where manual pages go
6338 set man1dir man1dir none
6339 eval $prefixit
6340 $cat <<EOM
6341
6342 $spackage has manual pages available in source form.
6343 EOM
6344 case "$nroff" in
6345 nroff)
6346         echo "However, you don't have nroff, so they're probably useless to you."
6347         case "$man1dir" in
6348         '') man1dir="none";;
6349         esac;;
6350 esac
6351 echo "If you don't want the manual sources installed, answer 'none'."
6352 case "$man1dir" in
6353 ' ') dflt=none
6354         ;;
6355 '')
6356         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6357         lookpath="$lookpath $prefixexp/man/p_man/man1"
6358         lookpath="$lookpath $prefixexp/man/u_man/man1"
6359         lookpath="$lookpath $prefixexp/man/man.1"
6360         case "$sysman" in
6361         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6362         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6363         esac
6364         set dflt
6365         eval $prefixup
6366         ;;
6367 *)  dflt="$man1dir"
6368         ;;
6369 esac
6370 echo " "
6371 fn=dn+~
6372 rp="Where do the main $spackage manual pages (source) go?"
6373 . ./getfile
6374 if $test "X$man1direxp" != "X$ansexp"; then
6375         installman1dir=''
6376 fi
6377 man1dir="$ans"
6378 man1direxp="$ansexp"
6379 case "$man1dir" in
6380 '')     man1dir=' '
6381         installman1dir='';;
6382 esac
6383
6384 : Change installation prefix, if necessary.
6385 if $test X"$prefix" != X"$installprefix"; then
6386         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6387 else
6388         installman1dir="$man1direxp"
6389 fi
6390
6391 : What suffix to use on installed man pages
6392
6393 case "$man1dir" in
6394 ' ')
6395         man1ext='0'
6396         ;;
6397 *)
6398         rp="What suffix should be used for the main $spackage man pages?"
6399         case "$man1ext" in
6400         '')     case "$man1dir" in
6401                 *1)  dflt=1 ;;
6402                 *1p) dflt=1p ;;
6403                 *1pm) dflt=1pm ;;
6404                 *l) dflt=l;;
6405                 *n) dflt=n;;
6406                 *o) dflt=o;;
6407                 *p) dflt=p;;
6408                 *C) dflt=C;;
6409                 *L) dflt=L;;
6410                 *L1) dflt=L1;;
6411                 *) dflt=1;;
6412                 esac
6413                 ;;
6414         *)      dflt="$man1ext";;
6415         esac
6416         . ./myread
6417         man1ext="$ans"
6418         ;;
6419 esac
6420
6421 : see if we can have long filenames
6422 echo " "
6423 rmlist="$rmlist /tmp/cf$$"
6424 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6425 first=123456789abcdef
6426 second=/tmp/cf$$/$first
6427 $rm -f $first $second
6428 if (echo hi >$first) 2>/dev/null; then
6429         if $test -f 123456789abcde; then
6430                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6431                 val="$undef"
6432         else
6433                 if (echo hi >$second) 2>/dev/null; then
6434                         if $test -f /tmp/cf$$/123456789abcde; then
6435                                 $cat <<'EOM'
6436 That's peculiar... You can have filenames longer than 14 characters, but only
6437 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6438 I shall consider your system cannot support long filenames at all.
6439 EOM
6440                                 val="$undef"
6441                         else
6442                                 echo 'You can have filenames longer than 14 characters.' >&4
6443                                 val="$define"
6444                         fi
6445                 else
6446                         $cat <<'EOM'
6447 How confusing! Some of your filesystems are sane enough to allow filenames
6448 longer than 14 characters but some others like /tmp can't even think about them.
6449 So, for now on, I shall assume your kernel does not allow them at all.
6450 EOM
6451                         val="$undef"
6452                 fi
6453         fi
6454 else
6455         $cat <<'EOM'
6456 You can't have filenames longer than 14 chars.  You can't even think about them!
6457 EOM
6458         val="$undef"
6459 fi 
6460 set d_flexfnam
6461 eval $setvar
6462 $rm -rf /tmp/cf$$ 123456789abcde*
6463
6464 : determine where library module manual pages go
6465 set man3dir man3dir none
6466 eval $prefixit
6467 $cat <<EOM
6468
6469 $spackage has manual pages for many of the library modules.
6470 EOM
6471
6472 case "$nroff" in
6473 nroff)
6474         $cat <<'EOM'
6475 However, you don't have nroff, so they're probably useless to you.
6476 EOM
6477         case "$man3dir" in
6478         '') man3dir="none";;
6479         esac;;
6480 esac
6481
6482 case "$d_flexfnam" in
6483 undef)
6484         $cat <<'EOM'
6485 However, your system can't handle the long file names like File::Basename.3. 
6486 EOM
6487         case "$man3dir" in
6488         '') man3dir="none";;
6489         esac;;
6490 esac
6491
6492 echo "If you don't want the manual sources installed, answer 'none'."
6493 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6494 case "$man3dir" in
6495 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6496         if $test -d "$privlib/man/man3"; then
6497                 cat <<EOM >&4
6498
6499 WARNING:  Previous versions of perl installed man3 pages into
6500 $privlib/man/man3.  This version will suggest a 
6501 new default of $dflt.  
6502 EOM
6503                 tdflt=$dflt
6504                 dflt='n'
6505                 rp='Do you wish to preserve the old behavior?(y/n)'
6506                 . ./myread
6507                 case "$ans" in
6508                 y*) dflt="$privlib/man/man3" ;;
6509                 *)  dflt=$tdflt ;;
6510                 esac
6511     fi
6512         ;;
6513 ' ') dflt=none;;
6514 *)      dflt="$man3dir" ;;
6515 esac
6516 echo " "
6517 fn=dn+~
6518 rp="Where do the $package library man pages (source) go?"
6519 . ./getfile
6520 man3dir="$ans"
6521 man3direxp="$ansexp"
6522 case "$man1dir" in
6523 '')     man3dir=' '
6524         installman3dir='';;
6525 esac
6526
6527 : Change installation prefix, if necessary.
6528 if $test X"$prefix" != X"$installprefix"; then
6529         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6530 else
6531         installman3dir="$man3direxp"
6532 fi
6533
6534 : What suffix to use on installed man pages
6535 case "$man3dir" in
6536 ' ')
6537         man3ext='0'
6538         ;;
6539 *)
6540         rp="What suffix should be used for the $package library man pages?"
6541         case "$man3ext" in
6542         '')     case "$man3dir" in
6543                 *3)  dflt=3 ;;
6544                 *3p) dflt=3p ;;
6545                 *3pm) dflt=3pm ;;
6546                 *l) dflt=l;;
6547                 *n) dflt=n;;
6548                 *o) dflt=o;;
6549                 *p) dflt=p;;
6550                 *C) dflt=C;;
6551                 *L) dflt=L;;
6552                 *L3) dflt=L3;;
6553                 *) dflt=3;;
6554                 esac
6555                 ;;
6556         *)      dflt="$man3ext";;
6557         esac
6558         . ./myread
6559         man3ext="$ans"
6560         ;;
6561 esac
6562
6563 : see if we have to deal with yellow pages, now NIS.
6564 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6565         if $test -f /usr/etc/nibindd; then
6566                 echo " "
6567                 echo "I'm fairly confident you're on a NeXT."
6568                 echo " "
6569                 rp='Do you get the hosts file via NetInfo?'
6570                 dflt=y
6571                 case "$hostcat" in
6572                 nidump*) ;;
6573                 '') ;;
6574                 *) dflt=n;;
6575                 esac
6576                 . ./myread
6577                 case "$ans" in
6578                 y*) hostcat='nidump hosts .';;
6579                 *)      case "$hostcat" in
6580                         nidump*) hostcat='';;
6581                         esac
6582                         ;;
6583                 esac
6584         fi
6585         case "$hostcat" in
6586         nidump*) ;;
6587         *)
6588                 case "$hostcat" in
6589                 *ypcat*) dflt=y;;
6590                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6591                                 dflt=y
6592                         else
6593                                 dflt=n
6594                         fi;;
6595                 *) dflt=n;;
6596                 esac
6597                 echo " "
6598                 rp='Are you getting the hosts file via yellow pages?'
6599                 . ./myread
6600                 case "$ans" in
6601                 y*) hostcat='ypcat hosts';;
6602                 *) hostcat='cat /etc/hosts';;
6603                 esac
6604                 ;;
6605         esac
6606 fi
6607 case "$hostcat" in
6608 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6609 esac
6610 case "$groupcat" in
6611 '') test -f /etc/group && groupcat='cat /etc/group';;
6612 esac
6613 case "$passcat" in
6614 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6615 esac
6616
6617 : now get the host name
6618 echo " "
6619 echo "Figuring out host name..." >&4
6620 case "$myhostname" in
6621 '') cont=true
6622         echo 'Maybe "hostname" will work...'
6623         if tans=`sh -c hostname 2>&1` ; then
6624                 myhostname=$tans
6625                 phostname=hostname
6626                 cont=''
6627         fi
6628         ;;
6629 *) cont='';;
6630 esac
6631 if $test "$cont"; then
6632         if ./xenix; then
6633                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6634                 if tans=`cat /etc/systemid 2>&1` ; then
6635                         myhostname=$tans
6636                         phostname='cat /etc/systemid'
6637                         echo "Whadyaknow.  Xenix always was a bit strange..."
6638                         cont=''
6639                 fi
6640         elif $test -r /etc/systemid; then
6641                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6642         fi
6643 fi
6644 if $test "$cont"; then
6645         echo 'No, maybe "uuname -l" will work...'
6646         if tans=`sh -c 'uuname -l' 2>&1` ; then
6647                 myhostname=$tans
6648                 phostname='uuname -l'
6649         else
6650                 echo 'Strange.  Maybe "uname -n" will work...'
6651                 if tans=`sh -c 'uname -n' 2>&1` ; then
6652                         myhostname=$tans
6653                         phostname='uname -n'
6654                 else
6655                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6656                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6657                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6658                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6659                         else
6660                                 case "$myhostname" in
6661                                 '') echo "Does this machine have an identity crisis or something?"
6662                                         phostname='';;
6663                                 *)
6664                                         echo "Well, you said $myhostname before..."
6665                                         phostname='echo $myhostname';;
6666                                 esac
6667                         fi
6668                 fi
6669         fi
6670 fi
6671 : you do not want to know about this
6672 set $myhostname
6673 myhostname=$1
6674
6675 : verify guess
6676 if $test "$myhostname" ; then
6677         dflt=y
6678         rp='Your host name appears to be "'$myhostname'".'" Right?"
6679         . ./myread
6680         case "$ans" in
6681         y*) ;;
6682         *) myhostname='';;
6683         esac
6684 fi
6685
6686 : bad guess or no guess
6687 while $test "X$myhostname" = X ; do
6688         dflt=''
6689         rp="Please type the (one word) name of your host:"
6690         . ./myread
6691         myhostname="$ans"
6692 done
6693
6694 : translate upper to lower if necessary
6695 case "$myhostname" in
6696 *[A-Z]*)
6697         echo "(Normalizing case in your host name)"
6698         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6699         ;;
6700 esac
6701
6702 case "$myhostname" in
6703 *.*)
6704         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6705         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6706         echo "(Trimming domain name from host name--host name is now $myhostname)"
6707         ;;
6708 *) case "$mydomain" in
6709         '')
6710                 {
6711                         test "X$hostcat" = "Xypcat hosts" &&
6712                         ypmatch "$myhostname" hosts 2>/dev/null |\
6713                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6714                         $test -s hosts
6715                 } || {
6716                         test "X$hostcat" != "X" &&
6717                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6718                                         /[       ]$myhostname[  . ]/p" > hosts
6719                 }
6720                 tmp_re="[       . ]"
6721                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6722                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6723                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6724                         hosts | $sort | $uniq | \
6725                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6726                 case `$echo X$dflt` in
6727                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6728                         dflt=.
6729                         ;;
6730                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6731                         ;;
6732                 esac
6733                 case "$dflt" in
6734                 .)
6735                         tans=`./loc resolv.conf X /etc /usr/etc`
6736                         if $test -f "$tans"; then
6737                                 echo "(Attempting domain name extraction from $tans)"
6738                                 dflt=.`$sed -n -e 's/   / /g' \
6739                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6740                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6741                                 case "$dflt" in
6742                                 .) dflt=.`$sed -n -e 's/        / /g' \
6743                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6744                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6745                                         ;;
6746                                 esac
6747                         fi
6748                         ;;
6749                 esac
6750                 case "$dflt" in
6751                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6752                         dflt=.`sh -c domainname 2>/dev/null`
6753                         case "$dflt" in
6754                         '') dflt='.';;
6755                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6756                         esac
6757                         ;;
6758                 esac
6759                 case "$dflt" in
6760                 .) echo "(Lost all hope -- silly guess then)"
6761                         dflt='.uucp'
6762                         ;;
6763                 esac
6764                 $rm -f hosts
6765                 ;;
6766         *) dflt="$mydomain";;
6767         esac;;
6768 esac
6769 echo " "
6770 rp="What is your domain name?"
6771 . ./myread
6772 tans="$ans"
6773 case "$ans" in
6774 '') ;;
6775 .*) ;;
6776 *) tans=".$tans";;
6777 esac
6778 mydomain="$tans"
6779
6780 : translate upper to lower if necessary
6781 case "$mydomain" in
6782 *[A-Z]*)
6783         echo "(Normalizing case in your domain name)"
6784         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6785         ;;
6786 esac
6787
6788 : a little sanity check here
6789 case "$phostname" in
6790 '') ;;
6791 *)
6792         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6793         $myhostname$mydomain|$myhostname) ;;
6794         *)
6795                 case "$phostname" in
6796                 sed*)
6797                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6798                         ;;
6799                 *)
6800                         echo "(That doesn't agree with your $phostname command, by the way.)"
6801                         ;;
6802                 esac
6803         ;;
6804         esac
6805         ;;
6806 esac
6807
6808 $cat <<EOM
6809
6810 I need to get your e-mail address in Internet format if possible, i.e.
6811 something like user@host.domain. Please answer accurately since I have
6812 no easy means to double check it. The default value provided below
6813 is most probably close to the reality but may not be valid from outside
6814 your organization...
6815
6816 EOM
6817 cont=x
6818 while test "$cont"; do
6819         case "$cf_email" in
6820         '') dflt="$cf_by@$myhostname$mydomain";;
6821         *) dflt="$cf_email";;
6822         esac
6823         rp='What is your e-mail address?'
6824         . ./myread
6825         cf_email="$ans"
6826         case "$cf_email" in
6827         *@*.*) cont='' ;;
6828         *)
6829                 rp='Address does not look like an Internet one.  Use it anyway?'
6830                 case "$fastread" in
6831                 yes) dflt=y ;;
6832                 *) dflt=n ;;
6833                 esac
6834                 . ./myread
6835                 case "$ans" in
6836                 y*) cont='' ;;
6837                 *) echo " " ;;
6838                 esac
6839                 ;;
6840         esac
6841 done
6842
6843 $cat <<EOM
6844
6845 If you or somebody else will be maintaining perl at your site, please
6846 fill in the correct e-mail address here so that they may be contacted
6847 if necessary. Currently, the "perlbug" program included with perl
6848 will send mail to this address in addition to perlbug@perl.com. You may
6849 enter "none" for no administrator.
6850
6851 EOM
6852 case "$perladmin" in
6853 '') dflt="$cf_email";;
6854 *) dflt="$perladmin";;
6855 esac
6856 rp='Perl administrator e-mail address'
6857 . ./myread
6858 perladmin="$ans"
6859
6860 : figure out how to guarantee perl startup
6861 case "$startperl" in
6862 '')
6863         case "$sharpbang" in
6864         *!)
6865                 $cat <<EOH
6866
6867 I can use the #! construct to start perl on your system. This will
6868 make startup of perl scripts faster, but may cause problems if you
6869 want to share those scripts and perl is not in a standard place
6870 ($binexp/perl) on all your platforms. The alternative is to force
6871 a shell by starting the script with a single ':' character.
6872
6873 EOH
6874                 dflt="$binexp/perl"
6875                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6876                 . ./myread
6877                 case "$ans" in
6878                 none)   startperl=": # use perl";;
6879                 *)      startperl="#!$ans"
6880                         if $test 30 -lt `echo "$ans" | wc -c`; then
6881                                 $cat >&4 <<EOM
6882
6883 WARNING:  Some systems limit the #! command to 32 characters.
6884 If you experience difficulty running Perl scripts with #!, try
6885 installing Perl in a directory with a shorter pathname.
6886
6887 EOM
6888                         fi ;;
6889                 esac
6890                 ;;
6891         *) startperl=": # use perl"
6892                 ;;
6893         esac
6894         ;;
6895 esac
6896 echo "I'll use $startperl to start perl scripts."
6897
6898 : figure best path for perl in scripts
6899 case "$perlpath" in
6900 '')
6901         perlpath="$binexp/perl"
6902         case "$startperl" in
6903         *!*) ;;
6904         *)
6905                 $cat <<EOH
6906
6907 I will use the "eval 'exec'" idiom to start Perl on your system.
6908 I can use the full path of your Perl binary for this purpose, but
6909 doing so may cause problems if you want to share those scripts and
6910 Perl is not always in a standard place ($binexp/perl).
6911
6912 EOH
6913                 dflt="$binexp/perl"
6914                 rp="What path shall I use in \"eval 'exec'\"?"
6915                 . ./myread
6916                 perlpath="$ans"
6917                 ;;
6918         esac
6919         ;;
6920 esac
6921 case "$startperl" in
6922 *!*)    ;;
6923 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6924 esac
6925
6926 : determine where public executable scripts go
6927 set scriptdir scriptdir
6928 eval $prefixit
6929 case "$scriptdir" in
6930 '')
6931         dflt="$bin"
6932         : guess some guesses
6933         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6934         $test -d /usr/share/bin     && dflt=/usr/share/bin
6935         $test -d /usr/local/script  && dflt=/usr/local/script
6936         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6937         $test -d $prefixexp/script  && dflt=$prefixexp/script
6938         set dflt
6939         eval $prefixup
6940         ;;
6941 *)  dflt="$scriptdir"
6942         ;;
6943 esac
6944 $cat <<EOM
6945  
6946 Some installations have a separate directory just for executable scripts so
6947 that they can mount it across multiple architectures but keep the scripts in
6948 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6949 Or you might just lump your scripts in with all your other executables.
6950  
6951 EOM
6952 fn=d~
6953 rp='Where do you keep publicly executable scripts?'
6954 . ./getfile
6955 if $test "X$ansexp" != "X$scriptdirexp"; then
6956         installscript=''
6957 fi
6958 scriptdir="$ans"
6959 scriptdirexp="$ansexp"
6960 : Change installation prefix, if necessary.
6961 if $test X"$prefix" != X"$installprefix"; then
6962         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6963 else
6964         installscript="$scriptdirexp"
6965 fi
6966
6967 : determine where site specific architecture-dependent libraries go.
6968 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6969 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6970 : sitelib may have an optional trailing /share.
6971 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6972 tdflt="$tdflt/$archname"
6973 set sitearch sitearch none
6974 eval $prefixit
6975 case "$sitearch" in
6976 '')     dflt="$tdflt" ;;
6977 *)      dflt="$sitearch" ;;
6978 esac
6979 $cat <<EOM
6980
6981 The installation process will also create a directory for
6982 architecture-dependent site-specific extensions and modules.
6983
6984 EOM
6985 fn=nd~+
6986 rp='Pathname for the site-specific architecture-dependent library files?'
6987 . ./getfile
6988 sitearch="$ans"
6989 sitearchexp="$ansexp"
6990 : Change installation prefix, if necessary.
6991 if $test X"$prefix" != X"$installprefix"; then
6992         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6993 else
6994         installsitearch="$sitearchexp"
6995 fi
6996
6997 : determine where add-on public executables go
6998 case "$sitebin" in
6999 '')     dflt=$siteprefix/bin ;;
7000 *)      dflt=$sitebin ;;
7001 esac
7002 fn=d~
7003 rp='Pathname where the add-on public executables should be installed?'
7004 . ./getfile
7005 sitebin="$ans"
7006 sitebinexp="$ansexp"
7007 : Change installation prefix, if necessary.
7008 if $test X"$prefix" != X"$installprefix"; then
7009         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7010 else
7011         installsitebin="$sitebinexp"
7012 fi
7013
7014 cat <<EOM
7015
7016 Perl can be built to take advantage of long doubles which
7017 (if available) may give more accuracy and range for floating point numbers.
7018
7019 If this doesn't make any sense to you, just accept the default 'n'.
7020 EOM
7021
7022 case "$ccflags" in
7023 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7024 esac
7025
7026 case "$uselongdouble" in
7027 $define|true|[yY]*)     dflt='y';;
7028 *) dflt='n';;
7029 esac
7030 rp='Try to use long doubles if available?'
7031 . ./myread
7032 case "$ans" in
7033 y|Y)    val="$define"   ;;
7034 *)      val="$undef"    ;;
7035 esac
7036 set uselongdouble
7037 eval $setvar
7038
7039 case "$uselongdouble" in
7040 true|[yY]*) uselongdouble="$define" ;;
7041 esac
7042
7043 case "$uselongdouble" in
7044 $define)
7045 : Look for a hint-file generated 'call-back-unit'.  If the
7046 : user has specified that long doubles should be used,
7047 : we may need to set or change some other defaults.
7048         if $test -f uselongdouble.cbu; then
7049                 echo "Your platform has some specific hints for long doubles, using them..."
7050                 . ./uselongdouble.cbu
7051         else
7052                 $cat <<EOM
7053 (Your platform doesn't have any specific hints for long doubles.)
7054 EOM
7055         fi
7056         ;;
7057 esac
7058
7059 cat <<EOM
7060
7061 Perl can be built to take advantage of long longs which
7062 (if available) may give more range for integer numbers.
7063
7064 If this doesn't make any sense to you, just accept the default 'n'.
7065 EOM
7066
7067 case "$ccflags" in
7068 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7069 esac
7070
7071 case "$uselonglong" in
7072 $define|true|[yY]*)     dflt='y';;
7073 *) dflt='n';;
7074 esac
7075 rp='Try to use long longs if available?'
7076 . ./myread
7077 case "$ans" in
7078 y|Y)    val="$define"   ;;
7079 *)      val="$undef"    ;;
7080 esac
7081 set uselonglong
7082 eval $setvar
7083
7084 case "$uselonglong" in
7085 true|[yY]*) uselonglong="$define" ;;
7086 esac
7087
7088 case "$uselonglong" in
7089 $define)
7090 : Look for a hint-file generated 'call-back-unit'.  If the
7091 : user has specified that long longs should be used,
7092 : we may need to set or change some other defaults.
7093         if $test -f uselonglong.cbu; then
7094                 echo "Your platform has some specific hints for long longs, using them..."
7095                 . ./uselonglong.cbu
7096         else
7097                 $cat <<EOM
7098 (Your platform doesn't have any specific hints for long longs.)
7099 EOM
7100         fi
7101         ;;
7102 esac
7103
7104 cat <<EOM
7105
7106 Previous version of $package used the standard IO mechanisms as defined
7107 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7108 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7109 the default.  This abstraction layer can use AT&T's sfio (if you already
7110 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7111 problems with some extension modules.  Using PerlIO with stdio is safe,
7112 but it is slower than plain stdio and therefore is not the default.
7113
7114 If this doesn't make any sense to you, just accept the default 'n'.
7115 EOM
7116 case "$useperlio" in
7117 $define|true|[yY]*)     dflt='y';;
7118 *) dflt='n';;
7119 esac
7120 rp='Use the experimental PerlIO abstraction layer?'
7121 . ./myread
7122 case "$ans" in
7123 y|Y) 
7124         val="$define"
7125         ;;     
7126 *)      
7127         echo "Ok, doing things the stdio way"
7128         val="$undef"
7129         ;;
7130 esac
7131 set useperlio
7132 eval $setvar 
7133
7134 case "$vendorprefix" in
7135 '')     d_vendorbin="$undef"
7136         vendorbin=''
7137         vendorbinexp=''
7138         ;;
7139 *)      d_vendorbin="$define"
7140         : determine where vendor-supplied executables go.
7141         dflt=$vendorprefix/bin
7142         fn=d~+
7143         rp='Pathname for the vendor-supplied executables directory?'
7144         . ./getfile
7145         vendorbin="$ans"
7146         vendorbinexp="$ansexp"
7147         : Change installation prefix, if necessary.
7148         if $test X"$prefix" != X"$installprefix"; then
7149                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7150         else
7151                 installvendorbin="$vendorbinexp"
7152         fi
7153         ;;
7154 esac
7155
7156 : check for length of double
7157 echo " "
7158 case "$doublesize" in
7159 '')
7160         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7161         $cat >try.c <<'EOCP'
7162 #include <stdio.h>
7163 int main()
7164 {
7165     printf("%d\n", (int)sizeof(double));
7166     exit(0);
7167 }
7168 EOCP
7169         set try
7170         if eval $compile_ok; then
7171                 doublesize=`./try`
7172                 $echo " $doublesize bytes." >&4
7173         else
7174                 dflt='8'
7175                 echo "(I can't seem to compile the test program.  Guessing...)"
7176                 rp="What is the size of a double precision number (in bytes)?"
7177                 . ./myread
7178                 doublesize="$ans"
7179         fi
7180         ;;
7181 esac
7182 $rm -f try.c try
7183
7184 : check for long doubles
7185 echo " "
7186 $echo $n "Checking to see if your system supports long double..." $c >&4
7187 echo 'int main() { long double x = 7.0; }' > try.c
7188 set try
7189 if eval $compile; then
7190         val="$define"
7191         echo " Yes, it does." >&4
7192 else
7193         val="$undef"
7194         echo " No, it doesn't." >&4
7195 fi
7196 $rm try.*
7197 set d_longdbl
7198 eval $setvar
7199
7200 : check for length of long double
7201 case "${d_longdbl}${longdblsize}" in
7202 $define)
7203         echo " "
7204         $echo $n "Checking to see how big your long doubles are..." $c >&4
7205         $cat >try.c <<'EOCP'
7206 #include <stdio.h>
7207 int main()
7208 {
7209         printf("%d\n", sizeof(long double));
7210 }
7211 EOCP
7212         set try
7213         set try
7214         if eval $compile; then
7215                 longdblsize=`./try$exe_ext`
7216                 $echo " $longdblsize bytes." >&4
7217         else
7218                 dflt='8'
7219                 echo " "
7220                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7221                 rp="What is the size of a long double (in bytes)?"
7222                 . ./myread
7223                 longdblsize="$ans"
7224         fi
7225         if $test "X$doublesize" = "X$longdblsize"; then
7226                 echo "(That isn't any different from an ordinary double.)"
7227         fi      
7228         ;;
7229 esac
7230 $rm -f try.* try
7231
7232 : Check how to convert floats to strings.
7233 if test "X$d_Gconvert" = X; then
7234         echo " "
7235         echo "Checking for an efficient way to convert floats to strings."
7236         $cat >try.c <<EOP
7237 #ifdef TRY_gconvert
7238 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7239 char *myname = "gconvert";
7240 #endif
7241 #ifdef TRY_gcvt
7242 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7243 char *myname = "gcvt";
7244 #endif
7245 #ifdef TRY_qgcvt
7246 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7247 char *myname = "qgcvt";
7248 #define DOUBLETYPE long double
7249 #endif
7250 #ifdef TRY_sprintf
7251 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7252 char *myname = "sprintf";
7253 #endif
7254
7255 #ifndef DOUBLETYPE
7256 #define DOUBLETYPE double
7257 #endif
7258
7259 #include <stdio.h>
7260
7261 #ifdef I_STDLIB
7262 #include <stdlib.h>
7263 #endif
7264
7265 int
7266 checkit(expect, got)
7267 char *expect;
7268 char *got;
7269 {
7270     if (strcmp(expect, got)) {
7271                 printf("%s oddity:  Expected %s, got %s\n",
7272                         myname, expect, got);
7273                 exit(1);
7274         }
7275 }
7276
7277 int main()
7278
7279         char buf[64]; 
7280         buf[63] = '\0';
7281
7282         /* This must be 1st test on (which?) platform */
7283         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7284         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7285         checkit("0.1", buf);
7286
7287         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7288         checkit("1", buf);
7289
7290         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7291         checkit("0", buf);
7292
7293         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7294         checkit("-1", buf);
7295
7296         /* Some Linux gcvt's give 1.e+5 here. */
7297         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7298         checkit("100000", buf);
7299         
7300         /* Some Linux gcvt's give -1.e+5 here. */
7301         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7302         checkit("-100000", buf);
7303
7304         exit(0);
7305 }
7306 EOP
7307         case "$d_Gconvert" in
7308         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7309         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7310         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7311         *) xxx_list='gconvert gcvt sprintf' ;;
7312         esac
7313
7314         case "$d_longdbl$uselongdouble" in
7315         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7316         esac
7317
7318         for xxx_convert in $xxx_list; do
7319                 echo "Trying $xxx_convert..."
7320                 $rm -f try try$_o
7321                 set try -DTRY_$xxx_convert
7322                 if eval $compile; then
7323                         echo "$xxx_convert() found." >&4
7324                         if ./try; then
7325                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7326                                 break;
7327                         else
7328                                 echo "...But $xxx_convert didn't work as I expected."
7329                         fi
7330                 else
7331                         echo "$xxx_convert NOT found." >&4
7332                 fi
7333         done
7334                 
7335         case "$xxx_convert" in
7336         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7337         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7338         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7339         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7340         esac
7341 fi
7342
7343 echo " "
7344
7345 if $test X"$d_longdbl" = X"$define"; then
7346
7347 echo "Checking how to print long doubles..." >&4
7348
7349 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7350         $cat >try.c <<'EOCP'
7351 #include <sys/types.h>
7352 #include <stdio.h>
7353 int main() {
7354   double d = 123.456;
7355   printf("%.3f\n", d);
7356 }
7357 EOCP
7358         set try
7359         if eval $compile; then
7360                 yyy=`./try$exe_ext`
7361                 case "$yyy" in
7362                 123.456)
7363                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7364                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7365                         echo "We will use %f."
7366                         ;;
7367                 esac
7368         fi
7369 fi
7370
7371 if $test X"$sPRIfldbl" = X; then
7372         $cat >try.c <<'EOCP'
7373 #include <sys/types.h>
7374 #include <stdio.h>
7375 int main() {
7376   long double d = 123.456;
7377   printf("%.3llf\n", d);
7378 }
7379 EOCP
7380         set try
7381         if eval $compile; then
7382                 yyy=`./try$exe_ext`
7383                 case "$yyy" in
7384                 123.456)
7385                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7386                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7387                         echo "We will use %llf."
7388                         ;;
7389                 esac
7390         fi
7391 fi
7392
7393 if $test X"$sPRIfldbl" = X; then
7394         $cat >try.c <<'EOCP'
7395 #include <sys/types.h>
7396 #include <stdio.h>
7397 int main() {
7398   long double d = 123.456;
7399   printf("%.3Lf\n", d);
7400 }
7401 EOCP
7402         set try
7403         if eval $compile; then
7404                 yyy=`./try$exe_ext`
7405                 case "$yyy" in
7406                 123.456)
7407                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7408                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7409                         echo "We will use %Lf."
7410                         ;;
7411                 esac
7412         fi
7413 fi
7414
7415 if $test X"$sPRIfldbl" = X; then
7416         $cat >try.c <<'EOCP'
7417 #include <sys/types.h>
7418 #include <stdio.h>
7419 int main() {
7420   long double d = 123.456;
7421   printf("%.3lf\n", d);
7422 }
7423 EOCP
7424         set try
7425         if eval $compile; then
7426                 yyy=`./try$exe_ext`
7427                 case "$yyy" in
7428                 123.456)
7429                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7430                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7431                         echo "We will use %lf."
7432                         ;;
7433                 esac
7434         fi
7435 fi
7436
7437 if $test X"$sPRIfldbl" = X; then
7438         echo "Cannot figure out how to print long doubles." >&4
7439 fi
7440
7441 $rm -f try try.*
7442
7443 fi # d_longdbl
7444
7445 case "$sPRIfldbl" in
7446 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7447         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7448         ;;
7449 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7450         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7451         ;;
7452 esac
7453
7454 : Initialize h_fcntl
7455 h_fcntl=false
7456
7457 : Initialize h_sysfile
7458 h_sysfile=false
7459
7460 : access call always available on UNIX
7461 set access d_access
7462 eval $inlibc
7463
7464 : locate the flags for 'access()'
7465 case "$d_access" in
7466 "$define")
7467         echo " "
7468         $cat >access.c <<'EOCP'
7469 #include <sys/types.h>
7470 #ifdef I_FCNTL
7471 #include <fcntl.h>
7472 #endif
7473 #ifdef I_SYS_FILE
7474 #include <sys/file.h>
7475 #endif
7476 #ifdef I_UNISTD
7477 #include <unistd.h>
7478 #endif
7479 int main() {
7480         exit(R_OK);
7481 }
7482 EOCP
7483         : check sys/file.h first, no particular reason here
7484         if $test `./findhdr sys/file.h` && \
7485                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7486                 h_sysfile=true;
7487                 echo "<sys/file.h> defines the *_OK access constants." >&4
7488         elif $test `./findhdr fcntl.h` && \
7489                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7490                 h_fcntl=true;
7491                 echo "<fcntl.h> defines the *_OK access constants." >&4
7492         elif $test `./findhdr unistd.h` && \
7493                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7494                 echo "<unistd.h> defines the *_OK access constants." >&4
7495         else
7496                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7497         fi
7498         ;;
7499 esac
7500 $rm -f access*
7501
7502 : see if accessx exists
7503 set accessx d_accessx
7504 eval $inlibc
7505
7506 : see if alarm exists
7507 set alarm d_alarm
7508 eval $inlibc
7509
7510 : see if atolf exists
7511 set atolf d_atolf
7512 eval $inlibc
7513
7514 : see if atoll exists
7515 set atoll d_atoll
7516 eval $inlibc
7517
7518 : Look for GNU-cc style attribute checking
7519 echo " "
7520 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7521 $cat >attrib.c <<'EOCP'
7522 #include <stdio.h>
7523 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7524 EOCP
7525 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7526         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7527                 echo "Your C compiler doesn't fully support __attribute__."
7528                 val="$undef"
7529         else
7530                 echo "Your C compiler supports __attribute__."
7531                 val="$define"
7532         fi
7533 else
7534         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7535         val="$undef"
7536 fi
7537 set d_attribut
7538 eval $setvar
7539 $rm -f attrib*
7540
7541 : see if bcmp exists
7542 set bcmp d_bcmp
7543 eval $inlibc
7544
7545 : see if bcopy exists
7546 set bcopy d_bcopy
7547 eval $inlibc
7548
7549 : see if this is a unistd.h system
7550 set unistd.h i_unistd
7551 eval $inhdr
7552
7553 : see if getpgrp exists
7554 set getpgrp d_getpgrp
7555 eval $inlibc
7556
7557 case "$d_getpgrp" in
7558 "$define")
7559         echo " "
7560         echo "Checking to see which flavor of getpgrp is in use..."
7561         $cat >set.c <<EOP
7562 #$i_unistd I_UNISTD
7563 #include <sys/types.h>
7564 #ifdef I_UNISTD
7565 #  include <unistd.h>
7566 #endif
7567 int main()
7568 {
7569         if (getuid() == 0) {
7570                 printf("(I see you are running Configure as super-user...)\n");
7571                 setuid(1);
7572         }
7573 #ifdef TRY_BSD_PGRP
7574         if (getpgrp(1) == 0)
7575                 exit(0);
7576 #else
7577         if (getpgrp() > 0)
7578                 exit(0);
7579 #endif
7580         exit(1);
7581 }
7582 EOP
7583         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7584                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7585                 val="$define"
7586         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7587                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7588                 val="$undef"
7589         else
7590                 echo "I can't seem to compile and run the test program."
7591                 if ./usg; then
7592                         xxx="a USG one, i.e. you use getpgrp()."
7593                 else
7594                         # SVR4 systems can appear rather BSD-ish.
7595                         case "$i_unistd" in
7596                         $undef)
7597                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7598                                 val="$define"
7599                                 ;;
7600                         $define)
7601                                 xxx="probably a USG one, i.e. you use getpgrp()."
7602                                 val="$undef"
7603                                 ;;
7604                         esac
7605                 fi
7606                 echo "Assuming your getpgrp is $xxx" >&4
7607         fi
7608         ;;
7609 *) val="$undef";;
7610 esac
7611 set d_bsdgetpgrp
7612 eval $setvar
7613 $rm -f set set.c
7614
7615 : see if setpgrp exists
7616 set setpgrp d_setpgrp
7617 eval $inlibc
7618
7619 case "$d_setpgrp" in
7620 "$define")
7621         echo " "
7622         echo "Checking to see which flavor of setpgrp is in use..."
7623         $cat >set.c <<EOP
7624 #$i_unistd I_UNISTD
7625 #include <sys/types.h>
7626 #ifdef I_UNISTD
7627 #  include <unistd.h>
7628 #endif
7629 int main()
7630 {
7631         if (getuid() == 0) {
7632                 printf("(I see you are running Configure as super-user...)\n");
7633                 setuid(1);
7634         }
7635 #ifdef TRY_BSD_PGRP
7636         if (-1 == setpgrp(1, 1))
7637                 exit(0);
7638 #else
7639         if (setpgrp() != -1)
7640                 exit(0);
7641 #endif
7642         exit(1);
7643 }
7644 EOP
7645         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7646                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7647                 val="$define"
7648         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7649                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7650                 val="$undef"
7651         else
7652                 echo "(I can't seem to compile and run the test program.)"
7653                 if ./usg; then
7654                         xxx="a USG one, i.e. you use setpgrp()."
7655                 else
7656                         # SVR4 systems can appear rather BSD-ish.
7657                         case "$i_unistd" in
7658                         $undef)
7659                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7660                                 val="$define"
7661                                 ;;
7662                         $define)
7663                                 xxx="probably a USG one, i.e. you use setpgrp()."
7664                                 val="$undef"
7665                                 ;;
7666                         esac
7667                 fi
7668                 echo "Assuming your setpgrp is $xxx" >&4
7669         fi
7670         ;;
7671 *) val="$undef";;
7672 esac
7673 set d_bsdsetpgrp
7674 eval $setvar
7675 $rm -f set set.c
7676 : see if bzero exists
7677 set bzero d_bzero
7678 eval $inlibc
7679
7680 : see if signal is declared as pointer to function returning int or void
7681 echo " "
7682 xxx=`./findhdr signal.h`
7683 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7684 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7685         echo "You have int (*signal())() instead of void." >&4
7686         val="$undef"
7687 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7688         echo "You have void (*signal())()." >&4
7689         val="$define"
7690 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7691         echo "You have int (*signal())() instead of void." >&4
7692         val="$undef"
7693 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7694         echo "You have void (*signal())()." >&4
7695         val="$define"
7696 else
7697         case "$d_voidsig" in
7698         '')
7699         echo "I can't determine whether signal handler returns void or int..." >&4
7700                 dflt=void
7701                 rp="What type does your signal handler return?"
7702                 . ./myread
7703                 case "$ans" in
7704                 v*) val="$define";;
7705                 *) val="$undef";;
7706                 esac;;
7707         "$define")
7708                 echo "As you already told me, signal handler returns void." >&4
7709                 val="$define"
7710                 ;;
7711         *)      echo "As you already told me, signal handler returns int." >&4
7712                 val="$undef"
7713                 ;;
7714         esac
7715 fi
7716 set d_voidsig
7717 eval $setvar
7718 case "$d_voidsig" in
7719 "$define") signal_t="void";;
7720 *) signal_t="int";;
7721 esac
7722 $rm -f $$.tmp
7723
7724 : check for ability to cast large floats to 32-bit ints.
7725 echo " "
7726 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7727 if $test "$intsize" -ge 4; then
7728         xxx=int
7729 else
7730         xxx=long
7731 fi
7732 $cat >try.c <<EOCP
7733 #include <stdio.h>
7734 #include <sys/types.h>
7735 #include <signal.h>
7736 $signal_t blech(s) int s; { exit(3); }
7737 int main()
7738 {
7739         $xxx i32;
7740         double f, g;
7741         int result = 0;
7742         char str[16];
7743         signal(SIGFPE, blech);
7744
7745         /* Don't let compiler optimize the test away.  Store the number 
7746            in a writable string for gcc to pass to sscanf under HP/UX.
7747         */
7748         sprintf(str, "2147483647");
7749         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7750         g = 10 * f;
7751         i32  = ($xxx) g;
7752
7753         /* x86 processors will probably give 0x8000 0000, which is a
7754        sign change.  We don't want that.  We want to mimic SPARC
7755            behavior here, which is to preserve the sign and give
7756            back 0x7fff ffff.
7757         */
7758         if (i32 != ($xxx) f)
7759                 result |= 1;
7760         exit(result);
7761 }
7762 EOCP
7763 set try
7764 if eval $compile_ok; then
7765         ./try
7766         yyy=$?
7767 else
7768         echo "(I can't seem to compile the test program--assuming it can't)"
7769         yyy=1
7770 fi
7771 case "$yyy" in
7772 0)      val="$define"
7773         echo "Yup, it can."
7774         ;;
7775 *)      val="$undef"
7776         echo "Nope, it can't."
7777         ;;
7778 esac
7779 set d_casti32
7780 eval $setvar
7781 $rm -f try try.*
7782
7783 : check for ability to cast negative floats to unsigned
7784 echo " "
7785 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7786 $cat >try.c <<EOCP
7787 #include <stdio.h>
7788 #include <sys/types.h>
7789 #include <signal.h>
7790 $signal_t blech(s) int s; { exit(7); }
7791 $signal_t blech_in_list(s) int s; { exit(4); }
7792 unsigned long dummy_long(p) unsigned long p; { return p; }
7793 unsigned int dummy_int(p) unsigned int p; { return p; }
7794 unsigned short dummy_short(p) unsigned short p; { return p; }
7795 int main()
7796 {
7797         double f;
7798         unsigned long along;
7799         unsigned int aint;
7800         unsigned short ashort;
7801         int result = 0;
7802         char str[16];
7803         
7804         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7805            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7806            optimized the whole file away
7807         */
7808         /* Store the number in a writable string for gcc to pass to 
7809            sscanf under HP/UX.
7810         */
7811         sprintf(str, "-123");
7812         sscanf(str, "%lf", &f);  /* f = -123.; */
7813
7814         signal(SIGFPE, blech);
7815         along = (unsigned long)f;
7816         aint = (unsigned int)f;
7817         ashort = (unsigned short)f;
7818         if (along != (unsigned long)-123)
7819                 result |= 1;
7820         if (aint != (unsigned int)-123)
7821                 result |= 1;
7822         if (ashort != (unsigned short)-123)
7823                 result |= 1;
7824         sprintf(str, "1073741824.");
7825         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7826         f = f + f;
7827         along = 0;
7828         along = (unsigned long)f;
7829         if (along != 0x80000000)
7830                 result |= 2;
7831         f -= 1.;
7832         along = 0;
7833         along = (unsigned long)f;
7834         if (along != 0x7fffffff)
7835                 result |= 1;
7836         f += 2.;
7837         along = 0;
7838         along = (unsigned long)f;
7839         if (along != 0x80000001)
7840                 result |= 2;
7841         if (result)
7842                 exit(result);
7843         signal(SIGFPE, blech_in_list);
7844         sprintf(str, "123.");
7845         sscanf(str, "%lf", &f);  /* f = 123.; */
7846         along = dummy_long((unsigned long)f);
7847         aint = dummy_int((unsigned int)f);
7848         ashort = dummy_short((unsigned short)f);
7849         if (along != (unsigned long)123)
7850                 result |= 4;
7851         if (aint != (unsigned int)123)
7852                 result |= 4;
7853         if (ashort != (unsigned short)123)
7854                 result |= 4;
7855         exit(result);
7856
7857 }
7858 EOCP
7859 set try
7860 if eval $compile_ok; then
7861         ./try
7862         castflags=$?
7863 else
7864         echo "(I can't seem to compile the test program--assuming it can't)"
7865         castflags=7
7866 fi
7867 case "$castflags" in
7868 0)      val="$define"
7869         echo "Yup, it can."
7870         ;;
7871 *)      val="$undef"
7872         echo "Nope, it can't."
7873         ;;
7874 esac
7875 set d_castneg
7876 eval $setvar
7877 $rm -f try.*
7878
7879 : see if vprintf exists
7880 echo " "
7881 if set vprintf val -f d_vprintf; eval $csym; $val; then
7882         echo 'vprintf() found.' >&4
7883         val="$define"
7884         $cat >vprintf.c <<'EOF'
7885 #include <varargs.h>
7886
7887 int main() { xxx("foo"); }
7888
7889 xxx(va_alist)
7890 va_dcl
7891 {
7892         va_list args;
7893         char buf[10];
7894
7895         va_start(args);
7896         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7897 }
7898 EOF
7899         set vprintf
7900         if eval $compile && ./vprintf; then
7901                 echo "Your vsprintf() returns (int)." >&4
7902                 val2="$undef"
7903         else
7904                 echo "Your vsprintf() returns (char*)." >&4
7905                 val2="$define"
7906         fi
7907 else
7908         echo 'vprintf() NOT found.' >&4
7909                 val="$undef"
7910                 val2="$undef"
7911 fi
7912 set d_vprintf
7913 eval $setvar
7914 val=$val2
7915 set d_charvspr
7916 eval $setvar
7917
7918 : see if chown exists
7919 set chown d_chown
7920 eval $inlibc
7921
7922 : see if chroot exists
7923 set chroot d_chroot
7924 eval $inlibc
7925
7926 : see if chsize exists
7927 set chsize d_chsize
7928 eval $inlibc
7929
7930 : check for const keyword
7931 echo " "
7932 echo 'Checking to see if your C compiler knows about "const"...' >&4
7933 $cat >const.c <<'EOCP'
7934 typedef struct spug { int drokk; } spug;
7935 int main()
7936 {
7937         const char *foo;
7938         const spug y;
7939 }
7940 EOCP
7941 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7942         val="$define"
7943         echo "Yup, it does."
7944 else
7945         val="$undef"
7946         echo "Nope, it doesn't."
7947 fi
7948 set d_const
7949 eval $setvar
7950
7951 : see if crypt exists
7952 echo " "
7953 if set crypt val -f d_crypt; eval $csym; $val; then
7954         echo 'crypt() found.' >&4
7955         val="$define"
7956         cryptlib=''
7957 else
7958         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7959         if $test -z "$cryptlib"; then
7960                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7961         else
7962                 cryptlib=-lcrypt
7963         fi
7964         if $test -z "$cryptlib"; then
7965                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7966         else
7967                 cryptlib=-lcrypt
7968         fi
7969         if $test -z "$cryptlib"; then
7970                 cryptlib=`./loc libcrypt$_a "" $libpth`
7971         else
7972                 cryptlib=-lcrypt
7973         fi
7974         if $test -z "$cryptlib"; then
7975                 echo 'crypt() NOT found.' >&4
7976                 val="$undef"
7977         else
7978                 val="$define"
7979         fi
7980 fi
7981 set d_crypt
7982 eval $setvar
7983
7984 : get csh whereabouts
7985 case "$csh" in
7986 'csh') val="$undef" ;;
7987 *) val="$define" ;;
7988 esac
7989 set d_csh
7990 eval $setvar
7991 : Respect a hint or command line value for full_csh.
7992 case "$full_csh" in
7993 '') full_csh=$csh ;;
7994 esac
7995
7996 : see if cuserid exists
7997 set cuserid d_cuserid
7998 eval $inlibc
7999
8000 : see if this is a limits.h system
8001 set limits.h i_limits
8002 eval $inhdr
8003
8004 : see if this is a float.h system
8005 set float.h i_float
8006 eval $inhdr
8007
8008 : See if number of significant digits in a double precision number is known
8009 echo " "
8010 $cat >dbl_dig.c <<EOM
8011 #$i_limits I_LIMITS
8012 #$i_float I_FLOAT
8013 #ifdef I_LIMITS
8014 #include <limits.h>
8015 #endif
8016 #ifdef I_FLOAT
8017 #include <float.h>
8018 #endif
8019 #ifdef DBL_DIG
8020 printf("Contains DBL_DIG");
8021 #endif
8022 EOM
8023 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8024 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8025         echo "DBL_DIG found." >&4
8026         val="$define"
8027 else
8028         echo "DBL_DIG NOT found." >&4
8029         val="$undef"
8030 fi
8031 $rm -f dbl_dig.?
8032 set d_dbl_dig
8033 eval $setvar
8034
8035 : see if difftime exists
8036 set difftime d_difftime
8037 eval $inlibc
8038
8039 : see if this is a dirent system
8040 echo " "
8041 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8042         val="$define"
8043         echo "<dirent.h> found." >&4
8044 else
8045         val="$undef"
8046         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8047                 echo "<sys/dir.h> found." >&4
8048                 echo " "
8049         else
8050                 xinc=`./findhdr sys/ndir.h`
8051         fi
8052         echo "<dirent.h> NOT found." >&4
8053 fi
8054 set i_dirent
8055 eval $setvar
8056
8057 : Look for type of directory structure.
8058 echo " "
8059 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8060
8061 case "$direntrytype" in
8062 ''|' ')
8063         case "$i_dirent" in
8064         $define) guess1='struct dirent' ;;
8065         *) guess1='struct direct'  ;;
8066         esac
8067         ;;
8068 *)      guess1="$direntrytype"
8069         ;;
8070 esac
8071
8072 case "$guess1" in
8073 'struct dirent') guess2='struct direct' ;;
8074 *) guess2='struct dirent' ;;
8075 esac
8076                 
8077 if $contains "$guess1" try.c >/dev/null 2>&1; then
8078         direntrytype="$guess1"
8079         echo "Your directory entries are $direntrytype." >&4
8080 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8081         direntrytype="$guess2"
8082         echo "Your directory entries seem to be $direntrytype." >&4
8083 else
8084         echo "I don't recognize your system's directory entries." >&4
8085         rp="What type is used for directory entries on this system?"
8086         dflt="$guess1"
8087         . ./myread
8088         direntrytype="$ans"
8089 fi
8090 $rm -f try.c
8091
8092
8093 : see if the directory entry stores field length
8094 echo " "
8095 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8096 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8097         echo "Good, your directory entry keeps length information in d_namlen." >&4
8098         val="$define"
8099 else
8100         echo "Your directory entry does not know about the d_namlen field." >&4
8101         val="$undef"
8102 fi
8103 set d_dirnamlen
8104 eval $setvar
8105 $rm -f try.c
8106
8107 : see if dlerror exists
8108 xxx_runnm="$runnm"
8109 runnm=false
8110 set dlerror d_dlerror
8111 eval $inlibc
8112 runnm="$xxx_runnm"
8113
8114 : see if dlfcn is available
8115 set dlfcn.h i_dlfcn
8116 eval $inhdr
8117
8118 case "$usedl" in
8119 $define|y|true)
8120         $cat << EOM
8121
8122 On a few systems, the dynamically loaded modules that perl generates and uses
8123 will need a different extension than shared libs. The default will probably
8124 be appropriate.
8125
8126 EOM
8127         case "$dlext" in
8128         '')     dflt="$so" ;;
8129         *)      dflt="$dlext" ;;
8130         esac
8131         rp='What is the extension of dynamically loaded modules'
8132         . ./myread
8133         dlext="$ans"
8134         ;;
8135 *)
8136         dlext="none"
8137         ;;
8138 esac
8139
8140 : Check if dlsym need a leading underscore
8141 echo " "
8142 val="$undef"
8143
8144 case "$dlsrc" in
8145 dl_dlopen.xs)
8146         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8147         $cat >dyna.c <<'EOM'
8148 fred () { }
8149 EOM
8150
8151 $cat >fred.c<<EOM
8152
8153 #include <stdio.h>
8154 #$i_dlfcn I_DLFCN
8155 #ifdef I_DLFCN
8156 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8157 #else
8158 #include <sys/types.h>
8159 #include <nlist.h>
8160 #include <link.h>
8161 #endif
8162
8163 extern int fred() ;
8164
8165 int main()
8166 {
8167     void * handle ;
8168     void * symbol ;
8169 #ifndef RTLD_LAZY
8170     int mode = 1 ;
8171 #else
8172     int mode = RTLD_LAZY ;
8173 #endif
8174     handle = dlopen("./dyna.$dlext", mode) ;
8175     if (handle == NULL) {
8176         printf ("1\n") ;
8177         fflush (stdout) ;
8178         exit(0);
8179     }
8180     symbol = dlsym(handle, "fred") ;
8181     if (symbol == NULL) {
8182         /* try putting a leading underscore */
8183         symbol = dlsym(handle, "_fred") ;
8184         if (symbol == NULL) {
8185             printf ("2\n") ;
8186             fflush (stdout) ;
8187             exit(0);
8188         }
8189         printf ("3\n") ;
8190     }
8191     else
8192         printf ("4\n") ;
8193     fflush (stdout) ;
8194     exit(0);
8195 }
8196 EOM
8197         : Call the object file tmp-dyna.o in case dlext=o.
8198         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8199                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8200                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8201                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8202                 xxx=`./fred`
8203                 case $xxx in
8204                 1)      echo "Test program failed using dlopen." >&4
8205                         echo "Perhaps you should not use dynamic loading." >&4;;
8206                 2)      echo "Test program failed using dlsym." >&4
8207                         echo "Perhaps you should not use dynamic loading." >&4;;
8208                 3)      echo "dlsym needs a leading underscore" >&4
8209                         val="$define" ;;
8210                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8211                 esac
8212         else
8213                 echo "I can't compile and run the test program." >&4
8214                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8215         fi
8216         ;;
8217 esac
8218                 
8219 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8220
8221 set d_dlsymun
8222 eval $setvar
8223
8224 hasproto='varname=$1; func=$2; shift; shift;
8225 while $test $# -ge 2; do
8226         case "$1" in
8227         $define) echo "#include <$2>";;
8228         esac ;
8229     shift 2;
8230 done > try.c;
8231 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8232 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8233         echo "$func() prototype found.";
8234         val="$define";
8235 else
8236         echo "$func() prototype NOT found.";
8237         val="$undef";
8238 fi;
8239 set $varname;
8240 eval $setvar;
8241 $rm -f try.c tryout.c'
8242
8243 : see if prototype for drand48 is available
8244 echo " "
8245 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8246 eval $hasproto
8247
8248 : see if dup2 exists
8249 set dup2 d_dup2
8250 eval $inlibc
8251
8252 : see if eaccess exists
8253 set eaccess d_eaccess
8254 eval $inlibc
8255
8256 : see if endgrent exists
8257 set endgrent d_endgrent
8258 eval $inlibc
8259
8260 : see if endhostent exists
8261 set endhostent d_endhent
8262 eval $inlibc
8263
8264 : see if endnetent exists
8265 set endnetent d_endnent
8266 eval $inlibc
8267
8268 : see if endprotoent exists
8269 set endprotoent d_endpent
8270 eval $inlibc
8271
8272 : see if endpwent exists
8273 set endpwent d_endpwent
8274 eval $inlibc
8275
8276 : see if endservent exists
8277 set endservent d_endsent
8278 eval $inlibc
8279
8280 : see if endspent exists
8281 set endspent d_endspent
8282 eval $inlibc
8283
8284 : Locate the flags for 'open()'
8285 echo " "
8286 $cat >open3.c <<'EOCP'
8287 #include <sys/types.h>
8288 #ifdef I_FCNTL
8289 #include <fcntl.h>
8290 #endif
8291 #ifdef I_SYS_FILE
8292 #include <sys/file.h>
8293 #endif
8294 int main() {
8295         if(O_RDONLY);
8296 #ifdef O_TRUNC
8297         exit(0);
8298 #else
8299         exit(1);
8300 #endif
8301 }
8302 EOCP
8303 : check sys/file.h first to get FREAD on Sun
8304 if $test `./findhdr sys/file.h` && \
8305                 set open3 -DI_SYS_FILE && eval $compile; then
8306         h_sysfile=true;
8307         echo "<sys/file.h> defines the O_* constants..." >&4
8308         if ./open3; then
8309                 echo "and you have the 3 argument form of open()." >&4
8310                 val="$define"
8311         else
8312                 echo "but not the 3 argument form of open().  Oh, well." >&4
8313                 val="$undef"
8314         fi
8315 elif $test `./findhdr fcntl.h` && \
8316                 set open3 -DI_FCNTL && eval $compile; then
8317         h_fcntl=true;
8318         echo "<fcntl.h> defines the O_* constants..." >&4
8319         if ./open3; then
8320                 echo "and you have the 3 argument form of open()." >&4
8321                 val="$define"
8322         else
8323                 echo "but not the 3 argument form of open().  Oh, well." >&4
8324                 val="$undef"
8325         fi
8326 else
8327         val="$undef"
8328         echo "I can't find the O_* constant definitions!  You got problems." >&4
8329 fi
8330 set d_open3
8331 eval $setvar
8332 $rm -f open3*
8333
8334 : see which of string.h or strings.h is needed
8335 echo " "
8336 strings=`./findhdr string.h`
8337 if $test "$strings" && $test -r "$strings"; then
8338         echo "Using <string.h> instead of <strings.h>." >&4
8339         val="$define"
8340 else
8341         val="$undef"
8342         strings=`./findhdr strings.h`
8343         if $test "$strings" && $test -r "$strings"; then
8344                 echo "Using <strings.h> instead of <string.h>." >&4
8345         else
8346                 echo "No string header found -- You'll surely have problems." >&4
8347         fi
8348 fi
8349 set i_string
8350 eval $setvar
8351 case "$i_string" in
8352 "$undef") strings=`./findhdr strings.h`;;
8353 *)        strings=`./findhdr string.h`;;
8354 esac
8355
8356 : check for non-blocking I/O stuff
8357 case "$h_sysfile" in
8358 true) echo "#include <sys/file.h>" > head.c;;
8359 *)
8360         case "$h_fcntl" in
8361         true) echo "#include <fcntl.h>" > head.c;;
8362         *) echo "#include <sys/fcntl.h>" > head.c;;
8363         esac
8364         ;;
8365 esac
8366 echo " "
8367 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8368 case "$o_nonblock" in
8369 '')
8370         $cat head.c > try.c
8371         $cat >>try.c <<'EOCP'
8372 #include <stdio.h>
8373 int main() {
8374 #ifdef O_NONBLOCK
8375         printf("O_NONBLOCK\n");
8376         exit(0);
8377 #endif
8378 #ifdef O_NDELAY
8379         printf("O_NDELAY\n");
8380         exit(0);
8381 #endif
8382 #ifdef FNDELAY
8383         printf("FNDELAY\n");
8384         exit(0);
8385 #endif
8386         exit(0);
8387 }
8388 EOCP
8389         set try
8390         if eval $compile_ok; then
8391                 o_nonblock=`./try`
8392                 case "$o_nonblock" in
8393                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8394                 *) echo "Seems like we can use $o_nonblock.";;
8395                 esac
8396         else
8397                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8398         fi
8399         ;;
8400 *) echo "Using $hint value $o_nonblock.";;
8401 esac
8402 $rm -f try try.* .out core
8403
8404 echo " "
8405 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8406 case "$eagain" in
8407 '')
8408         $cat head.c > try.c
8409         $cat >>try.c <<EOCP
8410 #include <errno.h>
8411 #include <sys/types.h>
8412 #include <signal.h>
8413 #include <stdio.h> 
8414 #define MY_O_NONBLOCK $o_nonblock
8415 #ifndef errno  /* XXX need better Configure test */
8416 extern int errno;
8417 #endif
8418 #$i_unistd I_UNISTD
8419 #ifdef I_UNISTD
8420 #include <unistd.h>
8421 #endif
8422 #ifdef $i_string
8423 #include <string.h>
8424 #else
8425 #include <strings.h>
8426 #endif
8427 $signal_t blech(x) int x; { exit(3); }
8428 EOCP
8429         $cat >> try.c <<'EOCP'
8430 int main()
8431 {
8432         int pd[2];
8433         int pu[2];
8434         char buf[1];
8435         char string[100];
8436
8437         pipe(pd);       /* Down: child -> parent */
8438         pipe(pu);       /* Up: parent -> child */
8439         if (0 != fork()) {
8440                 int ret;
8441                 close(pd[1]);   /* Parent reads from pd[0] */
8442                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8443                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8444                         exit(1);
8445                 signal(SIGALRM, blech);
8446                 alarm(5);
8447                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8448                         exit(2);
8449                 sprintf(string, "%d\n", ret);
8450                 write(2, string, strlen(string));
8451                 alarm(0);
8452 #ifdef EAGAIN
8453                 if (errno == EAGAIN) {
8454                         printf("EAGAIN\n");
8455                         goto ok;
8456                 }
8457 #endif
8458 #ifdef EWOULDBLOCK
8459                 if (errno == EWOULDBLOCK)
8460                         printf("EWOULDBLOCK\n");
8461 #endif
8462         ok:
8463                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8464                 sleep(2);                               /* Give it time to close our pipe */
8465                 alarm(5);
8466                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8467                 alarm(0);
8468                 sprintf(string, "%d\n", ret);
8469                 write(3, string, strlen(string));
8470                 exit(0);
8471         }
8472
8473         close(pd[0]);                   /* We write to pd[1] */
8474         close(pu[1]);                   /* We read from pu[0] */
8475         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8476         close(pd[1]);                   /* Pipe pd is now fully closed! */
8477         exit(0);                                /* Bye bye, thank you for playing! */
8478 }
8479 EOCP
8480         set try
8481         if eval $compile_ok; then
8482                 echo "$startsh" >mtry
8483                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8484                 chmod +x mtry
8485                 ./mtry >/dev/null 2>&1
8486                 case $? in
8487                 0) eagain=`$cat try.out`;;
8488                 1) echo "Could not perform non-blocking setting!";;
8489                 2) echo "I did a successful read() for something that was not there!";;
8490                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8491                 *) echo "Something terribly wrong happened during testing.";;
8492                 esac
8493                 rd_nodata=`$cat try.ret`
8494                 echo "A read() system call with no data present returns $rd_nodata."
8495                 case "$rd_nodata" in
8496                 0|-1) ;;
8497                 *)
8498                         echo "(That's peculiar, fixing that to be -1.)"
8499                         rd_nodata=-1
8500                         ;;
8501                 esac
8502                 case "$eagain" in
8503                 '')
8504                         echo "Forcing errno EAGAIN on read() with no data available."
8505                         eagain=EAGAIN
8506                         ;;
8507                 *)
8508                         echo "Your read() sets errno to $eagain when no data is available."
8509                         ;;
8510                 esac
8511                 status=`$cat try.err`
8512                 case "$status" in
8513                 0) echo "And it correctly returns 0 to signal EOF.";;
8514                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8515                 *) echo "However, your read() returns '$status' on EOF??";;
8516                 esac
8517                 val="$define"
8518                 if test "$status" = "$rd_nodata"; then
8519                         echo "WARNING: you can't distinguish between EOF and no data!"
8520                         val="$undef"
8521                 fi
8522         else
8523                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8524                 eagain=EAGAIN
8525         fi
8526         set d_eofnblk
8527         eval $setvar
8528         ;;
8529 *)
8530         echo "Using $hint value $eagain."
8531         echo "Your read() returns $rd_nodata when no data is present."
8532         case "$d_eofnblk" in
8533         "$define") echo "And you can see EOF because read() returns 0.";;
8534         "$undef") echo "But you can't see EOF status from read() returned value.";;
8535         *)
8536                 echo "(Assuming you can't see EOF status from read anyway.)"
8537                 d_eofnblk=$undef
8538                 ;;
8539         esac
8540         ;;
8541 esac
8542 $rm -f try try.* .out core head.c mtry
8543
8544 : see if fchmod exists
8545 set fchmod d_fchmod
8546 eval $inlibc
8547
8548 : see if fchown exists
8549 set fchown d_fchown
8550 eval $inlibc
8551
8552 : see if this is an fcntl system
8553 set fcntl d_fcntl
8554 eval $inlibc
8555
8556 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8557 while $test $# -ge 2; do
8558         case "$1" in
8559         $define) echo "#include <$2>";;
8560         esac ;
8561     shift 2;
8562 done > try.c;
8563 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8564 set try;
8565 if eval $compile; then
8566         val="$define";
8567 else
8568         val="$undef";
8569 fi;
8570 set $varname;
8571 eval $setvar;
8572 $rm -f try.c try.o'
8573
8574 socketlib=''
8575 sockethdr=''
8576 : see whether socket exists
8577 echo " "
8578 $echo $n "Hmm... $c" >&4
8579 if set socket val -f d_socket; eval $csym; $val; then
8580         echo "Looks like you have Berkeley networking support." >&4
8581         d_socket="$define"
8582         if set setsockopt val -f; eval $csym; $val; then
8583                 d_oldsock="$undef"
8584         else
8585                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8586                 d_oldsock="$define"
8587         fi
8588 else
8589         if $contains socklib libc.list >/dev/null 2>&1; then
8590                 echo "Looks like you have Berkeley networking support." >&4
8591                 d_socket="$define"
8592                 : we will have to assume that it supports the 4.2 BSD interface
8593                 d_oldsock="$undef"
8594         else
8595                 echo "You don't have Berkeley networking in libc$_a..." >&4
8596                 if test "X$d_socket" = "X$define"; then
8597                    echo "...but you seem to believe that you have sockets." >&4
8598                 else
8599                         for net in net socket
8600                         do
8601                                 if test -f /usr/lib/lib$net$_a; then
8602                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8603                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8604                                         if $contains socket libc.list >/dev/null 2>&1; then
8605                                                 d_socket="$define"
8606                                                 socketlib="-l$net"
8607                                                 case "$net" in
8608                                                 net)
8609                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8610                                                         sockethdr="-I/usr/netinclude"
8611                                                         ;;
8612                                                 esac
8613                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8614                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8615                                                         d_oldsock="$undef"
8616                                                 else
8617                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8618                                                         d_oldsock="$define"
8619                                                 fi
8620                                                 break
8621                                         fi
8622                                 fi
8623                         done
8624                         if test "X$d_socket" != "X$define"; then
8625                            echo "or anywhere else I see." >&4
8626                            d_socket="$undef"
8627                            d_oldsock="$undef"
8628                         fi
8629                 fi
8630         fi
8631 fi
8632
8633 : see if socketpair exists
8634 set socketpair d_sockpair
8635 eval $inlibc
8636
8637
8638 echo " "
8639 echo "Checking the availability of certain socket constants..." >& 4
8640 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8641         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8642         $cat >try.c <<EOF
8643 #include <sys/types.h>
8644 #include <sys/socket.h>
8645 int main() {
8646     int i = $ENUM;
8647 }
8648 EOF
8649         val="$undef"
8650         set try; if eval $compile; then
8651                 val="$define"
8652         fi
8653         set d_${enum}; eval $setvar
8654         $rm -f try.c try
8655 done
8656
8657 : see if sys/select.h has to be included
8658 set sys/select.h i_sysselct
8659 eval $inhdr
8660
8661 : see if we should include time.h, sys/time.h, or both
8662 echo " "
8663 if test "X$timeincl" = X; then
8664         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8665         $echo $n "I'm now running the test program...$c"
8666         $cat >try.c <<'EOCP'
8667 #include <sys/types.h>
8668 #ifdef I_TIME
8669 #include <time.h>
8670 #endif
8671 #ifdef I_SYSTIME
8672 #ifdef SYSTIMEKERNEL
8673 #define KERNEL
8674 #endif
8675 #include <sys/time.h>
8676 #endif
8677 #ifdef I_SYSSELECT
8678 #include <sys/select.h>
8679 #endif
8680 int main()
8681 {
8682         struct tm foo;
8683 #ifdef S_TIMEVAL
8684         struct timeval bar;
8685 #endif
8686 #ifdef S_TIMEZONE
8687         struct timezone tzp;
8688 #endif
8689         if (foo.tm_sec == foo.tm_sec)
8690                 exit(0);
8691 #ifdef S_TIMEVAL
8692         if (bar.tv_sec == bar.tv_sec)
8693                 exit(0);
8694 #endif
8695         exit(1);
8696 }
8697 EOCP
8698         flags=''
8699         for s_timezone in '-DS_TIMEZONE' ''; do
8700         sysselect=''
8701         for s_timeval in '-DS_TIMEVAL' ''; do
8702         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8703         for i_time in '' '-DI_TIME'; do
8704         for i_systime in '-DI_SYSTIME' ''; do
8705                 case "$flags" in
8706                 '') $echo $n ".$c"
8707                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8708                         if eval $compile; then
8709                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8710                                 shift
8711                                 flags="$*"
8712                                 echo " "
8713                                 $echo $n "Succeeded with $flags$c"
8714                         fi
8715                         ;;
8716                 esac
8717         done
8718         done
8719         done
8720         done
8721         done
8722         timeincl=''
8723         echo " "
8724         case "$flags" in
8725         *SYSTIMEKERNEL*) i_systimek="$define"
8726                 timeincl=`./findhdr sys/time.h`
8727                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8728         *) i_systimek="$undef";;
8729         esac
8730         case "$flags" in
8731         *I_TIME*) i_time="$define"
8732                 timeincl=`./findhdr time.h`" $timeincl"
8733                 echo "We'll include <time.h>." >&4;;
8734         *) i_time="$undef";;
8735         esac
8736         case "$flags" in
8737         *I_SYSTIME*) i_systime="$define"
8738                 timeincl=`./findhdr sys/time.h`" $timeincl"
8739                 echo "We'll include <sys/time.h>." >&4;;
8740         *) i_systime="$undef";;
8741         esac
8742         $rm -f try.c try
8743 fi
8744
8745 : check for fd_set items
8746 $cat <<EOM
8747
8748 Checking to see how well your C compiler handles fd_set and friends ...
8749 EOM
8750 $cat >fd_set.c <<EOCP
8751 #$i_systime I_SYS_TIME
8752 #$i_sysselct I_SYS_SELECT
8753 #$d_socket HAS_SOCKET
8754 #include <sys/types.h>
8755 #ifdef HAS_SOCKET
8756 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8757 #endif
8758 #ifdef I_SYS_TIME
8759 #include <sys/time.h>
8760 #endif
8761 #ifdef I_SYS_SELECT
8762 #include <sys/select.h>
8763 #endif
8764 int main() {
8765         fd_set fds;
8766
8767 #ifdef TRYBITS
8768         if(fds.fds_bits);
8769 #endif
8770
8771 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8772         exit(0);
8773 #else
8774         exit(1);
8775 #endif
8776 }
8777 EOCP
8778 set fd_set -DTRYBITS
8779 if eval $compile; then
8780         d_fds_bits="$define"
8781         d_fd_set="$define"
8782         echo "Well, your system knows about the normal fd_set typedef..." >&4
8783         if ./fd_set; then
8784                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8785                 d_fd_macros="$define"
8786         else
8787                 $cat >&4 <<'EOM'
8788 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8789 EOM
8790                 d_fd_macros="$undef"
8791         fi
8792 else
8793         $cat <<'EOM'
8794 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8795 EOM
8796         set fd_set
8797         if eval $compile; then
8798                 d_fds_bits="$undef"
8799                 d_fd_set="$define"
8800                 echo "Well, your system has some sort of fd_set available..." >&4
8801                 if ./fd_set; then
8802                         echo "and you have the normal fd_set macros." >&4
8803                         d_fd_macros="$define"
8804                 else
8805                         $cat <<'EOM'
8806 but not the normal fd_set macros!  Gross!  More work for me...
8807 EOM
8808                         d_fd_macros="$undef"
8809                 fi
8810         else
8811         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8812                 d_fd_set="$undef"
8813                 d_fds_bits="$undef"
8814                 d_fd_macros="$undef"
8815         fi
8816 fi
8817 $rm -f fd_set*
8818
8819 : see if fgetpos exists
8820 set fgetpos d_fgetpos
8821 eval $inlibc
8822
8823 : see if flock exists
8824 set flock d_flock
8825 eval $inlibc
8826
8827 : see if fork exists
8828 set fork d_fork
8829 eval $inlibc
8830
8831 : see if pathconf exists
8832 set pathconf d_pathconf
8833 eval $inlibc
8834
8835 : see if fpathconf exists
8836 set fpathconf d_fpathconf
8837 eval $inlibc
8838
8839
8840 : check for off64_t
8841 echo " "
8842 echo "Checking to see if your system supports off64_t..." >&4
8843 $cat >try.c <<EOCP
8844 #include <sys/types.h>
8845 #include <unistd.h>
8846 int main() { off64_t x = 7; }'
8847 EOCP
8848 set try
8849 if eval $compile; then
8850         val="$define"
8851         echo "Yes, it does."
8852 else
8853         val="$undef"
8854         echo "No, it doesn't."
8855         case "$lseeksize" in
8856         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8857         esac
8858 fi
8859 $rm -f try.* try
8860 set d_off64_t
8861 eval $setvar
8862
8863 : check for fpos64_t
8864 echo " "
8865 echo "Checking to see if your system supports fpos64_t..." >&4
8866 $cat >try.c <<EOCP
8867 #include <sys/stdio.h>
8868 int main() { fpos64_t x x = 7; }'
8869 EOCP
8870 set try
8871 if eval $compile; then
8872         val="$define"
8873         echo "Yes, it does."
8874 else
8875         val="$undef"
8876         echo "No, it doesn't."
8877         case "$fpossize" in
8878         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8879         esac
8880 fi
8881 $rm -f try.* try
8882 set d_fpos64_t
8883 eval $setvar
8884
8885 hasstruct='varname=$1; struct=$2; shift; shift;
8886 while $test $# -ge 2; do
8887         case "$1" in
8888         $define) echo "#include <$2>";;
8889         esac ;
8890     shift 2;
8891 done > try.c;
8892 echo "int main () { struct $struct foo; }" >> try.c;
8893 set try;
8894 if eval $compile; then
8895         val="$define";
8896 else
8897         val="$undef";
8898 fi;
8899 set $varname;
8900 eval $setvar;
8901 $rm -f try.c try.o'
8902
8903 : see if this is a sys/param system
8904 set sys/param.h i_sysparam
8905 eval $inhdr
8906
8907 : see if this is a sys/mount.h system
8908 set sys/mount.h i_sysmount
8909 eval $inhdr
8910
8911 : see if sys/types.h has to be included
8912 set sys/types.h i_systypes
8913 eval $inhdr
8914
8915
8916 echo " "
8917 echo "Checking to see if your system supports struct fs_data..." >&4
8918 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8919 eval $hasstruct
8920 case "$d_fs_data_s" in
8921 "$define")      echo "Yes, it does."   ;;
8922 *)              echo "No, it doesn't." ;;
8923 esac
8924
8925 : see if fseeko exists
8926 set fseeko d_fseeko
8927 eval $inlibc
8928 case "$longsize" in
8929 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8930 esac
8931
8932 : see if fsetpos exists
8933 set fsetpos d_fsetpos
8934 eval $inlibc
8935
8936
8937 : see if fstatfs exists
8938 set fstatfs d_fstatfs
8939 eval $inlibc
8940
8941
8942 : see if statvfs exists
8943 set statvfs d_statvfs
8944 eval $inlibc
8945
8946 : see if fstatvfs exists
8947 set fstatvfs d_fstatvfs
8948 eval $inlibc
8949
8950
8951 : see if ftello exists
8952 set ftello d_ftello
8953 eval $inlibc
8954 case "$longsize" in
8955 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8956 esac
8957
8958 : see if getgrent exists
8959 set getgrent d_getgrent
8960 eval $inlibc
8961
8962 : see if gethostbyaddr exists
8963 set gethostbyaddr d_gethbyaddr
8964 eval $inlibc
8965
8966 : see if gethostbyname exists
8967 set gethostbyname d_gethbyname
8968 eval $inlibc
8969
8970 : see if gethostent exists
8971 set gethostent d_gethent
8972 eval $inlibc
8973
8974 : see how we will look up host name
8975 echo " "
8976 call=''
8977 if set gethostname val -f d_gethname; eval $csym; $val; then
8978         echo 'gethostname() found.' >&4
8979         d_gethname="$define"
8980         call=gethostname
8981 fi
8982 if set uname val -f d_uname; eval $csym; $val; then
8983         if ./xenix; then
8984                 $cat <<'EOM'
8985 uname() was found, but you're running xenix, and older versions of xenix
8986 have a broken uname(). If you don't really know whether your xenix is old
8987 enough to have a broken system call, use the default answer.
8988
8989 EOM
8990                 dflt=y
8991                 case "$d_uname" in
8992                 "$define") dflt=n;;
8993                 esac
8994                 rp='Is your uname() broken?'
8995                 . ./myread
8996                 case "$ans" in
8997                 n*) d_uname="$define"; call=uname;;
8998                 esac
8999         else
9000                 echo 'uname() found.' >&4
9001                 d_uname="$define"
9002                 case "$call" in
9003                 '') call=uname ;;
9004                 esac
9005         fi
9006 fi
9007 case "$d_gethname" in
9008 '') d_gethname="$undef";;
9009 esac
9010 case "$d_uname" in
9011 '') d_uname="$undef";;
9012 esac
9013 case "$d_uname$d_gethname" in
9014 *define*)
9015         dflt=n
9016         cat <<EOM
9017  
9018 Every now and then someone has a $call() that lies about the hostname
9019 but can't be fixed for political or economic reasons.  If you wish, I can
9020 pretend $call() isn't there and maybe compute hostname at run-time
9021 thanks to the '$phostname' command.
9022
9023 EOM
9024         rp="Shall I ignore $call() from now on?"
9025         . ./myread
9026         case "$ans" in
9027         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9028         esac;;
9029 esac
9030 case "$phostname" in
9031 '') aphostname='';;
9032 *) case "$aphostname" in
9033         /*) ;;
9034         *) set X $phostname
9035                 shift
9036                 file=$1
9037                 shift
9038                 file=`./loc $file $file $pth`
9039                 aphostname=`echo $file $*`
9040                 ;;
9041         esac
9042         ;;
9043 esac
9044 case "$d_uname$d_gethname" in
9045 *define*) ;;
9046 *)
9047         case "$phostname" in
9048         '')
9049                 echo "There will be no way for $package to get your hostname." >&4;;
9050         *)
9051         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9052                 ;;
9053         esac;;
9054 esac
9055 case "$d_phostname" in
9056 '') d_phostname="$undef";;
9057 esac
9058
9059 : see if this is a netdb.h system
9060 set netdb.h i_netdb
9061 eval $inhdr
9062
9063 : see if prototypes for various gethostxxx netdb.h functions are available
9064 echo " "
9065 set d_gethostprotos gethostent $i_netdb netdb.h
9066 eval $hasproto
9067
9068 : see if getlogin exists
9069 set getlogin d_getlogin
9070 eval $inlibc
9071
9072 : see if getmnt exists
9073 set getmnt d_getmnt
9074 eval $inlibc
9075
9076 : see if getmntent exists
9077 set getmntent d_getmntent
9078 eval $inlibc
9079
9080 : see if getnetbyaddr exists
9081 set getnetbyaddr d_getnbyaddr
9082 eval $inlibc
9083
9084 : see if getnetbyname exists
9085 set getnetbyname d_getnbyname
9086 eval $inlibc
9087
9088 : see if getnetent exists
9089 set getnetent d_getnent
9090 eval $inlibc
9091
9092 : see if prototypes for various getnetxxx netdb.h functions are available
9093 echo " "
9094 set d_getnetprotos getnetent $i_netdb netdb.h
9095 eval $hasproto
9096
9097
9098 : see if getprotobyname exists
9099 set getprotobyname d_getpbyname
9100 eval $inlibc
9101
9102 : see if getprotobynumber exists
9103 set getprotobynumber d_getpbynumber
9104 eval $inlibc
9105
9106 : see if getprotoent exists
9107 set getprotoent d_getpent
9108 eval $inlibc
9109
9110 : see if getpgid exists
9111 set getpgid d_getpgid
9112 eval $inlibc
9113
9114 : see if getpgrp2 exists
9115 set getpgrp2 d_getpgrp2
9116 eval $inlibc
9117
9118 : see if getppid exists
9119 set getppid d_getppid
9120 eval $inlibc
9121
9122 : see if getpriority exists
9123 set getpriority d_getprior
9124 eval $inlibc
9125
9126 : see if prototypes for various getprotoxxx netdb.h functions are available
9127 echo " "
9128 set d_getprotoprotos getprotoent $i_netdb netdb.h
9129 eval $hasproto
9130
9131 : see if getpwent exists
9132 set getpwent d_getpwent
9133 eval $inlibc
9134
9135
9136 : see if getservbyname exists
9137 set getservbyname d_getsbyname
9138 eval $inlibc
9139
9140 : see if getservbyport exists
9141 set getservbyport d_getsbyport
9142 eval $inlibc
9143
9144 : see if getservent exists
9145 set getservent d_getsent
9146 eval $inlibc
9147
9148 : see if prototypes for various getservxxx netdb.h functions are available
9149 echo " "
9150 set d_getservprotos getservent $i_netdb netdb.h
9151 eval $hasproto
9152
9153 : see if getspent exists
9154 set getspent d_getspent
9155 eval $inlibc
9156
9157 : see if getspnam exists
9158 set getspnam d_getspnam
9159 eval $inlibc
9160
9161 : see if gettimeofday or ftime exists
9162 set gettimeofday d_gettimeod
9163 eval $inlibc
9164 case "$d_gettimeod" in
9165 "$undef")
9166         set ftime d_ftime 
9167         eval $inlibc
9168         ;;
9169 *)
9170         val="$undef"; set d_ftime; eval $setvar
9171         ;;
9172 esac
9173 case "$d_gettimeod$d_ftime" in
9174 "$undef$undef")
9175         echo " "
9176         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9177         ;;
9178 esac
9179
9180 : see if this is an grp system
9181 set grp.h i_grp
9182 eval $inhdr
9183
9184 case "$i_grp" in
9185 $define)
9186         xxx=`./findhdr grp.h`
9187         $cppstdin $cppflags $cppminus < $xxx >$$.h
9188
9189         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9190                 val="$define"
9191         else
9192                 val="$undef"
9193         fi
9194         set d_grpasswd
9195         eval $setvar
9196
9197         $rm -f $$.h
9198         ;;
9199 *)
9200         val="$undef";
9201         set d_grpasswd; eval $setvar
9202         ;;
9203 esac
9204
9205 : see if hasmntopt exists
9206 set hasmntopt d_hasmntopt
9207 eval $inlibc
9208
9209 : see if this is a netinet/in.h or sys/in.h system
9210 set netinet/in.h i_niin sys/in.h i_sysin
9211 eval $inhdr
9212
9213 : see if arpa/inet.h has to be included
9214 set arpa/inet.h i_arpainet
9215 eval $inhdr
9216
9217 : see if htonl --and friends-- exists
9218 val=''
9219 set htonl val
9220 eval $inlibc
9221
9222 : Maybe they are macros.
9223 case "$val" in
9224 $undef)
9225         $cat >htonl.c <<EOM
9226 #include <stdio.h>
9227 #include <sys/types.h>
9228 #$i_niin I_NETINET_IN
9229 #$i_sysin I_SYS_IN
9230 #$i_arpainet I_ARPA_INET
9231 #ifdef I_NETINET_IN
9232 #include <netinet/in.h>
9233 #endif
9234 #ifdef I_SYS_IN
9235 #include <sys/in.h>
9236 #endif
9237 #ifdef I_ARPA_INET
9238 #include <arpa/inet.h>
9239 #endif
9240 #ifdef htonl
9241 printf("Defined as a macro.");
9242 #endif
9243 EOM
9244         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9245         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9246                 val="$define"
9247                 echo "But it seems to be defined as a macro." >&4
9248         fi
9249         $rm -f htonl.?
9250         ;;
9251 esac
9252 set d_htonl
9253 eval $setvar
9254
9255 : index or strchr
9256 echo " "
9257 if set index val -f; eval $csym; $val; then
9258         if set strchr val -f d_strchr; eval $csym; $val; then
9259                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9260                         val="$define"
9261                         vali="$undef"
9262                         echo "strchr() found." >&4
9263                 else
9264                         val="$undef"
9265                         vali="$define"
9266                         echo "index() found." >&4
9267                 fi
9268         else
9269                 val="$undef"
9270                 vali="$define"
9271                 echo "index() found." >&4
9272         fi
9273 else
9274         if set strchr val -f d_strchr; eval $csym; $val; then
9275                 val="$define"
9276                 vali="$undef"
9277                 echo "strchr() found." >&4
9278         else
9279                 echo "No index() or strchr() found!" >&4
9280                 val="$undef"
9281                 vali="$undef"
9282         fi
9283 fi
9284 set d_strchr; eval $setvar
9285 val="$vali"
9286 set d_index; eval $setvar
9287
9288 : check whether inet_aton exists
9289 set inet_aton d_inetaton
9290 eval $inlibc
9291
9292 : Look for isascii
9293 echo " "
9294 $cat >isascii.c <<'EOCP'
9295 #include <stdio.h>
9296 #include <ctype.h>
9297 int main() {
9298         int c = 'A';
9299         if (isascii(c))
9300                 exit(0);
9301         else
9302                 exit(1);
9303 }
9304 EOCP
9305 set isascii
9306 if eval $compile; then
9307         echo "isascii() found." >&4
9308         val="$define"
9309 else
9310         echo "isascii() NOT found." >&4
9311         val="$undef"
9312 fi
9313 set d_isascii
9314 eval $setvar
9315 $rm -f isascii*
9316
9317 : see if killpg exists
9318 set killpg d_killpg
9319 eval $inlibc
9320
9321 : see if lchown exists
9322 echo " "
9323 $cat > try.c <<'EOCP'
9324 /* System header to define __stub macros and hopefully few prototypes,
9325     which can conflict with char lchown(); below.  */
9326 #include <assert.h>
9327 /* Override any gcc2 internal prototype to avoid an error.  */
9328 /* We use char because int might match the return type of a gcc2
9329    builtin and then its argument prototype would still apply.  */
9330 char lchown();
9331 int main() {
9332     /*  The GNU C library defines this for functions which it implements
9333         to always fail with ENOSYS.  Some functions are actually named
9334         something starting with __ and the normal name is an alias.  */
9335 #if defined (__stub_lchown) || defined (__stub___lchown)
9336 choke me
9337 #else
9338 lchown();
9339 #endif
9340 ; return 0; }
9341 EOCP
9342 set try
9343 if eval $compile; then
9344     $echo "lchown() found." >&4
9345     val="$define"
9346 else
9347     $echo "lchown() NOT found." >&4
9348     val="$undef"
9349 fi
9350 set d_lchown
9351 eval $setvar
9352
9353 : See if number of significant digits in a double precision number is known
9354 echo " "
9355 $cat >ldbl_dig.c <<EOM
9356 #$i_limits I_LIMITS
9357 #$i_float I_FLOAT
9358 #ifdef I_LIMITS
9359 #include <limits.h>
9360 #endif
9361 #ifdef I_FLOAT
9362 #include <float.h>
9363 #endif
9364 #ifdef LDBL_DIG
9365 printf("Contains LDBL_DIG");
9366 #endif
9367 EOM
9368 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9369 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9370         echo "LDBL_DIG found." >&4
9371         val="$define"
9372 else
9373         echo "LDBL_DIG NOT found." >&4
9374         val="$undef"
9375 fi
9376 $rm -f ldbl_dig.?
9377 set d_ldbl_dig
9378 eval $setvar
9379
9380 : see if link exists
9381 set link d_link
9382 eval $inlibc
9383
9384 : see if localeconv exists
9385 set localeconv d_locconv
9386 eval $inlibc
9387
9388 : see if lockf exists
9389 set lockf d_lockf
9390 eval $inlibc
9391
9392 : check for long long
9393 echo " "
9394 $echo $n "Checking to see if your system supports long long..." $c >&4
9395 echo 'int main() { long long x = 7; return 0; }' > try.c
9396 set try
9397 if eval $compile; then
9398         val="$define"
9399         echo " Yes, it does." >&4
9400 else
9401         val="$undef"
9402         echo " No, it doesn't." >&4
9403 fi
9404 $rm try.*
9405 set d_longlong
9406 eval $setvar
9407
9408 : check for length of long long
9409 case "${d_longlong}${longlongsize}" in
9410 $define)
9411         echo " "
9412         $echo $n "Checking to see how big your long longs are..." $c >&4
9413         $cat >try.c <<'EOCP'
9414 #include <stdio.h>
9415 int main()
9416 {
9417     printf("%d\n", (int)sizeof(long long));
9418     return(0);
9419 }
9420 EOCP
9421         set try
9422         if eval $compile_ok; then
9423                 longlongsize=`./try$exe_ext`
9424                 $echo " $longlongsize bytes." >&4
9425         else
9426                 dflt='8'
9427                 echo " "
9428                 echo "(I can't seem to compile the test program.  Guessing...)"
9429                 rp="What is the size of a long long (in bytes)?"
9430                 . ./myread
9431                 longlongsize="$ans"
9432         fi
9433         if $test "X$longsize" = "X$longlongsize"; then
9434                 echo "(That isn't any different from an ordinary long.)"
9435         fi      
9436         ;;
9437 esac
9438 $rm -f try.* try
9439
9440 : see if lstat exists
9441 set lstat d_lstat
9442 eval $inlibc
9443
9444 : see if mblen exists
9445 set mblen d_mblen
9446 eval $inlibc
9447
9448 : see if mbstowcs exists
9449 set mbstowcs d_mbstowcs
9450 eval $inlibc
9451
9452 : see if mbtowc exists
9453 set mbtowc d_mbtowc
9454 eval $inlibc
9455
9456 : see if memchr exists
9457 set memchr d_memchr
9458 eval $inlibc
9459
9460 : see if memcmp exists
9461 set memcmp d_memcmp
9462 eval $inlibc
9463
9464 : see if memcpy exists
9465 set memcpy d_memcpy
9466 eval $inlibc
9467
9468 : see if memmove exists
9469 set memmove d_memmove
9470 eval $inlibc
9471
9472 : see if memset exists
9473 set memset d_memset
9474 eval $inlibc
9475
9476 : see if mkdir exists
9477 set mkdir d_mkdir
9478 eval $inlibc
9479
9480 : see if mkfifo exists
9481 set mkfifo d_mkfifo
9482 eval $inlibc
9483
9484 : see if mktime exists
9485 set mktime d_mktime
9486 eval $inlibc
9487
9488 : see if msgctl exists
9489 set msgctl d_msgctl
9490 eval $inlibc
9491
9492 : see if msgget exists
9493 set msgget d_msgget
9494 eval $inlibc
9495
9496 : see if msgsnd exists
9497 set msgsnd d_msgsnd
9498 eval $inlibc
9499
9500 : see if msgrcv exists
9501 set msgrcv d_msgrcv
9502 eval $inlibc
9503
9504 : see how much of the 'msg*(2)' library is present.
9505 h_msg=true
9506 echo " "
9507 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9508 *"$undef"*) h_msg=false;;
9509 esac
9510 case "$osname" in
9511 freebsd)
9512     case "`ipcs 2>&1`" in
9513     "SVID messages"*"not configured"*)
9514         echo "Your $osname does not have the msg*(2) configured." >&4
9515         h_msg=false
9516         val="$undef"
9517         set msgctl d_msgctl
9518         eval $setvar
9519         set msgget d_msgget
9520         eval $setvar
9521         set msgsnd d_msgsnd
9522         eval $setvar
9523         set msgrcv d_msgrcv
9524         eval $setvar
9525         ;;
9526     esac
9527     ;;
9528 esac
9529 : we could also check for sys/ipc.h ...
9530 if $h_msg && $test `./findhdr sys/msg.h`; then
9531         echo "You have the full msg*(2) library." >&4
9532         val="$define"
9533 else
9534         echo "You don't have the full msg*(2) library." >&4
9535         val="$undef"
9536 fi
9537 set d_msg
9538 eval $setvar
9539
9540 : see if nice exists
9541 set nice d_nice
9542 eval $inlibc
9543
9544 : see if POSIX threads are available
9545 set pthread.h i_pthread
9546 eval $inhdr
9547
9548
9549
9550
9551 : how to create joinable pthreads
9552 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9553         echo " "
9554         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9555         $cat >try.c <<'EOCP'
9556 #include <pthread.h>
9557 int main() {
9558     int detachstate = JOINABLE;
9559 }
9560 EOCP
9561         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9562         if eval $compile; then
9563                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9564                 val="$undef" # Yes, undef.
9565                 set d_old_pthread_create_joinable
9566                 eval $setvar
9567                 val=""
9568                 set old_pthread_create_joinable
9569                 eval $setvar
9570         else
9571                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9572                 if eval $compile; then
9573                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9574                         val="$define"
9575                         set d_old_pthread_create_joinable
9576                         eval $setvar
9577                         val=PTHREAD_CREATE_UNDETACHED
9578                         set old_pthread_create_joinable
9579                         eval $setvar
9580                 else            
9581                         set try -DJOINABLE=__UNDETACHED
9582                         if eval $compile; then
9583                                 echo "You seem to use __UNDETACHED." >&4
9584                                 val="$define"
9585                                 set d_old_pthread_create_joinable
9586                                 eval $setvar
9587                                 val=__UNDETACHED
9588                                 set old_pthread_create_joinable
9589                                 eval $setvar
9590                         else
9591                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9592                                 val="$define"
9593                                 set d_old_pthread_create_joinable
9594                                 eval $setvar
9595                                 val=0
9596                                 set old_pthread_create_joinable
9597                                 eval $setvar
9598                         fi
9599                 fi
9600         fi
9601         $rm -f try try.*
9602 else
9603     d_old_pthread_create_joinable="$undef"
9604     old_pthread_create_joinable=""
9605 fi
9606
9607 : see if pause exists
9608 set pause d_pause
9609 eval $inlibc
9610
9611 : see if pipe exists
9612 set pipe d_pipe
9613 eval $inlibc
9614
9615 : see if poll exists
9616 set poll d_poll
9617 eval $inlibc
9618
9619
9620 : see whether the various POSIXish _yields exist
9621 $cat >try.c <<EOP
9622 #include <pthread.h>
9623 #include <stdio.h>
9624 int main() {
9625 #ifdef SCHED_YIELD
9626         sched_yield();
9627 #else
9628 #ifdef PTHREAD_YIELD
9629         pthread_yield();
9630 #else
9631 #ifdef PTHREAD_YIELD_NULL
9632         pthread_yield(NULL);
9633 #endif
9634 #endif
9635 #endif
9636 }
9637 EOP
9638 : see if sched_yield exists
9639 set try -DSCHED_YIELD
9640 if eval $compile; then
9641     val="$define"
9642     sched_yield='sched_yield()'
9643 else
9644     val="$undef"
9645 fi
9646 case "$usethreads" in
9647 $define)
9648         case "$val" in
9649         $define) echo 'sched_yield() found.' >&4        ;;
9650         *)       echo 'sched_yield() NOT found.' >&4    ;;
9651         esac
9652 esac
9653 set d_sched_yield
9654 eval $setvar
9655
9656 : see if pthread_yield exists
9657 set try -DPTHREAD_YIELD
9658 if eval $compile; then
9659     val="$define"
9660     case "$sched_yield" in
9661     '') sched_yield='pthread_yield()' ;;
9662     esac
9663 else
9664     set try -DPTHREAD_YIELD_NULL
9665     if eval $compile; then
9666         val="$define"
9667         case "$sched_yield" in
9668         '') sched_yield='pthread_yield(NULL)' ;;
9669         esac
9670     else
9671         val="$undef"
9672     fi
9673 fi
9674 case "$usethreads" in
9675 $define)
9676         case "$val" in
9677         $define) echo 'pthread_yield() found.' >&4      ;;
9678         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9679         esac
9680         ;;
9681 esac
9682 set d_pthread_yield
9683 eval $setvar
9684
9685 case "$sched_yield" in
9686 '') sched_yield=undef ;;
9687 esac
9688
9689 $rm -f try try.*
9690
9691 : see if this is a pwd.h system
9692 set pwd.h i_pwd
9693 eval $inhdr
9694
9695 case "$i_pwd" in
9696 $define)
9697         xxx=`./findhdr pwd.h`
9698         $cppstdin $cppflags $cppminus < $xxx >$$.h
9699
9700         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9701                 val="$define"
9702         else
9703                 val="$undef"
9704         fi
9705         set d_pwquota
9706         eval $setvar
9707
9708         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9709                 val="$define"
9710         else
9711                 val="$undef"
9712         fi
9713         set d_pwage
9714         eval $setvar
9715
9716         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9717                 val="$define"
9718         else
9719                 val="$undef"
9720         fi
9721         set d_pwchange
9722         eval $setvar
9723
9724         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9725                 val="$define"
9726         else
9727                 val="$undef"
9728         fi
9729         set d_pwclass
9730         eval $setvar
9731
9732         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9733                 val="$define"
9734         else
9735                 val="$undef"
9736         fi
9737         set d_pwexpire
9738         eval $setvar
9739
9740         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9741                 val="$define"
9742         else
9743                 val="$undef"
9744         fi
9745         set d_pwcomment
9746         eval $setvar
9747
9748         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9749                 val="$define"
9750         else
9751                 val="$undef"
9752         fi
9753         set d_pwgecos
9754         eval $setvar
9755
9756         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9757                 val="$define"
9758         else
9759                 val="$undef"
9760         fi
9761         set d_pwpasswd
9762         eval $setvar
9763
9764         $rm -f $$.h
9765         ;;
9766 *)
9767         val="$undef"; 
9768         set d_pwquota; eval $setvar
9769         set d_pwage; eval $setvar
9770         set d_pwchange; eval $setvar
9771         set d_pwclass; eval $setvar
9772         set d_pwexpire; eval $setvar
9773         set d_pwcomment; eval $setvar
9774         set d_pwgecos; eval $setvar
9775         set d_pwpasswd; eval $setvar
9776         ;;
9777 esac
9778
9779 : see if inttypes.h is available
9780 : we want a real compile instead of Inhdr because some systems
9781 : have an inttypes.h which includes non-existent headers
9782 echo " "
9783 $cat >try.c <<EOCP
9784 #include <inttypes.h>
9785 int main() {
9786         static int32_t foo32 = 0x12345678;
9787 }
9788 EOCP
9789 set try
9790 if eval $compile; then
9791         echo "<inttypes.h> found." >&4
9792         val="$define"
9793 else
9794         echo "<inttypes.h> NOT found." >&4
9795         val="$undef"
9796 fi
9797 $rm -f try.c try
9798 set i_inttypes
9799 eval $setvar
9800
9801 : check for int64_t
9802 echo " "
9803 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9804 $cat >try.c <<EOCP
9805 #include <sys/types.h>
9806 #$i_inttypes I_INTTYPES
9807 #ifdef I_INTTYPES
9808 #include <inttypes.h>
9809 #endif
9810 int main() { int64_t x = 7; }
9811 EOCP
9812 set try
9813 if eval $compile; then
9814         val="$define"
9815         echo " Yes, it does." >&4
9816 else
9817         val="$undef"
9818         echo " No, it doesn't." >&4
9819 fi
9820 $rm -f try try.*
9821 set d_int64t
9822 eval $setvar
9823
9824
9825 echo " "
9826 echo "Checking which 64-bit integer type we could use..." >&4
9827
9828 case "$intsize" in
9829 8) val=int
9830    set quadtype
9831    eval $setvar
9832    val='"unsigned int"'
9833    set uquadtype
9834    eval $setvar
9835    quadkind=1
9836    ;;
9837 *) case "$longsize" in
9838    8) val=long
9839       set quadtype
9840       eval $setvar
9841       val='"unsigned long"'
9842       set uquadtype
9843       eval $setvar
9844       quadkind=2
9845       ;;
9846    *) case "$uselonglong:$d_longlong:$longlongsize" in
9847       define:define:8)
9848         val='"long long"'
9849         set quadtype
9850         eval $setvar
9851         val='"unsigned long long"'
9852         set uquadtype
9853         eval $setvar
9854         quadkind=3
9855         ;;
9856       *) case "$d_int64t" in
9857          define)
9858            val=int64_t
9859            set quadtype
9860            eval $setvar
9861            val=uint64_t
9862            set uquadtype
9863            eval $setvar
9864            quadkind=4
9865            ;;
9866          esac
9867          ;;
9868       esac
9869       ;;
9870    esac
9871    ;;
9872 esac
9873
9874 case "$quadtype" in
9875 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9876         undef:define:8)
9877            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9878         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9879         esac
9880         d_quad="$undef"
9881         ;;
9882 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9883             verb="will"
9884         else
9885             verb="could"
9886         fi
9887         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9888         d_quad="$define"
9889         ;;
9890 esac
9891
9892 : see if readdir and friends exist
9893 set readdir d_readdir
9894 eval $inlibc
9895 set seekdir d_seekdir
9896 eval $inlibc
9897 set telldir d_telldir
9898 eval $inlibc
9899 set rewinddir d_rewinddir
9900 eval $inlibc
9901
9902 : see if readlink exists
9903 set readlink d_readlink
9904 eval $inlibc
9905
9906 : see if rename exists
9907 set rename d_rename
9908 eval $inlibc
9909
9910 : see if rmdir exists
9911 set rmdir d_rmdir
9912 eval $inlibc
9913
9914 : see if memory.h is available.
9915 val=''
9916 set memory.h val
9917 eval $inhdr
9918
9919 : See if it conflicts with string.h
9920 case "$val" in
9921 $define)
9922         case "$strings" in
9923         '') ;;
9924         *)
9925                 $cppstdin $cppflags $cppminus < $strings > mem.h
9926                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9927                         echo " "
9928                         echo "We won't be including <memory.h>."
9929                         val="$undef"
9930                 fi
9931                 $rm -f mem.h
9932                 ;;
9933         esac
9934 esac
9935 set i_memory
9936 eval $setvar
9937
9938 : can bcopy handle overlapping blocks?
9939 val="$undef"
9940 case "$d_bcopy" in
9941 "$define")
9942         echo " "
9943         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9944         $cat >try.c <<EOCP
9945 #$i_memory I_MEMORY
9946 #$i_stdlib I_STDLIB
9947 #$i_string I_STRING
9948 #$i_unistd I_UNISTD
9949 EOCP
9950         $cat >>try.c <<'EOCP'
9951 #include <stdio.h>
9952 #ifdef I_MEMORY
9953 #  include <memory.h>
9954 #endif
9955 #ifdef I_STDLIB
9956 #  include <stdlib.h>
9957 #endif
9958 #ifdef I_STRING
9959 #  include <string.h>
9960 #else
9961 #  include <strings.h>
9962 #endif
9963 #ifdef I_UNISTD
9964 #  include <unistd.h>  /* Needed for NetBSD */
9965 #endif
9966 int main()
9967 {
9968 char buf[128], abc[128];
9969 char *b;
9970 int len;
9971 int off;
9972 int align;
9973
9974 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9975
9976 for (align = 7; align >= 0; align--) {
9977         for (len = 36; len; len--) {
9978                 b = buf+align;
9979                 bcopy(abc, b, len);
9980                 for (off = 1; off <= len; off++) {
9981                         bcopy(b, b+off, len);
9982                         bcopy(b+off, b, len);
9983                         if (bcmp(b, abc, len))
9984                                 exit(1);
9985                 }
9986         }
9987 }
9988 exit(0);
9989 }
9990 EOCP
9991         set try
9992         if eval $compile_ok; then
9993                 if ./try 2>/dev/null; then
9994                         echo "Yes, it can."
9995                         val="$define"
9996                 else
9997                         echo "It can't, sorry."
9998                         case "$d_memmove" in
9999                         "$define") echo "But that's Ok since you have memmove()." ;;
10000                         esac
10001                 fi
10002         else
10003                 echo "(I can't compile the test program, so we'll assume not...)"
10004                 case "$d_memmove" in
10005                 "$define") echo "But that's Ok since you have memmove()." ;;
10006                 esac
10007         fi
10008         ;;
10009 esac
10010 $rm -f try.* try core
10011 set d_safebcpy
10012 eval $setvar
10013
10014 : can memcpy handle overlapping blocks?
10015 val="$undef"
10016 case "$d_memcpy" in
10017 "$define")
10018         echo " "
10019         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10020         $cat >try.c <<EOCP
10021 #$i_memory I_MEMORY
10022 #$i_stdlib I_STDLIB
10023 #$i_string I_STRING
10024 #$i_unistd I_UNISTD
10025 EOCP
10026         $cat >>try.c <<'EOCP'
10027 #include <stdio.h>
10028 #ifdef I_MEMORY
10029 #  include <memory.h>
10030 #endif
10031 #ifdef I_STDLIB
10032 #  include <stdlib.h>
10033 #endif
10034 #ifdef I_STRING
10035 #  include <string.h>
10036 #else
10037 #  include <strings.h>
10038 #endif
10039 #ifdef I_UNISTD
10040 #  include <unistd.h>  /* Needed for NetBSD */
10041 #endif
10042 int main()
10043 {
10044 char buf[128], abc[128];
10045 char *b;
10046 int len;
10047 int off;
10048 int align;
10049
10050 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10051    try to store the string in read-only memory. */
10052 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10053
10054 for (align = 7; align >= 0; align--) {
10055         for (len = 36; len; len--) {
10056                 b = buf+align;
10057                 memcpy(b, abc, len);
10058                 for (off = 1; off <= len; off++) {
10059                         memcpy(b+off, b, len);
10060                         memcpy(b, b+off, len);
10061                         if (memcmp(b, abc, len))
10062                                 exit(1);
10063                 }
10064         }
10065 }
10066 exit(0);
10067 }
10068 EOCP
10069         set try
10070         if eval $compile_ok; then
10071                 if ./try 2>/dev/null; then
10072                         echo "Yes, it can."
10073                         val="$define"
10074                 else
10075                         echo "It can't, sorry."
10076                         case "$d_memmove" in
10077                         "$define") echo "But that's Ok since you have memmove()." ;;
10078                         esac
10079                 fi
10080         else
10081                 echo "(I can't compile the test program, so we'll assume not...)"
10082                 case "$d_memmove" in
10083                 "$define") echo "But that's Ok since you have memmove()." ;;
10084                 esac
10085         fi
10086         ;;
10087 esac
10088 $rm -f try.* try core
10089 set d_safemcpy
10090 eval $setvar
10091
10092 : can memcmp be trusted to compare relative magnitude?
10093 val="$undef"
10094 case "$d_memcmp" in
10095 "$define")
10096         echo " "
10097         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10098         $cat >try.c <<EOCP
10099 #$i_memory I_MEMORY
10100 #$i_stdlib I_STDLIB
10101 #$i_string I_STRING
10102 #$i_unistd I_UNISTD
10103 EOCP
10104         $cat >>try.c <<'EOCP'
10105 #include <stdio.h>
10106 #ifdef I_MEMORY
10107 #  include <memory.h>
10108 #endif
10109 #ifdef I_STDLIB
10110 #  include <stdlib.h>
10111 #endif
10112 #ifdef I_STRING
10113 #  include <string.h>
10114 #else
10115 #  include <strings.h>
10116 #endif
10117 #ifdef I_UNISTD
10118 #  include <unistd.h>  /* Needed for NetBSD */
10119 #endif
10120 int main()
10121 {
10122 char a = -1;
10123 char b = 0;
10124 if ((a < b) && memcmp(&a, &b, 1) < 0)
10125         exit(1);
10126 exit(0);
10127 }
10128 EOCP
10129         set try
10130         if eval $compile_ok; then
10131                 if ./try 2>/dev/null; then
10132                         echo "Yes, it can."
10133                         val="$define"
10134                 else
10135                         echo "No, it can't (it uses signed chars)."
10136                 fi
10137         else
10138                 echo "(I can't compile the test program, so we'll assume not...)"
10139         fi
10140         ;;
10141 esac
10142 $rm -f try.* try core
10143 set d_sanemcmp
10144 eval $setvar
10145
10146 : see if select exists
10147 set select d_select
10148 eval $inlibc
10149
10150 : see if semctl exists
10151 set semctl d_semctl
10152 eval $inlibc
10153
10154 : see if semget exists
10155 set semget d_semget
10156 eval $inlibc
10157
10158 : see if semop exists
10159 set semop d_semop
10160 eval $inlibc
10161
10162 : see how much of the 'sem*(2)' library is present.
10163 h_sem=true
10164 echo " "
10165 case "$d_semctl$d_semget$d_semop" in
10166 *"$undef"*) h_sem=false;;
10167 esac
10168 case "$osname" in
10169 freebsd)
10170     case "`ipcs 2>&1`" in
10171     "SVID messages"*"not configured"*)
10172         echo "Your $osname does not have the sem*(2) configured." >&4
10173         h_sem=false
10174         val="$undef"
10175         set semctl d_semctl
10176         eval $setvar
10177         set semget d_semget
10178         eval $setvar
10179         set semop d_semop
10180         eval $setvar
10181         ;;
10182     esac
10183     ;;
10184 esac
10185 : we could also check for sys/ipc.h ...
10186 if $h_sem && $test `./findhdr sys/sem.h`; then
10187         echo "You have the full sem*(2) library." >&4
10188         val="$define"
10189 else
10190         echo "You don't have the full sem*(2) library." >&4
10191         val="$undef"
10192 fi
10193 set d_sem
10194 eval $setvar
10195
10196 : see whether sys/sem.h defines union semun
10197 echo " "
10198 $cat > try.c <<'END'
10199 #include <sys/types.h>
10200 #include <sys/ipc.h>
10201 #include <sys/sem.h>
10202 int main () { union semun semun; semun.buf = 0; }
10203 END
10204 set try
10205 if eval $compile; then
10206     echo "You have union semun in <sys/sem.h>." >&4
10207     val="$define"
10208 else
10209     echo "You do not have union semun in <sys/sem.h>." >&4
10210     val="$undef"
10211 fi
10212 $rm -f try try.c try.h
10213 set d_union_semun
10214 eval $setvar
10215
10216 : see how to do semctl IPC_STAT
10217 case "$d_sem" in
10218 $define)
10219     : see whether semctl IPC_STAT can use union semun
10220     echo " "
10221     $cat > try.h <<END
10222 #ifndef S_IRUSR
10223 #   ifdef S_IREAD
10224 #       define S_IRUSR S_IREAD
10225 #       define S_IWUSR S_IWRITE
10226 #       define S_IXUSR S_IEXEC
10227 #   else
10228 #       define S_IRUSR 0400
10229 #       define S_IWUSR 0200
10230 #       define S_IXUSR 0100
10231 #   endif
10232 #   define S_IRGRP (S_IRUSR>>3)
10233 #   define S_IWGRP (S_IWUSR>>3)
10234 #   define S_IXGRP (S_IXUSR>>3)
10235 #   define S_IROTH (S_IRUSR>>6)
10236 #   define S_IWOTH (S_IWUSR>>6)
10237 #   define S_IXOTH (S_IXUSR>>6)
10238 #endif
10239 #ifndef S_IRWXU
10240 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10241 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10242 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10243 #endif
10244 END
10245
10246     $cat > try.c <<END
10247 #include <sys/types.h>
10248 #include <sys/ipc.h>
10249 #include <sys/sem.h>
10250 #include <sys/stat.h>
10251 #include <stdio.h>
10252 #include <errno.h>
10253 #include "try.h"
10254 #ifndef errno
10255 extern int errno;
10256 #endif
10257 #$d_union_semun HAS_UNION_SEMUN
10258 int main() {
10259     union semun
10260 #ifndef HAS_UNION_SEMUN
10261     {
10262         int val;
10263         struct semid_ds *buf;
10264         unsigned short *array;
10265     }
10266 #endif
10267     arg;
10268     int sem, st;
10269
10270 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10271     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10272     if (sem > -1) {
10273         struct semid_ds argbuf;
10274         arg.buf = &argbuf;
10275 #       ifdef IPC_STAT
10276         st = semctl(sem, 0, IPC_STAT, arg);
10277         if (st == 0)
10278             printf("semun\n");
10279         else
10280 #       endif /* IPC_STAT */
10281             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10282 #       ifdef IPC_RMID
10283         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10284 #       endif /* IPC_RMID */
10285             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10286     } else
10287 #endif /* IPC_PRIVATE && ... */
10288         printf("semget failed: errno = %d\n", errno);
10289   return 0;
10290 }
10291 END
10292     val="$undef"
10293     set try
10294     if eval $compile; then
10295         xxx=`./try`
10296         case "$xxx" in
10297         semun) val="$define" ;;
10298         esac
10299     fi
10300     $rm -f try try.c
10301     set d_semctl_semun
10302     eval $setvar
10303     case "$d_semctl_semun" in
10304     $define)
10305         echo "You can use union semun for semctl IPC_STAT." >&4
10306         also='also'
10307         ;;
10308     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10309         also=''
10310         ;;
10311     esac
10312
10313     : see whether semctl IPC_STAT can use struct semid_ds pointer
10314     $cat > try.c <<'END'
10315 #include <sys/types.h>
10316 #include <sys/ipc.h>
10317 #include <sys/sem.h>
10318 #include <sys/stat.h>
10319 #include "try.h"
10320 #include <stdio.h>
10321 #include <errno.h>
10322 #ifndef errno
10323 extern int errno;
10324 #endif
10325 int main() {
10326     struct semid_ds arg;
10327     int sem, st;
10328
10329 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10330     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10331     if (sem > -1) {
10332 #       ifdef IPC_STAT
10333         st = semctl(sem, 0, IPC_STAT, &arg);
10334         if (st == 0)
10335             printf("semid_ds\n");
10336         else
10337 #       endif /* IPC_STAT */
10338             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10339 #       ifdef IPC_RMID
10340         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10341 #       endif /* IPC_RMID */
10342             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10343     } else
10344 #endif /* IPC_PRIVATE && ... */
10345         printf("semget failed: errno = %d\n", errno);
10346
10347     return 0;
10348 }
10349 END
10350     val="$undef"
10351     set try
10352     if eval $compile; then
10353         xxx=`./try`
10354         case "$xxx" in
10355         semid_ds) val="$define" ;;
10356         esac
10357     fi
10358     $rm -f try try.c
10359     set d_semctl_semid_ds
10360     eval $setvar
10361     case "$d_semctl_semid_ds" in
10362     $define)
10363         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10364         ;;
10365     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10366         ;;
10367     esac
10368     $rm -f try.h
10369     ;;
10370 *)  val="$undef"
10371
10372     # We do not have the full sem*(2) library, so assume we can not
10373     # use either.
10374
10375     set d_semctl_semun
10376     eval $setvar
10377
10378     set d_semctl_semid_ds
10379     eval $setvar
10380     ;;
10381 esac
10382
10383 : see if setegid exists
10384 set setegid d_setegid
10385 eval $inlibc
10386
10387 : see if seteuid exists
10388 set seteuid d_seteuid
10389 eval $inlibc
10390
10391 : see if setgrent exists
10392 set setgrent d_setgrent
10393 eval $inlibc
10394
10395 : see if sethostent exists
10396 set sethostent d_sethent
10397 eval $inlibc
10398
10399 : see if setlinebuf exists
10400 set setlinebuf d_setlinebuf
10401 eval $inlibc
10402
10403 : see if setlocale exists
10404 set setlocale d_setlocale
10405 eval $inlibc
10406
10407 : see if setnetent exists
10408 set setnetent d_setnent
10409 eval $inlibc
10410
10411 : see if setprotoent exists
10412 set setprotoent d_setpent
10413 eval $inlibc
10414
10415 : see if setpgid exists
10416 set setpgid d_setpgid
10417 eval $inlibc
10418
10419 : see if setpgrp2 exists
10420 set setpgrp2 d_setpgrp2
10421 eval $inlibc
10422
10423 : see if setpriority exists
10424 set setpriority d_setprior
10425 eval $inlibc
10426
10427 : see if setpwent exists
10428 set setpwent d_setpwent
10429 eval $inlibc
10430
10431 : see if setregid exists
10432 set setregid d_setregid
10433 eval $inlibc
10434 set setresgid d_setresgid
10435 eval $inlibc
10436
10437 : see if setreuid exists
10438 set setreuid d_setreuid
10439 eval $inlibc
10440 set setresuid d_setresuid
10441 eval $inlibc
10442
10443 : see if setrgid exists
10444 set setrgid d_setrgid
10445 eval $inlibc
10446
10447 : see if setruid exists
10448 set setruid d_setruid
10449 eval $inlibc
10450
10451 : see if setservent exists
10452 set setservent d_setsent
10453 eval $inlibc
10454
10455 : see if setsid exists
10456 set setsid d_setsid
10457 eval $inlibc
10458
10459 : see if setspent exists
10460 set setspent d_setspent
10461 eval $inlibc
10462
10463 : see if setvbuf exists
10464 set setvbuf d_setvbuf
10465 eval $inlibc
10466
10467 : see if sfio.h is available
10468 set sfio.h i_sfio
10469 eval $inhdr
10470
10471
10472 : see if sfio library is available
10473 case "$i_sfio" in
10474 $define)
10475         val=''
10476         set sfreserve val
10477         eval $inlibc
10478         ;;
10479 *)
10480         val="$undef"
10481         ;;
10482 esac
10483 : Ok, but do we want to use it.
10484 case "$val" in
10485 $define)
10486         case "$usesfio" in
10487         true|$define|[yY]*) dflt='y';;
10488         *) dflt='n';;
10489         esac
10490         echo "$package can use the sfio library, but it is experimental."
10491         rp="You seem to have sfio available, do you want to try using it?"
10492         . ./myread
10493         case "$ans" in
10494         y|Y) ;;
10495         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10496                 val="$undef"
10497                 : Remove sfio from list of libraries to use
10498                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10499                 shift
10500                 libs="$*"
10501                 echo "libs = $libs" >&4
10502                 ;;
10503         esac
10504         ;;
10505 *)      case "$usesfio" in
10506         true|$define|[yY]*)
10507                 echo "Sorry, cannot find sfio on this machine" >&4
10508                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10509                 ;;
10510         esac
10511         ;;
10512 esac
10513 set d_sfio
10514 eval $setvar
10515 case "$d_sfio" in
10516 $define) usesfio='true';;
10517 *) usesfio='false';;
10518 esac
10519
10520 : see if shmctl exists
10521 set shmctl d_shmctl
10522 eval $inlibc
10523
10524 : see if shmget exists
10525 set shmget d_shmget
10526 eval $inlibc
10527
10528 : see if shmat exists
10529 set shmat d_shmat
10530 eval $inlibc
10531 : see what shmat returns
10532 case "$d_shmat" in
10533 "$define")
10534         $cat >shmat.c <<'END'
10535 #include <sys/shm.h>
10536 void *shmat();
10537 END
10538         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10539                 shmattype='void *'
10540         else
10541                 shmattype='char *'
10542         fi
10543         echo "and it returns ($shmattype)." >&4
10544         : see if a prototype for shmat is available
10545         xxx=`./findhdr sys/shm.h`
10546         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10547         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10548                 val="$define"
10549         else
10550                 val="$undef"
10551         fi
10552         $rm -f shmat.[co]
10553         ;;
10554 *)
10555         val="$undef"
10556         ;;
10557 esac
10558 set d_shmatprototype
10559 eval $setvar
10560
10561 : see if shmdt exists
10562 set shmdt d_shmdt
10563 eval $inlibc
10564
10565 : see how much of the 'shm*(2)' library is present.
10566 h_shm=true
10567 echo " "
10568 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10569 *"$undef"*) h_shm=false;;
10570 esac
10571 case "$osname" in
10572 freebsd)
10573     case "`ipcs 2>&1`" in
10574     "SVID shared memory"*"not configured"*)
10575         echo "Your $osname does not have the shm*(2) configured." >&4
10576         h_shm=false
10577         val="$undef"
10578         set shmctl d_shmctl
10579         evat $setvar
10580         set shmget d_shmget
10581         evat $setvar
10582         set shmat d_shmat
10583         evat $setvar
10584         set shmdt d_shmdt
10585         evat $setvar
10586         ;;
10587     esac
10588     ;;
10589 esac
10590 : we could also check for sys/ipc.h ...
10591 if $h_shm && $test `./findhdr sys/shm.h`; then
10592         echo "You have the full shm*(2) library." >&4
10593         val="$define"
10594 else
10595         echo "You don't have the full shm*(2) library." >&4
10596         val="$undef"
10597 fi
10598 set d_shm
10599 eval $setvar
10600
10601 echo " "
10602 : see if we have sigaction
10603 if set sigaction val -f d_sigaction; eval $csym; $val; then
10604         echo 'sigaction() found.' >&4
10605         $cat > try.c <<'EOP'
10606 #include <stdio.h>
10607 #include <sys/types.h>
10608 #include <signal.h>
10609 int main()
10610 {
10611     struct sigaction act, oact;
10612     act.sa_flags = 0;
10613     oact.sa_handler = 0;
10614     /* so that act and oact are used */
10615     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10616 }
10617 EOP
10618         set try
10619         if eval $compile_ok; then
10620                 val="$define"
10621         else
10622                 echo "But you don't seem to have a useable struct sigaction." >&4
10623                 val="$undef"
10624         fi
10625 else
10626         echo 'sigaction NOT found.' >&4
10627         val="$undef"
10628 fi
10629 set d_sigaction; eval $setvar
10630 $rm -f try try$_o try.c
10631
10632 : see if sigsetjmp exists
10633 echo " "
10634 case "$d_sigsetjmp" in
10635 '')
10636         $cat >try.c <<'EOP'
10637 #include <setjmp.h>
10638 sigjmp_buf env;
10639 int set = 1;
10640 int main()
10641 {
10642         if (sigsetjmp(env,1))
10643                 exit(set);
10644         set = 0;
10645         siglongjmp(env, 1);
10646         exit(1);
10647 }
10648 EOP
10649         set try
10650         if eval $compile; then
10651                 if ./try >/dev/null 2>&1; then
10652                         echo "POSIX sigsetjmp found." >&4
10653                         val="$define"
10654                 else
10655                         $cat >&4 <<EOM
10656 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10657 I'll ignore them.
10658 EOM
10659                         val="$undef"
10660                 fi
10661         else
10662                 echo "sigsetjmp not found." >&4
10663                 val="$undef"
10664         fi
10665         ;;
10666 *) val="$d_sigsetjmp"
10667         case "$d_sigsetjmp" in
10668         $define) echo "POSIX sigsetjmp found." >&4;;
10669         $undef) echo "sigsetjmp not found." >&4;;
10670         esac
10671         ;;
10672 esac
10673 set d_sigsetjmp
10674 eval $setvar
10675 $rm -f try.c try
10676
10677 : see if sqrtl exists
10678 set sqrtl d_sqrtl
10679 eval $inlibc
10680
10681 : see if sys/stat.h is available
10682 set sys/stat.h i_sysstat
10683 eval $inhdr
10684
10685
10686 : see if stat knows about block sizes
10687 echo " "
10688 echo "Checking to see if your struct stat has st_blocks field..." >&4
10689 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10690 eval $hasfield
10691
10692
10693 : see if this is a sys/vfs.h system
10694 set sys/vfs.h i_sysvfs
10695 eval $inhdr
10696
10697
10698 : see if this is a sys/statfs.h system
10699 set sys/statfs.h i_sysstatfs
10700 eval $inhdr
10701
10702
10703 echo " "
10704 echo "Checking to see if your system supports struct statfs..." >&4
10705 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
10706 eval $hasstruct
10707 case "$d_statfs_s" in
10708 "$define")      echo "Yes, it does."   ;;
10709 *)              echo "No, it doesn't." ;;
10710 esac
10711
10712
10713
10714 : see if struct statfs knows about f_flags
10715 case "$d_statfs_s" in
10716 define) 
10717         echo " "
10718         echo "Checking to see if your struct statfs has f_flags field..." >&4
10719         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
10720         eval $hasfield
10721         ;;
10722 *)      val="$undef"
10723         set d_statfs_f_flags
10724         eval $setvar
10725         ;;
10726 esac
10727 case "$d_statfs_f_flags" in
10728 "$define")      echo "Yes, it does."   ;;
10729 *)              echo "No, it doesn't." ;;
10730 esac
10731
10732 : see if _ptr and _cnt from stdio act std
10733 echo " "
10734 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10735         echo "(Looks like you have stdio.h from Linux.)"
10736         case "$stdio_ptr" in
10737         '') stdio_ptr='((fp)->_IO_read_ptr)'
10738                 ptr_lval=$define
10739                 ;;
10740         *)      ptr_lval=$d_stdio_ptr_lval;;
10741         esac
10742         case "$stdio_cnt" in
10743         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10744                 cnt_lval=$undef
10745                 ;;
10746         *)      cnt_lval=$d_stdio_cnt_lval;;
10747         esac
10748         case "$stdio_base" in
10749         '') stdio_base='((fp)->_IO_read_base)';;
10750         esac
10751         case "$stdio_bufsiz" in
10752         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10753         esac
10754 else
10755         case "$stdio_ptr" in
10756         '') stdio_ptr='((fp)->_ptr)'
10757                 ptr_lval=$define
10758                 ;;
10759         *)      ptr_lval=$d_stdio_ptr_lval;;
10760         esac
10761         case "$stdio_cnt" in
10762         '') stdio_cnt='((fp)->_cnt)'
10763                 cnt_lval=$define
10764                 ;;
10765         *)      cnt_lval=$d_stdio_cnt_lval;;
10766         esac
10767         case "$stdio_base" in
10768         '') stdio_base='((fp)->_base)';;
10769         esac
10770         case "$stdio_bufsiz" in
10771         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10772         esac
10773 fi
10774 : test whether _ptr and _cnt really work
10775 echo "Checking how std your stdio is..." >&4
10776 $cat >try.c <<EOP
10777 #include <stdio.h>
10778 #define FILE_ptr(fp)    $stdio_ptr
10779 #define FILE_cnt(fp)    $stdio_cnt
10780 int main() {
10781         FILE *fp = fopen("try.c", "r");
10782         char c = getc(fp);
10783         if (
10784                 18 <= FILE_cnt(fp) &&
10785                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10786         )
10787                 exit(0);
10788         exit(1);
10789 }
10790 EOP
10791 val="$undef"
10792 set try
10793 if eval $compile; then
10794         if ./try; then
10795                 echo "Your stdio acts pretty std."
10796                 val="$define"
10797         else
10798                 echo "Your stdio isn't very std."
10799         fi
10800 else
10801         echo "Your stdio doesn't appear very std."
10802 fi
10803 $rm -f try.c try
10804 set d_stdstdio
10805 eval $setvar
10806
10807 : Can _ptr be used as an lvalue?
10808 case "$d_stdstdio$ptr_lval" in
10809 $define$define) val=$define ;;
10810 *) val=$undef ;;
10811 esac
10812 set d_stdio_ptr_lval
10813 eval $setvar
10814
10815 : Can _cnt be used as an lvalue?
10816 case "$d_stdstdio$cnt_lval" in
10817 $define$define) val=$define ;;
10818 *) val=$undef ;;
10819 esac
10820 set d_stdio_cnt_lval
10821 eval $setvar
10822
10823 : see if _base is also standard
10824 val="$undef"
10825 case "$d_stdstdio" in
10826 $define)
10827         $cat >try.c <<EOP
10828 #include <stdio.h>
10829 #define FILE_base(fp)   $stdio_base
10830 #define FILE_bufsiz(fp) $stdio_bufsiz
10831 int main() {
10832         FILE *fp = fopen("try.c", "r");
10833         char c = getc(fp);
10834         if (
10835                 19 <= FILE_bufsiz(fp) &&
10836                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10837         )
10838                 exit(0);
10839         exit(1);
10840 }
10841 EOP
10842         set try
10843         if eval $compile; then
10844                 if ./try; then
10845                         echo "And its _base field acts std."
10846                         val="$define"
10847                 else
10848                         echo "But its _base field isn't std."
10849                 fi
10850         else
10851                 echo "However, it seems to be lacking the _base field."
10852         fi
10853         $rm -f try.c try
10854         ;;
10855 esac
10856 set d_stdiobase
10857 eval $setvar
10858
10859 $cat >&4 <<EOM
10860 Checking how to access stdio streams by file descriptor number...
10861 EOM
10862 case "$stdio_stream_array" in
10863 '')     $cat >try.c <<EOCP
10864 #include <stdio.h>
10865 int main() {
10866   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10867     printf("yes\n");
10868 }
10869 EOCP
10870         for s in _iob __iob __sF
10871         do
10872                 set try -DSTDIO_STREAM_ARRAY=$s
10873                 if eval $compile; then
10874                         case "`./try$exe_ext`" in
10875                         yes)    stdio_stream_array=$s; break ;;
10876                         esac
10877                 fi
10878         done
10879         $rm -f try.* try$exe_ext
10880 esac
10881 case "$stdio_stream_array" in
10882 '')     $cat >&4 <<EOM
10883 I can't figure out how to access stdio streams by file descriptor number.
10884 EOM
10885         d_stdio_stream_array="$undef"
10886         ;;
10887 *)      $cat >&4 <<EOM
10888 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10889 EOM
10890         d_stdio_stream_array="$define"
10891         ;;
10892 esac
10893
10894 : see if strcoll exists
10895 set strcoll d_strcoll
10896 eval $inlibc
10897
10898 : check for structure copying
10899 echo " "
10900 echo "Checking to see if your C compiler can copy structs..." >&4
10901 $cat >try.c <<'EOCP'
10902 int main()
10903 {
10904         struct blurfl {
10905                 int dyick;
10906         } foo, bar;
10907
10908         foo = bar;
10909 }
10910 EOCP
10911 if $cc -c try.c >/dev/null 2>&1 ; then
10912         val="$define"
10913         echo "Yup, it can."
10914 else
10915         val="$undef"
10916         echo "Nope, it can't."
10917 fi
10918 set d_strctcpy
10919 eval $setvar
10920 $rm -f try.*
10921
10922 : see if strerror and/or sys_errlist[] exist
10923 echo " "
10924 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10925     if set strerror val -f d_strerror; eval $csym; $val; then
10926                 echo 'strerror() found.' >&4
10927                 d_strerror="$define"
10928                 d_strerrm='strerror(e)'
10929                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10930                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10931                         d_syserrlst="$define"
10932                 else
10933                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10934                         d_syserrlst="$undef"
10935                 fi
10936     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10937                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10938                 echo 'strerror() found in string header.' >&4
10939                 d_strerror="$define"
10940                 d_strerrm='strerror(e)'
10941                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10942                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10943                                 d_syserrlst="$define"
10944                 else
10945                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10946                         d_syserrlst="$undef"
10947                 fi
10948     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10949                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10950                 d_strerror="$undef"
10951                 d_syserrlst="$define"
10952                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10953     else
10954                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10955                 d_strerror="$undef"
10956                 d_syserrlst="$undef"
10957                 d_strerrm='"unknown"'
10958     fi
10959 fi
10960
10961 : see if strtod exists
10962 set strtod d_strtod
10963 eval $inlibc
10964
10965 : see if strtol exists
10966 set strtol d_strtol
10967 eval $inlibc
10968
10969 : see if strtold exists
10970 set strtold d_strtold
10971 eval $inlibc
10972
10973 : see if strtoll exists
10974 set strtoll d_strtoll
10975 eval $inlibc
10976
10977 : see if strtoul exists
10978 set strtoul d_strtoul
10979 eval $inlibc
10980
10981 : see if strtoull exists
10982 set strtoull d_strtoull
10983 eval $inlibc
10984
10985 : see if strtouq exists
10986 set strtouq d_strtouq
10987 eval $inlibc
10988
10989 : see if strxfrm exists
10990 set strxfrm d_strxfrm
10991 eval $inlibc
10992
10993 : see if symlink exists
10994 set symlink d_symlink
10995 eval $inlibc
10996
10997 : see if syscall exists
10998 set syscall d_syscall
10999 eval $inlibc
11000
11001 : see if sysconf exists
11002 set sysconf d_sysconf
11003 eval $inlibc
11004
11005 : see if system exists
11006 set system d_system
11007 eval $inlibc
11008
11009 : see if tcgetpgrp exists
11010 set tcgetpgrp d_tcgetpgrp
11011 eval $inlibc
11012
11013 : see if tcsetpgrp exists
11014 set tcsetpgrp d_tcsetpgrp
11015 eval $inlibc
11016
11017 : see if prototype for telldir is available
11018 echo " "
11019 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11020 eval $hasproto
11021
11022 : see if this is a sys/times.h system
11023 set sys/times.h i_systimes
11024 eval $inhdr
11025
11026 : see if times exists
11027 echo " "
11028 if set times val -f d_times; eval $csym; $val; then
11029         echo 'times() found.' >&4
11030         d_times="$define"
11031         inc=''
11032         case "$i_systimes" in
11033         "$define") inc='sys/times.h';;
11034         esac
11035         rp="What is the type returned by times() on this system?"
11036         set clock_t clocktype long stdio.h sys/types.h $inc
11037         eval $typedef_ask
11038 else
11039         echo 'times() NOT found, hope that will do.' >&4
11040         d_times="$undef"
11041         clocktype='int'
11042 fi
11043
11044 : see if truncate exists
11045 set truncate d_truncate
11046 eval $inlibc
11047
11048 : see if tzname[] exists
11049 echo " "
11050 if set tzname val -a d_tzname; eval $csym; $val; then
11051         val="$define"
11052         echo 'tzname[] found.' >&4
11053 else
11054         val="$undef"
11055         echo 'tzname[] NOT found.' >&4
11056 fi
11057 set d_tzname
11058 eval $setvar
11059
11060 : see if umask exists
11061 set umask d_umask
11062 eval $inlibc
11063
11064 : see if ustat exists
11065 set ustat d_ustat
11066 eval $inlibc
11067
11068 : backward compatibility for d_hvfork
11069 if test X$d_hvfork != X; then
11070         d_vfork="$d_hvfork"
11071         d_hvfork=''
11072 fi
11073 : see if there is a vfork
11074 val=''
11075 set vfork val
11076 eval $inlibc
11077
11078 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11079 : perl on Solaris 2.x, and probably elsewhere.
11080 case "$val" in
11081 $define)
11082         echo " "
11083         case "$usevfork" in
11084         false) dflt='n';;
11085         *) dflt='y';;
11086         esac
11087         cat <<'EOM'
11088  
11089 Perl can only use a vfork() that doesn't suffer from strict
11090 restrictions on calling functions or modifying global data in
11091 the child.  For example, glibc-2.1 contains such a vfork()
11092 that is unsuitable.  If your system provides a proper fork()
11093 call, chances are that you do NOT want perl to use vfork().
11094
11095 EOM
11096         rp="Do you still want to use vfork()?"
11097         . ./myread
11098         case "$ans" in
11099         y|Y) ;;
11100         *)
11101                 echo "Ok, we won't use vfork()."
11102                 val="$undef"
11103                 ;;
11104         esac
11105         ;;
11106 esac
11107 set d_vfork
11108 eval $setvar
11109 case "$d_vfork" in
11110 $define) usevfork='true';;
11111 *) usevfork='false';;
11112 esac
11113
11114 : see if this is an sysdir system
11115 set sys/dir.h i_sysdir
11116 eval $inhdr
11117
11118 : see if this is an sysndir system
11119 set sys/ndir.h i_sysndir
11120 eval $inhdr
11121
11122 : see if closedir exists
11123 set closedir d_closedir
11124 eval $inlibc
11125
11126 case "$d_closedir" in
11127 "$define")
11128         echo " "
11129         echo "Checking whether closedir() returns a status..." >&4
11130         cat > closedir.c <<EOM
11131 #$i_dirent I_DIRENT             /**/
11132 #$i_sysdir I_SYS_DIR            /**/
11133 #$i_sysndir I_SYS_NDIR          /**/
11134 #$i_systypes I_SYS_TYPES        /**/
11135
11136 #if defined(I_SYS_TYPES)
11137 #include <sys/types.h>
11138 #endif
11139 #if defined(I_DIRENT)
11140 #include <dirent.h>
11141 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11142 #include <sys/dir.h>
11143 #endif
11144 #else
11145 #ifdef I_SYS_NDIR
11146 #include <sys/ndir.h>
11147 #else
11148 #ifdef I_SYS_DIR
11149 #ifdef hp9000s500
11150 #include <ndir.h>       /* may be wrong in the future */
11151 #else
11152 #include <sys/dir.h>
11153 #endif
11154 #endif
11155 #endif
11156 #endif 
11157 int main() { return closedir(opendir(".")); }
11158 EOM
11159         set closedir
11160         if eval $compile_ok; then
11161                 if ./closedir > /dev/null 2>&1 ; then
11162                         echo "Yes, it does."
11163                         val="$undef"
11164                 else
11165                         echo "No, it doesn't."
11166                         val="$define"
11167                 fi
11168         else
11169                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11170                 val="$define"
11171         fi
11172         ;;
11173 *)
11174         val="$undef";
11175         ;;
11176 esac
11177 set d_void_closedir
11178 eval $setvar
11179 $rm -f closedir*
11180 : check for volatile keyword
11181 echo " "
11182 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11183 $cat >try.c <<'EOCP'
11184 int main()
11185 {
11186         typedef struct _goo_struct goo_struct;
11187         goo_struct * volatile goo = ((goo_struct *)0);
11188         struct _goo_struct {
11189                 long long_int;
11190                 int reg_int;
11191                 char char_var;
11192         };
11193         typedef unsigned short foo_t;
11194         char *volatile foo;
11195         volatile int bar;
11196         volatile foo_t blech;
11197         foo = foo;
11198 }
11199 EOCP
11200 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11201         val="$define"
11202         echo "Yup, it does."
11203 else
11204         val="$undef"
11205         echo "Nope, it doesn't."
11206 fi
11207 set d_volatile
11208 eval $setvar
11209 $rm -f try.*
11210
11211 : see if there is a wait4
11212 set wait4 d_wait4
11213 eval $inlibc
11214
11215 : see if waitpid exists
11216 set waitpid d_waitpid
11217 eval $inlibc
11218
11219 : see if wcstombs exists
11220 set wcstombs d_wcstombs
11221 eval $inlibc
11222
11223 : see if wctomb exists
11224 set wctomb d_wctomb
11225 eval $inlibc
11226
11227 : preserve RCS keywords in files with variable substitution, grrr
11228 Date='$Date'
11229 Id='$Id'
11230 Log='$Log'
11231 RCSfile='$RCSfile'
11232 Revision='$Revision'
11233
11234 case "$crosscompile" in
11235 ''|[nN]*) crosscompile="$undef" ;;
11236 esac
11237
11238 case "$osname" in
11239 next|rhapsody) multiarch="$define" ;;
11240 esac
11241 case "$multiarch" in
11242 ''|[nN]*) multiarch="$undef" ;;
11243 esac
11244
11245 : check for alignment requirements
11246 echo " "
11247 case "$crosscompile$multiarch" in
11248 *$define*)
11249         $cat <<EOM
11250 You seem to be either cross-compiling or doing a multiarchitecture build,
11251 skipping the memory alignment check.
11252
11253 EOM
11254         case "$alignbytes" in
11255         '') alignbytes=8 ;;
11256         esac
11257         ;;
11258 *)
11259         case "$alignbytes" in
11260         '') echo "Checking alignment constraints..." >&4
11261                 $cat >try.c <<'EOCP'
11262 #include <stdio.h>
11263 struct foobar {
11264         char foo;
11265         double bar;
11266 } try_algn;
11267 int main()
11268 {
11269     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11270     return(0);
11271 }
11272 EOCP
11273                 set try
11274                 if eval $compile_ok; then
11275                         dflt=`./try`
11276                 else
11277                         dflt='8'
11278                         echo "(I can't seem to compile the test program...)"
11279                 fi
11280                 ;;
11281         *) dflt="$alignbytes"
11282                 ;;
11283         esac
11284         rp="Doubles must be aligned on a how-many-byte boundary?"
11285         . ./myread
11286         alignbytes="$ans"
11287         $rm -f try.c try
11288         ;;
11289 esac
11290
11291
11292 : check for ordering of bytes in a long
11293 echo " "
11294 case "$crosscompile$multiarch" in
11295 *$define*)
11296         $cat <<EOM
11297 You seem to be either cross-compiling or doing a multiarchitecture build,
11298 skipping the byteorder check.
11299
11300 EOM
11301         byteorder='0xffff'
11302         ;;
11303 *)
11304         case "$byteorder" in
11305         '')
11306                 $cat <<'EOM'
11307 In the following, larger digits indicate more significance.  A big-endian
11308 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11309 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11310 machines may have weird orders like 3412.  A Cray will report 87654321,
11311 an Alpha will report 12345678. If the test program works the default is
11312 probably right.
11313 I'm now running the test program...
11314 EOM
11315                 $cat >try.c <<'EOCP'
11316 #include <stdio.h>
11317 int main()
11318 {
11319         int i;
11320         union {
11321                 unsigned long l;
11322                 char c[sizeof(long)];
11323         } u;
11324
11325         if (sizeof(long) > 4)
11326                 u.l = (0x08070605L << 32) | 0x04030201L;
11327         else
11328                 u.l = 0x04030201L;
11329         for (i = 0; i < sizeof(long); i++)
11330                 printf("%c", u.c[i]+'0');
11331         printf("\n");
11332         exit(0);
11333 }
11334 EOCP
11335                 xxx_prompt=y
11336                 set try
11337                 if eval $compile && ./try > /dev/null; then
11338                         dflt=`./try`
11339                         case "$dflt" in
11340                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11341                                 echo "(The test program ran ok.)"
11342                                 echo "byteorder=$dflt"
11343                                 xxx_prompt=n
11344                         ;;
11345                         ????|????????) echo "(The test program ran ok.)" ;;
11346                         *) echo "(The test program didn't run right for some reason.)" ;;
11347                         esac
11348                 else
11349                         dflt='4321'
11350                         cat <<'EOM'
11351 (I can't seem to compile the test program.  Guessing big-endian...)
11352 EOM
11353                 fi
11354                 case "$xxx_prompt" in
11355                 y)
11356                         rp="What is the order of bytes in a long?"
11357                         . ./myread
11358                         byteorder="$ans"
11359                         ;;
11360                 *)      byteorder=$dflt
11361                         ;;
11362                 esac
11363                 ;;
11364         esac
11365         $rm -f try.c try
11366         ;;
11367 esac
11368
11369
11370 : how do we catenate cpp tokens here?
11371 echo " "
11372 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11373 $cat >cpp_stuff.c <<'EOCP'
11374 #define RCAT(a,b)a/**/b
11375 #define ACAT(a,b)a ## b
11376 RCAT(Rei,ser)
11377 ACAT(Cir,cus)
11378 EOCP
11379 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11380 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11381         echo "Oh!  Smells like ANSI's been here." >&4
11382         echo "We can catify or stringify, separately or together!"
11383         cpp_stuff=42
11384 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11385         echo "Ah, yes!  The good old days!" >&4
11386         echo "However, in the good old days we don't know how to stringify and"
11387         echo "catify at the same time."
11388         cpp_stuff=1
11389 else
11390         $cat >&4 <<EOM
11391 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11392 to have to edit the values of CAT[2-5] in config.h...
11393 EOM
11394         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11395 fi
11396 $rm -f cpp_stuff.*
11397
11398 : see if this is a db.h system
11399 set db.h i_db
11400 eval $inhdr
11401
11402 case "$i_db" in
11403 $define)
11404         : Check db version.
11405         echo " "
11406         echo "Checking Berkeley DB version ..." >&4
11407         $cat >try.c <<EOCP
11408 #$d_const HASCONST
11409 #ifndef HASCONST
11410 #define const
11411 #endif
11412 #include <sys/types.h>
11413 #include <stdio.h>
11414 #include <db.h>
11415 int main()
11416 {
11417 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11418     int Major, Minor, Patch ;
11419     unsigned long Version ;
11420     (void)db_version(&Major, &Minor, &Patch) ;
11421     printf("You have Berkeley DB Version 2 or greater\n");
11422
11423     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11424                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11425     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11426                 Major, Minor, Patch) ;
11427
11428     /* check that db.h & libdb are compatible */
11429     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11430         printf("db.h and libdb are incompatible\n") ;
11431         exit(3);        
11432     }
11433
11434     printf("db.h and libdb are compatible\n") ;
11435
11436     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11437                 + DB_VERSION_PATCH ;
11438
11439     /* needs to be >= 2.3.4 */
11440     if (Version < 2003004) {
11441     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11442         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11443         exit(2);        
11444     }
11445
11446     exit(0);
11447 #else
11448 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11449     printf("You have Berkeley DB Version 1\n");
11450     exit(0);    /* DB version < 2: the coast is clear. */
11451 #else
11452     exit(1);    /* <db.h> not Berkeley DB? */
11453 #endif
11454 #endif
11455 }
11456 EOCP
11457         set try
11458         if eval $compile_ok && ./try; then
11459                 echo 'Looks OK.' >&4
11460         else
11461                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11462                 i_db=$undef
11463                 case " $libs " in
11464                 *"-ldb "*)
11465                         : Remove db from list of libraries to use
11466                         echo "Removing unusable -ldb from library list" >&4
11467                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11468                         shift
11469                         libs="$*"
11470                         echo "libs = $libs" >&4
11471                         ;;
11472                 esac
11473         fi
11474         $rm -f try.*
11475         ;;
11476 esac
11477
11478 case "$i_db" in
11479 define)
11480         : Check the return type needed for hash 
11481         echo " "
11482         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11483         $cat >try.c <<EOCP
11484 #$d_const HASCONST
11485 #ifndef HASCONST
11486 #define const
11487 #endif
11488 #include <sys/types.h>
11489 #include <db.h>
11490
11491 #ifndef DB_VERSION_MAJOR
11492 u_int32_t hash_cb (ptr, size)
11493 const void *ptr;
11494 size_t size;
11495 {
11496 }
11497 HASHINFO info;
11498 int main()
11499 {
11500         info.hash = hash_cb;
11501 }
11502 #endif
11503 EOCP
11504         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11505                 if $contains warning try.out >>/dev/null 2>&1 ; then
11506                         db_hashtype='int'
11507                 else
11508                         db_hashtype='u_int32_t'
11509                 fi
11510         else
11511                 : XXX Maybe we should just give up here.
11512                 db_hashtype=u_int32_t
11513                 $cat try.out >&4
11514                 echo "Help:  I can't seem to compile the db test program." >&4
11515                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11516         fi
11517         $rm -f try.*
11518         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11519         ;;
11520 *)      db_hashtype=u_int32_t
11521         ;;
11522 esac
11523 case "$i_db" in
11524 define)
11525         : Check the return type needed for prefix 
11526         echo " "
11527         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11528         cat >try.c <<EOCP
11529 #$d_const HASCONST
11530 #ifndef HASCONST
11531 #define const
11532 #endif
11533 #include <sys/types.h>
11534 #include <db.h>
11535
11536 #ifndef DB_VERSION_MAJOR
11537 size_t prefix_cb (key1, key2)
11538 const DBT *key1;
11539 const DBT *key2;
11540 {
11541 }
11542 BTREEINFO info;
11543 int main()
11544 {
11545         info.prefix = prefix_cb;
11546 }
11547 #endif
11548 EOCP
11549         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11550                 if $contains warning try.out >>/dev/null 2>&1 ; then
11551                         db_prefixtype='int'
11552                 else
11553                         db_prefixtype='size_t'
11554                 fi
11555         else
11556                 db_prefixtype='size_t'
11557                 : XXX Maybe we should just give up here.
11558                 $cat try.out >&4
11559                 echo "Help:  I can't seem to compile the db test program." >&4
11560                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11561         fi
11562         $rm -f try.*
11563         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11564         ;;
11565 *)      db_prefixtype='size_t'
11566         ;;
11567 esac
11568
11569 : check for void type
11570 echo " "
11571 echo "Checking to see how well your C compiler groks the void type..." >&4
11572 case "$voidflags" in
11573 '')
11574         $cat >try.c <<'EOCP'
11575 #if TRY & 1
11576 void sub() {
11577 #else
11578 sub() {
11579 #endif
11580         extern void moo();      /* function returning void */
11581         void (*goo)();          /* ptr to func returning void */
11582 #if TRY & 8
11583         void *hue;              /* generic ptr */
11584 #endif
11585 #if TRY & 2
11586         void (*foo[10])();
11587 #endif
11588
11589 #if TRY & 4
11590         if(goo == moo) {
11591                 exit(0);
11592         }
11593 #endif
11594         exit(0);
11595 }
11596 int main() { sub(); }
11597 EOCP
11598         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11599                 voidflags=$defvoidused
11600         echo "Good.  It appears to support void to the level $package wants.">&4
11601                 if $contains warning .out >/dev/null 2>&1; then
11602                         echo "However, you might get some warnings that look like this:"
11603                         $cat .out
11604                 fi
11605         else
11606 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11607                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11608                         echo "It supports 1..."
11609                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11610                                 echo "It also supports 2..."
11611                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11612                                         voidflags=7
11613                                         echo "And it supports 4 but not 8 definitely."
11614                                 else
11615                                         echo "It doesn't support 4..."
11616                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11617                                                 voidflags=11
11618                                                 echo "But it supports 8."
11619                                         else
11620                                                 voidflags=3
11621                                                 echo "Neither does it support 8."
11622                                         fi
11623                                 fi
11624                         else
11625                                 echo "It does not support 2..."
11626                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11627                                         voidflags=13
11628                                         echo "But it supports 4 and 8."
11629                                 else
11630                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11631                                                 voidflags=5
11632                                                 echo "And it supports 4 but has not heard about 8."
11633                                         else
11634                                                 echo "However it supports 8 but not 4."
11635                                         fi
11636                                 fi
11637                         fi
11638                 else
11639                         echo "There is no support at all for void."
11640                         voidflags=0
11641                 fi
11642         fi
11643 esac
11644 case "$voidflags" in
11645 "$defvoidused") ;;
11646 *)      $cat >&4 <<'EOM'
11647   Support flag bits are:
11648     1: basic void declarations.
11649     2: arrays of pointers to functions returning void.
11650     4: operations between pointers to and addresses of void functions.
11651     8: generic void pointers.
11652 EOM
11653         dflt="$voidflags";
11654         rp="Your void support flags add up to what?"
11655         . ./myread
11656         voidflags="$ans"
11657         ;;
11658 esac
11659 $rm -f try.* .out
11660
11661
11662 : How can we generate normalized random numbers ?
11663 echo " "
11664 echo "Looking for a random number function..." >&4
11665 case "$randfunc" in
11666 '')
11667         if set drand48 val -f; eval $csym; $val; then
11668                 dflt="drand48"
11669                 echo "Good, found drand48()." >&4
11670         elif set random val -f; eval $csym; $val; then
11671                 dflt="random"
11672                 echo "OK, found random()." >&4
11673         else
11674                 dflt="rand"
11675                 echo "Yick, looks like I have to use rand()." >&4
11676         fi
11677         echo " "
11678         ;;
11679 *)
11680         dflt="$randfunc"
11681         ;;
11682 esac
11683 cont=true
11684
11685 case "$ccflags" in
11686 *-Dmy_rand=*|*-Dmy_srand=*)
11687         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11688         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11689         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11690         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11691         ;;
11692 esac
11693
11694 while $test "$cont"; do
11695         rp="Use which function to generate random numbers?"
11696         . ./myread
11697         if $test "$ans" = "$dflt"; then
11698                 : null
11699         else
11700                 randbits=''
11701         fi
11702         randfunc="$ans"
11703         if set $ans val -f; eval $csym; $val; then
11704                 cont=''
11705         else
11706                 dflt=y
11707                 rp="I cannot find function $ans. Use that name anyway?"
11708                 . ./myread
11709                 dflt=rand
11710                 case "$ans" in
11711                         [yY]*) cont='';;
11712                 esac
11713         fi
11714         case "$cont" in
11715         '')
11716                 case "$randfunc" in
11717                 drand48)
11718                         drand01="drand48()"
11719                         seedfunc="srand48"
11720                         randbits=48
11721                         randseedtype=long
11722                         ;;
11723                 rand|random)
11724                         case "$randbits" in
11725                         '')
11726 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11727                                 $cat >try.c <<EOCP
11728 #$i_unistd I_UNISTD
11729 #$i_stdlib I_STDLIB
11730 #include <stdio.h>
11731 #ifdef I_UNISTD
11732 #  include <unistd.h>
11733 #endif
11734 #ifdef I_STDLIB
11735 #  include <stdlib.h>
11736 #endif
11737 int main()
11738 {
11739         register int i;
11740         register unsigned long tmp;
11741         register unsigned long max = 0L;
11742
11743         for (i = 1000; i; i--) {
11744                 tmp = (unsigned long) $randfunc();
11745                 if (tmp > max) max = tmp;
11746         }
11747         for (i = 0; max; i++)
11748                 max /= 2;
11749         printf("%d\n",i);
11750 }
11751 EOCP
11752                                 set try
11753                                 if eval $compile_ok; then
11754                                         dflt=`try`
11755                                 else
11756                                         dflt='?'
11757                                         echo "(I can't seem to compile the test program...)"
11758                                 fi
11759                                 ;;
11760                         *)
11761                                 dflt="$randbits"
11762                                 ;;
11763                         esac
11764                         rp="How many bits does your $randfunc() function produce?"
11765                         . ./myread
11766                         randbits="$ans"
11767                         $rm -f try.c try
11768                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11769                         seedfunc="s$randfunc"
11770                         randseedtype=unsigned
11771                         ;;
11772                 *)
11773                         dflt="31"
11774                         rp="How many bits does your $randfunc() function produce?"
11775                         . ./myread
11776                         randbits="$ans"
11777                         seedfunc="s$randfunc"
11778                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11779                         if set $seedfunc val -f; eval $csym; $val; then
11780                                 echo "(Using $seedfunc() to seed random generator)"
11781                         else
11782                                 echo "(Warning: no $seedfunc() to seed random generator)"
11783                                 seedfunc=rand
11784                         fi
11785                         randseedtype=unsigned
11786                         ;;
11787                 esac
11788                 ;;
11789         esac
11790 done
11791
11792 echo " "
11793 echo "Determining whether or not we are on an EBCDIC system..." >&4
11794 $cat >tebcdic.c <<'EOM'
11795 int main()
11796 {
11797   if ('M'==0xd4) return 0;
11798   return 1;
11799 }
11800 EOM
11801
11802 val=$undef
11803 set tebcdic
11804 if eval $compile_ok; then
11805         if ./tebcdic; then
11806                 echo "You have EBCDIC." >&4
11807                 val="$define"
11808         else
11809                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11810         fi
11811 else
11812         echo "I'm unable to compile the test program." >&4
11813         echo "I'll assume ASCII or some ISO Latin." >&4
11814 fi
11815 $rm -f tebcdic.c tebcdic
11816 set ebcdic
11817 eval $setvar
11818
11819 echo " "
11820 $cat >&4 <<EOM
11821 Checking how to flush all pending stdio output...
11822 EOM
11823 # I only know how to find the first 32 possibly open files on SunOS.
11824 # See also hints/sunos_4_1.sh and util.c  --AD
11825 case "$osname" in
11826 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11827 esac
11828 $cat >>try.c <<EOCP
11829 #include <stdio.h>
11830 #$i_unistd I_UNISTD
11831 #ifdef I_UNISTD
11832 # include <unistd.h>
11833 #endif
11834 #$d_sysconf HAS_SYSCONF
11835 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11836 #ifdef HAS_STDIO_STREAM_ARRAY
11837 # define STDIO_STREAM_ARRAY $stdio_stream_array
11838 #endif
11839 int main() {
11840   FILE* p = fopen("try.out", "w");
11841 #ifdef TRY_FPUTC
11842   fputc('x', p);
11843 #else
11844 # ifdef TRY_FPRINTF
11845   fprintf(p, "x");
11846 # endif
11847 #endif
11848 #ifdef TRY_FFLUSH_NULL
11849   fflush(NULL);
11850 #endif
11851 #ifdef TRY_FFLUSH_ALL
11852   {
11853     long open_max = -1;
11854 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11855     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11856 # else
11857 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11858     open_max = sysconf(_SC_OPEN_MAX);
11859 #  else
11860 #   ifdef FOPEN_MAX
11861     open_max = FOPEN_MAX;
11862 #   else
11863 #    ifdef OPEN_MAX
11864     open_max = OPEN_MAX;
11865 #    else
11866 #     ifdef _NFILE
11867     open_max = _NFILE;
11868 #     endif
11869 #    endif
11870 #   endif
11871 #  endif
11872 # endif 
11873 # ifdef HAS_STDIO_STREAM_ARRAY
11874     if (open_max > 0) {
11875       long i;
11876       for (i = 0; i < open_max; i++)
11877             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11878                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11879                 STDIO_STREAM_ARRAY[i]._flag)
11880                 fflush(&STDIO_STREAM_ARRAY[i]);
11881     }   
11882   }
11883 # endif
11884 #endif
11885   _exit(42);
11886 }
11887 EOCP
11888 : first we have to find out how _not_ to flush
11889 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11890     output=''
11891     set try -DTRY_FPUTC
11892     if eval $compile; then
11893             $rm -f try.out
11894             ./try$exe_ext 2>/dev/null
11895             if $test ! -s try.out -a "X$?" = X42; then
11896                 output=-DTRY_FPUTC
11897             fi
11898     fi
11899     case "$output" in
11900     '')
11901             set try -DTRY_FPRINTF
11902             $rm -f try.out
11903             if eval $compile; then
11904                     $rm -f try.out
11905                     ./try$exe_ext 2>/dev/null
11906                     if $test ! -s try.out -a "X$?" = X42; then
11907                         output=-DTRY_FPRINTF
11908                     fi
11909             fi
11910         ;;
11911     esac
11912 fi
11913 : check for fflush NULL behaviour
11914 case "$fflushNULL" in
11915 '')     set try -DTRY_FFLUSH_NULL $output
11916         if eval $compile; then
11917                 $rm -f try.out
11918                 ./try$exe_ext 2>/dev/null
11919                 code="$?"
11920                 if $test -s try.out -a "X$code" = X42; then
11921                         fflushNULL="`$cat try.out`"
11922                 else
11923                         if $test "X$code" != X42; then
11924                                 $cat >&4 <<EOM
11925 (If this test failed, don't worry, we'll try another method shortly.)
11926 EOM
11927                         fi
11928                 fi
11929         fi
11930         $rm -f core try.core core.try.*
11931         case "$fflushNULL" in
11932         x)      $cat >&4 <<EOM
11933 Your fflush(NULL) works okay.
11934 EOM
11935                 fflushNULL="$define"
11936                 ;;
11937         '')     $cat >&4 <<EOM
11938 Your fflush(NULL) isn't working (contrary to ANSI C).
11939 EOM
11940                 fflushNULL="$undef"
11941                 ;;
11942         *)      $cat >&4 <<EOM
11943 Cannot figure out whether your fflush(NULL) works or not.
11944 I'm assuming it doesn't (contrary to ANSI C).
11945 EOM
11946                 fflushNULL="$undef"
11947                 ;;
11948         esac
11949         ;;
11950 $define|true|[yY]*)
11951         fflushNULL="$define"
11952         ;;
11953 *)
11954         fflushNULL="$undef"
11955         ;;
11956 esac
11957 : check explicit looping only if NULL did not work
11958 case "$fflushNULL" in
11959 "$undef")
11960         : check for fflush all behaviour
11961         case "$fflushall" in
11962         '')     set try -DTRY_FFLUSH_ALL $output
11963                 if eval $compile; then
11964                         $cat >&4 <<EOM
11965 (Now testing the other method--but note that also this may fail.)
11966 EOM
11967                         $rm -f try.out
11968                         ./try$exe_ext 2>/dev/null
11969                         if $test -s try.out -a "X$?" = X42; then
11970                                 fflushall="`$cat try.out`"
11971                         fi
11972                 fi
11973                 $rm -f core try.core core.try.*
11974                 case "$fflushall" in
11975                 x)      $cat >&4 <<EOM
11976 Whew. Flushing explicitly all the stdio streams works.
11977 EOM
11978                         fflushall="$define"
11979                         ;;
11980                 '')     $cat >&4 <<EOM
11981 Sigh. Flushing explicitly all the stdio streams doesn't work.
11982 EOM
11983                         fflushall="$undef"
11984                         ;;
11985                 *)      $cat >&4 <<EOM
11986 Cannot figure out whether flushing stdio streams explicitly works or not.
11987 I'm assuming it doesn't.
11988 EOM
11989                         fflushall="$undef"
11990                         ;;
11991                 esac
11992                 ;;
11993         "$define"|true|[yY]*)
11994                 fflushall="$define"
11995                 ;;
11996         *)
11997                 fflushall="$undef"
11998                 ;;
11999         esac
12000         ;;
12001 *)      fflushall="$undef"      
12002         ;;
12003 esac
12004 case "$fflushNULL$fflushall" in
12005 undefundef)
12006         $cat <<EOM
12007 I cannot figure out how to flush pending stdio output.
12008 EOM
12009         ;;
12010 esac
12011 $rm -f try.* try$exe_ext
12012
12013 : Store the full pathname to the ar program for use in the C program
12014 : Respect a hint or command line value for full_ar.
12015 case "$full_ar" in
12016 '') full_ar=$ar ;;
12017 esac
12018
12019 : Store the full pathname to the sed program for use in the C program
12020 full_sed=$sed
12021
12022 : see what type gids are declared as in the kernel
12023 echo " "
12024 echo "Looking for the type for group ids returned by getgid()."
12025 set gid_t gidtype xxx stdio.h sys/types.h
12026 eval $typedef
12027 case "$gidtype" in
12028 xxx)
12029         xxx=`./findhdr sys/user.h`
12030         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12031         case $1 in
12032         unsigned) dflt="$1 $2" ;;
12033         *) dflt="$1" ;;
12034         esac
12035         ;;
12036 *) dflt="$gidtype";;
12037 esac
12038 case "$gidtype" in
12039 gid_t) echo "gid_t found." ;;
12040 *)      rp="What is the type for group ids returned by getgid()?"
12041         . ./myread
12042         gidtype="$ans"
12043         ;;
12044 esac
12045
12046 echo " "
12047 case "$gidtype" in
12048 *_t) zzz="$gidtype"     ;;
12049 *)   zzz="gid"          ;;
12050 esac
12051 echo "Checking the size of $zzz..." >&4 
12052 cat > try.c <<EOCP
12053 #include <sys/types.h>
12054 #include <stdio.h>
12055 int main() {
12056     printf("%d\n", (int)sizeof($gidtype));
12057     exit(0);
12058 }
12059 EOCP
12060 set try
12061 if eval $compile_ok; then
12062         yyy=`./try`
12063         case "$yyy" in
12064         '')     gidsize=4
12065                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12066                 ;;
12067         *)      gidsize=$yyy
12068                 echo "Your $zzz size is $gidsize bytes."
12069                 ;;
12070         esac
12071 else
12072         gidsize=4
12073         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12074 fi
12075
12076
12077 echo " "
12078 case "$gidtype" in
12079 *_t) zzz="$gidtype"     ;;
12080 *)   zzz="gid"          ;;
12081 esac
12082 echo "Checking the sign of $zzz..." >&4 
12083 cat > try.c <<EOCP
12084 #include <sys/types.h>
12085 #include <stdio.h>
12086 int main() {
12087         $gidtype foo = -1;
12088         if (foo < 0)
12089                 printf("-1\n");
12090         else
12091                 printf("1\n");
12092 }
12093 EOCP
12094 set try
12095 if eval $compile; then
12096         yyy=`./try`
12097         case "$yyy" in
12098         '')     gidsign=1
12099                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12100                 ;;
12101         *)      gidsign=$yyy
12102                 case "$gidsign" in
12103                  1) echo "Your $zzz is unsigned." ;;
12104                 -1) echo "Your $zzz is signed."   ;;
12105                 esac
12106                 ;;
12107         esac
12108 else
12109         gidsign=1
12110         echo "(I can't compile the test program--guessing unsigned.)" >&4
12111 fi
12112
12113
12114 : check for length of character
12115 echo " "
12116 case "$charsize" in
12117 '')
12118         echo "Checking to see how big your characters are (hey, you never know)..." >&4
12119         $cat >try.c <<'EOCP'
12120 #include <stdio.h>
12121 int main()
12122 {
12123     printf("%d\n", (int)sizeof(char));
12124     exit(0);
12125 }
12126 EOCP
12127         set try
12128         if eval $compile_ok; then
12129                 dflt=`./try`
12130         else
12131                 dflt='1'
12132                 echo "(I can't seem to compile the test program.  Guessing...)"
12133         fi
12134         ;;
12135 *)
12136         dflt="$charsize"
12137         ;;
12138 esac
12139 rp="What is the size of a character (in bytes)?"
12140 . ./myread
12141 charsize="$ans"
12142 $rm -f try.c try
12143
12144
12145 echo " "
12146 $echo "Choosing the C types to be used for Perl's internal types..." >&4
12147
12148 case "$use64bits:$d_quad:$quadtype" in
12149 define:define:?*)
12150         ivtype="$quadtype"
12151         uvtype="$uquadtype"
12152         ivsize=8
12153         uvsize=8
12154         ;;
12155 *)      ivtype="long"
12156         uvtype="unsigned long"
12157         ivsize=$longsize
12158         uvsize=$longsize
12159         ;;
12160 esac
12161
12162 case "$uselongdouble:$d_longdbl" in
12163 define:define)
12164         nvtype="long double"
12165         nvsize=$longdblsize
12166         ;;
12167 *)      nvtype=double
12168         nvsize=$doublesize
12169         ;;
12170 esac
12171
12172 echo "(IV will be "$ivtype", $ivsize bytes)"
12173 echo "(UV will be "$uvtype", $uvsize bytes)"
12174 echo "(NV will be "$nvtype", $nvsize bytes)"
12175
12176 $cat >try.c <<EOCP
12177 #$i_inttypes I_INTTYPES
12178 #ifdef I_INTTYPES
12179 #include <inttypes.h>
12180 #endif
12181 #include <stdio.h>
12182 int main() {
12183 #ifdef INT8
12184    int8_t i =  INT8_MAX;
12185   uint8_t u = UINT8_MAX;
12186   printf("int8_t\n");
12187 #endif
12188 #ifdef INT16
12189    int16_t i =  INT16_MAX;
12190   uint16_t i = UINT16_MAX;
12191   printf("int16_t\n");
12192 #endif
12193 #ifdef INT32
12194    int32_t i =  INT32_MAX;
12195   uint32_t u = UINT32_MAX;
12196   printf("int32_t\n");
12197 #endif
12198 }
12199 EOCP
12200
12201 case "$i8type" in
12202 '')     case "$charsize" in
12203         1)      i8type=char
12204                 u8type="unsigned char"
12205                 i8size=$charsize
12206                 u8size=$charsize
12207                 ;;
12208         esac
12209         ;;
12210 esac
12211 case "$i8type" in
12212 '')     set try -DINT8
12213         if eval $compile; then
12214                 case "`./try$exe_ext`" in
12215                 int8_t) i8type=int8_t
12216                         u8type=uint8_t
12217                         i8size=1
12218                         u8size=1
12219                         ;;
12220                 esac
12221         fi
12222         ;;
12223 esac
12224 case "$i8type" in
12225 '')     if $test $charsize -ge 1; then
12226                 i8type=char
12227                 u8type="unsigned char"
12228                 i8size=$charsize
12229                 u8size=$charsize
12230         fi
12231         ;;
12232 esac
12233
12234 case "$i16type" in
12235 '')     case "$shortsize" in
12236         2)      i16type=short
12237                 u16type="unsigned short"
12238                 i16size=$shortsize
12239                 u16size=$shortsize
12240                 ;;
12241         esac
12242         ;;
12243 esac
12244 case "$i16type" in
12245 '')     set try -DINT16
12246         if eval $compile; then
12247                 case "`./try$exe_ext`" in
12248                 int16_t)
12249                         i16type=int16_t
12250                         u16type=uint16_t
12251                         i16size=2
12252                         u16size=2
12253                         ;;
12254                 esac
12255         fi
12256         ;;
12257 esac
12258 case "$i16type" in
12259 '')     if $test $shortsize -ge 2; then
12260                 i16type=short
12261                 u16type="unsigned short"
12262                 i16size=$shortsize
12263                 u16size=$shortsize
12264         fi
12265         ;;
12266 esac
12267
12268 case "$i32type" in
12269 '')     case "$longsize" in
12270         4)      i32type=long
12271                 u32type="unsigned long"
12272                 i32size=$longsize
12273                 u32size=$longsize
12274                 ;;
12275         *)      case "$intsize" in
12276                 4)      i32type=int
12277                         u32type="unsigned int"
12278                         i32size=$intsize
12279                         u32size=$intsize
12280                         ;;
12281                 esac
12282                 ;;
12283         esac
12284         ;;
12285 esac
12286 case "$i32type" in
12287 '')     set try -DINT32
12288         if eval $compile; then
12289                 case "`./try$exe_ext`" in
12290                 int32_t)
12291                         i32type=int32_t
12292                         u32type=uint32_t
12293                         i32size=4
12294                         u32size=4
12295                         ;;
12296                 esac
12297         fi
12298         ;;
12299 esac
12300 case "$i32type" in
12301 '')     if $test $intsize -ge 4; then
12302                 i32type=int
12303                 u32type="unsigned int"
12304                 i32size=$intsize
12305                 u32size=$intsize
12306         fi
12307         ;;
12308 esac
12309
12310 case "$i64type" in
12311 '')     case "$d_quad:$quadtype" in
12312         define:?*)
12313                 i64type="$quadtype"
12314                 u64type="$uquadtype"
12315                 i64size=8
12316                 u64size=8
12317                 ;;
12318         esac
12319         ;;
12320 esac
12321
12322 $rm -f try.* try
12323
12324 echo " "
12325
12326 if $test X"$quadtype" != X; then
12327
12328 echo "Checking how to print 64-bit integers..." >&4
12329
12330 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12331         $cat >try.c <<'EOCP'
12332 #include <sys/types.h>
12333 #include <stdio.h>
12334 int main() {
12335   int q = 12345678901;
12336   printf("%ld\n", q);
12337 }
12338 EOCP
12339         set try
12340         if eval $compile; then
12341                 yyy=`./try$exe_ext`
12342                 case "$yyy" in
12343                 12345678901)
12344                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12345                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12346                         echo "We will use %d."
12347                         ;;
12348                 esac
12349         fi
12350 fi
12351
12352 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12353         $cat >try.c <<'EOCP'
12354 #include <sys/types.h>
12355 #include <stdio.h>
12356 int main() {
12357   long q = 12345678901;
12358   printf("%ld\n", q);
12359 }
12360 EOCP
12361         set try
12362         if eval $compile; then
12363                 yyy=`./try$exe_ext`
12364                 case "$yyy" in
12365                 12345678901)
12366                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12367                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12368                         echo "We will use %ld."
12369                         ;;
12370                 esac
12371         fi
12372 fi
12373
12374 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12375         $cat >try.c <<'EOCP'
12376 #include <sys/types.h>
12377 #include <inttypes.h>
12378 #include <stdio.h>
12379 int main() {
12380   int64_t q = 12345678901;
12381   printf("%" PRId64 "\n", q);
12382 }
12383 EOCP
12384         set try
12385         if eval $compile; then
12386                 yyy=`./try$exe_ext`
12387                 case "$yyy" in
12388                 12345678901)
12389                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12390                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12391                         echo "We will use the C9X style."
12392                         ;;
12393                 esac
12394         fi
12395 fi
12396
12397 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12398         $cat >try.c <<'EOCP'
12399 #include <sys/types.h>
12400 #include <stdio.h>
12401 int main() {
12402   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12403   printf("%lld\n", q);
12404 }
12405 EOCP
12406         set try
12407         if eval $compile; then
12408                 yyy=`./try$exe_ext`
12409                 case "$yyy" in
12410                 12345678901)
12411                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12412                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12413                         echo "We will use the %lld style."
12414                         ;;
12415                 esac
12416         fi
12417 fi
12418
12419 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12420         $cat >try.c <<EOCP
12421 #include <sys/types.h>
12422 #include <stdio.h>
12423 int main() {
12424   $quadtype q = 12345678901;
12425   printf("%Ld\n", q);
12426 }
12427 EOCP
12428         set try
12429         if eval $compile; then
12430                 yyy=`./try$exe_ext`
12431                 case "$yyy" in
12432                 12345678901)
12433                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12434                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12435                         echo "We will use %Ld."
12436                         ;;
12437                 esac
12438         fi
12439 fi
12440
12441 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12442         $cat >try.c <<EOCP
12443 #include <sys/types.h>
12444 #include <stdio.h>
12445 int main() {
12446   $quadtype q = 12345678901;
12447   printf("%qd\n", q);
12448 }
12449 EOCP
12450         set try
12451         if eval $compile; then
12452                 yyy=`./try$exe_ext`
12453                 case "$yyy" in
12454                 12345678901)
12455                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12456                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12457                         echo "We will use %qd."
12458                         ;;
12459                 esac
12460         fi
12461 fi
12462
12463 if $test X"$sPRId64" = X; then
12464         echo "Cannot figure out how to print 64-bit integers." >&4
12465 fi
12466
12467 $rm -f try try.*
12468
12469 fi
12470
12471 case "$sPRId64" in
12472 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12473         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12474         ;;
12475 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12476         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12477         ;;
12478 esac
12479
12480
12481 echo " "
12482 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12483
12484 if $test X"$ivsize" = X8; then
12485         ivdformat="$sPRId64"
12486         uvuformat="$sPRIu64"
12487         uvoformat="$sPRIo64"
12488         uvxformat="$sPRIx64"
12489 else
12490         if $test X"$ivsize" = X"$longsize"; then
12491                 ivdformat='"ld"'
12492                 uvuformat='"lu"'
12493                 uvoformat='"lo"'
12494                 uvxformat='"lx"'
12495         else
12496                 if $test X"$ivsize" = X"$intsize"; then
12497                         ivdformat='"d"'
12498                         uvuformat='"u"'
12499                         uvoformat='"o"'
12500                         uvxformat='"x"'
12501                 else
12502                         : far out
12503                         if $test X"$ivsize" = X"$shortsize"; then
12504                                 ivdformat='"hd"'
12505                                 uvuformat='"hu"'
12506                                 uvoformat='"ho"'
12507                                 uvxformat='"hx"'
12508                         fi
12509                 fi
12510         fi
12511 fi
12512
12513 case "$ivdformat" in
12514 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12515     exit 1
12516     ;;
12517 esac
12518
12519
12520 echo " "
12521 $echo "Checking the format string to be used for gids..." >&4
12522
12523 case "$gidsign" in
12524 -1)     if $test X"$gidsize" = X"$ivsize"; then
12525                 gidformat="$ivdformat"
12526         else
12527                 if $test X"$gidsize" = X"$longsize"; then
12528                         gidformat='"ld"'
12529                 else
12530                         if $test X"$gidsize" = X"$intsize"; then
12531                                 gidformat='"d"'
12532                         else
12533                                 if $test X"$gidsize" = X"$shortsize"; then
12534                                         gidformat='"hd"'
12535                                 fi
12536                         fi
12537                 fi
12538         fi
12539         ;;
12540 *)      if $test X"$gidsize" = X"$uvsize"; then
12541                 gidformat="$uvuformat"
12542         else
12543                 if $test X"$gidsize" = X"$longsize"; then
12544                         gidformat='"lu"'
12545                 else
12546                         if $test X"$gidsize" = X"$intsize"; then
12547                                 gidformat='"u"'
12548                         else
12549                                 if $test X"$gidsize" = X"$shortsize"; then
12550                                         gidformat='"hu"'
12551                                 fi
12552                         fi
12553                 fi
12554         fi
12555         ;;
12556 esac
12557
12558 : see if getgroups exists
12559 set getgroups d_getgrps
12560 eval $inlibc
12561
12562 : see if setgroups exists
12563 set setgroups d_setgrps
12564 eval $inlibc
12565
12566
12567 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12568 echo " "
12569 case "$d_getgrps$d_setgrps" in
12570 *define*)
12571         case "$groupstype" in
12572         '') dflt="$gidtype" ;;
12573         *)  dflt="$groupstype" ;;
12574         esac
12575         $cat <<EOM
12576 What type of pointer is the second argument to getgroups() and setgroups()?
12577 Usually this is the same as group ids, $gidtype, but not always.
12578
12579 EOM
12580         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12581         . ./myread
12582         groupstype="$ans"
12583         ;;
12584 *)  groupstype="$gidtype";;
12585 esac
12586
12587 echo " "
12588 echo "Checking if your $make program sets \$(MAKE)..." >&4
12589 case "$make_set_make" in
12590 '')
12591         $sed 's/^X //' > testmake.mak << 'EOF'
12592 Xall:
12593 X       @echo 'maketemp="$(MAKE)"'
12594 EOF
12595         case "`$make -f testmake.mak 2>/dev/null`" in
12596         *maketemp=*) make_set_make='#' ;;
12597         *)      make_set_make="MAKE=$make" ;;
12598         esac
12599         $rm -f testmake.mak
12600         ;;
12601 esac
12602 case "$make_set_make" in
12603 '#') echo "Yup, it does.";;
12604 *) echo "Nope, it doesn't.";;
12605 esac
12606
12607 : see what type is used for mode_t
12608 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12609 set mode_t modetype int stdio.h sys/types.h
12610 eval $typedef_ask
12611
12612 : define a fucntion to check prototypes
12613 $cat > protochk <<EOSH
12614 $startsh
12615 cc="$cc"
12616 optimize="$optimize"
12617 ccflags="$ccflags"
12618 prototype="$prototype"
12619 define="$define"
12620 rm=$rm
12621 EOSH
12622
12623 $cat >> protochk <<'EOSH'
12624
12625 $rm -f try.c
12626 foo="$1"
12627 shift
12628 while test $# -ge 2; do
12629         case "$1" in
12630                 $define) echo "#include <$2>" >> try.c ;;
12631                 literal) echo "$2" >> try.c ;;
12632         esac
12633     shift 2
12634 done
12635 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12636 cat >> try.c <<'EOCP'
12637 #ifdef CAN_PROTOTYPE
12638 #define _(args) args
12639 #else
12640 #define _(args) ()
12641 #endif
12642 EOCP
12643 echo "$foo" >> try.c
12644 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12645 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12646 status=$?
12647 $rm -f try.[co]
12648 exit $status
12649 EOSH
12650 chmod +x protochk
12651 $eunicefix protochk
12652
12653 : see what type is used for size_t
12654 rp="What is the type used for the length parameter for string functions?"
12655 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12656 eval $typedef_ask
12657
12658 : check for type of arguments to gethostbyaddr. 
12659 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12660         case "$d_gethbyaddr" in
12661         $define)
12662                 $cat <<EOM
12663
12664 Checking to see what type of arguments are accepted by gethostbyaddr().
12665 EOM
12666                 hdrs="$define sys/types.h
12667                         $d_socket sys/socket.h 
12668                         $i_niin netinet/in.h 
12669                         $i_netdb netdb.h
12670                         $i_unistd unistd.h"
12671                 : The first arg can 'char *' or 'void *'
12672                 : The second arg is some of integral type
12673                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12674                         for yyy in size_t long int; do
12675                                 case "$netdb_host_type" in
12676                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12677                                         if ./protochk "$try" $hdrs; then
12678                                                 echo "Your system accepts $xxx for the first arg."
12679                                                 echo "...and $yyy for the second arg."
12680                                                 netdb_host_type="$xxx"
12681                                                 netdb_hlen_type="$yyy"
12682                                         fi
12683                                         ;;
12684                                 esac
12685                         done
12686                 done
12687                 : In case none of those worked, prompt the user.
12688                 case "$netdb_host_type" in
12689                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12690                         dflt='char *'
12691                         . ./myread
12692                         netdb_host_type=$ans
12693                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12694                         dflt="$sizetype"
12695                         . ./myread
12696                         netdb_hlen_type=$ans
12697                         ;;
12698                 esac
12699                 ;;
12700         *)      : no gethostbyaddr, so pick harmless defaults
12701                 netdb_host_type='char *'
12702                 netdb_hlen_type="$sizetype"
12703                 ;;
12704         esac
12705         # Remove the "const" if needed. -- but then we'll have a 
12706         # prototype clash!
12707         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12708 fi
12709
12710 : check for type of argument to gethostbyname. 
12711 if test "X$netdb_name_type" = X ; then
12712         case "$d_gethbyname" in
12713         $define)
12714                 $cat <<EOM
12715
12716 Checking to see what type of argument is accepted by gethostbyname().
12717 EOM
12718                 hdrs="$define sys/types.h
12719                         $d_socket sys/socket.h 
12720                         $i_niin netinet/in.h 
12721                         $i_netdb netdb.h
12722                         $i_unistd unistd.h"
12723                 for xxx in "const char *" "char *"; do
12724                         case "$netdb_name_type" in
12725                         '')     try="extern struct hostent *gethostbyname($xxx);"
12726                                 if ./protochk "$try" $hdrs; then
12727                                         echo "Your system accepts $xxx."
12728                                         netdb_name_type="$xxx"
12729                                 fi
12730                                 ;;
12731                         esac
12732                 done
12733                 : In case none of those worked, prompt the user.
12734                 case "$netdb_name_type" in
12735                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12736                         dflt='char *'
12737                         . ./myread
12738                         netdb_name_type=$ans
12739                         ;;
12740                 esac
12741                 ;;
12742         *)      : no gethostbyname, so pick harmless default
12743                 netdb_name_type='char *'
12744                 ;;
12745         esac
12746 fi
12747
12748 : check for type of 1st argument to getnetbyaddr. 
12749 if test "X$netdb_net_type" = X ; then
12750         case "$d_getnbyaddr" in
12751         $define)
12752                 $cat <<EOM
12753
12754 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12755 EOM
12756                 hdrs="$define sys/types.h
12757                         $d_socket sys/socket.h 
12758                         $i_niin netinet/in.h 
12759                         $i_netdb netdb.h
12760                         $i_unistd unistd.h"
12761                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12762                         case "$netdb_net_type" in
12763                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12764                                 if ./protochk "$try" $hdrs; then
12765                                         echo "Your system accepts $xxx."
12766                                         netdb_net_type="$xxx"
12767                                 fi
12768                                 ;;
12769                         esac
12770                 done
12771                 : In case none of those worked, prompt the user.
12772                 case "$netdb_net_type" in
12773                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12774                         dflt='long'
12775                         . ./myread
12776                         netdb_net_type=$ans
12777                         ;;
12778                 esac
12779                 ;;
12780         *)      : no getnetbyaddr, so pick harmless default
12781                 netdb_net_type='long'
12782                 ;;
12783         esac
12784 fi
12785 : locate the preferred pager for this system
12786 case "$pager" in
12787 '')
12788         dflt=''
12789         case "$pg" in
12790         /*) dflt=$pg;;
12791         esac
12792         case "$more" in
12793         /*) dflt=$more;;
12794         esac
12795         case "$less" in
12796         /*) dflt=$less;;
12797         esac
12798         case "$dflt" in
12799         '') dflt=/usr/ucb/more;;
12800         esac
12801         ;;
12802 *) dflt="$pager";;
12803 esac
12804 echo " "
12805 fn=f/
12806 rp='What pager is used on your system?'
12807 . ./getfile
12808 pager="$ans"
12809
12810 : see what type pids are declared as in the kernel
12811 rp="What is the type of process ids on this system?"
12812 set pid_t pidtype int stdio.h sys/types.h
12813 eval $typedef_ask
12814
12815 : check for length of pointer
12816 echo " "
12817 case "$ptrsize" in
12818 '')
12819         $echo $n "Checking to see how big your pointers are...$c" >&4
12820         if test "$voidflags" -gt 7; then
12821                 echo '#define VOID_PTR char *' > try.c
12822         else
12823                 echo '#define VOID_PTR void *' > try.c
12824         fi
12825         $cat >>try.c <<'EOCP'
12826 #include <stdio.h>
12827 int main()
12828 {
12829     printf("%d\n", (int)sizeof(VOID_PTR));
12830     exit(0);
12831 }
12832 EOCP
12833         set try
12834         if eval $compile_ok; then
12835                 ptrsize=`./try`
12836                 $echo " $ptrsize bytes." >&4
12837         else
12838                 dflt='4'
12839                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12840                 rp="What is the size of a pointer (in bytes)?"
12841                 . ./myread
12842                 ptrsize="$ans"
12843         fi
12844         ;;
12845 esac
12846 $rm -f try.c try
12847
12848 : see if ar generates random libraries by itself
12849 echo " "
12850 echo "Checking how to generate random libraries on your machine..." >&4
12851 echo 'int bar1() { return bar2(); }' > bar1.c
12852 echo 'int bar2() { return 2; }' > bar2.c
12853 $cat > foo.c <<'EOP'
12854 int main() { printf("%d\n", bar1()); exit(0); }
12855 EOP
12856 $cc $ccflags -c bar1.c >/dev/null 2>&1
12857 $cc $ccflags -c bar2.c >/dev/null 2>&1
12858 $cc $ccflags -c foo.c >/dev/null 2>&1
12859 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12860 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12861         ./foobar >/dev/null 2>&1; then
12862         echo "$ar appears to generate random libraries itself."
12863         orderlib=false
12864         ranlib=":"
12865 elif $ar ts bar$_a >/dev/null 2>&1 &&
12866         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12867         ./foobar >/dev/null 2>&1; then
12868                 echo "a table of contents needs to be added with '$ar ts'."
12869                 orderlib=false
12870                 ranlib="$ar ts"
12871 else
12872         case "$ranlib" in
12873         :) ranlib='';;
12874         '')
12875                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12876                 $test -f $ranlib || ranlib=''
12877                 ;;
12878         esac
12879         if $test -n "$ranlib"; then
12880                 echo "your system has '$ranlib'; we'll use that."
12881                 orderlib=false
12882         else
12883                 echo "your system doesn't seem to support random libraries"
12884                 echo "so we'll use lorder and tsort to order the libraries."
12885                 orderlib=true
12886                 ranlib=":"
12887         fi
12888 fi
12889 $rm -f foo* bar* 
12890
12891 : check for type of arguments to select. 
12892 case "$selecttype" in
12893 '') case "$d_select" in
12894         $define)
12895                 $cat <<EOM
12896 Checking to see what type of arguments are accepted by select().
12897 EOM
12898                 hdrs="$define sys/types.h
12899                         $i_systime sys/time.h 
12900                         $i_sysselct sys/select.h
12901                         $d_socket sys/socket.h"
12902                 : The first arg can be int, unsigned, or size_t
12903                 : The last arg may or may not be 'const'
12904                 val=''
12905                 : void pointer has been seen but using that
12906                 : breaks the selectminbits test
12907                 for xxx in 'fd_set *' 'int *'; do
12908                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12909                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12910                                         case "$val" in
12911                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12912                                                 if ./protochk "$try" $hdrs; then
12913                                                         echo "Your system accepts $xxx."
12914                                                         val="$xxx"
12915                                                 fi
12916                                                 ;;
12917                                         esac
12918                                 done
12919                         done
12920                 done
12921                 case "$val" in
12922                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12923                         case "$d_fd_set" in
12924                                 $define) dflt="fd_set *" ;;
12925                                 *)              dflt="int *" ;;
12926                         esac
12927                         . ./myread
12928                         val=$ans
12929                         ;;
12930                 esac
12931                 selecttype="$val"
12932                 ;;
12933         *)      : no select, so pick a harmless default
12934                 selecttype='int *'
12935                 ;;
12936         esac
12937         ;;
12938 esac
12939
12940 : check for the select 'width'
12941 case "$selectminbits" in
12942 '') case "$d_select" in
12943         $define)
12944                 $cat <<EOM
12945
12946 Checking to see on how many bits at a time your select() operates...
12947 EOM
12948                 $cat >try.c <<EOCP
12949 #include <sys/types.h>
12950 #$i_time I_TIME
12951 #$i_systime I_SYS_TIME
12952 #$i_systimek I_SYS_TIME_KERNEL
12953 #ifdef I_TIME
12954 #   include <time.h>
12955 #endif
12956 #ifdef I_SYS_TIME
12957 #   ifdef I_SYS_TIME_KERNEL
12958 #       define KERNEL
12959 #   endif
12960 #   include <sys/time.h>
12961 #   ifdef I_SYS_TIME_KERNEL
12962 #       undef KERNEL
12963 #   endif
12964 #endif
12965 #$i_sysselct I_SYS_SELECT
12966 #ifdef I_SYS_SELECT
12967 #include <sys/select.h>
12968 #endif
12969 #$d_socket HAS_SOCKET
12970 #ifdef HAS_SOCKET
12971 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12972 #endif
12973 #include <stdio.h>
12974 $selecttype b;
12975 #define S sizeof(*(b))
12976 #define MINBITS 64
12977 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12978 #define NBITS  (NBYTES * 8)
12979 int main() {
12980     char s[NBYTES];
12981     struct timeval t;
12982     int i;
12983     FILE* fp;
12984     int fd;
12985
12986     fclose(stdin);
12987     fp = fopen("try.c", "r");
12988     if (fp == 0)
12989       exit(1);
12990     fd = fileno(fp);
12991     if (fd < 0)
12992       exit(2);
12993     b = ($selecttype)s;
12994     for (i = 0; i < NBITS; i++)
12995         FD_SET(i, b);
12996     t.tv_sec  = 0;
12997     t.tv_usec = 0;
12998     select(fd + 1, b, 0, 0, &t);
12999     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13000     printf("%d\n", i + 1);
13001     return 0;
13002 }
13003 EOCP
13004                 set try
13005                 if eval $compile_ok; then
13006                         selectminbits=`./try`
13007                         case "$selectminbits" in
13008                         '')     cat >&4 <<EOM
13009 Cannot figure out on how many bits at a time your select() operates.
13010 I'll play safe and guess it is 32 bits.
13011 EOM
13012                                 selectminbits=32
13013                                 bits="32 bits"
13014                                 ;;
13015                         1)      bits="1 bit" ;;
13016                         *)      bits="$selectminbits bits" ;;
13017                         esac
13018                         echo "Your select() operates on $bits at a time." >&4
13019                 else
13020                         rp='What is the minimum number of bits your select() operates on?'
13021                         case "$byteorder" in
13022                         1234|12345678)  dflt=32 ;;
13023                         *)              dflt=1  ;;
13024                         esac
13025                         . ./myread
13026                         val=$ans
13027                         selectminbits="$val"
13028                 fi
13029                 $rm -f try.* try
13030                 ;;
13031         *)      : no select, so pick a harmless default
13032                 selectminbits='32'
13033                 ;;
13034         esac
13035         ;;
13036 esac
13037
13038 : Trace out the files included by signal.h, then look for SIGxxx names.
13039 : Remove SIGARRAYSIZE used by HPUX.
13040 : Remove SIGSTKSIZE used by Linux.
13041 : Remove SIGSTKSZ used by Posix.
13042 : Remove SIGTYP void lines used by OS2.
13043 : Some cpps, like os390, dont give the file name anywhere
13044 if [ "X$fieldn" = X ]; then
13045         : Just make some guesses.  We check them later.
13046         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13047 else
13048         xxx=`echo '#include <signal.h>' |
13049         $cppstdin $cppminus $cppflags 2>/dev/null |
13050         $grep '^[       ]*#.*include' | 
13051         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13052 fi
13053 : Check this list of files to be sure we have parsed the cpp output ok.
13054 : This will also avoid potentially non-existent files, such 
13055 : as ../foo/bar.h
13056 xxxfiles=''
13057 for xx in $xxx /dev/null ; do
13058         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13059 done
13060 : If we have found no files, at least try signal.h
13061 case "$xxxfiles" in
13062 '')     xxxfiles=`./findhdr signal.h` ;;
13063 esac
13064 xxx=`awk '
13065 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13066         print substr($2, 4, 20)
13067 }
13068 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13069         print substr($3, 4, 20)
13070 }' $xxxfiles`
13071 : Append some common names just in case the awk scan failed.
13072 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13073 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13074 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13075 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13076 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13077
13078 : generate a few handy files for later
13079 $cat > signal.c <<'EOCP'
13080 #include <sys/types.h>
13081 #include <signal.h>
13082 #include <stdio.h>
13083 int main() {
13084
13085 /* Strange style to avoid deeply-nested #if/#else/#endif */
13086 #ifndef NSIG
13087 #  ifdef _NSIG
13088 #    define NSIG (_NSIG)
13089 #  endif
13090 #endif
13091
13092 #ifndef NSIG
13093 #  ifdef SIGMAX
13094 #    define NSIG (SIGMAX+1)
13095 #  endif
13096 #endif
13097
13098 #ifndef NSIG
13099 #  ifdef SIG_MAX
13100 #    define NSIG (SIG_MAX+1)
13101 #  endif
13102 #endif
13103
13104 #ifndef NSIG
13105 #  ifdef MAXSIG
13106 #    define NSIG (MAXSIG+1)
13107 #  endif
13108 #endif
13109
13110 #ifndef NSIG
13111 #  ifdef MAX_SIG
13112 #    define NSIG (MAX_SIG+1)
13113 #  endif
13114 #endif
13115
13116 #ifndef NSIG
13117 #  ifdef SIGARRAYSIZE
13118 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13119 #  endif
13120 #endif
13121
13122 #ifndef NSIG
13123 #  ifdef _sys_nsig
13124 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13125 #  endif
13126 #endif
13127
13128 /* Default to some arbitrary number that's big enough to get most
13129    of the common signals.
13130 */
13131 #ifndef NSIG
13132 #    define NSIG 50
13133 #endif
13134
13135 printf("NSIG %d\n", NSIG);
13136
13137 #ifndef JUST_NSIG
13138
13139 EOCP
13140
13141 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13142 {
13143         printf "#ifdef SIG"; printf $1; printf "\n"
13144         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13145         printf $1; printf ");\n"
13146         printf "#endif\n"
13147 }
13148 END {
13149         printf "#endif /* JUST_NSIG */\n";
13150         printf "exit(0);\n}\n";
13151 }
13152 ' >>signal.c
13153 $cat >signal.awk <<'EOP'
13154 BEGIN { ndups = 0 }
13155 $1 ~ /^NSIG$/ { nsig = $2 }
13156 ($1 !~ /^NSIG$/) && (NF == 2) {
13157     if ($2 > maxsig) { maxsig = $2 }
13158     if (sig_name[$2]) {
13159         dup_name[ndups] = $1
13160         dup_num[ndups] = $2
13161         ndups++ 
13162     }
13163     else {
13164         sig_name[$2] = $1
13165         sig_num[$2] = $2
13166     }
13167 }
13168 END { 
13169     if (nsig == 0) {
13170         nsig = maxsig + 1
13171     }
13172     printf("NSIG %d\n", nsig);
13173     for (n = 1; n < nsig; n++) {
13174         if (sig_name[n]) {
13175             printf("%s %d\n", sig_name[n], sig_num[n])
13176         }
13177         else {
13178             printf("NUM%d %d\n", n, n) 
13179         }
13180     }
13181     for (n = 0; n < ndups; n++) {
13182         printf("%s %d\n", dup_name[n], dup_num[n])
13183     }
13184 }
13185 EOP
13186 $cat >signal_cmd <<EOS
13187 $startsh
13188 if $test -s signal.lst; then
13189     echo "Using your existing signal.lst file"
13190         exit 0
13191 fi
13192 xxx="$xxx"
13193 EOS
13194 $cat >>signal_cmd <<'EOS'
13195
13196 set signal
13197 if eval $compile_ok; then
13198         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13199 else
13200         echo "(I can't seem be able to compile the whole test program)" >&4
13201         echo "(I'll try it in little pieces.)" >&4
13202         set signal -DJUST_NSIG
13203         if eval $compile_ok; then
13204                 ./signal$_exe > signal.nsg
13205                 $cat signal.nsg
13206         else
13207                 echo "I can't seem to figure out how many signals you have." >&4
13208                 echo "Guessing 50." >&4
13209                 echo 'NSIG 50' > signal.nsg
13210         fi
13211         : Now look at all the signal names, one at a time.
13212         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13213                 $cat > signal.c <<EOCP
13214 #include <sys/types.h>
13215 #include <signal.h>
13216 #include <stdio.h>
13217 int main() {
13218 printf("$xx %d\n", SIG${xx});
13219 return 0;
13220 }
13221 EOCP
13222                 set signal
13223                 if eval $compile; then
13224                         echo "SIG${xx} found."
13225                         ./signal$_exe  >> signal.ls1
13226                 else
13227                         echo "SIG${xx} NOT found."
13228                 fi
13229         done
13230         if $test -s signal.ls1; then
13231                 $cat signal.nsg signal.ls1 |
13232                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13233         fi
13234
13235 fi
13236 if $test -s signal.lst; then
13237         :
13238 else
13239         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13240         echo 'kill -l' >signal
13241         set X `csh -f <signal`
13242         $rm -f signal
13243         shift
13244         case $# in
13245         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13246         esac
13247         echo $@ | $tr ' ' $trnl | \
13248             $awk '{ printf "%s %d\n", $1, ++s; }
13249                   END { printf "NSIG %d\n", ++s }' >signal.lst
13250 fi
13251 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13252 EOS
13253 chmod a+x signal_cmd
13254 $eunicefix signal_cmd
13255
13256 : generate list of signal names
13257 echo " "
13258 case "$sig_name_init" in
13259 '') doinit=yes ;;
13260 *)  case "$sig_num_init" in
13261     ''|*,*) doinit=yes ;;
13262     esac ;;
13263 esac
13264 case "$doinit" in
13265 yes)
13266         echo "Generating a list of signal names and numbers..." >&4
13267         . ./signal_cmd
13268         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13269         sig_name=`$awk 'BEGIN { printf "ZERO " }
13270                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13271         sig_num=`$awk  'BEGIN { printf "0 " }
13272                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13273         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13274                              !/^NSIG/   { printf "\"%s\", ", $1 }
13275                              END        { printf "0\n" }' signal.lst`
13276         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13277                              !/^NSIG/   { printf "%d, ", $2}
13278                              END        { printf "0\n"}' signal.lst`
13279         ;;
13280 esac
13281 echo "The following $sig_count signals are available:"
13282 echo " "
13283 echo $sig_name | $awk \
13284 'BEGIN { linelen = 0 }
13285 {
13286         for (i = 1; i <= NF; i++) {
13287                 name = "SIG" $i " "
13288                 linelen = linelen + length(name)
13289                 if (linelen > 70) {
13290                         printf "\n"
13291                         linelen = length(name)
13292                 }
13293                 printf "%s", name
13294         }
13295         printf "\n"
13296 }'
13297 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13298
13299 : see what type is used for signed size_t
13300 set ssize_t ssizetype int stdio.h sys/types.h
13301 eval $typedef
13302 dflt="$ssizetype"
13303 $cat > ssize.c <<EOM
13304 #include <stdio.h>
13305 #include <sys/types.h>
13306 #define Size_t $sizetype
13307 #define SSize_t $dflt
13308 int main()
13309 {
13310         if (sizeof(Size_t) == sizeof(SSize_t))
13311                 printf("$dflt\n");
13312         else if (sizeof(Size_t) == sizeof(int))
13313                 printf("int\n");
13314         else 
13315                 printf("long\n");
13316         exit(0);
13317 }
13318 EOM
13319 echo " "
13320 set ssize
13321 if eval $compile_ok && ./ssize > /dev/null; then
13322         ssizetype=`./ssize`
13323         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13324 else
13325         $cat >&4 <<EOM
13326 Help! I can't compile and run the ssize_t test program: please enlighten me!
13327 (This is probably a misconfiguration in your system or libraries, and
13328 you really ought to fix it.  Still, I'll try anyway.)
13329
13330 I need a type that is the same size as $sizetype, but is guaranteed to
13331 be signed.  Common values are ssize_t, int and long.
13332
13333 EOM
13334         rp="What signed type is the same size as $sizetype?"
13335         . ./myread
13336         ssizetype="$ans"
13337 fi
13338 $rm -f ssize ssize.*
13339
13340 : see what type of char stdio uses.
13341 echo " "
13342 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13343         echo "Your stdio uses unsigned chars." >&4
13344         stdchar="unsigned char"
13345 else
13346         echo "Your stdio uses signed chars." >&4
13347         stdchar="char"
13348 fi
13349
13350 : see if time exists
13351 echo " "
13352 if test "X$d_time" = X -o X"$timetype" = X; then
13353     if set time val -f d_time; eval $csym; $val; then
13354                 echo 'time() found.' >&4
13355                 val="$define"
13356                 rp="What is the type returned by time() on this system?"
13357                 set time_t timetype long stdio.h sys/types.h
13358                 eval $typedef_ask
13359     else
13360                 echo 'time() not found, hope that will do.' >&4
13361                 val="$undef"
13362                 timetype='int';
13363     fi
13364     set d_time
13365     eval $setvar
13366 fi
13367
13368 : see what type uids are declared as in the kernel
13369 echo " "
13370 echo "Looking for the type for user ids returned by getuid()."
13371 set uid_t uidtype xxx stdio.h sys/types.h
13372 eval $typedef
13373 case "$uidtype" in
13374 xxx)
13375         xxx=`./findhdr sys/user.h`
13376         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13377         case $1 in
13378         unsigned) dflt="$1 $2" ;;
13379         *) dflt="$1" ;;
13380         esac
13381         ;;
13382 *) dflt="$uidtype";;
13383 esac
13384 case "$uidtype" in
13385 uid_t)  echo "uid_t found." ;;
13386 *)      rp="What is the type for user ids returned by getuid()?"
13387         . ./myread
13388         uidtype="$ans"
13389         ;;
13390 esac
13391
13392 echo " "
13393 case "$uidtype" in
13394 *_t) zzz="$uidtype"     ;;
13395 *)   zzz="uid"          ;;
13396 esac
13397 echo "Checking the size of $zzz..." >&4 
13398 cat > try.c <<EOCP
13399 #include <sys/types.h>
13400 #include <stdio.h>
13401 int main() {
13402     printf("%d\n", (int)sizeof($uidtype));
13403     exit(0);
13404 }
13405 EOCP
13406 set try
13407 if eval $compile_ok; then
13408         yyy=`./try`
13409         case "$yyy" in
13410         '')     uidsize=4
13411                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13412                 ;;
13413         *)      uidsize=$yyy
13414                 echo "Your $zzz size is $uidsize bytes."
13415                 ;;
13416         esac
13417 else
13418         uidsize=4
13419         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13420 fi
13421
13422 echo " "
13423 case "$uidtype" in
13424 *_t) zzz="$uidtype"     ;;
13425 *)   zzz="uid"          ;;
13426 esac
13427 echo "Checking the sign of $zzz..." >&4
13428 cat > try.c <<EOCP
13429 #include <sys/types.h>
13430 #include <stdio.h>
13431 int main() {
13432         $uidtype foo = -1;
13433         if (foo < 0)
13434                 printf("-1\n");
13435         else
13436                 printf("1\n");
13437 }
13438 EOCP
13439 set try
13440 if eval $compile; then
13441         yyy=`./try`
13442         case "$yyy" in
13443         '')     uidsign=1
13444                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13445                 ;;
13446         *)      uidsign=$yyy
13447                 case "$uidsign" in
13448                  1) echo "Your $zzz is unsigned." ;;
13449                 -1) echo "Your $zzz is signed."   ;;
13450                 esac
13451                 ;;
13452         esac
13453 else
13454         uidsign=1
13455         echo "(I can't compile the test program--guessing unsigned.)" >&4
13456 fi
13457
13458
13459
13460 echo " "
13461 $echo "Checking the format string to be used for uids..." >&4
13462
13463 case "$uidsign" in
13464 -1)     if $test X"$uidsize" = X"$ivsize"; then
13465                 uidformat="$ivdformat"
13466         else
13467                 if $test X"$uidsize" = X"$longsize"; then
13468                         uidformat='"ld"'
13469                 else
13470                         if $test X"$uidsize" = X"$intsize"; then
13471                                 uidformat='"d"'
13472                         else
13473                                 if $test X"$uidsize" = X"$shortsize"; then
13474                                         uidformat='"hd"'
13475                                 fi
13476                         fi
13477                 fi
13478         fi
13479         ;;
13480 *)      if $test X"$uidsize" = X"$uvsize"; then
13481                 uidformat="$uvuformat"
13482         else
13483                 if $test X"$uidsize" = X"$longsize"; then
13484                         uidformat='"lu"'
13485                 else
13486                         if $test X"$uidsize" = X"$intsize"; then
13487                                 uidformat='"u"'
13488                         else
13489                                 if $test X"$uidsize" = X"$shortsize"; then
13490                                         uidformat='"hu"'
13491                                 fi
13492                         fi
13493                 fi
13494         fi
13495         ;;
13496 esac
13497
13498 : see if dbm.h is available
13499 : see if dbmclose exists
13500 set dbmclose d_dbmclose
13501 eval $inlibc
13502
13503 case "$d_dbmclose" in
13504 $define)
13505         set dbm.h i_dbm
13506         eval $inhdr
13507         case "$i_dbm" in
13508         $define)
13509                 val="$undef"
13510                 set i_rpcsvcdbm
13511                 eval $setvar
13512                 ;;
13513         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13514                 eval $inhdr
13515                 ;;
13516         esac
13517         ;;
13518 *)      echo "We won't be including <dbm.h>"
13519         val="$undef"
13520         set i_dbm
13521         eval $setvar
13522         val="$undef"
13523         set i_rpcsvcdbm
13524         eval $setvar
13525         ;;
13526 esac
13527
13528 : see if this is a sys/file.h system
13529 val=''
13530 set sys/file.h val
13531 eval $inhdr
13532
13533 : do we need to include sys/file.h ?
13534 case "$val" in
13535 "$define")
13536         echo " "
13537         if $h_sysfile; then
13538                 val="$define"
13539                 echo "We'll be including <sys/file.h>." >&4
13540         else
13541                 val="$undef"
13542                 echo "We won't be including <sys/file.h>." >&4
13543         fi
13544         ;;
13545 *)
13546         h_sysfile=false
13547         ;;
13548 esac
13549 set i_sysfile
13550 eval $setvar
13551
13552 : see if fcntl.h is there
13553 val=''
13554 set fcntl.h val
13555 eval $inhdr
13556
13557 : see if we can include fcntl.h
13558 case "$val" in
13559 "$define")
13560         echo " "
13561         if $h_fcntl; then
13562                 val="$define"
13563                 echo "We'll be including <fcntl.h>." >&4
13564         else
13565                 val="$undef"
13566                 if $h_sysfile; then
13567         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13568                 else
13569                         echo "We won't be including <fcntl.h>." >&4
13570                 fi
13571         fi
13572         ;;
13573 *)
13574         h_fcntl=false
13575         val="$undef"
13576         ;;
13577 esac
13578 set i_fcntl
13579 eval $setvar
13580
13581 : see if locale.h is available
13582 set locale.h i_locale
13583 eval $inhdr
13584
13585 : see if mach cthreads are available
13586 if test "X$usethreads" = "X$define"; then
13587         set mach/cthreads.h i_machcthr
13588         eval $inhdr
13589 else
13590         i_machcthr="$undef"
13591 fi
13592
13593
13594
13595 : see if this is a math.h system
13596 set math.h i_math
13597 eval $inhdr
13598
13599 : see if this is a mntent.h system
13600 set mntent.h i_mntent
13601 eval $inhdr
13602
13603 : see if ndbm.h is available
13604 set ndbm.h t_ndbm
13605 eval $inhdr
13606 case "$t_ndbm" in
13607 $define)
13608         : see if dbm_open exists
13609         set dbm_open d_dbm_open
13610         eval $inlibc
13611         case "$d_dbm_open" in
13612         $undef)
13613                 t_ndbm="$undef"
13614                 echo "We won't be including <ndbm.h>"
13615                 ;;
13616         esac
13617         ;;
13618 esac
13619 val="$t_ndbm"
13620 set i_ndbm
13621 eval $setvar
13622
13623 : see if net/errno.h is available
13624 val=''
13625 set net/errno.h val
13626 eval $inhdr
13627
13628 : Unfortunately, it causes problems on some systems.  Arrgh.
13629 case "$val" in
13630 $define)
13631         cat > try.c <<'EOM'
13632 #include <stdio.h>
13633 #include <errno.h>
13634 #include <net/errno.h>
13635 int func()
13636 {
13637         return ENOTSOCK;
13638 }
13639 EOM
13640         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13641                 echo "We'll be including <net/errno.h>." >&4
13642         else
13643                 echo "We won't be including <net/errno.h>." >&4
13644                 val="$undef"
13645         fi
13646         $rm -f try.* try
13647         ;;
13648 esac
13649 set i_neterrno
13650 eval $setvar
13651
13652 : see if netinet/tcp.h is available
13653 set netinet/tcp.h i_netinettcp
13654 eval $inhdr
13655
13656 : see if this is a poll.h system
13657 set poll.h i_poll
13658 eval $inhdr
13659
13660 : get C preprocessor symbols handy
13661 echo " "
13662 $echo $n "Hmm... $c"
13663 echo $al | $tr ' ' $trnl >Cppsym.know
13664 $cat <<EOSS >Cppsym
13665 $startsh
13666 case "\$1" in
13667 -l) list=true
13668         shift
13669         ;;
13670 esac
13671 unknown=''
13672 case "\$list\$#" in
13673 1|2)
13674         for sym do
13675                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13676                         exit 0
13677                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13678                         :
13679                 else
13680                         unknown="\$unknown \$sym"
13681                 fi
13682         done
13683         set X \$unknown
13684         shift
13685         ;;
13686 esac
13687 case \$# in
13688 0) exit 1;;
13689 esac
13690 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13691 #ifdef \1\\
13692 exit 0; _ _ _ _\1\\      \1\\
13693 #endif\\
13694 /' >Cppsym\$\$
13695 echo "exit 1; _ _ _" >>Cppsym\$\$
13696 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13697 case "\$list" in
13698 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13699 *)
13700         sh Cppsym2\$\$
13701         status=\$?
13702         ;;
13703 esac
13704 $rm -f Cppsym\$\$ Cppsym2\$\$
13705 exit \$status
13706 EOSS
13707 chmod +x Cppsym
13708 $eunicefix Cppsym
13709 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13710
13711 : now check the C compiler for additional symbols
13712 postprocess_cc_v=''
13713 case "$osname" in
13714 aix) postprocess_cc_v="|$tr , ' '" ;;
13715 esac
13716 $cat >ccsym <<EOS
13717 $startsh
13718 $cat >tmp.c <<EOF
13719 extern int foo;
13720 EOF
13721 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13722 do
13723         case "\$i" in
13724         -D*) echo "\$i" | $sed 's/^-D//';;
13725         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13726         esac
13727 done
13728 $rm -f try.c
13729 EOS
13730 postprocess_cc_v=''
13731 chmod +x ccsym
13732 $eunicefix ccsym
13733 ./ccsym > ccsym1.raw
13734 if $test -s ccsym1.raw; then
13735        $sort ccsym1.raw | $uniq >ccsym.raw
13736 else
13737        mv ccsym1.raw ccsym.raw
13738 fi
13739
13740 $awk '/\=/ { print $0; next }
13741         { print $0"=1" }' ccsym.raw >ccsym.list
13742 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13743 $comm -13 ccsym.true ccsym.list >ccsym.own
13744 $comm -12 ccsym.true ccsym.list >ccsym.com
13745 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13746 also=''
13747 if $test -z ccsym.raw; then
13748         echo "Your C compiler doesn't seem to define any symbols!" >&4
13749         echo " "
13750         echo "However, your C preprocessor defines the following symbols:"
13751         $cat Cppsym.true
13752         ccsymbols=''
13753         cppsymbols=`$cat Cppsym.true`
13754         cppsymbols=`echo $cppsymbols`
13755         cppccsymbols="$cppsymbols"
13756 else
13757         if $test -s ccsym.com; then
13758                 echo "Your C compiler and pre-processor define these symbols:"
13759                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13760                 also='also '
13761                 symbols='ones'
13762                 cppccsymbols=`$cat ccsym.com`
13763                 cppccsymbols=`echo $cppccsymbols`
13764                 $test "$silent" || sleep 1
13765         fi
13766         if $test -s ccsym.cpp; then
13767                 $test "$also" && echo " "
13768                 echo "Your C pre-processor ${also}defines the following symbols:"
13769                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13770                 also='further '
13771                 cppsymbols=`$cat ccsym.cpp`
13772                 cppsymbols=`echo $cppsymbols`
13773                 $test "$silent" || sleep 1
13774         fi
13775         if $test -s ccsym.own; then
13776                 $test "$also" && echo " "
13777                 echo "Your C compiler ${also}defines the following cpp symbols:"
13778                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13779                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13780                 ccsymbols=`$cat ccsym.own`
13781                 ccsymbols=`echo $ccsymbols`
13782                 $test "$silent" || sleep 1
13783         fi
13784 fi
13785 $rm -f ccsym*
13786
13787 : see if this is a termio system
13788 val="$undef"
13789 val2="$undef"
13790 val3="$undef"
13791 if $test `./findhdr termios.h`; then
13792         set tcsetattr i_termios
13793         eval $inlibc
13794         val3="$i_termios"
13795 fi
13796 echo " "
13797 case "$val3" in
13798 "$define") echo "You have POSIX termios.h... good!" >&4;;
13799 *) if ./Cppsym pyr; then
13800                 case "`/bin/universe`" in
13801                 ucb) if $test `./findhdr sgtty.h`; then
13802                                 val2="$define"
13803                                 echo "<sgtty.h> found." >&4
13804                         else
13805                                 echo "System is pyramid with BSD universe."
13806                                 echo "<sgtty.h> not found--you could have problems." >&4
13807                         fi;;
13808                 *) if $test `./findhdr termio.h`; then
13809                                 val="$define"
13810                                 echo "<termio.h> found." >&4
13811                         else
13812                                 echo "System is pyramid with USG universe."
13813                                 echo "<termio.h> not found--you could have problems." >&4
13814                         fi;;
13815                 esac
13816         elif ./usg; then
13817                 if $test `./findhdr termio.h`; then
13818                         echo "<termio.h> found." >&4
13819                         val="$define"
13820                 elif $test `./findhdr sgtty.h`; then
13821                         echo "<sgtty.h> found." >&4
13822                         val2="$define"
13823                 else
13824 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13825                 fi
13826         else
13827                 if $test `./findhdr sgtty.h`; then
13828                         echo "<sgtty.h> found." >&4
13829                         val2="$define"
13830                 elif $test `./findhdr termio.h`; then
13831                         echo "<termio.h> found." >&4
13832                         val="$define"
13833                 else
13834 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13835                 fi
13836         fi;;
13837 esac
13838 set i_termio; eval $setvar
13839 val=$val2; set i_sgtty; eval $setvar
13840 val=$val3; set i_termios; eval $setvar
13841
13842 : see if this is a shadow.h system
13843 set shadow.h i_shadow
13844 eval $inhdr
13845
13846 : see if this is a socks.h system
13847 set socks.h i_socks
13848 eval $inhdr
13849
13850 : see if stdarg is available
13851 echo " "
13852 if $test `./findhdr stdarg.h`; then
13853         echo "<stdarg.h> found." >&4
13854         valstd="$define"
13855 else
13856         echo "<stdarg.h> NOT found." >&4
13857         valstd="$undef"
13858 fi
13859
13860 : see if varags is available
13861 echo " "
13862 if $test `./findhdr varargs.h`; then
13863         echo "<varargs.h> found." >&4
13864 else
13865         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13866 fi
13867
13868 : set up the varargs testing programs
13869 $cat > varargs.c <<EOP
13870 #ifdef I_STDARG
13871 #include <stdarg.h>
13872 #endif
13873 #ifdef I_VARARGS
13874 #include <varargs.h>
13875 #endif
13876
13877 #ifdef I_STDARG
13878 int f(char *p, ...)
13879 #else
13880 int f(va_alist)
13881 va_dcl
13882 #endif
13883 {
13884         va_list ap;
13885 #ifndef I_STDARG
13886         char *p;
13887 #endif
13888 #ifdef I_STDARG
13889         va_start(ap,p);
13890 #else
13891         va_start(ap);
13892         p = va_arg(ap, char *);
13893 #endif
13894         va_end(ap);
13895 }
13896 EOP
13897 $cat > varargs <<EOP
13898 $startsh
13899 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13900         echo "true"
13901 else
13902         echo "false"
13903 fi
13904 $rm -f varargs$_o
13905 EOP
13906 chmod +x varargs
13907
13908 : now check which varargs header should be included
13909 echo " "
13910 i_varhdr=''
13911 case "$valstd" in
13912 "$define")
13913         if `./varargs I_STDARG`; then
13914                 val='stdarg.h'
13915         elif `./varargs I_VARARGS`; then
13916                 val='varargs.h'
13917         fi
13918         ;;
13919 *)
13920         if `./varargs I_VARARGS`; then
13921                 val='varargs.h'
13922         fi
13923         ;;
13924 esac
13925 case "$val" in
13926 '')
13927 echo "I could not find the definition for va_dcl... You have problems..." >&4
13928         val="$undef"; set i_stdarg; eval $setvar
13929         val="$undef"; set i_varargs; eval $setvar
13930         ;;
13931 *) 
13932         set i_varhdr
13933         eval $setvar
13934         case "$i_varhdr" in
13935         stdarg.h)
13936                 val="$define"; set i_stdarg; eval $setvar
13937                 val="$undef"; set i_varargs; eval $setvar
13938                 ;;
13939         varargs.h)
13940                 val="$undef"; set i_stdarg; eval $setvar
13941                 val="$define"; set i_varargs; eval $setvar
13942                 ;;
13943         esac
13944         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13945 esac
13946 $rm -f varargs*
13947
13948 : see if stddef is available
13949 set stddef.h i_stddef
13950 eval $inhdr
13951
13952 : see if sys/access.h is available
13953 set sys/access.h i_sysaccess
13954 eval $inhdr
13955
13956 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13957 set sys/filio.h i_sysfilio
13958 eval $inhdr
13959 echo " "
13960 if $test `./findhdr sys/ioctl.h`; then
13961         val="$define"
13962         echo '<sys/ioctl.h> found.' >&4
13963 else
13964         val="$undef"
13965         if $test $i_sysfilio = "$define"; then
13966             echo '<sys/ioctl.h> NOT found.' >&4
13967         else
13968                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13969                 $test $i_termio = "$define" && xxx="termio.h"
13970                 $test $i_termios = "$define" && xxx="termios.h"
13971 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13972         fi
13973 fi
13974 set i_sysioctl
13975 eval $setvar
13976
13977 : see if sys/resource.h has to be included
13978 set sys/resource.h i_sysresrc
13979 eval $inhdr
13980
13981 : see if sys/security.h is available
13982 set sys/security.h i_syssecrt
13983 eval $inhdr
13984
13985 : see if this is a sys/statvfs.h system
13986 set sys/statvfs.h i_sysstatvfs
13987 eval $inhdr
13988
13989 : see if this is a sys/uio.h system
13990 set sys/uio.h i_sysuio
13991 eval $inhdr
13992
13993 : see if this is a sys/un.h system
13994 set sys/un.h i_sysun
13995 eval $inhdr
13996
13997 : see if this is a syswait system
13998 set sys/wait.h i_syswait
13999 eval $inhdr
14000
14001 : see if this is a ustat.h system
14002 set ustat.h i_ustat
14003 eval $inhdr
14004
14005 : see if this is an utime system
14006 set utime.h i_utime
14007 eval $inhdr
14008
14009 : see if this is a values.h system
14010 set values.h i_values
14011 eval $inhdr
14012
14013 : see if this is a vfork system
14014 case "$d_vfork" in
14015 "$define")
14016         set vfork.h i_vfork
14017         eval $inhdr
14018         ;;
14019 *)
14020         i_vfork="$undef"
14021         ;;
14022 esac
14023
14024 : see if gdbm.h is available
14025 set gdbm.h t_gdbm
14026 eval $inhdr
14027 case "$t_gdbm" in
14028 $define)
14029         : see if gdbm_open exists
14030         set gdbm_open d_gdbm_open
14031         eval $inlibc
14032         case "$d_gdbm_open" in
14033         $undef)
14034                 t_gdbm="$undef"
14035                 echo "We won't be including <gdbm.h>"
14036                 ;;
14037         esac
14038         ;;
14039 esac
14040 val="$t_gdbm"
14041 set i_gdbm
14042 eval $setvar
14043
14044 echo " "
14045 echo "Looking for extensions..." >&4
14046 : If we are using the old config.sh, known_extensions may contain
14047 : old or inaccurate or duplicate values.
14048 known_extensions=''
14049 nonxs_extensions=''
14050 : We do not use find because it might not be available.
14051 : We do not just use MANIFEST because the user may have dropped
14052 : some additional extensions into the source tree and expect them
14053 : to be built.
14054
14055 : Function to recursively find available extensions, ignoring DynaLoader
14056 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14057 find_extensions='
14058     for xxx in *; do
14059        case "$xxx" in
14060            DynaLoader|dynaload) ;;
14061            *)
14062            if $test -f $xxx/$xxx.xs; then
14063                known_extensions="$known_extensions $1$xxx";
14064            elif $test -f $xxx/Makefile.PL; then
14065                nonxs_extensions="$nonxs_extensions $1$xxx";
14066            else
14067                if $test -d $xxx -a $# -lt 10; then
14068                    set $1$xxx/ $*;
14069                    cd $xxx;
14070                    eval $find_extensions;
14071                    cd ..;
14072                    shift;
14073                fi;
14074            fi
14075            ;;
14076        esac;
14077     done'
14078 tdir=`pwd`
14079 cd $rsrc/ext
14080 set X
14081 shift
14082 eval $find_extensions
14083 set X $nonxs_extensions
14084 shift
14085 nonxs_extensions="$*"
14086 set X $known_extensions
14087 shift
14088 known_extensions="$*"
14089 cd $tdir
14090
14091 : Now see which are supported on this system.
14092 avail_ext=''
14093 for xxx in $known_extensions ; do
14094         case "$xxx" in
14095         DB_File|db_file)
14096                 case "$i_db" in
14097                 $define) avail_ext="$avail_ext $xxx" ;;
14098                 esac
14099                 ;;
14100         GDBM_File|gdbm_fil)
14101                 case "$i_gdbm" in 
14102                 $define) avail_ext="$avail_ext $xxx" ;;
14103                 esac
14104                 ;;
14105         NDBM_File|ndbm_fil)
14106                 case "$i_ndbm" in
14107                 $define) avail_ext="$avail_ext $xxx" ;;
14108                 esac
14109                 ;;
14110         ODBM_File|odbm_fil) 
14111                 case "${i_dbm}${i_rpcsvcdbm}" in
14112                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14113                 esac
14114                 ;;
14115         POSIX|posix)
14116                 case "$useposix" in
14117                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14118                 esac
14119                 ;;
14120         Opcode|opcode)
14121                 case "$useopcode" in
14122                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14123                 esac
14124                 ;;
14125         Socket|socket)
14126                 case "$d_socket" in 
14127                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14128                 esac
14129                 ;;
14130         Thread|thread)
14131                 case "$usethreads" in 
14132                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14133                 esac
14134                 ;;
14135         IPC/SysV|ipc/sysv)
14136                 : XXX Do we need a useipcsysv variable here
14137                 case "${d_msg}${d_sem}${d_shm}" in 
14138                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14139                 esac
14140                 ;;
14141         *)      avail_ext="$avail_ext $xxx"
14142                 ;;
14143         esac
14144 done
14145
14146 set X $avail_ext
14147 shift
14148 avail_ext="$*"
14149
14150 : Now see which nonxs extensions are supported on this system.
14151 : For now assume all are.
14152 nonxs_ext=''
14153 for xxx in $nonxs_extensions ; do
14154         case "$xxx" in
14155         *)      nonxs_ext="$nonxs_ext $xxx"
14156                 ;;
14157         esac
14158 done
14159
14160 set X $nonxs_ext
14161 shift
14162 nonxs_ext="$*"
14163
14164 case $usedl in
14165 $define)
14166         $cat <<EOM
14167 A number of extensions are supplied with $package.  You may choose to
14168 compile these extensions for dynamic loading (the default), compile
14169 them into the $package executable (static loading), or not include
14170 them at all.  Answer "none" to include no extensions.
14171 Note that DynaLoader is always built and need not be mentioned here.
14172
14173 EOM
14174         case "$dynamic_ext" in
14175         '') dflt="$avail_ext" ;;
14176         *)      dflt="$dynamic_ext"
14177                 # Perhaps we are reusing an old out-of-date config.sh.
14178                 case "$hint" in
14179                 previous)
14180                         if test X"$dynamic_ext" != X"$avail_ext"; then
14181                                 $cat <<EOM
14182 NOTICE:  Your previous config.sh list may be incorrect. 
14183 The extensions now available to you are 
14184         ${avail_ext}
14185 but the default list from your previous config.sh is
14186         ${dynamic_ext} 
14187
14188 EOM
14189                         fi
14190                         ;;
14191                 esac
14192                 ;;
14193         esac
14194         case "$dflt" in
14195         '')     dflt=none;;
14196         esac
14197         rp="What extensions do you wish to load dynamically?"
14198         . ./myread
14199         case "$ans" in
14200         none) dynamic_ext=' ' ;;
14201         *) dynamic_ext="$ans" ;;
14202         esac
14203
14204         case "$static_ext" in
14205         '')
14206                 : Exclude those already listed in dynamic linking
14207                 dflt=''
14208                 for xxx in $avail_ext; do
14209                         case " $dynamic_ext " in
14210                         *" $xxx "*) ;;
14211                         *) dflt="$dflt $xxx" ;;
14212                         esac
14213                 done
14214                 set X $dflt
14215                 shift
14216                 dflt="$*"
14217                 ;;
14218         *)  dflt="$static_ext" 
14219                 ;;
14220         esac
14221
14222         case "$dflt" in
14223         '')     dflt=none;;
14224         esac
14225         rp="What extensions do you wish to load statically?"
14226         . ./myread
14227         case "$ans" in
14228         none) static_ext=' ' ;;
14229         *) static_ext="$ans" ;;
14230         esac
14231         ;;
14232 *)
14233         $cat <<EOM
14234 A number of extensions are supplied with $package.  Answer "none" 
14235 to include no extensions. 
14236 Note that DynaLoader is always built and need not be mentioned here.
14237
14238 EOM
14239         case "$static_ext" in
14240         '') dflt="$avail_ext" ;;
14241         *)      dflt="$static_ext"
14242                 # Perhaps we are reusing an old out-of-date config.sh.
14243                 case "$hint" in
14244                 previous)
14245                         if test X"$static_ext" != X"$avail_ext"; then
14246                                 $cat <<EOM
14247 NOTICE:  Your previous config.sh list may be incorrect. 
14248 The extensions now available to you are 
14249         ${avail_ext}
14250 but the default list from your previous config.sh is
14251         ${static_ext} 
14252
14253 EOM
14254                         fi
14255                         ;;
14256                 esac
14257                 ;;
14258         esac
14259         : Exclude those that are not xs extensions
14260         case "$dflt" in
14261         '')     dflt=none;;
14262         esac
14263         rp="What extensions do you wish to include?"
14264         . ./myread
14265         case "$ans" in
14266         none) static_ext=' ' ;;
14267         *) static_ext="$ans" ;;
14268         esac
14269         ;;
14270 esac
14271
14272 set X $dynamic_ext $static_ext $nonxs_ext
14273 shift
14274 extensions="$*"
14275
14276 : Remove build directory name from cppstdin so it can be used from
14277 : either the present location or the final installed location.
14278 echo " "
14279 : Get out of the UU directory to get correct path name.
14280 cd ..
14281 case "$cppstdin" in
14282 `pwd`/cppstdin)
14283         echo "Stripping down cppstdin path name"
14284         cppstdin=cppstdin
14285         ;;
14286 esac
14287 cd UU
14288
14289 : end of configuration questions
14290 echo " "
14291 echo "End of configuration questions."
14292 echo " "
14293
14294 : back to where it started
14295 if test -d ../UU; then
14296         cd ..
14297 fi
14298
14299 : configuration may be patched via a 'config.over' file
14300 if $test -f config.over; then
14301         echo " "
14302         dflt=y
14303         rp='I see a config.over file.  Do you wish to load it?'
14304         . UU/myread
14305         case "$ans" in
14306         n*) echo "OK, I'll ignore it.";;
14307         *)      . ./config.over
14308                 echo "Configuration override changes have been loaded."
14309                 ;;
14310         esac
14311 fi
14312
14313 : in case they want portability, strip down executable paths
14314 case "$d_portable" in
14315 "$define")
14316         echo " "
14317         echo "Stripping down executable paths..." >&4
14318         for file in $loclist $trylist; do
14319                 eval temp=\$$file
14320                 eval $file=`basename $temp`
14321         done
14322         ;;
14323 esac
14324
14325 : create config.sh file
14326 echo " "
14327 echo "Creating config.sh..." >&4
14328 $spitshell <<EOT >config.sh
14329 $startsh
14330 #
14331 # This file was produced by running the Configure script. It holds all the
14332 # definitions figured out by Configure. Should you modify one of these values,
14333 # do not forget to propagate your changes by running "Configure -der". You may
14334 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14335 #
14336
14337 # Package name      : $package
14338 # Source directory  : $src
14339 # Configuration time: $cf_time
14340 # Configured by     : $cf_by
14341 # Target system     : $myuname
14342
14343 Author='$Author'
14344 Date='$Date'
14345 Header='$Header'
14346 Id='$Id'
14347 Locker='$Locker'
14348 Log='$Log'
14349 Mcc='$Mcc'
14350 RCSfile='$RCSfile'
14351 Revision='$Revision'
14352 Source='$Source'
14353 State='$State'
14354 _a='$_a'
14355 _exe='$_exe'
14356 _o='$_o'
14357 afs='$afs'
14358 alignbytes='$alignbytes'
14359 ansi2knr='$ansi2knr'
14360 aphostname='$aphostname'
14361 api_revision='$api_revision'
14362 api_subversion='$api_subversion'
14363 api_version='$api_version'
14364 api_versionstring='$api_versionstring'
14365 ar='$ar'
14366 archlib='$archlib'
14367 archlibexp='$archlibexp'
14368 archname64='$archname64'
14369 archname='$archname'
14370 archobjs='$archobjs'
14371 awk='$awk'
14372 baserev='$baserev'
14373 bash='$bash'
14374 bin='$bin'
14375 bincompat5005='$bincompat5005'
14376 binexp='$binexp'
14377 bison='$bison'
14378 byacc='$byacc'
14379 byteorder='$byteorder'
14380 c='$c'
14381 castflags='$castflags'
14382 cat='$cat'
14383 cc='$cc'
14384 cccdlflags='$cccdlflags'
14385 ccdlflags='$ccdlflags'
14386 ccflags='$ccflags'
14387 ccsymbols='$ccsymbols'
14388 cf_by='$cf_by'
14389 cf_email='$cf_email'
14390 cf_time='$cf_time'
14391 charsize='$charsize'
14392 chgrp='$chgrp'
14393 chmod='$chmod'
14394 chown='$chown'
14395 clocktype='$clocktype'
14396 comm='$comm'
14397 compress='$compress'
14398 contains='$contains'
14399 cp='$cp'
14400 cpio='$cpio'
14401 cpp='$cpp'
14402 cpp_stuff='$cpp_stuff'
14403 cppccsymbols='$cppccsymbols'
14404 cppflags='$cppflags'
14405 cpplast='$cpplast'
14406 cppminus='$cppminus'
14407 cpprun='$cpprun'
14408 cppstdin='$cppstdin'
14409 cppsymbols='$cppsymbols'
14410 crosscompile='$crosscompile'
14411 cryptlib='$cryptlib'
14412 csh='$csh'
14413 d_Gconvert='$d_Gconvert'
14414 d_PRIEldbl='$d_PRIEldbl'
14415 d_PRIFldbl='$d_PRIFldbl'
14416 d_PRIGldbl='$d_PRIGldbl'
14417 d_PRIX64='$d_PRIX64'
14418 d_PRId64='$d_PRId64'
14419 d_PRIeldbl='$d_PRIeldbl'
14420 d_PRIfldbl='$d_PRIfldbl'
14421 d_PRIgldbl='$d_PRIgldbl'
14422 d_PRIi64='$d_PRIi64'
14423 d_PRIo64='$d_PRIo64'
14424 d_PRIu64='$d_PRIu64'
14425 d_PRIx64='$d_PRIx64'
14426 d_access='$d_access'
14427 d_accessx='$d_accessx'
14428 d_alarm='$d_alarm'
14429 d_archlib='$d_archlib'
14430 d_atolf='$d_atolf'
14431 d_atoll='$d_atoll'
14432 d_attribut='$d_attribut'
14433 d_bcmp='$d_bcmp'
14434 d_bcopy='$d_bcopy'
14435 d_bincompat5005='$d_bincompat5005'
14436 d_bsd='$d_bsd'
14437 d_bsdgetpgrp='$d_bsdgetpgrp'
14438 d_bsdsetpgrp='$d_bsdsetpgrp'
14439 d_bzero='$d_bzero'
14440 d_casti32='$d_casti32'
14441 d_castneg='$d_castneg'
14442 d_charvspr='$d_charvspr'
14443 d_chown='$d_chown'
14444 d_chroot='$d_chroot'
14445 d_chsize='$d_chsize'
14446 d_closedir='$d_closedir'
14447 d_const='$d_const'
14448 d_crypt='$d_crypt'
14449 d_csh='$d_csh'
14450 d_cuserid='$d_cuserid'
14451 d_dbl_dig='$d_dbl_dig'
14452 d_difftime='$d_difftime'
14453 d_dirnamlen='$d_dirnamlen'
14454 d_dlerror='$d_dlerror'
14455 d_dlopen='$d_dlopen'
14456 d_dlsymun='$d_dlsymun'
14457 d_dosuid='$d_dosuid'
14458 d_drand48proto='$d_drand48proto'
14459 d_dup2='$d_dup2'
14460 d_eaccess='$d_eaccess'
14461 d_endgrent='$d_endgrent'
14462 d_endhent='$d_endhent'
14463 d_endnent='$d_endnent'
14464 d_endpent='$d_endpent'
14465 d_endpwent='$d_endpwent'
14466 d_endsent='$d_endsent'
14467 d_endspent='$d_endspent'
14468 d_eofnblk='$d_eofnblk'
14469 d_eunice='$d_eunice'
14470 d_fchmod='$d_fchmod'
14471 d_fchown='$d_fchown'
14472 d_fcntl='$d_fcntl'
14473 d_fd_macros='$d_fd_macros'
14474 d_fd_set='$d_fd_set'
14475 d_fds_bits='$d_fds_bits'
14476 d_fgetpos='$d_fgetpos'
14477 d_flexfnam='$d_flexfnam'
14478 d_flock='$d_flock'
14479 d_fork='$d_fork'
14480 d_fpathconf='$d_fpathconf'
14481 d_fpos64_t='$d_fpos64_t'
14482 d_fs_data_s='$d_fs_data_s'
14483 d_fseeko='$d_fseeko'
14484 d_fsetpos='$d_fsetpos'
14485 d_fstatfs='$d_fstatfs'
14486 d_fstatvfs='$d_fstatvfs'
14487 d_ftello='$d_ftello'
14488 d_ftime='$d_ftime'
14489 d_getgrent='$d_getgrent'
14490 d_getgrps='$d_getgrps'
14491 d_gethbyaddr='$d_gethbyaddr'
14492 d_gethbyname='$d_gethbyname'
14493 d_gethent='$d_gethent'
14494 d_gethname='$d_gethname'
14495 d_gethostprotos='$d_gethostprotos'
14496 d_getlogin='$d_getlogin'
14497 d_getmnt='$d_getmnt'
14498 d_getmntent='$d_getmntent'
14499 d_getnbyaddr='$d_getnbyaddr'
14500 d_getnbyname='$d_getnbyname'
14501 d_getnent='$d_getnent'
14502 d_getnetprotos='$d_getnetprotos'
14503 d_getpbyname='$d_getpbyname'
14504 d_getpbynumber='$d_getpbynumber'
14505 d_getpent='$d_getpent'
14506 d_getpgid='$d_getpgid'
14507 d_getpgrp2='$d_getpgrp2'
14508 d_getpgrp='$d_getpgrp'
14509 d_getppid='$d_getppid'
14510 d_getprior='$d_getprior'
14511 d_getprotoprotos='$d_getprotoprotos'
14512 d_getpwent='$d_getpwent'
14513 d_getsbyname='$d_getsbyname'
14514 d_getsbyport='$d_getsbyport'
14515 d_getsent='$d_getsent'
14516 d_getservprotos='$d_getservprotos'
14517 d_getspent='$d_getspent'
14518 d_getspnam='$d_getspnam'
14519 d_gettimeod='$d_gettimeod'
14520 d_gnulibc='$d_gnulibc'
14521 d_grpasswd='$d_grpasswd'
14522 d_hasmntopt='$d_hasmntopt'
14523 d_htonl='$d_htonl'
14524 d_index='$d_index'
14525 d_inetaton='$d_inetaton'
14526 d_int64t='$d_int64t'
14527 d_isascii='$d_isascii'
14528 d_killpg='$d_killpg'
14529 d_lchown='$d_lchown'
14530 d_ldbl_dig='$d_ldbl_dig'
14531 d_link='$d_link'
14532 d_locconv='$d_locconv'
14533 d_lockf='$d_lockf'
14534 d_longdbl='$d_longdbl'
14535 d_longlong='$d_longlong'
14536 d_lstat='$d_lstat'
14537 d_mblen='$d_mblen'
14538 d_mbstowcs='$d_mbstowcs'
14539 d_mbtowc='$d_mbtowc'
14540 d_memchr='$d_memchr'
14541 d_memcmp='$d_memcmp'
14542 d_memcpy='$d_memcpy'
14543 d_memmove='$d_memmove'
14544 d_memset='$d_memset'
14545 d_mkdir='$d_mkdir'
14546 d_mkfifo='$d_mkfifo'
14547 d_mktime='$d_mktime'
14548 d_msg='$d_msg'
14549 d_msg_ctrunc='$d_msg_ctrunc'
14550 d_msg_dontroute='$d_msg_dontroute'
14551 d_msg_oob='$d_msg_oob'
14552 d_msg_peek='$d_msg_peek'
14553 d_msg_proxy='$d_msg_proxy'
14554 d_msgctl='$d_msgctl'
14555 d_msgget='$d_msgget'
14556 d_msgrcv='$d_msgrcv'
14557 d_msgsnd='$d_msgsnd'
14558 d_mymalloc='$d_mymalloc'
14559 d_nice='$d_nice'
14560 d_off64_t='$d_off64_t'
14561 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14562 d_oldpthreads='$d_oldpthreads'
14563 d_oldsock='$d_oldsock'
14564 d_open3='$d_open3'
14565 d_pathconf='$d_pathconf'
14566 d_pause='$d_pause'
14567 d_phostname='$d_phostname'
14568 d_pipe='$d_pipe'
14569 d_poll='$d_poll'
14570 d_portable='$d_portable'
14571 d_pthread_yield='$d_pthread_yield'
14572 d_pwage='$d_pwage'
14573 d_pwchange='$d_pwchange'
14574 d_pwclass='$d_pwclass'
14575 d_pwcomment='$d_pwcomment'
14576 d_pwexpire='$d_pwexpire'
14577 d_pwgecos='$d_pwgecos'
14578 d_pwpasswd='$d_pwpasswd'
14579 d_pwquota='$d_pwquota'
14580 d_quad='$d_quad'
14581 d_readdir='$d_readdir'
14582 d_readlink='$d_readlink'
14583 d_rename='$d_rename'
14584 d_rewinddir='$d_rewinddir'
14585 d_rmdir='$d_rmdir'
14586 d_safebcpy='$d_safebcpy'
14587 d_safemcpy='$d_safemcpy'
14588 d_sanemcmp='$d_sanemcmp'
14589 d_sched_yield='$d_sched_yield'
14590 d_scm_rights='$d_scm_rights'
14591 d_seekdir='$d_seekdir'
14592 d_select='$d_select'
14593 d_sem='$d_sem'
14594 d_semctl='$d_semctl'
14595 d_semctl_semid_ds='$d_semctl_semid_ds'
14596 d_semctl_semun='$d_semctl_semun'
14597 d_semget='$d_semget'
14598 d_semop='$d_semop'
14599 d_setegid='$d_setegid'
14600 d_seteuid='$d_seteuid'
14601 d_setgrent='$d_setgrent'
14602 d_setgrps='$d_setgrps'
14603 d_sethent='$d_sethent'
14604 d_setlinebuf='$d_setlinebuf'
14605 d_setlocale='$d_setlocale'
14606 d_setnent='$d_setnent'
14607 d_setpent='$d_setpent'
14608 d_setpgid='$d_setpgid'
14609 d_setpgrp2='$d_setpgrp2'
14610 d_setpgrp='$d_setpgrp'
14611 d_setprior='$d_setprior'
14612 d_setpwent='$d_setpwent'
14613 d_setregid='$d_setregid'
14614 d_setresgid='$d_setresgid'
14615 d_setresuid='$d_setresuid'
14616 d_setreuid='$d_setreuid'
14617 d_setrgid='$d_setrgid'
14618 d_setruid='$d_setruid'
14619 d_setsent='$d_setsent'
14620 d_setsid='$d_setsid'
14621 d_setspent='$d_setspent'
14622 d_setvbuf='$d_setvbuf'
14623 d_sfio='$d_sfio'
14624 d_shm='$d_shm'
14625 d_shmat='$d_shmat'
14626 d_shmatprototype='$d_shmatprototype'
14627 d_shmctl='$d_shmctl'
14628 d_shmdt='$d_shmdt'
14629 d_shmget='$d_shmget'
14630 d_sigaction='$d_sigaction'
14631 d_sigsetjmp='$d_sigsetjmp'
14632 d_socket='$d_socket'
14633 d_sockpair='$d_sockpair'
14634 d_sqrtl='$d_sqrtl'
14635 d_statblks='$d_statblks'
14636 d_statfs_f_flags='$d_statfs_f_flags'
14637 d_statfs_s='$d_statfs_s'
14638 d_statvfs='$d_statvfs'
14639 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14640 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14641 d_stdio_stream_array='$d_stdio_stream_array'
14642 d_stdiobase='$d_stdiobase'
14643 d_stdstdio='$d_stdstdio'
14644 d_strchr='$d_strchr'
14645 d_strcoll='$d_strcoll'
14646 d_strctcpy='$d_strctcpy'
14647 d_strerrm='$d_strerrm'
14648 d_strerror='$d_strerror'
14649 d_strtod='$d_strtod'
14650 d_strtol='$d_strtol'
14651 d_strtold='$d_strtold'
14652 d_strtoll='$d_strtoll'
14653 d_strtoul='$d_strtoul'
14654 d_strtoull='$d_strtoull'
14655 d_strtouq='$d_strtouq'
14656 d_strxfrm='$d_strxfrm'
14657 d_suidsafe='$d_suidsafe'
14658 d_symlink='$d_symlink'
14659 d_syscall='$d_syscall'
14660 d_sysconf='$d_sysconf'
14661 d_sysernlst='$d_sysernlst'
14662 d_syserrlst='$d_syserrlst'
14663 d_system='$d_system'
14664 d_tcgetpgrp='$d_tcgetpgrp'
14665 d_tcsetpgrp='$d_tcsetpgrp'
14666 d_telldir='$d_telldir'
14667 d_telldirproto='$d_telldirproto'
14668 d_time='$d_time'
14669 d_times='$d_times'
14670 d_truncate='$d_truncate'
14671 d_tzname='$d_tzname'
14672 d_umask='$d_umask'
14673 d_uname='$d_uname'
14674 d_union_semun='$d_union_semun'
14675 d_ustat='$d_ustat'
14676 d_vendorbin='$d_vendorbin'
14677 d_vendorlib='$d_vendorlib'
14678 d_vfork='$d_vfork'
14679 d_void_closedir='$d_void_closedir'
14680 d_voidsig='$d_voidsig'
14681 d_voidtty='$d_voidtty'
14682 d_volatile='$d_volatile'
14683 d_vprintf='$d_vprintf'
14684 d_wait4='$d_wait4'
14685 d_waitpid='$d_waitpid'
14686 d_wcstombs='$d_wcstombs'
14687 d_wctomb='$d_wctomb'
14688 d_xenix='$d_xenix'
14689 date='$date'
14690 db_hashtype='$db_hashtype'
14691 db_prefixtype='$db_prefixtype'
14692 defvoidused='$defvoidused'
14693 direntrytype='$direntrytype'
14694 dlext='$dlext'
14695 dlsrc='$dlsrc'
14696 doublesize='$doublesize'
14697 drand01='$drand01'
14698 dynamic_ext='$dynamic_ext'
14699 eagain='$eagain'
14700 ebcdic='$ebcdic'
14701 echo='$echo'
14702 egrep='$egrep'
14703 emacs='$emacs'
14704 eunicefix='$eunicefix'
14705 exe_ext='$exe_ext'
14706 expr='$expr'
14707 extensions='$extensions'
14708 fflushNULL='$fflushNULL'
14709 fflushall='$fflushall'
14710 find='$find'
14711 firstmakefile='$firstmakefile'
14712 flex='$flex'
14713 fpossize='$fpossize'
14714 fpostype='$fpostype'
14715 freetype='$freetype'
14716 full_ar='$full_ar'
14717 full_csh='$full_csh'
14718 full_sed='$full_sed'
14719 gccversion='$gccversion'
14720 gidformat='$gidformat'
14721 gidsign='$gidsign'
14722 gidsize='$gidsize'
14723 gidtype='$gidtype'
14724 glibpth='$glibpth'
14725 grep='$grep'
14726 groupcat='$groupcat'
14727 groupstype='$groupstype'
14728 gzip='$gzip'
14729 h_fcntl='$h_fcntl'
14730 h_sysfile='$h_sysfile'
14731 hint='$hint'
14732 hostcat='$hostcat'
14733 huge='$huge'
14734 i16size='$i16size'
14735 i16type='$i16type'
14736 i32size='$i32size'
14737 i32type='$i32type'
14738 i64size='$i64size'
14739 i64type='$i64type'
14740 i8size='$i8size'
14741 i8type='$i8type'
14742 i_arpainet='$i_arpainet'
14743 i_bsdioctl='$i_bsdioctl'
14744 i_db='$i_db'
14745 i_dbm='$i_dbm'
14746 i_dirent='$i_dirent'
14747 i_dld='$i_dld'
14748 i_dlfcn='$i_dlfcn'
14749 i_fcntl='$i_fcntl'
14750 i_float='$i_float'
14751 i_gdbm='$i_gdbm'
14752 i_grp='$i_grp'
14753 i_inttypes='$i_inttypes'
14754 i_limits='$i_limits'
14755 i_locale='$i_locale'
14756 i_machcthr='$i_machcthr'
14757 i_malloc='$i_malloc'
14758 i_math='$i_math'
14759 i_memory='$i_memory'
14760 i_mntent='$i_mntent'
14761 i_ndbm='$i_ndbm'
14762 i_netdb='$i_netdb'
14763 i_neterrno='$i_neterrno'
14764 i_netinettcp='$i_netinettcp'
14765 i_niin='$i_niin'
14766 i_poll='$i_poll'
14767 i_pthread='$i_pthread'
14768 i_pwd='$i_pwd'
14769 i_rpcsvcdbm='$i_rpcsvcdbm'
14770 i_sfio='$i_sfio'
14771 i_sgtty='$i_sgtty'
14772 i_shadow='$i_shadow'
14773 i_socks='$i_socks'
14774 i_stdarg='$i_stdarg'
14775 i_stddef='$i_stddef'
14776 i_stdlib='$i_stdlib'
14777 i_string='$i_string'
14778 i_sysaccess='$i_sysaccess'
14779 i_sysdir='$i_sysdir'
14780 i_sysfile='$i_sysfile'
14781 i_sysfilio='$i_sysfilio'
14782 i_sysin='$i_sysin'
14783 i_sysioctl='$i_sysioctl'
14784 i_sysmount='$i_sysmount'
14785 i_sysndir='$i_sysndir'
14786 i_sysparam='$i_sysparam'
14787 i_sysresrc='$i_sysresrc'
14788 i_syssecrt='$i_syssecrt'
14789 i_sysselct='$i_sysselct'
14790 i_syssockio='$i_syssockio'
14791 i_sysstat='$i_sysstat'
14792 i_sysstatfs='$i_sysstatfs'
14793 i_sysstatvfs='$i_sysstatvfs'
14794 i_systime='$i_systime'
14795 i_systimek='$i_systimek'
14796 i_systimes='$i_systimes'
14797 i_systypes='$i_systypes'
14798 i_sysuio='$i_sysuio'
14799 i_sysun='$i_sysun'
14800 i_sysvfs='$i_sysvfs'
14801 i_syswait='$i_syswait'
14802 i_termio='$i_termio'
14803 i_termios='$i_termios'
14804 i_time='$i_time'
14805 i_unistd='$i_unistd'
14806 i_ustat='$i_ustat'
14807 i_utime='$i_utime'
14808 i_values='$i_values'
14809 i_varargs='$i_varargs'
14810 i_varhdr='$i_varhdr'
14811 i_vfork='$i_vfork'
14812 ignore_versioned_solibs='$ignore_versioned_solibs'
14813 inc_version_list='$inc_version_list'
14814 incpath='$incpath'
14815 inews='$inews'
14816 installarchlib='$installarchlib'
14817 installbin='$installbin'
14818 installman1dir='$installman1dir'
14819 installman3dir='$installman3dir'
14820 installprefix='$installprefix'
14821 installprefixexp='$installprefixexp'
14822 installprivlib='$installprivlib'
14823 installscript='$installscript'
14824 installsitearch='$installsitearch'
14825 installsitebin='$installsitebin'
14826 installsitelib='$installsitelib'
14827 installstyle='$installstyle'
14828 installusrbinperl='$installusrbinperl'
14829 installvendorbin='$installvendorbin'
14830 installvendorlib='$installvendorlib'
14831 intsize='$intsize'
14832 ivdformat='$ivdformat'
14833 ivsize='$ivsize'
14834 ivtype='$ivtype'
14835 known_extensions='$known_extensions'
14836 ksh='$ksh'
14837 large='$large'
14838 ld='$ld'
14839 lddlflags='$lddlflags'
14840 ldflags='$ldflags'
14841 ldlibpthname='$ldlibpthname'
14842 less='$less'
14843 lib_ext='$lib_ext'
14844 libc='$libc'
14845 libperl='$libperl'
14846 libpth='$libpth'
14847 libs='$libs'
14848 libswanted='$libswanted'
14849 line='$line'
14850 lint='$lint'
14851 lkflags='$lkflags'
14852 ln='$ln'
14853 lns='$lns'
14854 locincpth='$locincpth'
14855 loclibpth='$loclibpth'
14856 longdblsize='$longdblsize'
14857 longlongsize='$longlongsize'
14858 longsize='$longsize'
14859 lp='$lp'
14860 lpr='$lpr'
14861 ls='$ls'
14862 lseeksize='$lseeksize'
14863 lseektype='$lseektype'
14864 mail='$mail'
14865 mailx='$mailx'
14866 make='$make'
14867 make_set_make='$make_set_make'
14868 mallocobj='$mallocobj'
14869 mallocsrc='$mallocsrc'
14870 malloctype='$malloctype'
14871 man1dir='$man1dir'
14872 man1direxp='$man1direxp'
14873 man1ext='$man1ext'
14874 man3dir='$man3dir'
14875 man3direxp='$man3direxp'
14876 man3ext='$man3ext'
14877 medium='$medium'
14878 mips_type='$mips_type'
14879 mkdir='$mkdir'
14880 models='$models'
14881 modetype='$modetype'
14882 more='$more'
14883 multiarch='$multiarch'
14884 mv='$mv'
14885 myarchname='$myarchname'
14886 mydomain='$mydomain'
14887 myhostname='$myhostname'
14888 myuname='$myuname'
14889 n='$n'
14890 netdb_hlen_type='$netdb_hlen_type'
14891 netdb_host_type='$netdb_host_type'
14892 netdb_name_type='$netdb_name_type'
14893 netdb_net_type='$netdb_net_type'
14894 nm='$nm'
14895 nm_opt='$nm_opt'
14896 nm_so_opt='$nm_so_opt'
14897 nonxs_ext='$nonxs_ext'
14898 nroff='$nroff'
14899 nvsize='$nvsize'
14900 nvtype='$nvtype'
14901 o_nonblock='$o_nonblock'
14902 obj_ext='$obj_ext'
14903 old_pthread_create_joinable='$old_pthread_create_joinable'
14904 optimize='$optimize'
14905 orderlib='$orderlib'
14906 osname='$osname'
14907 osvers='$osvers'
14908 package='$package'
14909 pager='$pager'
14910 passcat='$passcat'
14911 patchlevel='$patchlevel'
14912 path_sep='$path_sep'
14913 perl='$perl'
14914 perladmin='$perladmin'
14915 perlpath='$perlpath'
14916 pg='$pg'
14917 phostname='$phostname'
14918 pidtype='$pidtype'
14919 plibpth='$plibpth'
14920 pmake='$pmake'
14921 pr='$pr'
14922 prefix='$prefix'
14923 prefixexp='$prefixexp'
14924 privlib='$privlib'
14925 privlibexp='$privlibexp'
14926 prototype='$prototype'
14927 ptrsize='$ptrsize'
14928 quadkind='$quadkind'
14929 quadtype='$quadtype'
14930 randbits='$randbits'
14931 randfunc='$randfunc'
14932 randseedtype='$randseedtype'
14933 ranlib='$ranlib'
14934 rd_nodata='$rd_nodata'
14935 rm='$rm'
14936 rmail='$rmail'
14937 runnm='$runnm'
14938 sPRIEldbl='$sPRIEldbl'
14939 sPRIFldbl='$sPRIFldbl'
14940 sPRIGldbl='$sPRIGldbl'
14941 sPRIX64='$sPRIX64'
14942 sPRId64='$sPRId64'
14943 sPRIeldbl='$sPRIeldbl'
14944 sPRIfldbl='$sPRIfldbl'
14945 sPRIgldbl='$sPRIgldbl'
14946 sPRIi64='$sPRIi64'
14947 sPRIo64='$sPRIo64'
14948 sPRIu64='$sPRIu64'
14949 sPRIx64='$sPRIx64'
14950 sched_yield='$sched_yield'
14951 scriptdir='$scriptdir'
14952 scriptdirexp='$scriptdirexp'
14953 sed='$sed'
14954 seedfunc='$seedfunc'
14955 selectminbits='$selectminbits'
14956 selecttype='$selecttype'
14957 sendmail='$sendmail'
14958 sh='$sh'
14959 shar='$shar'
14960 sharpbang='$sharpbang'
14961 shmattype='$shmattype'
14962 shortsize='$shortsize'
14963 shrpenv='$shrpenv'
14964 shsharp='$shsharp'
14965 sig_count='$sig_count'
14966 sig_name='$sig_name'
14967 sig_name_init='$sig_name_init'
14968 sig_num='$sig_num'
14969 sig_num_init='$sig_num_init'
14970 signal_t='$signal_t'
14971 sitearch='$sitearch'
14972 sitearchexp='$sitearchexp'
14973 sitebin='$sitebin'
14974 sitebinexp='$sitebinexp'
14975 sitelib='$sitelib'
14976 sitelibexp='$sitelibexp'
14977 siteprefix='$siteprefix'
14978 siteprefixexp='$siteprefixexp'
14979 sizetype='$sizetype'
14980 sleep='$sleep'
14981 smail='$smail'
14982 small='$small'
14983 so='$so'
14984 sockethdr='$sockethdr'
14985 socketlib='$socketlib'
14986 sort='$sort'
14987 spackage='$spackage'
14988 spitshell='$spitshell'
14989 split='$split'
14990 src='$src'
14991 ssizetype='$ssizetype'
14992 startperl='$startperl'
14993 startsh='$startsh'
14994 static_ext='$static_ext'
14995 stdchar='$stdchar'
14996 stdio_base='$stdio_base'
14997 stdio_bufsiz='$stdio_bufsiz'
14998 stdio_cnt='$stdio_cnt'
14999 stdio_filbuf='$stdio_filbuf'
15000 stdio_ptr='$stdio_ptr'
15001 stdio_stream_array='$stdio_stream_array'
15002 strings='$strings'
15003 submit='$submit'
15004 subversion='$subversion'
15005 sysman='$sysman'
15006 tail='$tail'
15007 tar='$tar'
15008 tbl='$tbl'
15009 tee='$tee'
15010 test='$test'
15011 timeincl='$timeincl'
15012 timetype='$timetype'
15013 touch='$touch'
15014 tr='$tr'
15015 trnl='$trnl'
15016 troff='$troff'
15017 u16size='$u16size'
15018 u16type='$u16type'
15019 u32size='$u32size'
15020 u32type='$u32type'
15021 u64size='$u64size'
15022 u64type='$u64type'
15023 u8size='$u8size'
15024 u8type='$u8type'
15025 uidformat='$uidformat'
15026 uidsign='$uidsign'
15027 uidsize='$uidsize'
15028 uidtype='$uidtype'
15029 uname='$uname'
15030 uniq='$uniq'
15031 uquadtype='$uquadtype'
15032 use5005threads='$use5005threads'
15033 use64bits='$use64bits'
15034 usedl='$usedl'
15035 useithreads='$useithreads'
15036 uselargefiles='$uselargefiles'
15037 uselongdouble='$uselongdouble'
15038 uselonglong='$uselonglong'
15039 usemorebits='$usemorebits'
15040 usemultiplicity='$usemultiplicity'
15041 usemymalloc='$usemymalloc'
15042 usenm='$usenm'
15043 useopcode='$useopcode'
15044 useperlio='$useperlio'
15045 useposix='$useposix'
15046 usesfio='$usesfio'
15047 useshrplib='$useshrplib'
15048 usesocks='$usesocks'
15049 usethreads='$usethreads'
15050 usevendorprefix='$usevendorprefix'
15051 usevfork='$usevfork'
15052 usrinc='$usrinc'
15053 uuname='$uuname'
15054 uvoformat='$uvoformat'
15055 uvsize='$uvsize'
15056 uvtype='$uvtype'
15057 uvuformat='$uvuformat'
15058 uvxformat='$uvxformat'
15059 vendorbin='$vendorbin'
15060 vendorbinexp='$vendorbinexp'
15061 vendorlib='$vendorlib'
15062 vendorlibexp='$vendorlibexp'
15063 vendorprefix='$vendorprefix'
15064 vendorprefixexp='$vendorprefixexp'
15065 version='$version'
15066 vi='$vi'
15067 voidflags='$voidflags'
15068 xlibpth='$xlibpth'
15069 zcat='$zcat'
15070 zip='$zip'
15071 EOT
15072
15073 : Add in command line options if available
15074 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15075
15076 : add special variables
15077 $test -f $src/patchlevel.h && \
15078 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15079 echo "CONFIGDOTSH=true" >>config.sh
15080
15081 : propagate old symbols
15082 if $test -f UU/config.sh; then
15083         <UU/config.sh sort | uniq >UU/oldconfig.sh
15084         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15085         sort | uniq -u >UU/oldsyms
15086         set X `cat UU/oldsyms`
15087         shift
15088         case $# in
15089         0) ;;
15090         *)
15091                 cat <<EOM
15092 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15093 EOM
15094                 echo "# Variables propagated from previous config.sh file." >>config.sh
15095                 for sym in `cat UU/oldsyms`; do
15096                         echo "    Propagating $hint variable "'$'"$sym..."
15097                         eval 'tmp="$'"${sym}"'"'
15098                         echo "$tmp" | \
15099                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15100                 done
15101                 ;;
15102         esac
15103 fi
15104
15105 : Finish up by extracting the .SH files
15106 case "$alldone" in
15107 exit)
15108         $rm -rf UU
15109         echo "Done."
15110         exit 0
15111         ;;
15112 cont)
15113         ;;
15114 '')
15115         dflt=''
15116         nostick=true
15117         $cat <<EOM
15118
15119 If you'd like to make any changes to the config.sh file before I begin
15120 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15121
15122 EOM
15123         rp="Press return or use a shell escape to edit config.sh:"
15124         . UU/myread
15125         nostick=''
15126         case "$ans" in
15127         '') ;;
15128         *) : in case they cannot read
15129                 sh 1>&4 -c "$ans";;
15130         esac
15131         ;;
15132 esac
15133
15134 : if this fails, just run all the .SH files by hand
15135 . ./config.sh
15136
15137 echo " "
15138 exec 1>&4
15139 . ./UU/extract
15140
15141 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15142         dflt=y
15143         case "$silent" in
15144         true) ;;
15145         *)
15146                 $cat <<EOM
15147
15148 Now you need to generate make dependencies by running "$make depend".
15149 You might prefer to run it in background: "$make depend > makedepend.out &"
15150 It can take a while, so you might not want to run it right now.
15151
15152 EOM
15153                 ;;
15154         esac
15155         rp="Run $make depend now?"
15156         . UU/myread
15157         case "$ans" in
15158         y*)
15159                 $make depend && echo "Now you must run a $make."
15160                 ;;
15161         *)
15162                 echo "You must run '$make depend' then '$make'."
15163                 ;;
15164         esac
15165 elif test -f [Mm]akefile; then
15166         echo " "
15167         echo "Now you must run a $make."
15168 else
15169         echo "Done."
15170 fi
15171
15172 if $test -f Policy.sh; then
15173     $cat <<EOM
15174
15175 If you compile $package on a different machine or from a different object
15176 directory, copy the Policy.sh file from this object directory to the
15177 new one before you run Configure -- this will help you with most of
15178 the policy defaults.
15179
15180 EOM
15181 fi
15182 if $test -f config.msg; then
15183     echo "Hmm.  I also noted the following information while running:"
15184     echo " "
15185     $cat config.msg >&4
15186     $rm -f config.msg
15187 fi
15188 $rm -f kit*isdone ark*isdone
15189 $rm -rf UU
15190
15191 : End of Configure
15192