ba587706e57e303ea16d91701cf67c5f6872d1c6
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Jan 18 21:42:31 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtold=''
533 d_strtoll=''
534 d_strtoul=''
535 d_strtoull=''
536 d_strtouq=''
537 d_strxfrm=''
538 d_symlink=''
539 d_syscall=''
540 d_sysconf=''
541 d_system=''
542 d_tcgetpgrp=''
543 d_tcsetpgrp=''
544 d_telldirproto=''
545 d_time=''
546 timetype=''
547 clocktype=''
548 d_times=''
549 d_truncate=''
550 d_tzname=''
551 d_umask=''
552 d_semctl_semid_ds=''
553 d_semctl_semun=''
554 d_union_semun=''
555 d_ustat=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 dlext=''
568 cccdlflags=''
569 ccdlflags=''
570 dlsrc=''
571 ld=''
572 lddlflags=''
573 usedl=''
574 doublesize=''
575 ebcdic=''
576 fflushNULL=''
577 fflushall=''
578 fpossize=''
579 fpostype=''
580 gidformat=''
581 gidsign=''
582 gidsize=''
583 gidtype=''
584 groupstype=''
585 h_fcntl=''
586 h_sysfile=''
587 i_arpainet=''
588 db_hashtype=''
589 db_prefixtype=''
590 i_db=''
591 i_dbm=''
592 i_rpcsvcdbm=''
593 d_dirnamlen=''
594 direntrytype=''
595 i_dirent=''
596 i_dld=''
597 i_dlfcn=''
598 i_fcntl=''
599 i_float=''
600 i_gdbm=''
601 d_grpasswd=''
602 i_grp=''
603 i_inttypes=''
604 i_limits=''
605 i_locale=''
606 i_machcthr=''
607 i_malloc=''
608 i_math=''
609 i_memory=''
610 i_mntent=''
611 i_ndbm=''
612 i_netdb=''
613 i_neterrno=''
614 i_netinettcp=''
615 i_niin=''
616 i_sysin=''
617 i_poll=''
618 i_pthread=''
619 d_pwage=''
620 d_pwchange=''
621 d_pwclass=''
622 d_pwcomment=''
623 d_pwexpire=''
624 d_pwgecos=''
625 d_pwpasswd=''
626 d_pwquota=''
627 i_pwd=''
628 i_sfio=''
629 i_shadow=''
630 i_socks=''
631 i_stddef=''
632 i_stdlib=''
633 i_string=''
634 strings=''
635 i_sysaccess=''
636 i_sysdir=''
637 i_sysfile=''
638 d_voidtty=''
639 i_bsdioctl=''
640 i_sysfilio=''
641 i_sysioctl=''
642 i_syssockio=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatfs=''
651 i_sysstatvfs=''
652 i_systimes=''
653 i_systypes=''
654 i_sysuio=''
655 i_sysun=''
656 i_sysvfs=''
657 i_syswait=''
658 i_sgtty=''
659 i_termio=''
660 i_termios=''
661 i_systime=''
662 i_systimek=''
663 i_time=''
664 timeincl=''
665 i_unistd=''
666 i_ustat=''
667 i_utime=''
668 i_values=''
669 i_stdarg=''
670 i_varargs=''
671 i_varhdr=''
672 i_vfork=''
673 inc_version_list=''
674 installprefix=''
675 installprefixexp=''
676 installstyle=''
677 installusrbinperl=''
678 intsize=''
679 longsize=''
680 shortsize=''
681 d_fpos64_t=''
682 d_off64_t=''
683 libc=''
684 ldlibpthname=''
685 libperl=''
686 shrpenv=''
687 useshrplib=''
688 glibpth=''
689 libpth=''
690 loclibpth=''
691 plibpth=''
692 xlibpth=''
693 ignore_versioned_solibs=''
694 libs=''
695 lns=''
696 d_PRIEldbl=''
697 d_PRIFldbl=''
698 d_PRIGldbl=''
699 d_PRIeldbl=''
700 d_PRIfldbl=''
701 d_PRIgldbl=''
702 sPRIEldbl=''
703 sPRIFldbl=''
704 sPRIGldbl=''
705 sPRIeldbl=''
706 sPRIfldbl=''
707 sPRIgldbl=''
708 lseeksize=''
709 lseektype=''
710 make_set_make=''
711 d_mymalloc=''
712 freetype=''
713 mallocobj=''
714 mallocsrc=''
715 malloctype=''
716 usemymalloc=''
717 installman1dir=''
718 man1dir=''
719 man1direxp=''
720 man1ext=''
721 installman3dir=''
722 man3dir=''
723 man3direxp=''
724 man3ext=''
725 huge=''
726 large=''
727 medium=''
728 models=''
729 small=''
730 split=''
731 modetype=''
732 multiarch=''
733 mydomain=''
734 myhostname=''
735 phostname=''
736 c=''
737 n=''
738 d_eofnblk=''
739 eagain=''
740 o_nonblock=''
741 rd_nodata=''
742 netdb_hlen_type=''
743 netdb_host_type=''
744 netdb_name_type=''
745 netdb_net_type=''
746 groupcat=''
747 hostcat=''
748 passcat=''
749 orderlib=''
750 ranlib=''
751 package=''
752 spackage=''
753 pager=''
754 api_revision=''
755 api_subversion=''
756 api_version=''
757 api_versionstring=''
758 patchlevel=''
759 subversion=''
760 version=''
761 perladmin=''
762 perlpath=''
763 i16size=''
764 i16type=''
765 i32size=''
766 i32type=''
767 i64size=''
768 i64type=''
769 i8size=''
770 i8type=''
771 ivsize=''
772 ivtype=''
773 nvsize=''
774 nvtype=''
775 u16size=''
776 u16type=''
777 u32size=''
778 u32type=''
779 u64size=''
780 u64type=''
781 u8size=''
782 u8type=''
783 uvsize=''
784 uvtype=''
785 ivdformat=''
786 uvoformat=''
787 uvuformat=''
788 uvxformat=''
789 pidtype=''
790 prefix=''
791 prefixexp=''
792 installprivlib=''
793 privlib=''
794 privlibexp=''
795 prototype=''
796 ptrsize=''
797 d_PRIX64=''
798 d_PRId64=''
799 d_PRIi64=''
800 d_PRIo64=''
801 d_PRIu64=''
802 d_PRIx64=''
803 sPRIX64=''
804 sPRId64=''
805 sPRIi64=''
806 sPRIo64=''
807 sPRIu64=''
808 sPRIx64=''
809 d_quad=''
810 quadkind=''
811 quadtype=''
812 uquadtype=''
813 drand01=''
814 randbits=''
815 randfunc=''
816 randseedtype=''
817 seedfunc=''
818 installscript=''
819 scriptdir=''
820 scriptdirexp=''
821 selectminbits=''
822 selecttype=''
823 sh=''
824 sig_count=''
825 sig_name=''
826 sig_name_init=''
827 sig_num=''
828 sig_num_init=''
829 installsitearch=''
830 sitearch=''
831 sitearchexp=''
832 installsitebin=''
833 sitebin=''
834 sitebinexp=''
835 installsitelib=''
836 sitelib=''
837 sitelibexp=''
838 siteprefix=''
839 siteprefixexp=''
840 sizetype=''
841 so=''
842 sharpbang=''
843 shsharp=''
844 spitshell=''
845 src=''
846 ssizetype=''
847 startperl=''
848 startsh=''
849 stdchar=''
850 d_stdio_stream_array=''
851 stdio_stream_array=''
852 sysman=''
853 trnl=''
854 uidformat=''
855 uidsign=''
856 uidsize=''
857 uidtype=''
858 archname64=''
859 use64bits=''
860 uselargefiles=''
861 uselongdouble=''
862 uselonglong=''
863 usemorebits=''
864 usemultiplicity=''
865 nm_opt=''
866 nm_so_opt=''
867 runnm=''
868 usenm=''
869 useperlio=''
870 usesocks=''
871 d_oldpthreads=''
872 use5005threads=''
873 useithreads=''
874 usethreads=''
875 incpath=''
876 mips_type=''
877 usrinc=''
878 d_vendorbin=''
879 installvendorbin=''
880 vendorbin=''
881 vendorbinexp=''
882 d_vendorlib=''
883 installvendorlib=''
884 vendorlib=''
885 vendorlibexp=''
886 usevendorprefix=''
887 vendorprefix=''
888 vendorprefixexp=''
889 defvoidused=''
890 voidflags=''
891 CONFIG=''
892
893 define='define'
894 undef='undef'
895 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
896 rmlist=''
897
898 : We must find out about Eunice early
899 eunicefix=':'
900 if test -f /etc/unixtovms; then
901         eunicefix=/etc/unixtovms
902 fi
903 if test -f /etc/unixtovms.exe; then
904         eunicefix=/etc/unixtovms.exe
905 fi
906
907 i_whoami=''
908 : list of known cpp symbols, sorted alphabetically
909 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
910 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
911 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
912 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
913 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
914 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
915 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
916 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
917 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
918 al="$al VMS Xenix286"
919 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
920 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
921 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
922 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
923 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
924 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
925 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
926 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
927 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
928 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
929 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
930 al="$al __SVR4_2__ __UMAXV__"
931 al="$al ____386BSD____ __alpha __alpha__ __amiga"
932 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
933 al="$al __host_mips__"
934 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
935 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
936 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
937 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
938 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
939 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
940 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
941 al="$al __mc88100 __mc88100__ __mips __mips__"
942 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
943 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
944 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
945 al="$al _host_mips _mips _unix"
946 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
947 al="$al apollo ardent att386 att3b"
948 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
949 al="$al cadmus clipper concurrent convex cray ctix"
950 al="$al dmert encore gcos gcx gimpel gould"
951 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
952 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
953 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
954 al="$al i186 i286 i386 i486 i8086"
955 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
956 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
957 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
958 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
959 al="$al mc88000 mc88100 merlin mert mips mvs n16"
960 al="$al ncl_el ncl_mr"
961 al="$al news1500 news1700 news1800 news1900 news3700"
962 al="$al news700 news800 news900 ns16000 ns32000"
963 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
964 al="$al parisc pc532 pdp11 plexus posix pyr"
965 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
966 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
967 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
968 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
969 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
970 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
971 al="$al xenix z8000"
972
973 : set useposix=false in your hint file to disable the POSIX extension.
974 useposix=true
975 : set useopcode=false in your hint file to disable the Opcode extension.
976 useopcode=true
977 : Trailing extension.  Override this in a hint file, if needed.
978 _exe=''
979 : Extra object files, if any, needed on this platform.
980 archobjs=''
981 : Possible local include directories to search.
982 : Set locincpth to "" in a hint file to defeat local include searches.
983 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
984 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
985 :
986 : no include file wanted by default
987 inclwanted=''
988
989 groupstype=''
990 : change the next line if compiling for Xenix/286 on Xenix/386
991 xlibpth='/usr/lib/386 /lib/386'
992
993 : Possible local library directories to search.
994 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
995 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
996
997 : general looking path for locating libraries
998 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
999 glibpth="$glibpth /lib /usr/lib $xlibpth"
1000 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
1001 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1002
1003 : Private path used by Configure to find libraries.  Its value
1004 : is prepended to libpth. This variable takes care of special
1005 : machines, like the mips.  Usually, it should be empty.
1006 plibpth=''
1007
1008 : default library list
1009 libswanted=''
1010 : some systems want to use only the non-versioned libso:s
1011 ignore_versioned_solibs=''
1012 : set usemultiplicity on the Configure command line to enable multiplicity.
1013 : set usesocks on the Configure command line to enable socks.
1014 : set usethreads on the Configure command line to enable threads.
1015 : full support for void wanted by default
1016 defvoidused=15
1017
1018 : List of libraries we want.
1019 : If anyone needs -lnet, put it in a hint file.
1020 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1021 libswanted="$libswanted dld ld sun m c cposix posix"
1022 libswanted="$libswanted ndir dir crypt sec"
1023 libswanted="$libswanted ucb bsd BSD PW x"
1024 : We probably want to search /usr/shlib before most other libraries.
1025 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1026 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1027 glibpth="/usr/shlib $glibpth"
1028 : Do not use vfork unless overridden by a hint file.
1029 usevfork=false
1030
1031 : Find the basic shell for Bourne shell scripts
1032 case "$sh" in
1033 '')
1034         case "$SYSTYPE" in
1035         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1036         *) xxx='/bin/sh';;
1037         esac
1038         if test -f "$xxx"; then
1039                 sh="$xxx"
1040         else
1041                 : Build up a list and do a single loop so we can 'break' out.
1042                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1043                 for xxx in sh bash ksh pdksh ash; do
1044                         for p in $pth; do
1045                                 try="$try ${p}/${xxx}"
1046                         done
1047                 done
1048                 for xxx in $try; do
1049                         if test -f "$xxx"; then
1050                                 sh="$xxx";
1051                                 break
1052                         elif test -f "$xxx.exe"; then
1053                                 sh="$xxx";
1054                                 break
1055                         fi
1056                 done
1057         fi
1058         ;;
1059 esac
1060
1061 case "$sh" in
1062 '')     cat <<EOM >&2
1063 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1064
1065 Usually it's in /bin/sh.  How did you even get this far?
1066 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1067 we'll try to straighten this all out.
1068 EOM
1069         exit 1
1070         ;;
1071 esac
1072
1073 : see if sh knows # comments
1074 if `$sh -c '#' >/dev/null 2>&1`; then
1075         shsharp=true
1076         spitshell=cat
1077         xcat=/bin/cat
1078         test -f $xcat || xcat=/usr/bin/cat
1079         echo "#!$xcat" >try
1080         $eunicefix try
1081         chmod +x try
1082         ./try > today
1083         if test -s today; then
1084                 sharpbang='#!'
1085         else
1086                 echo "#! $xcat" > try
1087                 $eunicefix try
1088                 chmod +x try
1089                 ./try > today
1090                 if test -s today; then
1091                         sharpbang='#! '
1092                 else
1093                         sharpbang=': use '
1094                 fi
1095         fi
1096 else
1097         echo " "
1098         echo "Your $sh doesn't grok # comments--I will strip them later on."
1099         shsharp=false
1100         cd ..
1101         echo "exec grep -v '^[  ]*#'" >spitshell
1102         chmod +x spitshell
1103         $eunicefix spitshell
1104         spitshell=`pwd`/spitshell
1105         cd UU
1106         echo "I presume that if # doesn't work, #! won't work either!"
1107         sharpbang=': use '
1108 fi
1109 rm -f try today
1110
1111 : figure out how to guarantee sh startup
1112 case "$startsh" in
1113 '') startsh=${sharpbang}${sh} ;;
1114 *)
1115 esac
1116 cat >try <<EOSS
1117 $startsh
1118 set abc
1119 test "$?abc" != 1
1120 EOSS
1121
1122 chmod +x try
1123 $eunicefix try
1124 if ./try; then
1125         : echo "Yup, it does."
1126 else
1127         echo "Hmm... '$startsh' does not guarantee sh startup..."
1128         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1129 fi
1130 rm -f try
1131
1132
1133 : Save command line options in file UU/cmdline.opt for later use in
1134 : generating config.sh.
1135 cat > cmdline.opt <<EOSH
1136 # Configure command line arguments.
1137 config_arg0='$0'
1138 config_args='$*'
1139 config_argc=$#
1140 EOSH
1141 argn=1
1142 for arg in "$@"; do
1143         cat >>cmdline.opt <<EOSH
1144 config_arg$argn='$arg'
1145 EOSH
1146         argn=`expr $argn + 1`
1147 done
1148
1149 : produce awk script to parse command line options
1150 cat >options.awk <<'EOF'
1151 BEGIN {
1152         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1153
1154         len = length(optstr);
1155         for (i = 1; i <= len; i++) {
1156                 c = substr(optstr, i, 1);
1157                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1158                 if (a == ":") {
1159                         arg[c] = 1;
1160                         i++;
1161                 }
1162                 opt[c] = 1;
1163         }
1164 }
1165 {
1166         expect = 0;
1167         str = $0;
1168         if (substr(str, 1, 1) != "-") {
1169                 printf("'%s'\n", str);
1170                 next;
1171         }
1172         len = length($0);
1173         for (i = 2; i <= len; i++) {
1174                 c = substr(str, i, 1);
1175                 if (!opt[c]) {
1176                         printf("-%s\n", substr(str, i));
1177                         next;
1178                 }
1179                 printf("-%s\n", c);
1180                 if (arg[c]) {
1181                         if (i < len)
1182                                 printf("'%s'\n", substr(str, i + 1));
1183                         else
1184                                 expect = 1;
1185                         next;
1186                 }
1187         }
1188 }
1189 END {
1190         if (expect)
1191                 print "?";
1192 }
1193 EOF
1194
1195 : process the command line options
1196 set X `for arg in "$@"; do echo "X$arg"; done |
1197         sed -e s/X// | awk -f options.awk`
1198 eval "set $*"
1199 shift
1200 rm -f options.awk
1201
1202 : set up default values
1203 fastread=''
1204 reuseval=false
1205 config_sh=''
1206 alldone=''
1207 error=''
1208 silent=''
1209 extractsh=''
1210 override=''
1211 knowitall=''
1212 rm -f optdef.sh posthint.sh
1213 cat >optdef.sh <<EOS
1214 $startsh
1215 EOS
1216
1217
1218 : option parsing
1219 while test $# -gt 0; do
1220         case "$1" in
1221         -d) shift; fastread=yes;;
1222         -e) shift; alldone=cont;;
1223         -f)
1224                 shift
1225                 cd ..
1226                 if test -r "$1"; then
1227                         config_sh="$1"
1228                 else
1229                         echo "$me: cannot read config file $1." >&2
1230                         error=true
1231                 fi
1232                 cd UU
1233                 shift;;
1234         -h) shift; error=true;;
1235         -r) shift; reuseval=true;;
1236         -s) shift; silent=true; realsilent=true;;
1237         -E) shift; alldone=exit;;
1238         -K) shift; knowitall=true;;
1239         -O) shift; override=true;;
1240         -S) shift; silent=true; extractsh=true;;
1241         -D)
1242                 shift
1243                 case "$1" in
1244                 *=)
1245                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1246                         echo "$me: ignoring -D $1" >&2
1247                         ;;
1248                 *=*) echo "$1" | \
1249                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1250                 *) echo "$1='define'" >> optdef.sh;;
1251                 esac
1252                 shift
1253                 ;;
1254         -U)
1255                 shift
1256                 case "$1" in
1257                 *=) echo "$1" >> optdef.sh;;
1258                 *=*)
1259                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1260                         echo "$me: ignoring -U $1" >&2
1261                         ;;
1262                 *) echo "$1='undef'" >> optdef.sh;;
1263                 esac
1264                 shift
1265                 ;;
1266         -A)
1267             shift
1268             xxx=''
1269             yyy="$1"
1270             zzz=''
1271             uuu=undef
1272             case "$yyy" in
1273             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1274                  case "$zzz" in
1275                  *:*) zzz='' ;;
1276                  *)   xxx=append
1277                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1278                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1279                  esac
1280                  ;;
1281             esac
1282             case "$xxx" in
1283             '')  case "$yyy" in
1284                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1285                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1286                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1287                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1288                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1289                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1290                  esac
1291                  ;;       
1292             esac
1293             case "$xxx" in
1294             append)
1295                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1296             clear)
1297                 echo "$yyy=''"                  >> posthint.sh ;;
1298             define)
1299                 case "$zzz" in
1300                 '') zzz=define ;;
1301                 esac
1302                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1303             eval)
1304                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1305             prepend)
1306                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1307             undef)
1308                 case "$zzz" in
1309                 '') zzz="$uuu" ;;
1310                 esac
1311                 echo "$yyy=$zzz"                >> posthint.sh ;;
1312             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1313             esac
1314             ;;
1315         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1316             exit 0;;
1317         --) break;;
1318         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1319         *) break;;
1320         esac
1321 done
1322
1323 case "$error" in
1324 true)
1325         cat >&2 <<EOM
1326 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1327                  [-U symbol] [-U symbol=] [-A command:symbol...]
1328   -d : use defaults for all answers.
1329   -e : go on without questioning past the production of config.sh.
1330   -f : specify an alternate default configuration file.
1331   -h : print this help message and exit (with an error status).
1332   -r : reuse C symbols value if possible (skips costly nm extraction).
1333   -s : silent mode, only echoes questions and essential information.
1334   -D : define symbol to have some value:
1335          -D symbol         symbol gets the value 'define'
1336          -D symbol=value   symbol gets the value 'value'
1337   -E : stop at the end of questions, after having produced config.sh.
1338   -K : do not use unless you know what you are doing.
1339   -O : let -D and -U override definitions from loaded configuration file.
1340   -S : perform variable substitutions on all .SH files (can mix with -f)
1341   -U : undefine symbol:
1342          -U symbol    symbol gets the value 'undef'
1343          -U symbol=   symbol gets completely empty
1344   -A : manipulate symbol after the platform specific hints have been applied:
1345          -A symbol=value                append " "value to symbol
1346          -A append:symbol=value         append value to symbol
1347          -A define:symbol=value         define symbol to have value
1348          -A clear:symbol                define symbol to be ''
1349          -A define:symbol               define symbol to be 'define'
1350          -A eval:symbol=value           define symbol to be eval of value
1351          -A prepend:symbol=value        prepend value to symbol
1352          -A undef:symbol                define symbol to be 'undef'
1353          -A undef:symbol=               define symbol to be ''
1354   -V : print version number and exit (with a zero status).
1355 EOM
1356         exit 1
1357         ;;
1358 esac
1359
1360 : Sanity checks
1361 case "$fastread$alldone" in
1362 yescont|yesexit) ;;
1363 *)
1364         if test ! -t 0; then
1365                 echo "Say 'sh Configure', not 'sh <Configure'"
1366                 exit 1
1367         fi
1368         ;;
1369 esac
1370
1371 exec 4>&1
1372 case "$silent" in
1373 true) exec 1>/dev/null;;
1374 esac
1375
1376 : run the defines and the undefines, if any, but leave the file out there...
1377 touch optdef.sh
1378 . ./optdef.sh
1379 : create the posthint manipulation script and leave the file out there...
1380 touch posthint.sh
1381
1382 : set package name
1383 package=perl5
1384 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1385 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1386 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1387 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1388 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1389 esac
1390
1391 : Some greps do not return status, grrr.
1392 echo "grimblepritz" >grimble
1393 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1394         contains=contains
1395 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1396         contains=grep
1397 else
1398         contains=contains
1399 fi
1400 rm -f grimble
1401 : the following should work in any shell
1402 case "$contains" in
1403 contains*)
1404         echo " "
1405         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1406         cat >contains <<'EOSS'
1407 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1408 EOSS
1409 chmod +x contains
1410 esac
1411
1412 : Find the path to the source tree
1413 case "$src" in
1414 '') case "$0" in
1415     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1416          case "$src" in
1417          /*)    ;;
1418          *)     src=`cd ../$src && pwd` ;;
1419          esac
1420          ;;
1421     *)   src='.';;
1422     esac;;
1423 esac
1424 case "$src" in
1425 '')     src=/
1426         rsrc=/
1427         ;;
1428 /*) rsrc="$src";;
1429 *) rsrc="../$src";;
1430 esac
1431 if test -f $rsrc/Configure && \
1432         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1433 then
1434    : found it, so we are ok.
1435 else
1436         rsrc=''
1437         for src in . .. ../.. ../../.. ../../../..; do
1438                 if test -f ../$src/Configure && \
1439                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1440                 then
1441                         rsrc=../$src
1442                         break
1443                 fi
1444         done
1445 fi
1446 case "$rsrc" in
1447 '')
1448         cat <<EOM >&4
1449
1450 Sorry, I can't seem to locate the source dir for $package.  Please start
1451 Configure with an explicit path -- i.e. /some/path/Configure.
1452
1453 EOM
1454         exit 1
1455         ;;
1456 ../.)   rsrc='..';;
1457 *)
1458         echo " "
1459         echo "Sources for $package found in \"$src\"." >&4
1460         ;;
1461 esac
1462
1463 : script used to extract .SH files with variable substitutions
1464 cat >extract <<'EOS'
1465 CONFIGDOTSH=true
1466 echo "Doing variable substitutions on .SH files..."
1467 if test -f $src/MANIFEST; then
1468         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1469 else
1470         echo "(Looking for .SH files under the source directory.)"
1471         set x `(cd $src; find . -name "*.SH" -print)`
1472 fi
1473 shift
1474 case $# in
1475 0) set x `(cd $src; echo *.SH)`; shift;;
1476 esac
1477 if test ! -f $src/$1; then
1478         shift
1479 fi
1480 mkdir_p='
1481 name=$1;
1482 create="";
1483 while test $name; do
1484         if test ! -d "$name"; then
1485                 create="$name $create";
1486                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1487                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1488         else
1489                 name="";
1490         fi;
1491 done;
1492 for file in $create; do
1493         mkdir $file;
1494 done
1495 '
1496 for file in $*; do
1497         case "$src" in
1498         ".")
1499                 case "$file" in
1500                 */*)
1501                         dir=`expr X$file : 'X\(.*\)/'`
1502                         file=`expr X$file : 'X.*/\(.*\)'`
1503                         (cd $dir && . ./$file)
1504                         ;;
1505                 *)
1506                         . ./$file
1507                         ;;
1508                 esac
1509                 ;;
1510         *)
1511                 case "$file" in
1512                 */*)
1513                         dir=`expr X$file : 'X\(.*\)/'`
1514                         file=`expr X$file : 'X.*/\(.*\)'`
1515                         (set x $dir; shift; eval $mkdir_p)
1516                         sh <$src/$dir/$file
1517                         ;;
1518                 *)
1519                         sh <$src/$file
1520                         ;;
1521                 esac
1522                 ;;
1523         esac
1524 done
1525 if test -f $src/config_h.SH; then
1526         if test ! -f config.h; then
1527         : oops, they left it out of MANIFEST, probably, so do it anyway.
1528         . $src/config_h.SH
1529         fi
1530 fi
1531 EOS
1532
1533 : extract files and exit if asked to do so
1534 case "$extractsh" in
1535 true)
1536         case "$realsilent" in
1537         true) ;;
1538         *) exec 1>&4;;
1539         esac
1540         case "$config_sh" in
1541         '') config_sh='config.sh';;
1542         esac
1543         echo " "
1544         echo "Fetching answers from $config_sh..."
1545         cd ..
1546         . $config_sh
1547         test "$override" && . ./optdef.sh
1548         echo " "
1549         . UU/extract
1550         rm -rf UU
1551         echo "Done."
1552         exit 0
1553         ;;
1554 esac
1555
1556 : Eunice requires " " instead of "", can you believe it
1557 echo " "
1558 : Here we go...
1559 echo "Beginning of configuration questions for $package."
1560
1561 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1562
1563 : first determine how to suppress newline on echo command
1564 echo " "
1565 echo "Checking echo to see how to suppress newlines..."
1566 (echo "hi there\c" ; echo " ") >.echotmp
1567 if $contains c .echotmp >/dev/null 2>&1 ; then
1568         echo "...using -n."
1569         n='-n'
1570         c=''
1571 else
1572         cat <<'EOM'
1573 ...using \c
1574 EOM
1575         n=''
1576         c='\c'
1577 fi
1578 echo $n "The star should be here-->$c"
1579 echo '*'
1580 rm -f .echotmp
1581
1582 : Now test for existence of everything in MANIFEST
1583 echo " "
1584 if test -f $rsrc/MANIFEST; then
1585         echo "First let's make sure your kit is complete.  Checking..." >&4
1586         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1587         rm -f missing
1588         tmppwd=`pwd`
1589         for filelist in x??; do
1590                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1591         done
1592         if test -s missing; then
1593                 cat missing >&4
1594                 cat >&4 <<'EOM'
1595
1596 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1597
1598 You have the option of continuing the configuration process, despite the
1599 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1600 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1601 and contact the author (perlbug@perl.com).
1602
1603 EOM
1604                 echo $n "Continue? [n] $c" >&4
1605                 read ans
1606                 case "$ans" in
1607                 y*)
1608                         echo "Continuing..." >&4
1609                         rm -f missing
1610                         ;;
1611                 *)
1612                         echo "ABORTING..." >&4
1613                         kill $$
1614                         ;;
1615                 esac
1616         else
1617                 echo "Looks good..."
1618         fi
1619 else
1620         echo "There is no MANIFEST file.  I hope your kit is complete !"
1621 fi
1622 rm -f missing x??
1623
1624 echo " "
1625 : Find the appropriate value for a newline for tr
1626 if test -n "$DJGPP"; then
1627        trnl='\012'
1628 fi
1629 if test X"$trnl" = X; then
1630         case "`echo foo|tr '\n' x 2>/dev/null`" in
1631         foox) trnl='\n' ;;
1632         esac
1633 fi
1634 if test X"$trnl" = X; then
1635         case "`echo foo|tr '\012' x 2>/dev/null`" in
1636         foox) trnl='\012' ;;
1637         esac
1638 fi
1639 if test X"$trnl" = X; then
1640         cat <<EOM >&2
1641
1642 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1643
1644 EOM
1645         exit 1
1646 fi
1647
1648 : compute the number of columns on the terminal for proper question formatting
1649 case "$COLUMNS" in
1650 '') COLUMNS='80';;
1651 esac
1652
1653 : set up the echo used in my read
1654 myecho="case \"\$xxxm\" in
1655 '') echo $n \"\$rp $c\" >&4;;
1656 *) case \"\$rp\" in
1657         '') echo $n \"[\$xxxm] $c\";;
1658         *)
1659                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1660                         echo \"\$rp\" >&4
1661                         echo $n \"[\$xxxm] $c\" >&4
1662                 else
1663                         echo $n \"\$rp [\$xxxm] $c\" >&4
1664                 fi
1665                 ;;
1666         esac;;
1667 esac"
1668
1669 : now set up to do reads with possible shell escape and default assignment
1670 cat <<EOSC >myread
1671 $startsh
1672 xxxm=\$dflt
1673 $myecho
1674 ans='!'
1675 case "\$fastread" in
1676 yes) case "\$dflt" in
1677         '') ;;
1678         *) ans='';
1679                 case "\$silent-\$rp" in
1680                 true-) ;;
1681                 *) echo " " >&4;;
1682                 esac;;
1683         esac;;
1684 *) case "\$silent" in
1685         true) case "\$rp" in
1686                 '') ans='';;
1687                 esac;;
1688         esac;;
1689 esac
1690 while expr "X\$ans" : "X!" >/dev/null; do
1691         read answ
1692         set x \$xxxm
1693         shift
1694         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1695         case  "\$answ" in
1696         "!")
1697                 sh 1>&4
1698                 echo " "
1699                 $myecho
1700                 ;;
1701         !*)
1702                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1703                 shift
1704                 sh 1>&4 -c "\$*"
1705                 echo " "
1706                 $myecho
1707                 ;;
1708         "\$ans")
1709                 case "\$ans" in
1710                 \\&*)
1711                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1712                         shift
1713                         case "\$1" in
1714                         -d)
1715                                 fastread=yes
1716                                 echo "(OK, I'll run with -d after this question.)" >&4
1717                                 ;;
1718                         -*)
1719                                 echo "*** Sorry, \$1 not supported yet." >&4
1720                                 ;;
1721                         esac
1722                         $myecho
1723                         ans=!
1724                         ;;
1725                 esac;;
1726         *)
1727                 case "\$aok" in
1728                 y)
1729                         echo "*** Substitution done -- please confirm."
1730                         xxxm="\$ans"
1731                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1732                         xxxm="\$ans"
1733                         ans=!
1734                         ;;
1735                 *)
1736                         echo "*** Error -- try again."
1737                         ans=!
1738                         ;;
1739                 esac
1740                 $myecho
1741                 ;;
1742         esac
1743         case "\$ans\$xxxm\$nostick" in
1744         '')
1745                 ans=!
1746                 $myecho
1747                 ;;
1748         esac
1749 done
1750 case "\$ans" in
1751 '') ans="\$xxxm";;
1752 esac
1753 EOSC
1754
1755 : create .config dir to save info across Configure sessions
1756 test -d ../.config || mkdir ../.config
1757 cat >../.config/README <<EOF
1758 This directory created by Configure to save information that should
1759 persist across sessions for $package.
1760
1761 You may safely delete it if you wish.
1762 EOF
1763
1764 : general instructions
1765 needman=true
1766 firsttime=true
1767 user=`(logname) 2>/dev/null`
1768 case "$user" in
1769 '') user=`whoami 2>&1`;;
1770 esac
1771 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1772         firsttime=false
1773         echo " "
1774         rp='Would you like to see the instructions?'
1775         dflt=n
1776         . ./myread
1777         case "$ans" in
1778         [yY]*) ;;
1779         *) needman=false;;
1780         esac
1781 fi
1782 if $needman; then
1783         cat <<EOH
1784
1785 This installation shell script will examine your system and ask you questions
1786 to determine how the perl5 package should be installed. If you get
1787 stuck on a question, you may use a ! shell escape to start a subshell or
1788 execute a command.  Many of the questions will have default answers in square
1789 brackets; typing carriage return will give you the default.
1790
1791 On some of the questions which ask for file or directory names you are allowed
1792 to use the ~name construct to specify the login directory belonging to "name",
1793 even if you don't have a shell which knows about that.  Questions where this is
1794 allowed will be marked "(~name ok)".
1795
1796 EOH
1797         rp=''
1798         dflt='Type carriage return to continue'
1799         . ./myread
1800         cat <<'EOH'
1801
1802 The prompter used in this script allows you to use shell variables and
1803 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1804 in the default answer, as if the default line was a set of arguments given to a
1805 script shell.  This means you may also use $* to repeat the whole default line,
1806 so you do not have to re-type everything to add something to the default.
1807
1808 Everytime there is a substitution, you will have to confirm.  If there is an
1809 error (e.g. an unmatched backtick), the default answer will remain unchanged
1810 and you will be prompted again.
1811
1812 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1813 the questions and use the computed defaults (or the previous answers if there
1814 was already a config.sh file). Type 'Configure -h' for a list of options.
1815 You may also start interactively and then answer '& -d' at any prompt to turn
1816 on the non-interactive behaviour for the remainder of the execution.
1817
1818 EOH
1819         . ./myread
1820         cat <<EOH
1821
1822 Much effort has been expended to ensure that this shell script will run on any
1823 Unix system.  If despite that it blows up on yours, your best bet is to edit
1824 Configure and run it again.  If you can't run Configure for some reason,
1825 you'll have to generate a config.sh file by hand.  Whatever problems you
1826 have, let me (perlbug@perl.com) know how I blew it.
1827
1828 This installation script affects things in two ways:
1829
1830 1) it may do direct variable substitutions on some of the files included
1831    in this kit.
1832 2) it builds a config.h file for inclusion in C programs.  You may edit
1833    any of these files as the need arises after running this script.
1834
1835 If you make a mistake on a question, there is no easy way to back up to it
1836 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1837 files.  Configure will offer to let you do this before it runs the SH files.
1838
1839 EOH
1840         dflt='Type carriage return to continue'
1841         . ./myread
1842         case "$firsttime" in
1843         true) echo $user >>../.config/instruct;;
1844         esac
1845 fi
1846
1847 : find out where common programs are
1848 echo " "
1849 echo "Locating common programs..." >&4
1850 cat <<EOSC >loc
1851 $startsh
1852 case \$# in
1853 0) exit 1;;
1854 esac
1855 thing=\$1
1856 shift
1857 dflt=\$1
1858 shift
1859 for dir in \$*; do
1860         case "\$thing" in
1861         .)
1862         if test -d \$dir/\$thing; then
1863                 echo \$dir
1864                 exit 0
1865         fi
1866         ;;
1867         *)
1868         for thisthing in \$dir/\$thing; do
1869                 : just loop through to pick last item
1870         done
1871         if test -f \$thisthing; then
1872                 echo \$thisthing
1873                 exit 0
1874         elif test -f \$dir/\$thing.exe; then
1875                 if test -n "$DJGPP"; then
1876                         echo \$dir/\$thing.exe
1877                 else
1878                         : on Eunice apparently
1879                         echo \$dir/\$thing
1880                 fi
1881                 exit 0
1882         fi
1883         ;;
1884         esac
1885 done
1886 echo \$dflt
1887 exit 1
1888 EOSC
1889 chmod +x loc
1890 $eunicefix loc
1891 loclist="
1892 awk
1893 cat
1894 comm
1895 cp
1896 echo
1897 expr
1898 grep
1899 ls
1900 make
1901 mkdir
1902 rm
1903 sed
1904 sort
1905 touch
1906 tr
1907 uniq
1908 "
1909 trylist="
1910 Mcc
1911 ar
1912 byacc
1913 cpp
1914 csh
1915 date
1916 egrep
1917 gzip
1918 less
1919 ln
1920 more
1921 nm
1922 nroff
1923 perl
1924 pg
1925 test
1926 uname
1927 zip
1928 "
1929 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1930 pth="$pth /lib /usr/lib"
1931 for file in $loclist; do
1932         eval xxx=\$$file
1933         case "$xxx" in
1934         /*|?:[\\/]*)
1935                 if test -f "$xxx"; then
1936                         : ok
1937                 else
1938                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1939                         xxx=`./loc $file $file $pth`
1940                 fi
1941                 ;;
1942         '') xxx=`./loc $file $file $pth`;;
1943         *) xxx=`./loc $xxx $xxx $pth`;;
1944         esac
1945         eval $file=$xxx
1946         eval _$file=$xxx
1947         case "$xxx" in
1948         /*)
1949                 echo $file is in $xxx.
1950                 ;;
1951         ?:[\\/]*)
1952                 echo $file is in $xxx.
1953                 ;;
1954         *)
1955                 echo "I don't know where '$file' is, and my life depends on it." >&4
1956                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1957                 exit 1
1958                 ;;
1959         esac
1960 done
1961 echo " "
1962 echo "Don't worry if any of the following aren't found..."
1963 say=offhand
1964 for file in $trylist; do
1965         eval xxx=\$$file
1966         case "$xxx" in
1967         /*|?:[\\/]*)
1968                 if test -f "$xxx"; then
1969                         : ok
1970                 else
1971                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1972                         xxx=`./loc $file $file $pth`
1973                 fi
1974                 ;;
1975         '') xxx=`./loc $file $file $pth`;;
1976         *) xxx=`./loc $xxx $xxx $pth`;;
1977         esac
1978         eval $file=$xxx
1979         eval _$file=$xxx
1980         case "$xxx" in
1981         /*)
1982                 echo $file is in $xxx.
1983                 ;;
1984         ?:[\\/]*)
1985                 echo $file is in $xxx.
1986                 ;;
1987         *)
1988                 echo "I don't see $file out there, $say."
1989                 say=either
1990                 ;;
1991         esac
1992 done
1993 case "$egrep" in
1994 egrep)
1995         echo "Substituting grep for egrep."
1996         egrep=$grep
1997         ;;
1998 esac
1999 case "$ln" in
2000 ln)
2001         echo "Substituting cp for ln."
2002         ln=$cp
2003         ;;
2004 esac
2005 case "$test" in
2006 test)
2007         echo "Hopefully test is built into your sh."
2008         ;;
2009 *)
2010         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2011                 echo "Using the test built into your sh."
2012                 test=test
2013                 _test=test
2014         fi
2015         ;;
2016 esac
2017 case "$echo" in
2018 echo)
2019         echo "Hopefully echo is built into your sh."
2020         ;;
2021 '') ;;
2022 *)
2023         echo " "
2024 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2025         $echo $n "hi there$c" >foo1
2026         echo $n "hi there$c" >foo2
2027         if cmp foo1 foo2 >/dev/null 2>&1; then
2028                 echo "They are compatible.  In fact, they may be identical."
2029         else
2030                 case "$n" in
2031                 '-n') n='' c='\c';;
2032                 *) n='-n' c='';;
2033                 esac
2034                 cat <<FOO
2035 They are not compatible!  You are probably running ksh on a non-USG system.
2036 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2037 have echo built in and we may have to run some Bourne shell scripts.  That
2038 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2039
2040 FOO
2041                 $echo $n "The star should be here-->$c"
2042                 $echo "*"
2043         fi
2044         $rm -f foo1 foo2
2045         ;;
2046 esac
2047
2048 : determine whether symbolic links are supported
2049 echo " "
2050 $touch blurfl
2051 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2052         echo "Symbolic links are supported." >&4
2053         lns="$ln -s"
2054 else
2055         echo "Symbolic links are NOT supported." >&4
2056         lns="$ln"
2057 fi
2058 $rm -f blurfl sym
2059
2060 : see whether [:lower:] and [:upper:] are supported character classes
2061 echo " "
2062 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2063 ABYZ)
2064         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2065         up='[:upper:]'
2066         low='[:lower:]'
2067         ;;
2068 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2069         # (0xc9 and 0xd1), therefore that is a nice testing point.
2070         if test "X$up" = X -o "X$low" = X; then
2071             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2072             ij) up='[A-Z]'
2073                 low='[a-z]'
2074                 ;;
2075             esac
2076         fi
2077         if test "X$up" = X -o "X$low" = X; then
2078             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2079             ij) up='A-Z'
2080                 low='a-z'
2081                 ;;
2082             esac
2083         fi
2084         if test "X$up" = X -o "X$low" = X; then
2085             case "`echo IJ | od -x 2>/dev/null`" in
2086             *C9D1*|*c9d1*)
2087                 echo "Hey, this might be EBCDIC." >&4
2088                 if test "X$up" = X -o "X$low" = X; then
2089                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2090                     ij) up='[A-IJ-RS-Z]'
2091                         low='[a-ij-rs-z]'
2092                         ;;
2093                     esac
2094                 fi
2095                 if test "X$up" = X -o "X$low" = X; then
2096                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2097                     ij) up='A-IJ-RS-Z'
2098                         low='a-ij-rs-z'
2099                         ;;
2100                     esac
2101                 fi
2102                 ;;
2103             esac
2104         fi
2105 esac
2106 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2107 ij)
2108     echo "Using $up and $low to convert case." >&4
2109     ;;
2110 *)
2111     echo "I don't know how to translate letters from upper to lower case." >&4
2112     echo "Your tr is not acting any way I know of." >&4
2113     exit 1
2114     ;;
2115 esac
2116 : set up the translation script tr, must be called with ./tr of course
2117 cat >tr <<EOSC
2118 $startsh
2119 case "\$1\$2" in
2120 '[A-Z][a-z]') exec $tr '$up' '$low';;
2121 '[a-z][A-Z]') exec $tr '$low' '$up';;
2122 esac
2123 exec $tr "\$@"
2124 EOSC
2125 chmod +x tr
2126 $eunicefix tr
2127
2128 : Try to determine whether config.sh was made on this system
2129 case "$config_sh" in
2130 '')
2131 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2132 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2133 # because the A-Z/a-z are not consecutive.
2134 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2135         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2136 newmyuname="$myuname"
2137 dflt=n
2138 case "$knowitall" in
2139 '')
2140         if test -f ../config.sh; then
2141                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2142                         eval "`grep myuname= ../config.sh`"
2143                 fi
2144                 if test "X$myuname" = "X$newmyuname"; then
2145                         dflt=y
2146                 fi
2147         fi
2148         ;;
2149 *) dflt=y;;
2150 esac
2151
2152 : Get old answers from old config file if Configure was run on the
2153 : same system, otherwise use the hints.
2154 hint=default
2155 cd ..
2156 if test -f config.sh; then
2157         echo " "
2158         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2159         . UU/myread
2160         case "$ans" in
2161         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2162         *)  echo "Fetching default answers from your old config.sh file..." >&4
2163                 tmp_n="$n"
2164                 tmp_c="$c"
2165                 tmp_sh="$sh"
2166                 . ./config.sh
2167                 cp config.sh UU
2168                 n="$tmp_n"
2169                 c="$tmp_c"
2170                 : Older versions did not always set $sh.  Catch re-use of such
2171                 : an old config.sh.
2172                 case "$sh" in
2173                 '') sh="$tmp_sh" ;;
2174                 esac
2175                 hint=previous
2176                 ;;
2177         esac
2178 fi
2179 if test ! -f config.sh; then
2180         $cat <<EOM
2181
2182 First time through, eh?  I have some defaults handy for some systems
2183 that need some extra help getting the Configure answers right:
2184
2185 EOM
2186         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2187         dflt=''
2188         : Half the following guesses are probably wrong... If you have better
2189         : tests or hints, please send them to perlbug@perl.com
2190         : The metaconfig authors would also appreciate a copy...
2191         $test -f /irix && osname=irix
2192         $test -f /xenix && osname=sco_xenix
2193         $test -f /dynix && osname=dynix
2194         $test -f /dnix && osname=dnix
2195         $test -f /lynx.os && osname=lynxos
2196         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2197         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2198         $test -f /bin/mips && /bin/mips && osname=mips
2199         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2200                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2201         $test -d /usr/apollo/bin && osname=apollo
2202         $test -f /etc/saf/_sactab && osname=svr4
2203         $test -d /usr/include/minix && osname=minix
2204         if $test -d /MachTen -o -d /MachTen_Folder; then
2205                 osname=machten
2206                 if $test -x /sbin/version; then
2207                         osvers=`/sbin/version | $awk '{print $2}' |
2208                         $sed -e 's/[A-Za-z]$//'`
2209                 elif $test -x /usr/etc/version; then
2210                         osvers=`/usr/etc/version | $awk '{print $2}' |
2211                         $sed -e 's/[A-Za-z]$//'`
2212                 else
2213                         osvers="$2.$3"
2214                 fi
2215         fi
2216
2217         $test -f /sys/posix.dll &&
2218                 $test -f /usr/bin/what &&
2219                 set X `/usr/bin/what /sys/posix.dll` &&
2220                 $test "$3" = UWIN &&
2221                 osname=uwin &&
2222                 osvers="$5"
2223
2224         if $test -f $uname; then
2225                 set X $myuname
2226                 shift
2227
2228                 case "$5" in
2229                 fps*) osname=fps ;;
2230                 mips*)
2231                         case "$4" in
2232                         umips) osname=umips ;;
2233                         *) osname=mips ;;
2234                         esac;;
2235                 [23]100) osname=mips ;;
2236                 next*) osname=next ;;
2237                 i386*)
2238                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2239                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2240                                 osname='sco'
2241                                 osvers=$tmp
2242                         elif $test -f /etc/kconfig; then
2243                                 osname=isc
2244                                 if test "$lns" = "$ln -s"; then
2245                                         osvers=4
2246                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2247                                         osvers=3
2248                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2249                                         osvers=2
2250                                 fi
2251                         fi
2252                         tmp=''
2253                         ;;
2254                 pc*)
2255                         if test -n "$DJGPP"; then
2256                                 osname=dos
2257                                 osvers=djgpp
2258                         fi
2259                         ;;
2260                 esac
2261
2262                 case "$1" in
2263                 aix) osname=aix
2264                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2265                         case "$tmp" in
2266                         'not found') osvers="$4"."$3" ;;
2267                         '<3240'|'<>3240') osvers=3.2.0 ;;
2268                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2269                         '=3250'|'>3250') osvers=3.2.5 ;;
2270                         *) osvers=$tmp;;
2271                         esac
2272                         ;;
2273                 bsd386) osname=bsd386
2274                         osvers=`$uname -r`
2275                         ;;
2276                 cygwin*) osname=cygwin
2277                         osvers="$3"
2278                         ;;
2279                 *dc.osx) osname=dcosx
2280                         osvers="$3"
2281                         ;;
2282                 dnix) osname=dnix
2283                         osvers="$3"
2284                         ;;
2285                 domainos) osname=apollo
2286                         osvers="$3"
2287                         ;;
2288                 dgux) osname=dgux 
2289                         osvers="$3"
2290                         ;;
2291                 dynixptx*) osname=dynixptx
2292                         osvers=`echo "$4"|sed 's/^v//'`
2293                         ;;
2294                 freebsd) osname=freebsd 
2295                         osvers="$3" ;;
2296                 genix) osname=genix ;;
2297                 hp*) osname=hpux 
2298                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2299                         ;;
2300                 irix*) osname=irix
2301                         case "$3" in
2302                         4*) osvers=4 ;;
2303                         5*) osvers=5 ;;
2304                         *)      osvers="$3" ;;
2305                         esac
2306                         ;;
2307                 linux) osname=linux
2308                         case "$3" in
2309                         *)      osvers="$3" ;;
2310                         esac
2311                         ;;
2312                 MiNT) osname=mint
2313                         ;;
2314                 netbsd*) osname=netbsd
2315                         osvers="$3"
2316                         ;;
2317                 news-os) osvers="$3"
2318                         case "$3" in
2319                         4*) osname=newsos4 ;;
2320                         *) osname=newsos ;;
2321                         esac
2322                         ;;
2323                 next*) osname=next ;;
2324                 POSIX-BC | posix-bc ) osname=posix-bc
2325                         osvers="$3"
2326                         ;;
2327                 powerux | power_ux | powermax_os | powermaxos | \
2328                 powerunix | power_unix) osname=powerux
2329                         osvers="$3"
2330                         ;;
2331                 qnx) osname=qnx
2332                         osvers="$4"
2333                         ;;
2334                 solaris) osname=solaris
2335                         case "$3" in
2336                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2337                         *)      osvers="$3" ;;
2338                         esac
2339                         ;;
2340                 sunos) osname=sunos
2341                         case "$3" in
2342                         5*) osname=solaris
2343                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2344                         *)      osvers="$3" ;;
2345                         esac
2346                         ;;
2347                 titanos) osname=titanos
2348                         case "$3" in
2349                         1*) osvers=1 ;;
2350                         2*) osvers=2 ;;
2351                         3*) osvers=3 ;;
2352                         4*) osvers=4 ;;
2353                         *)      osvers="$3" ;;
2354                         esac
2355                         ;;
2356                 ultrix) osname=ultrix
2357                         osvers="$3"
2358                         ;;
2359                 osf1|mls+)      case "$5" in
2360                                 alpha)
2361                                         osname=dec_osf
2362                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2363                                         ;;
2364                         hp*)    osname=hp_osf1  ;;
2365                         mips)   osname=mips_osf1 ;;
2366                         esac
2367                         ;;
2368                 unixware) osname=svr5
2369                         osvers="$4"
2370                         ;;
2371                 uts) osname=uts
2372                         osvers="$3"
2373                         ;;
2374                 $2) case "$osname" in
2375                         *isc*) ;;
2376                         *freebsd*) ;;
2377                         svr*)
2378                                 : svr4.x or possibly later
2379                                 case "svr$3" in 
2380                                 ${osname}*)
2381                                         osname=svr$3
2382                                         osvers=$4
2383                                         ;;
2384                                 esac
2385                                 case "$osname" in
2386                                 svr4.0)
2387                                         : Check for ESIX
2388                                         if test -f /stand/boot ; then
2389                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2390                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2391                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2392                                                         if test -n "$isesix"; then
2393                                                                 osname=esix4
2394                                                         fi
2395                                                 fi
2396                                         fi
2397                                         ;;
2398                                 esac
2399                                 ;;
2400                         *)      if test -f /etc/systemid; then
2401                                         osname=sco
2402                                         set `echo $3 | $sed 's/\./ /g'` $4
2403                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2404                                                 osvers=$1.$2.$3
2405                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2406                                                 osvers=$1.$2
2407                                         elif $test -f $src/hints/sco_$1.sh; then
2408                                                 osvers=$1
2409                                         fi
2410                                 else
2411                                         case "$osname" in
2412                                         '') : Still unknown.  Probably a generic Sys V.
2413                                                 osname="sysv"
2414                                                 osvers="$3"
2415                                                 ;;
2416                                         esac
2417                                 fi
2418                                 ;;
2419                         esac
2420                         ;;
2421                 *)      case "$osname" in
2422                         '') : Still unknown.  Probably a generic BSD.
2423                                 osname="$1"
2424                                 osvers="$3"
2425                                 ;;
2426                         esac
2427                         ;;
2428                 esac
2429         else
2430                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2431                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2432                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2433                                 osname=news_os
2434                         fi
2435                         $rm -f UU/kernel.what
2436                 elif test -d c:/.; then
2437                         set X $myuname
2438                         osname=os2
2439                         osvers="$5"
2440                 fi
2441         fi
2442         
2443         : Now look for a hint file osname_osvers, unless one has been
2444         : specified already.
2445         case "$hintfile" in
2446         ''|' ')
2447                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2448                 : Also try without trailing minor version numbers.
2449                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2450                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2451                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2452                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2453                 case "$file" in
2454                 '') dflt=none ;;
2455                 *)  case "$osvers" in
2456                         '') dflt=$file
2457                                 ;;
2458                         *)  if $test -f $src/hints/$file.sh ; then
2459                                         dflt=$file
2460                                 elif $test -f $src/hints/$xfile.sh ; then
2461                                         dflt=$xfile
2462                                 elif $test -f $src/hints/$xxfile.sh ; then
2463                                         dflt=$xxfile
2464                                 elif $test -f $src/hints/$xxxfile.sh ; then
2465                                         dflt=$xxxfile
2466                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2467                                         dflt=$xxxxfile
2468                                 elif $test -f "$src/hints/${osname}.sh" ; then
2469                                         dflt="${osname}"
2470                                 else
2471                                         dflt=none
2472                                 fi
2473                                 ;;
2474                         esac
2475                         ;;
2476                 esac
2477                 if $test -f Policy.sh ; then
2478                         case "$dflt" in
2479                         *Policy*) ;;
2480                         none) dflt="Policy" ;;
2481                         *) dflt="Policy $dflt" ;;
2482                         esac
2483                 fi
2484                 ;;
2485         *)
2486                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2487                 ;;
2488         esac
2489
2490         if $test -f Policy.sh ; then
2491                 $cat <<EOM
2492
2493 There's also a Policy hint file available, which should make the
2494 site-specific (policy) questions easier to answer.
2495 EOM
2496
2497         fi
2498
2499         $cat <<EOM
2500
2501 You may give one or more space-separated answers, or "none" if appropriate.
2502 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2503 is a good thing.  DO NOT give a wrong version or a wrong OS.
2504
2505 EOM
2506
2507         rp="Which of these apply, if any?"
2508         . UU/myread
2509         tans=$ans
2510         for file in $tans; do
2511                 if $test X$file = XPolicy -a -f Policy.sh; then
2512                         . Policy.sh
2513                         $cat Policy.sh >> UU/config.sh
2514                 elif $test -f $src/hints/$file.sh; then
2515                         . $src/hints/$file.sh
2516                         $cat $src/hints/$file.sh >> UU/config.sh
2517                 elif $test X$tans = X -o X$tans = Xnone ; then
2518                         : nothing
2519                 else
2520                         : Give one chance to correct a possible typo.
2521                         echo "$file.sh does not exist"
2522                         dflt=$file
2523                         rp="hint to use instead?"
2524                         . UU/myread
2525                         for file in $ans; do
2526                                 if $test -f "$src/hints/$file.sh"; then
2527                                         . $src/hints/$file.sh
2528                                         $cat $src/hints/$file.sh >> UU/config.sh
2529                                 elif $test X$ans = X -o X$ans = Xnone ; then
2530                                         : nothing
2531                                 else
2532                                         echo "$file.sh does not exist -- ignored."
2533                                 fi
2534                         done
2535                 fi
2536         done
2537
2538         hint=recommended
2539         : Remember our hint file for later.
2540         if $test -f "$src/hints/$file.sh" ; then
2541                 hintfile="$file"
2542         else
2543                 hintfile=''
2544         fi
2545 fi
2546 cd UU
2547 ;;
2548 *)
2549         echo " "
2550         echo "Fetching default answers from $config_sh..." >&4
2551         tmp_n="$n"
2552         tmp_c="$c"
2553         cd ..
2554         cp $config_sh config.sh 2>/dev/null
2555         chmod +w config.sh
2556         . ./config.sh
2557         cd UU
2558         cp ../config.sh .
2559         n="$tmp_n"
2560         c="$tmp_c"
2561         hint=previous
2562         ;;
2563 esac
2564 test "$override" && . ./optdef.sh
2565 myuname="$newmyuname"
2566
2567 : Restore computed paths
2568 for file in $loclist $trylist; do
2569         eval $file="\$_$file"
2570 done
2571
2572 cat << EOM
2573
2574 Configure uses the operating system name and version to set some defaults.
2575 The default value is probably right if the name rings a bell. Otherwise,
2576 since spelling matters for me, either accept the default or answer "none"
2577 to leave it blank.
2578
2579 EOM
2580 case "$osname" in
2581         ''|' ')
2582                 case "$hintfile" in
2583                 ''|' '|none) dflt=none ;;
2584                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2585                 esac
2586                 ;;
2587         *) dflt="$osname" ;;
2588 esac
2589 rp="Operating system name?"
2590 . ./myread
2591 case "$ans" in
2592 none)  osname='' ;;
2593 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2594 esac
2595 echo " "
2596 case "$osvers" in
2597         ''|' ')
2598                 case "$hintfile" in
2599                 ''|' '|none) dflt=none ;;
2600                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2601                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2602                         case "$dflt" in
2603                         ''|' ') dflt=none ;;
2604                         esac
2605                         ;;
2606                 esac
2607                 ;;
2608         *) dflt="$osvers" ;;
2609 esac
2610 rp="Operating system version?"
2611 . ./myread
2612 case "$ans" in
2613 none)  osvers='' ;;
2614 *) osvers="$ans" ;;
2615 esac
2616
2617
2618 . ./posthint.sh
2619
2620 : who configured the system
2621 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2622 cf_by=`(logname) 2>/dev/null`
2623 case "$cf_by" in
2624 "")
2625         cf_by=`(whoami) 2>/dev/null`
2626         case "$cf_by" in
2627         "") cf_by=unknown ;;
2628         esac ;;
2629 esac
2630
2631 : set up the script used to warn in case of inconsistency
2632 cat <<EOS >whoa
2633 $startsh
2634 EOS
2635 cat <<'EOSC' >>whoa
2636 dflt=y
2637 echo " "
2638 echo "*** WHOA THERE!!! ***" >&4
2639 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2640 rp="    Keep the $hint value?"
2641 . ./myread
2642 case "$ans" in
2643 y) td=$was; tu=$was;;
2644 esac
2645 EOSC
2646
2647 : function used to set $1 to $val
2648 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2649 case "$val$was" in
2650 $define$undef) . ./whoa; eval "$var=\$td";;
2651 $undef$define) . ./whoa; eval "$var=\$tu";;
2652 *) eval "$var=$val";;
2653 esac'
2654
2655 cat <<EOM
2656
2657 Perl can be built to take advantage of threads, on some systems.
2658 To do so, Configure must be run with -Dusethreads.
2659
2660 Note that threading is a highly experimental feature, and
2661 some known race conditions still remain.  If you choose to try
2662 it, be very sure to not actually deploy it for production
2663 purposes.  README.threads has more details, and is required
2664 reading if you enable threads.
2665 EOM
2666 case "$usethreads" in
2667 $define|true|[yY]*)     dflt='y';;
2668 *) dflt='n';;
2669 esac
2670 rp='Build a threading Perl?'
2671 . ./myread
2672 case "$ans" in
2673 y|Y)    val="$define" ;;
2674 *)      val="$undef" ;;
2675 esac
2676 set usethreads
2677 eval $setvar
2678
2679 case "$usethreads" in
2680 $define)
2681         $cat <<EOM
2682
2683 As of 5.5.640, Perl has two different internal threading implementations,
2684 the 5.005 version (5005threads) and an interpreter-based version
2685 (ithreads) that has one interpreter per thread.  Both are very 
2686 experimental.  This arrangement exists to help developers work out
2687 which one is better.
2688 EOM
2689         : Default to ithreads unless overridden on command line or with
2690         : old config.sh
2691         dflt='y'
2692         case "$use5005threads" in
2693                 $define|true|[yY]*) dflt='n';;
2694         esac
2695         case "$useithreads" in
2696                 $undef|false|[nN]*) dflt='n';;
2697         esac
2698         rp='Use interpreter-based ithreads?'
2699         . ./myread
2700         case "$ans" in
2701         y|Y)    val="$define" ;;
2702         *)      val="$undef" ;;
2703         esac
2704         set useithreads
2705         eval $setvar
2706         : Now set use5005threads to the opposite value.
2707         case "$useithreads" in
2708         $define) val="$undef" ;;
2709         *) val="$define" ;;
2710         esac
2711         set use5005threads
2712         eval $setvar
2713         ;;
2714 *)
2715         useithreads="$undef"
2716         use5005threads="$undef"
2717         ;;
2718 esac
2719
2720 case "$d_oldpthreads" in
2721 '')     : Configure tests would be welcome here.  For now, assume undef.
2722         val="$undef" ;;
2723 *)      val="$d_oldpthreads" ;;
2724 esac
2725 set d_oldpthreads
2726 eval $setvar
2727
2728
2729 case "$usethreads" in
2730 "$define"|true|[yY]*)
2731 : Look for a hint-file generated 'call-back-unit'.  If the
2732 : user has specified that a threading perl is to be built,
2733 : we may need to set or change some other defaults.
2734         if $test -f usethreads.cbu; then
2735                 echo "Your platform has some specific hints for threaded builds, using them..."
2736                 . ./usethreads.cbu
2737         else
2738                 $cat <<EOM
2739 (Your platform doesn't have any specific hints for threaded builds.
2740  Assuming POSIX threads, then.)
2741 EOM
2742         fi
2743         ;;
2744 esac
2745
2746 cat <<EOM
2747
2748 Perl can be built so that multiple Perl interpreters can coexist
2749 within the same Perl executable.
2750 EOM
2751
2752 case "$useithreads" in
2753 $define)
2754         cat <<EOM
2755 This multiple interpreter support is required for interpreter-based threads.
2756 EOM
2757         val="$define"
2758         ;;
2759 *)
2760         echo 'Normally you do not need this and you should answer no.'
2761         case "$usemultiplicity" in
2762         $define|true|[yY]*)     dflt='y';;
2763         *) dflt='n';;
2764         esac
2765         rp='Build Perl for multiplicity?'
2766         . ./myread
2767         case "$ans" in
2768         y|Y)    val="$define" ;;
2769         *)      val="$undef" ;;
2770         esac
2771         ;;
2772 esac
2773 set usemultiplicity
2774 eval $setvar
2775
2776 : determine where manual pages are on this system
2777 echo " "
2778 case "$sysman" in
2779 '') 
2780         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2781         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2782         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2783         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2784         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2785         sysman=`./loc . /usr/man/man1 $syspath`
2786         ;;
2787 esac
2788 if $test -d "$sysman"; then
2789         echo "System manual is in $sysman." >&4
2790 else
2791         echo "Could not find manual pages in source form." >&4
2792 fi
2793
2794 : see what memory models we can support
2795 case "$models" in
2796 '')
2797         $cat >pdp11.c <<'EOP'
2798 int main() {
2799 #ifdef pdp11
2800         exit(0);
2801 #else
2802         exit(1);
2803 #endif
2804 }
2805 EOP
2806         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2807         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2808                 dflt='unsplit split'
2809         else
2810                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2811                 case "$tans" in
2812                 X) dflt='none';;
2813                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2814                                 dflt='small'
2815                         else
2816                                 dflt=''
2817                         fi
2818                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2819                                 dflt="$dflt medium"
2820                         fi
2821                         if $test -d /lib/large || $test -d /usr/lib/large; then
2822                                 dflt="$dflt large"
2823                         fi
2824                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2825                                 dflt="$dflt huge"
2826                         fi
2827                 esac
2828         fi;;
2829 *) dflt="$models";;
2830 esac
2831 $cat <<EOM
2832  
2833 Some systems have different model sizes.  On most systems they are called
2834 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2835 split.  If your system doesn't support different memory models, say "none".
2836 If you wish to force everything to one memory model, say "none" here and
2837 put the appropriate flags later when it asks you for other cc and ld flags.
2838 Venix systems may wish to put "none" and let the compiler figure things out.
2839 (In the following question multiple model names should be space separated.)
2840
2841 The default for most systems is "none".
2842
2843 EOM
2844 rp="Which memory models are supported?"
2845 . ./myread
2846 models="$ans"
2847
2848 case "$models" in
2849 none)
2850         small=''
2851         medium=''
2852         large=''
2853         huge=''
2854         unsplit=''
2855         split=''
2856         ;;
2857 *split)
2858         case "$split" in
2859         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2860                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2861                         dflt='-i'
2862                 else
2863                         dflt='none'
2864                 fi;;
2865         *) dflt="$split";;
2866         esac
2867         rp="What flag indicates separate I and D space?"
2868         . ./myread
2869         tans="$ans"
2870         case "$tans" in
2871         none) tans='';;
2872         esac
2873         split="$tans"
2874         unsplit='';;
2875 *large*|*small*|*medium*|*huge*)
2876         case "$models" in
2877         *large*)
2878                 case "$large" in
2879                 '') dflt='-Ml';;
2880                 *) dflt="$large";;
2881                 esac
2882         rp="What flag indicates large model?"
2883         . ./myread
2884         tans="$ans"
2885         case "$tans" in
2886         none) tans='';
2887         esac
2888         large="$tans";;
2889         *) large='';;
2890         esac
2891         case "$models" in
2892         *huge*) case "$huge" in
2893                 '') dflt='-Mh';;
2894                 *) dflt="$huge";;
2895                 esac
2896                 rp="What flag indicates huge model?"
2897                 . ./myread
2898                 tans="$ans"
2899                 case "$tans" in
2900                 none) tans='';
2901                 esac
2902                 huge="$tans";;
2903         *) huge="$large";;
2904         esac
2905         case "$models" in
2906         *medium*) case "$medium" in
2907                 '') dflt='-Mm';;
2908                 *) dflt="$medium";;
2909                 esac
2910                 rp="What flag indicates medium model?"
2911                 . ./myread
2912                 tans="$ans"
2913                 case "$tans" in
2914                 none) tans='';
2915                 esac
2916                 medium="$tans";;
2917         *) medium="$large";;
2918         esac
2919         case "$models" in
2920         *small*) case "$small" in
2921                 '') dflt='none';;
2922                 *) dflt="$small";;
2923                 esac
2924                 rp="What flag indicates small model?"
2925                 . ./myread
2926                 tans="$ans"
2927                 case "$tans" in
2928                 none) tans='';
2929                 esac
2930                 small="$tans";;
2931         *) small='';;
2932         esac
2933         ;;
2934 *)
2935         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2936         ;;
2937 esac
2938 $rm -f pdp11.* pdp11
2939
2940 : make some quick guesses about what we are up against
2941 echo " "
2942 $echo $n "Hmm...  $c"
2943 echo exit 1 >bsd
2944 echo exit 1 >usg
2945 echo exit 1 >v7
2946 echo exit 1 >osf1
2947 echo exit 1 >eunice
2948 echo exit 1 >xenix
2949 echo exit 1 >venix
2950 echo exit 1 >os2
2951 d_bsd="$undef"
2952 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2953 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2954 then
2955         echo "Looks kind of like an OSF/1 system, but we'll see..."
2956         echo exit 0 >osf1
2957 elif test `echo abc | tr a-z A-Z` = Abc ; then
2958         xxx=`./loc addbib blurfl $pth`
2959         if $test -f $xxx; then
2960         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2961                 echo exit 0 >bsd
2962                 echo exit 0 >usg
2963         else
2964                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2965                         echo "Looks kind of like an extended USG system, but we'll see..."
2966                 else
2967                         echo "Looks kind of like a USG system, but we'll see..."
2968                 fi
2969                 echo exit 0 >usg
2970         fi
2971 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2972         echo "Looks kind of like a BSD system, but we'll see..."
2973         d_bsd="$define"
2974         echo exit 0 >bsd
2975 else
2976         echo "Looks kind of like a Version 7 system, but we'll see..."
2977         echo exit 0 >v7
2978 fi
2979 case "$eunicefix" in
2980 *unixtovms*)
2981         $cat <<'EOI'
2982 There is, however, a strange, musty smell in the air that reminds me of
2983 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2984 EOI
2985         echo exit 0 >eunice
2986         d_eunice="$define"
2987 : it so happens the Eunice I know will not run shell scripts in Unix format
2988         ;;
2989 *)
2990         echo " "
2991         echo "Congratulations.  You aren't running Eunice."
2992         d_eunice="$undef"
2993         ;;
2994 esac
2995 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2996 case "$p_" in
2997 :) ;;
2998 *)
2999         $cat <<'EOI'
3000 I have the feeling something is not exactly right, however...don't tell me...
3001 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3002 EOI
3003         echo exit 0 >os2
3004         ;;
3005 esac
3006 if test -f /xenix; then
3007         echo "Actually, this looks more like a XENIX system..."
3008         echo exit 0 >xenix
3009         d_xenix="$define"
3010 else
3011         echo " "
3012         echo "It's not Xenix..."
3013         d_xenix="$undef"
3014 fi
3015 chmod +x xenix
3016 $eunicefix xenix
3017 if test -f /venix; then
3018         echo "Actually, this looks more like a VENIX system..."
3019         echo exit 0 >venix
3020 else
3021         echo " "
3022         if ./xenix; then
3023                 : null
3024         else
3025                 echo "Nor is it Venix..."
3026         fi
3027 fi
3028 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3029 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3030 $rm -f foo
3031
3032 : see if we need a special compiler
3033 echo " "
3034 if ./usg; then
3035         case "$cc" in
3036         '') case "$Mcc" in
3037                 /*) dflt='Mcc';;
3038                 *) case "$large" in
3039                         -M*) dflt='cc';;
3040                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3041                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3042                                                 dflt='cc'
3043                                         else
3044                                                 dflt='cc -M'
3045                                         fi
3046                                 else
3047                                         dflt='cc'
3048                                 fi;;
3049                         esac;;
3050                 esac;;
3051         *)  dflt="$cc";;
3052         esac
3053         case "$dflt" in
3054         *M*)    $cat <<'EOM'
3055 On some older systems the default C compiler will not resolve multiple global
3056 references that happen to have the same name.  On some such systems the "Mcc"
3057 command may be used to force these to be resolved.  On other systems a "cc -M"
3058 command is required.  (Note that the -M flag on other systems indicates a
3059 memory model to use!) If you have the Gnu C compiler, you might wish to use
3060 that instead.
3061
3062 EOM
3063         ;;
3064         esac
3065         rp="Use which C compiler?"
3066         . ./myread
3067         cc="$ans"
3068 else
3069         case "$cc" in
3070         '') dflt=cc;;
3071         *) dflt="$cc";;
3072         esac
3073         rp="Use which C compiler?"
3074         . ./myread
3075         cc="$ans"
3076 fi
3077 : Look for a hint-file generated 'call-back-unit'.  Now that the
3078 : user has specified the compiler, we may need to set or change some
3079 : other defaults.
3080 if $test -f cc.cbu; then
3081     . ./cc.cbu
3082 fi
3083 echo " "
3084 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3085 $cat >gccvers.c <<EOM
3086 #include <stdio.h>
3087 int main() {
3088 #ifdef __GNUC__
3089 #ifdef __VERSION__
3090         printf("%s\n", __VERSION__);
3091 #else
3092         printf("%s\n", "1");
3093 #endif
3094 #endif
3095         exit(0);
3096 }
3097 EOM
3098 if $cc -o gccvers gccvers.c; then
3099         gccversion=`./gccvers`
3100         case "$gccversion" in
3101         '') echo "You are not using GNU cc." ;;
3102         *)  echo "You are using GNU cc $gccversion."
3103             echo "Adding -D_GNU_SOURCE to ccflags."
3104             ccflags="$ccflags -D_GNU_SOURCE" # expose glibc interfaces
3105             ;;
3106         esac
3107 else
3108         echo " "
3109         echo "*** WHOA THERE!!! ***" >&4
3110         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3111         case "$knowitall" in
3112         '')
3113         echo "    You'd better start hunting for one and let me know about it." >&4
3114                 exit 1
3115                 ;;
3116         esac
3117 fi
3118 $rm -f gccvers*
3119 case "$gccversion" in
3120 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3121 esac
3122
3123 : decide how portable to be.  Allow command line overrides.
3124 case "$d_portable" in
3125 "$undef") ;;
3126 *)      d_portable="$define" ;;
3127 esac
3128
3129 : set up shell script to do ~ expansion
3130 cat >filexp <<EOSS
3131 $startsh
3132 : expand filename
3133 case "\$1" in
3134  ~/*|~)
3135         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3136         ;;
3137  ~*)
3138         if $test -f /bin/csh; then
3139                 /bin/csh -f -c "glob \$1"
3140                 failed=\$?
3141                 echo ""
3142                 exit \$failed
3143         else
3144                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3145                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3146                 if $test ! -d "\$dir"; then
3147                         me=\`basename \$0\`
3148                         echo "\$me: can't locate home directory for: \$name" >&2
3149                         exit 1
3150                 fi
3151                 case "\$1" in
3152                 */*)
3153                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3154                         ;;
3155                 *)
3156                         echo \$dir
3157                         ;;
3158                 esac
3159         fi
3160         ;;
3161 *)
3162         echo \$1
3163         ;;
3164 esac
3165 EOSS
3166 chmod +x filexp
3167 $eunicefix filexp
3168
3169 : now set up to get a file name
3170 cat <<EOS >getfile
3171 $startsh
3172 EOS
3173 cat <<'EOSC' >>getfile
3174 tilde=''
3175 fullpath=''
3176 already=''
3177 skip=''
3178 none_ok=''
3179 exp_file=''
3180 nopath_ok=''
3181 orig_rp="$rp"
3182 orig_dflt="$dflt"
3183 case "$gfpth" in
3184 '') gfpth='.' ;;
3185 esac
3186
3187 case "$fn" in
3188 *\(*)
3189         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3190         fn=`echo $fn | sed 's/(.*)//'`
3191         ;;
3192 esac
3193
3194 case "$fn" in
3195 *:*)
3196         loc_file=`expr $fn : '.*:\(.*\)'`
3197         fn=`expr $fn : '\(.*\):.*'`
3198         ;;
3199 esac
3200
3201 case "$fn" in
3202 *~*) tilde=true;;
3203 esac
3204 case "$fn" in
3205 */*) fullpath=true;;
3206 esac
3207 case "$fn" in
3208 *+*) skip=true;;
3209 esac
3210 case "$fn" in
3211 *n*) none_ok=true;;
3212 esac
3213 case "$fn" in
3214 *e*) exp_file=true;;
3215 esac
3216 case "$fn" in
3217 *p*) nopath_ok=true;;
3218 esac
3219
3220 case "$fn" in
3221 *f*) type='File';;
3222 *d*) type='Directory';;
3223 *l*) type='Locate';;
3224 esac
3225
3226 what="$type"
3227 case "$what" in
3228 Locate) what='File';;
3229 esac
3230
3231 case "$exp_file" in
3232 '')
3233         case "$d_portable" in
3234         "$define") ;;
3235         *) exp_file=true;;
3236         esac
3237         ;;
3238 esac
3239
3240 cd ..
3241 while test "$type"; do
3242         redo=''
3243         rp="$orig_rp"
3244         dflt="$orig_dflt"
3245         case "$tilde" in
3246         true) rp="$rp (~name ok)";;
3247         esac
3248         . UU/myread
3249         if test -f UU/getfile.ok && \
3250                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3251         then
3252                 value="$ans"
3253                 ansexp="$ans"
3254                 break
3255         fi
3256         case "$ans" in
3257         none)
3258                 value=''
3259                 ansexp=''
3260                 case "$none_ok" in
3261                 true) type='';;
3262                 esac
3263                 ;;
3264         *)
3265                 case "$tilde" in
3266                 '') value="$ans"
3267                         ansexp="$ans";;
3268                 *)
3269                         value=`UU/filexp $ans`
3270                         case $? in
3271                         0)
3272                                 if test "$ans" != "$value"; then
3273                                         echo "(That expands to $value on this system.)"
3274                                 fi
3275                                 ;;
3276                         *) value="$ans";;
3277                         esac
3278                         ansexp="$value"
3279                         case "$exp_file" in
3280                         '') value="$ans";;
3281                         esac
3282                         ;;
3283                 esac
3284                 case "$fullpath" in
3285                 true)
3286                         case "$ansexp" in
3287                         /*) value="$ansexp" ;;
3288                         *)
3289                                 redo=true
3290                                 case "$already" in
3291                                 true)
3292                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3293                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3294                                         ;;
3295                                 *)
3296                                 echo "Please give a full path name, starting with slash." >&4
3297                                         case "$tilde" in
3298                                         true)
3299                                 echo "Note that using ~name is ok provided it expands well." >&4
3300                                                 already=true
3301                                                 ;;
3302                                         esac
3303                                 esac
3304                                 ;;
3305                         esac
3306                         ;;
3307                 esac
3308                 case "$redo" in
3309                 '')
3310                         case "$type" in
3311                         File)
3312                                 for fp in $gfpth; do
3313                                         if test "X$fp" = X.; then
3314                                             pf="$ansexp"
3315                                         else    
3316                                             pf="$fp/$ansexp"
3317                                         fi
3318                                         if test -f "$pf"; then
3319                                                 type=''
3320                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3321                                         then
3322                                                 echo "($value is not a plain file, but that's ok.)"
3323                                                 type=''
3324                                         fi
3325                                         if test X"$type" = X; then
3326                                             value="$pf"
3327                                             break
3328                                         fi
3329                                 done
3330                                 ;;
3331                         Directory)
3332                                 for fp in $gfpth; do
3333                                         if test "X$fp" = X.; then
3334                                             pf="$ansexp"
3335                                         else    
3336                                             pf="$fp/$ansexp"
3337                                         fi
3338                                         if test -d "$pf"; then
3339                                                 type=''
3340                                                 value="$pf"
3341                                                 break
3342                                         fi
3343                                 done
3344                                 ;;
3345                         Locate)
3346                                 if test -d "$ansexp"; then
3347                                         echo "(Looking for $loc_file in directory $value.)"
3348                                         value="$value/$loc_file"
3349                                         ansexp="$ansexp/$loc_file"
3350                                 fi
3351                                 if test -f "$ansexp"; then
3352                                         type=''
3353                                 fi
3354                                 case "$nopath_ok" in
3355                                 true)   case "$value" in
3356                                         */*) ;;
3357                                         *)      echo "Assuming $value will be in people's path."
3358                                                 type=''
3359                                                 ;;
3360                                         esac
3361                                         ;;
3362                                 esac
3363                                 ;;
3364                         esac
3365
3366                         case "$skip" in
3367                         true) type='';
3368                         esac
3369
3370                         case "$type" in
3371                         '') ;;
3372                         *)
3373                                 if test "$fastread" = yes; then
3374                                         dflt=y
3375                                 else
3376                                         dflt=n
3377                                 fi
3378                                 rp="$what $value doesn't exist.  Use that name anyway?"
3379                                 . UU/myread
3380                                 dflt=''
3381                                 case "$ans" in
3382                                 y*) type='';;
3383                                 *) echo " ";;
3384                                 esac
3385                                 ;;
3386                         esac
3387                         ;;
3388                 esac
3389                 ;;
3390         esac
3391 done
3392 cd UU
3393 ans="$value"
3394 rp="$orig_rp"
3395 dflt="$orig_dflt"
3396 rm -f getfile.ok
3397 test "X$gfpthkeep" != Xy && gfpth=""
3398 EOSC
3399
3400 : What should the include directory be ?
3401 echo " "
3402 $echo $n "Hmm...  $c"
3403 dflt='/usr/include'
3404 incpath=''
3405 mips_type=''
3406 if $test -f /bin/mips && /bin/mips; then
3407         echo "Looks like a MIPS system..."
3408         $cat >usr.c <<'EOCP'
3409 #ifdef SYSTYPE_BSD43
3410 /bsd43
3411 #endif
3412 EOCP
3413         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3414                 dflt='/bsd43/usr/include'
3415                 incpath='/bsd43'
3416                 mips_type='BSD 4.3'
3417         else
3418                 mips_type='System V'
3419         fi
3420         $rm -f usr.c usr.out
3421         echo "and you're compiling with the $mips_type compiler and libraries."
3422         xxx_prompt=y
3423         echo "exit 0" >mips
3424 else
3425         echo "Doesn't look like a MIPS system."
3426         xxx_prompt=n
3427         echo "exit 1" >mips
3428 fi
3429 chmod +x mips
3430 $eunicefix mips
3431 case "$usrinc" in
3432 '') ;;
3433 *) dflt="$usrinc";;
3434 esac
3435 case "$xxx_prompt" in
3436 y)      fn=d/
3437         echo " "
3438         rp='Where are the include files you want to use?'
3439         . ./getfile
3440         usrinc="$ans"
3441         ;;
3442 *)      usrinc="$dflt"
3443         ;;
3444 esac
3445
3446 : see how we invoke the C preprocessor
3447 echo " "
3448 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3449 cat <<'EOT' >testcpp.c
3450 #define ABC abc
3451 #define XYZ xyz
3452 ABC.XYZ
3453 EOT
3454 cd ..
3455 if test ! -f cppstdin; then
3456         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3457                 # AIX cc -E doesn't show the absolute headerfile
3458                 # locations but we'll cheat by using the -M flag.
3459                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
3460         else
3461                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3462         fi
3463 else
3464         echo "Keeping your $hint cppstdin wrapper."
3465 fi
3466 chmod 755 cppstdin
3467 wrapper=`pwd`/cppstdin
3468 ok='false'
3469 cd UU
3470
3471 if $test "X$cppstdin" != "X" && \
3472         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3473         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3474 then
3475         echo "You used to use $cppstdin $cppminus so we'll use that again."
3476         case "$cpprun" in
3477         '') echo "But let's see if we can live without a wrapper..." ;;
3478         *)
3479                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3480                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3481                 then
3482                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3483                         ok='true'
3484                 else
3485                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3486                 fi
3487                 ;;
3488         esac
3489 else
3490         case "$cppstdin" in
3491         '') ;;
3492         *)
3493                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3494                 ;;
3495         esac
3496 fi
3497
3498 if $ok; then
3499         : nothing
3500 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3501         $cc -E <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         echo "Yup, it does."
3504         x_cpp="$cc -E"
3505         x_minus='';
3506 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3507         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3509         echo "Yup, it does."
3510         x_cpp="$cc -E"
3511         x_minus='-';
3512 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3513         $cc -P <testcpp.c >testcpp.out 2>&1; \
3514         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3515         echo "Yipee, that works!"
3516         x_cpp="$cc -P"
3517         x_minus='';
3518 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3519         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3520         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3521         echo "At long last!"
3522         x_cpp="$cc -P"
3523         x_minus='-';
3524 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3525         $cpp <testcpp.c >testcpp.out 2>&1; \
3526         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3527         echo "It works!"
3528         x_cpp="$cpp"
3529         x_minus='';
3530 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3531         $cpp - <testcpp.c >testcpp.out 2>&1; \
3532         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3533         echo "Hooray, it works!  I was beginning to wonder."
3534         x_cpp="$cpp"
3535         x_minus='-';
3536 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3537         $wrapper <testcpp.c >testcpp.out 2>&1; \
3538         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3539         x_cpp="$wrapper"
3540         x_minus=''
3541         echo "Eureka!"
3542 else
3543         dflt=''
3544         rp="No dice.  I can't find a C preprocessor.  Name one:"
3545         . ./myread
3546         x_cpp="$ans"
3547         x_minus=''
3548         $x_cpp <testcpp.c >testcpp.out 2>&1
3549         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3550                 echo "OK, that will do." >&4
3551         else
3552 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3553                 exit 1
3554         fi
3555 fi
3556
3557 case "$ok" in
3558 false)
3559         cppstdin="$x_cpp"
3560         cppminus="$x_minus"
3561         cpprun="$x_cpp"
3562         cpplast="$x_minus"
3563         set X $x_cpp
3564         shift
3565         case "$1" in
3566         "$cpp")
3567                 echo "Perhaps can we force $cc -E using a wrapper..."
3568                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3569                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3570                 then
3571                         echo "Yup, we can."
3572                         cppstdin="$wrapper"
3573                         cppminus='';
3574                 else
3575                         echo "Nope, we'll have to live without it..."
3576                 fi
3577                 ;;
3578         esac
3579         case "$cpprun" in
3580         "$wrapper")
3581                 cpprun=''
3582                 cpplast=''
3583                 ;;
3584         esac
3585         ;;
3586 esac
3587
3588 case "$cppstdin" in
3589 "$wrapper"|'cppstdin') ;;
3590 *) $rm -f $wrapper;;
3591 esac
3592 $rm -f testcpp.c testcpp.out
3593
3594 : Set private lib path
3595 case "$plibpth" in
3596 '') if ./mips; then
3597                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3598         fi;;
3599 esac
3600 case "$libpth" in
3601 ' ') dlist='';;
3602 '') dlist="$loclibpth $plibpth $glibpth";;
3603 *) dlist="$libpth";;
3604 esac
3605
3606 : Now check and see which directories actually exist, avoiding duplicates
3607 libpth=''
3608 for xxx in $dlist
3609 do
3610     if $test -d $xxx; then
3611                 case " $libpth " in
3612                 *" $xxx "*) ;;
3613                 *) libpth="$libpth $xxx";;
3614                 esac
3615     fi
3616 done
3617 $cat <<'EOM'
3618
3619 Some systems have incompatible or broken versions of libraries.  Among
3620 the directories listed in the question below, please remove any you
3621 know not to be holding relevant libraries, and add any that are needed.
3622 Say "none" for none.
3623
3624 EOM
3625 case "$libpth" in
3626 '') dflt='none';;
3627 *)
3628         set X $libpth
3629         shift
3630         dflt=${1+"$@"}
3631         ;;
3632 esac
3633 rp="Directories to use for library searches?"
3634 . ./myread
3635 case "$ans" in
3636 none) libpth=' ';;
3637 *) libpth="$ans";;
3638 esac
3639
3640 : compute shared library extension
3641 case "$so" in
3642 '')
3643         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3644                 dflt='sl'
3645         else
3646                 dflt='so'
3647         fi
3648         ;;
3649 *) dflt="$so";;
3650 esac
3651 $cat <<EOM
3652
3653 On some systems, shared libraries may be available.  Answer 'none' if
3654 you want to suppress searching of shared libraries for the remaining
3655 of this configuration.
3656
3657 EOM
3658 rp='What is the file extension used for shared libraries?'
3659 . ./myread
3660 so="$ans"
3661
3662 : Define several unixisms.
3663 : Hints files or command line option can be used to override them.
3664 : The convoluted testing is in case hints files set either the old
3665 : or the new name.
3666 case "$_exe" in
3667 '')     case "$exe_ext" in
3668     '') ;;
3669         *)      _exe="$exe_ext" ;;
3670         esac
3671         ;;
3672 esac
3673 case "$_a" in
3674 '')     case "$lib_ext" in
3675     '') _a='.a';;
3676         *)      _a="$lib_ext" ;;
3677         esac
3678         ;;
3679 esac
3680 case "$_o" in
3681 '') case "$obj_ext" in
3682         '')     _o='.o';;
3683         *)      _o="$obj_ext";;
3684         esac
3685         ;;
3686 esac
3687 case "$p_" in
3688 '') case "$path_sep" in
3689         '')     p_=':';;
3690         *)      p_="$path_sep";;
3691         esac
3692         ;;
3693 esac
3694 exe_ext=$_exe
3695 lib_ext=$_a
3696 obj_ext=$_o
3697 path_sep=$p_
3698
3699 : Which makefile gets called first.  This is used by make depend.
3700 case "$firstmakefile" in
3701 '') firstmakefile='makefile';;
3702 esac
3703
3704 cat <<EOM
3705
3706 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3707 Configure must be run with -Dusesocks.
3708
3709 Normally you do not need this and you should answer no.
3710
3711 EOM
3712 case "$usesocks" in
3713 $define|true|[yY]*)     dflt='y';;
3714 *) dflt='n';;
3715 esac
3716 rp='Build Perl for SOCKS?'
3717 . ./myread
3718 case "$ans" in
3719 y|Y)    val="$define" ;;     
3720 *)      val="$undef" ;;
3721 esac
3722 set usesocks
3723 eval $setvar
3724
3725 : Looking for optional libraries
3726 echo " "
3727 echo "Checking for optional libraries..." >&4
3728 case "$libs" in
3729 ' '|'') dflt='';;
3730 *) dflt="$libs";;
3731 esac
3732 case "$libswanted" in
3733 '') libswanted='c_s';;
3734 esac
3735 case "$usesocks" in
3736 $define)
3737         libswanted="$libswanted socks5 socks5_sh"
3738         ;;
3739 esac
3740 for thislib in $libswanted; do
3741         
3742         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3743                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3744                 echo "Found -l$thislib (shared)."
3745                 case " $dflt " in
3746                 *"-l$thislib "*);;
3747                 *) dflt="$dflt -l$thislib";;
3748                 esac
3749         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3750                 echo "Found -l$thislib (shared)."
3751                 case " $dflt " in
3752                 *"-l$thislib "*);;
3753                 *) dflt="$dflt -l$thislib";;
3754                 esac
3755         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3756                 echo "Found -l$thislib."
3757                 case " $dflt " in
3758                 *"-l$thislib "*);;
3759                 *) dflt="$dflt -l$thislib";;
3760                 esac
3761         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3762                 echo "Found -l$thislib."
3763                 case " $dflt " in
3764                 *"-l$thislib "*);;
3765                 *) dflt="$dflt -l$thislib";;
3766                 esac
3767         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3768                 echo "Found -l${thislib}_s."
3769                 case " $dflt " in
3770                 *"-l$thislib "*);;
3771                 *) dflt="$dflt -l${thislib}_s";;
3772                 esac
3773         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3774                 echo "Found -l$thislib."
3775                 case " $dflt " in
3776                 *"-l$thislib "*);;
3777                 *) dflt="$dflt -l$thislib";;
3778                 esac
3779         else
3780                 echo "No -l$thislib."
3781         fi
3782 done
3783 set X $dflt
3784 shift
3785 dflt="$*"
3786 case "$libs" in
3787 '') dflt="$dflt";;
3788 *) dflt="$libs";;
3789 esac
3790 case "$dflt" in
3791 ' '|'') dflt='none';;
3792 esac
3793
3794 $cat <<EOM
3795
3796 In order to compile $package on your machine, a number of libraries
3797 are usually needed.  Include any other special libraries here as well.
3798 Say "none" for none.  The default list is almost always right.
3799 EOM
3800
3801 echo " "
3802 rp="What libraries to use?"
3803 . ./myread
3804 case "$ans" in
3805 none) libs=' ';;
3806 *) libs="$ans";;
3807 esac
3808
3809 : determine optimization, if desired, or use for debug flag also
3810 case "$optimize" in
3811 ' '|$undef) dflt='none';;
3812 '') dflt='-O';;
3813 *) dflt="$optimize";;
3814 esac
3815 $cat <<EOH
3816
3817 By default, $package compiles with the -O flag to use the optimizer.
3818 Alternately, you might want to use the symbolic debugger, which uses
3819 the -g flag (on traditional Unix systems).  Either flag can be
3820 specified here.  To use neither flag, specify the word "none".
3821
3822 EOH
3823 rp="What optimizer/debugger flag should be used?"
3824 . ./myread
3825 optimize="$ans"
3826 case "$optimize" in
3827 'none') optimize=" ";;
3828 esac
3829
3830 dflt=''
3831 : We will not override a previous value, but we might want to
3832 : augment a hint file
3833 case "$hint" in
3834 default|recommended)
3835         case "$gccversion" in
3836         1*) dflt='-fpcc-struct-return' ;;
3837         esac
3838         case "$optimize" in
3839         *-g*) dflt="$dflt -DDEBUGGING";;
3840         esac
3841         case "$gccversion" in
3842         2*) if test -d /etc/conf/kconfig.d &&
3843                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3844                 then
3845                         dflt="$dflt -posix"
3846                 fi
3847                 ;;
3848         esac
3849         case "$gccversion" in
3850         1*) ;;
3851         2.[0-8]*) ;;
3852         ?*)     echo " "
3853                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3854                 echo 'int main(void) { return 0; }' > gcctest.c
3855                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3856                         echo "Yes, it does." 2>&1
3857                         case "$ccflags" in
3858                         *strict-aliasing*) 
3859                                 echo "Leaving current flags $ccflags alone." 2>&1
3860                                 ;;
3861                         *) dflt="$dflt -fno-strict-aliasing" ;;
3862                         esac
3863                 else
3864                         echo "Nope, it doesn't, but that's ok." 2>&1
3865                 fi
3866                 ;;
3867         esac
3868         ;;
3869 esac
3870
3871 case "$mips_type" in
3872 *BSD*|'') inclwanted="$locincpth $usrinc";;
3873 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3874 esac
3875 for thisincl in $inclwanted; do
3876         if $test -d $thisincl; then
3877                 if $test x$thisincl != x$usrinc; then
3878                         case "$dflt" in
3879                         *$thisincl*);;
3880                         *) dflt="$dflt -I$thisincl";;
3881                         esac
3882                 fi
3883         fi
3884 done
3885
3886 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3887         xxx=true;
3888 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3889         xxx=true;
3890 else
3891         xxx=false;
3892 fi;
3893 if $xxx; then
3894         case "$dflt" in
3895         *$2*);;
3896         *) dflt="$dflt -D$2";;
3897         esac;
3898 fi'
3899
3900 set signal.h LANGUAGE_C; eval $inctest
3901
3902 case "$usesocks" in
3903 $define)
3904         ccflags="$ccflags -DSOCKS"
3905         ;;
3906 esac
3907
3908 case "$hint" in
3909 default|recommended) dflt="$ccflags $dflt" ;;
3910 *) dflt="$ccflags";;
3911 esac
3912
3913 case "$dflt" in
3914 ''|' ') dflt=none;;
3915 esac
3916 $cat <<EOH
3917
3918 Your C compiler may want other flags.  For this question you should include
3919 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3920 but you should NOT include libraries or ld flags like -lwhatever.  If you
3921 want $package to honor its debug switch, you should include -DDEBUGGING here.
3922 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3923
3924 To use no flags, specify the word "none".
3925
3926 EOH
3927 set X $dflt
3928 shift
3929 dflt=${1+"$@"}
3930 rp="Any additional cc flags?"
3931 . ./myread
3932 case "$ans" in
3933 none) ccflags='';;
3934 *) ccflags="$ans";;
3935 esac
3936
3937 : the following weeds options from ccflags that are of no interest to cpp
3938 cppflags="$ccflags"
3939 case "$gccversion" in
3940 1*) cppflags="$cppflags -D__GNUC__"
3941 esac
3942 case "$mips_type" in
3943 '');;
3944 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3945 esac
3946 case "$cppflags" in
3947 '');;
3948 *)
3949         echo " "
3950         echo "Let me guess what the preprocessor flags are..." >&4
3951         set X $cppflags
3952         shift
3953         cppflags=''
3954         $cat >cpp.c <<'EOM'
3955 #define BLURFL foo
3956
3957 BLURFL xx LFRULB
3958 EOM
3959         previous=''
3960         for flag in $*
3961         do
3962                 case "$flag" in
3963                 -*) ftry="$flag";;
3964                 *) ftry="$previous $flag";;
3965                 esac
3966                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3967                         >cpp1.out 2>/dev/null && \
3968                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3969                         >cpp2.out 2>/dev/null && \
3970                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3971                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3972                 then
3973                         cppflags="$cppflags $ftry"
3974                         previous=''
3975                 else
3976                         previous="$flag"
3977                 fi
3978         done
3979         set X $cppflags
3980         shift
3981         cppflags=${1+"$@"}
3982         case "$cppflags" in
3983         *-*)  echo "They appear to be: $cppflags";;
3984         esac
3985         $rm -f cpp.c cpp?.out
3986         ;;
3987 esac
3988
3989 : flags used in final linking phase
3990 case "$ldflags" in
3991 '') if ./venix; then
3992                 dflt='-i -z'
3993         else
3994                 dflt=''
3995         fi
3996         case "$ccflags" in
3997         *-posix*) dflt="$dflt -posix" ;;
3998         esac
3999         ;;
4000 *) dflt="$ldflags";;
4001 esac
4002
4003 : Try to guess additional flags to pick up local libraries.
4004 for thislibdir in $libpth; do
4005         case " $loclibpth " in
4006         *" $thislibdir "*)
4007                 case "$dflt " in 
4008                 *"-L$thislibdir "*) ;;
4009                 *)  dflt="$dflt -L$thislibdir" ;;
4010                 esac
4011                 ;;
4012         esac
4013 done
4014
4015 case "$dflt" in
4016 '') dflt='none' ;;
4017 esac
4018
4019 $cat <<EOH
4020
4021 Your C linker may need flags.  For this question you should
4022 include -L/whatever and any other flags used by the C linker, but you
4023 should NOT include libraries like -lwhatever.
4024
4025 Make sure you include the appropriate -L/path flags if your C linker
4026 does not normally search all of the directories you specified above,
4027 namely
4028         $libpth
4029 To use no flags, specify the word "none".
4030
4031 EOH
4032
4033 rp="Any additional ld flags (NOT including libraries)?"
4034 . ./myread
4035 case "$ans" in
4036 none) ldflags='';;
4037 *) ldflags="$ans";;
4038 esac
4039 rmlist="$rmlist pdp11"
4040
4041 : coherency check
4042 echo " "
4043 echo "Checking your choice of C compiler and flags for coherency..." >&4
4044 $cat > try.c <<'EOF'
4045 #include <stdio.h>
4046 int main() { printf("Ok\n"); exit(0); }
4047 EOF
4048 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4049 shift
4050 $cat >try.msg <<'EOM'
4051 I've tried to compile and run the following simple program:
4052
4053 EOM
4054 $cat try.c >> try.msg
4055
4056 $cat >> try.msg <<EOM
4057
4058 I used the command:
4059
4060         $*
4061         ./try
4062
4063 and I got the following output:
4064
4065 EOM
4066 dflt=y
4067 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4068         if sh -c './try' >>try.msg 2>&1; then
4069                 xxx=`./try`
4070                 case "$xxx" in
4071                 "Ok") dflt=n ;;
4072                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4073                         case " $libs " in
4074                         *" -lsfio "*)
4075                                 cat >> try.msg <<'EOQS'
4076 If $libs contains -lsfio, and sfio is mis-configured, then it
4077 sometimes (apparently) runs and exits with a 0 status, but with no
4078 output!  It may have to do with sfio's use of _exit vs. exit.
4079
4080 EOQS
4081                                 rp="You have a big problem.  Shall I abort Configure"
4082                                 dflt=y
4083                                 ;;
4084                         esac
4085                         ;;
4086                 esac
4087         else
4088                 echo "The program compiled OK, but exited with status $?." >>try.msg
4089                 rp="You have a problem.  Shall I abort Configure"
4090                 dflt=y
4091         fi
4092 else
4093         echo "I can't compile the test program." >>try.msg
4094         rp="You have a BIG problem.  Shall I abort Configure"
4095         dflt=y
4096 fi
4097 case "$dflt" in
4098 y)
4099         $cat try.msg >&4
4100         case "$knowitall" in
4101         '')
4102                 echo "(The supplied flags or libraries might be incorrect.)"
4103                 ;;
4104         *) dflt=n;;
4105         esac
4106         echo " "
4107         . ./myread
4108         case "$ans" in
4109         n*|N*) ;;
4110         *)      echo "Ok.  Stopping Configure." >&4
4111                 exit 1
4112                 ;;
4113         esac
4114         ;;
4115 n) echo "OK, that should do.";;
4116 esac
4117 $rm -f try try.* core
4118
4119 : define an is-a-typedef? function
4120 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4121 case "$inclist" in
4122 "") inclist="sys/types.h";;
4123 esac;
4124 eval "varval=\$$var";
4125 case "$varval" in
4126 "")
4127         $rm -f temp.c;
4128         for inc in $inclist; do
4129                 echo "#include <$inc>" >>temp.c;
4130         done;
4131         echo "#ifdef $type" >> temp.c;
4132         echo "printf(\"We have $type\");" >> temp.c;
4133         echo "#endif" >> temp.c;
4134         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4135         if $contains $type temp.E >/dev/null 2>&1; then
4136                 eval "$var=\$type";
4137         else
4138                 eval "$var=\$def";
4139         fi;
4140         $rm -f temp.?;;
4141 *) eval "$var=\$varval";;
4142 esac'
4143
4144 : define an is-a-typedef? function that prompts if the type is not available.
4145 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4146 case "$inclist" in
4147 "") inclist="sys/types.h";;
4148 esac;
4149 eval "varval=\$$var";
4150 case "$varval" in
4151 "")
4152         $rm -f temp.c;
4153         for inc in $inclist; do
4154                 echo "#include <$inc>" >>temp.c;
4155         done;
4156         echo "#ifdef $type" >> temp.c;
4157         echo "printf(\"We have $type\");" >> temp.c;
4158         echo "#endif" >> temp.c;
4159         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4160         echo " " ;
4161         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4162         if $contains $type temp.E >/dev/null 2>&1; then
4163                 echo "$type found." >&4;
4164                 eval "$var=\$type";
4165         else
4166                 echo "$type NOT found." >&4;
4167                 dflt="$def";
4168                 . ./myread ;
4169                 eval "$var=\$ans";
4170         fi;
4171         $rm -f temp.?;;
4172 *) eval "$var=\$varval";;
4173 esac'
4174
4175 : define a shorthand compile call
4176 compile='
4177 mc_file=$1;
4178 shift;
4179 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4180 : define a shorthand compile call for compilations that should be ok.
4181 compile_ok='
4182 mc_file=$1;
4183 shift;
4184 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4185
4186 : check for lengths of integral types
4187 echo " "
4188 case "$intsize" in
4189 '')
4190         echo "Checking to see how big your integers are..." >&4
4191         $cat >intsize.c <<'EOCP'
4192 #include <stdio.h>
4193 int main()
4194 {
4195         printf("intsize=%d;\n", (int)sizeof(int));
4196         printf("longsize=%d;\n", (int)sizeof(long));
4197         printf("shortsize=%d;\n", (int)sizeof(short));
4198         exit(0);
4199 }
4200 EOCP
4201         set intsize
4202         if eval $compile_ok && ./intsize > /dev/null; then
4203                 eval `./intsize`
4204                 echo "Your integers are $intsize bytes long."
4205                 echo "Your long integers are $longsize bytes long."
4206                 echo "Your short integers are $shortsize bytes long."
4207         else
4208                 $cat >&4 <<EOM
4209 !
4210 Help! I can't compile and run the intsize test program: please enlighten me!
4211 (This is probably a misconfiguration in your system or libraries, and
4212 you really ought to fix it.  Still, I'll try anyway.)
4213 !
4214 EOM
4215                 dflt=4
4216                 rp="What is the size of an integer (in bytes)?"
4217                 . ./myread
4218                 intsize="$ans"
4219                 dflt=$intsize
4220                 rp="What is the size of a long integer (in bytes)?"
4221                 . ./myread
4222                 longsize="$ans"
4223                 dflt=2
4224                 rp="What is the size of a short integer (in bytes)?"
4225                 . ./myread
4226                 shortsize="$ans"
4227         fi
4228         ;;
4229 esac
4230 $rm -f intsize intsize.*
4231
4232 : see what type lseek is declared as in the kernel
4233 rp="What is the type used for lseek's offset on this system?"
4234 set off_t lseektype long stdio.h sys/types.h
4235 eval $typedef_ask
4236
4237 echo " "
4238 $echo $n "Checking to see how big your file offsets are...$c" >&4
4239 $cat >try.c <<EOCP
4240 #include <sys/types.h>
4241 #include <stdio.h>
4242 int main()
4243 {
4244     printf("%d\n", (int)sizeof($lseektype));
4245     return(0); 
4246 }
4247 EOCP
4248 set try
4249 if eval $compile_ok; then
4250         lseeksize=`./try`
4251         $echo " $lseeksize bytes." >&4
4252 else
4253         dflt=$longsize
4254         echo " "
4255         echo "(I can't seem to compile the test program.  Guessing...)"
4256         rp="What is the size of your file offsets (in bytes)?"
4257         . ./myread
4258         lseeksize="$ans"
4259 fi
4260 $rm -f try.c try
4261
4262 : see what type file positions are declared as in the library
4263 rp="What is the type for file position used by fsetpos()?"
4264 set fpos_t fpostype long stdio.h sys/types.h
4265 eval $typedef_ask
4266
4267 echo " "
4268 case "$fpostype" in
4269 *_t) zzz="$fpostype"    ;;
4270 *)   zzz="fpos_t"       ;;
4271 esac
4272 $echo $n "Checking the size of $zzz...$c" >&4 
4273 cat > try.c <<EOCP
4274 #include <sys/types.h>
4275 #include <stdio.h>
4276 int main() {
4277     printf("%d\n", (int)sizeof($fpostype));
4278     exit(0);
4279 }
4280 EOCP
4281 set try
4282 if eval $compile_ok; then
4283         yyy=`./try`
4284         case "$yyy" in
4285         '')     fpossize=4
4286                 echo " "
4287                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4288                 ;;
4289         *)      fpossize=$yyy
4290                 echo " $fpossize bytes."
4291                 ;;
4292         esac
4293 else
4294         dflt="$longsize"
4295         echo " "
4296         echo "(I can't compile the test program.  Guessing...)" >&4
4297         rp="What is the size of your file positions (in bytes)?"
4298         . ./myread
4299         fpossize="$ans"
4300 fi
4301
4302
4303
4304 case "$lseeksize:$fpossize" in
4305 8:8) cat <<EOM
4306
4307 You can have files larger than 2 gigabytes.
4308 EOM
4309    val="$define" ;;
4310 *) cat <<EOM
4311
4312 Perl can be built to understand large files (files larger than 2 gigabytes)
4313 on some systems.  To do so, Configure must be run with -Duselargefiles.
4314
4315 If this doesn't make any sense to you, just accept the default 'y'.
4316 EOM
4317    case "$uselargefiles" in
4318    "$undef"|false|[nN]*) dflt='n' ;;
4319    *)   dflt='y' ;;
4320    esac
4321    rp='Try to understand large files, if available?'
4322    . ./myread
4323    case "$ans" in
4324    y|Y)         val="$define" ;;
4325    *)           val="$undef"  ;;
4326    esac
4327    ;;
4328 esac
4329 set uselargefiles
4330 eval $setvar
4331 case "$uselargefiles" in
4332 "$define")
4333 : Look for a hint-file generated 'call-back-unit'.  If the
4334 : user has specified that a large files perl is to be built,
4335 : we may need to set or change some other defaults.
4336         if $test -f uselfs.cbu; then
4337                 echo "Your platform has some specific hints for large file builds, using them..."
4338                 . ./uselfs.cbu
4339                 echo " "
4340                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4341                 $cat >try.c <<EOCP
4342 #include <sys/types.h>
4343 #include <stdio.h>
4344 int main()
4345 {
4346     printf("%d\n", (int)sizeof($lseektype));
4347     return(0); 
4348 }
4349 EOCP
4350                 set try
4351                 if eval $compile_ok; then
4352                         lseeksize=`./try`
4353                         $echo " $lseeksize bytes." >&4
4354                 else
4355                         dflt="$lseeksize"
4356                         echo " "
4357                         echo "(I can't seem to compile the test program.  Guessing...)"
4358                         rp="What is the size of your file offsets (in bytes)?"
4359                         . ./myread
4360                         lseeksize="$ans"
4361                 fi
4362                 case "$fpostype" in
4363                 *_t) zzz="$fpostype"    ;;
4364                 *)   zzz="fpos_t"       ;;
4365                 esac
4366                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4367                 $cat > try.c <<EOCP
4368 #include <sys/types.h>
4369 #include <stdio.h>
4370 int main() {
4371     printf("%d\n", (int)sizeof($fpostype));
4372     exit(0);
4373 }
4374 EOCP
4375                 set try
4376                 if eval $compile_ok; then
4377                         yyy=`./try`
4378                         dflt="$lseeksize"
4379                         case "$yyy" in
4380                         '')     echo " "
4381                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4382                                 ;;
4383                         *)      fpossize=$yyy
4384                                 echo " $fpossize bytes."
4385                                 ;;
4386                         esac
4387                 else
4388                         dflt="$fpossize"
4389                         echo " "
4390                         echo "(I can't compile the test program.  Guessing...)" >&4
4391                         rp="What is the size of your file positions (in bytes)?"
4392                         . ./myread
4393                         fpossize="$ans"
4394                 fi
4395                 $rm -f try.c try
4396         fi
4397         ;;
4398 esac
4399
4400
4401 case "$usemorebits" in
4402 "$define"|true|[yY]*)
4403         use64bits="$define"
4404         uselongdouble="$define"
4405         usemorebits="$define"
4406         ;;
4407 *)      usemorebits="$undef"
4408         ;;
4409 esac
4410
4411
4412 case "$intsize:$longsize" in
4413 8:*|*:8) cat <<EOM
4414
4415 You have natively 64-bit integers.
4416 EOM
4417    val="$define" ;;
4418 *) cat <<EOM
4419
4420 Perl can be built to take advantage of 64-bit integer types
4421 on some systems.  To do so, Configure must be run with -Duse64bits.
4422
4423 If this doesn't make any sense to you, just accept the default.
4424 EOM
4425   case "$use64bits" in
4426   $define|true|[yY]*)   dflt='y';;
4427   *) dflt='n';;
4428   esac
4429   rp='Try to use 64-bit integers, if available?'
4430   . ./myread
4431   case "$ans" in
4432   y|Y) val="$define" ;;
4433   *)   val="$undef"  ;;
4434   esac
4435   ;;
4436 esac
4437 set use64bits
4438 eval $setvar
4439
4440 case "$archname64" in
4441 '') archname64='' ;;    # not a typo
4442 esac
4443
4444 case "$use64bits" in
4445 "$define"|true|[yY]*)
4446 : Look for a hint-file generated 'call-back-unit'.  If the
4447 : user has specified that a 64-bit perl is to be built,
4448 : we may need to set or change some other defaults.
4449         if $test -f use64bits.cbu; then
4450                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4451                 . ./use64bits.cbu
4452         else
4453                 $cat <<EOM
4454 (Your platform doesn't have any specific hints for 64-bit builds.)
4455 EOM
4456                 case "$intsize:$longsize" in
4457 8:*|*:8) cat <<EOM
4458 (This is probably okay, as your system is a natively 64-bit system.)
4459 EOM
4460                   ;;
4461                 esac
4462                 case "$gccversion" in
4463                 '')     ;;
4464                 *)      case "$ccflags" in
4465                         *-DUSE_LONG_LONG*) ;;
4466                         *) $cat <<EOM
4467 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4468 to the compilation flags.
4469 EOM
4470                            ccflags="$ccflags -DUSE_LONG_LONG"
4471                            ;;
4472                         esac
4473                         ;;
4474                 esac
4475         fi
4476         ;;
4477 esac
4478
4479 : determine the architecture name
4480 echo " "
4481 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4482         tarch=`arch`"-$osname"
4483 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4484         if uname -m > tmparch 2>&1 ; then
4485                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4486                         -e 's/$/'"-$osname/" tmparch`
4487         else
4488                 tarch="$osname"
4489         fi
4490         $rm -f tmparch
4491 else
4492         tarch="$osname"
4493 fi
4494 case "$myarchname" in
4495 ''|"$tarch") ;;
4496 *)
4497         echo "(Your architecture name used to be $myarchname.)"
4498         archname=''
4499         ;;
4500 esac
4501 myarchname="$tarch"
4502 case "$archname" in
4503 '') dflt="$tarch";;
4504 *) dflt="$archname";;
4505 esac
4506 rp='What is your architecture name'
4507 . ./myread
4508 archname="$ans"
4509 case "$usethreads" in
4510 $define)
4511         echo "Threads selected." >&4
4512         case "$archname" in
4513         *-thread*) echo "...and architecture name already has -thread." >&4
4514                 ;;
4515         *)      archname="$archname-thread"
4516                 echo "...setting architecture name to $archname." >&4
4517                 ;;
4518         esac
4519         ;;
4520 esac
4521 case "$usemultiplicity" in
4522 $define)
4523         echo "Multiplicity selected." >&4
4524         case "$archname" in
4525         *-multi*) echo "...and architecture name already has -multi." >&4
4526                 ;;
4527         *)      archname="$archname-multi"
4528                 echo "...setting architecture name to $archname." >&4
4529                 ;;
4530         esac
4531         ;;
4532 esac
4533 case "$use64bits" in
4534 $define)
4535         case "$archname64" in
4536         '')
4537                 ;;
4538         *)
4539                 case "$archname" in
4540                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4541                         ;;
4542                 *)      archname="$archname-$archname64"
4543                         echo "...setting architecture name to $archname." >&4
4544                         ;;
4545                 esac
4546                 ;;
4547         esac
4548 esac
4549
4550 : determine root of directory hierarchy where package will be installed.
4551 case "$prefix" in
4552 '')
4553         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4554         ;;
4555 *)
4556         dflt="$prefix"
4557         ;;
4558 esac
4559 $cat <<EOM
4560
4561 By default, $package will be installed in $dflt/bin, manual pages
4562 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4563 installation directories. Typically this is something like /usr/local.
4564 If you wish to have binaries under /usr/bin but other parts of the
4565 installation under /usr/local, that's ok: you will be prompted
4566 separately for each of the installation directories, the prefix being
4567 only used to set the defaults.
4568
4569 EOM
4570 fn=d~
4571 rp='Installation prefix to use?'
4572 . ./getfile
4573 oldprefix=''
4574 case "$prefix" in
4575 '') ;;
4576 *)
4577         case "$ans" in
4578         "$prefix") ;;
4579         *) oldprefix="$prefix";;
4580         esac
4581         ;;
4582 esac
4583 prefix="$ans"
4584 prefixexp="$ansexp"
4585
4586 : is AFS running?
4587 echo " "
4588 case "$afs" in
4589 $define|true)   afs=true ;;
4590 $undef|false)   afs=false ;;
4591 *)      if test -d /afs; then
4592                 afs=true
4593         else
4594                 afs=false
4595         fi
4596         ;;
4597 esac
4598 if $afs; then
4599         echo "AFS may be running... I'll be extra cautious then..." >&4
4600 else
4601         echo "AFS does not seem to be running..." >&4
4602 fi
4603
4604 : determine installation prefix for where package is to be installed.
4605 if $afs; then 
4606 $cat <<EOM
4607
4608 Since you are running AFS, I need to distinguish the directory in which
4609 files will reside from the directory in which they are installed (and from
4610 which they are presumably copied to the former directory by occult means).
4611
4612 EOM
4613         case "$installprefix" in
4614         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4615         *) dflt="$installprefix";;
4616         esac
4617 else
4618 $cat <<EOM
4619
4620 In some special cases, particularly when building $package for distribution,
4621 it is convenient to distinguish between the directory in which files should 
4622 be installed from the directory ($prefix) in which they 
4623 will eventually reside.  For most users, these two directories are the same.
4624
4625 EOM
4626         case "$installprefix" in
4627         '') dflt=$prefix ;;
4628         *) dflt=$installprefix;;
4629         esac
4630 fi
4631 fn=d~
4632 rp='What installation prefix should I use for installing files?'
4633 . ./getfile
4634 installprefix="$ans"
4635 installprefixexp="$ansexp"
4636
4637 : set the prefixit variable, to compute a suitable default value
4638 prefixit='case "$3" in
4639 ""|none)
4640         case "$oldprefix" in
4641         "") eval "$1=\"\$$2\"";;
4642         *)
4643                 case "$3" in
4644                 "") eval "$1=";;
4645                 none)
4646                         eval "tp=\"\$$2\"";
4647                         case "$tp" in
4648                         ""|" ") eval "$1=\"\$$2\"";;
4649                         *) eval "$1=";;
4650                         esac;;
4651                 esac;;
4652         esac;;
4653 *)
4654         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4655         case "$tp" in
4656         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4657         /*-$oldprefix/*|\~*-$oldprefix/*)
4658                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4659         *) eval "$1=\"\$$2\"";;
4660         esac;;
4661 esac'
4662
4663 : set the base revision
4664 baserev=5.0
4665
4666
4667 : get the patchlevel
4668 echo " "
4669 echo "Getting the current patchlevel..." >&4
4670 if $test -r $rsrc/patchlevel.h;then
4671         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4672         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4673         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4674         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4675         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4676 else
4677         patchlevel=0
4678         subversion=0
4679         api_revision=0
4680         api_version=0
4681         api_subversion=0
4682 fi
4683 $echo $n "(You have $package" $c
4684 case "$package" in
4685 "*$baserev")    ;;
4686 *)              $echo $n " $baserev" $c ;;
4687 esac
4688 $echo $n " patchlevel $patchlevel" $c
4689 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4690 echo ".)"
4691 case "$osname" in
4692 dos|vms)
4693         : XXX Should be a Configure test for double-dots in filenames.
4694         version=`echo $baserev $patchlevel $subversion | \
4695                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4696         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4697                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4698         ;;
4699 *)
4700         version=`echo $baserev $patchlevel $subversion | \
4701                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4702         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4703                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4704         ;;
4705 esac
4706 : Special case the 5.005_xx maintenance series, which used 5.005
4707 : without any subversion label as a subdirectory in $sitelib
4708 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4709         api_versionstring='5.005'
4710 fi
4711
4712 : determine installation style
4713 : For now, try to deduce it from prefix unless it is already set.
4714 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4715 case "$installstyle" in
4716 '')     case "$prefix" in
4717                 *perl*) dflt='lib';;
4718                 *) dflt='lib/perl5' ;;
4719         esac
4720         ;;
4721 *)      dflt='lib/perl5' ;;
4722 esac
4723 : Probably not worth prompting for this since we prompt for all
4724 : the directories individually, and the prompt would be too long and
4725 : confusing anyway.
4726 installstyle=$dflt
4727
4728 : determine where private library files go
4729 : Usual default is /usr/local/lib/perl5/$version.
4730 : Also allow things like /opt/perl/lib/$version, since 
4731 : /opt/perl/lib/perl5... would be redundant.
4732 : The default "style" setting is made in installstyle.U
4733 case "$installstyle" in
4734 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4735 *)       set dflt privlib lib/$version ;;
4736 esac
4737 eval $prefixit
4738 $cat <<EOM
4739
4740 There are some auxiliary files for $package that need to be put into a
4741 private library directory that is accessible by everyone.
4742
4743 EOM
4744 fn=d~+
4745 rp='Pathname where the private library files will reside?'
4746 . ./getfile
4747 privlib="$ans"
4748 privlibexp="$ansexp"
4749 : Change installation prefix, if necessary.
4750 if $test X"$prefix" != X"$installprefix"; then
4751         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4752 else
4753         installprivlib="$privlibexp"
4754 fi
4755
4756 : set the prefixup variable, to restore leading tilda escape
4757 prefixup='case "$prefixexp" in
4758 "$prefix") ;;
4759 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4760 esac'
4761
4762 : determine where public architecture dependent libraries go
4763 set archlib archlib
4764 eval $prefixit
4765 : privlib default is /usr/local/lib/$package/$version
4766 : archlib default is /usr/local/lib/$package/$version/$archname
4767 : privlib may have an optional trailing /share.
4768 tdflt=`echo $privlib | $sed 's,/share$,,'`
4769 tdflt=$tdflt/$archname
4770 case "$archlib" in
4771 '')     dflt=$tdflt
4772         ;;
4773 *)      dflt="$archlib"
4774     ;;
4775 esac
4776 $cat <<EOM
4777
4778 $spackage contains architecture-dependent library files.  If you are
4779 sharing libraries in a heterogeneous environment, you might store
4780 these files in a separate location.  Otherwise, you can just include
4781 them with the rest of the public library files.
4782
4783 EOM
4784 fn=d+~
4785 rp='Where do you want to put the public architecture-dependent libraries?'
4786 . ./getfile
4787 archlib="$ans"
4788 archlibexp="$ansexp"
4789 if $test X"$archlib" = X"$privlib"; then
4790         d_archlib="$undef"
4791 else
4792         d_archlib="$define"
4793 fi
4794 : Change installation prefix, if necessary.
4795 if $test X"$prefix" != X"$installprefix"; then
4796         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4797 else
4798         installarchlib="$archlibexp"
4799 fi
4800
4801
4802 : Binary compatibility with 5.005 is not possible for builds
4803 : with advanced features
4804 case "$usethreads$usemultiplicity" in
4805 *define*)
4806         bincompat5005="$undef"
4807         d_bincompat5005="$undef"
4808         ;;
4809 *)      $cat <<EOM
4810
4811 Perl 5.006 can be compiled for binary compatibility with 5.005.
4812 If you decide to do so, you will be able to continue using most
4813 of the extensions that were compiled for Perl 5.005.
4814
4815 EOM
4816         case "$bincompat5005$d_bincompat5005" in
4817         *"$undef"*) dflt=n ;;
4818         *) dflt=y ;;
4819         esac
4820         rp='Binary compatibility with Perl 5.005?'
4821         . ./myread
4822         case "$ans" in
4823         y*) val="$define" ;;
4824         *)  val="$undef" ;;
4825         esac
4826         set d_bincompat5005
4827         eval $setvar
4828         case "$d_bincompat5005" in
4829         "$define")
4830                 bincompat5005="$define"
4831                 ;;
4832         *)      bincompat5005="$undef"
4833                 d_bincompat5005="$undef"
4834                 ;;
4835         esac
4836         ;;
4837 esac
4838
4839
4840 : see if setuid scripts can be secure
4841 $cat <<EOM
4842
4843 Some kernels have a bug that prevents setuid #! scripts from being
4844 secure.  Some sites have disabled setuid #! scripts because of this.
4845
4846 First let's decide if your kernel supports secure setuid #! scripts.
4847 (If setuid #! scripts would be secure but have been disabled anyway,
4848 don't say that they are secure if asked.)
4849
4850 EOM
4851
4852 val="$undef"
4853 if $test -d /dev/fd; then
4854         echo "#!$ls" >reflect
4855         chmod +x,u+s reflect
4856         ./reflect >flect 2>&1
4857         if $contains "/dev/fd" flect >/dev/null; then
4858                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4859                 val="$define"
4860         else
4861                 $cat <<EOM
4862 If you are not sure if they are secure, I can check but I'll need a
4863 username and password different from the one you are using right now.
4864 If you don't have such a username or don't want me to test, simply
4865 enter 'none'.
4866
4867 EOM
4868                 rp='Other username to test security of setuid scripts with?'
4869                 dflt='none'
4870                 . ./myread
4871                 case "$ans" in
4872                 n|none)
4873                         case "$d_suidsafe" in
4874                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4875                                 dflt=n;;
4876                         "$undef")
4877                                 echo "Well, the $hint value is *not* secure." >&4
4878                                 dflt=n;;
4879                         *)      echo "Well, the $hint value *is* secure." >&4
4880                                 dflt=y;;
4881                         esac
4882                         ;;
4883                 *)
4884                         $rm -f reflect flect
4885                         echo "#!$ls" >reflect
4886                         chmod +x,u+s reflect
4887                         echo >flect
4888                         chmod a+w flect
4889                         echo '"su" will (probably) prompt you for '"$ans's password."
4890                         su $ans -c './reflect >flect'
4891                         if $contains "/dev/fd" flect >/dev/null; then
4892                                 echo "Okay, it looks like setuid scripts are secure." >&4
4893                                 dflt=y
4894                         else
4895                                 echo "I don't think setuid scripts are secure." >&4
4896                                 dflt=n
4897                         fi
4898                         ;;
4899                 esac
4900                 rp='Does your kernel have *secure* setuid scripts?'
4901                 . ./myread
4902                 case "$ans" in
4903                 [yY]*)  val="$define";;
4904                 *)      val="$undef";;
4905                 esac
4906         fi
4907 else
4908         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4909         echo "(That's for file descriptors, not floppy disks.)"
4910         val="$undef"
4911 fi
4912 set d_suidsafe
4913 eval $setvar
4914
4915 $rm -f reflect flect
4916
4917 : now see if they want to do setuid emulation
4918 echo " "
4919 val="$undef"
4920 case "$d_suidsafe" in
4921 "$define")
4922         val="$undef"
4923         echo "No need to emulate SUID scripts since they are secure here." >& 4
4924         ;;
4925 *)
4926         $cat <<EOM
4927 Some systems have disabled setuid scripts, especially systems where
4928 setuid scripts cannot be secure.  On systems where setuid scripts have
4929 been disabled, the setuid/setgid bits on scripts are currently
4930 useless.  It is possible for $package to detect those bits and emulate
4931 setuid/setgid in a secure fashion.  This emulation will only work if
4932 setuid scripts have been disabled in your kernel.
4933
4934 EOM
4935         case "$d_dosuid" in
4936         "$define") dflt=y ;;
4937         *) dflt=n ;;
4938         esac
4939         rp="Do you want to do setuid/setgid emulation?"
4940         . ./myread
4941         case "$ans" in
4942         [yY]*)  val="$define";;
4943         *)      val="$undef";;
4944         esac
4945         ;;
4946 esac
4947 set d_dosuid
4948 eval $setvar
4949
4950 : determine filename position in cpp output
4951 echo " "
4952 echo "Computing filename position in cpp output for #include directives..." >&4
4953 echo '#include <stdio.h>' > foo.c
4954 $cat >fieldn <<EOF
4955 $startsh
4956 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4957 $grep '^[       ]*#.*stdio\.h' | \
4958 while read cline; do
4959         pos=1
4960         set \$cline
4961         while $test \$# -gt 0; do
4962                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4963                         echo "\$pos"
4964                         exit 0
4965                 fi
4966                 shift
4967                 pos=\`expr \$pos + 1\`
4968         done
4969 done
4970 EOF
4971 chmod +x fieldn
4972 fieldn=`./fieldn`
4973 $rm -f foo.c fieldn
4974 case $fieldn in
4975 '') pos='???';;
4976 1) pos=first;;
4977 2) pos=second;;
4978 3) pos=third;;
4979 *) pos="${fieldn}th";;
4980 esac
4981 echo "Your cpp writes the filename in the $pos field of the line."
4982
4983 : locate header file
4984 $cat >findhdr <<EOF
4985 $startsh
4986 wanted=\$1
4987 name=''
4988 for usrincdir in $usrinc
4989 do
4990         if test -f \$usrincdir/\$wanted; then
4991                 echo "\$usrincdir/\$wanted"
4992                 exit 0
4993         fi
4994 done
4995 awkprg='{ print \$$fieldn }'
4996 echo "#include <\$wanted>" > foo\$\$.c
4997 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4998 $grep "^[       ]*#.*\$wanted" | \
4999 while read cline; do
5000         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5001         case "\$name" in
5002         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5003         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5004         *) exit 2;;
5005         esac;
5006 done;
5007 #
5008 # status = 0: grep returned 0 lines, case statement not executed
5009 # status = 1: headerfile found
5010 # status = 2: while loop executed, no headerfile found
5011 #
5012 status=\$?
5013 $rm -f foo\$\$.c;
5014 if test \$status -eq 1; then
5015         exit 0;
5016 fi
5017 exit 1
5018 EOF
5019 chmod +x findhdr
5020
5021 : define an alternate in-header-list? function
5022 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5023 cont=true; xxf="echo \"<\$1> found.\" >&4";
5024 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5025 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5026 esac;
5027 case $# in 4) instead=instead;; *) instead="at last";; esac;
5028 while $test "$cont"; do
5029         xxx=`./findhdr $1`
5030         var=$2; eval "was=\$$2";
5031         if $test "$xxx" && $test -r "$xxx";
5032         then eval $xxf;
5033         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5034                 cont="";
5035         else eval $xxnf;
5036         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5037         set $yyy; shift; shift; yyy=$@;
5038         case $# in 0) cont="";;
5039         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5040                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5041         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5042                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5043         esac;
5044 done;
5045 while $test "$yyy";
5046 do set $yyy; var=$2; eval "was=\$$2";
5047         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5048         set $yyy; shift; shift; yyy=$@;
5049 done'
5050
5051 : see if this is a malloc.h system
5052 set malloc.h i_malloc
5053 eval $inhdr
5054
5055 : see if stdlib is available
5056 set stdlib.h i_stdlib
5057 eval $inhdr
5058
5059 : determine which malloc to compile in
5060 echo " "
5061 case "$usemymalloc" in
5062 ''|[yY]*|true|$define)  dflt='y' ;;
5063 *)      dflt='n' ;;
5064 esac
5065 rp="Do you wish to attempt to use the malloc that comes with $package?"
5066 . ./myread
5067 usemymalloc="$ans"
5068 case "$ans" in
5069 y*|true)
5070         usemymalloc='y'
5071         mallocsrc='malloc.c'
5072         mallocobj="malloc$_o"
5073         d_mymalloc="$define"
5074         case "$libs" in
5075         *-lmalloc*)
5076                 : Remove malloc from list of libraries to use
5077                 echo "Removing unneeded -lmalloc from library list" >&4
5078                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5079                 shift
5080                 libs="$*"
5081                 echo "libs = $libs" >&4
5082                 ;;
5083         esac
5084         ;;
5085 *)
5086         usemymalloc='n'
5087         mallocsrc=''
5088         mallocobj=''
5089         d_mymalloc="$undef"
5090         ;;
5091 esac
5092
5093 : compute the return types of malloc and free
5094 echo " "
5095 $cat >malloc.c <<END
5096 #$i_malloc I_MALLOC
5097 #$i_stdlib I_STDLIB
5098 #include <stdio.h>
5099 #include <sys/types.h>
5100 #ifdef I_MALLOC
5101 #include <malloc.h>
5102 #endif
5103 #ifdef I_STDLIB
5104 #include <stdlib.h>
5105 #endif
5106 #ifdef TRY_MALLOC
5107 void *malloc();
5108 #endif
5109 #ifdef TRY_FREE
5110 void free();
5111 #endif
5112 END
5113 case "$malloctype" in
5114 '')
5115         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5116                 malloctype='void *'
5117         else
5118                 malloctype='char *'
5119         fi
5120         ;;
5121 esac
5122 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5123
5124 case "$freetype" in
5125 '')
5126         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5127                 freetype='void'
5128         else
5129                 freetype='int'
5130         fi
5131         ;;
5132 esac
5133 echo "Your system uses $freetype free(), it would seem." >&4
5134 $rm -f malloc.[co]
5135 $cat <<EOM
5136
5137 The installation process will also create a directory for
5138 vendor-supplied add-ons.  Vendors who supply perl with their system
5139 may find it convenient to place all vendor-supplied files in this
5140 directory rather than in the main distribution directory.  This will
5141 ease upgrades between binary-compatible maintenance versions of perl.
5142
5143 Of course you may also use these directories in whatever way you see
5144 fit.  For example, you might use them to access modules shared over a
5145 company-wide network.
5146
5147 The default answer should be fine for most people.
5148 This causes further questions about vendor add-ons to be skipped
5149 and no vendor-specific directories will be configured for perl.
5150
5151 EOM
5152 rp='Do you want to configure vendor-specific add-on directories?'
5153 case "$usevendorprefix" in
5154 define|true|[yY]*) dflt=y ;;
5155 *) dflt=n ;;
5156 esac
5157 . ./myread
5158 case "$ans" in
5159 [yY]*)  fn=d~+
5160         rp='Installation prefix to use for vendor-supplied add-ons?'
5161         case "$vendorprefix" in
5162         '') dflt='' ;;
5163         *)  dflt=$vendorprefix ;;
5164         esac
5165         . ./getfile
5166         oldvendorprefix=''
5167         case "$vendorprefix" in
5168         '') ;;
5169         *)      case "$ans" in
5170                 "$prefix") ;;
5171                 *) oldvendorprefix="$prefix";;
5172                 esac
5173                 ;;
5174         esac
5175         usevendorprefix="$define"
5176         vendorprefix="$ans"
5177         vendorprefixexp="$ansexp"
5178         ;;
5179 *)      usevendorprefix="$undef"
5180         vendorprefix=''
5181         vendorprefixexp=''
5182         ;;
5183 esac
5184
5185 case "$vendorprefix" in
5186 '')     d_vendorlib="$undef"
5187         vendorlib=''
5188         vendorlibexp=''
5189         ;;
5190 *)      d_vendorlib="$define"
5191         : determine where vendor-supplied modules go.
5192         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5193         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5194         case "$installstyle" in
5195         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5196         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5197         esac
5198         fn=d~+
5199         rp='Pathname for the vendor-supplied library files?'
5200         . ./getfile
5201         vendorlib="$ans"
5202         vendorlibexp="$ansexp"
5203         : Change installation prefix, if necessary.
5204         if $test X"$prefix" != X"$installprefix"; then
5205                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5206         else
5207                 installvendorlib="$vendorlibexp"
5208         fi
5209         ;;
5210 esac
5211
5212 : Cruising for prototypes
5213 echo " "
5214 echo "Checking out function prototypes..." >&4
5215 $cat >prototype.c <<'EOCP'
5216 int main(int argc, char *argv[]) {
5217         exit(0);}
5218 EOCP
5219 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5220         echo "Your C compiler appears to support function prototypes."
5221         val="$define"
5222 else
5223         echo "Your C compiler doesn't seem to understand function prototypes."
5224         val="$undef"
5225 fi
5226 set prototype
5227 eval $setvar
5228 $rm -f prototype*
5229
5230 case "$prototype" in
5231 "$define") ;;
5232 *)      ansi2knr='ansi2knr'
5233         echo " "
5234         cat <<EOM >&4
5235
5236 $me:  FATAL ERROR:
5237 This version of $package can only be compiled by a compiler that 
5238 understands function prototypes.  Unfortunately, your C compiler 
5239         $cc $ccflags
5240 doesn't seem to understand them.  Sorry about that.
5241
5242 If GNU cc is available for your system, perhaps you could try that instead.  
5243
5244 Eventually, we hope to support building Perl with pre-ANSI compilers.
5245 If you would like to help in that effort, please contact <perlbug@perl.org>.
5246
5247 Aborting Configure now.
5248 EOM
5249         exit 2
5250         ;;
5251 esac
5252
5253 : determine where public executables go
5254 echo " "
5255 set dflt bin bin
5256 eval $prefixit
5257 fn=d~
5258 rp='Pathname where the public executables will reside?'
5259 . ./getfile
5260 if $test "X$ansexp" != "X$binexp"; then
5261         installbin=''
5262 fi
5263 bin="$ans"
5264 binexp="$ansexp"
5265 : Change installation prefix, if necessary.
5266 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5267 if $test X"$prefix" != X"$installprefix"; then
5268         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5269 else
5270         installbin="$binexp"
5271 fi
5272
5273 $cat <<EOM
5274
5275 After $package is installed, you may wish to install various
5276 add-on modules and utilities.  Typically, these add-ons will
5277 be installed under $prefix with the rest
5278 of this package.  However, you may wish to install such add-ons
5279 elsewhere under a different prefix.
5280
5281 If you do not wish to put everything under a single prefix, that's
5282 ok.  You will be prompted for the individual locations; this siteprefix
5283 is only used to suggest the defaults.
5284
5285 The default should be fine for most people.
5286
5287 EOM
5288 fn=d~+
5289 rp='Installation prefix to use for add-on modules and utilities?'
5290 : XXX Here might be another good place for an installstyle setting.
5291 case "$siteprefix" in
5292 '') dflt=$prefix ;;
5293 *)  dflt=$siteprefix ;;
5294 esac
5295 . ./getfile
5296 oldsiteprefix=''
5297 case "$siteprefix" in
5298 '') ;;
5299 *)
5300         case "$ans" in
5301         "$prefix") ;;
5302         *) oldsiteprefix="$prefix";;
5303         esac
5304         ;;
5305 esac
5306 siteprefix="$ans"
5307 siteprefixexp="$ansexp"
5308
5309 : determine where site specific libraries go.
5310 : Usual default is /usr/local/lib/perl5/site_perl/$version
5311 : The default "style" setting is made in installstyle.U
5312 : XXX No longer works with Prefixit stuff.
5313 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5314 case "$installstyle" in
5315 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5316 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5317 esac
5318 $cat <<EOM
5319
5320 The installation process will create a directory for
5321 site-specific extensions and modules.  Most users find it convenient
5322 to place all site-specific files in this directory rather than in the
5323 main distribution directory.
5324
5325 EOM
5326 fn=d~+
5327 rp='Pathname for the site-specific library files?'
5328 . ./getfile
5329 sitelib="$ans"
5330 sitelibexp="$ansexp"
5331 : Change installation prefix, if necessary.
5332 if $test X"$prefix" != X"$installprefix"; then
5333         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5334 else
5335         installsitelib="$sitelibexp"
5336 fi
5337
5338 : Determine list of previous versions to include in @INC
5339 $cat > getverlist <<EOPL
5340 #!$perl -w
5341 use File::Basename;
5342 \$api_versionstring = "$api_versionstring";
5343 \$version = "$version";
5344 \$sitelib = "$sitelib";
5345 \$archname = "$archname";
5346 EOPL
5347         $cat >> getverlist <<'EOPL'
5348 # Can't have leading @ because metaconfig interprets it as a command!
5349 ;@inc_version_list=();
5350 $stem=dirname($sitelib);
5351 # Redo to do opendir/readdir? 
5352 if (-d $stem) {
5353     chdir($stem);
5354     ;@candidates = glob("5.*");
5355 }
5356 else {
5357     ;@candidates = ();
5358 }
5359
5360 # XXX ToDo:  These comparisons must be reworked when two-digit
5361 # subversions come along, so that 5.7.10 compares as greater than
5362 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5363 # widespread that we can use the built-in version vectors rather
5364 # than reinventing them here.  For 5.6.0, however, we must
5365 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5366 foreach $d (@candidates) {
5367     if ($d lt $version) {
5368         if ($d ge $api_versionstring) {
5369             unshift(@inc_version_list, "$d/$archname", $d);
5370         }
5371         elsif ($d ge "5.005") {
5372             unshift(@inc_version_list, $d);
5373         }
5374     }
5375     else {
5376         # Skip newer version.  I.e. don't look in
5377         # 5.7.0 if we're installing 5.6.1.
5378     }
5379 }
5380
5381 if (@inc_version_list) {
5382     print '"';
5383     print join('", "', @inc_version_list);
5384     print '"';
5385 }
5386 else {
5387     # Blank space to preserve value for next Configure run.
5388     print " ";
5389 }
5390 EOPL
5391 chmod +x getverlist
5392 case "$inc_version_list" in
5393 '')     if test -x $perl; then
5394                 dflt=`$perl getverlist`
5395         else
5396                 dflt=''
5397         fi
5398         ;;
5399 *)  dflt="$inc_version_list" ;;
5400 esac
5401 $cat <<'EOM'
5402
5403 In order to ease the process of upgrading, this version of perl 
5404 can be configured to use modules built and installed with earlier 
5405 versions of perl that were installed under $prefix.  Specify here
5406 the list of earlier versions that this version of perl should check.
5407 If Configure detected no earlier versions of perl installed under
5408 $prefix, then the list will be empty.
5409
5410 The default should almost always be sensible, so if you're not sure,
5411 just accept the default.
5412 EOM
5413
5414 rp='list of earlier versions to include in @INC?'
5415 . ./myread
5416 inc_version_list="$ans"
5417 $rm -f getverlist
5418
5419 : determine whether to install perl also as /usr/bin/perl
5420
5421 echo " "
5422 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5423         $cat <<EOM
5424 Many scripts expect to perl to be installed as /usr/bin/perl.
5425 I can install the perl you are about to compile also as /usr/bin/perl
5426 (in addition to $installbin/perl).
5427 EOM
5428         case "$installusrbinperl" in
5429         "$undef"|[nN]*) dflt='n';;
5430         *)              dflt='y';;
5431         esac
5432         rp="Do you want to install perl as /usr/bin/perl?"
5433         . ./myread
5434         case "$ans" in
5435         [yY]*)  val="$define";;
5436         *)      val="$undef" ;;
5437         esac
5438 else
5439         val="$undef"
5440 fi
5441 set installusrbinperl
5442 eval $setvar
5443
5444 echo " "
5445 echo "Checking for GNU C Library..." >&4
5446 cat >gnulibc.c <<EOM
5447 #include <stdio.h>
5448 int main()
5449 {
5450 #ifdef __GLIBC__
5451     exit(0);
5452 #else
5453     exit(1);
5454 #endif
5455 }
5456 EOM
5457 set gnulibc
5458 if eval $compile_ok && ./gnulibc; then
5459         val="$define"
5460         echo "You are using the GNU C Library"
5461 else
5462         val="$undef"
5463         echo "You are not using the GNU C Library"
5464 fi
5465 $rm -f gnulibc*
5466 set d_gnulibc
5467 eval $setvar
5468
5469 : see if nm is to be used to determine whether a symbol is defined or not
5470 case "$usenm" in
5471 '')
5472         dflt=''
5473         case "$d_gnulibc" in
5474         "$define")
5475                 echo " "
5476                 echo "nm probably won't work on the GNU C Library." >&4
5477                 dflt=n
5478                 ;;
5479         esac
5480         case "$dflt" in
5481         '') 
5482                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5483                         echo " "
5484                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5485                         echo "'nm' won't be sufficient on this sytem." >&4
5486                         dflt=n
5487                 fi
5488                 ;;
5489         esac
5490         case "$dflt" in
5491         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5492                 if $test $dflt -gt 20; then
5493                         dflt=y
5494                 else
5495                         dflt=n
5496                 fi
5497                 ;;
5498         esac
5499         ;;
5500 *)
5501         case "$usenm" in
5502         true|$define) dflt=y;;
5503         *) dflt=n;;
5504         esac
5505         ;;
5506 esac
5507 $cat <<EOM
5508
5509 I can use $nm to extract the symbols from your C libraries. This
5510 is a time consuming task which may generate huge output on the disk (up
5511 to 3 megabytes) but that should make the symbols extraction faster. The
5512 alternative is to skip the 'nm' extraction part and to compile a small
5513 test program instead to determine whether each symbol is present. If
5514 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5515 this may be the best solution.
5516
5517 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5518
5519 EOM
5520 rp="Shall I use $nm to extract C symbols from the libraries?"
5521 . ./myread
5522 case "$ans" in
5523 [Nn]*) usenm=false;;
5524 *) usenm=true;;
5525 esac
5526
5527 runnm=$usenm
5528 case "$reuseval" in
5529 true) runnm=false;;
5530 esac
5531
5532 : nm options which may be necessary
5533 case "$nm_opt" in
5534 '') if $test -f /mach_boot; then
5535                 nm_opt=''       # Mach
5536         elif $test -d /usr/ccs/lib; then
5537                 nm_opt='-p'     # Solaris (and SunOS?)
5538         elif $test -f /dgux; then
5539                 nm_opt='-p'     # DG-UX
5540         elif $test -f /lib64/rld; then
5541                 nm_opt='-p'     # 64-bit Irix
5542         else
5543                 nm_opt=''
5544         fi;;
5545 esac
5546
5547 : nm options which may be necessary for shared libraries but illegal
5548 : for archive libraries.  Thank you, Linux.
5549 case "$nm_so_opt" in
5550 '')     case "$myuname" in
5551         *linux*)
5552                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5553                         nm_so_opt='--dynamic'
5554                 fi
5555                 ;;
5556         esac
5557         ;;
5558 esac
5559
5560 case "$runnm" in
5561 true)
5562 : get list of predefined functions in a handy place
5563 echo " "
5564 case "$libc" in
5565 '') libc=unknown
5566         case "$libs" in
5567         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5568         esac
5569         ;;
5570 esac
5571 libnames='';
5572 case "$libs" in
5573 '') ;;
5574 *)  for thislib in $libs; do
5575         case "$thislib" in
5576         -lc|-lc_s)
5577                 : Handle C library specially below.
5578                 ;;
5579         -l*)
5580                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5581                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5582                         :
5583                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5584                         :
5585                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5586                         :
5587                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5588                         :
5589                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5590                         :
5591                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5592                         :
5593                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5594                         :
5595                 else
5596                         try=''
5597                 fi
5598                 libnames="$libnames $try"
5599                 ;;
5600         *) libnames="$libnames $thislib" ;;
5601         esac
5602         done
5603         ;;
5604 esac
5605 xxx=normal
5606 case "$libc" in
5607 unknown)
5608         set /lib/libc.$so
5609         for xxx in $libpth; do
5610                 $test -r $1 || set $xxx/libc.$so
5611                 : The messy sed command sorts on library version numbers.
5612                 $test -r $1 || \
5613                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5614                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5615                                 h
5616                                 s/[0-9][0-9]*/0000&/g
5617                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5618                                 G
5619                                 s/\n/ /' | \
5620                          sort | $sed -e 's/^.* //'`
5621                 eval set \$$#
5622         done
5623         $test -r $1 || set /usr/ccs/lib/libc.$so
5624         $test -r $1 || set /lib/libsys_s$_a
5625         ;;
5626 *)
5627         set blurfl
5628         ;;
5629 esac
5630 if $test -r "$1"; then
5631         echo "Your (shared) C library seems to be in $1."
5632         libc="$1"
5633 elif $test -r /lib/libc && $test -r /lib/clib; then
5634         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5635         xxx=apollo
5636         libc='/lib/clib /lib/libc'
5637         if $test -r /lib/syslib; then
5638                 echo "(Your math library is in /lib/syslib.)"
5639                 libc="$libc /lib/syslib"
5640         fi
5641 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5642         echo "Your C library seems to be in $libc, as you said before."
5643 elif $test -r $incpath/usr/lib/libc$_a; then
5644         libc=$incpath/usr/lib/libc$_a;
5645         echo "Your C library seems to be in $libc.  That's fine."
5646 elif $test -r /lib/libc$_a; then
5647         libc=/lib/libc$_a;
5648         echo "Your C library seems to be in $libc.  You're normal."
5649 else
5650         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5651                 :
5652         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5653                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5654         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5655                 :
5656         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5657                 :
5658         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5659                 :
5660         else
5661                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5662         fi
5663         if $test -r "$tans"; then
5664                 echo "Your C library seems to be in $tans, of all places."
5665                 libc=$tans
5666         else
5667                 libc='blurfl'
5668         fi
5669 fi
5670 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5671         dflt="$libc"
5672         cat <<EOM
5673
5674 If the guess above is wrong (which it might be if you're using a strange
5675 compiler, or your machine supports multiple models), you can override it here.
5676
5677 EOM
5678 else
5679         dflt=''
5680         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5681         cat >&4 <<EOM
5682 I can't seem to find your C library.  I've looked in the following places:
5683
5684 EOM
5685         $sed 's/^/      /' libpath
5686         cat <<EOM
5687
5688 None of these seems to contain your C library. I need to get its name...
5689
5690 EOM
5691 fi
5692 fn=f
5693 rp='Where is your C library?'
5694 . ./getfile
5695 libc="$ans"
5696
5697 echo " "
5698 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5699 set X `cat libnames`
5700 shift
5701 xxx=files
5702 case $# in 1) xxx=file; esac
5703 echo "Extracting names from the following $xxx for later perusal:" >&4
5704 echo " "
5705 $sed 's/^/      /' libnames >&4
5706 echo " "
5707 $echo $n "This may take a while...$c" >&4
5708
5709 for file in $*; do
5710         case $file in
5711         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5712         *) $nm $nm_opt $file 2>/dev/null;;
5713         esac
5714 done >libc.tmp
5715
5716 $echo $n ".$c"
5717 $grep fprintf libc.tmp > libc.ptf
5718 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5719 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5720 xxx='[ADTSIW]'
5721 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5722         eval $xscan;\
5723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5724                 eval $xrun
5725 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5726         eval $xscan;\
5727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5728                 eval $xrun
5729 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5730         eval $xscan;\
5731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5732                 eval $xrun
5733 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5734         eval $xscan;\
5735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736                 eval $xrun
5737 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5738         eval $xscan;\
5739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5740                 eval $xrun
5741 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5746                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5747         eval $xscan;\
5748         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5749                 eval $xrun
5750 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5751         eval $xscan;\
5752         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5753                 eval $xrun
5754 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5755         eval $xscan;\
5756         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5757                 eval $xrun
5758 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5759         eval $xscan;\
5760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5761                 eval $xrun
5762 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5763         eval $xscan;\
5764         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5765                 eval $xrun
5766 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5767         eval $xscan;\
5768         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5769                 eval $xrun
5770 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5771         eval $xscan;\
5772         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5773                 eval $xrun
5774 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5775         eval $xscan;\
5776         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5777                 eval $xrun
5778 else
5779         $nm -p $* 2>/dev/null >libc.tmp
5780         $grep fprintf libc.tmp > libc.ptf
5781         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5782                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5783         then
5784                 nm_opt='-p'
5785                 eval $xrun
5786         else
5787                 echo " "
5788                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5789                 com=''
5790                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5791                         for thisname in $libnames $libc; do
5792                                 $ar t $thisname >>libc.tmp
5793                         done
5794                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5795                         echo "Ok." >&4
5796                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5797                         # Repeat libc to extract forwarders to DLL entries too
5798                         for thisname in $libnames $libc; do
5799                                 $ar tv $thisname >>libc.tmp
5800                                 # Revision 50 of EMX has bug in $ar.
5801                                 # it will not extract forwarders to DLL entries
5802                                 # Use emximp which will extract exactly them.
5803                                 emximp -o tmp.imp $thisname \
5804                                     2>/dev/null && \
5805                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5806                                     < tmp.imp >>libc.tmp
5807                                 $rm tmp.imp
5808                         done
5809                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5810                         echo "Ok." >&4
5811                 else
5812                         echo "$ar didn't seem to work right." >&4
5813                         echo "Maybe this is a Cray...trying bld instead..." >&4
5814                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5815                         then
5816                                 for thisname in $libnames; do
5817                                         bld t $libnames | \
5818                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5819                                         $ar t $thisname >>libc.tmp
5820                                 done
5821                                 echo "Ok." >&4
5822                         else
5823                                 echo "That didn't work either.  Giving up." >&4
5824                                 exit 1
5825                         fi
5826                 fi
5827         fi
5828 fi
5829 nm_extract="$com"
5830 if $test -f /lib/syscalls.exp; then
5831         echo " "
5832         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5833         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5834 fi
5835 ;;
5836 esac
5837 $rm -f libnames libpath
5838
5839 : see if dld is available
5840 set dld.h i_dld
5841 eval $inhdr
5842
5843 : is a C symbol defined?
5844 csym='tlook=$1;
5845 case "$3" in
5846 -v) tf=libc.tmp; tc=""; tdc="";;
5847 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5848 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5849 esac;
5850 tx=yes;
5851 case "$reuseval-$4" in
5852 true-) ;;
5853 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5854 esac;
5855 case "$tx" in
5856 yes)
5857         case "$runnm" in
5858         true)
5859                 if $contains $tlook $tf >/dev/null 2>&1;
5860                 then tval=true;
5861                 else tval=false;
5862                 fi;;
5863         *)
5864                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5865                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5866                 then tval=true;
5867                 else tval=false;
5868                 fi;
5869                 $rm -f t t.c;;
5870         esac;;
5871 *)
5872         case "$tval" in
5873         $define) tval=true;;
5874         *) tval=false;;
5875         esac;;
5876 esac;
5877 eval "$2=$tval"'
5878
5879 : define an is-in-libc? function
5880 inlibc='echo " "; td=$define; tu=$undef;
5881 sym=$1; var=$2; eval "was=\$$2";
5882 tx=yes;
5883 case "$reuseval$was" in
5884 true) ;;
5885 true*) tx=no;;
5886 esac;
5887 case "$tx" in
5888 yes)
5889         set $sym tres -f;
5890         eval $csym;
5891         case "$tres" in
5892         true)
5893                 echo "$sym() found." >&4;
5894                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5895         *)
5896                 echo "$sym() NOT found." >&4;
5897                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5898         esac;;
5899 *)
5900         case "$was" in
5901         $define) echo "$sym() found." >&4;;
5902         *) echo "$sym() NOT found." >&4;;
5903         esac;;
5904 esac'
5905
5906 : see if dlopen exists
5907 xxx_runnm="$runnm"
5908 runnm=false
5909 set dlopen d_dlopen
5910 eval $inlibc
5911 runnm="$xxx_runnm"
5912
5913 : determine which dynamic loading, if any, to compile in
5914 echo " "
5915 dldir="ext/DynaLoader"
5916 case "$usedl" in
5917 $define|y|true)
5918         dflt='y'
5919         usedl="$define"
5920         ;;
5921 $undef|n|false)
5922         dflt='n'
5923         usedl="$undef"
5924         ;;
5925 *) 
5926         dflt='n'
5927         case "$d_dlopen" in
5928             $define) dflt='y' ;;
5929         esac
5930         case "$i_dld" in
5931             $define) dflt='y' ;;
5932         esac
5933         : Does a dl_xxx.xs file exist for this operating system
5934         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5935         ;;
5936 esac
5937 rp="Do you wish to use dynamic loading?"
5938 . ./myread
5939 usedl="$ans"
5940 case "$ans" in
5941 y*) usedl="$define"
5942         case "$dlsrc" in
5943         '')
5944                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5945                         dflt="$dldir/dl_${osname}.xs"
5946                 elif $test "$d_dlopen" = "$define" ; then
5947                         dflt="$dldir/dl_dlopen.xs"
5948                 elif $test "$i_dld" = "$define" ; then
5949                         dflt="$dldir/dl_dld.xs"
5950                 else
5951                         dflt=''
5952                 fi
5953                 ;;
5954         *)      dflt="$dldir/$dlsrc"
5955                 ;;
5956         esac
5957     echo "The following dynamic loading files are available:"
5958         : Can not go over to $dldir because getfile has path hard-coded in.
5959         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5960         rp="Source file to use for dynamic loading"
5961         fn="fne"
5962         gfpth="$src"
5963         . ./getfile
5964         usedl="$define"
5965         : emulate basename
5966         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5967
5968         $cat << EOM
5969
5970 Some systems may require passing special flags to $cc -c to
5971 compile modules that will be used to create a shared library.
5972 To use no flags, say "none".
5973
5974 EOM
5975     case "$cccdlflags" in
5976     '') case "$gccversion" in
5977                 '') case "$osname" in
5978                         hpux)   dflt='+z' ;;
5979                         next)   dflt='none' ;;
5980                         irix*)  dflt='-KPIC' ;;
5981                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5982                         sunos)  dflt='-pic' ;;
5983                         *)      dflt='none' ;;
5984                     esac
5985                         ;;
5986                 *)  case "$osname" in
5987                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5988                         *)      dflt='-fpic' ;;
5989                     esac ;;
5990             esac ;;
5991         ' ') dflt='none' ;;
5992     *)  dflt="$cccdlflags" ;;
5993     esac
5994     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5995     . ./myread
5996     case "$ans" in
5997     none) cccdlflags=' ' ;;
5998     *) cccdlflags="$ans" ;;
5999     esac
6000
6001     cat << EOM
6002
6003 Some systems use ld to create libraries that can be dynamically loaded,
6004 while other systems (such as those using ELF) use $cc.
6005
6006 EOM
6007         case "$ld" in
6008         '')     $cat >try.c <<'EOM'
6009 /* Test for whether ELF binaries are produced */
6010 #include <fcntl.h>
6011 #include <stdlib.h>
6012 int main() {
6013         char b[4];
6014         int i = open("a.out",O_RDONLY);
6015         if(i == -1) 
6016                 exit(1); /* fail */
6017         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6018                 exit(0); /* succeed (yes, it's ELF) */
6019         else
6020                 exit(1); /* fail */
6021 }
6022 EOM
6023                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6024                         cat <<EOM
6025 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6026 EOM
6027                         dflt="$cc"
6028                 else
6029                         echo "I'll use ld to build dynamic libraries."
6030                         dflt='ld'
6031                 fi
6032                 rm -f try.c a.out
6033                 ;;
6034         *)      dflt="$ld"
6035                 ;;
6036         esac
6037
6038     rp="What command should be used to create dynamic libraries?"
6039     . ./myread
6040         ld="$ans"
6041
6042     cat << EOM
6043
6044 Some systems may require passing special flags to $ld to create a
6045 library that can be dynamically loaded.  If your ld flags include
6046 -L/other/path options to locate libraries outside your loader's normal
6047 search path, you may need to specify those -L options here as well.  To
6048 use no flags, say "none".
6049
6050 EOM
6051     case "$lddlflags" in
6052     '') case "$osname" in
6053                         beos) dflt='-nostart' ;;
6054                         hpux)  dflt='-b' ;;
6055                         linux|irix*)    dflt='-shared' ;;
6056                         next)  dflt='none' ;;
6057                         solaris) dflt='-G' ;;
6058                         sunos) dflt='-assert nodefinitions' ;;
6059                         svr4*|esix*) dflt="-G $ldflags" ;;
6060                 *)     dflt='none' ;;
6061                         esac
6062                         ;;
6063     *) dflt="$lddlflags" ;;
6064     esac
6065
6066         : Try to guess additional flags to pick up local libraries.
6067         : Be careful not to append to a plain 'none'
6068         case "$dflt" in
6069         none) dflt='' ;;
6070         esac
6071         for thisflag in $ldflags; do
6072                 case "$thisflag" in
6073                 -L*)
6074                         case " $dflt " in
6075                         *" $thisflag "*) ;;
6076                         *) dflt="$dflt $thisflag" ;;
6077                         esac
6078                         ;;
6079                 esac
6080         done
6081
6082         case "$dflt" in
6083         ''|' ') dflt='none' ;;
6084         esac
6085
6086     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6087     . ./myread
6088     case "$ans" in
6089     none) lddlflags=' ' ;;
6090     *) lddlflags="$ans" ;;
6091     esac
6092
6093         cat <<EOM
6094
6095 Some systems may require passing special flags to $cc to indicate that
6096 the resulting executable will use dynamic linking.  To use no flags,
6097 say "none".
6098
6099 EOM
6100     case "$ccdlflags" in
6101     '') case "$osname" in
6102                 hpux)   dflt='-Wl,-E' ;;
6103                 linux)  dflt='-rdynamic' ;;
6104                 next)   dflt='none' ;;
6105                 sunos)  dflt='none' ;;
6106                 *)      dflt='none' ;;
6107             esac ;;
6108     ' ')  dflt='none' ;;
6109     *)  dflt="$ccdlflags" ;;
6110     esac
6111     rp="Any special flags to pass to $cc to use dynamic loading?"
6112     . ./myread
6113     case "$ans" in
6114     none) ccdlflags=' ' ;;
6115     *) ccdlflags="$ans" ;;
6116     esac
6117     ;;
6118 *)  usedl="$undef"
6119         ld='ld'
6120     dlsrc='dl_none.xs'
6121     lddlflags=''
6122     ccdlflags=''
6123     ;;
6124 esac
6125
6126 also=''
6127 case "$usedl" in
6128 $undef)
6129         # No dynamic loading being used, so don't bother even to prompt.
6130         useshrplib='false'
6131         ;;
6132 *)      case "$useshrplib" in
6133         '')     case "$osname" in
6134                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6135                         dflt=y
6136                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6137                         ;;
6138                 next*)
6139                         case "$osvers" in
6140                         4*)     dflt=y
6141                                 also='Building a shared libperl is needed for MAB support.'
6142                                 ;;
6143                         *)      dflt=n
6144                                 ;;
6145                         esac
6146                         ;;
6147                 *)      dflt=n
6148                         ;;
6149                 esac
6150                 ;;
6151         $define|true|[Yy]*)
6152                 dflt=y
6153                 ;;
6154         *)      dflt=n
6155                 ;;
6156         esac
6157         $cat << EOM
6158
6159 The perl executable is normally obtained by linking perlmain.c with
6160 libperl${_a}, any static extensions (usually just DynaLoader), and
6161 any other libraries needed on this system (such as -lm, etc.).  Since
6162 your system supports dynamic loading, it is probably possible to build
6163 a shared libperl.$so.  If you will have more than one executable linked
6164 to libperl.$so, this will significantly reduce the size of each
6165 executable, but it may have a noticeable affect on performance.  The
6166 default is probably sensible for your system.
6167 $also
6168
6169 EOM
6170         rp="Build a shared libperl.$so (y/n)"
6171         . ./myread
6172         case "$ans" in
6173         true|$define|[Yy]*)
6174                 useshrplib='true'  ;;
6175         *)      useshrplib='false' ;;
6176         esac
6177         ;;
6178 esac
6179
6180 case "$useshrplib" in
6181 true)
6182         case "$libperl" in
6183         '')
6184                 # Figure out a good name for libperl.so.  Since it gets stored in
6185                 # a version-specific architecture-dependent library, the version
6186                 # number isn't really that important, except for making cc/ld happy.
6187                 #
6188                 # A name such as libperl.so.3.1
6189                 majmin="libperl.$so.$patchlevel.$subversion"
6190                 # A name such as libperl.so.301
6191                 majonly=`echo $patchlevel $subversion |
6192                         $awk '{printf "%d%02d", $1, $2}'`
6193                 majonly=libperl.$so.$majonly
6194                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6195                 # rely on figuring it out from the naming of libc.
6196                 case "${osname}${osvers}" in
6197                 next4*)
6198                         dflt=libperl.5.$so
6199                         # XXX How handle the --version stuff for MAB?
6200                         ;;
6201                 linux*)  # ld won't link with a bare -lperl otherwise.
6202                         dflt=libperl.$so
6203                         ;;
6204                 cygwin*) # include version
6205                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6206                         ;;
6207                 *)      # Try to guess based on whether libc has major.minor.
6208                         case "$libc" in
6209                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6210                         *libc.$so.[0-9]*) dflt=$majonly ;;
6211                         *)      dflt=libperl.$so ;;
6212                         esac
6213                         ;;
6214                 esac
6215                 ;;
6216         *)      dflt=$libperl
6217                 ;;
6218         esac
6219         cat << EOM
6220
6221 I need to select a good name for the shared libperl.  If your system uses
6222 library names with major and minor numbers, then you might want something
6223 like $majmin.  Alternatively, if your system uses a single version
6224 number for shared libraries, then you might want to use $majonly.
6225 Or, your system might be quite happy with a simple libperl.$so.
6226
6227 Since the shared libperl will get installed into a version-specific
6228 architecture-dependent directory, the version number of the shared perl
6229 library probably isn't important, so the default should be o.k.
6230
6231 EOM
6232         rp='What name do you want to give to the shared libperl?'
6233         . ./myread
6234         libperl=$ans
6235         echo "Ok, I'll use $libperl"
6236         ;;
6237 *)
6238         libperl="libperl${_a}"
6239         ;;
6240 esac
6241
6242 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6243 case "$shrpdir" in
6244 '') ;;
6245 *)      $cat >&4 <<EOM
6246 WARNING:  Use of the shrpdir variable for the installation location of
6247 the shared $libperl is not supported.  It was never documented and
6248 will not work in this version.  Let me (perlbug@perl.com)
6249 know of any problems this may cause.
6250
6251 EOM
6252         case "$shrpdir" in
6253         "$archlibexp/CORE")
6254                 $cat >&4 <<EOM
6255 But your current setting of $shrpdir is
6256 the default anyway, so it's harmless.
6257 EOM
6258                 ;;
6259         *)
6260                 $cat >&4 <<EOM
6261 Further, your current attempted setting of $shrpdir
6262 conflicts with the value of $archlibexp/CORE
6263 that installperl will use.
6264 EOM
6265                 ;;
6266         esac
6267         ;;
6268 esac
6269
6270 # How will the perl executable find the installed shared $libperl?
6271 # Add $xxx to ccdlflags.
6272 # If we can't figure out a command-line option, use $shrpenv to
6273 # set env LD_RUN_PATH.  The main perl makefile uses this.
6274 shrpdir=$archlibexp/CORE
6275 xxx=''
6276 tmp_shrpenv=''
6277 if "$useshrplib"; then
6278     case "$osname" in 
6279         aix)
6280                 # We'll set it in Makefile.SH...
6281                 ;;
6282         solaris|netbsd)
6283                 xxx="-R $shrpdir"
6284                 ;;
6285         freebsd)
6286                 xxx="-Wl,-R$shrpdir"
6287                 ;;
6288         linux|irix*|dec_osf)
6289                 xxx="-Wl,-rpath,$shrpdir"
6290                 ;;
6291         next)
6292                 # next doesn't like the default...
6293                 ;;
6294         beos)
6295                 # beos doesn't like the default, either.
6296                 ;;
6297         hpux*)
6298                 # hpux doesn't like the default, either.
6299                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6300                 ;;
6301         *)
6302                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6303                 ;;
6304         esac
6305         case "$xxx" in
6306         '') ;;
6307         *)      
6308                 # Only add $xxx if it isn't already in ccdlflags.
6309                 case " $ccdlflags " in
6310                 *" $xxx "*)     ;;
6311                 *)      ccdlflags="$ccdlflags $xxx"
6312                         cat <<EOM >&4
6313
6314 Adding $xxx to the flags
6315 passed to $ld so that the perl executable will find the 
6316 installed shared $libperl.
6317
6318 EOM
6319                         ;;
6320                 esac
6321                 ;;
6322         esac
6323 fi
6324 # Fix ccdlflags in AIX for building external extensions.
6325 # (For building Perl itself bare -bE:perl.exp is needed,
6326 #  Makefile.SH takes care of this.)
6327 case "$osname" in
6328 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6329 esac
6330 # Respect a hint or command-line value.
6331 case "$shrpenv" in
6332 '') shrpenv="$tmp_shrpenv" ;;
6333 esac
6334 case "$ldlibpthname" in
6335 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6336 none)   ldlibpthname='' ;;
6337 esac
6338
6339 : determine where manual pages go
6340 set man1dir man1dir none
6341 eval $prefixit
6342 $cat <<EOM
6343
6344 $spackage has manual pages available in source form.
6345 EOM
6346 case "$nroff" in
6347 nroff)
6348         echo "However, you don't have nroff, so they're probably useless to you."
6349         case "$man1dir" in
6350         '') man1dir="none";;
6351         esac;;
6352 esac
6353 echo "If you don't want the manual sources installed, answer 'none'."
6354 case "$man1dir" in
6355 ' ') dflt=none
6356         ;;
6357 '')
6358         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6359         lookpath="$lookpath $prefixexp/man/p_man/man1"
6360         lookpath="$lookpath $prefixexp/man/u_man/man1"
6361         lookpath="$lookpath $prefixexp/man/man.1"
6362         case "$sysman" in
6363         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6364         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6365         esac
6366         set dflt
6367         eval $prefixup
6368         ;;
6369 *)  dflt="$man1dir"
6370         ;;
6371 esac
6372 echo " "
6373 fn=dn+~
6374 rp="Where do the main $spackage manual pages (source) go?"
6375 . ./getfile
6376 if $test "X$man1direxp" != "X$ansexp"; then
6377         installman1dir=''
6378 fi
6379 man1dir="$ans"
6380 man1direxp="$ansexp"
6381 case "$man1dir" in
6382 '')     man1dir=' '
6383         installman1dir='';;
6384 esac
6385
6386 : Change installation prefix, if necessary.
6387 if $test X"$prefix" != X"$installprefix"; then
6388         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6389 else
6390         installman1dir="$man1direxp"
6391 fi
6392
6393 : What suffix to use on installed man pages
6394
6395 case "$man1dir" in
6396 ' ')
6397         man1ext='0'
6398         ;;
6399 *)
6400         rp="What suffix should be used for the main $spackage man pages?"
6401         case "$man1ext" in
6402         '')     case "$man1dir" in
6403                 *1)  dflt=1 ;;
6404                 *1p) dflt=1p ;;
6405                 *1pm) dflt=1pm ;;
6406                 *l) dflt=l;;
6407                 *n) dflt=n;;
6408                 *o) dflt=o;;
6409                 *p) dflt=p;;
6410                 *C) dflt=C;;
6411                 *L) dflt=L;;
6412                 *L1) dflt=L1;;
6413                 *) dflt=1;;
6414                 esac
6415                 ;;
6416         *)      dflt="$man1ext";;
6417         esac
6418         . ./myread
6419         man1ext="$ans"
6420         ;;
6421 esac
6422
6423 : see if we can have long filenames
6424 echo " "
6425 rmlist="$rmlist /tmp/cf$$"
6426 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6427 first=123456789abcdef
6428 second=/tmp/cf$$/$first
6429 $rm -f $first $second
6430 if (echo hi >$first) 2>/dev/null; then
6431         if $test -f 123456789abcde; then
6432                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6433                 val="$undef"
6434         else
6435                 if (echo hi >$second) 2>/dev/null; then
6436                         if $test -f /tmp/cf$$/123456789abcde; then
6437                                 $cat <<'EOM'
6438 That's peculiar... You can have filenames longer than 14 characters, but only
6439 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6440 I shall consider your system cannot support long filenames at all.
6441 EOM
6442                                 val="$undef"
6443                         else
6444                                 echo 'You can have filenames longer than 14 characters.' >&4
6445                                 val="$define"
6446                         fi
6447                 else
6448                         $cat <<'EOM'
6449 How confusing! Some of your filesystems are sane enough to allow filenames
6450 longer than 14 characters but some others like /tmp can't even think about them.
6451 So, for now on, I shall assume your kernel does not allow them at all.
6452 EOM
6453                         val="$undef"
6454                 fi
6455         fi
6456 else
6457         $cat <<'EOM'
6458 You can't have filenames longer than 14 chars.  You can't even think about them!
6459 EOM
6460         val="$undef"
6461 fi 
6462 set d_flexfnam
6463 eval $setvar
6464 $rm -rf /tmp/cf$$ 123456789abcde*
6465
6466 : determine where library module manual pages go
6467 set man3dir man3dir none
6468 eval $prefixit
6469 $cat <<EOM
6470
6471 $spackage has manual pages for many of the library modules.
6472 EOM
6473
6474 case "$nroff" in
6475 nroff)
6476         $cat <<'EOM'
6477 However, you don't have nroff, so they're probably useless to you.
6478 EOM
6479         case "$man3dir" in
6480         '') man3dir="none";;
6481         esac;;
6482 esac
6483
6484 case "$d_flexfnam" in
6485 undef)
6486         $cat <<'EOM'
6487 However, your system can't handle the long file names like File::Basename.3. 
6488 EOM
6489         case "$man3dir" in
6490         '') man3dir="none";;
6491         esac;;
6492 esac
6493
6494 echo "If you don't want the manual sources installed, answer 'none'."
6495 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6496 case "$man3dir" in
6497 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6498         if $test -d "$privlib/man/man3"; then
6499                 cat <<EOM >&4
6500
6501 WARNING:  Previous versions of perl installed man3 pages into
6502 $privlib/man/man3.  This version will suggest a 
6503 new default of $dflt.  
6504 EOM
6505                 tdflt=$dflt
6506                 dflt='n'
6507                 rp='Do you wish to preserve the old behavior?(y/n)'
6508                 . ./myread
6509                 case "$ans" in
6510                 y*) dflt="$privlib/man/man3" ;;
6511                 *)  dflt=$tdflt ;;
6512                 esac
6513     fi
6514         ;;
6515 ' ') dflt=none;;
6516 *)      dflt="$man3dir" ;;
6517 esac
6518 echo " "
6519 fn=dn+~
6520 rp="Where do the $package library man pages (source) go?"
6521 . ./getfile
6522 man3dir="$ans"
6523 man3direxp="$ansexp"
6524 case "$man1dir" in
6525 '')     man3dir=' '
6526         installman3dir='';;
6527 esac
6528
6529 : Change installation prefix, if necessary.
6530 if $test X"$prefix" != X"$installprefix"; then
6531         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6532 else
6533         installman3dir="$man3direxp"
6534 fi
6535
6536 : What suffix to use on installed man pages
6537 case "$man3dir" in
6538 ' ')
6539         man3ext='0'
6540         ;;
6541 *)
6542         rp="What suffix should be used for the $package library man pages?"
6543         case "$man3ext" in
6544         '')     case "$man3dir" in
6545                 *3)  dflt=3 ;;
6546                 *3p) dflt=3p ;;
6547                 *3pm) dflt=3pm ;;
6548                 *l) dflt=l;;
6549                 *n) dflt=n;;
6550                 *o) dflt=o;;
6551                 *p) dflt=p;;
6552                 *C) dflt=C;;
6553                 *L) dflt=L;;
6554                 *L3) dflt=L3;;
6555                 *) dflt=3;;
6556                 esac
6557                 ;;
6558         *)      dflt="$man3ext";;
6559         esac
6560         . ./myread
6561         man3ext="$ans"
6562         ;;
6563 esac
6564
6565 : see if we have to deal with yellow pages, now NIS.
6566 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6567         if $test -f /usr/etc/nibindd; then
6568                 echo " "
6569                 echo "I'm fairly confident you're on a NeXT."
6570                 echo " "
6571                 rp='Do you get the hosts file via NetInfo?'
6572                 dflt=y
6573                 case "$hostcat" in
6574                 nidump*) ;;
6575                 '') ;;
6576                 *) dflt=n;;
6577                 esac
6578                 . ./myread
6579                 case "$ans" in
6580                 y*) hostcat='nidump hosts .';;
6581                 *)      case "$hostcat" in
6582                         nidump*) hostcat='';;
6583                         esac
6584                         ;;
6585                 esac
6586         fi
6587         case "$hostcat" in
6588         nidump*) ;;
6589         *)
6590                 case "$hostcat" in
6591                 *ypcat*) dflt=y;;
6592                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6593                                 dflt=y
6594                         else
6595                                 dflt=n
6596                         fi;;
6597                 *) dflt=n;;
6598                 esac
6599                 echo " "
6600                 rp='Are you getting the hosts file via yellow pages?'
6601                 . ./myread
6602                 case "$ans" in
6603                 y*) hostcat='ypcat hosts';;
6604                 *) hostcat='cat /etc/hosts';;
6605                 esac
6606                 ;;
6607         esac
6608 fi
6609 case "$hostcat" in
6610 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6611 esac
6612 case "$groupcat" in
6613 '') test -f /etc/group && groupcat='cat /etc/group';;
6614 esac
6615 case "$passcat" in
6616 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6617 esac
6618
6619 : now get the host name
6620 echo " "
6621 echo "Figuring out host name..." >&4
6622 case "$myhostname" in
6623 '') cont=true
6624         echo 'Maybe "hostname" will work...'
6625         if tans=`sh -c hostname 2>&1` ; then
6626                 myhostname=$tans
6627                 phostname=hostname
6628                 cont=''
6629         fi
6630         ;;
6631 *) cont='';;
6632 esac
6633 if $test "$cont"; then
6634         if ./xenix; then
6635                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6636                 if tans=`cat /etc/systemid 2>&1` ; then
6637                         myhostname=$tans
6638                         phostname='cat /etc/systemid'
6639                         echo "Whadyaknow.  Xenix always was a bit strange..."
6640                         cont=''
6641                 fi
6642         elif $test -r /etc/systemid; then
6643                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6644         fi
6645 fi
6646 if $test "$cont"; then
6647         echo 'No, maybe "uuname -l" will work...'
6648         if tans=`sh -c 'uuname -l' 2>&1` ; then
6649                 myhostname=$tans
6650                 phostname='uuname -l'
6651         else
6652                 echo 'Strange.  Maybe "uname -n" will work...'
6653                 if tans=`sh -c 'uname -n' 2>&1` ; then
6654                         myhostname=$tans
6655                         phostname='uname -n'
6656                 else
6657                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6658                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6659                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6660                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6661                         else
6662                                 case "$myhostname" in
6663                                 '') echo "Does this machine have an identity crisis or something?"
6664                                         phostname='';;
6665                                 *)
6666                                         echo "Well, you said $myhostname before..."
6667                                         phostname='echo $myhostname';;
6668                                 esac
6669                         fi
6670                 fi
6671         fi
6672 fi
6673 : you do not want to know about this
6674 set $myhostname
6675 myhostname=$1
6676
6677 : verify guess
6678 if $test "$myhostname" ; then
6679         dflt=y
6680         rp='Your host name appears to be "'$myhostname'".'" Right?"
6681         . ./myread
6682         case "$ans" in
6683         y*) ;;
6684         *) myhostname='';;
6685         esac
6686 fi
6687
6688 : bad guess or no guess
6689 while $test "X$myhostname" = X ; do
6690         dflt=''
6691         rp="Please type the (one word) name of your host:"
6692         . ./myread
6693         myhostname="$ans"
6694 done
6695
6696 : translate upper to lower if necessary
6697 case "$myhostname" in
6698 *[A-Z]*)
6699         echo "(Normalizing case in your host name)"
6700         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6701         ;;
6702 esac
6703
6704 case "$myhostname" in
6705 *.*)
6706         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6707         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6708         echo "(Trimming domain name from host name--host name is now $myhostname)"
6709         ;;
6710 *) case "$mydomain" in
6711         '')
6712                 {
6713                         test "X$hostcat" = "Xypcat hosts" &&
6714                         ypmatch "$myhostname" hosts 2>/dev/null |\
6715                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6716                         $test -s hosts
6717                 } || {
6718                         test "X$hostcat" != "X" &&
6719                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6720                                         /[       ]$myhostname[  . ]/p" > hosts
6721                 }
6722                 tmp_re="[       . ]"
6723                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6724                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6725                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6726                         hosts | $sort | $uniq | \
6727                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6728                 case `$echo X$dflt` in
6729                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6730                         dflt=.
6731                         ;;
6732                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6733                         ;;
6734                 esac
6735                 case "$dflt" in
6736                 .)
6737                         tans=`./loc resolv.conf X /etc /usr/etc`
6738                         if $test -f "$tans"; then
6739                                 echo "(Attempting domain name extraction from $tans)"
6740                                 dflt=.`$sed -n -e 's/   / /g' \
6741                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6742                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6743                                 case "$dflt" in
6744                                 .) dflt=.`$sed -n -e 's/        / /g' \
6745                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6746                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6747                                         ;;
6748                                 esac
6749                         fi
6750                         ;;
6751                 esac
6752                 case "$dflt" in
6753                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6754                         dflt=.`sh -c domainname 2>/dev/null`
6755                         case "$dflt" in
6756                         '') dflt='.';;
6757                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6758                         esac
6759                         ;;
6760                 esac
6761                 case "$dflt" in
6762                 .) echo "(Lost all hope -- silly guess then)"
6763                         dflt='.uucp'
6764                         ;;
6765                 esac
6766                 $rm -f hosts
6767                 ;;
6768         *) dflt="$mydomain";;
6769         esac;;
6770 esac
6771 echo " "
6772 rp="What is your domain name?"
6773 . ./myread
6774 tans="$ans"
6775 case "$ans" in
6776 '') ;;
6777 .*) ;;
6778 *) tans=".$tans";;
6779 esac
6780 mydomain="$tans"
6781
6782 : translate upper to lower if necessary
6783 case "$mydomain" in
6784 *[A-Z]*)
6785         echo "(Normalizing case in your domain name)"
6786         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6787         ;;
6788 esac
6789
6790 : a little sanity check here
6791 case "$phostname" in
6792 '') ;;
6793 *)
6794         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6795         $myhostname$mydomain|$myhostname) ;;
6796         *)
6797                 case "$phostname" in
6798                 sed*)
6799                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6800                         ;;
6801                 *)
6802                         echo "(That doesn't agree with your $phostname command, by the way.)"
6803                         ;;
6804                 esac
6805         ;;
6806         esac
6807         ;;
6808 esac
6809
6810 $cat <<EOM
6811
6812 I need to get your e-mail address in Internet format if possible, i.e.
6813 something like user@host.domain. Please answer accurately since I have
6814 no easy means to double check it. The default value provided below
6815 is most probably close to the reality but may not be valid from outside
6816 your organization...
6817
6818 EOM
6819 cont=x
6820 while test "$cont"; do
6821         case "$cf_email" in
6822         '') dflt="$cf_by@$myhostname$mydomain";;
6823         *) dflt="$cf_email";;
6824         esac
6825         rp='What is your e-mail address?'
6826         . ./myread
6827         cf_email="$ans"
6828         case "$cf_email" in
6829         *@*.*) cont='' ;;
6830         *)
6831                 rp='Address does not look like an Internet one.  Use it anyway?'
6832                 case "$fastread" in
6833                 yes) dflt=y ;;
6834                 *) dflt=n ;;
6835                 esac
6836                 . ./myread
6837                 case "$ans" in
6838                 y*) cont='' ;;
6839                 *) echo " " ;;
6840                 esac
6841                 ;;
6842         esac
6843 done
6844
6845 $cat <<EOM
6846
6847 If you or somebody else will be maintaining perl at your site, please
6848 fill in the correct e-mail address here so that they may be contacted
6849 if necessary. Currently, the "perlbug" program included with perl
6850 will send mail to this address in addition to perlbug@perl.com. You may
6851 enter "none" for no administrator.
6852
6853 EOM
6854 case "$perladmin" in
6855 '') dflt="$cf_email";;
6856 *) dflt="$perladmin";;
6857 esac
6858 rp='Perl administrator e-mail address'
6859 . ./myread
6860 perladmin="$ans"
6861
6862 : figure out how to guarantee perl startup
6863 case "$startperl" in
6864 '')
6865         case "$sharpbang" in
6866         *!)
6867                 $cat <<EOH
6868
6869 I can use the #! construct to start perl on your system. This will
6870 make startup of perl scripts faster, but may cause problems if you
6871 want to share those scripts and perl is not in a standard place
6872 ($binexp/perl) on all your platforms. The alternative is to force
6873 a shell by starting the script with a single ':' character.
6874
6875 EOH
6876                 dflt="$binexp/perl"
6877                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6878                 . ./myread
6879                 case "$ans" in
6880                 none)   startperl=": # use perl";;
6881                 *)      startperl="#!$ans"
6882                         if $test 30 -lt `echo "$ans" | wc -c`; then
6883                                 $cat >&4 <<EOM
6884
6885 WARNING:  Some systems limit the #! command to 32 characters.
6886 If you experience difficulty running Perl scripts with #!, try
6887 installing Perl in a directory with a shorter pathname.
6888
6889 EOM
6890                         fi ;;
6891                 esac
6892                 ;;
6893         *) startperl=": # use perl"
6894                 ;;
6895         esac
6896         ;;
6897 esac
6898 echo "I'll use $startperl to start perl scripts."
6899
6900 : figure best path for perl in scripts
6901 case "$perlpath" in
6902 '')
6903         perlpath="$binexp/perl"
6904         case "$startperl" in
6905         *!*) ;;
6906         *)
6907                 $cat <<EOH
6908
6909 I will use the "eval 'exec'" idiom to start Perl on your system.
6910 I can use the full path of your Perl binary for this purpose, but
6911 doing so may cause problems if you want to share those scripts and
6912 Perl is not always in a standard place ($binexp/perl).
6913
6914 EOH
6915                 dflt="$binexp/perl"
6916                 rp="What path shall I use in \"eval 'exec'\"?"
6917                 . ./myread
6918                 perlpath="$ans"
6919                 ;;
6920         esac
6921         ;;
6922 esac
6923 case "$startperl" in
6924 *!*)    ;;
6925 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6926 esac
6927
6928 : determine where public executable scripts go
6929 set scriptdir scriptdir
6930 eval $prefixit
6931 case "$scriptdir" in
6932 '')
6933         dflt="$bin"
6934         : guess some guesses
6935         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6936         $test -d /usr/share/bin     && dflt=/usr/share/bin
6937         $test -d /usr/local/script  && dflt=/usr/local/script
6938         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6939         $test -d $prefixexp/script  && dflt=$prefixexp/script
6940         set dflt
6941         eval $prefixup
6942         ;;
6943 *)  dflt="$scriptdir"
6944         ;;
6945 esac
6946 $cat <<EOM
6947  
6948 Some installations have a separate directory just for executable scripts so
6949 that they can mount it across multiple architectures but keep the scripts in
6950 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6951 Or you might just lump your scripts in with all your other executables.
6952  
6953 EOM
6954 fn=d~
6955 rp='Where do you keep publicly executable scripts?'
6956 . ./getfile
6957 if $test "X$ansexp" != "X$scriptdirexp"; then
6958         installscript=''
6959 fi
6960 scriptdir="$ans"
6961 scriptdirexp="$ansexp"
6962 : Change installation prefix, if necessary.
6963 if $test X"$prefix" != X"$installprefix"; then
6964         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6965 else
6966         installscript="$scriptdirexp"
6967 fi
6968
6969 : determine where site specific architecture-dependent libraries go.
6970 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6971 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6972 : sitelib may have an optional trailing /share.
6973 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6974 tdflt="$tdflt/$archname"
6975 set sitearch sitearch none
6976 eval $prefixit
6977 case "$sitearch" in
6978 '')     dflt="$tdflt" ;;
6979 *)      dflt="$sitearch" ;;
6980 esac
6981 $cat <<EOM
6982
6983 The installation process will also create a directory for
6984 architecture-dependent site-specific extensions and modules.
6985
6986 EOM
6987 fn=nd~+
6988 rp='Pathname for the site-specific architecture-dependent library files?'
6989 . ./getfile
6990 sitearch="$ans"
6991 sitearchexp="$ansexp"
6992 : Change installation prefix, if necessary.
6993 if $test X"$prefix" != X"$installprefix"; then
6994         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6995 else
6996         installsitearch="$sitearchexp"
6997 fi
6998
6999 : determine where add-on public executables go
7000 case "$sitebin" in
7001 '')     dflt=$siteprefix/bin ;;
7002 *)      dflt=$sitebin ;;
7003 esac
7004 fn=d~
7005 rp='Pathname where the add-on public executables should be installed?'
7006 . ./getfile
7007 sitebin="$ans"
7008 sitebinexp="$ansexp"
7009 : Change installation prefix, if necessary.
7010 if $test X"$prefix" != X"$installprefix"; then
7011         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7012 else
7013         installsitebin="$sitebinexp"
7014 fi
7015
7016 cat <<EOM
7017
7018 Perl can be built to take advantage of long doubles which
7019 (if available) may give more accuracy and range for floating point numbers.
7020
7021 If this doesn't make any sense to you, just accept the default 'n'.
7022 EOM
7023
7024 case "$ccflags" in
7025 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7026 esac
7027
7028 case "$uselongdouble" in
7029 $define|true|[yY]*)     dflt='y';;
7030 *) dflt='n';;
7031 esac
7032 rp='Try to use long doubles if available?'
7033 . ./myread
7034 case "$ans" in
7035 y|Y)    val="$define"   ;;
7036 *)      val="$undef"    ;;
7037 esac
7038 set uselongdouble
7039 eval $setvar
7040
7041 case "$uselongdouble" in
7042 true|[yY]*) uselongdouble="$define" ;;
7043 esac
7044
7045 case "$uselongdouble" in
7046 $define)
7047 : Look for a hint-file generated 'call-back-unit'.  If the
7048 : user has specified that long doubles should be used,
7049 : we may need to set or change some other defaults.
7050         if $test -f uselongdouble.cbu; then
7051                 echo "Your platform has some specific hints for long doubles, using them..."
7052                 . ./uselongdouble.cbu
7053         else
7054                 $cat <<EOM
7055 (Your platform doesn't have any specific hints for long doubles.)
7056 EOM
7057         fi
7058         ;;
7059 esac
7060
7061 cat <<EOM
7062
7063 Perl can be built to take advantage of long longs which
7064 (if available) may give more range for integer numbers.
7065
7066 If this doesn't make any sense to you, just accept the default 'n'.
7067 EOM
7068
7069 case "$ccflags" in
7070 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7071 esac
7072
7073 case "$uselonglong" in
7074 $define|true|[yY]*)     dflt='y';;
7075 *) dflt='n';;
7076 esac
7077 rp='Try to use long longs if available?'
7078 . ./myread
7079 case "$ans" in
7080 y|Y)    val="$define"   ;;
7081 *)      val="$undef"    ;;
7082 esac
7083 set uselonglong
7084 eval $setvar
7085
7086 case "$uselonglong" in
7087 true|[yY]*) uselonglong="$define" ;;
7088 esac
7089
7090 case "$uselonglong" in
7091 $define)
7092 : Look for a hint-file generated 'call-back-unit'.  If the
7093 : user has specified that long longs should be used,
7094 : we may need to set or change some other defaults.
7095         if $test -f uselonglong.cbu; then
7096                 echo "Your platform has some specific hints for long longs, using them..."
7097                 . ./uselonglong.cbu
7098         else
7099                 $cat <<EOM
7100 (Your platform doesn't have any specific hints for long longs.)
7101 EOM
7102         fi
7103         ;;
7104 esac
7105
7106 cat <<EOM
7107
7108 Previous version of $package used the standard IO mechanisms as defined
7109 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7110 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7111 the default.  This abstraction layer can use AT&T's sfio (if you already
7112 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7113 problems with some extension modules.  Using PerlIO with stdio is safe,
7114 but it is slower than plain stdio and therefore is not the default.
7115
7116 If this doesn't make any sense to you, just accept the default 'n'.
7117 EOM
7118 case "$useperlio" in
7119 $define|true|[yY]*)     dflt='y';;
7120 *) dflt='n';;
7121 esac
7122 rp='Use the experimental PerlIO abstraction layer?'
7123 . ./myread
7124 case "$ans" in
7125 y|Y) 
7126         val="$define"
7127         ;;     
7128 *)      
7129         echo "Ok, doing things the stdio way"
7130         val="$undef"
7131         ;;
7132 esac
7133 set useperlio
7134 eval $setvar 
7135
7136 case "$vendorprefix" in
7137 '')     d_vendorbin="$undef"
7138         vendorbin=''
7139         vendorbinexp=''
7140         ;;
7141 *)      d_vendorbin="$define"
7142         : determine where vendor-supplied executables go.
7143         dflt=$vendorprefix/bin
7144         fn=d~+
7145         rp='Pathname for the vendor-supplied executables directory?'
7146         . ./getfile
7147         vendorbin="$ans"
7148         vendorbinexp="$ansexp"
7149         : Change installation prefix, if necessary.
7150         if $test X"$prefix" != X"$installprefix"; then
7151                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7152         else
7153                 installvendorbin="$vendorbinexp"
7154         fi
7155         ;;
7156 esac
7157
7158 : check for length of double
7159 echo " "
7160 case "$doublesize" in
7161 '')
7162         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7163         $cat >try.c <<'EOCP'
7164 #include <stdio.h>
7165 int main()
7166 {
7167     printf("%d\n", (int)sizeof(double));
7168     exit(0);
7169 }
7170 EOCP
7171         set try
7172         if eval $compile_ok; then
7173                 doublesize=`./try`
7174                 $echo " $doublesize bytes." >&4
7175         else
7176                 dflt='8'
7177                 echo "(I can't seem to compile the test program.  Guessing...)"
7178                 rp="What is the size of a double precision number (in bytes)?"
7179                 . ./myread
7180                 doublesize="$ans"
7181         fi
7182         ;;
7183 esac
7184 $rm -f try.c try
7185
7186 : check for long doubles
7187 echo " "
7188 $echo $n "Checking to see if your system supports long double..." $c >&4
7189 echo 'int main() { long double x = 7.0; }' > try.c
7190 set try
7191 if eval $compile; then
7192         val="$define"
7193         echo " Yes, it does." >&4
7194 else
7195         val="$undef"
7196         echo " No, it doesn't." >&4
7197 fi
7198 $rm try.*
7199 set d_longdbl
7200 eval $setvar
7201
7202 : check for length of long double
7203 case "${d_longdbl}${longdblsize}" in
7204 $define)
7205         echo " "
7206         $echo $n "Checking to see how big your long doubles are..." $c >&4
7207         $cat >try.c <<'EOCP'
7208 #include <stdio.h>
7209 int main()
7210 {
7211         printf("%d\n", sizeof(long double));
7212 }
7213 EOCP
7214         set try
7215         set try
7216         if eval $compile; then
7217                 longdblsize=`./try$exe_ext`
7218                 $echo " $longdblsize bytes." >&4
7219         else
7220                 dflt='8'
7221                 echo " "
7222                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7223                 rp="What is the size of a long double (in bytes)?"
7224                 . ./myread
7225                 longdblsize="$ans"
7226         fi
7227         if $test "X$doublesize" = "X$longdblsize"; then
7228                 echo "(That isn't any different from an ordinary double.)"
7229         fi      
7230         ;;
7231 esac
7232 $rm -f try.* try
7233
7234 : Check how to convert floats to strings.
7235 if test "X$d_Gconvert" = X; then
7236         echo " "
7237         echo "Checking for an efficient way to convert floats to strings."
7238         $cat >try.c <<EOP
7239 #ifdef TRY_gconvert
7240 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7241 char *myname = "gconvert";
7242 #endif
7243 #ifdef TRY_gcvt
7244 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7245 char *myname = "gcvt";
7246 #endif
7247 #ifdef TRY_qgcvt
7248 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7249 char *myname = "qgcvt";
7250 #define DOUBLETYPE long double
7251 #endif
7252 #ifdef TRY_sprintf
7253 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7254 char *myname = "sprintf";
7255 #endif
7256
7257 #ifndef DOUBLETYPE
7258 #define DOUBLETYPE double
7259 #endif
7260
7261 #include <stdio.h>
7262
7263 #ifdef I_STDLIB
7264 #include <stdlib.h>
7265 #endif
7266
7267 int
7268 checkit(expect, got)
7269 char *expect;
7270 char *got;
7271 {
7272     if (strcmp(expect, got)) {
7273                 printf("%s oddity:  Expected %s, got %s\n",
7274                         myname, expect, got);
7275                 exit(1);
7276         }
7277 }
7278
7279 int main()
7280
7281         char buf[64]; 
7282         buf[63] = '\0';
7283
7284         /* This must be 1st test on (which?) platform */
7285         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7286         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7287         checkit("0.1", buf);
7288
7289         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7290         checkit("1", buf);
7291
7292         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7293         checkit("0", buf);
7294
7295         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7296         checkit("-1", buf);
7297
7298         /* Some Linux gcvt's give 1.e+5 here. */
7299         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7300         checkit("100000", buf);
7301         
7302         /* Some Linux gcvt's give -1.e+5 here. */
7303         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7304         checkit("-100000", buf);
7305
7306         exit(0);
7307 }
7308 EOP
7309         case "$d_Gconvert" in
7310         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7311         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7312         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7313         *) xxx_list='gconvert gcvt sprintf' ;;
7314         esac
7315
7316         case "$d_longdbl$uselongdouble" in
7317         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7318         esac
7319
7320         for xxx_convert in $xxx_list; do
7321                 echo "Trying $xxx_convert..."
7322                 $rm -f try try$_o
7323                 set try -DTRY_$xxx_convert
7324                 if eval $compile; then
7325                         echo "$xxx_convert() found." >&4
7326                         if ./try; then
7327                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7328                                 break;
7329                         else
7330                                 echo "...But $xxx_convert didn't work as I expected."
7331                         fi
7332                 else
7333                         echo "$xxx_convert NOT found." >&4
7334                 fi
7335         done
7336                 
7337         case "$xxx_convert" in
7338         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7339         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7340         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7341         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7342         esac
7343 fi
7344
7345 echo " "
7346
7347 if $test X"$d_longdbl" = X"$define"; then
7348
7349 echo "Checking how to print long doubles..." >&4
7350
7351 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7352         $cat >try.c <<'EOCP'
7353 #include <sys/types.h>
7354 #include <stdio.h>
7355 int main() {
7356   double d = 123.456;
7357   printf("%.3f\n", d);
7358 }
7359 EOCP
7360         set try
7361         if eval $compile; then
7362                 yyy=`./try$exe_ext`
7363                 case "$yyy" in
7364                 123.456)
7365                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7366                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7367                         echo "We will use %f."
7368                         ;;
7369                 esac
7370         fi
7371 fi
7372
7373 if $test X"$sPRIfldbl" = X; then
7374         $cat >try.c <<'EOCP'
7375 #include <sys/types.h>
7376 #include <stdio.h>
7377 int main() {
7378   long double d = 123.456;
7379   printf("%.3llf\n", d);
7380 }
7381 EOCP
7382         set try
7383         if eval $compile; then
7384                 yyy=`./try$exe_ext`
7385                 case "$yyy" in
7386                 123.456)
7387                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7388                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7389                         echo "We will use %llf."
7390                         ;;
7391                 esac
7392         fi
7393 fi
7394
7395 if $test X"$sPRIfldbl" = X; then
7396         $cat >try.c <<'EOCP'
7397 #include <sys/types.h>
7398 #include <stdio.h>
7399 int main() {
7400   long double d = 123.456;
7401   printf("%.3Lf\n", d);
7402 }
7403 EOCP
7404         set try
7405         if eval $compile; then
7406                 yyy=`./try$exe_ext`
7407                 case "$yyy" in
7408                 123.456)
7409                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7410                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7411                         echo "We will use %Lf."
7412                         ;;
7413                 esac
7414         fi
7415 fi
7416
7417 if $test X"$sPRIfldbl" = X; then
7418         $cat >try.c <<'EOCP'
7419 #include <sys/types.h>
7420 #include <stdio.h>
7421 int main() {
7422   long double d = 123.456;
7423   printf("%.3lf\n", d);
7424 }
7425 EOCP
7426         set try
7427         if eval $compile; then
7428                 yyy=`./try$exe_ext`
7429                 case "$yyy" in
7430                 123.456)
7431                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7432                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7433                         echo "We will use %lf."
7434                         ;;
7435                 esac
7436         fi
7437 fi
7438
7439 if $test X"$sPRIfldbl" = X; then
7440         echo "Cannot figure out how to print long doubles." >&4
7441 fi
7442
7443 $rm -f try try.*
7444
7445 fi # d_longdbl
7446
7447 case "$sPRIfldbl" in
7448 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7449         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7450         ;;
7451 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7452         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7453         ;;
7454 esac
7455
7456 : Initialize h_fcntl
7457 h_fcntl=false
7458
7459 : Initialize h_sysfile
7460 h_sysfile=false
7461
7462 : access call always available on UNIX
7463 set access d_access
7464 eval $inlibc
7465
7466 : locate the flags for 'access()'
7467 case "$d_access" in
7468 "$define")
7469         echo " "
7470         $cat >access.c <<'EOCP'
7471 #include <sys/types.h>
7472 #ifdef I_FCNTL
7473 #include <fcntl.h>
7474 #endif
7475 #ifdef I_SYS_FILE
7476 #include <sys/file.h>
7477 #endif
7478 #ifdef I_UNISTD
7479 #include <unistd.h>
7480 #endif
7481 int main() {
7482         exit(R_OK);
7483 }
7484 EOCP
7485         : check sys/file.h first, no particular reason here
7486         if $test `./findhdr sys/file.h` && \
7487                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7488                 h_sysfile=true;
7489                 echo "<sys/file.h> defines the *_OK access constants." >&4
7490         elif $test `./findhdr fcntl.h` && \
7491                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7492                 h_fcntl=true;
7493                 echo "<fcntl.h> defines the *_OK access constants." >&4
7494         elif $test `./findhdr unistd.h` && \
7495                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7496                 echo "<unistd.h> defines the *_OK access constants." >&4
7497         else
7498                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7499         fi
7500         ;;
7501 esac
7502 $rm -f access*
7503
7504 : see if accessx exists
7505 set accessx d_accessx
7506 eval $inlibc
7507
7508 : see if alarm exists
7509 set alarm d_alarm
7510 eval $inlibc
7511
7512 : see if atolf exists
7513 set atolf d_atolf
7514 eval $inlibc
7515
7516 : see if atoll exists
7517 set atoll d_atoll
7518 eval $inlibc
7519
7520 : Look for GNU-cc style attribute checking
7521 echo " "
7522 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7523 $cat >attrib.c <<'EOCP'
7524 #include <stdio.h>
7525 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7526 EOCP
7527 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7528         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7529                 echo "Your C compiler doesn't fully support __attribute__."
7530                 val="$undef"
7531         else
7532                 echo "Your C compiler supports __attribute__."
7533                 val="$define"
7534         fi
7535 else
7536         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7537         val="$undef"
7538 fi
7539 set d_attribut
7540 eval $setvar
7541 $rm -f attrib*
7542
7543 : see if bcmp exists
7544 set bcmp d_bcmp
7545 eval $inlibc
7546
7547 : see if bcopy exists
7548 set bcopy d_bcopy
7549 eval $inlibc
7550
7551 : see if this is a unistd.h system
7552 set unistd.h i_unistd
7553 eval $inhdr
7554
7555 : see if getpgrp exists
7556 set getpgrp d_getpgrp
7557 eval $inlibc
7558
7559 case "$d_getpgrp" in
7560 "$define")
7561         echo " "
7562         echo "Checking to see which flavor of getpgrp is in use..."
7563         $cat >set.c <<EOP
7564 #$i_unistd I_UNISTD
7565 #include <sys/types.h>
7566 #ifdef I_UNISTD
7567 #  include <unistd.h>
7568 #endif
7569 int main()
7570 {
7571         if (getuid() == 0) {
7572                 printf("(I see you are running Configure as super-user...)\n");
7573                 setuid(1);
7574         }
7575 #ifdef TRY_BSD_PGRP
7576         if (getpgrp(1) == 0)
7577                 exit(0);
7578 #else
7579         if (getpgrp() > 0)
7580                 exit(0);
7581 #endif
7582         exit(1);
7583 }
7584 EOP
7585         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7586                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7587                 val="$define"
7588         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7589                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7590                 val="$undef"
7591         else
7592                 echo "I can't seem to compile and run the test program."
7593                 if ./usg; then
7594                         xxx="a USG one, i.e. you use getpgrp()."
7595                 else
7596                         # SVR4 systems can appear rather BSD-ish.
7597                         case "$i_unistd" in
7598                         $undef)
7599                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7600                                 val="$define"
7601                                 ;;
7602                         $define)
7603                                 xxx="probably a USG one, i.e. you use getpgrp()."
7604                                 val="$undef"
7605                                 ;;
7606                         esac
7607                 fi
7608                 echo "Assuming your getpgrp is $xxx" >&4
7609         fi
7610         ;;
7611 *) val="$undef";;
7612 esac
7613 set d_bsdgetpgrp
7614 eval $setvar
7615 $rm -f set set.c
7616
7617 : see if setpgrp exists
7618 set setpgrp d_setpgrp
7619 eval $inlibc
7620
7621 case "$d_setpgrp" in
7622 "$define")
7623         echo " "
7624         echo "Checking to see which flavor of setpgrp is in use..."
7625         $cat >set.c <<EOP
7626 #$i_unistd I_UNISTD
7627 #include <sys/types.h>
7628 #ifdef I_UNISTD
7629 #  include <unistd.h>
7630 #endif
7631 int main()
7632 {
7633         if (getuid() == 0) {
7634                 printf("(I see you are running Configure as super-user...)\n");
7635                 setuid(1);
7636         }
7637 #ifdef TRY_BSD_PGRP
7638         if (-1 == setpgrp(1, 1))
7639                 exit(0);
7640 #else
7641         if (setpgrp() != -1)
7642                 exit(0);
7643 #endif
7644         exit(1);
7645 }
7646 EOP
7647         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7648                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7649                 val="$define"
7650         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7651                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7652                 val="$undef"
7653         else
7654                 echo "(I can't seem to compile and run the test program.)"
7655                 if ./usg; then
7656                         xxx="a USG one, i.e. you use setpgrp()."
7657                 else
7658                         # SVR4 systems can appear rather BSD-ish.
7659                         case "$i_unistd" in
7660                         $undef)
7661                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7662                                 val="$define"
7663                                 ;;
7664                         $define)
7665                                 xxx="probably a USG one, i.e. you use setpgrp()."
7666                                 val="$undef"
7667                                 ;;
7668                         esac
7669                 fi
7670                 echo "Assuming your setpgrp is $xxx" >&4
7671         fi
7672         ;;
7673 *) val="$undef";;
7674 esac
7675 set d_bsdsetpgrp
7676 eval $setvar
7677 $rm -f set set.c
7678 : see if bzero exists
7679 set bzero d_bzero
7680 eval $inlibc
7681
7682 : see if signal is declared as pointer to function returning int or void
7683 echo " "
7684 xxx=`./findhdr signal.h`
7685 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7686 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7687         echo "You have int (*signal())() instead of void." >&4
7688         val="$undef"
7689 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7690         echo "You have void (*signal())()." >&4
7691         val="$define"
7692 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7693         echo "You have int (*signal())() instead of void." >&4
7694         val="$undef"
7695 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7696         echo "You have void (*signal())()." >&4
7697         val="$define"
7698 else
7699         case "$d_voidsig" in
7700         '')
7701         echo "I can't determine whether signal handler returns void or int..." >&4
7702                 dflt=void
7703                 rp="What type does your signal handler return?"
7704                 . ./myread
7705                 case "$ans" in
7706                 v*) val="$define";;
7707                 *) val="$undef";;
7708                 esac;;
7709         "$define")
7710                 echo "As you already told me, signal handler returns void." >&4
7711                 val="$define"
7712                 ;;
7713         *)      echo "As you already told me, signal handler returns int." >&4
7714                 val="$undef"
7715                 ;;
7716         esac
7717 fi
7718 set d_voidsig
7719 eval $setvar
7720 case "$d_voidsig" in
7721 "$define") signal_t="void";;
7722 *) signal_t="int";;
7723 esac
7724 $rm -f $$.tmp
7725
7726 : check for ability to cast large floats to 32-bit ints.
7727 echo " "
7728 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7729 if $test "$intsize" -ge 4; then
7730         xxx=int
7731 else
7732         xxx=long
7733 fi
7734 $cat >try.c <<EOCP
7735 #include <stdio.h>
7736 #include <sys/types.h>
7737 #include <signal.h>
7738 $signal_t blech(s) int s; { exit(3); }
7739 int main()
7740 {
7741         $xxx i32;
7742         double f, g;
7743         int result = 0;
7744         char str[16];
7745         signal(SIGFPE, blech);
7746
7747         /* Don't let compiler optimize the test away.  Store the number 
7748            in a writable string for gcc to pass to sscanf under HP/UX.
7749         */
7750         sprintf(str, "2147483647");
7751         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7752         g = 10 * f;
7753         i32  = ($xxx) g;
7754
7755         /* x86 processors will probably give 0x8000 0000, which is a
7756        sign change.  We don't want that.  We want to mimic SPARC
7757            behavior here, which is to preserve the sign and give
7758            back 0x7fff ffff.
7759         */
7760         if (i32 != ($xxx) f)
7761                 result |= 1;
7762         exit(result);
7763 }
7764 EOCP
7765 set try
7766 if eval $compile_ok; then
7767         ./try
7768         yyy=$?
7769 else
7770         echo "(I can't seem to compile the test program--assuming it can't)"
7771         yyy=1
7772 fi
7773 case "$yyy" in
7774 0)      val="$define"
7775         echo "Yup, it can."
7776         ;;
7777 *)      val="$undef"
7778         echo "Nope, it can't."
7779         ;;
7780 esac
7781 set d_casti32
7782 eval $setvar
7783 $rm -f try try.*
7784
7785 : check for ability to cast negative floats to unsigned
7786 echo " "
7787 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7788 $cat >try.c <<EOCP
7789 #include <stdio.h>
7790 #include <sys/types.h>
7791 #include <signal.h>
7792 $signal_t blech(s) int s; { exit(7); }
7793 $signal_t blech_in_list(s) int s; { exit(4); }
7794 unsigned long dummy_long(p) unsigned long p; { return p; }
7795 unsigned int dummy_int(p) unsigned int p; { return p; }
7796 unsigned short dummy_short(p) unsigned short p; { return p; }
7797 int main()
7798 {
7799         double f;
7800         unsigned long along;
7801         unsigned int aint;
7802         unsigned short ashort;
7803         int result = 0;
7804         char str[16];
7805         
7806         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7807            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7808            optimized the whole file away
7809         */
7810         /* Store the number in a writable string for gcc to pass to 
7811            sscanf under HP/UX.
7812         */
7813         sprintf(str, "-123");
7814         sscanf(str, "%lf", &f);  /* f = -123.; */
7815
7816         signal(SIGFPE, blech);
7817         along = (unsigned long)f;
7818         aint = (unsigned int)f;
7819         ashort = (unsigned short)f;
7820         if (along != (unsigned long)-123)
7821                 result |= 1;
7822         if (aint != (unsigned int)-123)
7823                 result |= 1;
7824         if (ashort != (unsigned short)-123)
7825                 result |= 1;
7826         sprintf(str, "1073741824.");
7827         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7828         f = f + f;
7829         along = 0;
7830         along = (unsigned long)f;
7831         if (along != 0x80000000)
7832                 result |= 2;
7833         f -= 1.;
7834         along = 0;
7835         along = (unsigned long)f;
7836         if (along != 0x7fffffff)
7837                 result |= 1;
7838         f += 2.;
7839         along = 0;
7840         along = (unsigned long)f;
7841         if (along != 0x80000001)
7842                 result |= 2;
7843         if (result)
7844                 exit(result);
7845         signal(SIGFPE, blech_in_list);
7846         sprintf(str, "123.");
7847         sscanf(str, "%lf", &f);  /* f = 123.; */
7848         along = dummy_long((unsigned long)f);
7849         aint = dummy_int((unsigned int)f);
7850         ashort = dummy_short((unsigned short)f);
7851         if (along != (unsigned long)123)
7852                 result |= 4;
7853         if (aint != (unsigned int)123)
7854                 result |= 4;
7855         if (ashort != (unsigned short)123)
7856                 result |= 4;
7857         exit(result);
7858
7859 }
7860 EOCP
7861 set try
7862 if eval $compile_ok; then
7863         ./try
7864         castflags=$?
7865 else
7866         echo "(I can't seem to compile the test program--assuming it can't)"
7867         castflags=7
7868 fi
7869 case "$castflags" in
7870 0)      val="$define"
7871         echo "Yup, it can."
7872         ;;
7873 *)      val="$undef"
7874         echo "Nope, it can't."
7875         ;;
7876 esac
7877 set d_castneg
7878 eval $setvar
7879 $rm -f try.*
7880
7881 : see if vprintf exists
7882 echo " "
7883 if set vprintf val -f d_vprintf; eval $csym; $val; then
7884         echo 'vprintf() found.' >&4
7885         val="$define"
7886         $cat >vprintf.c <<'EOF'
7887 #include <varargs.h>
7888
7889 int main() { xxx("foo"); }
7890
7891 xxx(va_alist)
7892 va_dcl
7893 {
7894         va_list args;
7895         char buf[10];
7896
7897         va_start(args);
7898         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7899 }
7900 EOF
7901         set vprintf
7902         if eval $compile && ./vprintf; then
7903                 echo "Your vsprintf() returns (int)." >&4
7904                 val2="$undef"
7905         else
7906                 echo "Your vsprintf() returns (char*)." >&4
7907                 val2="$define"
7908         fi
7909 else
7910         echo 'vprintf() NOT found.' >&4
7911                 val="$undef"
7912                 val2="$undef"
7913 fi
7914 set d_vprintf
7915 eval $setvar
7916 val=$val2
7917 set d_charvspr
7918 eval $setvar
7919
7920 : see if chown exists
7921 set chown d_chown
7922 eval $inlibc
7923
7924 : see if chroot exists
7925 set chroot d_chroot
7926 eval $inlibc
7927
7928 : see if chsize exists
7929 set chsize d_chsize
7930 eval $inlibc
7931
7932 : check for const keyword
7933 echo " "
7934 echo 'Checking to see if your C compiler knows about "const"...' >&4
7935 $cat >const.c <<'EOCP'
7936 typedef struct spug { int drokk; } spug;
7937 int main()
7938 {
7939         const char *foo;
7940         const spug y;
7941 }
7942 EOCP
7943 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7944         val="$define"
7945         echo "Yup, it does."
7946 else
7947         val="$undef"
7948         echo "Nope, it doesn't."
7949 fi
7950 set d_const
7951 eval $setvar
7952
7953 : see if crypt exists
7954 echo " "
7955 if set crypt val -f d_crypt; eval $csym; $val; then
7956         echo 'crypt() found.' >&4
7957         val="$define"
7958         cryptlib=''
7959 else
7960         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7961         if $test -z "$cryptlib"; then
7962                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7963         else
7964                 cryptlib=-lcrypt
7965         fi
7966         if $test -z "$cryptlib"; then
7967                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7968         else
7969                 cryptlib=-lcrypt
7970         fi
7971         if $test -z "$cryptlib"; then
7972                 cryptlib=`./loc libcrypt$_a "" $libpth`
7973         else
7974                 cryptlib=-lcrypt
7975         fi
7976         if $test -z "$cryptlib"; then
7977                 echo 'crypt() NOT found.' >&4
7978                 val="$undef"
7979         else
7980                 val="$define"
7981         fi
7982 fi
7983 set d_crypt
7984 eval $setvar
7985
7986 : get csh whereabouts
7987 case "$csh" in
7988 'csh') val="$undef" ;;
7989 *) val="$define" ;;
7990 esac
7991 set d_csh
7992 eval $setvar
7993 : Respect a hint or command line value for full_csh.
7994 case "$full_csh" in
7995 '') full_csh=$csh ;;
7996 esac
7997
7998 : see if cuserid exists
7999 set cuserid d_cuserid
8000 eval $inlibc
8001
8002 : see if this is a limits.h system
8003 set limits.h i_limits
8004 eval $inhdr
8005
8006 : see if this is a float.h system
8007 set float.h i_float
8008 eval $inhdr
8009
8010 : See if number of significant digits in a double precision number is known
8011 echo " "
8012 $cat >dbl_dig.c <<EOM
8013 #$i_limits I_LIMITS
8014 #$i_float I_FLOAT
8015 #ifdef I_LIMITS
8016 #include <limits.h>
8017 #endif
8018 #ifdef I_FLOAT
8019 #include <float.h>
8020 #endif
8021 #ifdef DBL_DIG
8022 printf("Contains DBL_DIG");
8023 #endif
8024 EOM
8025 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8026 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8027         echo "DBL_DIG found." >&4
8028         val="$define"
8029 else
8030         echo "DBL_DIG NOT found." >&4
8031         val="$undef"
8032 fi
8033 $rm -f dbl_dig.?
8034 set d_dbl_dig
8035 eval $setvar
8036
8037 : see if difftime exists
8038 set difftime d_difftime
8039 eval $inlibc
8040
8041 : see if this is a dirent system
8042 echo " "
8043 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8044         val="$define"
8045         echo "<dirent.h> found." >&4
8046 else
8047         val="$undef"
8048         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8049                 echo "<sys/dir.h> found." >&4
8050                 echo " "
8051         else
8052                 xinc=`./findhdr sys/ndir.h`
8053         fi
8054         echo "<dirent.h> NOT found." >&4
8055 fi
8056 set i_dirent
8057 eval $setvar
8058
8059 : Look for type of directory structure.
8060 echo " "
8061 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8062
8063 case "$direntrytype" in
8064 ''|' ')
8065         case "$i_dirent" in
8066         $define) guess1='struct dirent' ;;
8067         *) guess1='struct direct'  ;;
8068         esac
8069         ;;
8070 *)      guess1="$direntrytype"
8071         ;;
8072 esac
8073
8074 case "$guess1" in
8075 'struct dirent') guess2='struct direct' ;;
8076 *) guess2='struct dirent' ;;
8077 esac
8078                 
8079 if $contains "$guess1" try.c >/dev/null 2>&1; then
8080         direntrytype="$guess1"
8081         echo "Your directory entries are $direntrytype." >&4
8082 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8083         direntrytype="$guess2"
8084         echo "Your directory entries seem to be $direntrytype." >&4
8085 else
8086         echo "I don't recognize your system's directory entries." >&4
8087         rp="What type is used for directory entries on this system?"
8088         dflt="$guess1"
8089         . ./myread
8090         direntrytype="$ans"
8091 fi
8092 $rm -f try.c
8093
8094
8095 : see if the directory entry stores field length
8096 echo " "
8097 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8098 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8099         echo "Good, your directory entry keeps length information in d_namlen." >&4
8100         val="$define"
8101 else
8102         echo "Your directory entry does not know about the d_namlen field." >&4
8103         val="$undef"
8104 fi
8105 set d_dirnamlen
8106 eval $setvar
8107 $rm -f try.c
8108
8109 : see if dlerror exists
8110 xxx_runnm="$runnm"
8111 runnm=false
8112 set dlerror d_dlerror
8113 eval $inlibc
8114 runnm="$xxx_runnm"
8115
8116 : see if dlfcn is available
8117 set dlfcn.h i_dlfcn
8118 eval $inhdr
8119
8120 case "$usedl" in
8121 $define|y|true)
8122         $cat << EOM
8123
8124 On a few systems, the dynamically loaded modules that perl generates and uses
8125 will need a different extension than shared libs. The default will probably
8126 be appropriate.
8127
8128 EOM
8129         case "$dlext" in
8130         '')     dflt="$so" ;;
8131         *)      dflt="$dlext" ;;
8132         esac
8133         rp='What is the extension of dynamically loaded modules'
8134         . ./myread
8135         dlext="$ans"
8136         ;;
8137 *)
8138         dlext="none"
8139         ;;
8140 esac
8141
8142 : Check if dlsym need a leading underscore
8143 echo " "
8144 val="$undef"
8145
8146 case "$dlsrc" in
8147 dl_dlopen.xs)
8148         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8149         $cat >dyna.c <<'EOM'
8150 fred () { }
8151 EOM
8152
8153 $cat >fred.c<<EOM
8154
8155 #include <stdio.h>
8156 #$i_dlfcn I_DLFCN
8157 #ifdef I_DLFCN
8158 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8159 #else
8160 #include <sys/types.h>
8161 #include <nlist.h>
8162 #include <link.h>
8163 #endif
8164
8165 extern int fred() ;
8166
8167 int main()
8168 {
8169     void * handle ;
8170     void * symbol ;
8171 #ifndef RTLD_LAZY
8172     int mode = 1 ;
8173 #else
8174     int mode = RTLD_LAZY ;
8175 #endif
8176     handle = dlopen("./dyna.$dlext", mode) ;
8177     if (handle == NULL) {
8178         printf ("1\n") ;
8179         fflush (stdout) ;
8180         exit(0);
8181     }
8182     symbol = dlsym(handle, "fred") ;
8183     if (symbol == NULL) {
8184         /* try putting a leading underscore */
8185         symbol = dlsym(handle, "_fred") ;
8186         if (symbol == NULL) {
8187             printf ("2\n") ;
8188             fflush (stdout) ;
8189             exit(0);
8190         }
8191         printf ("3\n") ;
8192     }
8193     else
8194         printf ("4\n") ;
8195     fflush (stdout) ;
8196     exit(0);
8197 }
8198 EOM
8199         : Call the object file tmp-dyna.o in case dlext=o.
8200         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8201                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8202                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8203                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8204                 xxx=`./fred`
8205                 case $xxx in
8206                 1)      echo "Test program failed using dlopen." >&4
8207                         echo "Perhaps you should not use dynamic loading." >&4;;
8208                 2)      echo "Test program failed using dlsym." >&4
8209                         echo "Perhaps you should not use dynamic loading." >&4;;
8210                 3)      echo "dlsym needs a leading underscore" >&4
8211                         val="$define" ;;
8212                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8213                 esac
8214         else
8215                 echo "I can't compile and run the test program." >&4
8216                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8217         fi
8218         ;;
8219 esac
8220                 
8221 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8222
8223 set d_dlsymun
8224 eval $setvar
8225
8226 hasproto='varname=$1; func=$2; shift; shift;
8227 while $test $# -ge 2; do
8228         case "$1" in
8229         $define) echo "#include <$2>";;
8230         esac ;
8231     shift 2;
8232 done > try.c;
8233 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8234 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8235         echo "$func() prototype found.";
8236         val="$define";
8237 else
8238         echo "$func() prototype NOT found.";
8239         val="$undef";
8240 fi;
8241 set $varname;
8242 eval $setvar;
8243 $rm -f try.c tryout.c'
8244
8245 : see if prototype for drand48 is available
8246 echo " "
8247 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8248 eval $hasproto
8249
8250 : see if dup2 exists
8251 set dup2 d_dup2
8252 eval $inlibc
8253
8254 : see if eaccess exists
8255 set eaccess d_eaccess
8256 eval $inlibc
8257
8258 : see if endgrent exists
8259 set endgrent d_endgrent
8260 eval $inlibc
8261
8262 : see if endhostent exists
8263 set endhostent d_endhent
8264 eval $inlibc
8265
8266 : see if endnetent exists
8267 set endnetent d_endnent
8268 eval $inlibc
8269
8270 : see if endprotoent exists
8271 set endprotoent d_endpent
8272 eval $inlibc
8273
8274 : see if endpwent exists
8275 set endpwent d_endpwent
8276 eval $inlibc
8277
8278 : see if endservent exists
8279 set endservent d_endsent
8280 eval $inlibc
8281
8282 : see if endspent exists
8283 set endspent d_endspent
8284 eval $inlibc
8285
8286 : Locate the flags for 'open()'
8287 echo " "
8288 $cat >open3.c <<'EOCP'
8289 #include <sys/types.h>
8290 #ifdef I_FCNTL
8291 #include <fcntl.h>
8292 #endif
8293 #ifdef I_SYS_FILE
8294 #include <sys/file.h>
8295 #endif
8296 int main() {
8297         if(O_RDONLY);
8298 #ifdef O_TRUNC
8299         exit(0);
8300 #else
8301         exit(1);
8302 #endif
8303 }
8304 EOCP
8305 : check sys/file.h first to get FREAD on Sun
8306 if $test `./findhdr sys/file.h` && \
8307                 set open3 -DI_SYS_FILE && eval $compile; then
8308         h_sysfile=true;
8309         echo "<sys/file.h> defines the O_* constants..." >&4
8310         if ./open3; then
8311                 echo "and you have the 3 argument form of open()." >&4
8312                 val="$define"
8313         else
8314                 echo "but not the 3 argument form of open().  Oh, well." >&4
8315                 val="$undef"
8316         fi
8317 elif $test `./findhdr fcntl.h` && \
8318                 set open3 -DI_FCNTL && eval $compile; then
8319         h_fcntl=true;
8320         echo "<fcntl.h> defines the O_* constants..." >&4
8321         if ./open3; then
8322                 echo "and you have the 3 argument form of open()." >&4
8323                 val="$define"
8324         else
8325                 echo "but not the 3 argument form of open().  Oh, well." >&4
8326                 val="$undef"
8327         fi
8328 else
8329         val="$undef"
8330         echo "I can't find the O_* constant definitions!  You got problems." >&4
8331 fi
8332 set d_open3
8333 eval $setvar
8334 $rm -f open3*
8335
8336 : see which of string.h or strings.h is needed
8337 echo " "
8338 strings=`./findhdr string.h`
8339 if $test "$strings" && $test -r "$strings"; then
8340         echo "Using <string.h> instead of <strings.h>." >&4
8341         val="$define"
8342 else
8343         val="$undef"
8344         strings=`./findhdr strings.h`
8345         if $test "$strings" && $test -r "$strings"; then
8346                 echo "Using <strings.h> instead of <string.h>." >&4
8347         else
8348                 echo "No string header found -- You'll surely have problems." >&4
8349         fi
8350 fi
8351 set i_string
8352 eval $setvar
8353 case "$i_string" in
8354 "$undef") strings=`./findhdr strings.h`;;
8355 *)        strings=`./findhdr string.h`;;
8356 esac
8357
8358 : check for non-blocking I/O stuff
8359 case "$h_sysfile" in
8360 true) echo "#include <sys/file.h>" > head.c;;
8361 *)
8362         case "$h_fcntl" in
8363         true) echo "#include <fcntl.h>" > head.c;;
8364         *) echo "#include <sys/fcntl.h>" > head.c;;
8365         esac
8366         ;;
8367 esac
8368 echo " "
8369 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8370 case "$o_nonblock" in
8371 '')
8372         $cat head.c > try.c
8373         $cat >>try.c <<'EOCP'
8374 #include <stdio.h>
8375 int main() {
8376 #ifdef O_NONBLOCK
8377         printf("O_NONBLOCK\n");
8378         exit(0);
8379 #endif
8380 #ifdef O_NDELAY
8381         printf("O_NDELAY\n");
8382         exit(0);
8383 #endif
8384 #ifdef FNDELAY
8385         printf("FNDELAY\n");
8386         exit(0);
8387 #endif
8388         exit(0);
8389 }
8390 EOCP
8391         set try
8392         if eval $compile_ok; then
8393                 o_nonblock=`./try`
8394                 case "$o_nonblock" in
8395                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8396                 *) echo "Seems like we can use $o_nonblock.";;
8397                 esac
8398         else
8399                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8400         fi
8401         ;;
8402 *) echo "Using $hint value $o_nonblock.";;
8403 esac
8404 $rm -f try try.* .out core
8405
8406 echo " "
8407 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8408 case "$eagain" in
8409 '')
8410         $cat head.c > try.c
8411         $cat >>try.c <<EOCP
8412 #include <errno.h>
8413 #include <sys/types.h>
8414 #include <signal.h>
8415 #include <stdio.h> 
8416 #define MY_O_NONBLOCK $o_nonblock
8417 #ifndef errno  /* XXX need better Configure test */
8418 extern int errno;
8419 #endif
8420 #$i_unistd I_UNISTD
8421 #ifdef I_UNISTD
8422 #include <unistd.h>
8423 #endif
8424 #ifdef $i_string
8425 #include <string.h>
8426 #else
8427 #include <strings.h>
8428 #endif
8429 $signal_t blech(x) int x; { exit(3); }
8430 EOCP
8431         $cat >> try.c <<'EOCP'
8432 int main()
8433 {
8434         int pd[2];
8435         int pu[2];
8436         char buf[1];
8437         char string[100];
8438
8439         pipe(pd);       /* Down: child -> parent */
8440         pipe(pu);       /* Up: parent -> child */
8441         if (0 != fork()) {
8442                 int ret;
8443                 close(pd[1]);   /* Parent reads from pd[0] */
8444                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8445                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8446                         exit(1);
8447                 signal(SIGALRM, blech);
8448                 alarm(5);
8449                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8450                         exit(2);
8451                 sprintf(string, "%d\n", ret);
8452                 write(2, string, strlen(string));
8453                 alarm(0);
8454 #ifdef EAGAIN
8455                 if (errno == EAGAIN) {
8456                         printf("EAGAIN\n");
8457                         goto ok;
8458                 }
8459 #endif
8460 #ifdef EWOULDBLOCK
8461                 if (errno == EWOULDBLOCK)
8462                         printf("EWOULDBLOCK\n");
8463 #endif
8464         ok:
8465                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8466                 sleep(2);                               /* Give it time to close our pipe */
8467                 alarm(5);
8468                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8469                 alarm(0);
8470                 sprintf(string, "%d\n", ret);
8471                 write(3, string, strlen(string));
8472                 exit(0);
8473         }
8474
8475         close(pd[0]);                   /* We write to pd[1] */
8476         close(pu[1]);                   /* We read from pu[0] */
8477         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8478         close(pd[1]);                   /* Pipe pd is now fully closed! */
8479         exit(0);                                /* Bye bye, thank you for playing! */
8480 }
8481 EOCP
8482         set try
8483         if eval $compile_ok; then
8484                 echo "$startsh" >mtry
8485                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8486                 chmod +x mtry
8487                 ./mtry >/dev/null 2>&1
8488                 case $? in
8489                 0) eagain=`$cat try.out`;;
8490                 1) echo "Could not perform non-blocking setting!";;
8491                 2) echo "I did a successful read() for something that was not there!";;
8492                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8493                 *) echo "Something terribly wrong happened during testing.";;
8494                 esac
8495                 rd_nodata=`$cat try.ret`
8496                 echo "A read() system call with no data present returns $rd_nodata."
8497                 case "$rd_nodata" in
8498                 0|-1) ;;
8499                 *)
8500                         echo "(That's peculiar, fixing that to be -1.)"
8501                         rd_nodata=-1
8502                         ;;
8503                 esac
8504                 case "$eagain" in
8505                 '')
8506                         echo "Forcing errno EAGAIN on read() with no data available."
8507                         eagain=EAGAIN
8508                         ;;
8509                 *)
8510                         echo "Your read() sets errno to $eagain when no data is available."
8511                         ;;
8512                 esac
8513                 status=`$cat try.err`
8514                 case "$status" in
8515                 0) echo "And it correctly returns 0 to signal EOF.";;
8516                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8517                 *) echo "However, your read() returns '$status' on EOF??";;
8518                 esac
8519                 val="$define"
8520                 if test "$status" = "$rd_nodata"; then
8521                         echo "WARNING: you can't distinguish between EOF and no data!"
8522                         val="$undef"
8523                 fi
8524         else
8525                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8526                 eagain=EAGAIN
8527         fi
8528         set d_eofnblk
8529         eval $setvar
8530         ;;
8531 *)
8532         echo "Using $hint value $eagain."
8533         echo "Your read() returns $rd_nodata when no data is present."
8534         case "$d_eofnblk" in
8535         "$define") echo "And you can see EOF because read() returns 0.";;
8536         "$undef") echo "But you can't see EOF status from read() returned value.";;
8537         *)
8538                 echo "(Assuming you can't see EOF status from read anyway.)"
8539                 d_eofnblk=$undef
8540                 ;;
8541         esac
8542         ;;
8543 esac
8544 $rm -f try try.* .out core head.c mtry
8545
8546 : see if fchmod exists
8547 set fchmod d_fchmod
8548 eval $inlibc
8549
8550 : see if fchown exists
8551 set fchown d_fchown
8552 eval $inlibc
8553
8554 : see if this is an fcntl system
8555 set fcntl d_fcntl
8556 eval $inlibc
8557
8558 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8559 while $test $# -ge 2; do
8560         case "$1" in
8561         $define) echo "#include <$2>";;
8562         esac ;
8563     shift 2;
8564 done > try.c;
8565 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8566 set try;
8567 if eval $compile; then
8568         val="$define";
8569 else
8570         val="$undef";
8571 fi;
8572 set $varname;
8573 eval $setvar;
8574 $rm -f try.c try.o'
8575
8576 socketlib=''
8577 sockethdr=''
8578 : see whether socket exists
8579 echo " "
8580 $echo $n "Hmm... $c" >&4
8581 if set socket val -f d_socket; eval $csym; $val; then
8582         echo "Looks like you have Berkeley networking support." >&4
8583         d_socket="$define"
8584         if set setsockopt val -f; eval $csym; $val; then
8585                 d_oldsock="$undef"
8586         else
8587                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8588                 d_oldsock="$define"
8589         fi
8590 else
8591         if $contains socklib libc.list >/dev/null 2>&1; then
8592                 echo "Looks like you have Berkeley networking support." >&4
8593                 d_socket="$define"
8594                 : we will have to assume that it supports the 4.2 BSD interface
8595                 d_oldsock="$undef"
8596         else
8597                 echo "You don't have Berkeley networking in libc$_a..." >&4
8598                 if test "X$d_socket" = "X$define"; then
8599                    echo "...but you seem to believe that you have sockets." >&4
8600                 else
8601                         for net in net socket
8602                         do
8603                                 if test -f /usr/lib/lib$net$_a; then
8604                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8605                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8606                                         if $contains socket libc.list >/dev/null 2>&1; then
8607                                                 d_socket="$define"
8608                                                 socketlib="-l$net"
8609                                                 case "$net" in
8610                                                 net)
8611                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8612                                                         sockethdr="-I/usr/netinclude"
8613                                                         ;;
8614                                                 esac
8615                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8616                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8617                                                         d_oldsock="$undef"
8618                                                 else
8619                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8620                                                         d_oldsock="$define"
8621                                                 fi
8622                                                 break
8623                                         fi
8624                                 fi
8625                         done
8626                         if test "X$d_socket" != "X$define"; then
8627                            echo "or anywhere else I see." >&4
8628                            d_socket="$undef"
8629                            d_oldsock="$undef"
8630                         fi
8631                 fi
8632         fi
8633 fi
8634
8635 : see if socketpair exists
8636 set socketpair d_sockpair
8637 eval $inlibc
8638
8639
8640 echo " "
8641 echo "Checking the availability of certain socket constants..." >& 4
8642 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8643         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8644         $cat >try.c <<EOF
8645 #include <sys/types.h>
8646 #include <sys/socket.h>
8647 int main() {
8648     int i = $ENUM;
8649 }
8650 EOF
8651         val="$undef"
8652         set try; if eval $compile; then
8653                 val="$define"
8654         fi
8655         set d_${enum}; eval $setvar
8656         $rm -f try.c try
8657 done
8658
8659 : see if sys/select.h has to be included
8660 set sys/select.h i_sysselct
8661 eval $inhdr
8662
8663 : see if we should include time.h, sys/time.h, or both
8664 echo " "
8665 if test "X$timeincl" = X; then
8666         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8667         $echo $n "I'm now running the test program...$c"
8668         $cat >try.c <<'EOCP'
8669 #include <sys/types.h>
8670 #ifdef I_TIME
8671 #include <time.h>
8672 #endif
8673 #ifdef I_SYSTIME
8674 #ifdef SYSTIMEKERNEL
8675 #define KERNEL
8676 #endif
8677 #include <sys/time.h>
8678 #endif
8679 #ifdef I_SYSSELECT
8680 #include <sys/select.h>
8681 #endif
8682 int main()
8683 {
8684         struct tm foo;
8685 #ifdef S_TIMEVAL
8686         struct timeval bar;
8687 #endif
8688 #ifdef S_TIMEZONE
8689         struct timezone tzp;
8690 #endif
8691         if (foo.tm_sec == foo.tm_sec)
8692                 exit(0);
8693 #ifdef S_TIMEVAL
8694         if (bar.tv_sec == bar.tv_sec)
8695                 exit(0);
8696 #endif
8697         exit(1);
8698 }
8699 EOCP
8700         flags=''
8701         for s_timezone in '-DS_TIMEZONE' ''; do
8702         sysselect=''
8703         for s_timeval in '-DS_TIMEVAL' ''; do
8704         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8705         for i_time in '' '-DI_TIME'; do
8706         for i_systime in '-DI_SYSTIME' ''; do
8707                 case "$flags" in
8708                 '') $echo $n ".$c"
8709                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8710                         if eval $compile; then
8711                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8712                                 shift
8713                                 flags="$*"
8714                                 echo " "
8715                                 $echo $n "Succeeded with $flags$c"
8716                         fi
8717                         ;;
8718                 esac
8719         done
8720         done
8721         done
8722         done
8723         done
8724         timeincl=''
8725         echo " "
8726         case "$flags" in
8727         *SYSTIMEKERNEL*) i_systimek="$define"
8728                 timeincl=`./findhdr sys/time.h`
8729                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8730         *) i_systimek="$undef";;
8731         esac
8732         case "$flags" in
8733         *I_TIME*) i_time="$define"
8734                 timeincl=`./findhdr time.h`" $timeincl"
8735                 echo "We'll include <time.h>." >&4;;
8736         *) i_time="$undef";;
8737         esac
8738         case "$flags" in
8739         *I_SYSTIME*) i_systime="$define"
8740                 timeincl=`./findhdr sys/time.h`" $timeincl"
8741                 echo "We'll include <sys/time.h>." >&4;;
8742         *) i_systime="$undef";;
8743         esac
8744         $rm -f try.c try
8745 fi
8746
8747 : check for fd_set items
8748 $cat <<EOM
8749
8750 Checking to see how well your C compiler handles fd_set and friends ...
8751 EOM
8752 $cat >fd_set.c <<EOCP
8753 #$i_systime I_SYS_TIME
8754 #$i_sysselct I_SYS_SELECT
8755 #$d_socket HAS_SOCKET
8756 #include <sys/types.h>
8757 #ifdef HAS_SOCKET
8758 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8759 #endif
8760 #ifdef I_SYS_TIME
8761 #include <sys/time.h>
8762 #endif
8763 #ifdef I_SYS_SELECT
8764 #include <sys/select.h>
8765 #endif
8766 int main() {
8767         fd_set fds;
8768
8769 #ifdef TRYBITS
8770         if(fds.fds_bits);
8771 #endif
8772
8773 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8774         exit(0);
8775 #else
8776         exit(1);
8777 #endif
8778 }
8779 EOCP
8780 set fd_set -DTRYBITS
8781 if eval $compile; then
8782         d_fds_bits="$define"
8783         d_fd_set="$define"
8784         echo "Well, your system knows about the normal fd_set typedef..." >&4
8785         if ./fd_set; then
8786                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8787                 d_fd_macros="$define"
8788         else
8789                 $cat >&4 <<'EOM'
8790 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8791 EOM
8792                 d_fd_macros="$undef"
8793         fi
8794 else
8795         $cat <<'EOM'
8796 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8797 EOM
8798         set fd_set
8799         if eval $compile; then
8800                 d_fds_bits="$undef"
8801                 d_fd_set="$define"
8802                 echo "Well, your system has some sort of fd_set available..." >&4
8803                 if ./fd_set; then
8804                         echo "and you have the normal fd_set macros." >&4
8805                         d_fd_macros="$define"
8806                 else
8807                         $cat <<'EOM'
8808 but not the normal fd_set macros!  Gross!  More work for me...
8809 EOM
8810                         d_fd_macros="$undef"
8811                 fi
8812         else
8813         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8814                 d_fd_set="$undef"
8815                 d_fds_bits="$undef"
8816                 d_fd_macros="$undef"
8817         fi
8818 fi
8819 $rm -f fd_set*
8820
8821 : see if fgetpos exists
8822 set fgetpos d_fgetpos
8823 eval $inlibc
8824
8825 : see if flock exists
8826 set flock d_flock
8827 eval $inlibc
8828
8829 : see if fork exists
8830 set fork d_fork
8831 eval $inlibc
8832
8833 : see if pathconf exists
8834 set pathconf d_pathconf
8835 eval $inlibc
8836
8837 : see if fpathconf exists
8838 set fpathconf d_fpathconf
8839 eval $inlibc
8840
8841
8842 : check for off64_t
8843 echo " "
8844 echo "Checking to see if your system supports off64_t..." >&4
8845 $cat >try.c <<EOCP
8846 #include <sys/types.h>
8847 #include <unistd.h>
8848 int main() { off64_t x = 7; }'
8849 EOCP
8850 set try
8851 if eval $compile; then
8852         val="$define"
8853         echo "Yes, it does."
8854 else
8855         val="$undef"
8856         echo "No, it doesn't."
8857         case "$lseeksize" in
8858         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8859         esac
8860 fi
8861 $rm -f try.* try
8862 set d_off64_t
8863 eval $setvar
8864
8865 : check for fpos64_t
8866 echo " "
8867 echo "Checking to see if your system supports fpos64_t..." >&4
8868 $cat >try.c <<EOCP
8869 #include <sys/stdio.h>
8870 int main() { fpos64_t x x = 7; }'
8871 EOCP
8872 set try
8873 if eval $compile; then
8874         val="$define"
8875         echo "Yes, it does."
8876 else
8877         val="$undef"
8878         echo "No, it doesn't."
8879         case "$fpossize" in
8880         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8881         esac
8882 fi
8883 $rm -f try.* try
8884 set d_fpos64_t
8885 eval $setvar
8886
8887 hasstruct='varname=$1; struct=$2; shift; shift;
8888 while $test $# -ge 2; do
8889         case "$1" in
8890         $define) echo "#include <$2>";;
8891         esac ;
8892     shift 2;
8893 done > try.c;
8894 echo "int main () { struct $struct foo; }" >> try.c;
8895 set try;
8896 if eval $compile; then
8897         val="$define";
8898 else
8899         val="$undef";
8900 fi;
8901 set $varname;
8902 eval $setvar;
8903 $rm -f try.c try.o'
8904
8905 : see if this is a sys/param system
8906 set sys/param.h i_sysparam
8907 eval $inhdr
8908
8909 : see if this is a sys/mount.h system
8910 set sys/mount.h i_sysmount
8911 eval $inhdr
8912
8913 : see if sys/types.h has to be included
8914 set sys/types.h i_systypes
8915 eval $inhdr
8916
8917
8918 echo " "
8919 echo "Checking to see if your system supports struct fs_data..." >&4
8920 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8921 eval $hasstruct
8922 case "$d_fs_data_s" in
8923 "$define")      echo "Yes, it does."   ;;
8924 *)              echo "No, it doesn't." ;;
8925 esac
8926
8927 : see if fseeko exists
8928 set fseeko d_fseeko
8929 eval $inlibc
8930 case "$longsize" in
8931 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8932 esac
8933
8934 : see if fsetpos exists
8935 set fsetpos d_fsetpos
8936 eval $inlibc
8937
8938
8939 : see if fstatfs exists
8940 set fstatfs d_fstatfs
8941 eval $inlibc
8942
8943
8944 : see if statvfs exists
8945 set statvfs d_statvfs
8946 eval $inlibc
8947
8948 : see if fstatvfs exists
8949 set fstatvfs d_fstatvfs
8950 eval $inlibc
8951
8952
8953 : see if ftello exists
8954 set ftello d_ftello
8955 eval $inlibc
8956 case "$longsize" in
8957 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8958 esac
8959
8960 : see if getgrent exists
8961 set getgrent d_getgrent
8962 eval $inlibc
8963
8964 : see if gethostbyaddr exists
8965 set gethostbyaddr d_gethbyaddr
8966 eval $inlibc
8967
8968 : see if gethostbyname exists
8969 set gethostbyname d_gethbyname
8970 eval $inlibc
8971
8972 : see if gethostent exists
8973 set gethostent d_gethent
8974 eval $inlibc
8975
8976 : see how we will look up host name
8977 echo " "
8978 call=''
8979 if set gethostname val -f d_gethname; eval $csym; $val; then
8980         echo 'gethostname() found.' >&4
8981         d_gethname="$define"
8982         call=gethostname
8983 fi
8984 if set uname val -f d_uname; eval $csym; $val; then
8985         if ./xenix; then
8986                 $cat <<'EOM'
8987 uname() was found, but you're running xenix, and older versions of xenix
8988 have a broken uname(). If you don't really know whether your xenix is old
8989 enough to have a broken system call, use the default answer.
8990
8991 EOM
8992                 dflt=y
8993                 case "$d_uname" in
8994                 "$define") dflt=n;;
8995                 esac
8996                 rp='Is your uname() broken?'
8997                 . ./myread
8998                 case "$ans" in
8999                 n*) d_uname="$define"; call=uname;;
9000                 esac
9001         else
9002                 echo 'uname() found.' >&4
9003                 d_uname="$define"
9004                 case "$call" in
9005                 '') call=uname ;;
9006                 esac
9007         fi
9008 fi
9009 case "$d_gethname" in
9010 '') d_gethname="$undef";;
9011 esac
9012 case "$d_uname" in
9013 '') d_uname="$undef";;
9014 esac
9015 case "$d_uname$d_gethname" in
9016 *define*)
9017         dflt=n
9018         cat <<EOM
9019  
9020 Every now and then someone has a $call() that lies about the hostname
9021 but can't be fixed for political or economic reasons.  If you wish, I can
9022 pretend $call() isn't there and maybe compute hostname at run-time
9023 thanks to the '$phostname' command.
9024
9025 EOM
9026         rp="Shall I ignore $call() from now on?"
9027         . ./myread
9028         case "$ans" in
9029         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9030         esac;;
9031 esac
9032 case "$phostname" in
9033 '') aphostname='';;
9034 *) case "$aphostname" in
9035         /*) ;;
9036         *) set X $phostname
9037                 shift
9038                 file=$1
9039                 shift
9040                 file=`./loc $file $file $pth`
9041                 aphostname=`echo $file $*`
9042                 ;;
9043         esac
9044         ;;
9045 esac
9046 case "$d_uname$d_gethname" in
9047 *define*) ;;
9048 *)
9049         case "$phostname" in
9050         '')
9051                 echo "There will be no way for $package to get your hostname." >&4;;
9052         *)
9053         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9054                 ;;
9055         esac;;
9056 esac
9057 case "$d_phostname" in
9058 '') d_phostname="$undef";;
9059 esac
9060
9061 : see if this is a netdb.h system
9062 set netdb.h i_netdb
9063 eval $inhdr
9064
9065 : see if prototypes for various gethostxxx netdb.h functions are available
9066 echo " "
9067 set d_gethostprotos gethostent $i_netdb netdb.h
9068 eval $hasproto
9069
9070 : see if getlogin exists
9071 set getlogin d_getlogin
9072 eval $inlibc
9073
9074 : see if getmnt exists
9075 set getmnt d_getmnt
9076 eval $inlibc
9077
9078 : see if getmntent exists
9079 set getmntent d_getmntent
9080 eval $inlibc
9081
9082 : see if getnetbyaddr exists
9083 set getnetbyaddr d_getnbyaddr
9084 eval $inlibc
9085
9086 : see if getnetbyname exists
9087 set getnetbyname d_getnbyname
9088 eval $inlibc
9089
9090 : see if getnetent exists
9091 set getnetent d_getnent
9092 eval $inlibc
9093
9094 : see if prototypes for various getnetxxx netdb.h functions are available
9095 echo " "
9096 set d_getnetprotos getnetent $i_netdb netdb.h
9097 eval $hasproto
9098
9099
9100 : see if getprotobyname exists
9101 set getprotobyname d_getpbyname
9102 eval $inlibc
9103
9104 : see if getprotobynumber exists
9105 set getprotobynumber d_getpbynumber
9106 eval $inlibc
9107
9108 : see if getprotoent exists
9109 set getprotoent d_getpent
9110 eval $inlibc
9111
9112 : see if getpgid exists
9113 set getpgid d_getpgid
9114 eval $inlibc
9115
9116 : see if getpgrp2 exists
9117 set getpgrp2 d_getpgrp2
9118 eval $inlibc
9119
9120 : see if getppid exists
9121 set getppid d_getppid
9122 eval $inlibc
9123
9124 : see if getpriority exists
9125 set getpriority d_getprior
9126 eval $inlibc
9127
9128 : see if prototypes for various getprotoxxx netdb.h functions are available
9129 echo " "
9130 set d_getprotoprotos getprotoent $i_netdb netdb.h
9131 eval $hasproto
9132
9133 : see if getpwent exists
9134 set getpwent d_getpwent
9135 eval $inlibc
9136
9137
9138 : see if getservbyname exists
9139 set getservbyname d_getsbyname
9140 eval $inlibc
9141
9142 : see if getservbyport exists
9143 set getservbyport d_getsbyport
9144 eval $inlibc
9145
9146 : see if getservent exists
9147 set getservent d_getsent
9148 eval $inlibc
9149
9150 : see if prototypes for various getservxxx netdb.h functions are available
9151 echo " "
9152 set d_getservprotos getservent $i_netdb netdb.h
9153 eval $hasproto
9154
9155 : see if getspent exists
9156 set getspent d_getspent
9157 eval $inlibc
9158
9159 : see if getspnam exists
9160 set getspnam d_getspnam
9161 eval $inlibc
9162
9163 : see if gettimeofday or ftime exists
9164 set gettimeofday d_gettimeod
9165 eval $inlibc
9166 case "$d_gettimeod" in
9167 "$undef")
9168         set ftime d_ftime 
9169         eval $inlibc
9170         ;;
9171 *)
9172         val="$undef"; set d_ftime; eval $setvar
9173         ;;
9174 esac
9175 case "$d_gettimeod$d_ftime" in
9176 "$undef$undef")
9177         echo " "
9178         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9179         ;;
9180 esac
9181
9182 : see if this is an grp system
9183 set grp.h i_grp
9184 eval $inhdr
9185
9186 case "$i_grp" in
9187 $define)
9188         xxx=`./findhdr grp.h`
9189         $cppstdin $cppflags $cppminus < $xxx >$$.h
9190
9191         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9192                 val="$define"
9193         else
9194                 val="$undef"
9195         fi
9196         set d_grpasswd
9197         eval $setvar
9198
9199         $rm -f $$.h
9200         ;;
9201 *)
9202         val="$undef";
9203         set d_grpasswd; eval $setvar
9204         ;;
9205 esac
9206
9207 : see if hasmntopt exists
9208 set hasmntopt d_hasmntopt
9209 eval $inlibc
9210
9211 : see if this is a netinet/in.h or sys/in.h system
9212 set netinet/in.h i_niin sys/in.h i_sysin
9213 eval $inhdr
9214
9215 : see if arpa/inet.h has to be included
9216 set arpa/inet.h i_arpainet
9217 eval $inhdr
9218
9219 : see if htonl --and friends-- exists
9220 val=''
9221 set htonl val
9222 eval $inlibc
9223
9224 : Maybe they are macros.
9225 case "$val" in
9226 $undef)
9227         $cat >htonl.c <<EOM
9228 #include <stdio.h>
9229 #include <sys/types.h>
9230 #$i_niin I_NETINET_IN
9231 #$i_sysin I_SYS_IN
9232 #$i_arpainet I_ARPA_INET
9233 #ifdef I_NETINET_IN
9234 #include <netinet/in.h>
9235 #endif
9236 #ifdef I_SYS_IN
9237 #include <sys/in.h>
9238 #endif
9239 #ifdef I_ARPA_INET
9240 #include <arpa/inet.h>
9241 #endif
9242 #ifdef htonl
9243 printf("Defined as a macro.");
9244 #endif
9245 EOM
9246         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9247         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9248                 val="$define"
9249                 echo "But it seems to be defined as a macro." >&4
9250         fi
9251         $rm -f htonl.?
9252         ;;
9253 esac
9254 set d_htonl
9255 eval $setvar
9256
9257 : index or strchr
9258 echo " "
9259 if set index val -f; eval $csym; $val; then
9260         if set strchr val -f d_strchr; eval $csym; $val; then
9261                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9262                         val="$define"
9263                         vali="$undef"
9264                         echo "strchr() found." >&4
9265                 else
9266                         val="$undef"
9267                         vali="$define"
9268                         echo "index() found." >&4
9269                 fi
9270         else
9271                 val="$undef"
9272                 vali="$define"
9273                 echo "index() found." >&4
9274         fi
9275 else
9276         if set strchr val -f d_strchr; eval $csym; $val; then
9277                 val="$define"
9278                 vali="$undef"
9279                 echo "strchr() found." >&4
9280         else
9281                 echo "No index() or strchr() found!" >&4
9282                 val="$undef"
9283                 vali="$undef"
9284         fi
9285 fi
9286 set d_strchr; eval $setvar
9287 val="$vali"
9288 set d_index; eval $setvar
9289
9290 : check whether inet_aton exists
9291 set inet_aton d_inetaton
9292 eval $inlibc
9293
9294 : Look for isascii
9295 echo " "
9296 $cat >isascii.c <<'EOCP'
9297 #include <stdio.h>
9298 #include <ctype.h>
9299 int main() {
9300         int c = 'A';
9301         if (isascii(c))
9302                 exit(0);
9303         else
9304                 exit(1);
9305 }
9306 EOCP
9307 set isascii
9308 if eval $compile; then
9309         echo "isascii() found." >&4
9310         val="$define"
9311 else
9312         echo "isascii() NOT found." >&4
9313         val="$undef"
9314 fi
9315 set d_isascii
9316 eval $setvar
9317 $rm -f isascii*
9318
9319 : see if killpg exists
9320 set killpg d_killpg
9321 eval $inlibc
9322
9323 : see if lchown exists
9324 echo " "
9325 $cat > try.c <<'EOCP'
9326 /* System header to define __stub macros and hopefully few prototypes,
9327     which can conflict with char lchown(); below.  */
9328 #include <assert.h>
9329 /* Override any gcc2 internal prototype to avoid an error.  */
9330 /* We use char because int might match the return type of a gcc2
9331    builtin and then its argument prototype would still apply.  */
9332 char lchown();
9333 int main() {
9334     /*  The GNU C library defines this for functions which it implements
9335         to always fail with ENOSYS.  Some functions are actually named
9336         something starting with __ and the normal name is an alias.  */
9337 #if defined (__stub_lchown) || defined (__stub___lchown)
9338 choke me
9339 #else
9340 lchown();
9341 #endif
9342 ; return 0; }
9343 EOCP
9344 set try
9345 if eval $compile; then
9346     $echo "lchown() found." >&4
9347     val="$define"
9348 else
9349     $echo "lchown() NOT found." >&4
9350     val="$undef"
9351 fi
9352 set d_lchown
9353 eval $setvar
9354
9355 : See if number of significant digits in a double precision number is known
9356 echo " "
9357 $cat >ldbl_dig.c <<EOM
9358 #$i_limits I_LIMITS
9359 #$i_float I_FLOAT
9360 #ifdef I_LIMITS
9361 #include <limits.h>
9362 #endif
9363 #ifdef I_FLOAT
9364 #include <float.h>
9365 #endif
9366 #ifdef LDBL_DIG
9367 printf("Contains LDBL_DIG");
9368 #endif
9369 EOM
9370 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9371 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9372         echo "LDBL_DIG found." >&4
9373         val="$define"
9374 else
9375         echo "LDBL_DIG NOT found." >&4
9376         val="$undef"
9377 fi
9378 $rm -f ldbl_dig.?
9379 set d_ldbl_dig
9380 eval $setvar
9381
9382 : see if link exists
9383 set link d_link
9384 eval $inlibc
9385
9386 : see if localeconv exists
9387 set localeconv d_locconv
9388 eval $inlibc
9389
9390 : see if lockf exists
9391 set lockf d_lockf
9392 eval $inlibc
9393
9394 : check for long long
9395 echo " "
9396 $echo $n "Checking to see if your system supports long long..." $c >&4
9397 echo 'int main() { long long x = 7; return 0; }' > try.c
9398 set try
9399 if eval $compile; then
9400         val="$define"
9401         echo " Yes, it does." >&4
9402 else
9403         val="$undef"
9404         echo " No, it doesn't." >&4
9405 fi
9406 $rm try.*
9407 set d_longlong
9408 eval $setvar
9409
9410 : check for length of long long
9411 case "${d_longlong}${longlongsize}" in
9412 $define)
9413         echo " "
9414         $echo $n "Checking to see how big your long longs are..." $c >&4
9415         $cat >try.c <<'EOCP'
9416 #include <stdio.h>
9417 int main()
9418 {
9419     printf("%d\n", (int)sizeof(long long));
9420     return(0);
9421 }
9422 EOCP
9423         set try
9424         if eval $compile_ok; then
9425                 longlongsize=`./try$exe_ext`
9426                 $echo " $longlongsize bytes." >&4
9427         else
9428                 dflt='8'
9429                 echo " "
9430                 echo "(I can't seem to compile the test program.  Guessing...)"
9431                 rp="What is the size of a long long (in bytes)?"
9432                 . ./myread
9433                 longlongsize="$ans"
9434         fi
9435         if $test "X$longsize" = "X$longlongsize"; then
9436                 echo "(That isn't any different from an ordinary long.)"
9437         fi      
9438         ;;
9439 esac
9440 $rm -f try.* try
9441
9442 : see if lstat exists
9443 set lstat d_lstat
9444 eval $inlibc
9445
9446 : see if mblen exists
9447 set mblen d_mblen
9448 eval $inlibc
9449
9450 : see if mbstowcs exists
9451 set mbstowcs d_mbstowcs
9452 eval $inlibc
9453
9454 : see if mbtowc exists
9455 set mbtowc d_mbtowc
9456 eval $inlibc
9457
9458 : see if memchr exists
9459 set memchr d_memchr
9460 eval $inlibc
9461
9462 : see if memcmp exists
9463 set memcmp d_memcmp
9464 eval $inlibc
9465
9466 : see if memcpy exists
9467 set memcpy d_memcpy
9468 eval $inlibc
9469
9470 : see if memmove exists
9471 set memmove d_memmove
9472 eval $inlibc
9473
9474 : see if memset exists
9475 set memset d_memset
9476 eval $inlibc
9477
9478 : see if mkdir exists
9479 set mkdir d_mkdir
9480 eval $inlibc
9481
9482 : see if mkfifo exists
9483 set mkfifo d_mkfifo
9484 eval $inlibc
9485
9486 : see if mktime exists
9487 set mktime d_mktime
9488 eval $inlibc
9489
9490 : see if msgctl exists
9491 set msgctl d_msgctl
9492 eval $inlibc
9493
9494 : see if msgget exists
9495 set msgget d_msgget
9496 eval $inlibc
9497
9498 : see if msgsnd exists
9499 set msgsnd d_msgsnd
9500 eval $inlibc
9501
9502 : see if msgrcv exists
9503 set msgrcv d_msgrcv
9504 eval $inlibc
9505
9506 : see how much of the 'msg*(2)' library is present.
9507 h_msg=true
9508 echo " "
9509 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9510 *"$undef"*) h_msg=false;;
9511 esac
9512 case "$osname" in
9513 freebsd)
9514     case "`ipcs 2>&1`" in
9515     "SVID messages"*"not configured"*)
9516         echo "Your $osname does not have the msg*(2) configured." >&4
9517         h_msg=false
9518         val="$undef"
9519         set msgctl d_msgctl
9520         eval $setvar
9521         set msgget d_msgget
9522         eval $setvar
9523         set msgsnd d_msgsnd
9524         eval $setvar
9525         set msgrcv d_msgrcv
9526         eval $setvar
9527         ;;
9528     esac
9529     ;;
9530 esac
9531 : we could also check for sys/ipc.h ...
9532 if $h_msg && $test `./findhdr sys/msg.h`; then
9533         echo "You have the full msg*(2) library." >&4
9534         val="$define"
9535 else
9536         echo "You don't have the full msg*(2) library." >&4
9537         val="$undef"
9538 fi
9539 set d_msg
9540 eval $setvar
9541
9542 : see if nice exists
9543 set nice d_nice
9544 eval $inlibc
9545
9546 : see if POSIX threads are available
9547 set pthread.h i_pthread
9548 eval $inhdr
9549
9550
9551
9552
9553 : how to create joinable pthreads
9554 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9555         echo " "
9556         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9557         $cat >try.c <<'EOCP'
9558 #include <pthread.h>
9559 int main() {
9560     int detachstate = JOINABLE;
9561 }
9562 EOCP
9563         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9564         if eval $compile; then
9565                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9566                 val="$undef" # Yes, undef.
9567                 set d_old_pthread_create_joinable
9568                 eval $setvar
9569                 val=""
9570                 set old_pthread_create_joinable
9571                 eval $setvar
9572         else
9573                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9574                 if eval $compile; then
9575                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9576                         val="$define"
9577                         set d_old_pthread_create_joinable
9578                         eval $setvar
9579                         val=PTHREAD_CREATE_UNDETACHED
9580                         set old_pthread_create_joinable
9581                         eval $setvar
9582                 else            
9583                         set try -DJOINABLE=__UNDETACHED
9584                         if eval $compile; then
9585                                 echo "You seem to use __UNDETACHED." >&4
9586                                 val="$define"
9587                                 set d_old_pthread_create_joinable
9588                                 eval $setvar
9589                                 val=__UNDETACHED
9590                                 set old_pthread_create_joinable
9591                                 eval $setvar
9592                         else
9593                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9594                                 val="$define"
9595                                 set d_old_pthread_create_joinable
9596                                 eval $setvar
9597                                 val=0
9598                                 set old_pthread_create_joinable
9599                                 eval $setvar
9600                         fi
9601                 fi
9602         fi
9603         $rm -f try try.*
9604 else
9605     d_old_pthread_create_joinable="$undef"
9606     old_pthread_create_joinable=""
9607 fi
9608
9609 : see if pause exists
9610 set pause d_pause
9611 eval $inlibc
9612
9613 : see if pipe exists
9614 set pipe d_pipe
9615 eval $inlibc
9616
9617 : see if poll exists
9618 set poll d_poll
9619 eval $inlibc
9620
9621
9622 : see whether the various POSIXish _yields exist
9623 $cat >try.c <<EOP
9624 #include <pthread.h>
9625 #include <stdio.h>
9626 int main() {
9627 #ifdef SCHED_YIELD
9628         sched_yield();
9629 #else
9630 #ifdef PTHREAD_YIELD
9631         pthread_yield();
9632 #else
9633 #ifdef PTHREAD_YIELD_NULL
9634         pthread_yield(NULL);
9635 #endif
9636 #endif
9637 #endif
9638 }
9639 EOP
9640 : see if sched_yield exists
9641 set try -DSCHED_YIELD
9642 if eval $compile; then
9643     val="$define"
9644     sched_yield='sched_yield()'
9645 else
9646     val="$undef"
9647 fi
9648 case "$usethreads" in
9649 $define)
9650         case "$val" in
9651         $define) echo 'sched_yield() found.' >&4        ;;
9652         *)       echo 'sched_yield() NOT found.' >&4    ;;
9653         esac
9654 esac
9655 set d_sched_yield
9656 eval $setvar
9657
9658 : see if pthread_yield exists
9659 set try -DPTHREAD_YIELD
9660 if eval $compile; then
9661     val="$define"
9662     case "$sched_yield" in
9663     '') sched_yield='pthread_yield()' ;;
9664     esac
9665 else
9666     set try -DPTHREAD_YIELD_NULL
9667     if eval $compile; then
9668         val="$define"
9669         case "$sched_yield" in
9670         '') sched_yield='pthread_yield(NULL)' ;;
9671         esac
9672     else
9673         val="$undef"
9674     fi
9675 fi
9676 case "$usethreads" in
9677 $define)
9678         case "$val" in
9679         $define) echo 'pthread_yield() found.' >&4      ;;
9680         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9681         esac
9682         ;;
9683 esac
9684 set d_pthread_yield
9685 eval $setvar
9686
9687 case "$sched_yield" in
9688 '') sched_yield=undef ;;
9689 esac
9690
9691 $rm -f try try.*
9692
9693 : see if this is a pwd.h system
9694 set pwd.h i_pwd
9695 eval $inhdr
9696
9697 case "$i_pwd" in
9698 $define)
9699         xxx=`./findhdr pwd.h`
9700         $cppstdin $cppflags $cppminus < $xxx >$$.h
9701
9702         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9703                 val="$define"
9704         else
9705                 val="$undef"
9706         fi
9707         set d_pwquota
9708         eval $setvar
9709
9710         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9711                 val="$define"
9712         else
9713                 val="$undef"
9714         fi
9715         set d_pwage
9716         eval $setvar
9717
9718         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9719                 val="$define"
9720         else
9721                 val="$undef"
9722         fi
9723         set d_pwchange
9724         eval $setvar
9725
9726         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9727                 val="$define"
9728         else
9729                 val="$undef"
9730         fi
9731         set d_pwclass
9732         eval $setvar
9733
9734         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9735                 val="$define"
9736         else
9737                 val="$undef"
9738         fi
9739         set d_pwexpire
9740         eval $setvar
9741
9742         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9743                 val="$define"
9744         else
9745                 val="$undef"
9746         fi
9747         set d_pwcomment
9748         eval $setvar
9749
9750         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9751                 val="$define"
9752         else
9753                 val="$undef"
9754         fi
9755         set d_pwgecos
9756         eval $setvar
9757
9758         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9759                 val="$define"
9760         else
9761                 val="$undef"
9762         fi
9763         set d_pwpasswd
9764         eval $setvar
9765
9766         $rm -f $$.h
9767         ;;
9768 *)
9769         val="$undef"; 
9770         set d_pwquota; eval $setvar
9771         set d_pwage; eval $setvar
9772         set d_pwchange; eval $setvar
9773         set d_pwclass; eval $setvar
9774         set d_pwexpire; eval $setvar
9775         set d_pwcomment; eval $setvar
9776         set d_pwgecos; eval $setvar
9777         set d_pwpasswd; eval $setvar
9778         ;;
9779 esac
9780
9781 : see if inttypes.h is available
9782 : we want a real compile instead of Inhdr because some systems
9783 : have an inttypes.h which includes non-existent headers
9784 echo " "
9785 $cat >try.c <<EOCP
9786 #include <inttypes.h>
9787 int main() {
9788         static int32_t foo32 = 0x12345678;
9789 }
9790 EOCP
9791 set try
9792 if eval $compile; then
9793         echo "<inttypes.h> found." >&4
9794         val="$define"
9795 else
9796         echo "<inttypes.h> NOT found." >&4
9797         val="$undef"
9798 fi
9799 $rm -f try.c try
9800 set i_inttypes
9801 eval $setvar
9802
9803 : check for int64_t
9804 echo " "
9805 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9806 $cat >try.c <<EOCP
9807 #include <sys/types.h>
9808 #$i_inttypes I_INTTYPES
9809 #ifdef I_INTTYPES
9810 #include <inttypes.h>
9811 #endif
9812 int main() { int64_t x = 7; }
9813 EOCP
9814 set try
9815 if eval $compile; then
9816         val="$define"
9817         echo " Yes, it does." >&4
9818 else
9819         val="$undef"
9820         echo " No, it doesn't." >&4
9821 fi
9822 $rm -f try try.*
9823 set d_int64t
9824 eval $setvar
9825
9826
9827 echo " "
9828 echo "Checking which 64-bit integer type we could use..." >&4
9829
9830 case "$intsize" in
9831 8) val=int
9832    set quadtype
9833    eval $setvar
9834    val='"unsigned int"'
9835    set uquadtype
9836    eval $setvar
9837    quadkind=1
9838    ;;
9839 *) case "$longsize" in
9840    8) val=long
9841       set quadtype
9842       eval $setvar
9843       val='"unsigned long"'
9844       set uquadtype
9845       eval $setvar
9846       quadkind=2
9847       ;;
9848    *) case "$uselonglong:$d_longlong:$longlongsize" in
9849       define:define:8)
9850         val='"long long"'
9851         set quadtype
9852         eval $setvar
9853         val='"unsigned long long"'
9854         set uquadtype
9855         eval $setvar
9856         quadkind=3
9857         ;;
9858       *) case "$d_int64t" in
9859          define)
9860            val=int64_t
9861            set quadtype
9862            eval $setvar
9863            val=uint64_t
9864            set uquadtype
9865            eval $setvar
9866            quadkind=4
9867            ;;
9868          esac
9869          ;;
9870       esac
9871       ;;
9872    esac
9873    ;;
9874 esac
9875
9876 case "$quadtype" in
9877 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9878         undef:define:8)
9879            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9880         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9881         esac
9882         d_quad="$undef"
9883         ;;
9884 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9885             verb="will"
9886         else
9887             verb="could"
9888         fi
9889         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9890         d_quad="$define"
9891         ;;
9892 esac
9893
9894 : see if readdir and friends exist
9895 set readdir d_readdir
9896 eval $inlibc
9897 set seekdir d_seekdir
9898 eval $inlibc
9899 set telldir d_telldir
9900 eval $inlibc
9901 set rewinddir d_rewinddir
9902 eval $inlibc
9903
9904 : see if readlink exists
9905 set readlink d_readlink
9906 eval $inlibc
9907
9908 : see if rename exists
9909 set rename d_rename
9910 eval $inlibc
9911
9912 : see if rmdir exists
9913 set rmdir d_rmdir
9914 eval $inlibc
9915
9916 : see if memory.h is available.
9917 val=''
9918 set memory.h val
9919 eval $inhdr
9920
9921 : See if it conflicts with string.h
9922 case "$val" in
9923 $define)
9924         case "$strings" in
9925         '') ;;
9926         *)
9927                 $cppstdin $cppflags $cppminus < $strings > mem.h
9928                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9929                         echo " "
9930                         echo "We won't be including <memory.h>."
9931                         val="$undef"
9932                 fi
9933                 $rm -f mem.h
9934                 ;;
9935         esac
9936 esac
9937 set i_memory
9938 eval $setvar
9939
9940 : can bcopy handle overlapping blocks?
9941 val="$undef"
9942 case "$d_bcopy" in
9943 "$define")
9944         echo " "
9945         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9946         $cat >try.c <<EOCP
9947 #$i_memory I_MEMORY
9948 #$i_stdlib I_STDLIB
9949 #$i_string I_STRING
9950 #$i_unistd I_UNISTD
9951 EOCP
9952         $cat >>try.c <<'EOCP'
9953 #include <stdio.h>
9954 #ifdef I_MEMORY
9955 #  include <memory.h>
9956 #endif
9957 #ifdef I_STDLIB
9958 #  include <stdlib.h>
9959 #endif
9960 #ifdef I_STRING
9961 #  include <string.h>
9962 #else
9963 #  include <strings.h>
9964 #endif
9965 #ifdef I_UNISTD
9966 #  include <unistd.h>  /* Needed for NetBSD */
9967 #endif
9968 int main()
9969 {
9970 char buf[128], abc[128];
9971 char *b;
9972 int len;
9973 int off;
9974 int align;
9975
9976 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9977
9978 for (align = 7; align >= 0; align--) {
9979         for (len = 36; len; len--) {
9980                 b = buf+align;
9981                 bcopy(abc, b, len);
9982                 for (off = 1; off <= len; off++) {
9983                         bcopy(b, b+off, len);
9984                         bcopy(b+off, b, len);
9985                         if (bcmp(b, abc, len))
9986                                 exit(1);
9987                 }
9988         }
9989 }
9990 exit(0);
9991 }
9992 EOCP
9993         set try
9994         if eval $compile_ok; then
9995                 if ./try 2>/dev/null; then
9996                         echo "Yes, it can."
9997                         val="$define"
9998                 else
9999                         echo "It can't, sorry."
10000                         case "$d_memmove" in
10001                         "$define") echo "But that's Ok since you have memmove()." ;;
10002                         esac
10003                 fi
10004         else
10005                 echo "(I can't compile the test program, so we'll assume not...)"
10006                 case "$d_memmove" in
10007                 "$define") echo "But that's Ok since you have memmove()." ;;
10008                 esac
10009         fi
10010         ;;
10011 esac
10012 $rm -f try.* try core
10013 set d_safebcpy
10014 eval $setvar
10015
10016 : can memcpy handle overlapping blocks?
10017 val="$undef"
10018 case "$d_memcpy" in
10019 "$define")
10020         echo " "
10021         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10022         $cat >try.c <<EOCP
10023 #$i_memory I_MEMORY
10024 #$i_stdlib I_STDLIB
10025 #$i_string I_STRING
10026 #$i_unistd I_UNISTD
10027 EOCP
10028         $cat >>try.c <<'EOCP'
10029 #include <stdio.h>
10030 #ifdef I_MEMORY
10031 #  include <memory.h>
10032 #endif
10033 #ifdef I_STDLIB
10034 #  include <stdlib.h>
10035 #endif
10036 #ifdef I_STRING
10037 #  include <string.h>
10038 #else
10039 #  include <strings.h>
10040 #endif
10041 #ifdef I_UNISTD
10042 #  include <unistd.h>  /* Needed for NetBSD */
10043 #endif
10044 int main()
10045 {
10046 char buf[128], abc[128];
10047 char *b;
10048 int len;
10049 int off;
10050 int align;
10051
10052 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10053    try to store the string in read-only memory. */
10054 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10055
10056 for (align = 7; align >= 0; align--) {
10057         for (len = 36; len; len--) {
10058                 b = buf+align;
10059                 memcpy(b, abc, len);
10060                 for (off = 1; off <= len; off++) {
10061                         memcpy(b+off, b, len);
10062                         memcpy(b, b+off, len);
10063                         if (memcmp(b, abc, len))
10064                                 exit(1);
10065                 }
10066         }
10067 }
10068 exit(0);
10069 }
10070 EOCP
10071         set try
10072         if eval $compile_ok; then
10073                 if ./try 2>/dev/null; then
10074                         echo "Yes, it can."
10075                         val="$define"
10076                 else
10077                         echo "It can't, sorry."
10078                         case "$d_memmove" in
10079                         "$define") echo "But that's Ok since you have memmove()." ;;
10080                         esac
10081                 fi
10082         else
10083                 echo "(I can't compile the test program, so we'll assume not...)"
10084                 case "$d_memmove" in
10085                 "$define") echo "But that's Ok since you have memmove()." ;;
10086                 esac
10087         fi
10088         ;;
10089 esac
10090 $rm -f try.* try core
10091 set d_safemcpy
10092 eval $setvar
10093
10094 : can memcmp be trusted to compare relative magnitude?
10095 val="$undef"
10096 case "$d_memcmp" in
10097 "$define")
10098         echo " "
10099         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10100         $cat >try.c <<EOCP
10101 #$i_memory I_MEMORY
10102 #$i_stdlib I_STDLIB
10103 #$i_string I_STRING
10104 #$i_unistd I_UNISTD
10105 EOCP
10106         $cat >>try.c <<'EOCP'
10107 #include <stdio.h>
10108 #ifdef I_MEMORY
10109 #  include <memory.h>
10110 #endif
10111 #ifdef I_STDLIB
10112 #  include <stdlib.h>
10113 #endif
10114 #ifdef I_STRING
10115 #  include <string.h>
10116 #else
10117 #  include <strings.h>
10118 #endif
10119 #ifdef I_UNISTD
10120 #  include <unistd.h>  /* Needed for NetBSD */
10121 #endif
10122 int main()
10123 {
10124 char a = -1;
10125 char b = 0;
10126 if ((a < b) && memcmp(&a, &b, 1) < 0)
10127         exit(1);
10128 exit(0);
10129 }
10130 EOCP
10131         set try
10132         if eval $compile_ok; then
10133                 if ./try 2>/dev/null; then
10134                         echo "Yes, it can."
10135                         val="$define"
10136                 else
10137                         echo "No, it can't (it uses signed chars)."
10138                 fi
10139         else
10140                 echo "(I can't compile the test program, so we'll assume not...)"
10141         fi
10142         ;;
10143 esac
10144 $rm -f try.* try core
10145 set d_sanemcmp
10146 eval $setvar
10147
10148 : see if select exists
10149 set select d_select
10150 eval $inlibc
10151
10152 : see if semctl exists
10153 set semctl d_semctl
10154 eval $inlibc
10155
10156 : see if semget exists
10157 set semget d_semget
10158 eval $inlibc
10159
10160 : see if semop exists
10161 set semop d_semop
10162 eval $inlibc
10163
10164 : see how much of the 'sem*(2)' library is present.
10165 h_sem=true
10166 echo " "
10167 case "$d_semctl$d_semget$d_semop" in
10168 *"$undef"*) h_sem=false;;
10169 esac
10170 case "$osname" in
10171 freebsd)
10172     case "`ipcs 2>&1`" in
10173     "SVID messages"*"not configured"*)
10174         echo "Your $osname does not have the sem*(2) configured." >&4
10175         h_sem=false
10176         val="$undef"
10177         set semctl d_semctl
10178         eval $setvar
10179         set semget d_semget
10180         eval $setvar
10181         set semop d_semop
10182         eval $setvar
10183         ;;
10184     esac
10185     ;;
10186 esac
10187 : we could also check for sys/ipc.h ...
10188 if $h_sem && $test `./findhdr sys/sem.h`; then
10189         echo "You have the full sem*(2) library." >&4
10190         val="$define"
10191 else
10192         echo "You don't have the full sem*(2) library." >&4
10193         val="$undef"
10194 fi
10195 set d_sem
10196 eval $setvar
10197
10198 : see whether sys/sem.h defines union semun
10199 echo " "
10200 $cat > try.c <<'END'
10201 #include <sys/types.h>
10202 #include <sys/ipc.h>
10203 #include <sys/sem.h>
10204 int main () { union semun semun; semun.buf = 0; }
10205 END
10206 set try
10207 if eval $compile; then
10208     echo "You have union semun in <sys/sem.h>." >&4
10209     val="$define"
10210 else
10211     echo "You do not have union semun in <sys/sem.h>." >&4
10212     val="$undef"
10213 fi
10214 $rm -f try try.c try.h
10215 set d_union_semun
10216 eval $setvar
10217
10218 : see how to do semctl IPC_STAT
10219 case "$d_sem" in
10220 $define)
10221     : see whether semctl IPC_STAT can use union semun
10222     echo " "
10223     $cat > try.h <<END
10224 #ifndef S_IRUSR
10225 #   ifdef S_IREAD
10226 #       define S_IRUSR S_IREAD
10227 #       define S_IWUSR S_IWRITE
10228 #       define S_IXUSR S_IEXEC
10229 #   else
10230 #       define S_IRUSR 0400
10231 #       define S_IWUSR 0200
10232 #       define S_IXUSR 0100
10233 #   endif
10234 #   define S_IRGRP (S_IRUSR>>3)
10235 #   define S_IWGRP (S_IWUSR>>3)
10236 #   define S_IXGRP (S_IXUSR>>3)
10237 #   define S_IROTH (S_IRUSR>>6)
10238 #   define S_IWOTH (S_IWUSR>>6)
10239 #   define S_IXOTH (S_IXUSR>>6)
10240 #endif
10241 #ifndef S_IRWXU
10242 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10243 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10244 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10245 #endif
10246 END
10247
10248     $cat > try.c <<END
10249 #include <sys/types.h>
10250 #include <sys/ipc.h>
10251 #include <sys/sem.h>
10252 #include <sys/stat.h>
10253 #include <stdio.h>
10254 #include <errno.h>
10255 #include "try.h"
10256 #ifndef errno
10257 extern int errno;
10258 #endif
10259 #$d_union_semun HAS_UNION_SEMUN
10260 int main() {
10261     union semun
10262 #ifndef HAS_UNION_SEMUN
10263     {
10264         int val;
10265         struct semid_ds *buf;
10266         unsigned short *array;
10267     }
10268 #endif
10269     arg;
10270     int sem, st;
10271
10272 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10273     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10274     if (sem > -1) {
10275         struct semid_ds argbuf;
10276         arg.buf = &argbuf;
10277 #       ifdef IPC_STAT
10278         st = semctl(sem, 0, IPC_STAT, arg);
10279         if (st == 0)
10280             printf("semun\n");
10281         else
10282 #       endif /* IPC_STAT */
10283             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10284 #       ifdef IPC_RMID
10285         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10286 #       endif /* IPC_RMID */
10287             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10288     } else
10289 #endif /* IPC_PRIVATE && ... */
10290         printf("semget failed: errno = %d\n", errno);
10291   return 0;
10292 }
10293 END
10294     val="$undef"
10295     set try
10296     if eval $compile; then
10297         xxx=`./try`
10298         case "$xxx" in
10299         semun) val="$define" ;;
10300         esac
10301     fi
10302     $rm -f try try.c
10303     set d_semctl_semun
10304     eval $setvar
10305     case "$d_semctl_semun" in
10306     $define)
10307         echo "You can use union semun for semctl IPC_STAT." >&4
10308         also='also'
10309         ;;
10310     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10311         also=''
10312         ;;
10313     esac
10314
10315     : see whether semctl IPC_STAT can use struct semid_ds pointer
10316     $cat > try.c <<'END'
10317 #include <sys/types.h>
10318 #include <sys/ipc.h>
10319 #include <sys/sem.h>
10320 #include <sys/stat.h>
10321 #include "try.h"
10322 #include <stdio.h>
10323 #include <errno.h>
10324 #ifndef errno
10325 extern int errno;
10326 #endif
10327 int main() {
10328     struct semid_ds arg;
10329     int sem, st;
10330
10331 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10332     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10333     if (sem > -1) {
10334 #       ifdef IPC_STAT
10335         st = semctl(sem, 0, IPC_STAT, &arg);
10336         if (st == 0)
10337             printf("semid_ds\n");
10338         else
10339 #       endif /* IPC_STAT */
10340             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10341 #       ifdef IPC_RMID
10342         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10343 #       endif /* IPC_RMID */
10344             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10345     } else
10346 #endif /* IPC_PRIVATE && ... */
10347         printf("semget failed: errno = %d\n", errno);
10348
10349     return 0;
10350 }
10351 END
10352     val="$undef"
10353     set try
10354     if eval $compile; then
10355         xxx=`./try`
10356         case "$xxx" in
10357         semid_ds) val="$define" ;;
10358         esac
10359     fi
10360     $rm -f try try.c
10361     set d_semctl_semid_ds
10362     eval $setvar
10363     case "$d_semctl_semid_ds" in
10364     $define)
10365         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10366         ;;
10367     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10368         ;;
10369     esac
10370     $rm -f try.h
10371     ;;
10372 *)  val="$undef"
10373
10374     # We do not have the full sem*(2) library, so assume we can not
10375     # use either.
10376
10377     set d_semctl_semun
10378     eval $setvar
10379
10380     set d_semctl_semid_ds
10381     eval $setvar
10382     ;;
10383 esac
10384
10385 : see if setegid exists
10386 set setegid d_setegid
10387 eval $inlibc
10388
10389 : see if seteuid exists
10390 set seteuid d_seteuid
10391 eval $inlibc
10392
10393 : see if setgrent exists
10394 set setgrent d_setgrent
10395 eval $inlibc
10396
10397 : see if sethostent exists
10398 set sethostent d_sethent
10399 eval $inlibc
10400
10401 : see if setlinebuf exists
10402 set setlinebuf d_setlinebuf
10403 eval $inlibc
10404
10405 : see if setlocale exists
10406 set setlocale d_setlocale
10407 eval $inlibc
10408
10409 : see if setnetent exists
10410 set setnetent d_setnent
10411 eval $inlibc
10412
10413 : see if setprotoent exists
10414 set setprotoent d_setpent
10415 eval $inlibc
10416
10417 : see if setpgid exists
10418 set setpgid d_setpgid
10419 eval $inlibc
10420
10421 : see if setpgrp2 exists
10422 set setpgrp2 d_setpgrp2
10423 eval $inlibc
10424
10425 : see if setpriority exists
10426 set setpriority d_setprior
10427 eval $inlibc
10428
10429 : see if setpwent exists
10430 set setpwent d_setpwent
10431 eval $inlibc
10432
10433 : see if setregid exists
10434 set setregid d_setregid
10435 eval $inlibc
10436 set setresgid d_setresgid
10437 eval $inlibc
10438
10439 : see if setreuid exists
10440 set setreuid d_setreuid
10441 eval $inlibc
10442 set setresuid d_setresuid
10443 eval $inlibc
10444
10445 : see if setrgid exists
10446 set setrgid d_setrgid
10447 eval $inlibc
10448
10449 : see if setruid exists
10450 set setruid d_setruid
10451 eval $inlibc
10452
10453 : see if setservent exists
10454 set setservent d_setsent
10455 eval $inlibc
10456
10457 : see if setsid exists
10458 set setsid d_setsid
10459 eval $inlibc
10460
10461 : see if setspent exists
10462 set setspent d_setspent
10463 eval $inlibc
10464
10465 : see if setvbuf exists
10466 set setvbuf d_setvbuf
10467 eval $inlibc
10468
10469 : see if sfio.h is available
10470 set sfio.h i_sfio
10471 eval $inhdr
10472
10473
10474 : see if sfio library is available
10475 case "$i_sfio" in
10476 $define)
10477         val=''
10478         set sfreserve val
10479         eval $inlibc
10480         ;;
10481 *)
10482         val="$undef"
10483         ;;
10484 esac
10485 : Ok, but do we want to use it.
10486 case "$val" in
10487 $define)
10488         case "$usesfio" in
10489         true|$define|[yY]*) dflt='y';;
10490         *) dflt='n';;
10491         esac
10492         echo "$package can use the sfio library, but it is experimental."
10493         rp="You seem to have sfio available, do you want to try using it?"
10494         . ./myread
10495         case "$ans" in
10496         y|Y) ;;
10497         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10498                 val="$undef"
10499                 : Remove sfio from list of libraries to use
10500                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10501                 shift
10502                 libs="$*"
10503                 echo "libs = $libs" >&4
10504                 ;;
10505         esac
10506         ;;
10507 *)      case "$usesfio" in
10508         true|$define|[yY]*)
10509                 echo "Sorry, cannot find sfio on this machine" >&4
10510                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10511                 ;;
10512         esac
10513         ;;
10514 esac
10515 set d_sfio
10516 eval $setvar
10517 case "$d_sfio" in
10518 $define) usesfio='true';;
10519 *) usesfio='false';;
10520 esac
10521
10522 : see if shmctl exists
10523 set shmctl d_shmctl
10524 eval $inlibc
10525
10526 : see if shmget exists
10527 set shmget d_shmget
10528 eval $inlibc
10529
10530 : see if shmat exists
10531 set shmat d_shmat
10532 eval $inlibc
10533 : see what shmat returns
10534 case "$d_shmat" in
10535 "$define")
10536         $cat >shmat.c <<'END'
10537 #include <sys/shm.h>
10538 void *shmat();
10539 END
10540         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10541                 shmattype='void *'
10542         else
10543                 shmattype='char *'
10544         fi
10545         echo "and it returns ($shmattype)." >&4
10546         : see if a prototype for shmat is available
10547         xxx=`./findhdr sys/shm.h`
10548         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10549         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10550                 val="$define"
10551         else
10552                 val="$undef"
10553         fi
10554         $rm -f shmat.[co]
10555         ;;
10556 *)
10557         val="$undef"
10558         ;;
10559 esac
10560 set d_shmatprototype
10561 eval $setvar
10562
10563 : see if shmdt exists
10564 set shmdt d_shmdt
10565 eval $inlibc
10566
10567 : see how much of the 'shm*(2)' library is present.
10568 h_shm=true
10569 echo " "
10570 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10571 *"$undef"*) h_shm=false;;
10572 esac
10573 case "$osname" in
10574 freebsd)
10575     case "`ipcs 2>&1`" in
10576     "SVID shared memory"*"not configured"*)
10577         echo "Your $osname does not have the shm*(2) configured." >&4
10578         h_shm=false
10579         val="$undef"
10580         set shmctl d_shmctl
10581         evat $setvar
10582         set shmget d_shmget
10583         evat $setvar
10584         set shmat d_shmat
10585         evat $setvar
10586         set shmdt d_shmdt
10587         evat $setvar
10588         ;;
10589     esac
10590     ;;
10591 esac
10592 : we could also check for sys/ipc.h ...
10593 if $h_shm && $test `./findhdr sys/shm.h`; then
10594         echo "You have the full shm*(2) library." >&4
10595         val="$define"
10596 else
10597         echo "You don't have the full shm*(2) library." >&4
10598         val="$undef"
10599 fi
10600 set d_shm
10601 eval $setvar
10602
10603 echo " "
10604 : see if we have sigaction
10605 if set sigaction val -f d_sigaction; eval $csym; $val; then
10606         echo 'sigaction() found.' >&4
10607         $cat > try.c <<'EOP'
10608 #include <stdio.h>
10609 #include <sys/types.h>
10610 #include <signal.h>
10611 int main()
10612 {
10613     struct sigaction act, oact;
10614     act.sa_flags = 0;
10615     oact.sa_handler = 0;
10616     /* so that act and oact are used */
10617     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10618 }
10619 EOP
10620         set try
10621         if eval $compile_ok; then
10622                 val="$define"
10623         else
10624                 echo "But you don't seem to have a useable struct sigaction." >&4
10625                 val="$undef"
10626         fi
10627 else
10628         echo 'sigaction NOT found.' >&4
10629         val="$undef"
10630 fi
10631 set d_sigaction; eval $setvar
10632 $rm -f try try$_o try.c
10633
10634 : see if sigsetjmp exists
10635 echo " "
10636 case "$d_sigsetjmp" in
10637 '')
10638         $cat >try.c <<'EOP'
10639 #include <setjmp.h>
10640 sigjmp_buf env;
10641 int set = 1;
10642 int main()
10643 {
10644         if (sigsetjmp(env,1))
10645                 exit(set);
10646         set = 0;
10647         siglongjmp(env, 1);
10648         exit(1);
10649 }
10650 EOP
10651         set try
10652         if eval $compile; then
10653                 if ./try >/dev/null 2>&1; then
10654                         echo "POSIX sigsetjmp found." >&4
10655                         val="$define"
10656                 else
10657                         $cat >&4 <<EOM
10658 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10659 I'll ignore them.
10660 EOM
10661                         val="$undef"
10662                 fi
10663         else
10664                 echo "sigsetjmp not found." >&4
10665                 val="$undef"
10666         fi
10667         ;;
10668 *) val="$d_sigsetjmp"
10669         case "$d_sigsetjmp" in
10670         $define) echo "POSIX sigsetjmp found." >&4;;
10671         $undef) echo "sigsetjmp not found." >&4;;
10672         esac
10673         ;;
10674 esac
10675 set d_sigsetjmp
10676 eval $setvar
10677 $rm -f try.c try
10678
10679 : see if sqrtl exists
10680 set sqrtl d_sqrtl
10681 eval $inlibc
10682
10683 : see if sys/stat.h is available
10684 set sys/stat.h i_sysstat
10685 eval $inhdr
10686
10687
10688 : see if stat knows about block sizes
10689 echo " "
10690 echo "Checking to see if your struct stat has st_blocks field..." >&4
10691 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10692 eval $hasfield
10693
10694
10695 : see if this is a sys/vfs.h system
10696 set sys/vfs.h i_sysvfs
10697 eval $inhdr
10698
10699
10700 : see if this is a sys/statfs.h system
10701 set sys/statfs.h i_sysstatfs
10702 eval $inhdr
10703
10704
10705 echo " "
10706 echo "Checking to see if your system supports struct statfs..." >&4
10707 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
10708 eval $hasstruct
10709 case "$d_statfs_s" in
10710 "$define")      echo "Yes, it does."   ;;
10711 *)              echo "No, it doesn't." ;;
10712 esac
10713
10714
10715
10716 : see if struct statfs knows about f_flags
10717 case "$d_statfs_s" in
10718 define) 
10719         echo " "
10720         echo "Checking to see if your struct statfs has f_flags field..." >&4
10721         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
10722         eval $hasfield
10723         ;;
10724 *)      val="$undef"
10725         set d_statfs_f_flags
10726         eval $setvar
10727         ;;
10728 esac
10729 case "$d_statfs_f_flags" in
10730 "$define")      echo "Yes, it does."   ;;
10731 *)              echo "No, it doesn't." ;;
10732 esac
10733
10734 : see if _ptr and _cnt from stdio act std
10735 echo " "
10736 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10737         echo "(Looks like you have stdio.h from Linux.)"
10738         case "$stdio_ptr" in
10739         '') stdio_ptr='((fp)->_IO_read_ptr)'
10740                 ptr_lval=$define
10741                 ;;
10742         *)      ptr_lval=$d_stdio_ptr_lval;;
10743         esac
10744         case "$stdio_cnt" in
10745         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10746                 cnt_lval=$undef
10747                 ;;
10748         *)      cnt_lval=$d_stdio_cnt_lval;;
10749         esac
10750         case "$stdio_base" in
10751         '') stdio_base='((fp)->_IO_read_base)';;
10752         esac
10753         case "$stdio_bufsiz" in
10754         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10755         esac
10756 else
10757         case "$stdio_ptr" in
10758         '') stdio_ptr='((fp)->_ptr)'
10759                 ptr_lval=$define
10760                 ;;
10761         *)      ptr_lval=$d_stdio_ptr_lval;;
10762         esac
10763         case "$stdio_cnt" in
10764         '') stdio_cnt='((fp)->_cnt)'
10765                 cnt_lval=$define
10766                 ;;
10767         *)      cnt_lval=$d_stdio_cnt_lval;;
10768         esac
10769         case "$stdio_base" in
10770         '') stdio_base='((fp)->_base)';;
10771         esac
10772         case "$stdio_bufsiz" in
10773         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10774         esac
10775 fi
10776 : test whether _ptr and _cnt really work
10777 echo "Checking how std your stdio is..." >&4
10778 $cat >try.c <<EOP
10779 #include <stdio.h>
10780 #define FILE_ptr(fp)    $stdio_ptr
10781 #define FILE_cnt(fp)    $stdio_cnt
10782 int main() {
10783         FILE *fp = fopen("try.c", "r");
10784         char c = getc(fp);
10785         if (
10786                 18 <= FILE_cnt(fp) &&
10787                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10788         )
10789                 exit(0);
10790         exit(1);
10791 }
10792 EOP
10793 val="$undef"
10794 set try
10795 if eval $compile; then
10796         if ./try; then
10797                 echo "Your stdio acts pretty std."
10798                 val="$define"
10799         else
10800                 echo "Your stdio isn't very std."
10801         fi
10802 else
10803         echo "Your stdio doesn't appear very std."
10804 fi
10805 $rm -f try.c try
10806 set d_stdstdio
10807 eval $setvar
10808
10809 : Can _ptr be used as an lvalue?
10810 case "$d_stdstdio$ptr_lval" in
10811 $define$define) val=$define ;;
10812 *) val=$undef ;;
10813 esac
10814 set d_stdio_ptr_lval
10815 eval $setvar
10816
10817 : Can _cnt be used as an lvalue?
10818 case "$d_stdstdio$cnt_lval" in
10819 $define$define) val=$define ;;
10820 *) val=$undef ;;
10821 esac
10822 set d_stdio_cnt_lval
10823 eval $setvar
10824
10825 : see if _base is also standard
10826 val="$undef"
10827 case "$d_stdstdio" in
10828 $define)
10829         $cat >try.c <<EOP
10830 #include <stdio.h>
10831 #define FILE_base(fp)   $stdio_base
10832 #define FILE_bufsiz(fp) $stdio_bufsiz
10833 int main() {
10834         FILE *fp = fopen("try.c", "r");
10835         char c = getc(fp);
10836         if (
10837                 19 <= FILE_bufsiz(fp) &&
10838                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10839         )
10840                 exit(0);
10841         exit(1);
10842 }
10843 EOP
10844         set try
10845         if eval $compile; then
10846                 if ./try; then
10847                         echo "And its _base field acts std."
10848                         val="$define"
10849                 else
10850                         echo "But its _base field isn't std."
10851                 fi
10852         else
10853                 echo "However, it seems to be lacking the _base field."
10854         fi
10855         $rm -f try.c try
10856         ;;
10857 esac
10858 set d_stdiobase
10859 eval $setvar
10860
10861 $cat >&4 <<EOM
10862 Checking how to access stdio streams by file descriptor number...
10863 EOM
10864 case "$stdio_stream_array" in
10865 '')     $cat >try.c <<EOCP
10866 #include <stdio.h>
10867 int main() {
10868   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10869     printf("yes\n");
10870 }
10871 EOCP
10872         for s in _iob __iob __sF
10873         do
10874                 set try -DSTDIO_STREAM_ARRAY=$s
10875                 if eval $compile; then
10876                         case "`./try$exe_ext`" in
10877                         yes)    stdio_stream_array=$s; break ;;
10878                         esac
10879                 fi
10880         done
10881         $rm -f try.* try$exe_ext
10882 esac
10883 case "$stdio_stream_array" in
10884 '')     $cat >&4 <<EOM
10885 I can't figure out how to access stdio streams by file descriptor number.
10886 EOM
10887         d_stdio_stream_array="$undef"
10888         ;;
10889 *)      $cat >&4 <<EOM
10890 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10891 EOM
10892         d_stdio_stream_array="$define"
10893         ;;
10894 esac
10895
10896 : see if strcoll exists
10897 set strcoll d_strcoll
10898 eval $inlibc
10899
10900 : check for structure copying
10901 echo " "
10902 echo "Checking to see if your C compiler can copy structs..." >&4
10903 $cat >try.c <<'EOCP'
10904 int main()
10905 {
10906         struct blurfl {
10907                 int dyick;
10908         } foo, bar;
10909
10910         foo = bar;
10911 }
10912 EOCP
10913 if $cc -c try.c >/dev/null 2>&1 ; then
10914         val="$define"
10915         echo "Yup, it can."
10916 else
10917         val="$undef"
10918         echo "Nope, it can't."
10919 fi
10920 set d_strctcpy
10921 eval $setvar
10922 $rm -f try.*
10923
10924 : see if strerror and/or sys_errlist[] exist
10925 echo " "
10926 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10927     if set strerror val -f d_strerror; eval $csym; $val; then
10928                 echo 'strerror() found.' >&4
10929                 d_strerror="$define"
10930                 d_strerrm='strerror(e)'
10931                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10932                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10933                         d_syserrlst="$define"
10934                 else
10935                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10936                         d_syserrlst="$undef"
10937                 fi
10938     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10939                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10940                 echo 'strerror() found in string header.' >&4
10941                 d_strerror="$define"
10942                 d_strerrm='strerror(e)'
10943                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10944                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10945                                 d_syserrlst="$define"
10946                 else
10947                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10948                         d_syserrlst="$undef"
10949                 fi
10950     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10951                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10952                 d_strerror="$undef"
10953                 d_syserrlst="$define"
10954                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10955     else
10956                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10957                 d_strerror="$undef"
10958                 d_syserrlst="$undef"
10959                 d_strerrm='"unknown"'
10960     fi
10961 fi
10962
10963 : see if strtod exists
10964 set strtod d_strtod
10965 eval $inlibc
10966
10967 : see if strtol exists
10968 set strtol d_strtol
10969 eval $inlibc
10970
10971 : see if strtold exists
10972 set strtold d_strtold
10973 eval $inlibc
10974
10975 : see if strtoll exists
10976 set strtoll d_strtoll
10977 eval $inlibc
10978
10979 : see if strtoul exists
10980 set strtoul d_strtoul
10981 eval $inlibc
10982
10983 : see if strtoull exists
10984 set strtoull d_strtoull
10985 eval $inlibc
10986
10987 : see if strtouq exists
10988 set strtouq d_strtouq
10989 eval $inlibc
10990
10991 : see if strxfrm exists
10992 set strxfrm d_strxfrm
10993 eval $inlibc
10994
10995 : see if symlink exists
10996 set symlink d_symlink
10997 eval $inlibc
10998
10999 : see if syscall exists
11000 set syscall d_syscall
11001 eval $inlibc
11002
11003 : see if sysconf exists
11004 set sysconf d_sysconf
11005 eval $inlibc
11006
11007 : see if system exists
11008 set system d_system
11009 eval $inlibc
11010
11011 : see if tcgetpgrp exists
11012 set tcgetpgrp d_tcgetpgrp
11013 eval $inlibc
11014
11015 : see if tcsetpgrp exists
11016 set tcsetpgrp d_tcsetpgrp
11017 eval $inlibc
11018
11019 : see if prototype for telldir is available
11020 echo " "
11021 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11022 eval $hasproto
11023
11024 : see if this is a sys/times.h system
11025 set sys/times.h i_systimes
11026 eval $inhdr
11027
11028 : see if times exists
11029 echo " "
11030 if set times val -f d_times; eval $csym; $val; then
11031         echo 'times() found.' >&4
11032         d_times="$define"
11033         inc=''
11034         case "$i_systimes" in
11035         "$define") inc='sys/times.h';;
11036         esac
11037         rp="What is the type returned by times() on this system?"
11038         set clock_t clocktype long stdio.h sys/types.h $inc
11039         eval $typedef_ask
11040 else
11041         echo 'times() NOT found, hope that will do.' >&4
11042         d_times="$undef"
11043         clocktype='int'
11044 fi
11045
11046 : see if truncate exists
11047 set truncate d_truncate
11048 eval $inlibc
11049
11050 : see if tzname[] exists
11051 echo " "
11052 if set tzname val -a d_tzname; eval $csym; $val; then
11053         val="$define"
11054         echo 'tzname[] found.' >&4
11055 else
11056         val="$undef"
11057         echo 'tzname[] NOT found.' >&4
11058 fi
11059 set d_tzname
11060 eval $setvar
11061
11062 : see if umask exists
11063 set umask d_umask
11064 eval $inlibc
11065
11066 : see if ustat exists
11067 set ustat d_ustat
11068 eval $inlibc
11069
11070 : backward compatibility for d_hvfork
11071 if test X$d_hvfork != X; then
11072         d_vfork="$d_hvfork"
11073         d_hvfork=''
11074 fi
11075 : see if there is a vfork
11076 val=''
11077 set vfork val
11078 eval $inlibc
11079
11080 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11081 : perl on Solaris 2.x, and probably elsewhere.
11082 case "$val" in
11083 $define)
11084         echo " "
11085         case "$usevfork" in
11086         false) dflt='n';;
11087         *) dflt='y';;
11088         esac
11089         cat <<'EOM'
11090  
11091 Perl can only use a vfork() that doesn't suffer from strict
11092 restrictions on calling functions or modifying global data in
11093 the child.  For example, glibc-2.1 contains such a vfork()
11094 that is unsuitable.  If your system provides a proper fork()
11095 call, chances are that you do NOT want perl to use vfork().
11096
11097 EOM
11098         rp="Do you still want to use vfork()?"
11099         . ./myread
11100         case "$ans" in
11101         y|Y) ;;
11102         *)
11103                 echo "Ok, we won't use vfork()."
11104                 val="$undef"
11105                 ;;
11106         esac
11107         ;;
11108 esac
11109 set d_vfork
11110 eval $setvar
11111 case "$d_vfork" in
11112 $define) usevfork='true';;
11113 *) usevfork='false';;
11114 esac
11115
11116 : see if this is an sysdir system
11117 set sys/dir.h i_sysdir
11118 eval $inhdr
11119
11120 : see if this is an sysndir system
11121 set sys/ndir.h i_sysndir
11122 eval $inhdr
11123
11124 : see if closedir exists
11125 set closedir d_closedir
11126 eval $inlibc
11127
11128 case "$d_closedir" in
11129 "$define")
11130         echo " "
11131         echo "Checking whether closedir() returns a status..." >&4
11132         cat > closedir.c <<EOM
11133 #$i_dirent I_DIRENT             /**/
11134 #$i_sysdir I_SYS_DIR            /**/
11135 #$i_sysndir I_SYS_NDIR          /**/
11136 #$i_systypes I_SYS_TYPES        /**/
11137
11138 #if defined(I_SYS_TYPES)
11139 #include <sys/types.h>
11140 #endif
11141 #if defined(I_DIRENT)
11142 #include <dirent.h>
11143 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11144 #include <sys/dir.h>
11145 #endif
11146 #else
11147 #ifdef I_SYS_NDIR
11148 #include <sys/ndir.h>
11149 #else
11150 #ifdef I_SYS_DIR
11151 #ifdef hp9000s500
11152 #include <ndir.h>       /* may be wrong in the future */
11153 #else
11154 #include <sys/dir.h>
11155 #endif
11156 #endif
11157 #endif
11158 #endif 
11159 int main() { return closedir(opendir(".")); }
11160 EOM
11161         set closedir
11162         if eval $compile_ok; then
11163                 if ./closedir > /dev/null 2>&1 ; then
11164                         echo "Yes, it does."
11165                         val="$undef"
11166                 else
11167                         echo "No, it doesn't."
11168                         val="$define"
11169                 fi
11170         else
11171                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11172                 val="$define"
11173         fi
11174         ;;
11175 *)
11176         val="$undef";
11177         ;;
11178 esac
11179 set d_void_closedir
11180 eval $setvar
11181 $rm -f closedir*
11182 : check for volatile keyword
11183 echo " "
11184 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11185 $cat >try.c <<'EOCP'
11186 int main()
11187 {
11188         typedef struct _goo_struct goo_struct;
11189         goo_struct * volatile goo = ((goo_struct *)0);
11190         struct _goo_struct {
11191                 long long_int;
11192                 int reg_int;
11193                 char char_var;
11194         };
11195         typedef unsigned short foo_t;
11196         char *volatile foo;
11197         volatile int bar;
11198         volatile foo_t blech;
11199         foo = foo;
11200 }
11201 EOCP
11202 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11203         val="$define"
11204         echo "Yup, it does."
11205 else
11206         val="$undef"
11207         echo "Nope, it doesn't."
11208 fi
11209 set d_volatile
11210 eval $setvar
11211 $rm -f try.*
11212
11213 : see if there is a wait4
11214 set wait4 d_wait4
11215 eval $inlibc
11216
11217 : see if waitpid exists
11218 set waitpid d_waitpid
11219 eval $inlibc
11220
11221 : see if wcstombs exists
11222 set wcstombs d_wcstombs
11223 eval $inlibc
11224
11225 : see if wctomb exists
11226 set wctomb d_wctomb
11227 eval $inlibc
11228
11229 : preserve RCS keywords in files with variable substitution, grrr
11230 Date='$Date'
11231 Id='$Id'
11232 Log='$Log'
11233 RCSfile='$RCSfile'
11234 Revision='$Revision'
11235
11236 case "$crosscompile" in
11237 ''|[nN]*) crosscompile="$undef" ;;
11238 esac
11239
11240 case "$osname" in
11241 next|rhapsody) multiarch="$define" ;;
11242 esac
11243 case "$multiarch" in
11244 ''|[nN]*) multiarch="$undef" ;;
11245 esac
11246
11247 : check for alignment requirements
11248 echo " "
11249 case "$crosscompile$multiarch" in
11250 *$define*)
11251         $cat <<EOM
11252 You seem to be either cross-compiling or doing a multiarchitecture build,
11253 skipping the memory alignment check.
11254
11255 EOM
11256         case "$alignbytes" in
11257         '') alignbytes=8 ;;
11258         esac
11259         ;;
11260 *)
11261         case "$alignbytes" in
11262         '') echo "Checking alignment constraints..." >&4
11263                 $cat >try.c <<'EOCP'
11264 #include <stdio.h>
11265 struct foobar {
11266         char foo;
11267         double bar;
11268 } try_algn;
11269 int main()
11270 {
11271     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11272     return(0);
11273 }
11274 EOCP
11275                 set try
11276                 if eval $compile_ok; then
11277                         dflt=`./try`
11278                 else
11279                         dflt='8'
11280                         echo "(I can't seem to compile the test program...)"
11281                 fi
11282                 ;;
11283         *) dflt="$alignbytes"
11284                 ;;
11285         esac
11286         rp="Doubles must be aligned on a how-many-byte boundary?"
11287         . ./myread
11288         alignbytes="$ans"
11289         $rm -f try.c try
11290         ;;
11291 esac
11292
11293
11294 : check for ordering of bytes in a long
11295 echo " "
11296 case "$crosscompile$multiarch" in
11297 *$define*)
11298         $cat <<EOM
11299 You seem to be either cross-compiling or doing a multiarchitecture build,
11300 skipping the byteorder check.
11301
11302 EOM
11303         byteorder='0xffff'
11304         ;;
11305 *)
11306         case "$byteorder" in
11307         '')
11308                 $cat <<'EOM'
11309 In the following, larger digits indicate more significance.  A big-endian
11310 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11311 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11312 machines may have weird orders like 3412.  A Cray will report 87654321,
11313 an Alpha will report 12345678. If the test program works the default is
11314 probably right.
11315 I'm now running the test program...
11316 EOM
11317                 $cat >try.c <<'EOCP'
11318 #include <stdio.h>
11319 int main()
11320 {
11321         int i;
11322         union {
11323                 unsigned long l;
11324                 char c[sizeof(long)];
11325         } u;
11326
11327         if (sizeof(long) > 4)
11328                 u.l = (0x08070605L << 32) | 0x04030201L;
11329         else
11330                 u.l = 0x04030201L;
11331         for (i = 0; i < sizeof(long); i++)
11332                 printf("%c", u.c[i]+'0');
11333         printf("\n");
11334         exit(0);
11335 }
11336 EOCP
11337                 xxx_prompt=y
11338                 set try
11339                 if eval $compile && ./try > /dev/null; then
11340                         dflt=`./try`
11341                         case "$dflt" in
11342                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11343                                 echo "(The test program ran ok.)"
11344                                 echo "byteorder=$dflt"
11345                                 xxx_prompt=n
11346                         ;;
11347                         ????|????????) echo "(The test program ran ok.)" ;;
11348                         *) echo "(The test program didn't run right for some reason.)" ;;
11349                         esac
11350                 else
11351                         dflt='4321'
11352                         cat <<'EOM'
11353 (I can't seem to compile the test program.  Guessing big-endian...)
11354 EOM
11355                 fi
11356                 case "$xxx_prompt" in
11357                 y)
11358                         rp="What is the order of bytes in a long?"
11359                         . ./myread
11360                         byteorder="$ans"
11361                         ;;
11362                 *)      byteorder=$dflt
11363                         ;;
11364                 esac
11365                 ;;
11366         esac
11367         $rm -f try.c try
11368         ;;
11369 esac
11370
11371
11372 : how do we catenate cpp tokens here?
11373 echo " "
11374 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11375 $cat >cpp_stuff.c <<'EOCP'
11376 #define RCAT(a,b)a/**/b
11377 #define ACAT(a,b)a ## b
11378 RCAT(Rei,ser)
11379 ACAT(Cir,cus)
11380 EOCP
11381 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11382 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11383         echo "Oh!  Smells like ANSI's been here." >&4
11384         echo "We can catify or stringify, separately or together!"
11385         cpp_stuff=42
11386 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11387         echo "Ah, yes!  The good old days!" >&4
11388         echo "However, in the good old days we don't know how to stringify and"
11389         echo "catify at the same time."
11390         cpp_stuff=1
11391 else
11392         $cat >&4 <<EOM
11393 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11394 to have to edit the values of CAT[2-5] in config.h...
11395 EOM
11396         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11397 fi
11398 $rm -f cpp_stuff.*
11399
11400 : see if this is a db.h system
11401 set db.h i_db
11402 eval $inhdr
11403
11404 case "$i_db" in
11405 $define)
11406         : Check db version.
11407         echo " "
11408         echo "Checking Berkeley DB version ..." >&4
11409         $cat >try.c <<EOCP
11410 #$d_const HASCONST
11411 #ifndef HASCONST
11412 #define const
11413 #endif
11414 #include <sys/types.h>
11415 #include <stdio.h>
11416 #include <db.h>
11417 int main()
11418 {
11419 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11420     int Major, Minor, Patch ;
11421     unsigned long Version ;
11422     (void)db_version(&Major, &Minor, &Patch) ;
11423     printf("You have Berkeley DB Version 2 or greater\n");
11424
11425     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11426                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11427     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11428                 Major, Minor, Patch) ;
11429
11430     /* check that db.h & libdb are compatible */
11431     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11432         printf("db.h and libdb are incompatible\n") ;
11433         exit(3);        
11434     }
11435
11436     printf("db.h and libdb are compatible\n") ;
11437
11438     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11439                 + DB_VERSION_PATCH ;
11440
11441     /* needs to be >= 2.3.4 */
11442     if (Version < 2003004) {
11443     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11444         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11445         exit(2);        
11446     }
11447
11448     exit(0);
11449 #else
11450 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11451     printf("You have Berkeley DB Version 1\n");
11452     exit(0);    /* DB version < 2: the coast is clear. */
11453 #else
11454     exit(1);    /* <db.h> not Berkeley DB? */
11455 #endif
11456 #endif
11457 }
11458 EOCP
11459         set try
11460         if eval $compile_ok && ./try; then
11461                 echo 'Looks OK.' >&4
11462         else
11463                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11464                 i_db=$undef
11465                 case " $libs " in
11466                 *"-ldb "*)
11467                         : Remove db from list of libraries to use
11468                         echo "Removing unusable -ldb from library list" >&4
11469                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11470                         shift
11471                         libs="$*"
11472                         echo "libs = $libs" >&4
11473                         ;;
11474                 esac
11475         fi
11476         $rm -f try.*
11477         ;;
11478 esac
11479
11480 case "$i_db" in
11481 define)
11482         : Check the return type needed for hash 
11483         echo " "
11484         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11485         $cat >try.c <<EOCP
11486 #$d_const HASCONST
11487 #ifndef HASCONST
11488 #define const
11489 #endif
11490 #include <sys/types.h>
11491 #include <db.h>
11492
11493 #ifndef DB_VERSION_MAJOR
11494 u_int32_t hash_cb (ptr, size)
11495 const void *ptr;
11496 size_t size;
11497 {
11498 }
11499 HASHINFO info;
11500 int main()
11501 {
11502         info.hash = hash_cb;
11503 }
11504 #endif
11505 EOCP
11506         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11507                 if $contains warning try.out >>/dev/null 2>&1 ; then
11508                         db_hashtype='int'
11509                 else
11510                         db_hashtype='u_int32_t'
11511                 fi
11512         else
11513                 : XXX Maybe we should just give up here.
11514                 db_hashtype=u_int32_t
11515                 $cat try.out >&4
11516                 echo "Help:  I can't seem to compile the db test program." >&4
11517                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11518         fi
11519         $rm -f try.*
11520         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11521         ;;
11522 *)      db_hashtype=u_int32_t
11523         ;;
11524 esac
11525 case "$i_db" in
11526 define)
11527         : Check the return type needed for prefix 
11528         echo " "
11529         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11530         cat >try.c <<EOCP
11531 #$d_const HASCONST
11532 #ifndef HASCONST
11533 #define const
11534 #endif
11535 #include <sys/types.h>
11536 #include <db.h>
11537
11538 #ifndef DB_VERSION_MAJOR
11539 size_t prefix_cb (key1, key2)
11540 const DBT *key1;
11541 const DBT *key2;
11542 {
11543 }
11544 BTREEINFO info;
11545 int main()
11546 {
11547         info.prefix = prefix_cb;
11548 }
11549 #endif
11550 EOCP
11551         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11552                 if $contains warning try.out >>/dev/null 2>&1 ; then
11553                         db_prefixtype='int'
11554                 else
11555                         db_prefixtype='size_t'
11556                 fi
11557         else
11558                 db_prefixtype='size_t'
11559                 : XXX Maybe we should just give up here.
11560                 $cat try.out >&4
11561                 echo "Help:  I can't seem to compile the db test program." >&4
11562                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11563         fi
11564         $rm -f try.*
11565         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11566         ;;
11567 *)      db_prefixtype='size_t'
11568         ;;
11569 esac
11570
11571 : check for void type
11572 echo " "
11573 echo "Checking to see how well your C compiler groks the void type..." >&4
11574 case "$voidflags" in
11575 '')
11576         $cat >try.c <<'EOCP'
11577 #if TRY & 1
11578 void sub() {
11579 #else
11580 sub() {
11581 #endif
11582         extern void moo();      /* function returning void */
11583         void (*goo)();          /* ptr to func returning void */
11584 #if TRY & 8
11585         void *hue;              /* generic ptr */
11586 #endif
11587 #if TRY & 2
11588         void (*foo[10])();
11589 #endif
11590
11591 #if TRY & 4
11592         if(goo == moo) {
11593                 exit(0);
11594         }
11595 #endif
11596         exit(0);
11597 }
11598 int main() { sub(); }
11599 EOCP
11600         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11601                 voidflags=$defvoidused
11602         echo "Good.  It appears to support void to the level $package wants.">&4
11603                 if $contains warning .out >/dev/null 2>&1; then
11604                         echo "However, you might get some warnings that look like this:"
11605                         $cat .out
11606                 fi
11607         else
11608 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11609                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11610                         echo "It supports 1..."
11611                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11612                                 echo "It also supports 2..."
11613                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11614                                         voidflags=7
11615                                         echo "And it supports 4 but not 8 definitely."
11616                                 else
11617                                         echo "It doesn't support 4..."
11618                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11619                                                 voidflags=11
11620                                                 echo "But it supports 8."
11621                                         else
11622                                                 voidflags=3
11623                                                 echo "Neither does it support 8."
11624                                         fi
11625                                 fi
11626                         else
11627                                 echo "It does not support 2..."
11628                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11629                                         voidflags=13
11630                                         echo "But it supports 4 and 8."
11631                                 else
11632                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11633                                                 voidflags=5
11634                                                 echo "And it supports 4 but has not heard about 8."
11635                                         else
11636                                                 echo "However it supports 8 but not 4."
11637                                         fi
11638                                 fi
11639                         fi
11640                 else
11641                         echo "There is no support at all for void."
11642                         voidflags=0
11643                 fi
11644         fi
11645 esac
11646 case "$voidflags" in
11647 "$defvoidused") ;;
11648 *)      $cat >&4 <<'EOM'
11649   Support flag bits are:
11650     1: basic void declarations.
11651     2: arrays of pointers to functions returning void.
11652     4: operations between pointers to and addresses of void functions.
11653     8: generic void pointers.
11654 EOM
11655         dflt="$voidflags";
11656         rp="Your void support flags add up to what?"
11657         . ./myread
11658         voidflags="$ans"
11659         ;;
11660 esac
11661 $rm -f try.* .out
11662
11663
11664 : How can we generate normalized random numbers ?
11665 echo " "
11666 echo "Looking for a random number function..." >&4
11667 case "$randfunc" in
11668 '')
11669         if set drand48 val -f; eval $csym; $val; then
11670                 dflt="drand48"
11671                 echo "Good, found drand48()." >&4
11672         elif set random val -f; eval $csym; $val; then
11673                 dflt="random"
11674                 echo "OK, found random()." >&4
11675         else
11676                 dflt="rand"
11677                 echo "Yick, looks like I have to use rand()." >&4
11678         fi
11679         echo " "
11680         ;;
11681 *)
11682         dflt="$randfunc"
11683         ;;
11684 esac
11685 cont=true
11686
11687 case "$ccflags" in
11688 *-Dmy_rand=*|*-Dmy_srand=*)
11689         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11690         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11691         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11692         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11693         ;;
11694 esac
11695
11696 while $test "$cont"; do
11697         rp="Use which function to generate random numbers?"
11698         . ./myread
11699         if $test "$ans" = "$dflt"; then
11700                 : null
11701         else
11702                 randbits=''
11703         fi
11704         randfunc="$ans"
11705         if set $ans val -f; eval $csym; $val; then
11706                 cont=''
11707         else
11708                 dflt=y
11709                 rp="I cannot find function $ans. Use that name anyway?"
11710                 . ./myread
11711                 dflt=rand
11712                 case "$ans" in
11713                         [yY]*) cont='';;
11714                 esac
11715         fi
11716         case "$cont" in
11717         '')
11718                 case "$randfunc" in
11719                 drand48)
11720                         drand01="drand48()"
11721                         seedfunc="srand48"
11722                         randbits=48
11723                         randseedtype=long
11724                         ;;
11725                 rand|random)
11726                         case "$randbits" in
11727                         '')
11728 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11729                                 $cat >try.c <<EOCP
11730 #$i_unistd I_UNISTD
11731 #$i_stdlib I_STDLIB
11732 #include <stdio.h>
11733 #ifdef I_UNISTD
11734 #  include <unistd.h>
11735 #endif
11736 #ifdef I_STDLIB
11737 #  include <stdlib.h>
11738 #endif
11739 int main()
11740 {
11741         register int i;
11742         register unsigned long tmp;
11743         register unsigned long max = 0L;
11744
11745         for (i = 1000; i; i--) {
11746                 tmp = (unsigned long) $randfunc();
11747                 if (tmp > max) max = tmp;
11748         }
11749         for (i = 0; max; i++)
11750                 max /= 2;
11751         printf("%d\n",i);
11752 }
11753 EOCP
11754                                 set try
11755                                 if eval $compile_ok; then
11756                                         dflt=`try`
11757                                 else
11758                                         dflt='?'
11759                                         echo "(I can't seem to compile the test program...)"
11760                                 fi
11761                                 ;;
11762                         *)
11763                                 dflt="$randbits"
11764                                 ;;
11765                         esac
11766                         rp="How many bits does your $randfunc() function produce?"
11767                         . ./myread
11768                         randbits="$ans"
11769                         $rm -f try.c try
11770                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11771                         seedfunc="s$randfunc"
11772                         randseedtype=unsigned
11773                         ;;
11774                 *)
11775                         dflt="31"
11776                         rp="How many bits does your $randfunc() function produce?"
11777                         . ./myread
11778                         randbits="$ans"
11779                         seedfunc="s$randfunc"
11780                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11781                         if set $seedfunc val -f; eval $csym; $val; then
11782                                 echo "(Using $seedfunc() to seed random generator)"
11783                         else
11784                                 echo "(Warning: no $seedfunc() to seed random generator)"
11785                                 seedfunc=rand
11786                         fi
11787                         randseedtype=unsigned
11788                         ;;
11789                 esac
11790                 ;;
11791         esac
11792 done
11793
11794 echo " "
11795 echo "Determining whether or not we are on an EBCDIC system..." >&4
11796 $cat >tebcdic.c <<'EOM'
11797 int main()
11798 {
11799   if ('M'==0xd4) return 0;
11800   return 1;
11801 }
11802 EOM
11803
11804 val=$undef
11805 set tebcdic
11806 if eval $compile_ok; then
11807         if ./tebcdic; then
11808                 echo "You have EBCDIC." >&4
11809                 val="$define"
11810         else
11811                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11812         fi
11813 else
11814         echo "I'm unable to compile the test program." >&4
11815         echo "I'll assume ASCII or some ISO Latin." >&4
11816 fi
11817 $rm -f tebcdic.c tebcdic
11818 set ebcdic
11819 eval $setvar
11820
11821 echo " "
11822 $cat >&4 <<EOM
11823 Checking how to flush all pending stdio output...
11824 EOM
11825 # I only know how to find the first 32 possibly open files on SunOS.
11826 # See also hints/sunos_4_1.sh and util.c  --AD
11827 case "$osname" in
11828 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11829 esac
11830 $cat >>try.c <<EOCP
11831 #include <stdio.h>
11832 #$i_unistd I_UNISTD
11833 #ifdef I_UNISTD
11834 # include <unistd.h>
11835 #endif
11836 #$d_sysconf HAS_SYSCONF
11837 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11838 #ifdef HAS_STDIO_STREAM_ARRAY
11839 # define STDIO_STREAM_ARRAY $stdio_stream_array
11840 #endif
11841 int main() {
11842   FILE* p = fopen("try.out", "w");
11843 #ifdef TRY_FPUTC
11844   fputc('x', p);
11845 #else
11846 # ifdef TRY_FPRINTF
11847   fprintf(p, "x");
11848 # endif
11849 #endif
11850 #ifdef TRY_FFLUSH_NULL
11851   fflush(NULL);
11852 #endif
11853 #ifdef TRY_FFLUSH_ALL
11854   {
11855     long open_max = -1;
11856 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11857     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11858 # else
11859 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11860     open_max = sysconf(_SC_OPEN_MAX);
11861 #  else
11862 #   ifdef FOPEN_MAX
11863     open_max = FOPEN_MAX;
11864 #   else
11865 #    ifdef OPEN_MAX
11866     open_max = OPEN_MAX;
11867 #    else
11868 #     ifdef _NFILE
11869     open_max = _NFILE;
11870 #     endif
11871 #    endif
11872 #   endif
11873 #  endif
11874 # endif 
11875 # ifdef HAS_STDIO_STREAM_ARRAY
11876     if (open_max > 0) {
11877       long i;
11878       for (i = 0; i < open_max; i++)
11879             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11880                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11881                 STDIO_STREAM_ARRAY[i]._flag)
11882                 fflush(&STDIO_STREAM_ARRAY[i]);
11883     }   
11884   }
11885 # endif
11886 #endif
11887   _exit(42);
11888 }
11889 EOCP
11890 : first we have to find out how _not_ to flush
11891 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11892     output=''
11893     set try -DTRY_FPUTC
11894     if eval $compile; then
11895             $rm -f try.out
11896             ./try$exe_ext 2>/dev/null
11897             if $test ! -s try.out -a "X$?" = X42; then
11898                 output=-DTRY_FPUTC
11899             fi
11900     fi
11901     case "$output" in
11902     '')
11903             set try -DTRY_FPRINTF
11904             $rm -f try.out
11905             if eval $compile; then
11906                     $rm -f try.out
11907                     ./try$exe_ext 2>/dev/null
11908                     if $test ! -s try.out -a "X$?" = X42; then
11909                         output=-DTRY_FPRINTF
11910                     fi
11911             fi
11912         ;;
11913     esac
11914 fi
11915 : check for fflush NULL behaviour
11916 case "$fflushNULL" in
11917 '')     set try -DTRY_FFLUSH_NULL $output
11918         if eval $compile; then
11919                 $rm -f try.out
11920                 ./try$exe_ext 2>/dev/null
11921                 code="$?"
11922                 if $test -s try.out -a "X$code" = X42; then
11923                         fflushNULL="`$cat try.out`"
11924                 else
11925                         if $test "X$code" != X42; then
11926                                 $cat >&4 <<EOM
11927 (If this test failed, don't worry, we'll try another method shortly.)
11928 EOM
11929                         fi
11930                 fi
11931         fi
11932         $rm -f core try.core core.try.*
11933         case "$fflushNULL" in
11934         x)      $cat >&4 <<EOM
11935 Your fflush(NULL) works okay.
11936 EOM
11937                 fflushNULL="$define"
11938                 ;;
11939         '')     $cat >&4 <<EOM
11940 Your fflush(NULL) isn't working (contrary to ANSI C).
11941 EOM
11942                 fflushNULL="$undef"
11943                 ;;
11944         *)      $cat >&4 <<EOM
11945 Cannot figure out whether your fflush(NULL) works or not.
11946 I'm assuming it doesn't (contrary to ANSI C).
11947 EOM
11948                 fflushNULL="$undef"
11949                 ;;
11950         esac
11951         ;;
11952 $define|true|[yY]*)
11953         fflushNULL="$define"
11954         ;;
11955 *)
11956         fflushNULL="$undef"
11957         ;;
11958 esac
11959 : check explicit looping only if NULL did not work
11960 case "$fflushNULL" in
11961 "$undef")
11962         : check for fflush all behaviour
11963         case "$fflushall" in
11964         '')     set try -DTRY_FFLUSH_ALL $output
11965                 if eval $compile; then
11966                         $cat >&4 <<EOM
11967 (Now testing the other method--but note that also this may fail.)
11968 EOM
11969                         $rm -f try.out
11970                         ./try$exe_ext 2>/dev/null
11971                         if $test -s try.out -a "X$?" = X42; then
11972                                 fflushall="`$cat try.out`"
11973                         fi
11974                 fi
11975                 $rm -f core try.core core.try.*
11976                 case "$fflushall" in
11977                 x)      $cat >&4 <<EOM
11978 Whew. Flushing explicitly all the stdio streams works.
11979 EOM
11980                         fflushall="$define"
11981                         ;;
11982                 '')     $cat >&4 <<EOM
11983 Sigh. Flushing explicitly all the stdio streams doesn't work.
11984 EOM
11985                         fflushall="$undef"
11986                         ;;
11987                 *)      $cat >&4 <<EOM
11988 Cannot figure out whether flushing stdio streams explicitly works or not.
11989 I'm assuming it doesn't.
11990 EOM
11991                         fflushall="$undef"
11992                         ;;
11993                 esac
11994                 ;;
11995         "$define"|true|[yY]*)
11996                 fflushall="$define"
11997                 ;;
11998         *)
11999                 fflushall="$undef"
12000                 ;;
12001         esac
12002         ;;
12003 *)      fflushall="$undef"      
12004         ;;
12005 esac
12006 case "$fflushNULL$fflushall" in
12007 undefundef)
12008         $cat <<EOM
12009 I cannot figure out how to flush pending stdio output.
12010 EOM
12011         ;;
12012 esac
12013 $rm -f try.* try$exe_ext
12014
12015 : Store the full pathname to the ar program for use in the C program
12016 : Respect a hint or command line value for full_ar.
12017 case "$full_ar" in
12018 '') full_ar=$ar ;;
12019 esac
12020
12021 : Store the full pathname to the sed program for use in the C program
12022 full_sed=$sed
12023
12024 : see what type gids are declared as in the kernel
12025 echo " "
12026 echo "Looking for the type for group ids returned by getgid()."
12027 set gid_t gidtype xxx stdio.h sys/types.h
12028 eval $typedef
12029 case "$gidtype" in
12030 xxx)
12031         xxx=`./findhdr sys/user.h`
12032         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12033         case $1 in
12034         unsigned) dflt="$1 $2" ;;
12035         *) dflt="$1" ;;
12036         esac
12037         ;;
12038 *) dflt="$gidtype";;
12039 esac
12040 case "$gidtype" in
12041 gid_t) echo "gid_t found." ;;
12042 *)      rp="What is the type for group ids returned by getgid()?"
12043         . ./myread
12044         gidtype="$ans"
12045         ;;
12046 esac
12047
12048 echo " "
12049 case "$gidtype" in
12050 *_t) zzz="$gidtype"     ;;
12051 *)   zzz="gid"          ;;
12052 esac
12053 echo "Checking the size of $zzz..." >&4 
12054 cat > try.c <<EOCP
12055 #include <sys/types.h>
12056 #include <stdio.h>
12057 int main() {
12058     printf("%d\n", (int)sizeof($gidtype));
12059     exit(0);
12060 }
12061 EOCP
12062 set try
12063 if eval $compile_ok; then
12064         yyy=`./try`
12065         case "$yyy" in
12066         '')     gidsize=4
12067                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12068                 ;;
12069         *)      gidsize=$yyy
12070                 echo "Your $zzz size is $gidsize bytes."
12071                 ;;
12072         esac
12073 else
12074         gidsize=4
12075         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12076 fi
12077
12078
12079 echo " "
12080 case "$gidtype" in
12081 *_t) zzz="$gidtype"     ;;
12082 *)   zzz="gid"          ;;
12083 esac
12084 echo "Checking the sign of $zzz..." >&4 
12085 cat > try.c <<EOCP
12086 #include <sys/types.h>
12087 #include <stdio.h>
12088 int main() {
12089         $gidtype foo = -1;
12090         if (foo < 0)
12091                 printf("-1\n");
12092         else
12093                 printf("1\n");
12094 }
12095 EOCP
12096 set try
12097 if eval $compile; then
12098         yyy=`./try`
12099         case "$yyy" in
12100         '')     gidsign=1
12101                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12102                 ;;
12103         *)      gidsign=$yyy
12104                 case "$gidsign" in
12105                  1) echo "Your $zzz is unsigned." ;;
12106                 -1) echo "Your $zzz is signed."   ;;
12107                 esac
12108                 ;;
12109         esac
12110 else
12111         gidsign=1
12112         echo "(I can't compile the test program--guessing unsigned.)" >&4
12113 fi
12114
12115
12116 : check for length of character
12117 echo " "
12118 case "$charsize" in
12119 '')
12120         echo "Checking to see how big your characters are (hey, you never know)..." >&4
12121         $cat >try.c <<'EOCP'
12122 #include <stdio.h>
12123 int main()
12124 {
12125     printf("%d\n", (int)sizeof(char));
12126     exit(0);
12127 }
12128 EOCP
12129         set try
12130         if eval $compile_ok; then
12131                 dflt=`./try`
12132         else
12133                 dflt='1'
12134                 echo "(I can't seem to compile the test program.  Guessing...)"
12135         fi
12136         ;;
12137 *)
12138         dflt="$charsize"
12139         ;;
12140 esac
12141 rp="What is the size of a character (in bytes)?"
12142 . ./myread
12143 charsize="$ans"
12144 $rm -f try.c try
12145
12146
12147 echo " "
12148 $echo "Choosing the C types to be used for Perl's internal types..." >&4
12149
12150 case "$use64bits:$d_quad:$quadtype" in
12151 define:define:?*)
12152         ivtype="$quadtype"
12153         uvtype="$uquadtype"
12154         ivsize=8
12155         uvsize=8
12156         ;;
12157 *)      ivtype="long"
12158         uvtype="unsigned long"
12159         ivsize=$longsize
12160         uvsize=$longsize
12161         ;;
12162 esac
12163
12164 case "$uselongdouble:$d_longdbl" in
12165 define:define)
12166         nvtype="long double"
12167         nvsize=$longdblsize
12168         ;;
12169 *)      nvtype=double
12170         nvsize=$doublesize
12171         ;;
12172 esac
12173
12174 echo "(IV will be "$ivtype", $ivsize bytes)"
12175 echo "(UV will be "$uvtype", $uvsize bytes)"
12176 echo "(NV will be "$nvtype", $nvsize bytes)"
12177
12178 $cat >try.c <<EOCP
12179 #$i_inttypes I_INTTYPES
12180 #ifdef I_INTTYPES
12181 #include <inttypes.h>
12182 #endif
12183 #include <stdio.h>
12184 int main() {
12185 #ifdef INT8
12186    int8_t i =  INT8_MAX;
12187   uint8_t u = UINT8_MAX;
12188   printf("int8_t\n");
12189 #endif
12190 #ifdef INT16
12191    int16_t i =  INT16_MAX;
12192   uint16_t i = UINT16_MAX;
12193   printf("int16_t\n");
12194 #endif
12195 #ifdef INT32
12196    int32_t i =  INT32_MAX;
12197   uint32_t u = UINT32_MAX;
12198   printf("int32_t\n");
12199 #endif
12200 }
12201 EOCP
12202
12203 case "$i8type" in
12204 '')     case "$charsize" in
12205         1)      i8type=char
12206                 u8type="unsigned char"
12207                 i8size=$charsize
12208                 u8size=$charsize
12209                 ;;
12210         esac
12211         ;;
12212 esac
12213 case "$i8type" in
12214 '')     set try -DINT8
12215         if eval $compile; then
12216                 case "`./try$exe_ext`" in
12217                 int8_t) i8type=int8_t
12218                         u8type=uint8_t
12219                         i8size=1
12220                         u8size=1
12221                         ;;
12222                 esac
12223         fi
12224         ;;
12225 esac
12226 case "$i8type" in
12227 '')     if $test $charsize -ge 1; then
12228                 i8type=char
12229                 u8type="unsigned char"
12230                 i8size=$charsize
12231                 u8size=$charsize
12232         fi
12233         ;;
12234 esac
12235
12236 case "$i16type" in
12237 '')     case "$shortsize" in
12238         2)      i16type=short
12239                 u16type="unsigned short"
12240                 i16size=$shortsize
12241                 u16size=$shortsize
12242                 ;;
12243         esac
12244         ;;
12245 esac
12246 case "$i16type" in
12247 '')     set try -DINT16
12248         if eval $compile; then
12249                 case "`./try$exe_ext`" in
12250                 int16_t)
12251                         i16type=int16_t
12252                         u16type=uint16_t
12253                         i16size=2
12254                         u16size=2
12255                         ;;
12256                 esac
12257         fi
12258         ;;
12259 esac
12260 case "$i16type" in
12261 '')     if $test $shortsize -ge 2; then
12262                 i16type=short
12263                 u16type="unsigned short"
12264                 i16size=$shortsize
12265                 u16size=$shortsize
12266         fi
12267         ;;
12268 esac
12269
12270 case "$i32type" in
12271 '')     case "$longsize" in
12272         4)      i32type=long
12273                 u32type="unsigned long"
12274                 i32size=$longsize
12275                 u32size=$longsize
12276                 ;;
12277         *)      case "$intsize" in
12278                 4)      i32type=int
12279                         u32type="unsigned int"
12280                         i32size=$intsize
12281                         u32size=$intsize
12282                         ;;
12283                 esac
12284                 ;;
12285         esac
12286         ;;
12287 esac
12288 case "$i32type" in
12289 '')     set try -DINT32
12290         if eval $compile; then
12291                 case "`./try$exe_ext`" in
12292                 int32_t)
12293                         i32type=int32_t
12294                         u32type=uint32_t
12295                         i32size=4
12296                         u32size=4
12297                         ;;
12298                 esac
12299         fi
12300         ;;
12301 esac
12302 case "$i32type" in
12303 '')     if $test $intsize -ge 4; then
12304                 i32type=int
12305                 u32type="unsigned int"
12306                 i32size=$intsize
12307                 u32size=$intsize
12308         fi
12309         ;;
12310 esac
12311
12312 case "$i64type" in
12313 '')     case "$d_quad:$quadtype" in
12314         define:?*)
12315                 i64type="$quadtype"
12316                 u64type="$uquadtype"
12317                 i64size=8
12318                 u64size=8
12319                 ;;
12320         esac
12321         ;;
12322 esac
12323
12324 $rm -f try.* try
12325
12326 echo " "
12327
12328 if $test X"$quadtype" != X; then
12329
12330 echo "Checking how to print 64-bit integers..." >&4
12331
12332 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12333         $cat >try.c <<'EOCP'
12334 #include <sys/types.h>
12335 #include <stdio.h>
12336 int main() {
12337   int q = 12345678901;
12338   printf("%ld\n", q);
12339 }
12340 EOCP
12341         set try
12342         if eval $compile; then
12343                 yyy=`./try$exe_ext`
12344                 case "$yyy" in
12345                 12345678901)
12346                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12347                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12348                         echo "We will use %d."
12349                         ;;
12350                 esac
12351         fi
12352 fi
12353
12354 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12355         $cat >try.c <<'EOCP'
12356 #include <sys/types.h>
12357 #include <stdio.h>
12358 int main() {
12359   long q = 12345678901;
12360   printf("%ld\n", q);
12361 }
12362 EOCP
12363         set try
12364         if eval $compile; then
12365                 yyy=`./try$exe_ext`
12366                 case "$yyy" in
12367                 12345678901)
12368                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12369                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12370                         echo "We will use %ld."
12371                         ;;
12372                 esac
12373         fi
12374 fi
12375
12376 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12377         $cat >try.c <<'EOCP'
12378 #include <sys/types.h>
12379 #include <inttypes.h>
12380 #include <stdio.h>
12381 int main() {
12382   int64_t q = 12345678901;
12383   printf("%" PRId64 "\n", q);
12384 }
12385 EOCP
12386         set try
12387         if eval $compile; then
12388                 yyy=`./try$exe_ext`
12389                 case "$yyy" in
12390                 12345678901)
12391                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12392                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12393                         echo "We will use the C9X style."
12394                         ;;
12395                 esac
12396         fi
12397 fi
12398
12399 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12400         $cat >try.c <<'EOCP'
12401 #include <sys/types.h>
12402 #include <stdio.h>
12403 int main() {
12404   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12405   printf("%lld\n", q);
12406 }
12407 EOCP
12408         set try
12409         if eval $compile; then
12410                 yyy=`./try$exe_ext`
12411                 case "$yyy" in
12412                 12345678901)
12413                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12414                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12415                         echo "We will use the %lld style."
12416                         ;;
12417                 esac
12418         fi
12419 fi
12420
12421 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12422         $cat >try.c <<EOCP
12423 #include <sys/types.h>
12424 #include <stdio.h>
12425 int main() {
12426   $quadtype q = 12345678901;
12427   printf("%Ld\n", q);
12428 }
12429 EOCP
12430         set try
12431         if eval $compile; then
12432                 yyy=`./try$exe_ext`
12433                 case "$yyy" in
12434                 12345678901)
12435                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12436                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12437                         echo "We will use %Ld."
12438                         ;;
12439                 esac
12440         fi
12441 fi
12442
12443 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12444         $cat >try.c <<EOCP
12445 #include <sys/types.h>
12446 #include <stdio.h>
12447 int main() {
12448   $quadtype q = 12345678901;
12449   printf("%qd\n", q);
12450 }
12451 EOCP
12452         set try
12453         if eval $compile; then
12454                 yyy=`./try$exe_ext`
12455                 case "$yyy" in
12456                 12345678901)
12457                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12458                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12459                         echo "We will use %qd."
12460                         ;;
12461                 esac
12462         fi
12463 fi
12464
12465 if $test X"$sPRId64" = X; then
12466         echo "Cannot figure out how to print 64-bit integers." >&4
12467 fi
12468
12469 $rm -f try try.*
12470
12471 fi
12472
12473 case "$sPRId64" in
12474 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12475         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12476         ;;
12477 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12478         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12479         ;;
12480 esac
12481
12482
12483 echo " "
12484 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12485
12486 if $test X"$ivsize" = X8; then
12487         ivdformat="$sPRId64"
12488         uvuformat="$sPRIu64"
12489         uvoformat="$sPRIo64"
12490         uvxformat="$sPRIx64"
12491 else
12492         if $test X"$ivsize" = X"$longsize"; then
12493                 ivdformat='"ld"'
12494                 uvuformat='"lu"'
12495                 uvoformat='"lo"'
12496                 uvxformat='"lx"'
12497         else
12498                 if $test X"$ivsize" = X"$intsize"; then
12499                         ivdformat='"d"'
12500                         uvuformat='"u"'
12501                         uvoformat='"o"'
12502                         uvxformat='"x"'
12503                 else
12504                         : far out
12505                         if $test X"$ivsize" = X"$shortsize"; then
12506                                 ivdformat='"hd"'
12507                                 uvuformat='"hu"'
12508                                 uvoformat='"ho"'
12509                                 uvxformat='"hx"'
12510                         fi
12511                 fi
12512         fi
12513 fi
12514
12515 case "$ivdformat" in
12516 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12517     exit 1
12518     ;;
12519 esac
12520
12521
12522 echo " "
12523 $echo "Checking the format string to be used for gids..." >&4
12524
12525 case "$gidsign" in
12526 -1)     if $test X"$gidsize" = X"$ivsize"; then
12527                 gidformat="$ivdformat"
12528         else
12529                 if $test X"$gidsize" = X"$longsize"; then
12530                         gidformat='"ld"'
12531                 else
12532                         if $test X"$gidsize" = X"$intsize"; then
12533                                 gidformat='"d"'
12534                         else
12535                                 if $test X"$gidsize" = X"$shortsize"; then
12536                                         gidformat='"hd"'
12537                                 fi
12538                         fi
12539                 fi
12540         fi
12541         ;;
12542 *)      if $test X"$gidsize" = X"$uvsize"; then
12543                 gidformat="$uvuformat"
12544         else
12545                 if $test X"$gidsize" = X"$longsize"; then
12546                         gidformat='"lu"'
12547                 else
12548                         if $test X"$gidsize" = X"$intsize"; then
12549                                 gidformat='"u"'
12550                         else
12551                                 if $test X"$gidsize" = X"$shortsize"; then
12552                                         gidformat='"hu"'
12553                                 fi
12554                         fi
12555                 fi
12556         fi
12557         ;;
12558 esac
12559
12560 : see if getgroups exists
12561 set getgroups d_getgrps
12562 eval $inlibc
12563
12564 : see if setgroups exists
12565 set setgroups d_setgrps
12566 eval $inlibc
12567
12568
12569 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12570 echo " "
12571 case "$d_getgrps$d_setgrps" in
12572 *define*)
12573         case "$groupstype" in
12574         '') dflt="$gidtype" ;;
12575         *)  dflt="$groupstype" ;;
12576         esac
12577         $cat <<EOM
12578 What type of pointer is the second argument to getgroups() and setgroups()?
12579 Usually this is the same as group ids, $gidtype, but not always.
12580
12581 EOM
12582         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12583         . ./myread
12584         groupstype="$ans"
12585         ;;
12586 *)  groupstype="$gidtype";;
12587 esac
12588
12589 echo " "
12590 echo "Checking if your $make program sets \$(MAKE)..." >&4
12591 case "$make_set_make" in
12592 '')
12593         $sed 's/^X //' > testmake.mak << 'EOF'
12594 Xall:
12595 X       @echo 'maketemp="$(MAKE)"'
12596 EOF
12597         case "`$make -f testmake.mak 2>/dev/null`" in
12598         *maketemp=*) make_set_make='#' ;;
12599         *)      make_set_make="MAKE=$make" ;;
12600         esac
12601         $rm -f testmake.mak
12602         ;;
12603 esac
12604 case "$make_set_make" in
12605 '#') echo "Yup, it does.";;
12606 *) echo "Nope, it doesn't.";;
12607 esac
12608
12609 : see what type is used for mode_t
12610 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12611 set mode_t modetype int stdio.h sys/types.h
12612 eval $typedef_ask
12613
12614 : define a fucntion to check prototypes
12615 $cat > protochk <<EOSH
12616 $startsh
12617 cc="$cc"
12618 optimize="$optimize"
12619 ccflags="$ccflags"
12620 prototype="$prototype"
12621 define="$define"
12622 rm=$rm
12623 EOSH
12624
12625 $cat >> protochk <<'EOSH'
12626
12627 $rm -f try.c
12628 foo="$1"
12629 shift
12630 while test $# -ge 2; do
12631         case "$1" in
12632                 $define) echo "#include <$2>" >> try.c ;;
12633                 literal) echo "$2" >> try.c ;;
12634         esac
12635     shift 2
12636 done
12637 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12638 cat >> try.c <<'EOCP'
12639 #ifdef CAN_PROTOTYPE
12640 #define _(args) args
12641 #else
12642 #define _(args) ()
12643 #endif
12644 EOCP
12645 echo "$foo" >> try.c
12646 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12647 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12648 status=$?
12649 $rm -f try.[co]
12650 exit $status
12651 EOSH
12652 chmod +x protochk
12653 $eunicefix protochk
12654
12655 : see what type is used for size_t
12656 rp="What is the type used for the length parameter for string functions?"
12657 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12658 eval $typedef_ask
12659
12660 : check for type of arguments to gethostbyaddr. 
12661 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12662         case "$d_gethbyaddr" in
12663         $define)
12664                 $cat <<EOM
12665
12666 Checking to see what type of arguments are accepted by gethostbyaddr().
12667 EOM
12668                 hdrs="$define sys/types.h
12669                         $d_socket sys/socket.h 
12670                         $i_niin netinet/in.h 
12671                         $i_netdb netdb.h
12672                         $i_unistd unistd.h"
12673                 : The first arg can 'char *' or 'void *'
12674                 : The second arg is some of integral type
12675                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12676                         for yyy in size_t long int; do
12677                                 case "$netdb_host_type" in
12678                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12679                                         if ./protochk "$try" $hdrs; then
12680                                                 echo "Your system accepts $xxx for the first arg."
12681                                                 echo "...and $yyy for the second arg."
12682                                                 netdb_host_type="$xxx"
12683                                                 netdb_hlen_type="$yyy"
12684                                         fi
12685                                         ;;
12686                                 esac
12687                         done
12688                 done
12689                 : In case none of those worked, prompt the user.
12690                 case "$netdb_host_type" in
12691                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12692                         dflt='char *'
12693                         . ./myread
12694                         netdb_host_type=$ans
12695                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12696                         dflt="$sizetype"
12697                         . ./myread
12698                         netdb_hlen_type=$ans
12699                         ;;
12700                 esac
12701                 ;;
12702         *)      : no gethostbyaddr, so pick harmless defaults
12703                 netdb_host_type='char *'
12704                 netdb_hlen_type="$sizetype"
12705                 ;;
12706         esac
12707         # Remove the "const" if needed. -- but then we'll have a 
12708         # prototype clash!
12709         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12710 fi
12711
12712 : check for type of argument to gethostbyname. 
12713 if test "X$netdb_name_type" = X ; then
12714         case "$d_gethbyname" in
12715         $define)
12716                 $cat <<EOM
12717
12718 Checking to see what type of argument is accepted by gethostbyname().
12719 EOM
12720                 hdrs="$define sys/types.h
12721                         $d_socket sys/socket.h 
12722                         $i_niin netinet/in.h 
12723                         $i_netdb netdb.h
12724                         $i_unistd unistd.h"
12725                 for xxx in "const char *" "char *"; do
12726                         case "$netdb_name_type" in
12727                         '')     try="extern struct hostent *gethostbyname($xxx);"
12728                                 if ./protochk "$try" $hdrs; then
12729                                         echo "Your system accepts $xxx."
12730                                         netdb_name_type="$xxx"
12731                                 fi
12732                                 ;;
12733                         esac
12734                 done
12735                 : In case none of those worked, prompt the user.
12736                 case "$netdb_name_type" in
12737                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12738                         dflt='char *'
12739                         . ./myread
12740                         netdb_name_type=$ans
12741                         ;;
12742                 esac
12743                 ;;
12744         *)      : no gethostbyname, so pick harmless default
12745                 netdb_name_type='char *'
12746                 ;;
12747         esac
12748 fi
12749
12750 : check for type of 1st argument to getnetbyaddr. 
12751 if test "X$netdb_net_type" = X ; then
12752         case "$d_getnbyaddr" in
12753         $define)
12754                 $cat <<EOM
12755
12756 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12757 EOM
12758                 hdrs="$define sys/types.h
12759                         $d_socket sys/socket.h 
12760                         $i_niin netinet/in.h 
12761                         $i_netdb netdb.h
12762                         $i_unistd unistd.h"
12763                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12764                         case "$netdb_net_type" in
12765                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12766                                 if ./protochk "$try" $hdrs; then
12767                                         echo "Your system accepts $xxx."
12768                                         netdb_net_type="$xxx"
12769                                 fi
12770                                 ;;
12771                         esac
12772                 done
12773                 : In case none of those worked, prompt the user.
12774                 case "$netdb_net_type" in
12775                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12776                         dflt='long'
12777                         . ./myread
12778                         netdb_net_type=$ans
12779                         ;;
12780                 esac
12781                 ;;
12782         *)      : no getnetbyaddr, so pick harmless default
12783                 netdb_net_type='long'
12784                 ;;
12785         esac
12786 fi
12787 : locate the preferred pager for this system
12788 case "$pager" in
12789 '')
12790         dflt=''
12791         case "$pg" in
12792         /*) dflt=$pg;;
12793         esac
12794         case "$more" in
12795         /*) dflt=$more;;
12796         esac
12797         case "$less" in
12798         /*) dflt=$less;;
12799         esac
12800         case "$dflt" in
12801         '') dflt=/usr/ucb/more;;
12802         esac
12803         ;;
12804 *) dflt="$pager";;
12805 esac
12806 echo " "
12807 fn=f/
12808 rp='What pager is used on your system?'
12809 . ./getfile
12810 pager="$ans"
12811
12812 : see what type pids are declared as in the kernel
12813 rp="What is the type of process ids on this system?"
12814 set pid_t pidtype int stdio.h sys/types.h
12815 eval $typedef_ask
12816
12817 : check for length of pointer
12818 echo " "
12819 case "$ptrsize" in
12820 '')
12821         $echo $n "Checking to see how big your pointers are...$c" >&4
12822         if test "$voidflags" -gt 7; then
12823                 echo '#define VOID_PTR char *' > try.c
12824         else
12825                 echo '#define VOID_PTR void *' > try.c
12826         fi
12827         $cat >>try.c <<'EOCP'
12828 #include <stdio.h>
12829 int main()
12830 {
12831     printf("%d\n", (int)sizeof(VOID_PTR));
12832     exit(0);
12833 }
12834 EOCP
12835         set try
12836         if eval $compile_ok; then
12837                 ptrsize=`./try`
12838                 $echo " $ptrsize bytes." >&4
12839         else
12840                 dflt='4'
12841                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12842                 rp="What is the size of a pointer (in bytes)?"
12843                 . ./myread
12844                 ptrsize="$ans"
12845         fi
12846         ;;
12847 esac
12848 $rm -f try.c try
12849
12850 : see if ar generates random libraries by itself
12851 echo " "
12852 echo "Checking how to generate random libraries on your machine..." >&4
12853 echo 'int bar1() { return bar2(); }' > bar1.c
12854 echo 'int bar2() { return 2; }' > bar2.c
12855 $cat > foo.c <<'EOP'
12856 int main() { printf("%d\n", bar1()); exit(0); }
12857 EOP
12858 $cc $ccflags -c bar1.c >/dev/null 2>&1
12859 $cc $ccflags -c bar2.c >/dev/null 2>&1
12860 $cc $ccflags -c foo.c >/dev/null 2>&1
12861 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12862 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12863         ./foobar >/dev/null 2>&1; then
12864         echo "$ar appears to generate random libraries itself."
12865         orderlib=false
12866         ranlib=":"
12867 elif $ar ts bar$_a >/dev/null 2>&1 &&
12868         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12869         ./foobar >/dev/null 2>&1; then
12870                 echo "a table of contents needs to be added with '$ar ts'."
12871                 orderlib=false
12872                 ranlib="$ar ts"
12873 else
12874         case "$ranlib" in
12875         :) ranlib='';;
12876         '')
12877                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12878                 $test -f $ranlib || ranlib=''
12879                 ;;
12880         esac
12881         if $test -n "$ranlib"; then
12882                 echo "your system has '$ranlib'; we'll use that."
12883                 orderlib=false
12884         else
12885                 echo "your system doesn't seem to support random libraries"
12886                 echo "so we'll use lorder and tsort to order the libraries."
12887                 orderlib=true
12888                 ranlib=":"
12889         fi
12890 fi
12891 $rm -f foo* bar* 
12892
12893 : check for type of arguments to select. 
12894 case "$selecttype" in
12895 '') case "$d_select" in
12896         $define)
12897                 $cat <<EOM
12898 Checking to see what type of arguments are accepted by select().
12899 EOM
12900                 hdrs="$define sys/types.h
12901                         $i_systime sys/time.h 
12902                         $i_sysselct sys/select.h
12903                         $d_socket sys/socket.h"
12904                 : The first arg can be int, unsigned, or size_t
12905                 : The last arg may or may not be 'const'
12906                 val=''
12907                 : void pointer has been seen but using that
12908                 : breaks the selectminbits test
12909                 for xxx in 'fd_set *' 'int *'; do
12910                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12911                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12912                                         case "$val" in
12913                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12914                                                 if ./protochk "$try" $hdrs; then
12915                                                         echo "Your system accepts $xxx."
12916                                                         val="$xxx"
12917                                                 fi
12918                                                 ;;
12919                                         esac
12920                                 done
12921                         done
12922                 done
12923                 case "$val" in
12924                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12925                         case "$d_fd_set" in
12926                                 $define) dflt="fd_set *" ;;
12927                                 *)              dflt="int *" ;;
12928                         esac
12929                         . ./myread
12930                         val=$ans
12931                         ;;
12932                 esac
12933                 selecttype="$val"
12934                 ;;
12935         *)      : no select, so pick a harmless default
12936                 selecttype='int *'
12937                 ;;
12938         esac
12939         ;;
12940 esac
12941
12942 : check for the select 'width'
12943 case "$selectminbits" in
12944 '') case "$d_select" in
12945         $define)
12946                 $cat <<EOM
12947
12948 Checking to see on how many bits at a time your select() operates...
12949 EOM
12950                 $cat >try.c <<EOCP
12951 #include <sys/types.h>
12952 #$i_time I_TIME
12953 #$i_systime I_SYS_TIME
12954 #$i_systimek I_SYS_TIME_KERNEL
12955 #ifdef I_TIME
12956 #   include <time.h>
12957 #endif
12958 #ifdef I_SYS_TIME
12959 #   ifdef I_SYS_TIME_KERNEL
12960 #       define KERNEL
12961 #   endif
12962 #   include <sys/time.h>
12963 #   ifdef I_SYS_TIME_KERNEL
12964 #       undef KERNEL
12965 #   endif
12966 #endif
12967 #$i_sysselct I_SYS_SELECT
12968 #ifdef I_SYS_SELECT
12969 #include <sys/select.h>
12970 #endif
12971 #$d_socket HAS_SOCKET
12972 #ifdef HAS_SOCKET
12973 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12974 #endif
12975 #include <stdio.h>
12976 $selecttype b;
12977 #define S sizeof(*(b))
12978 #define MINBITS 64
12979 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12980 #define NBITS  (NBYTES * 8)
12981 int main() {
12982     char s[NBYTES];
12983     struct timeval t;
12984     int i;
12985     FILE* fp;
12986     int fd;
12987
12988     fclose(stdin);
12989     fp = fopen("try.c", "r");
12990     if (fp == 0)
12991       exit(1);
12992     fd = fileno(fp);
12993     if (fd < 0)
12994       exit(2);
12995     b = ($selecttype)s;
12996     for (i = 0; i < NBITS; i++)
12997         FD_SET(i, b);
12998     t.tv_sec  = 0;
12999     t.tv_usec = 0;
13000     select(fd + 1, b, 0, 0, &t);
13001     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13002     printf("%d\n", i + 1);
13003     return 0;
13004 }
13005 EOCP
13006                 set try
13007                 if eval $compile_ok; then
13008                         selectminbits=`./try`
13009                         case "$selectminbits" in
13010                         '')     cat >&4 <<EOM
13011 Cannot figure out on how many bits at a time your select() operates.
13012 I'll play safe and guess it is 32 bits.
13013 EOM
13014                                 selectminbits=32
13015                                 bits="32 bits"
13016                                 ;;
13017                         1)      bits="1 bit" ;;
13018                         *)      bits="$selectminbits bits" ;;
13019                         esac
13020                         echo "Your select() operates on $bits at a time." >&4
13021                 else
13022                         rp='What is the minimum number of bits your select() operates on?'
13023                         case "$byteorder" in
13024                         1234|12345678)  dflt=32 ;;
13025                         *)              dflt=1  ;;
13026                         esac
13027                         . ./myread
13028                         val=$ans
13029                         selectminbits="$val"
13030                 fi
13031                 $rm -f try.* try
13032                 ;;
13033         *)      : no select, so pick a harmless default
13034                 selectminbits='32'
13035                 ;;
13036         esac
13037         ;;
13038 esac
13039
13040 : Trace out the files included by signal.h, then look for SIGxxx names.
13041 : Remove SIGARRAYSIZE used by HPUX.
13042 : Remove SIGSTKSIZE used by Linux.
13043 : Remove SIGSTKSZ used by Posix.
13044 : Remove SIGTYP void lines used by OS2.
13045 : Some cpps, like os390, dont give the file name anywhere
13046 if [ "X$fieldn" = X ]; then
13047         : Just make some guesses.  We check them later.
13048         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13049 else
13050         xxx=`echo '#include <signal.h>' |
13051         $cppstdin $cppminus $cppflags 2>/dev/null |
13052         $grep '^[       ]*#.*include' | 
13053         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13054 fi
13055 : Check this list of files to be sure we have parsed the cpp output ok.
13056 : This will also avoid potentially non-existent files, such 
13057 : as ../foo/bar.h
13058 xxxfiles=''
13059 for xx in $xxx /dev/null ; do
13060         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13061 done
13062 : If we have found no files, at least try signal.h
13063 case "$xxxfiles" in
13064 '')     xxxfiles=`./findhdr signal.h` ;;
13065 esac
13066 xxx=`awk '
13067 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13068         print substr($2, 4, 20)
13069 }
13070 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13071         print substr($3, 4, 20)
13072 }' $xxxfiles`
13073 : Append some common names just in case the awk scan failed.
13074 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13075 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13076 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13077 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13078 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13079
13080 : generate a few handy files for later
13081 $cat > signal.c <<'EOCP'
13082 #include <sys/types.h>
13083 #include <signal.h>
13084 #include <stdio.h>
13085 int main() {
13086
13087 /* Strange style to avoid deeply-nested #if/#else/#endif */
13088 #ifndef NSIG
13089 #  ifdef _NSIG
13090 #    define NSIG (_NSIG)
13091 #  endif
13092 #endif
13093
13094 #ifndef NSIG
13095 #  ifdef SIGMAX
13096 #    define NSIG (SIGMAX+1)
13097 #  endif
13098 #endif
13099
13100 #ifndef NSIG
13101 #  ifdef SIG_MAX
13102 #    define NSIG (SIG_MAX+1)
13103 #  endif
13104 #endif
13105
13106 #ifndef NSIG
13107 #  ifdef MAXSIG
13108 #    define NSIG (MAXSIG+1)
13109 #  endif
13110 #endif
13111
13112 #ifndef NSIG
13113 #  ifdef MAX_SIG
13114 #    define NSIG (MAX_SIG+1)
13115 #  endif
13116 #endif
13117
13118 #ifndef NSIG
13119 #  ifdef SIGARRAYSIZE
13120 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13121 #  endif
13122 #endif
13123
13124 #ifndef NSIG
13125 #  ifdef _sys_nsig
13126 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13127 #  endif
13128 #endif
13129
13130 /* Default to some arbitrary number that's big enough to get most
13131    of the common signals.
13132 */
13133 #ifndef NSIG
13134 #    define NSIG 50
13135 #endif
13136
13137 printf("NSIG %d\n", NSIG);
13138
13139 #ifndef JUST_NSIG
13140
13141 EOCP
13142
13143 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13144 {
13145         printf "#ifdef SIG"; printf $1; printf "\n"
13146         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13147         printf $1; printf ");\n"
13148         printf "#endif\n"
13149 }
13150 END {
13151         printf "#endif /* JUST_NSIG */\n";
13152         printf "exit(0);\n}\n";
13153 }
13154 ' >>signal.c
13155 $cat >signal.awk <<'EOP'
13156 BEGIN { ndups = 0 }
13157 $1 ~ /^NSIG$/ { nsig = $2 }
13158 ($1 !~ /^NSIG$/) && (NF == 2) {
13159     if ($2 > maxsig) { maxsig = $2 }
13160     if (sig_name[$2]) {
13161         dup_name[ndups] = $1
13162         dup_num[ndups] = $2
13163         ndups++ 
13164     }
13165     else {
13166         sig_name[$2] = $1
13167         sig_num[$2] = $2
13168     }
13169 }
13170 END { 
13171     if (nsig == 0) {
13172         nsig = maxsig + 1
13173     }
13174     printf("NSIG %d\n", nsig);
13175     for (n = 1; n < nsig; n++) {
13176         if (sig_name[n]) {
13177             printf("%s %d\n", sig_name[n], sig_num[n])
13178         }
13179         else {
13180             printf("NUM%d %d\n", n, n) 
13181         }
13182     }
13183     for (n = 0; n < ndups; n++) {
13184         printf("%s %d\n", dup_name[n], dup_num[n])
13185     }
13186 }
13187 EOP
13188 $cat >signal_cmd <<EOS
13189 $startsh
13190 if $test -s signal.lst; then
13191     echo "Using your existing signal.lst file"
13192         exit 0
13193 fi
13194 xxx="$xxx"
13195 EOS
13196 $cat >>signal_cmd <<'EOS'
13197
13198 set signal
13199 if eval $compile_ok; then
13200         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13201 else
13202         echo "(I can't seem be able to compile the whole test program)" >&4
13203         echo "(I'll try it in little pieces.)" >&4
13204         set signal -DJUST_NSIG
13205         if eval $compile_ok; then
13206                 ./signal$_exe > signal.nsg
13207                 $cat signal.nsg
13208         else
13209                 echo "I can't seem to figure out how many signals you have." >&4
13210                 echo "Guessing 50." >&4
13211                 echo 'NSIG 50' > signal.nsg
13212         fi
13213         : Now look at all the signal names, one at a time.
13214         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13215                 $cat > signal.c <<EOCP
13216 #include <sys/types.h>
13217 #include <signal.h>
13218 #include <stdio.h>
13219 int main() {
13220 printf("$xx %d\n", SIG${xx});
13221 return 0;
13222 }
13223 EOCP
13224                 set signal
13225                 if eval $compile; then
13226                         echo "SIG${xx} found."
13227                         ./signal$_exe  >> signal.ls1
13228                 else
13229                         echo "SIG${xx} NOT found."
13230                 fi
13231         done
13232         if $test -s signal.ls1; then
13233                 $cat signal.nsg signal.ls1 |
13234                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13235         fi
13236
13237 fi
13238 if $test -s signal.lst; then
13239         :
13240 else
13241         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13242         echo 'kill -l' >signal
13243         set X `csh -f <signal`
13244         $rm -f signal
13245         shift
13246         case $# in
13247         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13248         esac
13249         echo $@ | $tr ' ' $trnl | \
13250             $awk '{ printf "%s %d\n", $1, ++s; }
13251                   END { printf "NSIG %d\n", ++s }' >signal.lst
13252 fi
13253 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13254 EOS
13255 chmod a+x signal_cmd
13256 $eunicefix signal_cmd
13257
13258 : generate list of signal names
13259 echo " "
13260 case "$sig_name_init" in
13261 '') doinit=yes ;;
13262 *)  case "$sig_num_init" in
13263     ''|*,*) doinit=yes ;;
13264     esac ;;
13265 esac
13266 case "$doinit" in
13267 yes)
13268         echo "Generating a list of signal names and numbers..." >&4
13269         . ./signal_cmd
13270         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13271         sig_name=`$awk 'BEGIN { printf "ZERO " }
13272                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13273         sig_num=`$awk  'BEGIN { printf "0 " }
13274                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13275         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13276                              !/^NSIG/   { printf "\"%s\", ", $1 }
13277                              END        { printf "0\n" }' signal.lst`
13278         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13279                              !/^NSIG/   { printf "%d, ", $2}
13280                              END        { printf "0\n"}' signal.lst`
13281         ;;
13282 esac
13283 echo "The following $sig_count signals are available:"
13284 echo " "
13285 echo $sig_name | $awk \
13286 'BEGIN { linelen = 0 }
13287 {
13288         for (i = 1; i <= NF; i++) {
13289                 name = "SIG" $i " "
13290                 linelen = linelen + length(name)
13291                 if (linelen > 70) {
13292                         printf "\n"
13293                         linelen = length(name)
13294                 }
13295                 printf "%s", name
13296         }
13297         printf "\n"
13298 }'
13299 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13300
13301 : see what type is used for signed size_t
13302 set ssize_t ssizetype int stdio.h sys/types.h
13303 eval $typedef
13304 dflt="$ssizetype"
13305 $cat > ssize.c <<EOM
13306 #include <stdio.h>
13307 #include <sys/types.h>
13308 #define Size_t $sizetype
13309 #define SSize_t $dflt
13310 int main()
13311 {
13312         if (sizeof(Size_t) == sizeof(SSize_t))
13313                 printf("$dflt\n");
13314         else if (sizeof(Size_t) == sizeof(int))
13315                 printf("int\n");
13316         else 
13317                 printf("long\n");
13318         exit(0);
13319 }
13320 EOM
13321 echo " "
13322 set ssize
13323 if eval $compile_ok && ./ssize > /dev/null; then
13324         ssizetype=`./ssize`
13325         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13326 else
13327         $cat >&4 <<EOM
13328 Help! I can't compile and run the ssize_t test program: please enlighten me!
13329 (This is probably a misconfiguration in your system or libraries, and
13330 you really ought to fix it.  Still, I'll try anyway.)
13331
13332 I need a type that is the same size as $sizetype, but is guaranteed to
13333 be signed.  Common values are ssize_t, int and long.
13334
13335 EOM
13336         rp="What signed type is the same size as $sizetype?"
13337         . ./myread
13338         ssizetype="$ans"
13339 fi
13340 $rm -f ssize ssize.*
13341
13342 : see what type of char stdio uses.
13343 echo " "
13344 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13345         echo "Your stdio uses unsigned chars." >&4
13346         stdchar="unsigned char"
13347 else
13348         echo "Your stdio uses signed chars." >&4
13349         stdchar="char"
13350 fi
13351
13352 : see if time exists
13353 echo " "
13354 if test "X$d_time" = X -o X"$timetype" = X; then
13355     if set time val -f d_time; eval $csym; $val; then
13356                 echo 'time() found.' >&4
13357                 val="$define"
13358                 rp="What is the type returned by time() on this system?"
13359                 set time_t timetype long stdio.h sys/types.h
13360                 eval $typedef_ask
13361     else
13362                 echo 'time() not found, hope that will do.' >&4
13363                 val="$undef"
13364                 timetype='int';
13365     fi
13366     set d_time
13367     eval $setvar
13368 fi
13369
13370 : see what type uids are declared as in the kernel
13371 echo " "
13372 echo "Looking for the type for user ids returned by getuid()."
13373 set uid_t uidtype xxx stdio.h sys/types.h
13374 eval $typedef
13375 case "$uidtype" in
13376 xxx)
13377         xxx=`./findhdr sys/user.h`
13378         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13379         case $1 in
13380         unsigned) dflt="$1 $2" ;;
13381         *) dflt="$1" ;;
13382         esac
13383         ;;
13384 *) dflt="$uidtype";;
13385 esac
13386 case "$uidtype" in
13387 uid_t)  echo "uid_t found." ;;
13388 *)      rp="What is the type for user ids returned by getuid()?"
13389         . ./myread
13390         uidtype="$ans"
13391         ;;
13392 esac
13393
13394 echo " "
13395 case "$uidtype" in
13396 *_t) zzz="$uidtype"     ;;
13397 *)   zzz="uid"          ;;
13398 esac
13399 echo "Checking the size of $zzz..." >&4 
13400 cat > try.c <<EOCP
13401 #include <sys/types.h>
13402 #include <stdio.h>
13403 int main() {
13404     printf("%d\n", (int)sizeof($uidtype));
13405     exit(0);
13406 }
13407 EOCP
13408 set try
13409 if eval $compile_ok; then
13410         yyy=`./try`
13411         case "$yyy" in
13412         '')     uidsize=4
13413                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13414                 ;;
13415         *)      uidsize=$yyy
13416                 echo "Your $zzz size is $uidsize bytes."
13417                 ;;
13418         esac
13419 else
13420         uidsize=4
13421         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13422 fi
13423
13424 echo " "
13425 case "$uidtype" in
13426 *_t) zzz="$uidtype"     ;;
13427 *)   zzz="uid"          ;;
13428 esac
13429 echo "Checking the sign of $zzz..." >&4
13430 cat > try.c <<EOCP
13431 #include <sys/types.h>
13432 #include <stdio.h>
13433 int main() {
13434         $uidtype foo = -1;
13435         if (foo < 0)
13436                 printf("-1\n");
13437         else
13438                 printf("1\n");
13439 }
13440 EOCP
13441 set try
13442 if eval $compile; then
13443         yyy=`./try`
13444         case "$yyy" in
13445         '')     uidsign=1
13446                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13447                 ;;
13448         *)      uidsign=$yyy
13449                 case "$uidsign" in
13450                  1) echo "Your $zzz is unsigned." ;;
13451                 -1) echo "Your $zzz is signed."   ;;
13452                 esac
13453                 ;;
13454         esac
13455 else
13456         uidsign=1
13457         echo "(I can't compile the test program--guessing unsigned.)" >&4
13458 fi
13459
13460
13461
13462 echo " "
13463 $echo "Checking the format string to be used for uids..." >&4
13464
13465 case "$uidsign" in
13466 -1)     if $test X"$uidsize" = X"$ivsize"; then
13467                 uidformat="$ivdformat"
13468         else
13469                 if $test X"$uidsize" = X"$longsize"; then
13470                         uidformat='"ld"'
13471                 else
13472                         if $test X"$uidsize" = X"$intsize"; then
13473                                 uidformat='"d"'
13474                         else
13475                                 if $test X"$uidsize" = X"$shortsize"; then
13476                                         uidformat='"hd"'
13477                                 fi
13478                         fi
13479                 fi
13480         fi
13481         ;;
13482 *)      if $test X"$uidsize" = X"$uvsize"; then
13483                 uidformat="$uvuformat"
13484         else
13485                 if $test X"$uidsize" = X"$longsize"; then
13486                         uidformat='"lu"'
13487                 else
13488                         if $test X"$uidsize" = X"$intsize"; then
13489                                 uidformat='"u"'
13490                         else
13491                                 if $test X"$uidsize" = X"$shortsize"; then
13492                                         uidformat='"hu"'
13493                                 fi
13494                         fi
13495                 fi
13496         fi
13497         ;;
13498 esac
13499
13500 : see if dbm.h is available
13501 : see if dbmclose exists
13502 set dbmclose d_dbmclose
13503 eval $inlibc
13504
13505 case "$d_dbmclose" in
13506 $define)
13507         set dbm.h i_dbm
13508         eval $inhdr
13509         case "$i_dbm" in
13510         $define)
13511                 val="$undef"
13512                 set i_rpcsvcdbm
13513                 eval $setvar
13514                 ;;
13515         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13516                 eval $inhdr
13517                 ;;
13518         esac
13519         ;;
13520 *)      echo "We won't be including <dbm.h>"
13521         val="$undef"
13522         set i_dbm
13523         eval $setvar
13524         val="$undef"
13525         set i_rpcsvcdbm
13526         eval $setvar
13527         ;;
13528 esac
13529
13530 : see if this is a sys/file.h system
13531 val=''
13532 set sys/file.h val
13533 eval $inhdr
13534
13535 : do we need to include sys/file.h ?
13536 case "$val" in
13537 "$define")
13538         echo " "
13539         if $h_sysfile; then
13540                 val="$define"
13541                 echo "We'll be including <sys/file.h>." >&4
13542         else
13543                 val="$undef"
13544                 echo "We won't be including <sys/file.h>." >&4
13545         fi
13546         ;;
13547 *)
13548         h_sysfile=false
13549         ;;
13550 esac
13551 set i_sysfile
13552 eval $setvar
13553
13554 : see if fcntl.h is there
13555 val=''
13556 set fcntl.h val
13557 eval $inhdr
13558
13559 : see if we can include fcntl.h
13560 case "$val" in
13561 "$define")
13562         echo " "
13563         if $h_fcntl; then
13564                 val="$define"
13565                 echo "We'll be including <fcntl.h>." >&4
13566         else
13567                 val="$undef"
13568                 if $h_sysfile; then
13569         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13570                 else
13571                         echo "We won't be including <fcntl.h>." >&4
13572                 fi
13573         fi
13574         ;;
13575 *)
13576         h_fcntl=false
13577         val="$undef"
13578         ;;
13579 esac
13580 set i_fcntl
13581 eval $setvar
13582
13583 : see if locale.h is available
13584 set locale.h i_locale
13585 eval $inhdr
13586
13587 : see if mach cthreads are available
13588 if test "X$usethreads" = "X$define"; then
13589         set mach/cthreads.h i_machcthr
13590         eval $inhdr
13591 else
13592         i_machcthr="$undef"
13593 fi
13594
13595
13596
13597 : see if this is a math.h system
13598 set math.h i_math
13599 eval $inhdr
13600
13601 : see if this is a mntent.h system
13602 set mntent.h i_mntent
13603 eval $inhdr
13604
13605 : see if ndbm.h is available
13606 set ndbm.h t_ndbm
13607 eval $inhdr
13608 case "$t_ndbm" in
13609 $define)
13610         : see if dbm_open exists
13611         set dbm_open d_dbm_open
13612         eval $inlibc
13613         case "$d_dbm_open" in
13614         $undef)
13615                 t_ndbm="$undef"
13616                 echo "We won't be including <ndbm.h>"
13617                 ;;
13618         esac
13619         ;;
13620 esac
13621 val="$t_ndbm"
13622 set i_ndbm
13623 eval $setvar
13624
13625 : see if net/errno.h is available
13626 val=''
13627 set net/errno.h val
13628 eval $inhdr
13629
13630 : Unfortunately, it causes problems on some systems.  Arrgh.
13631 case "$val" in
13632 $define)
13633         cat > try.c <<'EOM'
13634 #include <stdio.h>
13635 #include <errno.h>
13636 #include <net/errno.h>
13637 int func()
13638 {
13639         return ENOTSOCK;
13640 }
13641 EOM
13642         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13643                 echo "We'll be including <net/errno.h>." >&4
13644         else
13645                 echo "We won't be including <net/errno.h>." >&4
13646                 val="$undef"
13647         fi
13648         $rm -f try.* try
13649         ;;
13650 esac
13651 set i_neterrno
13652 eval $setvar
13653
13654 : see if netinet/tcp.h is available
13655 set netinet/tcp.h i_netinettcp
13656 eval $inhdr
13657
13658 : see if this is a poll.h system
13659 set poll.h i_poll
13660 eval $inhdr
13661
13662 : get C preprocessor symbols handy
13663 echo " "
13664 $echo $n "Hmm... $c"
13665 echo $al | $tr ' ' $trnl >Cppsym.know
13666 $cat <<EOSS >Cppsym
13667 $startsh
13668 case "\$1" in
13669 -l) list=true
13670         shift
13671         ;;
13672 esac
13673 unknown=''
13674 case "\$list\$#" in
13675 1|2)
13676         for sym do
13677                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13678                         exit 0
13679                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13680                         :
13681                 else
13682                         unknown="\$unknown \$sym"
13683                 fi
13684         done
13685         set X \$unknown
13686         shift
13687         ;;
13688 esac
13689 case \$# in
13690 0) exit 1;;
13691 esac
13692 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13693 #ifdef \1\\
13694 exit 0; _ _ _ _\1\\      \1\\
13695 #endif\\
13696 /' >Cppsym\$\$
13697 echo "exit 1; _ _ _" >>Cppsym\$\$
13698 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13699 case "\$list" in
13700 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13701 *)
13702         sh Cppsym2\$\$
13703         status=\$?
13704         ;;
13705 esac
13706 $rm -f Cppsym\$\$ Cppsym2\$\$
13707 exit \$status
13708 EOSS
13709 chmod +x Cppsym
13710 $eunicefix Cppsym
13711 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13712
13713 : now check the C compiler for additional symbols
13714 postprocess_cc_v=''
13715 case "$osname" in
13716 aix) postprocess_cc_v="|$tr , ' '" ;;
13717 esac
13718 $cat >ccsym <<EOS
13719 $startsh
13720 $cat >tmp.c <<EOF
13721 extern int foo;
13722 EOF
13723 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13724 do
13725         case "\$i" in
13726         -D*) echo "\$i" | $sed 's/^-D//';;
13727         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13728         esac
13729 done
13730 $rm -f try.c
13731 EOS
13732 postprocess_cc_v=''
13733 chmod +x ccsym
13734 $eunicefix ccsym
13735 ./ccsym > ccsym1.raw
13736 if $test -s ccsym1.raw; then
13737        $sort ccsym1.raw | $uniq >ccsym.raw
13738 else
13739        mv ccsym1.raw ccsym.raw
13740 fi
13741
13742 $awk '/\=/ { print $0; next }
13743         { print $0"=1" }' ccsym.raw >ccsym.list
13744 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13745 $comm -13 ccsym.true ccsym.list >ccsym.own
13746 $comm -12 ccsym.true ccsym.list >ccsym.com
13747 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13748 also=''
13749 if $test -z ccsym.raw; then
13750         echo "Your C compiler doesn't seem to define any symbols!" >&4
13751         echo " "
13752         echo "However, your C preprocessor defines the following symbols:"
13753         $cat Cppsym.true
13754         ccsymbols=''
13755         cppsymbols=`$cat Cppsym.true`
13756         cppsymbols=`echo $cppsymbols`
13757         cppccsymbols="$cppsymbols"
13758 else
13759         if $test -s ccsym.com; then
13760                 echo "Your C compiler and pre-processor define these symbols:"
13761                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13762                 also='also '
13763                 symbols='ones'
13764                 cppccsymbols=`$cat ccsym.com`
13765                 cppccsymbols=`echo $cppccsymbols`
13766                 $test "$silent" || sleep 1
13767         fi
13768         if $test -s ccsym.cpp; then
13769                 $test "$also" && echo " "
13770                 echo "Your C pre-processor ${also}defines the following symbols:"
13771                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13772                 also='further '
13773                 cppsymbols=`$cat ccsym.cpp`
13774                 cppsymbols=`echo $cppsymbols`
13775                 $test "$silent" || sleep 1
13776         fi
13777         if $test -s ccsym.own; then
13778                 $test "$also" && echo " "
13779                 echo "Your C compiler ${also}defines the following cpp symbols:"
13780                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13781                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13782                 ccsymbols=`$cat ccsym.own`
13783                 ccsymbols=`echo $ccsymbols`
13784                 $test "$silent" || sleep 1
13785         fi
13786 fi
13787 $rm -f ccsym*
13788
13789 : see if this is a termio system
13790 val="$undef"
13791 val2="$undef"
13792 val3="$undef"
13793 if $test `./findhdr termios.h`; then
13794         set tcsetattr i_termios
13795         eval $inlibc
13796         val3="$i_termios"
13797 fi
13798 echo " "
13799 case "$val3" in
13800 "$define") echo "You have POSIX termios.h... good!" >&4;;
13801 *) if ./Cppsym pyr; then
13802                 case "`/bin/universe`" in
13803                 ucb) if $test `./findhdr sgtty.h`; then
13804                                 val2="$define"
13805                                 echo "<sgtty.h> found." >&4
13806                         else
13807                                 echo "System is pyramid with BSD universe."
13808                                 echo "<sgtty.h> not found--you could have problems." >&4
13809                         fi;;
13810                 *) if $test `./findhdr termio.h`; then
13811                                 val="$define"
13812                                 echo "<termio.h> found." >&4
13813                         else
13814                                 echo "System is pyramid with USG universe."
13815                                 echo "<termio.h> not found--you could have problems." >&4
13816                         fi;;
13817                 esac
13818         elif ./usg; then
13819                 if $test `./findhdr termio.h`; then
13820                         echo "<termio.h> found." >&4
13821                         val="$define"
13822                 elif $test `./findhdr sgtty.h`; then
13823                         echo "<sgtty.h> found." >&4
13824                         val2="$define"
13825                 else
13826 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13827                 fi
13828         else
13829                 if $test `./findhdr sgtty.h`; then
13830                         echo "<sgtty.h> found." >&4
13831                         val2="$define"
13832                 elif $test `./findhdr termio.h`; then
13833                         echo "<termio.h> found." >&4
13834                         val="$define"
13835                 else
13836 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13837                 fi
13838         fi;;
13839 esac
13840 set i_termio; eval $setvar
13841 val=$val2; set i_sgtty; eval $setvar
13842 val=$val3; set i_termios; eval $setvar
13843
13844 : see if this is a shadow.h system
13845 set shadow.h i_shadow
13846 eval $inhdr
13847
13848 : see if this is a socks.h system
13849 set socks.h i_socks
13850 eval $inhdr
13851
13852 : see if stdarg is available
13853 echo " "
13854 if $test `./findhdr stdarg.h`; then
13855         echo "<stdarg.h> found." >&4
13856         valstd="$define"
13857 else
13858         echo "<stdarg.h> NOT found." >&4
13859         valstd="$undef"
13860 fi
13861
13862 : see if varags is available
13863 echo " "
13864 if $test `./findhdr varargs.h`; then
13865         echo "<varargs.h> found." >&4
13866 else
13867         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13868 fi
13869
13870 : set up the varargs testing programs
13871 $cat > varargs.c <<EOP
13872 #ifdef I_STDARG
13873 #include <stdarg.h>
13874 #endif
13875 #ifdef I_VARARGS
13876 #include <varargs.h>
13877 #endif
13878
13879 #ifdef I_STDARG
13880 int f(char *p, ...)
13881 #else
13882 int f(va_alist)
13883 va_dcl
13884 #endif
13885 {
13886         va_list ap;
13887 #ifndef I_STDARG
13888         char *p;
13889 #endif
13890 #ifdef I_STDARG
13891         va_start(ap,p);
13892 #else
13893         va_start(ap);
13894         p = va_arg(ap, char *);
13895 #endif
13896         va_end(ap);
13897 }
13898 EOP
13899 $cat > varargs <<EOP
13900 $startsh
13901 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13902         echo "true"
13903 else
13904         echo "false"
13905 fi
13906 $rm -f varargs$_o
13907 EOP
13908 chmod +x varargs
13909
13910 : now check which varargs header should be included
13911 echo " "
13912 i_varhdr=''
13913 case "$valstd" in
13914 "$define")
13915         if `./varargs I_STDARG`; then
13916                 val='stdarg.h'
13917         elif `./varargs I_VARARGS`; then
13918                 val='varargs.h'
13919         fi
13920         ;;
13921 *)
13922         if `./varargs I_VARARGS`; then
13923                 val='varargs.h'
13924         fi
13925         ;;
13926 esac
13927 case "$val" in
13928 '')
13929 echo "I could not find the definition for va_dcl... You have problems..." >&4
13930         val="$undef"; set i_stdarg; eval $setvar
13931         val="$undef"; set i_varargs; eval $setvar
13932         ;;
13933 *) 
13934         set i_varhdr
13935         eval $setvar
13936         case "$i_varhdr" in
13937         stdarg.h)
13938                 val="$define"; set i_stdarg; eval $setvar
13939                 val="$undef"; set i_varargs; eval $setvar
13940                 ;;
13941         varargs.h)
13942                 val="$undef"; set i_stdarg; eval $setvar
13943                 val="$define"; set i_varargs; eval $setvar
13944                 ;;
13945         esac
13946         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13947 esac
13948 $rm -f varargs*
13949
13950 : see if stddef is available
13951 set stddef.h i_stddef
13952 eval $inhdr
13953
13954 : see if sys/access.h is available
13955 set sys/access.h i_sysaccess
13956 eval $inhdr
13957
13958 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13959 set sys/filio.h i_sysfilio
13960 eval $inhdr
13961 echo " "
13962 if $test `./findhdr sys/ioctl.h`; then
13963         val="$define"
13964         echo '<sys/ioctl.h> found.' >&4
13965 else
13966         val="$undef"
13967         if $test $i_sysfilio = "$define"; then
13968             echo '<sys/ioctl.h> NOT found.' >&4
13969         else
13970                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13971                 $test $i_termio = "$define" && xxx="termio.h"
13972                 $test $i_termios = "$define" && xxx="termios.h"
13973 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13974         fi
13975 fi
13976 set i_sysioctl
13977 eval $setvar
13978
13979 : see if sys/resource.h has to be included
13980 set sys/resource.h i_sysresrc
13981 eval $inhdr
13982
13983 : see if sys/security.h is available
13984 set sys/security.h i_syssecrt
13985 eval $inhdr
13986
13987 : see if this is a sys/statvfs.h system
13988 set sys/statvfs.h i_sysstatvfs
13989 eval $inhdr
13990
13991 : see if this is a sys/uio.h system
13992 set sys/uio.h i_sysuio
13993 eval $inhdr
13994
13995 : see if this is a sys/un.h system
13996 set sys/un.h i_sysun
13997 eval $inhdr
13998
13999 : see if this is a syswait system
14000 set sys/wait.h i_syswait
14001 eval $inhdr
14002
14003 : see if this is a ustat.h system
14004 set ustat.h i_ustat
14005 eval $inhdr
14006
14007 : see if this is an utime system
14008 set utime.h i_utime
14009 eval $inhdr
14010
14011 : see if this is a values.h system
14012 set values.h i_values
14013 eval $inhdr
14014
14015 : see if this is a vfork system
14016 case "$d_vfork" in
14017 "$define")
14018         set vfork.h i_vfork
14019         eval $inhdr
14020         ;;
14021 *)
14022         i_vfork="$undef"
14023         ;;
14024 esac
14025
14026 : see if gdbm.h is available
14027 set gdbm.h t_gdbm
14028 eval $inhdr
14029 case "$t_gdbm" in
14030 $define)
14031         : see if gdbm_open exists
14032         set gdbm_open d_gdbm_open
14033         eval $inlibc
14034         case "$d_gdbm_open" in
14035         $undef)
14036                 t_gdbm="$undef"
14037                 echo "We won't be including <gdbm.h>"
14038                 ;;
14039         esac
14040         ;;
14041 esac
14042 val="$t_gdbm"
14043 set i_gdbm
14044 eval $setvar
14045
14046 echo " "
14047 echo "Looking for extensions..." >&4
14048 : If we are using the old config.sh, known_extensions may contain
14049 : old or inaccurate or duplicate values.
14050 known_extensions=''
14051 nonxs_extensions=''
14052 : We do not use find because it might not be available.
14053 : We do not just use MANIFEST because the user may have dropped
14054 : some additional extensions into the source tree and expect them
14055 : to be built.
14056
14057 : Function to recursively find available extensions, ignoring DynaLoader
14058 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14059 find_extensions='
14060     for xxx in *; do
14061        case "$xxx" in
14062            DynaLoader|dynaload) ;;
14063            *)
14064            if $test -f $xxx/$xxx.xs; then
14065                known_extensions="$known_extensions $1$xxx";
14066            elif $test -f $xxx/Makefile.PL; then
14067                nonxs_extensions="$nonxs_extensions $1$xxx";
14068            else
14069                if $test -d $xxx -a $# -lt 10; then
14070                    set $1$xxx/ $*;
14071                    cd $xxx;
14072                    eval $find_extensions;
14073                    cd ..;
14074                    shift;
14075                fi;
14076            fi
14077            ;;
14078        esac;
14079     done'
14080 tdir=`pwd`
14081 cd $rsrc/ext
14082 set X
14083 shift
14084 eval $find_extensions
14085 set X $nonxs_extensions
14086 shift
14087 nonxs_extensions="$*"
14088 set X $known_extensions
14089 shift
14090 known_extensions="$*"
14091 cd $tdir
14092
14093 : Now see which are supported on this system.
14094 avail_ext=''
14095 for xxx in $known_extensions ; do
14096         case "$xxx" in
14097         DB_File|db_file)
14098                 case "$i_db" in
14099                 $define) avail_ext="$avail_ext $xxx" ;;
14100                 esac
14101                 ;;
14102         GDBM_File|gdbm_fil)
14103                 case "$i_gdbm" in 
14104                 $define) avail_ext="$avail_ext $xxx" ;;
14105                 esac
14106                 ;;
14107         NDBM_File|ndbm_fil)
14108                 case "$i_ndbm" in
14109                 $define) avail_ext="$avail_ext $xxx" ;;
14110                 esac
14111                 ;;
14112         ODBM_File|odbm_fil) 
14113                 case "${i_dbm}${i_rpcsvcdbm}" in
14114                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14115                 esac
14116                 ;;
14117         POSIX|posix)
14118                 case "$useposix" in
14119                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14120                 esac
14121                 ;;
14122         Opcode|opcode)
14123                 case "$useopcode" in
14124                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14125                 esac
14126                 ;;
14127         Socket|socket)
14128                 case "$d_socket" in 
14129                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14130                 esac
14131                 ;;
14132         Thread|thread)
14133                 case "$usethreads" in 
14134                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14135                 esac
14136                 ;;
14137         IPC/SysV|ipc/sysv)
14138                 : XXX Do we need a useipcsysv variable here
14139                 case "${d_msg}${d_sem}${d_shm}" in 
14140                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14141                 esac
14142                 ;;
14143         *)      avail_ext="$avail_ext $xxx"
14144                 ;;
14145         esac
14146 done
14147
14148 set X $avail_ext
14149 shift
14150 avail_ext="$*"
14151
14152 : Now see which nonxs extensions are supported on this system.
14153 : For now assume all are.
14154 nonxs_ext=''
14155 for xxx in $nonxs_extensions ; do
14156         case "$xxx" in
14157         *)      nonxs_ext="$nonxs_ext $xxx"
14158                 ;;
14159         esac
14160 done
14161
14162 set X $nonxs_ext
14163 shift
14164 nonxs_ext="$*"
14165
14166 case $usedl in
14167 $define)
14168         $cat <<EOM
14169 A number of extensions are supplied with $package.  You may choose to
14170 compile these extensions for dynamic loading (the default), compile
14171 them into the $package executable (static loading), or not include
14172 them at all.  Answer "none" to include no extensions.
14173 Note that DynaLoader is always built and need not be mentioned here.
14174
14175 EOM
14176         case "$dynamic_ext" in
14177         '') dflt="$avail_ext" ;;
14178         *)      dflt="$dynamic_ext"
14179                 # Perhaps we are reusing an old out-of-date config.sh.
14180                 case "$hint" in
14181                 previous)
14182                         if test X"$dynamic_ext" != X"$avail_ext"; then
14183                                 $cat <<EOM
14184 NOTICE:  Your previous config.sh list may be incorrect. 
14185 The extensions now available to you are 
14186         ${avail_ext}
14187 but the default list from your previous config.sh is
14188         ${dynamic_ext} 
14189
14190 EOM
14191                         fi
14192                         ;;
14193                 esac
14194                 ;;
14195         esac
14196         case "$dflt" in
14197         '')     dflt=none;;
14198         esac
14199         rp="What extensions do you wish to load dynamically?"
14200         . ./myread
14201         case "$ans" in
14202         none) dynamic_ext=' ' ;;
14203         *) dynamic_ext="$ans" ;;
14204         esac
14205
14206         case "$static_ext" in
14207         '')
14208                 : Exclude those already listed in dynamic linking
14209                 dflt=''
14210                 for xxx in $avail_ext; do
14211                         case " $dynamic_ext " in
14212                         *" $xxx "*) ;;
14213                         *) dflt="$dflt $xxx" ;;
14214                         esac
14215                 done
14216                 set X $dflt
14217                 shift
14218                 dflt="$*"
14219                 ;;
14220         *)  dflt="$static_ext" 
14221                 ;;
14222         esac
14223
14224         case "$dflt" in
14225         '')     dflt=none;;
14226         esac
14227         rp="What extensions do you wish to load statically?"
14228         . ./myread
14229         case "$ans" in
14230         none) static_ext=' ' ;;
14231         *) static_ext="$ans" ;;
14232         esac
14233         ;;
14234 *)
14235         $cat <<EOM
14236 A number of extensions are supplied with $package.  Answer "none" 
14237 to include no extensions. 
14238 Note that DynaLoader is always built and need not be mentioned here.
14239
14240 EOM
14241         case "$static_ext" in
14242         '') dflt="$avail_ext" ;;
14243         *)      dflt="$static_ext"
14244                 # Perhaps we are reusing an old out-of-date config.sh.
14245                 case "$hint" in
14246                 previous)
14247                         if test X"$static_ext" != X"$avail_ext"; then
14248                                 $cat <<EOM
14249 NOTICE:  Your previous config.sh list may be incorrect. 
14250 The extensions now available to you are 
14251         ${avail_ext}
14252 but the default list from your previous config.sh is
14253         ${static_ext} 
14254
14255 EOM
14256                         fi
14257                         ;;
14258                 esac
14259                 ;;
14260         esac
14261         : Exclude those that are not xs extensions
14262         case "$dflt" in
14263         '')     dflt=none;;
14264         esac
14265         rp="What extensions do you wish to include?"
14266         . ./myread
14267         case "$ans" in
14268         none) static_ext=' ' ;;
14269         *) static_ext="$ans" ;;
14270         esac
14271         ;;
14272 esac
14273
14274 set X $dynamic_ext $static_ext $nonxs_ext
14275 shift
14276 extensions="$*"
14277
14278 : Remove build directory name from cppstdin so it can be used from
14279 : either the present location or the final installed location.
14280 echo " "
14281 : Get out of the UU directory to get correct path name.
14282 cd ..
14283 case "$cppstdin" in
14284 `pwd`/cppstdin)
14285         echo "Stripping down cppstdin path name"
14286         cppstdin=cppstdin
14287         ;;
14288 esac
14289 cd UU
14290
14291 : end of configuration questions
14292 echo " "
14293 echo "End of configuration questions."
14294 echo " "
14295
14296 : back to where it started
14297 if test -d ../UU; then
14298         cd ..
14299 fi
14300
14301 : configuration may be patched via a 'config.over' file
14302 if $test -f config.over; then
14303         echo " "
14304         dflt=y
14305         rp='I see a config.over file.  Do you wish to load it?'
14306         . UU/myread
14307         case "$ans" in
14308         n*) echo "OK, I'll ignore it.";;
14309         *)      . ./config.over
14310                 echo "Configuration override changes have been loaded."
14311                 ;;
14312         esac
14313 fi
14314
14315 : in case they want portability, strip down executable paths
14316 case "$d_portable" in
14317 "$define")
14318         echo " "
14319         echo "Stripping down executable paths..." >&4
14320         for file in $loclist $trylist; do
14321                 eval temp=\$$file
14322                 eval $file=`basename $temp`
14323         done
14324         ;;
14325 esac
14326
14327 : create config.sh file
14328 echo " "
14329 echo "Creating config.sh..." >&4
14330 $spitshell <<EOT >config.sh
14331 $startsh
14332 #
14333 # This file was produced by running the Configure script. It holds all the
14334 # definitions figured out by Configure. Should you modify one of these values,
14335 # do not forget to propagate your changes by running "Configure -der". You may
14336 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14337 #
14338
14339 # Package name      : $package
14340 # Source directory  : $src
14341 # Configuration time: $cf_time
14342 # Configured by     : $cf_by
14343 # Target system     : $myuname
14344
14345 Author='$Author'
14346 Date='$Date'
14347 Header='$Header'
14348 Id='$Id'
14349 Locker='$Locker'
14350 Log='$Log'
14351 Mcc='$Mcc'
14352 RCSfile='$RCSfile'
14353 Revision='$Revision'
14354 Source='$Source'
14355 State='$State'
14356 _a='$_a'
14357 _exe='$_exe'
14358 _o='$_o'
14359 afs='$afs'
14360 alignbytes='$alignbytes'
14361 ansi2knr='$ansi2knr'
14362 aphostname='$aphostname'
14363 api_revision='$api_revision'
14364 api_subversion='$api_subversion'
14365 api_version='$api_version'
14366 api_versionstring='$api_versionstring'
14367 ar='$ar'
14368 archlib='$archlib'
14369 archlibexp='$archlibexp'
14370 archname64='$archname64'
14371 archname='$archname'
14372 archobjs='$archobjs'
14373 awk='$awk'
14374 baserev='$baserev'
14375 bash='$bash'
14376 bin='$bin'
14377 bincompat5005='$bincompat5005'
14378 binexp='$binexp'
14379 bison='$bison'
14380 byacc='$byacc'
14381 byteorder='$byteorder'
14382 c='$c'
14383 castflags='$castflags'
14384 cat='$cat'
14385 cc='$cc'
14386 cccdlflags='$cccdlflags'
14387 ccdlflags='$ccdlflags'
14388 ccflags='$ccflags'
14389 ccsymbols='$ccsymbols'
14390 cf_by='$cf_by'
14391 cf_email='$cf_email'
14392 cf_time='$cf_time'
14393 charsize='$charsize'
14394 chgrp='$chgrp'
14395 chmod='$chmod'
14396 chown='$chown'
14397 clocktype='$clocktype'
14398 comm='$comm'
14399 compress='$compress'
14400 contains='$contains'
14401 cp='$cp'
14402 cpio='$cpio'
14403 cpp='$cpp'
14404 cpp_stuff='$cpp_stuff'
14405 cppccsymbols='$cppccsymbols'
14406 cppflags='$cppflags'
14407 cpplast='$cpplast'
14408 cppminus='$cppminus'
14409 cpprun='$cpprun'
14410 cppstdin='$cppstdin'
14411 cppsymbols='$cppsymbols'
14412 crosscompile='$crosscompile'
14413 cryptlib='$cryptlib'
14414 csh='$csh'
14415 d_Gconvert='$d_Gconvert'
14416 d_PRIEldbl='$d_PRIEldbl'
14417 d_PRIFldbl='$d_PRIFldbl'
14418 d_PRIGldbl='$d_PRIGldbl'
14419 d_PRIX64='$d_PRIX64'
14420 d_PRId64='$d_PRId64'
14421 d_PRIeldbl='$d_PRIeldbl'
14422 d_PRIfldbl='$d_PRIfldbl'
14423 d_PRIgldbl='$d_PRIgldbl'
14424 d_PRIi64='$d_PRIi64'
14425 d_PRIo64='$d_PRIo64'
14426 d_PRIu64='$d_PRIu64'
14427 d_PRIx64='$d_PRIx64'
14428 d_access='$d_access'
14429 d_accessx='$d_accessx'
14430 d_alarm='$d_alarm'
14431 d_archlib='$d_archlib'
14432 d_atolf='$d_atolf'
14433 d_atoll='$d_atoll'
14434 d_attribut='$d_attribut'
14435 d_bcmp='$d_bcmp'
14436 d_bcopy='$d_bcopy'
14437 d_bincompat5005='$d_bincompat5005'
14438 d_bsd='$d_bsd'
14439 d_bsdgetpgrp='$d_bsdgetpgrp'
14440 d_bsdsetpgrp='$d_bsdsetpgrp'
14441 d_bzero='$d_bzero'
14442 d_casti32='$d_casti32'
14443 d_castneg='$d_castneg'
14444 d_charvspr='$d_charvspr'
14445 d_chown='$d_chown'
14446 d_chroot='$d_chroot'
14447 d_chsize='$d_chsize'
14448 d_closedir='$d_closedir'
14449 d_const='$d_const'
14450 d_crypt='$d_crypt'
14451 d_csh='$d_csh'
14452 d_cuserid='$d_cuserid'
14453 d_dbl_dig='$d_dbl_dig'
14454 d_difftime='$d_difftime'
14455 d_dirnamlen='$d_dirnamlen'
14456 d_dlerror='$d_dlerror'
14457 d_dlopen='$d_dlopen'
14458 d_dlsymun='$d_dlsymun'
14459 d_dosuid='$d_dosuid'
14460 d_drand48proto='$d_drand48proto'
14461 d_dup2='$d_dup2'
14462 d_eaccess='$d_eaccess'
14463 d_endgrent='$d_endgrent'
14464 d_endhent='$d_endhent'
14465 d_endnent='$d_endnent'
14466 d_endpent='$d_endpent'
14467 d_endpwent='$d_endpwent'
14468 d_endsent='$d_endsent'
14469 d_endspent='$d_endspent'
14470 d_eofnblk='$d_eofnblk'
14471 d_eunice='$d_eunice'
14472 d_fchmod='$d_fchmod'
14473 d_fchown='$d_fchown'
14474 d_fcntl='$d_fcntl'
14475 d_fd_macros='$d_fd_macros'
14476 d_fd_set='$d_fd_set'
14477 d_fds_bits='$d_fds_bits'
14478 d_fgetpos='$d_fgetpos'
14479 d_flexfnam='$d_flexfnam'
14480 d_flock='$d_flock'
14481 d_fork='$d_fork'
14482 d_fpathconf='$d_fpathconf'
14483 d_fpos64_t='$d_fpos64_t'
14484 d_fs_data_s='$d_fs_data_s'
14485 d_fseeko='$d_fseeko'
14486 d_fsetpos='$d_fsetpos'
14487 d_fstatfs='$d_fstatfs'
14488 d_fstatvfs='$d_fstatvfs'
14489 d_ftello='$d_ftello'
14490 d_ftime='$d_ftime'
14491 d_getgrent='$d_getgrent'
14492 d_getgrps='$d_getgrps'
14493 d_gethbyaddr='$d_gethbyaddr'
14494 d_gethbyname='$d_gethbyname'
14495 d_gethent='$d_gethent'
14496 d_gethname='$d_gethname'
14497 d_gethostprotos='$d_gethostprotos'
14498 d_getlogin='$d_getlogin'
14499 d_getmnt='$d_getmnt'
14500 d_getmntent='$d_getmntent'
14501 d_getnbyaddr='$d_getnbyaddr'
14502 d_getnbyname='$d_getnbyname'
14503 d_getnent='$d_getnent'
14504 d_getnetprotos='$d_getnetprotos'
14505 d_getpbyname='$d_getpbyname'
14506 d_getpbynumber='$d_getpbynumber'
14507 d_getpent='$d_getpent'
14508 d_getpgid='$d_getpgid'
14509 d_getpgrp2='$d_getpgrp2'
14510 d_getpgrp='$d_getpgrp'
14511 d_getppid='$d_getppid'
14512 d_getprior='$d_getprior'
14513 d_getprotoprotos='$d_getprotoprotos'
14514 d_getpwent='$d_getpwent'
14515 d_getsbyname='$d_getsbyname'
14516 d_getsbyport='$d_getsbyport'
14517 d_getsent='$d_getsent'
14518 d_getservprotos='$d_getservprotos'
14519 d_getspent='$d_getspent'
14520 d_getspnam='$d_getspnam'
14521 d_gettimeod='$d_gettimeod'
14522 d_gnulibc='$d_gnulibc'
14523 d_grpasswd='$d_grpasswd'
14524 d_hasmntopt='$d_hasmntopt'
14525 d_htonl='$d_htonl'
14526 d_index='$d_index'
14527 d_inetaton='$d_inetaton'
14528 d_int64t='$d_int64t'
14529 d_isascii='$d_isascii'
14530 d_killpg='$d_killpg'
14531 d_lchown='$d_lchown'
14532 d_ldbl_dig='$d_ldbl_dig'
14533 d_link='$d_link'
14534 d_locconv='$d_locconv'
14535 d_lockf='$d_lockf'
14536 d_longdbl='$d_longdbl'
14537 d_longlong='$d_longlong'
14538 d_lstat='$d_lstat'
14539 d_mblen='$d_mblen'
14540 d_mbstowcs='$d_mbstowcs'
14541 d_mbtowc='$d_mbtowc'
14542 d_memchr='$d_memchr'
14543 d_memcmp='$d_memcmp'
14544 d_memcpy='$d_memcpy'
14545 d_memmove='$d_memmove'
14546 d_memset='$d_memset'
14547 d_mkdir='$d_mkdir'
14548 d_mkfifo='$d_mkfifo'
14549 d_mktime='$d_mktime'
14550 d_msg='$d_msg'
14551 d_msg_ctrunc='$d_msg_ctrunc'
14552 d_msg_dontroute='$d_msg_dontroute'
14553 d_msg_oob='$d_msg_oob'
14554 d_msg_peek='$d_msg_peek'
14555 d_msg_proxy='$d_msg_proxy'
14556 d_msgctl='$d_msgctl'
14557 d_msgget='$d_msgget'
14558 d_msgrcv='$d_msgrcv'
14559 d_msgsnd='$d_msgsnd'
14560 d_mymalloc='$d_mymalloc'
14561 d_nice='$d_nice'
14562 d_off64_t='$d_off64_t'
14563 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14564 d_oldpthreads='$d_oldpthreads'
14565 d_oldsock='$d_oldsock'
14566 d_open3='$d_open3'
14567 d_pathconf='$d_pathconf'
14568 d_pause='$d_pause'
14569 d_phostname='$d_phostname'
14570 d_pipe='$d_pipe'
14571 d_poll='$d_poll'
14572 d_portable='$d_portable'
14573 d_pthread_yield='$d_pthread_yield'
14574 d_pwage='$d_pwage'
14575 d_pwchange='$d_pwchange'
14576 d_pwclass='$d_pwclass'
14577 d_pwcomment='$d_pwcomment'
14578 d_pwexpire='$d_pwexpire'
14579 d_pwgecos='$d_pwgecos'
14580 d_pwpasswd='$d_pwpasswd'
14581 d_pwquota='$d_pwquota'
14582 d_quad='$d_quad'
14583 d_readdir='$d_readdir'
14584 d_readlink='$d_readlink'
14585 d_rename='$d_rename'
14586 d_rewinddir='$d_rewinddir'
14587 d_rmdir='$d_rmdir'
14588 d_safebcpy='$d_safebcpy'
14589 d_safemcpy='$d_safemcpy'
14590 d_sanemcmp='$d_sanemcmp'
14591 d_sched_yield='$d_sched_yield'
14592 d_scm_rights='$d_scm_rights'
14593 d_seekdir='$d_seekdir'
14594 d_select='$d_select'
14595 d_sem='$d_sem'
14596 d_semctl='$d_semctl'
14597 d_semctl_semid_ds='$d_semctl_semid_ds'
14598 d_semctl_semun='$d_semctl_semun'
14599 d_semget='$d_semget'
14600 d_semop='$d_semop'
14601 d_setegid='$d_setegid'
14602 d_seteuid='$d_seteuid'
14603 d_setgrent='$d_setgrent'
14604 d_setgrps='$d_setgrps'
14605 d_sethent='$d_sethent'
14606 d_setlinebuf='$d_setlinebuf'
14607 d_setlocale='$d_setlocale'
14608 d_setnent='$d_setnent'
14609 d_setpent='$d_setpent'
14610 d_setpgid='$d_setpgid'
14611 d_setpgrp2='$d_setpgrp2'
14612 d_setpgrp='$d_setpgrp'
14613 d_setprior='$d_setprior'
14614 d_setpwent='$d_setpwent'
14615 d_setregid='$d_setregid'
14616 d_setresgid='$d_setresgid'
14617 d_setresuid='$d_setresuid'
14618 d_setreuid='$d_setreuid'
14619 d_setrgid='$d_setrgid'
14620 d_setruid='$d_setruid'
14621 d_setsent='$d_setsent'
14622 d_setsid='$d_setsid'
14623 d_setspent='$d_setspent'
14624 d_setvbuf='$d_setvbuf'
14625 d_sfio='$d_sfio'
14626 d_shm='$d_shm'
14627 d_shmat='$d_shmat'
14628 d_shmatprototype='$d_shmatprototype'
14629 d_shmctl='$d_shmctl'
14630 d_shmdt='$d_shmdt'
14631 d_shmget='$d_shmget'
14632 d_sigaction='$d_sigaction'
14633 d_sigsetjmp='$d_sigsetjmp'
14634 d_socket='$d_socket'
14635 d_sockpair='$d_sockpair'
14636 d_sqrtl='$d_sqrtl'
14637 d_statblks='$d_statblks'
14638 d_statfs_f_flags='$d_statfs_f_flags'
14639 d_statfs_s='$d_statfs_s'
14640 d_statvfs='$d_statvfs'
14641 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14642 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14643 d_stdio_stream_array='$d_stdio_stream_array'
14644 d_stdiobase='$d_stdiobase'
14645 d_stdstdio='$d_stdstdio'
14646 d_strchr='$d_strchr'
14647 d_strcoll='$d_strcoll'
14648 d_strctcpy='$d_strctcpy'
14649 d_strerrm='$d_strerrm'
14650 d_strerror='$d_strerror'
14651 d_strtod='$d_strtod'
14652 d_strtol='$d_strtol'
14653 d_strtold='$d_strtold'
14654 d_strtoll='$d_strtoll'
14655 d_strtoul='$d_strtoul'
14656 d_strtoull='$d_strtoull'
14657 d_strtouq='$d_strtouq'
14658 d_strxfrm='$d_strxfrm'
14659 d_suidsafe='$d_suidsafe'
14660 d_symlink='$d_symlink'
14661 d_syscall='$d_syscall'
14662 d_sysconf='$d_sysconf'
14663 d_sysernlst='$d_sysernlst'
14664 d_syserrlst='$d_syserrlst'
14665 d_system='$d_system'
14666 d_tcgetpgrp='$d_tcgetpgrp'
14667 d_tcsetpgrp='$d_tcsetpgrp'
14668 d_telldir='$d_telldir'
14669 d_telldirproto='$d_telldirproto'
14670 d_time='$d_time'
14671 d_times='$d_times'
14672 d_truncate='$d_truncate'
14673 d_tzname='$d_tzname'
14674 d_umask='$d_umask'
14675 d_uname='$d_uname'
14676 d_union_semun='$d_union_semun'
14677 d_ustat='$d_ustat'
14678 d_vendorbin='$d_vendorbin'
14679 d_vendorlib='$d_vendorlib'
14680 d_vfork='$d_vfork'
14681 d_void_closedir='$d_void_closedir'
14682 d_voidsig='$d_voidsig'
14683 d_voidtty='$d_voidtty'
14684 d_volatile='$d_volatile'
14685 d_vprintf='$d_vprintf'
14686 d_wait4='$d_wait4'
14687 d_waitpid='$d_waitpid'
14688 d_wcstombs='$d_wcstombs'
14689 d_wctomb='$d_wctomb'
14690 d_xenix='$d_xenix'
14691 date='$date'
14692 db_hashtype='$db_hashtype'
14693 db_prefixtype='$db_prefixtype'
14694 defvoidused='$defvoidused'
14695 direntrytype='$direntrytype'
14696 dlext='$dlext'
14697 dlsrc='$dlsrc'
14698 doublesize='$doublesize'
14699 drand01='$drand01'
14700 dynamic_ext='$dynamic_ext'
14701 eagain='$eagain'
14702 ebcdic='$ebcdic'
14703 echo='$echo'
14704 egrep='$egrep'
14705 emacs='$emacs'
14706 eunicefix='$eunicefix'
14707 exe_ext='$exe_ext'
14708 expr='$expr'
14709 extensions='$extensions'
14710 fflushNULL='$fflushNULL'
14711 fflushall='$fflushall'
14712 find='$find'
14713 firstmakefile='$firstmakefile'
14714 flex='$flex'
14715 fpossize='$fpossize'
14716 fpostype='$fpostype'
14717 freetype='$freetype'
14718 full_ar='$full_ar'
14719 full_csh='$full_csh'
14720 full_sed='$full_sed'
14721 gccversion='$gccversion'
14722 gidformat='$gidformat'
14723 gidsign='$gidsign'
14724 gidsize='$gidsize'
14725 gidtype='$gidtype'
14726 glibpth='$glibpth'
14727 grep='$grep'
14728 groupcat='$groupcat'
14729 groupstype='$groupstype'
14730 gzip='$gzip'
14731 h_fcntl='$h_fcntl'
14732 h_sysfile='$h_sysfile'
14733 hint='$hint'
14734 hostcat='$hostcat'
14735 huge='$huge'
14736 i16size='$i16size'
14737 i16type='$i16type'
14738 i32size='$i32size'
14739 i32type='$i32type'
14740 i64size='$i64size'
14741 i64type='$i64type'
14742 i8size='$i8size'
14743 i8type='$i8type'
14744 i_arpainet='$i_arpainet'
14745 i_bsdioctl='$i_bsdioctl'
14746 i_db='$i_db'
14747 i_dbm='$i_dbm'
14748 i_dirent='$i_dirent'
14749 i_dld='$i_dld'
14750 i_dlfcn='$i_dlfcn'
14751 i_fcntl='$i_fcntl'
14752 i_float='$i_float'
14753 i_gdbm='$i_gdbm'
14754 i_grp='$i_grp'
14755 i_inttypes='$i_inttypes'
14756 i_limits='$i_limits'
14757 i_locale='$i_locale'
14758 i_machcthr='$i_machcthr'
14759 i_malloc='$i_malloc'
14760 i_math='$i_math'
14761 i_memory='$i_memory'
14762 i_mntent='$i_mntent'
14763 i_ndbm='$i_ndbm'
14764 i_netdb='$i_netdb'
14765 i_neterrno='$i_neterrno'
14766 i_netinettcp='$i_netinettcp'
14767 i_niin='$i_niin'
14768 i_poll='$i_poll'
14769 i_pthread='$i_pthread'
14770 i_pwd='$i_pwd'
14771 i_rpcsvcdbm='$i_rpcsvcdbm'
14772 i_sfio='$i_sfio'
14773 i_sgtty='$i_sgtty'
14774 i_shadow='$i_shadow'
14775 i_socks='$i_socks'
14776 i_stdarg='$i_stdarg'
14777 i_stddef='$i_stddef'
14778 i_stdlib='$i_stdlib'
14779 i_string='$i_string'
14780 i_sysaccess='$i_sysaccess'
14781 i_sysdir='$i_sysdir'
14782 i_sysfile='$i_sysfile'
14783 i_sysfilio='$i_sysfilio'
14784 i_sysin='$i_sysin'
14785 i_sysioctl='$i_sysioctl'
14786 i_sysmount='$i_sysmount'
14787 i_sysndir='$i_sysndir'
14788 i_sysparam='$i_sysparam'
14789 i_sysresrc='$i_sysresrc'
14790 i_syssecrt='$i_syssecrt'
14791 i_sysselct='$i_sysselct'
14792 i_syssockio='$i_syssockio'
14793 i_sysstat='$i_sysstat'
14794 i_sysstatfs='$i_sysstatfs'
14795 i_sysstatvfs='$i_sysstatvfs'
14796 i_systime='$i_systime'
14797 i_systimek='$i_systimek'
14798 i_systimes='$i_systimes'
14799 i_systypes='$i_systypes'
14800 i_sysuio='$i_sysuio'
14801 i_sysun='$i_sysun'
14802 i_sysvfs='$i_sysvfs'
14803 i_syswait='$i_syswait'
14804 i_termio='$i_termio'
14805 i_termios='$i_termios'
14806 i_time='$i_time'
14807 i_unistd='$i_unistd'
14808 i_ustat='$i_ustat'
14809 i_utime='$i_utime'
14810 i_values='$i_values'
14811 i_varargs='$i_varargs'
14812 i_varhdr='$i_varhdr'
14813 i_vfork='$i_vfork'
14814 ignore_versioned_solibs='$ignore_versioned_solibs'
14815 inc_version_list='$inc_version_list'
14816 incpath='$incpath'
14817 inews='$inews'
14818 installarchlib='$installarchlib'
14819 installbin='$installbin'
14820 installman1dir='$installman1dir'
14821 installman3dir='$installman3dir'
14822 installprefix='$installprefix'
14823 installprefixexp='$installprefixexp'
14824 installprivlib='$installprivlib'
14825 installscript='$installscript'
14826 installsitearch='$installsitearch'
14827 installsitebin='$installsitebin'
14828 installsitelib='$installsitelib'
14829 installstyle='$installstyle'
14830 installusrbinperl='$installusrbinperl'
14831 installvendorbin='$installvendorbin'
14832 installvendorlib='$installvendorlib'
14833 intsize='$intsize'
14834 ivdformat='$ivdformat'
14835 ivsize='$ivsize'
14836 ivtype='$ivtype'
14837 known_extensions='$known_extensions'
14838 ksh='$ksh'
14839 large='$large'
14840 ld='$ld'
14841 lddlflags='$lddlflags'
14842 ldflags='$ldflags'
14843 ldlibpthname='$ldlibpthname'
14844 less='$less'
14845 lib_ext='$lib_ext'
14846 libc='$libc'
14847 libperl='$libperl'
14848 libpth='$libpth'
14849 libs='$libs'
14850 libswanted='$libswanted'
14851 line='$line'
14852 lint='$lint'
14853 lkflags='$lkflags'
14854 ln='$ln'
14855 lns='$lns'
14856 locincpth='$locincpth'
14857 loclibpth='$loclibpth'
14858 longdblsize='$longdblsize'
14859 longlongsize='$longlongsize'
14860 longsize='$longsize'
14861 lp='$lp'
14862 lpr='$lpr'
14863 ls='$ls'
14864 lseeksize='$lseeksize'
14865 lseektype='$lseektype'
14866 mail='$mail'
14867 mailx='$mailx'
14868 make='$make'
14869 make_set_make='$make_set_make'
14870 mallocobj='$mallocobj'
14871 mallocsrc='$mallocsrc'
14872 malloctype='$malloctype'
14873 man1dir='$man1dir'
14874 man1direxp='$man1direxp'
14875 man1ext='$man1ext'
14876 man3dir='$man3dir'
14877 man3direxp='$man3direxp'
14878 man3ext='$man3ext'
14879 medium='$medium'
14880 mips_type='$mips_type'
14881 mkdir='$mkdir'
14882 models='$models'
14883 modetype='$modetype'
14884 more='$more'
14885 multiarch='$multiarch'
14886 mv='$mv'
14887 myarchname='$myarchname'
14888 mydomain='$mydomain'
14889 myhostname='$myhostname'
14890 myuname='$myuname'
14891 n='$n'
14892 netdb_hlen_type='$netdb_hlen_type'
14893 netdb_host_type='$netdb_host_type'
14894 netdb_name_type='$netdb_name_type'
14895 netdb_net_type='$netdb_net_type'
14896 nm='$nm'
14897 nm_opt='$nm_opt'
14898 nm_so_opt='$nm_so_opt'
14899 nonxs_ext='$nonxs_ext'
14900 nroff='$nroff'
14901 nvsize='$nvsize'
14902 nvtype='$nvtype'
14903 o_nonblock='$o_nonblock'
14904 obj_ext='$obj_ext'
14905 old_pthread_create_joinable='$old_pthread_create_joinable'
14906 optimize='$optimize'
14907 orderlib='$orderlib'
14908 osname='$osname'
14909 osvers='$osvers'
14910 package='$package'
14911 pager='$pager'
14912 passcat='$passcat'
14913 patchlevel='$patchlevel'
14914 path_sep='$path_sep'
14915 perl='$perl'
14916 perladmin='$perladmin'
14917 perlpath='$perlpath'
14918 pg='$pg'
14919 phostname='$phostname'
14920 pidtype='$pidtype'
14921 plibpth='$plibpth'
14922 pmake='$pmake'
14923 pr='$pr'
14924 prefix='$prefix'
14925 prefixexp='$prefixexp'
14926 privlib='$privlib'
14927 privlibexp='$privlibexp'
14928 prototype='$prototype'
14929 ptrsize='$ptrsize'
14930 quadkind='$quadkind'
14931 quadtype='$quadtype'
14932 randbits='$randbits'
14933 randfunc='$randfunc'
14934 randseedtype='$randseedtype'
14935 ranlib='$ranlib'
14936 rd_nodata='$rd_nodata'
14937 rm='$rm'
14938 rmail='$rmail'
14939 runnm='$runnm'
14940 sPRIEldbl='$sPRIEldbl'
14941 sPRIFldbl='$sPRIFldbl'
14942 sPRIGldbl='$sPRIGldbl'
14943 sPRIX64='$sPRIX64'
14944 sPRId64='$sPRId64'
14945 sPRIeldbl='$sPRIeldbl'
14946 sPRIfldbl='$sPRIfldbl'
14947 sPRIgldbl='$sPRIgldbl'
14948 sPRIi64='$sPRIi64'
14949 sPRIo64='$sPRIo64'
14950 sPRIu64='$sPRIu64'
14951 sPRIx64='$sPRIx64'
14952 sched_yield='$sched_yield'
14953 scriptdir='$scriptdir'
14954 scriptdirexp='$scriptdirexp'
14955 sed='$sed'
14956 seedfunc='$seedfunc'
14957 selectminbits='$selectminbits'
14958 selecttype='$selecttype'
14959 sendmail='$sendmail'
14960 sh='$sh'
14961 shar='$shar'
14962 sharpbang='$sharpbang'
14963 shmattype='$shmattype'
14964 shortsize='$shortsize'
14965 shrpenv='$shrpenv'
14966 shsharp='$shsharp'
14967 sig_count='$sig_count'
14968 sig_name='$sig_name'
14969 sig_name_init='$sig_name_init'
14970 sig_num='$sig_num'
14971 sig_num_init='$sig_num_init'
14972 signal_t='$signal_t'
14973 sitearch='$sitearch'
14974 sitearchexp='$sitearchexp'
14975 sitebin='$sitebin'
14976 sitebinexp='$sitebinexp'
14977 sitelib='$sitelib'
14978 sitelibexp='$sitelibexp'
14979 siteprefix='$siteprefix'
14980 siteprefixexp='$siteprefixexp'
14981 sizetype='$sizetype'
14982 sleep='$sleep'
14983 smail='$smail'
14984 small='$small'
14985 so='$so'
14986 sockethdr='$sockethdr'
14987 socketlib='$socketlib'
14988 sort='$sort'
14989 spackage='$spackage'
14990 spitshell='$spitshell'
14991 split='$split'
14992 src='$src'
14993 ssizetype='$ssizetype'
14994 startperl='$startperl'
14995 startsh='$startsh'
14996 static_ext='$static_ext'
14997 stdchar='$stdchar'
14998 stdio_base='$stdio_base'
14999 stdio_bufsiz='$stdio_bufsiz'
15000 stdio_cnt='$stdio_cnt'
15001 stdio_filbuf='$stdio_filbuf'
15002 stdio_ptr='$stdio_ptr'
15003 stdio_stream_array='$stdio_stream_array'
15004 strings='$strings'
15005 submit='$submit'
15006 subversion='$subversion'
15007 sysman='$sysman'
15008 tail='$tail'
15009 tar='$tar'
15010 tbl='$tbl'
15011 tee='$tee'
15012 test='$test'
15013 timeincl='$timeincl'
15014 timetype='$timetype'
15015 touch='$touch'
15016 tr='$tr'
15017 trnl='$trnl'
15018 troff='$troff'
15019 u16size='$u16size'
15020 u16type='$u16type'
15021 u32size='$u32size'
15022 u32type='$u32type'
15023 u64size='$u64size'
15024 u64type='$u64type'
15025 u8size='$u8size'
15026 u8type='$u8type'
15027 uidformat='$uidformat'
15028 uidsign='$uidsign'
15029 uidsize='$uidsize'
15030 uidtype='$uidtype'
15031 uname='$uname'
15032 uniq='$uniq'
15033 uquadtype='$uquadtype'
15034 use5005threads='$use5005threads'
15035 use64bits='$use64bits'
15036 usedl='$usedl'
15037 useithreads='$useithreads'
15038 uselargefiles='$uselargefiles'
15039 uselongdouble='$uselongdouble'
15040 uselonglong='$uselonglong'
15041 usemorebits='$usemorebits'
15042 usemultiplicity='$usemultiplicity'
15043 usemymalloc='$usemymalloc'
15044 usenm='$usenm'
15045 useopcode='$useopcode'
15046 useperlio='$useperlio'
15047 useposix='$useposix'
15048 usesfio='$usesfio'
15049 useshrplib='$useshrplib'
15050 usesocks='$usesocks'
15051 usethreads='$usethreads'
15052 usevendorprefix='$usevendorprefix'
15053 usevfork='$usevfork'
15054 usrinc='$usrinc'
15055 uuname='$uuname'
15056 uvoformat='$uvoformat'
15057 uvsize='$uvsize'
15058 uvtype='$uvtype'
15059 uvuformat='$uvuformat'
15060 uvxformat='$uvxformat'
15061 vendorbin='$vendorbin'
15062 vendorbinexp='$vendorbinexp'
15063 vendorlib='$vendorlib'
15064 vendorlibexp='$vendorlibexp'
15065 vendorprefix='$vendorprefix'
15066 vendorprefixexp='$vendorprefixexp'
15067 version='$version'
15068 vi='$vi'
15069 voidflags='$voidflags'
15070 xlibpth='$xlibpth'
15071 zcat='$zcat'
15072 zip='$zip'
15073 EOT
15074
15075 : Add in command line options if available
15076 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15077
15078 : add special variables
15079 $test -f $src/patchlevel.h && \
15080 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15081 echo "CONFIGDOTSH=true" >>config.sh
15082
15083 : propagate old symbols
15084 if $test -f UU/config.sh; then
15085         <UU/config.sh sort | uniq >UU/oldconfig.sh
15086         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15087         sort | uniq -u >UU/oldsyms
15088         set X `cat UU/oldsyms`
15089         shift
15090         case $# in
15091         0) ;;
15092         *)
15093                 cat <<EOM
15094 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15095 EOM
15096                 echo "# Variables propagated from previous config.sh file." >>config.sh
15097                 for sym in `cat UU/oldsyms`; do
15098                         echo "    Propagating $hint variable "'$'"$sym..."
15099                         eval 'tmp="$'"${sym}"'"'
15100                         echo "$tmp" | \
15101                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15102                 done
15103                 ;;
15104         esac
15105 fi
15106
15107 : Finish up by extracting the .SH files
15108 case "$alldone" in
15109 exit)
15110         $rm -rf UU
15111         echo "Done."
15112         exit 0
15113         ;;
15114 cont)
15115         ;;
15116 '')
15117         dflt=''
15118         nostick=true
15119         $cat <<EOM
15120
15121 If you'd like to make any changes to the config.sh file before I begin
15122 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15123
15124 EOM
15125         rp="Press return or use a shell escape to edit config.sh:"
15126         . UU/myread
15127         nostick=''
15128         case "$ans" in
15129         '') ;;
15130         *) : in case they cannot read
15131                 sh 1>&4 -c "$ans";;
15132         esac
15133         ;;
15134 esac
15135
15136 : if this fails, just run all the .SH files by hand
15137 . ./config.sh
15138
15139 echo " "
15140 exec 1>&4
15141 . ./UU/extract
15142
15143 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15144         dflt=y
15145         case "$silent" in
15146         true) ;;
15147         *)
15148                 $cat <<EOM
15149
15150 Now you need to generate make dependencies by running "$make depend".
15151 You might prefer to run it in background: "$make depend > makedepend.out &"
15152 It can take a while, so you might not want to run it right now.
15153
15154 EOM
15155                 ;;
15156         esac
15157         rp="Run $make depend now?"
15158         . UU/myread
15159         case "$ans" in
15160         y*)
15161                 $make depend && echo "Now you must run a $make."
15162                 ;;
15163         *)
15164                 echo "You must run '$make depend' then '$make'."
15165                 ;;
15166         esac
15167 elif test -f [Mm]akefile; then
15168         echo " "
15169         echo "Now you must run a $make."
15170 else
15171         echo "Done."
15172 fi
15173
15174 if $test -f Policy.sh; then
15175     $cat <<EOM
15176
15177 If you compile $package on a different machine or from a different object
15178 directory, copy the Policy.sh file from this object directory to the
15179 new one before you run Configure -- this will help you with most of
15180 the policy defaults.
15181
15182 EOM
15183 fi
15184 if $test -f config.msg; then
15185     echo "Hmm.  I also noted the following information while running:"
15186     echo " "
15187     $cat config.msg >&4
15188     $rm -f config.msg
15189 fi
15190 $rm -f kit*isdone ark*isdone
15191 $rm -rf UU
15192
15193 : End of Configure
15194