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