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