various Configure and hints updates (prefer drand48() or random()
[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 Sep 29 00:08:14 EET DST 1998 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by jhi@iki.fi)
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 case "$inksh/$needksh" in
112 /[a-z]*)
113                 ENV=''
114                 changesh=true
115                 reason="$needksh"
116         ;;
117 esac
118 case "$inksh/$avoidksh" in
119 true/[a-z]*)
120         changesh=true
121         reason="$avoidksh"
122         ;;
123 esac
124 case "$inksh/$needksh-$avoidksh-" in
125 true/--)
126                 cat <<EOM
127 (I see you are using the Korn shell.  Some ksh's blow up on $me,
128 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
129 EOM
130         ;;
131 esac
132 case "$changesh" in
133 true)
134         echo "(Feeding myself to $newsh $reason.)"
135         case "$0" in
136         Configure|*/Configure) exec $newsh $0 "$@";;
137         *) exec $newsh Configure "$@";;
138         esac
139         ;;
140 esac
141
142 : if needed set CDPATH to a harmless value that is not chatty
143 : avoid bash 2.02 problems with empty CDPATH.
144 case "$CDPATH" in
145 '')     ;;
146 *)      case "$SHELL" in
147         *bash*) CDPATH='.' ;;
148         *)              CDPATH='' ;;
149         esac
150         ;;
151 esac
152 : Configure runs within the UU subdirectory
153 test -d UU || mkdir UU
154 cd UU && rm -f ./*
155
156 dynamic_ext=''
157 extensions=''
158 known_extensions=''
159 nonxs_ext=''
160 static_ext=''
161 useopcode=''
162 useposix=''
163 d_bsd=''
164 d_eunice=''
165 d_xenix=''
166 eunicefix=''
167 Mcc=''
168 ar=''
169 awk=''
170 bash=''
171 bison=''
172 byacc=''
173 cat=''
174 chgrp=''
175 chmod=''
176 chown=''
177 comm=''
178 compress=''
179 cp=''
180 cpio=''
181 cpp=''
182 csh=''
183 date=''
184 echo=''
185 egrep=''
186 emacs=''
187 expr=''
188 find=''
189 flex=''
190 grep=''
191 gzip=''
192 inews=''
193 ksh=''
194 less=''
195 line=''
196 lint=''
197 ln=''
198 lp=''
199 lpr=''
200 ls=''
201 mail=''
202 mailx=''
203 make=''
204 mkdir=''
205 more=''
206 mv=''
207 nm=''
208 nroff=''
209 perl=''
210 pg=''
211 pmake=''
212 pr=''
213 rm=''
214 rmail=''
215 sed=''
216 sendmail=''
217 shar=''
218 sleep=''
219 smail=''
220 sort=''
221 submit=''
222 tail=''
223 tar=''
224 tbl=''
225 tee=''
226 test=''
227 touch=''
228 tr=''
229 troff=''
230 uname=''
231 uniq=''
232 uuname=''
233 vi=''
234 zcat=''
235 zip=''
236 full_sed=''
237 libswanted=''
238 hint=''
239 myuname=''
240 osname=''
241 osvers=''
242 Author=''
243 Date=''
244 Header=''
245 Id=''
246 Locker=''
247 Log=''
248 RCSfile=''
249 Revision=''
250 Source=''
251 State=''
252 _a=''
253 _exe=''
254 _o=''
255 archobjs=''
256 exe_ext=''
257 firstmakefile=''
258 lib_ext=''
259 obj_ext=''
260 path_sep=''
261 afs=''
262 alignbytes=''
263 ansi2knr=''
264 archlib=''
265 archlibexp=''
266 d_archlib=''
267 installarchlib=''
268 archname=''
269 myarchname=''
270 baserev=''
271 bin=''
272 binexp=''
273 installbin=''
274 byteorder=''
275 cc=''
276 gccversion=''
277 ccflags=''
278 cppflags=''
279 ldflags=''
280 lkflags=''
281 locincpth=''
282 optimize=''
283 cf_email=''
284 cf_by=''
285 cf_time=''
286 contains=''
287 cpp_stuff=''
288 cpplast=''
289 cppminus=''
290 cpprun=''
291 cppstdin=''
292 d_access=''
293 d_accessx=''
294 d_alarm=''
295 d_attribut=''
296 d_bcmp=''
297 d_bcopy=''
298 d_bzero=''
299 d_casti32=''
300 castflags=''
301 d_castneg=''
302 d_chown=''
303 d_chroot=''
304 d_chsize=''
305 d_closedir=''
306 d_void_closedir=''
307 d_const=''
308 cryptlib=''
309 d_crypt=''
310 d_csh=''
311 full_csh=''
312 d_cuserid=''
313 d_dbl_dig=''
314 d_difftime=''
315 d_dlerror=''
316 d_dlopen=''
317 d_dlsymun=''
318 d_dosuid=''
319 d_suidsafe=''
320 d_drand48proto=''
321 d_dup2=''
322 d_eaccess=''
323 d_endgrent=''
324 d_endhent=''
325 d_endnent=''
326 d_endpent=''
327 d_endpwent=''
328 d_endsent=''
329 d_fchmod=''
330 d_fchown=''
331 d_fcntl=''
332 d_fd_macros=''
333 d_fd_set=''
334 d_fds_bits=''
335 d_fgetpos=''
336 d_flexfnam=''
337 d_flock=''
338 d_fork=''
339 d_fseeko=''
340 d_fsetpos=''
341 d_ftello=''
342 d_ftime=''
343 d_gettimeod=''
344 d_Gconvert=''
345 d_getgrent=''
346 d_getgrps=''
347 d_gethbyaddr=''
348 d_gethbyname=''
349 d_gethent=''
350 aphostname=''
351 d_gethname=''
352 d_phostname=''
353 d_uname=''
354 d_gethostprotos=''
355 d_getlogin=''
356 d_getnbyaddr=''
357 d_getnbyname=''
358 d_getnent=''
359 d_getnetprotos=''
360 d_getpent=''
361 d_getpgid=''
362 d_getpgrp2=''
363 d_bsdgetpgrp=''
364 d_getpgrp=''
365 d_getppid=''
366 d_getprior=''
367 d_getpbyname=''
368 d_getpbynumber=''
369 d_getprotoprotos=''
370 d_getpwent=''
371 d_getsent=''
372 d_getservprotos=''
373 d_getsbyname=''
374 d_getsbyport=''
375 d_gnulibc=''
376 d_htonl=''
377 d_inetaton=''
378 d_isascii=''
379 d_killpg=''
380 d_lchown=''
381 d_link=''
382 d_locconv=''
383 d_lockf=''
384 d_longdbl=''
385 longdblsize=''
386 d_longlong=''
387 longlongsize=''
388 d_lstat=''
389 d_mblen=''
390 d_mbstowcs=''
391 d_mbtowc=''
392 d_memcmp=''
393 d_memcpy=''
394 d_memmove=''
395 d_memset=''
396 d_mkdir=''
397 d_mkfifo=''
398 d_mktime=''
399 d_msg=''
400 d_msgctl=''
401 d_msgget=''
402 d_msgrcv=''
403 d_msgsnd=''
404 d_nice=''
405 d_open3=''
406 d_fpathconf=''
407 d_pathconf=''
408 d_pause=''
409 d_pipe=''
410 d_poll=''
411 d_portable=''
412 d_pthread_yield=''
413 d_sched_yield=''
414 d_pthreads_created_joinable=''
415 d_readdir=''
416 d_rewinddir=''
417 d_seekdir=''
418 d_telldir=''
419 d_readlink=''
420 d_rename=''
421 d_rmdir=''
422 d_safebcpy=''
423 d_safemcpy=''
424 d_sanemcmp=''
425 d_select=''
426 d_sem=''
427 d_semctl=''
428 d_semget=''
429 d_semop=''
430 d_setegid=''
431 d_seteuid=''
432 d_setgrent=''
433 d_setgrps=''
434 d_sethent=''
435 d_setlinebuf=''
436 d_setlocale=''
437 d_setnent=''
438 d_setpent=''
439 d_setpgid=''
440 d_setpgrp2=''
441 d_bsdsetpgrp=''
442 d_setpgrp=''
443 d_setprior=''
444 d_setpwent=''
445 d_setregid=''
446 d_setresgid=''
447 d_setresuid=''
448 d_setreuid=''
449 d_setrgid=''
450 d_setruid=''
451 d_setsent=''
452 d_setsid=''
453 d_setvbuf=''
454 d_sfio=''
455 usesfio=''
456 d_shm=''
457 d_shmat=''
458 d_shmatprototype=''
459 shmattype=''
460 d_shmctl=''
461 d_shmdt=''
462 d_shmget=''
463 d_sigaction=''
464 d_sigsetjmp=''
465 d_oldsock=''
466 d_socket=''
467 d_sockpair=''
468 sockethdr=''
469 socketlib=''
470 d_statblks=''
471 d_stdio_cnt_lval=''
472 d_stdio_ptr_lval=''
473 d_stdiobase=''
474 d_stdstdio=''
475 stdio_base=''
476 stdio_bufsiz=''
477 stdio_cnt=''
478 stdio_filbuf=''
479 stdio_ptr=''
480 d_index=''
481 d_strchr=''
482 d_strcoll=''
483 d_strctcpy=''
484 d_strerrm=''
485 d_strerror=''
486 d_sysernlst=''
487 d_syserrlst=''
488 d_strtod=''
489 d_strtol=''
490 d_strtoul=''
491 d_strxfrm=''
492 d_symlink=''
493 d_syscall=''
494 d_sysconf=''
495 d_system=''
496 d_tcgetpgrp=''
497 d_tcsetpgrp=''
498 d_time=''
499 timetype=''
500 clocktype=''
501 d_times=''
502 d_truncate=''
503 d_tzname=''
504 d_umask=''
505 d_semctl_semid_ds=''
506 d_semctl_semun=''
507 d_union_semun=''
508 d_vfork=''
509 usevfork=''
510 d_voidsig=''
511 signal_t=''
512 d_volatile=''
513 d_charvspr=''
514 d_vprintf=''
515 d_wait4=''
516 d_waitpid=''
517 d_wcstombs=''
518 d_wctomb=''
519 d_dbmclose64=''
520 d_dbminit64=''
521 d_delete64=''
522 d_fetch64=''
523 d_firstkey64=''
524 d_nextkey64=''
525 d_store64=''
526 dlext=''
527 cccdlflags=''
528 ccdlflags=''
529 dlsrc=''
530 ld=''
531 lddlflags=''
532 usedl=''
533 doublesize=''
534 ebcdic=''
535 fpostype=''
536 gidtype=''
537 groupstype=''
538 h_fcntl=''
539 h_sysfile=''
540 i_arpainet=''
541 db_hashtype=''
542 db_prefixtype=''
543 i_db=''
544 i_dbm=''
545 i_rpcsvcdbm=''
546 d_dirnamlen=''
547 direntrytype=''
548 i_dirent=''
549 i_dld=''
550 i_dlfcn=''
551 i_fcntl=''
552 i_float=''
553 i_gdbm=''
554 d_grpasswd=''
555 i_grp=''
556 d_int64t=''
557 i_inttypes=''
558 i_limits=''
559 i_locale=''
560 i_malloc=''
561 i_math=''
562 i_memory=''
563 i_ndbm=''
564 i_netdb=''
565 i_neterrno=''
566 i_niin=''
567 i_sysin=''
568 d_pwage=''
569 d_pwchange=''
570 d_pwclass=''
571 d_pwcomment=''
572 d_pwexpire=''
573 d_pwgecos=''
574 d_pwpasswd=''
575 d_pwquota=''
576 i_pwd=''
577 i_sfio=''
578 i_stddef=''
579 i_stdlib=''
580 i_string=''
581 strings=''
582 i_sysaccess=''
583 i_sysdir=''
584 i_sysfile=''
585 d_voidtty=''
586 i_bsdioctl=''
587 i_sysfilio=''
588 i_sysioctl=''
589 i_syssockio=''
590 i_sysndir=''
591 i_sysparam=''
592 i_sysresrc=''
593 i_syssecrt=''
594 i_sysselct=''
595 i_sysstat=''
596 i_systimes=''
597 i_systypes=''
598 i_sysun=''
599 i_syswait=''
600 i_sgtty=''
601 i_termio=''
602 i_termios=''
603 i_systime=''
604 i_systimek=''
605 i_time=''
606 timeincl=''
607 i_unistd=''
608 i_utime=''
609 i_values=''
610 i_stdarg=''
611 i_varargs=''
612 i_varhdr=''
613 i_vfork=''
614 intsize=''
615 longsize=''
616 shortsize=''
617 d_dirent64s=''
618 d_flock64s=''
619 d_fstat64=''
620 d_ftruncate64=''
621 d_ino64t=''
622 d_lockf64=''
623 d_lseek64=''
624 d_lstat64=''
625 d_off64t=''
626 d_open64=''
627 d_opendir64=''
628 d_readdir64=''
629 d_seekdir64=''
630 d_stat64=''
631 d_telldir64=''
632 d_truncate64=''
633 libc=''
634 libperl=''
635 shrpenv=''
636 useshrplib=''
637 glibpth=''
638 libpth=''
639 loclibpth=''
640 plibpth=''
641 xlibpth=''
642 libs=''
643 lns=''
644 lseeksize=''
645 lseektype=''
646 make_set_make=''
647 d_mymalloc=''
648 freetype=''
649 mallocobj=''
650 mallocsrc=''
651 malloctype=''
652 usemymalloc=''
653 installman1dir=''
654 man1dir=''
655 man1direxp=''
656 man1ext=''
657 installman3dir=''
658 man3dir=''
659 man3direxp=''
660 man3ext=''
661 huge=''
662 large=''
663 medium=''
664 models=''
665 small=''
666 split=''
667 modetype=''
668 mydomain=''
669 myhostname=''
670 phostname=''
671 c=''
672 n=''
673 d_eofnblk=''
674 eagain=''
675 o_nonblock=''
676 rd_nodata=''
677 netdb_hlen_type=''
678 netdb_host_type=''
679 netdb_name_type=''
680 netdb_net_type=''
681 groupcat=''
682 hostcat=''
683 passcat=''
684 orderlib=''
685 ranlib=''
686 package=''
687 spackage=''
688 pager=''
689 apiversion=''
690 patchlevel=''
691 subversion=''
692 version=''
693 perladmin=''
694 perlpath=''
695 pidtype=''
696 prefix=''
697 prefixexp=''
698 installprivlib=''
699 privlib=''
700 privlibexp=''
701 prototype=''
702 ptrsize=''
703 drand01=''
704 randbits=''
705 randfunc=''
706 randseedtype=''
707 seedfunc=''
708 installscript=''
709 scriptdir=''
710 scriptdirexp=''
711 selectminbits=''
712 selecttype=''
713 sh=''
714 sig_name=''
715 sig_name_init=''
716 sig_num=''
717 installsitearch=''
718 sitearch=''
719 sitearchexp=''
720 installsitelib=''
721 sitelib=''
722 sitelibexp=''
723 sizetype=''
724 so=''
725 sharpbang=''
726 shsharp=''
727 spitshell=''
728 src=''
729 ssizetype=''
730 startperl=''
731 startsh=''
732 stdchar=''
733 d_fgetpos64=''
734 d_fopen64=''
735 d_freopen64=''
736 d_fseek64=''
737 d_fseeko64=''
738 d_fsetpos64=''
739 d_ftell64=''
740 d_ftello64=''
741 d_tmpfile64=''
742 sysman=''
743 trnl=''
744 uidtype=''
745 archname64=''
746 use64bits=''
747 usemultiplicity=''
748 nm_opt=''
749 nm_so_opt=''
750 runnm=''
751 usenm=''
752 useperlio=''
753 d_oldpthreads=''
754 usethreads=''
755 incpath=''
756 mips=''
757 mips_type=''
758 usrinc=''
759 defvoidused=''
760 voidflags=''
761 CONFIG=''
762
763 define='define'
764 undef='undef'
765 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
766 rmlist=''
767
768 : We must find out about Eunice early
769 eunicefix=':'
770 if test -f /etc/unixtovms; then
771         eunicefix=/etc/unixtovms
772 fi
773 if test -f /etc/unixtovms.exe; then
774         eunicefix=/etc/unixtovms.exe
775 fi
776
777 i_whoami=''
778 : change the next line if compiling for Xenix/286 on Xenix/386
779 xlibpth='/usr/lib/386 /lib/386'
780
781 : Possible local library directories to search.
782 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
783 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
784
785 : general looking path for locating libraries
786 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
787 glibpth="$glibpth /lib /usr/lib $xlibpth"
788 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
789 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
790
791 : Private path used by Configure to find libraries.  Its value
792 : is prepended to libpth. This variable takes care of special
793 : machines, like the mips.  Usually, it should be empty.
794 plibpth=''
795
796 : default library list
797 libswanted=''
798 : Possible local include directories to search.
799 : Set locincpth to "" in a hint file to defeat local include searches.
800 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
801 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
802 :
803 : no include file wanted by default
804 inclwanted=''
805
806 : list of known cpp symbols, sorted alphabetically
807 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
808 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
809 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
810 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
811 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
812 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
813 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
814 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
815 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
816 al="$al VMS Xenix286"
817 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
818 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
819 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
820 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
821 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
822 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
823 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
824 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
825 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
826 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
827 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
828 al="$al __SVR4_2__ __UMAXV__"
829 al="$al ____386BSD____ __alpha __alpha__ __amiga"
830 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
831 al="$al __host_mips__"
832 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
833 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
834 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
835 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
836 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
837 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
838 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
839 al="$al __mc88100 __mc88100__ __mips __mips__"
840 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
841 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
842 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
843 al="$al _host_mips _mips _unix"
844 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
845 al="$al apollo ardent att386 att3b"
846 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
847 al="$al cadmus clipper concurrent convex cray ctix"
848 al="$al dmert encore gcos gcx gimpel gould"
849 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
850 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
851 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
852 al="$al i186 i286 i386 i486 i8086"
853 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
854 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
855 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
856 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
857 al="$al mc88000 mc88100 merlin mert mips mvs n16"
858 al="$al ncl_el ncl_mr"
859 al="$al news1500 news1700 news1800 news1900 news3700"
860 al="$al news700 news800 news900 ns16000 ns32000"
861 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
862 al="$al parisc pc532 pdp11 plexus posix pyr"
863 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
864 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
865 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
866 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
867 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
868 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
869 al="$al xenix z8000"
870
871 : Trailing extension.  Override this in a hint file, if needed.
872 _exe=''
873 : Extra object files, if any, needed on this platform.
874 archobjs=''
875 groupstype=''
876 : full support for void wanted by default
877 defvoidused=15
878
879 : set useposix=false in your hint file to disable the POSIX extension.
880 useposix=true
881 : set useopcode=false in your hint file to disable the Opcode extension.
882 useopcode=true
883 : set usemultiplicity on the Configure command line to enable multiplicity.
884 : set usethreads on the Configure command line to enable threads.
885 : List of libraries we want.
886 : If anyone needs -lnet, put it in a hint file.
887 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
888 libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
889 libswanted="$libswanted ucb bsd BSD PW x"
890 : We probably want to search /usr/shlib before most other libraries.
891 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
892 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
893 glibpth="/usr/shlib $glibpth"
894 : Do not use vfork unless overridden by a hint file.
895 usevfork=false
896
897 : Find the basic shell for Bourne shell scripts
898 case "$sh" in
899 '')
900         case "$SYSTYPE" in
901         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
902         *) xxx='/bin/sh';;
903         esac
904         if test -f "$xxx"; then
905                 sh="$xxx"
906         else
907                 : Build up a list and do a single loop so we can 'break' out.
908                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
909                 for xxx in sh bash ksh pdksh ash; do
910                         for p in $pth; do
911                                 try="$try ${p}/${xxx}"
912                         done
913                 done
914                 for xxx in $try; do
915                         if test -f "$xxx"; then
916                                 sh="$xxx";
917                                 break
918                         elif test -f "$xxx.exe"; then
919                                 sh="$xxx";
920                                 break
921                         fi
922                 done
923         fi
924         ;;
925 esac
926
927 case "$sh" in
928 '')     cat <<EOM >&2
929 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
930
931 Usually it's in /bin/sh.  How did you even get this far?
932 Please contact me (Jarkko Hietaniemi) at jhi@iki.fi and 
933 we'll try to straighten this all out.
934 EOM
935         exit 1
936         ;;
937 esac
938
939 : see if sh knows # comments
940 if `$sh -c '#' >/dev/null 2>&1`; then
941         shsharp=true
942         spitshell=cat
943         xcat=/bin/cat
944         test -f $xcat || xcat=/usr/bin/cat
945         echo "#!$xcat" >try
946         $eunicefix try
947         chmod +x try
948         ./try > today
949         if test -s today; then
950                 sharpbang='#!'
951         else
952                 echo "#! $xcat" > try
953                 $eunicefix try
954                 chmod +x try
955                 ./try > today
956                 if test -s today; then
957                         sharpbang='#! '
958                 else
959                         sharpbang=': use '
960                 fi
961         fi
962 else
963         echo " "
964         echo "Your $sh doesn't grok # comments--I will strip them later on."
965         shsharp=false
966         cd ..
967         echo "exec grep -v '^[  ]*#'" >spitshell
968         chmod +x spitshell
969         $eunicefix spitshell
970         spitshell=`pwd`/spitshell
971         cd UU
972         echo "I presume that if # doesn't work, #! won't work either!"
973         sharpbang=': use '
974 fi
975 rm -f try today
976
977 : figure out how to guarantee sh startup
978 case "$startsh" in
979 '') startsh=${sharpbang}${sh} ;;
980 *)
981 esac
982 cat >try <<EOSS
983 $startsh
984 set abc
985 test "$?abc" != 1
986 EOSS
987
988 chmod +x try
989 $eunicefix try
990 if ./try; then
991         : echo "Yup, it does."
992 else
993         echo "Hmm... '$startsh' does not guarantee sh startup..."
994         echo "You may have to fix up the shell scripts to make sure $sh runs them."
995 fi
996 rm -f try
997
998
999 : Save command line options in file UU/cmdline.opt for later use in
1000 : generating config.sh.
1001 cat > cmdline.opt <<EOSH
1002 # Configure command line arguments.
1003 config_arg0='$0'
1004 config_args='$*'
1005 config_argc=$#
1006 EOSH
1007 argn=1
1008 for arg in "$@"; do
1009         cat >>cmdline.opt <<EOSH
1010 config_arg$argn='$arg'
1011 EOSH
1012         argn=`expr $argn + 1`
1013 done
1014
1015 : produce awk script to parse command line options
1016 cat >options.awk <<'EOF'
1017 BEGIN {
1018         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1019
1020         len = length(optstr);
1021         for (i = 1; i <= len; i++) {
1022                 c = substr(optstr, i, 1);
1023                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1024                 if (a == ":") {
1025                         arg[c] = 1;
1026                         i++;
1027                 }
1028                 opt[c] = 1;
1029         }
1030 }
1031 {
1032         expect = 0;
1033         str = $0;
1034         if (substr(str, 1, 1) != "-") {
1035                 printf("'%s'\n", str);
1036                 next;
1037         }
1038         len = length($0);
1039         for (i = 2; i <= len; i++) {
1040                 c = substr(str, i, 1);
1041                 if (!opt[c]) {
1042                         printf("-%s\n", substr(str, i));
1043                         next;
1044                 }
1045                 printf("-%s\n", c);
1046                 if (arg[c]) {
1047                         if (i < len)
1048                                 printf("'%s'\n", substr(str, i + 1));
1049                         else
1050                                 expect = 1;
1051                         next;
1052                 }
1053         }
1054 }
1055 END {
1056         if (expect)
1057                 print "?";
1058 }
1059 EOF
1060
1061 : process the command line options
1062 set X `for arg in "$@"; do echo "X$arg"; done |
1063         sed -e s/X// | awk -f options.awk`
1064 eval "set $*"
1065 shift
1066 rm -f options.awk
1067
1068 : set up default values
1069 fastread=''
1070 reuseval=false
1071 config_sh=''
1072 alldone=''
1073 error=''
1074 silent=''
1075 extractsh=''
1076 override=''
1077 knowitall=''
1078 rm -f optdef.sh
1079 cat >optdef.sh <<EOS
1080 $startsh
1081 EOS
1082
1083
1084 : option parsing
1085 while test $# -gt 0; do
1086         case "$1" in
1087         -d) shift; fastread=yes;;
1088         -e) shift; alldone=cont;;
1089         -f)
1090                 shift
1091                 cd ..
1092                 if test -r "$1"; then
1093                         config_sh="$1"
1094                 else
1095                         echo "$me: cannot read config file $1." >&2
1096                         error=true
1097                 fi
1098                 cd UU
1099                 shift;;
1100         -h) shift; error=true;;
1101         -r) shift; reuseval=true;;
1102         -s) shift; silent=true; realsilent=true;;
1103         -E) shift; alldone=exit;;
1104         -K) shift; knowitall=true;;
1105         -O) shift; override=true;;
1106         -S) shift; silent=true; extractsh=true;;
1107         -D)
1108                 shift
1109                 case "$1" in
1110                 *=)
1111                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1112                         echo "$me: ignoring -D $1" >&2
1113                         ;;
1114                 *=*) echo "$1" | \
1115                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1116                 *) echo "$1='define'" >> optdef.sh;;
1117                 esac
1118                 shift
1119                 ;;
1120         -U)
1121                 shift
1122                 case "$1" in
1123                 *=) echo "$1" >> optdef.sh;;
1124                 *=*)
1125                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1126                         echo "$me: ignoring -U $1" >&2
1127                         ;;
1128                 *) echo "$1='undef'" >> optdef.sh;;
1129                 esac
1130                 shift
1131                 ;;
1132         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1133                 exit 0;;
1134         --) break;;
1135         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1136         *) break;;
1137         esac
1138 done
1139
1140 case "$error" in
1141 true)
1142         cat >&2 <<EOM
1143 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1144                  [-U symbol] [-U symbol=]
1145   -d : use defaults for all answers.
1146   -e : go on without questioning past the production of config.sh.
1147   -f : specify an alternate default configuration file.
1148   -h : print this help message and exit (with an error status).
1149   -r : reuse C symbols value if possible (skips costly nm extraction).
1150   -s : silent mode, only echoes questions and essential information.
1151   -D : define symbol to have some value:
1152          -D symbol         symbol gets the value 'define'
1153          -D symbol=value   symbol gets the value 'value'
1154   -E : stop at the end of questions, after having produced config.sh.
1155   -K : do not use unless you know what you are doing.
1156   -O : let -D and -U override definitions from loaded configuration file.
1157   -S : perform variable substitutions on all .SH files (can mix with -f)
1158   -U : undefine symbol:
1159          -U symbol    symbol gets the value 'undef'
1160          -U symbol=   symbol gets completely empty
1161   -V : print version number and exit (with a zero status).
1162 EOM
1163         exit 1
1164         ;;
1165 esac
1166
1167 : Sanity checks
1168 case "$fastread$alldone" in
1169 yescont|yesexit) ;;
1170 *)
1171         if test ! -t 0; then
1172                 echo "Say 'sh Configure', not 'sh <Configure'"
1173                 exit 1
1174         fi
1175         ;;
1176 esac
1177
1178 exec 4>&1
1179 case "$silent" in
1180 true) exec 1>/dev/null;;
1181 esac
1182
1183 : run the defines and the undefines, if any, but leave the file out there...
1184 touch optdef.sh
1185 . ./optdef.sh
1186
1187 : set package name
1188 package=perl5
1189 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1190 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1191 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1192 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1193 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1194 esac
1195
1196 : Some greps do not return status, grrr.
1197 echo "grimblepritz" >grimble
1198 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1199         contains=contains
1200 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1201         contains=grep
1202 else
1203         contains=contains
1204 fi
1205 rm -f grimble
1206 : the following should work in any shell
1207 case "$contains" in
1208 contains*)
1209         echo " "
1210         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1211         cat >contains <<'EOSS'
1212 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1213 EOSS
1214 chmod +x contains
1215 esac
1216
1217 : Find the path to the source tree
1218 case "$src" in
1219 '') case "$0" in
1220     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1221     *)   src='.';;
1222     esac;;
1223 esac
1224 case "$src" in
1225 '')     src=/
1226         rsrc=/
1227         ;;
1228 /*) rsrc="$src";;
1229 *) rsrc="../$src";;
1230 esac
1231 if test -f $rsrc/Configure && \
1232         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1233 then
1234    : found it, so we are ok.
1235 else
1236         rsrc=''
1237         for src in . .. ../.. ../../.. ../../../..; do
1238                 if test -f ../$src/Configure && \
1239                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1240                 then
1241                         rsrc=../$src
1242                         break
1243                 fi
1244         done
1245 fi
1246 case "$rsrc" in
1247 '')
1248         cat <<EOM >&4
1249
1250 Sorry, I can't seem to locate the source dir for $package.  Please start
1251 Configure with an explicit path -- i.e. /some/path/Configure.
1252
1253 EOM
1254         exit 1
1255         ;;
1256 ../.)   rsrc='..';;
1257 *)
1258         echo " "
1259         echo "Sources for $package found in \"$src\"." >&4
1260         ;;
1261 esac
1262
1263 : script used to extract .SH files with variable substitutions
1264 cat >extract <<'EOS'
1265 CONFIG=true
1266 echo "Doing variable substitutions on .SH files..."
1267 if test -f $src/MANIFEST; then
1268         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
1269 else
1270         echo "(Looking for .SH files under the source directory.)"
1271         set x `(cd $src; find . -name "*.SH" -print)`
1272 fi
1273 shift
1274 case $# in
1275 0) set x `(cd $src; echo *.SH)`; shift;;
1276 esac
1277 if test ! -f $src/$1; then
1278         shift
1279 fi
1280 mkdir_p='
1281 name=$1;
1282 create="";
1283 while test $name; do
1284         if test ! -d "$name"; then
1285                 create="$name $create";
1286                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1287                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1288         else
1289                 name="";
1290         fi;
1291 done;
1292 for file in $create; do
1293         mkdir $file;
1294 done
1295 '
1296 for file in $*; do
1297         case "$src" in
1298         ".")
1299                 case "$file" in
1300                 */*)
1301                         dir=`expr X$file : 'X\(.*\)/'`
1302                         file=`expr X$file : 'X.*/\(.*\)'`
1303                         (cd $dir && . ./$file)
1304                         ;;
1305                 *)
1306                         . ./$file
1307                         ;;
1308                 esac
1309                 ;;
1310         *)
1311                 case "$file" in
1312                 */*)
1313                         dir=`expr X$file : 'X\(.*\)/'`
1314                         file=`expr X$file : 'X.*/\(.*\)'`
1315                         (set x $dir; shift; eval $mkdir_p)
1316                         sh <$src/$dir/$file
1317                         ;;
1318                 *)
1319                         sh <$src/$file
1320                         ;;
1321                 esac
1322                 ;;
1323         esac
1324 done
1325 if test -f $src/config_h.SH; then
1326         if test ! -f config.h; then
1327         : oops, they left it out of MANIFEST, probably, so do it anyway.
1328         . $src/config_h.SH
1329         fi
1330 fi
1331 EOS
1332
1333 : extract files and exit if asked to do so
1334 case "$extractsh" in
1335 true)
1336         case "$realsilent" in
1337         true) ;;
1338         *) exec 1>&4;;
1339         esac
1340         case "$config_sh" in
1341         '') config_sh='config.sh';;
1342         esac
1343         echo " "
1344         echo "Fetching answers from $config_sh..."
1345         cd ..
1346         . $config_sh
1347         test "$override" && . ./optdef.sh
1348         echo " "
1349         . UU/extract
1350         rm -rf UU
1351         echo "Done."
1352         exit 0
1353         ;;
1354 esac
1355
1356 : Eunice requires " " instead of "", can you believe it
1357 echo " "
1358 : Here we go...
1359 echo "Beginning of configuration questions for $package."
1360
1361 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1362
1363 : first determine how to suppress newline on echo command
1364 echo " "
1365 echo "Checking echo to see how to suppress newlines..."
1366 (echo "hi there\c" ; echo " ") >.echotmp
1367 if $contains c .echotmp >/dev/null 2>&1 ; then
1368         echo "...using -n."
1369         n='-n'
1370         c=''
1371 else
1372         cat <<'EOM'
1373 ...using \c
1374 EOM
1375         n=''
1376         c='\c'
1377 fi
1378 echo $n "The star should be here-->$c"
1379 echo '*'
1380 rm -f .echotmp
1381
1382 : Now test for existence of everything in MANIFEST
1383 echo " "
1384 if test -f $rsrc/MANIFEST; then
1385         echo "First let's make sure your kit is complete.  Checking..." >&4
1386         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1387         rm -f missing
1388         tmppwd=`pwd`
1389         for filelist in x??; do
1390                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1391         done
1392         if test -s missing; then
1393                 cat missing >&4
1394                 cat >&4 <<'EOM'
1395
1396 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1397
1398 You have the option of continuing the configuration process, despite the
1399 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1400 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1401 and contact the author (jhi@iki.fi).
1402
1403 EOM
1404                 echo $n "Continue? [n] $c" >&4
1405                 read ans
1406                 case "$ans" in
1407                 y*)
1408                         echo "Continuing..." >&4
1409                         rm -f missing
1410                         ;;
1411                 *)
1412                         echo "ABORTING..." >&4
1413                         kill $$
1414                         ;;
1415                 esac
1416         else
1417                 echo "Looks good..."
1418         fi
1419 else
1420         echo "There is no MANIFEST file.  I hope your kit is complete !"
1421 fi
1422 rm -f missing x??
1423
1424 echo " "
1425 : Find the appropriate value for a newline for tr
1426 if test -n "$DJGPP"; then
1427        trnl='\012'
1428 fi
1429 if test X"$trnl" = X; then
1430         case "`echo foo|tr '\n' x 2>/dev/null`" in
1431         foox) trnl='\n' ;;
1432         esac
1433 fi
1434 if test X"$trnl" = X; then
1435         case "`echo foo|tr '\012' x 2>/dev/null`" in
1436         foox) trnl='\012' ;;
1437         esac
1438 fi
1439 if test X"$trnl" = X; then
1440         cat <<EOM >&2
1441
1442 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1443
1444 EOM
1445         exit 1
1446 fi
1447
1448 : compute the number of columns on the terminal for proper question formatting
1449 case "$COLUMNS" in
1450 '') COLUMNS='80';;
1451 esac
1452
1453 : set up the echo used in my read
1454 myecho="case \"\$xxxm\" in
1455 '') echo $n \"\$rp $c\" >&4;;
1456 *) case \"\$rp\" in
1457         '') echo $n \"[\$xxxm] $c\";;
1458         *)
1459                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1460                         echo \"\$rp\" >&4
1461                         echo $n \"[\$xxxm] $c\" >&4
1462                 else
1463                         echo $n \"\$rp [\$xxxm] $c\" >&4
1464                 fi
1465                 ;;
1466         esac;;
1467 esac"
1468
1469 : now set up to do reads with possible shell escape and default assignment
1470 cat <<EOSC >myread
1471 $startsh
1472 xxxm=\$dflt
1473 $myecho
1474 ans='!'
1475 case "\$fastread" in
1476 yes) case "\$dflt" in
1477         '') ;;
1478         *) ans='';
1479                 case "\$silent-\$rp" in
1480                 true-) ;;
1481                 *) echo " " >&4;;
1482                 esac;;
1483         esac;;
1484 *) case "\$silent" in
1485         true) case "\$rp" in
1486                 '') ans='';;
1487                 esac;;
1488         esac;;
1489 esac
1490 while expr "X\$ans" : "X!" >/dev/null; do
1491         read answ
1492         set x \$xxxm
1493         shift
1494         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1495         case  "\$answ" in
1496         "!")
1497                 sh 1>&4
1498                 echo " "
1499                 $myecho
1500                 ;;
1501         !*)
1502                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1503                 shift
1504                 sh 1>&4 -c "\$*"
1505                 echo " "
1506                 $myecho
1507                 ;;
1508         "\$ans")
1509                 case "\$ans" in
1510                 \\&*)
1511                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1512                         shift
1513                         case "\$1" in
1514                         -d)
1515                                 fastread=yes
1516                                 echo "(OK, I'll run with -d after this question.)" >&4
1517                                 ;;
1518                         -*)
1519                                 echo "*** Sorry, \$1 not supported yet." >&4
1520                                 ;;
1521                         esac
1522                         $myecho
1523                         ans=!
1524                         ;;
1525                 esac;;
1526         *)
1527                 case "\$aok" in
1528                 y)
1529                         echo "*** Substitution done -- please confirm."
1530                         xxxm="\$ans"
1531                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1532                         xxxm="\$ans"
1533                         ans=!
1534                         ;;
1535                 *)
1536                         echo "*** Error -- try again."
1537                         ans=!
1538                         ;;
1539                 esac
1540                 $myecho
1541                 ;;
1542         esac
1543         case "\$ans\$xxxm\$nostick" in
1544         '')
1545                 ans=!
1546                 $myecho
1547                 ;;
1548         esac
1549 done
1550 case "\$ans" in
1551 '') ans="\$xxxm";;
1552 esac
1553 EOSC
1554
1555 : create .config dir to save info across Configure sessions
1556 test -d ../.config || mkdir ../.config
1557 cat >../.config/README <<EOF
1558 This directory created by Configure to save information that should
1559 persist across sessions for $package.
1560
1561 You may safely delete it if you wish.
1562 EOF
1563
1564 : general instructions
1565 needman=true
1566 firsttime=true
1567 user=`(logname) 2>/dev/null`
1568 case "$user" in
1569 '') user=`whoami 2>&1`;;
1570 esac
1571 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1572         firsttime=false
1573         echo " "
1574         rp='Would you like to see the instructions?'
1575         dflt=n
1576         . ./myread
1577         case "$ans" in
1578         [yY]*) ;;
1579         *) needman=false;;
1580         esac
1581 fi
1582 if $needman; then
1583         cat <<EOH
1584
1585 This installation shell script will examine your system and ask you questions
1586 to determine how the perl5 package should be installed. If you get
1587 stuck on a question, you may use a ! shell escape to start a subshell or
1588 execute a command.  Many of the questions will have default answers in square
1589 brackets; typing carriage return will give you the default.
1590
1591 On some of the questions which ask for file or directory names you are allowed
1592 to use the ~name construct to specify the login directory belonging to "name",
1593 even if you don't have a shell which knows about that.  Questions where this is
1594 allowed will be marked "(~name ok)".
1595
1596 EOH
1597         rp=''
1598         dflt='Type carriage return to continue'
1599         . ./myread
1600         cat <<'EOH'
1601
1602 The prompter used in this script allows you to use shell variables and
1603 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1604 in the default answer, as if the default line was a set of arguments given to a
1605 script shell.  This means you may also use $* to repeat the whole default line,
1606 so you do not have to re-type everything to add something to the default.
1607
1608 Everytime there is a substitution, you will have to confirm.  If there is an
1609 error (e.g. an unmatched backtick), the default answer will remain unchanged
1610 and you will be prompted again.
1611
1612 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1613 the questions and use the computed defaults (or the previous answers if there
1614 was already a config.sh file). Type 'Configure -h' for a list of options.
1615 You may also start interactively and then answer '& -d' at any prompt to turn
1616 on the non-interactive behaviour for the remainder of the execution.
1617
1618 EOH
1619         . ./myread
1620         cat <<EOH
1621
1622 Much effort has been expended to ensure that this shell script will run on any
1623 Unix system.  If despite that it blows up on yours, your best bet is to edit
1624 Configure and run it again.  If you can't run Configure for some reason,
1625 you'll have to generate a config.sh file by hand.  Whatever problems you
1626 have, let me (jhi@iki.fi) know how I blew it.
1627
1628 This installation script affects things in two ways:
1629
1630 1) it may do direct variable substitutions on some of the files included
1631    in this kit.
1632 2) it builds a config.h file for inclusion in C programs.  You may edit
1633    any of these files as the need arises after running this script.
1634
1635 If you make a mistake on a question, there is no easy way to back up to it
1636 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1637 files.  Configure will offer to let you do this before it runs the SH files.
1638
1639 EOH
1640         dflt='Type carriage return to continue'
1641         . ./myread
1642         case "$firsttime" in
1643         true) echo $user >>../.config/instruct;;
1644         esac
1645 fi
1646
1647 : find out where common programs are
1648 echo " "
1649 echo "Locating common programs..." >&4
1650 cat <<EOSC >loc
1651 $startsh
1652 case \$# in
1653 0) exit 1;;
1654 esac
1655 thing=\$1
1656 shift
1657 dflt=\$1
1658 shift
1659 for dir in \$*; do
1660         case "\$thing" in
1661         .)
1662         if test -d \$dir/\$thing; then
1663                 echo \$dir
1664                 exit 0
1665         fi
1666         ;;
1667         *)
1668         for thisthing in \$dir/\$thing; do
1669                 : just loop through to pick last item
1670         done
1671         if test -f \$thisthing; then
1672                 echo \$thisthing
1673                 exit 0
1674         elif test -f \$dir/\$thing.exe; then
1675                 if test -n "$DJGPP"; then
1676                         echo \$dir/\$thing.exe
1677                 else
1678                         : on Eunice apparently
1679                         echo \$dir/\$thing
1680                 fi
1681                 exit 0
1682         fi
1683         ;;
1684         esac
1685 done
1686 echo \$dflt
1687 exit 1
1688 EOSC
1689 chmod +x loc
1690 $eunicefix loc
1691 loclist="
1692 awk
1693 cat
1694 comm
1695 cp
1696 echo
1697 expr
1698 grep
1699 ls
1700 make
1701 mkdir
1702 rm
1703 sed
1704 sort
1705 touch
1706 tr
1707 uniq
1708 "
1709 trylist="
1710 Mcc
1711 ar
1712 byacc
1713 cpp
1714 csh
1715 date
1716 egrep
1717 gzip
1718 less
1719 ln
1720 more
1721 nm
1722 nroff
1723 pg
1724 tee
1725 test
1726 uname
1727 zip
1728 "
1729 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1730 pth="$pth /lib /usr/lib"
1731 for file in $loclist; do
1732         eval xxx=\$$file
1733         case "$xxx" in
1734         /*|?:[\\/]*)
1735                 if test -f "$xxx"; then
1736                         : ok
1737                 else
1738                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1739                         xxx=`./loc $file $file $pth`
1740                 fi
1741                 ;;
1742         '') xxx=`./loc $file $file $pth`;;
1743         *) xxx=`./loc $xxx $xxx $pth`;;
1744         esac
1745         eval $file=$xxx
1746         eval _$file=$xxx
1747         case "$xxx" in
1748         /*)
1749                 echo $file is in $xxx.
1750                 ;;
1751         ?:[\\/]*)
1752                 echo $file is in $xxx.
1753                 ;;
1754         *)
1755                 echo "I don't know where '$file' is, and my life depends on it." >&4
1756                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1757                 exit 1
1758                 ;;
1759         esac
1760 done
1761 echo " "
1762 echo "Don't worry if any of the following aren't found..."
1763 say=offhand
1764 for file in $trylist; do
1765         eval xxx=\$$file
1766         case "$xxx" in
1767         /*|?:[\\/]*)
1768                 if test -f "$xxx"; then
1769                         : ok
1770                 else
1771                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1772                         xxx=`./loc $file $file $pth`
1773                 fi
1774                 ;;
1775         '') xxx=`./loc $file $file $pth`;;
1776         *) xxx=`./loc $xxx $xxx $pth`;;
1777         esac
1778         eval $file=$xxx
1779         eval _$file=$xxx
1780         case "$xxx" in
1781         /*)
1782                 echo $file is in $xxx.
1783                 ;;
1784         ?:[\\/]*)
1785                 echo $file is in $xxx.
1786                 ;;
1787         *)
1788                 echo "I don't see $file out there, $say."
1789                 say=either
1790                 ;;
1791         esac
1792 done
1793 case "$egrep" in
1794 egrep)
1795         echo "Substituting grep for egrep."
1796         egrep=$grep
1797         ;;
1798 esac
1799 case "$ln" in
1800 ln)
1801         echo "Substituting cp for ln."
1802         ln=$cp
1803         ;;
1804 esac
1805 case "$test" in
1806 test)
1807         echo "Hopefully test is built into your sh."
1808         ;;
1809 *)
1810         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1811                 echo "Using the test built into your sh."
1812                 test=test
1813                 _test=test
1814         fi
1815         ;;
1816 esac
1817 case "$echo" in
1818 echo)
1819         echo "Hopefully echo is built into your sh."
1820         ;;
1821 '') ;;
1822 *)
1823         echo " "
1824 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1825         $echo $n "hi there$c" >foo1
1826         echo $n "hi there$c" >foo2
1827         if cmp foo1 foo2 >/dev/null 2>&1; then
1828                 echo "They are compatible.  In fact, they may be identical."
1829         else
1830                 case "$n" in
1831                 '-n') n='' c='\c';;
1832                 *) n='-n' c='';;
1833                 esac
1834                 cat <<FOO
1835 They are not compatible!  You are probably running ksh on a non-USG system.
1836 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1837 have echo built in and we may have to run some Bourne shell scripts.  That
1838 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1839
1840 FOO
1841                 $echo $n "The star should be here-->$c"
1842                 $echo "*"
1843         fi
1844         $rm -f foo1 foo2
1845         ;;
1846 esac
1847
1848 : determine whether symbolic links are supported
1849 echo " "
1850 $touch blurfl
1851 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1852         echo "Symbolic links are supported." >&4
1853         lns="$ln -s"
1854 else
1855         echo "Symbolic links are NOT supported." >&4
1856         lns="$ln"
1857 fi
1858 $rm -f blurfl sym
1859
1860 : see whether [:lower:] and [:upper:] are supported character classes
1861 echo " "
1862 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1863 ABYZ)
1864         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1865         up='[:upper:]'
1866         low='[:lower:]'
1867         ;;
1868 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1869         # (0xc9 and 0xd1), therefore that is a nice testing point.
1870         if test "X$up" = X -o "X$low" = X; then
1871             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1872             ij) up='[A-Z]'
1873                 low='[a-z]'
1874                 ;;
1875             esac
1876         fi
1877         if test "X$up" = X -o "X$low" = X; then
1878             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1879             ij) up='A-Z'
1880                 low='a-z'
1881                 ;;
1882             esac
1883         fi
1884         if test "X$up" = X -o "X$low" = X; then
1885             case "`echo IJ | od -x 2>/dev/null`" in
1886             *C9D1*|*c9d1*)
1887                 echo "Hey, this might be EBCDIC." >&4
1888                 if test "X$up" = X -o "X$low" = X; then
1889                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1890                     ij) up='[A-IJ-RS-Z]'
1891                         low='[a-ij-rs-z]'
1892                         ;;
1893                     esac
1894                 fi
1895                 if test "X$up" = X -o "X$low" = X; then
1896                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1897                     ij) up='A-IJ-RS-Z'
1898                         low='a-ij-rs-z'
1899                         ;;
1900                     esac
1901                 fi
1902                 ;;
1903             esac
1904         fi
1905 esac
1906 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1907 ij)
1908     echo "Using $up and $low to convert case." >&4
1909     ;;
1910 *)
1911     echo "I don't know how to translate letters from upper to lower case." >&4
1912     echo "Your tr is not acting any way I know of." >&4
1913     exit 1
1914     ;;
1915 esac
1916 : set up the translation script tr, must be called with ./tr of course
1917 cat >tr <<EOSC
1918 $startsh
1919 case "\$1\$2" in
1920 '[A-Z][a-z]') exec $tr '$up' '$low';;
1921 '[a-z][A-Z]') exec $tr '$low' '$up';;
1922 esac
1923 exec $tr "\$@"
1924 EOSC
1925 chmod +x tr
1926 $eunicefix tr
1927
1928 : Try to determine whether config.sh was made on this system
1929 case "$config_sh" in
1930 '')
1931 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1932 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
1933 # because the A-Z/a-z are not consecutive.
1934 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1935         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1936 newmyuname="$myuname"
1937 dflt=n
1938 case "$knowitall" in
1939 '')
1940         if test -f ../config.sh; then
1941                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1942                         eval "`grep myuname= ../config.sh`"
1943                 fi
1944                 if test "X$myuname" = "X$newmyuname"; then
1945                         dflt=y
1946                 fi
1947         fi
1948         ;;
1949 *) dflt=y;;
1950 esac
1951
1952 : Get old answers from old config file if Configure was run on the
1953 : same system, otherwise use the hints.
1954 hint=default
1955 cd ..
1956 if test -f config.sh; then
1957         echo " "
1958         rp="I see a config.sh file.  Shall I use it to set the defaults?"
1959         . UU/myread
1960         case "$ans" in
1961         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1962         *)  echo "Fetching default answers from your old config.sh file..." >&4
1963                 tmp_n="$n"
1964                 tmp_c="$c"
1965                 tmp_sh="$sh"
1966                 . ./config.sh
1967                 cp config.sh UU
1968                 n="$tmp_n"
1969                 c="$tmp_c"
1970                 : Older versions did not always set $sh.  Catch re-use of such
1971                 : an old config.sh.
1972                 case "$sh" in
1973                 '') sh="$tmp_sh" ;;
1974                 esac
1975                 hint=previous
1976                 ;;
1977         esac
1978 fi
1979 if test ! -f config.sh; then
1980         $cat <<EOM
1981
1982 First time through, eh?  I have some defaults handy for some systems
1983 that need some extra help getting the Configure answers right:
1984
1985 EOM
1986         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
1987         dflt=''
1988         : Half the following guesses are probably wrong... If you have better
1989         : tests or hints, please send them to jhi@iki.fi
1990         : The metaconfig authors would also appreciate a copy...
1991         $test -f /irix && osname=irix
1992         $test -f /xenix && osname=sco_xenix
1993         $test -f /dynix && osname=dynix
1994         $test -f /dnix && osname=dnix
1995         $test -f /lynx.os && osname=lynxos
1996         $test -f /unicos && osname=unicos && osvers=`$uname -r`
1997         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
1998         $test -f /bin/mips && /bin/mips && osname=mips
1999         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2000                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2001         $test -d /usr/apollo/bin && osname=apollo
2002         $test -f /etc/saf/_sactab && osname=svr4
2003         $test -d /usr/include/minix && osname=minix
2004         if $test -d /MachTen -o -d /MachTen_Folder; then
2005                 osname=machten
2006                 if $test -x /sbin/version; then
2007                         osvers=`/sbin/version | $awk '{print $2}' |
2008                         $sed -e 's/[A-Za-z]$//'`
2009                 elif $test -x /usr/etc/version; then
2010                         osvers=`/usr/etc/version | $awk '{print $2}' |
2011                         $sed -e 's/[A-Za-z]$//'`
2012                 else
2013                         osvers="$2.$3"
2014                 fi
2015         fi
2016        $test -f /sys/posix.dll &&
2017                $test -f /usr/bin/what &&
2018                set X `/usr/bin/what /sys/posix.dll` &&
2019                $test "$3" = UWIN &&
2020                osname=uwin &&
2021                osvers="$5"
2022         if $test -f $uname; then
2023                 set X $myuname
2024                 shift
2025
2026                 case "$5" in
2027                 fps*) osname=fps ;;
2028                 mips*)
2029                         case "$4" in
2030                         umips) osname=umips ;;
2031                         *) osname=mips ;;
2032                         esac;;
2033                 [23]100) osname=mips ;;
2034                 next*) osname=next ;;
2035                 i386*)
2036                         if $test -f /etc/kconfig; then
2037                                 osname=isc
2038                                 if test "$lns" = "ln -s"; then
2039                                         osvers=4
2040                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2041                                         osvers=3
2042                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2043                                         osvers=2
2044                                 fi
2045                         fi
2046                         ;;
2047                 pc*)
2048                         if test -n "$DJGPP"; then
2049                                 osname=dos
2050                                 osvers=djgpp
2051                         fi
2052                         ;;
2053                 esac
2054
2055                 case "$1" in
2056                 aix) osname=aix
2057                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2058                         case "$tmp" in
2059                         'not found') osvers="$4"."$3" ;;
2060                         '<3240'|'<>3240') osvers=3.2.0 ;;
2061                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2062                         '=3250'|'>3250') osvers=3.2.5 ;;
2063                         *) osvers=$tmp;;
2064                         esac
2065                         ;;
2066                 *dc.osx) osname=dcosx
2067                         osvers="$3"
2068                         ;;
2069                 dnix) osname=dnix
2070                         osvers="$3"
2071                         ;;
2072                 domainos) osname=apollo
2073                         osvers="$3"
2074                         ;;
2075                 dgux) osname=dgux 
2076                         osvers="$3"
2077                         ;;
2078                 dynixptx*) osname=dynixptx
2079                         osvers="$3"
2080                         ;;
2081                 freebsd) osname=freebsd 
2082                         osvers="$3" ;;
2083                 genix) osname=genix ;;
2084                 hp*) osname=hpux 
2085                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2086                         ;;
2087                 irix*) osname=irix
2088                         case "$3" in
2089                         4*) osvers=4 ;;
2090                         5*) osvers=5 ;;
2091                         *)      osvers="$3" ;;
2092                         esac
2093                         ;;
2094                 linux) osname=linux
2095                         case "$3" in
2096                         *)      osvers="$3" ;;
2097                         esac
2098                         ;;
2099                 MiNT) osname=mint
2100                         ;;
2101                 netbsd*) osname=netbsd
2102                         osvers="$3"
2103                         ;;
2104                 news-os) osvers="$3"
2105                         case "$3" in
2106                         4*) osname=newsos4 ;;
2107                         *) osname=newsos ;;
2108                         esac
2109                         ;;
2110                 bsd386) osname=bsd386
2111                         osvers=`$uname -r`
2112                         ;;
2113                 powerux | power_ux | powermax_os | powermaxos | \
2114                 powerunix | power_unix) osname=powerux
2115                         osvers="$3"
2116                         ;;
2117                 next*) osname=next ;;
2118                 solaris) osname=solaris
2119                         case "$3" in
2120                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2121                         *)      osvers="$3" ;;
2122                         esac
2123                         ;;
2124                 sunos) osname=sunos
2125                         case "$3" in
2126                         5*) osname=solaris
2127                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2128                         *)      osvers="$3" ;;
2129                         esac
2130                         ;;
2131                 titanos) osname=titanos
2132                         case "$3" in
2133                         1*) osvers=1 ;;
2134                         2*) osvers=2 ;;
2135                         3*) osvers=3 ;;
2136                         4*) osvers=4 ;;
2137                         *)      osvers="$3" ;;
2138                         esac
2139                         ;;
2140                 ultrix) osname=ultrix
2141                         osvers="$3"
2142                         ;;
2143                 osf1|mls+)      case "$5" in
2144                                 alpha)
2145                                         osname=dec_osf
2146                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2147                                         ;;
2148                         hp*)    osname=hp_osf1  ;;
2149                         mips)   osname=mips_osf1 ;;
2150                         esac
2151                         ;;
2152                 uts) osname=uts 
2153                         osvers="$3"
2154                         ;;
2155                 qnx) osname=qnx
2156                         osvers="$4"
2157                         ;;
2158                 $2) case "$osname" in
2159                         *isc*) ;;
2160                         *freebsd*) ;;
2161                         svr*)
2162                                 : svr4.x or possibly later
2163                                 case "svr$3" in 
2164                                 ${osname}*)
2165                                         osname=svr$3
2166                                         osvers=$4
2167                                         ;;
2168                                 esac
2169                                 case "$osname" in
2170                                 svr4.0)
2171                                         : Check for ESIX
2172                                         if test -f /stand/boot ; then
2173                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2174                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2175                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2176                                                         if test -n "$isesix"; then
2177                                                                 osname=esix4
2178                                                         fi
2179                                                 fi
2180                                         fi
2181                                         ;;
2182                                 esac
2183                                 ;;
2184                         *)      if test -f /etc/systemid; then
2185                                         osname=sco
2186                                         set `echo $3 | $sed 's/\./ /g'` $4
2187                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2188                                                 osvers=$1.$2.$3
2189                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2190                                                 osvers=$1.$2
2191                                         elif $test -f $src/hints/sco_$1.sh; then
2192                                                 osvers=$1
2193                                         fi
2194                                 else
2195                                         case "$osname" in
2196                                         '') : Still unknown.  Probably a generic Sys V.
2197                                                 osname="sysv"
2198                                                 osvers="$3"
2199                                                 ;;
2200                                         esac
2201                                 fi
2202                                 ;;
2203                         esac
2204                         ;;
2205                 *)      case "$osname" in
2206                         '') : Still unknown.  Probably a generic BSD.
2207                                 osname="$1"
2208                                 osvers="$3"
2209                                 ;;
2210                         esac
2211                         ;;
2212                 esac
2213         else
2214                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2215                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2216                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2217                                 osname=news_os
2218                         fi
2219                         $rm -f UU/kernel.what
2220                 elif test -d c:/.; then
2221                         set X $myuname
2222                         osname=os2
2223                         osvers="$5"
2224                 fi
2225         fi
2226         
2227         : Now look for a hint file osname_osvers, unless one has been
2228         : specified already.
2229         case "$hintfile" in
2230         ''|' ')
2231                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2232                 : Also try without trailing minor version numbers.
2233                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2234                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2235                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2236                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2237                 case "$file" in
2238                 '') dflt=none ;;
2239                 *)  case "$osvers" in
2240                         '') dflt=$file
2241                                 ;;
2242                         *)  if $test -f $src/hints/$file.sh ; then
2243                                         dflt=$file
2244                                 elif $test -f $src/hints/$xfile.sh ; then
2245                                         dflt=$xfile
2246                                 elif $test -f $src/hints/$xxfile.sh ; then
2247                                         dflt=$xxfile
2248                                 elif $test -f $src/hints/$xxxfile.sh ; then
2249                                         dflt=$xxxfile
2250                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2251                                         dflt=$xxxxfile
2252                                 elif $test -f "$src/hints/${osname}.sh" ; then
2253                                         dflt="${osname}"
2254                                 else
2255                                         dflt=none
2256                                 fi
2257                                 ;;
2258                         esac
2259                         ;;
2260                 esac
2261                 if $test -f Policy.sh ; then
2262                         case "$dflt" in
2263                         *Policy*) ;;
2264                         none) dflt="Policy" ;;
2265                         *) dflt="Policy $dflt" ;;
2266                         esac
2267                 fi
2268                 ;;
2269         *)
2270                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2271                 ;;
2272         esac
2273
2274         if $test -f Policy.sh ; then
2275                 $cat <<EOM
2276
2277 There's also a Policy hint file available, which should make the
2278 site-specific (policy) questions easier to answer.
2279 EOM
2280
2281         fi
2282
2283         $cat <<EOM
2284
2285 You may give one or more space-separated answers, or "none" if appropriate.
2286 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2287 is a good thing.  DO NOT give a wrong version.
2288
2289 EOM
2290
2291         rp="Which of these apply, if any?"
2292         . UU/myread
2293         tans=$ans
2294         for file in $tans; do
2295                 if $test X$file = XPolicy -a -f Policy.sh; then
2296                         . Policy.sh
2297                         $cat Policy.sh >> UU/config.sh
2298                 elif $test -f $src/hints/$file.sh; then
2299                         . $src/hints/$file.sh
2300                         $cat $src/hints/$file.sh >> UU/config.sh
2301                 elif $test X$tans = X -o X$tans = Xnone ; then
2302                         : nothing
2303                 else
2304                         : Give one chance to correct a possible typo.
2305                         echo "$file.sh does not exist"
2306                         dflt=$file
2307                         rp="hint to use instead?"
2308                         . UU/myread
2309                         for file in $ans; do
2310                                 if $test -f "$src/hints/$file.sh"; then
2311                                         . $src/hints/$file.sh
2312                                         $cat $src/hints/$file.sh >> UU/config.sh
2313                                 elif $test X$ans = X -o X$ans = Xnone ; then
2314                                         : nothing
2315                                 else
2316                                         echo "$file.sh does not exist -- ignored."
2317                                 fi
2318                         done
2319                 fi
2320         done
2321
2322         hint=recommended
2323         : Remember our hint file for later.
2324         if $test -f "$src/hints/$file.sh" ; then
2325                 hintfile="$file"
2326         else
2327                 hintfile=''
2328         fi
2329 fi
2330 cd UU
2331 ;;
2332 *)
2333         echo " "
2334         echo "Fetching default answers from $config_sh..." >&4
2335         tmp_n="$n"
2336         tmp_c="$c"
2337         cd ..
2338         cp $config_sh config.sh 2>/dev/null
2339         chmod +w config.sh
2340         . ./config.sh
2341         cd UU
2342         cp ../config.sh .
2343         n="$tmp_n"
2344         c="$tmp_c"
2345         hint=previous
2346         ;;
2347 esac
2348 test "$override" && . ./optdef.sh
2349 myuname="$newmyuname"
2350
2351 : Restore computed paths
2352 for file in $loclist $trylist; do
2353         eval $file="\$_$file"
2354 done
2355
2356 cat << EOM
2357
2358 Configure uses the operating system name and version to set some defaults.
2359 The default value is probably right if the name rings a bell. Otherwise,
2360 since spelling matters for me, either accept the default or answer "none"
2361 to leave it blank.
2362
2363 EOM
2364 case "$osname" in
2365         ''|' ')
2366                 case "$hintfile" in
2367                 ''|' '|none) dflt=none ;;
2368                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2369                 esac
2370                 ;;
2371         *) dflt="$osname" ;;
2372 esac
2373 rp="Operating system name?"
2374 . ./myread
2375 case "$ans" in
2376 none)  osname='' ;;
2377 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2378 esac
2379 echo " "
2380 case "$osvers" in
2381         ''|' ')
2382                 case "$hintfile" in
2383                 ''|' '|none) dflt=none ;;
2384                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2385                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2386                         case "$dflt" in
2387                         ''|' ') dflt=none ;;
2388                         esac
2389                         ;;
2390                 esac
2391                 ;;
2392         *) dflt="$osvers" ;;
2393 esac
2394 rp="Operating system version?"
2395 . ./myread
2396 case "$ans" in
2397 none)  osvers='' ;;
2398 *) osvers="$ans" ;;
2399 esac
2400
2401 : who configured the system
2402 cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
2403 cf_by=`(logname) 2>/dev/null`
2404 case "$cf_by" in
2405 "")
2406         cf_by=`(whoami) 2>/dev/null`
2407         case "$cf_by" in
2408         "") cf_by=unknown ;;
2409         esac ;;
2410 esac
2411
2412 : set up the script used to warn in case of inconsistency
2413 cat <<EOS >whoa
2414 $startsh
2415 EOS
2416 cat <<'EOSC' >>whoa
2417 dflt=y
2418 echo " "
2419 echo "*** WHOA THERE!!! ***" >&4
2420 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2421 rp="    Keep the $hint value?"
2422 . ./myread
2423 case "$ans" in
2424 y) td=$was; tu=$was;;
2425 esac
2426 EOSC
2427
2428 : function used to set $1 to $val
2429 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2430 case "$val$was" in
2431 $define$undef) . ./whoa; eval "$var=\$td";;
2432 $undef$define) . ./whoa; eval "$var=\$tu";;
2433 *) eval "$var=$val";;
2434 esac'
2435
2436 cat <<EOM
2437
2438 Perl can be built to take advantage of threads, on some systems.
2439 To do so, Configure must be run with -Dusethreads.
2440 (See README.threads for details.)
2441 EOM
2442 case "$usethreads" in
2443 $define|true|[yY]*)     dflt='y';;
2444 *) dflt='n';;
2445 esac
2446 rp='Build a threading Perl?'
2447 . ./myread
2448 case "$ans" in
2449 y|Y)    val="$define" ;;     
2450 *)      val="$undef" ;;
2451 esac
2452 set usethreads
2453 eval $setvar 
2454 : Look for a hint-file generated 'call-back-unit'.  Now that the
2455 : user has specified if a threading perl is to be built, we may need 
2456 : to set or change some other defaults.
2457 if $test -f usethreads.cbu; then
2458     . ./usethreads.cbu
2459 fi
2460 case "$d_oldpthreads" in
2461 '')     : Configure tests would be welcome here.  For now, assume undef.
2462         val="$undef" ;;
2463 *)      val="$d_oldpthreads" ;;
2464 esac
2465 set d_oldpthreads
2466 eval $setvar
2467
2468 cat <<EOM
2469
2470 Perl can be built so that multiple Perl interpreters can coexist
2471 within the same Perl executable.  To do so, Configure must be run with
2472 -Dusemultiplicity.
2473
2474 Normally you do not need this and you should answer no.
2475
2476 EOM
2477 case "$usemultiplicity" in
2478 $define|true|[yY]*)     dflt='y';;
2479 *) dflt='n';;
2480 esac
2481 rp='Build Perl for multiplicity?'
2482 . ./myread
2483 case "$ans" in
2484 y|Y)    val="$define" ;;     
2485 *)      val="$undef" ;;
2486 esac
2487 set usemultiplicity
2488 eval $setvar 
2489
2490 cat <<EOM
2491
2492 Perl can be built to take advantage of explicit 64-bit interfaces,
2493 on some systems.  To do so, Configure must be run with -Duse64bits.
2494
2495 If this doesn't make any sense to you, just accept the default 'n'.
2496 EOM
2497 case "$use64bits" in
2498 $define|true|[yY]*)     dflt='y';;
2499 *) dflt='n';;
2500 esac
2501 rp='Try to use explicit 64-bit interfaces, if available?'
2502 . ./myread
2503 case "$ans" in
2504 y|Y) 
2505         val="$define"
2506         ;;     
2507 *)      
2508         val="$undef"
2509         ;;
2510 esac
2511 set use64bits
2512 eval $setvar
2513
2514 archname64=''
2515
2516 : determine the architecture name
2517 echo " "
2518 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2519         tarch=`arch`"-$osname"
2520 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2521         if uname -m > tmparch 2>&1 ; then
2522                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
2523                         -e 's/$/'"-$osname/" tmparch`
2524         else
2525                 tarch="$osname"
2526         fi
2527         $rm -f tmparch
2528 else
2529         tarch="$osname"
2530 fi
2531 case "$myarchname" in
2532 ''|"$tarch") ;;
2533 *)
2534         echo "(Your architecture name used to be $myarchname.)"
2535         archname=''
2536         ;;
2537 esac
2538 myarchname="$tarch"
2539 case "$archname" in
2540 '') dflt="$tarch";;
2541 *) dflt="$archname";;
2542 esac
2543 rp='What is your architecture name'
2544 . ./myread
2545 archname="$ans"
2546 case "$usethreads" in
2547 $define)
2548         echo "Threads selected." >&4
2549         case "$archname" in
2550         *-thread*) echo "...and architecture name already has -thread." >&4
2551                 ;;
2552         *)      archname="$archname-thread"
2553                 echo "...setting architecture name to $archname." >&4
2554                 ;;
2555         esac
2556         ;;
2557 esac
2558 case "$usemultiplicity" in
2559 $define)
2560         echo "Multiplicity selected." >&4
2561         case "$archname" in
2562         *-multi*) echo "...and architecture name already has -multi." >&4
2563                 ;;
2564         *)      archname="$archname-multi"
2565                 echo "...setting architecture name to $archname." >&4
2566                 ;;
2567         esac
2568         ;;
2569 esac
2570 case "$use64bits" in
2571 $define)
2572         echo "Explicit 64-bitness selected." >&4
2573         case "$archname64" in
2574         '')
2575                 ;;
2576         *)
2577                 case "$archname" in
2578                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2579                         ;;
2580                 *)      archname="$archname-$archname64"
2581                         echo "...setting architecture name to $archname." >&4
2582                         ;;
2583                 esac
2584                 ;;
2585         esac
2586 esac
2587
2588 : is AFS running?
2589 echo " "
2590 case "$afs" in
2591 $define|true)   afs=true ;;
2592 $undef|false)   afs=false ;;
2593 *)      if test -d /afs; then
2594                 afs=true
2595         else
2596                 afs=false
2597         fi
2598         ;;
2599 esac
2600 if $afs; then
2601         echo "AFS may be running... I'll be extra cautious then..." >&4
2602 else
2603         echo "AFS does not seem to be running..." >&4
2604 fi
2605
2606 : decide how portable to be.  Allow command line overrides.
2607 case "$d_portable" in
2608 "$undef") ;;
2609 *)      d_portable="$define" ;;
2610 esac
2611
2612 : set up shell script to do ~ expansion
2613 cat >filexp <<EOSS
2614 $startsh
2615 : expand filename
2616 case "\$1" in
2617  ~/*|~)
2618         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2619         ;;
2620  ~*)
2621         if $test -f /bin/csh; then
2622                 /bin/csh -f -c "glob \$1"
2623                 failed=\$?
2624                 echo ""
2625                 exit \$failed
2626         else
2627                 name=\`$expr x\$1 : '..\([^/]*\)'\`
2628                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2629                 if $test ! -d "\$dir"; then
2630                         me=\`basename \$0\`
2631                         echo "\$me: can't locate home directory for: \$name" >&2
2632                         exit 1
2633                 fi
2634                 case "\$1" in
2635                 */*)
2636                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2637                         ;;
2638                 *)
2639                         echo \$dir
2640                         ;;
2641                 esac
2642         fi
2643         ;;
2644 *)
2645         echo \$1
2646         ;;
2647 esac
2648 EOSS
2649 chmod +x filexp
2650 $eunicefix filexp
2651
2652 : now set up to get a file name
2653 cat <<EOS >getfile
2654 $startsh
2655 EOS
2656 cat <<'EOSC' >>getfile
2657 tilde=''
2658 fullpath=''
2659 already=''
2660 skip=''
2661 none_ok=''
2662 exp_file=''
2663 nopath_ok=''
2664 orig_rp="$rp"
2665 orig_dflt="$dflt"
2666
2667 case "$fn" in
2668 *\(*)
2669         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
2670         fn=`echo $fn | sed 's/(.*)//'`
2671         ;;
2672 esac
2673
2674 case "$fn" in
2675 *:*)
2676         loc_file=`expr $fn : '.*:\(.*\)'`
2677         fn=`expr $fn : '\(.*\):.*'`
2678         ;;
2679 esac
2680
2681 case "$fn" in
2682 *~*) tilde=true;;
2683 esac
2684 case "$fn" in
2685 */*) fullpath=true;;
2686 esac
2687 case "$fn" in
2688 *+*) skip=true;;
2689 esac
2690 case "$fn" in
2691 *n*) none_ok=true;;
2692 esac
2693 case "$fn" in
2694 *e*) exp_file=true;;
2695 esac
2696 case "$fn" in
2697 *p*) nopath_ok=true;;
2698 esac
2699
2700 case "$fn" in
2701 *f*) type='File';;
2702 *d*) type='Directory';;
2703 *l*) type='Locate';;
2704 esac
2705
2706 what="$type"
2707 case "$what" in
2708 Locate) what='File';;
2709 esac
2710
2711 case "$exp_file" in
2712 '')
2713         case "$d_portable" in
2714         "$define") ;;
2715         *) exp_file=true;;
2716         esac
2717         ;;
2718 esac
2719
2720 cd ..
2721 while test "$type"; do
2722         redo=''
2723         rp="$orig_rp"
2724         dflt="$orig_dflt"
2725         case "$tilde" in
2726         true) rp="$rp (~name ok)";;
2727         esac
2728         . UU/myread
2729         if test -f UU/getfile.ok && \
2730                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2731         then
2732                 value="$ans"
2733                 ansexp="$ans"
2734                 break
2735         fi
2736         case "$ans" in
2737         none)
2738                 value=''
2739                 ansexp=''
2740                 case "$none_ok" in
2741                 true) type='';;
2742                 esac
2743                 ;;
2744         *)
2745                 case "$tilde" in
2746                 '') value="$ans"
2747                         ansexp="$ans";;
2748                 *)
2749                         value=`UU/filexp $ans`
2750                         case $? in
2751                         0)
2752                                 if test "$ans" != "$value"; then
2753                                         echo "(That expands to $value on this system.)"
2754                                 fi
2755                                 ;;
2756                         *) value="$ans";;
2757                         esac
2758                         ansexp="$value"
2759                         case "$exp_file" in
2760                         '') value="$ans";;
2761                         esac
2762                         ;;
2763                 esac
2764                 case "$fullpath" in
2765                 true)
2766                         case "$ansexp" in
2767                         /*) value="$ansexp" ;;
2768                         *)
2769                                 redo=true
2770                                 case "$already" in
2771                                 true)
2772                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
2773                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
2774                                         ;;
2775                                 *)
2776                                 echo "Please give a full path name, starting with slash." >&4
2777                                         case "$tilde" in
2778                                         true)
2779                                 echo "Note that using ~name is ok provided it expands well." >&4
2780                                                 already=true
2781                                                 ;;
2782                                         esac
2783                                 esac
2784                                 ;;
2785                         esac
2786                         ;;
2787                 esac
2788                 case "$redo" in
2789                 '')
2790                         case "$type" in
2791                         File)
2792                                 if test -f "$ansexp"; then
2793                                         type=''
2794                                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2795                                 then
2796                                         echo "($value is not a plain file, but that's ok.)"
2797                                         type=''
2798                                 fi
2799                                 ;;
2800                         Directory)
2801                                 if test -d "$ansexp"; then
2802                                         type=''
2803                                 fi
2804                                 ;;
2805                         Locate)
2806                                 if test -d "$ansexp"; then
2807                                         echo "(Looking for $loc_file in directory $value.)"
2808                                         value="$value/$loc_file"
2809                                         ansexp="$ansexp/$loc_file"
2810                                 fi
2811                                 if test -f "$ansexp"; then
2812                                         type=''
2813                                 fi
2814                                 case "$nopath_ok" in
2815                                 true)   case "$value" in
2816                                         */*) ;;
2817                                         *)      echo "Assuming $value will be in people's path."
2818                                                 type=''
2819                                                 ;;
2820                                         esac
2821                                         ;;
2822                                 esac
2823                                 ;;
2824                         esac
2825
2826                         case "$skip" in
2827                         true) type='';
2828                         esac
2829
2830                         case "$type" in
2831                         '') ;;
2832                         *)
2833                                 if test "$fastread" = yes; then
2834                                         dflt=y
2835                                 else
2836                                         dflt=n
2837                                 fi
2838                                 rp="$what $value doesn't exist.  Use that name anyway?"
2839                                 . UU/myread
2840                                 dflt=''
2841                                 case "$ans" in
2842                                 y*) type='';;
2843                                 *) echo " ";;
2844                                 esac
2845                                 ;;
2846                         esac
2847                         ;;
2848                 esac
2849                 ;;
2850         esac
2851 done
2852 cd UU
2853 ans="$value"
2854 rp="$orig_rp"
2855 dflt="$orig_dflt"
2856 rm -f getfile.ok
2857 EOSC
2858
2859 : determine root of directory hierarchy where package will be installed.
2860 case "$prefix" in
2861 '')
2862         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2863         ;;
2864 *)
2865         dflt="$prefix"
2866         ;;
2867 esac
2868 $cat <<EOM
2869
2870 By default, $package will be installed in $dflt/bin, manual
2871 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2872 all installation directories. Typically set to /usr/local, but you
2873 may choose /usr if you wish to install $package among your system
2874 binaries. If you wish to have binaries under /bin but manual pages
2875 under /usr/local/man, that's ok: you will be prompted separately
2876 for each of the installation directories, the prefix being only used
2877 to set the defaults.
2878
2879 EOM
2880 fn=d~
2881 rp='Installation prefix to use?'
2882 . ./getfile
2883 oldprefix=''
2884 case "$prefix" in
2885 '') ;;
2886 *)
2887         case "$ans" in
2888         "$prefix") ;;
2889         *) oldprefix="$prefix";;
2890         esac
2891         ;;
2892 esac
2893 prefix="$ans"
2894 prefixexp="$ansexp"
2895
2896 : set the prefixit variable, to compute a suitable default value
2897 prefixit='case "$3" in
2898 ""|none)
2899         case "$oldprefix" in
2900         "") eval "$1=\"\$$2\"";;
2901         *)
2902                 case "$3" in
2903                 "") eval "$1=";;
2904                 none)
2905                         eval "tp=\"\$$2\"";
2906                         case "$tp" in
2907                         ""|" ") eval "$1=\"\$$2\"";;
2908                         *) eval "$1=";;
2909                         esac;;
2910                 esac;;
2911         esac;;
2912 *)
2913         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2914         case "$tp" in
2915         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2916         /*-$oldprefix/*|\~*-$oldprefix/*)
2917                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2918         *) eval "$1=\"\$$2\"";;
2919         esac;;
2920 esac'
2921
2922 : set the base revision
2923 baserev=5.0
2924
2925 : get the patchlevel
2926 echo " "
2927 echo "Getting the current patchlevel..." >&4
2928 if $test -r $rsrc/patchlevel.h;then
2929         patchlevel=`awk '/define[       ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
2930         subversion=`awk '/define[       ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
2931 else
2932         patchlevel=0
2933         subversion=0
2934 fi
2935 $echo $n "(You have $package" $c
2936 case "$package" in
2937 "*$baserev")    ;;
2938 *)              $echo $n " $baserev" $c ;;
2939 esac
2940 $echo $n " patchlevel $patchlevel" $c
2941 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
2942 echo ".)"
2943
2944 if test 0 -eq "$subversion"; then
2945         version=`LC_ALL=C; export LC_ALL; \
2946                  echo $baserev $patchlevel | \
2947                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2948 else
2949         version=`LC_ALL=C; export LC_ALL; \
2950                  echo $baserev $patchlevel $subversion | \
2951                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
2952 fi
2953 : Figure out perl API version.  Perhaps this should be in patchlevel.h
2954 if test "$subversion" -lt 50; then
2955         apiversion=`LC_ALL=C; export LC_ALL; \
2956                  echo $baserev $patchlevel | \
2957                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2958 else
2959         apiversion="$version"
2960 fi
2961
2962 : determine where private library files go
2963 : Usual default is /usr/local/lib/perl5/$version.
2964 : Also allow things like /opt/perl/lib/$version, since 
2965 : /opt/perl/lib/perl5... would be redundant.
2966 case "$prefix" in
2967 *perl*) set dflt privlib lib/$version ;;
2968 *)       set dflt privlib lib/$package/$version ;;
2969 esac
2970 eval $prefixit
2971 $cat <<EOM
2972
2973 There are some auxiliary files for $package that need to be put into a
2974 private library directory that is accessible by everyone.
2975
2976 EOM
2977 fn=d~+
2978 rp='Pathname where the private library files will reside?'
2979 . ./getfile
2980 if $test "X$privlibexp" != "X$ansexp"; then
2981         installprivlib=''
2982 fi
2983 privlib="$ans"
2984 privlibexp="$ansexp"
2985 if $afs; then
2986         $cat <<EOM
2987
2988 Since you are running AFS, I need to distinguish the directory in which
2989 private files reside from the directory in which they are installed (and from
2990 which they are presumably copied to the former directory by occult means).
2991
2992 EOM
2993         case "$installprivlib" in
2994         '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
2995         *) dflt="$installprivlib";;
2996         esac
2997         fn=de~
2998         rp='Where will private files be installed?'
2999         . ./getfile
3000         installprivlib="$ans"
3001 else
3002         installprivlib="$privlibexp"
3003 fi
3004
3005 : set the prefixup variable, to restore leading tilda escape
3006 prefixup='case "$prefixexp" in
3007 "$prefix") ;;
3008 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3009 esac'
3010
3011 : determine where public architecture dependent libraries go
3012 set archlib archlib
3013 eval $prefixit
3014 : privlib default is /usr/local/lib/$package/$version
3015 : archlib default is /usr/local/lib/$package/$version/$archname
3016 : privlib may have an optional trailing /share.
3017 tdflt=`echo $privlib | $sed 's,/share$,,'`
3018 tdflt=$tdflt/$archname
3019 case "$archlib" in
3020 '')     dflt=$tdflt
3021         ;;
3022 *)      dflt="$archlib"
3023     ;;
3024 esac
3025 cat <<EOM
3026
3027 $spackage contains architecture-dependent library files.  If you are
3028 sharing libraries in a heterogeneous environment, you might store
3029 these files in a separate location.  Otherwise, you can just include
3030 them with the rest of the public library files.
3031
3032 EOM
3033 fn=d+~
3034 rp='Where do you want to put the public architecture-dependent libraries?'
3035 . ./getfile
3036 archlib="$ans"
3037 archlibexp="$ansexp"
3038
3039 if $afs; then
3040         $cat <<EOM
3041
3042 Since you are running AFS, I need to distinguish the directory in
3043 which architecture-dependent library files reside from the directory
3044 in which they are installed (and from which they are presumably copied
3045 to the former directory by occult means).
3046
3047 EOM
3048         case "$installarchlib" in
3049         '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3050         *) dflt="$installarchlib";;
3051         esac
3052         fn=de~
3053         rp='Where will architecture-dependent library files be installed?'
3054         . ./getfile
3055         installarchlib="$ans"
3056 else
3057         installarchlib="$archlibexp"
3058 fi
3059 if $test X"$archlib" = X"$privlib"; then
3060         d_archlib="$undef"
3061 else
3062         d_archlib="$define"
3063 fi
3064
3065 : make some quick guesses about what we are up against
3066 echo " "
3067 $echo $n "Hmm...  $c"
3068 echo exit 1 >bsd
3069 echo exit 1 >usg
3070 echo exit 1 >v7
3071 echo exit 1 >osf1
3072 echo exit 1 >eunice
3073 echo exit 1 >xenix
3074 echo exit 1 >venix
3075 echo exit 1 >os2
3076 d_bsd="$undef"
3077 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3078 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3079 then
3080         echo "Looks kind of like an OSF/1 system, but we'll see..."
3081         echo exit 0 >osf1
3082 elif test `echo abc | tr a-z A-Z` = Abc ; then
3083         xxx=`./loc addbib blurfl $pth`
3084         if $test -f $xxx; then
3085         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3086                 echo exit 0 >bsd
3087                 echo exit 0 >usg
3088         else
3089                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3090                         echo "Looks kind of like an extended USG system, but we'll see..."
3091                 else
3092                         echo "Looks kind of like a USG system, but we'll see..."
3093                 fi
3094                 echo exit 0 >usg
3095         fi
3096 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3097         echo "Looks kind of like a BSD system, but we'll see..."
3098         d_bsd="$define"
3099         echo exit 0 >bsd
3100 else
3101         echo "Looks kind of like a Version 7 system, but we'll see..."
3102         echo exit 0 >v7
3103 fi
3104 case "$eunicefix" in
3105 *unixtovms*)
3106         $cat <<'EOI'
3107 There is, however, a strange, musty smell in the air that reminds me of
3108 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3109 EOI
3110         echo exit 0 >eunice
3111         d_eunice="$define"
3112 : it so happens the Eunice I know will not run shell scripts in Unix format
3113         ;;
3114 *)
3115         echo " "
3116         echo "Congratulations.  You aren't running Eunice."
3117         d_eunice="$undef"
3118         ;;
3119 esac
3120 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3121 case "$p_" in
3122 :) ;;
3123 *)
3124         $cat <<'EOI'
3125 I have the feeling something is not exactly right, however...don't tell me...
3126 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3127 EOI
3128         echo exit 0 >os2
3129         ;;
3130 esac
3131 if test -f /xenix; then
3132         echo "Actually, this looks more like a XENIX system..."
3133         echo exit 0 >xenix
3134         d_xenix="$define"
3135 else
3136         echo " "
3137         echo "It's not Xenix..."
3138         d_xenix="$undef"
3139 fi
3140 chmod +x xenix
3141 $eunicefix xenix
3142 if test -f /venix; then
3143         echo "Actually, this looks more like a VENIX system..."
3144         echo exit 0 >venix
3145 else
3146         echo " "
3147         if ./xenix; then
3148                 : null
3149         else
3150                 echo "Nor is it Venix..."
3151         fi
3152 fi
3153 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3154 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3155 $rm -f foo
3156
3157 : see if setuid scripts can be secure
3158 $cat <<EOM
3159
3160 Some kernels have a bug that prevents setuid #! scripts from being
3161 secure.  Some sites have disabled setuid #! scripts because of this.
3162
3163 First let's decide if your kernel supports secure setuid #! scripts.
3164 (If setuid #! scripts would be secure but have been disabled anyway,
3165 don't say that they are secure if asked.)
3166
3167 EOM
3168
3169 val="$undef"
3170 if $test -d /dev/fd; then
3171         echo "#!$ls" >reflect
3172         chmod +x,u+s reflect
3173         ./reflect >flect 2>&1
3174         if $contains "/dev/fd" flect >/dev/null; then
3175                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3176                 val="$define"
3177         else
3178                 $cat <<EOM
3179 If you are not sure if they are secure, I can check but I'll need a
3180 username and password different from the one you are using right now.
3181 If you don't have such a username or don't want me to test, simply
3182 enter 'none'.
3183
3184 EOM
3185                 rp='Other username to test security of setuid scripts with?'
3186                 dflt='none'
3187                 . ./myread
3188                 case "$ans" in
3189                 n|none)
3190                         case "$d_suidsafe" in
3191                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3192                                 dflt=n;;
3193                         "$undef")
3194                                 echo "Well, the $hint value is *not* secure." >&4
3195                                 dflt=n;;
3196                         *)      echo "Well, the $hint value *is* secure." >&4
3197                                 dflt=y;;
3198                         esac
3199                         ;;
3200                 *)
3201                         $rm -f reflect flect
3202                         echo "#!$ls" >reflect
3203                         chmod +x,u+s reflect
3204                         echo >flect
3205                         chmod a+w flect
3206                         echo '"su" will (probably) prompt you for '"$ans's password."
3207                         su $ans -c './reflect >flect'
3208                         if $contains "/dev/fd" flect >/dev/null; then
3209                                 echo "Okay, it looks like setuid scripts are secure." >&4
3210                                 dflt=y
3211                         else
3212                                 echo "I don't think setuid scripts are secure." >&4
3213                                 dflt=n
3214                         fi
3215                         ;;
3216                 esac
3217                 rp='Does your kernel have *secure* setuid scripts?'
3218                 . ./myread
3219                 case "$ans" in
3220                 [yY]*)  val="$define";;
3221                 *)      val="$undef";;
3222                 esac
3223         fi
3224 else
3225         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3226         echo "(That's for file descriptors, not floppy disks.)"
3227         val="$undef"
3228 fi
3229 set d_suidsafe
3230 eval $setvar
3231
3232 $rm -f reflect flect
3233
3234 : now see if they want to do setuid emulation
3235 echo " "
3236 val="$undef"
3237 case "$d_suidsafe" in
3238 "$define")
3239         val="$undef"
3240         echo "No need to emulate SUID scripts since they are secure here." >& 4
3241         ;;
3242 *)
3243         $cat <<EOM
3244 Some systems have disabled setuid scripts, especially systems where
3245 setuid scripts cannot be secure.  On systems where setuid scripts have
3246 been disabled, the setuid/setgid bits on scripts are currently
3247 useless.  It is possible for $package to detect those bits and emulate
3248 setuid/setgid in a secure fashion.  This emulation will only work if
3249 setuid scripts have been disabled in your kernel.
3250
3251 EOM
3252         case "$d_dosuid" in
3253         "$define") dflt=y ;;
3254         *) dflt=n ;;
3255         esac
3256         rp="Do you want to do setuid/setgid emulation?"
3257         . ./myread
3258         case "$ans" in
3259         [yY]*)  val="$define";;
3260         *)      val="$undef";;
3261         esac
3262         ;;
3263 esac
3264 set d_dosuid
3265 eval $setvar
3266
3267 : determine where manual pages are on this system
3268 echo " "
3269 case "$sysman" in
3270 '') 
3271         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3272         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3273         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3274         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3275         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3276         sysman=`./loc . /usr/man/man1 $syspath`
3277         ;;
3278 esac
3279 if $test -d "$sysman"; then
3280         echo "System manual is in $sysman." >&4
3281 else
3282         echo "Could not find manual pages in source form." >&4
3283 fi
3284
3285 : see what memory models we can support
3286 case "$models" in
3287 '')
3288         $cat >pdp11.c <<'EOP'
3289 main() {
3290 #ifdef pdp11
3291         exit(0);
3292 #else
3293         exit(1);
3294 #endif
3295 }
3296 EOP
3297         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3298         if $test -f pdp11 && ./pdp11 2>/dev/null; then
3299                 dflt='unsplit split'
3300         else
3301                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3302                 case "$tans" in
3303                 X) dflt='none';;
3304                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3305                                 dflt='small'
3306                         else
3307                                 dflt=''
3308                         fi
3309                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
3310                                 dflt="$dflt medium"
3311                         fi
3312                         if $test -d /lib/large || $test -d /usr/lib/large; then
3313                                 dflt="$dflt large"
3314                         fi
3315                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
3316                                 dflt="$dflt huge"
3317                         fi
3318                 esac
3319         fi;;
3320 *) dflt="$models";;
3321 esac
3322 $cat <<EOM
3323  
3324 Some systems have different model sizes.  On most systems they are called
3325 small, medium, large, and huge.  On the PDP11 they are called unsplit and
3326 split.  If your system doesn't support different memory models, say "none".
3327 If you wish to force everything to one memory model, say "none" here and
3328 put the appropriate flags later when it asks you for other cc and ld flags.
3329 Venix systems may wish to put "none" and let the compiler figure things out.
3330 (In the following question multiple model names should be space separated.)
3331
3332 The default for most systems is "none".
3333
3334 EOM
3335 rp="Which memory models are supported?"
3336 . ./myread
3337 models="$ans"
3338
3339 case "$models" in
3340 none)
3341         small=''
3342         medium=''
3343         large=''
3344         huge=''
3345         unsplit=''
3346         split=''
3347         ;;
3348 *split)
3349         case "$split" in
3350         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3351                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3352                         dflt='-i'
3353                 else
3354                         dflt='none'
3355                 fi;;
3356         *) dflt="$split";;
3357         esac
3358         rp="What flag indicates separate I and D space?"
3359         . ./myread
3360         tans="$ans"
3361         case "$tans" in
3362         none) tans='';;
3363         esac
3364         split="$tans"
3365         unsplit='';;
3366 *large*|*small*|*medium*|*huge*)
3367         case "$models" in
3368         *large*)
3369                 case "$large" in
3370                 '') dflt='-Ml';;
3371                 *) dflt="$large";;
3372                 esac
3373         rp="What flag indicates large model?"
3374         . ./myread
3375         tans="$ans"
3376         case "$tans" in
3377         none) tans='';
3378         esac
3379         large="$tans";;
3380         *) large='';;
3381         esac
3382         case "$models" in
3383         *huge*) case "$huge" in
3384                 '') dflt='-Mh';;
3385                 *) dflt="$huge";;
3386                 esac
3387                 rp="What flag indicates huge model?"
3388                 . ./myread
3389                 tans="$ans"
3390                 case "$tans" in
3391                 none) tans='';
3392                 esac
3393                 huge="$tans";;
3394         *) huge="$large";;
3395         esac
3396         case "$models" in
3397         *medium*) case "$medium" in
3398                 '') dflt='-Mm';;
3399                 *) dflt="$medium";;
3400                 esac
3401                 rp="What flag indicates medium model?"
3402                 . ./myread
3403                 tans="$ans"
3404                 case "$tans" in
3405                 none) tans='';
3406                 esac
3407                 medium="$tans";;
3408         *) medium="$large";;
3409         esac
3410         case "$models" in
3411         *small*) case "$small" in
3412                 '') dflt='none';;
3413                 *) dflt="$small";;
3414                 esac
3415                 rp="What flag indicates small model?"
3416                 . ./myread
3417                 tans="$ans"
3418                 case "$tans" in
3419                 none) tans='';
3420                 esac
3421                 small="$tans";;
3422         *) small='';;
3423         esac
3424         ;;
3425 *)
3426         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3427         ;;
3428 esac
3429 $rm -f pdp11.* pdp11
3430
3431 : see if we need a special compiler
3432 echo " "
3433 if ./usg; then
3434         case "$cc" in
3435         '') case "$Mcc" in
3436                 /*) dflt='Mcc';;
3437                 *) case "$large" in
3438                         -M*) dflt='cc';;
3439                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3440                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3441                                                 dflt='cc'
3442                                         else
3443                                                 dflt='cc -M'
3444                                         fi
3445                                 else
3446                                         dflt='cc'
3447                                 fi;;
3448                         esac;;
3449                 esac;;
3450         *)  dflt="$cc";;
3451         esac
3452         case "$dflt" in
3453         *M*)    $cat <<'EOM'
3454 On some older systems the default C compiler will not resolve multiple global
3455 references that happen to have the same name.  On some such systems the "Mcc"
3456 command may be used to force these to be resolved.  On other systems a "cc -M"
3457 command is required.  (Note that the -M flag on other systems indicates a
3458 memory model to use!) If you have the Gnu C compiler, you might wish to use
3459 that instead.
3460
3461 EOM
3462         ;;
3463         esac
3464         rp="Use which C compiler?"
3465         . ./myread
3466         cc="$ans"
3467 else
3468         case "$cc" in
3469         '') dflt=cc;;
3470         *) dflt="$cc";;
3471         esac
3472         rp="Use which C compiler?"
3473         . ./myread
3474         cc="$ans"
3475 fi
3476 : Look for a hint-file generated 'call-back-unit'.  Now that the
3477 : user has specified the compiler, we may need to set or change some
3478 : other defaults.
3479 if $test -f cc.cbu; then
3480     . ./cc.cbu
3481 fi
3482 echo " "
3483 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3484 $cat >gccvers.c <<EOM
3485 #include <stdio.h>
3486 int main() {
3487 #ifdef __GNUC__
3488 #ifdef __VERSION__
3489         printf("%s\n", __VERSION__);
3490 #else
3491         printf("%s\n", "1");
3492 #endif
3493 #endif
3494         exit(0);
3495 }
3496 EOM
3497 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3498         gccversion=`./gccvers`
3499         case "$gccversion" in
3500         '') echo "You are not using GNU cc." ;;
3501         *)  echo "You are using GNU cc $gccversion." ;;
3502         esac
3503 else
3504         echo " "
3505         echo "*** WHOA THERE!!! ***" >&4
3506         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3507         case "$knowitall" in
3508         '')
3509         echo "    You'd better start hunting for one and let me know about it." >&4
3510                 exit 1
3511                 ;;
3512         esac
3513 fi
3514 $rm -f gccvers*
3515 case "$gccversion" in
3516 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3517 esac
3518
3519 : What should the include directory be ?
3520 echo " "
3521 $echo $n "Hmm...  $c"
3522 dflt='/usr/include'
3523 incpath=''
3524 mips_type=''
3525 if $test -f /bin/mips && /bin/mips; then
3526         echo "Looks like a MIPS system..."
3527         $cat >usr.c <<'EOCP'
3528 #ifdef SYSTYPE_BSD43
3529 /bsd43
3530 #endif
3531 EOCP
3532         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3533                 dflt='/bsd43/usr/include'
3534                 incpath='/bsd43'
3535                 mips_type='BSD 4.3'
3536         else
3537                 mips_type='System V'
3538         fi
3539         $rm -f usr.c usr.out
3540         echo "and you're compiling with the $mips_type compiler and libraries."
3541         xxx_prompt=y
3542         echo "exit 0" >mips
3543 else
3544         echo "Doesn't look like a MIPS system."
3545         xxx_prompt=n
3546         echo "exit 1" >mips
3547 fi
3548 chmod +x mips
3549 $eunicefix mips
3550 case "$usrinc" in
3551 '') ;;
3552 *) dflt="$usrinc";;
3553 esac
3554 case "$xxx_prompt" in
3555 y)      fn=d/
3556         echo " "
3557         rp='Where are the include files you want to use?'
3558         . ./getfile
3559         usrinc="$ans"
3560         ;;
3561 *)      usrinc="$dflt"
3562         ;;
3563 esac
3564
3565 : see how we invoke the C preprocessor
3566 echo " "
3567 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3568 cat <<'EOT' >testcpp.c
3569 #define ABC abc
3570 #define XYZ xyz
3571 ABC.XYZ
3572 EOT
3573 cd ..
3574 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3575 chmod 755 cppstdin
3576 wrapper=`pwd`/cppstdin
3577 ok='false'
3578 cd UU
3579
3580 if $test "X$cppstdin" != "X" && \
3581         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3582         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3583 then
3584         echo "You used to use $cppstdin $cppminus so we'll use that again."
3585         case "$cpprun" in
3586         '') echo "But let's see if we can live without a wrapper..." ;;
3587         *)
3588                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3589                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3590                 then
3591                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3592                         ok='true'
3593                 else
3594                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3595                 fi
3596                 ;;
3597         esac
3598 else
3599         case "$cppstdin" in
3600         '') ;;
3601         *)
3602                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3603                 ;;
3604         esac
3605 fi
3606
3607 if $ok; then
3608         : nothing
3609 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3610         $cc -E <testcpp.c >testcpp.out 2>&1; \
3611         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3612         echo "Yup, it does."
3613         x_cpp="$cc -E"
3614         x_minus='';
3615 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3616         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3617         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3618         echo "Yup, it does."
3619         x_cpp="$cc -E"
3620         x_minus='-';
3621 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3622         $cc -P <testcpp.c >testcpp.out 2>&1; \
3623         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3624         echo "Yipee, that works!"
3625         x_cpp="$cc -P"
3626         x_minus='';
3627 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3628         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3629         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3630         echo "At long last!"
3631         x_cpp="$cc -P"
3632         x_minus='-';
3633 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3634         $cpp <testcpp.c >testcpp.out 2>&1; \
3635         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3636         echo "It works!"
3637         x_cpp="$cpp"
3638         x_minus='';
3639 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3640         $cpp - <testcpp.c >testcpp.out 2>&1; \
3641         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3642         echo "Hooray, it works!  I was beginning to wonder."
3643         x_cpp="$cpp"
3644         x_minus='-';
3645 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3646         $wrapper <testcpp.c >testcpp.out 2>&1; \
3647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3648         x_cpp="$wrapper"
3649         x_minus=''
3650         echo "Eureka!"
3651 else
3652         dflt=''
3653         rp="No dice.  I can't find a C preprocessor.  Name one:"
3654         . ./myread
3655         x_cpp="$ans"
3656         x_minus=''
3657         $x_cpp <testcpp.c >testcpp.out 2>&1
3658         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3659                 echo "OK, that will do." >&4
3660         else
3661 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3662                 exit 1
3663         fi
3664 fi
3665
3666 case "$ok" in
3667 false)
3668         cppstdin="$x_cpp"
3669         cppminus="$x_minus"
3670         cpprun="$x_cpp"
3671         cpplast="$x_minus"
3672         set X $x_cpp
3673         shift
3674         case "$1" in
3675         "$cpp")
3676                 echo "Perhaps can we force $cc -E using a wrapper..."
3677                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3678                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3679                 then
3680                         echo "Yup, we can."
3681                         cppstdin="$wrapper"
3682                         cppminus='';
3683                 else
3684                         echo "Nope, we'll have to live without it..."
3685                 fi
3686                 ;;
3687         esac
3688         case "$cpprun" in
3689         "$wrapper")
3690                 cpprun=''
3691                 cpplast=''
3692                 ;;
3693         esac
3694         ;;
3695 esac
3696
3697 case "$cppstdin" in
3698 "$wrapper") ;;
3699 *) $rm -f $wrapper;;
3700 esac
3701 $rm -f testcpp.c testcpp.out
3702
3703 : Set private lib path
3704 case "$plibpth" in
3705 '') if ./mips; then
3706                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3707         fi;;
3708 esac
3709 case "$libpth" in
3710 ' ') dlist='';;
3711 '') dlist="$loclibpth $plibpth $glibpth";;
3712 *) dlist="$libpth";;
3713 esac
3714
3715 : Now check and see which directories actually exist, avoiding duplicates
3716 libpth=''
3717 for xxx in $dlist
3718 do
3719     if $test -d $xxx; then
3720                 case " $libpth " in
3721                 *" $xxx "*) ;;
3722                 *) libpth="$libpth $xxx";;
3723                 esac
3724     fi
3725 done
3726 $cat <<'EOM'
3727
3728 Some systems have incompatible or broken versions of libraries.  Among
3729 the directories listed in the question below, please remove any you
3730 know not to be holding relevant libraries, and add any that are needed.
3731 Say "none" for none.
3732
3733 EOM
3734 case "$libpth" in
3735 '') dflt='none';;
3736 *)
3737         set X $libpth
3738         shift
3739         dflt=${1+"$@"}
3740         ;;
3741 esac
3742 rp="Directories to use for library searches?"
3743 . ./myread
3744 case "$ans" in
3745 none) libpth=' ';;
3746 *) libpth="$ans";;
3747 esac
3748
3749 : compute shared library extension
3750 case "$so" in
3751 '')
3752         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3753                 dflt='sl'
3754         else
3755                 dflt='so'
3756         fi
3757         ;;
3758 *) dflt="$so";;
3759 esac
3760 $cat <<EOM
3761
3762 On some systems, shared libraries may be available.  Answer 'none' if
3763 you want to suppress searching of shared libraries for the remaining
3764 of this configuration.
3765
3766 EOM
3767 rp='What is the file extension used for shared libraries?'
3768 . ./myread
3769 so="$ans"
3770
3771 : Define several unixisms.
3772 : Hints files or command line option can be used to override them.
3773 : The convoluted testing is in case hints files set either the old
3774 : or the new name.
3775 case "$_exe" in
3776 '')     case "$exe_ext" in
3777     '') ;;
3778         *)      _exe="$exe_ext" ;;
3779         esac
3780         ;;
3781 esac
3782 case "$_a" in
3783 '')     case "$lib_ext" in
3784     '') _a='.a';;
3785         *)      _a="$lib_ext" ;;
3786         esac
3787         ;;
3788 esac
3789 case "$_o" in
3790 '') case "$obj_ext" in
3791         '')     _o='.o';;
3792         *)      _o="$obj_ext";;
3793         esac
3794         ;;
3795 esac
3796 case "$p_" in
3797 '') case "$path_sep" in
3798         '')     p_=':';;
3799         *)      p_="$path_sep";;
3800         esac
3801         ;;
3802 esac
3803 exe_ext=$_exe
3804 lib_ext=$_a
3805 obj_ext=$_o
3806 path_sep=$p_
3807
3808 : Which makefile gets called first.  This is used by make depend.
3809 case "$firstmakefile" in
3810 '') firstmakefile='makefile';;
3811 esac
3812
3813 : Looking for optional libraries
3814 echo " "
3815 echo "Checking for optional libraries..." >&4
3816 case "$libs" in
3817 ' '|'') dflt='';;
3818 *) dflt="$libs";;
3819 esac
3820 case "$libswanted" in
3821 '') libswanted='c_s';;
3822 esac
3823 for thislib in $libswanted; do
3824         
3825         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
3826                 echo "Found -l$thislib (shared)."
3827                 case " $dflt " in
3828                 *"-l$thislib "*);;
3829                 *) dflt="$dflt -l$thislib";;
3830                 esac
3831         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3832                 echo "Found -l$thislib (shared)."
3833                 case " $dflt " in
3834                 *"-l$thislib "*);;
3835                 *) dflt="$dflt -l$thislib";;
3836                 esac
3837         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3838                 echo "Found -l$thislib."
3839                 case " $dflt " in
3840                 *"-l$thislib "*);;
3841                 *) dflt="$dflt -l$thislib";;
3842                 esac
3843         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3844                 echo "Found -l$thislib."
3845                 case " $dflt " in
3846                 *"-l$thislib "*);;
3847                 *) dflt="$dflt -l$thislib";;
3848                 esac
3849         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3850                 echo "Found -l${thislib}_s."
3851                 case " $dflt " in
3852                 *"-l$thislib "*);;
3853                 *) dflt="$dflt -l${thislib}_s";;
3854                 esac
3855         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3856                 echo "Found -l$thislib."
3857                 case " $dflt " in
3858                 *"-l$thislib "*);;
3859                 *) dflt="$dflt -l$thislib";;
3860                 esac
3861         else
3862                 echo "No -l$thislib."
3863         fi
3864 done
3865 set X $dflt
3866 shift
3867 dflt="$*"
3868 case "$libs" in
3869 '') dflt="$dflt";;
3870 *) dflt="$libs";;
3871 esac
3872 case "$dflt" in
3873 ' '|'') dflt='none';;
3874 esac
3875
3876 $cat <<EOM
3877  
3878 Some versions of Unix support shared libraries, which make executables smaller
3879 but make load time slightly longer.
3880
3881 On some systems, mostly System V Release 3's, the shared library is included
3882 by putting the option "-lc_s" as the last thing on the cc command line when
3883 linking.  Other systems use shared libraries by default.  There may be other
3884 libraries needed to compile $package on your machine as well.  If your system
3885 needs the "-lc_s" option, include it here.  Include any other special libraries
3886 here as well.  Say "none" for none.
3887 EOM
3888
3889 echo " "
3890 rp="Any additional libraries?"
3891 . ./myread
3892 case "$ans" in
3893 none) libs=' ';;
3894 *) libs="$ans";;
3895 esac
3896
3897 : determine optimize, if desired, or use for debug flag also
3898 case "$optimize" in
3899 ' '|$undef) dflt='none';;
3900 '') dflt='-O';;
3901 *) dflt="$optimize";;
3902 esac
3903 $cat <<EOH
3904
3905 Some C compilers have problems with their optimizers.  By default, $package
3906 compiles with the -O flag to use the optimizer.  Alternately, you might want
3907 to use the symbolic debugger, which uses the -g flag (on traditional Unix
3908 systems).  Either flag can be specified here.  To use neither flag, specify
3909 the word "none".
3910
3911 EOH
3912 rp="What optimizer/debugger flag should be used?"
3913 . ./myread
3914 optimize="$ans"
3915 case "$optimize" in
3916 'none') optimize=" ";;
3917 esac
3918
3919 dflt=''
3920 : We will not override a previous value, but we might want to
3921 : augment a hint file
3922 case "$hint" in
3923 none|recommended)
3924         case "$gccversion" in
3925         1*) dflt='-fpcc-struct-return' ;;
3926         esac
3927         case "$optimize" in
3928         *-g*) dflt="$dflt -DDEBUGGING";;
3929         esac
3930         case "$gccversion" in
3931         2*) if test -d /etc/conf/kconfig.d &&
3932                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3933                 then
3934                         dflt="$dflt -posix"
3935                 fi
3936                 ;;
3937         esac
3938         ;;
3939 esac
3940
3941 case "$mips_type" in
3942 *BSD*|'') inclwanted="$locincpth $usrinc";;
3943 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3944 esac
3945 for thisincl in $inclwanted; do
3946         if $test -d $thisincl; then
3947                 if $test x$thisincl != x$usrinc; then
3948                         case "$dflt" in
3949                         *$thisincl*);;
3950                         *) dflt="$dflt -I$thisincl";;
3951                         esac
3952                 fi
3953         fi
3954 done
3955
3956 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3957         xxx=true;
3958 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3959         xxx=true;
3960 else
3961         xxx=false;
3962 fi;
3963 if $xxx; then
3964         case "$dflt" in
3965         *$2*);;
3966         *) dflt="$dflt -D$2";;
3967         esac;
3968 fi'
3969
3970 if ./osf1; then
3971         set signal.h __LANGUAGE_C__; eval $inctest
3972 else
3973         set signal.h LANGUAGE_C; eval $inctest
3974 fi
3975
3976 case "$hint" in
3977 none|recommended) dflt="$ccflags $dflt" ;;
3978 *) dflt="$ccflags";;
3979 esac
3980
3981 case "$usemultiplicity" in
3982 $define)
3983         case "$dflt" in
3984         *-DMULTIPLICITY* ) ;;
3985         *)      dflt="$dflt -DMULTIPLICITY"
3986                 ;;
3987         esac
3988         ;;
3989 esac
3990
3991 case "$dflt" in
3992 ''|' ') dflt=none;;
3993 esac
3994 $cat <<EOH
3995
3996 Your C compiler may want other flags.  For this question you should include
3997 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3998 but you should NOT include libraries or ld flags like -lwhatever.  If you
3999 want $package to honor its debug switch, you should include -DDEBUGGING here.
4000 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4001
4002 To use no flags, specify the word "none".
4003
4004 EOH
4005 set X $dflt
4006 shift
4007 dflt=${1+"$@"}
4008 rp="Any additional cc flags?"
4009 . ./myread
4010 case "$ans" in
4011 none) ccflags='';;
4012 *) ccflags="$ans";;
4013 esac
4014
4015 : the following weeds options from ccflags that are of no interest to cpp
4016 cppflags="$ccflags"
4017 case "$gccversion" in
4018 1*) cppflags="$cppflags -D__GNUC__"
4019 esac
4020 case "$mips_type" in
4021 '');;
4022 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4023 esac
4024 case "$cppflags" in
4025 '');;
4026 *)
4027         echo " "
4028         echo "Let me guess what the preprocessor flags are..." >&4
4029         set X $cppflags
4030         shift
4031         cppflags=''
4032         $cat >cpp.c <<'EOM'
4033 #define BLURFL foo
4034
4035 BLURFL xx LFRULB
4036 EOM
4037         previous=''
4038         for flag in $*
4039         do
4040                 case "$flag" in
4041                 -*) ftry="$flag";;
4042                 *) ftry="$previous $flag";;
4043                 esac
4044                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4045                         >cpp1.out 2>/dev/null && \
4046                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4047                         >cpp2.out 2>/dev/null && \
4048                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4049                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4050                 then
4051                         cppflags="$cppflags $ftry"
4052                         previous=''
4053                 else
4054                         previous="$flag"
4055                 fi
4056         done
4057         set X $cppflags
4058         shift
4059         cppflags=${1+"$@"}
4060         case "$cppflags" in
4061         *-*)  echo "They appear to be: $cppflags";;
4062         esac
4063         $rm -f cpp.c cpp?.out
4064         ;;
4065 esac
4066
4067 : flags used in final linking phase
4068 case "$ldflags" in
4069 '') if ./venix; then
4070                 dflt='-i -z'
4071         else
4072                 dflt=''
4073         fi
4074         case "$ccflags" in
4075         *-posix*) dflt="$dflt -posix" ;;
4076         esac
4077         ;;
4078 *) dflt="$ldflags";;
4079 esac
4080
4081 : Try to guess additional flags to pick up local libraries.
4082 for thislibdir in $libpth; do
4083         case " $loclibpth " in
4084         *" $thislibdir "*)
4085                 case "$dflt " in 
4086                 *"-L$thislibdir "*) ;;
4087                 *)  dflt="$dflt -L$thislibdir" ;;
4088                 esac
4089                 ;;
4090         esac
4091 done
4092
4093 case "$dflt" in
4094 '') dflt='none' ;;
4095 esac
4096
4097 $cat <<EOH
4098
4099 Your C linker may need flags.  For this question you should
4100 include -L/whatever and any other flags used by the C linker, but you
4101 should NOT include libraries like -lwhatever.
4102
4103 Make sure you include the appropriate -L/path flags if your C linker
4104 does not normally search all of the directories you specified above,
4105 namely
4106         $libpth
4107 To use no flags, specify the word "none".
4108
4109 EOH
4110
4111 rp="Any additional ld flags (NOT including libraries)?"
4112 . ./myread
4113 case "$ans" in
4114 none) ldflags='';;
4115 *) ldflags="$ans";;
4116 esac
4117 rmlist="$rmlist pdp11"
4118
4119 : coherency check
4120 echo " "
4121 echo "Checking your choice of C compiler and flags for coherency..." >&4
4122 $cat > try.c <<'EOF'
4123 #include <stdio.h>
4124 main() { printf("Ok\n"); exit(0); }
4125 EOF
4126 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4127 shift
4128 $cat >try.msg <<'EOM'
4129 I've tried to compile and run the following simple program:
4130
4131 EOM
4132 $cat try.c
4133
4134 $cat >> try.msg <<EOM
4135
4136 I used the command:
4137
4138         $*
4139         ./try
4140
4141 and I got the following output:
4142
4143 EOM
4144 dflt=y
4145 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4146         if sh -c './try' >>try.msg 2>&1; then
4147                 xxx=`./try`
4148                 case "$xxx" in
4149                 "Ok") dflt=n ;;
4150                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4151                         case " $libs " in
4152                         *" -lsfio "*)
4153                                 cat >> try.msg <<'EOQS'
4154 If $libs contains -lsfio, and sfio is mis-configured, then it
4155 sometimes (apparently) runs and exits with a 0 status, but with no
4156 output!  It may have to do with sfio's use of _exit vs. exit.
4157
4158 EOQS
4159                                 rp="You have a big problem.  Shall I abort Configure"
4160                                 dflt=y
4161                                 ;;
4162                         esac
4163                         ;;
4164                 esac
4165         else
4166                 echo "The program compiled OK, but exited with status $?." >>try.msg
4167                 rp="You have a problem.  Shall I abort Configure"
4168                 dflt=y
4169         fi
4170 else
4171         echo "I can't compile the test program." >>try.msg
4172         rp="You have a BIG problem.  Shall I abort Configure"
4173         dflt=y
4174 fi
4175 case "$dflt" in
4176 y)
4177         $cat try.msg >&4
4178         case "$knowitall" in
4179         '')
4180                 echo "(The supplied flags or libraries might be incorrect.)"
4181                 ;;
4182         *) dflt=n;;
4183         esac
4184         echo " "
4185         . ./myread
4186         case "$ans" in
4187         n*|N*) ;;
4188         *)      echo "Ok.  Stopping Configure." >&4
4189                 exit 1
4190                 ;;
4191         esac
4192         ;;
4193 n) echo "OK, that should do.";;
4194 esac
4195 $rm -f try try.* core
4196
4197 : determine filename position in cpp output
4198 echo " "
4199 echo "Computing filename position in cpp output for #include directives..." >&4
4200 echo '#include <stdio.h>' > foo.c
4201 $cat >fieldn <<EOF
4202 $startsh
4203 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4204 $grep '^[       ]*#.*stdio\.h' | \
4205 while read cline; do
4206         pos=1
4207         set \$cline
4208         while $test \$# -gt 0; do
4209                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4210                         echo "\$pos"
4211                         exit 0
4212                 fi
4213                 shift
4214                 pos=\`expr \$pos + 1\`
4215         done
4216 done
4217 EOF
4218 chmod +x fieldn
4219 fieldn=`./fieldn`
4220 $rm -f foo.c fieldn
4221 case $fieldn in
4222 '') pos='???';;
4223 1) pos=first;;
4224 2) pos=second;;
4225 3) pos=third;;
4226 *) pos="${fieldn}th";;
4227 esac
4228 echo "Your cpp writes the filename in the $pos field of the line."
4229
4230 : locate header file
4231 $cat >findhdr <<EOF
4232 $startsh
4233 wanted=\$1
4234 name=''
4235 if test -f $usrinc/\$wanted; then
4236         echo "$usrinc/\$wanted"
4237         exit 0
4238 fi
4239 awkprg='{ print \$$fieldn }'
4240 echo "#include <\$wanted>" > foo\$\$.c
4241 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4242 $grep "^[       ]*#.*\$wanted" | \
4243 while read cline; do
4244         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4245         case "\$name" in
4246         */\$wanted) echo "\$name"; exit 0;;
4247         *) name='';;
4248         esac;
4249 done;
4250 $rm -f foo\$\$.c;
4251 case "\$name" in
4252 '') exit 1;;
4253 esac
4254 EOF
4255 chmod +x findhdr
4256
4257 : define an alternate in-header-list? function
4258 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4259 cont=true; xxf="echo \"<\$1> found.\" >&4";
4260 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4261 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4262 esac;
4263 case $# in 4) instead=instead;; *) instead="at last";; esac;
4264 while $test "$cont"; do
4265         xxx=`./findhdr $1`
4266         var=$2; eval "was=\$$2";
4267         if $test "$xxx" && $test -r "$xxx";
4268         then eval $xxf;
4269         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4270                 cont="";
4271         else eval $xxnf;
4272         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4273         set $yyy; shift; shift; yyy=$@;
4274         case $# in 0) cont="";;
4275         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4276                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4277         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4278                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4279         esac;
4280 done;
4281 while $test "$yyy";
4282 do set $yyy; var=$2; eval "was=\$$2";
4283         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4284         set $yyy; shift; shift; yyy=$@;
4285 done'
4286
4287 : see if this is a malloc.h system
4288 set malloc.h i_malloc
4289 eval $inhdr
4290
4291 : see if stdlib is available
4292 set stdlib.h i_stdlib
4293 eval $inhdr
4294
4295 : determine which malloc to compile in
4296 echo " "
4297 case "$usemymalloc" in
4298 ''|[yY]*|true|$define)  dflt='y' ;;
4299 *)      dflt='n' ;;
4300 esac
4301 rp="Do you wish to attempt to use the malloc that comes with $package?"
4302 . ./myread
4303 usemymalloc="$ans"
4304 case "$ans" in
4305 y*|true)
4306         usemymalloc='y'
4307         mallocsrc='malloc.c'
4308         mallocobj="malloc$_o"
4309         d_mymalloc="$define"
4310         case "$libs" in
4311         *-lmalloc*)
4312                 : Remove malloc from list of libraries to use
4313                 echo "Removing unneeded -lmalloc from library list" >&4
4314                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4315                 shift
4316                 libs="$*"
4317                 echo "libs = $libs" >&4
4318                 ;;
4319         esac
4320         ;;
4321 *)
4322         usemymalloc='n'
4323         mallocsrc=''
4324         mallocobj=''
4325         d_mymalloc="$undef"
4326         ;;
4327 esac
4328
4329 : compute the return types of malloc and free
4330 echo " "
4331 $cat >malloc.c <<END
4332 #$i_malloc I_MALLOC
4333 #$i_stdlib I_STDLIB
4334 #include <stdio.h>
4335 #include <sys/types.h>
4336 #ifdef I_MALLOC
4337 #include <malloc.h>
4338 #endif
4339 #ifdef I_STDLIB
4340 #include <stdlib.h>
4341 #endif
4342 #ifdef TRY_MALLOC
4343 void *malloc();
4344 #endif
4345 #ifdef TRY_FREE
4346 void free();
4347 #endif
4348 END
4349 case "$malloctype" in
4350 '')
4351         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4352                 malloctype='void *'
4353         else
4354                 malloctype='char *'
4355         fi
4356         ;;
4357 esac
4358 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4359
4360 case "$freetype" in
4361 '')
4362         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4363                 freetype='void'
4364         else
4365                 freetype='int'
4366         fi
4367         ;;
4368 esac
4369 echo "Your system uses $freetype free(), it would seem." >&4
4370 $rm -f malloc.[co]
4371 : Cruising for prototypes
4372 echo " "
4373 echo "Checking out function prototypes..." >&4
4374 $cat >prototype.c <<'EOCP'
4375 main(int argc, char *argv[]) {
4376         exit(0);}
4377 EOCP
4378 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4379         echo "Your C compiler appears to support function prototypes."
4380         val="$define"
4381 else
4382         echo "Your C compiler doesn't seem to understand function prototypes."
4383         val="$undef"
4384 fi
4385 set prototype
4386 eval $setvar
4387 $rm -f prototype*
4388
4389 case "$prototype" in
4390 "$define") ;;
4391 *)      ansi2knr='ansi2knr'
4392         echo " "
4393         cat <<EOM >&4
4394
4395 $me:  FATAL ERROR:
4396 This version of $package can only be compiled by a compiler that 
4397 understands function prototypes.  Unfortunately, your C compiler 
4398         $cc $ccflags
4399 doesn't seem to understand them.  Sorry about that.
4400
4401 If GNU cc is available for your system, perhaps you could try that instead.  
4402
4403 Eventually, we hope to support building Perl with pre-ANSI compilers.
4404 If you would like to help in that effort, please contact <perlbug@perl.org>.
4405
4406 Aborting Configure now.
4407 EOM
4408         exit 2
4409         ;;
4410 esac
4411
4412 : determine where public executables go
4413 echo " "
4414 set dflt bin bin
4415 eval $prefixit
4416 fn=d~
4417 rp='Pathname where the public executables will reside?'
4418 . ./getfile
4419 if $test "X$ansexp" != "X$binexp"; then
4420         installbin=''
4421 fi
4422 bin="$ans"
4423 binexp="$ansexp"
4424 if $afs; then
4425         $cat <<EOM
4426
4427 Since you are running AFS, I need to distinguish the directory in which
4428 executables reside from the directory in which they are installed (and from
4429 which they are presumably copied to the former directory by occult means).
4430
4431 EOM
4432         case "$installbin" in
4433         '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4434         *) dflt="$installbin";;
4435         esac
4436         fn=de~
4437         rp='Where will public executables be installed?'
4438         . ./getfile
4439         installbin="$ans"
4440 else
4441         installbin="$binexp"
4442 fi
4443
4444 : define a shorthand compile call
4445 compile='
4446 mc_file=$1;
4447 shift;
4448 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4449 : define a shorthand compile call for compilations that should be ok.
4450 compile_ok='
4451 mc_file=$1;
4452 shift;
4453 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4454
4455 echo " "
4456 echo "Checking for GNU C Library..." >&4
4457 cat >gnulibc.c <<EOM
4458 #include <stdio.h>
4459 int
4460 main()
4461 {
4462 #ifdef __GLIBC__
4463     exit(0);
4464 #else
4465     exit(1);
4466 #endif
4467 }
4468 EOM
4469 set gnulibc
4470 if eval $compile_ok && ./gnulibc; then
4471         val="$define"
4472         echo "You are using the GNU C Library"
4473 else
4474         val="$undef"
4475         echo "You are not using the GNU C Library"
4476 fi
4477 $rm -f gnulibc*
4478 set d_gnulibc
4479 eval $setvar
4480
4481 : see if nm is to be used to determine whether a symbol is defined or not
4482 case "$usenm" in
4483 '')
4484         dflt=''
4485         case "$d_gnulibc" in
4486         "$define")
4487                 echo " "
4488                 echo "nm probably won't work on the GNU C Library." >&4
4489                 dflt=n
4490                 ;;
4491         esac
4492         case "$dflt" in
4493         '') 
4494                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4495                         echo " "
4496                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4497                         echo "'nm' won't be sufficient on this sytem." >&4
4498                         dflt=n
4499                 fi
4500                 ;;
4501         esac
4502         case "$dflt" in
4503         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4504                 if $test $dflt -gt 20; then
4505                         dflt=y
4506                 else
4507                         dflt=n
4508                 fi
4509                 ;;
4510         esac
4511         ;;
4512 *)
4513         case "$usenm" in
4514         true|$define) dflt=y;;
4515         *) dflt=n;;
4516         esac
4517         ;;
4518 esac
4519 $cat <<EOM
4520
4521 I can use $nm to extract the symbols from your C libraries. This
4522 is a time consuming task which may generate huge output on the disk (up
4523 to 3 megabytes) but that should make the symbols extraction faster. The
4524 alternative is to skip the 'nm' extraction part and to compile a small
4525 test program instead to determine whether each symbol is present. If
4526 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4527 this may be the best solution.
4528
4529 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4530
4531 EOM
4532 rp="Shall I use $nm to extract C symbols from the libraries?"
4533 . ./myread
4534 case "$ans" in
4535 [Nn]*) usenm=false;;
4536 *) usenm=true;;
4537 esac
4538
4539 runnm=$usenm
4540 case "$reuseval" in
4541 true) runnm=false;;
4542 esac
4543
4544 : nm options which may be necessary
4545 case "$nm_opt" in
4546 '') if $test -f /mach_boot; then
4547                 nm_opt=''       # Mach
4548         elif $test -d /usr/ccs/lib; then
4549                 nm_opt='-p'     # Solaris (and SunOS?)
4550         elif $test -f /dgux; then
4551                 nm_opt='-p'     # DG-UX
4552         elif $test -f /lib64/rld; then
4553                 nm_opt='-p'     # 64-bit Irix
4554         else
4555                 nm_opt=''
4556         fi;;
4557 esac
4558
4559 : nm options which may be necessary for shared libraries but illegal
4560 : for archive libraries.  Thank you, Linux.
4561 case "$nm_so_opt" in
4562 '')     case "$myuname" in
4563         *linux*)
4564                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4565                         nm_so_opt='--dynamic'
4566                 fi
4567                 ;;
4568         esac
4569         ;;
4570 esac
4571
4572 case "$runnm" in
4573 true)
4574 : get list of predefined functions in a handy place
4575 echo " "
4576 case "$libc" in
4577 '') libc=unknown
4578         case "$libs" in
4579         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4580         esac
4581         ;;
4582 esac
4583 libnames='';
4584 case "$libs" in
4585 '') ;;
4586 *)  for thislib in $libs; do
4587         case "$thislib" in
4588         -lc|-lc_s)
4589                 : Handle C library specially below.
4590                 ;;
4591         -l*)
4592                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4593                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4594                         :
4595                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4596                         :
4597                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4598                         :
4599                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4600                         :
4601                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4602                         :
4603                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4604                         :
4605                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4606                         :
4607                 else
4608                         try=''
4609                 fi
4610                 libnames="$libnames $try"
4611                 ;;
4612         *) libnames="$libnames $thislib" ;;
4613         esac
4614         done
4615         ;;
4616 esac
4617 xxx=normal
4618 case "$libc" in
4619 unknown)
4620         set /lib/libc.$so
4621         for xxx in $libpth; do
4622                 $test -r $1 || set $xxx/libc.$so
4623                 : The messy sed command sorts on library version numbers.
4624                 $test -r $1 || \
4625                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4626                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4627                                 h
4628                                 s/[0-9][0-9]*/0000&/g
4629                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4630                                 G
4631                                 s/\n/ /' | \
4632                          sort | $sed -e 's/^.* //'`
4633                 eval set \$$#
4634         done
4635         $test -r $1 || set /usr/ccs/lib/libc.$so
4636         $test -r $1 || set /lib/libsys_s$_a
4637         ;;
4638 *)
4639         set blurfl
4640         ;;
4641 esac
4642 if $test -r "$1"; then
4643         echo "Your (shared) C library seems to be in $1."
4644         libc="$1"
4645 elif $test -r /lib/libc && $test -r /lib/clib; then
4646         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4647         xxx=apollo
4648         libc='/lib/clib /lib/libc'
4649         if $test -r /lib/syslib; then
4650                 echo "(Your math library is in /lib/syslib.)"
4651                 libc="$libc /lib/syslib"
4652         fi
4653 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4654         echo "Your C library seems to be in $libc, as you said before."
4655 elif $test -r $incpath/usr/lib/libc$_a; then
4656         libc=$incpath/usr/lib/libc$_a;
4657         echo "Your C library seems to be in $libc.  That's fine."
4658 elif $test -r /lib/libc$_a; then
4659         libc=/lib/libc$_a;
4660         echo "Your C library seems to be in $libc.  You're normal."
4661 else
4662         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4663                 :
4664         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4665                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4666         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4667                 :
4668         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4669                 :
4670         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4671                 :
4672         else
4673                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4674         fi
4675         if $test -r "$tans"; then
4676                 echo "Your C library seems to be in $tans, of all places."
4677                 libc=$tans
4678         else
4679                 libc='blurfl'
4680         fi
4681 fi
4682 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4683         dflt="$libc"
4684         cat <<EOM
4685
4686 If the guess above is wrong (which it might be if you're using a strange
4687 compiler, or your machine supports multiple models), you can override it here.
4688
4689 EOM
4690 else
4691         dflt=''
4692         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4693         cat >&4 <<EOM
4694 I can't seem to find your C library.  I've looked in the following places:
4695
4696 EOM
4697         $sed 's/^/      /' libpath
4698         cat <<EOM
4699
4700 None of these seems to contain your C library. I need to get its name...
4701
4702 EOM
4703 fi
4704 fn=f
4705 rp='Where is your C library?'
4706 . ./getfile
4707 libc="$ans"
4708
4709 echo " "
4710 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
4711 set X `cat libnames`
4712 shift
4713 xxx=files
4714 case $# in 1) xxx=file; esac
4715 echo "Extracting names from the following $xxx for later perusal:" >&4
4716 echo " "
4717 $sed 's/^/      /' libnames >&4
4718 echo " "
4719 $echo $n "This may take a while...$c" >&4
4720
4721 for file in $*; do
4722         case $file in
4723         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4724         *) $nm $nm_opt $file 2>/dev/null;;
4725         esac
4726 done >libc.tmp
4727
4728 $echo $n ".$c"
4729 $grep fprintf libc.tmp > libc.ptf
4730 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4731 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4732 xxx='[ADTSIW]'
4733 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4734         eval $xscan;\
4735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4736                 eval $xrun
4737 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4738         eval $xscan;\
4739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4740                 eval $xrun
4741 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4742         eval $xscan;\
4743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4744                 eval $xrun
4745 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4746         eval $xscan;\
4747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4748                 eval $xrun
4749 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4750         eval $xscan;\
4751         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4752                 eval $xrun
4753 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4754         eval $xscan;\
4755         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4756                 eval $xrun
4757 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4758                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4759         eval $xscan;\
4760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4761                 eval $xrun
4762 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4763         eval $xscan;\
4764         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4765                 eval $xrun
4766 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4767         eval $xscan;\
4768         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4769                 eval $xrun
4770 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4771         eval $xscan;\
4772         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4773                 eval $xrun
4774 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4775         eval $xscan;\
4776         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4777                 eval $xrun
4778 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4779         eval $xscan;\
4780         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4781                 eval $xrun
4782 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4783         eval $xscan;\
4784         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4785                 eval $xrun
4786 else
4787         $nm -p $* 2>/dev/null >libc.tmp
4788         $grep fprintf libc.tmp > libc.ptf
4789         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4790                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4791         then
4792                 nm_opt='-p'
4793                 eval $xrun
4794         else
4795                 echo " "
4796                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4797                 com=''
4798                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4799                         for thisname in $libnames $libc; do
4800                                 $ar t $thisname >>libc.tmp
4801                         done
4802                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4803                         echo "Ok." >&4
4804                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4805                         # Repeat libc to extract forwarders to DLL entries too
4806                         for thisname in $libnames $libc; do
4807                                 $ar tv $thisname >>libc.tmp
4808                                 # Revision 50 of EMX has bug in $ar.
4809                                 # it will not extract forwarders to DLL entries
4810                                 # Use emximp which will extract exactly them.
4811                                 emximp -o tmp.imp $thisname \
4812                                     2>/dev/null && \
4813                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4814                                     < tmp.imp >>libc.tmp
4815                                 $rm tmp.imp
4816                         done
4817                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4818                         echo "Ok." >&4
4819                 else
4820                         echo "$ar didn't seem to work right." >&4
4821                         echo "Maybe this is a Cray...trying bld instead..." >&4
4822                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4823                         then
4824                                 for thisname in $libnames; do
4825                                         bld t $libnames | \
4826                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4827                                         $ar t $thisname >>libc.tmp
4828                                 done
4829                                 echo "Ok." >&4
4830                         else
4831                                 echo "That didn't work either.  Giving up." >&4
4832                                 exit 1
4833                         fi
4834                 fi
4835         fi
4836 fi
4837 nm_extract="$com"
4838 if $test -f /lib/syscalls.exp; then
4839         echo " "
4840         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4841         $sed -n 's/^\([^        ]*\)[   ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
4842 fi
4843 ;;
4844 esac
4845 $rm -f libnames libpath
4846
4847 : see if dld is available
4848 set dld.h i_dld
4849 eval $inhdr
4850
4851 : is a C symbol defined?
4852 csym='tlook=$1;
4853 case "$3" in
4854 -v) tf=libc.tmp; tc=""; tdc="";;
4855 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4856 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4857 esac;
4858 tx=yes;
4859 case "$reuseval-$4" in
4860 true-) ;;
4861 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4862 esac;
4863 case "$tx" in
4864 yes)
4865         case "$runnm" in
4866         true)
4867                 if $contains $tlook $tf >/dev/null 2>&1;
4868                 then tval=true;
4869                 else tval=false;
4870                 fi;;
4871         *)
4872                 echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4873                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
4874                 then tval=true;
4875                 else tval=false;
4876                 fi;
4877                 $rm -f t t.c;;
4878         esac;;
4879 *)
4880         case "$tval" in
4881         $define) tval=true;;
4882         *) tval=false;;
4883         esac;;
4884 esac;
4885 eval "$2=$tval"'
4886
4887 : define an is-in-libc? function
4888 inlibc='echo " "; td=$define; tu=$undef;
4889 sym=$1; var=$2; eval "was=\$$2";
4890 tx=yes;
4891 case "$reuseval$was" in
4892 true) ;;
4893 true*) tx=no;;
4894 esac;
4895 case "$tx" in
4896 yes)
4897         set $sym tres -f;
4898         eval $csym;
4899         case "$tres" in
4900         true)
4901                 echo "$sym() found." >&4;
4902                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
4903         *)
4904                 echo "$sym() NOT found." >&4;
4905                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
4906         esac;;
4907 *)
4908         case "$was" in
4909         $define) echo "$sym() found." >&4;;
4910         *) echo "$sym() NOT found." >&4;;
4911         esac;;
4912 esac'
4913
4914 : see if dlopen exists
4915 xxx_runnm="$runnm"
4916 runnm=false
4917 set dlopen d_dlopen
4918 eval $inlibc
4919 runnm="$xxx_runnm"
4920
4921 : determine which dynamic loading, if any, to compile in
4922 echo " "
4923 dldir="ext/DynaLoader"
4924 case "$usedl" in
4925 $define|y|true)
4926         dflt='y'
4927         usedl="$define"
4928         ;;
4929 $undef|n|false)
4930         dflt='n'
4931         usedl="$undef"
4932         ;;
4933 *) 
4934         dflt='n'
4935         case "$d_dlopen" in
4936             $define) dflt='y' ;;
4937         esac
4938         case "$i_dld" in
4939             $define) dflt='y' ;;
4940         esac
4941         : Does a dl_xxx.xs file exist for this operating system
4942         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4943         ;;
4944 esac
4945 rp="Do you wish to use dynamic loading?"
4946 . ./myread
4947 usedl="$ans"
4948 case "$ans" in
4949 y*) usedl="$define"
4950         case "$dlsrc" in
4951         '')
4952                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
4953                         dflt="$dldir/dl_${osname}.xs"
4954                 elif $test "$d_dlopen" = "$define" ; then
4955                         dflt="$dldir/dl_dlopen.xs"
4956                 elif $test "$i_dld" = "$define" ; then
4957                         dflt="$dldir/dl_dld.xs"
4958                 else
4959                         dflt=''
4960                 fi
4961                 ;;
4962         *)      dflt="$dldir/$dlsrc"
4963                 ;;
4964         esac
4965     echo "The following dynamic loading files are available:"
4966         : Can not go over to $dldir because getfile has path hard-coded in.
4967         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
4968         rp="Source file to use for dynamic loading"
4969         fn="fne"
4970         # XXX This getfile call will fail the existence check if you try 
4971         # building away from $src (this is not supported yet).
4972         . ./getfile
4973         usedl="$define"
4974         : emulate basename
4975         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
4976
4977         $cat << EOM
4978
4979 Some systems may require passing special flags to $cc -c to
4980 compile modules that will be used to create a shared library.
4981 To use no flags, say "none".
4982
4983 EOM
4984     case "$cccdlflags" in
4985     '') case "$gccversion" in
4986                 '') case "$osname" in
4987                         hpux)   dflt='+z' ;;
4988                         next)   dflt='none' ;;
4989                         irix*)  dflt='-KPIC' ;;
4990                         svr4*|esix*|solaris) dflt='-KPIC' ;;
4991                         sunos)  dflt='-pic' ;;
4992                         *)      dflt='none' ;;
4993                     esac
4994                         ;;
4995                 *)  case "$osname" in
4996                         svr4*|esix*|solaris) dflt='-fPIC' ;;
4997                         *)      dflt='-fpic' ;;
4998                     esac ;;
4999             esac ;;
5000         ' ') dflt='none' ;;
5001     *)  dflt="$cccdlflags" ;;
5002     esac
5003     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5004     . ./myread
5005     case "$ans" in
5006     none) cccdlflags=' ' ;;
5007     *) cccdlflags="$ans" ;;
5008     esac
5009
5010     cat << EOM
5011
5012 Some systems use ld to create libraries that can be dynamically loaded,
5013 while other systems (such as those using ELF) use $cc.
5014
5015 EOM
5016         case "$ld" in
5017         '')     $cat >try.c <<'EOM'
5018 /* Test for whether ELF binaries are produced */
5019 #include <fcntl.h>
5020 #include <stdlib.h>
5021 main() {
5022         char b[4];
5023         int i = open("a.out",O_RDONLY);
5024         if(i == -1) 
5025                 exit(1); /* fail */
5026         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5027                 exit(0); /* succeed (yes, it's ELF) */
5028         else
5029                 exit(1); /* fail */
5030 }
5031 EOM
5032                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5033                         cat <<EOM
5034 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5035 EOM
5036                         dflt="$cc"
5037                 else
5038                         echo "I'll use ld to build dynamic libraries."
5039                         dflt='ld'
5040                 fi
5041                 rm -f try.c a.out
5042                 ;;
5043         *)      dflt="$ld"
5044                 ;;
5045         esac
5046
5047     rp="What command should be used to create dynamic libraries?"
5048     . ./myread
5049         ld="$ans"
5050
5051     cat << EOM
5052
5053 Some systems may require passing special flags to $ld to create a
5054 library that can be dynamically loaded.  If your ld flags include
5055 -L/other/path options to locate libraries outside your loader's normal
5056 search path, you may need to specify those -L options here as well.  To
5057 use no flags, say "none".
5058
5059 EOM
5060     case "$lddlflags" in
5061     '') case "$osname" in
5062                         hpux)  dflt='-b' ;;
5063                         linux|irix*)    dflt='-shared' ;;
5064                         next)  dflt='none' ;;
5065                         solaris) dflt='-G' ;;
5066                         sunos) dflt='-assert nodefinitions' ;;
5067                         svr4*|esix*) dflt="-G $ldflags" ;;
5068                 *)     dflt='none' ;;
5069                         esac
5070                         ;;
5071     *) dflt="$lddlflags" ;;
5072     esac
5073
5074         : Try to guess additional flags to pick up local libraries.
5075         for thisflag in $ldflags; do
5076                 case "$thisflag" in
5077                 -L*)
5078                         case " $dflt " in
5079                         *" $thisflag "*) ;;
5080                         *) dflt="$dflt $thisflag" ;;
5081                         esac
5082                         ;;
5083                 esac
5084         done
5085
5086         case "$dflt" in
5087         ''|' ') dflt='none' ;;
5088         esac
5089
5090     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5091     . ./myread
5092     case "$ans" in
5093     none) lddlflags=' ' ;;
5094     *) lddlflags="$ans" ;;
5095     esac
5096
5097         cat <<EOM
5098
5099 Some systems may require passing special flags to $cc to indicate that
5100 the resulting executable will use dynamic linking.  To use no flags,
5101 say "none".
5102
5103 EOM
5104     case "$ccdlflags" in
5105     '') case "$osname" in
5106                 hpux)   dflt='-Wl,-E' ;;
5107                 linux)  dflt='-rdynamic' ;;
5108                 next)   dflt='none' ;;
5109                 sunos)  dflt='none' ;;
5110                 *)      dflt='none' ;;
5111             esac ;;
5112     ' ')  dflt='none' ;;
5113     *)  dflt="$ccdlflags" ;;
5114     esac
5115     rp="Any special flags to pass to $cc to use dynamic loading?"
5116     . ./myread
5117     case "$ans" in
5118     none) ccdlflags=' ' ;;
5119     *) ccdlflags="$ans" ;;
5120     esac
5121     ;;
5122 *)  usedl="$undef"
5123         ld='ld'
5124     dlsrc='dl_none.xs'
5125     lddlflags=''
5126     ccdlflags=''
5127     ;;
5128 esac
5129
5130 also=''
5131 case "$usedl" in
5132 $undef)
5133         # No dynamic loading being used, so don't bother even to prompt.
5134         useshrplib='false'
5135         ;;
5136 *)      case "$useshrplib" in
5137         '')     case "$osname" in
5138                 svr4*|dgux|dynixptx|esix|powerux)
5139                         dflt=y
5140                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5141                         ;;
5142                 next*)
5143                         case "$osvers" in
5144                         4*)     dflt=y
5145                                 also='Building a shared libperl is needed for MAB support.'
5146                                 ;;
5147                         *)      dflt=n
5148                                 ;;
5149                         esac
5150                         ;;
5151                 *)      dflt=n
5152                         ;;
5153                 esac
5154                 ;;
5155         $define|true|[Yy]*)
5156                 dflt=y
5157                 ;;
5158         *)      dflt=n
5159                 ;;
5160         esac
5161         $cat << EOM
5162
5163 The perl executable is normally obtained by linking perlmain.c with
5164 libperl${_a}, any static extensions (usually just DynaLoader), and
5165 any other libraries needed on this system (such as -lm, etc.).  Since
5166 your system supports dynamic loading, it is probably possible to build
5167 a shared libperl.$so.  If you will have more than one executable linked
5168 to libperl.$so, this will significantly reduce the size of each
5169 executable, but it may have a noticeable affect on performance.  The
5170 default is probably sensible for your system.
5171 $also
5172
5173 EOM
5174         rp="Build a shared libperl.$so (y/n)"
5175         . ./myread
5176         case "$ans" in
5177         true|$define|[Yy]*)
5178                 useshrplib='true'
5179                 # Why does next4 have to be so different?
5180                 case "${osname}${osvers}" in
5181                 next4*) xxx='DYLD_LIBRARY_PATH' ;;
5182                 os2*)   xxx='' ;; # Nothing special needed.
5183                 *)              xxx='LD_LIBRARY_PATH' ;;
5184                 esac
5185                 if test X"$xxx" != "X"; then
5186                         $cat <<EOM  | $tee -a ../config.msg >&4
5187
5188 To build perl, you must add the current working directory to your
5189 $xxx environment variable before running make.  You can do
5190 this with
5191    $xxx=\`pwd\`; export $xxx
5192 for Bourne-style shells, or
5193    setenv $xxx \`pwd\`
5194 for Csh-style shells.  You *MUST* do this before running make.
5195
5196 EOM
5197                 fi
5198                 ;;
5199         *)      useshrplib='false' ;;
5200         esac
5201         ;;
5202 esac
5203
5204 case "$useshrplib" in
5205 true)
5206         case "$libperl" in
5207         '')
5208                 # Figure out a good name for libperl.so.  Since it gets stored in
5209                 # a version-specific architecture-dependent library, the version
5210                 # number isn't really that important, except for making cc/ld happy.
5211                 #
5212                 # A name such as libperl.so.3.1
5213                 majmin="libperl.$so.$patchlevel.$subversion"
5214                 # A name such as libperl.so.301
5215                 majonly=`echo $patchlevel $subversion |
5216                         $awk '{printf "%d%02d", $1, $2}'`
5217                 majonly=libperl.$so.$majonly
5218                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5219                 # rely on figuring it out from the naming of libc.
5220                 case "${osname}${osvers}" in
5221                 next4*)
5222                         dflt=libperl.5.$so
5223                         # XXX How handle the --version stuff for MAB?
5224                         ;;
5225                 linux*)  # ld won't link with a bare -lperl otherwise.
5226                         dflt=libperl.$so
5227                         ;;
5228                 *)      # Try to guess based on whether libc has major.minor.
5229                         case "$libc" in
5230                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5231                         *libc.$so.[0-9]*) dflt=$majonly ;;
5232                         *)      dflt=libperl.$so ;;
5233                         esac
5234                         ;;
5235                 esac
5236                 ;;
5237         *)      dflt=$libperl
5238                 ;;
5239         esac
5240         cat << EOM
5241
5242 I need to select a good name for the shared libperl.  If your system uses
5243 library names with major and minor numbers, then you might want something
5244 like $majmin.  Alternatively, if your system uses a single version
5245 number for shared libraries, then you might want to use $majonly.
5246 Or, your system might be quite happy with a simple libperl.$so.
5247
5248 Since the shared libperl will get installed into a version-specific
5249 architecture-dependent directory, the version number of the shared perl
5250 library probably isn't important, so the default should be o.k.
5251
5252 EOM
5253         rp='What name do you want to give to the shared libperl?'
5254         . ./myread
5255         libperl=$ans
5256         echo "Ok, I'll use $libperl"
5257         ;;
5258 *)
5259         libperl="libperl${_a}"
5260         ;;
5261 esac
5262
5263 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5264 case "$shrpdir" in
5265 '') ;;
5266 *)      $cat >&4 <<EOM
5267 WARNING:  Use of the shrpdir variable for the installation location of
5268 the shared $libperl is not supported.  It was never documented and
5269 will not work in this version.  Let me (jhi@iki.fi)
5270 know of any problems this may cause.
5271
5272 EOM
5273         case "$shrpdir" in
5274         "$archlibexp/CORE")
5275                 $cat >&4 <<EOM
5276 But your current setting of $shrpdir is
5277 the default anyway, so it's harmless.
5278 EOM
5279                 ;;
5280         *)
5281                 $cat >&4 <<EOM
5282 Further, your current attempted setting of $shrpdir
5283 conflicts with the value of $archlibexp/CORE
5284 that installperl will use.
5285 EOM
5286                 ;;
5287         esac
5288         ;;
5289 esac
5290
5291 # How will the perl executable find the installed shared $libperl?
5292 # Add $xxx to ccdlflags.
5293 # If we can't figure out a command-line option, use $shrpenv to
5294 # set env LD_RUN_PATH.  The main perl makefile uses this.
5295 shrpdir=$archlibexp/CORE
5296 xxx=''
5297 tmp_shrpenv=''
5298 if "$useshrplib"; then
5299     case "$osname" in 
5300         aix)
5301                 # We'll set it in Makefile.SH...
5302                 ;;
5303         solaris|netbsd)
5304                 xxx="-R $shrpdir"
5305                 ;;
5306         freebsd)
5307                 xxx="-Wl,-R$shrpdir"
5308                 ;;
5309         linux|irix*|dec_osf)
5310                 xxx="-Wl,-rpath,$shrpdir"
5311                 ;;
5312         next)
5313                 # next doesn't like the default...
5314                 ;;
5315         *)
5316                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5317                 ;;
5318         esac
5319         case "$xxx" in
5320         '') ;;
5321         *)      
5322                 # Only add $xxx if it isn't already in ccdlflags.
5323                 case " $ccdlflags " in
5324                 *" $xxx "*)     ;;
5325                 *)      ccdlflags="$ccdlflags $xxx"
5326                         cat <<EOM >&4
5327
5328 Adding $xxx to the flags
5329 passed to $ld so that the perl executable will find the 
5330 installed shared $libperl.
5331
5332 EOM
5333                         ;;
5334                 esac
5335                 ;;
5336         esac
5337 fi
5338 # Respect a hint or command-line value.
5339 case "$shrpenv" in
5340 '') shrpenv="$tmp_shrpenv" ;;
5341 esac
5342
5343 : determine where manual pages go
5344 set man1dir man1dir none
5345 eval $prefixit
5346 $cat <<EOM
5347
5348 $spackage has manual pages available in source form.
5349 EOM
5350 case "$nroff" in
5351 nroff)
5352         echo "However, you don't have nroff, so they're probably useless to you."
5353         case "$man1dir" in
5354         '') man1dir="none";;
5355         esac;;
5356 esac
5357 echo "If you don't want the manual sources installed, answer 'none'."
5358 case "$man1dir" in
5359 ' ') dflt=none
5360         ;;
5361 '')
5362         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5363         lookpath="$lookpath $prefixexp/man/p_man/man1"
5364         lookpath="$lookpath $prefixexp/man/u_man/man1"
5365         lookpath="$lookpath $prefixexp/man/man.1"
5366         case "$sysman" in
5367         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5368         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5369         esac
5370         set dflt
5371         eval $prefixup
5372         ;;
5373 *)  dflt="$man1dir"
5374         ;;
5375 esac
5376 echo " "
5377 fn=dn+~
5378 rp="Where do the main $spackage manual pages (source) go?"
5379 . ./getfile
5380 if $test "X$man1direxp" != "X$ansexp"; then
5381         installman1dir=''
5382 fi
5383 man1dir="$ans"
5384 man1direxp="$ansexp"
5385 case "$man1dir" in
5386 '') man1dir=' '
5387         installman1dir='';;
5388 esac
5389 if $afs; then
5390         $cat <<EOM
5391
5392 Since you are running AFS, I need to distinguish the directory in which
5393 manual pages reside from the directory in which they are installed (and from
5394 which they are presumably copied to the former directory by occult means).
5395
5396 EOM
5397         case "$installman1dir" in
5398         '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
5399         *) dflt="$installman1dir";;
5400         esac
5401         fn=de~
5402         rp='Where will man pages be installed?'
5403         . ./getfile
5404         installman1dir="$ans"
5405 else
5406         installman1dir="$man1direxp"
5407 fi
5408
5409 : What suffix to use on installed man pages
5410
5411 case "$man1dir" in
5412 ' ')
5413         man1ext='0'
5414         ;;
5415 *)
5416         rp="What suffix should be used for the main $spackage man pages?"
5417         case "$man1ext" in
5418         '')     case "$man1dir" in
5419                 *1)  dflt=1 ;;
5420                 *1p) dflt=1p ;;
5421                 *1pm) dflt=1pm ;;
5422                 *l) dflt=l;;
5423                 *n) dflt=n;;
5424                 *o) dflt=o;;
5425                 *p) dflt=p;;
5426                 *C) dflt=C;;
5427                 *L) dflt=L;;
5428                 *L1) dflt=L1;;
5429                 *) dflt=1;;
5430                 esac
5431                 ;;
5432         *)      dflt="$man1ext";;
5433         esac
5434         . ./myread
5435         man1ext="$ans"
5436         ;;
5437 esac
5438
5439 : see if we can have long filenames
5440 echo " "
5441 rmlist="$rmlist /tmp/cf$$"
5442 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5443 first=123456789abcdef
5444 second=/tmp/cf$$/$first
5445 $rm -f $first $second
5446 if (echo hi >$first) 2>/dev/null; then
5447         if $test -f 123456789abcde; then
5448                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5449                 val="$undef"
5450         else
5451                 if (echo hi >$second) 2>/dev/null; then
5452                         if $test -f /tmp/cf$$/123456789abcde; then
5453                                 $cat <<'EOM'
5454 That's peculiar... You can have filenames longer than 14 characters, but only
5455 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5456 I shall consider your system cannot support long filenames at all.
5457 EOM
5458                                 val="$undef"
5459                         else
5460                                 echo 'You can have filenames longer than 14 characters.' >&4
5461                                 val="$define"
5462                         fi
5463                 else
5464                         $cat <<'EOM'
5465 How confusing! Some of your filesystems are sane enough to allow filenames
5466 longer than 14 characters but some others like /tmp can't even think about them.
5467 So, for now on, I shall assume your kernel does not allow them at all.
5468 EOM
5469                         val="$undef"
5470                 fi
5471         fi
5472 else
5473         $cat <<'EOM'
5474 You can't have filenames longer than 14 chars.  You can't even think about them!
5475 EOM
5476         val="$undef"
5477 fi 
5478 set d_flexfnam
5479 eval $setvar
5480 $rm -rf /tmp/cf$$ 123456789abcde*
5481
5482 : determine where library module manual pages go
5483 set man3dir man3dir none
5484 eval $prefixit
5485 $cat <<EOM
5486
5487 $spackage has manual pages for many of the library modules.
5488 EOM
5489
5490 case "$nroff" in
5491 nroff)
5492         $cat <<'EOM'
5493 However, you don't have nroff, so they're probably useless to you.
5494 EOM
5495         case "$man3dir" in
5496         '') man3dir="none";;
5497         esac;;
5498 esac
5499
5500 case "$d_flexfnam" in
5501 undef)
5502         $cat <<'EOM'
5503 However, your system can't handle the long file names like File::Basename.3. 
5504 EOM
5505         case "$man3dir" in
5506         '') man3dir="none";;
5507         esac;;
5508 esac
5509
5510 echo "If you don't want the manual sources installed, answer 'none'."
5511 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5512 case "$man3dir" in
5513 '')     case "$prefix" in 
5514         *$prog*) dflt=`echo $man1dir | 
5515                         $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
5516         *)      dflt="$privlib/man/man3" ;;
5517         esac
5518         ;;
5519 ' ') dflt=none;;
5520 *)      dflt="$man3dir" ;;
5521 esac
5522 echo " "
5523
5524 fn=dn+~
5525 rp="Where do the $package library man pages (source) go?"
5526 . ./getfile
5527 if test "X$man3direxp" != "X$ansexp"; then
5528         installman3dir=''
5529 fi
5530
5531 man3dir="$ans"
5532 man3direxp="$ansexp"
5533 case "$man3dir" in
5534 '') man3dir=' '
5535         installman3dir='';;
5536 esac
5537 if $afs; then
5538         $cat <<EOM
5539
5540 Since you are running AFS, I need to distinguish the directory in which
5541 manual pages reside from the directory in which they are installed (and from
5542 which they are presumably copied to the former directory by occult means).
5543
5544 EOM
5545         case "$installman3dir" in
5546         '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
5547         *) dflt="$installman3dir";;
5548         esac
5549         fn=de~
5550         rp='Where will man pages be installed?'
5551         . ./getfile
5552         installman3dir="$ans"
5553 else
5554         installman3dir="$man3direxp"
5555 fi
5556
5557 : What suffix to use on installed man pages
5558
5559 case "$man3dir" in
5560 ' ')
5561         man3ext='0'
5562         ;;
5563 *)
5564         rp="What suffix should be used for the $package library man pages?"
5565         case "$man3ext" in
5566         '')     case "$man3dir" in
5567                 *3)  dflt=3 ;;
5568                 *3p) dflt=3p ;;
5569                 *3pm) dflt=3pm ;;
5570                 *l) dflt=l;;
5571                 *n) dflt=n;;
5572                 *o) dflt=o;;
5573                 *p) dflt=p;;
5574                 *C) dflt=C;;
5575                 *L) dflt=L;;
5576                 *L3) dflt=L3;;
5577                 *) dflt=3;;
5578                 esac
5579                 ;;
5580         *)      dflt="$man3ext";;
5581         esac
5582         . ./myread
5583         man3ext="$ans"
5584         ;;
5585 esac
5586
5587 : see if we have to deal with yellow pages, now NIS.
5588 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5589         if $test -f /usr/etc/nibindd; then
5590                 echo " "
5591                 echo "I'm fairly confident you're on a NeXT."
5592                 echo " "
5593                 rp='Do you get the hosts file via NetInfo?'
5594                 dflt=y
5595                 case "$hostcat" in
5596                 nidump*) ;;
5597                 '') ;;
5598                 *) dflt=n;;
5599                 esac
5600                 . ./myread
5601                 case "$ans" in
5602                 y*) hostcat='nidump hosts .';;
5603                 *)      case "$hostcat" in
5604                         nidump*) hostcat='';;
5605                         esac
5606                         ;;
5607                 esac
5608         fi
5609         case "$hostcat" in
5610         nidump*) ;;
5611         *)
5612                 case "$hostcat" in
5613                 *ypcat*) dflt=y;;
5614                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5615                                 dflt=y
5616                         else
5617                                 dflt=n
5618                         fi;;
5619                 *) dflt=n;;
5620                 esac
5621                 echo " "
5622                 rp='Are you getting the hosts file via yellow pages?'
5623                 . ./myread
5624                 case "$ans" in
5625                 y*) hostcat='ypcat hosts';;
5626                 *) hostcat='cat /etc/hosts';;
5627                 esac
5628                 ;;
5629         esac
5630 fi
5631 case "$hostcat" in
5632 '') hostcat='cat /etc/hosts';;
5633 esac
5634 case "$groupcat" in
5635 '') groupcat='cat /etc/group';;
5636 esac
5637 case "$passcat" in
5638 '') passcat='cat /etc/passwd';;
5639 esac
5640
5641 : now get the host name
5642 echo " "
5643 echo "Figuring out host name..." >&4
5644 case "$myhostname" in
5645 '') cont=true
5646         echo 'Maybe "hostname" will work...'
5647         if tans=`sh -c hostname 2>&1` ; then
5648                 myhostname=$tans
5649                 phostname=hostname
5650                 cont=''
5651         fi
5652         ;;
5653 *) cont='';;
5654 esac
5655 if $test "$cont"; then
5656         if ./xenix; then
5657                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
5658                 if tans=`cat /etc/systemid 2>&1` ; then
5659                         myhostname=$tans
5660                         phostname='cat /etc/systemid'
5661                         echo "Whadyaknow.  Xenix always was a bit strange..."
5662                         cont=''
5663                 fi
5664         elif $test -r /etc/systemid; then
5665                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5666         fi
5667 fi
5668 if $test "$cont"; then
5669         echo 'No, maybe "uuname -l" will work...'
5670         if tans=`sh -c 'uuname -l' 2>&1` ; then
5671                 myhostname=$tans
5672                 phostname='uuname -l'
5673         else
5674                 echo 'Strange.  Maybe "uname -n" will work...'
5675                 if tans=`sh -c 'uname -n' 2>&1` ; then
5676                         myhostname=$tans
5677                         phostname='uname -n'
5678                 else
5679                         echo 'Oh well, maybe I can mine it out of whoami.h...'
5680                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5681                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5682                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5683                         else
5684                                 case "$myhostname" in
5685                                 '') echo "Does this machine have an identity crisis or something?"
5686                                         phostname='';;
5687                                 *)
5688                                         echo "Well, you said $myhostname before..."
5689                                         phostname='echo $myhostname';;
5690                                 esac
5691                         fi
5692                 fi
5693         fi
5694 fi
5695 : you do not want to know about this
5696 set $myhostname
5697 myhostname=$1
5698
5699 : verify guess
5700 if $test "$myhostname" ; then
5701         dflt=y
5702         rp='Your host name appears to be "'$myhostname'".'" Right?"
5703         . ./myread
5704         case "$ans" in
5705         y*) ;;
5706         *) myhostname='';;
5707         esac
5708 fi
5709
5710 : bad guess or no guess
5711 while $test "X$myhostname" = X ; do
5712         dflt=''
5713         rp="Please type the (one word) name of your host:"
5714         . ./myread
5715         myhostname="$ans"
5716 done
5717
5718 : translate upper to lower if necessary
5719 case "$myhostname" in
5720 *[A-Z]*)
5721         echo "(Normalizing case in your host name)"
5722         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5723         ;;
5724 esac
5725
5726 case "$myhostname" in
5727 *.*)
5728         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
5729         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
5730         echo "(Trimming domain name from host name--host name is now $myhostname)"
5731         ;;
5732 *) case "$mydomain" in
5733         '')
5734                 {
5735                         test "X$hostcat" = "Xypcat hosts" &&
5736                         ypmatch "$myhostname" hosts 2>/dev/null |\
5737                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
5738                         $test -s hosts
5739                 } || {
5740                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
5741                                         /[       ]$myhostname[  . ]/p" > hosts
5742                 }
5743                 tmp_re="[       . ]"
5744                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
5745                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
5746                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
5747                         hosts | $sort | $uniq | \
5748                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
5749                 case `$echo X$dflt` in
5750                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
5751                         dflt=.
5752                         ;;
5753                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
5754                         ;;
5755                 esac
5756                 case "$dflt" in
5757                 .)
5758                         tans=`./loc resolv.conf X /etc /usr/etc`
5759                         if $test -f "$tans"; then
5760                                 echo "(Attempting domain name extraction from $tans)"
5761                                 dflt=.`$sed -n -e 's/   / /g' \
5762                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
5763                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5764                                 case "$dflt" in
5765                                 .) dflt=.`$sed -n -e 's/        / /g' \
5766                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
5767                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5768                                         ;;
5769                                 esac
5770                         fi
5771                         ;;
5772                 esac
5773                 case "$dflt" in
5774                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
5775                         dflt=.`sh -c domainname 2>/dev/null`
5776                         case "$dflt" in
5777                         '') dflt='.';;
5778                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
5779                         esac
5780                         ;;
5781                 esac
5782                 case "$dflt" in
5783                 .) echo "(Lost all hope -- silly guess then)"
5784                         dflt='.uucp'
5785                         ;;
5786                 esac
5787                 $rm -f hosts
5788                 ;;
5789         *) dflt="$mydomain";;
5790         esac;;
5791 esac
5792 echo " "
5793 rp="What is your domain name?"
5794 . ./myread
5795 tans="$ans"
5796 case "$ans" in
5797 '') ;;
5798 .*) ;;
5799 *) tans=".$tans";;
5800 esac
5801 mydomain="$tans"
5802
5803 : translate upper to lower if necessary
5804 case "$mydomain" in
5805 *[A-Z]*)
5806         echo "(Normalizing case in your domain name)"
5807         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
5808         ;;
5809 esac
5810
5811 : a little sanity check here
5812 case "$phostname" in
5813 '') ;;
5814 *)
5815         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
5816         $myhostname$mydomain|$myhostname) ;;
5817         *)
5818                 case "$phostname" in
5819                 sed*)
5820                         echo "(That doesn't agree with your whoami.h file, by the way.)"
5821                         ;;
5822                 *)
5823                         echo "(That doesn't agree with your $phostname command, by the way.)"
5824                         ;;
5825                 esac
5826         ;;
5827         esac
5828         ;;
5829 esac
5830
5831 $cat <<EOM
5832
5833 I need to get your e-mail address in Internet format if possible, i.e.
5834 something like user@host.domain. Please answer accurately since I have
5835 no easy means to double check it. The default value provided below
5836 is most probably close to the reality but may not be valid from outside
5837 your organization...
5838
5839 EOM
5840 cont=x
5841 while test "$cont"; do
5842         case "$cf_email" in
5843         '') dflt="$cf_by@$myhostname$mydomain";;
5844         *) dflt="$cf_email";;
5845         esac
5846         rp='What is your e-mail address?'
5847         . ./myread
5848         cf_email="$ans"
5849         case "$cf_email" in
5850         *@*.*) cont='' ;;
5851         *)
5852                 rp='Address does not look like an Internet one.  Use it anyway?'
5853                 case "$fastread" in
5854                 yes) dflt=y ;;
5855                 *) dflt=n ;;
5856                 esac
5857                 . ./myread
5858                 case "$ans" in
5859                 y*) cont='' ;;
5860                 *) echo " " ;;
5861                 esac
5862                 ;;
5863         esac
5864 done
5865
5866 $cat <<EOM
5867
5868 If you or somebody else will be maintaining perl at your site, please
5869 fill in the correct e-mail address here so that they may be contacted
5870 if necessary. Currently, the "perlbug" program included with perl
5871 will send mail to this address in addition to perlbug@perl.com. You may
5872 enter "none" for no administrator.
5873
5874 EOM
5875 case "$perladmin" in
5876 '') dflt="$cf_email";;
5877 *) dflt="$perladmin";;
5878 esac
5879 rp='Perl administrator e-mail address'
5880 . ./myread
5881 perladmin="$ans"
5882
5883 : figure out how to guarantee perl startup
5884 case "$startperl" in
5885 '')
5886         case "$sharpbang" in
5887         *!)
5888                 $cat <<EOH
5889
5890 I can use the #! construct to start perl on your system. This will
5891 make startup of perl scripts faster, but may cause problems if you
5892 want to share those scripts and perl is not in a standard place
5893 ($binexp/perl) on all your platforms. The alternative is to force
5894 a shell by starting the script with a single ':' character.
5895
5896 EOH
5897                 dflt="$binexp/perl"
5898                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
5899                 . ./myread
5900                 case "$ans" in
5901                 none)   startperl=": # use perl";;
5902                 *)      startperl="#!$ans"
5903                         if $test 30 -lt `echo "$ans" | wc -c`; then
5904                                 $cat >&4 <<EOM
5905
5906 WARNING:  Some systems limit the #! command to 32 characters.
5907 If you experience difficulty running Perl scripts with #!, try
5908 installing Perl in a directory with a shorter pathname.
5909
5910 EOM
5911                         fi ;;
5912                 esac
5913                 ;;
5914         *) startperl=": # use perl"
5915                 ;;
5916         esac
5917         ;;
5918 esac
5919 echo "I'll use $startperl to start perl scripts."
5920
5921 : figure best path for perl in scripts
5922 case "$perlpath" in
5923 '')
5924         perlpath="$binexp/perl"
5925         case "$startperl" in
5926         *!*) ;;
5927         *)
5928                 $cat <<EOH
5929
5930 I will use the "eval 'exec'" idiom to start Perl on your system.
5931 I can use the full path of your Perl binary for this purpose, but
5932 doing so may cause problems if you want to share those scripts and
5933 Perl is not always in a standard place ($binexp/perl).
5934
5935 EOH
5936                 dflt="$binexp/perl"
5937                 rp="What path shall I use in \"eval 'exec'\"?"
5938                 . ./myread
5939                 perlpath="$ans"
5940                 ;;
5941         esac
5942         ;;
5943 esac
5944 case "$startperl" in
5945 *!*)    ;;
5946 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
5947 esac
5948
5949 : determine where public executable scripts go
5950 set scriptdir scriptdir
5951 eval $prefixit
5952 case "$scriptdir" in
5953 '')
5954         dflt="$bin"
5955         : guess some guesses
5956         $test -d /usr/share/scripts && dflt=/usr/share/scripts
5957         $test -d /usr/share/bin && dflt=/usr/share/bin
5958         $test -d /usr/local/script && dflt=/usr/local/script
5959         $test -d $prefixexp/script && dflt=$prefixexp/script
5960         set dflt
5961         eval $prefixup
5962         ;;
5963 *)  dflt="$scriptdir"
5964         ;;
5965 esac
5966 $cat <<EOM
5967  
5968 Some installations have a separate directory just for executable scripts so
5969 that they can mount it across multiple architectures but keep the scripts in
5970 one spot.  You might, for example, have a subdirectory of /usr/share for this.
5971 Or you might just lump your scripts in with all your other executables.
5972  
5973 EOM
5974 fn=d~
5975 rp='Where do you keep publicly executable scripts?'
5976 . ./getfile
5977 if $test "X$ansexp" != "X$scriptdirexp"; then
5978         installscript=''
5979 fi
5980 scriptdir="$ans"
5981 scriptdirexp="$ansexp"
5982 if $afs; then
5983         $cat <<EOM
5984
5985 Since you are running AFS, I need to distinguish the directory in which
5986 scripts reside from the directory in which they are installed (and from
5987 which they are presumably copied to the former directory by occult means).
5988
5989 EOM
5990         case "$installscript" in
5991         '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
5992         *) dflt="$installscript";;
5993         esac
5994         fn=de~
5995         rp='Where will public scripts be installed?'
5996         . ./getfile
5997         installscript="$ans"
5998 else
5999         installscript="$scriptdirexp"
6000 fi
6001
6002 : determine where site specific libraries go.
6003 : Usual default is /usr/local/lib/perl5/site_perl/$apiversion
6004 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6005 case "$prefix" in
6006 *perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
6007 *)       set dflt sitelib lib/$package/site_$prog/$apiversion ;;
6008 esac
6009 eval $prefixit
6010 $cat <<EOM
6011
6012 The installation process will also create a directory for
6013 site-specific extensions and modules.  Some users find it convenient
6014 to place all local files in this directory rather than in the main
6015 distribution directory.
6016
6017 EOM
6018 fn=d~+
6019 rp='Pathname for the site-specific library files?'
6020 . ./getfile
6021 if $test "X$sitelibexp" != "X$ansexp"; then
6022         installsitelib=''
6023 fi
6024 sitelib="$ans"
6025 sitelibexp="$ansexp"
6026 if $afs; then
6027         $cat <<EOM
6028
6029 Since you are running AFS, I need to distinguish the directory in
6030 which site-specific files reside from the directory in which they are
6031 installed (and from which they are presumably copied to the former
6032 directory by occult means).
6033
6034 EOM
6035         case "$installsitelib" in
6036         '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
6037         *) dflt="$installsitelib";;
6038         esac
6039         fn=de~
6040         rp='Where will site-specific files be installed?'
6041         . ./getfile
6042         installsitelib="$ans"
6043 else
6044         installsitelib="$sitelibexp"
6045 fi
6046
6047 : determine where site specific architecture-dependent libraries go.
6048 : sitelib  default is /usr/local/lib/perl5/site_perl/$apiversion
6049 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6050 : sitelib may have an optional trailing /share.
6051 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6052 tdflt="$tdflt/$archname"
6053 set sitearch sitearch none
6054 eval $prefixit
6055 case "$sitearch" in
6056 '')     dflt="$tdflt" ;;
6057 *)      dflt="$sitearch" ;;
6058 esac
6059 $cat <<EOM
6060
6061 The installation process will also create a directory for
6062 architecture-dependent site-specific extensions and modules.
6063
6064 EOM
6065 fn=nd~+
6066 rp='Pathname for the site-specific architecture-dependent library files?'
6067 . ./getfile
6068 if $test "X$sitearchexp" != "X$ansexp"; then
6069         installsitearch=''
6070 fi
6071 sitearch="$ans"
6072 sitearchexp="$ansexp"
6073 if $afs; then
6074         $cat <<EOM
6075
6076 Since you are running AFS, I need to distinguish the directory in
6077 which site-specific architecture-dependent library files reside from
6078 the directory in which they are installed (and from which they are
6079 presumably copied to the former directory by occult means).
6080
6081 EOM
6082         case "$installsitearch" in
6083         '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
6084         *) dflt="$installsitearch";;
6085         esac
6086         fn=de~
6087         rp='Where will site-specific architecture-dependent files be installed?'
6088         . ./getfile
6089         installsitearch="$ans"
6090 else
6091         installsitearch="$sitearchexp"
6092 fi
6093
6094 cat <<EOM
6095
6096 Previous version of $package used the standard IO mechanisms as defined
6097 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6098 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6099 the default.  This abstraction layer can use AT&T's sfio (if you already
6100 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6101 problems with some extension modules.  Using PerlIO with stdio is safe,
6102 but it is slower than plain stdio and therefore is not the default.
6103
6104 If this doesn't make any sense to you, just accept the default 'n'.
6105 EOM
6106 case "$useperlio" in
6107 $define|true|[yY]*)     dflt='y';;
6108 *) dflt='n';;
6109 esac
6110 rp='Use the experimental PerlIO abstraction layer?'
6111 . ./myread
6112 case "$ans" in
6113 y|Y) 
6114         val="$define"
6115         ;;     
6116 *)      
6117         echo "Ok, doing things the stdio way"
6118         val="$undef"
6119         ;;
6120 esac
6121 set useperlio
6122 eval $setvar 
6123
6124 : Check how to convert floats to strings.
6125 if test "X$d_Gconvert" = X; then
6126         echo " "
6127         echo "Checking for an efficient way to convert floats to strings."
6128         $cat >try.c <<'EOP'
6129 #ifdef TRY_gconvert
6130 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6131 char *myname = "gconvert";
6132 #endif
6133 #ifdef TRY_gcvt
6134 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6135 char *myname = "gcvt";
6136 #endif
6137 #ifdef TRY_sprintf
6138 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6139 char *myname = "sprintf";
6140 #endif
6141
6142 #include <stdio.h>
6143
6144 int
6145 checkit(expect, got)
6146 char *expect;
6147 char *got;
6148 {
6149     if (strcmp(expect, got)) {
6150                 printf("%s oddity:  Expected %s, got %s\n",
6151                         myname, expect, got);
6152                 exit(1);
6153         }
6154 }
6155
6156 int
6157 main()
6158
6159         char buf[64]; 
6160         buf[63] = '\0';
6161
6162         /* This must be 1st test on (which?) platform */
6163         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6164         Gconvert(0.1, 8, 0, buf);
6165         checkit("0.1", buf);
6166
6167         Gconvert(1.0, 8, 0, buf); 
6168         checkit("1", buf);
6169
6170         Gconvert(0.0, 8, 0, buf); 
6171         checkit("0", buf);
6172
6173         Gconvert(-1.0, 8, 0, buf); 
6174         checkit("-1", buf);
6175
6176         /* Some Linux gcvt's give 1.e+5 here. */
6177         Gconvert(100000.0, 8, 0, buf); 
6178         checkit("100000", buf);
6179         
6180         /* Some Linux gcvt's give -1.e+5 here. */
6181         Gconvert(-100000.0, 8, 0, buf); 
6182         checkit("-100000", buf);
6183
6184         exit(0);
6185 }
6186 EOP
6187         case "$d_Gconvert" in
6188         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6189         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6190         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6191         *) xxx_list='gconvert gcvt sprintf' ;;
6192         esac
6193
6194         for xxx_convert in $xxx_list; do
6195                 echo "Trying $xxx_convert"
6196                 $rm -f try try$_o
6197                 set try -DTRY_$xxx_convert
6198                 if eval $compile; then
6199                         echo "$xxx_convert" found. >&4
6200                         if ./try; then
6201                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6202                                 break;
6203                         else
6204                                 echo "...But $xxx_convert didn't work as I expected."
6205                         fi
6206                 else
6207                         echo "$xxx_convert NOT found." >&4
6208                 fi
6209         done
6210                 
6211         case "$xxx_convert" in
6212         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6213         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6214         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6215         esac
6216 fi
6217
6218 : Initialize h_fcntl
6219 h_fcntl=false
6220
6221 : Initialize h_sysfile
6222 h_sysfile=false
6223
6224 : access call always available on UNIX
6225 set access d_access
6226 eval $inlibc
6227
6228 : locate the flags for 'access()'
6229 case "$d_access" in
6230 "$define")
6231         echo " "
6232         $cat >access.c <<'EOCP'
6233 #include <sys/types.h>
6234 #ifdef I_FCNTL
6235 #include <fcntl.h>
6236 #endif
6237 #ifdef I_SYS_FILE
6238 #include <sys/file.h>
6239 #endif
6240 #ifdef I_UNISTD
6241 #include <unistd.h>
6242 #endif
6243 main() {
6244         exit(R_OK);
6245 }
6246 EOCP
6247         : check sys/file.h first, no particular reason here
6248         if $test `./findhdr sys/file.h` && \
6249                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
6250                 h_sysfile=true;
6251                 echo "<sys/file.h> defines the *_OK access constants." >&4
6252         elif $test `./findhdr fcntl.h` && \
6253                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
6254                 h_fcntl=true;
6255                 echo "<fcntl.h> defines the *_OK access constants." >&4
6256         elif $test `./findhdr unistd.h` && \
6257                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
6258                 echo "<unistd.h> defines the *_OK access constants." >&4
6259         else
6260                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
6261         fi
6262         ;;
6263 esac
6264 $rm -f access*
6265
6266 : see if accessx exists
6267 set accessx d_accessx
6268 eval $inlibc
6269
6270 : see if alarm exists
6271 set alarm d_alarm
6272 eval $inlibc
6273
6274 : Look for GNU-cc style attribute checking
6275 echo " "
6276 echo "Checking whether your compiler can handle __attribute__ ..." >&4
6277 $cat >attrib.c <<'EOCP'
6278 #include <stdio.h>
6279 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
6280 EOCP
6281 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
6282         if $contains 'warning' attrib.out >/dev/null 2>&1; then
6283                 echo "Your C compiler doesn't fully support __attribute__."
6284                 val="$undef"
6285         else
6286                 echo "Your C compiler supports __attribute__."
6287                 val="$define"
6288         fi
6289 else
6290         echo "Your C compiler doesn't seem to understand __attribute__ at all."
6291         val="$undef"
6292 fi
6293 set d_attribut
6294 eval $setvar
6295 $rm -f attrib*
6296
6297 : see if bcmp exists
6298 set bcmp d_bcmp
6299 eval $inlibc
6300
6301 : see if bcopy exists
6302 set bcopy d_bcopy
6303 eval $inlibc
6304
6305 : see if this is a unistd.h system
6306 set unistd.h i_unistd
6307 eval $inhdr
6308
6309 : see if getpgrp exists
6310 set getpgrp d_getpgrp
6311 eval $inlibc
6312
6313 case "$d_getpgrp" in
6314 "$define")
6315         echo " "
6316         echo "Checking to see which flavor of getpgrp is in use..."
6317         $cat >set.c <<EOP
6318 #$i_unistd I_UNISTD
6319 #include <sys/types.h>
6320 #ifdef I_UNISTD
6321 #  include <unistd.h>
6322 #endif
6323 main()
6324 {
6325         if (getuid() == 0) {
6326                 printf("(I see you are running Configure as super-user...)\n");
6327                 setuid(1);
6328         }
6329 #ifdef TRY_BSD_PGRP
6330         if (getpgrp(1) == 0)
6331                 exit(0);
6332 #else
6333         if (getpgrp() > 0)
6334                 exit(0);
6335 #endif
6336         exit(1);
6337 }
6338 EOP
6339         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6340                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6341                 val="$define"
6342         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6343                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6344                 val="$undef"
6345         else
6346                 echo "I can't seem to compile and run the test program."
6347                 if ./usg; then
6348                         xxx="a USG one, i.e. you use getpgrp()."
6349                 else
6350                         # SVR4 systems can appear rather BSD-ish.
6351                         case "$i_unistd" in
6352                         $undef)
6353                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
6354                                 val="$define"
6355                                 ;;
6356                         $define)
6357                                 xxx="probably a USG one, i.e. you use getpgrp()."
6358                                 val="$undef"
6359                                 ;;
6360                         esac
6361                 fi
6362                 echo "Assuming your getpgrp is $xxx" >&4
6363         fi
6364         ;;
6365 *) val="$undef";;
6366 esac
6367 set d_bsdgetpgrp
6368 eval $setvar
6369 $rm -f set set.c
6370
6371 : see if setpgrp exists
6372 set setpgrp d_setpgrp
6373 eval $inlibc
6374
6375 case "$d_setpgrp" in
6376 "$define")
6377         echo " "
6378         echo "Checking to see which flavor of setpgrp is in use..."
6379         $cat >set.c <<EOP
6380 #$i_unistd I_UNISTD
6381 #include <sys/types.h>
6382 #ifdef I_UNISTD
6383 #  include <unistd.h>
6384 #endif
6385 main()
6386 {
6387         if (getuid() == 0) {
6388                 printf("(I see you are running Configure as super-user...)\n");
6389                 setuid(1);
6390         }
6391 #ifdef TRY_BSD_PGRP
6392         if (-1 == setpgrp(1, 1))
6393                 exit(0);
6394 #else
6395         if (setpgrp() != -1)
6396                 exit(0);
6397 #endif
6398         exit(1);
6399 }
6400 EOP
6401         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6402                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6403                 val="$define"
6404         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6405                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6406                 val="$undef"
6407         else
6408                 echo "(I can't seem to compile and run the test program.)"
6409                 if ./usg; then
6410                         xxx="a USG one, i.e. you use setpgrp()."
6411                 else
6412                         # SVR4 systems can appear rather BSD-ish.
6413                         case "$i_unistd" in
6414                         $undef)
6415                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6416                                 val="$define"
6417                                 ;;
6418                         $define)
6419                                 xxx="probably a USG one, i.e. you use setpgrp()."
6420                                 val="$undef"
6421                                 ;;
6422                         esac
6423                 fi
6424                 echo "Assuming your setpgrp is $xxx" >&4
6425         fi
6426         ;;
6427 *) val="$undef";;
6428 esac
6429 set d_bsdsetpgrp
6430 eval $setvar
6431 $rm -f set set.c
6432 : see if bzero exists
6433 set bzero d_bzero
6434 eval $inlibc
6435
6436 : check for lengths of integral types
6437 echo " "
6438 case "$intsize" in
6439 '')
6440         echo "Checking to see how big your integers are..." >&4
6441         $cat >intsize.c <<'EOCP'
6442 #include <stdio.h>
6443 main()
6444 {
6445         printf("intsize=%d;\n", sizeof(int));
6446         printf("longsize=%d;\n", sizeof(long));
6447         printf("shortsize=%d;\n", sizeof(short));
6448         exit(0);
6449 }
6450 EOCP
6451         set intsize
6452         if eval $compile_ok && ./intsize > /dev/null; then
6453                 eval `./intsize`
6454                 echo "Your integers are $intsize bytes long."
6455                 echo "Your long integers are $longsize bytes long."
6456                 echo "Your short integers are $shortsize bytes long."
6457         else
6458                 $cat >&4 <<EOM
6459 !
6460 Help! I can't compile and run the intsize test program: please enlighten me!
6461 (This is probably a misconfiguration in your system or libraries, and
6462 you really ought to fix it.  Still, I'll try anyway.)
6463 !
6464 EOM
6465                 dflt=4
6466                 rp="What is the size of an integer (in bytes)?"
6467                 . ./myread
6468                 intsize="$ans"
6469                 dflt=$intsize
6470                 rp="What is the size of a long integer (in bytes)?"
6471                 . ./myread
6472                 longsize="$ans"
6473                 dflt=2
6474                 rp="What is the size of a short integer (in bytes)?"
6475                 . ./myread
6476                 shortsize="$ans"
6477         fi
6478         ;;
6479 esac
6480 $rm -f intsize intsize.*
6481
6482 : see if signal is declared as pointer to function returning int or void
6483 echo " "
6484 xxx=`./findhdr signal.h`
6485 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6486 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
6487         echo "You have int (*signal())() instead of void." >&4
6488         val="$undef"
6489 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
6490         echo "You have void (*signal())()." >&4
6491         val="$define"
6492 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6493         echo "You have int (*signal())() instead of void." >&4
6494         val="$undef"
6495 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6496         echo "You have void (*signal())()." >&4
6497         val="$define"
6498 else
6499         case "$d_voidsig" in
6500         '')
6501         echo "I can't determine whether signal handler returns void or int..." >&4
6502                 dflt=void
6503                 rp="What type does your signal handler return?"
6504                 . ./myread
6505                 case "$ans" in
6506                 v*) val="$define";;
6507                 *) val="$undef";;
6508                 esac;;
6509         "$define")
6510                 echo "As you already told me, signal handler returns void." >&4
6511                 val="$define"
6512                 ;;
6513         *)      echo "As you already told me, signal handler returns int." >&4
6514                 val="$undef"
6515                 ;;
6516         esac
6517 fi
6518 set d_voidsig
6519 eval $setvar
6520 case "$d_voidsig" in
6521 "$define") signal_t="void";;
6522 *) signal_t="int";;
6523 esac
6524 $rm -f $$.tmp
6525
6526 : check for ability to cast large floats to 32-bit ints.
6527 echo " "
6528 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
6529 if $test "$intsize" -ge 4; then
6530         xxx=int
6531 else
6532         xxx=long
6533 fi
6534 $cat >try.c <<EOCP
6535 #include <stdio.h>
6536 #include <sys/types.h>
6537 #include <signal.h>
6538 $signal_t blech(s) int s; { exit(3); }
6539 main()
6540 {
6541         $xxx i32;
6542         double f, g;
6543         int result = 0;
6544         char str[16];
6545         signal(SIGFPE, blech);
6546
6547         /* Don't let compiler optimize the test away.  Store the number 
6548            in a writable string for gcc to pass to sscanf under HP/UX.
6549         */
6550         sprintf(str, "2147483647");
6551         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
6552         g = 10 * f;
6553         i32  = ($xxx) g;
6554
6555         /* x86 processors will probably give 0x8000 0000, which is a
6556        sign change.  We don't want that.  We want to mimic SPARC
6557            behavior here, which is to preserve the sign and give
6558            back 0x7fff ffff.
6559         */
6560         if (i32 != ($xxx) f)
6561                 result |= 1;
6562         exit(result);
6563 }
6564 EOCP
6565 set try
6566 if eval $compile_ok; then
6567         ./try
6568         yyy=$?
6569 else
6570         echo "(I can't seem to compile the test program--assuming it can't)"
6571         yyy=1
6572 fi
6573 case "$yyy" in
6574 0)      val="$define"
6575         echo "Yup, it can."
6576         ;;
6577 *)      val="$undef"
6578         echo "Nope, it can't."
6579         ;;
6580 esac
6581 set d_casti32
6582 eval $setvar
6583 $rm -f try try.*
6584
6585 : check for ability to cast negative floats to unsigned
6586 echo " "
6587 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
6588 $cat >try.c <<EOCP
6589 #include <stdio.h>
6590 #include <sys/types.h>
6591 #include <signal.h>
6592 $signal_t blech(s) int s; { exit(7); }
6593 $signal_t blech_in_list(s) int s; { exit(4); }
6594 unsigned long dummy_long(p) unsigned long p; { return p; }
6595 unsigned int dummy_int(p) unsigned int p; { return p; }
6596 unsigned short dummy_short(p) unsigned short p; { return p; }
6597 main()
6598 {
6599         double f;
6600         unsigned long along;
6601         unsigned int aint;
6602         unsigned short ashort;
6603         int result = 0;
6604         char str[16];
6605         
6606         /* Frustrate gcc-2.7.2's optimizer which failed this test with
6607            a direct f = -123. assignment.  gcc-2.8.0 reportedly
6608            optimized the whole file away
6609         */
6610         /* Store the number in a writable string for gcc to pass to 
6611            sscanf under HP/UX.
6612         */
6613         sprintf(str, "-123");
6614         sscanf(str, "%lf", &f);  /* f = -123.; */
6615
6616         signal(SIGFPE, blech);
6617         along = (unsigned long)f;
6618         aint = (unsigned int)f;
6619         ashort = (unsigned short)f;
6620         if (along != (unsigned long)-123)
6621                 result |= 1;
6622         if (aint != (unsigned int)-123)
6623                 result |= 1;
6624         if (ashort != (unsigned short)-123)
6625                 result |= 1;
6626         sprintf(str, "1073741824.");
6627         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
6628         f = f + f;
6629         along = 0;
6630         along = (unsigned long)f;
6631         if (along != 0x80000000)
6632                 result |= 2;
6633         f -= 1.;
6634         along = 0;
6635         along = (unsigned long)f;
6636         if (along != 0x7fffffff)
6637                 result |= 1;
6638         f += 2.;
6639         along = 0;
6640         along = (unsigned long)f;
6641         if (along != 0x80000001)
6642                 result |= 2;
6643         if (result)
6644                 exit(result);
6645         signal(SIGFPE, blech_in_list);
6646         sprintf(str, "123.");
6647         sscanf(str, "%lf", &f);  /* f = 123.; */
6648         along = dummy_long((unsigned long)f);
6649         aint = dummy_int((unsigned int)f);
6650         ashort = dummy_short((unsigned short)f);
6651         if (along != (unsigned long)123)
6652                 result |= 4;
6653         if (aint != (unsigned int)123)
6654                 result |= 4;
6655         if (ashort != (unsigned short)123)
6656                 result |= 4;
6657         exit(result);
6658
6659 }
6660 EOCP
6661 set try
6662 if eval $compile_ok; then
6663         ./try
6664         castflags=$?
6665 else
6666         echo "(I can't seem to compile the test program--assuming it can't)"
6667         castflags=7
6668 fi
6669 case "$castflags" in
6670 0)      val="$define"
6671         echo "Yup, it can."
6672         ;;
6673 *)      val="$undef"
6674         echo "Nope, it can't."
6675         ;;
6676 esac
6677 set d_castneg
6678 eval $setvar
6679 $rm -f try.*
6680
6681 : see if vprintf exists
6682 echo " "
6683 if set vprintf val -f d_vprintf; eval $csym; $val; then
6684         echo 'vprintf() found.' >&4
6685         val="$define"
6686         $cat >vprintf.c <<'EOF'
6687 #include <varargs.h>
6688
6689 main() { xxx("foo"); }
6690
6691 xxx(va_alist)
6692 va_dcl
6693 {
6694         va_list args;
6695         char buf[10];
6696
6697         va_start(args);
6698         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
6699 }
6700 EOF
6701         set vprintf
6702         if eval $compile && ./vprintf; then
6703                 echo "Your vsprintf() returns (int)." >&4
6704                 val2="$undef"
6705         else
6706                 echo "Your vsprintf() returns (char*)." >&4
6707                 val2="$define"
6708         fi
6709 else
6710         echo 'vprintf() NOT found.' >&4
6711                 val="$undef"
6712                 val2="$undef"
6713 fi
6714 set d_vprintf
6715 eval $setvar
6716 val=$val2
6717 set d_charvspr
6718 eval $setvar
6719
6720 : see if chown exists
6721 set chown d_chown
6722 eval $inlibc
6723
6724 : see if chroot exists
6725 set chroot d_chroot
6726 eval $inlibc
6727
6728 : see if chsize exists
6729 set chsize d_chsize
6730 eval $inlibc
6731
6732 : check for const keyword
6733 echo " "
6734 echo 'Checking to see if your C compiler knows about "const"...' >&4
6735 $cat >const.c <<'EOCP'
6736 typedef struct spug { int drokk; } spug;
6737 main()
6738 {
6739         const char *foo;
6740         const spug y;
6741 }
6742 EOCP
6743 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
6744         val="$define"
6745         echo "Yup, it does."
6746 else
6747         val="$undef"
6748         echo "Nope, it doesn't."
6749 fi
6750 set d_const
6751 eval $setvar
6752
6753 : see if crypt exists
6754 echo " "
6755 if set crypt val -f d_crypt; eval $csym; $val; then
6756         echo 'crypt() found.' >&4
6757         val="$define"
6758         cryptlib=''
6759 else
6760         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
6761         if $test -z "$cryptlib"; then
6762                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
6763         else
6764                 cryptlib=-lcrypt
6765         fi
6766         if $test -z "$cryptlib"; then
6767                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
6768         else
6769                 cryptlib=-lcrypt
6770         fi
6771         if $test -z "$cryptlib"; then
6772                 cryptlib=`./loc libcrypt$_a "" $libpth`
6773         else
6774                 cryptlib=-lcrypt
6775         fi
6776         if $test -z "$cryptlib"; then
6777                 echo 'crypt() NOT found.' >&4
6778                 val="$undef"
6779         else
6780                 val="$define"
6781         fi
6782 fi
6783 set d_crypt
6784 eval $setvar
6785
6786 : see if cuserid exists
6787 set cuserid d_cuserid
6788 eval $inlibc
6789
6790 : see if this is a limits.h system
6791 set limits.h i_limits
6792 eval $inhdr
6793
6794 : see if this is a float.h system
6795 set float.h i_float
6796 eval $inhdr
6797
6798 : See if number of significant digits in a double precision number is known
6799 echo " "
6800 $cat >dbl_dig.c <<EOM
6801 #$i_limits I_LIMITS
6802 #$i_float I_FLOAT
6803 #ifdef I_LIMITS
6804 #include <limits.h>
6805 #endif
6806 #ifdef I_FLOAT
6807 #include <float.h>
6808 #endif
6809 #ifdef DBL_DIG
6810 printf("Contains DBL_DIG");
6811 #endif
6812 EOM
6813 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
6814 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
6815         echo "DBL_DIG found." >&4
6816         val="$define"
6817 else
6818         echo "DBL_DIG NOT found." >&4
6819         val="$undef"
6820 fi
6821 $rm -f dbl_dig.?
6822 set d_dbl_dig
6823 eval $setvar
6824
6825
6826 if $test X"$use64bits" = X"$define"; then
6827         : see if dbminit64 exists
6828         set dbminit64 d_dbminit64
6829         eval $inlibc
6830
6831         : see if dbmclose64 exists
6832         set dbmclose64 d_dbmclose64
6833         eval $inlibc
6834
6835         : see if fetch64 exists
6836         set fetch64 d_fetch64
6837         eval $inlibc
6838
6839         : see if store64 exists
6840         set store64 d_store64
6841         eval $inlibc
6842
6843         : see if delete64 exists
6844         set delete64 d_delete64
6845         eval $inlibc
6846
6847         : see if firstkey64 exists
6848         set firstkey64 d_firstkey64
6849         eval $inlibc
6850
6851         : see if nextkey64 exists
6852         set nextkey64 d_nextkey64
6853         eval $inlibc
6854 else
6855         val="$undef"
6856         for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
6857         do
6858                 set $xxx
6859                 eval $setvar
6860         done
6861 fi
6862
6863 : see if difftime exists
6864 set difftime d_difftime
6865 eval $inlibc
6866
6867 : see if sys/stat.h is available
6868 set sys/stat.h i_sysstat
6869 eval $inhdr
6870
6871 : see if this is a dirent system
6872 echo " "
6873 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
6874         val="$define"
6875         echo "<dirent.h> found." >&4
6876 else
6877         val="$undef"
6878         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
6879                 echo "<sys/dir.h> found." >&4
6880                 echo " "
6881         else
6882                 xinc=`./findhdr sys/ndir.h`
6883         fi
6884         echo "<dirent.h> NOT found." >&4
6885 fi
6886 set i_dirent
6887 eval $setvar
6888
6889 : Look for type of directory structure.
6890 echo " "
6891 $cppstdin $cppflags $cppminus < "$xinc" > try.c
6892
6893 case "$direntrytype" in
6894 ''|' ')
6895         case "$i_dirent" in
6896         $define) guess1='struct dirent' ;;
6897         *) guess1='struct direct'  ;;
6898         esac
6899         ;;
6900 *)      guess1="$direntrytype"
6901         ;;
6902 esac
6903
6904 case "$guess1" in
6905 'struct dirent') guess2='struct direct' ;;
6906 *) guess2='struct dirent' ;;
6907 esac
6908                 
6909 if $contains "$guess1" try.c >/dev/null 2>&1; then
6910         direntrytype="$guess1"
6911         echo "Your directory entries are $direntrytype." >&4
6912 elif $contains "$guess2" try.c >/dev/null 2>&1; then
6913         direntrytype="$guess2"
6914         echo "Your directory entries seem to be $direntrytype." >&4
6915 else
6916         echo "I don't recognize your system's directory entries." >&4
6917         rp="What type is used for directory entries on this system?"
6918         dflt="$guess1"
6919         . ./myread
6920         direntrytype="$ans"
6921 fi
6922 $rm -f try.c
6923
6924
6925 : see if the directory entry stores field length
6926 echo " "
6927 $cppstdin $cppflags $cppminus < "$xinc" > try.c
6928 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
6929         echo "Good, your directory entry keeps length information in d_namlen." >&4
6930         val="$define"
6931 else
6932         echo "Your directory entry does not know about the d_namlen field." >&4
6933         val="$undef"
6934 fi
6935 set d_dirnamlen
6936 eval $setvar
6937 $rm -f try.c
6938
6939 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
6940 while $test $# -ge 2; do
6941         case "$1" in
6942         $define) echo "#include <$2>";;
6943         esac ;
6944     shift 2;
6945 done > try.c;
6946 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
6947 if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6948         val="$define";
6949 else
6950         val="$undef";
6951 fi;
6952 set $varname;
6953 eval $setvar;
6954 $rm -f try.c try.o'
6955
6956
6957 if $test X"$use64bits" = X"$define"; then
6958         : see if fstat64 exists
6959         set fstat64 d_fstat64
6960         eval $inlibc
6961
6962         : see if ftruncate64 exists
6963         set ftruncate64 d_ftruncate64
6964         eval $inlibc
6965
6966         : see if lockf64 exists
6967         set lockf64 d_lockf64
6968         eval $inlibc
6969
6970         : see if lseek64 exists
6971         set lseek64 d_lseek64
6972         eval $inlibc
6973
6974         : see if lstat64 exists
6975         set lstat64 d_lstat64
6976         eval $inlibc
6977
6978         : see if open64 exists
6979         set open64 d_open64
6980         eval $inlibc
6981
6982         : see if opendir64 exists
6983         set opendir64 d_opendir64
6984         eval $inlibc
6985
6986         : see if readdir64 exists
6987         set readdir64 d_readdir64
6988         eval $inlibc
6989
6990         : see if seekdir64 exists
6991         set seekdir64 d_seekdir64
6992         eval $inlibc
6993
6994         : see if stat64 exists
6995         set stat64 d_stat64
6996         eval $inlibc
6997
6998         : see if telldir64 exists
6999         set telldir64 d_telldir64
7000         eval $inlibc
7001
7002         : see if truncate64 exists
7003         set truncate64 d_truncate64
7004         eval $inlibc
7005
7006         : check for off64_t
7007         echo " "
7008         echo $n "Checking to see if your system supports off64_t...$c" >&4
7009         $cat >try.c <<EOCP
7010 #include <sys/types.h>
7011 off64_t foo() { off64_t x; x = 7; return x; }'
7012 EOCP
7013         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7014                 val="$define"
7015                 echo " Yup, it does." >&4
7016         else
7017                 val="$undef"
7018                 echo " Nope, it doesn't." >&4
7019         fi
7020         $rm -f try.*
7021         set d_off64t
7022         eval $setvar
7023
7024         : check for ino64_t
7025         echo " "
7026         echo $n "Checking to see if your system supports ino64_t...$c" >&4
7027         val="$undef"
7028         case "$i_sysstat" in
7029         "$define" )
7030                 $cat >try.c <<EOCP
7031 #include <sys/types.h>
7032 #include <sys/stat.h>
7033 ino64_t foo() { ino64_t x; x = 7; return x; }'
7034 EOCP
7035                 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7036                         val="$define"
7037                 fi
7038                 $rm -f try.*
7039                 ;;
7040         esac
7041         if $test "X$val" = X"$define"; then
7042                 echo " Yup, it does." >&4
7043         else
7044                 echo " Nope, it doesn't." >&4
7045         fi
7046         set d_ino64t
7047         eval $setvar
7048
7049         : check for struct flock64
7050         echo " "
7051         echo "Checking to see if your system supports struct flock64..." >&4
7052         if $h_fcntl; then
7053                 set d_flock64s flock64 l_len define fcntl.h
7054                 eval $hasfield
7055         else
7056                 val="$undef"
7057                 set d_flock64s
7058                 eval $setvar
7059         fi
7060         case "$d_flock64s" in
7061         "$define")      echo "Yup, it does." >&4
7062                         ;;
7063         *)              echo "Nope, it doesn't." >&4
7064                         ;;
7065         esac
7066
7067         : check for struct dirent64
7068         echo " "
7069         echo "Checking to see if your system supports struct dirent64..." >&4
7070         set d_dirent64s dirent64 d_off $i_dirent dirent.h
7071         eval $hasfield
7072         case "$d_flock64s" in
7073         "$define")      echo "Yup, it does." >&4
7074                         ;;
7075         *)              echo "Nope, it doesn't." >&4
7076                         ;;
7077         esac
7078
7079 else
7080         val="$undef"
7081         for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64t d_ino64t d_flock64s d_dirent64s
7082         do
7083                 set $xxx
7084                 eval $setvar
7085         done
7086 fi
7087
7088 : see if dlerror exists
7089 xxx_runnm="$runnm"
7090 runnm=false
7091 set dlerror d_dlerror
7092 eval $inlibc
7093 runnm="$xxx_runnm"
7094
7095 : see if dlfcn is available
7096 set dlfcn.h i_dlfcn
7097 eval $inhdr
7098
7099 case "$usedl" in
7100 $define|y|true)
7101         $cat << EOM
7102
7103 On a few systems, the dynamically loaded modules that perl generates and uses
7104 will need a different extension than shared libs. The default will probably
7105 be appropriate.
7106
7107 EOM
7108         case "$dlext" in
7109         '')     dflt="$so" ;;
7110         *)      dflt="$dlext" ;;
7111         esac
7112         rp='What is the extension of dynamically loaded modules'
7113         . ./myread
7114         dlext="$ans"
7115         ;;
7116 *)
7117         dlext="none"
7118         ;;
7119 esac
7120
7121 : Check if dlsym need a leading underscore
7122 echo " "
7123 val="$undef"
7124
7125 case "$dlsrc" in
7126 dl_dlopen.xs)
7127         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7128         $cat >dyna.c <<'EOM'
7129 fred () { }
7130 EOM
7131
7132 $cat >fred.c<<EOM
7133
7134 #include <stdio.h>
7135 #$i_dlfcn I_DLFCN
7136 #ifdef I_DLFCN
7137 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7138 #else
7139 #include <sys/types.h>
7140 #include <nlist.h>
7141 #include <link.h>
7142 #endif
7143
7144 extern int fred() ;
7145
7146 main()
7147 {
7148     void * handle ;
7149     void * symbol ;
7150 #ifndef RTLD_LAZY
7151     int mode = 1 ;
7152 #else
7153     int mode = RTLD_LAZY ;
7154 #endif
7155     handle = dlopen("./dyna.$dlext", mode) ;
7156     if (handle == NULL) {
7157         printf ("1\n") ;
7158         fflush (stdout) ;
7159         exit(0);
7160     }
7161     symbol = dlsym(handle, "fred") ;
7162     if (symbol == NULL) {
7163         /* try putting a leading underscore */
7164         symbol = dlsym(handle, "_fred") ;
7165         if (symbol == NULL) {
7166             printf ("2\n") ;
7167             fflush (stdout) ;
7168             exit(0);
7169         }
7170         printf ("3\n") ;
7171     }
7172     else
7173         printf ("4\n") ;
7174     fflush (stdout) ;
7175     exit(0);
7176 }
7177 EOM
7178         : Call the object file tmp-dyna.o in case dlext=o.
7179         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7180                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7181                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7182                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7183                 xxx=`./fred`
7184                 case $xxx in
7185                 1)      echo "Test program failed using dlopen." >&4
7186                         echo "Perhaps you should not use dynamic loading." >&4;;
7187                 2)      echo "Test program failed using dlsym." >&4
7188                         echo "Perhaps you should not use dynamic loading." >&4;;
7189                 3)      echo "dlsym needs a leading underscore" >&4
7190                         val="$define" ;;
7191                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7192                 esac
7193         else
7194                 echo "I can't compile and run the test program." >&4
7195         fi
7196         ;;
7197 esac
7198                 
7199 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7200
7201 set d_dlsymun
7202 eval $setvar
7203
7204 hasproto='varname=$1; func=$2; shift; shift;
7205 while $test $# -ge 2; do
7206         case "$1" in
7207         $define) echo "#include <$2>";;
7208         esac ;
7209     shift 2;
7210 done > try.c;
7211 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7212 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7213         echo "$func() prototype found.";
7214         val="$define";
7215 else
7216         echo "$func() prototype NOT found.";
7217         val="$undef";
7218 fi;
7219 set $varname;
7220 eval $setvar;
7221 $rm -f try.c tryout.c'
7222
7223 : see if prototype for drand48 is available
7224 echo " "
7225 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
7226 eval $hasproto
7227
7228 : see if dup2 exists
7229 set dup2 d_dup2
7230 eval $inlibc
7231
7232 : see if eaccess exists
7233 set eaccess d_eaccess
7234 eval $inlibc
7235
7236 : see if endgrent exists
7237 set endgrent d_endgrent
7238 eval $inlibc
7239
7240 : see if endhostent exists
7241 set endhostent d_endhent
7242 eval $inlibc
7243
7244 : see if endnetent exists
7245 set endnetent d_endnent
7246 eval $inlibc
7247
7248 : see if endprotoent exists
7249 set endprotoent d_endpent
7250 eval $inlibc
7251
7252 : see if endpwent exists
7253 set endpwent d_endpwent
7254 eval $inlibc
7255
7256 : see if endservent exists
7257 set endservent d_endsent
7258 eval $inlibc
7259
7260 : Locate the flags for 'open()'
7261 echo " "
7262 $cat >open3.c <<'EOCP'
7263 #include <sys/types.h>
7264 #ifdef I_FCNTL
7265 #include <fcntl.h>
7266 #endif
7267 #ifdef I_SYS_FILE
7268 #include <sys/file.h>
7269 #endif
7270 main() {
7271         if(O_RDONLY);
7272 #ifdef O_TRUNC
7273         exit(0);
7274 #else
7275         exit(1);
7276 #endif
7277 }
7278 EOCP
7279 : check sys/file.h first to get FREAD on Sun
7280 if $test `./findhdr sys/file.h` && \
7281                 set open3 -DI_SYS_FILE && eval $compile; then
7282         h_sysfile=true;
7283         echo "<sys/file.h> defines the O_* constants..." >&4
7284         if ./open3; then
7285                 echo "and you have the 3 argument form of open()." >&4
7286                 val="$define"
7287         else
7288                 echo "but not the 3 argument form of open().  Oh, well." >&4
7289                 val="$undef"
7290         fi
7291 elif $test `./findhdr fcntl.h` && \
7292                 set open3 -DI_FCNTL && eval $compile; then
7293         h_fcntl=true;
7294         echo "<fcntl.h> defines the O_* constants..." >&4
7295         if ./open3; then
7296                 echo "and you have the 3 argument form of open()." >&4
7297                 val="$define"
7298         else
7299                 echo "but not the 3 argument form of open().  Oh, well." >&4
7300                 val="$undef"
7301         fi
7302 else
7303         val="$undef"
7304         echo "I can't find the O_* constant definitions!  You got problems." >&4
7305 fi
7306 set d_open3
7307 eval $setvar
7308 $rm -f open3*
7309
7310 : check for non-blocking I/O stuff
7311 case "$h_sysfile" in
7312 true) echo "#include <sys/file.h>" > head.c;;
7313 *)
7314         case "$h_fcntl" in
7315         true) echo "#include <fcntl.h>" > head.c;;
7316         *) echo "#include <sys/fcntl.h>" > head.c;;
7317         esac
7318         ;;
7319 esac
7320 echo " "
7321 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
7322 case "$o_nonblock" in
7323 '')
7324         $cat head.c > try.c
7325         $cat >>try.c <<'EOCP'
7326 main() {
7327 #ifdef O_NONBLOCK
7328         printf("O_NONBLOCK\n");
7329         exit(0);
7330 #endif
7331 #ifdef O_NDELAY
7332         printf("O_NDELAY\n");
7333         exit(0);
7334 #endif
7335 #ifdef FNDELAY
7336         printf("FNDELAY\n");
7337         exit(0);
7338 #endif
7339         exit(0);
7340 }
7341 EOCP
7342         set try
7343         if eval $compile_ok; then
7344                 o_nonblock=`./try`
7345                 case "$o_nonblock" in
7346                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
7347                 *) echo "Seems like we can use $o_nonblock.";;
7348                 esac
7349         else
7350                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
7351         fi
7352         ;;
7353 *) echo "Using $hint value $o_nonblock.";;
7354 esac
7355 $rm -f try try.* .out core
7356
7357 echo " "
7358 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
7359 case "$eagain" in
7360 '')
7361         $cat head.c > try.c
7362         $cat >>try.c <<EOCP
7363 #include <errno.h>
7364 #include <sys/types.h>
7365 #include <signal.h>
7366 #define MY_O_NONBLOCK $o_nonblock
7367 #ifndef errno  /* XXX need better Configure test */
7368 extern int errno;
7369 #endif
7370 $signal_t blech(x) int x; { exit(3); }
7371 EOCP
7372         $cat >> try.c <<'EOCP'
7373 main()
7374 {
7375         int pd[2];
7376         int pu[2];
7377         char buf[1];
7378         char string[100];
7379
7380         pipe(pd);       /* Down: child -> parent */
7381         pipe(pu);       /* Up: parent -> child */
7382         if (0 != fork()) {
7383                 int ret;
7384                 close(pd[1]);   /* Parent reads from pd[0] */
7385                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
7386                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
7387                         exit(1);
7388                 signal(SIGALRM, blech);
7389                 alarm(5);
7390                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
7391                         exit(2);
7392                 sprintf(string, "%d\n", ret);
7393                 write(2, string, strlen(string));
7394                 alarm(0);
7395 #ifdef EAGAIN
7396                 if (errno == EAGAIN) {
7397                         printf("EAGAIN\n");
7398                         goto ok;
7399                 }
7400 #endif
7401 #ifdef EWOULDBLOCK
7402                 if (errno == EWOULDBLOCK)
7403                         printf("EWOULDBLOCK\n");
7404 #endif
7405         ok:
7406                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
7407                 sleep(2);                               /* Give it time to close our pipe */
7408                 alarm(5);
7409                 ret = read(pd[0], buf, 1);      /* Should read EOF */
7410                 alarm(0);
7411                 sprintf(string, "%d\n", ret);
7412                 write(3, string, strlen(string));
7413                 exit(0);
7414         }
7415
7416         close(pd[0]);                   /* We write to pd[1] */
7417         close(pu[1]);                   /* We read from pu[0] */
7418         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
7419         close(pd[1]);                   /* Pipe pd is now fully closed! */
7420         exit(0);                                /* Bye bye, thank you for playing! */
7421 }
7422 EOCP
7423         set try
7424         if eval $compile_ok; then
7425                 echo "$startsh" >mtry
7426                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
7427                 chmod +x mtry
7428                 ./mtry >/dev/null 2>&1
7429                 case $? in
7430                 0) eagain=`$cat try.out`;;
7431                 1) echo "Could not perform non-blocking setting!";;
7432                 2) echo "I did a successful read() for something that was not there!";;
7433                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
7434                 *) echo "Something terribly wrong happened during testing.";;
7435                 esac
7436                 rd_nodata=`$cat try.ret`
7437                 echo "A read() system call with no data present returns $rd_nodata."
7438                 case "$rd_nodata" in
7439                 0|-1) ;;
7440                 *)
7441                         echo "(That's peculiar, fixing that to be -1.)"
7442                         rd_nodata=-1
7443                         ;;
7444                 esac
7445                 case "$eagain" in
7446                 '')
7447                         echo "Forcing errno EAGAIN on read() with no data available."
7448                         eagain=EAGAIN
7449                         ;;
7450                 *)
7451                         echo "Your read() sets errno to $eagain when no data is available."
7452                         ;;
7453                 esac
7454                 status=`$cat try.err`
7455                 case "$status" in
7456                 0) echo "And it correctly returns 0 to signal EOF.";;
7457                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
7458                 *) echo "However, your read() returns '$status' on EOF??";;
7459                 esac
7460                 val="$define"
7461                 if test "$status" = "$rd_nodata"; then
7462                         echo "WARNING: you can't distinguish between EOF and no data!"
7463                         val="$undef"
7464                 fi
7465         else
7466                 echo "I can't compile the test program--assuming errno EAGAIN will do."
7467                 eagain=EAGAIN
7468         fi
7469         set d_eofnblk
7470         eval $setvar
7471         ;;
7472 *)
7473         echo "Using $hint value $eagain."
7474         echo "Your read() returns $rd_nodata when no data is present."
7475         case "$d_eofnblk" in
7476         "$define") echo "And you can see EOF because read() returns 0.";;
7477         "$undef") echo "But you can't see EOF status from read() returned value.";;
7478         *)
7479                 echo "(Assuming you can't see EOF status from read anyway.)"
7480                 d_eofnblk=$undef
7481                 ;;
7482         esac
7483         ;;
7484 esac
7485 $rm -f try try.* .out core head.c mtry
7486
7487 : see if fchmod exists
7488 set fchmod d_fchmod
7489 eval $inlibc
7490
7491 : see if fchown exists
7492 set fchown d_fchown
7493 eval $inlibc
7494
7495 : see if this is an fcntl system
7496 set fcntl d_fcntl
7497 eval $inlibc
7498
7499 : see if fgetpos exists
7500 set fgetpos d_fgetpos
7501 eval $inlibc
7502
7503
7504 if $test X"$use64bits" = X"$define"; then
7505         : see if fgetpos64 exists
7506         set fgetpos64 d_fgetpos64
7507         eval $inlibc
7508
7509         : see if fopen64 exists
7510         set freopen64 d_fopen64
7511         eval $inlibc
7512
7513         : see if freopen64 exists
7514         set freopen64 d_freopen64
7515         eval $inlibc
7516
7517         : see if fseek64 exists
7518         set fseek64 d_fseek64
7519         eval $inlibc
7520
7521         : see if fseeko64 exists
7522         set fseeko64 d_fseeko64
7523         eval $inlibc
7524
7525         : see if fsetpos64 exists
7526         set fsetpos64 d_fsetpos64
7527         eval $inlibc
7528
7529         : see if ftell64 exists
7530         set ftell64 d_ftell64
7531         eval $inlibc
7532
7533         : see if ftello64 exists
7534         set ftello64 d_ftello64
7535         eval $inlibc
7536
7537         : see if tmpfile64 exists
7538         set tmpfile64 d_tmpfile64
7539         eval $inlibc
7540 else
7541         val="$undef"
7542         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
7543         do
7544                 set $xxx
7545                 eval $setvar
7546         done
7547 fi
7548
7549 : see if flock exists
7550 set flock d_flock
7551 eval $inlibc
7552
7553 : see if fork exists
7554 set fork d_fork
7555 eval $inlibc
7556
7557 : see if pathconf exists
7558 set pathconf d_pathconf
7559 eval $inlibc
7560
7561 : see if fpathconf exists
7562 set fpathconf d_fpathconf
7563 eval $inlibc
7564
7565 : see if fseeko exists
7566 set fseeko d_fseeko
7567 eval $inlibc
7568
7569 : see if fsetpos exists
7570 set fsetpos d_fsetpos
7571 eval $inlibc
7572
7573 : see if ftello exists
7574 set ftello d_ftello
7575 eval $inlibc
7576
7577 : see if getgrent exists
7578 set getgrent d_getgrent
7579 eval $inlibc
7580
7581 : see if gethostbyaddr exists
7582 set gethostbyaddr d_gethbyaddr
7583 eval $inlibc
7584
7585 : see if gethostbyname exists
7586 set gethostbyname d_gethbyname
7587 eval $inlibc
7588
7589 : see if gethostent exists
7590 set gethostent d_gethent
7591 eval $inlibc
7592
7593 : see if this is a netdb.h system
7594 set netdb.h i_netdb
7595 eval $inhdr
7596
7597 : see if prototypes for various gethostxxx netdb.h functions are available
7598 echo " "
7599 set d_gethostprotos gethostent $i_netdb netdb.h
7600 eval $hasproto
7601
7602 : see if getlogin exists
7603 set getlogin d_getlogin
7604 eval $inlibc
7605
7606 : see if getnetbyaddr exists
7607 set getnetbyaddr d_getnbyaddr
7608 eval $inlibc
7609
7610 : see if getnetbyname exists
7611 set getnetbyname d_getnbyname
7612 eval $inlibc
7613
7614 : see if getnetent exists
7615 set getnetent d_getnent
7616 eval $inlibc
7617
7618 : see if prototypes for various getnetxxx netdb.h functions are available
7619 echo " "
7620 set d_getnetprotos getnetent $i_netdb netdb.h
7621 eval $hasproto
7622
7623
7624 : see if getprotobyname exists
7625 set getprotobyname d_getpbyname
7626 eval $inlibc
7627
7628 : see if getprotobynumber exists
7629 set getprotobynumber d_getpbynumber
7630 eval $inlibc
7631
7632 : see if getprotoent exists
7633 set getprotoent d_getpent
7634 eval $inlibc
7635
7636 : see if getpgid exists
7637 set getpgid d_getpgid
7638 eval $inlibc
7639
7640 : see if getpgrp2 exists
7641 set getpgrp2 d_getpgrp2
7642 eval $inlibc
7643
7644 : see if getppid exists
7645 set getppid d_getppid
7646 eval $inlibc
7647
7648 : see if getpriority exists
7649 set getpriority d_getprior
7650 eval $inlibc
7651
7652 : see if prototypes for various getprotoxxx netdb.h functions are available
7653 echo " "
7654 set d_getprotoprotos getprotoent $i_netdb netdb.h
7655 eval $hasproto
7656
7657 : see if getpwent exists
7658 set getpwent d_getpwent
7659 eval $inlibc
7660
7661
7662 : see if getservbyname exists
7663 set getservbyname d_getsbyname
7664 eval $inlibc
7665
7666 : see if getservbyport exists
7667 set getservbyport d_getsbyport
7668 eval $inlibc
7669
7670 : see if getservent exists
7671 set getservent d_getsent
7672 eval $inlibc
7673
7674 : see if prototypes for various getservxxx netdb.h functions are available
7675 echo " "
7676 set d_getservprotos getservent $i_netdb netdb.h
7677 eval $hasproto
7678
7679 : see if gettimeofday or ftime exists
7680 set gettimeofday d_gettimeod
7681 eval $inlibc
7682 case "$d_gettimeod" in
7683 "$undef")
7684         set ftime d_ftime 
7685         eval $inlibc
7686         ;;
7687 *)
7688         val="$undef"; set d_ftime; eval $setvar
7689         ;;
7690 esac
7691 case "$d_gettimeod$d_ftime" in
7692 "$undef$undef")
7693         echo " "
7694         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
7695         ;;
7696 esac
7697
7698 : see if this is an grp system
7699 set grp.h i_grp
7700 eval $inhdr
7701
7702 case "$i_grp" in
7703 $define)
7704         xxx=`./findhdr grp.h`
7705         $cppstdin $cppflags $cppminus < $xxx >$$.h
7706
7707         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
7708                 val="$define"
7709         else
7710                 val="$undef"
7711         fi
7712         set d_grpasswd
7713         eval $setvar
7714
7715         $rm -f $$.h
7716         ;;
7717 *)
7718         val="$undef";
7719         set d_grpasswd; eval $setvar
7720         ;;
7721 esac
7722
7723 : see if this is a netinet/in.h or sys/in.h system
7724 set netinet/in.h i_niin sys/in.h i_sysin
7725 eval $inhdr
7726
7727 : see if arpa/inet.h has to be included
7728 set arpa/inet.h i_arpainet
7729 eval $inhdr
7730
7731 : see if htonl --and friends-- exists
7732 val=''
7733 set htonl val
7734 eval $inlibc
7735
7736 : Maybe they are macros.
7737 case "$val" in
7738 $undef)
7739         $cat >htonl.c <<EOM
7740 #include <stdio.h>
7741 #include <sys/types.h>
7742 #$i_niin I_NETINET_IN
7743 #$i_sysin I_SYS_IN
7744 #$i_arpainet I_ARPA_INET
7745 #ifdef I_NETINET_IN
7746 #include <netinet/in.h>
7747 #endif
7748 #ifdef I_SYS_IN
7749 #include <sys/in.h>
7750 #endif
7751 #ifdef I_ARPA_INET
7752 #include <arpa/inet.h>
7753 #endif
7754 #ifdef htonl
7755 printf("Defined as a macro.");
7756 #endif
7757 EOM
7758         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
7759         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
7760                 val="$define"
7761                 echo "But it seems to be defined as a macro." >&4
7762         fi
7763         $rm -f htonl.?
7764         ;;
7765 esac
7766 set d_htonl
7767 eval $setvar
7768
7769 : see which of string.h or strings.h is needed
7770 echo " "
7771 strings=`./findhdr string.h`
7772 if $test "$strings" && $test -r "$strings"; then
7773         echo "Using <string.h> instead of <strings.h>." >&4
7774         val="$define"
7775 else
7776         val="$undef"
7777         strings=`./findhdr strings.h`
7778         if $test "$strings" && $test -r "$strings"; then
7779                 echo "Using <strings.h> instead of <string.h>." >&4
7780         else
7781                 echo "No string header found -- You'll surely have problems." >&4
7782         fi
7783 fi
7784 set i_string
7785 eval $setvar
7786 case "$i_string" in
7787 "$undef") strings=`./findhdr strings.h`;;
7788 *)        strings=`./findhdr string.h`;;
7789 esac
7790
7791 : index or strchr
7792 echo " "
7793 if set index val -f; eval $csym; $val; then
7794         if set strchr val -f d_strchr; eval $csym; $val; then
7795                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
7796                         val="$define"
7797                         vali="$undef"
7798                         echo "strchr() found." >&4
7799                 else
7800                         val="$undef"
7801                         vali="$define"
7802                         echo "index() found." >&4
7803                 fi
7804         else
7805                 val="$undef"
7806                 vali="$define"
7807                 echo "index() found." >&4
7808         fi
7809 else
7810         if set strchr val -f d_strchr; eval $csym; $val; then
7811                 val="$define"
7812                 vali="$undef"
7813                 echo "strchr() found." >&4
7814         else
7815                 echo "No index() or strchr() found!" >&4
7816                 val="$undef"
7817                 vali="$undef"
7818         fi
7819 fi
7820 set d_strchr; eval $setvar
7821 val="$vali"
7822 set d_index; eval $setvar
7823
7824 : check whether inet_aton exists
7825 set inet_aton d_inetaton
7826 eval $inlibc
7827
7828 : see if inttypes.h is available
7829 set inttypes.h i_inttypes
7830 eval $inhdr
7831 : check for int64_t
7832 case "$use64bits" in
7833 "$define" )
7834         echo " "
7835         echo $n "Checking to see if your system supports int64_t...$c" >&4
7836         $cat >try.c <<EOCP
7837 #include <sys/types.h>
7838 #$i_inttypes I_INTTYPES
7839 #ifdef I_INTTYPES
7840 #include <inttypes.h>
7841 #endif
7842 int64_t foo() { int64_t x; x = 7; return x; }'
7843 EOCP
7844         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7845                 val="$define"
7846                 echo " Yup, it does." >&4
7847         else
7848                 val="$undef"
7849                 echo " Nope, it doesn't." >&4
7850         fi
7851         $rm -f try.*
7852         ;;
7853 *)      val="$undef"
7854         ;;
7855 esac
7856 set d_int64t
7857 eval $setvar
7858
7859
7860 : Look for isascii
7861 echo " "
7862 $cat >isascii.c <<'EOCP'
7863 #include <stdio.h>
7864 #include <ctype.h>
7865 main() {
7866         int c = 'A';
7867         if (isascii(c))
7868                 exit(0);
7869         else
7870                 exit(1);
7871 }
7872 EOCP
7873 set isascii
7874 if eval $compile; then
7875         echo "isascii() found." >&4
7876         val="$define"
7877 else
7878         echo "isascii() NOT found." >&4
7879         val="$undef"
7880 fi
7881 set d_isascii
7882 eval $setvar
7883 $rm -f isascii*
7884
7885 : see if killpg exists
7886 set killpg d_killpg
7887 eval $inlibc
7888
7889 : see if lchown exists
7890 echo " "
7891 $cat > try.c <<'EOCP'
7892 /* System header to define __stub macros and hopefully few prototypes,
7893     which can conflict with char lchown(); below.  */
7894 #include <assert.h>
7895 /* Override any gcc2 internal prototype to avoid an error.  */
7896 /* We use char because int might match the return type of a gcc2
7897    builtin and then its argument prototype would still apply.  */
7898 char lchown();
7899 int main() {
7900     /*  The GNU C library defines this for functions which it implements
7901         to always fail with ENOSYS.  Some functions are actually named
7902         something starting with __ and the normal name is an alias.  */
7903 #if defined (__stub_lchown) || defined (__stub___lchown)
7904 choke me
7905 #else
7906 lchown();
7907 #endif
7908 ; return 0; }
7909 EOCP
7910 set try
7911 if eval $compile; then
7912     $echo "lchown() found." >&4
7913     val="$define"
7914 else
7915     $echo "lchown() NOT found." >&4
7916     val="$undef"
7917 fi
7918 set d_lchown
7919 eval $setvar
7920
7921 : see if link exists
7922 set link d_link
7923 eval $inlibc
7924
7925 : see if localeconv exists
7926 set localeconv d_locconv
7927 eval $inlibc
7928
7929 : see if lockf exists
7930 set lockf d_lockf
7931 eval $inlibc
7932
7933 : check for length of double
7934 echo " "
7935 case "$doublesize" in
7936 '')
7937         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7938         $cat >try.c <<'EOCP'
7939 #include <stdio.h>
7940 main()
7941 {
7942         printf("%d\n", sizeof(double));
7943 }
7944 EOCP
7945         set try
7946         if eval $compile_ok; then
7947                 doublesize=`./try`
7948                 $echo " $doublesize bytes." >&4
7949         else
7950                 dflt='8'
7951                 echo "(I can't seem to compile the test program.  Guessing...)"
7952                 rp="What is the size of a double precision number (in bytes)?"
7953                 . ./myread
7954                 doublesize="$ans"
7955         fi
7956         ;;
7957 esac
7958 $rm -f try.c try
7959
7960 : check for long doubles
7961 echo " "
7962 echo $n "Checking to see if your system supports long doubles...$c" >&4
7963 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7964 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7965         val="$define"
7966         echo " Yup, it does." >&4
7967 else
7968         val="$undef"
7969         echo " Nope, it doesn't." >&4
7970 fi
7971 $rm try.*
7972 set d_longdbl
7973 eval $setvar
7974
7975 : check for length of long double
7976 case "${d_longdbl}${longdblsize}" in
7977 $define)
7978         echo " "
7979         $echo $n "Checking to see how big your long doubles are...$c" >&4
7980         $cat >try.c <<'EOCP'
7981 #include <stdio.h>
7982 main()
7983 {
7984         printf("%d\n", sizeof(long double));
7985 }
7986 EOCP
7987         set try
7988         if eval $compile; then
7989                 longdblsize=`./try`
7990                 $echo " $longdblsize bytes." >&4
7991         else
7992                 dflt='8'
7993                 echo " "
7994                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7995                 rp="What is the size of a long double (in bytes)?"
7996                 . ./myread
7997                 longdblsize="$ans"
7998         fi
7999         if $test "X$doublesize" = "X$longdblsize"; then
8000                 echo "(That isn't any different from an ordinary double.)"
8001         fi      
8002         ;;
8003 esac
8004 $rm -f try.c try
8005
8006 : check for long long
8007 echo " "
8008 echo $n "Checking to see if your system supports long long...$c" >&4
8009 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
8010 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8011         val="$define"
8012         echo " Yup, it does." >&4
8013 else
8014         val="$undef"
8015         echo " Nope, it doesn't." >&4
8016 fi
8017 $rm try.*
8018 set d_longlong
8019 eval $setvar
8020
8021 : check for length of long long
8022 case "${d_longlong}${longlongsize}" in
8023 $define)
8024         echo " "
8025         $echo $n "Checking to see how big your long longs are...$c" >&4
8026         $cat >try.c <<'EOCP'
8027 #include <stdio.h>
8028 main()
8029 {
8030         printf("%d\n", sizeof(long long));
8031 }
8032 EOCP
8033         set try
8034         if eval $compile_ok; then
8035                 longlongsize=`./try`
8036                 $echo " $longlongsize bytes." >&4
8037         else
8038                 dflt='8'
8039                 echo " "
8040                 echo "(I can't seem to compile the test program.  Guessing...)"
8041                 rp="What is the size of a long long (in bytes)?"
8042                 . ./myread
8043                 longlongsize="$ans"
8044         fi
8045         if $test "X$longsize" = "X$longlongsize"; then
8046                 echo "(That isn't any different from an ordinary long.)"
8047         fi      
8048         ;;
8049 esac
8050 $rm -f try.c try
8051
8052 : see if lstat exists
8053 set lstat d_lstat
8054 eval $inlibc
8055
8056 : see if mblen exists
8057 set mblen d_mblen
8058 eval $inlibc
8059
8060 : see if mbstowcs exists
8061 set mbstowcs d_mbstowcs
8062 eval $inlibc
8063
8064 : see if mbtowc exists
8065 set mbtowc d_mbtowc
8066 eval $inlibc
8067
8068 : see if memcmp exists
8069 set memcmp d_memcmp
8070 eval $inlibc
8071
8072 : see if memcpy exists
8073 set memcpy d_memcpy
8074 eval $inlibc
8075
8076 : see if memmove exists
8077 set memmove d_memmove
8078 eval $inlibc
8079
8080 : see if memset exists
8081 set memset d_memset
8082 eval $inlibc
8083
8084 : see if mkdir exists
8085 set mkdir d_mkdir
8086 eval $inlibc
8087
8088 : see if mkfifo exists
8089 set mkfifo d_mkfifo
8090 eval $inlibc
8091
8092 : see if mktime exists
8093 set mktime d_mktime
8094 eval $inlibc
8095
8096 : see if msgctl exists
8097 set msgctl d_msgctl
8098 eval $inlibc
8099
8100 : see if msgget exists
8101 set msgget d_msgget
8102 eval $inlibc
8103
8104 : see if msgsnd exists
8105 set msgsnd d_msgsnd
8106 eval $inlibc
8107
8108 : see if msgrcv exists
8109 set msgrcv d_msgrcv
8110 eval $inlibc
8111
8112 : see how much of the 'msg*(2)' library is present.
8113 h_msg=true
8114 echo " "
8115 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
8116 *"$undef"*) h_msg=false;;
8117 esac
8118 case "$osname" in
8119 freebsd)
8120     case "`ipcs 2>&1`" in
8121     "SVID messages"*"not configured"*)
8122         echo "Your $osname does not have the msg*(2) configured." >&4
8123         h_msg=false
8124         val="$undef"
8125         set msgctl d_msgctl
8126         eval $setvar
8127         set msgget d_msgget
8128         eval $setvar
8129         set msgsnd d_msgsnd
8130         eval $setvar
8131         set msgrcv d_msgrcv
8132         eval $setvar
8133         ;;
8134     esac
8135     ;;
8136 esac
8137 : we could also check for sys/ipc.h ...
8138 if $h_msg && $test `./findhdr sys/msg.h`; then
8139         echo "You have the full msg*(2) library." >&4
8140         val="$define"
8141 else
8142         echo "You don't have the full msg*(2) library." >&4
8143         val="$undef"
8144 fi
8145 set d_msg
8146 eval $setvar
8147
8148 : see if nice exists
8149 set nice d_nice
8150 eval $inlibc
8151
8152 : see if pause exists
8153 set pause d_pause
8154 eval $inlibc
8155
8156 : see if pipe exists
8157 set pipe d_pipe
8158 eval $inlibc
8159
8160 : see if poll exists
8161 set poll d_poll
8162 eval $inlibc
8163
8164
8165 : see whether the various POSIXish _yields exist within given cccmd
8166 $cat >try.c <<EOP
8167 #include <pthread.h>
8168 main() {
8169         YIELD();
8170         exit(0);
8171 }
8172 EOP
8173 : see if pthread_yield exists within given cccmd,
8174 : if we do not usethreads this may well end up undef.
8175 set try -DYIELD=pthread_yield
8176 if eval $compile; then
8177     val="$define"
8178     echo 'pthread_yield() found.' >&4
8179 else
8180     val="$undef"
8181     echo 'pthread_yield() NOT found.' >&4
8182 fi
8183 set d_pthread_yield
8184 eval $setvar
8185
8186 : see if sched_yield exists within given cccmd,
8187 : if we do not usethreads this may well end up undef.
8188 set try -DYIELD=sched_yield
8189 if eval $compile; then
8190     val="$define"
8191     echo 'sched_yield() found.' >&4
8192 else
8193     val="$undef"
8194     echo 'sched_yield() NOT found.' >&4
8195 fi
8196 set d_sched_yield
8197 eval $setvar
8198 $rm -f try try.*
8199
8200 : test whether pthreads are created in joinable -- aka undetached -- state
8201 if test "X$usethreads" = "X$define"; then
8202         echo $n "Checking whether pthreads are created joinable. $c" >&4 
8203         $cat >try.c <<'EOCP'
8204 #include <pthread.h>
8205 #include <stdio.h>
8206 int main() {
8207     pthread_attr_t attr;
8208     int detachstate;
8209     printf("%s\n",
8210         pthread_attr_init(&attr) == 0 &&
8211         pthread_attr_getdetachstate(&attr, &detachstate) == 0 &&
8212         detachstate == PTHREAD_CREATE_DETACHED ?
8213         "detached" : "joinable");
8214     exit(0);
8215 }
8216 EOCP
8217         set try
8218         if eval $compile; then
8219                 yyy=`./try`
8220                 case "$yyy" in
8221                         detached) echo "Nope, they aren't." >&4 ;;
8222                         *) echo "Yup, they are." >&4 ;;
8223                 esac
8224         else
8225                 echo " "
8226                 echo "(I can't execute the test program--assuming they are.)" >&4
8227                 yyy=joinable
8228         fi
8229         $rm -f try try.*
8230         case "$yyy" in
8231                 detached) val="$undef" ;;
8232                 *) val="$define" ;;
8233         esac
8234         set d_pthreads_created_joinable
8235         eval $setvar
8236 else
8237     d_pthreads_created_joinable="$undef"
8238 fi
8239
8240 : see if this is a pwd.h system
8241 set pwd.h i_pwd
8242 eval $inhdr
8243
8244 case "$i_pwd" in
8245 $define)
8246         xxx=`./findhdr pwd.h`
8247         $cppstdin $cppflags $cppminus < $xxx >$$.h
8248
8249         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
8250                 val="$define"
8251         else
8252                 val="$undef"
8253         fi
8254         set d_pwquota
8255         eval $setvar
8256
8257         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
8258                 val="$define"
8259         else
8260                 val="$undef"
8261         fi
8262         set d_pwage
8263         eval $setvar
8264
8265         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
8266                 val="$define"
8267         else
8268                 val="$undef"
8269         fi
8270         set d_pwchange
8271         eval $setvar
8272
8273         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
8274                 val="$define"
8275         else
8276                 val="$undef"
8277         fi
8278         set d_pwclass
8279         eval $setvar
8280
8281         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
8282                 val="$define"
8283         else
8284                 val="$undef"
8285         fi
8286         set d_pwexpire
8287         eval $setvar
8288
8289         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
8290                 val="$define"
8291         else
8292                 val="$undef"
8293         fi
8294         set d_pwcomment
8295         eval $setvar
8296
8297         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
8298                 val="$define"
8299         else
8300                 val="$undef"
8301         fi
8302         set d_pwgecos
8303         eval $setvar
8304
8305         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
8306                 val="$define"
8307         else
8308                 val="$undef"
8309         fi
8310         set d_pwpasswd
8311         eval $setvar
8312
8313         $rm -f $$.h
8314         ;;
8315 *)
8316         val="$undef"; 
8317         set d_pwquota; eval $setvar
8318         set d_pwage; eval $setvar
8319         set d_pwchange; eval $setvar
8320         set d_pwclass; eval $setvar
8321         set d_pwexpire; eval $setvar
8322         set d_pwcomment; eval $setvar
8323         set d_pwgecos; eval $setvar
8324         set d_pwpasswd; eval $setvar
8325         ;;
8326 esac
8327
8328 : see if readdir and friends exist
8329 set readdir d_readdir
8330 eval $inlibc
8331 set seekdir d_seekdir
8332 eval $inlibc
8333 set telldir d_telldir
8334 eval $inlibc
8335 set rewinddir d_rewinddir
8336 eval $inlibc
8337
8338 : see if readlink exists
8339 set readlink d_readlink
8340 eval $inlibc
8341
8342 : see if rename exists
8343 set rename d_rename
8344 eval $inlibc
8345
8346 : see if rmdir exists
8347 set rmdir d_rmdir
8348 eval $inlibc
8349
8350 : see if memory.h is available.
8351 val=''
8352 set memory.h val
8353 eval $inhdr
8354
8355 : See if it conflicts with string.h
8356 case "$val" in
8357 $define)
8358         case "$strings" in
8359         '') ;;
8360         *)
8361                 $cppstdin $cppflags $cppminus < $strings > mem.h
8362                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
8363                         echo " "
8364                         echo "We won't be including <memory.h>."
8365                         val="$undef"
8366                 fi
8367                 $rm -f mem.h
8368                 ;;
8369         esac
8370 esac
8371 set i_memory
8372 eval $setvar
8373
8374 : can bcopy handle overlapping blocks?
8375 val="$undef"
8376 case "$d_bcopy" in
8377 "$define")
8378         echo " "
8379         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
8380         $cat >try.c <<EOCP
8381 #$i_memory I_MEMORY
8382 #$i_stdlib I_STDLIB
8383 #$i_string I_STRING
8384 #$i_unistd I_UNISTD
8385 EOCP
8386         $cat >>try.c <<'EOCP'
8387 #include <stdio.h>
8388 #ifdef I_MEMORY
8389 #  include <memory.h>
8390 #endif
8391 #ifdef I_STDLIB
8392 #  include <stdlib.h>
8393 #endif
8394 #ifdef I_STRING
8395 #  include <string.h>
8396 #else
8397 #  include <strings.h>
8398 #endif
8399 #ifdef I_UNISTD
8400 #  include <unistd.h>  /* Needed for NetBSD */
8401 #endif
8402 main()
8403 {
8404 char buf[128], abc[128];
8405 char *b;
8406 int len;
8407 int off;
8408 int align;
8409
8410 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
8411
8412 for (align = 7; align >= 0; align--) {
8413         for (len = 36; len; len--) {
8414                 b = buf+align;
8415                 bcopy(abc, b, len);
8416                 for (off = 1; off <= len; off++) {
8417                         bcopy(b, b+off, len);
8418                         bcopy(b+off, b, len);
8419                         if (bcmp(b, abc, len))
8420                                 exit(1);
8421                 }
8422         }
8423 }
8424 exit(0);
8425 }
8426 EOCP
8427         set try
8428         if eval $compile_ok; then
8429                 if ./try 2>/dev/null; then
8430                         echo "Yes, it can."
8431                         val="$define"
8432                 else
8433                         echo "It can't, sorry."
8434                         case "$d_memmove" in
8435                         "$define") echo "But that's Ok since you have memmove()." ;;
8436                         esac
8437                 fi
8438         else
8439                 echo "(I can't compile the test program, so we'll assume not...)"
8440                 case "$d_memmove" in
8441                 "$define") echo "But that's Ok since you have memmove()." ;;
8442                 esac
8443         fi
8444         ;;
8445 esac
8446 $rm -f try.* try core
8447 set d_safebcpy
8448 eval $setvar
8449
8450 : can memcpy handle overlapping blocks?
8451 val="$undef"
8452 case "$d_memcpy" in
8453 "$define")
8454         echo " "
8455         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
8456         $cat >try.c <<EOCP
8457 #$i_memory I_MEMORY
8458 #$i_stdlib I_STDLIB
8459 #$i_string I_STRING
8460 #$i_unistd I_UNISTD
8461 EOCP
8462         $cat >>try.c <<'EOCP'
8463 #include <stdio.h>
8464 #ifdef I_MEMORY
8465 #  include <memory.h>
8466 #endif
8467 #ifdef I_STDLIB
8468 #  include <stdlib.h>
8469 #endif
8470 #ifdef I_STRING
8471 #  include <string.h>
8472 #else
8473 #  include <strings.h>
8474 #endif
8475 #ifdef I_UNISTD
8476 #  include <unistd.h>  /* Needed for NetBSD */
8477 #endif
8478 main()
8479 {
8480 char buf[128], abc[128];
8481 char *b;
8482 int len;
8483 int off;
8484 int align;
8485
8486 /* Copy "abcde..." string to char abc[] so that gcc doesn't
8487    try to store the string in read-only memory. */
8488 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
8489
8490 for (align = 7; align >= 0; align--) {
8491         for (len = 36; len; len--) {
8492                 b = buf+align;
8493                 memcpy(b, abc, len);
8494                 for (off = 1; off <= len; off++) {
8495                         memcpy(b+off, b, len);
8496                         memcpy(b, b+off, len);
8497                         if (memcmp(b, abc, len))
8498                                 exit(1);
8499                 }
8500         }
8501 }
8502 exit(0);
8503 }
8504 EOCP
8505         set try
8506         if eval $compile_ok; then
8507                 if ./try 2>/dev/null; then
8508                         echo "Yes, it can."
8509                         val="$define"
8510                 else
8511                         echo "It can't, sorry."
8512                         case "$d_memmove" in
8513                         "$define") echo "But that's Ok since you have memmove()." ;;
8514                         esac
8515                 fi
8516         else
8517                 echo "(I can't compile the test program, so we'll assume not...)"
8518                 case "$d_memmove" in
8519                 "$define") echo "But that's Ok since you have memmove()." ;;
8520                 esac
8521         fi
8522         ;;
8523 esac
8524 $rm -f try.* try core
8525 set d_safemcpy
8526 eval $setvar
8527
8528 : can memcmp be trusted to compare relative magnitude?
8529 val="$undef"
8530 case "$d_memcmp" in
8531 "$define")
8532         echo " "
8533         echo "Checking if your memcmp() can compare relative magnitude..." >&4
8534         $cat >try.c <<EOCP
8535 #$i_memory I_MEMORY
8536 #$i_stdlib I_STDLIB
8537 #$i_string I_STRING
8538 #$i_unistd I_UNISTD
8539 EOCP
8540         $cat >>try.c <<'EOCP'
8541 #include <stdio.h>
8542 #ifdef I_MEMORY
8543 #  include <memory.h>
8544 #endif
8545 #ifdef I_STDLIB
8546 #  include <stdlib.h>
8547 #endif
8548 #ifdef I_STRING
8549 #  include <string.h>
8550 #else
8551 #  include <strings.h>
8552 #endif
8553 #ifdef I_UNISTD
8554 #  include <unistd.h>  /* Needed for NetBSD */
8555 #endif
8556 main()
8557 {
8558 char a = -1;
8559 char b = 0;
8560 if ((a < b) && memcmp(&a, &b, 1) < 0)
8561         exit(1);
8562 exit(0);
8563 }
8564 EOCP
8565         set try
8566         if eval $compile_ok; then
8567                 if ./try 2>/dev/null; then
8568                         echo "Yes, it can."
8569                         val="$define"
8570                 else
8571                         echo "No, it can't (it uses signed chars)."
8572                 fi
8573         else
8574                 echo "(I can't compile the test program, so we'll assume not...)"
8575         fi
8576         ;;
8577 esac
8578 $rm -f try.* try core
8579 set d_sanemcmp
8580 eval $setvar
8581
8582 : see if select exists
8583 set select d_select
8584 eval $inlibc
8585
8586 : see if semctl exists
8587 set semctl d_semctl
8588 eval $inlibc
8589
8590 : see if semget exists
8591 set semget d_semget
8592 eval $inlibc
8593
8594 : see if semop exists
8595 set semop d_semop
8596 eval $inlibc
8597
8598 : see how much of the 'sem*(2)' library is present.
8599 h_sem=true
8600 echo " "
8601 case "$d_semctl$d_semget$d_semop" in
8602 *"$undef"*) h_sem=false;;
8603 esac
8604 case "$osname" in
8605 freebsd)
8606     case "`ipcs 2>&1`" in
8607     "SVID messages"*"not configured"*)
8608         echo "Your $osname does not have the sem*(2) configured." >&4
8609         h_sem=false
8610         val="$undef"
8611         set semctl d_semctl
8612         eval $setvar
8613         set semget d_semget
8614         eval $setvar
8615         set semop d_semop
8616         eval $setvar
8617         ;;
8618     esac
8619     ;;
8620 esac
8621 : we could also check for sys/ipc.h ...
8622 if $h_sem && $test `./findhdr sys/sem.h`; then
8623         echo "You have the full sem*(2) library." >&4
8624         val="$define"
8625 else
8626         echo "You don't have the full sem*(2) library." >&4
8627         val="$undef"
8628 fi
8629 set d_sem
8630 eval $setvar
8631
8632 : see whether sys/sem.h defines union semun
8633 echo " "
8634 $cat > try.c <<'END'
8635 #include <sys/types.h>
8636 #include <sys/ipc.h>
8637 #include <sys/sem.h>
8638 int main () { union semun semun; semun.buf = 0; }
8639 END
8640 set try
8641 if eval $compile; then
8642     echo "You have union semun in <sys/sem.h>." >&4
8643     val="$define"
8644 else
8645     echo "You do not have union semun in <sys/sem.h>." >&4
8646     val="$undef"
8647 fi
8648 $rm -f try try.c try.h
8649 set d_union_semun
8650 eval $setvar
8651
8652 : see how to do semctl IPC_STAT
8653 case "$d_sem" in
8654 $define)
8655     : see whether semctl IPC_STAT can use union semun
8656     echo " "
8657     $cat > try.h <<END
8658 #ifndef S_IRUSR
8659 #   ifdef S_IREAD
8660 #       define S_IRUSR S_IREAD
8661 #       define S_IWUSR S_IWRITE
8662 #       define S_IXUSR S_IEXEC
8663 #   else
8664 #       define S_IRUSR 0400
8665 #       define S_IWUSR 0200
8666 #       define S_IXUSR 0100
8667 #   endif
8668 #   define S_IRGRP (S_IRUSR>>3)
8669 #   define S_IWGRP (S_IWUSR>>3)
8670 #   define S_IXGRP (S_IXUSR>>3)
8671 #   define S_IROTH (S_IRUSR>>6)
8672 #   define S_IWOTH (S_IWUSR>>6)
8673 #   define S_IXOTH (S_IXUSR>>6)
8674 #endif
8675 #ifndef S_IRWXU
8676 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
8677 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
8678 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
8679 #endif
8680 END
8681
8682     $cat > try.c <<END
8683 #include <sys/types.h>
8684 #include <sys/ipc.h>
8685 #include <sys/sem.h>
8686 #include <sys/stat.h>
8687 #include <stdio.h>
8688 #include <errno.h>
8689 #include "try.h"
8690 #ifndef errno
8691 extern int errno;
8692 #endif
8693 #$d_union_semun HAS_UNION_SEMUN
8694 int main() {
8695     union semun
8696 #ifndef HAS_UNION_SEMUN
8697     {
8698         int val;
8699         struct semid_ds *buf;
8700         unsigned short *array;
8701     }
8702 #endif
8703     arg;
8704     int sem, st;
8705
8706 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
8707     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
8708     if (sem > -1) {
8709         struct semid_ds argbuf;
8710         arg.buf = &argbuf;
8711 #       ifdef IPC_STAT
8712         st = semctl(sem, 0, IPC_STAT, arg);
8713         if (st == 0)
8714             printf("semun\n");
8715         else
8716 #       endif /* IPC_STAT */
8717             printf("semctl IPC_STAT failed: errno = %d\n", errno);
8718 #       ifdef IPC_RMID
8719         if (semctl(sem, 0, IPC_RMID, arg) != 0)
8720 #       endif /* IPC_RMID */
8721             printf("semctl IPC_RMID failed: errno = %d\n", errno);
8722     } else
8723 #endif /* IPC_PRIVATE && ... */
8724         printf("semget failed: errno = %d\n", errno);
8725   return 0;
8726 }
8727 END
8728     val="$undef"
8729     set try
8730     if eval $compile; then
8731         xxx=`./try`
8732         case "$xxx" in
8733         semun) val="$define" ;;
8734         esac
8735     fi
8736     $rm -f try try.c
8737     set d_semctl_semun
8738     eval $setvar
8739     case "$d_semctl_semun" in
8740     $define)
8741         echo "You can use union semun for semctl IPC_STAT." >&4
8742         also='also'
8743         ;;
8744     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
8745         also=''
8746         ;;
8747     esac
8748
8749     : see whether semctl IPC_STAT can use struct semid_ds pointer
8750     $cat > try.c <<'END'
8751 #include <sys/types.h>
8752 #include <sys/ipc.h>
8753 #include <sys/sem.h>
8754 #include <sys/stat.h>
8755 #include "try.h"
8756 #include <stdio.h>
8757 #include <errno.h>
8758 #ifndef errno
8759 extern int errno;
8760 #endif
8761 int main() {
8762     struct semid_ds arg;
8763     int sem, st;
8764
8765 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
8766     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
8767     if (sem > -1) {
8768 #       ifdef IPC_STAT
8769         st = semctl(sem, 0, IPC_STAT, &arg);
8770         if (st == 0)
8771             printf("semid_ds\n");
8772         else
8773 #       endif /* IPC_STAT */
8774             printf("semctl IPC_STAT failed: errno = %d\n", errno);
8775 #       ifdef IPC_RMID
8776         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
8777 #       endif /* IPC_RMID */
8778             printf("semctl IPC_RMID failed: errno = %d\n", errno);
8779     } else
8780 #endif /* IPC_PRIVATE && ... */
8781         printf("semget failed: errno = %d\n", errno);
8782
8783     return 0;
8784 }
8785 END
8786     val="$undef"
8787     set try
8788     if eval $compile; then
8789         xxx=`./try`
8790         case "$xxx" in
8791         semid_ds) val="$define" ;;
8792         esac
8793     fi
8794     $rm -f try try.c
8795     set d_semctl_semid_ds
8796     eval $setvar
8797     case "$d_semctl_semid_ds" in
8798     $define)
8799         echo "You can $also use struct semid_ds * for semctl IPC_STAT." >&4
8800         ;;
8801     *)  echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4
8802         ;;
8803     esac
8804     $rm -f try.h
8805     ;;
8806 *)  val="$undef"
8807
8808     # We do not have the full sem*(2) library, so assume we can not
8809     # use either.
8810
8811     set d_semctl_semun
8812     eval $setvar
8813
8814     set d_semctl_semid_ds
8815     eval $setvar
8816     ;;
8817 esac
8818
8819 : see if setegid exists
8820 set setegid d_setegid
8821 eval $inlibc
8822
8823 : see if seteuid exists
8824 set seteuid d_seteuid
8825 eval $inlibc
8826
8827 : see if setgrent exists
8828 set setgrent d_setgrent
8829 eval $inlibc
8830
8831 : see if sethostent exists
8832 set sethostent d_sethent
8833 eval $inlibc
8834
8835 : see if setlinebuf exists
8836 set setlinebuf d_setlinebuf
8837 eval $inlibc
8838
8839 : see if setlocale exists
8840 set setlocale d_setlocale
8841 eval $inlibc
8842
8843 : see if setnetent exists
8844 set setnetent d_setnent
8845 eval $inlibc
8846
8847 : see if setprotoent exists
8848 set setprotoent d_setpent
8849 eval $inlibc
8850
8851 : see if setpgid exists
8852 set setpgid d_setpgid
8853 eval $inlibc
8854
8855 : see if setpgrp2 exists
8856 set setpgrp2 d_setpgrp2
8857 eval $inlibc
8858
8859 : see if setpriority exists
8860 set setpriority d_setprior
8861 eval $inlibc
8862
8863 : see if setpwent exists
8864 set setpwent d_setpwent
8865 eval $inlibc
8866
8867 : see if setregid exists
8868 set setregid d_setregid
8869 eval $inlibc
8870 set setresgid d_setresgid
8871 eval $inlibc
8872
8873 : see if setreuid exists
8874 set setreuid d_setreuid
8875 eval $inlibc
8876 set setresuid d_setresuid
8877 eval $inlibc
8878
8879 : see if setrgid exists
8880 set setrgid d_setrgid
8881 eval $inlibc
8882
8883 : see if setruid exists
8884 set setruid d_setruid
8885 eval $inlibc
8886
8887 : see if setservent exists
8888 set setservent d_setsent
8889 eval $inlibc
8890
8891 : see if setsid exists
8892 set setsid d_setsid
8893 eval $inlibc
8894
8895 : see if setvbuf exists
8896 set setvbuf d_setvbuf
8897 eval $inlibc
8898
8899 : see if sfio.h is available
8900 set sfio.h i_sfio
8901 eval $inhdr
8902
8903
8904 : see if sfio library is available
8905 case "$i_sfio" in
8906 $define)
8907         val=''
8908         set sfreserve val
8909         eval $inlibc
8910         ;;
8911 *)
8912         val="$undef"
8913         ;;
8914 esac
8915 : Ok, but do we want to use it.
8916 case "$val" in
8917 $define)
8918         case "$usesfio" in
8919         true|$define|[yY]*) dflt='y';;
8920         *) dflt='n';;
8921         esac
8922         echo "$package can use the sfio library, but it is experimental."
8923         rp="You seem to have sfio available, do you want to try using it?"
8924         . ./myread
8925         case "$ans" in
8926         y|Y) ;;
8927         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
8928                 val="$undef"
8929                 : Remove sfio from list of libraries to use
8930                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
8931                 shift
8932                 libs="$*"
8933                 echo "libs = $libs" >&4
8934                 ;;
8935         esac
8936         ;;
8937 *)      case "$usesfio" in
8938         true|$define|[yY]*)
8939                 echo "Sorry, cannot find sfio on this machine" >&4
8940                 echo "Ignoring your setting of usesfio=$usesfio" >&4
8941                 ;;
8942         esac
8943         ;;
8944 esac
8945 set d_sfio
8946 eval $setvar
8947 case "$d_sfio" in
8948 $define) usesfio='true';;
8949 *) usesfio='false';;
8950 esac
8951
8952 : see if shmctl exists
8953 set shmctl d_shmctl
8954 eval $inlibc
8955
8956 : see if shmget exists
8957 set shmget d_shmget
8958 eval $inlibc
8959
8960 : see if shmat exists
8961 set shmat d_shmat
8962 eval $inlibc
8963 : see what shmat returns
8964 case "$d_shmat" in
8965 "$define")
8966         $cat >shmat.c <<'END'
8967 #include <sys/shm.h>
8968 void *shmat();
8969 END
8970         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
8971                 shmattype='void *'
8972         else
8973                 shmattype='char *'
8974         fi
8975         echo "and it returns ($shmattype)." >&4
8976         : see if a prototype for shmat is available
8977         xxx=`./findhdr sys/shm.h`
8978         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
8979         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
8980                 val="$define"
8981         else
8982                 val="$undef"
8983         fi
8984         $rm -f shmat.[co]
8985         ;;
8986 *)
8987         val="$undef"
8988         ;;
8989 esac
8990 set d_shmatprototype
8991 eval $setvar
8992
8993 : see if shmdt exists
8994 set shmdt d_shmdt
8995 eval $inlibc
8996
8997 : see how much of the 'shm*(2)' library is present.
8998 h_shm=true
8999 echo " "
9000 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
9001 *"$undef"*) h_shm=false;;
9002 esac
9003 case "$osname" in
9004 freebsd)
9005     case "`ipcs 2>&1`" in
9006     "SVID shared memory"*"not configured"*)
9007         echo "Your $osname does not have the shm*(2) configured." >&4
9008         h_shm=false
9009         val="$undef"
9010         set shmctl d_shmctl
9011         evat $setvar
9012         set shmget d_shmget
9013         evat $setvar
9014         set shmat d_shmat
9015         evat $setvar
9016         set shmdt d_shmdt
9017         evat $setvar
9018         ;;
9019     esac
9020     ;;
9021 esac
9022 : we could also check for sys/ipc.h ...
9023 if $h_shm && $test `./findhdr sys/shm.h`; then
9024         echo "You have the full shm*(2) library." >&4
9025         val="$define"
9026 else
9027         echo "You don't have the full shm*(2) library." >&4
9028         val="$undef"
9029 fi
9030 set d_shm
9031 eval $setvar
9032
9033 echo " "
9034 : see if we have sigaction
9035 if set sigaction val -f d_sigaction; eval $csym; $val; then
9036         echo 'sigaction() found.' >&4
9037         $cat > try.c <<'EOP'
9038 #include <stdio.h>
9039 #include <sys/types.h>
9040 #include <signal.h>
9041 main()
9042 {
9043     struct sigaction act, oact;
9044 }
9045 EOP
9046         set try
9047         if eval $compile_ok; then
9048                 val="$define"
9049         else
9050                 echo "But you don't seem to have a useable struct sigaction." >&4
9051                 val="$undef"
9052         fi
9053 else
9054         echo 'sigaction NOT found.' >&4
9055         val="$undef"
9056 fi
9057 set d_sigaction; eval $setvar
9058 $rm -f try try$_o try.c
9059
9060 : see if sigsetjmp exists
9061 echo " "
9062 case "$d_sigsetjmp" in
9063 '')
9064         $cat >try.c <<'EOP'
9065 #include <setjmp.h>
9066 sigjmp_buf env;
9067 int set = 1;
9068 main()
9069 {
9070         if (sigsetjmp(env,1))
9071                 exit(set);
9072         set = 0;
9073         siglongjmp(env, 1);
9074         exit(1);
9075 }
9076 EOP
9077         set try
9078         if eval $compile; then
9079                 if ./try >/dev/null 2>&1; then
9080                         echo "POSIX sigsetjmp found." >&4
9081                         val="$define"
9082                 else
9083                         $cat >&4 <<EOM
9084 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
9085 I'll ignore them.
9086 EOM
9087                         val="$undef"
9088                 fi
9089         else
9090                 echo "sigsetjmp not found." >&4
9091                 val="$undef"
9092         fi
9093         ;;
9094 *) val="$d_sigsetjmp"
9095         case "$d_sigsetjmp" in
9096         $define) echo "POSIX sigsetjmp found." >&4;;
9097         $undef) echo "sigsetjmp not found." >&4;;
9098         esac
9099         ;;
9100 esac
9101 set d_sigsetjmp
9102 eval $setvar
9103 $rm -f try.c try
9104
9105 socketlib=''
9106 sockethdr=''
9107 : see whether socket exists
9108 echo " "
9109 $echo $n "Hmm... $c" >&4
9110 if set socket val -f d_socket; eval $csym; $val; then
9111         echo "Looks like you have Berkeley networking support." >&4
9112         d_socket="$define"
9113         if set setsockopt val -f; eval $csym; $val; then
9114                 d_oldsock="$undef"
9115         else
9116                 echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
9117                 d_oldsock="$define"
9118         fi
9119 else
9120         if $contains socklib libc.list >/dev/null 2>&1; then
9121                 echo "Looks like you have Berkeley networking support." >&4
9122                 d_socket="$define"
9123                 : we will have to assume that it supports the 4.2 BSD interface
9124                 d_oldsock="$undef"
9125         else
9126                 echo "You don't have Berkeley networking in libc$_a..." >&4
9127                 if test -f /usr/lib/libnet$_a; then
9128                         ( ($nm $nm_opt /usr/lib/libnet$_a | eval $nm_extract) ||  \
9129                         $ar t /usr/lib/libnet$_a) 2>/dev/null >> libc.list
9130                         if $contains socket libc.list >/dev/null 2>&1; then
9131                         echo "...but the Wollongong group seems to have hacked it in." >&4
9132                                 socketlib="-lnet"
9133                                 sockethdr="-I/usr/netinclude"
9134                                 d_socket="$define"
9135                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9136                                         d_oldsock="$undef"
9137                                 else
9138                                         echo "...using the old 4.1c interface, rather than 4.2" >&4
9139                                         d_oldsock="$define"
9140                                 fi
9141                         else
9142                                 echo "or even in libnet$_a, which is peculiar." >&4
9143                                 d_socket="$undef"
9144                                 d_oldsock="$undef"
9145                         fi
9146                 else
9147                         echo "or anywhere else I see." >&4
9148                         d_socket="$undef"
9149                         d_oldsock="$undef"
9150                 fi
9151         fi
9152 fi
9153
9154 : see if socketpair exists
9155 set socketpair d_sockpair
9156 eval $inlibc
9157
9158 : see if stat knows about block sizes
9159 echo " "
9160 set d_statblks stat st_blocks $i_sysstat sys/stat.h
9161 eval $hasfield
9162
9163 : see if _ptr and _cnt from stdio act std
9164 echo " "
9165 if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
9166         echo "(Looks like you have stdio.h from Linux.)"
9167         case "$stdio_ptr" in
9168         '') stdio_ptr='((fp)->_IO_read_ptr)'
9169                 ptr_lval=$define
9170                 ;;
9171         *)      ptr_lval=$d_stdio_ptr_lval;;
9172         esac
9173         case "$stdio_cnt" in
9174         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
9175                 cnt_lval=$undef
9176                 ;;
9177         *)      cnt_lval=$d_stdio_cnt_lval;;
9178         esac
9179         case "$stdio_base" in
9180         '') stdio_base='((fp)->_IO_read_base)';;
9181         esac
9182         case "$stdio_bufsiz" in
9183         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
9184         esac
9185 else
9186         case "$stdio_ptr" in
9187         '') stdio_ptr='((fp)->_ptr)'
9188                 ptr_lval=$define
9189                 ;;
9190         *)      ptr_lval=$d_stdio_ptr_lval;;
9191         esac
9192         case "$stdio_cnt" in
9193         '') stdio_cnt='((fp)->_cnt)'
9194                 cnt_lval=$define
9195                 ;;
9196         *)      cnt_lval=$d_stdio_cnt_lval;;
9197         esac
9198         case "$stdio_base" in
9199         '') stdio_base='((fp)->_base)';;
9200         esac
9201         case "$stdio_bufsiz" in
9202         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
9203         esac
9204 fi
9205 : test whether _ptr and _cnt really work
9206 echo "Checking how std your stdio is..." >&4
9207 $cat >try.c <<EOP
9208 #include <stdio.h>
9209 #define FILE_ptr(fp)    $stdio_ptr
9210 #define FILE_cnt(fp)    $stdio_cnt
9211 main() {
9212         FILE *fp = fopen("try.c", "r");
9213         char c = getc(fp);
9214         if (
9215                 18 <= FILE_cnt(fp) &&
9216                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
9217         )
9218                 exit(0);
9219         exit(1);
9220 }
9221 EOP
9222 val="$undef"
9223 set try
9224 if eval $compile; then
9225         if ./try; then
9226                 echo "Your stdio acts pretty std."
9227                 val="$define"
9228         else
9229                 echo "Your stdio isn't very std."
9230         fi
9231 else
9232         echo "Your stdio doesn't appear very std."
9233 fi
9234 $rm -f try.c try
9235 set d_stdstdio
9236 eval $setvar
9237
9238 : Can _ptr be used as an lvalue?
9239 case "$d_stdstdio$ptr_lval" in
9240 $define$define) val=$define ;;
9241 *) val=$undef ;;
9242 esac
9243 set d_stdio_ptr_lval
9244 eval $setvar
9245
9246 : Can _cnt be used as an lvalue?
9247 case "$d_stdstdio$cnt_lval" in
9248 $define$define) val=$define ;;
9249 *) val=$undef ;;
9250 esac
9251 set d_stdio_cnt_lval
9252 eval $setvar
9253
9254 : see if _base is also standard
9255 val="$undef"
9256 case "$d_stdstdio" in
9257 $define)
9258         $cat >try.c <<EOP
9259 #include <stdio.h>
9260 #define FILE_base(fp)   $stdio_base
9261 #define FILE_bufsiz(fp) $stdio_bufsiz
9262 main() {
9263         FILE *fp = fopen("try.c", "r");
9264         char c = getc(fp);
9265         if (
9266                 19 <= FILE_bufsiz(fp) &&
9267                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
9268         )
9269                 exit(0);
9270         exit(1);
9271 }
9272 EOP
9273         set try
9274         if eval $compile; then
9275                 if ./try; then
9276                         echo "And its _base field acts std."
9277                         val="$define"
9278                 else
9279                         echo "But its _base field isn't std."
9280                 fi
9281         else
9282                 echo "However, it seems to be lacking the _base field."
9283         fi
9284         $rm -f try.c try
9285         ;;
9286 esac
9287 set d_stdiobase
9288 eval $setvar
9289
9290 : see if strcoll exists
9291 set strcoll d_strcoll
9292 eval $inlibc
9293
9294 : check for structure copying
9295 echo " "
9296 echo "Checking to see if your C compiler can copy structs..." >&4
9297 $cat >try.c <<'EOCP'
9298 main()
9299 {
9300         struct blurfl {
9301                 int dyick;
9302         } foo, bar;
9303
9304         foo = bar;
9305 }
9306 EOCP
9307 if $cc -c try.c >/dev/null 2>&1 ; then
9308         val="$define"
9309         echo "Yup, it can."
9310 else
9311         val="$undef"
9312         echo "Nope, it can't."
9313 fi
9314 set d_strctcpy
9315 eval $setvar
9316 $rm -f try.*
9317
9318 : see if strerror and/or sys_errlist[] exist
9319 echo " "
9320 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
9321     if set strerror val -f d_strerror; eval $csym; $val; then
9322                 echo 'strerror() found.' >&4
9323                 d_strerror="$define"
9324                 d_strerrm='strerror(e)'
9325                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9326                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
9327                         d_syserrlst="$define"
9328                 else
9329                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
9330                         d_syserrlst="$undef"
9331                 fi
9332     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
9333                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
9334                 echo 'strerror() found in string header.' >&4
9335                 d_strerror="$define"
9336                 d_strerrm='strerror(e)'
9337                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9338                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
9339                                 d_syserrlst="$define"
9340                 else
9341                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
9342                         d_syserrlst="$undef"
9343                 fi
9344     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
9345                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
9346                 d_strerror="$undef"
9347                 d_syserrlst="$define"
9348                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
9349     else
9350                 echo 'strerror() and sys_errlist[] NOT found.' >&4
9351                 d_strerror="$undef"
9352                 d_syserrlst="$undef"
9353                 d_strerrm='"unknown"'
9354     fi
9355 fi
9356
9357 : see if strtod exists
9358 set strtod d_strtod
9359 eval $inlibc
9360
9361 : see if strtol exists
9362 set strtol d_strtol
9363 eval $inlibc
9364
9365 : see if strtoul exists
9366 set strtoul d_strtoul
9367 eval $inlibc
9368
9369 : see if strxfrm exists
9370 set strxfrm d_strxfrm
9371 eval $inlibc
9372
9373 : see if symlink exists
9374 set symlink d_symlink
9375 eval $inlibc
9376
9377 : see if syscall exists
9378 set syscall d_syscall
9379 eval $inlibc
9380
9381 : see if sysconf exists
9382 set sysconf d_sysconf
9383 eval $inlibc
9384
9385 : see if system exists
9386 set system d_system
9387 eval $inlibc
9388
9389 : see if tcgetpgrp exists
9390 set tcgetpgrp d_tcgetpgrp
9391 eval $inlibc
9392
9393 : see if tcsetpgrp exists
9394 set tcsetpgrp d_tcsetpgrp
9395 eval $inlibc
9396
9397 : define an is-a-typedef? function
9398 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9399 case "$inclist" in
9400 "") inclist="sys/types.h";;
9401 esac;
9402 eval "varval=\$$var";
9403 case "$varval" in
9404 "")
9405         $rm -f temp.c;
9406         for inc in $inclist; do
9407                 echo "#include <$inc>" >>temp.c;
9408         done;
9409         echo "#ifdef $type" >> temp.c;
9410         echo "printf(\"We have $type\");" >> temp.c;
9411         echo "#endif" >> temp.c;
9412         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9413         if $contains $type temp.E >/dev/null 2>&1; then
9414                 eval "$var=\$type";
9415         else
9416                 eval "$var=\$def";
9417         fi;
9418         $rm -f temp.?;;
9419 *) eval "$var=\$varval";;
9420 esac'
9421
9422 : define an is-a-typedef? function that prompts if the type is not available.
9423 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9424 case "$inclist" in
9425 "") inclist="sys/types.h";;
9426 esac;
9427 eval "varval=\$$var";
9428 case "$varval" in
9429 "")
9430         $rm -f temp.c;
9431         for inc in $inclist; do
9432                 echo "#include <$inc>" >>temp.c;
9433         done;
9434         echo "#ifdef $type" >> temp.c;
9435         echo "printf(\"We have $type\");" >> temp.c;
9436         echo "#endif" >> temp.c;
9437         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9438         echo " " ;
9439         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9440         if $contains $type temp.E >/dev/null 2>&1; then
9441                 echo "$type found." >&4;
9442                 eval "$var=\$type";
9443         else
9444                 echo "$type NOT found." >&4;
9445                 dflt="$def";
9446                 . ./myread ;
9447                 eval "$var=\$ans";
9448         fi;
9449         $rm -f temp.?;;
9450 *) eval "$var=\$varval";;
9451 esac'
9452
9453 : see if this is a sys/times.h system
9454 set sys/times.h i_systimes
9455 eval $inhdr
9456
9457 : see if times exists
9458 echo " "
9459 if set times val -f d_times; eval $csym; $val; then
9460         echo 'times() found.' >&4
9461         d_times="$define"
9462         inc=''
9463         case "$i_systimes" in
9464         "$define") inc='sys/times.h';;
9465         esac
9466         rp="What is the type returned by times() on this system?"
9467         set clock_t clocktype long stdio.h sys/types.h $inc
9468         eval $typedef_ask
9469 else
9470         echo 'times() NOT found, hope that will do.' >&4
9471         d_times="$undef"
9472         clocktype='int'
9473 fi
9474
9475 : see if truncate exists
9476 set truncate d_truncate
9477 eval $inlibc
9478
9479 : see if tzname[] exists
9480 echo " "
9481 if set tzname val -a d_tzname; eval $csym; $val; then
9482         val="$define"
9483         echo 'tzname[] found.' >&4
9484 else
9485         val="$undef"
9486         echo 'tzname[] NOT found.' >&4
9487 fi
9488 set d_tzname
9489 eval $setvar
9490
9491 : see if umask exists
9492 set umask d_umask
9493 eval $inlibc
9494
9495 : see how we will look up host name
9496 echo " "
9497 if false; then
9498         : dummy stub to allow use of elif
9499 elif set uname val -f d_uname; eval $csym; $val; then
9500         if ./xenix; then
9501                 $cat <<'EOM'
9502 uname() was found, but you're running xenix, and older versions of xenix
9503 have a broken uname(). If you don't really know whether your xenix is old
9504 enough to have a broken system call, use the default answer.
9505
9506 EOM
9507                 dflt=y
9508                 case "$d_uname" in
9509                 "$define") dflt=n;;
9510                 esac
9511                 rp='Is your uname() broken?'
9512                 . ./myread
9513                 case "$ans" in
9514                 n*) d_uname="$define"; call=uname;;
9515                 esac
9516         else
9517                 echo 'uname() found.' >&4
9518                 d_uname="$define"
9519                 call=uname
9520         fi
9521 fi
9522 case "$d_gethname" in
9523 '') d_gethname="$undef";;
9524 esac
9525 case "$d_uname" in
9526 '') d_uname="$undef";;
9527 esac
9528 case "$d_phostname" in
9529 '') d_phostname="$undef";;
9530 esac
9531
9532 : backward compatibility for d_hvfork
9533 if test X$d_hvfork != X; then
9534         d_vfork="$d_hvfork"
9535         d_hvfork=''
9536 fi
9537 : see if there is a vfork
9538 val=''
9539 set vfork val
9540 eval $inlibc
9541
9542 : Ok, but do we want to use it. vfork is reportedly unreliable in 
9543 : perl on Solaris 2.x, and probably elsewhere.
9544 case "$val" in
9545 $define)
9546         echo " "
9547         case "$usevfork" in
9548         false) dflt='n';;
9549         *) dflt='y';;
9550         esac
9551         rp="Some systems have problems with vfork().  Do you want to use it?"
9552         . ./myread
9553         case "$ans" in
9554         y|Y) ;;
9555         *)
9556                 echo "Ok, we won't use vfork()."
9557                 val="$undef"
9558                 ;;
9559         esac
9560         ;;
9561 esac
9562 set d_vfork
9563 eval $setvar
9564 case "$d_vfork" in
9565 $define) usevfork='true';;
9566 *) usevfork='false';;
9567 esac
9568
9569 : see if this is an sysdir system
9570 set sys/dir.h i_sysdir
9571 eval $inhdr
9572
9573 : see if this is an sysndir system
9574 set sys/ndir.h i_sysndir
9575 eval $inhdr
9576
9577 : see if sys/types.h has to be included
9578 set sys/types.h i_systypes
9579 eval $inhdr
9580
9581 : see if closedir exists
9582 set closedir d_closedir
9583 eval $inlibc
9584
9585 case "$d_closedir" in
9586 "$define")
9587         echo " "
9588         echo "Checking whether closedir() returns a status..." >&4
9589         cat > closedir.c <<EOM
9590 #$i_dirent I_DIRENT             /**/
9591 #$i_sysdir I_SYS_DIR            /**/
9592 #$i_sysndir I_SYS_NDIR          /**/
9593 #$i_systypes I_SYS_TYPES        /**/
9594
9595 #if defined(I_SYS_TYPES)
9596 #include <sys/types.h>
9597 #endif
9598 #if defined(I_DIRENT)
9599 #include <dirent.h>
9600 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
9601 #include <sys/dir.h>
9602 #endif
9603 #else
9604 #ifdef I_SYS_NDIR
9605 #include <sys/ndir.h>
9606 #else
9607 #ifdef I_SYS_DIR
9608 #ifdef hp9000s500
9609 #include <ndir.h>       /* may be wrong in the future */
9610 #else
9611 #include <sys/dir.h>
9612 #endif
9613 #endif
9614 #endif
9615 #endif 
9616 int main() { return closedir(opendir(".")); }
9617 EOM
9618         set closedir
9619         if eval $compile_ok; then
9620                 if ./closedir > /dev/null 2>&1 ; then
9621                         echo "Yes, it does."
9622                         val="$undef"
9623                 else
9624                         echo "No, it doesn't."
9625                         val="$define"
9626                 fi
9627         else
9628                 echo "(I can't seem to compile the test program--assuming it doesn't)"
9629                 val="$define"
9630         fi
9631         ;;
9632 *)
9633         val="$undef";
9634         ;;
9635 esac
9636 set d_void_closedir
9637 eval $setvar
9638 $rm -f closedir*
9639 : check for volatile keyword
9640 echo " "
9641 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
9642 $cat >try.c <<'EOCP'
9643 main()
9644 {
9645         typedef struct _goo_struct goo_struct;
9646         goo_struct * volatile goo = ((goo_struct *)0);
9647         struct _goo_struct {
9648                 long long_int;
9649                 int reg_int;
9650                 char char_var;
9651         };
9652         typedef unsigned short foo_t;
9653         char *volatile foo;
9654         volatile int bar;
9655         volatile foo_t blech;
9656         foo = foo;
9657 }
9658 EOCP
9659 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
9660         val="$define"
9661         echo "Yup, it does."
9662 else
9663         val="$undef"
9664         echo "Nope, it doesn't."
9665 fi
9666 set d_volatile
9667 eval $setvar
9668 $rm -f try.*
9669
9670 : see if there is a wait4
9671 set wait4 d_wait4
9672 eval $inlibc
9673
9674 : see if waitpid exists
9675 set waitpid d_waitpid
9676 eval $inlibc
9677
9678 : see if wcstombs exists
9679 set wcstombs d_wcstombs
9680 eval $inlibc
9681
9682 : see if wctomb exists
9683 set wctomb d_wctomb
9684 eval $inlibc
9685
9686 : preserve RCS keywords in files with variable substitution, grrr
9687 Date='$Date'
9688 Id='$Id'
9689 Log='$Log'
9690 RCSfile='$RCSfile'
9691 Revision='$Revision'
9692
9693 : check for alignment requirements
9694 echo " "
9695 case "$alignbytes" in
9696 '') echo "Checking alignment constraints..." >&4
9697         $cat >try.c <<'EOCP'
9698 struct foobar {
9699         char foo;
9700         double bar;
9701 } try;
9702 main()
9703 {
9704         printf("%d\n", (char *)&try.bar - (char *)&try.foo);
9705 }
9706 EOCP
9707         set try
9708         if eval $compile_ok; then
9709                 dflt=`./try`
9710         else
9711                 dflt='8'
9712                 echo "(I can't seem to compile the test program...)"
9713         fi
9714         ;;
9715 *) dflt="$alignbytes"
9716         ;;
9717 esac
9718 rp="Doubles must be aligned on a how-many-byte boundary?"
9719 . ./myread
9720 alignbytes="$ans"
9721 $rm -f try.c try
9722
9723 : check for ordering of bytes in a long
9724 case "$byteorder" in
9725 '')
9726         $cat <<'EOM'
9727   
9728 In the following, larger digits indicate more significance.  A big-endian
9729 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
9730 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
9731 machines may have weird orders like 3412.  A Cray will report 87654321. If
9732 the test program works the default is probably right.
9733 I'm now running the test program...
9734 EOM
9735         $cat >try.c <<'EOCP'
9736 #include <stdio.h>
9737 main()
9738 {
9739         int i;
9740         union {
9741                 unsigned long l;
9742                 char c[sizeof(long)];
9743         } u;
9744
9745         if (sizeof(long) > 4)
9746                 u.l = (0x08070605L << 32) | 0x04030201L;
9747         else
9748                 u.l = 0x04030201L;
9749         for (i = 0; i < sizeof(long); i++)
9750                 printf("%c", u.c[i]+'0');
9751         printf("\n");
9752         exit(0);
9753 }
9754 EOCP
9755         xxx_prompt=y
9756         set try
9757         if eval $compile && ./try > /dev/null; then
9758                 dflt=`./try`
9759                 case "$dflt" in
9760                 [1-4][1-4][1-4][1-4]|12345678|87654321)
9761                         echo "(The test program ran ok.)"
9762                         echo "byteorder=$dflt"
9763                         xxx_prompt=n
9764                         ;;
9765                 ????|????????) echo "(The test program ran ok.)" ;;
9766                 *) echo "(The test program didn't run right for some reason.)" ;;
9767                 esac
9768         else
9769                 dflt='4321'
9770                 cat <<'EOM'
9771 (I can't seem to compile the test program.  Guessing big-endian...)
9772 EOM
9773         fi
9774         case "$xxx_prompt" in
9775         y)
9776                 rp="What is the order of bytes in a long?"
9777                 . ./myread
9778                 byteorder="$ans"
9779                 ;;
9780         *)      byteorder=$dflt
9781                 ;;
9782         esac
9783         ;;
9784 esac
9785 $rm -f try.c try
9786
9787 : how do we catenate cpp tokens here?
9788 echo " "
9789 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
9790 $cat >cpp_stuff.c <<'EOCP'
9791 #define RCAT(a,b)a/**/b
9792 #define ACAT(a,b)a ## b
9793 RCAT(Rei,ser)
9794 ACAT(Cir,cus)
9795 EOCP
9796 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
9797 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
9798         echo "Oh!  Smells like ANSI's been here." >&4
9799         echo "We can catify or stringify, separately or together!"
9800         cpp_stuff=42
9801 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
9802         echo "Ah, yes!  The good old days!" >&4
9803         echo "However, in the good old days we don't know how to stringify and"
9804         echo "catify at the same time."
9805         cpp_stuff=1
9806 else
9807         $cat >&4 <<EOM
9808 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
9809 to have to edit the values of CAT[2-5] in config.h...
9810 EOM
9811         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
9812 fi
9813 $rm -f cpp_stuff.*
9814
9815 : see if this is a db.h system
9816 set db.h i_db
9817 eval $inhdr
9818
9819 case "$i_db" in
9820 $define)
9821         : Check db version.
9822         echo " "
9823         echo "Checking Berkeley DB version ..." >&4
9824         $cat >try.c <<EOCP
9825 #$d_const HASCONST
9826 #ifndef HASCONST
9827 #define const
9828 #endif
9829 #include <sys/types.h>
9830 #include <stdio.h>
9831 #include <db.h>
9832 main()
9833 {
9834 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
9835     int Major, Minor, Patch ;
9836     unsigned long Version ;
9837     (void)db_version(&Major, &Minor, &Patch) ;
9838     printf("You have Berkeley DB Version 2 or greater\n");
9839
9840     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
9841                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
9842     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
9843                 Major, Minor, Patch) ;
9844
9845     /* check that db.h & libdb are compatible */
9846     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
9847         printf("db.h and libdb are incompatible\n") ;
9848         exit(3);        
9849     }
9850
9851     printf("db.h and libdb are compatible\n") ;
9852
9853     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
9854                 + DB_VERSION_PATCH ;
9855
9856     /* needs to be >= 2.3.4 */
9857     if (Version < 2003004) {
9858     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
9859         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
9860         exit(2);        
9861     }
9862
9863     exit(0);
9864 #else
9865 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
9866     printf("You have Berkeley DB Version 1\n");
9867     exit(0);    /* DB version < 2: the coast is clear. */
9868 #else
9869     exit(1);    /* <db.h> not Berkeley DB? */
9870 #endif
9871 #endif
9872 }
9873 EOCP
9874         set try
9875         if eval $compile && ./try; then
9876                 echo 'Looks OK.' >&4
9877         else
9878                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
9879                 i_db=$undef
9880                 case " $libs " in
9881                 *"-ldb "*)
9882                         : Remove db from list of libraries to use
9883                         echo "Removing unusable -ldb from library list" >&4
9884                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
9885                         shift
9886                         libs="$*"
9887                         echo "libs = $libs" >&4
9888                         ;;
9889                 esac
9890         fi
9891         $rm -f try.*
9892         ;;
9893 esac
9894
9895 case "$i_db" in
9896 define)
9897         : Check the return type needed for hash 
9898         echo " "
9899         echo "Checking return type needed for hash for Berkeley DB ..." >&4
9900         $cat >try.c <<EOCP
9901 #$d_const HASCONST
9902 #ifndef HASCONST
9903 #define const
9904 #endif
9905 #include <sys/types.h>
9906 #include <db.h>
9907
9908 #ifndef DB_VERSION_MAJOR
9909 u_int32_t hash_cb (ptr, size)
9910 const void *ptr;
9911 size_t size;
9912 {
9913 }
9914 HASHINFO info;
9915 main()
9916 {
9917         info.hash = hash_cb;
9918 }
9919 #endif
9920 EOCP
9921         if $cc $ccflags -c try.c >try.out 2>&1 ; then
9922                 if $contains warning try.out >>/dev/null 2>&1 ; then
9923                         db_hashtype='int'
9924                 else
9925                         db_hashtype='u_int32_t'
9926                 fi
9927         else
9928                 : XXX Maybe we should just give up here.
9929                 db_hashtype=u_int32_t
9930                 $cat try.out >&4
9931                 echo "Help:  I can't seem to compile the db test program." >&4
9932                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
9933         fi
9934         $rm -f try.*
9935         echo "Your version of Berkeley DB uses $db_hashtype for hash."
9936         ;;
9937 *)      db_hashtype=u_int32_t
9938         ;;
9939 esac
9940 case "$i_db" in
9941 define)
9942         : Check the return type needed for prefix 
9943         echo " "
9944         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
9945         cat >try.c <<EOCP
9946 #$d_const HASCONST
9947 #ifndef HASCONST
9948 #define const
9949 #endif
9950 #include <sys/types.h>
9951 #include <db.h>
9952
9953 #ifndef DB_VERSION_MAJOR
9954 size_t prefix_cb (key1, key2)
9955 const DBT *key1;
9956 const DBT *key2;
9957 {
9958 }
9959 BTREEINFO info;
9960 main()
9961 {
9962         info.prefix = prefix_cb;
9963 }
9964 #endif
9965 EOCP
9966         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
9967                 if $contains warning try.out >>/dev/null 2>&1 ; then
9968                         db_prefixtype='int'
9969                 else
9970                         db_prefixtype='size_t'
9971                 fi
9972         else
9973                 db_prefixtype='size_t'
9974                 : XXX Maybe we should just give up here.
9975                 $cat try.out >&4
9976                 echo "Help:  I can't seem to compile the db test program." >&4
9977                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
9978         fi
9979         $rm -f try.*
9980         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
9981         ;;
9982 *)      db_prefixtype='size_t'
9983         ;;
9984 esac
9985
9986 : check for void type
9987 echo " "
9988 echo "Checking to see how well your C compiler groks the void type..." >&4
9989 case "$voidflags" in
9990 '')
9991         $cat >try.c <<'EOCP'
9992 #if TRY & 1
9993 void sub() {
9994 #else
9995 sub() {
9996 #endif
9997         extern void moo();      /* function returning void */
9998         void (*goo)();          /* ptr to func returning void */
9999 #if TRY & 8
10000         void *hue;              /* generic ptr */
10001 #endif
10002 #if TRY & 2
10003         void (*foo[10])();
10004 #endif
10005
10006 #if TRY & 4
10007         if(goo == moo) {
10008                 exit(0);
10009         }
10010 #endif
10011         exit(0);
10012 }
10013 main() { sub(); }
10014 EOCP
10015         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
10016                 voidflags=$defvoidused
10017         echo "Good.  It appears to support void to the level $package wants.">&4
10018                 if $contains warning .out >/dev/null 2>&1; then
10019                         echo "However, you might get some warnings that look like this:"
10020                         $cat .out
10021                 fi
10022         else
10023 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
10024                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
10025                         echo "It supports 1..."
10026                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
10027                                 echo "It also supports 2..."
10028                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
10029                                         voidflags=7
10030                                         echo "And it supports 4 but not 8 definitely."
10031                                 else
10032                                         echo "It doesn't support 4..."
10033                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
10034                                                 voidflags=11
10035                                                 echo "But it supports 8."
10036                                         else
10037                                                 voidflags=3
10038                                                 echo "Neither does it support 8."
10039                                         fi
10040                                 fi
10041                         else
10042                                 echo "It does not support 2..."
10043                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
10044                                         voidflags=13
10045                                         echo "But it supports 4 and 8."
10046                                 else
10047                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
10048                                                 voidflags=5
10049                                                 echo "And it supports 4 but has not heard about 8."
10050                                         else
10051                                                 echo "However it supports 8 but not 4."
10052                                         fi
10053                                 fi
10054                         fi
10055                 else
10056                         echo "There is no support at all for void."
10057                         voidflags=0
10058                 fi
10059         fi
10060 esac
10061 case "$voidflags" in
10062 "$defvoidused") ;;
10063 *)      $cat >&4 <<'EOM'
10064   Support flag bits are:
10065     1: basic void declarations.
10066     2: arrays of pointers to functions returning void.
10067     4: operations between pointers to and addresses of void functions.
10068     8: generic void pointers.
10069 EOM
10070         dflt="$voidflags";
10071         rp="Your void support flags add up to what?"
10072         . ./myread
10073         voidflags="$ans"
10074         ;;
10075 esac
10076 $rm -f try.* .out
10077
10078
10079 : How can we generate normalized random numbers ?
10080 echo " "
10081 case "$randfunc" in
10082 '')
10083         if set drand48 val -f; eval $csym; $val; then
10084                 dflt="drand48"
10085                 echo "Good, found drand48()." >&4
10086         elif set random val -f; eval $csym; $val; then
10087                 dflt="random"
10088                 echo "OK, found random()." >&4
10089         else
10090                 dflt="rand"
10091                 echo "Yick, looks like I have to use rand()." >&4
10092         fi
10093         echo " "
10094         ;;
10095 *)
10096         dflt="$randfunc"
10097         ;;
10098 esac
10099 cont=true
10100
10101 case "$ccflags" in
10102 *-Dmy_rand=*|*-Dmy_srand=*)
10103         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
10104         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
10105         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
10106         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
10107         ;;
10108 esac
10109
10110 while $test "$cont"; do
10111         rp="Use which function to generate random numbers?"
10112         . ./myread
10113         if $test "$ans" = "$dflt"; then
10114                 : null
10115         else
10116                 randbits=''
10117         fi
10118         randfunc="$ans"
10119         if set $ans val -f; eval $csym; $val; then
10120                 cont=''
10121         else
10122                 dflt=n
10123                 rp="Function $ans does not exists. Use that name anyway?"
10124                 . ./myread
10125                 dflt=rand
10126                 case "$ans" in
10127                         [yY]*) cont='';;
10128                 esac
10129         fi
10130         case "$cont" in
10131         '')
10132                 case "$randfunc" in
10133                 drand48)
10134                         drand01="drand48()"
10135                         seedfunc="srand48"
10136                         randbits=48
10137                         randseedtype=long
10138                         ;;
10139                 rand|random)
10140                         case "$randbits" in
10141                         '')
10142 echo "Checking to see how many bits your $randfunc() function produces..." >&4
10143                                 $cat >try.c <<EOCP
10144 #$i_unistd I_UNISTD
10145 #$i_stdlib I_STDLIB
10146 #include <stdio.h>
10147 #ifdef I_UNISTD
10148 #  include <unistd.h>
10149 #endif
10150 #ifdef I_STDLIB
10151 #  include <stdlib.h>
10152 #endif
10153 main()
10154 {
10155         register int i;
10156         register unsigned long tmp;
10157         register unsigned long max = 0L;
10158
10159         for (i = 1000; i; i--) {
10160                 tmp = (unsigned long) $randfunc();
10161                 if (tmp > max) max = tmp;
10162         }
10163         for (i = 0; max; i++)
10164                 max /= 2;
10165         printf("%d\n",i);
10166 }
10167 EOCP
10168                                 set try
10169                                 if eval $compile_ok; then
10170                                         dflt=`try`
10171                                 else
10172                                         dflt='?'
10173                                         echo "(I can't seem to compile the test program...)"
10174                                 fi
10175                                 ;;
10176                         *)
10177                                 dflt="$randbits"
10178                                 ;;
10179                         esac
10180                         rp="How many bits does your $randfunc() function produce?"
10181                         . ./myread
10182                         randbits="$ans"
10183                         $rm -f try.c try
10184                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10185                         seedfunc="s$randfunc"
10186                         randseedtype=unsigned
10187                         ;;
10188                 *)
10189                         dflt="31"
10190                         rp="How many bits does your $randfunc() function produce?"
10191                         . ./myread
10192                         randbits="$ans"
10193                         seedfunc="s$randfunc"
10194                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10195                         if set $seedfunc val -f; eval $csym; $val; then
10196                                 echo "(Using $seedfunc() to seed random generator)"
10197                         else
10198                                 echo "(Warning: no $seedfunc() to seed random generator)"
10199                                 seedfunc=rand
10200                         fi
10201                         randseedtype=unsigned
10202                         ;;
10203                 esac
10204                 ;;
10205         esac
10206 done
10207
10208 echo " "
10209 echo "Determining whether or not we are on an EBCDIC system..." >&4
10210 $cat >tebcdic.c <<'EOM'
10211 int main()
10212 {
10213   if ('M'==0xd4) return 0;
10214   return 1;
10215 }
10216 EOM
10217
10218 val=$undef
10219 set tebcdic
10220 if eval $compile_ok; then
10221         if ./tebcdic; then
10222                 echo "You have EBCDIC." >&4
10223                 val="$define"
10224         else
10225                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin." >&4
10226         fi
10227 else
10228         echo "$me: I'm unable to compile the test program." >&4
10229         echo "I'll assume ASCII or some ISO Latin." >&4
10230 fi
10231 $rm -f tebcdic.c tebcdic
10232 set ebcdic
10233 eval $setvar
10234
10235 : see what type file positions are declared as in the library
10236 rp="What is the type for file position used by fsetpos()?"
10237 set fpos_t fpostype long stdio.h sys/types.h
10238 eval $typedef_ask
10239
10240 : get csh whereabouts
10241 case "$csh" in
10242 'csh') val="$undef" ;;
10243 *) val="$define" ;;
10244 esac
10245 set d_csh
10246 eval $setvar
10247 : Respect a hint or command line value for full_csh.
10248 case "$full_csh" in
10249 '') full_csh=$csh ;;
10250 esac
10251
10252 : Store the full pathname to the sed program for use in the C program
10253 full_sed=$sed
10254
10255 : see what type gids are declared as in the kernel
10256 echo " "
10257 echo "Looking for the type for group ids returned by getgid()."
10258 set gid_t gidtype xxx stdio.h sys/types.h
10259 eval $typedef
10260 case "$gidtype" in
10261 xxx)
10262         xxx=`./findhdr sys/user.h`
10263         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
10264         case $1 in
10265         unsigned) dflt="$1 $2" ;;
10266         *) dflt="$1" ;;
10267         esac
10268         ;;
10269 *) dflt="$gidtype";;
10270 esac
10271 case "$gidtype" in
10272 gid_t) echo "gid_t found." ;;
10273 *)      rp="What is the type for group ids returned by getgid()?"
10274         . ./myread
10275         gidtype="$ans"
10276         ;;
10277 esac
10278
10279 : see if getgroups exists
10280 set getgroups d_getgrps
10281 eval $inlibc
10282
10283 : see if setgroups exists
10284 set setgroups d_setgrps
10285 eval $inlibc
10286
10287
10288 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
10289 echo " "
10290 case "$d_getgrps$d_setgrps" in
10291 *define*)
10292         case "$groupstype" in
10293         '') dflt="$gidtype" ;;
10294         *)  dflt="$groupstype" ;;
10295         esac
10296         $cat <<EOM
10297 What type of pointer is the second argument to getgroups() and setgroups()?
10298 Usually this is the same as group ids, $gidtype, but not always.
10299
10300 EOM
10301         rp='What type pointer is the second argument to getgroups() and setgroups()?'
10302         . ./myread
10303         groupstype="$ans"
10304         ;;
10305 *)  groupstype="$gidtype";;
10306 esac
10307
10308 : see what type lseek is declared as in the kernel
10309 rp="What is the type used for lseek's offset on this system?"
10310 set off_t lseektype long stdio.h sys/types.h
10311 eval $typedef_ask
10312
10313 echo " "
10314 $echo $n "Checking to see how big your file offsets are...$c" >&4
10315 $cat >try.c <<EOCP
10316 #include <sys/types.h>
10317 #include <stdio.h>
10318 main()
10319 {
10320         printf("%d\n", sizeof($lseektype));
10321 }
10322 EOCP
10323 set try
10324 if eval $compile_ok; then
10325         lseeksize=`./try`
10326         $echo " $lseeksize bytes." >&4
10327 else
10328         dflt='4'
10329         echo " "
10330         echo "(I can't seem to compile the test program.  Guessing...)"
10331         rp="What is the size of your file offsets (in bytes)?"
10332         . ./myread
10333         lseeksize="$ans"
10334 fi
10335 $rm -f try.c try
10336
10337 echo " "
10338 echo "Checking if your $make program sets \$(MAKE)..." >&4
10339 case "$make_set_make" in
10340 '')
10341         $sed 's/^X //' > testmake.mak << 'EOF'
10342 Xall:
10343 X       @echo 'maketemp="$(MAKE)"'
10344 EOF
10345         case "`$make -f testmake.mak 2>/dev/null`" in
10346         *maketemp=*) make_set_make='#' ;;
10347         *)      make_set_make="MAKE=$make" ;;
10348         esac
10349         $rm -f testmake.mak
10350         ;;
10351 esac
10352 case "$make_set_make" in
10353 '#') echo "Yup, it does.";;
10354 *) echo "Nope, it doesn't.";;
10355 esac
10356
10357 : see what type is used for mode_t
10358 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
10359 set mode_t modetype int stdio.h sys/types.h
10360 eval $typedef_ask
10361
10362 : define a fucntion to check prototypes
10363 $cat > protochk <<EOSH
10364 $startsh
10365 cc="$cc"
10366 optimize="$optimize"
10367 ccflags="$ccflags"
10368 prototype="$prototype"
10369 define="$define"
10370 rm=$rm
10371 EOSH
10372
10373 $cat >> protochk <<'EOSH'
10374
10375 $rm -f try.c
10376 foo="$1"
10377 shift
10378 while test $# -ge 2; do
10379         case "$1" in
10380                 $define) echo "#include <$2>" >> try.c ;;
10381                 literal) echo "$2" >> try.c ;;
10382         esac
10383     shift 2
10384 done
10385 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10386 cat >> try.c <<'EOCP'
10387 #ifdef CAN_PROTOTYPE
10388 #define _(args) args
10389 #else
10390 #define _(args) ()
10391 #endif
10392 EOCP
10393 echo "$foo" >> try.c
10394 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10395 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10396 status=$?
10397 $rm -f try.[co]
10398 exit $status
10399 EOSH
10400 chmod +x protochk
10401 $eunicefix protochk
10402
10403 : see what type is used for size_t
10404 rp="What is the type used for the length parameter for string functions?"
10405 set size_t sizetype 'unsigned int' stdio.h sys/types.h
10406 eval $typedef_ask
10407
10408 : check for type of arguments to gethostbyaddr. 
10409 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
10410         case "$d_gethbyaddr" in
10411         $define)
10412                 $cat <<EOM
10413
10414 Checking to see what type of arguments are accepted by gethostbyaddr().
10415 EOM
10416                 hdrs="$define sys/types.h
10417                         $d_socket sys/socket.h 
10418                         $i_niin netinet/in.h 
10419                         $i_netdb netdb.h
10420                         $i_unistd unistd.h"
10421                 : The first arg can 'char *' or 'void *'
10422                 : The second arg is some of integral type
10423                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
10424                         for yyy in size_t long int; do
10425                                 case "$netdb_host_type" in
10426                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
10427                                         if ./protochk "$try" $hdrs; then
10428                                                 echo "Your system accepts $xxx for the first arg."
10429                                                 echo "...and $yyy for the second arg."
10430                                                 netdb_host_type="$xxx"
10431                                                 netdb_hlen_type="$yyy"
10432                                         fi
10433                                         ;;
10434                                 esac
10435                         done
10436                 done
10437                 : In case none of those worked, prompt the user.
10438                 case "$netdb_host_type" in
10439                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
10440                         dflt='char *'
10441                         . ./myread
10442                         netdb_host_type=$ans
10443                         rp='What is the type for the 2nd argument to gethostbyaddr?'
10444                         dflt="$sizetype"
10445                         . ./myread
10446                         netdb_hlen_type=$ans
10447                         ;;
10448                 esac
10449                 ;;
10450         *)      : no gethostbyaddr, so pick harmless defaults
10451                 netdb_host_type='char *'
10452                 netdb_hlen_type="$sizetype"
10453                 ;;
10454         esac
10455         # Remove the "const" if needed. -- but then we'll have a 
10456         # prototype clash!
10457         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
10458 fi
10459
10460 : check for type of argument to gethostbyname. 
10461 if test "X$netdb_name_type" = X ; then
10462         case "$d_gethbyname" in
10463         $define)
10464                 $cat <<EOM
10465
10466 Checking to see what type of argument is accepted by gethostbyname().
10467 EOM
10468                 hdrs="$define sys/types.h
10469                         $d_socket sys/socket.h 
10470                         $i_niin netinet/in.h 
10471                         $i_netdb netdb.h
10472                         $i_unistd unistd.h"
10473                 for xxx in "const char *" "char *"; do
10474                         case "$netdb_name_type" in
10475                         '')     try="extern struct hostent *gethostbyname($xxx);"
10476                                 if ./protochk "$try" $hdrs; then
10477                                         echo "Your system accepts $xxx."
10478                                         netdb_name_type="$xxx"
10479                                 fi
10480                                 ;;
10481                         esac
10482                 done
10483                 : In case none of those worked, prompt the user.
10484                 case "$netdb_name_type" in
10485                 '')     rp='What is the type for the 1st argument to gethostbyname?'
10486                         dflt='char *'
10487                         . ./myread
10488                         netdb_name_type=$ans
10489                         ;;
10490                 esac
10491                 ;;
10492         *)      : no gethostbyname, so pick harmless default
10493                 netdb_name_type='char *'
10494                 ;;
10495         esac
10496 fi
10497
10498 : check for type of 1st argument to getnetbyaddr. 
10499 if test "X$netdb_net_type" = X ; then
10500         case "$d_getnbyaddr" in
10501         $define)
10502                 $cat <<EOM
10503
10504 Checking to see what type of 1st argument is accepted by getnetbyaddr().
10505 EOM
10506                 hdrs="$define sys/types.h
10507                         $d_socket sys/socket.h 
10508                         $i_niin netinet/in.h 
10509                         $i_netdb netdb.h
10510                         $i_unistd unistd.h"
10511                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
10512                         case "$netdb_net_type" in
10513                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
10514                                 if ./protochk "$try" $hdrs; then
10515                                         echo "Your system accepts $xxx."
10516                                         netdb_net_type="$xxx"
10517                                 fi
10518                                 ;;
10519                         esac
10520                 done
10521                 : In case none of those worked, prompt the user.
10522                 case "$netdb_net_type" in
10523                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
10524                         dflt='long'
10525                         . ./myread
10526                         netdb_net_type=$ans
10527                         ;;
10528                 esac
10529                 ;;
10530         *)      : no getnetbyaddr, so pick harmless default
10531                 netdb_net_type='long'
10532                 ;;
10533         esac
10534 fi
10535 : locate the preferred pager for this system
10536 case "$pager" in
10537 '')
10538         dflt=''
10539         case "$pg" in
10540         /*) dflt=$pg;;
10541         esac
10542         case "$more" in
10543         /*) dflt=$more;;
10544         esac
10545         case "$less" in
10546         /*) dflt=$less;;
10547         esac
10548         case "$dflt" in
10549         '') dflt=/usr/ucb/more;;
10550         esac
10551         ;;
10552 *) dflt="$pager";;
10553 esac
10554 echo " "
10555 fn=f/
10556 rp='What pager is used on your system?'
10557 . ./getfile
10558 pager="$ans"
10559
10560 : see what type pids are declared as in the kernel
10561 rp="What is the type of process ids on this system?"
10562 set pid_t pidtype int stdio.h sys/types.h
10563 eval $typedef_ask
10564
10565 : check for length of pointer
10566 echo " "
10567 case "$ptrsize" in
10568 '')
10569         $echo $n "Checking to see how big your pointers are...$c" >&4
10570         if test "$voidflags" -gt 7; then
10571                 echo '#define VOID_PTR char *' > try.c
10572         else
10573                 echo '#define VOID_PTR void *' > try.c
10574         fi
10575         $cat >>try.c <<'EOCP'
10576 #include <stdio.h>
10577 main()
10578 {
10579         printf("%d\n", sizeof(VOID_PTR));
10580         exit(0);
10581 }
10582 EOCP
10583         set try
10584         if eval $compile_ok; then
10585                 ptrsize=`./try`
10586                 $echo " $ptrsize bytes." >&4
10587         else
10588                 dflt='4'
10589                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
10590                 rp="What is the size of a pointer (in bytes)?"
10591                 . ./myread
10592                 ptrsize="$ans"
10593         fi
10594         ;;
10595 esac
10596 $rm -f try.c try
10597
10598 : see if ar generates random libraries by itself
10599 echo " "
10600 echo "Checking how to generate random libraries on your machine..." >&4
10601 echo 'int bar1() { return bar2(); }' > bar1.c
10602 echo 'int bar2() { return 2; }' > bar2.c
10603 $cat > foo.c <<'EOP'
10604 main() { printf("%d\n", bar1()); exit(0); }
10605 EOP
10606 $cc $ccflags -c bar1.c >/dev/null 2>&1
10607 $cc $ccflags -c bar2.c >/dev/null 2>&1
10608 $cc $ccflags -c foo.c >/dev/null 2>&1
10609 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
10610 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
10611         ./foobar >/dev/null 2>&1; then
10612         echo "$ar appears to generate random libraries itself."
10613         orderlib=false
10614         ranlib=":"
10615 elif $ar ts bar$_a >/dev/null 2>&1 &&
10616         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
10617         ./foobar >/dev/null 2>&1; then
10618                 echo "a table of contents needs to be added with '$ar ts'."
10619                 orderlib=false
10620                 ranlib="$ar ts"
10621 else
10622         case "$ranlib" in
10623         :) ranlib='';;
10624         '')
10625                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
10626                 $test -f $ranlib || ranlib=''
10627                 ;;
10628         esac
10629         if $test -n "$ranlib"; then
10630                 echo "your system has '$ranlib'; we'll use that."
10631                 orderlib=false
10632         else
10633                 echo "your system doesn't seem to support random libraries"
10634                 echo "so we'll use lorder and tsort to order the libraries."
10635                 orderlib=true
10636                 ranlib=":"
10637         fi
10638 fi
10639 $rm -f foo* bar* 
10640
10641 : see if sys/select.h has to be included
10642 set sys/select.h i_sysselct
10643 eval $inhdr
10644
10645 : see if we should include time.h, sys/time.h, or both
10646 echo " "
10647 if test "X$timeincl" = X; then
10648         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10649         $echo $n "I'm now running the test program...$c"
10650         $cat >try.c <<'EOCP'
10651 #include <sys/types.h>
10652 #ifdef I_TIME
10653 #include <time.h>
10654 #endif
10655 #ifdef I_SYSTIME
10656 #ifdef SYSTIMEKERNEL
10657 #define KERNEL
10658 #endif
10659 #include <sys/time.h>
10660 #endif
10661 #ifdef I_SYSSELECT
10662 #include <sys/select.h>
10663 #endif
10664 main()
10665 {
10666         struct tm foo;
10667 #ifdef S_TIMEVAL
10668         struct timeval bar;
10669 #endif
10670 #ifdef S_TIMEZONE
10671         struct timezone tzp;
10672 #endif
10673         if (foo.tm_sec == foo.tm_sec)
10674                 exit(0);
10675 #ifdef S_TIMEVAL
10676         if (bar.tv_sec == bar.tv_sec)
10677                 exit(0);
10678 #endif
10679         exit(1);
10680 }
10681 EOCP
10682         flags=''
10683         for s_timezone in '-DS_TIMEZONE' ''; do
10684         sysselect=''
10685         for s_timeval in '-DS_TIMEVAL' ''; do
10686         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10687         for i_time in '' '-DI_TIME'; do
10688         for i_systime in '-DI_SYSTIME' ''; do
10689                 case "$flags" in
10690                 '') $echo $n ".$c"
10691                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10692                         if eval $compile; then
10693                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10694                                 shift
10695                                 flags="$*"
10696                                 echo " "
10697                                 $echo $n "Succeeded with $flags$c"
10698                         fi
10699                         ;;
10700                 esac
10701         done
10702         done
10703         done
10704         done
10705         done
10706         timeincl=''
10707         echo " "
10708         case "$flags" in
10709         *SYSTIMEKERNEL*) i_systimek="$define"
10710                 timeincl=`./findhdr sys/time.h`
10711                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10712         *) i_systimek="$undef";;
10713         esac
10714         case "$flags" in
10715         *I_TIME*) i_time="$define"
10716                 timeincl=`./findhdr time.h`" $timeincl"
10717                 echo "We'll include <time.h>." >&4;;
10718         *) i_time="$undef";;
10719         esac
10720         case "$flags" in
10721         *I_SYSTIME*) i_systime="$define"
10722                 timeincl=`./findhdr sys/time.h`" $timeincl"
10723                 echo "We'll include <sys/time.h>." >&4;;
10724         *) i_systime="$undef";;
10725         esac
10726         $rm -f try.c try
10727 fi
10728
10729 : check for fd_set items
10730 $cat <<EOM
10731
10732 Checking to see how well your C compiler handles fd_set and friends ...
10733 EOM
10734 $cat >fd_set.c <<EOCP
10735 #$i_systime I_SYS_TIME
10736 #$i_sysselct I_SYS_SELECT
10737 #$d_socket HAS_SOCKET
10738 #include <sys/types.h>
10739 #ifdef HAS_SOCKET
10740 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
10741 #endif
10742 #ifdef I_SYS_TIME
10743 #include <sys/time.h>
10744 #endif
10745 #ifdef I_SYS_SELECT
10746 #include <sys/select.h>
10747 #endif
10748 main() {
10749         fd_set fds;
10750
10751 #ifdef TRYBITS
10752         if(fds.fds_bits);
10753 #endif
10754
10755 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10756         exit(0);
10757 #else
10758         exit(1);
10759 #endif
10760 }
10761 EOCP
10762 set fd_set -DTRYBITS
10763 if eval $compile; then
10764         d_fds_bits="$define"
10765         d_fd_set="$define"
10766         echo "Well, your system knows about the normal fd_set typedef..." >&4
10767         if ./fd_set; then
10768                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10769                 d_fd_macros="$define"
10770         else
10771                 $cat >&4 <<'EOM'
10772 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
10773 EOM
10774                 d_fd_macros="$undef"
10775         fi
10776 else
10777         $cat <<'EOM'
10778 Hmm, your compiler has some difficulty with fd_set.  Checking further...
10779 EOM
10780         set fd_set
10781         if eval $compile; then
10782                 d_fds_bits="$undef"
10783                 d_fd_set="$define"
10784                 echo "Well, your system has some sort of fd_set available..." >&4
10785                 if ./fd_set; then
10786                         echo "and you have the normal fd_set macros." >&4
10787                         d_fd_macros="$define"
10788                 else
10789                         $cat <<'EOM'
10790 but not the normal fd_set macros!  Gross!  More work for me...
10791 EOM
10792                         d_fd_macros="$undef"
10793                 fi
10794         else
10795         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
10796                 d_fd_set="$undef"
10797                 d_fds_bits="$undef"
10798                 d_fd_macros="$undef"
10799         fi
10800 fi
10801 $rm -f fd_set*
10802
10803 : check for type of arguments to select. 
10804 case "$selecttype" in
10805 '') case "$d_select" in
10806         $define)
10807                 $cat <<EOM
10808 Checking to see what type of arguments are accepted by select().
10809 EOM
10810                 hdrs="$define sys/types.h
10811                         $i_systime sys/time.h 
10812                         $i_sysselct sys/select.h
10813                         $d_socket sys/socket.h"
10814                 : The first arg can be int, unsigned, or size_t
10815                 : The last arg may or may not be 'const'
10816                 val=''
10817                 for xxx in 'fd_set *' 'int *'; do
10818                         for nfd in 'int' 'size_t' 'unsigned' ; do
10819                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
10820                                         case "$val" in
10821                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
10822                                                 if ./protochk "$try" $hdrs; then
10823                                                         echo "Your system accepts $xxx."
10824                                                         val="$xxx"
10825                                                 fi
10826                                                 ;;
10827                                         esac
10828                                 done
10829                         done
10830                 done
10831                 case "$val" in
10832                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
10833                         case "$d_fd_set" in
10834                                 $define) dflt="fd_set *" ;;
10835                                 *)              dflt="int *" ;;
10836                         esac
10837                         . ./myread
10838                         val=$ans
10839                         ;;
10840                 esac
10841                 selecttype="$val"
10842                 ;;
10843         *)      : no select, so pick a harmless default
10844                 selecttype='int *'
10845                 ;;
10846         esac
10847         ;;
10848 esac
10849
10850 : check for the select 'width'
10851 case "$selectminbits" in
10852 '') case "$d_select" in
10853         $define)
10854                 $cat <<EOM
10855
10856 Checking to see on how many bits at a time your select() operates...
10857 EOM
10858                 $cat >try.c <<EOCP
10859 #include <sys/types.h>
10860 #$i_time I_TIME
10861 #$i_systime I_SYS_TIME
10862 #$i_systimek I_SYS_TIME_KERNEL
10863 #ifdef I_TIME
10864 #   include <time.h>
10865 #endif
10866 #ifdef I_SYS_TIME
10867 #   ifdef I_SYS_TIME_KERNEL
10868 #       define KERNEL
10869 #   endif
10870 #   include <sys/time.h>
10871 #   ifdef I_SYS_TIME_KERNEL
10872 #       undef KERNEL
10873 #   endif
10874 #endif
10875 #$i_sysselct I_SYS_SELECT
10876 #ifdef I_SYS_SELECT
10877 #include <sys/select.h>
10878 #endif
10879 #include <stdio.h>
10880 #define S sizeof($selecttype)
10881 #define MINBITS 64
10882 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
10883 #define NBITS  (NBYTES * 8)
10884 int main() {
10885     char s[NBYTES];
10886     $selecttype b;
10887     struct timeval t;
10888     int i;
10889     FILE* fp;
10890     int fd;
10891
10892     fclose(stdin);
10893     fp = fopen("try.c", "r");
10894     if (fp == 0)
10895       exit(1);
10896     fd = fileno(fp);
10897     if (fd < 0)
10898       exit(2);
10899     b = ($selecttype)s;
10900     for (i = 0; i < NBITS; i++)
10901         FD_SET(i, b);
10902     t.tv_sec  = 0;
10903     t.tv_usec = 0;
10904     select(fd + 1, b, 0, 0, &t);
10905     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
10906     printf("%d\n", i + 1);
10907     return 0;
10908 }
10909 EOCP
10910                 set try
10911                 if eval $compile_ok; then
10912                         selectminbits=`./try`
10913                         case "$selectminbits" in
10914                         1)      bits="1 bit" ;;
10915                         *)      bits="$selectminbits bits" ;;
10916                         esac
10917                         echo "Your select() operates on $bits at a time." >&4
10918                 else
10919                         rp='What is the minimum number of bits your select() operates on?'
10920                         case "$byteorder" in
10921                         1234|12345678)  dflt=32 ;;
10922                         *)              dflt=1  ;;
10923                         esac
10924                         . ./myread
10925                         val=$ans
10926                         selectminbits="$val"
10927                 fi
10928                 $rm -f try.* try
10929                 ;;
10930         *)      : no select, so pick a harmless default
10931                 selectminbits='32'
10932                 ;;
10933         esac
10934         ;;
10935 esac
10936
10937 : Trace out the files included by signal.h, then look for SIGxxx names.
10938 : Remove SIGARRAYSIZE used by HPUX.
10939 : Remove SIGTYP void lines used by OS2.
10940 xxx=`echo '#include <signal.h>' |
10941         $cppstdin $cppminus $cppflags 2>/dev/null |
10942         $grep '^[       ]*#.*include' | 
10943         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
10944 : Check this list of files to be sure we have parsed the cpp output ok.
10945 : This will also avoid potentially non-existent files, such 
10946 : as ../foo/bar.h
10947 xxxfiles=''
10948 for xx in $xxx /dev/null ; do
10949         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
10950 done
10951 : If we have found no files, at least try signal.h
10952 case "$xxxfiles" in
10953 '')     xxxfiles=`./findhdr signal.h` ;;
10954 esac
10955 xxx=`awk '
10956 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
10957         print substr($2, 4, 20)
10958 }
10959 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
10960         print substr($3, 4, 20)
10961 }' $xxxfiles`
10962 : Append some common names just in case the awk scan failed.
10963 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
10964 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
10965 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
10966 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
10967 : generate a few handy files for later
10968 $cat > signal.c <<'EOCP'
10969 #include <sys/types.h>
10970 #include <signal.h>
10971 #include <stdio.h>
10972 int main() {
10973
10974 /* Strange style to avoid deeply-nested #if/#else/#endif */
10975 #ifndef NSIG
10976 #  ifdef _NSIG
10977 #    define NSIG (_NSIG)
10978 #  endif
10979 #endif
10980
10981 #ifndef NSIG
10982 #  ifdef SIGMAX
10983 #    define NSIG (SIGMAX+1)
10984 #  endif
10985 #endif
10986
10987 #ifndef NSIG
10988 #  ifdef SIG_MAX
10989 #    define NSIG (SIG_MAX+1)
10990 #  endif
10991 #endif
10992
10993 #ifndef NSIG
10994 #  ifdef MAXSIG
10995 #    define NSIG (MAXSIG+1)
10996 #  endif
10997 #endif
10998
10999 #ifndef NSIG
11000 #  ifdef MAX_SIG
11001 #    define NSIG (MAX_SIG+1)
11002 #  endif
11003 #endif
11004
11005 #ifndef NSIG
11006 #  ifdef SIGARRAYSIZE
11007 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
11008 #  endif
11009 #endif
11010
11011 #ifndef NSIG
11012 #  ifdef _sys_nsig
11013 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
11014 #  endif
11015 #endif
11016
11017 /* Default to some arbitrary number that's big enough to get most
11018    of the common signals.
11019 */
11020 #ifndef NSIG
11021 #    define NSIG 50
11022 #endif
11023
11024 printf("NSIG %d\n", NSIG);
11025
11026 #ifndef JUST_NSIG
11027
11028 EOCP
11029
11030 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
11031 {
11032         printf "#ifdef SIG"; printf $1; printf "\n"
11033         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
11034         printf $1; printf ");\n"
11035         printf "#endif\n"
11036 }
11037 END {
11038         printf "#endif /* JUST_NSIG */\n";
11039         printf "}\n";
11040 }
11041 ' >>signal.c
11042 $cat >signal.awk <<'EOP'
11043 BEGIN { ndups = 0 }
11044 $1 ~ /^NSIG$/ { nsig = $2 }
11045 ($1 !~ /^NSIG$/) && (NF == 2) {
11046     if ($2 > maxsig) { maxsig = $2 }
11047     if (sig_name[$2]) {
11048         dup_name[ndups] = $1
11049         dup_num[ndups] = $2
11050         ndups++ 
11051     }
11052     else {
11053         sig_name[$2] = $1
11054         sig_num[$2] = $2
11055     }
11056
11057 }
11058 END { 
11059     if (nsig == 0) { nsig = maxsig + 1 }
11060         for (n = 1; n < nsig; n++) {
11061                 if (sig_name[n]) {
11062                         printf("%s %d\n", sig_name[n], sig_num[n])
11063                 }
11064                 else {
11065                         printf("NUM%d %d\n", n, n) 
11066                 }
11067         }
11068     for (n = 0; n < ndups; n++) {
11069                 printf("%s %d\n", dup_name[n], dup_num[n])
11070     }
11071 }
11072 EOP
11073 $cat >signal_cmd <<EOS
11074 $startsh
11075 if $test -s signal.lst; then
11076     echo "Using your existing signal.lst file"
11077         exit 0
11078 fi
11079 xxx="$xxx"
11080 EOS
11081 $cat >>signal_cmd <<'EOS'
11082
11083 set signal
11084 if eval $compile_ok; then
11085         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11086 else
11087         echo "(I can't seem be able to compile the whole test program)" >&4
11088         echo "(I'll try it in little pieces.)" >&4
11089         set signal -DJUST_NSIG
11090         if eval $compile_ok; then
11091                 ./signal$_exe > signal.nsg
11092                 $cat signal.nsg
11093         else
11094                 echo "I can't seem to figure out how many signals you have." >&4
11095                 echo "Guessing 50." >&4
11096                 echo 'NSIG 50' > signal.nsg
11097         fi
11098         : Now look at all the signal names, one at a time.
11099         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
11100                 $cat > signal.c <<EOCP
11101 #include <sys/types.h>
11102 #include <signal.h>
11103 #include <stdio.h>
11104 int main() {
11105 printf("$xx %d\n", SIG${xx});
11106 return 0;
11107 }
11108 EOCP
11109                 set signal
11110                 if eval $compile; then
11111                         echo "SIG${xx} found."
11112                         ./signal$_exe  >> signal.ls1
11113                 else
11114                         echo "SIG${xx} NOT found."
11115                 fi
11116         done
11117         if $test -s signal.ls1; then
11118                 $cat signal.nsg signal.ls1 |
11119                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11120         fi
11121
11122 fi
11123 if $test -s signal.lst; then
11124         :
11125 else
11126         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
11127         echo 'kill -l' >signal
11128         set X `csh -f <signal`
11129         $rm -f signal
11130         shift
11131         case $# in
11132         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
11133         esac
11134         echo $@ | $tr ' ' $trnl | \
11135                 $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
11136 fi
11137 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
11138 EOS
11139 chmod a+x signal_cmd
11140 $eunicefix signal_cmd
11141
11142 : generate list of signal names
11143 echo " "
11144 case "$sig_name_init" in
11145 '')
11146         echo "Generating a list of signal names and numbers..." >&4
11147         . ./signal_cmd
11148         sig_name=`$awk '{printf "%s ", $1}' signal.lst`
11149         sig_name="ZERO $sig_name"
11150         sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
11151                                                 { printf "\"%s\", ", $1 }
11152                                                 END { printf "0\n" }' signal.lst`
11153         sig_num=`$awk 'BEGIN { printf "0, " }
11154                                         { printf "%d, ", $2}
11155                                         END { printf "0\n"}' signal.lst`
11156         ;;
11157 esac
11158 echo "The following signals are available:"
11159 echo " "
11160 echo $sig_name | $awk \
11161 'BEGIN { linelen = 0 }
11162 {
11163         for (i = 1; i <= NF; i++) {
11164                 name = "SIG" $i " "
11165                 linelen = linelen + length(name)
11166                 if (linelen > 70) {
11167                         printf "\n"
11168                         linelen = length(name)
11169                 }
11170                 printf "%s", name
11171         }
11172         printf "\n"
11173 }'
11174 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
11175
11176 : see what type is used for signed size_t
11177 set ssize_t ssizetype int stdio.h sys/types.h
11178 eval $typedef
11179 dflt="$ssizetype"
11180 $cat > ssize.c <<EOM
11181 #include <stdio.h>
11182 #include <sys/types.h>
11183 #define Size_t $sizetype
11184 #define SSize_t $dflt
11185 main()
11186 {
11187         if (sizeof(Size_t) == sizeof(SSize_t))
11188                 printf("$dflt\n");
11189         else if (sizeof(Size_t) == sizeof(int))
11190                 printf("int\n");
11191         else 
11192                 printf("long\n");
11193         exit(0);
11194 }
11195 EOM
11196 echo " "
11197 set ssize
11198 if eval $compile_ok && ./ssize > /dev/null; then
11199         ssizetype=`./ssize`
11200         echo "I'll be using $ssizetype for functions returning a byte count." >&4
11201 else
11202         $cat >&4 <<EOM
11203 Help! I can't compile and run the ssize_t test program: please enlighten me!
11204 (This is probably a misconfiguration in your system or libraries, and
11205 you really ought to fix it.  Still, I'll try anyway.)
11206
11207 I need a type that is the same size as $sizetype, but is guaranteed to
11208 be signed.  Common values are ssize_t, int and long.
11209
11210 EOM
11211         rp="What signed type is the same size as $sizetype?"
11212         . ./myread
11213         ssizetype="$ans"
11214 fi
11215 $rm -f ssize ssize.*
11216
11217 : see what type of char stdio uses.
11218 echo " "
11219 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11220         echo "Your stdio uses unsigned chars." >&4
11221         stdchar="unsigned char"
11222 else
11223         echo "Your stdio uses signed chars." >&4
11224         stdchar="char"
11225 fi
11226
11227 : see if time exists
11228 echo " "
11229 if test "X$d_time" = X -o X"$timetype" = X; then
11230     if set time val -f d_time; eval $csym; $val; then
11231                 echo 'time() found.' >&4
11232                 val="$define"
11233                 rp="What is the type returned by time() on this system?"
11234                 set time_t timetype long stdio.h sys/types.h
11235                 eval $typedef_ask
11236     else
11237                 echo 'time() not found, hope that will do.' >&4
11238                 val="$undef"
11239                 timetype='int';
11240     fi
11241     set d_time
11242     eval $setvar
11243 fi
11244
11245 : see what type uids are declared as in the kernel
11246 echo " "
11247 echo "Looking for the type for user ids returned by getuid()."
11248 set uid_t uidtype xxx stdio.h sys/types.h
11249 eval $typedef
11250 case "$uidtype" in
11251 xxx)
11252         xxx=`./findhdr sys/user.h`
11253         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
11254         case $1 in
11255         unsigned) dflt="$1 $2" ;;
11256         *) dflt="$1" ;;
11257         esac
11258         ;;
11259 *) dflt="$uidtype";;
11260 esac
11261 case "$uidtype" in
11262 uid_t)  echo "uid_t found." ;;
11263 *)      rp="What is the type for user ids returned by getuid()?"
11264         . ./myread
11265         uidtype="$ans"
11266         ;;
11267 esac
11268
11269 : see if dbm.h is available
11270 : see if dbmclose exists
11271 set dbmclose d_dbmclose
11272 eval $inlibc
11273
11274 case "$d_dbmclose" in
11275 $define)
11276         set dbm.h i_dbm
11277         eval $inhdr
11278         case "$i_dbm" in
11279         $define)
11280                 val="$undef"
11281                 set i_rpcsvcdbm
11282                 eval $setvar
11283                 ;;
11284         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11285                 eval $inhdr
11286                 ;;
11287         esac
11288         ;;
11289 *)      echo "We won't be including <dbm.h>"
11290         val="$undef"
11291         set i_dbm
11292         eval $setvar
11293         val="$undef"
11294         set i_rpcsvcdbm
11295         eval $setvar
11296         ;;
11297 esac
11298
11299 : see if this is a sys/file.h system
11300 val=''
11301 set sys/file.h val
11302 eval $inhdr
11303
11304 : do we need to include sys/file.h ?
11305 case "$val" in
11306 "$define")
11307         echo " "
11308         if $h_sysfile; then
11309                 val="$define"
11310                 echo "We'll be including <sys/file.h>." >&4
11311         else
11312                 val="$undef"
11313                 echo "We won't be including <sys/file.h>." >&4
11314         fi
11315         ;;
11316 *)
11317         h_sysfile=false
11318         ;;
11319 esac
11320 set i_sysfile
11321 eval $setvar
11322
11323 : see if fcntl.h is there
11324 val=''
11325 set fcntl.h val
11326 eval $inhdr
11327
11328 : see if we can include fcntl.h
11329 case "$val" in
11330 "$define")
11331         echo " "
11332         if $h_fcntl; then
11333                 val="$define"
11334                 echo "We'll be including <fcntl.h>." >&4
11335         else
11336                 val="$undef"
11337                 if $h_sysfile; then
11338         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11339                 else
11340                         echo "We won't be including <fcntl.h>." >&4
11341                 fi
11342         fi
11343         ;;
11344 *)
11345         h_fcntl=false
11346         val="$undef"
11347         ;;
11348 esac
11349 set i_fcntl
11350 eval $setvar
11351
11352 : see if locale.h is available
11353 set locale.h i_locale
11354 eval $inhdr
11355
11356 : see if this is a math.h system
11357 set math.h i_math
11358 eval $inhdr
11359
11360 : see if ndbm.h is available
11361 set ndbm.h t_ndbm
11362 eval $inhdr
11363 case "$t_ndbm" in
11364 $define)
11365         : see if dbm_open exists
11366         set dbm_open d_dbm_open
11367         eval $inlibc
11368         case "$d_dbm_open" in
11369         $undef)
11370                 t_ndbm="$undef"
11371                 echo "We won't be including <ndbm.h>"
11372                 ;;
11373         esac
11374         ;;
11375 esac
11376 val="$t_ndbm"
11377 set i_ndbm
11378 eval $setvar
11379
11380 : see if net/errno.h is available
11381 val=''
11382 set net/errno.h val
11383 eval $inhdr
11384
11385 : Unfortunately, it causes problems on some systems.  Arrgh.
11386 case "$val" in
11387 $define)
11388         cat > try.c <<'EOM'
11389 #include <stdio.h>
11390 #include <errno.h>
11391 #include <net/errno.h>
11392 int func()
11393 {
11394         return ENOTSOCK;
11395 }
11396 EOM
11397         if $cc $ccflags -c try.c >/dev/null 2>&1; then
11398                 echo "We'll be including <net/errno.h>." >&4
11399         else
11400                 echo "We won't be including <net/errno.h>." >&4
11401                 val="$undef"
11402         fi
11403         $rm -f try.* try
11404         ;;
11405 esac
11406 set i_neterrno
11407 eval $setvar
11408
11409 : get C preprocessor symbols handy
11410 echo " "
11411 $echo $n "Hmm... $c"
11412 echo $al | $tr ' ' $trnl >Cppsym.know
11413 $cat <<EOSS >Cppsym
11414 $startsh
11415 case "\$1" in
11416 -l) list=true
11417         shift
11418         ;;
11419 esac
11420 unknown=''
11421 case "\$list\$#" in
11422 1|2)
11423         for sym do
11424                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
11425                         exit 0
11426                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
11427                         :
11428                 else
11429                         unknown="\$unknown \$sym"
11430                 fi
11431         done
11432         set X \$unknown
11433         shift
11434         ;;
11435 esac
11436 case \$# in
11437 0) exit 1;;
11438 esac
11439 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
11440 #ifdef \1\\
11441 exit 0; _ _ _ _\1\\      \1\\
11442 #endif\\
11443 /' >Cppsym\$\$
11444 echo "exit 1; _ _ _" >>Cppsym\$\$
11445 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
11446 case "\$list" in
11447 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
11448 *)
11449         sh Cppsym2\$\$
11450         status=\$?
11451         ;;
11452 esac
11453 $rm -f Cppsym\$\$ Cppsym2\$\$
11454 exit \$status
11455 EOSS
11456 chmod +x Cppsym
11457 $eunicefix Cppsym
11458 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
11459
11460 : now check the C compiler for additional symbols
11461 $cat >ccsym <<EOS
11462 $startsh
11463 $cat >tmp.c <<EOF
11464 extern int foo;
11465 EOF
11466 for i in \`$cc -v -c tmp.c 2>&1\`
11467 do
11468         case "\$i" in
11469         -D*) echo "\$i" | $sed 's/^-D//';;
11470         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
11471         esac
11472 done
11473 $rm -f try.c
11474 EOS
11475 chmod +x ccsym
11476 $eunicefix ccsym
11477 ./ccsym > ccsym1.raw
11478 if $test -s ccsym1.raw; then
11479        $sort ccsym1.raw | $uniq >ccsym.raw
11480 else
11481        mv ccsym1.raw ccsym.raw
11482 fi
11483
11484 $awk '/\=/ { print $0; next }
11485         { print $0"=1" }' ccsym.raw >ccsym.list
11486 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
11487 $comm -13 ccsym.true ccsym.list >ccsym.own
11488 $comm -12 ccsym.true ccsym.list >ccsym.com
11489 $comm -23 ccsym.true ccsym.list >ccsym.cpp
11490 also=''
11491 symbols='symbols'
11492 if $test -z ccsym.raw; then
11493         echo "Your C compiler doesn't seem to define any symbol!" >&4
11494         echo " "
11495         echo "However, your C preprocessor defines the following ones:"
11496         $cat Cppsym.true
11497 else
11498         if $test -s ccsym.com; then
11499                 echo "Your C compiler and pre-processor define these symbols:"
11500                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
11501                 also='also '
11502                 symbols='ones'
11503                 $test "$silent" || sleep 1
11504         fi
11505         if $test -s ccsym.cpp; then
11506                 $test "$also" && echo " "
11507                 echo "Your C pre-processor ${also}defines the following $symbols:"
11508                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
11509                 also='further '
11510                 $test "$silent" || sleep 1
11511         fi
11512         if $test -s ccsym.own; then
11513                 $test "$also" && echo " "
11514                 echo "Your C compiler ${also}defines the following cpp variables:"
11515                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
11516                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
11517                 $test "$silent" || sleep 1
11518         fi
11519 fi
11520 $rm -f ccsym*
11521
11522 : see if this is a termio system
11523 val="$undef"
11524 val2="$undef"
11525 val3="$undef"
11526 if $test `./findhdr termios.h`; then
11527         set tcsetattr i_termios
11528         eval $inlibc
11529         val3="$i_termios"
11530 fi
11531 echo " "
11532 case "$val3" in
11533 "$define") echo "You have POSIX termios.h... good!" >&4;;
11534 *) if ./Cppsym pyr; then
11535                 case "`/bin/universe`" in
11536                 ucb) if $test `./findhdr sgtty.h`; then
11537                                 val2="$define"
11538                                 echo "<sgtty.h> found." >&4
11539                         else
11540                                 echo "System is pyramid with BSD universe."
11541                                 echo "<sgtty.h> not found--you could have problems." >&4
11542                         fi;;
11543                 *) if $test `./findhdr termio.h`; then
11544                                 val="$define"
11545                                 echo "<termio.h> found." >&4
11546                         else
11547                                 echo "System is pyramid with USG universe."
11548                                 echo "<termio.h> not found--you could have problems." >&4
11549                         fi;;
11550                 esac
11551         elif ./usg; then
11552                 if $test `./findhdr termio.h`; then
11553                         echo "<termio.h> found." >&4
11554                         val="$define"
11555                 elif $test `./findhdr sgtty.h`; then
11556                         echo "<sgtty.h> found." >&4
11557                         val2="$define"
11558                 else
11559 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
11560                 fi
11561         else
11562                 if $test `./findhdr sgtty.h`; then
11563                         echo "<sgtty.h> found." >&4
11564                         val2="$define"
11565                 elif $test `./findhdr termio.h`; then
11566                         echo "<termio.h> found." >&4
11567                         val="$define"
11568                 else
11569 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
11570                 fi
11571         fi;;
11572 esac
11573 set i_termio; eval $setvar
11574 val=$val2; set i_sgtty; eval $setvar
11575 val=$val3; set i_termios; eval $setvar
11576
11577 : see if stdarg is available
11578 echo " "
11579 if $test `./findhdr stdarg.h`; then
11580         echo "<stdarg.h> found." >&4
11581         valstd="$define"
11582 else
11583         echo "<stdarg.h> NOT found." >&4
11584         valstd="$undef"
11585 fi
11586
11587 : see if varags is available
11588 echo " "
11589 if $test `./findhdr varargs.h`; then
11590         echo "<varargs.h> found." >&4
11591 else
11592         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11593 fi
11594
11595 : set up the varargs testing programs
11596 $cat > varargs.c <<EOP
11597 #ifdef I_STDARG
11598 #include <stdarg.h>
11599 #endif
11600 #ifdef I_VARARGS
11601 #include <varargs.h>
11602 #endif
11603
11604 #ifdef I_STDARG
11605 int f(char *p, ...)
11606 #else
11607 int f(va_alist)
11608 va_dcl
11609 #endif
11610 {
11611         va_list ap;
11612 #ifndef I_STDARG
11613         char *p;
11614 #endif
11615 #ifdef I_STDARG
11616         va_start(ap,p);
11617 #else
11618         va_start(ap);
11619         p = va_arg(ap, char *);
11620 #endif
11621         va_end(ap);
11622 }
11623 EOP
11624 $cat > varargs <<EOP
11625 $startsh
11626 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11627         echo "true"
11628 else
11629         echo "false"
11630 fi
11631 $rm -f varargs$_o
11632 EOP
11633 chmod +x varargs
11634
11635 : now check which varargs header should be included
11636 echo " "
11637 i_varhdr=''
11638 case "$valstd" in
11639 "$define")
11640         if `./varargs I_STDARG`; then
11641                 val='stdarg.h'
11642         elif `./varargs I_VARARGS`; then
11643                 val='varargs.h'
11644         fi
11645         ;;
11646 *)
11647         if `./varargs I_VARARGS`; then
11648                 val='varargs.h'
11649         fi
11650         ;;
11651 esac
11652 case "$val" in
11653 '')
11654 echo "I could not find the definition for va_dcl... You have problems..." >&4
11655         val="$undef"; set i_stdarg; eval $setvar
11656         val="$undef"; set i_varargs; eval $setvar
11657         ;;
11658 *) 
11659         set i_varhdr
11660         eval $setvar
11661         case "$i_varhdr" in
11662         stdarg.h)
11663                 val="$define"; set i_stdarg; eval $setvar
11664                 val="$undef"; set i_varargs; eval $setvar
11665                 ;;
11666         varargs.h)
11667                 val="$undef"; set i_stdarg; eval $setvar
11668                 val="$define"; set i_varargs; eval $setvar
11669                 ;;
11670         esac
11671         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11672 esac
11673 $rm -f varargs*
11674
11675 : see if stddef is available
11676 set stddef.h i_stddef
11677 eval $inhdr
11678
11679 : see if sys/access.h is available
11680 set sys/access.h i_sysaccess
11681 eval $inhdr
11682
11683 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
11684 set sys/filio.h i_sysfilio
11685 eval $inhdr
11686 echo " "
11687 if $test `./findhdr sys/ioctl.h`; then
11688         val="$define"
11689         echo '<sys/ioctl.h> found.' >&4
11690 else
11691         val="$undef"
11692         if $test $i_sysfilio = "$define"; then
11693             echo '<sys/ioctl.h> NOT found.' >&4
11694         else
11695                 $test $i_sgtty = "$define" && xxx="sgtty.h"
11696                 $test $i_termio = "$define" && xxx="termio.h"
11697                 $test $i_termios = "$define" && xxx="termios.h"
11698 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
11699         fi
11700 fi
11701 set i_sysioctl
11702 eval $setvar
11703
11704 : see if this is a sys/param system
11705 set sys/param.h i_sysparam
11706 eval $inhdr
11707
11708 : see if sys/resource.h has to be included
11709 set sys/resource.h i_sysresrc
11710 eval $inhdr
11711
11712 : see if sys/security.h is available
11713 set sys/security.h i_syssecrt
11714 eval $inhdr
11715
11716 : see if this is a sys/un.h system
11717 set sys/un.h i_sysun
11718 eval $inhdr
11719
11720 : see if this is a syswait system
11721 set sys/wait.h i_syswait
11722 eval $inhdr
11723
11724 : see if this is an utime system
11725 set utime.h i_utime
11726 eval $inhdr
11727
11728 : see if this is a values.h system
11729 set values.h i_values
11730 eval $inhdr
11731
11732 : see if this is a vfork system
11733 case "$d_vfork" in
11734 "$define")
11735         set vfork.h i_vfork
11736         eval $inhdr
11737         ;;
11738 *)
11739         i_vfork="$undef"
11740         ;;
11741 esac
11742
11743 : see if gdbm.h is available
11744 set gdbm.h t_gdbm
11745 eval $inhdr
11746 case "$t_gdbm" in
11747 $define)
11748         : see if gdbm_open exists
11749         set gdbm_open d_gdbm_open
11750         eval $inlibc
11751         case "$d_gdbm_open" in
11752         $undef)
11753                 t_gdbm="$undef"
11754                 echo "We won't be including <gdbm.h>"
11755                 ;;
11756         esac
11757         ;;
11758 esac
11759 val="$t_gdbm"
11760 set i_gdbm
11761 eval $setvar
11762
11763 echo " "
11764 echo "Looking for extensions..." >&4
11765 tdir=`pwd`
11766 cd $rsrc/ext
11767 : If we are using the old config.sh, known_extensions may contain
11768 : old or inaccurate or duplicate values.
11769 known_extensions=''
11770 nonxs_extensions=''
11771 : We do not use find because it might not be available.
11772 : We do not just use MANIFEST because the user may have dropped
11773 : some additional extensions into the source tree and expect them
11774 : to be built.
11775 for xxx in * ; do
11776         case "$xxx" in
11777         DynaLoader|dynaload) ;;
11778         *)      if $test -f $xxx/$xxx.xs; then
11779                         known_extensions="$known_extensions $xxx"
11780                 elif $test -f $xxx/Makefile.PL; then
11781                         nonxs_extensions="$nonxs_extensions $xxx"
11782                 else
11783                         if $test -d $xxx; then
11784                                 # Look for nested extensions, eg. Devel/Dprof.
11785                                 cd $xxx
11786                                 for yyy in * ; do
11787                                 if $test -f $yyy/$yyy.xs; then
11788                                         known_extensions="$known_extensions $xxx/$yyy"
11789                                 elif $test -f $yyy/Makefile.PL; then
11790                                         nonxs_extensions="$nonxs_extensions $xxx/$yyy"
11791                                 fi
11792                                 done
11793                                 cd ..
11794                         fi
11795                 fi 
11796                 ;;
11797         esac
11798 done
11799 set X $nonxs_extensions
11800 shift
11801 nonxs_extensions="$*"
11802 set X $known_extensions
11803 shift
11804 known_extensions="$*"
11805 cd $tdir
11806
11807 : Now see which are supported on this system.
11808 avail_ext=''
11809 for xxx in $known_extensions ; do
11810         case "$xxx" in
11811         DB_File|db_file)
11812                 case "$i_db" in
11813                 $define) avail_ext="$avail_ext $xxx" ;;
11814                 esac
11815                 ;;
11816         GDBM_File|gdbm_fil)
11817                 case "$i_gdbm" in 
11818                 $define) avail_ext="$avail_ext $xxx" ;;
11819                 esac
11820                 ;;
11821         NDBM_File|ndbm_fil)
11822                 case "$i_ndbm" in
11823                 $define) avail_ext="$avail_ext $xxx" ;;
11824                 esac
11825                 ;;
11826         ODBM_File|odbm_fil) 
11827                 case "${i_dbm}${i_rpcsvcdbm}" in
11828                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
11829                 esac
11830                 ;;
11831         POSIX|posix)
11832                 case "$useposix" in
11833                 true|define|y) avail_ext="$avail_ext $xxx" ;;
11834                 esac
11835                 ;;
11836         Opcode|opcode)
11837                 case "$useopcode" in
11838                 true|define|y) avail_ext="$avail_ext $xxx" ;;
11839                 esac
11840                 ;;
11841         Socket|socket)
11842                 case "$d_socket" in 
11843                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
11844                 esac
11845                 ;;
11846         Thread|thread)
11847                 case "$usethreads" in 
11848                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
11849                 esac
11850                 ;;
11851         IPC/SysV|ipc/sysv)
11852                 : XXX Do we need a useipcsysv variable here
11853                 case "${d_msg}${d_sem}${d_shm}" in 
11854                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
11855                 esac
11856                 ;;
11857         *)      avail_ext="$avail_ext $xxx"
11858                 ;;
11859         esac
11860 done
11861
11862 set X $avail_ext
11863 shift
11864 avail_ext="$*"
11865
11866 : Now see which nonxs extensions are supported on this system.
11867 : For now assume all are.
11868 nonxs_ext=''
11869 for xxx in $nonxs_extensions ; do
11870         case "$xxx" in
11871         *)      nonxs_ext="$nonxs_ext $xxx"
11872                 ;;
11873         esac
11874 done
11875
11876 set X $nonxs_ext
11877 shift
11878 nonxs_ext="$*"
11879
11880 case $usedl in
11881 $define)
11882         $cat <<EOM
11883 A number of extensions are supplied with $package.  You may choose to
11884 compile these extensions for dynamic loading (the default), compile
11885 them into the $package executable (static loading), or not include
11886 them at all.  Answer "none" to include no extensions.
11887 Note that DynaLoader is always built and need not be mentioned here.
11888
11889 EOM
11890         case "$dynamic_ext" in
11891         '') dflt="$avail_ext" ;;
11892         *)      dflt="$dynamic_ext"
11893                 # Perhaps we are reusing an old out-of-date config.sh.
11894                 case "$hint" in
11895                 previous)
11896                         if test X"$dynamic_ext" != X"$avail_ext"; then
11897                                 $cat <<EOM
11898 NOTICE:  Your previous config.sh list may be incorrect. 
11899 The extensions now available to you are 
11900         ${avail_ext}
11901 but the default list from your previous config.sh is
11902         ${dynamic_ext} 
11903
11904 EOM
11905                         fi
11906                         ;;
11907                 esac
11908                 ;;
11909         esac
11910         case "$dflt" in
11911         '')     dflt=none;;
11912         esac
11913         rp="What extensions do you wish to load dynamically?"
11914         . ./myread
11915         case "$ans" in
11916         none) dynamic_ext=' ' ;;
11917         *) dynamic_ext="$ans" ;;
11918         esac
11919
11920         case "$static_ext" in
11921         '')
11922                 : Exclude those already listed in dynamic linking
11923                 dflt=''
11924                 for xxx in $avail_ext; do
11925                         case " $dynamic_ext " in
11926                         *" $xxx "*) ;;
11927                         *) dflt="$dflt $xxx" ;;
11928                         esac
11929                 done
11930                 set X $dflt
11931                 shift
11932                 dflt="$*"
11933                 ;;
11934         *)  dflt="$static_ext" 
11935                 ;;
11936         esac
11937
11938         case "$dflt" in
11939         '')     dflt=none;;
11940         esac
11941         rp="What extensions do you wish to load statically?"
11942         . ./myread
11943         case "$ans" in
11944         none) static_ext=' ' ;;
11945         *) static_ext="$ans" ;;
11946         esac
11947         ;;
11948 *)
11949         $cat <<EOM
11950 A number of extensions are supplied with $package.  Answer "none" 
11951 to include no extensions. 
11952 Note that DynaLoader is always built and need not be mentioned here.
11953
11954 EOM
11955         case "$static_ext" in
11956         '') dflt="$avail_ext" ;;
11957         *)      dflt="$static_ext"
11958                 # Perhaps we are reusing an old out-of-date config.sh.
11959                 case "$hint" in
11960                 previous)
11961                         if test X"$static_ext" != X"$avail_ext"; then
11962                                 $cat <<EOM
11963 NOTICE:  Your previous config.sh list may be incorrect. 
11964 The extensions now available to you are 
11965         ${avail_ext}
11966 but the default list from your previous config.sh is
11967         ${static_ext} 
11968
11969 EOM
11970                         fi
11971                         ;;
11972                 esac
11973                 ;;
11974         esac
11975         : Exclude those that are not xs extensions
11976         case "$dflt" in
11977         '')     dflt=none;;
11978         esac
11979         rp="What extensions do you wish to include?"
11980         . ./myread
11981         case "$ans" in
11982         none) static_ext=' ' ;;
11983         *) static_ext="$ans" ;;
11984         esac
11985         ;;
11986 esac
11987
11988 set X $dynamic_ext $static_ext $nonxs_ext
11989 shift
11990 extensions="$*"
11991
11992 : Remove build directory name from cppstdin so it can be used from
11993 : either the present location or the final installed location.
11994 echo " "
11995 : Get out of the UU directory to get correct path name.
11996 cd ..
11997 case "$cppstdin" in
11998 `pwd`/cppstdin)
11999         echo "Stripping down cppstdin path name"
12000         cppstdin=cppstdin
12001         ;;
12002 esac
12003 cd UU
12004
12005 : end of configuration questions
12006 echo " "
12007 echo "End of configuration questions."
12008 echo " "
12009
12010 : back to where it started
12011 if test -d ../UU; then
12012         cd ..
12013 fi
12014
12015 : configuration may be patched via a 'config.over' file
12016 if $test -f config.over; then
12017         echo " "
12018         dflt=y
12019         rp='I see a config.over file.  Do you wish to load it?'
12020         . UU/myread
12021         case "$ans" in
12022         n*) echo "OK, I'll ignore it.";;
12023         *)      . ./config.over
12024                 echo "Configuration override changes have been loaded."
12025                 ;;
12026         esac
12027 fi
12028
12029 : in case they want portability, strip down executable paths
12030 case "$d_portable" in
12031 "$define")
12032         echo " "
12033         echo "Stripping down executable paths..." >&4
12034         for file in $loclist $trylist; do
12035                 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
12036                         eval $file="\$file"
12037                 fi
12038         done
12039         ;;
12040 esac
12041
12042 : create config.sh file
12043 echo " "
12044 echo "Creating config.sh..." >&4
12045 $spitshell <<EOT >config.sh
12046 $startsh
12047 #
12048 # This file was produced by running the Configure script. It holds all the
12049 # definitions figured out by Configure. Should you modify one of these values,
12050 # do not forget to propagate your changes by running "Configure -der". You may
12051 # instead choose to run each of the .SH files by yourself, or "Configure -S".
12052 #
12053
12054 # Package name      : $package
12055 # Source directory  : $src
12056 # Configuration time: $cf_time
12057 # Configured by     : $cf_by
12058 # Target system     : $myuname
12059
12060 Author='$Author'
12061 Date='$Date'
12062 Header='$Header'
12063 Id='$Id'
12064 Locker='$Locker'
12065 Log='$Log'
12066 Mcc='$Mcc'
12067 RCSfile='$RCSfile'
12068 Revision='$Revision'
12069 Source='$Source'
12070 State='$State'
12071 _a='$_a'
12072 _exe='$_exe'
12073 _o='$_o'
12074 afs='$afs'
12075 alignbytes='$alignbytes'
12076 ansi2knr='$ansi2knr'
12077 aphostname='$aphostname'
12078 apiversion='$apiversion'
12079 ar='$ar'
12080 archlib='$archlib'
12081 archlibexp='$archlibexp'
12082 archname64='$archname64'
12083 archname='$archname'
12084 archobjs='$archobjs'
12085 awk='$awk'
12086 baserev='$baserev'
12087 bash='$bash'
12088 bin='$bin'
12089 binexp='$binexp'
12090 bison='$bison'
12091 byacc='$byacc'
12092 byteorder='$byteorder'
12093 c='$c'
12094 castflags='$castflags'
12095 cat='$cat'
12096 cc='$cc'
12097 cccdlflags='$cccdlflags'
12098 ccdlflags='$ccdlflags'
12099 ccflags='$ccflags'
12100 cf_by='$cf_by'
12101 cf_email='$cf_email'
12102 cf_time='$cf_time'
12103 chgrp='$chgrp'
12104 chmod='$chmod'
12105 chown='$chown'
12106 clocktype='$clocktype'
12107 comm='$comm'
12108 compress='$compress'
12109 contains='$contains'
12110 cp='$cp'
12111 cpio='$cpio'
12112 cpp='$cpp'
12113 cpp_stuff='$cpp_stuff'
12114 cppflags='$cppflags'
12115 cpplast='$cpplast'
12116 cppminus='$cppminus'
12117 cpprun='$cpprun'
12118 cppstdin='$cppstdin'
12119 cryptlib='$cryptlib'
12120 csh='$csh'
12121 d_Gconvert='$d_Gconvert'
12122 d_access='$d_access'
12123 d_accessx='$d_accessx'
12124 d_alarm='$d_alarm'
12125 d_archlib='$d_archlib'
12126 d_attribut='$d_attribut'
12127 d_bcmp='$d_bcmp'
12128 d_bcopy='$d_bcopy'
12129 d_bsd='$d_bsd'
12130 d_bsdgetpgrp='$d_bsdgetpgrp'
12131 d_bsdsetpgrp='$d_bsdsetpgrp'
12132 d_bzero='$d_bzero'
12133 d_casti32='$d_casti32'
12134 d_castneg='$d_castneg'
12135 d_charvspr='$d_charvspr'
12136 d_chown='$d_chown'
12137 d_chroot='$d_chroot'
12138 d_chsize='$d_chsize'
12139 d_closedir='$d_closedir'
12140 d_const='$d_const'
12141 d_crypt='$d_crypt'
12142 d_csh='$d_csh'
12143 d_cuserid='$d_cuserid'
12144 d_dbl_dig='$d_dbl_dig'
12145 d_dbmclose64='$d_dbmclose64'
12146 d_dbminit64='$d_dbminit64'
12147 d_delete64='$d_delete64'
12148 d_difftime='$d_difftime'
12149 d_dirent64s='$d_dirent64s'
12150 d_dirnamlen='$d_dirnamlen'
12151 d_dlerror='$d_dlerror'
12152 d_dlopen='$d_dlopen'
12153 d_dlsymun='$d_dlsymun'
12154 d_dosuid='$d_dosuid'
12155 d_drand48proto='$d_drand48proto'
12156 d_dup2='$d_dup2'
12157 d_eaccess='$d_eaccess'
12158 d_endgrent='$d_endgrent'
12159 d_endhent='$d_endhent'
12160 d_endnent='$d_endnent'
12161 d_endpent='$d_endpent'
12162 d_endpwent='$d_endpwent'
12163 d_endsent='$d_endsent'
12164 d_eofnblk='$d_eofnblk'
12165 d_eunice='$d_eunice'
12166 d_fchmod='$d_fchmod'
12167 d_fchown='$d_fchown'
12168 d_fcntl='$d_fcntl'
12169 d_fd_macros='$d_fd_macros'
12170 d_fd_set='$d_fd_set'
12171 d_fds_bits='$d_fds_bits'
12172 d_fetch64='$d_fetch64'
12173 d_fgetpos64='$d_fgetpos64'
12174 d_fgetpos='$d_fgetpos'
12175 d_firstkey64='$d_firstkey64'
12176 d_flexfnam='$d_flexfnam'
12177 d_flock64s='$d_flock64s'
12178 d_flock='$d_flock'
12179 d_fopen64='$d_fopen64'
12180 d_fork='$d_fork'
12181 d_fpathconf='$d_fpathconf'
12182 d_freopen64='$d_freopen64'
12183 d_fseek64='$d_fseek64'
12184 d_fseeko64='$d_fseeko64'
12185 d_fseeko='$d_fseeko'
12186 d_fsetpos64='$d_fsetpos64'
12187 d_fsetpos='$d_fsetpos'
12188 d_fstat64='$d_fstat64'
12189 d_ftell64='$d_ftell64'
12190 d_ftello64='$d_ftello64'
12191 d_ftello='$d_ftello'
12192 d_ftime='$d_ftime'
12193 d_ftruncate64='$d_ftruncate64'
12194 d_getgrent='$d_getgrent'
12195 d_getgrps='$d_getgrps'
12196 d_gethbyaddr='$d_gethbyaddr'
12197 d_gethbyname='$d_gethbyname'
12198 d_gethent='$d_gethent'
12199 d_gethname='$d_gethname'
12200 d_gethostprotos='$d_gethostprotos'
12201 d_getlogin='$d_getlogin'
12202 d_getnbyaddr='$d_getnbyaddr'
12203 d_getnbyname='$d_getnbyname'
12204 d_getnent='$d_getnent'
12205 d_getnetprotos='$d_getnetprotos'
12206 d_getpbyname='$d_getpbyname'
12207 d_getpbynumber='$d_getpbynumber'
12208 d_getpent='$d_getpent'
12209 d_getpgid='$d_getpgid'
12210 d_getpgrp2='$d_getpgrp2'
12211 d_getpgrp='$d_getpgrp'
12212 d_getppid='$d_getppid'
12213 d_getprior='$d_getprior'
12214 d_getprotoprotos='$d_getprotoprotos'
12215 d_getpwent='$d_getpwent'
12216 d_getsbyname='$d_getsbyname'
12217 d_getsbyport='$d_getsbyport'
12218 d_getsent='$d_getsent'
12219 d_getservprotos='$d_getservprotos'
12220 d_gettimeod='$d_gettimeod'
12221 d_gnulibc='$d_gnulibc'
12222 d_grpasswd='$d_grpasswd'
12223 d_htonl='$d_htonl'
12224 d_index='$d_index'
12225 d_inetaton='$d_inetaton'
12226 d_ino64t='$d_ino64t'
12227 d_int64t='$d_int64t'
12228 d_isascii='$d_isascii'
12229 d_killpg='$d_killpg'
12230 d_lchown='$d_lchown'
12231 d_link='$d_link'
12232 d_locconv='$d_locconv'
12233 d_lockf64='$d_lockf64'
12234 d_lockf='$d_lockf'
12235 d_longdbl='$d_longdbl'
12236 d_longlong='$d_longlong'
12237 d_lseek64='$d_lseek64'
12238 d_lstat64='$d_lstat64'
12239 d_lstat='$d_lstat'
12240 d_mblen='$d_mblen'
12241 d_mbstowcs='$d_mbstowcs'
12242 d_mbtowc='$d_mbtowc'
12243 d_memcmp='$d_memcmp'
12244 d_memcpy='$d_memcpy'
12245 d_memmove='$d_memmove'
12246 d_memset='$d_memset'
12247 d_mkdir='$d_mkdir'
12248 d_mkfifo='$d_mkfifo'
12249 d_mktime='$d_mktime'
12250 d_msg='$d_msg'
12251 d_msgctl='$d_msgctl'
12252 d_msgget='$d_msgget'
12253 d_msgrcv='$d_msgrcv'
12254 d_msgsnd='$d_msgsnd'
12255 d_mymalloc='$d_mymalloc'
12256 d_nextkey64='$d_nextkey64'
12257 d_nice='$d_nice'
12258 d_off64t='$d_off64t'
12259 d_oldpthreads='$d_oldpthreads'
12260 d_oldsock='$d_oldsock'
12261 d_open3='$d_open3'
12262 d_open64='$d_open64'
12263 d_opendir64='$d_opendir64'
12264 d_pathconf='$d_pathconf'
12265 d_pause='$d_pause'
12266 d_phostname='$d_phostname'
12267 d_pipe='$d_pipe'
12268 d_poll='$d_poll'
12269 d_portable='$d_portable'
12270 d_pthread_yield='$d_pthread_yield'
12271 d_pthreads_created_joinable='$d_pthreads_created_joinable'
12272 d_pwage='$d_pwage'
12273 d_pwchange='$d_pwchange'
12274 d_pwclass='$d_pwclass'
12275 d_pwcomment='$d_pwcomment'
12276 d_pwexpire='$d_pwexpire'
12277 d_pwgecos='$d_pwgecos'
12278 d_pwpasswd='$d_pwpasswd'
12279 d_pwquota='$d_pwquota'
12280 d_readdir64='$d_readdir64'
12281 d_readdir='$d_readdir'
12282 d_readlink='$d_readlink'
12283 d_rename='$d_rename'
12284 d_rewinddir='$d_rewinddir'
12285 d_rmdir='$d_rmdir'
12286 d_safebcpy='$d_safebcpy'
12287 d_safemcpy='$d_safemcpy'
12288 d_sanemcmp='$d_sanemcmp'
12289 d_sched_yield='$d_sched_yield'
12290 d_seekdir64='$d_seekdir64'
12291 d_seekdir='$d_seekdir'
12292 d_select='$d_select'
12293 d_sem='$d_sem'
12294 d_semctl='$d_semctl'
12295 d_semctl_semid_ds='$d_semctl_semid_ds'
12296 d_semctl_semun='$d_semctl_semun'
12297 d_semget='$d_semget'
12298 d_semop='$d_semop'
12299 d_setegid='$d_setegid'
12300 d_seteuid='$d_seteuid'
12301 d_setgrent='$d_setgrent'
12302 d_setgrps='$d_setgrps'
12303 d_sethent='$d_sethent'
12304 d_setlinebuf='$d_setlinebuf'
12305 d_setlocale='$d_setlocale'
12306 d_setnent='$d_setnent'
12307 d_setpent='$d_setpent'
12308 d_setpgid='$d_setpgid'
12309 d_setpgrp2='$d_setpgrp2'
12310 d_setpgrp='$d_setpgrp'
12311 d_setprior='$d_setprior'
12312 d_setpwent='$d_setpwent'
12313 d_setregid='$d_setregid'
12314 d_setresgid='$d_setresgid'
12315 d_setresuid='$d_setresuid'
12316 d_setreuid='$d_setreuid'
12317 d_setrgid='$d_setrgid'
12318 d_setruid='$d_setruid'
12319 d_setsent='$d_setsent'
12320 d_setsid='$d_setsid'
12321 d_setvbuf='$d_setvbuf'
12322 d_sfio='$d_sfio'
12323 d_shm='$d_shm'
12324 d_shmat='$d_shmat'
12325 d_shmatprototype='$d_shmatprototype'
12326 d_shmctl='$d_shmctl'
12327 d_shmdt='$d_shmdt'
12328 d_shmget='$d_shmget'
12329 d_sigaction='$d_sigaction'
12330 d_sigsetjmp='$d_sigsetjmp'
12331 d_socket='$d_socket'
12332 d_sockpair='$d_sockpair'
12333 d_stat64='$d_stat64'
12334 d_statblks='$d_statblks'
12335 d_stdio_cnt_lval='$d_stdio_cnt_lval'
12336 d_stdio_ptr_lval='$d_stdio_ptr_lval'
12337 d_stdiobase='$d_stdiobase'
12338 d_stdstdio='$d_stdstdio'
12339 d_store64='$d_store64'
12340 d_strchr='$d_strchr'
12341 d_strcoll='$d_strcoll'
12342 d_strctcpy='$d_strctcpy'
12343 d_strerrm='$d_strerrm'
12344 d_strerror='$d_strerror'
12345 d_strtod='$d_strtod'
12346 d_strtol='$d_strtol'
12347 d_strtoul='$d_strtoul'
12348 d_strxfrm='$d_strxfrm'
12349 d_suidsafe='$d_suidsafe'
12350 d_symlink='$d_symlink'
12351 d_syscall='$d_syscall'
12352 d_sysconf='$d_sysconf'
12353 d_sysernlst='$d_sysernlst'
12354 d_syserrlst='$d_syserrlst'
12355 d_system='$d_system'
12356 d_tcgetpgrp='$d_tcgetpgrp'
12357 d_tcsetpgrp='$d_tcsetpgrp'
12358 d_telldir64='$d_telldir64'
12359 d_telldir='$d_telldir'
12360 d_time='$d_time'
12361 d_times='$d_times'
12362 d_tmpfile64='$d_tmpfile64'
12363 d_truncate64='$d_truncate64'
12364 d_truncate='$d_truncate'
12365 d_tzname='$d_tzname'
12366 d_umask='$d_umask'
12367 d_uname='$d_uname'
12368 d_union_semun='$d_union_semun'
12369 d_vfork='$d_vfork'
12370 d_void_closedir='$d_void_closedir'
12371 d_voidsig='$d_voidsig'
12372 d_voidtty='$d_voidtty'
12373 d_volatile='$d_volatile'
12374 d_vprintf='$d_vprintf'
12375 d_wait4='$d_wait4'
12376 d_waitpid='$d_waitpid'
12377 d_wcstombs='$d_wcstombs'
12378 d_wctomb='$d_wctomb'
12379 d_xenix='$d_xenix'
12380 date='$date'
12381 db_hashtype='$db_hashtype'
12382 db_prefixtype='$db_prefixtype'
12383 defvoidused='$defvoidused'
12384 direntrytype='$direntrytype'
12385 dlext='$dlext'
12386 dlsrc='$dlsrc'
12387 doublesize='$doublesize'
12388 drand01='$drand01'
12389 dynamic_ext='$dynamic_ext'
12390 eagain='$eagain'
12391 ebcdic='$ebcdic'
12392 echo='$echo'
12393 egrep='$egrep'
12394 emacs='$emacs'
12395 eunicefix='$eunicefix'
12396 exe_ext='$exe_ext'
12397 expr='$expr'
12398 extensions='$extensions'
12399 find='$find'
12400 firstmakefile='$firstmakefile'
12401 flex='$flex'
12402 fpostype='$fpostype'
12403 freetype='$freetype'
12404 full_csh='$full_csh'
12405 full_sed='$full_sed'
12406 gccversion='$gccversion'
12407 gidtype='$gidtype'
12408 glibpth='$glibpth'
12409 grep='$grep'
12410 groupcat='$groupcat'
12411 groupstype='$groupstype'
12412 gzip='$gzip'
12413 h_fcntl='$h_fcntl'
12414 h_sysfile='$h_sysfile'
12415 hint='$hint'
12416 hostcat='$hostcat'
12417 huge='$huge'
12418 i_arpainet='$i_arpainet'
12419 i_bsdioctl='$i_bsdioctl'
12420 i_db='$i_db'
12421 i_dbm='$i_dbm'
12422 i_dirent='$i_dirent'
12423 i_dld='$i_dld'
12424 i_dlfcn='$i_dlfcn'
12425 i_fcntl='$i_fcntl'
12426 i_float='$i_float'
12427 i_gdbm='$i_gdbm'
12428 i_grp='$i_grp'
12429 i_inttypes='$i_inttypes'
12430 i_limits='$i_limits'
12431 i_locale='$i_locale'
12432 i_malloc='$i_malloc'
12433 i_math='$i_math'
12434 i_memory='$i_memory'
12435 i_ndbm='$i_ndbm'
12436 i_netdb='$i_netdb'
12437 i_neterrno='$i_neterrno'
12438 i_niin='$i_niin'
12439 i_pwd='$i_pwd'
12440 i_rpcsvcdbm='$i_rpcsvcdbm'
12441 i_sfio='$i_sfio'
12442 i_sgtty='$i_sgtty'
12443 i_stdarg='$i_stdarg'
12444 i_stddef='$i_stddef'
12445 i_stdlib='$i_stdlib'
12446 i_string='$i_string'
12447 i_sysaccess='$i_sysaccess'
12448 i_sysdir='$i_sysdir'
12449 i_sysfile='$i_sysfile'
12450 i_sysfilio='$i_sysfilio'
12451 i_sysin='$i_sysin'
12452 i_sysioctl='$i_sysioctl'
12453 i_sysndir='$i_sysndir'
12454 i_sysparam='$i_sysparam'
12455 i_sysresrc='$i_sysresrc'
12456 i_syssecrt='$i_syssecrt'
12457 i_sysselct='$i_sysselct'
12458 i_syssockio='$i_syssockio'
12459 i_sysstat='$i_sysstat'
12460 i_systime='$i_systime'
12461 i_systimek='$i_systimek'
12462 i_systimes='$i_systimes'
12463 i_systypes='$i_systypes'
12464 i_sysun='$i_sysun'
12465 i_syswait='$i_syswait'
12466 i_termio='$i_termio'
12467 i_termios='$i_termios'
12468 i_time='$i_time'
12469 i_unistd='$i_unistd'
12470 i_utime='$i_utime'
12471 i_values='$i_values'
12472 i_varargs='$i_varargs'
12473 i_varhdr='$i_varhdr'
12474 i_vfork='$i_vfork'
12475 incpath='$incpath'
12476 inews='$inews'
12477 installarchlib='$installarchlib'
12478 installbin='$installbin'
12479 installman1dir='$installman1dir'
12480 installman3dir='$installman3dir'
12481 installprivlib='$installprivlib'
12482 installscript='$installscript'
12483 installsitearch='$installsitearch'
12484 installsitelib='$installsitelib'
12485 intsize='$intsize'
12486 known_extensions='$known_extensions'
12487 ksh='$ksh'
12488 large='$large'
12489 ld='$ld'
12490 lddlflags='$lddlflags'
12491 ldflags='$ldflags'
12492 less='$less'
12493 lib_ext='$lib_ext'
12494 libc='$libc'
12495 libperl='$libperl'
12496 libpth='$libpth'
12497 libs='$libs'
12498 libswanted='$libswanted'
12499 line='$line'
12500 lint='$lint'
12501 lkflags='$lkflags'
12502 ln='$ln'
12503 lns='$lns'
12504 locincpth='$locincpth'
12505 loclibpth='$loclibpth'
12506 longdblsize='$longdblsize'
12507 longlongsize='$longlongsize'
12508 longsize='$longsize'
12509 lp='$lp'
12510 lpr='$lpr'
12511 ls='$ls'
12512 lseeksize='$lseeksize'
12513 lseektype='$lseektype'
12514 mail='$mail'
12515 mailx='$mailx'
12516 make='$make'
12517 make_set_make='$make_set_make'
12518 mallocobj='$mallocobj'
12519 mallocsrc='$mallocsrc'
12520 malloctype='$malloctype'
12521 man1dir='$man1dir'
12522 man1direxp='$man1direxp'
12523 man1ext='$man1ext'
12524 man3dir='$man3dir'
12525 man3direxp='$man3direxp'
12526 man3ext='$man3ext'
12527 medium='$medium'
12528 mips='$mips'
12529 mips_type='$mips_type'
12530 mkdir='$mkdir'
12531 models='$models'
12532 modetype='$modetype'
12533 more='$more'
12534 mv='$mv'
12535 myarchname='$myarchname'
12536 mydomain='$mydomain'
12537 myhostname='$myhostname'
12538 myuname='$myuname'
12539 n='$n'
12540 netdb_hlen_type='$netdb_hlen_type'
12541 netdb_host_type='$netdb_host_type'
12542 netdb_name_type='$netdb_name_type'
12543 netdb_net_type='$netdb_net_type'
12544 nm='$nm'
12545 nm_opt='$nm_opt'
12546 nm_so_opt='$nm_so_opt'
12547 nonxs_ext='$nonxs_ext'
12548 nroff='$nroff'
12549 o_nonblock='$o_nonblock'
12550 obj_ext='$obj_ext'
12551 optimize='$optimize'
12552 orderlib='$orderlib'
12553 osname='$osname'
12554 osvers='$osvers'
12555 package='$package'
12556 pager='$pager'
12557 passcat='$passcat'
12558 patchlevel='$patchlevel'
12559 path_sep='$path_sep'
12560 perl='$perl'
12561 perladmin='$perladmin'
12562 perlpath='$perlpath'
12563 pg='$pg'
12564 phostname='$phostname'
12565 pidtype='$pidtype'
12566 plibpth='$plibpth'
12567 pmake='$pmake'
12568 pr='$pr'
12569 prefix='$prefix'
12570 prefixexp='$prefixexp'
12571 privlib='$privlib'
12572 privlibexp='$privlibexp'
12573 prototype='$prototype'
12574 ptrsize='$ptrsize'
12575 randbits='$randbits'
12576 randfunc='$randfunc'
12577 randseedtype='$randseedtype'
12578 ranlib='$ranlib'
12579 rd_nodata='$rd_nodata'
12580 rm='$rm'
12581 rmail='$rmail'
12582 runnm='$runnm'
12583 scriptdir='$scriptdir'
12584 scriptdirexp='$scriptdirexp'
12585 sed='$sed'
12586 seedfunc='$seedfunc'
12587 selectminbits='$selectminbits'
12588 selecttype='$selecttype'
12589 sendmail='$sendmail'
12590 sh='$sh'
12591 shar='$shar'
12592 sharpbang='$sharpbang'
12593 shmattype='$shmattype'
12594 shortsize='$shortsize'
12595 shrpenv='$shrpenv'
12596 shsharp='$shsharp'
12597 sig_name='$sig_name'
12598 sig_name_init='$sig_name_init'
12599 sig_num='$sig_num'
12600 signal_t='$signal_t'
12601 sitearch='$sitearch'
12602 sitearchexp='$sitearchexp'
12603 sitelib='$sitelib'
12604 sitelibexp='$sitelibexp'
12605 sizetype='$sizetype'
12606 sleep='$sleep'
12607 smail='$smail'
12608 small='$small'
12609 so='$so'
12610 sockethdr='$sockethdr'
12611 socketlib='$socketlib'
12612 sort='$sort'
12613 spackage='$spackage'
12614 spitshell='$spitshell'
12615 split='$split'
12616 src='$src'
12617 ssizetype='$ssizetype'
12618 startperl='$startperl'
12619 startsh='$startsh'
12620 static_ext='$static_ext'
12621 stdchar='$stdchar'
12622 stdio_base='$stdio_base'
12623 stdio_bufsiz='$stdio_bufsiz'
12624 stdio_cnt='$stdio_cnt'
12625 stdio_filbuf='$stdio_filbuf'
12626 stdio_ptr='$stdio_ptr'
12627 strings='$strings'
12628 submit='$submit'
12629 subversion='$subversion'
12630 sysman='$sysman'
12631 tail='$tail'
12632 tar='$tar'
12633 tbl='$tbl'
12634 tee='$tee'
12635 test='$test'
12636 timeincl='$timeincl'
12637 timetype='$timetype'
12638 touch='$touch'
12639 tr='$tr'
12640 trnl='$trnl'
12641 troff='$troff'
12642 uidtype='$uidtype'
12643 uname='$uname'
12644 uniq='$uniq'
12645 use64bits='$use64bits'
12646 usedl='$usedl'
12647 usemultiplicity='$usemultiplicity'
12648 usemymalloc='$usemymalloc'
12649 usenm='$usenm'
12650 useopcode='$useopcode'
12651 useperlio='$useperlio'
12652 useposix='$useposix'
12653 usesfio='$usesfio'
12654 useshrplib='$useshrplib'
12655 usethreads='$usethreads'
12656 usevfork='$usevfork'
12657 usrinc='$usrinc'
12658 uuname='$uuname'
12659 version='$version'
12660 vi='$vi'
12661 voidflags='$voidflags'
12662 xlibpth='$xlibpth'
12663 zcat='$zcat'
12664 zip='$zip'
12665 EOT
12666
12667 : Add in command line options if available
12668 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
12669
12670 : add special variables
12671 $test -f $src/patchlevel.h && \
12672 awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
12673 echo "CONFIG=true" >>config.sh
12674
12675 : propagate old symbols
12676 if $test -f UU/config.sh; then
12677         <UU/config.sh sort | uniq >UU/oldconfig.sh
12678         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
12679         sort | uniq -u >UU/oldsyms
12680         set X `cat UU/oldsyms`
12681         shift
12682         case $# in
12683         0) ;;
12684         *)
12685                 cat <<EOM
12686 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
12687 EOM
12688                 echo "# Variables propagated from previous config.sh file." >>config.sh
12689                 for sym in `cat UU/oldsyms`; do
12690                         echo "    Propagating $hint variable "'$'"$sym..."
12691                         eval 'tmp="$'"${sym}"'"'
12692                         echo "$tmp" | \
12693                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
12694                 done
12695                 ;;
12696         esac
12697 fi
12698
12699 : Finish up by extracting the .SH files
12700 case "$alldone" in
12701 exit)
12702         $rm -rf UU
12703         echo "Done."
12704         exit 0
12705         ;;
12706 cont)
12707         ;;
12708 '')
12709         dflt=''
12710         nostick=true
12711         $cat <<EOM
12712
12713 If you'd like to make any changes to the config.sh file before I begin
12714 to configure things, do it as a shell escape now (e.g. !vi config.sh).
12715
12716 EOM
12717         rp="Press return or use a shell escape to edit config.sh:"
12718         . UU/myread
12719         nostick=''
12720         case "$ans" in
12721         '') ;;
12722         *) : in case they cannot read
12723                 sh 1>&4 -c "$ans";;
12724         esac
12725         ;;
12726 esac
12727
12728 : if this fails, just run all the .SH files by hand
12729 . ./config.sh
12730
12731 echo " "
12732 exec 1>&4
12733 . ./UU/extract
12734
12735 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
12736         dflt=y
12737         case "$silent" in
12738         true) ;;
12739         *)
12740                 $cat <<EOM
12741
12742 Now you need to generate make dependencies by running "$make depend".
12743 You might prefer to run it in background: "$make depend > makedepend.out &"
12744 It can take a while, so you might not want to run it right now.
12745
12746 EOM
12747                 ;;
12748         esac
12749         rp="Run $make depend now?"
12750         . UU/myread
12751         case "$ans" in
12752         y*)
12753                 $make depend && echo "Now you must run a $make."
12754                 ;;
12755         *)
12756                 echo "You must run '$make depend' then '$make'."
12757                 ;;
12758         esac
12759 elif test -f [Mm]akefile; then
12760         echo " "
12761         echo "Now you must run a $make."
12762 else
12763         echo "Done."
12764 fi
12765
12766 if $test -f Policy.sh; then
12767     $cat <<EOM
12768
12769 If you compile $package on a different machine or from a different object
12770 directory, copy the Policy.sh file from this object directory to the
12771 new one before you run Configure -- this will help you with most of
12772 the policy defaults.
12773
12774 EOM
12775 fi
12776 if $test -f config.msg; then
12777     echo "Hmm.  I also noted the following information while running:"
12778     echo " "
12779     $cat config.msg >&4
12780     $rm -f config.msg
12781 fi
12782 $rm -f kit*isdone ark*isdone
12783 $rm -rf UU
12784
12785 : End of Configure
12786