c0e5e2488bfb098287eb8377f4429f31d6fea739
[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 Fri Oct 29 17:37:33 EET DST 1999 [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 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_endspent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fs_data_s=''
357 d_fseeko=''
358 d_fsetpos=''
359 d_fstatfs=''
360 d_ftello=''
361 d_ftime=''
362 d_gettimeod=''
363 d_Gconvert=''
364 d_getgrent=''
365 d_getgrps=''
366 d_gethbyaddr=''
367 d_gethbyname=''
368 d_gethent=''
369 aphostname=''
370 d_gethname=''
371 d_phostname=''
372 d_uname=''
373 d_gethostprotos=''
374 d_getlogin=''
375 d_getmnt=''
376 d_getmntent=''
377 d_getnbyaddr=''
378 d_getnbyname=''
379 d_getnent=''
380 d_getnetprotos=''
381 d_getpent=''
382 d_getpgid=''
383 d_getpgrp2=''
384 d_bsdgetpgrp=''
385 d_getpgrp=''
386 d_getppid=''
387 d_getprior=''
388 d_getpbyname=''
389 d_getpbynumber=''
390 d_getprotoprotos=''
391 d_getpwent=''
392 d_getsent=''
393 d_getservprotos=''
394 d_getspent=''
395 d_getspnam=''
396 d_getsbyname=''
397 d_getsbyport=''
398 d_gnulibc=''
399 d_hasmntopt=''
400 d_htonl=''
401 d_inetaton=''
402 d_isascii=''
403 d_killpg=''
404 d_lchown=''
405 d_ldbl_dig=''
406 d_link=''
407 d_locconv=''
408 d_lockf=''
409 d_longdbl=''
410 longdblsize=''
411 d_longlong=''
412 longlongsize=''
413 d_lstat=''
414 d_mblen=''
415 d_mbstowcs=''
416 d_mbtowc=''
417 d_memchr=''
418 d_memcmp=''
419 d_memcpy=''
420 d_memmove=''
421 d_memset=''
422 d_mkdir=''
423 d_mkfifo=''
424 d_mktime=''
425 d_msg=''
426 d_msgctl=''
427 d_msgget=''
428 d_msgrcv=''
429 d_msgsnd=''
430 d_nice=''
431 d_open3=''
432 d_fpathconf=''
433 d_pathconf=''
434 d_pause=''
435 d_pipe=''
436 d_poll=''
437 d_portable=''
438 d_old_pthread_create_joinable=''
439 old_pthread_create_joinable=''
440 d_pthread_yield=''
441 d_sched_yield=''
442 sched_yield=''
443 d_readdir=''
444 d_rewinddir=''
445 d_seekdir=''
446 d_telldir=''
447 d_readlink=''
448 d_rename=''
449 d_rmdir=''
450 d_safebcpy=''
451 d_safemcpy=''
452 d_sanemcmp=''
453 d_select=''
454 d_sem=''
455 d_semctl=''
456 d_semget=''
457 d_semop=''
458 d_setegid=''
459 d_seteuid=''
460 d_setgrent=''
461 d_setgrps=''
462 d_sethent=''
463 d_setlinebuf=''
464 d_setlocale=''
465 d_setnent=''
466 d_setpent=''
467 d_setpgid=''
468 d_setpgrp2=''
469 d_bsdsetpgrp=''
470 d_setpgrp=''
471 d_setprior=''
472 d_setpwent=''
473 d_setregid=''
474 d_setresgid=''
475 d_setresuid=''
476 d_setreuid=''
477 d_setrgid=''
478 d_setruid=''
479 d_setsent=''
480 d_setsid=''
481 d_setspent=''
482 d_setvbuf=''
483 d_sfio=''
484 usesfio=''
485 d_shm=''
486 d_shmat=''
487 d_shmatprototype=''
488 shmattype=''
489 d_shmctl=''
490 d_shmdt=''
491 d_shmget=''
492 d_sigaction=''
493 d_sigsetjmp=''
494 d_msg_ctrunc=''
495 d_msg_dontroute=''
496 d_msg_oob=''
497 d_msg_peek=''
498 d_msg_proxy=''
499 d_oldsock=''
500 d_scm_rights=''
501 d_socket=''
502 d_sockpair=''
503 sockethdr=''
504 socketlib=''
505 d_sqrtl=''
506 d_statblks=''
507 d_statfs_f_flags=''
508 d_statfs_s=''
509 d_fstatvfs=''
510 d_statvfs=''
511 d_stdio_cnt_lval=''
512 d_stdio_ptr_lval=''
513 d_stdiobase=''
514 d_stdstdio=''
515 stdio_base=''
516 stdio_bufsiz=''
517 stdio_cnt=''
518 stdio_filbuf=''
519 stdio_ptr=''
520 d_index=''
521 d_strchr=''
522 d_strcoll=''
523 d_strctcpy=''
524 d_strerrm=''
525 d_strerror=''
526 d_sysernlst=''
527 d_syserrlst=''
528 d_strtod=''
529 d_strtol=''
530 d_strtoul=''
531 d_strxfrm=''
532 d_symlink=''
533 d_syscall=''
534 d_sysconf=''
535 d_system=''
536 d_tcgetpgrp=''
537 d_tcsetpgrp=''
538 d_telldirproto=''
539 d_time=''
540 timetype=''
541 clocktype=''
542 d_times=''
543 d_truncate=''
544 d_tzname=''
545 d_umask=''
546 d_semctl_semid_ds=''
547 d_semctl_semun=''
548 d_union_semun=''
549 d_ustat=''
550 d_vfork=''
551 usevfork=''
552 d_voidsig=''
553 signal_t=''
554 d_volatile=''
555 d_charvspr=''
556 d_vprintf=''
557 d_wait4=''
558 d_waitpid=''
559 d_wcstombs=''
560 d_wctomb=''
561 dlext=''
562 cccdlflags=''
563 ccdlflags=''
564 dlsrc=''
565 ld=''
566 lddlflags=''
567 usedl=''
568 doublesize=''
569 ebcdic=''
570 fflushNULL=''
571 fflushall=''
572 fpostype=''
573 gidsign=''
574 gidsize=''
575 gidtype=''
576 groupstype=''
577 h_fcntl=''
578 h_sysfile=''
579 i_arpainet=''
580 db_hashtype=''
581 db_prefixtype=''
582 i_db=''
583 i_dbm=''
584 i_rpcsvcdbm=''
585 d_dirnamlen=''
586 direntrytype=''
587 i_dirent=''
588 i_dld=''
589 i_dlfcn=''
590 i_fcntl=''
591 i_float=''
592 i_gdbm=''
593 d_grpasswd=''
594 i_grp=''
595 d_int64t=''
596 i_inttypes=''
597 i_limits=''
598 i_locale=''
599 i_machcthr=''
600 i_malloc=''
601 i_math=''
602 i_memory=''
603 i_mntent=''
604 i_ndbm=''
605 i_netdb=''
606 i_neterrno=''
607 i_netinettcp=''
608 i_niin=''
609 i_sysin=''
610 i_poll=''
611 i_pthread=''
612 d_pwage=''
613 d_pwchange=''
614 d_pwclass=''
615 d_pwcomment=''
616 d_pwexpire=''
617 d_pwgecos=''
618 d_pwpasswd=''
619 d_pwquota=''
620 i_pwd=''
621 i_sfio=''
622 i_shadow=''
623 i_socks=''
624 i_stddef=''
625 i_stdlib=''
626 i_string=''
627 strings=''
628 i_sysaccess=''
629 i_sysdir=''
630 i_sysfile=''
631 d_voidtty=''
632 i_bsdioctl=''
633 i_sysfilio=''
634 i_sysioctl=''
635 i_syssockio=''
636 i_sysmount=''
637 i_sysndir=''
638 i_sysparam=''
639 i_sysresrc=''
640 i_syssecrt=''
641 i_sysselct=''
642 i_sysstat=''
643 i_sysstatfs=''
644 i_sysstatvfs=''
645 i_systimes=''
646 i_systypes=''
647 d_iovec_s=''
648 i_sysuio=''
649 i_sysun=''
650 i_sysvfs=''
651 i_syswait=''
652 i_sgtty=''
653 i_termio=''
654 i_termios=''
655 i_systime=''
656 i_systimek=''
657 i_time=''
658 timeincl=''
659 i_unistd=''
660 i_ustat=''
661 i_utime=''
662 i_values=''
663 i_stdarg=''
664 i_varargs=''
665 i_varhdr=''
666 i_vfork=''
667 installprefix=''
668 installprefixexp=''
669 installstyle=''
670 installusrbinperl=''
671 intsize=''
672 longsize=''
673 shortsize=''
674 d_fpos64_t=''
675 d_llseek=''
676 d_off64_t=''
677 libc=''
678 ldlibpthname=''
679 libperl=''
680 shrpenv=''
681 useshrplib=''
682 glibpth=''
683 libpth=''
684 loclibpth=''
685 plibpth=''
686 xlibpth=''
687 ignore_versioned_solibs=''
688 libs=''
689 lns=''
690 d_PRIEldbl=''
691 d_PRIFldbl=''
692 d_PRIGldbl=''
693 d_PRIeldbl=''
694 d_PRIfldbl=''
695 d_PRIgldbl=''
696 sPRIEldbl=''
697 sPRIFldbl=''
698 sPRIGldbl=''
699 sPRIeldbl=''
700 sPRIfldbl=''
701 sPRIgldbl=''
702 lseeksize=''
703 lseektype=''
704 make_set_make=''
705 d_mymalloc=''
706 freetype=''
707 mallocobj=''
708 mallocsrc=''
709 malloctype=''
710 usemymalloc=''
711 installman1dir=''
712 man1dir=''
713 man1direxp=''
714 man1ext=''
715 installman3dir=''
716 man3dir=''
717 man3direxp=''
718 man3ext=''
719 huge=''
720 large=''
721 medium=''
722 models=''
723 small=''
724 split=''
725 modetype=''
726 multiarch=''
727 mydomain=''
728 myhostname=''
729 phostname=''
730 c=''
731 n=''
732 d_eofnblk=''
733 eagain=''
734 o_nonblock=''
735 rd_nodata=''
736 netdb_hlen_type=''
737 netdb_host_type=''
738 netdb_name_type=''
739 netdb_net_type=''
740 groupcat=''
741 hostcat=''
742 passcat=''
743 orderlib=''
744 ranlib=''
745 package=''
746 spackage=''
747 pager=''
748 apiversion=''
749 patchlevel=''
750 subversion=''
751 version=''
752 perladmin=''
753 perlpath=''
754 pidtype=''
755 prefix=''
756 prefixexp=''
757 installprivlib=''
758 privlib=''
759 privlibexp=''
760 prototype=''
761 ptrsize=''
762 d_PRIX64=''
763 d_PRId64=''
764 d_PRIi64=''
765 d_PRIo64=''
766 d_PRIu64=''
767 d_PRIx64=''
768 sPRIX64=''
769 sPRId64=''
770 sPRIi64=''
771 sPRIo64=''
772 sPRIu64=''
773 sPRIx64=''
774 quadcase=''
775 quadtype=''
776 uquadtype=''
777 drand01=''
778 randbits=''
779 randfunc=''
780 randseedtype=''
781 seedfunc=''
782 installscript=''
783 scriptdir=''
784 scriptdirexp=''
785 selectminbits=''
786 selecttype=''
787 sh=''
788 sig_count=''
789 sig_name=''
790 sig_name_init=''
791 sig_num=''
792 sig_num_init=''
793 installsitearch=''
794 sitearch=''
795 sitearchexp=''
796 installsitebin=''
797 sitebin=''
798 sitebinexp=''
799 installsitelib=''
800 sitelib=''
801 sitelibexp=''
802 siteprefix=''
803 siteprefixexp=''
804 sizetype=''
805 so=''
806 sharpbang=''
807 shsharp=''
808 spitshell=''
809 src=''
810 ssizetype=''
811 startperl=''
812 startsh=''
813 stdchar=''
814 d_stdio_stream_array=''
815 stdio_stream_array=''
816 d_strtoull=''
817 sysman=''
818 trnl=''
819 uidsign=''
820 uidsize=''
821 uidtype=''
822 archname64=''
823 use64bits=''
824 uselargefiles=''
825 uselongdouble=''
826 uselonglong=''
827 usemorebits=''
828 usemultiplicity=''
829 nm_opt=''
830 nm_so_opt=''
831 runnm=''
832 usenm=''
833 useperlio=''
834 usesocks=''
835 d_oldpthreads=''
836 usethreads=''
837 incpath=''
838 mips_type=''
839 usrinc=''
840 d_vendorbin=''
841 installvendorbin=''
842 vendorbin=''
843 vendorbinexp=''
844 d_vendorlib=''
845 installvendorlib=''
846 vendorlib=''
847 vendorlibexp=''
848 usevendorprefix=''
849 vendorprefix=''
850 vendorprefixexp=''
851 defvoidused=''
852 voidflags=''
853 pm_apiversion=''
854 xs_apiversion=''
855 CONFIG=''
856
857 define='define'
858 undef='undef'
859 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
860 rmlist=''
861
862 : We must find out about Eunice early
863 eunicefix=':'
864 if test -f /etc/unixtovms; then
865         eunicefix=/etc/unixtovms
866 fi
867 if test -f /etc/unixtovms.exe; then
868         eunicefix=/etc/unixtovms.exe
869 fi
870
871 i_whoami=''
872 : Possible local include directories to search.
873 : Set locincpth to "" in a hint file to defeat local include searches.
874 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
875 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
876 :
877 : no include file wanted by default
878 inclwanted=''
879
880 : list of known cpp symbols, sorted alphabetically
881 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
882 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
883 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
884 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
885 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
886 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
887 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
888 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
889 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
890 al="$al VMS Xenix286"
891 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
892 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
893 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
894 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
895 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
896 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
897 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
898 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
899 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
900 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
901 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
902 al="$al __SVR4_2__ __UMAXV__"
903 al="$al ____386BSD____ __alpha __alpha__ __amiga"
904 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
905 al="$al __host_mips__"
906 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
907 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
908 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
909 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
910 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
911 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
912 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
913 al="$al __mc88100 __mc88100__ __mips __mips__"
914 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
915 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
916 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
917 al="$al _host_mips _mips _unix"
918 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
919 al="$al apollo ardent att386 att3b"
920 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
921 al="$al cadmus clipper concurrent convex cray ctix"
922 al="$al dmert encore gcos gcx gimpel gould"
923 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
924 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
925 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
926 al="$al i186 i286 i386 i486 i8086"
927 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
928 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
929 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
930 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
931 al="$al mc88000 mc88100 merlin mert mips mvs n16"
932 al="$al ncl_el ncl_mr"
933 al="$al news1500 news1700 news1800 news1900 news3700"
934 al="$al news700 news800 news900 ns16000 ns32000"
935 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
936 al="$al parisc pc532 pdp11 plexus posix pyr"
937 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
938 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
939 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
940 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
941 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
942 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
943 al="$al xenix z8000"
944
945 : Trailing extension.  Override this in a hint file, if needed.
946 _exe=''
947 : Extra object files, if any, needed on this platform.
948 archobjs=''
949 groupstype=''
950 : change the next line if compiling for Xenix/286 on Xenix/386
951 xlibpth='/usr/lib/386 /lib/386'
952
953 : Possible local library directories to search.
954 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
955 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
956
957 : general looking path for locating libraries
958 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
959 glibpth="$glibpth /lib /usr/lib $xlibpth"
960 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
961 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
962
963 : Private path used by Configure to find libraries.  Its value
964 : is prepended to libpth. This variable takes care of special
965 : machines, like the mips.  Usually, it should be empty.
966 plibpth=''
967
968 : default library list
969 libswanted=''
970 : some systems want to use only the non-versioned libso:s
971 ignore_versioned_solibs=''
972 : full support for void wanted by default
973 defvoidused=15
974
975 : set useposix=false in your hint file to disable the POSIX extension.
976 useposix=true
977 : set useopcode=false in your hint file to disable the Opcode extension.
978 useopcode=true
979 : set usemultiplicity on the Configure command line to enable multiplicity.
980 : set usesocks on the Configure command line to enable socks.
981 : set usethreads on the Configure command line to enable threads.
982 : List of libraries we want.
983 : If anyone needs -lnet, put it in a hint file.
984 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
985 libswanted="$libswanted dld ld sun m c cposix posix"
986 libswanted="$libswanted ndir dir crypt sec"
987 libswanted="$libswanted ucb bsd BSD PW x"
988 : We probably want to search /usr/shlib before most other libraries.
989 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
990 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
991 glibpth="/usr/shlib $glibpth"
992 : Do not use vfork unless overridden by a hint file.
993 usevfork=false
994
995 : Find the basic shell for Bourne shell scripts
996 case "$sh" in
997 '')
998         case "$SYSTYPE" in
999         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1000         *) xxx='/bin/sh';;
1001         esac
1002         if test -f "$xxx"; then
1003                 sh="$xxx"
1004         else
1005                 : Build up a list and do a single loop so we can 'break' out.
1006                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1007                 for xxx in sh bash ksh pdksh ash; do
1008                         for p in $pth; do
1009                                 try="$try ${p}/${xxx}"
1010                         done
1011                 done
1012                 for xxx in $try; do
1013                         if test -f "$xxx"; then
1014                                 sh="$xxx";
1015                                 break
1016                         elif test -f "$xxx.exe"; then
1017                                 sh="$xxx";
1018                                 break
1019                         fi
1020                 done
1021         fi
1022         ;;
1023 esac
1024
1025 case "$sh" in
1026 '')     cat <<EOM >&2
1027 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1028
1029 Usually it's in /bin/sh.  How did you even get this far?
1030 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1031 we'll try to straighten this all out.
1032 EOM
1033         exit 1
1034         ;;
1035 esac
1036
1037 : see if sh knows # comments
1038 if `$sh -c '#' >/dev/null 2>&1`; then
1039         shsharp=true
1040         spitshell=cat
1041         xcat=/bin/cat
1042         test -f $xcat || xcat=/usr/bin/cat
1043         echo "#!$xcat" >try
1044         $eunicefix try
1045         chmod +x try
1046         ./try > today
1047         if test -s today; then
1048                 sharpbang='#!'
1049         else
1050                 echo "#! $xcat" > try
1051                 $eunicefix try
1052                 chmod +x try
1053                 ./try > today
1054                 if test -s today; then
1055                         sharpbang='#! '
1056                 else
1057                         sharpbang=': use '
1058                 fi
1059         fi
1060 else
1061         echo " "
1062         echo "Your $sh doesn't grok # comments--I will strip them later on."
1063         shsharp=false
1064         cd ..
1065         echo "exec grep -v '^[  ]*#'" >spitshell
1066         chmod +x spitshell
1067         $eunicefix spitshell
1068         spitshell=`pwd`/spitshell
1069         cd UU
1070         echo "I presume that if # doesn't work, #! won't work either!"
1071         sharpbang=': use '
1072 fi
1073 rm -f try today
1074
1075 : figure out how to guarantee sh startup
1076 case "$startsh" in
1077 '') startsh=${sharpbang}${sh} ;;
1078 *)
1079 esac
1080 cat >try <<EOSS
1081 $startsh
1082 set abc
1083 test "$?abc" != 1
1084 EOSS
1085
1086 chmod +x try
1087 $eunicefix try
1088 if ./try; then
1089         : echo "Yup, it does."
1090 else
1091         echo "Hmm... '$startsh' does not guarantee sh startup..."
1092         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1093 fi
1094 rm -f try
1095
1096
1097 : Save command line options in file UU/cmdline.opt for later use in
1098 : generating config.sh.
1099 cat > cmdline.opt <<EOSH
1100 # Configure command line arguments.
1101 config_arg0='$0'
1102 config_args='$*'
1103 config_argc=$#
1104 EOSH
1105 argn=1
1106 for arg in "$@"; do
1107         cat >>cmdline.opt <<EOSH
1108 config_arg$argn='$arg'
1109 EOSH
1110         argn=`expr $argn + 1`
1111 done
1112
1113 : produce awk script to parse command line options
1114 cat >options.awk <<'EOF'
1115 BEGIN {
1116         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1117
1118         len = length(optstr);
1119         for (i = 1; i <= len; i++) {
1120                 c = substr(optstr, i, 1);
1121                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1122                 if (a == ":") {
1123                         arg[c] = 1;
1124                         i++;
1125                 }
1126                 opt[c] = 1;
1127         }
1128 }
1129 {
1130         expect = 0;
1131         str = $0;
1132         if (substr(str, 1, 1) != "-") {
1133                 printf("'%s'\n", str);
1134                 next;
1135         }
1136         len = length($0);
1137         for (i = 2; i <= len; i++) {
1138                 c = substr(str, i, 1);
1139                 if (!opt[c]) {
1140                         printf("-%s\n", substr(str, i));
1141                         next;
1142                 }
1143                 printf("-%s\n", c);
1144                 if (arg[c]) {
1145                         if (i < len)
1146                                 printf("'%s'\n", substr(str, i + 1));
1147                         else
1148                                 expect = 1;
1149                         next;
1150                 }
1151         }
1152 }
1153 END {
1154         if (expect)
1155                 print "?";
1156 }
1157 EOF
1158
1159 : process the command line options
1160 set X `for arg in "$@"; do echo "X$arg"; done |
1161         sed -e s/X// | awk -f options.awk`
1162 eval "set $*"
1163 shift
1164 rm -f options.awk
1165
1166 : set up default values
1167 fastread=''
1168 reuseval=false
1169 config_sh=''
1170 alldone=''
1171 error=''
1172 silent=''
1173 extractsh=''
1174 override=''
1175 knowitall=''
1176 rm -f optdef.sh posthint.sh
1177 cat >optdef.sh <<EOS
1178 $startsh
1179 EOS
1180
1181
1182 : option parsing
1183 while test $# -gt 0; do
1184         case "$1" in
1185         -d) shift; fastread=yes;;
1186         -e) shift; alldone=cont;;
1187         -f)
1188                 shift
1189                 cd ..
1190                 if test -r "$1"; then
1191                         config_sh="$1"
1192                 else
1193                         echo "$me: cannot read config file $1." >&2
1194                         error=true
1195                 fi
1196                 cd UU
1197                 shift;;
1198         -h) shift; error=true;;
1199         -r) shift; reuseval=true;;
1200         -s) shift; silent=true; realsilent=true;;
1201         -E) shift; alldone=exit;;
1202         -K) shift; knowitall=true;;
1203         -O) shift; override=true;;
1204         -S) shift; silent=true; extractsh=true;;
1205         -D)
1206                 shift
1207                 case "$1" in
1208                 *=)
1209                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1210                         echo "$me: ignoring -D $1" >&2
1211                         ;;
1212                 *=*) echo "$1" | \
1213                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1214                 *) echo "$1='define'" >> optdef.sh;;
1215                 esac
1216                 shift
1217                 ;;
1218         -U)
1219                 shift
1220                 case "$1" in
1221                 *=) echo "$1" >> optdef.sh;;
1222                 *=*)
1223                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1224                         echo "$me: ignoring -U $1" >&2
1225                         ;;
1226                 *) echo "$1='undef'" >> optdef.sh;;
1227                 esac
1228                 shift
1229                 ;;
1230         -A)
1231             shift
1232             xxx=''
1233             yyy="$1"
1234             zzz=''
1235             uuu=undef
1236             case "$yyy" in
1237             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1238                  case "$zzz" in
1239                  *:*) zzz='' ;;
1240                  *)   xxx=append
1241                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1242                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1243                  esac
1244                  ;;
1245             esac
1246             case "$xxx" in
1247             '')  case "$yyy" in
1248                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1249                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1250                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1251                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1252                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1253                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1254                  esac
1255                  ;;       
1256             esac
1257             case "$xxx" in
1258             append)
1259                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1260             clear)
1261                 echo "$yyy=''"                  >> posthint.sh ;;
1262             define)
1263                 case "$zzz" in
1264                 '') zzz=define ;;
1265                 esac
1266                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1267             eval)
1268                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1269             prepend)
1270                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1271             undef)
1272                 case "$zzz" in
1273                 '') zzz="$uuu" ;;
1274                 esac
1275                 echo "$yyy=$zzz"                >> posthint.sh ;;
1276             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1277             esac
1278             ;;
1279         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1280             exit 0;;
1281         --) break;;
1282         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1283         *) break;;
1284         esac
1285 done
1286
1287 case "$error" in
1288 true)
1289         cat >&2 <<EOM
1290 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1291                  [-U symbol] [-U symbol=] [-A command:symbol...]
1292   -d : use defaults for all answers.
1293   -e : go on without questioning past the production of config.sh.
1294   -f : specify an alternate default configuration file.
1295   -h : print this help message and exit (with an error status).
1296   -r : reuse C symbols value if possible (skips costly nm extraction).
1297   -s : silent mode, only echoes questions and essential information.
1298   -D : define symbol to have some value:
1299          -D symbol         symbol gets the value 'define'
1300          -D symbol=value   symbol gets the value 'value'
1301   -E : stop at the end of questions, after having produced config.sh.
1302   -K : do not use unless you know what you are doing.
1303   -O : let -D and -U override definitions from loaded configuration file.
1304   -S : perform variable substitutions on all .SH files (can mix with -f)
1305   -U : undefine symbol:
1306          -U symbol    symbol gets the value 'undef'
1307          -U symbol=   symbol gets completely empty
1308   -A : manipulate symbol after the platform specific hints have been applied:
1309          -A symbol=value                append " "value to symbol
1310          -A append:symbol=value         append value to symbol
1311          -A define:symbol=value         define symbol to have value
1312          -A clear:symbol                define symbol to be ''
1313          -A define:symbol               define symbol to be 'define'
1314          -A eval:symbol=value           define symbol to be eval of value
1315          -A prepend:symbol=value        prepend value to symbol
1316          -A undef:symbol                define symbol to be 'undef'
1317          -A undef:symbol=               define symbol to be ''
1318   -V : print version number and exit (with a zero status).
1319 EOM
1320         exit 1
1321         ;;
1322 esac
1323
1324 : Sanity checks
1325 case "$fastread$alldone" in
1326 yescont|yesexit) ;;
1327 *)
1328         if test ! -t 0; then
1329                 echo "Say 'sh Configure', not 'sh <Configure'"
1330                 exit 1
1331         fi
1332         ;;
1333 esac
1334
1335 exec 4>&1
1336 case "$silent" in
1337 true) exec 1>/dev/null;;
1338 esac
1339
1340 : run the defines and the undefines, if any, but leave the file out there...
1341 touch optdef.sh
1342 . ./optdef.sh
1343 : create the posthint manipulation script and leave the file out there...
1344 touch posthint.sh
1345
1346 : set package name
1347 package=perl5
1348 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1349 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1350 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1351 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1352 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1353 esac
1354
1355 : Some greps do not return status, grrr.
1356 echo "grimblepritz" >grimble
1357 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1358         contains=contains
1359 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1360         contains=grep
1361 else
1362         contains=contains
1363 fi
1364 rm -f grimble
1365 : the following should work in any shell
1366 case "$contains" in
1367 contains*)
1368         echo " "
1369         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1370         cat >contains <<'EOSS'
1371 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1372 EOSS
1373 chmod +x contains
1374 esac
1375
1376 : Find the path to the source tree
1377 case "$src" in
1378 '') case "$0" in
1379     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1380          case "$src" in
1381          /*)    ;;
1382          *)     src=`cd ../$src && pwd` ;;
1383          esac
1384          ;;
1385     *)   src='.';;
1386     esac;;
1387 esac
1388 case "$src" in
1389 '')     src=/
1390         rsrc=/
1391         ;;
1392 /*) rsrc="$src";;
1393 *) rsrc="../$src";;
1394 esac
1395 if test -f $rsrc/Configure && \
1396         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1397 then
1398    : found it, so we are ok.
1399 else
1400         rsrc=''
1401         for src in . .. ../.. ../../.. ../../../..; do
1402                 if test -f ../$src/Configure && \
1403                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1404                 then
1405                         rsrc=../$src
1406                         break
1407                 fi
1408         done
1409 fi
1410 case "$rsrc" in
1411 '')
1412         cat <<EOM >&4
1413
1414 Sorry, I can't seem to locate the source dir for $package.  Please start
1415 Configure with an explicit path -- i.e. /some/path/Configure.
1416
1417 EOM
1418         exit 1
1419         ;;
1420 ../.)   rsrc='..';;
1421 *)
1422         echo " "
1423         echo "Sources for $package found in \"$src\"." >&4
1424         ;;
1425 esac
1426
1427 : script used to extract .SH files with variable substitutions
1428 cat >extract <<'EOS'
1429 CONFIGDOTSH=true
1430 echo "Doing variable substitutions on .SH files..."
1431 if test -f $src/MANIFEST; then
1432         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1433 else
1434         echo "(Looking for .SH files under the source directory.)"
1435         set x `(cd $src; find . -name "*.SH" -print)`
1436 fi
1437 shift
1438 case $# in
1439 0) set x `(cd $src; echo *.SH)`; shift;;
1440 esac
1441 if test ! -f $src/$1; then
1442         shift
1443 fi
1444 mkdir_p='
1445 name=$1;
1446 create="";
1447 while test $name; do
1448         if test ! -d "$name"; then
1449                 create="$name $create";
1450                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1451                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1452         else
1453                 name="";
1454         fi;
1455 done;
1456 for file in $create; do
1457         mkdir $file;
1458 done
1459 '
1460 for file in $*; do
1461         case "$src" in
1462         ".")
1463                 case "$file" in
1464                 */*)
1465                         dir=`expr X$file : 'X\(.*\)/'`
1466                         file=`expr X$file : 'X.*/\(.*\)'`
1467                         (cd $dir && . ./$file)
1468                         ;;
1469                 *)
1470                         . ./$file
1471                         ;;
1472                 esac
1473                 ;;
1474         *)
1475                 case "$file" in
1476                 */*)
1477                         dir=`expr X$file : 'X\(.*\)/'`
1478                         file=`expr X$file : 'X.*/\(.*\)'`
1479                         (set x $dir; shift; eval $mkdir_p)
1480                         sh <$src/$dir/$file
1481                         ;;
1482                 *)
1483                         sh <$src/$file
1484                         ;;
1485                 esac
1486                 ;;
1487         esac
1488 done
1489 if test -f $src/config_h.SH; then
1490         if test ! -f config.h; then
1491         : oops, they left it out of MANIFEST, probably, so do it anyway.
1492         . $src/config_h.SH
1493         fi
1494 fi
1495 EOS
1496
1497 : extract files and exit if asked to do so
1498 case "$extractsh" in
1499 true)
1500         case "$realsilent" in
1501         true) ;;
1502         *) exec 1>&4;;
1503         esac
1504         case "$config_sh" in
1505         '') config_sh='config.sh';;
1506         esac
1507         echo " "
1508         echo "Fetching answers from $config_sh..."
1509         cd ..
1510         . $config_sh
1511         test "$override" && . ./optdef.sh
1512         echo " "
1513         . UU/extract
1514         rm -rf UU
1515         echo "Done."
1516         exit 0
1517         ;;
1518 esac
1519
1520 : Eunice requires " " instead of "", can you believe it
1521 echo " "
1522 : Here we go...
1523 echo "Beginning of configuration questions for $package."
1524
1525 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1526
1527 : first determine how to suppress newline on echo command
1528 echo " "
1529 echo "Checking echo to see how to suppress newlines..."
1530 (echo "hi there\c" ; echo " ") >.echotmp
1531 if $contains c .echotmp >/dev/null 2>&1 ; then
1532         echo "...using -n."
1533         n='-n'
1534         c=''
1535 else
1536         cat <<'EOM'
1537 ...using \c
1538 EOM
1539         n=''
1540         c='\c'
1541 fi
1542 echo $n "The star should be here-->$c"
1543 echo '*'
1544 rm -f .echotmp
1545
1546 : Now test for existence of everything in MANIFEST
1547 echo " "
1548 if test -f $rsrc/MANIFEST; then
1549         echo "First let's make sure your kit is complete.  Checking..." >&4
1550         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1551         rm -f missing
1552         tmppwd=`pwd`
1553         for filelist in x??; do
1554                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1555         done
1556         if test -s missing; then
1557                 cat missing >&4
1558                 cat >&4 <<'EOM'
1559
1560 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1561
1562 You have the option of continuing the configuration process, despite the
1563 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1564 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1565 and contact the author (perlbug@perl.com).
1566
1567 EOM
1568                 echo $n "Continue? [n] $c" >&4
1569                 read ans
1570                 case "$ans" in
1571                 y*)
1572                         echo "Continuing..." >&4
1573                         rm -f missing
1574                         ;;
1575                 *)
1576                         echo "ABORTING..." >&4
1577                         kill $$
1578                         ;;
1579                 esac
1580         else
1581                 echo "Looks good..."
1582         fi
1583 else
1584         echo "There is no MANIFEST file.  I hope your kit is complete !"
1585 fi
1586 rm -f missing x??
1587
1588 echo " "
1589 : Find the appropriate value for a newline for tr
1590 if test -n "$DJGPP"; then
1591        trnl='\012'
1592 fi
1593 if test X"$trnl" = X; then
1594         case "`echo foo|tr '\n' x 2>/dev/null`" in
1595         foox) trnl='\n' ;;
1596         esac
1597 fi
1598 if test X"$trnl" = X; then
1599         case "`echo foo|tr '\012' x 2>/dev/null`" in
1600         foox) trnl='\012' ;;
1601         esac
1602 fi
1603 if test X"$trnl" = X; then
1604         cat <<EOM >&2
1605
1606 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1607
1608 EOM
1609         exit 1
1610 fi
1611
1612 : compute the number of columns on the terminal for proper question formatting
1613 case "$COLUMNS" in
1614 '') COLUMNS='80';;
1615 esac
1616
1617 : set up the echo used in my read
1618 myecho="case \"\$xxxm\" in
1619 '') echo $n \"\$rp $c\" >&4;;
1620 *) case \"\$rp\" in
1621         '') echo $n \"[\$xxxm] $c\";;
1622         *)
1623                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1624                         echo \"\$rp\" >&4
1625                         echo $n \"[\$xxxm] $c\" >&4
1626                 else
1627                         echo $n \"\$rp [\$xxxm] $c\" >&4
1628                 fi
1629                 ;;
1630         esac;;
1631 esac"
1632
1633 : now set up to do reads with possible shell escape and default assignment
1634 cat <<EOSC >myread
1635 $startsh
1636 xxxm=\$dflt
1637 $myecho
1638 ans='!'
1639 case "\$fastread" in
1640 yes) case "\$dflt" in
1641         '') ;;
1642         *) ans='';
1643                 case "\$silent-\$rp" in
1644                 true-) ;;
1645                 *) echo " " >&4;;
1646                 esac;;
1647         esac;;
1648 *) case "\$silent" in
1649         true) case "\$rp" in
1650                 '') ans='';;
1651                 esac;;
1652         esac;;
1653 esac
1654 while expr "X\$ans" : "X!" >/dev/null; do
1655         read answ
1656         set x \$xxxm
1657         shift
1658         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1659         case  "\$answ" in
1660         "!")
1661                 sh 1>&4
1662                 echo " "
1663                 $myecho
1664                 ;;
1665         !*)
1666                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1667                 shift
1668                 sh 1>&4 -c "\$*"
1669                 echo " "
1670                 $myecho
1671                 ;;
1672         "\$ans")
1673                 case "\$ans" in
1674                 \\&*)
1675                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1676                         shift
1677                         case "\$1" in
1678                         -d)
1679                                 fastread=yes
1680                                 echo "(OK, I'll run with -d after this question.)" >&4
1681                                 ;;
1682                         -*)
1683                                 echo "*** Sorry, \$1 not supported yet." >&4
1684                                 ;;
1685                         esac
1686                         $myecho
1687                         ans=!
1688                         ;;
1689                 esac;;
1690         *)
1691                 case "\$aok" in
1692                 y)
1693                         echo "*** Substitution done -- please confirm."
1694                         xxxm="\$ans"
1695                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1696                         xxxm="\$ans"
1697                         ans=!
1698                         ;;
1699                 *)
1700                         echo "*** Error -- try again."
1701                         ans=!
1702                         ;;
1703                 esac
1704                 $myecho
1705                 ;;
1706         esac
1707         case "\$ans\$xxxm\$nostick" in
1708         '')
1709                 ans=!
1710                 $myecho
1711                 ;;
1712         esac
1713 done
1714 case "\$ans" in
1715 '') ans="\$xxxm";;
1716 esac
1717 EOSC
1718
1719 : create .config dir to save info across Configure sessions
1720 test -d ../.config || mkdir ../.config
1721 cat >../.config/README <<EOF
1722 This directory created by Configure to save information that should
1723 persist across sessions for $package.
1724
1725 You may safely delete it if you wish.
1726 EOF
1727
1728 : general instructions
1729 needman=true
1730 firsttime=true
1731 user=`(logname) 2>/dev/null`
1732 case "$user" in
1733 '') user=`whoami 2>&1`;;
1734 esac
1735 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1736         firsttime=false
1737         echo " "
1738         rp='Would you like to see the instructions?'
1739         dflt=n
1740         . ./myread
1741         case "$ans" in
1742         [yY]*) ;;
1743         *) needman=false;;
1744         esac
1745 fi
1746 if $needman; then
1747         cat <<EOH
1748
1749 This installation shell script will examine your system and ask you questions
1750 to determine how the perl5 package should be installed. If you get
1751 stuck on a question, you may use a ! shell escape to start a subshell or
1752 execute a command.  Many of the questions will have default answers in square
1753 brackets; typing carriage return will give you the default.
1754
1755 On some of the questions which ask for file or directory names you are allowed
1756 to use the ~name construct to specify the login directory belonging to "name",
1757 even if you don't have a shell which knows about that.  Questions where this is
1758 allowed will be marked "(~name ok)".
1759
1760 EOH
1761         rp=''
1762         dflt='Type carriage return to continue'
1763         . ./myread
1764         cat <<'EOH'
1765
1766 The prompter used in this script allows you to use shell variables and
1767 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1768 in the default answer, as if the default line was a set of arguments given to a
1769 script shell.  This means you may also use $* to repeat the whole default line,
1770 so you do not have to re-type everything to add something to the default.
1771
1772 Everytime there is a substitution, you will have to confirm.  If there is an
1773 error (e.g. an unmatched backtick), the default answer will remain unchanged
1774 and you will be prompted again.
1775
1776 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1777 the questions and use the computed defaults (or the previous answers if there
1778 was already a config.sh file). Type 'Configure -h' for a list of options.
1779 You may also start interactively and then answer '& -d' at any prompt to turn
1780 on the non-interactive behaviour for the remainder of the execution.
1781
1782 EOH
1783         . ./myread
1784         cat <<EOH
1785
1786 Much effort has been expended to ensure that this shell script will run on any
1787 Unix system.  If despite that it blows up on yours, your best bet is to edit
1788 Configure and run it again.  If you can't run Configure for some reason,
1789 you'll have to generate a config.sh file by hand.  Whatever problems you
1790 have, let me (perlbug@perl.com) know how I blew it.
1791
1792 This installation script affects things in two ways:
1793
1794 1) it may do direct variable substitutions on some of the files included
1795    in this kit.
1796 2) it builds a config.h file for inclusion in C programs.  You may edit
1797    any of these files as the need arises after running this script.
1798
1799 If you make a mistake on a question, there is no easy way to back up to it
1800 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1801 files.  Configure will offer to let you do this before it runs the SH files.
1802
1803 EOH
1804         dflt='Type carriage return to continue'
1805         . ./myread
1806         case "$firsttime" in
1807         true) echo $user >>../.config/instruct;;
1808         esac
1809 fi
1810
1811 : find out where common programs are
1812 echo " "
1813 echo "Locating common programs..." >&4
1814 cat <<EOSC >loc
1815 $startsh
1816 case \$# in
1817 0) exit 1;;
1818 esac
1819 thing=\$1
1820 shift
1821 dflt=\$1
1822 shift
1823 for dir in \$*; do
1824         case "\$thing" in
1825         .)
1826         if test -d \$dir/\$thing; then
1827                 echo \$dir
1828                 exit 0
1829         fi
1830         ;;
1831         *)
1832         for thisthing in \$dir/\$thing; do
1833                 : just loop through to pick last item
1834         done
1835         if test -f \$thisthing; then
1836                 echo \$thisthing
1837                 exit 0
1838         elif test -f \$dir/\$thing.exe; then
1839                 if test -n "$DJGPP"; then
1840                         echo \$dir/\$thing.exe
1841                 else
1842                         : on Eunice apparently
1843                         echo \$dir/\$thing
1844                 fi
1845                 exit 0
1846         fi
1847         ;;
1848         esac
1849 done
1850 echo \$dflt
1851 exit 1
1852 EOSC
1853 chmod +x loc
1854 $eunicefix loc
1855 loclist="
1856 awk
1857 cat
1858 comm
1859 cp
1860 echo
1861 expr
1862 grep
1863 ls
1864 make
1865 mkdir
1866 rm
1867 sed
1868 sort
1869 touch
1870 tr
1871 uniq
1872 "
1873 trylist="
1874 Mcc
1875 ar
1876 byacc
1877 cpp
1878 csh
1879 date
1880 egrep
1881 gzip
1882 less
1883 ln
1884 more
1885 nm
1886 nroff
1887 pg
1888 test
1889 uname
1890 zip
1891 "
1892 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1893 pth="$pth /lib /usr/lib"
1894 for file in $loclist; do
1895         eval xxx=\$$file
1896         case "$xxx" in
1897         /*|?:[\\/]*)
1898                 if test -f "$xxx"; then
1899                         : ok
1900                 else
1901                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1902                         xxx=`./loc $file $file $pth`
1903                 fi
1904                 ;;
1905         '') xxx=`./loc $file $file $pth`;;
1906         *) xxx=`./loc $xxx $xxx $pth`;;
1907         esac
1908         eval $file=$xxx
1909         eval _$file=$xxx
1910         case "$xxx" in
1911         /*)
1912                 echo $file is in $xxx.
1913                 ;;
1914         ?:[\\/]*)
1915                 echo $file is in $xxx.
1916                 ;;
1917         *)
1918                 echo "I don't know where '$file' is, and my life depends on it." >&4
1919                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1920                 exit 1
1921                 ;;
1922         esac
1923 done
1924 echo " "
1925 echo "Don't worry if any of the following aren't found..."
1926 say=offhand
1927 for file in $trylist; do
1928         eval xxx=\$$file
1929         case "$xxx" in
1930         /*|?:[\\/]*)
1931                 if test -f "$xxx"; then
1932                         : ok
1933                 else
1934                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1935                         xxx=`./loc $file $file $pth`
1936                 fi
1937                 ;;
1938         '') xxx=`./loc $file $file $pth`;;
1939         *) xxx=`./loc $xxx $xxx $pth`;;
1940         esac
1941         eval $file=$xxx
1942         eval _$file=$xxx
1943         case "$xxx" in
1944         /*)
1945                 echo $file is in $xxx.
1946                 ;;
1947         ?:[\\/]*)
1948                 echo $file is in $xxx.
1949                 ;;
1950         *)
1951                 echo "I don't see $file out there, $say."
1952                 say=either
1953                 ;;
1954         esac
1955 done
1956 case "$egrep" in
1957 egrep)
1958         echo "Substituting grep for egrep."
1959         egrep=$grep
1960         ;;
1961 esac
1962 case "$ln" in
1963 ln)
1964         echo "Substituting cp for ln."
1965         ln=$cp
1966         ;;
1967 esac
1968 case "$test" in
1969 test)
1970         echo "Hopefully test is built into your sh."
1971         ;;
1972 *)
1973         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1974                 echo "Using the test built into your sh."
1975                 test=test
1976                 _test=test
1977         fi
1978         ;;
1979 esac
1980 case "$echo" in
1981 echo)
1982         echo "Hopefully echo is built into your sh."
1983         ;;
1984 '') ;;
1985 *)
1986         echo " "
1987 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1988         $echo $n "hi there$c" >foo1
1989         echo $n "hi there$c" >foo2
1990         if cmp foo1 foo2 >/dev/null 2>&1; then
1991                 echo "They are compatible.  In fact, they may be identical."
1992         else
1993                 case "$n" in
1994                 '-n') n='' c='\c';;
1995                 *) n='-n' c='';;
1996                 esac
1997                 cat <<FOO
1998 They are not compatible!  You are probably running ksh on a non-USG system.
1999 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2000 have echo built in and we may have to run some Bourne shell scripts.  That
2001 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2002
2003 FOO
2004                 $echo $n "The star should be here-->$c"
2005                 $echo "*"
2006         fi
2007         $rm -f foo1 foo2
2008         ;;
2009 esac
2010
2011 : determine whether symbolic links are supported
2012 echo " "
2013 $touch blurfl
2014 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2015         echo "Symbolic links are supported." >&4
2016         lns="$ln -s"
2017 else
2018         echo "Symbolic links are NOT supported." >&4
2019         lns="$ln"
2020 fi
2021 $rm -f blurfl sym
2022
2023 : see whether [:lower:] and [:upper:] are supported character classes
2024 echo " "
2025 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2026 ABYZ)
2027         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2028         up='[:upper:]'
2029         low='[:lower:]'
2030         ;;
2031 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2032         # (0xc9 and 0xd1), therefore that is a nice testing point.
2033         if test "X$up" = X -o "X$low" = X; then
2034             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2035             ij) up='[A-Z]'
2036                 low='[a-z]'
2037                 ;;
2038             esac
2039         fi
2040         if test "X$up" = X -o "X$low" = X; then
2041             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2042             ij) up='A-Z'
2043                 low='a-z'
2044                 ;;
2045             esac
2046         fi
2047         if test "X$up" = X -o "X$low" = X; then
2048             case "`echo IJ | od -x 2>/dev/null`" in
2049             *C9D1*|*c9d1*)
2050                 echo "Hey, this might be EBCDIC." >&4
2051                 if test "X$up" = X -o "X$low" = X; then
2052                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2053                     ij) up='[A-IJ-RS-Z]'
2054                         low='[a-ij-rs-z]'
2055                         ;;
2056                     esac
2057                 fi
2058                 if test "X$up" = X -o "X$low" = X; then
2059                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2060                     ij) up='A-IJ-RS-Z'
2061                         low='a-ij-rs-z'
2062                         ;;
2063                     esac
2064                 fi
2065                 ;;
2066             esac
2067         fi
2068 esac
2069 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2070 ij)
2071     echo "Using $up and $low to convert case." >&4
2072     ;;
2073 *)
2074     echo "I don't know how to translate letters from upper to lower case." >&4
2075     echo "Your tr is not acting any way I know of." >&4
2076     exit 1
2077     ;;
2078 esac
2079 : set up the translation script tr, must be called with ./tr of course
2080 cat >tr <<EOSC
2081 $startsh
2082 case "\$1\$2" in
2083 '[A-Z][a-z]') exec $tr '$up' '$low';;
2084 '[a-z][A-Z]') exec $tr '$low' '$up';;
2085 esac
2086 exec $tr "\$@"
2087 EOSC
2088 chmod +x tr
2089 $eunicefix tr
2090
2091 : Try to determine whether config.sh was made on this system
2092 case "$config_sh" in
2093 '')
2094 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2095 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2096 # because the A-Z/a-z are not consecutive.
2097 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2098         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2099 newmyuname="$myuname"
2100 dflt=n
2101 case "$knowitall" in
2102 '')
2103         if test -f ../config.sh; then
2104                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2105                         eval "`grep myuname= ../config.sh`"
2106                 fi
2107                 if test "X$myuname" = "X$newmyuname"; then
2108                         dflt=y
2109                 fi
2110         fi
2111         ;;
2112 *) dflt=y;;
2113 esac
2114
2115 : Get old answers from old config file if Configure was run on the
2116 : same system, otherwise use the hints.
2117 hint=default
2118 cd ..
2119 if test -f config.sh; then
2120         echo " "
2121         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2122         . UU/myread
2123         case "$ans" in
2124         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2125         *)  echo "Fetching default answers from your old config.sh file..." >&4
2126                 tmp_n="$n"
2127                 tmp_c="$c"
2128                 tmp_sh="$sh"
2129                 . ./config.sh
2130                 cp config.sh UU
2131                 n="$tmp_n"
2132                 c="$tmp_c"
2133                 : Older versions did not always set $sh.  Catch re-use of such
2134                 : an old config.sh.
2135                 case "$sh" in
2136                 '') sh="$tmp_sh" ;;
2137                 esac
2138                 hint=previous
2139                 ;;
2140         esac
2141 fi
2142 if test ! -f config.sh; then
2143         $cat <<EOM
2144
2145 First time through, eh?  I have some defaults handy for some systems
2146 that need some extra help getting the Configure answers right:
2147
2148 EOM
2149         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2150         dflt=''
2151         : Half the following guesses are probably wrong... If you have better
2152         : tests or hints, please send them to perlbug@perl.com
2153         : The metaconfig authors would also appreciate a copy...
2154         $test -f /irix && osname=irix
2155         $test -f /xenix && osname=sco_xenix
2156         $test -f /dynix && osname=dynix
2157         $test -f /dnix && osname=dnix
2158         $test -f /lynx.os && osname=lynxos
2159         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2160         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2161         $test -f /bin/mips && /bin/mips && osname=mips
2162         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2163                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2164         $test -d /usr/apollo/bin && osname=apollo
2165         $test -f /etc/saf/_sactab && osname=svr4
2166         $test -d /usr/include/minix && osname=minix
2167         if $test -d /MachTen -o -d /MachTen_Folder; then
2168                 osname=machten
2169                 if $test -x /sbin/version; then
2170                         osvers=`/sbin/version | $awk '{print $2}' |
2171                         $sed -e 's/[A-Za-z]$//'`
2172                 elif $test -x /usr/etc/version; then
2173                         osvers=`/usr/etc/version | $awk '{print $2}' |
2174                         $sed -e 's/[A-Za-z]$//'`
2175                 else
2176                         osvers="$2.$3"
2177                 fi
2178         fi
2179        $test -f /sys/posix.dll &&
2180                $test -f /usr/bin/what &&
2181                set X `/usr/bin/what /sys/posix.dll` &&
2182                $test "$3" = UWIN &&
2183                osname=uwin &&
2184                osvers="$5"
2185         if $test -f $uname; then
2186                 set X $myuname
2187                 shift
2188
2189                 case "$5" in
2190                 fps*) osname=fps ;;
2191                 mips*)
2192                         case "$4" in
2193                         umips) osname=umips ;;
2194                         *) osname=mips ;;
2195                         esac;;
2196                 [23]100) osname=mips ;;
2197                 next*) osname=next ;;
2198                 i386*)
2199                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2200                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2201                                 osname='sco'
2202                                 osvers=$tmp
2203                         elif $test -f /etc/kconfig; then
2204                                 osname=isc
2205                                 if test "$lns" = "$ln -s"; then
2206                                         osvers=4
2207                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2208                                         osvers=3
2209                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2210                                         osvers=2
2211                                 fi
2212                         fi
2213                         tmp=''
2214                         ;;
2215                 pc*)
2216                         if test -n "$DJGPP"; then
2217                                 osname=dos
2218                                 osvers=djgpp
2219                         fi
2220                         ;;
2221                 esac
2222
2223                 case "$1" in
2224                 aix) osname=aix
2225                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2226                         case "$tmp" in
2227                         'not found') osvers="$4"."$3" ;;
2228                         '<3240'|'<>3240') osvers=3.2.0 ;;
2229                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2230                         '=3250'|'>3250') osvers=3.2.5 ;;
2231                         *) osvers=$tmp;;
2232                         esac
2233                         ;;
2234                 *dc.osx) osname=dcosx
2235                         osvers="$3"
2236                         ;;
2237                 dnix) osname=dnix
2238                         osvers="$3"
2239                         ;;
2240                 domainos) osname=apollo
2241                         osvers="$3"
2242                         ;;
2243                 dgux) osname=dgux 
2244                         osvers="$3"
2245                         ;;
2246                 dynixptx*) osname=dynixptx
2247                         osvers=`echo "$4"|sed 's/^v//'`
2248                         ;;
2249                 freebsd) osname=freebsd 
2250                         osvers="$3" ;;
2251                 genix) osname=genix ;;
2252                 hp*) osname=hpux 
2253                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2254                         ;;
2255                 irix*) osname=irix
2256                         case "$3" in
2257                         4*) osvers=4 ;;
2258                         5*) osvers=5 ;;
2259                         *)      osvers="$3" ;;
2260                         esac
2261                         ;;
2262                 linux) osname=linux
2263                         case "$3" in
2264                         *)      osvers="$3" ;;
2265                         esac
2266                         ;;
2267                 MiNT) osname=mint
2268                         ;;
2269                 netbsd*) osname=netbsd
2270                         osvers="$3"
2271                         ;;
2272                 news-os) osvers="$3"
2273                         case "$3" in
2274                         4*) osname=newsos4 ;;
2275                         *) osname=newsos ;;
2276                         esac
2277                         ;;
2278                 bsd386) osname=bsd386
2279                         osvers=`$uname -r`
2280                         ;;
2281                 POSIX-BC | posix-bc ) osname=posix-bc
2282                         osvers="$3"
2283                         ;;
2284                 powerux | power_ux | powermax_os | powermaxos | \
2285                 powerunix | power_unix) osname=powerux
2286                         osvers="$3"
2287                         ;;
2288                 next*) osname=next ;;
2289                 solaris) osname=solaris
2290                         case "$3" in
2291                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2292                         *)      osvers="$3" ;;
2293                         esac
2294                         ;;
2295                 sunos) osname=sunos
2296                         case "$3" in
2297                         5*) osname=solaris
2298                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2299                         *)      osvers="$3" ;;
2300                         esac
2301                         ;;
2302                 titanos) osname=titanos
2303                         case "$3" in
2304                         1*) osvers=1 ;;
2305                         2*) osvers=2 ;;
2306                         3*) osvers=3 ;;
2307                         4*) osvers=4 ;;
2308                         *)      osvers="$3" ;;
2309                         esac
2310                         ;;
2311                 ultrix) osname=ultrix
2312                         osvers="$3"
2313                         ;;
2314                 osf1|mls+)      case "$5" in
2315                                 alpha)
2316                                         osname=dec_osf
2317                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2318                                         ;;
2319                         hp*)    osname=hp_osf1  ;;
2320                         mips)   osname=mips_osf1 ;;
2321                         esac
2322                         ;;
2323                 unixware) osname=svr5
2324                         osvers="$4"
2325                         ;;
2326                 uts) osname=uts
2327                         osvers="$3"
2328                         ;;
2329                 qnx) osname=qnx
2330                         osvers="$4"
2331                         ;;
2332                 $2) case "$osname" in
2333                         *isc*) ;;
2334                         *freebsd*) ;;
2335                         svr*)
2336                                 : svr4.x or possibly later
2337                                 case "svr$3" in 
2338                                 ${osname}*)
2339                                         osname=svr$3
2340                                         osvers=$4
2341                                         ;;
2342                                 esac
2343                                 case "$osname" in
2344                                 svr4.0)
2345                                         : Check for ESIX
2346                                         if test -f /stand/boot ; then
2347                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2348                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2349                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2350                                                         if test -n "$isesix"; then
2351                                                                 osname=esix4
2352                                                         fi
2353                                                 fi
2354                                         fi
2355                                         ;;
2356                                 esac
2357                                 ;;
2358                         *)      if test -f /etc/systemid; then
2359                                         osname=sco
2360                                         set `echo $3 | $sed 's/\./ /g'` $4
2361                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2362                                                 osvers=$1.$2.$3
2363                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2364                                                 osvers=$1.$2
2365                                         elif $test -f $src/hints/sco_$1.sh; then
2366                                                 osvers=$1
2367                                         fi
2368                                 else
2369                                         case "$osname" in
2370                                         '') : Still unknown.  Probably a generic Sys V.
2371                                                 osname="sysv"
2372                                                 osvers="$3"
2373                                                 ;;
2374                                         esac
2375                                 fi
2376                                 ;;
2377                         esac
2378                         ;;
2379                 *)      case "$osname" in
2380                         '') : Still unknown.  Probably a generic BSD.
2381                                 osname="$1"
2382                                 osvers="$3"
2383                                 ;;
2384                         esac
2385                         ;;
2386                 esac
2387         else
2388                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2389                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2390                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2391                                 osname=news_os
2392                         fi
2393                         $rm -f UU/kernel.what
2394                 elif test -d c:/.; then
2395                         set X $myuname
2396                         osname=os2
2397                         osvers="$5"
2398                 fi
2399         fi
2400         
2401         : Now look for a hint file osname_osvers, unless one has been
2402         : specified already.
2403         case "$hintfile" in
2404         ''|' ')
2405                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2406                 : Also try without trailing minor version numbers.
2407                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2408                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2409                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2410                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2411                 case "$file" in
2412                 '') dflt=none ;;
2413                 *)  case "$osvers" in
2414                         '') dflt=$file
2415                                 ;;
2416                         *)  if $test -f $src/hints/$file.sh ; then
2417                                         dflt=$file
2418                                 elif $test -f $src/hints/$xfile.sh ; then
2419                                         dflt=$xfile
2420                                 elif $test -f $src/hints/$xxfile.sh ; then
2421                                         dflt=$xxfile
2422                                 elif $test -f $src/hints/$xxxfile.sh ; then
2423                                         dflt=$xxxfile
2424                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2425                                         dflt=$xxxxfile
2426                                 elif $test -f "$src/hints/${osname}.sh" ; then
2427                                         dflt="${osname}"
2428                                 else
2429                                         dflt=none
2430                                 fi
2431                                 ;;
2432                         esac
2433                         ;;
2434                 esac
2435                 if $test -f Policy.sh ; then
2436                         case "$dflt" in
2437                         *Policy*) ;;
2438                         none) dflt="Policy" ;;
2439                         *) dflt="Policy $dflt" ;;
2440                         esac
2441                 fi
2442                 ;;
2443         *)
2444                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2445                 ;;
2446         esac
2447
2448         if $test -f Policy.sh ; then
2449                 $cat <<EOM
2450
2451 There's also a Policy hint file available, which should make the
2452 site-specific (policy) questions easier to answer.
2453 EOM
2454
2455         fi
2456
2457         $cat <<EOM
2458
2459 You may give one or more space-separated answers, or "none" if appropriate.
2460 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2461 is a good thing.  DO NOT give a wrong version or a wrong OS.
2462
2463 EOM
2464
2465         rp="Which of these apply, if any?"
2466         . UU/myread
2467         tans=$ans
2468         for file in $tans; do
2469                 if $test X$file = XPolicy -a -f Policy.sh; then
2470                         . Policy.sh
2471                         $cat Policy.sh >> UU/config.sh
2472                 elif $test -f $src/hints/$file.sh; then
2473                         . $src/hints/$file.sh
2474                         $cat $src/hints/$file.sh >> UU/config.sh
2475                 elif $test X$tans = X -o X$tans = Xnone ; then
2476                         : nothing
2477                 else
2478                         : Give one chance to correct a possible typo.
2479                         echo "$file.sh does not exist"
2480                         dflt=$file
2481                         rp="hint to use instead?"
2482                         . UU/myread
2483                         for file in $ans; do
2484                                 if $test -f "$src/hints/$file.sh"; then
2485                                         . $src/hints/$file.sh
2486                                         $cat $src/hints/$file.sh >> UU/config.sh
2487                                 elif $test X$ans = X -o X$ans = Xnone ; then
2488                                         : nothing
2489                                 else
2490                                         echo "$file.sh does not exist -- ignored."
2491                                 fi
2492                         done
2493                 fi
2494         done
2495
2496         hint=recommended
2497         : Remember our hint file for later.
2498         if $test -f "$src/hints/$file.sh" ; then
2499                 hintfile="$file"
2500         else
2501                 hintfile=''
2502         fi
2503 fi
2504 cd UU
2505 ;;
2506 *)
2507         echo " "
2508         echo "Fetching default answers from $config_sh..." >&4
2509         tmp_n="$n"
2510         tmp_c="$c"
2511         cd ..
2512         cp $config_sh config.sh 2>/dev/null
2513         chmod +w config.sh
2514         . ./config.sh
2515         cd UU
2516         cp ../config.sh .
2517         n="$tmp_n"
2518         c="$tmp_c"
2519         hint=previous
2520         ;;
2521 esac
2522 test "$override" && . ./optdef.sh
2523 myuname="$newmyuname"
2524
2525 : Restore computed paths
2526 for file in $loclist $trylist; do
2527         eval $file="\$_$file"
2528 done
2529
2530 cat << EOM
2531
2532 Configure uses the operating system name and version to set some defaults.
2533 The default value is probably right if the name rings a bell. Otherwise,
2534 since spelling matters for me, either accept the default or answer "none"
2535 to leave it blank.
2536
2537 EOM
2538 case "$osname" in
2539         ''|' ')
2540                 case "$hintfile" in
2541                 ''|' '|none) dflt=none ;;
2542                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2543                 esac
2544                 ;;
2545         *) dflt="$osname" ;;
2546 esac
2547 rp="Operating system name?"
2548 . ./myread
2549 case "$ans" in
2550 none)  osname='' ;;
2551 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2552 esac
2553 echo " "
2554 case "$osvers" in
2555         ''|' ')
2556                 case "$hintfile" in
2557                 ''|' '|none) dflt=none ;;
2558                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2559                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2560                         case "$dflt" in
2561                         ''|' ') dflt=none ;;
2562                         esac
2563                         ;;
2564                 esac
2565                 ;;
2566         *) dflt="$osvers" ;;
2567 esac
2568 rp="Operating system version?"
2569 . ./myread
2570 case "$ans" in
2571 none)  osvers='' ;;
2572 *) osvers="$ans" ;;
2573 esac
2574
2575
2576 . ./posthint.sh
2577
2578 : who configured the system
2579 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2580 cf_by=`(logname) 2>/dev/null`
2581 case "$cf_by" in
2582 "")
2583         cf_by=`(whoami) 2>/dev/null`
2584         case "$cf_by" in
2585         "") cf_by=unknown ;;
2586         esac ;;
2587 esac
2588
2589 : set up the script used to warn in case of inconsistency
2590 cat <<EOS >whoa
2591 $startsh
2592 EOS
2593 cat <<'EOSC' >>whoa
2594 dflt=y
2595 echo " "
2596 echo "*** WHOA THERE!!! ***" >&4
2597 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2598 rp="    Keep the $hint value?"
2599 . ./myread
2600 case "$ans" in
2601 y) td=$was; tu=$was;;
2602 esac
2603 EOSC
2604
2605 : function used to set $1 to $val
2606 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2607 case "$val$was" in
2608 $define$undef) . ./whoa; eval "$var=\$td";;
2609 $undef$define) . ./whoa; eval "$var=\$tu";;
2610 *) eval "$var=$val";;
2611 esac'
2612
2613 cat <<EOM
2614
2615 Perl can be built to take advantage of threads, on some systems.
2616 To do so, Configure must be run with -Dusethreads.
2617
2618 Note that threading is a highly experimental feature, and
2619 some known race conditions still remain.  If you choose to try
2620 it, be very sure to not actually deploy it for production
2621 purposes.  README.threads has more details, and is required
2622 reading if you enable threads.
2623 EOM
2624 case "$usethreads" in
2625 $define|true|[yY]*)     dflt='y';;
2626 *) dflt='n';;
2627 esac
2628 rp='Build a threading Perl?'
2629 . ./myread
2630 case "$ans" in
2631 y|Y)    val="$define" ;;     
2632 *)      val="$undef" ;;
2633 esac
2634 set usethreads
2635 eval $setvar 
2636
2637 case "$d_oldpthreads" in
2638 '')     : Configure tests would be welcome here.  For now, assume undef.
2639         val="$undef" ;;
2640 *)      val="$d_oldpthreads" ;;
2641 esac
2642 set d_oldpthreads
2643 eval $setvar
2644
2645
2646 case "$usethreads" in
2647 "$define"|true|[yY]*)
2648 : Look for a hint-file generated 'call-back-unit'.  If the
2649 : user has specified that a threading perl is to be built,
2650 : we may need to set or change some other defaults.
2651         if $test -f usethreads.cbu; then
2652                 echo "Your platform has some specific hints for threaded builds, using them..."
2653                 . ./usethreads.cbu
2654         else
2655                 $cat <<EOM
2656 (Your platform doesn't have any specific hints for threaded builds.
2657  Assuming POSIX threads, then.)
2658 EOM
2659         fi
2660     ;;
2661 esac
2662
2663 cat <<EOM
2664
2665 Perl can be built so that multiple Perl interpreters can coexist
2666 within the same Perl executable.  To do so, Configure must be run with
2667 -Dusemultiplicity.
2668
2669 Normally you do not need this and you should answer no.
2670
2671 EOM
2672 case "$usemultiplicity" in
2673 $define|true|[yY]*)     dflt='y';;
2674 *) dflt='n';;
2675 esac
2676 rp='Build Perl for multiplicity?'
2677 . ./myread
2678 case "$ans" in
2679 y|Y)    val="$define" ;;     
2680 *)      val="$undef" ;;
2681 esac
2682 set usemultiplicity
2683 eval $setvar 
2684
2685 : determine where manual pages are on this system
2686 echo " "
2687 case "$sysman" in
2688 '') 
2689         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2690         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2691         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2692         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2693         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2694         sysman=`./loc . /usr/man/man1 $syspath`
2695         ;;
2696 esac
2697 if $test -d "$sysman"; then
2698         echo "System manual is in $sysman." >&4
2699 else
2700         echo "Could not find manual pages in source form." >&4
2701 fi
2702
2703 : see what memory models we can support
2704 case "$models" in
2705 '')
2706         $cat >pdp11.c <<'EOP'
2707 int main() {
2708 #ifdef pdp11
2709         exit(0);
2710 #else
2711         exit(1);
2712 #endif
2713 }
2714 EOP
2715         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2716         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2717                 dflt='unsplit split'
2718         else
2719                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2720                 case "$tans" in
2721                 X) dflt='none';;
2722                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2723                                 dflt='small'
2724                         else
2725                                 dflt=''
2726                         fi
2727                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2728                                 dflt="$dflt medium"
2729                         fi
2730                         if $test -d /lib/large || $test -d /usr/lib/large; then
2731                                 dflt="$dflt large"
2732                         fi
2733                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2734                                 dflt="$dflt huge"
2735                         fi
2736                 esac
2737         fi;;
2738 *) dflt="$models";;
2739 esac
2740 $cat <<EOM
2741  
2742 Some systems have different model sizes.  On most systems they are called
2743 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2744 split.  If your system doesn't support different memory models, say "none".
2745 If you wish to force everything to one memory model, say "none" here and
2746 put the appropriate flags later when it asks you for other cc and ld flags.
2747 Venix systems may wish to put "none" and let the compiler figure things out.
2748 (In the following question multiple model names should be space separated.)
2749
2750 The default for most systems is "none".
2751
2752 EOM
2753 rp="Which memory models are supported?"
2754 . ./myread
2755 models="$ans"
2756
2757 case "$models" in
2758 none)
2759         small=''
2760         medium=''
2761         large=''
2762         huge=''
2763         unsplit=''
2764         split=''
2765         ;;
2766 *split)
2767         case "$split" in
2768         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2769                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2770                         dflt='-i'
2771                 else
2772                         dflt='none'
2773                 fi;;
2774         *) dflt="$split";;
2775         esac
2776         rp="What flag indicates separate I and D space?"
2777         . ./myread
2778         tans="$ans"
2779         case "$tans" in
2780         none) tans='';;
2781         esac
2782         split="$tans"
2783         unsplit='';;
2784 *large*|*small*|*medium*|*huge*)
2785         case "$models" in
2786         *large*)
2787                 case "$large" in
2788                 '') dflt='-Ml';;
2789                 *) dflt="$large";;
2790                 esac
2791         rp="What flag indicates large model?"
2792         . ./myread
2793         tans="$ans"
2794         case "$tans" in
2795         none) tans='';
2796         esac
2797         large="$tans";;
2798         *) large='';;
2799         esac
2800         case "$models" in
2801         *huge*) case "$huge" in
2802                 '') dflt='-Mh';;
2803                 *) dflt="$huge";;
2804                 esac
2805                 rp="What flag indicates huge model?"
2806                 . ./myread
2807                 tans="$ans"
2808                 case "$tans" in
2809                 none) tans='';
2810                 esac
2811                 huge="$tans";;
2812         *) huge="$large";;
2813         esac
2814         case "$models" in
2815         *medium*) case "$medium" in
2816                 '') dflt='-Mm';;
2817                 *) dflt="$medium";;
2818                 esac
2819                 rp="What flag indicates medium model?"
2820                 . ./myread
2821                 tans="$ans"
2822                 case "$tans" in
2823                 none) tans='';
2824                 esac
2825                 medium="$tans";;
2826         *) medium="$large";;
2827         esac
2828         case "$models" in
2829         *small*) case "$small" in
2830                 '') dflt='none';;
2831                 *) dflt="$small";;
2832                 esac
2833                 rp="What flag indicates small model?"
2834                 . ./myread
2835                 tans="$ans"
2836                 case "$tans" in
2837                 none) tans='';
2838                 esac
2839                 small="$tans";;
2840         *) small='';;
2841         esac
2842         ;;
2843 *)
2844         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2845         ;;
2846 esac
2847 $rm -f pdp11.* pdp11
2848
2849 : make some quick guesses about what we are up against
2850 echo " "
2851 $echo $n "Hmm...  $c"
2852 echo exit 1 >bsd
2853 echo exit 1 >usg
2854 echo exit 1 >v7
2855 echo exit 1 >osf1
2856 echo exit 1 >eunice
2857 echo exit 1 >xenix
2858 echo exit 1 >venix
2859 echo exit 1 >os2
2860 d_bsd="$undef"
2861 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2862 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2863 then
2864         echo "Looks kind of like an OSF/1 system, but we'll see..."
2865         echo exit 0 >osf1
2866 elif test `echo abc | tr a-z A-Z` = Abc ; then
2867         xxx=`./loc addbib blurfl $pth`
2868         if $test -f $xxx; then
2869         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2870                 echo exit 0 >bsd
2871                 echo exit 0 >usg
2872         else
2873                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2874                         echo "Looks kind of like an extended USG system, but we'll see..."
2875                 else
2876                         echo "Looks kind of like a USG system, but we'll see..."
2877                 fi
2878                 echo exit 0 >usg
2879         fi
2880 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2881         echo "Looks kind of like a BSD system, but we'll see..."
2882         d_bsd="$define"
2883         echo exit 0 >bsd
2884 else
2885         echo "Looks kind of like a Version 7 system, but we'll see..."
2886         echo exit 0 >v7
2887 fi
2888 case "$eunicefix" in
2889 *unixtovms*)
2890         $cat <<'EOI'
2891 There is, however, a strange, musty smell in the air that reminds me of
2892 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2893 EOI
2894         echo exit 0 >eunice
2895         d_eunice="$define"
2896 : it so happens the Eunice I know will not run shell scripts in Unix format
2897         ;;
2898 *)
2899         echo " "
2900         echo "Congratulations.  You aren't running Eunice."
2901         d_eunice="$undef"
2902         ;;
2903 esac
2904 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2905 case "$p_" in
2906 :) ;;
2907 *)
2908         $cat <<'EOI'
2909 I have the feeling something is not exactly right, however...don't tell me...
2910 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2911 EOI
2912         echo exit 0 >os2
2913         ;;
2914 esac
2915 if test -f /xenix; then
2916         echo "Actually, this looks more like a XENIX system..."
2917         echo exit 0 >xenix
2918         d_xenix="$define"
2919 else
2920         echo " "
2921         echo "It's not Xenix..."
2922         d_xenix="$undef"
2923 fi
2924 chmod +x xenix
2925 $eunicefix xenix
2926 if test -f /venix; then
2927         echo "Actually, this looks more like a VENIX system..."
2928         echo exit 0 >venix
2929 else
2930         echo " "
2931         if ./xenix; then
2932                 : null
2933         else
2934                 echo "Nor is it Venix..."
2935         fi
2936 fi
2937 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2938 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2939 $rm -f foo
2940
2941 : see if we need a special compiler
2942 echo " "
2943 if ./usg; then
2944         case "$cc" in
2945         '') case "$Mcc" in
2946                 /*) dflt='Mcc';;
2947                 *) case "$large" in
2948                         -M*) dflt='cc';;
2949                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2950                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2951                                                 dflt='cc'
2952                                         else
2953                                                 dflt='cc -M'
2954                                         fi
2955                                 else
2956                                         dflt='cc'
2957                                 fi;;
2958                         esac;;
2959                 esac;;
2960         *)  dflt="$cc";;
2961         esac
2962         case "$dflt" in
2963         *M*)    $cat <<'EOM'
2964 On some older systems the default C compiler will not resolve multiple global
2965 references that happen to have the same name.  On some such systems the "Mcc"
2966 command may be used to force these to be resolved.  On other systems a "cc -M"
2967 command is required.  (Note that the -M flag on other systems indicates a
2968 memory model to use!) If you have the Gnu C compiler, you might wish to use
2969 that instead.
2970
2971 EOM
2972         ;;
2973         esac
2974         rp="Use which C compiler?"
2975         . ./myread
2976         cc="$ans"
2977 else
2978         case "$cc" in
2979         '') dflt=cc;;
2980         *) dflt="$cc";;
2981         esac
2982         rp="Use which C compiler?"
2983         . ./myread
2984         cc="$ans"
2985 fi
2986 : Look for a hint-file generated 'call-back-unit'.  Now that the
2987 : user has specified the compiler, we may need to set or change some
2988 : other defaults.
2989 if $test -f cc.cbu; then
2990     . ./cc.cbu
2991 fi
2992 echo " "
2993 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2994 $cat >gccvers.c <<EOM
2995 #include <stdio.h>
2996 int main() {
2997 #ifdef __GNUC__
2998 #ifdef __VERSION__
2999         printf("%s\n", __VERSION__);
3000 #else
3001         printf("%s\n", "1");
3002 #endif
3003 #endif
3004         exit(0);
3005 }
3006 EOM
3007 if $cc -o gccvers gccvers.c; then
3008         gccversion=`./gccvers`
3009         case "$gccversion" in
3010         '') echo "You are not using GNU cc." ;;
3011         *)  echo "You are using GNU cc $gccversion." ;;
3012         esac
3013 else
3014         echo " "
3015         echo "*** WHOA THERE!!! ***" >&4
3016         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3017         case "$knowitall" in
3018         '')
3019         echo "    You'd better start hunting for one and let me know about it." >&4
3020                 exit 1
3021                 ;;
3022         esac
3023 fi
3024 $rm -f gccvers*
3025 case "$gccversion" in
3026 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3027 esac
3028
3029
3030 case "$usemorebits" in
3031 "$define"|true|[yY]*)
3032         use64bits="$define"
3033         uselongdouble="$define"
3034         usemorebits="$define"
3035         ;;
3036 *)      usemorebits="$undef"
3037         ;;
3038 esac
3039
3040
3041 cat <<EOM
3042
3043 Perl can be built to understand large files (files larger than 2 gigabytes)
3044 on some systems.  To do so, Configure must be run with -Duselargefiles.
3045
3046 If this doesn't make any sense to you, just accept the default.
3047 EOM
3048 case "$uselargefiles" in
3049 "$define"|true|[yY]*) dflt='y' ;;
3050 *)      dflt='n' ;;
3051 esac
3052 rp='Try to understand large files?'
3053 . ./myread
3054 case "$ans" in
3055 y|Y)    val="$define" ;;
3056 *)      val="$undef"  ;;
3057 esac
3058 set uselargefiles
3059 eval $setvar
3060 case "$uselargefiles" in
3061 "$define") use64bits="$define" ;;
3062 esac
3063
3064 cat <<EOM
3065
3066 Perl can be built to take advantage of explicit 64-bit interfaces,
3067 on some systems.  To do so, Configure must be run with -Duse64bits.
3068
3069 If this doesn't make any sense to you, just accept the default.
3070 EOM
3071 case "$use64bits" in
3072 $define|true|[yY]*)     dflt='y';;
3073 *) dflt='n';;
3074 esac
3075 rp='Try to use explicit 64-bit interfaces, if available?'
3076 . ./myread
3077 case "$ans" in
3078 y|Y) 
3079         val="$define"
3080         ;;     
3081 *)      
3082         val="$undef"
3083         ;;
3084 esac
3085 set use64bits
3086 eval $setvar
3087
3088 case "$archname64" in
3089 '') archname64='' ;;    # not a typo
3090 esac
3091
3092 case "$use64bits" in
3093 "$define"|true|[yY]*)
3094 : Look for a hint-file generated 'call-back-unit'.  If the
3095 : user has specified that a 64 bit perl is to be built,
3096 : we may need to set or change some other defaults.
3097         if $test -f use64bits.cbu; then
3098                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3099                 . ./use64bits.cbu
3100         else
3101                 $cat <<EOM
3102 (Your platform doesn't have any specific hints for 64-bit builds.
3103  This is probably okay, especially if your system is a true 64-bit system.)
3104 EOM
3105                 case "$gccversion" in
3106                 '')     ;;
3107                 *)      $cat <<EOM
3108 But since you seem to be using gcc,
3109 I will now add -DUSE_LONG_LONG to the compilation flags.
3110 EOM
3111                         ccflags="$ccflags -DUSE_LONG_LONG"
3112                         ;;
3113                 esac
3114         fi
3115         ;;
3116 esac
3117
3118 : determine the architecture name
3119 echo " "
3120 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3121         tarch=`arch`"-$osname"
3122 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3123         if uname -m > tmparch 2>&1 ; then
3124                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3125                         -e 's/$/'"-$osname/" tmparch`
3126         else
3127                 tarch="$osname"
3128         fi
3129         $rm -f tmparch
3130 else
3131         tarch="$osname"
3132 fi
3133 case "$myarchname" in
3134 ''|"$tarch") ;;
3135 *)
3136         echo "(Your architecture name used to be $myarchname.)"
3137         archname=''
3138         ;;
3139 esac
3140 myarchname="$tarch"
3141 case "$archname" in
3142 '') dflt="$tarch";;
3143 *) dflt="$archname";;
3144 esac
3145 rp='What is your architecture name'
3146 . ./myread
3147 archname="$ans"
3148 case "$usethreads" in
3149 $define)
3150         echo "Threads selected." >&4
3151         case "$archname" in
3152         *-thread*) echo "...and architecture name already has -thread." >&4
3153                 ;;
3154         *)      archname="$archname-thread"
3155                 echo "...setting architecture name to $archname." >&4
3156                 ;;
3157         esac
3158         ;;
3159 esac
3160 case "$usemultiplicity" in
3161 $define)
3162         echo "Multiplicity selected." >&4
3163         case "$archname" in
3164         *-multi*) echo "...and architecture name already has -multi." >&4
3165                 ;;
3166         *)      archname="$archname-multi"
3167                 echo "...setting architecture name to $archname." >&4
3168                 ;;
3169         esac
3170         ;;
3171 esac
3172 case "$use64bits" in
3173 $define)
3174         echo "Explicit 64-bitness selected." >&4
3175         case "$archname64" in
3176         '')
3177                 ;;
3178         *)
3179                 case "$archname" in
3180                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3181                         ;;
3182                 *)      archname="$archname-$archname64"
3183                         echo "...setting architecture name to $archname." >&4
3184                         ;;
3185                 esac
3186                 ;;
3187         esac
3188 esac
3189
3190 : decide how portable to be.  Allow command line overrides.
3191 case "$d_portable" in
3192 "$undef") ;;
3193 *)      d_portable="$define" ;;
3194 esac
3195
3196 : set up shell script to do ~ expansion
3197 cat >filexp <<EOSS
3198 $startsh
3199 : expand filename
3200 case "\$1" in
3201  ~/*|~)
3202         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3203         ;;
3204  ~*)
3205         if $test -f /bin/csh; then
3206                 /bin/csh -f -c "glob \$1"
3207                 failed=\$?
3208                 echo ""
3209                 exit \$failed
3210         else
3211                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3212                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3213                 if $test ! -d "\$dir"; then
3214                         me=\`basename \$0\`
3215                         echo "\$me: can't locate home directory for: \$name" >&2
3216                         exit 1
3217                 fi
3218                 case "\$1" in
3219                 */*)
3220                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3221                         ;;
3222                 *)
3223                         echo \$dir
3224                         ;;
3225                 esac
3226         fi
3227         ;;
3228 *)
3229         echo \$1
3230         ;;
3231 esac
3232 EOSS
3233 chmod +x filexp
3234 $eunicefix filexp
3235
3236 : now set up to get a file name
3237 cat <<EOS >getfile
3238 $startsh
3239 EOS
3240 cat <<'EOSC' >>getfile
3241 tilde=''
3242 fullpath=''
3243 already=''
3244 skip=''
3245 none_ok=''
3246 exp_file=''
3247 nopath_ok=''
3248 orig_rp="$rp"
3249 orig_dflt="$dflt"
3250 case "$gfpth" in
3251 '') gfpth='.' ;;
3252 esac
3253
3254 case "$fn" in
3255 *\(*)
3256         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3257         fn=`echo $fn | sed 's/(.*)//'`
3258         ;;
3259 esac
3260
3261 case "$fn" in
3262 *:*)
3263         loc_file=`expr $fn : '.*:\(.*\)'`
3264         fn=`expr $fn : '\(.*\):.*'`
3265         ;;
3266 esac
3267
3268 case "$fn" in
3269 *~*) tilde=true;;
3270 esac
3271 case "$fn" in
3272 */*) fullpath=true;;
3273 esac
3274 case "$fn" in
3275 *+*) skip=true;;
3276 esac
3277 case "$fn" in
3278 *n*) none_ok=true;;
3279 esac
3280 case "$fn" in
3281 *e*) exp_file=true;;
3282 esac
3283 case "$fn" in
3284 *p*) nopath_ok=true;;
3285 esac
3286
3287 case "$fn" in
3288 *f*) type='File';;
3289 *d*) type='Directory';;
3290 *l*) type='Locate';;
3291 esac
3292
3293 what="$type"
3294 case "$what" in
3295 Locate) what='File';;
3296 esac
3297
3298 case "$exp_file" in
3299 '')
3300         case "$d_portable" in
3301         "$define") ;;
3302         *) exp_file=true;;
3303         esac
3304         ;;
3305 esac
3306
3307 cd ..
3308 while test "$type"; do
3309         redo=''
3310         rp="$orig_rp"
3311         dflt="$orig_dflt"
3312         case "$tilde" in
3313         true) rp="$rp (~name ok)";;
3314         esac
3315         . UU/myread
3316         if test -f UU/getfile.ok && \
3317                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3318         then
3319                 value="$ans"
3320                 ansexp="$ans"
3321                 break
3322         fi
3323         case "$ans" in
3324         none)
3325                 value=''
3326                 ansexp=''
3327                 case "$none_ok" in
3328                 true) type='';;
3329                 esac
3330                 ;;
3331         *)
3332                 case "$tilde" in
3333                 '') value="$ans"
3334                         ansexp="$ans";;
3335                 *)
3336                         value=`UU/filexp $ans`
3337                         case $? in
3338                         0)
3339                                 if test "$ans" != "$value"; then
3340                                         echo "(That expands to $value on this system.)"
3341                                 fi
3342                                 ;;
3343                         *) value="$ans";;
3344                         esac
3345                         ansexp="$value"
3346                         case "$exp_file" in
3347                         '') value="$ans";;
3348                         esac
3349                         ;;
3350                 esac
3351                 case "$fullpath" in
3352                 true)
3353                         case "$ansexp" in
3354                         /*) value="$ansexp" ;;
3355                         *)
3356                                 redo=true
3357                                 case "$already" in
3358                                 true)
3359                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3360                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3361                                         ;;
3362                                 *)
3363                                 echo "Please give a full path name, starting with slash." >&4
3364                                         case "$tilde" in
3365                                         true)
3366                                 echo "Note that using ~name is ok provided it expands well." >&4
3367                                                 already=true
3368                                                 ;;
3369                                         esac
3370                                 esac
3371                                 ;;
3372                         esac
3373                         ;;
3374                 esac
3375                 case "$redo" in
3376                 '')
3377                         case "$type" in
3378                         File)
3379                                 for fp in $gfpth; do
3380                                         if test "X$fp" = X.; then
3381                                             pf="$ansexp"
3382                                         else    
3383                                             pf="$fp/$ansexp"
3384                                         fi
3385                                         if test -f "$pf"; then
3386                                                 type=''
3387                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3388                                         then
3389                                                 echo "($value is not a plain file, but that's ok.)"
3390                                                 type=''
3391                                         fi
3392                                         if test X"$type" = X; then
3393                                             value="$pf"
3394                                             break
3395                                         fi
3396                                 done
3397                                 ;;
3398                         Directory)
3399                                 for fp in $gfpth; do
3400                                         if test "X$fp" = X.; then
3401                                             pf="$ansexp"
3402                                         else    
3403                                             pf="$fp/$ansexp"
3404                                         fi
3405                                         if test -d "$pf"; then
3406                                                 type=''
3407                                                 value="$pf"
3408                                                 break
3409                                         fi
3410                                 done
3411                                 ;;
3412                         Locate)
3413                                 if test -d "$ansexp"; then
3414                                         echo "(Looking for $loc_file in directory $value.)"
3415                                         value="$value/$loc_file"
3416                                         ansexp="$ansexp/$loc_file"
3417                                 fi
3418                                 if test -f "$ansexp"; then
3419                                         type=''
3420                                 fi
3421                                 case "$nopath_ok" in
3422                                 true)   case "$value" in
3423                                         */*) ;;
3424                                         *)      echo "Assuming $value will be in people's path."
3425                                                 type=''
3426                                                 ;;
3427                                         esac
3428                                         ;;
3429                                 esac
3430                                 ;;
3431                         esac
3432
3433                         case "$skip" in
3434                         true) type='';
3435                         esac
3436
3437                         case "$type" in
3438                         '') ;;
3439                         *)
3440                                 if test "$fastread" = yes; then
3441                                         dflt=y
3442                                 else
3443                                         dflt=n
3444                                 fi
3445                                 rp="$what $value doesn't exist.  Use that name anyway?"
3446                                 . UU/myread
3447                                 dflt=''
3448                                 case "$ans" in
3449                                 y*) type='';;
3450                                 *) echo " ";;
3451                                 esac
3452                                 ;;
3453                         esac
3454                         ;;
3455                 esac
3456                 ;;
3457         esac
3458 done
3459 cd UU
3460 ans="$value"
3461 rp="$orig_rp"
3462 dflt="$orig_dflt"
3463 rm -f getfile.ok
3464 test "X$gfpthkeep" != Xy && gfpth=""
3465 EOSC
3466
3467 : determine root of directory hierarchy where package will be installed.
3468 case "$prefix" in
3469 '')
3470         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3471         ;;
3472 *)
3473         dflt="$prefix"
3474         ;;
3475 esac
3476 $cat <<EOM
3477
3478 By default, $package will be installed in $dflt/bin, manual pages
3479 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3480 installation directories. Typically this is something like /usr/local.
3481 If you wish to have binaries under /usr/bin but other parts of the
3482 installation under /usr/local, that's ok: you will be prompted
3483 separately for each of the installation directories, the prefix being
3484 only used to set the defaults.
3485
3486 EOM
3487 fn=d~
3488 rp='Installation prefix to use?'
3489 . ./getfile
3490 oldprefix=''
3491 case "$prefix" in
3492 '') ;;
3493 *)
3494         case "$ans" in
3495         "$prefix") ;;
3496         *) oldprefix="$prefix";;
3497         esac
3498         ;;
3499 esac
3500 prefix="$ans"
3501 prefixexp="$ansexp"
3502
3503 : is AFS running?
3504 echo " "
3505 case "$afs" in
3506 $define|true)   afs=true ;;
3507 $undef|false)   afs=false ;;
3508 *)      if test -d /afs; then
3509                 afs=true
3510         else
3511                 afs=false
3512         fi
3513         ;;
3514 esac
3515 if $afs; then
3516         echo "AFS may be running... I'll be extra cautious then..." >&4
3517 else
3518         echo "AFS does not seem to be running..." >&4
3519 fi
3520
3521 : determine installation prefix for where package is to be installed.
3522 if $afs; then 
3523 $cat <<EOM
3524
3525 Since you are running AFS, I need to distinguish the directory in which
3526 files will reside from the directory in which they are installed (and from
3527 which they are presumably copied to the former directory by occult means).
3528
3529 EOM
3530         case "$installprefix" in
3531         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3532         *) dflt="$installprefix";;
3533         esac
3534 else
3535 $cat <<EOM
3536
3537 In some special cases, particularly when building $package for distribution,
3538 it is convenient to distinguish between the directory in which files should 
3539 be installed from the directory ($prefix) in which they 
3540 will eventually reside.  For most users, these two directories are the same.
3541
3542 EOM
3543         case "$installprefix" in
3544         '') dflt=$prefix ;;
3545         *) dflt=$installprefix;;
3546         esac
3547 fi
3548 fn=d~
3549 rp='What installation prefix should I use for installing files?'
3550 . ./getfile
3551 installprefix="$ans"
3552 installprefixexp="$ansexp"
3553
3554 : set the prefixit variable, to compute a suitable default value
3555 prefixit='case "$3" in
3556 ""|none)
3557         case "$oldprefix" in
3558         "") eval "$1=\"\$$2\"";;
3559         *)
3560                 case "$3" in
3561                 "") eval "$1=";;
3562                 none)
3563                         eval "tp=\"\$$2\"";
3564                         case "$tp" in
3565                         ""|" ") eval "$1=\"\$$2\"";;
3566                         *) eval "$1=";;
3567                         esac;;
3568                 esac;;
3569         esac;;
3570 *)
3571         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3572         case "$tp" in
3573         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3574         /*-$oldprefix/*|\~*-$oldprefix/*)
3575                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3576         *) eval "$1=\"\$$2\"";;
3577         esac;;
3578 esac'
3579
3580 : set the base revision
3581 baserev=5.0
3582
3583 : get the patchlevel
3584 echo " "
3585 echo "Getting the current patchlevel..." >&4
3586 if $test -r $rsrc/patchlevel.h;then
3587         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3588         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3589         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3590 else
3591         patchlevel=0
3592         subversion=0
3593         apiversion=0
3594 fi
3595 $echo $n "(You have $package" $c
3596 case "$package" in
3597 "*$baserev")    ;;
3598 *)              $echo $n " $baserev" $c ;;
3599 esac
3600 $echo $n " patchlevel $patchlevel" $c
3601 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3602 echo ".)"
3603
3604 if test 0 -eq "$subversion"; then
3605         version=`LC_ALL=C; export LC_ALL; \
3606                  echo $baserev $patchlevel | \
3607                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3608 else
3609         version=`LC_ALL=C; export LC_ALL; \
3610                  echo $baserev $patchlevel $subversion | \
3611                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3612 fi
3613
3614 : determine installation style
3615 : For now, try to deduce it from prefix unless it is already set.
3616 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3617 case "$installstyle" in
3618 '')     case "$prefix" in
3619                 *perl*) dflt='lib';;
3620                 *) dflt='lib/perl5' ;;
3621         esac
3622         ;;
3623 *)      dflt='lib/perl5' ;;
3624 esac
3625 : Probably not worth prompting for this since we prompt for all
3626 : the directories individually, and the prompt would be too long and
3627 : confusing anyway.
3628 installstyle=$dflt
3629
3630 : determine where private library files go
3631 : Usual default is /usr/local/lib/perl5/$version.
3632 : Also allow things like /opt/perl/lib/$version, since 
3633 : /opt/perl/lib/perl5... would be redundant.
3634 : The default "style" setting is made in installstyle.U
3635 case "$installstyle" in
3636 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3637 *)       set dflt privlib lib/$version ;;
3638 esac
3639 eval $prefixit
3640 $cat <<EOM
3641
3642 There are some auxiliary files for $package that need to be put into a
3643 private library directory that is accessible by everyone.
3644
3645 EOM
3646 fn=d~+
3647 rp='Pathname where the private library files will reside?'
3648 . ./getfile
3649 privlib="$ans"
3650 privlibexp="$ansexp"
3651 : Change installation prefix, if necessary.
3652 if $test X"$prefix" != X"$installprefix"; then
3653         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3654 else
3655         installprivlib="$privlibexp"
3656 fi
3657
3658 : set the prefixup variable, to restore leading tilda escape
3659 prefixup='case "$prefixexp" in
3660 "$prefix") ;;
3661 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3662 esac'
3663
3664 : determine where public architecture dependent libraries go
3665 set archlib archlib
3666 eval $prefixit
3667 : privlib default is /usr/local/lib/$package/$version
3668 : archlib default is /usr/local/lib/$package/$version/$archname
3669 : privlib may have an optional trailing /share.
3670 tdflt=`echo $privlib | $sed 's,/share$,,'`
3671 tdflt=$tdflt/$archname
3672 case "$archlib" in
3673 '')     dflt=$tdflt
3674         ;;
3675 *)      dflt="$archlib"
3676     ;;
3677 esac
3678 $cat <<EOM
3679
3680 $spackage contains architecture-dependent library files.  If you are
3681 sharing libraries in a heterogeneous environment, you might store
3682 these files in a separate location.  Otherwise, you can just include
3683 them with the rest of the public library files.
3684
3685 EOM
3686 fn=d+~
3687 rp='Where do you want to put the public architecture-dependent libraries?'
3688 . ./getfile
3689 archlib="$ans"
3690 archlibexp="$ansexp"
3691 if $test X"$archlib" = X"$privlib"; then
3692         d_archlib="$undef"
3693 else
3694         d_archlib="$define"
3695 fi
3696 : Change installation prefix, if necessary.
3697 if $test X"$prefix" != X"$installprefix"; then
3698         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3699 else
3700         installarchlib="$archlibexp"
3701 fi
3702
3703
3704 : Binary compatibility with 5.005 is not possible for builds
3705 : with advanced features
3706 case "$usethreads$usemultiplicity" in
3707 *define*)
3708         bincompat5005="$undef"
3709         d_bincompat5005="$undef"
3710         ;;
3711 *)      $cat <<EOM
3712
3713 Perl 5.006 can be compiled for binary compatibility with 5.005.
3714 If you decide to do so, you will be able to continue using most
3715 of the extensions that were compiled for Perl 5.005.
3716
3717 EOM
3718         case "$bincompat5005$d_bincompat5005" in
3719         *"$undef"*) dflt=n ;;
3720         *) dflt=y ;;
3721         esac
3722         rp='Binary compatibility with Perl 5.005?'
3723         . ./myread
3724         case "$ans" in
3725         y*) val="$define" ;;
3726         *)  val="$undef" ;;
3727         esac
3728         set d_bincompat5005
3729         eval $setvar
3730         case "$d_bincompat5005" in
3731         "$define")
3732                 bincompat5005="$define"
3733                 ;;
3734         *)      bincompat5005="$undef"
3735                 d_bincompat5005="$undef"
3736                 ;;
3737         esac
3738         ;;
3739 esac
3740
3741
3742 : see if setuid scripts can be secure
3743 $cat <<EOM
3744
3745 Some kernels have a bug that prevents setuid #! scripts from being
3746 secure.  Some sites have disabled setuid #! scripts because of this.
3747
3748 First let's decide if your kernel supports secure setuid #! scripts.
3749 (If setuid #! scripts would be secure but have been disabled anyway,
3750 don't say that they are secure if asked.)
3751
3752 EOM
3753
3754 val="$undef"
3755 if $test -d /dev/fd; then
3756         echo "#!$ls" >reflect
3757         chmod +x,u+s reflect
3758         ./reflect >flect 2>&1
3759         if $contains "/dev/fd" flect >/dev/null; then
3760                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3761                 val="$define"
3762         else
3763                 $cat <<EOM
3764 If you are not sure if they are secure, I can check but I'll need a
3765 username and password different from the one you are using right now.
3766 If you don't have such a username or don't want me to test, simply
3767 enter 'none'.
3768
3769 EOM
3770                 rp='Other username to test security of setuid scripts with?'
3771                 dflt='none'
3772                 . ./myread
3773                 case "$ans" in
3774                 n|none)
3775                         case "$d_suidsafe" in
3776                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3777                                 dflt=n;;
3778                         "$undef")
3779                                 echo "Well, the $hint value is *not* secure." >&4
3780                                 dflt=n;;
3781                         *)      echo "Well, the $hint value *is* secure." >&4
3782                                 dflt=y;;
3783                         esac
3784                         ;;
3785                 *)
3786                         $rm -f reflect flect
3787                         echo "#!$ls" >reflect
3788                         chmod +x,u+s reflect
3789                         echo >flect
3790                         chmod a+w flect
3791                         echo '"su" will (probably) prompt you for '"$ans's password."
3792                         su $ans -c './reflect >flect'
3793                         if $contains "/dev/fd" flect >/dev/null; then
3794                                 echo "Okay, it looks like setuid scripts are secure." >&4
3795                                 dflt=y
3796                         else
3797                                 echo "I don't think setuid scripts are secure." >&4
3798                                 dflt=n
3799                         fi
3800                         ;;
3801                 esac
3802                 rp='Does your kernel have *secure* setuid scripts?'
3803                 . ./myread
3804                 case "$ans" in
3805                 [yY]*)  val="$define";;
3806                 *)      val="$undef";;
3807                 esac
3808         fi
3809 else
3810         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3811         echo "(That's for file descriptors, not floppy disks.)"
3812         val="$undef"
3813 fi
3814 set d_suidsafe
3815 eval $setvar
3816
3817 $rm -f reflect flect
3818
3819 : now see if they want to do setuid emulation
3820 echo " "
3821 val="$undef"
3822 case "$d_suidsafe" in
3823 "$define")
3824         val="$undef"
3825         echo "No need to emulate SUID scripts since they are secure here." >& 4
3826         ;;
3827 *)
3828         $cat <<EOM
3829 Some systems have disabled setuid scripts, especially systems where
3830 setuid scripts cannot be secure.  On systems where setuid scripts have
3831 been disabled, the setuid/setgid bits on scripts are currently
3832 useless.  It is possible for $package to detect those bits and emulate
3833 setuid/setgid in a secure fashion.  This emulation will only work if
3834 setuid scripts have been disabled in your kernel.
3835
3836 EOM
3837         case "$d_dosuid" in
3838         "$define") dflt=y ;;
3839         *) dflt=n ;;
3840         esac
3841         rp="Do you want to do setuid/setgid emulation?"
3842         . ./myread
3843         case "$ans" in
3844         [yY]*)  val="$define";;
3845         *)      val="$undef";;
3846         esac
3847         ;;
3848 esac
3849 set d_dosuid
3850 eval $setvar
3851
3852 : What should the include directory be ?
3853 echo " "
3854 $echo $n "Hmm...  $c"
3855 dflt='/usr/include'
3856 incpath=''
3857 mips_type=''
3858 if $test -f /bin/mips && /bin/mips; then
3859         echo "Looks like a MIPS system..."
3860         $cat >usr.c <<'EOCP'
3861 #ifdef SYSTYPE_BSD43
3862 /bsd43
3863 #endif
3864 EOCP
3865         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3866                 dflt='/bsd43/usr/include'
3867                 incpath='/bsd43'
3868                 mips_type='BSD 4.3'
3869         else
3870                 mips_type='System V'
3871         fi
3872         $rm -f usr.c usr.out
3873         echo "and you're compiling with the $mips_type compiler and libraries."
3874         xxx_prompt=y
3875         echo "exit 0" >mips
3876 else
3877         echo "Doesn't look like a MIPS system."
3878         xxx_prompt=n
3879         echo "exit 1" >mips
3880 fi
3881 chmod +x mips
3882 $eunicefix mips
3883 case "$usrinc" in
3884 '') ;;
3885 *) dflt="$usrinc";;
3886 esac
3887 case "$xxx_prompt" in
3888 y)      fn=d/
3889         echo " "
3890         rp='Where are the include files you want to use?'
3891         . ./getfile
3892         usrinc="$ans"
3893         ;;
3894 *)      usrinc="$dflt"
3895         ;;
3896 esac
3897
3898 : see how we invoke the C preprocessor
3899 echo " "
3900 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3901 cat <<'EOT' >testcpp.c
3902 #define ABC abc
3903 #define XYZ xyz
3904 ABC.XYZ
3905 EOT
3906 cd ..
3907 if test ! -f cppstdin; then
3908         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3909                 # AIX cc -E doesn't show the absolute headerfile
3910                 # locations but we'll cheat by using the -M flag.
3911                 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
3912         else
3913                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3914         fi
3915 else
3916         echo "Keeping your $hint cppstdin wrapper."
3917 fi
3918 chmod 755 cppstdin
3919 wrapper=`pwd`/cppstdin
3920 ok='false'
3921 cd UU
3922
3923 if $test "X$cppstdin" != "X" && \
3924         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3925         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3926 then
3927         echo "You used to use $cppstdin $cppminus so we'll use that again."
3928         case "$cpprun" in
3929         '') echo "But let's see if we can live without a wrapper..." ;;
3930         *)
3931                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3932                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3933                 then
3934                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3935                         ok='true'
3936                 else
3937                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3938                 fi
3939                 ;;
3940         esac
3941 else
3942         case "$cppstdin" in
3943         '') ;;
3944         *)
3945                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3946                 ;;
3947         esac
3948 fi
3949
3950 if $ok; then
3951         : nothing
3952 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3953         $cc -E <testcpp.c >testcpp.out 2>&1; \
3954         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3955         echo "Yup, it does."
3956         x_cpp="$cc -E"
3957         x_minus='';
3958 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3959         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3960         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3961         echo "Yup, it does."
3962         x_cpp="$cc -E"
3963         x_minus='-';
3964 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3965         $cc -P <testcpp.c >testcpp.out 2>&1; \
3966         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3967         echo "Yipee, that works!"
3968         x_cpp="$cc -P"
3969         x_minus='';
3970 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3971         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3972         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3973         echo "At long last!"
3974         x_cpp="$cc -P"
3975         x_minus='-';
3976 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3977         $cpp <testcpp.c >testcpp.out 2>&1; \
3978         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3979         echo "It works!"
3980         x_cpp="$cpp"
3981         x_minus='';
3982 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3983         $cpp - <testcpp.c >testcpp.out 2>&1; \
3984         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3985         echo "Hooray, it works!  I was beginning to wonder."
3986         x_cpp="$cpp"
3987         x_minus='-';
3988 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3989         $wrapper <testcpp.c >testcpp.out 2>&1; \
3990         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3991         x_cpp="$wrapper"
3992         x_minus=''
3993         echo "Eureka!"
3994 else
3995         dflt=''
3996         rp="No dice.  I can't find a C preprocessor.  Name one:"
3997         . ./myread
3998         x_cpp="$ans"
3999         x_minus=''
4000         $x_cpp <testcpp.c >testcpp.out 2>&1
4001         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4002                 echo "OK, that will do." >&4
4003         else
4004 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4005                 exit 1
4006         fi
4007 fi
4008
4009 case "$ok" in
4010 false)
4011         cppstdin="$x_cpp"
4012         cppminus="$x_minus"
4013         cpprun="$x_cpp"
4014         cpplast="$x_minus"
4015         set X $x_cpp
4016         shift
4017         case "$1" in
4018         "$cpp")
4019                 echo "Perhaps can we force $cc -E using a wrapper..."
4020                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4021                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4022                 then
4023                         echo "Yup, we can."
4024                         cppstdin="$wrapper"
4025                         cppminus='';
4026                 else
4027                         echo "Nope, we'll have to live without it..."
4028                 fi
4029                 ;;
4030         esac
4031         case "$cpprun" in
4032         "$wrapper")
4033                 cpprun=''
4034                 cpplast=''
4035                 ;;
4036         esac
4037         ;;
4038 esac
4039
4040 case "$cppstdin" in
4041 "$wrapper"|'cppstdin') ;;
4042 *) $rm -f $wrapper;;
4043 esac
4044 $rm -f testcpp.c testcpp.out
4045
4046 : Set private lib path
4047 case "$plibpth" in
4048 '') if ./mips; then
4049                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4050         fi;;
4051 esac
4052 case "$libpth" in
4053 ' ') dlist='';;
4054 '') dlist="$loclibpth $plibpth $glibpth";;
4055 *) dlist="$libpth";;
4056 esac
4057
4058 : Now check and see which directories actually exist, avoiding duplicates
4059 libpth=''
4060 for xxx in $dlist
4061 do
4062     if $test -d $xxx; then
4063                 case " $libpth " in
4064                 *" $xxx "*) ;;
4065                 *) libpth="$libpth $xxx";;
4066                 esac
4067     fi
4068 done
4069 $cat <<'EOM'
4070
4071 Some systems have incompatible or broken versions of libraries.  Among
4072 the directories listed in the question below, please remove any you
4073 know not to be holding relevant libraries, and add any that are needed.
4074 Say "none" for none.
4075
4076 EOM
4077 case "$libpth" in
4078 '') dflt='none';;
4079 *)
4080         set X $libpth
4081         shift
4082         dflt=${1+"$@"}
4083         ;;
4084 esac
4085 rp="Directories to use for library searches?"
4086 . ./myread
4087 case "$ans" in
4088 none) libpth=' ';;
4089 *) libpth="$ans";;
4090 esac
4091
4092 : compute shared library extension
4093 case "$so" in
4094 '')
4095         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4096                 dflt='sl'
4097         else
4098                 dflt='so'
4099         fi
4100         ;;
4101 *) dflt="$so";;
4102 esac
4103 $cat <<EOM
4104
4105 On some systems, shared libraries may be available.  Answer 'none' if
4106 you want to suppress searching of shared libraries for the remaining
4107 of this configuration.
4108
4109 EOM
4110 rp='What is the file extension used for shared libraries?'
4111 . ./myread
4112 so="$ans"
4113
4114 : Define several unixisms.
4115 : Hints files or command line option can be used to override them.
4116 : The convoluted testing is in case hints files set either the old
4117 : or the new name.
4118 case "$_exe" in
4119 '')     case "$exe_ext" in
4120     '') ;;
4121         *)      _exe="$exe_ext" ;;
4122         esac
4123         ;;
4124 esac
4125 case "$_a" in
4126 '')     case "$lib_ext" in
4127     '') _a='.a';;
4128         *)      _a="$lib_ext" ;;
4129         esac
4130         ;;
4131 esac
4132 case "$_o" in
4133 '') case "$obj_ext" in
4134         '')     _o='.o';;
4135         *)      _o="$obj_ext";;
4136         esac
4137         ;;
4138 esac
4139 case "$p_" in
4140 '') case "$path_sep" in
4141         '')     p_=':';;
4142         *)      p_="$path_sep";;
4143         esac
4144         ;;
4145 esac
4146 exe_ext=$_exe
4147 lib_ext=$_a
4148 obj_ext=$_o
4149 path_sep=$p_
4150
4151 : Which makefile gets called first.  This is used by make depend.
4152 case "$firstmakefile" in
4153 '') firstmakefile='makefile';;
4154 esac
4155
4156 cat <<EOM
4157
4158 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4159 Configure must be run with -Dusesocks.
4160
4161 Normally you do not need this and you should answer no.
4162
4163 EOM
4164 case "$usesocks" in
4165 $define|true|[yY]*)     dflt='y';;
4166 *) dflt='n';;
4167 esac
4168 rp='Build Perl for SOCKS?'
4169 . ./myread
4170 case "$ans" in
4171 y|Y)    val="$define" ;;     
4172 *)      val="$undef" ;;
4173 esac
4174 set usesocks
4175 eval $setvar
4176
4177 : Looking for optional libraries
4178 echo " "
4179 echo "Checking for optional libraries..." >&4
4180 case "$libs" in
4181 ' '|'') dflt='';;
4182 *) dflt="$libs";;
4183 esac
4184 case "$libswanted" in
4185 '') libswanted='c_s';;
4186 esac
4187 case "$usesocks" in
4188 $define)
4189         libswanted="$libswanted socks5 socks5_sh"
4190         ;;
4191 esac
4192 for thislib in $libswanted; do
4193         
4194         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4195                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4196                 echo "Found -l$thislib (shared)."
4197                 case " $dflt " in
4198                 *"-l$thislib "*);;
4199                 *) dflt="$dflt -l$thislib";;
4200                 esac
4201         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4202                 echo "Found -l$thislib (shared)."
4203                 case " $dflt " in
4204                 *"-l$thislib "*);;
4205                 *) dflt="$dflt -l$thislib";;
4206                 esac
4207         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4208                 echo "Found -l$thislib."
4209                 case " $dflt " in
4210                 *"-l$thislib "*);;
4211                 *) dflt="$dflt -l$thislib";;
4212                 esac
4213         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4214                 echo "Found -l$thislib."
4215                 case " $dflt " in
4216                 *"-l$thislib "*);;
4217                 *) dflt="$dflt -l$thislib";;
4218                 esac
4219         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4220                 echo "Found -l${thislib}_s."
4221                 case " $dflt " in
4222                 *"-l$thislib "*);;
4223                 *) dflt="$dflt -l${thislib}_s";;
4224                 esac
4225         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4226                 echo "Found -l$thislib."
4227                 case " $dflt " in
4228                 *"-l$thislib "*);;
4229                 *) dflt="$dflt -l$thislib";;
4230                 esac
4231         else
4232                 echo "No -l$thislib."
4233         fi
4234 done
4235 set X $dflt
4236 shift
4237 dflt="$*"
4238 case "$libs" in
4239 '') dflt="$dflt";;
4240 *) dflt="$libs";;
4241 esac
4242 case "$dflt" in
4243 ' '|'') dflt='none';;
4244 esac
4245
4246 $cat <<EOM
4247
4248 In order to compile $package on your machine, a number of libraries
4249 are usually needed.  Include any other special libraries here as well.
4250 Say "none" for none.  The default list is almost always right.
4251 EOM
4252
4253 echo " "
4254 rp="What libraries to use?"
4255 . ./myread
4256 case "$ans" in
4257 none) libs=' ';;
4258 *) libs="$ans";;
4259 esac
4260
4261 : determine optimization, if desired, or use for debug flag also
4262 case "$optimize" in
4263 ' '|$undef) dflt='none';;
4264 '') dflt='-O';;
4265 *) dflt="$optimize";;
4266 esac
4267 $cat <<EOH
4268
4269 By default, $package compiles with the -O flag to use the optimizer.
4270 Alternately, you might want to use the symbolic debugger, which uses
4271 the -g flag (on traditional Unix systems).  Either flag can be
4272 specified here.  To use neither flag, specify the word "none".
4273
4274 EOH
4275 rp="What optimizer/debugger flag should be used?"
4276 . ./myread
4277 optimize="$ans"
4278 case "$optimize" in
4279 'none') optimize=" ";;
4280 esac
4281
4282 dflt=''
4283 : We will not override a previous value, but we might want to
4284 : augment a hint file
4285 case "$hint" in
4286 default|recommended)
4287         case "$gccversion" in
4288         1*) dflt='-fpcc-struct-return' ;;
4289         esac
4290         case "$optimize" in
4291         *-g*) dflt="$dflt -DDEBUGGING";;
4292         esac
4293         case "$gccversion" in
4294         2*) if test -d /etc/conf/kconfig.d &&
4295                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4296                 then
4297                         dflt="$dflt -posix"
4298                 fi
4299                 ;;
4300         esac
4301         case "$gccversion" in
4302         1*) ;;
4303         2.[0-8]*) ;;
4304         ?*)     echo " "
4305                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4306                 echo 'int main(void) { return 0; }' > gcctest.c
4307                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4308                         echo "Yes, it does." 2>&1
4309                         case "$ccflags" in
4310                         *strict-aliasing*) 
4311                                 echo "Leaving current flags $ccflags alone." 2>&1
4312                                 ;;
4313                         *) dflt="$dflt -fno-strict-aliasing" ;;
4314                         esac
4315                 else
4316                         echo "Nope, it doesn't, but that's ok." 2>&1
4317                 fi
4318                 ;;
4319         esac
4320         ;;
4321 esac
4322
4323 case "$mips_type" in
4324 *BSD*|'') inclwanted="$locincpth $usrinc";;
4325 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4326 esac
4327 for thisincl in $inclwanted; do
4328         if $test -d $thisincl; then
4329                 if $test x$thisincl != x$usrinc; then
4330                         case "$dflt" in
4331                         *$thisincl*);;
4332                         *) dflt="$dflt -I$thisincl";;
4333                         esac
4334                 fi
4335         fi
4336 done
4337
4338 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4339         xxx=true;
4340 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4341         xxx=true;
4342 else
4343         xxx=false;
4344 fi;
4345 if $xxx; then
4346         case "$dflt" in
4347         *$2*);;
4348         *) dflt="$dflt -D$2";;
4349         esac;
4350 fi'
4351
4352 set signal.h LANGUAGE_C; eval $inctest
4353
4354 case "$usesocks" in
4355 $define)
4356         ccflags="$ccflags -DSOCKS"
4357         ;;
4358 esac
4359
4360 case "$hint" in
4361 default|recommended) dflt="$ccflags $dflt" ;;
4362 *) dflt="$ccflags";;
4363 esac
4364
4365 case "$dflt" in
4366 ''|' ') dflt=none;;
4367 esac
4368 $cat <<EOH
4369
4370 Your C compiler may want other flags.  For this question you should include
4371 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4372 but you should NOT include libraries or ld flags like -lwhatever.  If you
4373 want $package to honor its debug switch, you should include -DDEBUGGING here.
4374 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4375
4376 To use no flags, specify the word "none".
4377
4378 EOH
4379 set X $dflt
4380 shift
4381 dflt=${1+"$@"}
4382 rp="Any additional cc flags?"
4383 . ./myread
4384 case "$ans" in
4385 none) ccflags='';;
4386 *) ccflags="$ans";;
4387 esac
4388
4389 : the following weeds options from ccflags that are of no interest to cpp
4390 cppflags="$ccflags"
4391 case "$gccversion" in
4392 1*) cppflags="$cppflags -D__GNUC__"
4393 esac
4394 case "$mips_type" in
4395 '');;
4396 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4397 esac
4398 case "$cppflags" in
4399 '');;
4400 *)
4401         echo " "
4402         echo "Let me guess what the preprocessor flags are..." >&4
4403         set X $cppflags
4404         shift
4405         cppflags=''
4406         $cat >cpp.c <<'EOM'
4407 #define BLURFL foo
4408
4409 BLURFL xx LFRULB
4410 EOM
4411         previous=''
4412         for flag in $*
4413         do
4414                 case "$flag" in
4415                 -*) ftry="$flag";;
4416                 *) ftry="$previous $flag";;
4417                 esac
4418                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4419                         >cpp1.out 2>/dev/null && \
4420                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4421                         >cpp2.out 2>/dev/null && \
4422                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4423                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4424                 then
4425                         cppflags="$cppflags $ftry"
4426                         previous=''
4427                 else
4428                         previous="$flag"
4429                 fi
4430         done
4431         set X $cppflags
4432         shift
4433         cppflags=${1+"$@"}
4434         case "$cppflags" in
4435         *-*)  echo "They appear to be: $cppflags";;
4436         esac
4437         $rm -f cpp.c cpp?.out
4438         ;;
4439 esac
4440
4441 : flags used in final linking phase
4442 case "$ldflags" in
4443 '') if ./venix; then
4444                 dflt='-i -z'
4445         else
4446                 dflt=''
4447         fi
4448         case "$ccflags" in
4449         *-posix*) dflt="$dflt -posix" ;;
4450         esac
4451         ;;
4452 *) dflt="$ldflags";;
4453 esac
4454
4455 : Try to guess additional flags to pick up local libraries.
4456 for thislibdir in $libpth; do
4457         case " $loclibpth " in
4458         *" $thislibdir "*)
4459                 case "$dflt " in 
4460                 *"-L$thislibdir "*) ;;
4461                 *)  dflt="$dflt -L$thislibdir" ;;
4462                 esac
4463                 ;;
4464         esac
4465 done
4466
4467 case "$dflt" in
4468 '') dflt='none' ;;
4469 esac
4470
4471 $cat <<EOH
4472
4473 Your C linker may need flags.  For this question you should
4474 include -L/whatever and any other flags used by the C linker, but you
4475 should NOT include libraries like -lwhatever.
4476
4477 Make sure you include the appropriate -L/path flags if your C linker
4478 does not normally search all of the directories you specified above,
4479 namely
4480         $libpth
4481 To use no flags, specify the word "none".
4482
4483 EOH
4484
4485 rp="Any additional ld flags (NOT including libraries)?"
4486 . ./myread
4487 case "$ans" in
4488 none) ldflags='';;
4489 *) ldflags="$ans";;
4490 esac
4491 rmlist="$rmlist pdp11"
4492
4493 : coherency check
4494 echo " "
4495 echo "Checking your choice of C compiler and flags for coherency..." >&4
4496 $cat > try.c <<'EOF'
4497 #include <stdio.h>
4498 int main() { printf("Ok\n"); exit(0); }
4499 EOF
4500 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4501 shift
4502 $cat >try.msg <<'EOM'
4503 I've tried to compile and run the following simple program:
4504
4505 EOM
4506 $cat try.c >> try.msg
4507
4508 $cat >> try.msg <<EOM
4509
4510 I used the command:
4511
4512         $*
4513         ./try
4514
4515 and I got the following output:
4516
4517 EOM
4518 dflt=y
4519 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4520         if sh -c './try' >>try.msg 2>&1; then
4521                 xxx=`./try`
4522                 case "$xxx" in
4523                 "Ok") dflt=n ;;
4524                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4525                         case " $libs " in
4526                         *" -lsfio "*)
4527                                 cat >> try.msg <<'EOQS'
4528 If $libs contains -lsfio, and sfio is mis-configured, then it
4529 sometimes (apparently) runs and exits with a 0 status, but with no
4530 output!  It may have to do with sfio's use of _exit vs. exit.
4531
4532 EOQS
4533                                 rp="You have a big problem.  Shall I abort Configure"
4534                                 dflt=y
4535                                 ;;
4536                         esac
4537                         ;;
4538                 esac
4539         else
4540                 echo "The program compiled OK, but exited with status $?." >>try.msg
4541                 rp="You have a problem.  Shall I abort Configure"
4542                 dflt=y
4543         fi
4544 else
4545         echo "I can't compile the test program." >>try.msg
4546         rp="You have a BIG problem.  Shall I abort Configure"
4547         dflt=y
4548 fi
4549 case "$dflt" in
4550 y)
4551         $cat try.msg >&4
4552         case "$knowitall" in
4553         '')
4554                 echo "(The supplied flags or libraries might be incorrect.)"
4555                 ;;
4556         *) dflt=n;;
4557         esac
4558         echo " "
4559         . ./myread
4560         case "$ans" in
4561         n*|N*) ;;
4562         *)      echo "Ok.  Stopping Configure." >&4
4563                 exit 1
4564                 ;;
4565         esac
4566         ;;
4567 n) echo "OK, that should do.";;
4568 esac
4569 $rm -f try try.* core
4570
4571 : determine filename position in cpp output
4572 echo " "
4573 echo "Computing filename position in cpp output for #include directives..." >&4
4574 echo '#include <stdio.h>' > foo.c
4575 $cat >fieldn <<EOF
4576 $startsh
4577 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4578 $grep '^[       ]*#.*stdio\.h' | \
4579 while read cline; do
4580         pos=1
4581         set \$cline
4582         while $test \$# -gt 0; do
4583                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4584                         echo "\$pos"
4585                         exit 0
4586                 fi
4587                 shift
4588                 pos=\`expr \$pos + 1\`
4589         done
4590 done
4591 EOF
4592 chmod +x fieldn
4593 fieldn=`./fieldn`
4594 $rm -f foo.c fieldn
4595 case $fieldn in
4596 '') pos='???';;
4597 1) pos=first;;
4598 2) pos=second;;
4599 3) pos=third;;
4600 *) pos="${fieldn}th";;
4601 esac
4602 echo "Your cpp writes the filename in the $pos field of the line."
4603
4604 : locate header file
4605 $cat >findhdr <<EOF
4606 $startsh
4607 wanted=\$1
4608 name=''
4609 for usrincdir in $usrinc
4610 do
4611         if test -f \$usrincdir/\$wanted; then
4612                 echo "\$usrincdir/\$wanted"
4613                 exit 0
4614         fi
4615 done
4616 awkprg='{ print \$$fieldn }'
4617 echo "#include <\$wanted>" > foo\$\$.c
4618 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4619 $grep "^[       ]*#.*\$wanted" | \
4620 while read cline; do
4621         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4622         case "\$name" in
4623         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4624         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4625         *) exit 2;;
4626         esac;
4627 done;
4628 #
4629 # status = 0: grep returned 0 lines, case statement not executed
4630 # status = 1: headerfile found
4631 # status = 2: while loop executed, no headerfile found
4632 #
4633 status=\$?
4634 $rm -f foo\$\$.c;
4635 if test \$status -eq 1; then
4636         exit 0;
4637 fi
4638 exit 1
4639 EOF
4640 chmod +x findhdr
4641
4642 : define an alternate in-header-list? function
4643 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4644 cont=true; xxf="echo \"<\$1> found.\" >&4";
4645 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4646 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4647 esac;
4648 case $# in 4) instead=instead;; *) instead="at last";; esac;
4649 while $test "$cont"; do
4650         xxx=`./findhdr $1`
4651         var=$2; eval "was=\$$2";
4652         if $test "$xxx" && $test -r "$xxx";
4653         then eval $xxf;
4654         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4655                 cont="";
4656         else eval $xxnf;
4657         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4658         set $yyy; shift; shift; yyy=$@;
4659         case $# in 0) cont="";;
4660         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4661                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4662         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4663                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4664         esac;
4665 done;
4666 while $test "$yyy";
4667 do set $yyy; var=$2; eval "was=\$$2";
4668         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4669         set $yyy; shift; shift; yyy=$@;
4670 done'
4671
4672 : see if this is a malloc.h system
4673 set malloc.h i_malloc
4674 eval $inhdr
4675
4676 : see if stdlib is available
4677 set stdlib.h i_stdlib
4678 eval $inhdr
4679
4680 : determine which malloc to compile in
4681 echo " "
4682 case "$usemymalloc" in
4683 ''|[yY]*|true|$define)  dflt='y' ;;
4684 *)      dflt='n' ;;
4685 esac
4686 rp="Do you wish to attempt to use the malloc that comes with $package?"
4687 . ./myread
4688 usemymalloc="$ans"
4689 case "$ans" in
4690 y*|true)
4691         usemymalloc='y'
4692         mallocsrc='malloc.c'
4693         mallocobj="malloc$_o"
4694         d_mymalloc="$define"
4695         case "$libs" in
4696         *-lmalloc*)
4697                 : Remove malloc from list of libraries to use
4698                 echo "Removing unneeded -lmalloc from library list" >&4
4699                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4700                 shift
4701                 libs="$*"
4702                 echo "libs = $libs" >&4
4703                 ;;
4704         esac
4705         ;;
4706 *)
4707         usemymalloc='n'
4708         mallocsrc=''
4709         mallocobj=''
4710         d_mymalloc="$undef"
4711         ;;
4712 esac
4713
4714 : compute the return types of malloc and free
4715 echo " "
4716 $cat >malloc.c <<END
4717 #$i_malloc I_MALLOC
4718 #$i_stdlib I_STDLIB
4719 #include <stdio.h>
4720 #include <sys/types.h>
4721 #ifdef I_MALLOC
4722 #include <malloc.h>
4723 #endif
4724 #ifdef I_STDLIB
4725 #include <stdlib.h>
4726 #endif
4727 #ifdef TRY_MALLOC
4728 void *malloc();
4729 #endif
4730 #ifdef TRY_FREE
4731 void free();
4732 #endif
4733 END
4734 case "$malloctype" in
4735 '')
4736         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4737                 malloctype='void *'
4738         else
4739                 malloctype='char *'
4740         fi
4741         ;;
4742 esac
4743 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4744
4745 case "$freetype" in
4746 '')
4747         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4748                 freetype='void'
4749         else
4750                 freetype='int'
4751         fi
4752         ;;
4753 esac
4754 echo "Your system uses $freetype free(), it would seem." >&4
4755 $rm -f malloc.[co]
4756 $cat <<EOM
4757
4758 The installation process will also create a directory for
4759 vendor-supplied add-ons.  Vendors who supply perl with their system
4760 may find it convenient to place all vendor-supplied files in this
4761 directory rather than in the main distribution directory.  This will
4762 ease upgrades between binary-compatible maintenance versions of perl.
4763
4764 Of course you may also use these directories in whatever way you see
4765 fit.  For example, you might use them to access modules shared over a
4766 company-wide network.
4767
4768 The default answer should be fine for most people.
4769 This causes further questions about vendor add-ons to be skipped
4770 and no vendor-specific directories will be configured for perl.
4771
4772 EOM
4773 rp='Do you want to configure vendor-specific add-on directories?'
4774 case "$usevendorprefix" in
4775 define|true|[yY]*) dflt=y ;;
4776 *) dflt=n ;;
4777 esac
4778 . ./myread
4779 case "$ans" in
4780 [yY]*)  fn=d~+
4781         rp='Installation prefix to use for vendor-supplied add-ons?'
4782         case "$vendorprefix" in
4783         '') dflt='' ;;
4784         *)  dflt=$vendorprefix ;;
4785         esac
4786         . ./getfile
4787         oldvendorprefix=''
4788         case "$vendorprefix" in
4789         '') ;;
4790         *)      case "$ans" in
4791                 "$prefix") ;;
4792                 *) oldvendorprefix="$prefix";;
4793                 esac
4794                 ;;
4795         esac
4796         usevendorprefix="$define"
4797         vendorprefix="$ans"
4798         vendorprefixexp="$ansexp"
4799         ;;
4800 *)      usevendorprefix="$undef"
4801         vendorprefix=''
4802         vendorprefixexp=''
4803         ;;
4804 esac
4805
4806 case "$vendorprefix" in
4807 '')     d_vendorlib="$undef"
4808         vendorlib=''
4809         vendorlibexp=''
4810         ;;
4811 *)      d_vendorlib="$define"
4812         : determine where vendor-supplied modules go.
4813         : Usual default is /usr/local/lib/perl5/vendor_perl
4814         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4815         case "$installstyle" in
4816         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4817         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4818         esac
4819         fn=d~+
4820         rp='Pathname for the vendor-supplied library files?'
4821         . ./getfile
4822         vendorlib="$ans"
4823         vendorlibexp="$ansexp"
4824         : Change installation prefix, if necessary.
4825         if $test X"$prefix" != X"$installprefix"; then
4826                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4827         else
4828                 installvendorlib="$vendorlibexp"
4829         fi
4830         ;;
4831 esac
4832
4833 : Cruising for prototypes
4834 echo " "
4835 echo "Checking out function prototypes..." >&4
4836 $cat >prototype.c <<'EOCP'
4837 int main(int argc, char *argv[]) {
4838         exit(0);}
4839 EOCP
4840 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4841         echo "Your C compiler appears to support function prototypes."
4842         val="$define"
4843 else
4844         echo "Your C compiler doesn't seem to understand function prototypes."
4845         val="$undef"
4846 fi
4847 set prototype
4848 eval $setvar
4849 $rm -f prototype*
4850
4851 case "$prototype" in
4852 "$define") ;;
4853 *)      ansi2knr='ansi2knr'
4854         echo " "
4855         cat <<EOM >&4
4856
4857 $me:  FATAL ERROR:
4858 This version of $package can only be compiled by a compiler that 
4859 understands function prototypes.  Unfortunately, your C compiler 
4860         $cc $ccflags
4861 doesn't seem to understand them.  Sorry about that.
4862
4863 If GNU cc is available for your system, perhaps you could try that instead.  
4864
4865 Eventually, we hope to support building Perl with pre-ANSI compilers.
4866 If you would like to help in that effort, please contact <perlbug@perl.org>.
4867
4868 Aborting Configure now.
4869 EOM
4870         exit 2
4871         ;;
4872 esac
4873
4874 : determine where public executables go
4875 echo " "
4876 set dflt bin bin
4877 eval $prefixit
4878 fn=d~
4879 rp='Pathname where the public executables will reside?'
4880 . ./getfile
4881 if $test "X$ansexp" != "X$binexp"; then
4882         installbin=''
4883 fi
4884 bin="$ans"
4885 binexp="$ansexp"
4886 : Change installation prefix, if necessary.
4887 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4888 if $test X"$prefix" != X"$installprefix"; then
4889         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4890 else
4891         installbin="$binexp"
4892 fi
4893
4894 : determine whether to install perl also as /usr/bin/perl
4895
4896 echo " "
4897 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4898         $cat <<EOM
4899 Many scripts expect to perl to be installed as /usr/bin/perl.
4900 I can install the perl you are about to compile also as /usr/bin/perl
4901 (in addition to $installbin/perl).
4902 EOM
4903         case "$installusrbinperl" in
4904         "$undef"|[nN]*) dflt='n';;
4905         *)              dflt='y';;
4906         esac
4907         rp="Do you want to install perl as /usr/bin/perl?"
4908         . ./myread
4909         case "$ans" in
4910         [yY]*)  val="$define";;
4911         *)      val="$undef" ;;
4912         esac
4913 else
4914         val="$undef"
4915 fi
4916 set installusrbinperl
4917 eval $setvar
4918
4919 : define a shorthand compile call
4920 compile='
4921 mc_file=$1;
4922 shift;
4923 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4924 : define a shorthand compile call for compilations that should be ok.
4925 compile_ok='
4926 mc_file=$1;
4927 shift;
4928 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4929
4930 echo " "
4931 echo "Checking for GNU C Library..." >&4
4932 cat >gnulibc.c <<EOM
4933 #include <stdio.h>
4934 int main()
4935 {
4936 #ifdef __GLIBC__
4937     exit(0);
4938 #else
4939     exit(1);
4940 #endif
4941 }
4942 EOM
4943 set gnulibc
4944 if eval $compile_ok && ./gnulibc; then
4945         val="$define"
4946         echo "You are using the GNU C Library"
4947 else
4948         val="$undef"
4949         echo "You are not using the GNU C Library"
4950 fi
4951 $rm -f gnulibc*
4952 set d_gnulibc
4953 eval $setvar
4954
4955 : see if nm is to be used to determine whether a symbol is defined or not
4956 case "$usenm" in
4957 '')
4958         dflt=''
4959         case "$d_gnulibc" in
4960         "$define")
4961                 echo " "
4962                 echo "nm probably won't work on the GNU C Library." >&4
4963                 dflt=n
4964                 ;;
4965         esac
4966         case "$dflt" in
4967         '') 
4968                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4969                         echo " "
4970                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4971                         echo "'nm' won't be sufficient on this sytem." >&4
4972                         dflt=n
4973                 fi
4974                 ;;
4975         esac
4976         case "$dflt" in
4977         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4978                 if $test $dflt -gt 20; then
4979                         dflt=y
4980                 else
4981                         dflt=n
4982                 fi
4983                 ;;
4984         esac
4985         ;;
4986 *)
4987         case "$usenm" in
4988         true|$define) dflt=y;;
4989         *) dflt=n;;
4990         esac
4991         ;;
4992 esac
4993 $cat <<EOM
4994
4995 I can use $nm to extract the symbols from your C libraries. This
4996 is a time consuming task which may generate huge output on the disk (up
4997 to 3 megabytes) but that should make the symbols extraction faster. The
4998 alternative is to skip the 'nm' extraction part and to compile a small
4999 test program instead to determine whether each symbol is present. If
5000 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5001 this may be the best solution.
5002
5003 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5004
5005 EOM
5006 rp="Shall I use $nm to extract C symbols from the libraries?"
5007 . ./myread
5008 case "$ans" in
5009 [Nn]*) usenm=false;;
5010 *) usenm=true;;
5011 esac
5012
5013 runnm=$usenm
5014 case "$reuseval" in
5015 true) runnm=false;;
5016 esac
5017
5018 : nm options which may be necessary
5019 case "$nm_opt" in
5020 '') if $test -f /mach_boot; then
5021                 nm_opt=''       # Mach
5022         elif $test -d /usr/ccs/lib; then
5023                 nm_opt='-p'     # Solaris (and SunOS?)
5024         elif $test -f /dgux; then
5025                 nm_opt='-p'     # DG-UX
5026         elif $test -f /lib64/rld; then
5027                 nm_opt='-p'     # 64-bit Irix
5028         else
5029                 nm_opt=''
5030         fi;;
5031 esac
5032
5033 : nm options which may be necessary for shared libraries but illegal
5034 : for archive libraries.  Thank you, Linux.
5035 case "$nm_so_opt" in
5036 '')     case "$myuname" in
5037         *linux*)
5038                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5039                         nm_so_opt='--dynamic'
5040                 fi
5041                 ;;
5042         esac
5043         ;;
5044 esac
5045
5046 case "$runnm" in
5047 true)
5048 : get list of predefined functions in a handy place
5049 echo " "
5050 case "$libc" in
5051 '') libc=unknown
5052         case "$libs" in
5053         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5054         esac
5055         ;;
5056 esac
5057 libnames='';
5058 case "$libs" in
5059 '') ;;
5060 *)  for thislib in $libs; do
5061         case "$thislib" in
5062         -lc|-lc_s)
5063                 : Handle C library specially below.
5064                 ;;
5065         -l*)
5066                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5067                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5068                         :
5069                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5070                         :
5071                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5072                         :
5073                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5074                         :
5075                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5076                         :
5077                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5078                         :
5079                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5080                         :
5081                 else
5082                         try=''
5083                 fi
5084                 libnames="$libnames $try"
5085                 ;;
5086         *) libnames="$libnames $thislib" ;;
5087         esac
5088         done
5089         ;;
5090 esac
5091 xxx=normal
5092 case "$libc" in
5093 unknown)
5094         set /lib/libc.$so
5095         for xxx in $libpth; do
5096                 $test -r $1 || set $xxx/libc.$so
5097                 : The messy sed command sorts on library version numbers.
5098                 $test -r $1 || \
5099                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5100                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5101                                 h
5102                                 s/[0-9][0-9]*/0000&/g
5103                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5104                                 G
5105                                 s/\n/ /' | \
5106                          sort | $sed -e 's/^.* //'`
5107                 eval set \$$#
5108         done
5109         $test -r $1 || set /usr/ccs/lib/libc.$so
5110         $test -r $1 || set /lib/libsys_s$_a
5111         ;;
5112 *)
5113         set blurfl
5114         ;;
5115 esac
5116 if $test -r "$1"; then
5117         echo "Your (shared) C library seems to be in $1."
5118         libc="$1"
5119 elif $test -r /lib/libc && $test -r /lib/clib; then
5120         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5121         xxx=apollo
5122         libc='/lib/clib /lib/libc'
5123         if $test -r /lib/syslib; then
5124                 echo "(Your math library is in /lib/syslib.)"
5125                 libc="$libc /lib/syslib"
5126         fi
5127 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5128         echo "Your C library seems to be in $libc, as you said before."
5129 elif $test -r $incpath/usr/lib/libc$_a; then
5130         libc=$incpath/usr/lib/libc$_a;
5131         echo "Your C library seems to be in $libc.  That's fine."
5132 elif $test -r /lib/libc$_a; then
5133         libc=/lib/libc$_a;
5134         echo "Your C library seems to be in $libc.  You're normal."
5135 else
5136         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5137                 :
5138         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5139                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5140         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5141                 :
5142         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5143                 :
5144         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5145                 :
5146         else
5147                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5148         fi
5149         if $test -r "$tans"; then
5150                 echo "Your C library seems to be in $tans, of all places."
5151                 libc=$tans
5152         else
5153                 libc='blurfl'
5154         fi
5155 fi
5156 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5157         dflt="$libc"
5158         cat <<EOM
5159
5160 If the guess above is wrong (which it might be if you're using a strange
5161 compiler, or your machine supports multiple models), you can override it here.
5162
5163 EOM
5164 else
5165         dflt=''
5166         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5167         cat >&4 <<EOM
5168 I can't seem to find your C library.  I've looked in the following places:
5169
5170 EOM
5171         $sed 's/^/      /' libpath
5172         cat <<EOM
5173
5174 None of these seems to contain your C library. I need to get its name...
5175
5176 EOM
5177 fi
5178 fn=f
5179 rp='Where is your C library?'
5180 . ./getfile
5181 libc="$ans"
5182
5183 echo " "
5184 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5185 set X `cat libnames`
5186 shift
5187 xxx=files
5188 case $# in 1) xxx=file; esac
5189 echo "Extracting names from the following $xxx for later perusal:" >&4
5190 echo " "
5191 $sed 's/^/      /' libnames >&4
5192 echo " "
5193 $echo $n "This may take a while...$c" >&4
5194
5195 for file in $*; do
5196         case $file in
5197         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5198         *) $nm $nm_opt $file 2>/dev/null;;
5199         esac
5200 done >libc.tmp
5201
5202 $echo $n ".$c"
5203 $grep fprintf libc.tmp > libc.ptf
5204 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5205 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5206 xxx='[ADTSIW]'
5207 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5208         eval $xscan;\
5209         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5210                 eval $xrun
5211 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5212         eval $xscan;\
5213         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5214                 eval $xrun
5215 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5216         eval $xscan;\
5217         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5218                 eval $xrun
5219 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5220         eval $xscan;\
5221         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5222                 eval $xrun
5223 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5224         eval $xscan;\
5225         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5226                 eval $xrun
5227 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5228         eval $xscan;\
5229         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5230                 eval $xrun
5231 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5232                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5233         eval $xscan;\
5234         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5235                 eval $xrun
5236 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5237         eval $xscan;\
5238         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5239                 eval $xrun
5240 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5241         eval $xscan;\
5242         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5243                 eval $xrun
5244 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5245         eval $xscan;\
5246         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5247                 eval $xrun
5248 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5249         eval $xscan;\
5250         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5251                 eval $xrun
5252 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5253         eval $xscan;\
5254         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5255                 eval $xrun
5256 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5257         eval $xscan;\
5258         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5259                 eval $xrun
5260 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5261         eval $xscan;\
5262         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5263                 eval $xrun
5264 else
5265         $nm -p $* 2>/dev/null >libc.tmp
5266         $grep fprintf libc.tmp > libc.ptf
5267         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5268                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5269         then
5270                 nm_opt='-p'
5271                 eval $xrun
5272         else
5273                 echo " "
5274                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5275                 com=''
5276                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5277                         for thisname in $libnames $libc; do
5278                                 $ar t $thisname >>libc.tmp
5279                         done
5280                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5281                         echo "Ok." >&4
5282                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5283                         # Repeat libc to extract forwarders to DLL entries too
5284                         for thisname in $libnames $libc; do
5285                                 $ar tv $thisname >>libc.tmp
5286                                 # Revision 50 of EMX has bug in $ar.
5287                                 # it will not extract forwarders to DLL entries
5288                                 # Use emximp which will extract exactly them.
5289                                 emximp -o tmp.imp $thisname \
5290                                     2>/dev/null && \
5291                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5292                                     < tmp.imp >>libc.tmp
5293                                 $rm tmp.imp
5294                         done
5295                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5296                         echo "Ok." >&4
5297                 else
5298                         echo "$ar didn't seem to work right." >&4
5299                         echo "Maybe this is a Cray...trying bld instead..." >&4
5300                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5301                         then
5302                                 for thisname in $libnames; do
5303                                         bld t $libnames | \
5304                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5305                                         $ar t $thisname >>libc.tmp
5306                                 done
5307                                 echo "Ok." >&4
5308                         else
5309                                 echo "That didn't work either.  Giving up." >&4
5310                                 exit 1
5311                         fi
5312                 fi
5313         fi
5314 fi
5315 nm_extract="$com"
5316 if $test -f /lib/syscalls.exp; then
5317         echo " "
5318         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5319         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5320 fi
5321 ;;
5322 esac
5323 $rm -f libnames libpath
5324
5325 : see if dld is available
5326 set dld.h i_dld
5327 eval $inhdr
5328
5329 : is a C symbol defined?
5330 csym='tlook=$1;
5331 case "$3" in
5332 -v) tf=libc.tmp; tc=""; tdc="";;
5333 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5334 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5335 esac;
5336 tx=yes;
5337 case "$reuseval-$4" in
5338 true-) ;;
5339 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5340 esac;
5341 case "$tx" in
5342 yes)
5343         case "$runnm" in
5344         true)
5345                 if $contains $tlook $tf >/dev/null 2>&1;
5346                 then tval=true;
5347                 else tval=false;
5348                 fi;;
5349         *)
5350                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5351                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5352                 then tval=true;
5353                 else tval=false;
5354                 fi;
5355                 $rm -f t t.c;;
5356         esac;;
5357 *)
5358         case "$tval" in
5359         $define) tval=true;;
5360         *) tval=false;;
5361         esac;;
5362 esac;
5363 eval "$2=$tval"'
5364
5365 : define an is-in-libc? function
5366 inlibc='echo " "; td=$define; tu=$undef;
5367 sym=$1; var=$2; eval "was=\$$2";
5368 tx=yes;
5369 case "$reuseval$was" in
5370 true) ;;
5371 true*) tx=no;;
5372 esac;
5373 case "$tx" in
5374 yes)
5375         set $sym tres -f;
5376         eval $csym;
5377         case "$tres" in
5378         true)
5379                 echo "$sym() found." >&4;
5380                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5381         *)
5382                 echo "$sym() NOT found." >&4;
5383                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5384         esac;;
5385 *)
5386         case "$was" in
5387         $define) echo "$sym() found." >&4;;
5388         *) echo "$sym() NOT found." >&4;;
5389         esac;;
5390 esac'
5391
5392 : see if dlopen exists
5393 xxx_runnm="$runnm"
5394 runnm=false
5395 set dlopen d_dlopen
5396 eval $inlibc
5397 runnm="$xxx_runnm"
5398
5399 : determine which dynamic loading, if any, to compile in
5400 echo " "
5401 dldir="ext/DynaLoader"
5402 case "$usedl" in
5403 $define|y|true)
5404         dflt='y'
5405         usedl="$define"
5406         ;;
5407 $undef|n|false)
5408         dflt='n'
5409         usedl="$undef"
5410         ;;
5411 *) 
5412         dflt='n'
5413         case "$d_dlopen" in
5414             $define) dflt='y' ;;
5415         esac
5416         case "$i_dld" in
5417             $define) dflt='y' ;;
5418         esac
5419         : Does a dl_xxx.xs file exist for this operating system
5420         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5421         ;;
5422 esac
5423 rp="Do you wish to use dynamic loading?"
5424 . ./myread
5425 usedl="$ans"
5426 case "$ans" in
5427 y*) usedl="$define"
5428         case "$dlsrc" in
5429         '')
5430                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5431                         dflt="$dldir/dl_${osname}.xs"
5432                 elif $test "$d_dlopen" = "$define" ; then
5433                         dflt="$dldir/dl_dlopen.xs"
5434                 elif $test "$i_dld" = "$define" ; then
5435                         dflt="$dldir/dl_dld.xs"
5436                 else
5437                         dflt=''
5438                 fi
5439                 ;;
5440         *)      dflt="$dldir/$dlsrc"
5441                 ;;
5442         esac
5443     echo "The following dynamic loading files are available:"
5444         : Can not go over to $dldir because getfile has path hard-coded in.
5445         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5446         rp="Source file to use for dynamic loading"
5447         fn="fne"
5448         gfpth="$src"
5449         . ./getfile
5450         usedl="$define"
5451         : emulate basename
5452         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5453
5454         $cat << EOM
5455
5456 Some systems may require passing special flags to $cc -c to
5457 compile modules that will be used to create a shared library.
5458 To use no flags, say "none".
5459
5460 EOM
5461     case "$cccdlflags" in
5462     '') case "$gccversion" in
5463                 '') case "$osname" in
5464                         hpux)   dflt='+z' ;;
5465                         next)   dflt='none' ;;
5466                         irix*)  dflt='-KPIC' ;;
5467                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5468                         sunos)  dflt='-pic' ;;
5469                         *)      dflt='none' ;;
5470                     esac
5471                         ;;
5472                 *)  case "$osname" in
5473                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5474                         *)      dflt='-fpic' ;;
5475                     esac ;;
5476             esac ;;
5477         ' ') dflt='none' ;;
5478     *)  dflt="$cccdlflags" ;;
5479     esac
5480     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5481     . ./myread
5482     case "$ans" in
5483     none) cccdlflags=' ' ;;
5484     *) cccdlflags="$ans" ;;
5485     esac
5486
5487     cat << EOM
5488
5489 Some systems use ld to create libraries that can be dynamically loaded,
5490 while other systems (such as those using ELF) use $cc.
5491
5492 EOM
5493         case "$ld" in
5494         '')     $cat >try.c <<'EOM'
5495 /* Test for whether ELF binaries are produced */
5496 #include <fcntl.h>
5497 #include <stdlib.h>
5498 int main() {
5499         char b[4];
5500         int i = open("a.out",O_RDONLY);
5501         if(i == -1) 
5502                 exit(1); /* fail */
5503         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5504                 exit(0); /* succeed (yes, it's ELF) */
5505         else
5506                 exit(1); /* fail */
5507 }
5508 EOM
5509                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5510                         cat <<EOM
5511 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5512 EOM
5513                         dflt="$cc"
5514                 else
5515                         echo "I'll use ld to build dynamic libraries."
5516                         dflt='ld'
5517                 fi
5518                 rm -f try.c a.out
5519                 ;;
5520         *)      dflt="$ld"
5521                 ;;
5522         esac
5523
5524     rp="What command should be used to create dynamic libraries?"
5525     . ./myread
5526         ld="$ans"
5527
5528     cat << EOM
5529
5530 Some systems may require passing special flags to $ld to create a
5531 library that can be dynamically loaded.  If your ld flags include
5532 -L/other/path options to locate libraries outside your loader's normal
5533 search path, you may need to specify those -L options here as well.  To
5534 use no flags, say "none".
5535
5536 EOM
5537     case "$lddlflags" in
5538     '') case "$osname" in
5539                         beos) dflt='-nostart' ;;
5540                         hpux)  dflt='-b' ;;
5541                         linux|irix*)    dflt='-shared' ;;
5542                         next)  dflt='none' ;;
5543                         solaris) dflt='-G' ;;
5544                         sunos) dflt='-assert nodefinitions' ;;
5545                         svr4*|esix*) dflt="-G $ldflags" ;;
5546                 *)     dflt='none' ;;
5547                         esac
5548                         ;;
5549     *) dflt="$lddlflags" ;;
5550     esac
5551
5552         : Try to guess additional flags to pick up local libraries.
5553         : Be careful not to append to a plain 'none'
5554         case "$dflt" in
5555         none) dflt='' ;;
5556         esac
5557         for thisflag in $ldflags; do
5558                 case "$thisflag" in
5559                 -L*)
5560                         case " $dflt " in
5561                         *" $thisflag "*) ;;
5562                         *) dflt="$dflt $thisflag" ;;
5563                         esac
5564                         ;;
5565                 esac
5566         done
5567
5568         case "$dflt" in
5569         ''|' ') dflt='none' ;;
5570         esac
5571
5572     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5573     . ./myread
5574     case "$ans" in
5575     none) lddlflags=' ' ;;
5576     *) lddlflags="$ans" ;;
5577     esac
5578
5579         cat <<EOM
5580
5581 Some systems may require passing special flags to $cc to indicate that
5582 the resulting executable will use dynamic linking.  To use no flags,
5583 say "none".
5584
5585 EOM
5586     case "$ccdlflags" in
5587     '') case "$osname" in
5588                 hpux)   dflt='-Wl,-E' ;;
5589                 linux)  dflt='-rdynamic' ;;
5590                 next)   dflt='none' ;;
5591                 sunos)  dflt='none' ;;
5592                 *)      dflt='none' ;;
5593             esac ;;
5594     ' ')  dflt='none' ;;
5595     *)  dflt="$ccdlflags" ;;
5596     esac
5597     rp="Any special flags to pass to $cc to use dynamic loading?"
5598     . ./myread
5599     case "$ans" in
5600     none) ccdlflags=' ' ;;
5601     *) ccdlflags="$ans" ;;
5602     esac
5603     ;;
5604 *)  usedl="$undef"
5605         ld='ld'
5606     dlsrc='dl_none.xs'
5607     lddlflags=''
5608     ccdlflags=''
5609     ;;
5610 esac
5611
5612 also=''
5613 case "$usedl" in
5614 $undef)
5615         # No dynamic loading being used, so don't bother even to prompt.
5616         useshrplib='false'
5617         ;;
5618 *)      case "$useshrplib" in
5619         '')     case "$osname" in
5620                 svr4*|dgux|dynixptx|esix|powerux|beos)
5621                         dflt=y
5622                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5623                         ;;
5624                 next*)
5625                         case "$osvers" in
5626                         4*)     dflt=y
5627                                 also='Building a shared libperl is needed for MAB support.'
5628                                 ;;
5629                         *)      dflt=n
5630                                 ;;
5631                         esac
5632                         ;;
5633                 *)      dflt=n
5634                         ;;
5635                 esac
5636                 ;;
5637         $define|true|[Yy]*)
5638                 dflt=y
5639                 ;;
5640         *)      dflt=n
5641                 ;;
5642         esac
5643         $cat << EOM
5644
5645 The perl executable is normally obtained by linking perlmain.c with
5646 libperl${_a}, any static extensions (usually just DynaLoader), and
5647 any other libraries needed on this system (such as -lm, etc.).  Since
5648 your system supports dynamic loading, it is probably possible to build
5649 a shared libperl.$so.  If you will have more than one executable linked
5650 to libperl.$so, this will significantly reduce the size of each
5651 executable, but it may have a noticeable affect on performance.  The
5652 default is probably sensible for your system.
5653 $also
5654
5655 EOM
5656         rp="Build a shared libperl.$so (y/n)"
5657         . ./myread
5658         case "$ans" in
5659         true|$define|[Yy]*)
5660                 useshrplib='true'  ;;
5661         *)      useshrplib='false' ;;
5662         esac
5663         ;;
5664 esac
5665
5666 case "$useshrplib" in
5667 true)
5668         case "$libperl" in
5669         '')
5670                 # Figure out a good name for libperl.so.  Since it gets stored in
5671                 # a version-specific architecture-dependent library, the version
5672                 # number isn't really that important, except for making cc/ld happy.
5673                 #
5674                 # A name such as libperl.so.3.1
5675                 majmin="libperl.$so.$patchlevel.$subversion"
5676                 # A name such as libperl.so.301
5677                 majonly=`echo $patchlevel $subversion |
5678                         $awk '{printf "%d%02d", $1, $2}'`
5679                 majonly=libperl.$so.$majonly
5680                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5681                 # rely on figuring it out from the naming of libc.
5682                 case "${osname}${osvers}" in
5683                 next4*)
5684                         dflt=libperl.5.$so
5685                         # XXX How handle the --version stuff for MAB?
5686                         ;;
5687                 linux*)  # ld won't link with a bare -lperl otherwise.
5688                         dflt=libperl.$so
5689                         ;;
5690                 *)      # Try to guess based on whether libc has major.minor.
5691                         case "$libc" in
5692                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5693                         *libc.$so.[0-9]*) dflt=$majonly ;;
5694                         *)      dflt=libperl.$so ;;
5695                         esac
5696                         ;;
5697                 esac
5698                 ;;
5699         *)      dflt=$libperl
5700                 ;;
5701         esac
5702         cat << EOM
5703
5704 I need to select a good name for the shared libperl.  If your system uses
5705 library names with major and minor numbers, then you might want something
5706 like $majmin.  Alternatively, if your system uses a single version
5707 number for shared libraries, then you might want to use $majonly.
5708 Or, your system might be quite happy with a simple libperl.$so.
5709
5710 Since the shared libperl will get installed into a version-specific
5711 architecture-dependent directory, the version number of the shared perl
5712 library probably isn't important, so the default should be o.k.
5713
5714 EOM
5715         rp='What name do you want to give to the shared libperl?'
5716         . ./myread
5717         libperl=$ans
5718         echo "Ok, I'll use $libperl"
5719         ;;
5720 *)
5721         libperl="libperl${_a}"
5722         ;;
5723 esac
5724
5725 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5726 case "$shrpdir" in
5727 '') ;;
5728 *)      $cat >&4 <<EOM
5729 WARNING:  Use of the shrpdir variable for the installation location of
5730 the shared $libperl is not supported.  It was never documented and
5731 will not work in this version.  Let me (perlbug@perl.com)
5732 know of any problems this may cause.
5733
5734 EOM
5735         case "$shrpdir" in
5736         "$archlibexp/CORE")
5737                 $cat >&4 <<EOM
5738 But your current setting of $shrpdir is
5739 the default anyway, so it's harmless.
5740 EOM
5741                 ;;
5742         *)
5743                 $cat >&4 <<EOM
5744 Further, your current attempted setting of $shrpdir
5745 conflicts with the value of $archlibexp/CORE
5746 that installperl will use.
5747 EOM
5748                 ;;
5749         esac
5750         ;;
5751 esac
5752
5753 # How will the perl executable find the installed shared $libperl?
5754 # Add $xxx to ccdlflags.
5755 # If we can't figure out a command-line option, use $shrpenv to
5756 # set env LD_RUN_PATH.  The main perl makefile uses this.
5757 shrpdir=$archlibexp/CORE
5758 xxx=''
5759 tmp_shrpenv=''
5760 if "$useshrplib"; then
5761     case "$osname" in 
5762         aix)
5763                 # We'll set it in Makefile.SH...
5764                 ;;
5765         solaris|netbsd)
5766                 xxx="-R $shrpdir"
5767                 ;;
5768         freebsd)
5769                 xxx="-Wl,-R$shrpdir"
5770                 ;;
5771         linux|irix*|dec_osf)
5772                 xxx="-Wl,-rpath,$shrpdir"
5773                 ;;
5774         next)
5775                 # next doesn't like the default...
5776                 ;;
5777         beos)
5778                 # beos doesn't like the default, either.
5779                 ;;
5780         hpux*)
5781                 # hpux doesn't like the default, either.
5782                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5783                 ;;
5784         *)
5785                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5786                 ;;
5787         esac
5788         case "$xxx" in
5789         '') ;;
5790         *)      
5791                 # Only add $xxx if it isn't already in ccdlflags.
5792                 case " $ccdlflags " in
5793                 *" $xxx "*)     ;;
5794                 *)      ccdlflags="$ccdlflags $xxx"
5795                         cat <<EOM >&4
5796
5797 Adding $xxx to the flags
5798 passed to $ld so that the perl executable will find the 
5799 installed shared $libperl.
5800
5801 EOM
5802                         ;;
5803                 esac
5804                 ;;
5805         esac
5806 fi
5807 # Fix ccdlflags in AIX for building external extensions.
5808 # (For building Perl itself bare -bE:perl.exp is needed,
5809 #  Makefile.SH takes care of this.)
5810 case "$osname" in
5811 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5812 esac
5813 # Respect a hint or command-line value.
5814 case "$shrpenv" in
5815 '') shrpenv="$tmp_shrpenv" ;;
5816 esac
5817 case "$ldlibpthname" in
5818 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5819 none)   ldlibpthname='' ;;
5820 esac
5821
5822 : determine where manual pages go
5823 set man1dir man1dir none
5824 eval $prefixit
5825 $cat <<EOM
5826
5827 $spackage has manual pages available in source form.
5828 EOM
5829 case "$nroff" in
5830 nroff)
5831         echo "However, you don't have nroff, so they're probably useless to you."
5832         case "$man1dir" in
5833         '') man1dir="none";;
5834         esac;;
5835 esac
5836 echo "If you don't want the manual sources installed, answer 'none'."
5837 case "$man1dir" in
5838 ' ') dflt=none
5839         ;;
5840 '')
5841         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5842         lookpath="$lookpath $prefixexp/man/p_man/man1"
5843         lookpath="$lookpath $prefixexp/man/u_man/man1"
5844         lookpath="$lookpath $prefixexp/man/man.1"
5845         case "$sysman" in
5846         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5847         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5848         esac
5849         set dflt
5850         eval $prefixup
5851         ;;
5852 *)  dflt="$man1dir"
5853         ;;
5854 esac
5855 echo " "
5856 fn=dn+~
5857 rp="Where do the main $spackage manual pages (source) go?"
5858 . ./getfile
5859 if $test "X$man1direxp" != "X$ansexp"; then
5860         installman1dir=''
5861 fi
5862 man1dir="$ans"
5863 man1direxp="$ansexp"
5864 case "$man1dir" in
5865 '')     man1dir=' '
5866         installman1dir='';;
5867 esac
5868
5869 : Change installation prefix, if necessary.
5870 if $test X"$prefix" != X"$installprefix"; then
5871         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5872 else
5873         installman1dir="$man1direxp"
5874 fi
5875
5876 : What suffix to use on installed man pages
5877
5878 case "$man1dir" in
5879 ' ')
5880         man1ext='0'
5881         ;;
5882 *)
5883         rp="What suffix should be used for the main $spackage man pages?"
5884         case "$man1ext" in
5885         '')     case "$man1dir" in
5886                 *1)  dflt=1 ;;
5887                 *1p) dflt=1p ;;
5888                 *1pm) dflt=1pm ;;
5889                 *l) dflt=l;;
5890                 *n) dflt=n;;
5891                 *o) dflt=o;;
5892                 *p) dflt=p;;
5893                 *C) dflt=C;;
5894                 *L) dflt=L;;
5895                 *L1) dflt=L1;;
5896                 *) dflt=1;;
5897                 esac
5898                 ;;
5899         *)      dflt="$man1ext";;
5900         esac
5901         . ./myread
5902         man1ext="$ans"
5903         ;;
5904 esac
5905
5906 : see if we can have long filenames
5907 echo " "
5908 rmlist="$rmlist /tmp/cf$$"
5909 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5910 first=123456789abcdef
5911 second=/tmp/cf$$/$first
5912 $rm -f $first $second
5913 if (echo hi >$first) 2>/dev/null; then
5914         if $test -f 123456789abcde; then
5915                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5916                 val="$undef"
5917         else
5918                 if (echo hi >$second) 2>/dev/null; then
5919                         if $test -f /tmp/cf$$/123456789abcde; then
5920                                 $cat <<'EOM'
5921 That's peculiar... You can have filenames longer than 14 characters, but only
5922 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5923 I shall consider your system cannot support long filenames at all.
5924 EOM
5925                                 val="$undef"
5926                         else
5927                                 echo 'You can have filenames longer than 14 characters.' >&4
5928                                 val="$define"
5929                         fi
5930                 else
5931                         $cat <<'EOM'
5932 How confusing! Some of your filesystems are sane enough to allow filenames
5933 longer than 14 characters but some others like /tmp can't even think about them.
5934 So, for now on, I shall assume your kernel does not allow them at all.
5935 EOM
5936                         val="$undef"
5937                 fi
5938         fi
5939 else
5940         $cat <<'EOM'
5941 You can't have filenames longer than 14 chars.  You can't even think about them!
5942 EOM
5943         val="$undef"
5944 fi 
5945 set d_flexfnam
5946 eval $setvar
5947 $rm -rf /tmp/cf$$ 123456789abcde*
5948
5949 : determine where library module manual pages go
5950 set man3dir man3dir none
5951 eval $prefixit
5952 $cat <<EOM
5953
5954 $spackage has manual pages for many of the library modules.
5955 EOM
5956
5957 case "$nroff" in
5958 nroff)
5959         $cat <<'EOM'
5960 However, you don't have nroff, so they're probably useless to you.
5961 EOM
5962         case "$man3dir" in
5963         '') man3dir="none";;
5964         esac;;
5965 esac
5966
5967 case "$d_flexfnam" in
5968 undef)
5969         $cat <<'EOM'
5970 However, your system can't handle the long file names like File::Basename.3. 
5971 EOM
5972         case "$man3dir" in
5973         '') man3dir="none";;
5974         esac;;
5975 esac
5976
5977 echo "If you don't want the manual sources installed, answer 'none'."
5978 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5979 case "$man3dir" in
5980 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5981         if $test -d "$privlib/man/man3"; then
5982                 cat <<EOM >&4
5983
5984 WARNING:  Previous versions of perl installed man3 pages into
5985 $privlib/man/man3.  This version will suggest a 
5986 new default of $dflt.  
5987 EOM
5988                 tdflt=$dflt
5989                 dflt='n'
5990                 rp='Do you wish to preserve the old behavior?(y/n)'
5991                 . ./myread
5992                 case "$ans" in
5993                 y*) dflt="$privlib/man/man3" ;;
5994                 *)  dflt=$tdflt ;;
5995                 esac
5996     fi
5997         ;;
5998 ' ') dflt=none;;
5999 *)      dflt="$man3dir" ;;
6000 esac
6001 echo " "
6002 fn=dn+~
6003 rp="Where do the $package library man pages (source) go?"
6004 . ./getfile
6005 man3dir="$ans"
6006 man3direxp="$ansexp"
6007 case "$man1dir" in
6008 '')     man3dir=' '
6009         installman3dir='';;
6010 esac
6011
6012 : Change installation prefix, if necessary.
6013 if $test X"$prefix" != X"$installprefix"; then
6014         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6015 else
6016         installman3dir="$man3direxp"
6017 fi
6018
6019 : What suffix to use on installed man pages
6020 case "$man3dir" in
6021 ' ')
6022         man3ext='0'
6023         ;;
6024 *)
6025         rp="What suffix should be used for the $package library man pages?"
6026         case "$man3ext" in
6027         '')     case "$man3dir" in
6028                 *3)  dflt=3 ;;
6029                 *3p) dflt=3p ;;
6030                 *3pm) dflt=3pm ;;
6031                 *l) dflt=l;;
6032                 *n) dflt=n;;
6033                 *o) dflt=o;;
6034                 *p) dflt=p;;
6035                 *C) dflt=C;;
6036                 *L) dflt=L;;
6037                 *L3) dflt=L3;;
6038                 *) dflt=3;;
6039                 esac
6040                 ;;
6041         *)      dflt="$man3ext";;
6042         esac
6043         . ./myread
6044         man3ext="$ans"
6045         ;;
6046 esac
6047
6048 : see if we have to deal with yellow pages, now NIS.
6049 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6050         if $test -f /usr/etc/nibindd; then
6051                 echo " "
6052                 echo "I'm fairly confident you're on a NeXT."
6053                 echo " "
6054                 rp='Do you get the hosts file via NetInfo?'
6055                 dflt=y
6056                 case "$hostcat" in
6057                 nidump*) ;;
6058                 '') ;;
6059                 *) dflt=n;;
6060                 esac
6061                 . ./myread
6062                 case "$ans" in
6063                 y*) hostcat='nidump hosts .';;
6064                 *)      case "$hostcat" in
6065                         nidump*) hostcat='';;
6066                         esac
6067                         ;;
6068                 esac
6069         fi
6070         case "$hostcat" in
6071         nidump*) ;;
6072         *)
6073                 case "$hostcat" in
6074                 *ypcat*) dflt=y;;
6075                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6076                                 dflt=y
6077                         else
6078                                 dflt=n
6079                         fi;;
6080                 *) dflt=n;;
6081                 esac
6082                 echo " "
6083                 rp='Are you getting the hosts file via yellow pages?'
6084                 . ./myread
6085                 case "$ans" in
6086                 y*) hostcat='ypcat hosts';;
6087                 *) hostcat='cat /etc/hosts';;
6088                 esac
6089                 ;;
6090         esac
6091 fi
6092 case "$hostcat" in
6093 '') hostcat='cat /etc/hosts';;
6094 esac
6095 case "$groupcat" in
6096 '') groupcat='cat /etc/group';;
6097 esac
6098 case "$passcat" in
6099 '') passcat='cat /etc/passwd';;
6100 esac
6101
6102 : now get the host name
6103 echo " "
6104 echo "Figuring out host name..." >&4
6105 case "$myhostname" in
6106 '') cont=true
6107         echo 'Maybe "hostname" will work...'
6108         if tans=`sh -c hostname 2>&1` ; then
6109                 myhostname=$tans
6110                 phostname=hostname
6111                 cont=''
6112         fi
6113         ;;
6114 *) cont='';;
6115 esac
6116 if $test "$cont"; then
6117         if ./xenix; then
6118                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6119                 if tans=`cat /etc/systemid 2>&1` ; then
6120                         myhostname=$tans
6121                         phostname='cat /etc/systemid'
6122                         echo "Whadyaknow.  Xenix always was a bit strange..."
6123                         cont=''
6124                 fi
6125         elif $test -r /etc/systemid; then
6126                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6127         fi
6128 fi
6129 if $test "$cont"; then
6130         echo 'No, maybe "uuname -l" will work...'
6131         if tans=`sh -c 'uuname -l' 2>&1` ; then
6132                 myhostname=$tans
6133                 phostname='uuname -l'
6134         else
6135                 echo 'Strange.  Maybe "uname -n" will work...'
6136                 if tans=`sh -c 'uname -n' 2>&1` ; then
6137                         myhostname=$tans
6138                         phostname='uname -n'
6139                 else
6140                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6141                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6142                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6143                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6144                         else
6145                                 case "$myhostname" in
6146                                 '') echo "Does this machine have an identity crisis or something?"
6147                                         phostname='';;
6148                                 *)
6149                                         echo "Well, you said $myhostname before..."
6150                                         phostname='echo $myhostname';;
6151                                 esac
6152                         fi
6153                 fi
6154         fi
6155 fi
6156 : you do not want to know about this
6157 set $myhostname
6158 myhostname=$1
6159
6160 : verify guess
6161 if $test "$myhostname" ; then
6162         dflt=y
6163         rp='Your host name appears to be "'$myhostname'".'" Right?"
6164         . ./myread
6165         case "$ans" in
6166         y*) ;;
6167         *) myhostname='';;
6168         esac
6169 fi
6170
6171 : bad guess or no guess
6172 while $test "X$myhostname" = X ; do
6173         dflt=''
6174         rp="Please type the (one word) name of your host:"
6175         . ./myread
6176         myhostname="$ans"
6177 done
6178
6179 : translate upper to lower if necessary
6180 case "$myhostname" in
6181 *[A-Z]*)
6182         echo "(Normalizing case in your host name)"
6183         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6184         ;;
6185 esac
6186
6187 case "$myhostname" in
6188 *.*)
6189         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6190         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6191         echo "(Trimming domain name from host name--host name is now $myhostname)"
6192         ;;
6193 *) case "$mydomain" in
6194         '')
6195                 {
6196                         test "X$hostcat" = "Xypcat hosts" &&
6197                         ypmatch "$myhostname" hosts 2>/dev/null |\
6198                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6199                         $test -s hosts
6200                 } || {
6201                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6202                                         /[       ]$myhostname[  . ]/p" > hosts
6203                 }
6204                 tmp_re="[       . ]"
6205                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6206                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6207                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6208                         hosts | $sort | $uniq | \
6209                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6210                 case `$echo X$dflt` in
6211                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6212                         dflt=.
6213                         ;;
6214                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6215                         ;;
6216                 esac
6217                 case "$dflt" in
6218                 .)
6219                         tans=`./loc resolv.conf X /etc /usr/etc`
6220                         if $test -f "$tans"; then
6221                                 echo "(Attempting domain name extraction from $tans)"
6222                                 dflt=.`$sed -n -e 's/   / /g' \
6223                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6224                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6225                                 case "$dflt" in
6226                                 .) dflt=.`$sed -n -e 's/        / /g' \
6227                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6228                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6229                                         ;;
6230                                 esac
6231                         fi
6232                         ;;
6233                 esac
6234                 case "$dflt" in
6235                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6236                         dflt=.`sh -c domainname 2>/dev/null`
6237                         case "$dflt" in
6238                         '') dflt='.';;
6239                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6240                         esac
6241                         ;;
6242                 esac
6243                 case "$dflt" in
6244                 .) echo "(Lost all hope -- silly guess then)"
6245                         dflt='.uucp'
6246                         ;;
6247                 esac
6248                 $rm -f hosts
6249                 ;;
6250         *) dflt="$mydomain";;
6251         esac;;
6252 esac
6253 echo " "
6254 rp="What is your domain name?"
6255 . ./myread
6256 tans="$ans"
6257 case "$ans" in
6258 '') ;;
6259 .*) ;;
6260 *) tans=".$tans";;
6261 esac
6262 mydomain="$tans"
6263
6264 : translate upper to lower if necessary
6265 case "$mydomain" in
6266 *[A-Z]*)
6267         echo "(Normalizing case in your domain name)"
6268         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6269         ;;
6270 esac
6271
6272 : a little sanity check here
6273 case "$phostname" in
6274 '') ;;
6275 *)
6276         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6277         $myhostname$mydomain|$myhostname) ;;
6278         *)
6279                 case "$phostname" in
6280                 sed*)
6281                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6282                         ;;
6283                 *)
6284                         echo "(That doesn't agree with your $phostname command, by the way.)"
6285                         ;;
6286                 esac
6287         ;;
6288         esac
6289         ;;
6290 esac
6291
6292 $cat <<EOM
6293
6294 I need to get your e-mail address in Internet format if possible, i.e.
6295 something like user@host.domain. Please answer accurately since I have
6296 no easy means to double check it. The default value provided below
6297 is most probably close to the reality but may not be valid from outside
6298 your organization...
6299
6300 EOM
6301 cont=x
6302 while test "$cont"; do
6303         case "$cf_email" in
6304         '') dflt="$cf_by@$myhostname$mydomain";;
6305         *) dflt="$cf_email";;
6306         esac
6307         rp='What is your e-mail address?'
6308         . ./myread
6309         cf_email="$ans"
6310         case "$cf_email" in
6311         *@*.*) cont='' ;;
6312         *)
6313                 rp='Address does not look like an Internet one.  Use it anyway?'
6314                 case "$fastread" in
6315                 yes) dflt=y ;;
6316                 *) dflt=n ;;
6317                 esac
6318                 . ./myread
6319                 case "$ans" in
6320                 y*) cont='' ;;
6321                 *) echo " " ;;
6322                 esac
6323                 ;;
6324         esac
6325 done
6326
6327 $cat <<EOM
6328
6329 If you or somebody else will be maintaining perl at your site, please
6330 fill in the correct e-mail address here so that they may be contacted
6331 if necessary. Currently, the "perlbug" program included with perl
6332 will send mail to this address in addition to perlbug@perl.com. You may
6333 enter "none" for no administrator.
6334
6335 EOM
6336 case "$perladmin" in
6337 '') dflt="$cf_email";;
6338 *) dflt="$perladmin";;
6339 esac
6340 rp='Perl administrator e-mail address'
6341 . ./myread
6342 perladmin="$ans"
6343
6344 : figure out how to guarantee perl startup
6345 case "$startperl" in
6346 '')
6347         case "$sharpbang" in
6348         *!)
6349                 $cat <<EOH
6350
6351 I can use the #! construct to start perl on your system. This will
6352 make startup of perl scripts faster, but may cause problems if you
6353 want to share those scripts and perl is not in a standard place
6354 ($binexp/perl) on all your platforms. The alternative is to force
6355 a shell by starting the script with a single ':' character.
6356
6357 EOH
6358                 dflt="$binexp/perl"
6359                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6360                 . ./myread
6361                 case "$ans" in
6362                 none)   startperl=": # use perl";;
6363                 *)      startperl="#!$ans"
6364                         if $test 30 -lt `echo "$ans" | wc -c`; then
6365                                 $cat >&4 <<EOM
6366
6367 WARNING:  Some systems limit the #! command to 32 characters.
6368 If you experience difficulty running Perl scripts with #!, try
6369 installing Perl in a directory with a shorter pathname.
6370
6371 EOM
6372                         fi ;;
6373                 esac
6374                 ;;
6375         *) startperl=": # use perl"
6376                 ;;
6377         esac
6378         ;;
6379 esac
6380 echo "I'll use $startperl to start perl scripts."
6381
6382 : figure best path for perl in scripts
6383 case "$perlpath" in
6384 '')
6385         perlpath="$binexp/perl"
6386         case "$startperl" in
6387         *!*) ;;
6388         *)
6389                 $cat <<EOH
6390
6391 I will use the "eval 'exec'" idiom to start Perl on your system.
6392 I can use the full path of your Perl binary for this purpose, but
6393 doing so may cause problems if you want to share those scripts and
6394 Perl is not always in a standard place ($binexp/perl).
6395
6396 EOH
6397                 dflt="$binexp/perl"
6398                 rp="What path shall I use in \"eval 'exec'\"?"
6399                 . ./myread
6400                 perlpath="$ans"
6401                 ;;
6402         esac
6403         ;;
6404 esac
6405 case "$startperl" in
6406 *!*)    ;;
6407 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6408 esac
6409
6410 : determine where public executable scripts go
6411 set scriptdir scriptdir
6412 eval $prefixit
6413 case "$scriptdir" in
6414 '')
6415         dflt="$bin"
6416         : guess some guesses
6417         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6418         $test -d /usr/share/bin     && dflt=/usr/share/bin
6419         $test -d /usr/local/script  && dflt=/usr/local/script
6420         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6421         $test -d $prefixexp/script  && dflt=$prefixexp/script
6422         set dflt
6423         eval $prefixup
6424         ;;
6425 *)  dflt="$scriptdir"
6426         ;;
6427 esac
6428 $cat <<EOM
6429  
6430 Some installations have a separate directory just for executable scripts so
6431 that they can mount it across multiple architectures but keep the scripts in
6432 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6433 Or you might just lump your scripts in with all your other executables.
6434  
6435 EOM
6436 fn=d~
6437 rp='Where do you keep publicly executable scripts?'
6438 . ./getfile
6439 if $test "X$ansexp" != "X$scriptdirexp"; then
6440         installscript=''
6441 fi
6442 scriptdir="$ans"
6443 scriptdirexp="$ansexp"
6444 : Change installation prefix, if necessary.
6445 if $test X"$prefix" != X"$installprefix"; then
6446         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6447 else
6448         installscript="$scriptdirexp"
6449 fi
6450
6451 $cat <<EOM
6452
6453 After $package is installed, you may wish to install various
6454 add-on modules and utilities.  Typically, these add-ons will
6455 be installed under $prefix with the rest
6456 of this package.  However, you may wish to install such add-ons
6457 elsewhere under a different prefix.
6458
6459 If you do not wish to put everything under a single prefix, that's
6460 ok.  You will be prompted for the individual locations; this siteprefix
6461 is only used to suggest the defaults.
6462
6463 The default should be fine for most people.
6464
6465 EOM
6466 fn=d~+
6467 rp='Installation prefix to use for add-on modules and utilities?'
6468 : XXX Here might be another good place for an installstyle setting.
6469 case "$siteprefix" in
6470 '') dflt=$prefix ;;
6471 *)  dflt=$siteprefix ;;
6472 esac
6473 . ./getfile
6474 oldsiteprefix=''
6475 case "$siteprefix" in
6476 '') ;;
6477 *)
6478         case "$ans" in
6479         "$prefix") ;;
6480         *) oldsiteprefix="$prefix";;
6481         esac
6482         ;;
6483 esac
6484 siteprefix="$ans"
6485 siteprefixexp="$ansexp"
6486
6487 : determine where site specific libraries go.
6488 : Usual default is /usr/local/lib/perl5/site_perl
6489 : The default "style" setting is made in installstyle.U
6490 : XXX No longer works with Prefixit stuff.
6491 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6492 case "$installstyle" in
6493 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6494 *)       dflt=$siteprefix/lib/site_$prog ;;
6495 esac
6496 $cat <<EOM
6497
6498 The installation process will create a directory for
6499 site-specific extensions and modules.  Most users find it convenient
6500 to place all site-specific files in this directory rather than in the
6501 main distribution directory.
6502
6503 EOM
6504 fn=d~+
6505 rp='Pathname for the site-specific library files?'
6506 . ./getfile
6507 sitelib="$ans"
6508 sitelibexp="$ansexp"
6509 : Change installation prefix, if necessary.
6510 if $test X"$prefix" != X"$installprefix"; then
6511         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6512 else
6513         installsitelib="$sitelibexp"
6514 fi
6515
6516 : determine where site specific architecture-dependent libraries go.
6517 : sitelib  default is /usr/local/lib/perl5/site_perl/
6518 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6519 : sitelib may have an optional trailing /share.
6520 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6521 tdflt="$tdflt/$apiversion/$archname"
6522 set sitearch sitearch none
6523 eval $prefixit
6524 case "$sitearch" in
6525 '')     dflt="$tdflt" ;;
6526 *)      dflt="$sitearch" ;;
6527 esac
6528 $cat <<EOM
6529
6530 The installation process will also create a directory for
6531 architecture-dependent site-specific extensions and modules.
6532
6533 EOM
6534 fn=nd~+
6535 rp='Pathname for the site-specific architecture-dependent library files?'
6536 . ./getfile
6537 sitearch="$ans"
6538 sitearchexp="$ansexp"
6539 : Change installation prefix, if necessary.
6540 if $test X"$prefix" != X"$installprefix"; then
6541         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6542 else
6543         installsitearch="$sitearchexp"
6544 fi
6545
6546 : determine where add-on public executables go
6547 case "$sitebin" in
6548 '')     dflt=$siteprefix/bin ;;
6549 *)      dflt=$sitebin ;;
6550 esac
6551 fn=d~
6552 rp='Pathname where the add-on public executables should be installed?'
6553 . ./getfile
6554 sitebin="$ans"
6555 sitebinexp="$ansexp"
6556 : Change installation prefix, if necessary.
6557 if $test X"$prefix" != X"$installprefix"; then
6558         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6559 else
6560         installsitebin="$sitebinexp"
6561 fi
6562
6563 cat <<EOM
6564
6565 Perl can be built to take advantage of long doubles which
6566 (if available) may give more accuracy and range for floating point numbers.
6567
6568 If this doesn't make any sense to you, just accept the default 'n'.
6569 EOM
6570
6571 case "$ccflags" in
6572 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6573 esac
6574
6575 case "$uselongdouble" in
6576 $define|true|[yY]*)     dflt='y';;
6577 *) dflt='n';;
6578 esac
6579 rp='Try to use long doubles if available?'
6580 . ./myread
6581 case "$ans" in
6582 y|Y)    val="$define"   ;;
6583 *)      val="$undef"    ;;
6584 esac
6585 set uselongdouble
6586 eval $setvar
6587
6588 case "$uselongdouble" in
6589 true|[yY]*) uselongdouble="$define" ;;
6590 esac
6591
6592 case "$uselongdouble" in
6593 $define)
6594 : Look for a hint-file generated 'call-back-unit'.  If the
6595 : user has specified that long doubles should be used,
6596 : we may need to set or change some other defaults.
6597         if $test -f uselongdouble.cbu; then
6598                 echo "Your platform has some specific hints for long doubles, using them..."
6599                 . ./uselongdouble.cbu
6600         else
6601                 $cat <<EOM
6602 (Your platform doesn't have any specific hints for long doubles.)
6603 EOM
6604         fi
6605         ;;
6606 esac
6607
6608 cat <<EOM
6609
6610 Perl can be built to take advantage of long longs which
6611 (if available) may give more range for integer numbers.
6612
6613 If this doesn't make any sense to you, just accept the default 'n'.
6614 EOM
6615
6616 case "$ccflags" in
6617 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
6618 esac
6619
6620 case "$uselonglong" in
6621 $define|true|[yY]*)     dflt='y';;
6622 *) dflt='n';;
6623 esac
6624 rp='Try to use long longs if available?'
6625 . ./myread
6626 case "$ans" in
6627 y|Y)    val="$define"   ;;
6628 *)      val="$undef"    ;;
6629 esac
6630 set uselonglong
6631 eval $setvar
6632
6633 case "$uselonglong" in
6634 true|[yY]*) uselonglong="$define" ;;
6635 esac
6636
6637 case "$uselonglong" in
6638 $define)
6639 : Look for a hint-file generated 'call-back-unit'.  If the
6640 : user has specified that long longs should be used,
6641 : we may need to set or change some other defaults.
6642         if $test -f uselonglong.cbu; then
6643                 echo "Your platform has some specific hints for long longs, using them..."
6644                 . ./uselonglong.cbu
6645         else
6646                 $cat <<EOM
6647 (Your platform doesn't have any specific hints for long longs.)
6648 EOM
6649         fi
6650         ;;
6651 esac
6652
6653 cat <<EOM
6654
6655 Previous version of $package used the standard IO mechanisms as defined
6656 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6657 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6658 the default.  This abstraction layer can use AT&T's sfio (if you already
6659 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6660 problems with some extension modules.  Using PerlIO with stdio is safe,
6661 but it is slower than plain stdio and therefore is not the default.
6662
6663 If this doesn't make any sense to you, just accept the default 'n'.
6664 EOM
6665 case "$useperlio" in
6666 $define|true|[yY]*)     dflt='y';;
6667 *) dflt='n';;
6668 esac
6669 rp='Use the experimental PerlIO abstraction layer?'
6670 . ./myread
6671 case "$ans" in
6672 y|Y) 
6673         val="$define"
6674         ;;     
6675 *)      
6676         echo "Ok, doing things the stdio way"
6677         val="$undef"
6678         ;;
6679 esac
6680 set useperlio
6681 eval $setvar 
6682
6683 case "$vendorprefix" in
6684 '')     d_vendorbin="$undef"
6685         vendorbin=''
6686         vendorbinexp=''
6687         ;;
6688 *)      d_vendorbin="$define"
6689         : determine where vendor-supplied executables go.
6690         dflt=$vendorprefix/bin
6691         fn=d~+
6692         rp='Pathname for the vendor-supplied executables directory?'
6693         . ./getfile
6694         vendorbin="$ans"
6695         vendorbinexp="$ansexp"
6696         : Change installation prefix, if necessary.
6697         if $test X"$prefix" != X"$installprefix"; then
6698                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6699         else
6700                 installvendorbin="$vendorbinexp"
6701         fi
6702         ;;
6703 esac
6704
6705 : Check how to convert floats to strings.
6706 if test "X$d_Gconvert" = X; then
6707         echo " "
6708         echo "Checking for an efficient way to convert floats to strings."
6709         $cat >try.c <<'EOP'
6710 #ifdef TRY_gconvert
6711 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6712 char *myname = "gconvert";
6713 #endif
6714 #ifdef TRY_gcvt
6715 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6716 char *myname = "gcvt";
6717 #endif
6718 #ifdef TRY_sprintf
6719 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6720 char *myname = "sprintf";
6721 #endif
6722
6723 #include <stdio.h>
6724
6725 int
6726 checkit(expect, got)
6727 char *expect;
6728 char *got;
6729 {
6730     if (strcmp(expect, got)) {
6731                 printf("%s oddity:  Expected %s, got %s\n",
6732                         myname, expect, got);
6733                 exit(1);
6734         }
6735 }
6736
6737 int main()
6738
6739         char buf[64]; 
6740         buf[63] = '\0';
6741
6742         /* This must be 1st test on (which?) platform */
6743         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6744         Gconvert(0.1, 8, 0, buf);
6745         checkit("0.1", buf);
6746
6747         Gconvert(1.0, 8, 0, buf); 
6748         checkit("1", buf);
6749
6750         Gconvert(0.0, 8, 0, buf); 
6751         checkit("0", buf);
6752
6753         Gconvert(-1.0, 8, 0, buf); 
6754         checkit("-1", buf);
6755
6756         /* Some Linux gcvt's give 1.e+5 here. */
6757         Gconvert(100000.0, 8, 0, buf); 
6758         checkit("100000", buf);
6759         
6760         /* Some Linux gcvt's give -1.e+5 here. */
6761         Gconvert(-100000.0, 8, 0, buf); 
6762         checkit("-100000", buf);
6763
6764         exit(0);
6765 }
6766 EOP
6767         case "$d_Gconvert" in
6768         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6769         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6770         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6771         *) xxx_list='gconvert gcvt sprintf' ;;
6772         esac
6773
6774         for xxx_convert in $xxx_list; do
6775                 echo "Trying $xxx_convert"
6776                 $rm -f try try$_o
6777                 set try -DTRY_$xxx_convert
6778                 if eval $compile; then
6779                         echo "$xxx_convert" found. >&4
6780                         if ./try; then
6781                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6782                                 break;
6783                         else
6784                                 echo "...But $xxx_convert didn't work as I expected."
6785                         fi
6786                 else
6787                         echo "$xxx_convert NOT found." >&4
6788                 fi
6789         done
6790                 
6791         case "$xxx_convert" in
6792         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6793         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6794         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6795         esac
6796 fi
6797
6798 : check for lengths of integral types
6799 echo " "
6800 case "$intsize" in
6801 '')
6802         echo "Checking to see how big your integers are..." >&4
6803         $cat >intsize.c <<'EOCP'
6804 #include <stdio.h>
6805 int main()
6806 {
6807         printf("intsize=%d;\n", sizeof(int));
6808         printf("longsize=%d;\n", sizeof(long));
6809         printf("shortsize=%d;\n", sizeof(short));
6810         exit(0);
6811 }
6812 EOCP
6813         set intsize
6814         if eval $compile_ok && ./intsize > /dev/null; then
6815                 eval `./intsize`
6816                 echo "Your integers are $intsize bytes long."
6817                 echo "Your long integers are $longsize bytes long."
6818                 echo "Your short integers are $shortsize bytes long."
6819         else
6820                 $cat >&4 <<EOM
6821 !
6822 Help! I can't compile and run the intsize test program: please enlighten me!
6823 (This is probably a misconfiguration in your system or libraries, and
6824 you really ought to fix it.  Still, I'll try anyway.)
6825 !
6826 EOM
6827                 dflt=4
6828                 rp="What is the size of an integer (in bytes)?"
6829                 . ./myread
6830                 intsize="$ans"
6831                 dflt=$intsize
6832                 rp="What is the size of a long integer (in bytes)?"
6833                 . ./myread
6834                 longsize="$ans"
6835                 dflt=2
6836                 rp="What is the size of a short integer (in bytes)?"
6837                 . ./myread
6838                 shortsize="$ans"
6839         fi
6840         ;;
6841 esac
6842 $rm -f intsize intsize.*
6843
6844 : check for long long
6845 echo " "
6846 $echo $n "Checking to see if your system supports long long..." $c >&4
6847 echo 'int main() { long long x = 7; }' > try.c
6848 set try
6849 if eval $compile; then
6850         val="$define"
6851         echo " Yes, it does." >&4
6852 else
6853         val="$undef"
6854         echo " No, it doesn't." >&4
6855 fi
6856 $rm try.*
6857 set d_longlong
6858 eval $setvar
6859
6860 : check for length of long long
6861 case "${d_longlong}${longlongsize}" in
6862 $define)
6863         echo " "
6864         $echo $n "Checking to see how big your long longs are..." $c >&4
6865         $cat >try.c <<'EOCP'
6866 #include <stdio.h>
6867 int main()
6868 {
6869         printf("%d\n", sizeof(long long));
6870 }
6871 EOCP
6872         set try
6873         if eval $compile_ok; then
6874                 longlongsize=`./try$exe_ext`
6875                 $echo " $longlongsize bytes." >&4
6876         else
6877                 dflt='8'
6878                 echo " "
6879                 echo "(I can't seem to compile the test program.  Guessing...)"
6880                 rp="What is the size of a long long (in bytes)?"
6881                 . ./myread
6882                 longlongsize="$ans"
6883         fi
6884         if $test "X$longsize" = "X$longlongsize"; then
6885                 echo "(That isn't any different from an ordinary long.)"
6886         fi      
6887         ;;
6888 esac
6889 $rm -f try.* try
6890
6891 : see if inttypes.h is available
6892 : we want a real compile instead of Inhdr because some systems
6893 : have an inttypes.h which includes non-existent headers
6894 echo " "
6895 $cat >try.c <<EOCP
6896 #include <inttypes.h>
6897 int main() {
6898         static int32_t foo32 = 0x12345678;
6899 }
6900 EOCP
6901 set try
6902 if eval $compile; then
6903         echo "<inttypes.h> found." >&4
6904         val="$define"
6905 else
6906         echo "<inttypes.h> NOT found." >&4
6907         val="$undef"
6908 fi
6909 $rm -f try.c try
6910 set i_inttypes
6911 eval $setvar
6912
6913 : check for int64_t
6914 case "$use64bits" in
6915 "$define" )
6916         echo " "
6917         $echo $n "Checking to see if your system supports int64_t...$c" >&4
6918         $cat >try.c <<EOCP
6919 #include <sys/types.h>
6920 #$i_inttypes I_INTTYPES
6921 #ifdef I_INTTYPES
6922 #include <inttypes.h>
6923 #endif
6924 int main() { int64_t x = 7; }
6925 EOCP
6926         set try
6927         if eval $compile; then
6928                 val="$define"
6929                 echo " Yes, it does." >&4
6930         else
6931                 val="$undef"
6932                 echo " No, it doesn't." >&4
6933         fi
6934         $rm -f try try.*
6935         ;;
6936 *)      val="$undef"
6937         ;;
6938 esac
6939 set d_int64t
6940 eval $setvar
6941
6942
6943
6944 echo " "
6945 echo "Checking which 64-bit integer type to use..." >&4
6946
6947 case "$intsize" in
6948 8) val=int
6949    set quadtype
6950    eval $setvar
6951    val='"unsigned int"'
6952    set uquadtype
6953    eval $setvar
6954    quadcase=1
6955    ;;
6956 *) case "$longsize" in
6957    8) val=long
6958       set quadtype
6959       eval $setvar
6960       val='"unsigned long"'
6961       set uquadtype
6962       eval $setvar
6963       quadcase=2
6964       ;;
6965    *) case "$uselonglong:$d_longlong:$longlongsize" in
6966       define:define:8)
6967         val='"long long"'
6968         set quadtype
6969         eval $setvar
6970         val='"unsigned long long"'
6971         set uquadtype
6972         eval $setvar
6973         quadcase=3
6974         ;;
6975       *) case "$d_int64t" in
6976          define)
6977            val=int64_t
6978            set quadtype
6979            eval $setvar
6980            val=uint64_t
6981            set uquadtype
6982            eval $setvar
6983            quadcase=4
6984            ;;
6985          esac
6986          ;;
6987       esac
6988       ;;
6989    esac
6990    ;;
6991 esac
6992
6993 case "$quadtype" in
6994 '') echo "Alas, no 64-bit integer types in sight."    >&4 ;;
6995 *)  echo "Using '$quadtype' for 64-bit integers." >&4 ;;
6996 esac
6997
6998 echo " "
6999
7000 if $test X"$quadtype" != X; then
7001
7002 echo "Checking how to print 64-bit integers..." >&4
7003
7004 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
7005         $cat >try.c <<'EOCP'
7006 #include <sys/types.h>
7007 #include <stdio.h>
7008 int main() {
7009   int q = 12345678901;
7010   printf("%ld\n", q);
7011 }
7012 EOCP
7013         set try
7014         if eval $compile; then
7015                 yyy=`./try$exe_ext`
7016                 case "$yyy" in
7017                 12345678901)
7018                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
7019                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
7020                         echo "We will use %d."
7021                         ;;
7022                 esac
7023         fi
7024 fi
7025
7026 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
7027         $cat >try.c <<'EOCP'
7028 #include <sys/types.h>
7029 #include <stdio.h>
7030 int main() {
7031   long q = 12345678901;
7032   printf("%ld\n", q);
7033 }
7034 EOCP
7035         set try
7036         if eval $compile; then
7037                 yyy=`./try$exe_ext`
7038                 case "$yyy" in
7039                 12345678901)
7040                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
7041                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
7042                         echo "We will use %ld."
7043                         ;;
7044                 esac
7045         fi
7046 fi
7047
7048 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
7049         $cat >try.c <<'EOCP'
7050 #include <sys/types.h>
7051 #include <inttypes.h>
7052 #include <stdio.h>
7053 int main() {
7054   int64_t q = 12345678901;
7055   printf("%" PRId64 "\n", q);
7056 }
7057 EOCP
7058         set try
7059         if eval $compile; then
7060                 yyy=`./try$exe_ext`
7061                 case "$yyy" in
7062                 12345678901)
7063                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
7064                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
7065                         echo "We will use the C9X style."
7066                         ;;
7067                 esac
7068         fi
7069 fi
7070
7071 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
7072         $cat >try.c <<'EOCP'
7073 #include <sys/types.h>
7074 #include <stdio.h>
7075 int main() {
7076   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
7077   printf("%lld\n", q);
7078 }
7079 EOCP
7080         set try
7081         if eval $compile; then
7082                 yyy=`./try$exe_ext`
7083                 case "$yyy" in
7084                 12345678901)
7085                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
7086                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
7087                         echo "We will use the %lld style."
7088                         ;;
7089                 esac
7090         fi
7091 fi
7092
7093 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
7094         $cat >try.c <<EOCP
7095 #include <sys/types.h>
7096 #include <stdio.h>
7097 int main() {
7098   $quadtype q = 12345678901;
7099   printf("%Ld\n", q);
7100 }
7101 EOCP
7102         set try
7103         if eval $compile; then
7104                 yyy=`./try$exe_ext`
7105                 case "$yyy" in
7106                 12345678901)
7107                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
7108                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
7109                         echo "We will use %Ld."
7110                         ;;
7111                 esac
7112         fi
7113 fi
7114
7115 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
7116         $cat >try.c <<EOCP
7117 #include <sys/types.h>
7118 #include <stdio.h>
7119 int main() {
7120   $quadtype q = 12345678901;
7121   printf("%qd\n", q);
7122 }
7123 EOCP
7124         set try
7125         if eval $compile; then
7126                 yyy=`./try$exe_ext`
7127                 case "$yyy" in
7128                 12345678901)
7129                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
7130                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
7131                         echo "We will use %qd."
7132                         ;;
7133                 esac
7134         fi
7135 fi
7136
7137 if $test X"$sPRId64" = X; then
7138         echo "Cannot figure out how to print 64-bit integers." >&4
7139 fi
7140
7141 $rm -f try try.*
7142
7143 fi
7144
7145 case "$sPRId64" in
7146 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
7147         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
7148         ;;
7149 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
7150         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
7151         ;;
7152 esac
7153
7154 : check for length of double
7155 echo " "
7156 case "$doublesize" in
7157 '')
7158         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7159         $cat >try.c <<'EOCP'
7160 #include <stdio.h>
7161 int main()
7162 {
7163         printf("%d\n", sizeof(double));
7164 }
7165 EOCP
7166         set try
7167         if eval $compile_ok; then
7168                 doublesize=`./try`
7169                 $echo " $doublesize bytes." >&4
7170         else
7171                 dflt='8'
7172                 echo "(I can't seem to compile the test program.  Guessing...)"
7173                 rp="What is the size of a double precision number (in bytes)?"
7174                 . ./myread
7175                 doublesize="$ans"
7176         fi
7177         ;;
7178 esac
7179 $rm -f try.c try
7180
7181 : check for long doubles
7182 echo " "
7183 $echo $n "Checking to see if your system supports long double..." $c >&4
7184 echo 'int main() { long double x = 7.0; }' > try.c
7185 set try
7186 if eval $compile; then
7187         val="$define"
7188         echo " Yes, it does." >&4
7189 else
7190         val="$undef"
7191         echo " No, it doesn't." >&4
7192 fi
7193 $rm try.*
7194 set d_longdbl
7195 eval $setvar
7196
7197 : check for length of long double
7198 case "${d_longdbl}${longdblsize}" in
7199 $define)
7200         echo " "
7201         $echo $n "Checking to see how big your long doubles are..." $c >&4
7202         $cat >try.c <<'EOCP'
7203 #include <stdio.h>
7204 int main()
7205 {
7206         printf("%d\n", sizeof(long double));
7207 }
7208 EOCP
7209         set try
7210         set try
7211         if eval $compile; then
7212                 longdblsize=`./try$exe_ext`
7213                 $echo " $longdblsize bytes." >&4
7214         else
7215                 dflt='8'
7216                 echo " "
7217                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7218                 rp="What is the size of a long double (in bytes)?"
7219                 . ./myread
7220                 longdblsize="$ans"
7221         fi
7222         if $test "X$doublesize" = "X$longdblsize"; then
7223                 echo "(That isn't any different from an ordinary double.)"
7224         fi      
7225         ;;
7226 esac
7227 $rm -f try.* try
7228
7229 echo " "
7230
7231 if $test X"$d_longdbl" = X"$define"; then
7232
7233 echo "Checking how to print long doubles..." >&4
7234
7235 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7236         $cat >try.c <<'EOCP'
7237 #include <sys/types.h>
7238 #include <stdio.h>
7239 int main() {
7240   double d = 123.456;
7241   printf("%.3f\n", d);
7242 }
7243 EOCP
7244         set try
7245         if eval $compile; then
7246                 yyy=`./try$exe_ext`
7247                 case "$yyy" in
7248                 123.456)
7249                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7250                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7251                         echo "We will use %f."
7252                         ;;
7253                 esac
7254         fi
7255 fi
7256
7257 if $test X"$sPRIfldbl" = X; then
7258         $cat >try.c <<'EOCP'
7259 #include <sys/types.h>
7260 #include <stdio.h>
7261 int main() {
7262   long double d = 123.456;
7263   printf("%.3llf\n", d);
7264 }
7265 EOCP
7266         set try
7267         if eval $compile; then
7268                 yyy=`./try$exe_ext`
7269                 case "$yyy" in
7270                 123.456)
7271                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7272                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7273                         echo "We will use %llf."
7274                         ;;
7275                 esac
7276         fi
7277 fi
7278
7279 if $test X"$sPRIfldbl" = X; then
7280         $cat >try.c <<'EOCP'
7281 #include <sys/types.h>
7282 #include <stdio.h>
7283 int main() {
7284   long double d = 123.456;
7285   printf("%.3Lf\n", d);
7286 }
7287 EOCP
7288         set try
7289         if eval $compile; then
7290                 yyy=`./try$exe_ext`
7291                 case "$yyy" in
7292                 123.456)
7293                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7294                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7295                         echo "We will use %Lf."
7296                         ;;
7297                 esac
7298         fi
7299 fi
7300
7301 if $test X"$sPRIfldbl" = X; then
7302         $cat >try.c <<'EOCP'
7303 #include <sys/types.h>
7304 #include <stdio.h>
7305 int main() {
7306   long double d = 123.456;
7307   printf("%.3lf\n", d);
7308 }
7309 EOCP
7310         set try
7311         if eval $compile; then
7312                 yyy=`./try$exe_ext`
7313                 case "$yyy" in
7314                 123.456)
7315                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7316                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7317                         echo "We will use %lf."
7318                         ;;
7319                 esac
7320         fi
7321 fi
7322
7323 if $test X"$sPRIfldbl" = X; then
7324         echo "Cannot figure out how to print long doubles." >&4
7325 fi
7326
7327 $rm -f try try.*
7328
7329 fi # d_longdbl
7330
7331 case "$sPRIfldbl" in
7332 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7333         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7334         ;;
7335 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7336         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7337         ;;
7338 esac
7339
7340 : Initialize h_fcntl
7341 h_fcntl=false
7342
7343 : Initialize h_sysfile
7344 h_sysfile=false
7345
7346 : access call always available on UNIX
7347 set access d_access
7348 eval $inlibc
7349
7350 : locate the flags for 'access()'
7351 case "$d_access" in
7352 "$define")
7353         echo " "
7354         $cat >access.c <<'EOCP'
7355 #include <sys/types.h>
7356 #ifdef I_FCNTL
7357 #include <fcntl.h>
7358 #endif
7359 #ifdef I_SYS_FILE
7360 #include <sys/file.h>
7361 #endif
7362 #ifdef I_UNISTD
7363 #include <unistd.h>
7364 #endif
7365 int main() {
7366         exit(R_OK);
7367 }
7368 EOCP
7369         : check sys/file.h first, no particular reason here
7370         if $test `./findhdr sys/file.h` && \
7371                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7372                 h_sysfile=true;
7373                 echo "<sys/file.h> defines the *_OK access constants." >&4
7374         elif $test `./findhdr fcntl.h` && \
7375                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7376                 h_fcntl=true;
7377                 echo "<fcntl.h> defines the *_OK access constants." >&4
7378         elif $test `./findhdr unistd.h` && \
7379                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7380                 echo "<unistd.h> defines the *_OK access constants." >&4
7381         else
7382                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7383         fi
7384         ;;
7385 esac
7386 $rm -f access*
7387
7388 : see if accessx exists
7389 set accessx d_accessx
7390 eval $inlibc
7391
7392 : see if alarm exists
7393 set alarm d_alarm
7394 eval $inlibc
7395
7396 : see if atolf exists
7397 set atolf d_atolf
7398 eval $inlibc
7399
7400 : see if atoll exists
7401 set atoll d_atoll
7402 eval $inlibc
7403
7404 : Look for GNU-cc style attribute checking
7405 echo " "
7406 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7407 $cat >attrib.c <<'EOCP'
7408 #include <stdio.h>
7409 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7410 EOCP
7411 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7412         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7413                 echo "Your C compiler doesn't fully support __attribute__."
7414                 val="$undef"
7415         else
7416                 echo "Your C compiler supports __attribute__."
7417                 val="$define"
7418         fi
7419 else
7420         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7421         val="$undef"
7422 fi
7423 set d_attribut
7424 eval $setvar
7425 $rm -f attrib*
7426
7427 : see if bcmp exists
7428 set bcmp d_bcmp
7429 eval $inlibc
7430
7431 : see if bcopy exists
7432 set bcopy d_bcopy
7433 eval $inlibc
7434
7435 : see if this is a unistd.h system
7436 set unistd.h i_unistd
7437 eval $inhdr
7438
7439 : see if getpgrp exists
7440 set getpgrp d_getpgrp
7441 eval $inlibc
7442
7443 case "$d_getpgrp" in
7444 "$define")
7445         echo " "
7446         echo "Checking to see which flavor of getpgrp is in use..."
7447         $cat >set.c <<EOP
7448 #$i_unistd I_UNISTD
7449 #include <sys/types.h>
7450 #ifdef I_UNISTD
7451 #  include <unistd.h>
7452 #endif
7453 int main()
7454 {
7455         if (getuid() == 0) {
7456                 printf("(I see you are running Configure as super-user...)\n");
7457                 setuid(1);
7458         }
7459 #ifdef TRY_BSD_PGRP
7460         if (getpgrp(1) == 0)
7461                 exit(0);
7462 #else
7463         if (getpgrp() > 0)
7464                 exit(0);
7465 #endif
7466         exit(1);
7467 }
7468 EOP
7469         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7470                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7471                 val="$define"
7472         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7473                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7474                 val="$undef"
7475         else
7476                 echo "I can't seem to compile and run the test program."
7477                 if ./usg; then
7478                         xxx="a USG one, i.e. you use getpgrp()."
7479                 else
7480                         # SVR4 systems can appear rather BSD-ish.
7481                         case "$i_unistd" in
7482                         $undef)
7483                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7484                                 val="$define"
7485                                 ;;
7486                         $define)
7487                                 xxx="probably a USG one, i.e. you use getpgrp()."
7488                                 val="$undef"
7489                                 ;;
7490                         esac
7491                 fi
7492                 echo "Assuming your getpgrp is $xxx" >&4
7493         fi
7494         ;;
7495 *) val="$undef";;
7496 esac
7497 set d_bsdgetpgrp
7498 eval $setvar
7499 $rm -f set set.c
7500
7501 : see if setpgrp exists
7502 set setpgrp d_setpgrp
7503 eval $inlibc
7504
7505 case "$d_setpgrp" in
7506 "$define")
7507         echo " "
7508         echo "Checking to see which flavor of setpgrp is in use..."
7509         $cat >set.c <<EOP
7510 #$i_unistd I_UNISTD
7511 #include <sys/types.h>
7512 #ifdef I_UNISTD
7513 #  include <unistd.h>
7514 #endif
7515 int main()
7516 {
7517         if (getuid() == 0) {
7518                 printf("(I see you are running Configure as super-user...)\n");
7519                 setuid(1);
7520         }
7521 #ifdef TRY_BSD_PGRP
7522         if (-1 == setpgrp(1, 1))
7523                 exit(0);
7524 #else
7525         if (setpgrp() != -1)
7526                 exit(0);
7527 #endif
7528         exit(1);
7529 }
7530 EOP
7531         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7532                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7533                 val="$define"
7534         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7535                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7536                 val="$undef"
7537         else
7538                 echo "(I can't seem to compile and run the test program.)"
7539                 if ./usg; then
7540                         xxx="a USG one, i.e. you use setpgrp()."
7541                 else
7542                         # SVR4 systems can appear rather BSD-ish.
7543                         case "$i_unistd" in
7544                         $undef)
7545                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7546                                 val="$define"
7547                                 ;;
7548                         $define)
7549                                 xxx="probably a USG one, i.e. you use setpgrp()."
7550                                 val="$undef"
7551                                 ;;
7552                         esac
7553                 fi
7554                 echo "Assuming your setpgrp is $xxx" >&4
7555         fi
7556         ;;
7557 *) val="$undef";;
7558 esac
7559 set d_bsdsetpgrp
7560 eval $setvar
7561 $rm -f set set.c
7562 : see if bzero exists
7563 set bzero d_bzero
7564 eval $inlibc
7565
7566 : see if signal is declared as pointer to function returning int or void
7567 echo " "
7568 xxx=`./findhdr signal.h`
7569 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7570 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7571         echo "You have int (*signal())() instead of void." >&4
7572         val="$undef"
7573 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7574         echo "You have void (*signal())()." >&4
7575         val="$define"
7576 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7577         echo "You have int (*signal())() instead of void." >&4
7578         val="$undef"
7579 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7580         echo "You have void (*signal())()." >&4
7581         val="$define"
7582 else
7583         case "$d_voidsig" in
7584         '')
7585         echo "I can't determine whether signal handler returns void or int..." >&4
7586                 dflt=void
7587                 rp="What type does your signal handler return?"
7588                 . ./myread
7589                 case "$ans" in
7590                 v*) val="$define";;
7591                 *) val="$undef";;
7592                 esac;;
7593         "$define")
7594                 echo "As you already told me, signal handler returns void." >&4
7595                 val="$define"
7596                 ;;
7597         *)      echo "As you already told me, signal handler returns int." >&4
7598                 val="$undef"
7599                 ;;
7600         esac
7601 fi
7602 set d_voidsig
7603 eval $setvar
7604 case "$d_voidsig" in
7605 "$define") signal_t="void";;
7606 *) signal_t="int";;
7607 esac
7608 $rm -f $$.tmp
7609
7610 : check for ability to cast large floats to 32-bit ints.
7611 echo " "
7612 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7613 if $test "$intsize" -ge 4; then
7614         xxx=int
7615 else
7616         xxx=long
7617 fi
7618 $cat >try.c <<EOCP
7619 #include <stdio.h>
7620 #include <sys/types.h>
7621 #include <signal.h>
7622 $signal_t blech(s) int s; { exit(3); }
7623 int main()
7624 {
7625         $xxx i32;
7626         double f, g;
7627         int result = 0;
7628         char str[16];
7629         signal(SIGFPE, blech);
7630
7631         /* Don't let compiler optimize the test away.  Store the number 
7632            in a writable string for gcc to pass to sscanf under HP/UX.
7633         */
7634         sprintf(str, "2147483647");
7635         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7636         g = 10 * f;
7637         i32  = ($xxx) g;
7638
7639         /* x86 processors will probably give 0x8000 0000, which is a
7640        sign change.  We don't want that.  We want to mimic SPARC
7641            behavior here, which is to preserve the sign and give
7642            back 0x7fff ffff.
7643         */
7644         if (i32 != ($xxx) f)
7645                 result |= 1;
7646         exit(result);
7647 }
7648 EOCP
7649 set try
7650 if eval $compile_ok; then
7651         ./try
7652         yyy=$?
7653 else
7654         echo "(I can't seem to compile the test program--assuming it can't)"
7655         yyy=1
7656 fi
7657 case "$yyy" in
7658 0)      val="$define"
7659         echo "Yup, it can."
7660         ;;
7661 *)      val="$undef"
7662         echo "Nope, it can't."
7663         ;;
7664 esac
7665 set d_casti32
7666 eval $setvar
7667 $rm -f try try.*
7668
7669 : check for ability to cast negative floats to unsigned
7670 echo " "
7671 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7672 $cat >try.c <<EOCP
7673 #include <stdio.h>
7674 #include <sys/types.h>
7675 #include <signal.h>
7676 $signal_t blech(s) int s; { exit(7); }
7677 $signal_t blech_in_list(s) int s; { exit(4); }
7678 unsigned long dummy_long(p) unsigned long p; { return p; }
7679 unsigned int dummy_int(p) unsigned int p; { return p; }
7680 unsigned short dummy_short(p) unsigned short p; { return p; }
7681 int main()
7682 {
7683         double f;
7684         unsigned long along;
7685         unsigned int aint;
7686         unsigned short ashort;
7687         int result = 0;
7688         char str[16];
7689         
7690         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7691            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7692            optimized the whole file away
7693         */
7694         /* Store the number in a writable string for gcc to pass to 
7695            sscanf under HP/UX.
7696         */
7697         sprintf(str, "-123");
7698         sscanf(str, "%lf", &f);  /* f = -123.; */
7699
7700         signal(SIGFPE, blech);
7701         along = (unsigned long)f;
7702         aint = (unsigned int)f;
7703         ashort = (unsigned short)f;
7704         if (along != (unsigned long)-123)
7705                 result |= 1;
7706         if (aint != (unsigned int)-123)
7707                 result |= 1;
7708         if (ashort != (unsigned short)-123)
7709                 result |= 1;
7710         sprintf(str, "1073741824.");
7711         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7712         f = f + f;
7713         along = 0;
7714         along = (unsigned long)f;
7715         if (along != 0x80000000)
7716                 result |= 2;
7717         f -= 1.;
7718         along = 0;
7719         along = (unsigned long)f;
7720         if (along != 0x7fffffff)
7721                 result |= 1;
7722         f += 2.;
7723         along = 0;
7724         along = (unsigned long)f;
7725         if (along != 0x80000001)
7726                 result |= 2;
7727         if (result)
7728                 exit(result);
7729         signal(SIGFPE, blech_in_list);
7730         sprintf(str, "123.");
7731         sscanf(str, "%lf", &f);  /* f = 123.; */
7732         along = dummy_long((unsigned long)f);
7733         aint = dummy_int((unsigned int)f);
7734         ashort = dummy_short((unsigned short)f);
7735         if (along != (unsigned long)123)
7736                 result |= 4;
7737         if (aint != (unsigned int)123)
7738                 result |= 4;
7739         if (ashort != (unsigned short)123)
7740                 result |= 4;
7741         exit(result);
7742
7743 }
7744 EOCP
7745 set try
7746 if eval $compile_ok; then
7747         ./try
7748         castflags=$?
7749 else
7750         echo "(I can't seem to compile the test program--assuming it can't)"
7751         castflags=7
7752 fi
7753 case "$castflags" in
7754 0)      val="$define"
7755         echo "Yup, it can."
7756         ;;
7757 *)      val="$undef"
7758         echo "Nope, it can't."
7759         ;;
7760 esac
7761 set d_castneg
7762 eval $setvar
7763 $rm -f try.*
7764
7765 : see if vprintf exists
7766 echo " "
7767 if set vprintf val -f d_vprintf; eval $csym; $val; then
7768         echo 'vprintf() found.' >&4
7769         val="$define"
7770         $cat >vprintf.c <<'EOF'
7771 #include <varargs.h>
7772
7773 int main() { xxx("foo"); }
7774
7775 xxx(va_alist)
7776 va_dcl
7777 {
7778         va_list args;
7779         char buf[10];
7780
7781         va_start(args);
7782         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7783 }
7784 EOF
7785         set vprintf
7786         if eval $compile && ./vprintf; then
7787                 echo "Your vsprintf() returns (int)." >&4
7788                 val2="$undef"
7789         else
7790                 echo "Your vsprintf() returns (char*)." >&4
7791                 val2="$define"
7792         fi
7793 else
7794         echo 'vprintf() NOT found.' >&4
7795                 val="$undef"
7796                 val2="$undef"
7797 fi
7798 set d_vprintf
7799 eval $setvar
7800 val=$val2
7801 set d_charvspr
7802 eval $setvar
7803
7804 : see if chown exists
7805 set chown d_chown
7806 eval $inlibc
7807
7808 : see if chroot exists
7809 set chroot d_chroot
7810 eval $inlibc
7811
7812 : see if chsize exists
7813 set chsize d_chsize
7814 eval $inlibc
7815
7816 : check for const keyword
7817 echo " "
7818 echo 'Checking to see if your C compiler knows about "const"...' >&4
7819 $cat >const.c <<'EOCP'
7820 typedef struct spug { int drokk; } spug;
7821 int main()
7822 {
7823         const char *foo;
7824         const spug y;
7825 }
7826 EOCP
7827 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7828         val="$define"
7829         echo "Yup, it does."
7830 else
7831         val="$undef"
7832         echo "Nope, it doesn't."
7833 fi
7834 set d_const
7835 eval $setvar
7836
7837 : see if crypt exists
7838 echo " "
7839 if set crypt val -f d_crypt; eval $csym; $val; then
7840         echo 'crypt() found.' >&4
7841         val="$define"
7842         cryptlib=''
7843 else
7844         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7845         if $test -z "$cryptlib"; then
7846                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7847         else
7848                 cryptlib=-lcrypt
7849         fi
7850         if $test -z "$cryptlib"; then
7851                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7852         else
7853                 cryptlib=-lcrypt
7854         fi
7855         if $test -z "$cryptlib"; then
7856                 cryptlib=`./loc libcrypt$_a "" $libpth`
7857         else
7858                 cryptlib=-lcrypt
7859         fi
7860         if $test -z "$cryptlib"; then
7861                 echo 'crypt() NOT found.' >&4
7862                 val="$undef"
7863         else
7864                 val="$define"
7865         fi
7866 fi
7867 set d_crypt
7868 eval $setvar
7869
7870 : get csh whereabouts
7871 case "$csh" in
7872 'csh') val="$undef" ;;
7873 *) val="$define" ;;
7874 esac
7875 set d_csh
7876 eval $setvar
7877 : Respect a hint or command line value for full_csh.
7878 case "$full_csh" in
7879 '') full_csh=$csh ;;
7880 esac
7881
7882 : see if cuserid exists
7883 set cuserid d_cuserid
7884 eval $inlibc
7885
7886 : see if this is a limits.h system
7887 set limits.h i_limits
7888 eval $inhdr
7889
7890 : see if this is a float.h system
7891 set float.h i_float
7892 eval $inhdr
7893
7894 : See if number of significant digits in a double precision number is known
7895 echo " "
7896 $cat >dbl_dig.c <<EOM
7897 #$i_limits I_LIMITS
7898 #$i_float I_FLOAT
7899 #ifdef I_LIMITS
7900 #include <limits.h>
7901 #endif
7902 #ifdef I_FLOAT
7903 #include <float.h>
7904 #endif
7905 #ifdef DBL_DIG
7906 printf("Contains DBL_DIG");
7907 #endif
7908 EOM
7909 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7910 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7911         echo "DBL_DIG found." >&4
7912         val="$define"
7913 else
7914         echo "DBL_DIG NOT found." >&4
7915         val="$undef"
7916 fi
7917 $rm -f dbl_dig.?
7918 set d_dbl_dig
7919 eval $setvar
7920
7921 : see if difftime exists
7922 set difftime d_difftime
7923 eval $inlibc
7924
7925 : see if this is a dirent system
7926 echo " "
7927 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7928         val="$define"
7929         echo "<dirent.h> found." >&4
7930 else
7931         val="$undef"
7932         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7933                 echo "<sys/dir.h> found." >&4
7934                 echo " "
7935         else
7936                 xinc=`./findhdr sys/ndir.h`
7937         fi
7938         echo "<dirent.h> NOT found." >&4
7939 fi
7940 set i_dirent
7941 eval $setvar
7942
7943 : Look for type of directory structure.
7944 echo " "
7945 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7946
7947 case "$direntrytype" in
7948 ''|' ')
7949         case "$i_dirent" in
7950         $define) guess1='struct dirent' ;;
7951         *) guess1='struct direct'  ;;
7952         esac
7953         ;;
7954 *)      guess1="$direntrytype"
7955         ;;
7956 esac
7957
7958 case "$guess1" in
7959 'struct dirent') guess2='struct direct' ;;
7960 *) guess2='struct dirent' ;;
7961 esac
7962                 
7963 if $contains "$guess1" try.c >/dev/null 2>&1; then
7964         direntrytype="$guess1"
7965         echo "Your directory entries are $direntrytype." >&4
7966 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7967         direntrytype="$guess2"
7968         echo "Your directory entries seem to be $direntrytype." >&4
7969 else
7970         echo "I don't recognize your system's directory entries." >&4
7971         rp="What type is used for directory entries on this system?"
7972         dflt="$guess1"
7973         . ./myread
7974         direntrytype="$ans"
7975 fi
7976 $rm -f try.c
7977
7978
7979 : see if the directory entry stores field length
7980 echo " "
7981 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7982 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7983         echo "Good, your directory entry keeps length information in d_namlen." >&4
7984         val="$define"
7985 else
7986         echo "Your directory entry does not know about the d_namlen field." >&4
7987         val="$undef"
7988 fi
7989 set d_dirnamlen
7990 eval $setvar
7991 $rm -f try.c
7992
7993 : see if dlerror exists
7994 xxx_runnm="$runnm"
7995 runnm=false
7996 set dlerror d_dlerror
7997 eval $inlibc
7998 runnm="$xxx_runnm"
7999
8000 : see if dlfcn is available
8001 set dlfcn.h i_dlfcn
8002 eval $inhdr
8003
8004 case "$usedl" in
8005 $define|y|true)
8006         $cat << EOM
8007
8008 On a few systems, the dynamically loaded modules that perl generates and uses
8009 will need a different extension than shared libs. The default will probably
8010 be appropriate.
8011
8012 EOM
8013         case "$dlext" in
8014         '')     dflt="$so" ;;
8015         *)      dflt="$dlext" ;;
8016         esac
8017         rp='What is the extension of dynamically loaded modules'
8018         . ./myread
8019         dlext="$ans"
8020         ;;
8021 *)
8022         dlext="none"
8023         ;;
8024 esac
8025
8026 : Check if dlsym need a leading underscore
8027 echo " "
8028 val="$undef"
8029
8030 case "$dlsrc" in
8031 dl_dlopen.xs)
8032         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8033         $cat >dyna.c <<'EOM'
8034 fred () { }
8035 EOM
8036
8037 $cat >fred.c<<EOM
8038
8039 #include <stdio.h>
8040 #$i_dlfcn I_DLFCN
8041 #ifdef I_DLFCN
8042 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8043 #else
8044 #include <sys/types.h>
8045 #include <nlist.h>
8046 #include <link.h>
8047 #endif
8048
8049 extern int fred() ;
8050
8051 int main()
8052 {
8053     void * handle ;
8054     void * symbol ;
8055 #ifndef RTLD_LAZY
8056     int mode = 1 ;
8057 #else
8058     int mode = RTLD_LAZY ;
8059 #endif
8060     handle = dlopen("./dyna.$dlext", mode) ;
8061     if (handle == NULL) {
8062         printf ("1\n") ;
8063         fflush (stdout) ;
8064         exit(0);
8065     }
8066     symbol = dlsym(handle, "fred") ;
8067     if (symbol == NULL) {
8068         /* try putting a leading underscore */
8069         symbol = dlsym(handle, "_fred") ;
8070         if (symbol == NULL) {
8071             printf ("2\n") ;
8072             fflush (stdout) ;
8073             exit(0);
8074         }
8075         printf ("3\n") ;
8076     }
8077     else
8078         printf ("4\n") ;
8079     fflush (stdout) ;
8080     exit(0);
8081 }
8082 EOM
8083         : Call the object file tmp-dyna.o in case dlext=o.
8084         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8085                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8086                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8087                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8088                 xxx=`./fred`
8089                 case $xxx in
8090                 1)      echo "Test program failed using dlopen." >&4
8091                         echo "Perhaps you should not use dynamic loading." >&4;;
8092                 2)      echo "Test program failed using dlsym." >&4
8093                         echo "Perhaps you should not use dynamic loading." >&4;;
8094                 3)      echo "dlsym needs a leading underscore" >&4
8095                         val="$define" ;;
8096                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8097                 esac
8098         else
8099                 echo "I can't compile and run the test program." >&4
8100                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8101         fi
8102         ;;
8103 esac
8104                 
8105 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8106
8107 set d_dlsymun
8108 eval $setvar
8109
8110 hasproto='varname=$1; func=$2; shift; shift;
8111 while $test $# -ge 2; do
8112         case "$1" in
8113         $define) echo "#include <$2>";;
8114         esac ;
8115     shift 2;
8116 done > try.c;
8117 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8118 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8119         echo "$func() prototype found.";
8120         val="$define";
8121 else
8122         echo "$func() prototype NOT found.";
8123         val="$undef";
8124 fi;
8125 set $varname;
8126 eval $setvar;
8127 $rm -f try.c tryout.c'
8128
8129 : see if prototype for drand48 is available
8130 echo " "
8131 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8132 eval $hasproto
8133
8134 : see if dup2 exists
8135 set dup2 d_dup2
8136 eval $inlibc
8137
8138 : see if eaccess exists
8139 set eaccess d_eaccess
8140 eval $inlibc
8141
8142 : see if endgrent exists
8143 set endgrent d_endgrent
8144 eval $inlibc
8145
8146 : see if endhostent exists
8147 set endhostent d_endhent
8148 eval $inlibc
8149
8150 : see if endnetent exists
8151 set endnetent d_endnent
8152 eval $inlibc
8153
8154 : see if endprotoent exists
8155 set endprotoent d_endpent
8156 eval $inlibc
8157
8158 : see if endpwent exists
8159 set endpwent d_endpwent
8160 eval $inlibc
8161
8162 : see if endservent exists
8163 set endservent d_endsent
8164 eval $inlibc
8165
8166 : see if endspent exists
8167 set endspent d_endspent
8168 eval $inlibc
8169
8170 : Locate the flags for 'open()'
8171 echo " "
8172 $cat >open3.c <<'EOCP'
8173 #include <sys/types.h>
8174 #ifdef I_FCNTL
8175 #include <fcntl.h>
8176 #endif
8177 #ifdef I_SYS_FILE
8178 #include <sys/file.h>
8179 #endif
8180 int main() {
8181         if(O_RDONLY);
8182 #ifdef O_TRUNC
8183         exit(0);
8184 #else
8185         exit(1);
8186 #endif
8187 }
8188 EOCP
8189 : check sys/file.h first to get FREAD on Sun
8190 if $test `./findhdr sys/file.h` && \
8191                 set open3 -DI_SYS_FILE && eval $compile; then
8192         h_sysfile=true;
8193         echo "<sys/file.h> defines the O_* constants..." >&4
8194         if ./open3; then
8195                 echo "and you have the 3 argument form of open()." >&4
8196                 val="$define"
8197         else
8198                 echo "but not the 3 argument form of open().  Oh, well." >&4
8199                 val="$undef"
8200         fi
8201 elif $test `./findhdr fcntl.h` && \
8202                 set open3 -DI_FCNTL && eval $compile; then
8203         h_fcntl=true;
8204         echo "<fcntl.h> defines the O_* constants..." >&4
8205         if ./open3; then
8206                 echo "and you have the 3 argument form of open()." >&4
8207                 val="$define"
8208         else
8209                 echo "but not the 3 argument form of open().  Oh, well." >&4
8210                 val="$undef"
8211         fi
8212 else
8213         val="$undef"
8214         echo "I can't find the O_* constant definitions!  You got problems." >&4
8215 fi
8216 set d_open3
8217 eval $setvar
8218 $rm -f open3*
8219
8220 : check for non-blocking I/O stuff
8221 case "$h_sysfile" in
8222 true) echo "#include <sys/file.h>" > head.c;;
8223 *)
8224         case "$h_fcntl" in
8225         true) echo "#include <fcntl.h>" > head.c;;
8226         *) echo "#include <sys/fcntl.h>" > head.c;;
8227         esac
8228         ;;
8229 esac
8230 echo " "
8231 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8232 case "$o_nonblock" in
8233 '')
8234         $cat head.c > try.c
8235         $cat >>try.c <<'EOCP'
8236 int main() {
8237 #ifdef O_NONBLOCK
8238         printf("O_NONBLOCK\n");
8239         exit(0);
8240 #endif
8241 #ifdef O_NDELAY
8242         printf("O_NDELAY\n");
8243         exit(0);
8244 #endif
8245 #ifdef FNDELAY
8246         printf("FNDELAY\n");
8247         exit(0);
8248 #endif
8249         exit(0);
8250 }
8251 EOCP
8252         set try
8253         if eval $compile_ok; then
8254                 o_nonblock=`./try`
8255                 case "$o_nonblock" in
8256                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8257                 *) echo "Seems like we can use $o_nonblock.";;
8258                 esac
8259         else
8260                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8261         fi
8262         ;;
8263 *) echo "Using $hint value $o_nonblock.";;
8264 esac
8265 $rm -f try try.* .out core
8266
8267 echo " "
8268 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8269 case "$eagain" in
8270 '')
8271         $cat head.c > try.c
8272         $cat >>try.c <<EOCP
8273 #include <errno.h>
8274 #include <sys/types.h>
8275 #include <signal.h>
8276 #define MY_O_NONBLOCK $o_nonblock
8277 #ifndef errno  /* XXX need better Configure test */
8278 extern int errno;
8279 #endif
8280 $signal_t blech(x) int x; { exit(3); }
8281 EOCP
8282         $cat >> try.c <<'EOCP'
8283 int main()
8284 {
8285         int pd[2];
8286         int pu[2];
8287         char buf[1];
8288         char string[100];
8289
8290         pipe(pd);       /* Down: child -> parent */
8291         pipe(pu);       /* Up: parent -> child */
8292         if (0 != fork()) {
8293                 int ret;
8294                 close(pd[1]);   /* Parent reads from pd[0] */
8295                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8296                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8297                         exit(1);
8298                 signal(SIGALRM, blech);
8299                 alarm(5);
8300                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8301                         exit(2);
8302                 sprintf(string, "%d\n", ret);
8303                 write(2, string, strlen(string));
8304                 alarm(0);
8305 #ifdef EAGAIN
8306                 if (errno == EAGAIN) {
8307                         printf("EAGAIN\n");
8308                         goto ok;
8309                 }
8310 #endif
8311 #ifdef EWOULDBLOCK
8312                 if (errno == EWOULDBLOCK)
8313                         printf("EWOULDBLOCK\n");
8314 #endif
8315         ok:
8316                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8317                 sleep(2);                               /* Give it time to close our pipe */
8318                 alarm(5);
8319                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8320                 alarm(0);
8321                 sprintf(string, "%d\n", ret);
8322                 write(3, string, strlen(string));
8323                 exit(0);
8324         }
8325
8326         close(pd[0]);                   /* We write to pd[1] */
8327         close(pu[1]);                   /* We read from pu[0] */
8328         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8329         close(pd[1]);                   /* Pipe pd is now fully closed! */
8330         exit(0);                                /* Bye bye, thank you for playing! */
8331 }
8332 EOCP
8333         set try
8334         if eval $compile_ok; then
8335                 echo "$startsh" >mtry
8336                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8337                 chmod +x mtry
8338                 ./mtry >/dev/null 2>&1
8339                 case $? in
8340                 0) eagain=`$cat try.out`;;
8341                 1) echo "Could not perform non-blocking setting!";;
8342                 2) echo "I did a successful read() for something that was not there!";;
8343                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8344                 *) echo "Something terribly wrong happened during testing.";;
8345                 esac
8346                 rd_nodata=`$cat try.ret`
8347                 echo "A read() system call with no data present returns $rd_nodata."
8348                 case "$rd_nodata" in
8349                 0|-1) ;;
8350                 *)
8351                         echo "(That's peculiar, fixing that to be -1.)"
8352                         rd_nodata=-1
8353                         ;;
8354                 esac
8355                 case "$eagain" in
8356                 '')
8357                         echo "Forcing errno EAGAIN on read() with no data available."
8358                         eagain=EAGAIN
8359                         ;;
8360                 *)
8361                         echo "Your read() sets errno to $eagain when no data is available."
8362                         ;;
8363                 esac
8364                 status=`$cat try.err`
8365                 case "$status" in
8366                 0) echo "And it correctly returns 0 to signal EOF.";;
8367                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8368                 *) echo "However, your read() returns '$status' on EOF??";;
8369                 esac
8370                 val="$define"
8371                 if test "$status" = "$rd_nodata"; then
8372                         echo "WARNING: you can't distinguish between EOF and no data!"
8373                         val="$undef"
8374                 fi
8375         else
8376                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8377                 eagain=EAGAIN
8378         fi
8379         set d_eofnblk
8380         eval $setvar
8381         ;;
8382 *)
8383         echo "Using $hint value $eagain."
8384         echo "Your read() returns $rd_nodata when no data is present."
8385         case "$d_eofnblk" in
8386         "$define") echo "And you can see EOF because read() returns 0.";;
8387         "$undef") echo "But you can't see EOF status from read() returned value.";;
8388         *)
8389                 echo "(Assuming you can't see EOF status from read anyway.)"
8390                 d_eofnblk=$undef
8391                 ;;
8392         esac
8393         ;;
8394 esac
8395 $rm -f try try.* .out core head.c mtry
8396
8397 : see if fchmod exists
8398 set fchmod d_fchmod
8399 eval $inlibc
8400
8401 : see if fchown exists
8402 set fchown d_fchown
8403 eval $inlibc
8404
8405 : see if this is an fcntl system
8406 set fcntl d_fcntl
8407 eval $inlibc
8408
8409 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8410 while $test $# -ge 2; do
8411         case "$1" in
8412         $define) echo "#include <$2>";;
8413         esac ;
8414     shift 2;
8415 done > try.c;
8416 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8417 set try;
8418 if eval $compile; then
8419         val="$define";
8420 else
8421         val="$undef";
8422 fi;
8423 set $varname;
8424 eval $setvar;
8425 $rm -f try.c try.o'
8426
8427 socketlib=''
8428 sockethdr=''
8429 : see whether socket exists
8430 echo " "
8431 $echo $n "Hmm... $c" >&4
8432 if set socket val -f d_socket; eval $csym; $val; then
8433         echo "Looks like you have Berkeley networking support." >&4
8434         d_socket="$define"
8435         if set setsockopt val -f; eval $csym; $val; then
8436                 d_oldsock="$undef"
8437         else
8438                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8439                 d_oldsock="$define"
8440         fi
8441 else
8442         if $contains socklib libc.list >/dev/null 2>&1; then
8443                 echo "Looks like you have Berkeley networking support." >&4
8444                 d_socket="$define"
8445                 : we will have to assume that it supports the 4.2 BSD interface
8446                 d_oldsock="$undef"
8447         else
8448                 echo "You don't have Berkeley networking in libc$_a..." >&4
8449                 if test "X$d_socket" = "X$define"; then
8450                    echo "...but you seem to believe that you have sockets." >&4
8451                 else
8452                         for net in net socket
8453                         do
8454                                 if test -f /usr/lib/lib$net$_a; then
8455                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8456                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8457                                         if $contains socket libc.list >/dev/null 2>&1; then
8458                                                 d_socket="$define"
8459                                                 socketlib="-l$net"
8460                                                 case "$net" in
8461                                                 net)
8462                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8463                                                         sockethdr="-I/usr/netinclude"
8464                                                         ;;
8465                                                 esac
8466                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8467                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8468                                                         d_oldsock="$undef"
8469                                                 else
8470                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8471                                                         d_oldsock="$define"
8472                                                 fi
8473                                                 break
8474                                         fi
8475                                 fi
8476                         done
8477                         if test "X$d_socket" != "X$define"; then
8478                            echo "or anywhere else I see." >&4
8479                            d_socket="$undef"
8480                            d_oldsock="$undef"
8481                         fi
8482                 fi
8483         fi
8484 fi
8485
8486 : see if socketpair exists
8487 set socketpair d_sockpair
8488 eval $inlibc
8489
8490
8491 echo " "
8492 echo "Checking the availability of certain socket constants..." >& 4
8493 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8494         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8495         $cat >try.c <<EOF
8496 #include <sys/types.h>
8497 #include <sys/socket.h>
8498 int main() {
8499     int i = $ENUM;
8500 }
8501 EOF
8502         val="$undef"
8503         set try; if eval $compile; then
8504                 val="$define"
8505         fi
8506         set d_${enum}; eval $setvar
8507         $rm -f try.c try
8508 done
8509
8510 : see if sys/select.h has to be included
8511 set sys/select.h i_sysselct
8512 eval $inhdr
8513
8514 : see if we should include time.h, sys/time.h, or both
8515 echo " "
8516 if test "X$timeincl" = X; then
8517         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8518         $echo $n "I'm now running the test program...$c"
8519         $cat >try.c <<'EOCP'
8520 #include <sys/types.h>
8521 #ifdef I_TIME
8522 #include <time.h>
8523 #endif
8524 #ifdef I_SYSTIME
8525 #ifdef SYSTIMEKERNEL
8526 #define KERNEL
8527 #endif
8528 #include <sys/time.h>
8529 #endif
8530 #ifdef I_SYSSELECT
8531 #include <sys/select.h>
8532 #endif
8533 int main()
8534 {
8535         struct tm foo;
8536 #ifdef S_TIMEVAL
8537         struct timeval bar;
8538 #endif
8539 #ifdef S_TIMEZONE
8540         struct timezone tzp;
8541 #endif
8542         if (foo.tm_sec == foo.tm_sec)
8543                 exit(0);
8544 #ifdef S_TIMEVAL
8545         if (bar.tv_sec == bar.tv_sec)
8546                 exit(0);
8547 #endif
8548         exit(1);
8549 }
8550 EOCP
8551         flags=''
8552         for s_timezone in '-DS_TIMEZONE' ''; do
8553         sysselect=''
8554         for s_timeval in '-DS_TIMEVAL' ''; do
8555         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8556         for i_time in '' '-DI_TIME'; do
8557         for i_systime in '-DI_SYSTIME' ''; do
8558                 case "$flags" in
8559                 '') $echo $n ".$c"
8560                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8561                         if eval $compile; then
8562                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8563                                 shift
8564                                 flags="$*"
8565                                 echo " "
8566                                 $echo $n "Succeeded with $flags$c"
8567                         fi
8568                         ;;
8569                 esac
8570         done
8571         done
8572         done
8573         done
8574         done
8575         timeincl=''
8576         echo " "
8577         case "$flags" in
8578         *SYSTIMEKERNEL*) i_systimek="$define"
8579                 timeincl=`./findhdr sys/time.h`
8580                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8581         *) i_systimek="$undef";;
8582         esac
8583         case "$flags" in
8584         *I_TIME*) i_time="$define"
8585                 timeincl=`./findhdr time.h`" $timeincl"
8586                 echo "We'll include <time.h>." >&4;;
8587         *) i_time="$undef";;
8588         esac
8589         case "$flags" in
8590         *I_SYSTIME*) i_systime="$define"
8591                 timeincl=`./findhdr sys/time.h`" $timeincl"
8592                 echo "We'll include <sys/time.h>." >&4;;
8593         *) i_systime="$undef";;
8594         esac
8595         $rm -f try.c try
8596 fi
8597
8598 : check for fd_set items
8599 $cat <<EOM
8600
8601 Checking to see how well your C compiler handles fd_set and friends ...
8602 EOM
8603 $cat >fd_set.c <<EOCP
8604 #$i_systime I_SYS_TIME
8605 #$i_sysselct I_SYS_SELECT
8606 #$d_socket HAS_SOCKET
8607 #include <sys/types.h>
8608 #ifdef HAS_SOCKET
8609 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8610 #endif
8611 #ifdef I_SYS_TIME
8612 #include <sys/time.h>
8613 #endif
8614 #ifdef I_SYS_SELECT
8615 #include <sys/select.h>
8616 #endif
8617 int main() {
8618         fd_set fds;
8619
8620 #ifdef TRYBITS
8621         if(fds.fds_bits);
8622 #endif
8623
8624 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8625         exit(0);
8626 #else
8627         exit(1);
8628 #endif
8629 }
8630 EOCP
8631 set fd_set -DTRYBITS
8632 if eval $compile; then
8633         d_fds_bits="$define"
8634         d_fd_set="$define"
8635         echo "Well, your system knows about the normal fd_set typedef..." >&4
8636         if ./fd_set; then
8637                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8638                 d_fd_macros="$define"
8639         else
8640                 $cat >&4 <<'EOM'
8641 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8642 EOM
8643                 d_fd_macros="$undef"
8644         fi
8645 else
8646         $cat <<'EOM'
8647 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8648 EOM
8649         set fd_set
8650         if eval $compile; then
8651                 d_fds_bits="$undef"
8652                 d_fd_set="$define"
8653                 echo "Well, your system has some sort of fd_set available..." >&4
8654                 if ./fd_set; then
8655                         echo "and you have the normal fd_set macros." >&4
8656                         d_fd_macros="$define"
8657                 else
8658                         $cat <<'EOM'
8659 but not the normal fd_set macros!  Gross!  More work for me...
8660 EOM
8661                         d_fd_macros="$undef"
8662                 fi
8663         else
8664         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8665                 d_fd_set="$undef"
8666                 d_fds_bits="$undef"
8667                 d_fd_macros="$undef"
8668         fi
8669 fi
8670 $rm -f fd_set*
8671
8672 : see if fgetpos exists
8673 set fgetpos d_fgetpos
8674 eval $inlibc
8675
8676 : see if flock exists
8677 set flock d_flock
8678 eval $inlibc
8679
8680 : see if fork exists
8681 set fork d_fork
8682 eval $inlibc
8683
8684 : see if pathconf exists
8685 set pathconf d_pathconf
8686 eval $inlibc
8687
8688 : see if fpathconf exists
8689 set fpathconf d_fpathconf
8690 eval $inlibc
8691
8692
8693 : see if llseek exists
8694 set llseek d_llseek
8695 eval $inlibc
8696
8697 : check for off64_t
8698 echo " "
8699 $echo $n "Checking to see if your system supports off64_t...$c" >&4
8700 $cat >try.c <<EOCP
8701 #include <sys/types.h>
8702 #include <unistd.h>
8703 off64_t foo() { off64_t x; x = 7; return x; }'
8704 EOCP
8705 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8706         val="$define"
8707         echo " Yup, it does." >&4
8708 else
8709         val="$undef"
8710         echo " Nope, it doesn't." >&4
8711 fi
8712 $rm -f try.*
8713 set d_off64_t
8714 eval $setvar
8715
8716 : check for fpos64_t
8717 echo " "
8718 $echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8719 $cat >try.c <<EOCP
8720 #include <sys/stdio.h>
8721 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8722 EOCP
8723 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8724         val="$define"
8725         echo " Yup, it does." >&4
8726 else
8727         val="$undef"
8728         echo " Nope, it doesn't." >&4
8729 fi
8730 $rm -f try.*
8731 set d_fpos64_t
8732 eval $setvar
8733
8734 hasstruct='varname=$1; struct=$2; shift; shift;
8735 while $test $# -ge 2; do
8736         case "$1" in
8737         $define) echo "#include <$2>";;
8738         esac ;
8739     shift 2;
8740 done > try.c;
8741 echo "int main () { struct $struct foo; }" >> try.c;
8742 set try;
8743 if eval $compile; then
8744         val="$define";
8745 else
8746         val="$undef";
8747 fi;
8748 set $varname;
8749 eval $setvar;
8750 $rm -f try.c try.o'
8751
8752 : see if this is a sys/param system
8753 set sys/param.h i_sysparam
8754 eval $inhdr
8755
8756 : see if this is a sys/mount.h system
8757 set sys/mount.h i_sysmount
8758 eval $inhdr
8759
8760 : see if sys/types.h has to be included
8761 set sys/types.h i_systypes
8762 eval $inhdr
8763
8764
8765 echo " "
8766 $echo $n "Checking to see if your system supports struct fs_data..." $c >&4
8767 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8768 eval $hasstruct
8769 case "$d_fs_data_s" in
8770 "$define")      echo "Yup, it does."     >&4 ;;
8771 *)              echo "Nope, it doesn't." >&4 ;;
8772 esac
8773
8774 : see if fseeko exists
8775 set fseeko d_fseeko
8776 eval $inlibc
8777
8778 : see if fsetpos exists
8779 set fsetpos d_fsetpos
8780 eval $inlibc
8781
8782
8783 : see if fstatfs exists
8784 set fstatfs d_fstatfs
8785 eval $inlibc
8786
8787
8788 : see if statvfs exists
8789 set statvfs d_statvfs
8790 eval $inlibc
8791
8792 : see if fstatvfs exists
8793 set fstatvfs d_fstatvfs
8794 eval $inlibc
8795
8796
8797 : see if ftello exists
8798 set ftello d_ftello
8799 eval $inlibc
8800
8801 : see if getgrent exists
8802 set getgrent d_getgrent
8803 eval $inlibc
8804
8805 : see if gethostbyaddr exists
8806 set gethostbyaddr d_gethbyaddr
8807 eval $inlibc
8808
8809 : see if gethostbyname exists
8810 set gethostbyname d_gethbyname
8811 eval $inlibc
8812
8813 : see if gethostent exists
8814 set gethostent d_gethent
8815 eval $inlibc
8816
8817 : see how we will look up host name
8818 echo " "
8819 call=''
8820 if set gethostname val -f d_gethname; eval $csym; $val; then
8821         echo 'gethostname() found.' >&4
8822         d_gethname="$define"
8823         call=gethostname
8824 fi
8825 if set uname val -f d_uname; eval $csym; $val; then
8826         if ./xenix; then
8827                 $cat <<'EOM'
8828 uname() was found, but you're running xenix, and older versions of xenix
8829 have a broken uname(). If you don't really know whether your xenix is old
8830 enough to have a broken system call, use the default answer.
8831
8832 EOM
8833                 dflt=y
8834                 case "$d_uname" in
8835                 "$define") dflt=n;;
8836                 esac
8837                 rp='Is your uname() broken?'
8838                 . ./myread
8839                 case "$ans" in
8840                 n*) d_uname="$define"; call=uname;;
8841                 esac
8842         else
8843                 echo 'uname() found.' >&4
8844                 d_uname="$define"
8845                 case "$call" in
8846                 '') call=uname ;;
8847                 esac
8848         fi
8849 fi
8850 case "$d_gethname" in
8851 '') d_gethname="$undef";;
8852 esac
8853 case "$d_uname" in
8854 '') d_uname="$undef";;
8855 esac
8856 case "$d_uname$d_gethname" in
8857 *define*)
8858         dflt=n
8859         cat <<EOM
8860  
8861 Every now and then someone has a $call() that lies about the hostname
8862 but can't be fixed for political or economic reasons.  If you wish, I can
8863 pretend $call() isn't there and maybe compute hostname at run-time
8864 thanks to the '$phostname' command.
8865
8866 EOM
8867         rp="Shall I ignore $call() from now on?"
8868         . ./myread
8869         case "$ans" in
8870         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8871         esac;;
8872 esac
8873 case "$phostname" in
8874 '') aphostname='';;
8875 *) case "$aphostname" in
8876         /*) ;;
8877         *) set X $phostname
8878                 shift
8879                 file=$1
8880                 shift
8881                 file=`./loc $file $file $pth`
8882                 aphostname=`echo $file $*`
8883                 ;;
8884         esac
8885         ;;
8886 esac
8887 case "$d_uname$d_gethname" in
8888 *define*) ;;
8889 *)
8890         case "$phostname" in
8891         '')
8892                 echo "There will be no way for $package to get your hostname." >&4;;
8893         *)
8894         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8895                 ;;
8896         esac;;
8897 esac
8898 case "$d_phostname" in
8899 '') d_phostname="$undef";;
8900 esac
8901
8902 : see if this is a netdb.h system
8903 set netdb.h i_netdb
8904 eval $inhdr
8905
8906 : see if prototypes for various gethostxxx netdb.h functions are available
8907 echo " "
8908 set d_gethostprotos gethostent $i_netdb netdb.h
8909 eval $hasproto
8910
8911 : see if getlogin exists
8912 set getlogin d_getlogin
8913 eval $inlibc
8914
8915 : see if getmnt exists
8916 set getmnt d_getmnt
8917 eval $inlibc
8918
8919 : see if getmntent exists
8920 set getmntent d_getmntent
8921 eval $inlibc
8922
8923 : see if getnetbyaddr exists
8924 set getnetbyaddr d_getnbyaddr
8925 eval $inlibc
8926
8927 : see if getnetbyname exists
8928 set getnetbyname d_getnbyname
8929 eval $inlibc
8930
8931 : see if getnetent exists
8932 set getnetent d_getnent
8933 eval $inlibc
8934
8935 : see if prototypes for various getnetxxx netdb.h functions are available
8936 echo " "
8937 set d_getnetprotos getnetent $i_netdb netdb.h
8938 eval $hasproto
8939
8940
8941 : see if getprotobyname exists
8942 set getprotobyname d_getpbyname
8943 eval $inlibc
8944
8945 : see if getprotobynumber exists
8946 set getprotobynumber d_getpbynumber
8947 eval $inlibc
8948
8949 : see if getprotoent exists
8950 set getprotoent d_getpent
8951 eval $inlibc
8952
8953 : see if getpgid exists
8954 set getpgid d_getpgid
8955 eval $inlibc
8956
8957 : see if getpgrp2 exists
8958 set getpgrp2 d_getpgrp2
8959 eval $inlibc
8960
8961 : see if getppid exists
8962 set getppid d_getppid
8963 eval $inlibc
8964
8965 : see if getpriority exists
8966 set getpriority d_getprior
8967 eval $inlibc
8968
8969 : see if prototypes for various getprotoxxx netdb.h functions are available
8970 echo " "
8971 set d_getprotoprotos getprotoent $i_netdb netdb.h
8972 eval $hasproto
8973
8974 : see if getpwent exists
8975 set getpwent d_getpwent
8976 eval $inlibc
8977
8978
8979 : see if getservbyname exists
8980 set getservbyname d_getsbyname
8981 eval $inlibc
8982
8983 : see if getservbyport exists
8984 set getservbyport d_getsbyport
8985 eval $inlibc
8986
8987 : see if getservent exists
8988 set getservent d_getsent
8989 eval $inlibc
8990
8991 : see if prototypes for various getservxxx netdb.h functions are available
8992 echo " "
8993 set d_getservprotos getservent $i_netdb netdb.h
8994 eval $hasproto
8995
8996 : see if getspent exists
8997 set getspent d_getspent
8998 eval $inlibc
8999
9000 : see if getspnam exists
9001 set getspnam d_getspnam
9002 eval $inlibc
9003
9004 : see if gettimeofday or ftime exists
9005 set gettimeofday d_gettimeod
9006 eval $inlibc
9007 case "$d_gettimeod" in
9008 "$undef")
9009         set ftime d_ftime 
9010         eval $inlibc
9011         ;;
9012 *)
9013         val="$undef"; set d_ftime; eval $setvar
9014         ;;
9015 esac
9016 case "$d_gettimeod$d_ftime" in
9017 "$undef$undef")
9018         echo " "
9019         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9020         ;;
9021 esac
9022
9023 : see if this is an grp system
9024 set grp.h i_grp
9025 eval $inhdr
9026
9027 case "$i_grp" in
9028 $define)
9029         xxx=`./findhdr grp.h`
9030         $cppstdin $cppflags $cppminus < $xxx >$$.h
9031
9032         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9033                 val="$define"
9034         else
9035                 val="$undef"
9036         fi
9037         set d_grpasswd
9038         eval $setvar
9039
9040         $rm -f $$.h
9041         ;;
9042 *)
9043         val="$undef";
9044         set d_grpasswd; eval $setvar
9045         ;;
9046 esac
9047
9048 : see if hasmntopt exists
9049 set hasmntopt d_hasmntopt
9050 eval $inlibc
9051
9052 : see if this is a netinet/in.h or sys/in.h system
9053 set netinet/in.h i_niin sys/in.h i_sysin
9054 eval $inhdr
9055
9056 : see if arpa/inet.h has to be included
9057 set arpa/inet.h i_arpainet
9058 eval $inhdr
9059
9060 : see if htonl --and friends-- exists
9061 val=''
9062 set htonl val
9063 eval $inlibc
9064
9065 : Maybe they are macros.
9066 case "$val" in
9067 $undef)
9068         $cat >htonl.c <<EOM
9069 #include <stdio.h>
9070 #include <sys/types.h>
9071 #$i_niin I_NETINET_IN
9072 #$i_sysin I_SYS_IN
9073 #$i_arpainet I_ARPA_INET
9074 #ifdef I_NETINET_IN
9075 #include <netinet/in.h>
9076 #endif
9077 #ifdef I_SYS_IN
9078 #include <sys/in.h>
9079 #endif
9080 #ifdef I_ARPA_INET
9081 #include <arpa/inet.h>
9082 #endif
9083 #ifdef htonl
9084 printf("Defined as a macro.");
9085 #endif
9086 EOM
9087         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9088         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9089                 val="$define"
9090                 echo "But it seems to be defined as a macro." >&4
9091         fi
9092         $rm -f htonl.?
9093         ;;
9094 esac
9095 set d_htonl
9096 eval $setvar
9097
9098 : see which of string.h or strings.h is needed
9099 echo " "
9100 strings=`./findhdr string.h`
9101 if $test "$strings" && $test -r "$strings"; then
9102         echo "Using <string.h> instead of <strings.h>." >&4
9103         val="$define"
9104 else
9105         val="$undef"
9106         strings=`./findhdr strings.h`
9107         if $test "$strings" && $test -r "$strings"; then
9108                 echo "Using <strings.h> instead of <string.h>." >&4
9109         else
9110                 echo "No string header found -- You'll surely have problems." >&4
9111         fi
9112 fi
9113 set i_string
9114 eval $setvar
9115 case "$i_string" in
9116 "$undef") strings=`./findhdr strings.h`;;
9117 *)        strings=`./findhdr string.h`;;
9118 esac
9119
9120 : index or strchr
9121 echo " "
9122 if set index val -f; eval $csym; $val; then
9123         if set strchr val -f d_strchr; eval $csym; $val; then
9124                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9125                         val="$define"
9126                         vali="$undef"
9127                         echo "strchr() found." >&4
9128                 else
9129                         val="$undef"
9130                         vali="$define"
9131                         echo "index() found." >&4
9132                 fi
9133         else
9134                 val="$undef"
9135                 vali="$define"
9136                 echo "index() found." >&4
9137         fi
9138 else
9139         if set strchr val -f d_strchr; eval $csym; $val; then
9140                 val="$define"
9141                 vali="$undef"
9142                 echo "strchr() found." >&4
9143         else
9144                 echo "No index() or strchr() found!" >&4
9145                 val="$undef"
9146                 vali="$undef"
9147         fi
9148 fi
9149 set d_strchr; eval $setvar
9150 val="$vali"
9151 set d_index; eval $setvar
9152
9153 : check whether inet_aton exists
9154 set inet_aton d_inetaton
9155 eval $inlibc
9156
9157 : Look for isascii
9158 echo " "
9159 $cat >isascii.c <<'EOCP'
9160 #include <stdio.h>
9161 #include <ctype.h>
9162 int main() {
9163         int c = 'A';
9164         if (isascii(c))
9165                 exit(0);
9166         else
9167                 exit(1);
9168 }
9169 EOCP
9170 set isascii
9171 if eval $compile; then
9172         echo "isascii() found." >&4
9173         val="$define"
9174 else
9175         echo "isascii() NOT found." >&4
9176         val="$undef"
9177 fi
9178 set d_isascii
9179 eval $setvar
9180 $rm -f isascii*
9181
9182 : see if killpg exists
9183 set killpg d_killpg
9184 eval $inlibc
9185
9186 : see if lchown exists
9187 echo " "
9188 $cat > try.c <<'EOCP'
9189 /* System header to define __stub macros and hopefully few prototypes,
9190     which can conflict with char lchown(); below.  */
9191 #include <assert.h>
9192 /* Override any gcc2 internal prototype to avoid an error.  */
9193 /* We use char because int might match the return type of a gcc2
9194    builtin and then its argument prototype would still apply.  */
9195 char lchown();
9196 int main() {
9197     /*  The GNU C library defines this for functions which it implements
9198         to always fail with ENOSYS.  Some functions are actually named
9199         something starting with __ and the normal name is an alias.  */
9200 #if defined (__stub_lchown) || defined (__stub___lchown)
9201 choke me
9202 #else
9203 lchown();
9204 #endif
9205 ; return 0; }
9206 EOCP
9207 set try
9208 if eval $compile; then
9209     $echo "lchown() found." >&4
9210     val="$define"
9211 else
9212     $echo "lchown() NOT found." >&4
9213     val="$undef"
9214 fi
9215 set d_lchown
9216 eval $setvar
9217
9218 : See if number of significant digits in a double precision number is known
9219 echo " "
9220 $cat >ldbl_dig.c <<EOM
9221 #$i_limits I_LIMITS
9222 #$i_float I_FLOAT
9223 #ifdef I_LIMITS
9224 #include <limits.h>
9225 #endif
9226 #ifdef I_FLOAT
9227 #include <float.h>
9228 #endif
9229 #ifdef LDBL_DIG
9230 printf("Contains LDBL_DIG");
9231 #endif
9232 EOM
9233 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9234 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9235         echo "LDBL_DIG found." >&4
9236         val="$define"
9237 else
9238         echo "LDBL_DIG NOT found." >&4
9239         val="$undef"
9240 fi
9241 $rm -f ldbl_dig.?
9242 set d_ldbl_dig
9243 eval $setvar
9244
9245 : see if link exists
9246 set link d_link
9247 eval $inlibc
9248
9249 : see if localeconv exists
9250 set localeconv d_locconv
9251 eval $inlibc
9252
9253 : see if lockf exists
9254 set lockf d_lockf
9255 eval $inlibc
9256
9257 : see if lstat exists
9258 set lstat d_lstat
9259 eval $inlibc
9260
9261 : see if mblen exists
9262 set mblen d_mblen
9263 eval $inlibc
9264
9265 : see if mbstowcs exists
9266 set mbstowcs d_mbstowcs
9267 eval $inlibc
9268
9269 : see if mbtowc exists
9270 set mbtowc d_mbtowc
9271 eval $inlibc
9272
9273 : see if memchr exists
9274 set memchr d_memchr
9275 eval $inlibc
9276
9277 : see if memcmp exists
9278 set memcmp d_memcmp
9279 eval $inlibc
9280
9281 : see if memcpy exists
9282 set memcpy d_memcpy
9283 eval $inlibc
9284
9285 : see if memmove exists
9286 set memmove d_memmove
9287 eval $inlibc
9288
9289 : see if memset exists
9290 set memset d_memset
9291 eval $inlibc
9292
9293 : see if mkdir exists
9294 set mkdir d_mkdir
9295 eval $inlibc
9296
9297 : see if mkfifo exists
9298 set mkfifo d_mkfifo
9299 eval $inlibc
9300
9301 : see if mktime exists
9302 set mktime d_mktime
9303 eval $inlibc
9304
9305 : see if msgctl exists
9306 set msgctl d_msgctl
9307 eval $inlibc
9308
9309 : see if msgget exists
9310 set msgget d_msgget
9311 eval $inlibc
9312
9313 : see if msgsnd exists
9314 set msgsnd d_msgsnd
9315 eval $inlibc
9316
9317 : see if msgrcv exists
9318 set msgrcv d_msgrcv
9319 eval $inlibc
9320
9321 : see how much of the 'msg*(2)' library is present.
9322 h_msg=true
9323 echo " "
9324 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9325 *"$undef"*) h_msg=false;;
9326 esac
9327 case "$osname" in
9328 freebsd)
9329     case "`ipcs 2>&1`" in
9330     "SVID messages"*"not configured"*)
9331         echo "Your $osname does not have the msg*(2) configured." >&4
9332         h_msg=false
9333         val="$undef"
9334         set msgctl d_msgctl
9335         eval $setvar
9336         set msgget d_msgget
9337         eval $setvar
9338         set msgsnd d_msgsnd
9339         eval $setvar
9340         set msgrcv d_msgrcv
9341         eval $setvar
9342         ;;
9343     esac
9344     ;;
9345 esac
9346 : we could also check for sys/ipc.h ...
9347 if $h_msg && $test `./findhdr sys/msg.h`; then
9348         echo "You have the full msg*(2) library." >&4
9349         val="$define"
9350 else
9351         echo "You don't have the full msg*(2) library." >&4
9352         val="$undef"
9353 fi
9354 set d_msg
9355 eval $setvar
9356
9357 : see if nice exists
9358 set nice d_nice
9359 eval $inlibc
9360
9361 : see if POSIX threads are available
9362 set pthread.h i_pthread
9363 eval $inhdr
9364
9365
9366
9367
9368 : how to create joinable pthreads
9369 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9370         echo " "
9371         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9372         $cat >try.c <<'EOCP'
9373 #include <pthread.h>
9374 int main() {
9375     int detachstate = JOINABLE;
9376 }
9377 EOCP
9378         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9379         if eval $compile; then
9380                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9381                 val="$undef" # Yes, undef.
9382                 set d_old_pthread_create_joinable
9383                 eval $setvar
9384                 val=""
9385                 set old_pthread_create_joinable
9386                 eval $setvar
9387         else
9388                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9389                 if eval $compile; then
9390                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9391                         val="$define"
9392                         set d_old_pthread_create_joinable
9393                         eval $setvar
9394                         val=PTHREAD_CREATE_UNDETACHED
9395                         set old_pthread_create_joinable
9396                         eval $setvar
9397                 else            
9398                         set try -DJOINABLE=__UNDETACHED
9399                         if eval $compile; then
9400                                 echo "You seem to use __UNDETACHED." >&4
9401                                 val="$define"
9402                                 set d_old_pthread_create_joinable
9403                                 eval $setvar
9404                                 val=__UNDETACHED
9405                                 set old_pthread_create_joinable
9406                                 eval $setvar
9407                         else
9408                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9409                                 val="$define"
9410                                 set d_old_pthread_create_joinable
9411                                 eval $setvar
9412                                 val=0
9413                                 set old_pthread_create_joinable
9414                                 eval $setvar
9415                         fi
9416                 fi
9417         fi
9418         $rm -f try try.*
9419 else
9420     d_old_pthread_create_joinable="$undef"
9421     old_pthread_create_joinable=""
9422 fi
9423
9424 : see if pause exists
9425 set pause d_pause
9426 eval $inlibc
9427
9428 : see if pipe exists
9429 set pipe d_pipe
9430 eval $inlibc
9431
9432 : see if poll exists
9433 set poll d_poll
9434 eval $inlibc
9435
9436
9437 : see whether the various POSIXish _yields exist
9438 $cat >try.c <<EOP
9439 #include <pthread.h>
9440 #include <stdio.h>
9441 int main() {
9442 #ifdef SCHED_YIELD
9443         sched_yield();
9444 #else
9445 #ifdef PTHREAD_YIELD
9446         pthread_yield();
9447 #else
9448 #ifdef PTHREAD_YIELD_NULL
9449         pthread_yield(NULL);
9450 #endif
9451 #endif
9452 #endif
9453 }
9454 EOP
9455 : see if sched_yield exists
9456 set try -DSCHED_YIELD
9457 if eval $compile; then
9458     val="$define"
9459     sched_yield='sched_yield()'
9460 else
9461     val="$undef"
9462 fi
9463 case "$usethreads" in
9464 $define)
9465         case "$val" in
9466         $define) echo 'sched_yield() found.' >&4        ;;
9467         *)       echo 'sched_yield() NOT found.' >&4    ;;
9468         esac
9469 esac
9470 set d_sched_yield
9471 eval $setvar
9472
9473 : see if pthread_yield exists
9474 set try -DPTHREAD_YIELD
9475 if eval $compile; then
9476     val="$define"
9477     case "$sched_yield" in
9478     '') sched_yield='pthread_yield()' ;;
9479     esac
9480 else
9481     set try -DPTHREAD_YIELD_NULL
9482     if eval $compile; then
9483         val="$define"
9484         case "$sched_yield" in
9485         '') sched_yield='pthread_yield(NULL)' ;;
9486         esac
9487     else
9488         val="$undef"
9489     fi
9490 fi
9491 case "$usethreads" in
9492 $define)
9493         case "$val" in
9494         $define) echo 'pthread_yield() found.' >&4      ;;
9495         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9496         esac
9497         ;;
9498 esac
9499 set d_pthread_yield
9500 eval $setvar
9501
9502 case "$sched_yield" in
9503 '') sched_yield=undef ;;
9504 esac
9505
9506 $rm -f try try.*
9507
9508 : see if this is a pwd.h system
9509 set pwd.h i_pwd
9510 eval $inhdr
9511
9512 case "$i_pwd" in
9513 $define)
9514         xxx=`./findhdr pwd.h`
9515         $cppstdin $cppflags $cppminus < $xxx >$$.h
9516
9517         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9518                 val="$define"
9519         else
9520                 val="$undef"
9521         fi
9522         set d_pwquota
9523         eval $setvar
9524
9525         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9526                 val="$define"
9527         else
9528                 val="$undef"
9529         fi
9530         set d_pwage
9531         eval $setvar
9532
9533         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9534                 val="$define"
9535         else
9536                 val="$undef"
9537         fi
9538         set d_pwchange
9539         eval $setvar
9540
9541         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9542                 val="$define"
9543         else
9544                 val="$undef"
9545         fi
9546         set d_pwclass
9547         eval $setvar
9548
9549         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9550                 val="$define"
9551         else
9552                 val="$undef"
9553         fi
9554         set d_pwexpire
9555         eval $setvar
9556
9557         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9558                 val="$define"
9559         else
9560                 val="$undef"
9561         fi
9562         set d_pwcomment
9563         eval $setvar
9564
9565         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9566                 val="$define"
9567         else
9568                 val="$undef"
9569         fi
9570         set d_pwgecos
9571         eval $setvar
9572
9573         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9574                 val="$define"
9575         else
9576                 val="$undef"
9577         fi
9578         set d_pwpasswd
9579         eval $setvar
9580
9581         $rm -f $$.h
9582         ;;
9583 *)
9584         val="$undef"; 
9585         set d_pwquota; eval $setvar
9586         set d_pwage; eval $setvar
9587         set d_pwchange; eval $setvar
9588         set d_pwclass; eval $setvar
9589         set d_pwexpire; eval $setvar
9590         set d_pwcomment; eval $setvar
9591         set d_pwgecos; eval $setvar
9592         set d_pwpasswd; eval $setvar
9593         ;;
9594 esac
9595
9596 : see if readdir and friends exist
9597 set readdir d_readdir
9598 eval $inlibc
9599 set seekdir d_seekdir
9600 eval $inlibc
9601 set telldir d_telldir
9602 eval $inlibc
9603 set rewinddir d_rewinddir
9604 eval $inlibc
9605
9606 : see if readlink exists
9607 set readlink d_readlink
9608 eval $inlibc
9609
9610 : see if rename exists
9611 set rename d_rename
9612 eval $inlibc
9613
9614 : see if rmdir exists
9615 set rmdir d_rmdir
9616 eval $inlibc
9617
9618 : see if memory.h is available.
9619 val=''
9620 set memory.h val
9621 eval $inhdr
9622
9623 : See if it conflicts with string.h
9624 case "$val" in
9625 $define)
9626         case "$strings" in
9627         '') ;;
9628         *)
9629                 $cppstdin $cppflags $cppminus < $strings > mem.h
9630                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9631                         echo " "
9632                         echo "We won't be including <memory.h>."
9633                         val="$undef"
9634                 fi
9635                 $rm -f mem.h
9636                 ;;
9637         esac
9638 esac
9639 set i_memory
9640 eval $setvar
9641
9642 : can bcopy handle overlapping blocks?
9643 val="$undef"
9644 case "$d_bcopy" in
9645 "$define")
9646         echo " "
9647         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9648         $cat >try.c <<EOCP
9649 #$i_memory I_MEMORY
9650 #$i_stdlib I_STDLIB
9651 #$i_string I_STRING
9652 #$i_unistd I_UNISTD
9653 EOCP
9654         $cat >>try.c <<'EOCP'
9655 #include <stdio.h>
9656 #ifdef I_MEMORY
9657 #  include <memory.h>
9658 #endif
9659 #ifdef I_STDLIB
9660 #  include <stdlib.h>
9661 #endif
9662 #ifdef I_STRING
9663 #  include <string.h>
9664 #else
9665 #  include <strings.h>
9666 #endif
9667 #ifdef I_UNISTD
9668 #  include <unistd.h>  /* Needed for NetBSD */
9669 #endif
9670 int main()
9671 {
9672 char buf[128], abc[128];
9673 char *b;
9674 int len;
9675 int off;
9676 int align;
9677
9678 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9679
9680 for (align = 7; align >= 0; align--) {
9681         for (len = 36; len; len--) {
9682                 b = buf+align;
9683                 bcopy(abc, b, len);
9684                 for (off = 1; off <= len; off++) {
9685                         bcopy(b, b+off, len);
9686                         bcopy(b+off, b, len);
9687                         if (bcmp(b, abc, len))
9688                                 exit(1);
9689                 }
9690         }
9691 }
9692 exit(0);
9693 }
9694 EOCP
9695         set try
9696         if eval $compile_ok; then
9697                 if ./try 2>/dev/null; then
9698                         echo "Yes, it can."
9699                         val="$define"
9700                 else
9701                         echo "It can't, sorry."
9702                         case "$d_memmove" in
9703                         "$define") echo "But that's Ok since you have memmove()." ;;
9704                         esac
9705                 fi
9706         else
9707                 echo "(I can't compile the test program, so we'll assume not...)"
9708                 case "$d_memmove" in
9709                 "$define") echo "But that's Ok since you have memmove()." ;;
9710                 esac
9711         fi
9712         ;;
9713 esac
9714 $rm -f try.* try core
9715 set d_safebcpy
9716 eval $setvar
9717
9718 : can memcpy handle overlapping blocks?
9719 val="$undef"
9720 case "$d_memcpy" in
9721 "$define")
9722         echo " "
9723         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9724         $cat >try.c <<EOCP
9725 #$i_memory I_MEMORY
9726 #$i_stdlib I_STDLIB
9727 #$i_string I_STRING
9728 #$i_unistd I_UNISTD
9729 EOCP
9730         $cat >>try.c <<'EOCP'
9731 #include <stdio.h>
9732 #ifdef I_MEMORY
9733 #  include <memory.h>
9734 #endif
9735 #ifdef I_STDLIB
9736 #  include <stdlib.h>
9737 #endif
9738 #ifdef I_STRING
9739 #  include <string.h>
9740 #else
9741 #  include <strings.h>
9742 #endif
9743 #ifdef I_UNISTD
9744 #  include <unistd.h>  /* Needed for NetBSD */
9745 #endif
9746 int main()
9747 {
9748 char buf[128], abc[128];
9749 char *b;
9750 int len;
9751 int off;
9752 int align;
9753
9754 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9755    try to store the string in read-only memory. */
9756 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9757
9758 for (align = 7; align >= 0; align--) {
9759         for (len = 36; len; len--) {
9760                 b = buf+align;
9761                 memcpy(b, abc, len);
9762                 for (off = 1; off <= len; off++) {
9763                         memcpy(b+off, b, len);
9764                         memcpy(b, b+off, len);
9765                         if (memcmp(b, abc, len))
9766                                 exit(1);
9767                 }
9768         }
9769 }
9770 exit(0);
9771 }
9772 EOCP
9773         set try
9774         if eval $compile_ok; then
9775                 if ./try 2>/dev/null; then
9776                         echo "Yes, it can."
9777                         val="$define"
9778                 else
9779                         echo "It can't, sorry."
9780                         case "$d_memmove" in
9781                         "$define") echo "But that's Ok since you have memmove()." ;;
9782                         esac
9783                 fi
9784         else
9785                 echo "(I can't compile the test program, so we'll assume not...)"
9786                 case "$d_memmove" in
9787                 "$define") echo "But that's Ok since you have memmove()." ;;
9788                 esac
9789         fi
9790         ;;
9791 esac
9792 $rm -f try.* try core
9793 set d_safemcpy
9794 eval $setvar
9795
9796 : can memcmp be trusted to compare relative magnitude?
9797 val="$undef"
9798 case "$d_memcmp" in
9799 "$define")
9800         echo " "
9801         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9802         $cat >try.c <<EOCP
9803 #$i_memory I_MEMORY
9804 #$i_stdlib I_STDLIB
9805 #$i_string I_STRING
9806 #$i_unistd I_UNISTD
9807 EOCP
9808         $cat >>try.c <<'EOCP'
9809 #include <stdio.h>
9810 #ifdef I_MEMORY
9811 #  include <memory.h>
9812 #endif
9813 #ifdef I_STDLIB
9814 #  include <stdlib.h>
9815 #endif
9816 #ifdef I_STRING
9817 #  include <string.h>
9818 #else
9819 #  include <strings.h>
9820 #endif
9821 #ifdef I_UNISTD
9822 #  include <unistd.h>  /* Needed for NetBSD */
9823 #endif
9824 int main()
9825 {
9826 char a = -1;
9827 char b = 0;
9828 if ((a < b) && memcmp(&a, &b, 1) < 0)
9829         exit(1);
9830 exit(0);
9831 }
9832 EOCP
9833         set try
9834         if eval $compile_ok; then
9835                 if ./try 2>/dev/null; then
9836                         echo "Yes, it can."
9837                         val="$define"
9838                 else
9839                         echo "No, it can't (it uses signed chars)."
9840                 fi
9841         else
9842                 echo "(I can't compile the test program, so we'll assume not...)"
9843         fi
9844         ;;
9845 esac
9846 $rm -f try.* try core
9847 set d_sanemcmp
9848 eval $setvar
9849
9850 : see if select exists
9851 set select d_select
9852 eval $inlibc
9853
9854 : see if semctl exists
9855 set semctl d_semctl
9856 eval $inlibc
9857
9858 : see if semget exists
9859 set semget d_semget
9860 eval $inlibc
9861
9862 : see if semop exists
9863 set semop d_semop
9864 eval $inlibc
9865
9866 : see how much of the 'sem*(2)' library is present.
9867 h_sem=true
9868 echo " "
9869 case "$d_semctl$d_semget$d_semop" in
9870 *"$undef"*) h_sem=false;;
9871 esac
9872 case "$osname" in
9873 freebsd)
9874     case "`ipcs 2>&1`" in
9875     "SVID messages"*"not configured"*)
9876         echo "Your $osname does not have the sem*(2) configured." >&4
9877         h_sem=false
9878         val="$undef"
9879         set semctl d_semctl
9880         eval $setvar
9881         set semget d_semget
9882         eval $setvar
9883         set semop d_semop
9884         eval $setvar
9885         ;;
9886     esac
9887     ;;
9888 esac
9889 : we could also check for sys/ipc.h ...
9890 if $h_sem && $test `./findhdr sys/sem.h`; then
9891         echo "You have the full sem*(2) library." >&4
9892         val="$define"
9893 else
9894         echo "You don't have the full sem*(2) library." >&4
9895         val="$undef"
9896 fi
9897 set d_sem
9898 eval $setvar
9899
9900 : see whether sys/sem.h defines union semun
9901 echo " "
9902 $cat > try.c <<'END'
9903 #include <sys/types.h>
9904 #include <sys/ipc.h>
9905 #include <sys/sem.h>
9906 int main () { union semun semun; semun.buf = 0; }
9907 END
9908 set try
9909 if eval $compile; then
9910     echo "You have union semun in <sys/sem.h>." >&4
9911     val="$define"
9912 else
9913     echo "You do not have union semun in <sys/sem.h>." >&4
9914     val="$undef"
9915 fi
9916 $rm -f try try.c try.h
9917 set d_union_semun
9918 eval $setvar
9919
9920 : see how to do semctl IPC_STAT
9921 case "$d_sem" in
9922 $define)
9923     : see whether semctl IPC_STAT can use union semun
9924     echo " "
9925     $cat > try.h <<END
9926 #ifndef S_IRUSR
9927 #   ifdef S_IREAD
9928 #       define S_IRUSR S_IREAD
9929 #       define S_IWUSR S_IWRITE
9930 #       define S_IXUSR S_IEXEC
9931 #   else
9932 #       define S_IRUSR 0400
9933 #       define S_IWUSR 0200
9934 #       define S_IXUSR 0100
9935 #   endif
9936 #   define S_IRGRP (S_IRUSR>>3)
9937 #   define S_IWGRP (S_IWUSR>>3)
9938 #   define S_IXGRP (S_IXUSR>>3)
9939 #   define S_IROTH (S_IRUSR>>6)
9940 #   define S_IWOTH (S_IWUSR>>6)
9941 #   define S_IXOTH (S_IXUSR>>6)
9942 #endif
9943 #ifndef S_IRWXU
9944 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9945 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9946 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9947 #endif
9948 END
9949
9950     $cat > try.c <<END
9951 #include <sys/types.h>
9952 #include <sys/ipc.h>
9953 #include <sys/sem.h>
9954 #include <sys/stat.h>
9955 #include <stdio.h>
9956 #include <errno.h>
9957 #include "try.h"
9958 #ifndef errno
9959 extern int errno;
9960 #endif
9961 #$d_union_semun HAS_UNION_SEMUN
9962 int main() {
9963     union semun
9964 #ifndef HAS_UNION_SEMUN
9965     {
9966         int val;
9967         struct semid_ds *buf;
9968         unsigned short *array;
9969     }
9970 #endif
9971     arg;
9972     int sem, st;
9973
9974 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9975     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9976     if (sem > -1) {
9977         struct semid_ds argbuf;
9978         arg.buf = &argbuf;
9979 #       ifdef IPC_STAT
9980         st = semctl(sem, 0, IPC_STAT, arg);
9981         if (st == 0)
9982             printf("semun\n");
9983         else
9984 #       endif /* IPC_STAT */
9985             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9986 #       ifdef IPC_RMID
9987         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9988 #       endif /* IPC_RMID */
9989             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9990     } else
9991 #endif /* IPC_PRIVATE && ... */
9992         printf("semget failed: errno = %d\n", errno);
9993   return 0;
9994 }
9995 END
9996     val="$undef"
9997     set try
9998     if eval $compile; then
9999         xxx=`./try`
10000         case "$xxx" in
10001         semun) val="$define" ;;
10002         esac
10003     fi
10004     $rm -f try try.c
10005     set d_semctl_semun
10006     eval $setvar
10007     case "$d_semctl_semun" in
10008     $define)
10009         echo "You can use union semun for semctl IPC_STAT." >&4
10010         also='also'
10011         ;;
10012     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10013         also=''
10014         ;;
10015     esac
10016
10017     : see whether semctl IPC_STAT can use struct semid_ds pointer
10018     $cat > try.c <<'END'
10019 #include <sys/types.h>
10020 #include <sys/ipc.h>
10021 #include <sys/sem.h>
10022 #include <sys/stat.h>
10023 #include "try.h"
10024 #include <stdio.h>
10025 #include <errno.h>
10026 #ifndef errno
10027 extern int errno;
10028 #endif
10029 int main() {
10030     struct semid_ds arg;
10031     int sem, st;
10032
10033 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10034     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10035     if (sem > -1) {
10036 #       ifdef IPC_STAT
10037         st = semctl(sem, 0, IPC_STAT, &arg);
10038         if (st == 0)
10039             printf("semid_ds\n");
10040         else
10041 #       endif /* IPC_STAT */
10042             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10043 #       ifdef IPC_RMID
10044         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10045 #       endif /* IPC_RMID */
10046             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10047     } else
10048 #endif /* IPC_PRIVATE && ... */
10049         printf("semget failed: errno = %d\n", errno);
10050
10051     return 0;
10052 }
10053 END
10054     val="$undef"
10055     set try
10056     if eval $compile; then
10057         xxx=`./try`
10058         case "$xxx" in
10059         semid_ds) val="$define" ;;
10060         esac
10061     fi
10062     $rm -f try try.c
10063     set d_semctl_semid_ds
10064     eval $setvar
10065     case "$d_semctl_semid_ds" in
10066     $define)
10067         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10068         ;;
10069     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10070         ;;
10071     esac
10072     $rm -f try.h
10073     ;;
10074 *)  val="$undef"
10075
10076     # We do not have the full sem*(2) library, so assume we can not
10077     # use either.
10078
10079     set d_semctl_semun
10080     eval $setvar
10081
10082     set d_semctl_semid_ds
10083     eval $setvar
10084     ;;
10085 esac
10086
10087 : see if setegid exists
10088 set setegid d_setegid
10089 eval $inlibc
10090
10091 : see if seteuid exists
10092 set seteuid d_seteuid
10093 eval $inlibc
10094
10095 : see if setgrent exists
10096 set setgrent d_setgrent
10097 eval $inlibc
10098
10099 : see if sethostent exists
10100 set sethostent d_sethent
10101 eval $inlibc
10102
10103 : see if setlinebuf exists
10104 set setlinebuf d_setlinebuf
10105 eval $inlibc
10106
10107 : see if setlocale exists
10108 set setlocale d_setlocale
10109 eval $inlibc
10110
10111 : see if setnetent exists
10112 set setnetent d_setnent
10113 eval $inlibc
10114
10115 : see if setprotoent exists
10116 set setprotoent d_setpent
10117 eval $inlibc
10118
10119 : see if setpgid exists
10120 set setpgid d_setpgid
10121 eval $inlibc
10122
10123 : see if setpgrp2 exists
10124 set setpgrp2 d_setpgrp2
10125 eval $inlibc
10126
10127 : see if setpriority exists
10128 set setpriority d_setprior
10129 eval $inlibc
10130
10131 : see if setpwent exists
10132 set setpwent d_setpwent
10133 eval $inlibc
10134
10135 : see if setregid exists
10136 set setregid d_setregid
10137 eval $inlibc
10138 set setresgid d_setresgid
10139 eval $inlibc
10140
10141 : see if setreuid exists
10142 set setreuid d_setreuid
10143 eval $inlibc
10144 set setresuid d_setresuid
10145 eval $inlibc
10146
10147 : see if setrgid exists
10148 set setrgid d_setrgid
10149 eval $inlibc
10150
10151 : see if setruid exists
10152 set setruid d_setruid
10153 eval $inlibc
10154
10155 : see if setservent exists
10156 set setservent d_setsent
10157 eval $inlibc
10158
10159 : see if setsid exists
10160 set setsid d_setsid
10161 eval $inlibc
10162
10163 : see if setspent exists
10164 set setspent d_setspent
10165 eval $inlibc
10166
10167 : see if setvbuf exists
10168 set setvbuf d_setvbuf
10169 eval $inlibc
10170
10171 : see if sfio.h is available
10172 set sfio.h i_sfio
10173 eval $inhdr
10174
10175
10176 : see if sfio library is available
10177 case "$i_sfio" in
10178 $define)
10179         val=''
10180         set sfreserve val
10181         eval $inlibc
10182         ;;
10183 *)
10184         val="$undef"
10185         ;;
10186 esac
10187 : Ok, but do we want to use it.
10188 case "$val" in
10189 $define)
10190         case "$usesfio" in
10191         true|$define|[yY]*) dflt='y';;
10192         *) dflt='n';;
10193         esac
10194         echo "$package can use the sfio library, but it is experimental."
10195         rp="You seem to have sfio available, do you want to try using it?"
10196         . ./myread
10197         case "$ans" in
10198         y|Y) ;;
10199         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10200                 val="$undef"
10201                 : Remove sfio from list of libraries to use
10202                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10203                 shift
10204                 libs="$*"
10205                 echo "libs = $libs" >&4
10206                 ;;
10207         esac
10208         ;;
10209 *)      case "$usesfio" in
10210         true|$define|[yY]*)
10211                 echo "Sorry, cannot find sfio on this machine" >&4
10212                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10213                 ;;
10214         esac
10215         ;;
10216 esac
10217 set d_sfio
10218 eval $setvar
10219 case "$d_sfio" in
10220 $define) usesfio='true';;
10221 *) usesfio='false';;
10222 esac
10223
10224 : see if shmctl exists
10225 set shmctl d_shmctl
10226 eval $inlibc
10227
10228 : see if shmget exists
10229 set shmget d_shmget
10230 eval $inlibc
10231
10232 : see if shmat exists
10233 set shmat d_shmat
10234 eval $inlibc
10235 : see what shmat returns
10236 case "$d_shmat" in
10237 "$define")
10238         $cat >shmat.c <<'END'
10239 #include <sys/shm.h>
10240 void *shmat();
10241 END
10242         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10243                 shmattype='void *'
10244         else
10245                 shmattype='char *'
10246         fi
10247         echo "and it returns ($shmattype)." >&4
10248         : see if a prototype for shmat is available
10249         xxx=`./findhdr sys/shm.h`
10250         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10251         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10252                 val="$define"
10253         else
10254                 val="$undef"
10255         fi
10256         $rm -f shmat.[co]
10257         ;;
10258 *)
10259         val="$undef"
10260         ;;
10261 esac
10262 set d_shmatprototype
10263 eval $setvar
10264
10265 : see if shmdt exists
10266 set shmdt d_shmdt
10267 eval $inlibc
10268
10269 : see how much of the 'shm*(2)' library is present.
10270 h_shm=true
10271 echo " "
10272 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10273 *"$undef"*) h_shm=false;;
10274 esac
10275 case "$osname" in
10276 freebsd)
10277     case "`ipcs 2>&1`" in
10278     "SVID shared memory"*"not configured"*)
10279         echo "Your $osname does not have the shm*(2) configured." >&4
10280         h_shm=false
10281         val="$undef"
10282         set shmctl d_shmctl
10283         evat $setvar
10284         set shmget d_shmget
10285         evat $setvar
10286         set shmat d_shmat
10287         evat $setvar
10288         set shmdt d_shmdt
10289         evat $setvar
10290         ;;
10291     esac
10292     ;;
10293 esac
10294 : we could also check for sys/ipc.h ...
10295 if $h_shm && $test `./findhdr sys/shm.h`; then
10296         echo "You have the full shm*(2) library." >&4
10297         val="$define"
10298 else
10299         echo "You don't have the full shm*(2) library." >&4
10300         val="$undef"
10301 fi
10302 set d_shm
10303 eval $setvar
10304
10305 echo " "
10306 : see if we have sigaction
10307 if set sigaction val -f d_sigaction; eval $csym; $val; then
10308         echo 'sigaction() found.' >&4
10309         $cat > try.c <<'EOP'
10310 #include <stdio.h>
10311 #include <sys/types.h>
10312 #include <signal.h>
10313 int main()
10314 {
10315     struct sigaction act, oact;
10316     act.sa_flags = 0;
10317     oact.sa_handler = 0;
10318 }
10319 EOP
10320         set try
10321         if eval $compile_ok; then
10322                 val="$define"
10323         else
10324                 echo "But you don't seem to have a useable struct sigaction." >&4
10325                 val="$undef"
10326         fi
10327 else
10328         echo 'sigaction NOT found.' >&4
10329         val="$undef"
10330 fi
10331 set d_sigaction; eval $setvar
10332 $rm -f try try$_o try.c
10333
10334 : see if sigsetjmp exists
10335 echo " "
10336 case "$d_sigsetjmp" in
10337 '')
10338         $cat >try.c <<'EOP'
10339 #include <setjmp.h>
10340 sigjmp_buf env;
10341 int set = 1;
10342 int main()
10343 {
10344         if (sigsetjmp(env,1))
10345                 exit(set);
10346         set = 0;
10347         siglongjmp(env, 1);
10348         exit(1);
10349 }
10350 EOP
10351         set try
10352         if eval $compile; then
10353                 if ./try >/dev/null 2>&1; then
10354                         echo "POSIX sigsetjmp found." >&4
10355                         val="$define"
10356                 else
10357                         $cat >&4 <<EOM
10358 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10359 I'll ignore them.
10360 EOM
10361                         val="$undef"
10362                 fi
10363         else
10364                 echo "sigsetjmp not found." >&4
10365                 val="$undef"
10366         fi
10367         ;;
10368 *) val="$d_sigsetjmp"
10369         case "$d_sigsetjmp" in
10370         $define) echo "POSIX sigsetjmp found." >&4;;
10371         $undef) echo "sigsetjmp not found." >&4;;
10372         esac
10373         ;;
10374 esac
10375 set d_sigsetjmp
10376 eval $setvar
10377 $rm -f try.c try
10378
10379 : see if sqrtl exists
10380 set sqrtl d_sqrtl
10381 eval $inlibc
10382
10383 : see if sys/stat.h is available
10384 set sys/stat.h i_sysstat
10385 eval $inhdr
10386
10387
10388 : see if stat knows about block sizes
10389 echo " "
10390 echo "Checking to see if your struct stat has st_blocks field..." >&4
10391 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10392 eval $hasfield
10393
10394
10395 : see if this is a sys/vfs.h system
10396 set sys/vfs.h i_sysvfs
10397 eval $inhdr
10398
10399
10400 : see if this is a sys/statfs.h system
10401 set sys/statfs.h i_sysstatfs
10402 eval $inhdr
10403
10404
10405 echo " "
10406 $echo $n "Checking to see if your system supports struct statfs..." $c >&4
10407 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
10408 eval $hasstruct
10409 case "$d_statfs_s" in
10410 "$define")      echo "Yup, it does."     >&4 ;;
10411 *)              echo "Nope, it doesn't." >&4 ;;
10412 esac
10413
10414
10415
10416 : see if struct statfs knows about f_flags
10417 case "$d_statfs_s" in
10418 define) 
10419         echo " "
10420         $echo $n "Checking to see if your struct statfs has f_flags field..." $c >&4
10421         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
10422         eval $hasfield
10423         ;;
10424 *)      val="$undef"
10425         set d_statfs_f_flags
10426         eval $setvar
10427         ;;
10428 esac
10429 case "$d_statfs_f_flags" in
10430 "$define")      echo "Yup, it does."     >&4 ;;
10431 *)              echo "Nope, it doesn't." >&4 ;;
10432 esac
10433
10434 : see if _ptr and _cnt from stdio act std
10435 echo " "
10436 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10437         echo "(Looks like you have stdio.h from Linux.)"
10438         case "$stdio_ptr" in
10439         '') stdio_ptr='((fp)->_IO_read_ptr)'
10440                 ptr_lval=$define
10441                 ;;
10442         *)      ptr_lval=$d_stdio_ptr_lval;;
10443         esac
10444         case "$stdio_cnt" in
10445         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10446                 cnt_lval=$undef
10447                 ;;
10448         *)      cnt_lval=$d_stdio_cnt_lval;;
10449         esac
10450         case "$stdio_base" in
10451         '') stdio_base='((fp)->_IO_read_base)';;
10452         esac
10453         case "$stdio_bufsiz" in
10454         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10455         esac
10456 else
10457         case "$stdio_ptr" in
10458         '') stdio_ptr='((fp)->_ptr)'
10459                 ptr_lval=$define
10460                 ;;
10461         *)      ptr_lval=$d_stdio_ptr_lval;;
10462         esac
10463         case "$stdio_cnt" in
10464         '') stdio_cnt='((fp)->_cnt)'
10465                 cnt_lval=$define
10466                 ;;
10467         *)      cnt_lval=$d_stdio_cnt_lval;;
10468         esac
10469         case "$stdio_base" in
10470         '') stdio_base='((fp)->_base)';;
10471         esac
10472         case "$stdio_bufsiz" in
10473         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10474         esac
10475 fi
10476 : test whether _ptr and _cnt really work
10477 echo "Checking how std your stdio is..." >&4
10478 $cat >try.c <<EOP
10479 #include <stdio.h>
10480 #define FILE_ptr(fp)    $stdio_ptr
10481 #define FILE_cnt(fp)    $stdio_cnt
10482 int main() {
10483         FILE *fp = fopen("try.c", "r");
10484         char c = getc(fp);
10485         if (
10486                 18 <= FILE_cnt(fp) &&
10487                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10488         )
10489                 exit(0);
10490         exit(1);
10491 }
10492 EOP
10493 val="$undef"
10494 set try
10495 if eval $compile; then
10496         if ./try; then
10497                 echo "Your stdio acts pretty std."
10498                 val="$define"
10499         else
10500                 echo "Your stdio isn't very std."
10501         fi
10502 else
10503         echo "Your stdio doesn't appear very std."
10504 fi
10505 $rm -f try.c try
10506 set d_stdstdio
10507 eval $setvar
10508
10509 : Can _ptr be used as an lvalue?
10510 case "$d_stdstdio$ptr_lval" in
10511 $define$define) val=$define ;;
10512 *) val=$undef ;;
10513 esac
10514 set d_stdio_ptr_lval
10515 eval $setvar
10516
10517 : Can _cnt be used as an lvalue?
10518 case "$d_stdstdio$cnt_lval" in
10519 $define$define) val=$define ;;
10520 *) val=$undef ;;
10521 esac
10522 set d_stdio_cnt_lval
10523 eval $setvar
10524
10525 : see if _base is also standard
10526 val="$undef"
10527 case "$d_stdstdio" in
10528 $define)
10529         $cat >try.c <<EOP
10530 #include <stdio.h>
10531 #define FILE_base(fp)   $stdio_base
10532 #define FILE_bufsiz(fp) $stdio_bufsiz
10533 int main() {
10534         FILE *fp = fopen("try.c", "r");
10535         char c = getc(fp);
10536         if (
10537                 19 <= FILE_bufsiz(fp) &&
10538                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10539         )
10540                 exit(0);
10541         exit(1);
10542 }
10543 EOP
10544         set try
10545         if eval $compile; then
10546                 if ./try; then
10547                         echo "And its _base field acts std."
10548                         val="$define"
10549                 else
10550                         echo "But its _base field isn't std."
10551                 fi
10552         else
10553                 echo "However, it seems to be lacking the _base field."
10554         fi
10555         $rm -f try.c try
10556         ;;
10557 esac
10558 set d_stdiobase
10559 eval $setvar
10560
10561 $cat >&4 <<EOM
10562 Checking how to access stdio streams by file descriptor number...
10563 EOM
10564 case "$stdio_stream_array" in
10565 '')     $cat >try.c <<EOCP
10566 #include <stdio.h>
10567 int main() {
10568   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10569     printf("yes\n");
10570 }
10571 EOCP
10572         for s in _iob __iob __sF
10573         do
10574                 set try -DSTDIO_STREAM_ARRAY=$s
10575                 if eval $compile; then
10576                         case "`./try$exe_ext`" in
10577                         yes)    stdio_stream_array=$s; break ;;
10578                         esac
10579                 fi
10580         done
10581         $rm -f try.* try$exe_ext
10582 esac
10583 case "$stdio_stream_array" in
10584 '')     $cat >&4 <<EOM
10585 I can't figure out how to access stdio streams by file descriptor number.
10586 EOM
10587         d_stdio_stream_array="$undef"
10588         ;;
10589 *)      $cat >&4 <<EOM
10590 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10591 EOM
10592         d_stdio_stream_array="$define"
10593         ;;
10594 esac
10595
10596 : see if strcoll exists
10597 set strcoll d_strcoll
10598 eval $inlibc
10599
10600 : check for structure copying
10601 echo " "
10602 echo "Checking to see if your C compiler can copy structs..." >&4
10603 $cat >try.c <<'EOCP'
10604 int main()
10605 {
10606         struct blurfl {
10607                 int dyick;
10608         } foo, bar;
10609
10610         foo = bar;
10611 }
10612 EOCP
10613 if $cc -c try.c >/dev/null 2>&1 ; then
10614         val="$define"
10615         echo "Yup, it can."
10616 else
10617         val="$undef"
10618         echo "Nope, it can't."
10619 fi
10620 set d_strctcpy
10621 eval $setvar
10622 $rm -f try.*
10623
10624 : see if strerror and/or sys_errlist[] exist
10625 echo " "
10626 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10627     if set strerror val -f d_strerror; eval $csym; $val; then
10628                 echo 'strerror() found.' >&4
10629                 d_strerror="$define"
10630                 d_strerrm='strerror(e)'
10631                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10632                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10633                         d_syserrlst="$define"
10634                 else
10635                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10636                         d_syserrlst="$undef"
10637                 fi
10638     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10639                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10640                 echo 'strerror() found in string header.' >&4
10641                 d_strerror="$define"
10642                 d_strerrm='strerror(e)'
10643                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10644                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10645                                 d_syserrlst="$define"
10646                 else
10647                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10648                         d_syserrlst="$undef"
10649                 fi
10650     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10651                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10652                 d_strerror="$undef"
10653                 d_syserrlst="$define"
10654                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10655     else
10656                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10657                 d_strerror="$undef"
10658                 d_syserrlst="$undef"
10659                 d_strerrm='"unknown"'
10660     fi
10661 fi
10662
10663 : see if strtod exists
10664 set strtod d_strtod
10665 eval $inlibc
10666
10667 : see if strtol exists
10668 set strtol d_strtol
10669 eval $inlibc
10670
10671 : see if strtoul exists
10672 set strtoul d_strtoul
10673 eval $inlibc
10674
10675 : see if strtoull exists
10676 set strtoull d_strtoull
10677 eval $inlibc
10678
10679 : see if strxfrm exists
10680 set strxfrm d_strxfrm
10681 eval $inlibc
10682
10683 : see if symlink exists
10684 set symlink d_symlink
10685 eval $inlibc
10686
10687 : see if syscall exists
10688 set syscall d_syscall
10689 eval $inlibc
10690
10691 : see if sysconf exists
10692 set sysconf d_sysconf
10693 eval $inlibc
10694
10695 : see if system exists
10696 set system d_system
10697 eval $inlibc
10698
10699 : see if tcgetpgrp exists
10700 set tcgetpgrp d_tcgetpgrp
10701 eval $inlibc
10702
10703 : see if tcsetpgrp exists
10704 set tcsetpgrp d_tcsetpgrp
10705 eval $inlibc
10706
10707 : see if prototype for telldir is available
10708 echo " "
10709 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10710 eval $hasproto
10711
10712 : define an is-a-typedef? function
10713 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10714 case "$inclist" in
10715 "") inclist="sys/types.h";;
10716 esac;
10717 eval "varval=\$$var";
10718 case "$varval" in
10719 "")
10720         $rm -f temp.c;
10721         for inc in $inclist; do
10722                 echo "#include <$inc>" >>temp.c;
10723         done;
10724         echo "#ifdef $type" >> temp.c;
10725         echo "printf(\"We have $type\");" >> temp.c;
10726         echo "#endif" >> temp.c;
10727         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10728         if $contains $type temp.E >/dev/null 2>&1; then
10729                 eval "$var=\$type";
10730         else
10731                 eval "$var=\$def";
10732         fi;
10733         $rm -f temp.?;;
10734 *) eval "$var=\$varval";;
10735 esac'
10736
10737 : define an is-a-typedef? function that prompts if the type is not available.
10738 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10739 case "$inclist" in
10740 "") inclist="sys/types.h";;
10741 esac;
10742 eval "varval=\$$var";
10743 case "$varval" in
10744 "")
10745         $rm -f temp.c;
10746         for inc in $inclist; do
10747                 echo "#include <$inc>" >>temp.c;
10748         done;
10749         echo "#ifdef $type" >> temp.c;
10750         echo "printf(\"We have $type\");" >> temp.c;
10751         echo "#endif" >> temp.c;
10752         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10753         echo " " ;
10754         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10755         if $contains $type temp.E >/dev/null 2>&1; then
10756                 echo "$type found." >&4;
10757                 eval "$var=\$type";
10758         else
10759                 echo "$type NOT found." >&4;
10760                 dflt="$def";
10761                 . ./myread ;
10762                 eval "$var=\$ans";
10763         fi;
10764         $rm -f temp.?;;
10765 *) eval "$var=\$varval";;
10766 esac'
10767
10768 : see if this is a sys/times.h system
10769 set sys/times.h i_systimes
10770 eval $inhdr
10771
10772 : see if times exists
10773 echo " "
10774 if set times val -f d_times; eval $csym; $val; then
10775         echo 'times() found.' >&4
10776         d_times="$define"
10777         inc=''
10778         case "$i_systimes" in
10779         "$define") inc='sys/times.h';;
10780         esac
10781         rp="What is the type returned by times() on this system?"
10782         set clock_t clocktype long stdio.h sys/types.h $inc
10783         eval $typedef_ask
10784 else
10785         echo 'times() NOT found, hope that will do.' >&4
10786         d_times="$undef"
10787         clocktype='int'
10788 fi
10789
10790 : see if truncate exists
10791 set truncate d_truncate
10792 eval $inlibc
10793
10794 : see if tzname[] exists
10795 echo " "
10796 if set tzname val -a d_tzname; eval $csym; $val; then
10797         val="$define"
10798         echo 'tzname[] found.' >&4
10799 else
10800         val="$undef"
10801         echo 'tzname[] NOT found.' >&4
10802 fi
10803 set d_tzname
10804 eval $setvar
10805
10806 : see if umask exists
10807 set umask d_umask
10808 eval $inlibc
10809
10810 : see if ustat exists
10811 set ustat d_ustat
10812 eval $inlibc
10813
10814 : backward compatibility for d_hvfork
10815 if test X$d_hvfork != X; then
10816         d_vfork="$d_hvfork"
10817         d_hvfork=''
10818 fi
10819 : see if there is a vfork
10820 val=''
10821 set vfork val
10822 eval $inlibc
10823
10824 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10825 : perl on Solaris 2.x, and probably elsewhere.
10826 case "$val" in
10827 $define)
10828         echo " "
10829         case "$usevfork" in
10830         false) dflt='n';;
10831         *) dflt='y';;
10832         esac
10833         cat <<'EOM'
10834  
10835 Perl can only use a vfork() that doesn't suffer from strict
10836 restrictions on calling functions or modifying global data in
10837 the child.  For example, glibc-2.1 contains such a vfork()
10838 that is unsuitable.  If your system provides a proper fork()
10839 call, chances are that you do NOT want perl to use vfork().
10840
10841 EOM
10842         rp="Do you still want to use vfork()?"
10843         . ./myread
10844         case "$ans" in
10845         y|Y) ;;
10846         *)
10847                 echo "Ok, we won't use vfork()."
10848                 val="$undef"
10849                 ;;
10850         esac
10851         ;;
10852 esac
10853 set d_vfork
10854 eval $setvar
10855 case "$d_vfork" in
10856 $define) usevfork='true';;
10857 *) usevfork='false';;
10858 esac
10859
10860 : see if this is an sysdir system
10861 set sys/dir.h i_sysdir
10862 eval $inhdr
10863
10864 : see if this is an sysndir system
10865 set sys/ndir.h i_sysndir
10866 eval $inhdr
10867
10868 : see if closedir exists
10869 set closedir d_closedir
10870 eval $inlibc
10871
10872 case "$d_closedir" in
10873 "$define")
10874         echo " "
10875         echo "Checking whether closedir() returns a status..." >&4
10876         cat > closedir.c <<EOM
10877 #$i_dirent I_DIRENT             /**/
10878 #$i_sysdir I_SYS_DIR            /**/
10879 #$i_sysndir I_SYS_NDIR          /**/
10880 #$i_systypes I_SYS_TYPES        /**/
10881
10882 #if defined(I_SYS_TYPES)
10883 #include <sys/types.h>
10884 #endif
10885 #if defined(I_DIRENT)
10886 #include <dirent.h>
10887 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10888 #include <sys/dir.h>
10889 #endif
10890 #else
10891 #ifdef I_SYS_NDIR
10892 #include <sys/ndir.h>
10893 #else
10894 #ifdef I_SYS_DIR
10895 #ifdef hp9000s500
10896 #include <ndir.h>       /* may be wrong in the future */
10897 #else
10898 #include <sys/dir.h>
10899 #endif
10900 #endif
10901 #endif
10902 #endif 
10903 int main() { return closedir(opendir(".")); }
10904 EOM
10905         set closedir
10906         if eval $compile_ok; then
10907                 if ./closedir > /dev/null 2>&1 ; then
10908                         echo "Yes, it does."
10909                         val="$undef"
10910                 else
10911                         echo "No, it doesn't."
10912                         val="$define"
10913                 fi
10914         else
10915                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10916                 val="$define"
10917         fi
10918         ;;
10919 *)
10920         val="$undef";
10921         ;;
10922 esac
10923 set d_void_closedir
10924 eval $setvar
10925 $rm -f closedir*
10926 : check for volatile keyword
10927 echo " "
10928 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10929 $cat >try.c <<'EOCP'
10930 int main()
10931 {
10932         typedef struct _goo_struct goo_struct;
10933         goo_struct * volatile goo = ((goo_struct *)0);
10934         struct _goo_struct {
10935                 long long_int;
10936                 int reg_int;
10937                 char char_var;
10938         };
10939         typedef unsigned short foo_t;
10940         char *volatile foo;
10941         volatile int bar;
10942         volatile foo_t blech;
10943         foo = foo;
10944 }
10945 EOCP
10946 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10947         val="$define"
10948         echo "Yup, it does."
10949 else
10950         val="$undef"
10951         echo "Nope, it doesn't."
10952 fi
10953 set d_volatile
10954 eval $setvar
10955 $rm -f try.*
10956
10957 : see if there is a wait4
10958 set wait4 d_wait4
10959 eval $inlibc
10960
10961 : see if waitpid exists
10962 set waitpid d_waitpid
10963 eval $inlibc
10964
10965 : see if wcstombs exists
10966 set wcstombs d_wcstombs
10967 eval $inlibc
10968
10969 : see if wctomb exists
10970 set wctomb d_wctomb
10971 eval $inlibc
10972
10973 : preserve RCS keywords in files with variable substitution, grrr
10974 Date='$Date'
10975 Id='$Id'
10976 Log='$Log'
10977 RCSfile='$RCSfile'
10978 Revision='$Revision'
10979
10980 case "$crosscompile" in
10981 ''|[nN]*) crosscompile="$undef" ;;
10982 esac
10983
10984 case "$osname" in
10985 next|rhapsody) multiarch="$define" ;;
10986 esac
10987 case "$multiarch" in
10988 ''|[nN]*) multiarch="$undef" ;;
10989 esac
10990
10991 : check for alignment requirements
10992 echo " "
10993 case "$crosscompile$multiarch" in
10994 *$define*)
10995         $cat <<EOM
10996 You seem to be either cross-compiling or doing a multiarchitecture build,
10997 skipping the memory alignment check.
10998
10999 EOM
11000         case "$alignbytes" in
11001         '') alignbytes=8 ;;
11002         esac
11003         ;;
11004 *)
11005         case "$alignbytes" in
11006         '') echo "Checking alignment constraints..." >&4
11007                 $cat >try.c <<'EOCP'
11008 struct foobar {
11009         char foo;
11010         double bar;
11011 } try_algn;
11012 int main()
11013 {
11014         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
11015 }
11016 EOCP
11017                 set try
11018                 if eval $compile_ok; then
11019                         dflt=`./try`
11020                 else
11021                         dflt='8'
11022                         echo "(I can't seem to compile the test program...)"
11023                 fi
11024                 ;;
11025         *) dflt="$alignbytes"
11026                 ;;
11027         esac
11028         rp="Doubles must be aligned on a how-many-byte boundary?"
11029         . ./myread
11030         alignbytes="$ans"
11031         $rm -f try.c try
11032         ;;
11033 esac
11034
11035
11036 : check for ordering of bytes in a long
11037 echo " "
11038 case "$crosscompile$multiarch" in
11039 *$define*)
11040         $cat <<EOM
11041 You seem to be either cross-compiling or doing a multiarchitecture build,
11042 skipping the byteorder check.
11043
11044 EOM
11045         byteorder='0xffff'
11046         ;;
11047 *)
11048         case "$byteorder" in
11049         '')
11050                 $cat <<'EOM'
11051 In the following, larger digits indicate more significance.  A big-endian
11052 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11053 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11054 machines may have weird orders like 3412.  A Cray will report 87654321,
11055 an Alpha will report 12345678. If the test program works the default is
11056 probably right.
11057 I'm now running the test program...
11058 EOM
11059                 $cat >try.c <<'EOCP'
11060 #include <stdio.h>
11061 int main()
11062 {
11063         int i;
11064         union {
11065                 unsigned long l;
11066                 char c[sizeof(long)];
11067         } u;
11068
11069         if (sizeof(long) > 4)
11070                 u.l = (0x08070605L << 32) | 0x04030201L;
11071         else
11072                 u.l = 0x04030201L;
11073         for (i = 0; i < sizeof(long); i++)
11074                 printf("%c", u.c[i]+'0');
11075         printf("\n");
11076         exit(0);
11077 }
11078 EOCP
11079                 xxx_prompt=y
11080                 set try
11081                 if eval $compile && ./try > /dev/null; then
11082                         dflt=`./try`
11083                         case "$dflt" in
11084                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11085                                 echo "(The test program ran ok.)"
11086                                 echo "byteorder=$dflt"
11087                                 xxx_prompt=n
11088                         ;;
11089                         ????|????????) echo "(The test program ran ok.)" ;;
11090                         *) echo "(The test program didn't run right for some reason.)" ;;
11091                         esac
11092                 else
11093                         dflt='4321'
11094                         cat <<'EOM'
11095 (I can't seem to compile the test program.  Guessing big-endian...)
11096 EOM
11097                 fi
11098                 case "$xxx_prompt" in
11099                 y)
11100                         rp="What is the order of bytes in a long?"
11101                         . ./myread
11102                         byteorder="$ans"
11103                         ;;
11104                 *)      byteorder=$dflt
11105                         ;;
11106                 esac
11107                 ;;
11108         esac
11109         $rm -f try.c try
11110         ;;
11111 esac
11112
11113
11114 : how do we catenate cpp tokens here?
11115 echo " "
11116 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11117 $cat >cpp_stuff.c <<'EOCP'
11118 #define RCAT(a,b)a/**/b
11119 #define ACAT(a,b)a ## b
11120 RCAT(Rei,ser)
11121 ACAT(Cir,cus)
11122 EOCP
11123 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11124 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11125         echo "Oh!  Smells like ANSI's been here." >&4
11126         echo "We can catify or stringify, separately or together!"
11127         cpp_stuff=42
11128 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11129         echo "Ah, yes!  The good old days!" >&4
11130         echo "However, in the good old days we don't know how to stringify and"
11131         echo "catify at the same time."
11132         cpp_stuff=1
11133 else
11134         $cat >&4 <<EOM
11135 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11136 to have to edit the values of CAT[2-5] in config.h...
11137 EOM
11138         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11139 fi
11140 $rm -f cpp_stuff.*
11141
11142 : see if this is a db.h system
11143 set db.h i_db
11144 eval $inhdr
11145
11146 case "$i_db" in
11147 $define)
11148         : Check db version.
11149         echo " "
11150         echo "Checking Berkeley DB version ..." >&4
11151         $cat >try.c <<EOCP
11152 #$d_const HASCONST
11153 #ifndef HASCONST
11154 #define const
11155 #endif
11156 #include <sys/types.h>
11157 #include <stdio.h>
11158 #include <db.h>
11159 int main()
11160 {
11161 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11162     int Major, Minor, Patch ;
11163     unsigned long Version ;
11164     (void)db_version(&Major, &Minor, &Patch) ;
11165     printf("You have Berkeley DB Version 2 or greater\n");
11166
11167     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11168                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11169     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11170                 Major, Minor, Patch) ;
11171
11172     /* check that db.h & libdb are compatible */
11173     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11174         printf("db.h and libdb are incompatible\n") ;
11175         exit(3);        
11176     }
11177
11178     printf("db.h and libdb are compatible\n") ;
11179
11180     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11181                 + DB_VERSION_PATCH ;
11182
11183     /* needs to be >= 2.3.4 */
11184     if (Version < 2003004) {
11185     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11186         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11187         exit(2);        
11188     }
11189
11190     exit(0);
11191 #else
11192 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11193     printf("You have Berkeley DB Version 1\n");
11194     exit(0);    /* DB version < 2: the coast is clear. */
11195 #else
11196     exit(1);    /* <db.h> not Berkeley DB? */
11197 #endif
11198 #endif
11199 }
11200 EOCP
11201         set try
11202         if eval $compile && ./try; then
11203                 echo 'Looks OK.' >&4
11204         else
11205                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11206                 i_db=$undef
11207                 case " $libs " in
11208                 *"-ldb "*)
11209                         : Remove db from list of libraries to use
11210                         echo "Removing unusable -ldb from library list" >&4
11211                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11212                         shift
11213                         libs="$*"
11214                         echo "libs = $libs" >&4
11215                         ;;
11216                 esac
11217         fi
11218         $rm -f try.*
11219         ;;
11220 esac
11221
11222 case "$i_db" in
11223 define)
11224         : Check the return type needed for hash 
11225         echo " "
11226         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11227         $cat >try.c <<EOCP
11228 #$d_const HASCONST
11229 #ifndef HASCONST
11230 #define const
11231 #endif
11232 #include <sys/types.h>
11233 #include <db.h>
11234
11235 #ifndef DB_VERSION_MAJOR
11236 u_int32_t hash_cb (ptr, size)
11237 const void *ptr;
11238 size_t size;
11239 {
11240 }
11241 HASHINFO info;
11242 int main()
11243 {
11244         info.hash = hash_cb;
11245 }
11246 #endif
11247 EOCP
11248         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11249                 if $contains warning try.out >>/dev/null 2>&1 ; then
11250                         db_hashtype='int'
11251                 else
11252                         db_hashtype='u_int32_t'
11253                 fi
11254         else
11255                 : XXX Maybe we should just give up here.
11256                 db_hashtype=u_int32_t
11257                 $cat try.out >&4
11258                 echo "Help:  I can't seem to compile the db test program." >&4
11259                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11260         fi
11261         $rm -f try.*
11262         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11263         ;;
11264 *)      db_hashtype=u_int32_t
11265         ;;
11266 esac
11267 case "$i_db" in
11268 define)
11269         : Check the return type needed for prefix 
11270         echo " "
11271         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11272         cat >try.c <<EOCP
11273 #$d_const HASCONST
11274 #ifndef HASCONST
11275 #define const
11276 #endif
11277 #include <sys/types.h>
11278 #include <db.h>
11279
11280 #ifndef DB_VERSION_MAJOR
11281 size_t prefix_cb (key1, key2)
11282 const DBT *key1;
11283 const DBT *key2;
11284 {
11285 }
11286 BTREEINFO info;
11287 int main()
11288 {
11289         info.prefix = prefix_cb;
11290 }
11291 #endif
11292 EOCP
11293         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11294                 if $contains warning try.out >>/dev/null 2>&1 ; then
11295                         db_prefixtype='int'
11296                 else
11297                         db_prefixtype='size_t'
11298                 fi
11299         else
11300                 db_prefixtype='size_t'
11301                 : XXX Maybe we should just give up here.
11302                 $cat try.out >&4
11303                 echo "Help:  I can't seem to compile the db test program." >&4
11304                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11305         fi
11306         $rm -f try.*
11307         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11308         ;;
11309 *)      db_prefixtype='size_t'
11310         ;;
11311 esac
11312
11313 : check for void type
11314 echo " "
11315 echo "Checking to see how well your C compiler groks the void type..." >&4
11316 case "$voidflags" in
11317 '')
11318         $cat >try.c <<'EOCP'
11319 #if TRY & 1
11320 void sub() {
11321 #else
11322 sub() {
11323 #endif
11324         extern void moo();      /* function returning void */
11325         void (*goo)();          /* ptr to func returning void */
11326 #if TRY & 8
11327         void *hue;              /* generic ptr */
11328 #endif
11329 #if TRY & 2
11330         void (*foo[10])();
11331 #endif
11332
11333 #if TRY & 4
11334         if(goo == moo) {
11335                 exit(0);
11336         }
11337 #endif
11338         exit(0);
11339 }
11340 int main() { sub(); }
11341 EOCP
11342         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11343                 voidflags=$defvoidused
11344         echo "Good.  It appears to support void to the level $package wants.">&4
11345                 if $contains warning .out >/dev/null 2>&1; then
11346                         echo "However, you might get some warnings that look like this:"
11347                         $cat .out
11348                 fi
11349         else
11350 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11351                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11352                         echo "It supports 1..."
11353                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11354                                 echo "It also supports 2..."
11355                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11356                                         voidflags=7
11357                                         echo "And it supports 4 but not 8 definitely."
11358                                 else
11359                                         echo "It doesn't support 4..."
11360                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11361                                                 voidflags=11
11362                                                 echo "But it supports 8."
11363                                         else
11364                                                 voidflags=3
11365                                                 echo "Neither does it support 8."
11366                                         fi
11367                                 fi
11368                         else
11369                                 echo "It does not support 2..."
11370                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11371                                         voidflags=13
11372                                         echo "But it supports 4 and 8."
11373                                 else
11374                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11375                                                 voidflags=5
11376                                                 echo "And it supports 4 but has not heard about 8."
11377                                         else
11378                                                 echo "However it supports 8 but not 4."
11379                                         fi
11380                                 fi
11381                         fi
11382                 else
11383                         echo "There is no support at all for void."
11384                         voidflags=0
11385                 fi
11386         fi
11387 esac
11388 case "$voidflags" in
11389 "$defvoidused") ;;
11390 *)      $cat >&4 <<'EOM'
11391   Support flag bits are:
11392     1: basic void declarations.
11393     2: arrays of pointers to functions returning void.
11394     4: operations between pointers to and addresses of void functions.
11395     8: generic void pointers.
11396 EOM
11397         dflt="$voidflags";
11398         rp="Your void support flags add up to what?"
11399         . ./myread
11400         voidflags="$ans"
11401         ;;
11402 esac
11403 $rm -f try.* .out
11404
11405
11406 : How can we generate normalized random numbers ?
11407 echo " "
11408 echo "Looking for a random number function..." >&4
11409 case "$randfunc" in
11410 '')
11411         if set drand48 val -f; eval $csym; $val; then
11412                 dflt="drand48"
11413                 echo "Good, found drand48()." >&4
11414         elif set random val -f; eval $csym; $val; then
11415                 dflt="random"
11416                 echo "OK, found random()." >&4
11417         else
11418                 dflt="rand"
11419                 echo "Yick, looks like I have to use rand()." >&4
11420         fi
11421         echo " "
11422         ;;
11423 *)
11424         dflt="$randfunc"
11425         ;;
11426 esac
11427 cont=true
11428
11429 case "$ccflags" in
11430 *-Dmy_rand=*|*-Dmy_srand=*)
11431         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11432         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11433         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11434         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11435         ;;
11436 esac
11437
11438 while $test "$cont"; do
11439         rp="Use which function to generate random numbers?"
11440         . ./myread
11441         if $test "$ans" = "$dflt"; then
11442                 : null
11443         else
11444                 randbits=''
11445         fi
11446         randfunc="$ans"
11447         if set $ans val -f; eval $csym; $val; then
11448                 cont=''
11449         else
11450                 dflt=y
11451                 rp="I cannot find function $ans. Use that name anyway?"
11452                 . ./myread
11453                 dflt=rand
11454                 case "$ans" in
11455                         [yY]*) cont='';;
11456                 esac
11457         fi
11458         case "$cont" in
11459         '')
11460                 case "$randfunc" in
11461                 drand48)
11462                         drand01="drand48()"
11463                         seedfunc="srand48"
11464                         randbits=48
11465                         randseedtype=long
11466                         ;;
11467                 rand|random)
11468                         case "$randbits" in
11469                         '')
11470 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11471                                 $cat >try.c <<EOCP
11472 #$i_unistd I_UNISTD
11473 #$i_stdlib I_STDLIB
11474 #include <stdio.h>
11475 #ifdef I_UNISTD
11476 #  include <unistd.h>
11477 #endif
11478 #ifdef I_STDLIB
11479 #  include <stdlib.h>
11480 #endif
11481 int main()
11482 {
11483         register int i;
11484         register unsigned long tmp;
11485         register unsigned long max = 0L;
11486
11487         for (i = 1000; i; i--) {
11488                 tmp = (unsigned long) $randfunc();
11489                 if (tmp > max) max = tmp;
11490         }
11491         for (i = 0; max; i++)
11492                 max /= 2;
11493         printf("%d\n",i);
11494 }
11495 EOCP
11496                                 set try
11497                                 if eval $compile_ok; then
11498                                         dflt=`try`
11499                                 else
11500                                         dflt='?'
11501                                         echo "(I can't seem to compile the test program...)"
11502                                 fi
11503                                 ;;
11504                         *)
11505                                 dflt="$randbits"
11506                                 ;;
11507                         esac
11508                         rp="How many bits does your $randfunc() function produce?"
11509                         . ./myread
11510                         randbits="$ans"
11511                         $rm -f try.c try
11512                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11513                         seedfunc="s$randfunc"
11514                         randseedtype=unsigned
11515                         ;;
11516                 *)
11517                         dflt="31"
11518                         rp="How many bits does your $randfunc() function produce?"
11519                         . ./myread
11520                         randbits="$ans"
11521                         seedfunc="s$randfunc"
11522                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11523                         if set $seedfunc val -f; eval $csym; $val; then
11524                                 echo "(Using $seedfunc() to seed random generator)"
11525                         else
11526                                 echo "(Warning: no $seedfunc() to seed random generator)"
11527                                 seedfunc=rand
11528                         fi
11529                         randseedtype=unsigned
11530                         ;;
11531                 esac
11532                 ;;
11533         esac
11534 done
11535
11536 echo " "
11537 echo "Determining whether or not we are on an EBCDIC system..." >&4
11538 $cat >tebcdic.c <<'EOM'
11539 int main()
11540 {
11541   if ('M'==0xd4) return 0;
11542   return 1;
11543 }
11544 EOM
11545
11546 val=$undef
11547 set tebcdic
11548 if eval $compile_ok; then
11549         if ./tebcdic; then
11550                 echo "You have EBCDIC." >&4
11551                 val="$define"
11552         else
11553                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11554         fi
11555 else
11556         echo "I'm unable to compile the test program." >&4
11557         echo "I'll assume ASCII or some ISO Latin." >&4
11558 fi
11559 $rm -f tebcdic.c tebcdic
11560 set ebcdic
11561 eval $setvar
11562
11563 echo " "
11564 $cat >&4 <<EOM
11565 Checking how to flush all pending stdio output...
11566 EOM
11567 # I only know how to find the first 32 possibly open files on SunOS.
11568 # See also hints/sunos_4_1.sh and util.c  --AD
11569 case "$osname" in
11570 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11571 esac
11572 $cat >>try.c <<EOCP
11573 #include <stdio.h>
11574 #$i_unistd I_UNISTD
11575 #ifdef I_UNISTD
11576 # include <unistd.h>
11577 #endif
11578 #$d_sysconf HAS_SYSCONF
11579 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11580 #ifdef HAS_STDIO_STREAM_ARRAY
11581 # define STDIO_STREAM_ARRAY $stdio_stream_array
11582 #endif
11583 int main() {
11584   FILE* p = fopen("try.out", "w");
11585 #ifdef TRY_FPUTC
11586   fputc('x', p);
11587 #else
11588 # ifdef TRY_FPRINTF
11589   fprintf(p, "x");
11590 # endif
11591 #endif
11592 #ifdef TRY_FFLUSH_NULL
11593   fflush(NULL);
11594 #endif
11595 #ifdef TRY_FFLUSH_ALL
11596   {
11597     long open_max = -1;
11598 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11599     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11600 # else
11601 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11602     open_max = sysconf(_SC_OPEN_MAX);
11603 #  else
11604 #   ifdef FOPEN_MAX
11605     open_max = FOPEN_MAX;
11606 #   else
11607 #    ifdef OPEN_MAX
11608     open_max = OPEN_MAX;
11609 #    else
11610 #     ifdef _NFILE
11611     open_max = _NFILE;
11612 #     endif
11613 #    endif
11614 #   endif
11615 #  endif
11616 # endif 
11617 # ifdef HAS_STDIO_STREAM_ARRAY
11618     if (open_max > 0) {
11619       long i;
11620       for (i = 0; i < open_max; i++)
11621             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11622                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11623                 STDIO_STREAM_ARRAY[i]._flag)
11624                 fflush(&STDIO_STREAM_ARRAY[i]);
11625     }   
11626   }
11627 # endif
11628 #endif
11629   _exit(42);
11630 }
11631 EOCP
11632 : first we have to find out how _not_ to flush
11633 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11634     output=''
11635     set try -DTRY_FPUTC
11636     if eval $compile; then
11637             $rm -f try.out
11638             ./try$exe_ext 2>/dev/null
11639             if $test ! -s try.out -a "X$?" = X42; then
11640                 output=-DTRY_FPUTC
11641             fi
11642     fi
11643     case "$output" in
11644     '')
11645             set try -DTRY_FPRINTF
11646             $rm -f try.out
11647             if eval $compile; then
11648                     $rm -f try.out
11649                     ./try$exe_ext 2>/dev/null
11650                     if $test ! -s try.out -a "X$?" = X42; then
11651                         output=-DTRY_FPRINTF
11652                     fi
11653             fi
11654         ;;
11655     esac
11656 fi
11657 : check for fflush NULL behaviour
11658 case "$fflushNULL" in
11659 '')     set try -DTRY_FFLUSH_NULL $output
11660         if eval $compile; then
11661                 $rm -f try.out
11662                 ./try$exe_ext 2>/dev/null
11663                 code="$?"
11664                 if $test -s try.out -a "X$code" = X42; then
11665                         fflushNULL="`$cat try.out`"
11666                 else
11667                         if $test "X$code" != X42; then
11668                                 $cat >&4 <<EOM
11669 (If this test failed, don't worry, we'll try another method shortly.)
11670 EOM
11671                         fi
11672                 fi
11673         fi
11674         $rm -f core try.core core.try.*
11675         case "$fflushNULL" in
11676         x)      $cat >&4 <<EOM
11677 Your fflush(NULL) works okay.
11678 EOM
11679                 fflushNULL="$define"
11680                 ;;
11681         '')     $cat >&4 <<EOM
11682 Your fflush(NULL) isn't working (contrary to ANSI C).
11683 EOM
11684                 fflushNULL="$undef"
11685                 ;;
11686         *)      $cat >&4 <<EOM
11687 Cannot figure out whether your fflush(NULL) works or not.
11688 I'm assuming it doesn't (contrary to ANSI C).
11689 EOM
11690                 fflushNULL="$undef"
11691                 ;;
11692         esac
11693         ;;
11694 $define|true|[yY]*)
11695         fflushNULL="$define"
11696         ;;
11697 *)
11698         fflushNULL="$undef"
11699         ;;
11700 esac
11701 : check explicit looping only if NULL did not work
11702 case "$fflushNULL" in
11703 "$undef")
11704         : check for fflush all behaviour
11705         case "$fflushall" in
11706         '')     set try -DTRY_FFLUSH_ALL $output
11707                 if eval $compile; then
11708                         $cat >&4 <<EOM
11709 (Now testing the other method--but note that also this may fail.)
11710 EOM
11711                         $rm -f try.out
11712                         ./try$exe_ext 2>/dev/null
11713                         if $test -s try.out -a "X$?" = X42; then
11714                                 fflushall="`$cat try.out`"
11715                         fi
11716                 fi
11717                 $rm -f core try.core core.try.*
11718                 case "$fflushall" in
11719                 x)      $cat >&4 <<EOM
11720 Whew. Flushing explicitly all the stdio streams works.
11721 EOM
11722                         fflushall="$define"
11723                         ;;
11724                 '')     $cat >&4 <<EOM
11725 Sigh. Flushing explicitly all the stdio streams doesn't work.
11726 EOM
11727                         fflushall="$undef"
11728                         ;;
11729                 *)      $cat >&4 <<EOM
11730 Cannot figure out whether flushing stdio streams explicitly works or not.
11731 I'm assuming it doesn't.
11732 EOM
11733                         fflushall="$undef"
11734                         ;;
11735                 esac
11736                 ;;
11737         "$define"|true|[yY]*)
11738                 fflushall="$define"
11739                 ;;
11740         *)
11741                 fflushall="$undef"
11742                 ;;
11743         esac
11744         ;;
11745 *)      fflushall="$undef"      
11746         ;;
11747 esac
11748 case "$fflushNULL$fflushall" in
11749 undefundef)
11750         $cat <<EOM
11751 I cannot figure out how to flush pending stdio output.
11752 EOM
11753         ;;
11754 esac
11755 $rm -f try.* try$exe_ext
11756
11757 : see what type file positions are declared as in the library
11758 rp="What is the type for file position used by fsetpos()?"
11759 set fpos_t fpostype long stdio.h sys/types.h
11760 eval $typedef_ask
11761
11762 : Store the full pathname to the ar program for use in the C program
11763 : Respect a hint or command line value for full_ar.
11764 case "$full_ar" in
11765 '') full_ar=$ar ;;
11766 esac
11767
11768 : Store the full pathname to the sed program for use in the C program
11769 full_sed=$sed
11770
11771 : see what type gids are declared as in the kernel
11772 echo " "
11773 echo "Looking for the type for group ids returned by getgid()."
11774 set gid_t gidtype xxx stdio.h sys/types.h
11775 eval $typedef
11776 case "$gidtype" in
11777 xxx)
11778         xxx=`./findhdr sys/user.h`
11779         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11780         case $1 in
11781         unsigned) dflt="$1 $2" ;;
11782         *) dflt="$1" ;;
11783         esac
11784         ;;
11785 *) dflt="$gidtype";;
11786 esac
11787 case "$gidtype" in
11788 gid_t) echo "gid_t found." ;;
11789 *)      rp="What is the type for group ids returned by getgid()?"
11790         . ./myread
11791         gidtype="$ans"
11792         ;;
11793 esac
11794
11795 echo " "
11796 case "$gidtype" in
11797 *_t) zzz="$gidtype"     ;;
11798 *)   zzz="gid"          ;;
11799 esac
11800 echo "Checking the sign of $zzz..." >&4 
11801 cat > try.c <<EOCP
11802 #include <sys/types.h>
11803 #include <stdio.h>
11804 int main() {
11805         $gidtype foo = -1;
11806         if (foo < 0)
11807                 printf("-1\n");
11808         else
11809                 printf("1\n");
11810 }
11811 EOCP
11812 set try
11813 if eval $compile; then
11814         yyy=`./try`
11815         case "$yyy" in
11816         '')     gidsign=1
11817                 echo "(I can't execute the test program--guessing unsigned.)" >&4
11818                 ;;
11819         *)      gidsign=$yyy
11820                 case "$gidsign" in
11821                  1) echo "Your $zzz is unsigned." ;;
11822                 -1) echo "Your $zzz is signed."   ;;
11823                 esac
11824                 ;;
11825         esac
11826 else
11827         gidsign=1
11828         echo "(I can't compile the test program--guessing unsigned.)" >&4
11829 fi
11830
11831
11832 echo " "
11833 case "$gidtype" in
11834 *_t) zzz="$gidtype"     ;;
11835 *)   zzz="gid"          ;;
11836 esac
11837 echo "Checking the size of $zzz..." >&4 
11838 cat > try.c <<EOCP
11839 #include <sys/types.h>
11840 #include <stdio.h>
11841 int main() {
11842     printf("%d\n", sizeof($gidtype));
11843 }
11844 EOCP
11845 set try
11846 if eval $compile_ok; then
11847         yyy=`./try`
11848         case "$yyy" in
11849         '')     gidsize=4
11850                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
11851                 ;;
11852         *)      gidsize=$yyy
11853                 echo "Your $zzz size is $gidsize bytes."
11854                 ;;
11855         esac
11856 else
11857         gidsize=4
11858         echo "(I can't compile the test program--guessing $gidsize.)" >&4
11859 fi
11860
11861
11862 : see if getgroups exists
11863 set getgroups d_getgrps
11864 eval $inlibc
11865
11866 : see if setgroups exists
11867 set setgroups d_setgrps
11868 eval $inlibc
11869
11870
11871 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11872 echo " "
11873 case "$d_getgrps$d_setgrps" in
11874 *define*)
11875         case "$groupstype" in
11876         '') dflt="$gidtype" ;;
11877         *)  dflt="$groupstype" ;;
11878         esac
11879         $cat <<EOM
11880 What type of pointer is the second argument to getgroups() and setgroups()?
11881 Usually this is the same as group ids, $gidtype, but not always.
11882
11883 EOM
11884         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11885         . ./myread
11886         groupstype="$ans"
11887         ;;
11888 *)  groupstype="$gidtype";;
11889 esac
11890
11891 : see what type lseek is declared as in the kernel
11892 rp="What is the type used for lseek's offset on this system?"
11893 set off_t lseektype long stdio.h sys/types.h
11894 eval $typedef_ask
11895
11896 echo " "
11897 $echo $n "Checking to see how big your file offsets are...$c" >&4
11898 $cat >try.c <<EOCP
11899 #include <sys/types.h>
11900 #include <stdio.h>
11901 int main()
11902 {
11903         printf("%d\n", sizeof($lseektype));
11904 }
11905 EOCP
11906 set try
11907 if eval $compile_ok; then
11908         lseeksize=`./try`
11909         $echo " $lseeksize bytes." >&4
11910 else
11911         dflt='4'
11912         echo " "
11913         echo "(I can't seem to compile the test program.  Guessing...)"
11914         rp="What is the size of your file offsets (in bytes)?"
11915         . ./myread
11916         lseeksize="$ans"
11917 fi
11918 $rm -f try.c try
11919
11920 echo " "
11921 echo "Checking if your $make program sets \$(MAKE)..." >&4
11922 case "$make_set_make" in
11923 '')
11924         $sed 's/^X //' > testmake.mak << 'EOF'
11925 Xall:
11926 X       @echo 'maketemp="$(MAKE)"'
11927 EOF
11928         case "`$make -f testmake.mak 2>/dev/null`" in
11929         *maketemp=*) make_set_make='#' ;;
11930         *)      make_set_make="MAKE=$make" ;;
11931         esac
11932         $rm -f testmake.mak
11933         ;;
11934 esac
11935 case "$make_set_make" in
11936 '#') echo "Yup, it does.";;
11937 *) echo "Nope, it doesn't.";;
11938 esac
11939
11940 : see what type is used for mode_t
11941 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11942 set mode_t modetype int stdio.h sys/types.h
11943 eval $typedef_ask
11944
11945 : define a fucntion to check prototypes
11946 $cat > protochk <<EOSH
11947 $startsh
11948 cc="$cc"
11949 optimize="$optimize"
11950 ccflags="$ccflags"
11951 prototype="$prototype"
11952 define="$define"
11953 rm=$rm
11954 EOSH
11955
11956 $cat >> protochk <<'EOSH'
11957
11958 $rm -f try.c
11959 foo="$1"
11960 shift
11961 while test $# -ge 2; do
11962         case "$1" in
11963                 $define) echo "#include <$2>" >> try.c ;;
11964                 literal) echo "$2" >> try.c ;;
11965         esac
11966     shift 2
11967 done
11968 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11969 cat >> try.c <<'EOCP'
11970 #ifdef CAN_PROTOTYPE
11971 #define _(args) args
11972 #else
11973 #define _(args) ()
11974 #endif
11975 EOCP
11976 echo "$foo" >> try.c
11977 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11978 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11979 status=$?
11980 $rm -f try.[co]
11981 exit $status
11982 EOSH
11983 chmod +x protochk
11984 $eunicefix protochk
11985
11986 : see what type is used for size_t
11987 rp="What is the type used for the length parameter for string functions?"
11988 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11989 eval $typedef_ask
11990
11991 : check for type of arguments to gethostbyaddr. 
11992 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11993         case "$d_gethbyaddr" in
11994         $define)
11995                 $cat <<EOM
11996
11997 Checking to see what type of arguments are accepted by gethostbyaddr().
11998 EOM
11999                 hdrs="$define sys/types.h
12000                         $d_socket sys/socket.h 
12001                         $i_niin netinet/in.h 
12002                         $i_netdb netdb.h
12003                         $i_unistd unistd.h"
12004                 : The first arg can 'char *' or 'void *'
12005                 : The second arg is some of integral type
12006                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12007                         for yyy in size_t long int; do
12008                                 case "$netdb_host_type" in
12009                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12010                                         if ./protochk "$try" $hdrs; then
12011                                                 echo "Your system accepts $xxx for the first arg."
12012                                                 echo "...and $yyy for the second arg."
12013                                                 netdb_host_type="$xxx"
12014                                                 netdb_hlen_type="$yyy"
12015                                         fi
12016                                         ;;
12017                                 esac
12018                         done
12019                 done
12020                 : In case none of those worked, prompt the user.
12021                 case "$netdb_host_type" in
12022                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12023                         dflt='char *'
12024                         . ./myread
12025                         netdb_host_type=$ans
12026                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12027                         dflt="$sizetype"
12028                         . ./myread
12029                         netdb_hlen_type=$ans
12030                         ;;
12031                 esac
12032                 ;;
12033         *)      : no gethostbyaddr, so pick harmless defaults
12034                 netdb_host_type='char *'
12035                 netdb_hlen_type="$sizetype"
12036                 ;;
12037         esac
12038         # Remove the "const" if needed. -- but then we'll have a 
12039         # prototype clash!
12040         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12041 fi
12042
12043 : check for type of argument to gethostbyname. 
12044 if test "X$netdb_name_type" = X ; then
12045         case "$d_gethbyname" in
12046         $define)
12047                 $cat <<EOM
12048
12049 Checking to see what type of argument is accepted by gethostbyname().
12050 EOM
12051                 hdrs="$define sys/types.h
12052                         $d_socket sys/socket.h 
12053                         $i_niin netinet/in.h 
12054                         $i_netdb netdb.h
12055                         $i_unistd unistd.h"
12056                 for xxx in "const char *" "char *"; do
12057                         case "$netdb_name_type" in
12058                         '')     try="extern struct hostent *gethostbyname($xxx);"
12059                                 if ./protochk "$try" $hdrs; then
12060                                         echo "Your system accepts $xxx."
12061                                         netdb_name_type="$xxx"
12062                                 fi
12063                                 ;;
12064                         esac
12065                 done
12066                 : In case none of those worked, prompt the user.
12067                 case "$netdb_name_type" in
12068                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12069                         dflt='char *'
12070                         . ./myread
12071                         netdb_name_type=$ans
12072                         ;;
12073                 esac
12074                 ;;
12075         *)      : no gethostbyname, so pick harmless default
12076                 netdb_name_type='char *'
12077                 ;;
12078         esac
12079 fi
12080
12081 : check for type of 1st argument to getnetbyaddr. 
12082 if test "X$netdb_net_type" = X ; then
12083         case "$d_getnbyaddr" in
12084         $define)
12085                 $cat <<EOM
12086
12087 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12088 EOM
12089                 hdrs="$define sys/types.h
12090                         $d_socket sys/socket.h 
12091                         $i_niin netinet/in.h 
12092                         $i_netdb netdb.h
12093                         $i_unistd unistd.h"
12094                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12095                         case "$netdb_net_type" in
12096                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12097                                 if ./protochk "$try" $hdrs; then
12098                                         echo "Your system accepts $xxx."
12099                                         netdb_net_type="$xxx"
12100                                 fi
12101                                 ;;
12102                         esac
12103                 done
12104                 : In case none of those worked, prompt the user.
12105                 case "$netdb_net_type" in
12106                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12107                         dflt='long'
12108                         . ./myread
12109                         netdb_net_type=$ans
12110                         ;;
12111                 esac
12112                 ;;
12113         *)      : no getnetbyaddr, so pick harmless default
12114                 netdb_net_type='long'
12115                 ;;
12116         esac
12117 fi
12118 : locate the preferred pager for this system
12119 case "$pager" in
12120 '')
12121         dflt=''
12122         case "$pg" in
12123         /*) dflt=$pg;;
12124         esac
12125         case "$more" in
12126         /*) dflt=$more;;
12127         esac
12128         case "$less" in
12129         /*) dflt=$less;;
12130         esac
12131         case "$dflt" in
12132         '') dflt=/usr/ucb/more;;
12133         esac
12134         ;;
12135 *) dflt="$pager";;
12136 esac
12137 echo " "
12138 fn=f/
12139 rp='What pager is used on your system?'
12140 . ./getfile
12141 pager="$ans"
12142
12143 : see what type pids are declared as in the kernel
12144 rp="What is the type of process ids on this system?"
12145 set pid_t pidtype int stdio.h sys/types.h
12146 eval $typedef_ask
12147
12148 : Find earliest binary compatible site_perl subdirectory perl can use.
12149 case "$bincompat5005" in
12150 "$define") xs_apiversion='5.005' ;;
12151 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12152 esac
12153 : Find earliest pure perl site_perl subdirectory perl can use.
12154 : The versioned directories started at 5.005.
12155 pm_apiversion='5.005'
12156
12157 : check for length of pointer
12158 echo " "
12159 case "$ptrsize" in
12160 '')
12161         $echo $n "Checking to see how big your pointers are...$c" >&4
12162         if test "$voidflags" -gt 7; then
12163                 echo '#define VOID_PTR char *' > try.c
12164         else
12165                 echo '#define VOID_PTR void *' > try.c
12166         fi
12167         $cat >>try.c <<'EOCP'
12168 #include <stdio.h>
12169 int main()
12170 {
12171         printf("%d\n", sizeof(VOID_PTR));
12172         exit(0);
12173 }
12174 EOCP
12175         set try
12176         if eval $compile_ok; then
12177                 ptrsize=`./try`
12178                 $echo " $ptrsize bytes." >&4
12179         else
12180                 dflt='4'
12181                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12182                 rp="What is the size of a pointer (in bytes)?"
12183                 . ./myread
12184                 ptrsize="$ans"
12185         fi
12186         ;;
12187 esac
12188 $rm -f try.c try
12189
12190 : see if ar generates random libraries by itself
12191 echo " "
12192 echo "Checking how to generate random libraries on your machine..." >&4
12193 echo 'int bar1() { return bar2(); }' > bar1.c
12194 echo 'int bar2() { return 2; }' > bar2.c
12195 $cat > foo.c <<'EOP'
12196 int main() { printf("%d\n", bar1()); exit(0); }
12197 EOP
12198 $cc $ccflags -c bar1.c >/dev/null 2>&1
12199 $cc $ccflags -c bar2.c >/dev/null 2>&1
12200 $cc $ccflags -c foo.c >/dev/null 2>&1
12201 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12202 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12203         ./foobar >/dev/null 2>&1; then
12204         echo "$ar appears to generate random libraries itself."
12205         orderlib=false
12206         ranlib=":"
12207 elif $ar ts bar$_a >/dev/null 2>&1 &&
12208         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12209         ./foobar >/dev/null 2>&1; then
12210                 echo "a table of contents needs to be added with '$ar ts'."
12211                 orderlib=false
12212                 ranlib="$ar ts"
12213 else
12214         case "$ranlib" in
12215         :) ranlib='';;
12216         '')
12217                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12218                 $test -f $ranlib || ranlib=''
12219                 ;;
12220         esac
12221         if $test -n "$ranlib"; then
12222                 echo "your system has '$ranlib'; we'll use that."
12223                 orderlib=false
12224         else
12225                 echo "your system doesn't seem to support random libraries"
12226                 echo "so we'll use lorder and tsort to order the libraries."
12227                 orderlib=true
12228                 ranlib=":"
12229         fi
12230 fi
12231 $rm -f foo* bar* 
12232
12233 : check for type of arguments to select. 
12234 case "$selecttype" in
12235 '') case "$d_select" in
12236         $define)
12237                 $cat <<EOM
12238 Checking to see what type of arguments are accepted by select().
12239 EOM
12240                 hdrs="$define sys/types.h
12241                         $i_systime sys/time.h 
12242                         $i_sysselct sys/select.h
12243                         $d_socket sys/socket.h"
12244                 : The first arg can be int, unsigned, or size_t
12245                 : The last arg may or may not be 'const'
12246                 val=''
12247                 : void pointer has been seen but using that
12248                 : breaks the selectminbits test
12249                 for xxx in 'fd_set *' 'int *'; do
12250                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12251                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12252                                         case "$val" in
12253                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12254                                                 if ./protochk "$try" $hdrs; then
12255                                                         echo "Your system accepts $xxx."
12256                                                         val="$xxx"
12257                                                 fi
12258                                                 ;;
12259                                         esac
12260                                 done
12261                         done
12262                 done
12263                 case "$val" in
12264                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12265                         case "$d_fd_set" in
12266                                 $define) dflt="fd_set *" ;;
12267                                 *)              dflt="int *" ;;
12268                         esac
12269                         . ./myread
12270                         val=$ans
12271                         ;;
12272                 esac
12273                 selecttype="$val"
12274                 ;;
12275         *)      : no select, so pick a harmless default
12276                 selecttype='int *'
12277                 ;;
12278         esac
12279         ;;
12280 esac
12281
12282 : check for the select 'width'
12283 case "$selectminbits" in
12284 '') case "$d_select" in
12285         $define)
12286                 $cat <<EOM
12287
12288 Checking to see on how many bits at a time your select() operates...
12289 EOM
12290                 $cat >try.c <<EOCP
12291 #include <sys/types.h>
12292 #$i_time I_TIME
12293 #$i_systime I_SYS_TIME
12294 #$i_systimek I_SYS_TIME_KERNEL
12295 #ifdef I_TIME
12296 #   include <time.h>
12297 #endif
12298 #ifdef I_SYS_TIME
12299 #   ifdef I_SYS_TIME_KERNEL
12300 #       define KERNEL
12301 #   endif
12302 #   include <sys/time.h>
12303 #   ifdef I_SYS_TIME_KERNEL
12304 #       undef KERNEL
12305 #   endif
12306 #endif
12307 #$i_sysselct I_SYS_SELECT
12308 #ifdef I_SYS_SELECT
12309 #include <sys/select.h>
12310 #endif
12311 #$d_socket HAS_SOCKET
12312 #ifdef HAS_SOCKET
12313 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12314 #endif
12315 #include <stdio.h>
12316 $selecttype b;
12317 #define S sizeof(*(b))
12318 #define MINBITS 64
12319 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12320 #define NBITS  (NBYTES * 8)
12321 int main() {
12322     char s[NBYTES];
12323     struct timeval t;
12324     int i;
12325     FILE* fp;
12326     int fd;
12327
12328     fclose(stdin);
12329     fp = fopen("try.c", "r");
12330     if (fp == 0)
12331       exit(1);
12332     fd = fileno(fp);
12333     if (fd < 0)
12334       exit(2);
12335     b = ($selecttype)s;
12336     for (i = 0; i < NBITS; i++)
12337         FD_SET(i, b);
12338     t.tv_sec  = 0;
12339     t.tv_usec = 0;
12340     select(fd + 1, b, 0, 0, &t);
12341     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12342     printf("%d\n", i + 1);
12343     return 0;
12344 }
12345 EOCP
12346                 set try
12347                 if eval $compile_ok; then
12348                         selectminbits=`./try`
12349                         case "$selectminbits" in
12350                         '')     cat >&4 <<EOM
12351 Cannot figure out on how many bits at a time your select() operates.
12352 I'll play safe and guess it is 32 bits.
12353 EOM
12354                                 selectminbits=32
12355                                 bits="32 bits"
12356                                 ;;
12357                         1)      bits="1 bit" ;;
12358                         *)      bits="$selectminbits bits" ;;
12359                         esac
12360                         echo "Your select() operates on $bits at a time." >&4
12361                 else
12362                         rp='What is the minimum number of bits your select() operates on?'
12363                         case "$byteorder" in
12364                         1234|12345678)  dflt=32 ;;
12365                         *)              dflt=1  ;;
12366                         esac
12367                         . ./myread
12368                         val=$ans
12369                         selectminbits="$val"
12370                 fi
12371                 $rm -f try.* try
12372                 ;;
12373         *)      : no select, so pick a harmless default
12374                 selectminbits='32'
12375                 ;;
12376         esac
12377         ;;
12378 esac
12379
12380 : Trace out the files included by signal.h, then look for SIGxxx names.
12381 : Remove SIGARRAYSIZE used by HPUX.
12382 : Remove SIGSTKSIZE used by Linux.
12383 : Remove SIGSTKSZ used by Posix.
12384 : Remove SIGTYP void lines used by OS2.
12385 xxx=`echo '#include <signal.h>' |
12386         $cppstdin $cppminus $cppflags 2>/dev/null |
12387         $grep '^[       ]*#.*include' | 
12388         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12389 : Check this list of files to be sure we have parsed the cpp output ok.
12390 : This will also avoid potentially non-existent files, such 
12391 : as ../foo/bar.h
12392 xxxfiles=''
12393 for xx in $xxx /dev/null ; do
12394         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12395 done
12396 : If we have found no files, at least try signal.h
12397 case "$xxxfiles" in
12398 '')     xxxfiles=`./findhdr signal.h` ;;
12399 esac
12400 xxx=`awk '
12401 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12402         print substr($2, 4, 20)
12403 }
12404 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12405         print substr($3, 4, 20)
12406 }' $xxxfiles`
12407 : Append some common names just in case the awk scan failed.
12408 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12409 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12410 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12411 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12412 : generate a few handy files for later
12413 $cat > signal.c <<'EOCP'
12414 #include <sys/types.h>
12415 #include <signal.h>
12416 #include <stdio.h>
12417 int main() {
12418
12419 /* Strange style to avoid deeply-nested #if/#else/#endif */
12420 #ifndef NSIG
12421 #  ifdef _NSIG
12422 #    define NSIG (_NSIG)
12423 #  endif
12424 #endif
12425
12426 #ifndef NSIG
12427 #  ifdef SIGMAX
12428 #    define NSIG (SIGMAX+1)
12429 #  endif
12430 #endif
12431
12432 #ifndef NSIG
12433 #  ifdef SIG_MAX
12434 #    define NSIG (SIG_MAX+1)
12435 #  endif
12436 #endif
12437
12438 #ifndef NSIG
12439 #  ifdef MAXSIG
12440 #    define NSIG (MAXSIG+1)
12441 #  endif
12442 #endif
12443
12444 #ifndef NSIG
12445 #  ifdef MAX_SIG
12446 #    define NSIG (MAX_SIG+1)
12447 #  endif
12448 #endif
12449
12450 #ifndef NSIG
12451 #  ifdef SIGARRAYSIZE
12452 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12453 #  endif
12454 #endif
12455
12456 #ifndef NSIG
12457 #  ifdef _sys_nsig
12458 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12459 #  endif
12460 #endif
12461
12462 /* Default to some arbitrary number that's big enough to get most
12463    of the common signals.
12464 */
12465 #ifndef NSIG
12466 #    define NSIG 50
12467 #endif
12468
12469 printf("NSIG %d\n", NSIG);
12470
12471 #ifndef JUST_NSIG
12472
12473 EOCP
12474
12475 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12476 {
12477         printf "#ifdef SIG"; printf $1; printf "\n"
12478         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12479         printf $1; printf ");\n"
12480         printf "#endif\n"
12481 }
12482 END {
12483         printf "#endif /* JUST_NSIG */\n";
12484         printf "}\n";
12485 }
12486 ' >>signal.c
12487 $cat >signal.awk <<'EOP'
12488 BEGIN { ndups = 0 }
12489 $1 ~ /^NSIG$/ { nsig = $2 }
12490 ($1 !~ /^NSIG$/) && (NF == 2) {
12491     if ($2 > maxsig) { maxsig = $2 }
12492     if (sig_name[$2]) {
12493         dup_name[ndups] = $1
12494         dup_num[ndups] = $2
12495         ndups++ 
12496     }
12497     else {
12498         sig_name[$2] = $1
12499         sig_num[$2] = $2
12500     }
12501 }
12502 END { 
12503     if (nsig == 0) {
12504         nsig = maxsig + 1
12505     }
12506     printf("NSIG %d\n", nsig);
12507     for (n = 1; n < nsig; n++) {
12508         if (sig_name[n]) {
12509             printf("%s %d\n", sig_name[n], sig_num[n])
12510         }
12511         else {
12512             printf("NUM%d %d\n", n, n) 
12513         }
12514     }
12515     for (n = 0; n < ndups; n++) {
12516         printf("%s %d\n", dup_name[n], dup_num[n])
12517     }
12518 }
12519 EOP
12520 $cat >signal_cmd <<EOS
12521 $startsh
12522 if $test -s signal.lst; then
12523     echo "Using your existing signal.lst file"
12524         exit 0
12525 fi
12526 xxx="$xxx"
12527 EOS
12528 $cat >>signal_cmd <<'EOS'
12529
12530 set signal
12531 if eval $compile_ok; then
12532         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12533 else
12534         echo "(I can't seem be able to compile the whole test program)" >&4
12535         echo "(I'll try it in little pieces.)" >&4
12536         set signal -DJUST_NSIG
12537         if eval $compile_ok; then
12538                 ./signal$_exe > signal.nsg
12539                 $cat signal.nsg
12540         else
12541                 echo "I can't seem to figure out how many signals you have." >&4
12542                 echo "Guessing 50." >&4
12543                 echo 'NSIG 50' > signal.nsg
12544         fi
12545         : Now look at all the signal names, one at a time.
12546         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12547                 $cat > signal.c <<EOCP
12548 #include <sys/types.h>
12549 #include <signal.h>
12550 #include <stdio.h>
12551 int main() {
12552 printf("$xx %d\n", SIG${xx});
12553 return 0;
12554 }
12555 EOCP
12556                 set signal
12557                 if eval $compile; then
12558                         echo "SIG${xx} found."
12559                         ./signal$_exe  >> signal.ls1
12560                 else
12561                         echo "SIG${xx} NOT found."
12562                 fi
12563         done
12564         if $test -s signal.ls1; then
12565                 $cat signal.nsg signal.ls1 |
12566                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12567         fi
12568
12569 fi
12570 if $test -s signal.lst; then
12571         :
12572 else
12573         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12574         echo 'kill -l' >signal
12575         set X `csh -f <signal`
12576         $rm -f signal
12577         shift
12578         case $# in
12579         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12580         esac
12581         echo $@ | $tr ' ' $trnl | \
12582             $awk '{ printf "%s %d\n", $1, ++s; }
12583                   END { printf "NSIG %d\n", ++s }' >signal.lst
12584 fi
12585 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12586 EOS
12587 chmod a+x signal_cmd
12588 $eunicefix signal_cmd
12589
12590 : generate list of signal names
12591 echo " "
12592 case "$sig_name_init" in
12593 '') doinit=yes ;;
12594 *)  case "$sig_num_init" in
12595     ''|*,*) doinit=yes ;;
12596     esac ;;
12597 esac
12598 case "$doinit" in
12599 yes)
12600         echo "Generating a list of signal names and numbers..." >&4
12601         . ./signal_cmd
12602         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12603         sig_name=`$awk 'BEGIN { printf "ZERO " }
12604                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12605         sig_num=`$awk  'BEGIN { printf "0 " }
12606                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12607         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12608                              !/^NSIG/   { printf "\"%s\", ", $1 }
12609                              END        { printf "0\n" }' signal.lst`
12610         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12611                              !/^NSIG/   { printf "%d, ", $2}
12612                              END        { printf "0\n"}' signal.lst`
12613         ;;
12614 esac
12615 echo "The following $sig_count signals are available:"
12616 echo " "
12617 echo $sig_name | $awk \
12618 'BEGIN { linelen = 0 }
12619 {
12620         for (i = 1; i <= NF; i++) {
12621                 name = "SIG" $i " "
12622                 linelen = linelen + length(name)
12623                 if (linelen > 70) {
12624                         printf "\n"
12625                         linelen = length(name)
12626                 }
12627                 printf "%s", name
12628         }
12629         printf "\n"
12630 }'
12631 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12632
12633 : see what type is used for signed size_t
12634 set ssize_t ssizetype int stdio.h sys/types.h
12635 eval $typedef
12636 dflt="$ssizetype"
12637 $cat > ssize.c <<EOM
12638 #include <stdio.h>
12639 #include <sys/types.h>
12640 #define Size_t $sizetype
12641 #define SSize_t $dflt
12642 int main()
12643 {
12644         if (sizeof(Size_t) == sizeof(SSize_t))
12645                 printf("$dflt\n");
12646         else if (sizeof(Size_t) == sizeof(int))
12647                 printf("int\n");
12648         else 
12649                 printf("long\n");
12650         exit(0);
12651 }
12652 EOM
12653 echo " "
12654 set ssize
12655 if eval $compile_ok && ./ssize > /dev/null; then
12656         ssizetype=`./ssize`
12657         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12658 else
12659         $cat >&4 <<EOM
12660 Help! I can't compile and run the ssize_t test program: please enlighten me!
12661 (This is probably a misconfiguration in your system or libraries, and
12662 you really ought to fix it.  Still, I'll try anyway.)
12663
12664 I need a type that is the same size as $sizetype, but is guaranteed to
12665 be signed.  Common values are ssize_t, int and long.
12666
12667 EOM
12668         rp="What signed type is the same size as $sizetype?"
12669         . ./myread
12670         ssizetype="$ans"
12671 fi
12672 $rm -f ssize ssize.*
12673
12674 : see what type of char stdio uses.
12675 echo " "
12676 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12677         echo "Your stdio uses unsigned chars." >&4
12678         stdchar="unsigned char"
12679 else
12680         echo "Your stdio uses signed chars." >&4
12681         stdchar="char"
12682 fi
12683
12684 : see if time exists
12685 echo " "
12686 if test "X$d_time" = X -o X"$timetype" = X; then
12687     if set time val -f d_time; eval $csym; $val; then
12688                 echo 'time() found.' >&4
12689                 val="$define"
12690                 rp="What is the type returned by time() on this system?"
12691                 set time_t timetype long stdio.h sys/types.h
12692                 eval $typedef_ask
12693     else
12694                 echo 'time() not found, hope that will do.' >&4
12695                 val="$undef"
12696                 timetype='int';
12697     fi
12698     set d_time
12699     eval $setvar
12700 fi
12701
12702 : see what type uids are declared as in the kernel
12703 echo " "
12704 echo "Looking for the type for user ids returned by getuid()."
12705 set uid_t uidtype xxx stdio.h sys/types.h
12706 eval $typedef
12707 case "$uidtype" in
12708 xxx)
12709         xxx=`./findhdr sys/user.h`
12710         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12711         case $1 in
12712         unsigned) dflt="$1 $2" ;;
12713         *) dflt="$1" ;;
12714         esac
12715         ;;
12716 *) dflt="$uidtype";;
12717 esac
12718 case "$uidtype" in
12719 uid_t)  echo "uid_t found." ;;
12720 *)      rp="What is the type for user ids returned by getuid()?"
12721         . ./myread
12722         uidtype="$ans"
12723         ;;
12724 esac
12725
12726 echo " "
12727 case "$uidtype" in
12728 *_t) zzz="$uidtype"     ;;
12729 *)   zzz="uid"          ;;
12730 esac
12731 echo "Checking the sign of $zzz..." >&4
12732 cat > try.c <<EOCP
12733 #include <sys/types.h>
12734 #include <stdio.h>
12735 int main() {
12736         $uidtype foo = -1;
12737         if (foo < 0)
12738                 printf("-1\n");
12739         else
12740                 printf("1\n");
12741 }
12742 EOCP
12743 set try
12744 if eval $compile; then
12745         yyy=`./try`
12746         case "$yyy" in
12747         '')     uidsign=1
12748                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12749                 ;;
12750         *)      uidsign=$yyy
12751                 case "$uidsign" in
12752                  1) echo "Your $zzz is unsigned." ;;
12753                 -1) echo "Your $zzz is signed."   ;;
12754                 esac
12755                 ;;
12756         esac
12757 else
12758         uidsign=1
12759         echo "(I can't compile the test program--guessing unsigned.)" >&4
12760 fi
12761
12762
12763 echo " "
12764 case "$uidtype" in
12765 *_t) zzz="$uidtype"     ;;
12766 *)   zzz="uid"          ;;
12767 esac
12768 echo "Checking the size of $zzz..." >&4 
12769 cat > try.c <<EOCP
12770 #include <sys/types.h>
12771 #include <stdio.h>
12772 int main() {
12773     printf("%d\n", sizeof($uidtype));
12774 }
12775 EOCP
12776 set try
12777 if eval $compile_ok; then
12778         yyy=`./try`
12779         case "$yyy" in
12780         '')     uidsize=4
12781                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
12782                 ;;
12783         *)      uidsize=$yyy
12784                 echo "Your $zzz size is $uidsize bytes."
12785                 ;;
12786         esac
12787 else
12788         uidsize=4
12789         echo "(I can't compile the test program--guessing $uidsize.)" >&4
12790 fi
12791
12792 : see if dbm.h is available
12793 : see if dbmclose exists
12794 set dbmclose d_dbmclose
12795 eval $inlibc
12796
12797 case "$d_dbmclose" in
12798 $define)
12799         set dbm.h i_dbm
12800         eval $inhdr
12801         case "$i_dbm" in
12802         $define)
12803                 val="$undef"
12804                 set i_rpcsvcdbm
12805                 eval $setvar
12806                 ;;
12807         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12808                 eval $inhdr
12809                 ;;
12810         esac
12811         ;;
12812 *)      echo "We won't be including <dbm.h>"
12813         val="$undef"
12814         set i_dbm
12815         eval $setvar
12816         val="$undef"
12817         set i_rpcsvcdbm
12818         eval $setvar
12819         ;;
12820 esac
12821
12822 : see if this is a sys/file.h system
12823 val=''
12824 set sys/file.h val
12825 eval $inhdr
12826
12827 : do we need to include sys/file.h ?
12828 case "$val" in
12829 "$define")
12830         echo " "
12831         if $h_sysfile; then
12832                 val="$define"
12833                 echo "We'll be including <sys/file.h>." >&4
12834         else
12835                 val="$undef"
12836                 echo "We won't be including <sys/file.h>." >&4
12837         fi
12838         ;;
12839 *)
12840         h_sysfile=false
12841         ;;
12842 esac
12843 set i_sysfile
12844 eval $setvar
12845
12846 : see if fcntl.h is there
12847 val=''
12848 set fcntl.h val
12849 eval $inhdr
12850
12851 : see if we can include fcntl.h
12852 case "$val" in
12853 "$define")
12854         echo " "
12855         if $h_fcntl; then
12856                 val="$define"
12857                 echo "We'll be including <fcntl.h>." >&4
12858         else
12859                 val="$undef"
12860                 if $h_sysfile; then
12861         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12862                 else
12863                         echo "We won't be including <fcntl.h>." >&4
12864                 fi
12865         fi
12866         ;;
12867 *)
12868         h_fcntl=false
12869         val="$undef"
12870         ;;
12871 esac
12872 set i_fcntl
12873 eval $setvar
12874
12875 : see if locale.h is available
12876 set locale.h i_locale
12877 eval $inhdr
12878
12879 : see if mach cthreads are available
12880 if test "X$usethreads" = "X$define"; then
12881         set mach/cthreads.h i_machcthr
12882         eval $inhdr
12883 else
12884         i_machcthr="$undef"
12885 fi
12886
12887
12888
12889 : see if this is a math.h system
12890 set math.h i_math
12891 eval $inhdr
12892
12893 : see if this is a mntent.h system
12894 set mntent.h i_mntent
12895 eval $inhdr
12896
12897 : see if ndbm.h is available
12898 set ndbm.h t_ndbm
12899 eval $inhdr
12900 case "$t_ndbm" in
12901 $define)
12902         : see if dbm_open exists
12903         set dbm_open d_dbm_open
12904         eval $inlibc
12905         case "$d_dbm_open" in
12906         $undef)
12907                 t_ndbm="$undef"
12908                 echo "We won't be including <ndbm.h>"
12909                 ;;
12910         esac
12911         ;;
12912 esac
12913 val="$t_ndbm"
12914 set i_ndbm
12915 eval $setvar
12916
12917 : see if net/errno.h is available
12918 val=''
12919 set net/errno.h val
12920 eval $inhdr
12921
12922 : Unfortunately, it causes problems on some systems.  Arrgh.
12923 case "$val" in
12924 $define)
12925         cat > try.c <<'EOM'
12926 #include <stdio.h>
12927 #include <errno.h>
12928 #include <net/errno.h>
12929 int func()
12930 {
12931         return ENOTSOCK;
12932 }
12933 EOM
12934         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12935                 echo "We'll be including <net/errno.h>." >&4
12936         else
12937                 echo "We won't be including <net/errno.h>." >&4
12938                 val="$undef"
12939         fi
12940         $rm -f try.* try
12941         ;;
12942 esac
12943 set i_neterrno
12944 eval $setvar
12945
12946 : see if netinet/tcp.h is available
12947 set netinet/tcp.h i_netinettcp
12948 eval $inhdr
12949
12950 : see if this is a poll.h system
12951 set poll.h i_poll
12952 eval $inhdr
12953
12954 : get C preprocessor symbols handy
12955 echo " "
12956 $echo $n "Hmm... $c"
12957 echo $al | $tr ' ' $trnl >Cppsym.know
12958 $cat <<EOSS >Cppsym
12959 $startsh
12960 case "\$1" in
12961 -l) list=true
12962         shift
12963         ;;
12964 esac
12965 unknown=''
12966 case "\$list\$#" in
12967 1|2)
12968         for sym do
12969                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12970                         exit 0
12971                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12972                         :
12973                 else
12974                         unknown="\$unknown \$sym"
12975                 fi
12976         done
12977         set X \$unknown
12978         shift
12979         ;;
12980 esac
12981 case \$# in
12982 0) exit 1;;
12983 esac
12984 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12985 #ifdef \1\\
12986 exit 0; _ _ _ _\1\\      \1\\
12987 #endif\\
12988 /' >Cppsym\$\$
12989 echo "exit 1; _ _ _" >>Cppsym\$\$
12990 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12991 case "\$list" in
12992 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12993 *)
12994         sh Cppsym2\$\$
12995         status=\$?
12996         ;;
12997 esac
12998 $rm -f Cppsym\$\$ Cppsym2\$\$
12999 exit \$status
13000 EOSS
13001 chmod +x Cppsym
13002 $eunicefix Cppsym
13003 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13004
13005 : now check the C compiler for additional symbols
13006 postprocess_cc_v=''
13007 case "$osname" in
13008 aix) postprocess_cc_v="|$tr , ' '" ;;
13009 esac
13010 $cat >ccsym <<EOS
13011 $startsh
13012 $cat >tmp.c <<EOF
13013 extern int foo;
13014 EOF
13015 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13016 do
13017         case "\$i" in
13018         -D*) echo "\$i" | $sed 's/^-D//';;
13019         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13020         esac
13021 done
13022 $rm -f try.c
13023 EOS
13024 postprocess_cc_v=''
13025 chmod +x ccsym
13026 $eunicefix ccsym
13027 ./ccsym > ccsym1.raw
13028 if $test -s ccsym1.raw; then
13029        $sort ccsym1.raw | $uniq >ccsym.raw
13030 else
13031        mv ccsym1.raw ccsym.raw
13032 fi
13033
13034 $awk '/\=/ { print $0; next }
13035         { print $0"=1" }' ccsym.raw >ccsym.list
13036 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13037 $comm -13 ccsym.true ccsym.list >ccsym.own
13038 $comm -12 ccsym.true ccsym.list >ccsym.com
13039 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13040 also=''
13041 if $test -z ccsym.raw; then
13042         echo "Your C compiler doesn't seem to define any symbols!" >&4
13043         echo " "
13044         echo "However, your C preprocessor defines the following symbols:"
13045         $cat Cppsym.true
13046         ccsymbols=''
13047         cppsymbols=`$cat Cppsym.true`
13048         cppsymbols=`echo $cppsymbols`
13049         cppccsymbols="$cppsymbols"
13050 else
13051         if $test -s ccsym.com; then
13052                 echo "Your C compiler and pre-processor define these symbols:"
13053                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13054                 also='also '
13055                 symbols='ones'
13056                 cppccsymbols=`$cat ccsym.com`
13057                 cppccsymbols=`echo $cppccsymbols`
13058                 $test "$silent" || sleep 1
13059         fi
13060         if $test -s ccsym.cpp; then
13061                 $test "$also" && echo " "
13062                 echo "Your C pre-processor ${also}defines the following symbols:"
13063                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13064                 also='further '
13065                 cppsymbols=`$cat ccsym.cpp`
13066                 cppsymbols=`echo $cppsymbols`
13067                 $test "$silent" || sleep 1
13068         fi
13069         if $test -s ccsym.own; then
13070                 $test "$also" && echo " "
13071                 echo "Your C compiler ${also}defines the following cpp symbols:"
13072                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13073                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13074                 ccsymbols=`$cat ccsym.own`
13075                 ccsymbols=`echo $ccsymbols`
13076                 $test "$silent" || sleep 1
13077         fi
13078 fi
13079 $rm -f ccsym*
13080
13081 : see if this is a termio system
13082 val="$undef"
13083 val2="$undef"
13084 val3="$undef"
13085 if $test `./findhdr termios.h`; then
13086         set tcsetattr i_termios
13087         eval $inlibc
13088         val3="$i_termios"
13089 fi
13090 echo " "
13091 case "$val3" in
13092 "$define") echo "You have POSIX termios.h... good!" >&4;;
13093 *) if ./Cppsym pyr; then
13094                 case "`/bin/universe`" in
13095                 ucb) if $test `./findhdr sgtty.h`; then
13096                                 val2="$define"
13097                                 echo "<sgtty.h> found." >&4
13098                         else
13099                                 echo "System is pyramid with BSD universe."
13100                                 echo "<sgtty.h> not found--you could have problems." >&4
13101                         fi;;
13102                 *) if $test `./findhdr termio.h`; then
13103                                 val="$define"
13104                                 echo "<termio.h> found." >&4
13105                         else
13106                                 echo "System is pyramid with USG universe."
13107                                 echo "<termio.h> not found--you could have problems." >&4
13108                         fi;;
13109                 esac
13110         elif ./usg; then
13111                 if $test `./findhdr termio.h`; then
13112                         echo "<termio.h> found." >&4
13113                         val="$define"
13114                 elif $test `./findhdr sgtty.h`; then
13115                         echo "<sgtty.h> found." >&4
13116                         val2="$define"
13117                 else
13118 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13119                 fi
13120         else
13121                 if $test `./findhdr sgtty.h`; then
13122                         echo "<sgtty.h> found." >&4
13123                         val2="$define"
13124                 elif $test `./findhdr termio.h`; then
13125                         echo "<termio.h> found." >&4
13126                         val="$define"
13127                 else
13128 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13129                 fi
13130         fi;;
13131 esac
13132 set i_termio; eval $setvar
13133 val=$val2; set i_sgtty; eval $setvar
13134 val=$val3; set i_termios; eval $setvar
13135
13136 : see if this is a shadow.h system
13137 set shadow.h i_shadow
13138 eval $inhdr
13139
13140 : see if this is a socks.h system
13141 set socks.h i_socks
13142 eval $inhdr
13143
13144 : see if stdarg is available
13145 echo " "
13146 if $test `./findhdr stdarg.h`; then
13147         echo "<stdarg.h> found." >&4
13148         valstd="$define"
13149 else
13150         echo "<stdarg.h> NOT found." >&4
13151         valstd="$undef"
13152 fi
13153
13154 : see if varags is available
13155 echo " "
13156 if $test `./findhdr varargs.h`; then
13157         echo "<varargs.h> found." >&4
13158 else
13159         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13160 fi
13161
13162 : set up the varargs testing programs
13163 $cat > varargs.c <<EOP
13164 #ifdef I_STDARG
13165 #include <stdarg.h>
13166 #endif
13167 #ifdef I_VARARGS
13168 #include <varargs.h>
13169 #endif
13170
13171 #ifdef I_STDARG
13172 int f(char *p, ...)
13173 #else
13174 int f(va_alist)
13175 va_dcl
13176 #endif
13177 {
13178         va_list ap;
13179 #ifndef I_STDARG
13180         char *p;
13181 #endif
13182 #ifdef I_STDARG
13183         va_start(ap,p);
13184 #else
13185         va_start(ap);
13186         p = va_arg(ap, char *);
13187 #endif
13188         va_end(ap);
13189 }
13190 EOP
13191 $cat > varargs <<EOP
13192 $startsh
13193 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13194         echo "true"
13195 else
13196         echo "false"
13197 fi
13198 $rm -f varargs$_o
13199 EOP
13200 chmod +x varargs
13201
13202 : now check which varargs header should be included
13203 echo " "
13204 i_varhdr=''
13205 case "$valstd" in
13206 "$define")
13207         if `./varargs I_STDARG`; then
13208                 val='stdarg.h'
13209         elif `./varargs I_VARARGS`; then
13210                 val='varargs.h'
13211         fi
13212         ;;
13213 *)
13214         if `./varargs I_VARARGS`; then
13215                 val='varargs.h'
13216         fi
13217         ;;
13218 esac
13219 case "$val" in
13220 '')
13221 echo "I could not find the definition for va_dcl... You have problems..." >&4
13222         val="$undef"; set i_stdarg; eval $setvar
13223         val="$undef"; set i_varargs; eval $setvar
13224         ;;
13225 *) 
13226         set i_varhdr
13227         eval $setvar
13228         case "$i_varhdr" in
13229         stdarg.h)
13230                 val="$define"; set i_stdarg; eval $setvar
13231                 val="$undef"; set i_varargs; eval $setvar
13232                 ;;
13233         varargs.h)
13234                 val="$undef"; set i_stdarg; eval $setvar
13235                 val="$define"; set i_varargs; eval $setvar
13236                 ;;
13237         esac
13238         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13239 esac
13240 $rm -f varargs*
13241
13242 : see if stddef is available
13243 set stddef.h i_stddef
13244 eval $inhdr
13245
13246 : see if sys/access.h is available
13247 set sys/access.h i_sysaccess
13248 eval $inhdr
13249
13250 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13251 set sys/filio.h i_sysfilio
13252 eval $inhdr
13253 echo " "
13254 if $test `./findhdr sys/ioctl.h`; then
13255         val="$define"
13256         echo '<sys/ioctl.h> found.' >&4
13257 else
13258         val="$undef"
13259         if $test $i_sysfilio = "$define"; then
13260             echo '<sys/ioctl.h> NOT found.' >&4
13261         else
13262                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13263                 $test $i_termio = "$define" && xxx="termio.h"
13264                 $test $i_termios = "$define" && xxx="termios.h"
13265 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13266         fi
13267 fi
13268 set i_sysioctl
13269 eval $setvar
13270
13271 : see if sys/resource.h has to be included
13272 set sys/resource.h i_sysresrc
13273 eval $inhdr
13274
13275 : see if sys/security.h is available
13276 set sys/security.h i_syssecrt
13277 eval $inhdr
13278
13279 : see if this is a sys/statvfs.h system
13280 set sys/statvfs.h i_sysstatvfs
13281 eval $inhdr
13282
13283 : see if this is a sys/uio.h system
13284 set sys/uio.h i_sysuio
13285 eval $inhdr
13286
13287 echo "Checking to see if your system supports struct iovec..." >&4
13288 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
13289 eval $hasfield
13290 case "$d_iovec_s" in
13291 "$define")      echo "Yup, it does." >&4
13292                 ;;
13293 *)              echo "Nope, it doesn't." >&4
13294                 ;;
13295 esac
13296
13297 : see if this is a sys/un.h system
13298 set sys/un.h i_sysun
13299 eval $inhdr
13300
13301 : see if this is a syswait system
13302 set sys/wait.h i_syswait
13303 eval $inhdr
13304
13305 : see if this is a ustat.h system
13306 set ustat.h i_ustat
13307 eval $inhdr
13308
13309 : see if this is an utime system
13310 set utime.h i_utime
13311 eval $inhdr
13312
13313 : see if this is a values.h system
13314 set values.h i_values
13315 eval $inhdr
13316
13317 : see if this is a vfork system
13318 case "$d_vfork" in
13319 "$define")
13320         set vfork.h i_vfork
13321         eval $inhdr
13322         ;;
13323 *)
13324         i_vfork="$undef"
13325         ;;
13326 esac
13327
13328 : see if gdbm.h is available
13329 set gdbm.h t_gdbm
13330 eval $inhdr
13331 case "$t_gdbm" in
13332 $define)
13333         : see if gdbm_open exists
13334         set gdbm_open d_gdbm_open
13335         eval $inlibc
13336         case "$d_gdbm_open" in
13337         $undef)
13338                 t_gdbm="$undef"
13339                 echo "We won't be including <gdbm.h>"
13340                 ;;
13341         esac
13342         ;;
13343 esac
13344 val="$t_gdbm"
13345 set i_gdbm
13346 eval $setvar
13347
13348 echo " "
13349 echo "Looking for extensions..." >&4
13350 : If we are using the old config.sh, known_extensions may contain
13351 : old or inaccurate or duplicate values.
13352 known_extensions=''
13353 nonxs_extensions=''
13354 : We do not use find because it might not be available.
13355 : We do not just use MANIFEST because the user may have dropped
13356 : some additional extensions into the source tree and expect them
13357 : to be built.
13358
13359 : Function to recursively find available extensions, ignoring DynaLoader
13360 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13361 find_extensions='
13362     for xxx in *; do
13363        case "$xxx" in
13364            DynaLoader|dynaload) ;;
13365            *)
13366            if $test -f $xxx/$xxx.xs; then
13367                known_extensions="$known_extensions $1$xxx";
13368            elif $test -f $xxx/Makefile.PL; then
13369                nonxs_extensions="$nonxs_extensions $1$xxx";
13370            else
13371                if $test -d $xxx -a $# -lt 10; then
13372                    set $1$xxx/ $*;
13373                    cd $xxx;
13374                    eval $find_extensions;
13375                    cd ..;
13376                    shift;
13377                fi;
13378            fi
13379            ;;
13380        esac;
13381     done'
13382 tdir=`pwd`
13383 cd $rsrc/ext
13384 set X
13385 shift
13386 eval $find_extensions
13387 set X $nonxs_extensions
13388 shift
13389 nonxs_extensions="$*"
13390 set X $known_extensions
13391 shift
13392 known_extensions="$*"
13393 cd $tdir
13394
13395 : Now see which are supported on this system.
13396 avail_ext=''
13397 for xxx in $known_extensions ; do
13398         case "$xxx" in
13399         DB_File|db_file)
13400                 case "$i_db" in
13401                 $define) avail_ext="$avail_ext $xxx" ;;
13402                 esac
13403                 ;;
13404         GDBM_File|gdbm_fil)
13405                 case "$i_gdbm" in 
13406                 $define) avail_ext="$avail_ext $xxx" ;;
13407                 esac
13408                 ;;
13409         NDBM_File|ndbm_fil)
13410                 case "$i_ndbm" in
13411                 $define) avail_ext="$avail_ext $xxx" ;;
13412                 esac
13413                 ;;
13414         ODBM_File|odbm_fil) 
13415                 case "${i_dbm}${i_rpcsvcdbm}" in
13416                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13417                 esac
13418                 ;;
13419         POSIX|posix)
13420                 case "$useposix" in
13421                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13422                 esac
13423                 ;;
13424         Opcode|opcode)
13425                 case "$useopcode" in
13426                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13427                 esac
13428                 ;;
13429         Socket|socket)
13430                 case "$d_socket" in 
13431                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13432                 esac
13433                 ;;
13434         Thread|thread)
13435                 case "$usethreads" in 
13436                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13437                 esac
13438                 ;;
13439         IPC/SysV|ipc/sysv)
13440                 : XXX Do we need a useipcsysv variable here
13441                 case "${d_msg}${d_sem}${d_shm}" in 
13442                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13443                 esac
13444                 ;;
13445         *)      avail_ext="$avail_ext $xxx"
13446                 ;;
13447         esac
13448 done
13449
13450 set X $avail_ext
13451 shift
13452 avail_ext="$*"
13453
13454 : Now see which nonxs extensions are supported on this system.
13455 : For now assume all are.
13456 nonxs_ext=''
13457 for xxx in $nonxs_extensions ; do
13458         case "$xxx" in
13459         *)      nonxs_ext="$nonxs_ext $xxx"
13460                 ;;
13461         esac
13462 done
13463
13464 set X $nonxs_ext
13465 shift
13466 nonxs_ext="$*"
13467
13468 case $usedl in
13469 $define)
13470         $cat <<EOM
13471 A number of extensions are supplied with $package.  You may choose to
13472 compile these extensions for dynamic loading (the default), compile
13473 them into the $package executable (static loading), or not include
13474 them at all.  Answer "none" to include no extensions.
13475 Note that DynaLoader is always built and need not be mentioned here.
13476
13477 EOM
13478         case "$dynamic_ext" in
13479         '') dflt="$avail_ext" ;;
13480         *)      dflt="$dynamic_ext"
13481                 # Perhaps we are reusing an old out-of-date config.sh.
13482                 case "$hint" in
13483                 previous)
13484                         if test X"$dynamic_ext" != X"$avail_ext"; then
13485                                 $cat <<EOM
13486 NOTICE:  Your previous config.sh list may be incorrect. 
13487 The extensions now available to you are 
13488         ${avail_ext}
13489 but the default list from your previous config.sh is
13490         ${dynamic_ext} 
13491
13492 EOM
13493                         fi
13494                         ;;
13495                 esac
13496                 ;;
13497         esac
13498         case "$dflt" in
13499         '')     dflt=none;;
13500         esac
13501         rp="What extensions do you wish to load dynamically?"
13502         . ./myread
13503         case "$ans" in
13504         none) dynamic_ext=' ' ;;
13505         *) dynamic_ext="$ans" ;;
13506         esac
13507
13508         case "$static_ext" in
13509         '')
13510                 : Exclude those already listed in dynamic linking
13511                 dflt=''
13512                 for xxx in $avail_ext; do
13513                         case " $dynamic_ext " in
13514                         *" $xxx "*) ;;
13515                         *) dflt="$dflt $xxx" ;;
13516                         esac
13517                 done
13518                 set X $dflt
13519                 shift
13520                 dflt="$*"
13521                 ;;
13522         *)  dflt="$static_ext" 
13523                 ;;
13524         esac
13525
13526         case "$dflt" in
13527         '')     dflt=none;;
13528         esac
13529         rp="What extensions do you wish to load statically?"
13530         . ./myread
13531         case "$ans" in
13532         none) static_ext=' ' ;;
13533         *) static_ext="$ans" ;;
13534         esac
13535         ;;
13536 *)
13537         $cat <<EOM
13538 A number of extensions are supplied with $package.  Answer "none" 
13539 to include no extensions. 
13540 Note that DynaLoader is always built and need not be mentioned here.
13541
13542 EOM
13543         case "$static_ext" in
13544         '') dflt="$avail_ext" ;;
13545         *)      dflt="$static_ext"
13546                 # Perhaps we are reusing an old out-of-date config.sh.
13547                 case "$hint" in
13548                 previous)
13549                         if test X"$static_ext" != X"$avail_ext"; then
13550                                 $cat <<EOM
13551 NOTICE:  Your previous config.sh list may be incorrect. 
13552 The extensions now available to you are 
13553         ${avail_ext}
13554 but the default list from your previous config.sh is
13555         ${static_ext} 
13556
13557 EOM
13558                         fi
13559                         ;;
13560                 esac
13561                 ;;
13562         esac
13563         : Exclude those that are not xs extensions
13564         case "$dflt" in
13565         '')     dflt=none;;
13566         esac
13567         rp="What extensions do you wish to include?"
13568         . ./myread
13569         case "$ans" in
13570         none) static_ext=' ' ;;
13571         *) static_ext="$ans" ;;
13572         esac
13573         ;;
13574 esac
13575
13576 set X $dynamic_ext $static_ext $nonxs_ext
13577 shift
13578 extensions="$*"
13579
13580 : Remove build directory name from cppstdin so it can be used from
13581 : either the present location or the final installed location.
13582 echo " "
13583 : Get out of the UU directory to get correct path name.
13584 cd ..
13585 case "$cppstdin" in
13586 `pwd`/cppstdin)
13587         echo "Stripping down cppstdin path name"
13588         cppstdin=cppstdin
13589         ;;
13590 esac
13591 cd UU
13592
13593 : end of configuration questions
13594 echo " "
13595 echo "End of configuration questions."
13596 echo " "
13597
13598 : back to where it started
13599 if test -d ../UU; then
13600         cd ..
13601 fi
13602
13603 : configuration may be patched via a 'config.over' file
13604 if $test -f config.over; then
13605         echo " "
13606         dflt=y
13607         rp='I see a config.over file.  Do you wish to load it?'
13608         . UU/myread
13609         case "$ans" in
13610         n*) echo "OK, I'll ignore it.";;
13611         *)      . ./config.over
13612                 echo "Configuration override changes have been loaded."
13613                 ;;
13614         esac
13615 fi
13616
13617 : in case they want portability, strip down executable paths
13618 case "$d_portable" in
13619 "$define")
13620         echo " "
13621         echo "Stripping down executable paths..." >&4
13622         for file in $loclist $trylist; do
13623                 eval temp=\$$file
13624                 eval $file=`basename $temp`
13625         done
13626         ;;
13627 esac
13628
13629 : create config.sh file
13630 echo " "
13631 echo "Creating config.sh..." >&4
13632 $spitshell <<EOT >config.sh
13633 $startsh
13634 #
13635 # This file was produced by running the Configure script. It holds all the
13636 # definitions figured out by Configure. Should you modify one of these values,
13637 # do not forget to propagate your changes by running "Configure -der". You may
13638 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13639 #
13640
13641 # Package name      : $package
13642 # Source directory  : $src
13643 # Configuration time: $cf_time
13644 # Configured by     : $cf_by
13645 # Target system     : $myuname
13646
13647 Author='$Author'
13648 Date='$Date'
13649 Header='$Header'
13650 Id='$Id'
13651 Locker='$Locker'
13652 Log='$Log'
13653 Mcc='$Mcc'
13654 RCSfile='$RCSfile'
13655 Revision='$Revision'
13656 Source='$Source'
13657 State='$State'
13658 _a='$_a'
13659 _exe='$_exe'
13660 _o='$_o'
13661 afs='$afs'
13662 alignbytes='$alignbytes'
13663 ansi2knr='$ansi2knr'
13664 aphostname='$aphostname'
13665 apiversion='$apiversion'
13666 ar='$ar'
13667 archlib='$archlib'
13668 archlibexp='$archlibexp'
13669 archname64='$archname64'
13670 archname='$archname'
13671 archobjs='$archobjs'
13672 awk='$awk'
13673 baserev='$baserev'
13674 bash='$bash'
13675 bin='$bin'
13676 bincompat5005='$bincompat5005'
13677 binexp='$binexp'
13678 bison='$bison'
13679 byacc='$byacc'
13680 byteorder='$byteorder'
13681 c='$c'
13682 castflags='$castflags'
13683 cat='$cat'
13684 cc='$cc'
13685 cccdlflags='$cccdlflags'
13686 ccdlflags='$ccdlflags'
13687 ccflags='$ccflags'
13688 ccsymbols='$ccsymbols'
13689 cf_by='$cf_by'
13690 cf_email='$cf_email'
13691 cf_time='$cf_time'
13692 chgrp='$chgrp'
13693 chmod='$chmod'
13694 chown='$chown'
13695 clocktype='$clocktype'
13696 comm='$comm'
13697 compress='$compress'
13698 contains='$contains'
13699 cp='$cp'
13700 cpio='$cpio'
13701 cpp='$cpp'
13702 cpp_stuff='$cpp_stuff'
13703 cppccsymbols='$cppccsymbols'
13704 cppflags='$cppflags'
13705 cpplast='$cpplast'
13706 cppminus='$cppminus'
13707 cpprun='$cpprun'
13708 cppstdin='$cppstdin'
13709 cppsymbols='$cppsymbols'
13710 crosscompile='$crosscompile'
13711 cryptlib='$cryptlib'
13712 csh='$csh'
13713 d_Gconvert='$d_Gconvert'
13714 d_PRIEldbl='$d_PRIEldbl'
13715 d_PRIFldbl='$d_PRIFldbl'
13716 d_PRIGldbl='$d_PRIGldbl'
13717 d_PRIX64='$d_PRIX64'
13718 d_PRId64='$d_PRId64'
13719 d_PRIeldbl='$d_PRIeldbl'
13720 d_PRIfldbl='$d_PRIfldbl'
13721 d_PRIgldbl='$d_PRIgldbl'
13722 d_PRIi64='$d_PRIi64'
13723 d_PRIo64='$d_PRIo64'
13724 d_PRIu64='$d_PRIu64'
13725 d_PRIx64='$d_PRIx64'
13726 d_access='$d_access'
13727 d_accessx='$d_accessx'
13728 d_alarm='$d_alarm'
13729 d_archlib='$d_archlib'
13730 d_atolf='$d_atolf'
13731 d_atoll='$d_atoll'
13732 d_attribut='$d_attribut'
13733 d_bcmp='$d_bcmp'
13734 d_bcopy='$d_bcopy'
13735 d_bincompat5005='$d_bincompat5005'
13736 d_bsd='$d_bsd'
13737 d_bsdgetpgrp='$d_bsdgetpgrp'
13738 d_bsdsetpgrp='$d_bsdsetpgrp'
13739 d_bzero='$d_bzero'
13740 d_casti32='$d_casti32'
13741 d_castneg='$d_castneg'
13742 d_charvspr='$d_charvspr'
13743 d_chown='$d_chown'
13744 d_chroot='$d_chroot'
13745 d_chsize='$d_chsize'
13746 d_closedir='$d_closedir'
13747 d_const='$d_const'
13748 d_crypt='$d_crypt'
13749 d_csh='$d_csh'
13750 d_cuserid='$d_cuserid'
13751 d_dbl_dig='$d_dbl_dig'
13752 d_difftime='$d_difftime'
13753 d_dirnamlen='$d_dirnamlen'
13754 d_dlerror='$d_dlerror'
13755 d_dlopen='$d_dlopen'
13756 d_dlsymun='$d_dlsymun'
13757 d_dosuid='$d_dosuid'
13758 d_drand48proto='$d_drand48proto'
13759 d_dup2='$d_dup2'
13760 d_eaccess='$d_eaccess'
13761 d_endgrent='$d_endgrent'
13762 d_endhent='$d_endhent'
13763 d_endnent='$d_endnent'
13764 d_endpent='$d_endpent'
13765 d_endpwent='$d_endpwent'
13766 d_endsent='$d_endsent'
13767 d_endspent='$d_endspent'
13768 d_eofnblk='$d_eofnblk'
13769 d_eunice='$d_eunice'
13770 d_fchmod='$d_fchmod'
13771 d_fchown='$d_fchown'
13772 d_fcntl='$d_fcntl'
13773 d_fd_macros='$d_fd_macros'
13774 d_fd_set='$d_fd_set'
13775 d_fds_bits='$d_fds_bits'
13776 d_fgetpos='$d_fgetpos'
13777 d_flexfnam='$d_flexfnam'
13778 d_flock='$d_flock'
13779 d_fork='$d_fork'
13780 d_fpathconf='$d_fpathconf'
13781 d_fpos64_t='$d_fpos64_t'
13782 d_fs_data_s='$d_fs_data_s'
13783 d_fseeko='$d_fseeko'
13784 d_fsetpos='$d_fsetpos'
13785 d_fstatfs='$d_fstatfs'
13786 d_fstatvfs='$d_fstatvfs'
13787 d_ftello='$d_ftello'
13788 d_ftime='$d_ftime'
13789 d_getgrent='$d_getgrent'
13790 d_getgrps='$d_getgrps'
13791 d_gethbyaddr='$d_gethbyaddr'
13792 d_gethbyname='$d_gethbyname'
13793 d_gethent='$d_gethent'
13794 d_gethname='$d_gethname'
13795 d_gethostprotos='$d_gethostprotos'
13796 d_getlogin='$d_getlogin'
13797 d_getmnt='$d_getmnt'
13798 d_getmntent='$d_getmntent'
13799 d_getnbyaddr='$d_getnbyaddr'
13800 d_getnbyname='$d_getnbyname'
13801 d_getnent='$d_getnent'
13802 d_getnetprotos='$d_getnetprotos'
13803 d_getpbyname='$d_getpbyname'
13804 d_getpbynumber='$d_getpbynumber'
13805 d_getpent='$d_getpent'
13806 d_getpgid='$d_getpgid'
13807 d_getpgrp2='$d_getpgrp2'
13808 d_getpgrp='$d_getpgrp'
13809 d_getppid='$d_getppid'
13810 d_getprior='$d_getprior'
13811 d_getprotoprotos='$d_getprotoprotos'
13812 d_getpwent='$d_getpwent'
13813 d_getsbyname='$d_getsbyname'
13814 d_getsbyport='$d_getsbyport'
13815 d_getsent='$d_getsent'
13816 d_getservprotos='$d_getservprotos'
13817 d_getspent='$d_getspent'
13818 d_getspnam='$d_getspnam'
13819 d_gettimeod='$d_gettimeod'
13820 d_gnulibc='$d_gnulibc'
13821 d_grpasswd='$d_grpasswd'
13822 d_hasmntopt='$d_hasmntopt'
13823 d_htonl='$d_htonl'
13824 d_index='$d_index'
13825 d_inetaton='$d_inetaton'
13826 d_int64t='$d_int64t'
13827 d_iovec_s='$d_iovec_s'
13828 d_isascii='$d_isascii'
13829 d_killpg='$d_killpg'
13830 d_lchown='$d_lchown'
13831 d_ldbl_dig='$d_ldbl_dig'
13832 d_link='$d_link'
13833 d_llseek='$d_llseek'
13834 d_locconv='$d_locconv'
13835 d_lockf='$d_lockf'
13836 d_longdbl='$d_longdbl'
13837 d_longlong='$d_longlong'
13838 d_lstat='$d_lstat'
13839 d_mblen='$d_mblen'
13840 d_mbstowcs='$d_mbstowcs'
13841 d_mbtowc='$d_mbtowc'
13842 d_memchr='$d_memchr'
13843 d_memcmp='$d_memcmp'
13844 d_memcpy='$d_memcpy'
13845 d_memmove='$d_memmove'
13846 d_memset='$d_memset'
13847 d_mkdir='$d_mkdir'
13848 d_mkfifo='$d_mkfifo'
13849 d_mktime='$d_mktime'
13850 d_msg='$d_msg'
13851 d_msg_ctrunc='$d_msg_ctrunc'
13852 d_msg_dontroute='$d_msg_dontroute'
13853 d_msg_oob='$d_msg_oob'
13854 d_msg_peek='$d_msg_peek'
13855 d_msg_proxy='$d_msg_proxy'
13856 d_msgctl='$d_msgctl'
13857 d_msgget='$d_msgget'
13858 d_msgrcv='$d_msgrcv'
13859 d_msgsnd='$d_msgsnd'
13860 d_mymalloc='$d_mymalloc'
13861 d_nice='$d_nice'
13862 d_off64_t='$d_off64_t'
13863 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13864 d_oldpthreads='$d_oldpthreads'
13865 d_oldsock='$d_oldsock'
13866 d_open3='$d_open3'
13867 d_pathconf='$d_pathconf'
13868 d_pause='$d_pause'
13869 d_phostname='$d_phostname'
13870 d_pipe='$d_pipe'
13871 d_poll='$d_poll'
13872 d_portable='$d_portable'
13873 d_pthread_yield='$d_pthread_yield'
13874 d_pwage='$d_pwage'
13875 d_pwchange='$d_pwchange'
13876 d_pwclass='$d_pwclass'
13877 d_pwcomment='$d_pwcomment'
13878 d_pwexpire='$d_pwexpire'
13879 d_pwgecos='$d_pwgecos'
13880 d_pwpasswd='$d_pwpasswd'
13881 d_pwquota='$d_pwquota'
13882 d_readdir='$d_readdir'
13883 d_readlink='$d_readlink'
13884 d_rename='$d_rename'
13885 d_rewinddir='$d_rewinddir'
13886 d_rmdir='$d_rmdir'
13887 d_safebcpy='$d_safebcpy'
13888 d_safemcpy='$d_safemcpy'
13889 d_sanemcmp='$d_sanemcmp'
13890 d_sched_yield='$d_sched_yield'
13891 d_scm_rights='$d_scm_rights'
13892 d_seekdir='$d_seekdir'
13893 d_select='$d_select'
13894 d_sem='$d_sem'
13895 d_semctl='$d_semctl'
13896 d_semctl_semid_ds='$d_semctl_semid_ds'
13897 d_semctl_semun='$d_semctl_semun'
13898 d_semget='$d_semget'
13899 d_semop='$d_semop'
13900 d_setegid='$d_setegid'
13901 d_seteuid='$d_seteuid'
13902 d_setgrent='$d_setgrent'
13903 d_setgrps='$d_setgrps'
13904 d_sethent='$d_sethent'
13905 d_setlinebuf='$d_setlinebuf'
13906 d_setlocale='$d_setlocale'
13907 d_setnent='$d_setnent'
13908 d_setpent='$d_setpent'
13909 d_setpgid='$d_setpgid'
13910 d_setpgrp2='$d_setpgrp2'
13911 d_setpgrp='$d_setpgrp'
13912 d_setprior='$d_setprior'
13913 d_setpwent='$d_setpwent'
13914 d_setregid='$d_setregid'
13915 d_setresgid='$d_setresgid'
13916 d_setresuid='$d_setresuid'
13917 d_setreuid='$d_setreuid'
13918 d_setrgid='$d_setrgid'
13919 d_setruid='$d_setruid'
13920 d_setsent='$d_setsent'
13921 d_setsid='$d_setsid'
13922 d_setspent='$d_setspent'
13923 d_setvbuf='$d_setvbuf'
13924 d_sfio='$d_sfio'
13925 d_shm='$d_shm'
13926 d_shmat='$d_shmat'
13927 d_shmatprototype='$d_shmatprototype'
13928 d_shmctl='$d_shmctl'
13929 d_shmdt='$d_shmdt'
13930 d_shmget='$d_shmget'
13931 d_sigaction='$d_sigaction'
13932 d_sigsetjmp='$d_sigsetjmp'
13933 d_socket='$d_socket'
13934 d_sockpair='$d_sockpair'
13935 d_sqrtl='$d_sqrtl'
13936 d_statblks='$d_statblks'
13937 d_statfs_f_flags='$d_statfs_f_flags'
13938 d_statfs_s='$d_statfs_s'
13939 d_statvfs='$d_statvfs'
13940 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13941 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13942 d_stdio_stream_array='$d_stdio_stream_array'
13943 d_stdiobase='$d_stdiobase'
13944 d_stdstdio='$d_stdstdio'
13945 d_strchr='$d_strchr'
13946 d_strcoll='$d_strcoll'
13947 d_strctcpy='$d_strctcpy'
13948 d_strerrm='$d_strerrm'
13949 d_strerror='$d_strerror'
13950 d_strtod='$d_strtod'
13951 d_strtol='$d_strtol'
13952 d_strtoul='$d_strtoul'
13953 d_strtoull='$d_strtoull'
13954 d_strxfrm='$d_strxfrm'
13955 d_suidsafe='$d_suidsafe'
13956 d_symlink='$d_symlink'
13957 d_syscall='$d_syscall'
13958 d_sysconf='$d_sysconf'
13959 d_sysernlst='$d_sysernlst'
13960 d_syserrlst='$d_syserrlst'
13961 d_system='$d_system'
13962 d_tcgetpgrp='$d_tcgetpgrp'
13963 d_tcsetpgrp='$d_tcsetpgrp'
13964 d_telldir='$d_telldir'
13965 d_telldirproto='$d_telldirproto'
13966 d_time='$d_time'
13967 d_times='$d_times'
13968 d_truncate='$d_truncate'
13969 d_tzname='$d_tzname'
13970 d_umask='$d_umask'
13971 d_uname='$d_uname'
13972 d_union_semun='$d_union_semun'
13973 d_ustat='$d_ustat'
13974 d_vendorbin='$d_vendorbin'
13975 d_vendorlib='$d_vendorlib'
13976 d_vfork='$d_vfork'
13977 d_void_closedir='$d_void_closedir'
13978 d_voidsig='$d_voidsig'
13979 d_voidtty='$d_voidtty'
13980 d_volatile='$d_volatile'
13981 d_vprintf='$d_vprintf'
13982 d_wait4='$d_wait4'
13983 d_waitpid='$d_waitpid'
13984 d_wcstombs='$d_wcstombs'
13985 d_wctomb='$d_wctomb'
13986 d_xenix='$d_xenix'
13987 date='$date'
13988 db_hashtype='$db_hashtype'
13989 db_prefixtype='$db_prefixtype'
13990 defvoidused='$defvoidused'
13991 direntrytype='$direntrytype'
13992 dlext='$dlext'
13993 dlsrc='$dlsrc'
13994 doublesize='$doublesize'
13995 drand01='$drand01'
13996 dynamic_ext='$dynamic_ext'
13997 eagain='$eagain'
13998 ebcdic='$ebcdic'
13999 echo='$echo'
14000 egrep='$egrep'
14001 emacs='$emacs'
14002 eunicefix='$eunicefix'
14003 exe_ext='$exe_ext'
14004 expr='$expr'
14005 extensions='$extensions'
14006 fflushNULL='$fflushNULL'
14007 fflushall='$fflushall'
14008 find='$find'
14009 firstmakefile='$firstmakefile'
14010 flex='$flex'
14011 fpostype='$fpostype'
14012 freetype='$freetype'
14013 full_ar='$full_ar'
14014 full_csh='$full_csh'
14015 full_sed='$full_sed'
14016 gccversion='$gccversion'
14017 gidsign='$gidsign'
14018 gidsize='$gidsize'
14019 gidtype='$gidtype'
14020 glibpth='$glibpth'
14021 grep='$grep'
14022 groupcat='$groupcat'
14023 groupstype='$groupstype'
14024 gzip='$gzip'
14025 h_fcntl='$h_fcntl'
14026 h_sysfile='$h_sysfile'
14027 hint='$hint'
14028 hostcat='$hostcat'
14029 huge='$huge'
14030 i_arpainet='$i_arpainet'
14031 i_bsdioctl='$i_bsdioctl'
14032 i_db='$i_db'
14033 i_dbm='$i_dbm'
14034 i_dirent='$i_dirent'
14035 i_dld='$i_dld'
14036 i_dlfcn='$i_dlfcn'
14037 i_fcntl='$i_fcntl'
14038 i_float='$i_float'
14039 i_gdbm='$i_gdbm'
14040 i_grp='$i_grp'
14041 i_inttypes='$i_inttypes'
14042 i_limits='$i_limits'
14043 i_locale='$i_locale'
14044 i_machcthr='$i_machcthr'
14045 i_malloc='$i_malloc'
14046 i_math='$i_math'
14047 i_memory='$i_memory'
14048 i_mntent='$i_mntent'
14049 i_ndbm='$i_ndbm'
14050 i_netdb='$i_netdb'
14051 i_neterrno='$i_neterrno'
14052 i_netinettcp='$i_netinettcp'
14053 i_niin='$i_niin'
14054 i_poll='$i_poll'
14055 i_pthread='$i_pthread'
14056 i_pwd='$i_pwd'
14057 i_rpcsvcdbm='$i_rpcsvcdbm'
14058 i_sfio='$i_sfio'
14059 i_sgtty='$i_sgtty'
14060 i_shadow='$i_shadow'
14061 i_socks='$i_socks'
14062 i_stdarg='$i_stdarg'
14063 i_stddef='$i_stddef'
14064 i_stdlib='$i_stdlib'
14065 i_string='$i_string'
14066 i_sysaccess='$i_sysaccess'
14067 i_sysdir='$i_sysdir'
14068 i_sysfile='$i_sysfile'
14069 i_sysfilio='$i_sysfilio'
14070 i_sysin='$i_sysin'
14071 i_sysioctl='$i_sysioctl'
14072 i_sysmount='$i_sysmount'
14073 i_sysndir='$i_sysndir'
14074 i_sysparam='$i_sysparam'
14075 i_sysresrc='$i_sysresrc'
14076 i_syssecrt='$i_syssecrt'
14077 i_sysselct='$i_sysselct'
14078 i_syssockio='$i_syssockio'
14079 i_sysstat='$i_sysstat'
14080 i_sysstatfs='$i_sysstatfs'
14081 i_sysstatvfs='$i_sysstatvfs'
14082 i_systime='$i_systime'
14083 i_systimek='$i_systimek'
14084 i_systimes='$i_systimes'
14085 i_systypes='$i_systypes'
14086 i_sysuio='$i_sysuio'
14087 i_sysun='$i_sysun'
14088 i_sysvfs='$i_sysvfs'
14089 i_syswait='$i_syswait'
14090 i_termio='$i_termio'
14091 i_termios='$i_termios'
14092 i_time='$i_time'
14093 i_unistd='$i_unistd'
14094 i_ustat='$i_ustat'
14095 i_utime='$i_utime'
14096 i_values='$i_values'
14097 i_varargs='$i_varargs'
14098 i_varhdr='$i_varhdr'
14099 i_vfork='$i_vfork'
14100 ignore_versioned_solibs='$ignore_versioned_solibs'
14101 incpath='$incpath'
14102 inews='$inews'
14103 installarchlib='$installarchlib'
14104 installbin='$installbin'
14105 installman1dir='$installman1dir'
14106 installman3dir='$installman3dir'
14107 installprefix='$installprefix'
14108 installprefixexp='$installprefixexp'
14109 installprivlib='$installprivlib'
14110 installscript='$installscript'
14111 installsitearch='$installsitearch'
14112 installsitebin='$installsitebin'
14113 installsitelib='$installsitelib'
14114 installstyle='$installstyle'
14115 installusrbinperl='$installusrbinperl'
14116 installvendorbin='$installvendorbin'
14117 installvendorlib='$installvendorlib'
14118 intsize='$intsize'
14119 known_extensions='$known_extensions'
14120 ksh='$ksh'
14121 large='$large'
14122 ld='$ld'
14123 lddlflags='$lddlflags'
14124 ldflags='$ldflags'
14125 ldlibpthname='$ldlibpthname'
14126 less='$less'
14127 lib_ext='$lib_ext'
14128 libc='$libc'
14129 libperl='$libperl'
14130 libpth='$libpth'
14131 libs='$libs'
14132 libswanted='$libswanted'
14133 line='$line'
14134 lint='$lint'
14135 lkflags='$lkflags'
14136 ln='$ln'
14137 lns='$lns'
14138 locincpth='$locincpth'
14139 loclibpth='$loclibpth'
14140 longdblsize='$longdblsize'
14141 longlongsize='$longlongsize'
14142 longsize='$longsize'
14143 lp='$lp'
14144 lpr='$lpr'
14145 ls='$ls'
14146 lseeksize='$lseeksize'
14147 lseektype='$lseektype'
14148 mail='$mail'
14149 mailx='$mailx'
14150 make='$make'
14151 make_set_make='$make_set_make'
14152 mallocobj='$mallocobj'
14153 mallocsrc='$mallocsrc'
14154 malloctype='$malloctype'
14155 man1dir='$man1dir'
14156 man1direxp='$man1direxp'
14157 man1ext='$man1ext'
14158 man3dir='$man3dir'
14159 man3direxp='$man3direxp'
14160 man3ext='$man3ext'
14161 medium='$medium'
14162 mips_type='$mips_type'
14163 mkdir='$mkdir'
14164 models='$models'
14165 modetype='$modetype'
14166 more='$more'
14167 multiarch='$multiarch'
14168 mv='$mv'
14169 myarchname='$myarchname'
14170 mydomain='$mydomain'
14171 myhostname='$myhostname'
14172 myuname='$myuname'
14173 n='$n'
14174 netdb_hlen_type='$netdb_hlen_type'
14175 netdb_host_type='$netdb_host_type'
14176 netdb_name_type='$netdb_name_type'
14177 netdb_net_type='$netdb_net_type'
14178 nm='$nm'
14179 nm_opt='$nm_opt'
14180 nm_so_opt='$nm_so_opt'
14181 nonxs_ext='$nonxs_ext'
14182 nroff='$nroff'
14183 o_nonblock='$o_nonblock'
14184 obj_ext='$obj_ext'
14185 old_pthread_create_joinable='$old_pthread_create_joinable'
14186 optimize='$optimize'
14187 orderlib='$orderlib'
14188 osname='$osname'
14189 osvers='$osvers'
14190 package='$package'
14191 pager='$pager'
14192 passcat='$passcat'
14193 patchlevel='$patchlevel'
14194 path_sep='$path_sep'
14195 perl='$perl'
14196 perladmin='$perladmin'
14197 perlpath='$perlpath'
14198 pg='$pg'
14199 phostname='$phostname'
14200 pidtype='$pidtype'
14201 plibpth='$plibpth'
14202 pm_apiversion='$pm_apiversion'
14203 pmake='$pmake'
14204 pr='$pr'
14205 prefix='$prefix'
14206 prefixexp='$prefixexp'
14207 privlib='$privlib'
14208 privlibexp='$privlibexp'
14209 prototype='$prototype'
14210 ptrsize='$ptrsize'
14211 quadcase='$quadcase'
14212 quadtype='$quadtype'
14213 randbits='$randbits'
14214 randfunc='$randfunc'
14215 randseedtype='$randseedtype'
14216 ranlib='$ranlib'
14217 rd_nodata='$rd_nodata'
14218 rm='$rm'
14219 rmail='$rmail'
14220 runnm='$runnm'
14221 sPRIEldbl='$sPRIEldbl'
14222 sPRIFldbl='$sPRIFldbl'
14223 sPRIGldbl='$sPRIGldbl'
14224 sPRIX64='$sPRIX64'
14225 sPRId64='$sPRId64'
14226 sPRIeldbl='$sPRIeldbl'
14227 sPRIfldbl='$sPRIfldbl'
14228 sPRIgldbl='$sPRIgldbl'
14229 sPRIi64='$sPRIi64'
14230 sPRIo64='$sPRIo64'
14231 sPRIu64='$sPRIu64'
14232 sPRIx64='$sPRIx64'
14233 sched_yield='$sched_yield'
14234 scriptdir='$scriptdir'
14235 scriptdirexp='$scriptdirexp'
14236 sed='$sed'
14237 seedfunc='$seedfunc'
14238 selectminbits='$selectminbits'
14239 selecttype='$selecttype'
14240 sendmail='$sendmail'
14241 sh='$sh'
14242 shar='$shar'
14243 sharpbang='$sharpbang'
14244 shmattype='$shmattype'
14245 shortsize='$shortsize'
14246 shrpenv='$shrpenv'
14247 shsharp='$shsharp'
14248 sig_count='$sig_count'
14249 sig_name='$sig_name'
14250 sig_name_init='$sig_name_init'
14251 sig_num='$sig_num'
14252 sig_num_init='$sig_num_init'
14253 signal_t='$signal_t'
14254 sitearch='$sitearch'
14255 sitearchexp='$sitearchexp'
14256 sitebin='$sitebin'
14257 sitebinexp='$sitebinexp'
14258 sitelib='$sitelib'
14259 sitelibexp='$sitelibexp'
14260 siteprefix='$siteprefix'
14261 siteprefixexp='$siteprefixexp'
14262 sizetype='$sizetype'
14263 sleep='$sleep'
14264 smail='$smail'
14265 small='$small'
14266 so='$so'
14267 sockethdr='$sockethdr'
14268 socketlib='$socketlib'
14269 sort='$sort'
14270 spackage='$spackage'
14271 spitshell='$spitshell'
14272 split='$split'
14273 src='$src'
14274 ssizetype='$ssizetype'
14275 startperl='$startperl'
14276 startsh='$startsh'
14277 static_ext='$static_ext'
14278 stdchar='$stdchar'
14279 stdio_base='$stdio_base'
14280 stdio_bufsiz='$stdio_bufsiz'
14281 stdio_cnt='$stdio_cnt'
14282 stdio_filbuf='$stdio_filbuf'
14283 stdio_ptr='$stdio_ptr'
14284 stdio_stream_array='$stdio_stream_array'
14285 strings='$strings'
14286 submit='$submit'
14287 subversion='$subversion'
14288 sysman='$sysman'
14289 tail='$tail'
14290 tar='$tar'
14291 tbl='$tbl'
14292 tee='$tee'
14293 test='$test'
14294 timeincl='$timeincl'
14295 timetype='$timetype'
14296 touch='$touch'
14297 tr='$tr'
14298 trnl='$trnl'
14299 troff='$troff'
14300 uidsign='$uidsign'
14301 uidsize='$uidsize'
14302 uidtype='$uidtype'
14303 uname='$uname'
14304 uniq='$uniq'
14305 uquadtype='$uquadtype'
14306 use64bits='$use64bits'
14307 usedl='$usedl'
14308 uselargefiles='$uselargefiles'
14309 uselongdouble='$uselongdouble'
14310 uselonglong='$uselonglong'
14311 usemorebits='$usemorebits'
14312 usemultiplicity='$usemultiplicity'
14313 usemymalloc='$usemymalloc'
14314 usenm='$usenm'
14315 useopcode='$useopcode'
14316 useperlio='$useperlio'
14317 useposix='$useposix'
14318 usesfio='$usesfio'
14319 useshrplib='$useshrplib'
14320 usesocks='$usesocks'
14321 usethreads='$usethreads'
14322 usevendorprefix='$usevendorprefix'
14323 usevfork='$usevfork'
14324 usrinc='$usrinc'
14325 uuname='$uuname'
14326 vendorbin='$vendorbin'
14327 vendorbinexp='$vendorbinexp'
14328 vendorlib='$vendorlib'
14329 vendorlibexp='$vendorlibexp'
14330 vendorprefix='$vendorprefix'
14331 vendorprefixexp='$vendorprefixexp'
14332 version='$version'
14333 vi='$vi'
14334 voidflags='$voidflags'
14335 xlibpth='$xlibpth'
14336 xs_apiversion='$xs_apiversion'
14337 zcat='$zcat'
14338 zip='$zip'
14339 EOT
14340
14341 : Add in command line options if available
14342 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14343
14344 : add special variables
14345 $test -f $src/patchlevel.h && \
14346 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14347 echo "CONFIGDOTSH=true" >>config.sh
14348
14349 : propagate old symbols
14350 if $test -f UU/config.sh; then
14351         <UU/config.sh sort | uniq >UU/oldconfig.sh
14352         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14353         sort | uniq -u >UU/oldsyms
14354         set X `cat UU/oldsyms`
14355         shift
14356         case $# in
14357         0) ;;
14358         *)
14359                 cat <<EOM
14360 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14361 EOM
14362                 echo "# Variables propagated from previous config.sh file." >>config.sh
14363                 for sym in `cat UU/oldsyms`; do
14364                         echo "    Propagating $hint variable "'$'"$sym..."
14365                         eval 'tmp="$'"${sym}"'"'
14366                         echo "$tmp" | \
14367                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14368                 done
14369                 ;;
14370         esac
14371 fi
14372
14373 : Finish up by extracting the .SH files
14374 case "$alldone" in
14375 exit)
14376         $rm -rf UU
14377         echo "Done."
14378         exit 0
14379         ;;
14380 cont)
14381         ;;
14382 '')
14383         dflt=''
14384         nostick=true
14385         $cat <<EOM
14386
14387 If you'd like to make any changes to the config.sh file before I begin
14388 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14389
14390 EOM
14391         rp="Press return or use a shell escape to edit config.sh:"
14392         . UU/myread
14393         nostick=''
14394         case "$ans" in
14395         '') ;;
14396         *) : in case they cannot read
14397                 sh 1>&4 -c "$ans";;
14398         esac
14399         ;;
14400 esac
14401
14402 : if this fails, just run all the .SH files by hand
14403 . ./config.sh
14404
14405 echo " "
14406 exec 1>&4
14407 . ./UU/extract
14408
14409 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14410         dflt=y
14411         case "$silent" in
14412         true) ;;
14413         *)
14414                 $cat <<EOM
14415
14416 Now you need to generate make dependencies by running "$make depend".
14417 You might prefer to run it in background: "$make depend > makedepend.out &"
14418 It can take a while, so you might not want to run it right now.
14419
14420 EOM
14421                 ;;
14422         esac
14423         rp="Run $make depend now?"
14424         . UU/myread
14425         case "$ans" in
14426         y*)
14427                 $make depend && echo "Now you must run a $make."
14428                 ;;
14429         *)
14430                 echo "You must run '$make depend' then '$make'."
14431                 ;;
14432         esac
14433 elif test -f [Mm]akefile; then
14434         echo " "
14435         echo "Now you must run a $make."
14436 else
14437         echo "Done."
14438 fi
14439
14440 if $test -f Policy.sh; then
14441     $cat <<EOM
14442
14443 If you compile $package on a different machine or from a different object
14444 directory, copy the Policy.sh file from this object directory to the
14445 new one before you run Configure -- this will help you with most of
14446 the policy defaults.
14447
14448 EOM
14449 fi
14450 if $test -f config.msg; then
14451     echo "Hmm.  I also noted the following information while running:"
14452     echo " "
14453     $cat config.msg >&4
14454     $rm -f config.msg
14455 fi
14456 $rm -f kit*isdone ark*isdone
14457 $rm -rf UU
14458
14459 : End of Configure
14460