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