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