This is my patch patch.1i for perl5.001.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc so you may fetch it yourself from your nearest
18 # archive site. Check with Archie if you don't know where that can be.)
19 #
20
21 # $Id: Head.U,v 3.0.1.7 1995/03/21 08:46:15 ram Exp $
22 #
23 # Generated on Wed May 31 09:14:05 EDT 1995 [metaconfig 3.0 PL55]
24
25 cat >/tmp/c1$$ <<EOF
26 ARGGGHHHH!!!!!
27
28 SCO csh still thinks true is false.  Write to SCO today and tell them that next
29 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
30
31 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
32 we'd have to do is go in and swap the && and || tokens, wherever they are.)
33
34 [End of diatribe. We now return you to your regularly scheduled programming...]
35 EOF
36 cat >/tmp/c2$$ <<EOF
37
38 OOPS!  You naughty creature!  You didn't run Configure with sh!
39 I will attempt to remedy the situation by running sh for you...
40 EOF
41
42 true || cat /tmp/c1$$ /tmp/c2$$
43 true || exec sh $0 $argv:q
44
45 (exit $?0) || cat /tmp/c2$$
46 (exit $?0) || exec sh $0 $argv:q
47 rm -f /tmp/c1$$ /tmp/c2$$
48
49 : compute my invocation name
50 me=$0
51 case "$0" in
52 */*)
53         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
54         test "$me" || me=$0
55         ;;
56 esac
57
58
59 : Proper PATH setting
60 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
61 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
62 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
63 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
64 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
65 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
66 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
67 paths="$paths /sbin /usr/sbin /usr/libexec"
68
69 for p in $paths
70 do
71         case ":$PATH:" in
72         *:$p:*) ;;
73         *) test -d $p && PATH=$PATH:$p ;;
74         esac
75 done
76
77 PATH=.:$PATH
78 export PATH
79
80 : Sanity checks
81 if test ! -t 0; then
82         echo "Say 'sh $me', not 'sh <$me'"
83         exit 1
84 fi
85
86 : On HP-UX, large Configure scripts may exercise a bug in /bin/sh
87 if test -f /hp-ux -a -f /bin/ksh; then
88         if (PATH=.; alias -x) >/dev/null 2>&1; then
89                 : already under /bin/ksh
90         else
91                 cat <<'EOM'
92 (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
93 EOM
94                 unset ENV
95                 exec /bin/ksh $0 "$@"
96         fi
97 else
98         : Warn them if they use ksh on other systems
99         (PATH=.; alias -x) >/dev/null 2>&1 && \
100                 cat <<EOM
101 (I see you are using the Korn shell.  Some ksh's blow up on $me,
102 especially on exotic machines.  If yours does, try the Bourne shell instead.)
103 EOM
104 fi
105
106 : Configure runs within the UU subdirectory
107 test -d UU || mkdir UU
108 cd UU && rm -f *
109
110 dynamic_ext=''
111 extensions=''
112 known_extensions=''
113 static_ext=''
114 useposix=''
115 d_bsd=''
116 d_eunice=''
117 d_xenix=''
118 eunicefix=''
119 Mcc=''
120 awk=''
121 bash=''
122 bison=''
123 byacc=''
124 cat=''
125 chgrp=''
126 chmod=''
127 chown=''
128 comm=''
129 compress=''
130 cp=''
131 cpio=''
132 cpp=''
133 csh=''
134 date=''
135 echo=''
136 egrep=''
137 emacs=''
138 expr=''
139 find=''
140 flex=''
141 gcc=''
142 grep=''
143 inews=''
144 ksh=''
145 less=''
146 line=''
147 lint=''
148 ln=''
149 lp=''
150 lpr=''
151 ls=''
152 mail=''
153 mailx=''
154 make=''
155 mkdir=''
156 more=''
157 mv=''
158 nroff=''
159 perl=''
160 pg=''
161 pmake=''
162 pr=''
163 rm=''
164 rmail=''
165 sed=''
166 sendmail=''
167 sh=''
168 shar=''
169 sleep=''
170 smail=''
171 sort=''
172 submit=''
173 tail=''
174 tar=''
175 tbl=''
176 test=''
177 touch=''
178 tr=''
179 troff=''
180 uname=''
181 uniq=''
182 uuname=''
183 vi=''
184 zcat=''
185 full_sed=''
186 libswanted=''
187 hint=''
188 myuname=''
189 osname=''
190 osvers=''
191 Author=''
192 Date=''
193 Header=''
194 Id=''
195 Locker=''
196 Log=''
197 RCSfile=''
198 Revision=''
199 Source=''
200 State=''
201 afs=''
202 alignbytes=''
203 archlib=''
204 archlibexp=''
205 d_archlib=''
206 installarchlib=''
207 archname=''
208 myarchname=''
209 baserev=''
210 bin=''
211 binexp=''
212 installbin=''
213 byteorder=''
214 cc=''
215 gccversion=''
216 ccflags=''
217 cppflags=''
218 ldflags=''
219 lkflags=''
220 optimize=''
221 cf_by=''
222 cf_time=''
223 contains=''
224 cpp_stuff=''
225 cpplast=''
226 cppminus=''
227 cpprun=''
228 cppstdin=''
229 d_access=''
230 d_alarm=''
231 d_attribut=''
232 d_bcmp=''
233 d_bcopy=''
234 d_bzero=''
235 d_casti32=''
236 castflags=''
237 d_castneg=''
238 d_chown=''
239 d_chroot=''
240 d_chsize=''
241 d_closedir=''
242 d_void_closedir=''
243 d_const=''
244 cryptlib=''
245 d_crypt=''
246 d_csh=''
247 full_csh=''
248 d_cuserid=''
249 d_dbl_dig=''
250 d_difftime=''
251 d_dlerror=''
252 d_dlopen=''
253 d_dlsymun=''
254 d_dosuid=''
255 d_suidsafe=''
256 d_dup2=''
257 d_fchmod=''
258 d_fchown=''
259 d_fcntl=''
260 d_fd_macros=''
261 d_fd_set=''
262 d_fds_bits=''
263 d_fgetpos=''
264 d_flexfnam=''
265 d_flock=''
266 d_fork=''
267 d_fsetpos=''
268 d_Gconvert=''
269 d_getgrps=''
270 d_gethent=''
271 aphostname=''
272 d_gethname=''
273 d_phostname=''
274 d_uname=''
275 d_getlogin=''
276 d_getpgrp2=''
277 d_getpgrp=''
278 d_getppid=''
279 d_getprior=''
280 d_htonl=''
281 d_isascii=''
282 d_killpg=''
283 d_link=''
284 d_locconv=''
285 d_lockf=''
286 d_lstat=''
287 d_mblen=''
288 d_mbstowcs=''
289 d_mbtowc=''
290 d_memcmp=''
291 d_memcpy=''
292 d_memmove=''
293 d_memset=''
294 d_mkdir=''
295 d_mkfifo=''
296 d_mktime=''
297 d_msg=''
298 d_msgctl=''
299 d_msgget=''
300 d_msgrcv=''
301 d_msgsnd=''
302 d_nice=''
303 d_open3=''
304 d_fpathconf=''
305 d_pathconf=''
306 d_pause=''
307 d_pipe=''
308 d_portable=''
309 d_readdir=''
310 d_rewinddir=''
311 d_seekdir=''
312 d_telldir=''
313 d_readlink=''
314 d_rename=''
315 d_rmdir=''
316 d_safebcpy=''
317 d_safemcpy=''
318 d_select=''
319 d_sem=''
320 d_semctl=''
321 d_semget=''
322 d_semop=''
323 d_setegid=''
324 d_seteuid=''
325 d_setlinebuf=''
326 d_setlocale=''
327 d_setpgid=''
328 d_setpgrp2=''
329 d_bsdpgrp=''
330 d_setpgrp=''
331 d_setprior=''
332 d_setregid=''
333 d_setresgid=''
334 d_setresuid=''
335 d_setreuid=''
336 d_setrgid=''
337 d_setruid=''
338 d_setsid=''
339 d_shm=''
340 d_shmat=''
341 d_shmatprototype=''
342 shmattype=''
343 d_shmctl=''
344 d_shmdt=''
345 d_shmget=''
346 d_oldsock=''
347 d_socket=''
348 d_sockpair=''
349 sockethdr=''
350 socketlib=''
351 d_statblks=''
352 d_stdiobase=''
353 d_stdstdio=''
354 stdio_base=''
355 stdio_bufsiz=''
356 stdio_cnt=''
357 stdio_ptr=''
358 d_index=''
359 d_strchr=''
360 d_strcoll=''
361 d_strctcpy=''
362 d_strerrm=''
363 d_strerror=''
364 d_sysernlst=''
365 d_syserrlst=''
366 d_strxfrm=''
367 d_symlink=''
368 d_syscall=''
369 d_sysconf=''
370 d_system=''
371 d_tcgetpgrp=''
372 d_tcsetpgrp=''
373 d_time=''
374 timetype=''
375 clocktype=''
376 d_times=''
377 d_truncate=''
378 d_tzname=''
379 d_umask=''
380 d_vfork=''
381 usevfork=''
382 d_voidsig=''
383 signal_t=''
384 d_volatile=''
385 d_charvspr=''
386 d_vprintf=''
387 d_wait4=''
388 d_waitpid=''
389 d_wcstombs=''
390 d_wctomb=''
391 dlext=''
392 cccdlflags=''
393 ccdlflags=''
394 d_shrplib=''
395 dlsrc=''
396 ld=''
397 lddlflags=''
398 shrpdir=''
399 usedl=''
400 fpostype=''
401 gidtype=''
402 groupstype=''
403 h_fcntl=''
404 h_sysfile=''
405 db_hashtype=''
406 db_prefixtype=''
407 i_db=''
408 i_dbm=''
409 d_dirnamlen=''
410 direntrytype=''
411 i_dirent=''
412 i_dld=''
413 i_dlfcn=''
414 i_fcntl=''
415 i_float=''
416 i_gdbm=''
417 i_grp=''
418 i_limits=''
419 i_malloc=''
420 i_math=''
421 i_memory=''
422 i_ndbm=''
423 i_neterrno=''
424 i_niin=''
425 i_sysin=''
426 d_pwage=''
427 d_pwchange=''
428 d_pwclass=''
429 d_pwcomment=''
430 d_pwexpire=''
431 d_pwquota=''
432 i_pwd=''
433 i_stddef=''
434 i_stdlib=''
435 i_string=''
436 strings=''
437 i_sysdir=''
438 i_sysfile=''
439 d_voidtty=''
440 i_bsdioctl=''
441 i_sysfilio=''
442 i_sysioctl=''
443 i_syssockio=''
444 i_sysndir=''
445 i_sysparam=''
446 i_sysselct=''
447 i_sysstat=''
448 i_systimes=''
449 i_systypes=''
450 i_sgtty=''
451 i_termio=''
452 i_termios=''
453 i_systime=''
454 i_systimek=''
455 i_time=''
456 timeincl=''
457 i_unistd=''
458 i_utime=''
459 i_stdarg=''
460 i_varargs=''
461 i_varhdr=''
462 i_vfork=''
463 intsize=''
464 libc=''
465 glibpth=''
466 libpth=''
467 plibpth=''
468 xlibpth=''
469 libs=''
470 lns=''
471 lseektype=''
472 d_mymalloc=''
473 freetype=''
474 mallocobj=''
475 mallocsrc=''
476 malloctype=''
477 usemymalloc=''
478 installman1dir=''
479 man1dir=''
480 man1direxp=''
481 man1ext=''
482 installman3dir=''
483 man3dir=''
484 man3direxp=''
485 man3ext=''
486 huge=''
487 large=''
488 medium=''
489 models=''
490 small=''
491 split=''
492 modetype=''
493 mydomain=''
494 myhostname=''
495 phostname=''
496 c=''
497 n=''
498 groupcat=''
499 hostcat=''
500 passcat=''
501 orderlib=''
502 ranlib=''
503 package=''
504 spackage=''
505 patchlevel=''
506 prefix=''
507 prefixexp=''
508 installprivlib=''
509 privlib=''
510 privlibexp=''
511 prototype=''
512 randbits=''
513 installscript=''
514 scriptdir=''
515 scriptdirexp=''
516 selecttype=''
517 sig_name=''
518 d_sitelib=''
519 installsitelib=''
520 sitelib=''
521 sitelibexp=''
522 sizetype=''
523 so=''
524 sharpbang=''
525 shsharp=''
526 spitshell=''
527 ssizetype=''
528 startsh=''
529 stdchar=''
530 sysman=''
531 uidtype=''
532 nm_opt=''
533 runnm=''
534 usenm=''
535 incpath=''
536 mips=''
537 mips_type=''
538 usrinc=''
539 defvoidused=''
540 voidflags=''
541 CONFIG=''
542
543 define='define'
544 undef='undef'
545 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
546 rmlist=''
547
548 : We must find out about Eunice early
549 eunicefix=':'
550 if test -f /etc/unixtovms; then
551         eunicefix=/etc/unixtovms
552 fi
553 if test -f /etc/unixtovms.exe; then
554         eunicefix=/etc/unixtovms.exe
555 fi
556
557 : list of known cpp symbols, sorted alphabetically
558 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
559 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
560 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
561 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
562 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
563 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
564 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
565 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
566 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
567 al="$al VMS Xenix286"
568 al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
569 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
570 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
571 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
572 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
573 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
574 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
575 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
576 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
577 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
578 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
579 al="$al __SVR4_2__ __UMAXV__"
580 al="$al ____386BSD____ __alpha __alpha__ __amiga"
581 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
582 al="$al __host_mips__"
583 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
584 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
585 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
586 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
587 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
588 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
589 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
590 al="$al __mc88100 __mc88100__ __mips __mips__"
591 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
592 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
593 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
594 al="$al _host_mips _mips _unix"
595 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
596 al="$al apollo ardent att386 att3b"
597 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
598 al="$al cadmus clipper concurrent convex cray ctix"
599 al="$al dmert encore gcos gcx gimpel gould"
600 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
601 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
602 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
603 al="$al i186 i286 i386 i486 i8086"
604 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
605 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
606 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
607 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
608 al="$al mc88000 mc88100 merlin mert mips mvs n16"
609 al="$al ncl_el ncl_mr"
610 al="$al news1500 news1700 news1800 news1900 news3700"
611 al="$al news700 news800 news900 ns16000 ns32000"
612 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
613 al="$al parisc pc532 pdp11 plexus posix pyr"
614 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
615 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
616 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
617 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
618 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
619 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
620 al="$al xenix z8000"
621
622 groupstype=''
623 i_whoami=''
624 : change the next line if compiling for Xenix/286 on Xenix/386
625 xlibpth='/usr/lib/386 /lib/386'
626
627 : general looking path for locating libraries
628 glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth"
629 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
630 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib"
631
632 : Private path used by Configure to find libraries.  Its value
633 : is prepended to libpth. This variable takes care of special
634 : machines, like the mips.  Usually, it should be empty.
635 plibpth=''
636
637 : default library list
638 libswanted=''
639 : full support for void wanted by default
640 defvoidused=15
641
642 : set useposix=false in your hint file to disable the POSIX extension.
643 useposix=true
644 : no include file wanted by default
645 inclwanted=''
646
647 : List of libraries we want.
648 libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl'
649 libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
650 libswanted="$libswanted ucb bsd BSD PW x"
651 : We probably want to search /usr/shlib before most other libraries.
652 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
653 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
654 glibpth="/usr/shlib $glibpth"
655 : Do not use vfork unless overridden by a hint file.
656 usevfork=false
657 : We might as well always be portable.  It makes no difference for
658 : perl5, and makes people happy.
659 d_portable=define
660
661 : script used to extract .SH files with variable substitutions
662 cat >extract <<'EOS'
663 CONFIG=true
664 echo "Doing variable substitutions on .SH files..."
665 if test -f MANIFEST; then
666         shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
667         : Pick up possible extension manifests.
668         for dir in ext/* ; do
669                 if test -f $dir/MANIFEST; then
670                         xxx=`awk '{print $1}' < $dir/MANIFEST | 
671                                 sed -n "/\.SH$/ s@^@$dir/@p"`
672                         shlist="$shlist $xxx"
673                 fi
674         done
675         set x $shlist
676 else
677         echo "(Looking for .SH files under the current directory.)"
678         set x `find . -name "*.SH" -print`
679 fi
680 shift
681 case $# in
682 0) set x *.SH; shift;;
683 esac
684 if test ! -f $1; then
685         shift
686 fi
687 for file in $*; do
688         case "$file" in
689         */*)
690                 dir=`expr X$file : 'X\(.*\)/'`
691                 file=`expr X$file : 'X.*/\(.*\)'`
692                 (cd $dir && . ./$file)
693                 ;;
694         *)
695                 . ./$file
696                 ;;
697         esac
698 done
699 if test -f config_h.SH; then
700         if test ! -f config.h; then
701         : oops, they left it out of MANIFEST, probably, so do it anyway.
702         . ./config_h.SH
703         fi
704 fi
705 EOS
706
707 : produce awk script to parse command line options
708 cat >options.awk <<'EOF'
709 BEGIN {
710         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
711
712         len = length(optstr);
713         for (i = 1; i <= len; i++) {
714                 c = substr(optstr, i, 1);
715                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
716                 if (a == ":") {
717                         arg[c] = 1;
718                         i++;
719                 }
720                 opt[c] = 1;
721         }
722 }
723 {
724         expect = 0;
725         str = $0;
726         if (substr(str, 1, 1) != "-") {
727                 printf("'%s'\n", str);
728                 next;
729         }
730         len = length($0);
731         for (i = 2; i <= len; i++) {
732                 c = substr(str, i, 1);
733                 if (!opt[c]) {
734                         printf("-%s\n", substr(str, i));
735                         next;
736                 }
737                 printf("-%s\n", c);
738                 if (arg[c]) {
739                         if (i < len)
740                                 printf("'%s'\n", substr(str, i + 1));
741                         else
742                                 expect = 1;
743                         next;
744                 }
745         }
746 }
747 END {
748         if (expect)
749                 print "?";
750 }
751 EOF
752
753 : process the command line options
754 set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
755 eval "set $*"
756 shift
757 rm -f options.awk
758
759 : set up default values
760 fastread=''
761 reuseval=false
762 config_sh=''
763 alldone=''
764 error=''
765 silent=''
766 extractsh=''
767 override=''
768 knowitall=''
769 rm -f optdef.sh
770
771 : option parsing
772 while test $# -gt 0; do
773         case "$1" in
774         -d) shift; fastread=yes;;
775         -e) shift; alldone=cont;;
776         -f)
777                 shift
778                 cd ..
779                 if test -r "$1"; then
780                         config_sh="$1"
781                 else
782                         echo "$me: cannot read config file $1." >&2
783                         error=true
784                 fi
785                 cd UU
786                 shift;;
787         -h) shift; error=true;;
788         -r) shift; reuseval=true;;
789         -s) shift; silent=true;;
790         -E) shift; alldone=exit;;
791         -K) shift; knowitall=true;;
792         -O) shift; override=true;;
793         -S) shift; extractsh=true;;
794         -D)
795                 shift
796                 case "$1" in
797                 *=)
798                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
799                         echo "$me: ignoring -D $1" >&2
800                         ;;
801                 *=*) echo "$1" | \
802                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
803                 *) echo "$1='define'" >> optdef.sh;;
804                 esac
805                 shift
806                 ;;
807         -U)
808                 shift
809                 case "$1" in
810                 *=) echo "$1" >> optdef.sh;;
811                 *=*)
812                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
813                         echo "$me: ignoring -U $1" >&2
814                         ;;
815                 *) echo "$1='undef'" >> optdef.sh;;
816                 esac
817                 shift
818                 ;;
819         -V) echo "$me generated by metaconfig 3.0 PL55." >&2
820                 exit 0;;
821         --) break;;
822         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
823         *) break;;
824         esac
825 done
826
827 case "$error" in
828 true)
829         cat >&2 <<EOM
830 Usage: $me [-dehrEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
831                  [-U symbol] [-U symbol=]
832   -d : use defaults for all answers.
833   -e : go on without questioning past the production of config.sh.
834   -f : specify an alternate default configuration file.
835   -h : print this help message and exit (with an error status).
836   -r : reuse C symbols value if possible (skips costly nm extraction).
837   -s : silent mode, only echoes questions and essential information.
838   -D : define symbol to have some value:
839          -D symbol         symbol gets the value 'define'
840          -D symbol=value   symbol gets the value 'value'
841   -E : stop at the end of questions, after having produced config.sh.
842   -K : do not use unless you know what you are doing.
843   -O : let -D and -U override definitions from loaded configuration file.
844   -S : perform variable substitutions on all .SH files (can mix with -f)
845   -U : undefine symbol:
846          -U symbol    symbol gets the value 'undef'
847          -U symbol=   symbol gets completely empty
848   -V : print version number and exit (with a zero status).
849 EOM
850         exit 1
851         ;;
852 esac
853
854 exec 4>&1
855 case "$silent" in
856 true) exec 1>/dev/null;;
857 esac
858
859 : run the defines and the undefines, if any, but leave the file out there...
860 touch optdef.sh
861 . ./optdef.sh
862
863 case "$extractsh" in
864 true)
865         case "$config_sh" in
866         '') config_sh='config.sh'; config='./config.sh';;
867         /*) config="$config_sh";;
868         *) config="./$config_sh";;
869         esac
870         echo " "
871         echo "Fetching answers from $config_sh..."
872         cd ..
873         . $config
874         test "$override" && . ./optdef.sh
875         echo " "
876         . ./UU/extract
877         rm -rf UU
878         echo "Done."
879         exit 0
880         ;;
881 esac
882
883 : set package name
884 package=perl5
885 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
886 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
887 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
888 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
889 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
890 esac
891
892 : Eunice requires " " instead of "", can you believe it
893 echo " "
894 : Here we go...
895 echo "Beginning of configuration questions for $package."
896
897 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
898
899 : Some greps do not return status, grrr.
900 echo "grimblepritz" >grimble
901 if grep blurfldyick grimble >/dev/null 2>&1 ; then
902         contains=contains
903 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
904         contains=grep
905 else
906         contains=contains
907 fi
908 rm -f grimble
909 : the following should work in any shell
910 case "$contains" in
911 contains*)
912         echo " "
913         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
914         cat >contains <<'EOSS'
915 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
916 EOSS
917 chmod +x contains
918 esac
919
920 : first determine how to suppress newline on echo command
921 echo " "
922 echo "Checking echo to see how to suppress newlines..."
923 (echo "hi there\c" ; echo " ") >.echotmp
924 if $contains c .echotmp >/dev/null 2>&1 ; then
925         echo "...using -n."
926         n='-n'
927         c=''
928 else
929         cat <<'EOM'
930 ...using \c
931 EOM
932         n=''
933         c='\c'
934 fi
935 echo $n "The star should be here-->$c"
936 echo '*'
937 rm -f .echotmp
938
939 : Now test for existence of everything in MANIFEST
940 echo " "
941 if test -f ../MANIFEST; then
942         echo "First let's make sure your kit is complete.  Checking..." >&4
943         awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
944         rm -f missing
945         for filelist in x??; do
946                 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
947         done
948         if test -s missing; then
949                 cat missing >&4
950                 cat >&4 <<'EOM'
951
952 THIS PACKAGE SEEMS TO BE INCOMPLETE.
953
954 You have the option of continuing the configuration process, despite the
955 distinct possibility that your kit is damaged, by typing 'y'es.  If you
956 do, don't blame me if something goes wrong.  I advise you to type 'n'o
957 and contact the author (lwall@netlabs.com).
958
959 EOM
960                 echo $n "Continue? [n] $c" >&4
961                 read ans
962                 case "$ans" in
963                 y*)
964                         echo "Continuing..." >&4
965                         rm -f missing
966                         ;;
967                 *)
968                         echo "ABORTING..." >&4
969                         kill $$
970                         ;;
971                 esac
972         else
973                 echo "Looks good..." >&4
974         fi
975 else
976         echo "There is no MANIFEST file.  I hope your kit is complete !"
977 fi
978 rm -f missing x??
979
980 : compute the number of columns on the terminal for proper question formatting
981 case "$COLUMNS" in
982 '') COLUMNS='80';;
983 esac
984
985 : set up the echo used in my read
986 myecho="case \"\$xxxm\" in
987 '') echo $n \"\$rp $c\" >&4;;
988 *) case \"\$rp\" in
989         '') echo $n \"[\$xxxm] $c\";;
990         *)
991                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
992                         echo \"\$rp\" >&4
993                         echo $n \"[\$xxxm] $c\" >&4
994                 else
995                         echo $n \"\$rp [\$xxxm] $c\" >&4
996                 fi
997                 ;;
998         esac;;
999 esac"
1000
1001 : now set up to do reads with possible shell escape and default assignment
1002 cat <<EOSC >myread
1003 xxxm=\$dflt
1004 $myecho
1005 ans='!'
1006 case "\$fastread" in
1007 yes) case "\$dflt" in
1008         '') ;;
1009         *) ans='';
1010                 case "\$silent-\$rp" in
1011                 true-) ;;
1012                 *) echo " " >&4;;
1013                 esac;;
1014         esac;;
1015 *) case "\$silent" in
1016         true) case "\$rp" in
1017                 '') ans='';;
1018                 esac;;
1019         esac;;
1020 esac
1021 while expr "X\$ans" : "X!" >/dev/null; do
1022         read answ
1023         set x \$xxxm
1024         shift
1025         aok=''; eval "ans=\"\$answ\"" && aok=y
1026         case  "\$answ" in
1027         "\$ans")
1028                 case "\$ans" in
1029                 \\&*)
1030                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1031                         shift
1032                         case "\$1" in
1033                         -d)
1034                                 fastread=yes
1035                                 echo "(OK, I'll run with -d after this question.)"
1036                                 ;;
1037                         -*)
1038                                 echo "*** Sorry, \$1 not supported yet."
1039                                 ;;
1040                         esac
1041                         $myecho
1042                         ans=!
1043                         ;;
1044                 "!")
1045                         sh 1>&4
1046                         echo " "
1047                         $myecho
1048                         ;;
1049                 !*)
1050                         set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1051                         shift
1052                         sh 1>&4 -c "\$*"
1053                         echo " "
1054                         $myecho
1055                         ;;
1056                 esac;;
1057         *)
1058                 case "\$aok" in
1059                 y)
1060                         echo "*** Substitution done -- please confirm."
1061                         xxxm="\$ans"
1062                         ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1063                         xxxm="\$ans"
1064                         ans=!
1065                         ;;
1066                 *)
1067                         echo "*** Error -- try again."
1068                         ans=!
1069                         ;;
1070                 esac
1071                 $myecho
1072                 ;;
1073         esac
1074         case "\$ans\$xxxm\$nostick" in
1075         '')
1076                 ans=!
1077                 $myecho
1078                 ;;
1079         esac
1080 done
1081 case "\$ans" in
1082 '') ans="\$xxxm";;
1083 esac
1084 EOSC
1085
1086 : create .config dir to save info across Configure sessions
1087 test -d ../.config || mkdir ../.config
1088 cat >../.config/README <<EOF
1089 This directory created by Configure to save information that should
1090 persist across sessions.
1091
1092 You may safely delete it if you wish.
1093 EOF
1094
1095 : general instructions
1096 needman=true
1097 firsttime=true
1098 user=`( (logname) 2>/dev/null || whoami) 2>&1`
1099 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1100         firsttime=false
1101         echo " "
1102         rp='Would you like to see the instructions?'
1103         dflt=n
1104         . ./myread
1105         case "$ans" in
1106         [yY]*) ;;
1107         *) needman=false;;
1108         esac
1109 fi
1110 if $needman; then
1111         cat <<EOH
1112  
1113 This installation shell script will examine your system and ask you questions
1114 to determine how the perl5 package should be installed. If you get
1115 stuck on a question, you may use a ! shell escape to start a subshell or
1116 execute a command.  Many of the questions will have default answers in square
1117 brackets; typing carriage return will give you the default.
1118
1119 On some of the questions which ask for file or directory names you are allowed
1120 to use the ~name construct to specify the login directory belonging to "name",
1121 even if you don't have a shell which knows about that.  Questions where this is
1122 allowed will be marked "(~name ok)".
1123
1124 EOH
1125         rp=''
1126         dflt='Type carriage return to continue'
1127         . ./myread
1128         cat <<'EOH'
1129
1130 The prompter used in this script allows you to use shell variables and
1131 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1132 in the default answer, as if the default line was a set of arguments given to a
1133 script shell.  This means you may also use $* to repeat the whole default line,
1134 so you do not have to re-type everything to add something to the default.
1135
1136 Everytime there is a substitution, you will have to confirm.  If there is an
1137 error (e.g. an unmatched backtick), the default answer will remain unchanged
1138 and you will be prompted again.
1139
1140 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1141 the questions and use the computed defaults (or the previous answers if there
1142 was already a config.sh file). Type 'Configure -h' for a list of options.
1143 You may also start interactively and then answer '& -d' at any prompt to turn
1144 on the non-interactive behaviour for the remaining of the execution.
1145
1146 EOH
1147         . ./myread
1148         cat <<EOH
1149
1150 Much effort has been expended to ensure that this shell script will run on any
1151 Unix system.  If despite that it blows up on yours, your best bet is to edit
1152 Configure and run it again.  If you can't run Configure for some reason,
1153 you'll have to generate a config.sh file by hand.  Whatever problems you
1154 have, let me (lwall@netlabs.com) know how I blew it.
1155
1156 This installation script affects things in two ways:
1157
1158 1) it may do direct variable substitutions on some of the files included
1159    in this kit.
1160 2) it builds a config.h file for inclusion in C programs.  You may edit
1161    any of these files as the need arises after running this script.
1162
1163 If you make a mistake on a question, there is no easy way to back up to it
1164 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1165 files.  Configure will offer to let you do this before it runs the SH files.
1166
1167 EOH
1168         dflt='Type carriage return to continue'
1169         . ./myread
1170         case "$firsttime" in
1171         true) echo $user >>../.config/instruct;;
1172         esac
1173 fi
1174
1175 : see if sh knows # comments
1176 echo " "
1177 echo "Checking your sh to see if it knows about # comments..." >&4
1178 if `sh -c '#' >/dev/null 2>&1`; then
1179         echo "Your sh handles # comments correctly."
1180         shsharp=true
1181         spitshell=cat
1182         echo " "
1183         echo "Okay, let's see if #! works on this system..."
1184         xcat=/bin/cat
1185         test -f $xcat || xcat=/usr/bin/cat
1186         echo "#!$xcat" >try
1187         $eunicefix try
1188         chmod +x try
1189         ./try > today
1190         if test -s today; then
1191                 echo "It does."
1192                 sharpbang='#!'
1193         else
1194                 echo "#! $xcat" > try
1195                 $eunicefix try
1196                 chmod +x try
1197                 ./try > today
1198                 if test -s today; then
1199                         echo "It does."
1200                         sharpbang='#! '
1201                 else
1202                         echo "It's just a comment."
1203                         sharpbang=': use '
1204                 fi
1205         fi
1206 else
1207         echo "Your sh doesn't grok # comments--I will strip them later on."
1208         shsharp=false
1209         cd ..
1210         echo "exec grep -v '^[  ]*#'" >spitshell
1211         chmod +x spitshell
1212         $eunicefix spitshell
1213         spitshell=`pwd`/spitshell
1214         cd UU
1215         echo "I presume that if # doesn't work, #! won't work either!"
1216         sharpbang=': use '
1217 fi
1218 rm -f try today
1219
1220 : figure out how to guarantee sh startup
1221 echo " "
1222 echo "Checking out how to guarantee sh startup..." >&4
1223 case "$SYSTYPE" in
1224 *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
1225 *) startsh=$sharpbang'/bin/sh';;
1226 esac
1227 echo "Let's see if '$startsh' works..."
1228 cat >try <<EOSS
1229 $startsh
1230 set abc
1231 test "$?abc" != 1
1232 EOSS
1233
1234 chmod +x try
1235 $eunicefix try
1236 if ./try; then
1237         echo "Yup, it does."
1238 else
1239 echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
1240 fi
1241 rm -f try
1242
1243 : find out where common programs are
1244 echo " "
1245 echo "Locating common programs..." >&4
1246 cat <<EOSC >loc
1247 $startsh
1248 case \$# in
1249 0) exit 1;;
1250 esac
1251 thing=\$1
1252 shift
1253 dflt=\$1
1254 shift
1255 for dir in \$*; do
1256         case "\$thing" in
1257         .)
1258         if test -d \$dir/\$thing; then
1259                 echo \$dir
1260                 exit 0
1261         fi
1262         ;;
1263         *)
1264         for thisthing in \$dir/\$thing; do
1265                 : just loop through to pick last item
1266         done
1267         if test -f \$thisthing; then
1268                 echo \$thisthing
1269                 exit 0
1270         elif test -f \$dir/\$thing.exe; then
1271                 : on Eunice apparently
1272                 echo \$dir/\$thing
1273                 exit 0
1274         fi
1275         ;;
1276         esac
1277 done
1278 echo \$dflt
1279 exit 1
1280 EOSC
1281 chmod +x loc
1282 $eunicefix loc
1283 loclist="
1284 awk
1285 cat
1286 comm
1287 cp
1288 echo
1289 expr
1290 find
1291 grep
1292 ln
1293 ls
1294 mkdir
1295 rm
1296 sed
1297 sort
1298 touch
1299 tr
1300 uniq
1301 "
1302 trylist="
1303 Mcc
1304 byacc
1305 cpp
1306 csh
1307 date
1308 egrep
1309 line
1310 nroff
1311 perl
1312 test
1313 uname
1314 "
1315 pth=`echo $PATH | sed -e 's/:/ /g'`
1316 pth="$pth /lib /usr/lib"
1317 for file in $loclist; do
1318         xxx=`./loc $file $file $pth`
1319         eval $file=$xxx
1320         eval _$file=$xxx
1321         case "$xxx" in
1322         /*)
1323                 echo $file is in $xxx.
1324                 ;;
1325         *)
1326                 echo "I don't know where $file is.  I hope it's in everyone's PATH."
1327                 ;;
1328         esac
1329 done
1330 echo " "
1331 echo "Don't worry if any of the following aren't found..."
1332 say=offhand
1333 for file in $trylist; do
1334         xxx=`./loc $file $file $pth`
1335         eval $file=$xxx
1336         eval _$file=$xxx
1337         case "$xxx" in
1338         /*)
1339                 echo $file is in $xxx.
1340                 ;;
1341         *)
1342                 echo "I don't see $file out there, $say."
1343                 say=either
1344                 ;;
1345         esac
1346 done
1347 case "$egrep" in
1348 egrep)
1349         echo "Substituting grep for egrep."
1350         egrep=$grep
1351         ;;
1352 esac
1353 case "$test" in
1354 test)
1355         echo "Hopefully test is built into your sh."
1356         ;;
1357 *)
1358         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1359                 echo "Using the test built into your sh."
1360                 test=test
1361                 _test=test
1362         fi
1363         ;;
1364 esac
1365 case "$echo" in
1366 echo)
1367         echo "Hopefully echo is built into your sh."
1368         ;;
1369 '') ;;
1370 *)
1371         echo " "
1372 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1373         $echo $n "hi there$c" >foo1
1374         echo $n "hi there$c" >foo2
1375         if cmp foo1 foo2 >/dev/null 2>&1; then
1376                 echo "They are compatible.  In fact, they may be identical."
1377         else
1378                 case "$n" in
1379                 '-n') n='' c='\c';;
1380                 *) n='-n' c='';;
1381                 esac
1382                 cat <<FOO
1383 They are not compatible!  You are probably running ksh on a non-USG system.
1384 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1385 have echo built in and we may have to run some Bourne shell scripts.  That
1386 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1387
1388 FOO
1389                 $echo $n "The star should be here-->$c"
1390                 $echo "*"
1391         fi
1392         $rm -f foo1 foo2
1393         ;;
1394 esac
1395
1396 : determine whether symbolic links are supported
1397 echo " "
1398 $touch blurfl
1399 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1400         echo "Symbolic links are supported." >&4
1401         lns="$ln -s"
1402 else
1403         echo "Symbolic links are NOT supported." >&4
1404         lns="$ln"
1405 fi
1406 $rm -f blurfl sym
1407
1408 : see whether [:lower:] and [:upper:] are supported character classes
1409 echo " "
1410 up='[A-Z]'
1411 low='[a-z]'
1412 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1413 ABYZ)
1414         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1415         up='[:upper:]'
1416         low='[:lower:]'
1417         ;;
1418 *)
1419         echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1420         ;;
1421 esac
1422 : set up the translation script tr, must be called with ./tr of course
1423 cat >tr <<EOSC
1424 $startsh
1425 case "\$1\$2" in
1426 '[A-Z][a-z]') exec $tr '$up' '$low';;
1427 '[a-z][A-Z]') exec $tr '$low' '$up';;
1428 esac
1429 exec $tr "\$@"
1430 EOSC
1431 chmod +x tr
1432 $eunicefix tr
1433
1434 : Try to determine whether config.sh was made on this system
1435 case "$config_sh" in
1436 '')
1437 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1438 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1439         ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1440 newmyuname="$myuname"
1441 dflt=n
1442 case "$knowitall" in
1443 '')
1444         if test -f ../config.sh; then
1445                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1446                         eval "`grep myuname= ../config.sh`"
1447                 fi
1448                 if test "X$myuname" = "X$newmyuname"; then
1449                         dflt=y
1450                 fi
1451         fi
1452         ;;
1453 *) dflt=y;;
1454 esac
1455
1456 : Get old answers from old config file if Configure was run on the
1457 : same system, otherwise use the hints.
1458 hint=default
1459 cd ..
1460 if test -f config.sh; then
1461         echo " "
1462         rp="I see a config.sh file.  Shall I use it to set the defaults?"
1463         . UU/myread
1464         case "$ans" in
1465         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1466         *)  echo "Fetching default answers from your old config.sh file..." >&4
1467                 tmp_n="$n"
1468                 tmp_c="$c"
1469                 . ./config.sh
1470                 cp config.sh UU
1471                 n="$tmp_n"
1472                 c="$tmp_c"
1473                 hint=previous
1474                 ;;
1475         esac
1476 fi
1477 if test ! -f config.sh; then
1478         $cat <<EOM
1479
1480 First time through, eh?  I have some defaults handy for the following systems:
1481
1482 EOM
1483         cd hints; ls -C *.sh | $sed 's/\.sh/   /g' >&4
1484         dflt=''
1485         : Half the following guesses are probably wrong... If you have better
1486         : tests or hints, please send them to lwall@netlabs.com
1487         : The metaconfig authors would also appreciate a copy...
1488         $test -f /irix && osname=irix
1489         $test -f /xenix && osname=sco_xenix
1490         $test -f /dynix && osname=dynix
1491         $test -f /dnix && osname=dnix
1492         $test -f /unicos && osname=unicos && osvers=`$uname -r`
1493         $test -f /bin/mips && /bin/mips && osname=mips
1494         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1495                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1496         $test -d /usr/apollo/bin && osname=apollo
1497         $test -f /etc/saf/_sactab && osname=svr4
1498         $test -d /usr/include/minix && osname=minix
1499         $test -d /MachTen && osname=machten && \
1500                 osvers=`/usr/etc/version | $awk '{print $2}' | \
1501                 $sed -e 's/[A-Za-z]$//'`
1502         if $test -f $uname; then
1503                 set X $myuname
1504                 shift
1505
1506                 case "$5" in
1507                 fps*) osname=fps ;;
1508                 mips*)
1509                         case "$4" in
1510                         umips) osname=umips ;;
1511                         *) osname=mips ;;
1512                         esac;;
1513                 [23]100) osname=mips ;;
1514                 next*) osname=next ;;
1515                 news*) osname=news ;;
1516                 i386*)
1517                         if $test -f /etc/kconfig; then
1518                                 osname=isc
1519                                 if test "$lns" = "ln -s"; then
1520                                         osvers=4
1521                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1522                                         osvers=3
1523                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
1524                                         osvers=2
1525                                 fi
1526                         fi
1527                         ;;
1528                 esac
1529
1530                 case "$1" in
1531                 aix) osname=aix
1532                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1533                         case "$tmp" in
1534                         'not found') osvers="$4"."$3" ;;
1535                         '<3240'|'<>3240') osvers=3.2.0 ;;
1536                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1537                         '=3250'|'>3250') osvers=3.2.5 ;;
1538                         *) osvers=$tmp;;
1539                         esac
1540                         ;;
1541                 dnix) osname=dnix
1542                         osvers="$3"
1543                         ;;
1544                 domainos) osname=apollo
1545                         osvers="$3"
1546                         ;;
1547                 dgux) osname=dgux 
1548                         osvers="$3"
1549                         ;;
1550                 freebsd) osname=freebsd 
1551                         osvers="$3" ;;
1552                 genix) osname=genix ;;
1553                 hp*) osname=hpux 
1554                         case "$3" in
1555                         *.08.*) osvers=9 ;;
1556                         *.09.*) osvers=9 ;;
1557                         *.10.*) osvers=10 ;;
1558                         *)      osvers="$3" ;;
1559                         esac
1560                         ;;
1561                 irix) osname=irix
1562                         case "$3" in
1563                         4*) osvers=4 ;;
1564                         5*) osvers=5 ;;
1565                         *)      osvers="$3" ;;
1566                         esac
1567                         ;;
1568                 linux) osname=linux
1569                         case "$3" in
1570                         1*) osvers=1 ;;
1571                         *)      osvers="$3" ;;
1572                         esac
1573                         ;;
1574                 netbsd*) osname=netbsd 
1575                         osvers="$3"
1576                         ;;
1577                 bsd386) osname=bsd386
1578                         osvers=`$uname -r`
1579                         ;;
1580                 next*) osname=next ;;
1581                 solaris) osname=solaris
1582                         case "$3" in
1583                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1584                         *)      osvers="$3" ;;
1585                         esac
1586                         ;;
1587                 sunos) osname=sunos
1588                         case "$3" in
1589                         5*) osname=solaris
1590                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1591                         *)      osvers="$3" ;;
1592                         esac
1593                         ;;
1594                 titanos) osname=titanos
1595                         case "$3" in
1596                         1*) osvers=1 ;;
1597                         2*) osvers=2 ;;
1598                         3*) osvers=3 ;;
1599                         4*) osvers=4 ;;
1600                         *)      osvers="$3" ;;
1601                         esac
1602                         ;;
1603                 ultrix) osname=ultrix
1604                         osvers="$3"
1605                         ;;
1606                 osf1)   case "$5" in
1607                                 alpha)
1608                                         osname=dec_osf
1609                                         osvers=`echo "$3" | sed 's/^[vt]//'`
1610                                         ;;
1611                         hp*)    osname=hp_osf1  ;;
1612                         mips)   osname=mips_osf1 ;;
1613                         esac
1614                         ;;
1615                 uts) osname=uts 
1616                         osvers="$3"
1617                         ;;
1618                 $2) case "$osname" in
1619                         *isc*) ;;
1620                         *freebsd*) ;;
1621                         svr*)
1622                                 : svr4.x or possibly later
1623                                 case "svr$3" in 
1624                                 ${osname}*)
1625                                         osname=svr$3
1626                                         osvers=$4
1627                                         ;;
1628                                 esac
1629                                 case "$osname" in
1630                                 svr4.0)
1631                                         : Check for ESIX
1632                                         if test -f /stand/boot ; then
1633                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
1634                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
1635                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1636                                                         if test -n "$isesix"; then
1637                                                                 osname=esix4
1638                                                         fi
1639                                                 fi
1640                                         fi
1641                                         ;;
1642                                 esac
1643                                 ;;
1644                         *)      if test -f /etc/systemid; then
1645                                         osname=sco
1646                                         set `echo $3 | $sed 's/\./ /g'` $4
1647                                         if $test -f sco_$1_$2_$3.sh; then
1648                                                 osvers=$1.$2.$3
1649                                         elif $test -f sco_$1_$2.sh; then
1650                                                 osvers=$1.$2
1651                                         elif $test -f sco_$1.sh; then
1652                                                 osvers=$1
1653                                         fi
1654                                 else
1655                                         case "$osname" in
1656                                         '') : Still unknown.  Probably a generic Sys V.
1657                                                 osname="sysv"
1658                                                 osvers="$3"
1659                                                 ;;
1660                                         esac
1661                                 fi
1662                                 ;;
1663                         esac
1664                         ;;
1665                 *)      case "$osname" in
1666                         '') : Still unknown.  Probably a generic BSD.
1667                                 osname="$1"
1668                                 osvers="$3"
1669                                 ;;
1670                         esac
1671                         ;;
1672                 esac
1673         else
1674                 if test -f /vmunix -a -f news_os.sh; then
1675                         (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
1676                         if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
1677                                 osname=news_os
1678                         fi
1679                         $rm -f ../UU/kernel.what
1680                 fi
1681         fi
1682         
1683         : Now look for a hint file osname_osvers, unless one has been
1684         : specified already.
1685         case "$hintfile" in
1686         ''|' ')
1687                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
1688                 : Also try without trailing minor version numbers.
1689                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1690                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1691                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1692                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
1693                 case "$file" in
1694                 '') dflt=none ;;
1695                 *)  case "$osvers" in
1696                         '') dflt=$file
1697                                 ;;
1698                         *)  if $test -f $file.sh ; then
1699                                         dflt=$file
1700                                 elif $test -f $xfile.sh ; then
1701                                         dflt=$xfile
1702                                 elif $test -f $xxfile.sh ; then
1703                                         dflt=$xxfile
1704                                 elif $test -f $xxxfile.sh ; then
1705                                         dflt=$xxxfile
1706                                 elif $test -f $xxxxfile.sh ; then
1707                                         dflt=$xxxxfile
1708                                 elif $test -f "${osname}.sh" ; then
1709                                         dflt="${osname}"
1710                                 else
1711                                         dflt=none
1712                                 fi
1713                                 ;;
1714                         esac
1715                         ;;
1716                 esac
1717                 ;;
1718         *)
1719                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
1720                 ;;
1721         esac
1722
1723         $cat <<EOM
1724
1725 You may give one or more space-separated answers, or "none" if appropriate.
1726 If your OS version has no hints, DO NOT give a wrong version -- say "none".
1727
1728 EOM
1729         rp="Which of these apply, if any?"
1730         . ../UU/myread
1731         tans=$ans
1732         for file in $tans; do
1733                 if $test -f $file.sh; then
1734                         . ./$file.sh
1735                         $cat $file.sh >> ../UU/config.sh
1736                 elif $test X$tans = X -o X$tans = Xnone ; then
1737                         : nothing
1738                 else
1739                         : Give one chance to correct a possible typo.
1740                         echo "$file.sh does not exist"
1741                         dflt=$file
1742                         rp="hint to use instead?"
1743                         . ../UU/myread
1744                         for file in $ans; do
1745                                 if $test -f "$file.sh"; then
1746                                         . ./$file.sh
1747                                         $cat $file.sh >> ../UU/config.sh
1748                                 elif $test X$ans = X -o X$ans = Xnone ; then
1749                                         : nothing
1750                                 else
1751                                         echo "$file.sh does not exist -- ignored."
1752                                 fi
1753                         done
1754                 fi
1755         done
1756
1757         hint=recommended
1758         : Remember our hint file for later.
1759         if $test -f "$file.sh" ; then
1760                 hintfile="$file"
1761         else
1762                 hintfile=''
1763         fi
1764
1765         cd ..
1766 fi
1767 cd UU
1768 ;;
1769 *)
1770         echo " "
1771         echo "Fetching default answers from $config_sh..." >&4
1772         tmp_n="$n"
1773         tmp_c="$c"
1774         cd ..
1775         cp $config_sh config.sh 2>/dev/null
1776         . ./config.sh
1777         cd UU
1778         cp ../config.sh .
1779         n="$tmp_n"
1780         c="$tmp_c"
1781         hint=previous
1782         ;;
1783 esac
1784 test "$override" && . ./optdef.sh
1785 myuname="$newmyuname"
1786
1787 : Restore computed paths
1788 for file in $loclist $trylist; do
1789         eval $file="\$_$file"
1790 done
1791
1792 cat << EOM
1793
1794 Configure uses the operating system name and version to set some defaults.
1795 The default value is probably right if the name rings a bell. Otherwise,
1796 since spelling matters for me, either accept the default or answer "none"
1797 to leave it blank.
1798
1799 EOM
1800 case "$osname" in
1801         ''|' ')
1802                 case "$hintfile" in
1803                 ''|' '|none) dflt=none ;;
1804                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
1805                 esac
1806                 ;;
1807         *) dflt="$osname" ;;
1808 esac
1809 rp="Operating system name?"
1810 . ./myread
1811 case "$ans" in
1812 none)  osname='' ;;
1813 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
1814 esac
1815 : who configured the system
1816 cf_time=`$date 2>&1`
1817 (logname > .temp) >/dev/null 2>&1
1818 $test -s .temp || (whoami > .temp) >/dev/null 2>&1
1819 $test -s .temp || echo unknown > .temp
1820 cf_by=`$cat .temp`
1821 $rm -f .temp
1822
1823 : determine where manual pages are on this system
1824 echo " "
1825 case "$sysman" in
1826 '') 
1827         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
1828         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1829         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1830         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
1831         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
1832         sysman=`./loc . /usr/man/man1 $syspath`
1833         ;;
1834 esac
1835 if $test -d "$sysman"; then
1836         echo "System manual is in $sysman." >&4
1837 else
1838         echo "Could not find manual pages in source form." >&4
1839 fi
1840
1841 : see what memory models we can support
1842 case "$models" in
1843 '')
1844         $cat >pdp11.c <<'EOP'
1845 main() {
1846 #ifdef pdp11
1847         exit(0);
1848 #else
1849         exit(1);
1850 #endif
1851 }
1852 EOP
1853         cc -o pdp11 pdp11.c >/dev/null 2>&1
1854         if ./pdp11 2>/dev/null; then
1855                 dflt='unsplit split'
1856         else
1857                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1858                 case "$tans" in
1859                 X) dflt='none';;
1860                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1861                                 dflt='small'
1862                         else
1863                                 dflt=''
1864                         fi
1865                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
1866                                 dflt="$dflt medium"
1867                         fi
1868                         if $test -d /lib/large || $test -d /usr/lib/large; then
1869                                 dflt="$dflt large"
1870                         fi
1871                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
1872                                 dflt="$dflt huge"
1873                         fi
1874                 esac
1875         fi;;
1876 *) dflt="$models";;
1877 esac
1878 $cat <<EOM
1879  
1880 Some systems have different model sizes.  On most systems they are called
1881 small, medium, large, and huge.  On the PDP11 they are called unsplit and
1882 split.  If your system doesn't support different memory models, say "none".
1883 If you wish to force everything to one memory model, say "none" here and
1884 put the appropriate flags later when it asks you for other cc and ld flags.
1885 Venix systems may wish to put "none" and let the compiler figure things out.
1886 (In the following question multiple model names should be space separated.)
1887
1888 EOM
1889 rp="Which memory models are supported?"
1890 . ./myread
1891 models="$ans"
1892
1893 case "$models" in
1894 none)
1895         small=''
1896         medium=''
1897         large=''
1898         huge=''
1899         unsplit=''
1900         split=''
1901         ;;
1902 *split)
1903         case "$split" in
1904         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
1905                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
1906                         dflt='-i'
1907                 else
1908                         dflt='none'
1909                 fi;;
1910         *) dflt="$split";;
1911         esac
1912         rp="What flag indicates separate I and D space?"
1913         . ./myread
1914         tans="$ans"
1915         case "$tans" in
1916         none) tans='';;
1917         esac
1918         split="$tans"
1919         unsplit='';;
1920 *large*|*small*|*medium*|*huge*)
1921         case "$models" in
1922         *large*)
1923                 case "$large" in
1924                 '') dflt='-Ml';;
1925                 *) dflt="$large";;
1926                 esac
1927         rp="What flag indicates large model?"
1928         . ./myread
1929         tans="$ans"
1930         case "$tans" in
1931         none) tans='';
1932         esac
1933         large="$tans";;
1934         *) large='';;
1935         esac
1936         case "$models" in
1937         *huge*) case "$huge" in
1938                 '') dflt='-Mh';;
1939                 *) dflt="$huge";;
1940                 esac
1941                 rp="What flag indicates huge model?"
1942                 . ./myread
1943                 tans="$ans"
1944                 case "$tans" in
1945                 none) tans='';
1946                 esac
1947                 huge="$tans";;
1948         *) huge="$large";;
1949         esac
1950         case "$models" in
1951         *medium*) case "$medium" in
1952                 '') dflt='-Mm';;
1953                 *) dflt="$medium";;
1954                 esac
1955                 rp="What flag indicates medium model?"
1956                 . ./myread
1957                 tans="$ans"
1958                 case "$tans" in
1959                 none) tans='';
1960                 esac
1961                 medium="$tans";;
1962         *) medium="$large";;
1963         esac
1964         case "$models" in
1965         *small*) case "$small" in
1966                 '') dflt='none';;
1967                 *) dflt="$small";;
1968                 esac
1969                 rp="What flag indicates small model?"
1970                 . ./myread
1971                 tans="$ans"
1972                 case "$tans" in
1973                 none) tans='';
1974                 esac
1975                 small="$tans";;
1976         *) small='';;
1977         esac
1978         ;;
1979 *)
1980         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
1981         ;;
1982 esac
1983
1984 : make some quick guesses about what we are up against
1985 echo " "
1986 $echo $n "Hmm...  $c"
1987 echo exit 1 >bsd
1988 echo exit 1 >usg
1989 echo exit 1 >v7
1990 echo exit 1 >osf1
1991 echo exit 1 >eunice
1992 echo exit 1 >xenix
1993 echo exit 1 >venix
1994 d_bsd="$undef"
1995 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
1996 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
1997 then
1998         echo "Looks kind of like an OSF/1 system, but we'll see..."
1999         echo exit 0 >osf1
2000 elif test `echo abc | tr a-z A-Z` = Abc ; then
2001         xxx=`./loc addbib blurfl $pth`
2002         if $test -f $xxx; then
2003         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2004                 echo exit 0 >bsd
2005                 echo exit 0 >usg
2006         else
2007                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2008                         echo "Looks kind of like an extended USG system, but we'll see..."
2009                 else
2010                         echo "Looks kind of like a USG system, but we'll see..."
2011                 fi
2012                 echo exit 0 >usg
2013         fi
2014 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2015         echo "Looks kind of like a BSD system, but we'll see..."
2016         d_bsd="$define"
2017         echo exit 0 >bsd
2018 else
2019         echo "Looks kind of like a Version 7 system, but we'll see..."
2020         echo exit 0 >v7
2021 fi
2022 case "$eunicefix" in
2023 *unixtovms*)
2024         $cat <<'EOI'
2025 There is, however, a strange, musty smell in the air that reminds me of
2026 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2027 EOI
2028         echo exit 0 >eunice
2029         d_eunice="$define"
2030 : it so happens the Eunice I know will not run shell scripts in Unix format
2031         ;;
2032 *)
2033         echo " "
2034         echo "Congratulations.  You aren't running Eunice."
2035         d_eunice="$undef"
2036         ;;
2037 esac
2038 if test -f /xenix; then
2039         echo "Actually, this looks more like a XENIX system..."
2040         echo exit 0 >xenix
2041         d_xenix="$define"
2042 else
2043         echo " "
2044         echo "It's not Xenix..."
2045         d_xenix="$undef"
2046 fi
2047 chmod +x xenix
2048 $eunicefix xenix
2049 if test -f /venix; then
2050         echo "Actually, this looks more like a VENIX system..."
2051         echo exit 0 >venix
2052 else
2053         echo " "
2054         if ./xenix; then
2055                 : null
2056         else
2057                 echo "Nor is it Venix..."
2058         fi
2059 fi
2060 chmod +x bsd usg v7 osf1 eunice xenix venix
2061 $eunicefix bsd usg v7 osf1 eunice xenix venix
2062 $rm -f foo
2063
2064 : see if we need a special compiler
2065 echo " "
2066 if ./usg; then
2067         case "$cc" in
2068         '') case "$Mcc" in
2069                 /*) dflt='Mcc';;
2070                 *) case "$large" in
2071                         -M*) dflt='cc';;
2072                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2073                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2074                                                 dflt='cc'
2075                                         else
2076                                                 dflt='cc -M'
2077                                         fi
2078                                 else
2079                                         dflt='cc'
2080                                 fi;;
2081                         esac;;
2082                 esac;;
2083         *)  dflt="$cc";;
2084         esac
2085         $cat <<'EOM'
2086 On some systems the default C compiler will not resolve multiple global
2087 references that happen to have the same name.  On some such systems the "Mcc"
2088 command may be used to force these to be resolved.  On other systems a "cc -M"
2089 command is required.  (Note that the -M flag on other systems indicates a
2090 memory model to use!) If you have the Gnu C compiler, you might wish to use
2091 that instead.
2092
2093 EOM
2094         rp="What command will force resolution on this system?"
2095         . ./myread
2096         cc="$ans"
2097 else
2098         case "$cc" in
2099         '') dflt=cc;;
2100         *) dflt="$cc";;
2101         esac
2102         rp="Use which C compiler?"
2103         . ./myread
2104         cc="$ans"
2105 fi
2106 echo " "
2107 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2108 $cat >gccvers.c <<EOM
2109 #include <stdio.h>
2110 int main() {
2111 #ifdef __GNUC__
2112 #ifdef __VERSION__
2113         printf("%s\n", __VERSION__);
2114 #else
2115         printf("%s\n", "1");
2116 #endif
2117 #endif
2118         exit(0);
2119 }
2120 EOM
2121 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
2122         gccversion=`./gccvers`
2123         case "$gccversion" in
2124         '') echo "You are not using GNU cc." ;;
2125         *)  echo "You are using GNU cc $gccversion." ;;
2126         esac
2127 else
2128         echo " "
2129         echo "*** WHOA THERE!!! ***" >&4
2130         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
2131         case "$knowitall" in
2132         '')
2133         echo "    You'd better start hunting for one and let me know about it." >&4
2134                 exit 1
2135                 ;;
2136         esac
2137 fi
2138 $rm -f gccvers*
2139 case "$gccversion" in
2140 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2141 esac
2142
2143 : decide how portable to be
2144 case "$d_portable" in
2145 "$define") dflt=y;;
2146 *)      dflt=n;;
2147 esac
2148 $cat <<'EOH'
2149  
2150 I can set things up so that your shell scripts and binaries are more portable,
2151 at what may be a noticable cost in performance.  In particular, if you
2152 ask to be portable, the following happens:
2153
2154      1) Shell scripts will rely on the PATH variable rather than using
2155         the paths derived above.
2156      2) ~username interpretations will be done at run time rather than
2157         by Configure.
2158
2159 EOH
2160 rp="Do you expect to run these scripts and binaries on multiple machines?"
2161 . ./myread
2162 case "$ans" in
2163         y*) d_portable="$define"
2164         ;;
2165         *)  d_portable="$undef" ;;
2166 esac
2167
2168 : set up shell script to do ~ expansion
2169 cat >filexp <<EOSS
2170 $startsh
2171 : expand filename
2172 case "\$1" in
2173  ~/*|~)
2174         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2175         ;;
2176  ~*)
2177         if $test -f /bin/csh; then
2178                 /bin/csh -f -c "glob \$1"
2179                 failed=\$?
2180                 echo ""
2181                 exit \$failed
2182         else
2183                 name=\`$expr x\$1 : '..\([^/]*\)'\`
2184                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2185                 if $test ! -d "\$dir"; then
2186                         me=\`basename \$0\`
2187                         echo "\$me: can't locate home directory for: \$name" >&2
2188                         exit 1
2189                 fi
2190                 case "\$1" in
2191                 */*)
2192                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2193                         ;;
2194                 *)
2195                         echo \$dir
2196                         ;;
2197                 esac
2198         fi
2199         ;;
2200 *)
2201         echo \$1
2202         ;;
2203 esac
2204 EOSS
2205 chmod +x filexp
2206 $eunicefix filexp
2207
2208 : now set up to get a file name
2209 cat <<'EOSC' >getfile
2210 tilde=''
2211 fullpath=''
2212 already=''
2213 skip=''
2214 none_ok=''
2215 exp_file=''
2216 nopath_ok=''
2217 orig_rp="$rp"
2218 orig_dflt="$dflt"
2219
2220 case "$fn" in
2221 *\(*)
2222         expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
2223         fn=`echo $fn | sed 's/(.*)//'`
2224         ;;
2225 esac
2226
2227 case "$fn" in
2228 *:*)
2229         loc_file=`expr $fn : '.*:\(.*\)'`
2230         fn=`expr $fn : '\(.*\):.*'`
2231         ;;
2232 esac
2233
2234 case "$fn" in
2235 *~*) tilde=true;;
2236 esac
2237 case "$fn" in
2238 */*) fullpath=true;;
2239 esac
2240 case "$fn" in
2241 *+*) skip=true;;
2242 esac
2243 case "$fn" in
2244 *n*) none_ok=true;;
2245 esac
2246 case "$fn" in
2247 *e*) exp_file=true;;
2248 esac
2249 case "$fn" in
2250 *p*) nopath_ok=true;;
2251 esac
2252
2253 case "$fn" in
2254 *f*) type='File';;
2255 *d*) type='Directory';;
2256 *l*) type='Locate';;
2257 esac
2258
2259 what="$type"
2260 case "$what" in
2261 Locate) what='File';;
2262 esac
2263
2264 case "$exp_file" in
2265 '')
2266         case "$d_portable" in
2267         "$define") ;;
2268         *) exp_file=true;;
2269         esac
2270         ;;
2271 esac
2272
2273 cd ..
2274 while test "$type"; do
2275         redo=''
2276         rp="$orig_rp"
2277         dflt="$orig_dflt"
2278         case "$tilde" in
2279         true) rp="$rp (~name ok)";;
2280         esac
2281         . UU/myread
2282         if test -f UU/getfile.ok && \
2283                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2284         then
2285                 value="$ans"
2286                 ansexp="$ans"
2287                 break
2288         fi
2289         case "$ans" in
2290         none)
2291                 value=''
2292                 ansexp=''
2293                 case "$none_ok" in
2294                 true) type='';;
2295                 esac
2296                 ;;
2297         *)
2298                 case "$tilde" in
2299                 '') value="$ans"
2300                         ansexp="$ans";;
2301                 *)
2302                         value=`UU/filexp $ans`
2303                         case $? in
2304                         0)
2305                                 if test "$ans" != "$value"; then
2306                                         echo "(That expands to $value on this system.)"
2307                                 fi
2308                                 ;;
2309                         *) value="$ans";;
2310                         esac
2311                         ansexp="$value"
2312                         case "$exp_file" in
2313                         '') value="$ans";;
2314                         esac
2315                         ;;
2316                 esac
2317                 case "$fullpath" in
2318                 true)
2319                         case "$ansexp" in
2320                         /*) value="$ansexp" ;;
2321                         *)
2322                                 redo=true
2323                                 case "$already" in
2324                                 true)
2325                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
2326                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
2327                                         ;;
2328                                 *)
2329                                 echo "Please give a full path name, starting with slash." >&4
2330                                         case "$tilde" in
2331                                         true)
2332                                 echo "Note that using ~name is ok provided it expands well." >&4
2333                                                 already=true
2334                                                 ;;
2335                                         esac
2336                                 esac
2337                                 ;;
2338                         esac
2339                         ;;
2340                 esac
2341                 case "$redo" in
2342                 '')
2343                         case "$type" in
2344                         File)
2345                                 if test -f "$ansexp"; then
2346                                         type=''
2347                                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2348                                 then
2349                                         echo "($value is not a plain file, but that's ok.)"
2350                                         type=''
2351                                 fi
2352                                 ;;
2353                         Directory)
2354                                 if test -d "$ansexp"; then
2355                                         type=''
2356                                 fi
2357                                 ;;
2358                         Locate)
2359                                 if test -d "$ansexp"; then
2360                                         echo "(Looking for $loc_file in directory $value.)"
2361                                         value="$value/$loc_file"
2362                                         ansexp="$ansexp/$loc_file"
2363                                 fi
2364                                 if test -f "$ansexp"; then
2365                                         type=''
2366                                 fi
2367                                 case "$nopath_ok" in
2368                                 true)   case "$value" in
2369                                         */*) ;;
2370                                         *)      echo "Assuming $value will be in people's path."
2371                                                 type=''
2372                                                 ;;
2373                                         esac
2374                                         ;;
2375                                 esac
2376                                 ;;
2377                         esac
2378
2379                         case "$skip" in
2380                         true) type='';
2381                         esac
2382
2383                         case "$type" in
2384                         '') ;;
2385                         *)
2386                                 if test "$fastread" = yes; then
2387                                         dflt=y
2388                                 else
2389                                         dflt=n
2390                                 fi
2391                                 rp="$what $value doesn't exist.  Use that name anyway?"
2392                                 . UU/myread
2393                                 dflt=''
2394                                 case "$ans" in
2395                                 y*) type='';;
2396                                 *) echo " ";;
2397                                 esac
2398                                 ;;
2399                         esac
2400                         ;;
2401                 esac
2402                 ;;
2403         esac
2404 done
2405 cd UU
2406 ans="$value"
2407 rp="$orig_rp"
2408 dflt="$orig_dflt"
2409 rm -f getfile.ok
2410 EOSC
2411
2412 : What should the include directory be ?
2413 echo " "
2414 $echo $n "Hmm...  $c"
2415 dflt='/usr/include'
2416 incpath=''
2417 mips_type=''
2418 if $test -f /bin/mips && /bin/mips; then
2419         echo "Looks like a MIPS system..."
2420         $cat >usr.c <<'EOCP'
2421 #ifdef SYSTYPE_BSD43
2422 /bsd43
2423 #endif
2424 EOCP
2425         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
2426                 dflt='/bsd43/usr/include'
2427                 incpath='/bsd43'
2428                 mips_type='BSD 4.3'
2429         else
2430                 mips_type='System V'
2431         fi
2432         $rm -f usr.c usr.out
2433         echo "and you're compiling with the $mips_type compiler and libraries."
2434         echo "exit 0" >mips
2435 else
2436         echo "Doesn't look like a MIPS system."
2437         echo "exit 1" >mips
2438 fi
2439 chmod +x mips
2440 $eunicefix mips
2441 echo " "
2442 case "$usrinc" in
2443 '') ;;
2444 *) dflt="$usrinc";;
2445 esac
2446 fn=d/
2447 rp='Where are the include files you want to use?'
2448 . ./getfile
2449 usrinc="$ans"
2450
2451 : see how we invoke the C preprocessor
2452 echo " "
2453 echo "Now, how can we feed standard input to your C preprocessor..." >&4
2454 cat <<'EOT' >testcpp.c
2455 #define ABC abc
2456 #define XYZ xyz
2457 ABC.XYZ
2458 EOT
2459 cd ..
2460 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2461 chmod 755 cppstdin
2462 wrapper=`pwd`/cppstdin
2463 ok='false'
2464 cd UU
2465
2466 if $test "X$cppstdin" != "X" && \
2467         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2468         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2469 then
2470         echo "You used to use $cppstdin $cppminus so we'll use that again."
2471         case "$cpprun" in
2472         '') echo "But let's see if we can live without a wrapper..." ;;
2473         *)
2474                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2475                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2476                 then
2477                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2478                         ok='true'
2479                 else
2480                         echo "(However, $cpprun $cpplast does not work, let's see...)"
2481                 fi
2482                 ;;
2483         esac
2484 else
2485         case "$cppstdin" in
2486         '') ;;
2487         *)
2488                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2489                 ;;
2490         esac
2491 fi
2492
2493 if $ok; then
2494         : nothing
2495 elif echo 'Maybe "'"$cc"' -E" will work...'; \
2496         $cc -E <testcpp.c >testcpp.out 2>&1; \
2497         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2498         echo "Yup, it does."
2499         x_cpp="$cc -E"
2500         x_minus='';
2501 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2502         $cc -E - <testcpp.c >testcpp.out 2>&1; \
2503         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2504         echo "Yup, it does."
2505         x_cpp="$cc -E"
2506         x_minus='-';
2507 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2508         $cc -P <testcpp.c >testcpp.out 2>&1; \
2509         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2510         echo "Yipee, that works!"
2511         x_cpp="$cc -P"
2512         x_minus='';
2513 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2514         $cc -P - <testcpp.c >testcpp.out 2>&1; \
2515         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2516         echo "At long last!"
2517         x_cpp="$cc -P"
2518         x_minus='-';
2519 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2520         $cpp <testcpp.c >testcpp.out 2>&1; \
2521         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2522         echo "It works!"
2523         x_cpp="$cpp"
2524         x_minus='';
2525 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2526         $cpp - <testcpp.c >testcpp.out 2>&1; \
2527         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2528         echo "Hooray, it works!  I was beginning to wonder."
2529         x_cpp="$cpp"
2530         x_minus='-';
2531 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
2532         $wrapper <testcpp.c >testcpp.out 2>&1; \
2533         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2534         x_cpp="$wrapper"
2535         x_minus=''
2536         echo "Eureka!"
2537 else
2538         dflt=''
2539         rp="No dice.  I can't find a C preprocessor.  Name one:"
2540         . ./myread
2541         x_cpp="$ans"
2542         x_minus=''
2543         $x_cpp <testcpp.c >testcpp.out 2>&1
2544         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2545                 echo "OK, that will do." >&4
2546         else
2547 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
2548                 exit 1
2549         fi
2550 fi
2551
2552 case "$ok" in
2553 false)
2554         cppstdin="$x_cpp"
2555         cppminus="$x_minus"
2556         cpprun="$x_cpp"
2557         cpplast="$x_minus"
2558         set X $x_cpp
2559         shift
2560         case "$1" in
2561         "$cpp")
2562                 echo "Perhaps can we force $cc -E using a wrapper..."
2563                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2564                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2565                 then
2566                         echo "Yup, we can."
2567                         cppstdin="$wrapper"
2568                         cppminus='';
2569                 else
2570                         echo "Nope, we'll have to live without it..."
2571                 fi
2572                 ;;
2573         esac
2574         case "$cpprun" in
2575         "$wrapper")
2576                 cpprun=''
2577                 cpplast=''
2578                 ;;
2579         esac
2580         ;;
2581 esac
2582
2583 case "$cppstdin" in
2584 "$wrapper") ;;
2585 *) $rm -f $wrapper;;
2586 esac
2587 $rm -f testcpp.c testcpp.out
2588
2589 : determine optimize, if desired, or use for debug flag also
2590 case "$optimize" in
2591 ' ') dflt='none';;
2592 '') dflt='-O';;
2593 *) dflt="$optimize";;
2594 esac
2595 $cat <<EOH
2596
2597 Some C compilers have problems with their optimizers, by default, $package
2598 compiles with the -O flag to use the optimizer.  Alternately, you might want
2599 to use the symbolic debugger, which uses the -g flag (on traditional Unix
2600 systems).  Either flag can be specified here.  To use neither flag, specify
2601 the word "none".
2602
2603 EOH
2604 rp="What optimizer/debugger flag should be used?"
2605 . ./myread
2606 optimize="$ans"
2607 case "$optimize" in
2608 'none') optimize=" ";;
2609 esac
2610
2611 dflt=''
2612 case "$ccflags" in
2613 '')     
2614         case "$gccversion" in
2615         1*) dflt='-fpcc-struct-return' ;;
2616         esac
2617         case "$optimize" in
2618         *-g*) dflt="$dflt -DDEBUGGING";;
2619         esac
2620         case "$gccversion" in
2621         2*) if test -d /etc/conf/kconfig.d &&
2622                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
2623                 then
2624                         dflt="$dflt -posix"
2625                 fi
2626                 ;;
2627         esac
2628         ;;
2629 esac
2630
2631 case "$mips_type" in
2632 *BSD*) ;;
2633 '') ;;
2634 *) inclwanted="$inclwanted $usrinc/bsd";;
2635 esac
2636 for thisincl in $inclwanted; do
2637         if $test -d $thisincl; then
2638                 if $test x$thisincl != x$usrinc; then
2639                         case "$dflt" in
2640                         *$thisincl*);;
2641                         *) dflt="$dflt -I$thisincl";;
2642                         esac
2643                 fi
2644         fi
2645 done
2646
2647 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
2648         xxx=true;
2649 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
2650         xxx=true;
2651 else
2652         xxx=false;
2653 fi;
2654 if $xxx; then
2655         case "$dflt" in
2656         *$2*);;
2657         *) dflt="$dflt -D$2";;
2658         esac;
2659 fi'
2660
2661 if ./osf1; then
2662         set signal.h __LANGUAGE_C__; eval $inctest
2663 else
2664         set signal.h LANGUAGE_C; eval $inctest
2665 fi
2666 set signal.h NO_PROTOTYPE; eval $inctest
2667 set signal.h _NO_PROTO; eval $inctest
2668
2669 case "$dflt" in
2670 '') dflt=none;;
2671 esac
2672 case "$ccflags" in
2673 '') ;;
2674 *) dflt="$ccflags";;
2675 esac
2676 $cat <<EOH
2677
2678 Your C compiler may want other flags.  For this question you should include
2679 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
2680 but you should NOT include libraries or ld flags like -lwhatever.  If you
2681 want $package to honor its debug switch, you should include -DDEBUGGING here.
2682 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
2683 -DHIDEMYMALLOC or -DCRIPPLED_CC.
2684
2685 To use no flags, specify the word "none".
2686
2687 EOH
2688 set X $dflt
2689 shift
2690 dflt=${1+"$@"}
2691 rp="Any additional cc flags?"
2692 . ./myread
2693 case "$ans" in
2694 none) ccflags='';;
2695 *) ccflags="$ans";;
2696 esac
2697
2698 : the following weeds options from ccflags that are of no interest to cpp
2699 cppflags="$ccflags"
2700 case "$gccversion" in
2701 1*) cppflags="$cppflags -D__GNUC__"
2702 esac
2703 case "$mips_type" in
2704 '');;
2705 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
2706 esac
2707 case "$cppflags" in
2708 '');;
2709 *)
2710         echo " "
2711         echo "Let me guess what the preprocessor flags are..." >&4
2712         set X $cppflags
2713         shift
2714         cppflags=''
2715         $cat >cpp.c <<'EOM'
2716 #define BLURFL foo
2717
2718 BLURFL xx LFRULB
2719 EOM
2720         previous=''
2721         for flag in $*
2722         do
2723                 case "$flag" in
2724                 -*) ftry="$flag";;
2725                 *) ftry="$previous $flag";;
2726                 esac
2727                 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
2728                         >cpp1.out 2>/dev/null && \
2729                         $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
2730                         >cpp2.out 2>/dev/null && \
2731                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
2732                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
2733                 then
2734                         cppflags="$cppflags $ftry"
2735                         previous=''
2736                 else
2737                         previous="$flag"
2738                 fi
2739         done
2740         set X $cppflags
2741         shift
2742         cppflags=${1+"$@"}
2743         case "$cppflags" in
2744         *-*)  echo "They appear to be: $cppflags";;
2745         esac
2746         $rm -f cpp.c cpp?.out
2747         ;;
2748 esac
2749
2750 : flags used in final linking phase
2751 case "$ldflags" in
2752 '') if ./venix; then
2753                 dflt='-i -z'
2754         else
2755                 dflt=''
2756         fi
2757         case "$ccflags" in
2758         *-posix*) dflt="$dflt -posix" ;;
2759         esac
2760         case "$dflt" in
2761         '') dflt='none' ;;
2762         esac
2763         ;;
2764 *) dflt="$ldflags";;
2765 esac
2766 echo " "
2767 rp="Any additional ld flags (NOT including libraries)?"
2768 . ./myread
2769 case "$ans" in
2770 none) ldflags='';;
2771 *) ldflags="$ans";;
2772 esac
2773 rmlist="$rmlist pdp11"
2774
2775 : coherency check
2776 echo " "
2777 echo "Checking your choice of C compiler and flags for coherency..." >&4
2778 set X $cc $optimize $ccflags try.c -o try $ldflags
2779 shift
2780 $cat >try.msg <<EOM
2781 I've tried to compile and run a simple program with:
2782
2783         $*
2784         ./try
2785
2786 and I got the following output:
2787
2788 EOM
2789 $cat > try.c <<'EOF'
2790 #include <stdio.h>
2791 main() { exit(0); }
2792 EOF
2793 dflt=y
2794 if sh -c "$cc $optimize $ccflags try.c -o try $ldflags" >>try.msg 2>&1; then
2795         if sh -c './try' >>try.msg 2>&1; then
2796                 dflt=n
2797         else
2798                 echo "The program compiled OK, but exited with status $?." >>try.msg
2799                 rp="You have a problem.  Shall I abort Configure"
2800                 dflt=y
2801         fi
2802 else
2803         echo "I can't compile the test program." >>try.msg
2804         rp="You have a BIG problem.  Shall I abort Configure"
2805         dflt=y
2806 fi
2807 case "$dflt" in
2808 y)
2809         $cat try.msg
2810         case "$knowitall" in
2811         '')
2812                 echo "(The supplied flags might be incorrect with this C compiler.)"
2813                 ;;
2814         *) dflt=n;;
2815         esac
2816         echo " "
2817         . ./myread
2818         case "$ans" in
2819         n*|N*) ;;
2820         *)      echo "Ok.  Stopping Configure." >&4
2821                 exit 1
2822                 ;;
2823         esac
2824         ;;
2825 n) echo "OK, that should do.";;
2826 esac
2827 $rm -f try try.* core
2828
2829 : Set private lib path
2830 case "$plibpth" in
2831 '') if ./mips; then
2832                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2833         fi;;
2834 esac
2835 case "$libpth" in
2836 ' ') dlist='';;
2837 '') dlist="$plibpth $glibpth";;
2838 *) dlist="$libpth";;
2839 esac
2840
2841 : Now check and see which directories actually exist, avoiding duplicates
2842 libpth=''
2843 for xxx in $dlist
2844 do
2845     if $test -d $xxx; then
2846                 case " $libpth " in
2847                 *" $xxx "*) ;;
2848                 *) libpth="$libpth $xxx";;
2849                 esac
2850     fi
2851 done
2852 $cat <<'EOM'
2853
2854 Some systems have incompatible or broken versions of libraries.  Among
2855 the directories listed in the question below, please remove any you
2856 know not to be holding relevant libraries, and add any that are needed.
2857 Say "none" for none.
2858
2859 EOM
2860 case "$libpth" in
2861 '') dflt='none';;
2862 *)
2863         set X $libpth
2864         shift
2865         dflt=${1+"$@"}
2866         ;;
2867 esac
2868 rp="Directories to use for library searches?"
2869 . ./myread
2870 case "$ans" in
2871 none) libpth=' ';;
2872 *) libpth="$ans";;
2873 esac
2874
2875 : compute shared library extension
2876 case "$so" in
2877 '')
2878         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
2879                 dflt='sl'
2880         else
2881                 dflt='so'
2882         fi
2883         ;;
2884 *) dflt="$so";;
2885 esac
2886 $cat <<EOM
2887
2888 On some systems, shared libraries may be available.  Answer 'none' if
2889 you want to suppress searching of shared libraries for the remaining
2890 of this configuration.
2891
2892 EOM
2893 rp='What is the file extension used for shared libraries?'
2894 . ./myread
2895 so="$ans"
2896
2897 : Looking for optional libraries
2898 echo " "
2899 echo "Checking for optional libraries..." >&4
2900 case "$libs" in
2901 ' '|'') dflt='';;
2902 *) dflt="$libs";;
2903 esac
2904 case "$libswanted" in
2905 '') libswanted='c_s';;
2906 esac
2907 for thislib in $libswanted; do
2908         
2909         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
2910                 echo "Found -l$thislib (shared)."
2911                 case " $dflt " in
2912                 *"-l$thislib "*);;
2913                 *) dflt="$dflt -l$thislib";;
2914                 esac
2915         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
2916                 echo "Found -l$thislib (shared)."
2917                 case " $dflt " in
2918                 *"-l$thislib "*);;
2919                 *) dflt="$dflt -l$thislib";;
2920                 esac
2921         elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
2922                 echo "Found -l$thislib."
2923                 case " $dflt " in
2924                 *"-l$thislib "*);;
2925                 *) dflt="$dflt -l$thislib";;
2926                 esac
2927         elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
2928                 echo "Found -l${thislib}_s."
2929                 case " $dflt " in
2930                 *"-l$thislib "*);;
2931                 *) dflt="$dflt -l${thislib}_s";;
2932                 esac
2933         elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
2934                 echo "Found -l$thislib."
2935                 case " $dflt " in
2936                 *"-l$thislib "*);;
2937                 *) dflt="$dflt -l$thislib";;
2938                 esac
2939         else
2940                 echo "No -l$thislib."
2941         fi
2942 done
2943 set X $dflt
2944 shift
2945 dflt="$*"
2946 case "$libs" in
2947 '') dflt="$dflt";;
2948 *) dflt="$libs";;
2949 esac
2950 case "$dflt" in
2951 ' '|'') dflt='none';;
2952 esac
2953
2954 $cat <<EOM
2955  
2956 Some versions of Unix support shared libraries, which make executables smaller
2957 but make load time slightly longer.
2958
2959 On some systems, mostly newer Unix System V's, the shared library is included
2960 by putting the option "-lc_s" as the last thing on the cc command line when
2961 linking.  Other systems use shared libraries by default.  There may be other
2962 libraries needed to compile $package on your machine as well.  If your system
2963 needs the "-lc_s" option, include it here.  Include any other special libraries
2964 here as well.  Say "none" for none.
2965 EOM
2966
2967 echo " "
2968 rp="Any additional libraries?"
2969 . ./myread
2970 case "$ans" in
2971 none) libs=' ';;
2972 *) libs="$ans";;
2973 esac
2974
2975 : see if nm is to be used to determine whether a symbol is defined or not
2976 case "$usenm" in
2977 '')
2978         dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
2979         if $test $dflt -gt 20; then
2980                 dflt=y
2981         else
2982                 dflt=n
2983         fi
2984         ;;
2985 *)
2986         case "$usenm" in
2987         true) dflt=y;;
2988         *) dflt=n;;
2989         esac
2990         ;;
2991 esac
2992 $cat <<EOM
2993
2994 I can use 'nm' to extract the symbols from your C libraries. This is a time
2995 consuming task which may generate huge output on the disk (up to 3 megabytes)
2996 but that should make the symbols extraction faster. The alternative is to skip
2997 the 'nm' extraction part and to compile a small test program instead to
2998 determine whether each symbol is present. If you have a fast C compiler and/or
2999 if your 'nm' output cannot be parsed, this may be the best solution.
3000
3001 EOM
3002 rp='Shall I use nm to extract C symbols from the libraries?'
3003 . ./myread
3004 case "$ans" in
3005 n|N) usenm=false;;
3006 *) usenm=true;;
3007 esac
3008
3009 runnm=$usenm
3010 case "$reuseval" in
3011 true) runnm=false;;
3012 esac
3013
3014 : nm options which may be necessary
3015 case "$nm_opt" in
3016 '') if $test -f /mach_boot; then
3017                 nm_opt=''
3018         elif $test -d /usr/ccs/lib; then
3019                 nm_opt='-p'
3020         elif $test -f /dgux; then
3021                 nm_opt='-p'
3022         else
3023                 nm_opt=''
3024         fi;;
3025 esac
3026
3027 case "$runnm" in
3028 true)
3029 : get list of predefined functions in a handy place
3030 echo " "
3031 case "$libc" in
3032 '') libc=unknown
3033         case "$libs" in
3034         *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
3035         esac
3036         ;;
3037 esac
3038 libnames='';
3039 case "$libs" in
3040 '') ;;
3041 *)  for thislib in $libs; do
3042         case "$thislib" in
3043         -lc|-lc_s)
3044                 : Handle C library specially below.
3045                 ;;
3046         -l*)
3047                 thislib=`echo $thislib | $sed -e 's/^-l//'`
3048                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
3049                         :
3050                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
3051                         :
3052                 elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
3053                         :
3054                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
3055                         :
3056                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
3057                         :
3058                 elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
3059                         :
3060                 else
3061                         try=''
3062                 fi
3063                 libnames="$libnames $try"
3064                 ;;
3065         *) libnames="$libnames $thislib" ;;
3066         esac
3067         done
3068         ;;
3069 esac
3070 xxx=normal
3071 case "$libc" in
3072 unknown)
3073         set /usr/ccs/lib/libc.$so
3074         $test -r $1 || set /usr/lib/libc.$so
3075         $test -r $1 || set /usr/shlib/libc.$so
3076         $test -r $1 || \
3077                 set `echo blurfl; echo /usr/lib/libc.$so.[0-9]* | \
3078                 tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e '
3079                         h
3080                         s/[0-9][0-9]*/0000&/g
3081                         s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
3082                         G
3083                         s/\n/ /' | \
3084                  sort | $sed -e 's/^.* //'`
3085         eval set \$$#
3086         $test -r $1 || set /lib/libc.$so
3087         $test -r $1 || set /lib/libsys_s.a
3088         ;;
3089 *)
3090         set blurfl
3091         ;;
3092 esac
3093 if $test -r "$1"; then
3094         echo "Your (shared) C library seems to be in $1."
3095         libc="$1"
3096 elif $test -r /lib/libc && $test -r /lib/clib; then
3097         echo "Your C library seems to be in both /lib/clib and /lib/libc."
3098         xxx=apollo
3099         libc='/lib/clib /lib/libc'
3100         if $test -r /lib/syslib; then
3101                 echo "(Your math library is in /lib/syslib.)"
3102                 libc="$libc /lib/syslib"
3103         fi
3104 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3105         echo "Your C library seems to be in $libc, as you said before."
3106 elif $test -r $incpath/usr/lib/libc.a; then
3107         libc=$incpath/usr/lib/libc.a;
3108         echo "Your C library seems to be in $libc.  That's fine."
3109 elif $test -r /lib/libc.a; then
3110         libc=/lib/libc.a;
3111         echo "Your C library seems to be in $libc.  You're normal."
3112 else
3113         if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
3114                 :
3115         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
3116                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
3117         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
3118                 :
3119         elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3120                 :
3121         elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3122                 :
3123         else
3124                 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
3125         fi
3126         if $test -r "$tans"; then
3127                 echo "Your C library seems to be in $tans, of all places."
3128                 libc=$tans
3129         else
3130                 libc='blurfl'
3131         fi
3132 fi
3133 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3134         dflt="$libc"
3135         cat <<EOM
3136
3137 If the guess above is wrong (which it might be if you're using a strange
3138 compiler, or your machine supports multiple models), you can override it here.
3139
3140 EOM
3141 else
3142         dflt=''
3143         echo $libpth | tr ' ' '\012' | sort | uniq > libpath
3144         cat >&4 <<EOM
3145 I can't seem to find your C library.  I've looked in the following places:
3146
3147 EOM
3148         $sed 's/^/      /' libpath
3149         cat <<EOM
3150
3151 None of these seems to contain your C library. I need to get its name...
3152
3153 EOM
3154 fi
3155 fn=f
3156 rp='Where is your C library?'
3157 . ./getfile
3158 libc="$ans"
3159
3160 echo " "
3161 echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
3162 set X `cat libnames`
3163 shift
3164 xxx=files
3165 case $# in 1) xxx=file; esac
3166 echo "Extracting names from the following $xxx for later perusal:" >&4
3167 echo " "
3168 $sed 's/^/      /' libnames >&4
3169 echo " "
3170 $echo $n "This may take a while...$c" >&4
3171
3172 nm $nm_opt $* 2>/dev/null >libc.tmp
3173 $echo $n ".$c"
3174 $grep fprintf libc.tmp > libc.ptf
3175 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
3176 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
3177 xxx='[ADTSIW]'
3178 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx //p'";\
3179         eval $xscan;\
3180         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3181                 eval $xrun
3182 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
3183         eval $xscan;\
3184         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3185                 eval $xrun
3186 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
3187         eval $xscan;\
3188         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3189                 eval $xrun
3190 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
3191         eval $xscan;\
3192         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3193                 eval $xrun
3194 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
3195         eval $xscan;\
3196         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3197                 eval $xrun
3198 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
3199         eval $xscan;\
3200         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3201                 eval $xrun
3202 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
3203                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
3204         eval $xscan;\
3205         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3206                 eval $xrun
3207 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
3208         eval $xscan;\
3209         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3210                 eval $xrun
3211 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
3212         eval $xscan;\
3213         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3214                 eval $xrun
3215 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
3216         eval $xscan;\
3217         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3218                 eval $xrun
3219 else
3220         nm -p $* 2>/dev/null >libc.tmp
3221         $grep fprintf libc.tmp > libc.ptf
3222         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
3223                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
3224         then
3225                 nm_opt='-p'
3226                 eval $xrun
3227         else
3228                 echo " "
3229                 echo "nm didn't seem to work right. Trying ar instead..." >&4
3230                 com=''
3231                 if ar t $libc > libc.tmp; then
3232                         for thisname in $libnames; do
3233                                 ar t $thisname >>libc.tmp
3234                         done
3235                         $sed -e 's/\.o$//' < libc.tmp > libc.list
3236                         echo "Ok." >&4
3237                 else
3238                         echo "ar didn't seem to work right." >&4
3239                         echo "Maybe this is a Cray...trying bld instead..." >&4
3240                         if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list
3241                         then
3242                                 for thisname in $libnames; do
3243                                         bld t $libnames | \
3244                                         $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
3245                                         ar t $thisname >>libc.tmp
3246                                 done
3247                                 echo "Ok." >&4
3248                         else
3249                                 echo "That didn't work either.  Giving up." >&4
3250                                 exit 1
3251                         fi
3252                 fi
3253         fi
3254 fi
3255 nm_extract="$com"
3256 if $test -f /lib/syscalls.exp; then
3257         echo " "
3258         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
3259         $sed -n 's/^\([^        ]*\)[   ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
3260 fi
3261 ;;
3262 esac
3263 $rm -f libnames libpath
3264
3265 : is a C symbol defined?
3266 csym='tlook=$1;
3267 case "$3" in
3268 -v) tf=libc.tmp; tc=""; tdc="";;
3269 -a) tf=libc.tmp; tc="[0]"; tdc=[];;
3270 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
3271 esac;
3272 tx=yes;
3273 case "$reuseval-$4" in
3274 true-) ;;
3275 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
3276 esac;
3277 case "$tx" in
3278 yes)
3279         case "$runnm" in
3280         true)
3281                 if $contains $tlook $tf >/dev/null 2>&1;
3282                 then tval=true;
3283                 else tval=false;
3284                 fi;;
3285         *)
3286                 echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
3287                 if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1;
3288                 then tval=true;
3289                 else tval=false;
3290                 fi;
3291                 $rm -f t t.c;;
3292         esac;;
3293 *)
3294         case "$tval" in
3295         $define) tval=true;;
3296         *) tval=false;;
3297         esac;;
3298 esac;
3299 eval "$2=$tval"'
3300
3301 : set up the script used to warn in case of inconsistency
3302 cat <<'EOSC' >whoa
3303 dflt=y
3304 echo " "
3305 echo "*** WHOA THERE!!! ***" >&4
3306 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3307 rp="    Keep the $hint value?"
3308 . ./myread
3309 case "$ans" in
3310 y) td=$was; tu=$was;;
3311 esac
3312 EOSC
3313
3314 : define an is-in-libc? function
3315 inlibc='echo " "; td=$define; tu=$undef;
3316 sym=$1; var=$2; eval "was=\$$2";
3317 tx=yes;
3318 case "$reuseval$was" in
3319 true) ;;
3320 true*) tx=no;;
3321 esac;
3322 case "$tx" in
3323 yes)
3324         set $sym tres -f;
3325         eval $csym;
3326         case "$tres" in
3327         true)
3328                 echo "$sym() found." >&4;
3329                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
3330         *)
3331                 echo "$sym() NOT found." >&4;
3332                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
3333         esac;;
3334 *)
3335         case "$was" in
3336         $define) echo "$sym() found." >&4;;
3337         *) echo "$sym() NOT found." >&4;;
3338         esac;;
3339 esac'
3340
3341 : see if gconvert exists
3342 : On some SVR4 systems, gconvert is present but can not be used 
3343 : because it requires some other unavailable functions.
3344 : Therefore, do not use the nm extraction, but use a real compile
3345 : and link test instead.
3346 xxx_runnm="$runnm"
3347 runnm=false
3348 set gconvert d_gconvert
3349 eval $inlibc
3350 runnm="$xxx_runnm"
3351
3352 case "$d_gconvert" in
3353 $define)
3354         echo "We'll use it to convert floats into a string then." >&4
3355         d_Gconvert="gconvert((x),(n),(t),(b))"
3356         ;;
3357 *)
3358         : Maybe we can emulate it with gcvt.
3359         set gcvt d_gcvt
3360         eval $inlibc
3361
3362         case "$d_gcvt" in
3363         $define) 
3364                 : Test whether gcvt drops a trailing decimal point
3365                 $cat >try.c <<'EOP'
3366 main() { 
3367         char buf[64]; 
3368         gcvt(1.0, 8, buf); 
3369         if (buf[0] != '1' || buf[1] != '\0')
3370                 exit(1);
3371         gcvt(0.0, 8, buf); 
3372         if (buf[0] != '0' || buf[1] != '\0')
3373                 exit(1);
3374         gcvt(-1.0, 8, buf); 
3375         if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0')
3376                 exit(1);
3377         exit(0);
3378 }
3379 EOP
3380                 if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
3381                         if ./try; then
3382                                 echo "Good, your gcvt() drops a trailing decimal point."
3383                                 echo "We'll use it to convert floats into a string." >&4
3384                                 d_Gconvert="gcvt((x),(n),(b))"
3385                         else
3386                                 echo "But your gcvt() keeps a trailing decimal point".
3387                                 d_Gconvert=''
3388                         fi
3389                 else
3390                         echo "Hmm.  I can't compile the gcvt test program."
3391                         d_Gconvert=''
3392                 fi
3393                 $rm -f try.c try
3394                 ;;
3395         esac
3396         case "$d_Gconvert" in
3397         '')
3398                 echo "I'll use sprintf instead to convert floats into a string." >&4
3399                 d_Gconvert='sprintf((b),"%.*g",(n),(x))'
3400                 ;;
3401         esac
3402 esac
3403
3404 : Initialize h_fcntl
3405 h_fcntl=false
3406
3407 : Initialize h_sysfile
3408 h_sysfile=false
3409
3410 : determine filename position in cpp output
3411 echo " "
3412 echo "Computing filename position in cpp output for #include directives..." >&4
3413 echo '#include <stdio.h>' > foo.c
3414 $cat >fieldn <<EOF
3415 $startsh
3416 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
3417 $grep '^[       ]*#.*stdio\.h' | \
3418 while read cline; do
3419         pos=1
3420         set \$cline
3421         while $test \$# -gt 0; do
3422                 if $test -r \`echo \$1 | $tr -d '"'\`; then
3423                         echo "\$pos"
3424                         exit 0
3425                 fi
3426                 shift
3427                 pos=\`expr \$pos + 1\`
3428         done
3429 done
3430 EOF
3431 chmod +x fieldn
3432 fieldn=`./fieldn`
3433 $rm -f foo.c fieldn
3434 case $fieldn in
3435 '') pos='???';;
3436 1) pos=first;;
3437 2) pos=second;;
3438 3) pos=third;;
3439 *) pos="${fieldn}th";;
3440 esac
3441 echo "Your cpp writes the filename in the $pos field of the line."
3442
3443 : locate header file
3444 $cat >findhdr <<EOF
3445 $startsh
3446 wanted=\$1
3447 name=''
3448 if test -f $usrinc/\$wanted; then
3449         echo "$usrinc/\$wanted"
3450         exit 0
3451 fi
3452 awkprg='{ print \$$fieldn }'
3453 echo "#include <\$wanted>" > foo\$\$.c
3454 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3455 $grep "^[       ]*#.*\$wanted" | \
3456 while read cline; do
3457         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
3458         case "\$name" in
3459         */\$wanted) echo "\$name"; exit 0;;
3460         *) name='';;
3461         esac;
3462 done;
3463 $rm -f foo\$\$.c;
3464 case "\$name" in
3465 '') exit 1;;
3466 esac
3467 EOF
3468 chmod +x findhdr
3469
3470 : access call always available on UNIX
3471 set access d_access
3472 eval $inlibc
3473
3474 : locate the flags for 'access()'
3475 case "$d_access" in
3476 "$define")
3477         echo " "
3478         $cat >access.c <<'EOCP'
3479 #include <sys/types.h>
3480 #ifdef I_FCNTL
3481 #include <fcntl.h>
3482 #endif
3483 #ifdef I_SYS_FILE
3484 #include <sys/file.h>
3485 #endif
3486 #ifdef I_UNISTD
3487 #include <unistd.h>
3488 #endif
3489 main() {
3490         exit(R_OK);
3491 }
3492 EOCP
3493         : check sys/file.h first, no particular reason here
3494         if $test `./findhdr sys/file.h` && \
3495                 $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
3496                 h_sysfile=true;
3497                 echo "<sys/file.h> defines the *_OK access constants." >&4
3498         elif $test `./findhdr fcntl.h` && \
3499                 $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
3500                 h_fcntl=true;
3501                 echo "<fcntl.h> defines the *_OK access constants." >&4
3502         elif $test `./findhdr unistd.h` && \
3503                 $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
3504                 echo "<unistd.h> defines the *_OK access constants." >&4
3505         else
3506                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
3507         fi
3508         ;;
3509 esac
3510 $rm -f access*
3511
3512 : see if alarm exists
3513 set alarm d_alarm
3514 eval $inlibc
3515
3516 : determine the architecture name
3517 echo " "
3518 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3519         tarch=`arch`"-$osname"
3520 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3521         if uname -m > tmparch 2>&1 ; then
3522                 tarch=`$sed -e 's/ /_/g' -e 's/$/'"-$osname/" tmparch`
3523         else
3524                 tarch="$osname"
3525         fi
3526         $rm -f tmparch
3527 else
3528         tarch="$osname"
3529 fi
3530 case "$myarchname" in
3531 ''|"$tarch") ;;
3532 *)
3533         echo "(Your architecture name used to be $myarchname.)"
3534         archname=''
3535         ;;
3536 esac
3537 case "$archname" in
3538 '') dflt="$tarch";;
3539 *) dflt="$archname";;
3540 esac
3541 rp='What is your architecture name'
3542 . ./myread
3543 archname="$ans"
3544 myarchname="$tarch"
3545
3546 : is AFS running?
3547 echo " "
3548 if test -d /afs; then
3549         echo "AFS may be running... I'll be extra cautious then..." >&4
3550         afs=true
3551 else
3552         echo "AFS does not seem to be running..." >&4
3553         afs=false
3554 fi
3555
3556 : determine root of directory hierarchy where package will be installed.
3557 case "$prefix" in
3558 '')
3559         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3560         ;;
3561 *)
3562         dflt="$prefix"
3563         ;;
3564 esac
3565 $cat <<EOM
3566
3567 By default, $package will be installed in $dflt/bin, manual
3568 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
3569 all installation directories. Typically set to /usr/local, but you
3570 may choose /usr if you wish to install $package among your system
3571 binaries. If you wish to have binaries under /bin but manual pages
3572 under /usr/local/man, that's ok: you will be prompted separately
3573 for each of the installation directories, the prefix being only used
3574 to set the defaults.
3575
3576 EOM
3577 fn=d~
3578 rp='Installation prefix to use?'
3579 . ./getfile
3580 oldprefix=''
3581 case "$prefix" in
3582 '') ;;
3583 *)
3584         case "$ans" in
3585         "$prefix") ;;
3586         *) oldprefix="$prefix";;
3587         esac
3588         ;;
3589 esac
3590 prefix="$ans"
3591 prefixexp="$ansexp"
3592
3593 : set the prefixit variable, to compute a suitable default value
3594 prefixit='case "$3" in
3595 ""|none)
3596         case "$oldprefix" in
3597         "") eval "$1=\"\$$2\"";;
3598         *)
3599                 case "$3" in
3600                 "") eval "$1=";;
3601                 none)
3602                         eval "tp=\"\$$2\"";
3603                         case "$tp" in
3604                         ""|" ") eval "$1=\"\$$2\"";;
3605                         *) eval "$1=";;
3606                         esac;;
3607                 esac;;
3608         esac;;
3609 *)
3610         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3611         case "$tp" in
3612         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3613         /*-$oldprefix/*|\~*-$oldprefix/*)
3614                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3615         *) eval "$1=\"\$$2\"";;
3616         esac;;
3617 esac'
3618
3619 : determine where private executables go
3620 set dflt privlib lib/$package
3621 eval $prefixit
3622 $cat <<EOM
3623
3624 There are some auxiliary files for $package that need to be put into a
3625 private library directory that is accessible by everyone.
3626
3627 EOM
3628 fn=d~+
3629 rp='Pathname where the private library files will reside?'
3630 . ./getfile
3631 if $test "X$privlibexp" != "X$ansexp"; then
3632         installprivlib=''
3633 fi
3634 privlib="$ans"
3635 privlibexp="$ansexp"
3636 if $afs; then
3637         $cat <<EOM
3638
3639 Since you are running AFS, I need to distinguish the directory in which
3640 private files reside from the directory in which they are installed (and from
3641 which they are presumably copied to the former directory by occult means).
3642
3643 EOM
3644         case "$installprivlib" in
3645         '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3646         *) dflt="$installprivlib";;
3647         esac
3648         fn=de~
3649         rp='Where will private files be installed?'
3650         . ./getfile
3651         installprivlib="$ans"
3652 else
3653         installprivlib="$privlibexp"
3654 fi
3655
3656 : set the prefixup variable, to restore leading tilda escape
3657 prefixup='case "$prefixexp" in
3658 "$prefix") ;;
3659 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3660 esac'
3661
3662 : determine where public architecture dependent libraries go
3663 set archlib archlib
3664 eval $prefixit
3665 case "$archlib" in
3666 '')
3667         case "$privlib" in
3668         '')
3669                 dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
3670                 set dflt
3671                 eval $prefixup
3672                 ;;
3673         *)  dflt="$privlib/$archname";;
3674         esac
3675         ;;
3676 *) dflt="$archlib";;
3677 esac
3678 cat <<EOM
3679
3680 $spackage contains architecture-dependent library files.  If you are
3681 sharing libraries in a heterogeneous environment, you might store
3682 these files in a separate location.  Otherwise, you can just include
3683 them with the rest of the public library files.
3684
3685 EOM
3686 fn=d~
3687 rp='Where do you want to put the public architecture-dependent libraries?'
3688 . ./getfile
3689 archlib="$ans"
3690 archlibexp="$ansexp"
3691
3692 if $afs; then
3693         $cat <<EOM
3694
3695 Since you are running AFS, I need to distinguish the directory in which
3696 private files reside from the directory in which they are installed (and from
3697 which they are presumably copied to the former directory by occult means).
3698
3699 EOM
3700         case "$installarchlib" in
3701         '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3702         *) dflt="$installarchlib";;
3703         esac
3704         fn=de~
3705         rp='Where will architecture-dependent library files be installed?'
3706         . ./getfile
3707         installarchlib="$ans"
3708 else
3709         installarchlib="$archlibexp"
3710 fi
3711 if $test X"$archlib" = X"$privlib"; then
3712         d_archlib="$undef"
3713 else
3714         d_archlib="$define"
3715 fi
3716
3717 : function used to set $1 to $val
3718 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3719 case "$val$was" in
3720 $define$undef) . ./whoa; eval "$var=\$td";;
3721 $undef$define) . ./whoa; eval "$var=\$tu";;
3722 *) eval "$var=$val";;
3723 esac'
3724
3725 : Look for GNU-cc style attribute checking
3726 echo " "
3727 echo "Checking whether your compiler can handle __attribute__ ..." >&4
3728 $cat >attrib.c <<'EOCP'
3729 #include <stdio.h>
3730 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
3731 EOCP
3732 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
3733         if $contains 'warning' attrib.out >/dev/null 2>&1; then
3734                 echo "Your C compiler doesn't fully support __attribute__."
3735                 val="$undef"
3736         else
3737                 echo "Your C compiler supports __attribute__."
3738                 val="$define"
3739         fi
3740 else
3741         echo "Your C compiler doesn't seem to understand __attribute__ at all."
3742         val="$undef"
3743 fi
3744 set d_attribut
3745 eval $setvar
3746 $rm -f attrib*
3747
3748 : see if bcmp exists
3749 set bcmp d_bcmp
3750 eval $inlibc
3751
3752 : see if bcopy exists
3753 set bcopy d_bcopy
3754 eval $inlibc
3755
3756 : see if setpgrp exists
3757 set setpgrp d_setpgrp
3758 eval $inlibc
3759
3760 : see which flavor of setpgrp is in use
3761 case "$d_setpgrp" in
3762 "$define")
3763         echo " "
3764         $cat >set.c <<EOP
3765 main()
3766 {
3767         if (getuid() == 0) {
3768                 printf("(I see you are running Configure as super-user...)\n");
3769                 setuid(1);
3770         }
3771         if (-1 == setpgrp(1, 1))
3772                 exit(1);
3773         exit(0);
3774 }
3775 EOP
3776         if $cc $ccflags -o set set.c $ldflags $libs >/dev/null 2>&1; then
3777                 ./set 2>/dev/null
3778                 case $? in
3779                 0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
3780                         val="$undef";;
3781                 *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
3782                         val="$define";;
3783                 esac
3784         else
3785                 if ./usg; then
3786                         xxx="USG one, i.e. you use setpgrp()."
3787                         val="$undef"
3788                 else
3789                         xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
3790                         val="$define"
3791                 fi
3792                 echo "Assuming your setpgrp is a $xxx" >&4
3793         fi
3794         ;;
3795 *) val="$undef";;
3796 esac
3797 set d_bsdpgrp
3798 eval $setvar
3799 $rm -f set set.c
3800
3801 : see if bzero exists
3802 set bzero d_bzero
3803 eval $inlibc
3804
3805 : check for length of integer
3806 echo " "
3807 case "$intsize" in
3808 '')
3809         echo "Checking to see how big your integers are..." >&4
3810         $cat >try.c <<'EOCP'
3811 #include <stdio.h>
3812 main()
3813 {
3814         printf("%d\n", sizeof(int));
3815 }
3816 EOCP
3817         if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
3818                 dflt=`./try`
3819         else
3820                 dflt='4'
3821                 echo "(I can't seem to compile the test program.  Guessing...)"
3822         fi
3823         ;;
3824 *)
3825         dflt="$intsize"
3826         ;;
3827 esac
3828 rp="What is the size of an integer (in bytes)?"
3829 . ./myread
3830 intsize="$ans"
3831 $rm -f try.c try
3832
3833 : see if signal is declared as pointer to function returning int or void
3834 echo " "
3835 xxx=`./findhdr signal.h`
3836 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
3837 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
3838         echo "You have int (*signal())() instead of void." >&4
3839         val="$undef"
3840 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
3841         echo "You have void (*signal())() instead of int." >&4
3842         val="$define"
3843 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
3844         echo "You have int (*signal())() instead of void." >&4
3845         val="$undef"
3846 else
3847         case "$d_voidsig" in
3848         '')
3849         echo "I can't determine whether signal handler returns void or int..." >&4
3850                 dflt=void
3851                 rp="What type does your signal handler return?"
3852                 . ./myread
3853                 case "$ans" in
3854                 v*) val="$define";;
3855                 *) val="$undef";;
3856                 esac;;
3857         "$define")
3858                 echo "As you already told me, signal handler returns void." >&4;;
3859         *)
3860                 echo "As you already told me, signal handler returns int." >&4;;
3861         esac
3862 fi
3863 set d_voidsig
3864 eval $setvar
3865 case "$d_voidsig" in
3866 "$define") signal_t="void";;
3867 *) signal_t="int";;
3868 esac
3869 $rm -f $$.tmp
3870
3871 : check for ability to cast large floats to 32-bit ints.
3872 echo " "
3873 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
3874 if $test "$intsize" -eq 4; then
3875         xxx=int
3876 else
3877         xxx=long
3878 fi
3879 $cat >try.c <<EOCP
3880 #include <sys/types.h>
3881 #include <signal.h>
3882 $signal_t blech() { exit(3); }
3883 main()
3884 {
3885         $xxx i32;
3886         double f;
3887         int result = 0;
3888         signal(SIGFPE, blech);
3889
3890         f = (double) 0x7fffffff;
3891         f = 10 * f;
3892         i32  = ($xxx) f;
3893
3894         if (i32 != ($xxx) f)
3895                 result |= 1;
3896         exit(result);
3897 }
3898 EOCP
3899 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3900         ./try
3901         yyy=$?
3902 else
3903         echo "(I can't seem to compile the test program--assuming it can't)"
3904         yyy=1
3905 fi
3906 case "$yyy" in
3907 0)      val="$define"
3908         echo "Yup, it can."
3909         ;;
3910 *)      val="$undef"
3911         echo "Nope, it can't."
3912         ;;
3913 esac
3914 set d_casti32
3915 eval $setvar
3916 $rm -f try try.*
3917
3918 : check for ability to cast negative floats to unsigned
3919 echo " "
3920 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
3921 $cat >try.c <<EOCP
3922 #include <sys/types.h>
3923 #include <signal.h>
3924 $signal_t blech() { exit(7); }
3925 $signal_t blech_in_list() { exit(4); }
3926 unsigned long dummy_long(p) unsigned long p; { return p; }
3927 unsigned int dummy_int(p) unsigned int p; { return p; }
3928 unsigned short dummy_short(p) unsigned short p; { return p; }
3929 main()
3930 {
3931         double f = -123.;
3932         unsigned long along;
3933         unsigned int aint;
3934         unsigned short ashort;
3935         int result = 0;
3936
3937         signal(SIGFPE, blech);
3938         along = (unsigned long)f;
3939         aint = (unsigned int)f;
3940         ashort = (unsigned short)f;
3941         if (along != (unsigned long)-123)
3942                 result |= 1;
3943         if (aint != (unsigned int)-123)
3944                 result |= 1;
3945         if (ashort != (unsigned short)-123)
3946                 result |= 1;
3947         f = (double)0x40000000;
3948         f = f + f;
3949         along = 0;
3950         along = (unsigned long)f;
3951         if (along != 0x80000000)
3952                 result |= 2;
3953         f -= 1.;
3954         along = 0;
3955         along = (unsigned long)f;
3956         if (along != 0x7fffffff)
3957                 result |= 1;
3958         f += 2.;
3959         along = 0;
3960         along = (unsigned long)f;
3961         if (along != 0x80000001)
3962                 result |= 2;
3963         if (result)
3964                 exit(result);
3965         signal(SIGFPE, blech_in_list);
3966         f = 123.;
3967         along = dummy_long((unsigned long)f);
3968         aint = dummy_int((unsigned int)f);
3969         ashort = dummy_short((unsigned short)f);
3970         if (along != (unsigned long)123)
3971                 result |= 4;
3972         if (aint != (unsigned int)123)
3973                 result |= 4;
3974         if (ashort != (unsigned short)123)
3975                 result |= 4;
3976         exit(result);
3977
3978 }
3979 EOCP
3980 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3981         ./try
3982         castflags=$?
3983 else
3984         echo "(I can't seem to compile the test program--assuming it can't)"
3985         castflags=7
3986 fi
3987 case "$castflags" in
3988 0)      val="$define"
3989         echo "Yup, it can."
3990         ;;
3991 *)      val="$undef"
3992         echo "Nope, it can't."
3993         ;;
3994 esac
3995 set d_castneg
3996 eval $setvar
3997 $rm -f try.*
3998
3999 : see if vprintf exists
4000 echo " "
4001 if set vprintf val -f d_vprintf; eval $csym; $val; then
4002         echo 'vprintf() found.' >&4
4003         val="$define"
4004         $cat >vprintf.c <<'EOF'
4005 #include <varargs.h>
4006
4007 main() { xxx("foo"); }
4008
4009 xxx(va_alist)
4010 va_dcl
4011 {
4012         va_list args;
4013         char buf[10];
4014
4015         va_start(args);
4016         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
4017 }
4018 EOF
4019         if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
4020                 echo "Your vsprintf() returns (int)." >&4
4021                 val2="$undef"
4022         else
4023                 echo "Your vsprintf() returns (char*)." >&4
4024                 val2="$define"
4025         fi
4026 else
4027         echo 'vprintf() NOT found.' >&4
4028                 val="$undef"
4029                 val2="$undef"
4030 fi
4031 set d_vprintf
4032 eval $setvar
4033 val=$val2
4034 set d_charvspr
4035 eval $setvar
4036
4037 : see if chown exists
4038 set chown d_chown
4039 eval $inlibc
4040
4041 : see if chroot exists
4042 set chroot d_chroot
4043 eval $inlibc
4044
4045 : see if chsize exists
4046 set chsize d_chsize
4047 eval $inlibc
4048
4049 : check for const keyword
4050 echo " "
4051 echo 'Checking to see if your C compiler knows about "const"...' >&4
4052 $cat >const.c <<'EOCP'
4053 typedef struct spug { int drokk; } spug;
4054 main()
4055 {
4056         const char *foo;
4057         const spug y;
4058 }
4059 EOCP
4060 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
4061         val="$define"
4062         echo "Yup, it does."
4063 else
4064         val="$undef"
4065         echo "Nope, it doesn't."
4066 fi
4067 set d_const
4068 eval $setvar
4069
4070 : see if crypt exists
4071 echo " "
4072 if set crypt val -f d_crypt; eval $csym; $val; then
4073         echo 'crypt() found.' >&4
4074         val="$define"
4075         cryptlib=''
4076 else
4077         cryptlib=`./loc Slibcrypt.a "" $xlibpth`
4078         if $test -z "$cryptlib"; then
4079                 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
4080         else
4081                 cryptlib=-lcrypt
4082         fi
4083         if $test -z "$cryptlib"; then
4084                 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
4085         else
4086                 cryptlib=-lcrypt
4087         fi
4088         if $test -z "$cryptlib"; then
4089                 cryptlib=`./loc libcrypt.a "" $libpth`
4090         else
4091                 cryptlib=-lcrypt
4092         fi
4093         if $test -z "$cryptlib"; then
4094                 echo 'crypt() NOT found.' >&4
4095                 val="$undef"
4096         else
4097                 val="$define"
4098         fi
4099 fi
4100 set d_crypt
4101 eval $setvar
4102
4103 : get csh whereabouts
4104 case "$csh" in
4105 'csh') val="$undef" ;;
4106 *) val="$define" ;;
4107 esac
4108 set d_csh
4109 eval $setvar
4110 full_csh=$csh
4111
4112 : see if cuserid exists
4113 set cuserid d_cuserid
4114 eval $inlibc
4115
4116 : define an alternate in-header-list? function
4117 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4118 cont=true; xxf="echo \"<\$1> found.\" >&4";
4119 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4120 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4121 esac;
4122 case $# in 4) instead=instead;; *) instead="at last";; esac;
4123 while $test "$cont"; do
4124         xxx=`./findhdr $1`
4125         var=$2; eval "was=\$$2";
4126         if $test "$xxx" && $test -r "$xxx";
4127         then eval $xxf;
4128         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4129                 cont="";
4130         else eval $xxnf;
4131         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4132         set $yyy; shift; shift; yyy=$@;
4133         case $# in 0) cont="";;
4134         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4135                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4136         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4137                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4138         esac;
4139 done;
4140 while $test "$yyy";
4141 do set $yyy; var=$2; eval "was=\$$2";
4142         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4143         set $yyy; shift; shift; yyy=$@;
4144 done'
4145
4146 : see if this is a limits.h system
4147 set limits.h i_limits
4148 eval $inhdr
4149
4150 : see if this is a float.h system
4151 set float.h i_float
4152 eval $inhdr
4153
4154 : See if number of significant digits in a double precision number is known
4155 echo " "
4156 $cat >dbl_dig.c <<EOM
4157 #$i_limits I_LIMITS
4158 #$i_float I_FLOAT
4159 #ifdef I_LIMITS
4160 #include <limits.h>
4161 #endif
4162 #ifdef I_FLOAT
4163 #include <float.h>
4164 #endif
4165 #ifdef DBL_DIG
4166 printf("Contains DBL_DIG");
4167 #endif
4168 EOM
4169 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
4170 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
4171         echo "DBL_DIG found." >&4
4172         val="$define"
4173 else
4174         echo "DBL_DIG NOT found." >&4
4175         val="$undef"
4176 fi
4177 $rm -f dbl_dig.?
4178 set d_dbl_dig
4179 eval $setvar
4180
4181 : see if difftime exists
4182 set difftime d_difftime
4183 eval $inlibc
4184
4185 : see if this is a dirent system
4186 echo " "
4187 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
4188         val="$define"
4189         echo "<dirent.h> found." >&4
4190 else
4191         val="$undef"
4192         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
4193                 echo "<sys/dir.h> found." >&4
4194                 echo " "
4195         else
4196                 xinc=`./findhdr sys/ndir.h`
4197         fi
4198         echo "<dirent.h> NOT found." >&4
4199 fi
4200 set i_dirent
4201 eval $setvar
4202
4203 : Look for type of directory structure.
4204 echo " "
4205 $cppstdin $cppflags $cppminus < "$xinc" > try.c
4206
4207 case "$direntrytype" in
4208 ''|' ')
4209         case "$i_dirent" in
4210         $define) guess1='struct dirent' ;;
4211         *) guess1='struct direct'  ;;
4212         esac
4213         ;;
4214 *)      guess1="$direntrytype"
4215         ;;
4216 esac
4217
4218 case "$guess1" in
4219 'struct dirent') guess2='struct direct' ;;
4220 *) guess2='struct dirent' ;;
4221 esac
4222                 
4223 if $contains "$guess1" try.c >/dev/null 2>&1; then
4224         direntrytype="$guess1"
4225         echo "Your directory entries are $direntrytype." >&4
4226 elif $contains "$guess2" try.c >/dev/null 2>&1; then
4227         direntrytype="$guess2"
4228         echo "Your directory entries seem to be $direntrytype." >&4
4229 else
4230         echo "I don't recognize your system's directory entries." >&4
4231         rp="What type is used for directory entries on this system?"
4232         dflt="$guess1"
4233         . ./myread
4234         direntrytype="$ans"
4235 fi
4236 $rm -f try.c
4237
4238
4239 : see if the directory entry stores field length
4240 echo " "
4241 $cppstdin $cppflags $cppminus < "$xinc" > try.c
4242 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
4243         echo "Good, your directory entry keeps length information in d_namlen." >&4
4244         val="$define"
4245 else
4246         echo "Your directory entry does not know about the d_namlen field." >&4
4247         val="$undef"
4248 fi
4249 set d_dirnamlen
4250 eval $setvar
4251 $rm -f try.c
4252
4253 : see if dlerror exists
4254 : On NetBSD and FreeBSD, dlerror might be available, but it is in 
4255 : /usr/lib/crt0.o, not in any of the libraries.  Therefore, do not
4256 : use the nm extraction, but use a real compile and link test instead.
4257 xxx_runnm="$runnm"
4258 runnm=false
4259 set dlerror d_dlerror
4260 eval $inlibc
4261 runnm="$xxx_runnm"
4262
4263 : see if dld is available
4264 set dld.h i_dld
4265 eval $inhdr
4266
4267 : see if dlopen exists
4268 : On NetBSD and FreeBSD, dlopen is available, but it is in 
4269 : /usr/lib/crt0.o, not in any of the libraries.  Therefore, do not
4270 : use the nm extraction, but use a real compile and link test instead.
4271 xxx_runnm="$runnm"
4272 runnm=false
4273 set dlopen d_dlopen
4274 eval $inlibc
4275 runnm="$xxx_runnm"
4276
4277 : determine which dynamic loading, if any, to compile in
4278 echo " "
4279 dldir="ext/DynaLoader"
4280 case "$usedl" in
4281 $define|y|true)
4282         dflt='y'
4283         usedl="$define"
4284         ;;
4285 $undef|n|false)
4286         dflt='n'
4287         usedl="$undef"
4288         ;;
4289 *) 
4290         dflt='n'
4291         case "$d_dlopen" in
4292             $define) dflt='y' ;;
4293         esac
4294         case "$i_dld" in
4295             $define) dflt='y' ;;
4296         esac
4297         : Does a dl_xxx.xs file exist for this operating system
4298         $test -f ../$dldir/dl_${osname}.xs && dflt='y'
4299         ;;
4300 esac
4301 rp="Do you wish to use dynamic loading?"
4302 . ./myread
4303 usedl="$ans"
4304 case "$ans" in
4305 y*) usedl="$define"
4306         case "$dlsrc" in
4307         '')
4308                 if $test -f ../$dldir/dl_${osname}.xs ; then
4309                         dflt="$dldir/dl_${osname}.xs"
4310                 elif $test "$d_dlopen" = "$define" ; then
4311                         dflt="$dldir/dl_dlopen.xs"
4312                 elif $test "$i_dld" = "$define" ; then
4313                         dflt="$dldir/dl_dld.xs"
4314                 else
4315                         dflt=''
4316                 fi
4317                 ;;
4318         *)      dflt="$dldir/$dlsrc"
4319                 ;;
4320         esac
4321     echo "The following dynamic loading files are available:"
4322         : Can not go over to $dldir because getfile has path hard-coded in.
4323     cd ..; ls -C $dldir/dl*.xs; cd UU
4324     rp="Source file to use for dynamic loading"
4325     fn="fne"
4326     . ./getfile
4327         usedl="$define"
4328         : emulate basename
4329         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
4330
4331     $cat << EOM
4332
4333 Some systems may require passing special flags to $cc -c to
4334 compile modules that will be used to create a shared library.
4335 To use no flags, say "none".
4336
4337 EOM
4338     case "$cccdlflags" in
4339     '') case "$gccversion" in
4340                 '') case "$osname" in
4341                         hpux)   dflt='+z' ;;
4342                         next)   dflt='none' ;;
4343                         solaris|svr4*|esix*) dflt='-Kpic' ;;
4344                         sunos)  dflt='-pic' ;;
4345                         *)      dflt='none' ;;
4346                     esac ;;
4347                 *)      dflt='-fpic' ;;
4348             esac ;;
4349     *)  dflt="$cccdlflags" ;;
4350     esac
4351     rp="Any special flags to pass to $cc -c to compile shared library modules?"
4352     . ./myread
4353     case "$ans" in
4354     none) cccdlflags=' ' ;;
4355     *) cccdlflags="$ans" ;;
4356     esac
4357
4358     cat << EOM
4359
4360 Some systems use ld to create libraries that can be dynamically loaded,
4361 while other systems (such as those using ELF) use $cc.
4362
4363 EOM
4364         case "$ld" in
4365         '')     $cat >try.c <<'EOM'
4366 /* Test for whether ELF binaries are produced */
4367 #include <fcntl.h>
4368 #include <stdlib.h>
4369 main() {
4370         char b[4];
4371         int i = open("a.out",O_RDONLY);
4372         if(i == -1) 
4373                 exit(1); /* fail */
4374         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
4375                 exit(0); /* succeed (yes, it's ELF) */
4376         else
4377                 exit(1); /* fail */
4378 }
4379 EOM
4380                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
4381                         cat <<EOM
4382 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
4383 EOM
4384                         dflt="$cc"
4385                 else
4386                         echo "I'll use ld to build dynamic libraries."
4387                         dflt='ld'
4388                 fi
4389                 rm -f try.c a.out
4390                 ;;
4391         *)      dflt="$ld"
4392                 ;;
4393         esac
4394
4395     rp="What command should be used to create dynamic libraries?"
4396     . ./myread
4397         ld="$ans"
4398
4399     cat << EOM
4400
4401 Some systems may require passing special flags to $ld to create a
4402 library that can be dynamically loaded.  If your ld flags include
4403 -L/other/path options to locate libraries outside your loader's normal
4404 search path, you may need to specify those -L options here as well.  To
4405 use no flags, say "none".
4406
4407 EOM
4408     case "$lddlflags" in
4409     '') case "$osname" in
4410                         hpux)  dflt='-b' ;;
4411                         linux)  dflt='-shared' ;;
4412                         next)  dflt='none' ;;
4413                         solaris) dflt='-G' ;;
4414                         sunos) dflt='-assert nodefinitions' ;;
4415                         svr4*|esix*) dflt="-G $ldflags" ;;
4416                 *)     dflt='none' ;;
4417                         esac
4418                         ;;
4419     *) dflt="$lddlflags" ;;
4420     esac
4421     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
4422     . ./myread
4423     case "$ans" in
4424     none) lddlflags=' ' ;;
4425     *) lddlflags="$ans" ;;
4426     esac
4427
4428         cat <<EOM
4429
4430 Some systems may require passing special flags to $cc to indicate that
4431 the resulting executable will use dynamic linking.  To use no flags,
4432 say "none".
4433
4434 EOM
4435     case "$ccdlflags" in
4436     '') case "$osname" in
4437                 hpux)   dflt='-Wl,-E' ;;
4438                 linux)  dflt='-rdynamic' ;;
4439                 next)   dflt='none' ;;
4440                 sunos)  dflt='none' ;;
4441                 *)      dflt='none' ;;
4442             esac ;;
4443     *)  dflt="$ccdlflags" ;;
4444     esac
4445     rp="Any special flags to pass to $cc to use dynamic loading?"
4446     . ./myread
4447     case "$ans" in
4448     none) ccdlflags=' ' ;;
4449     *) ccdlflags="$ans" ;;
4450     esac
4451     ;;
4452 *)  usedl="$undef"
4453         ld='ld'
4454     dlsrc='dl_none.xs'
4455     lddlflags=''
4456     ccdlflags=''
4457     ;;
4458 esac
4459
4460 val="$undef"
4461 case "$osname" in
4462 esix*|svr4*)
4463     case "$usedl" in
4464     $define)
4465         $cat <<EOM
4466
4467 System V Release 4 systems can support dynamic loading
4468 only if libperl is created as a shared library.
4469
4470 EOM
4471         val="$define"
4472         ;;
4473     esac ;;
4474 esac
4475 set d_shrplib; eval $setvar
4476 case "$d_shrplib" in
4477 $define)
4478     cat <<EOM >&4
4479
4480 Be sure to add the perl source directory to the LD_LIBRARY_PATH
4481 environment variable before running make:
4482     LD_LIBRARY_PATH=`cd ..;pwd`; export LD_LIBRARY_PATH
4483 or
4484     setenv LD_LIBRARY_PATH `cd ..;pwd`
4485
4486 EOM
4487 ;;
4488 esac
4489 case "$d_shrplib" in
4490 $define)
4491         case "$shrpdir" in
4492         "")     dflt="$archlib/CORE";;
4493         *)      dflt="$shrpdir";;
4494         esac
4495         rp="What directory should we install the shared libperl into?"
4496         fn="d~"
4497         . ./getfile
4498         shrpdir="$ans"
4499         ;;
4500 *)      shrpdir='none'
4501         ;;
4502 esac
4503
4504 : see if dlfcn is available
4505 set dlfcn.h i_dlfcn
4506 eval $inhdr
4507
4508 case "$usedl" in
4509 $define|y|true)
4510         $cat << EOM
4511
4512 On a few systems, the dynamically loaded modules that perl generates and uses
4513 will need a different extension then shared libs. The default will probably
4514 be appropriate.
4515
4516 EOM
4517         case "$dlext" in
4518         '')     dflt="$so" ;;
4519         *)      dflt="$dlext" ;;
4520         esac
4521         rp='What is the extension of dynamically loaded modules'
4522         . ./myread
4523         dlext="$ans"
4524         ;;
4525 *)
4526         dlext="none"
4527         ;;
4528 esac
4529
4530 : Check if dlsym need a leading underscore
4531 echo " "
4532 val="$undef"
4533
4534 case "$dlsrc" in
4535 dl_dlopen.xs)
4536         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
4537         $cat >dyna.c <<'EOM'
4538 fred () { }
4539 EOM
4540
4541 $cat >fred.c<<EOM
4542
4543 #include <stdio.h>
4544 #$i_dlfcn I_DLFCN
4545 #ifdef I_DLFCN
4546 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
4547 #else
4548 #include <sys/types.h>
4549 #include <nlist.h>
4550 #include <link.h>
4551 #endif
4552
4553 extern int fred() ;
4554
4555 main()
4556 {
4557     void * handle ;
4558     void * symbol ;
4559 #ifndef RTLD_LAZY
4560     int mode = 1 ;
4561 #else
4562     int mode = RTLD_LAZY ;
4563 #endif
4564     handle = dlopen("./dyna.$dlext", mode) ;
4565     if (handle == NULL) {
4566         printf ("1\n") ;
4567             exit(0);
4568     }
4569     symbol = dlsym(handle, "fred") ;
4570     if (symbol == NULL) {
4571                 /* try putting a leading underscore */
4572         symbol = dlsym(handle, "_fred") ;
4573         if (symbol == NULL) {
4574             printf ("2\n") ;
4575                 exit(0);
4576                 }
4577         printf ("3\n") ;
4578     }
4579     else
4580         printf ("4\n") ;
4581         exit(0);
4582 }
4583 EOM
4584         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
4585                 $ld $lddlflags -o dyna.$dlext dyna.o > /dev/null 2>&1 && 
4586                 $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then
4587                 xxx=`./fred`
4588                 case $xxx in
4589                 1)      echo "Test program failed using dlopen." >&4
4590                         echo "Perhaps you should not use dynamic loading." >&4;;
4591                 2)      echo "Test program failed using dlsym." >&4
4592                         echo "Perhaps you should not use dynamic loading." >&4;;
4593                 3)      echo "dlsym needs a leading underscore" >&4
4594                         val="$define" ;;
4595                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
4596                 esac
4597         else
4598                 echo "I can't compile and run the test program." >&4
4599         fi
4600         ;;
4601 esac
4602                 
4603 $rm -f fred fred.? dyna.$dlext dyna.?
4604
4605 set d_dlsymun
4606 eval $setvar
4607
4608 : see if setuid scripts can be secure
4609 $cat <<EOM
4610
4611 Some kernels have a bug that prevents setuid #! scripts from being
4612 secure.  Some sites have disabled setuid #! scripts because of this.
4613
4614 First let's decide if your kernel supports secure setuid #! scripts.
4615 (If setuid #! scripts would be secure but have been disabled anyway,
4616 don't say that they are secure if asked.)
4617
4618 EOM
4619
4620 val="$undef"
4621 if $test -d /dev/fd; then
4622         echo "#!$ls" >reflect
4623         chmod +x,u+s reflect
4624         ./reflect >flect 2>&1
4625         if $contains "/dev/fd" flect >/dev/null; then
4626                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4627                 val="$define"
4628         else
4629                 $cat <<EOM
4630 If you are not sure if they are secure, I can check but I'll need a
4631 username and password different from the one you are using right now.
4632 If you don't have such a username or don't want me to test, simply
4633 enter 'none'.
4634
4635 EOM
4636                 rp='Other username to test security of setuid scripts with?'
4637                 dflt='none'
4638                 . ./myread
4639                 case "$ans" in
4640                 n|none)
4641                         case "$d_suidsafe" in
4642                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4643                                 dflt=n;;
4644                         "$undef")
4645                                 echo "Well, the $hint value is *not* secure." >&4
4646                                 dflt=n;;
4647                         *)      echo "Well, the $hint value *is* secure." >&4
4648                                 dflt=y;;
4649                         esac
4650                         ;;
4651                 *)
4652                         $rm -f reflect flect
4653                         echo "#!$ls" >reflect
4654                         chmod +x,u+s reflect
4655                         echo >flect
4656                         chmod a+w flect
4657                         echo '"su" will (probably) prompt you for '"$ans's password."
4658                         su $ans -c './reflect >flect'
4659                         if $contains "/dev/fd" flect >/dev/null; then
4660                                 echo "Okay, it looks like setuid scripts are secure." >&4
4661                                 dflt=y
4662                         else
4663                                 echo "I don't think setuid scripts are secure." >&4
4664                                 dflt=n
4665                         fi
4666                         ;;
4667                 esac
4668                 rp='Does your kernel have *secure* setuid scripts?'
4669                 . ./myread
4670                 case "$ans" in
4671                 [yY]*)  val="$define";;
4672                 *)      val="$undef";;
4673                 esac
4674         fi
4675 else
4676         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4677         val="$undef"
4678 fi
4679 set d_suidsafe
4680 eval $setvar
4681
4682 $rm -f reflect flect
4683
4684 : now see if they want to do setuid emulation
4685 echo " "
4686 val="$undef"
4687 case "$d_suidsafe" in
4688 "$define")
4689         val="$undef"
4690         echo "No need to emulate SUID scripts since they are secure here." >& 4
4691         ;;
4692 *)
4693         $cat <<EOM
4694 Some systems have disabled setuid scripts, especially systems where
4695 setuid scripts cannot be secure.  On systems where setuid scripts have
4696 been disabled, the setuid/setgid bits on scripts are currently
4697 useless.  It is possible for $package to detect those bits and emulate
4698 setuid/setgid in a secure fashion.  This emulation will only work if
4699 setuid scripts have been disabled in your kernel.
4700
4701 EOM
4702         case "$d_dosuid" in
4703         "$define") dflt=y ;;
4704         *) dflt=n ;;
4705         esac
4706         rp="Do you want to do setuid/setgid emulation?"
4707         . ./myread
4708         case "$ans" in
4709         [yY]*)  val="$define";;
4710         *)      val="$undef";;
4711         esac
4712         ;;
4713 esac
4714 set d_dosuid
4715 eval $setvar
4716
4717 : see if dup2 exists
4718 set dup2 d_dup2
4719 eval $inlibc
4720
4721 : see if fchmod exists
4722 set fchmod d_fchmod
4723 eval $inlibc
4724
4725 : see if fchown exists
4726 set fchown d_fchown
4727 eval $inlibc
4728
4729 : see if this is an fcntl system
4730 set fcntl d_fcntl
4731 eval $inlibc
4732
4733 : see if fgetpos exists
4734 set fgetpos d_fgetpos
4735 eval $inlibc
4736
4737 : see if we can have long filenames
4738 echo " "
4739 rmlist="$rmlist /tmp/cf$$"
4740 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
4741 first=123456789abcdef
4742 second=/tmp/cf$$/$first
4743 $rm -f $first $second
4744 if (echo hi >$first) 2>/dev/null; then
4745         if $test -f 123456789abcde; then
4746                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
4747                 val="$undef"
4748         else
4749                 if (echo hi >$second) 2>/dev/null; then
4750                         if $test -f /tmp/cf$$/123456789abcde; then
4751                                 $cat <<'EOM'
4752 That's peculiar... You can have filenames longer than 14 characters, but only
4753 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
4754 I shall consider your system cannot support long filenames at all.
4755 EOM
4756                                 val="$undef"
4757                         else
4758                                 echo 'You can have filenames longer than 14 characters.' >&4
4759                                 val="$define"
4760                         fi
4761                 else
4762                         $cat <<'EOM'
4763 How confusing! Some of your filesystems are sane enough to allow filenames
4764 longer than 14 characters but some others like /tmp can't even think about them.
4765 So, for now on, I shall assume your kernel does not allow them at all.
4766 EOM
4767                         val="$undef"
4768                 fi
4769         fi
4770 else
4771         $cat <<'EOM'
4772 You can't have filenames longer than 14 chars.  You can't even think about them!
4773 EOM
4774         val="$undef"
4775 fi 
4776 set d_flexfnam
4777 eval $setvar
4778 $rm -rf /tmp/cf$$ 123456789abcde*
4779
4780 : see if flock exists
4781 set flock d_flock
4782 eval $inlibc
4783
4784 : see if fork exists
4785 set fork d_fork
4786 eval $inlibc
4787
4788 : see if pathconf exists
4789 set pathconf d_pathconf
4790 eval $inlibc
4791
4792 : see if fpathconf exists
4793 set fpathconf d_fpathconf
4794 eval $inlibc
4795
4796 : see if fsetpos exists
4797 set fsetpos d_fsetpos
4798 eval $inlibc
4799
4800 : see if gethostent exists
4801 set gethostent d_gethent
4802 eval $inlibc
4803
4804 : see if getlogin exists
4805 set getlogin d_getlogin
4806 eval $inlibc
4807
4808 : see if getpgrp exists
4809 set getpgrp d_getpgrp
4810 eval $inlibc
4811
4812 : see if getpgrp2 exists
4813 set getpgrp2 d_getpgrp2
4814 eval $inlibc
4815
4816 : see if getppid exists
4817 set getppid d_getppid
4818 eval $inlibc
4819
4820 : see if getpriority exists
4821 set getpriority d_getprior
4822 eval $inlibc
4823
4824 : see if this is a netinet/in.h or sys/in.h system
4825 set netinet/in.h i_niin sys/in.h i_sysin
4826 eval $inhdr
4827
4828 : see if htonl --and friends-- exists
4829 val=''
4830 set htonl val
4831 eval $inlibc
4832
4833 : Maybe they are macros.
4834 case "$val" in
4835 $undef)
4836         $cat >htonl.c <<EOM
4837 #include <stdio.h>
4838 #include <sys/types.h>
4839 #$i_niin I_NETINET_IN
4840 #$i_sysin I_SYS_IN
4841 #ifdef I_NETINET_IN
4842 #include <netinet/in.h>
4843 #endif
4844 #ifdef I_SYS_IN
4845 #include <sys/in.h>
4846 #endif
4847 #ifdef htonl
4848 printf("Defined as a macro.");
4849 #endif
4850 EOM
4851         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
4852         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
4853                 val="$define"
4854                 echo "But it seems to be defined as a macro." >&4
4855         fi
4856         $rm -f htonl.?
4857         ;;
4858 esac
4859 set d_htonl
4860 eval $setvar
4861
4862 : see which of string.h or strings.h is needed
4863 echo " "
4864 strings=`./findhdr string.h`
4865 if $test "$strings" && $test -r "$strings"; then
4866         echo "Using <string.h> instead of <strings.h>." >&4
4867         val="$define"
4868 else
4869         val="$undef"
4870         strings=`./findhdr strings.h`
4871         if $test "$strings" && $test -r "$strings"; then
4872                 echo "Using <strings.h> instead of <string.h>." >&4
4873         else
4874                 echo "No string header found -- You'll surely have problems." >&4
4875         fi
4876 fi
4877 set i_string
4878 eval $setvar
4879 case "$i_string" in
4880 "$undef") strings=`./findhdr strings.h`;;
4881 *)        strings=`./findhdr string.h`;;
4882 esac
4883
4884 : index or strchr
4885 echo " "
4886 if set index val -f; eval $csym; $val; then
4887         if set strchr val -f d_strchr; eval $csym; $val; then
4888                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
4889                         val="$define"
4890                         vali="$undef"
4891                         echo "strchr() found." >&4
4892                 else
4893                         val="$undef"
4894                         vali="$define"
4895                         echo "index() found." >&4
4896                 fi
4897         else
4898                 val="$undef"
4899                 vali="$define"
4900                 echo "index() found." >&4
4901         fi
4902 else
4903         if set strchr val -f d_strchr; eval $csym; $val; then
4904                 val="$define"
4905                 vali="$undef"
4906                 echo "strchr() found." >&4
4907         else
4908                 echo "No index() or strchr() found!" >&4
4909                 val="$undef"
4910                 vali="$undef"
4911         fi
4912 fi
4913 set d_strchr; eval $setvar
4914 val="$vali"
4915 set d_index; eval $setvar
4916
4917 : Look for isascii
4918 echo " "
4919 $cat >isascii.c <<'EOCP'
4920 #include <stdio.h>
4921 #include <ctype.h>
4922 main() {
4923         int c = 'A';
4924         if (isascii(c))
4925                 exit(0);
4926         else
4927                 exit(1);
4928 }
4929 EOCP
4930 if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then
4931         echo "isascii() found." >&4
4932         val="$define"
4933 else
4934         echo "isascii() NOT found." >&4
4935         val="$undef"
4936 fi
4937 set d_isascii
4938 eval $setvar
4939 $rm -f isascii*
4940
4941 : see if killpg exists
4942 set killpg d_killpg
4943 eval $inlibc
4944
4945 : see if link exists
4946 set link d_link
4947 eval $inlibc
4948
4949 : see if localeconv exists
4950 set localeconv d_locconv
4951 eval $inlibc
4952
4953 : see if lockf exists
4954 set lockf d_lockf
4955 eval $inlibc
4956
4957 : see if lstat exists
4958 set lstat d_lstat
4959 eval $inlibc
4960
4961 : see if mblen exists
4962 set mblen d_mblen
4963 eval $inlibc
4964
4965 : see if mbstowcs exists
4966 set mbstowcs d_mbstowcs
4967 eval $inlibc
4968
4969 : see if mbtowc exists
4970 set mbtowc d_mbtowc
4971 eval $inlibc
4972
4973 : see if memcmp exists
4974 set memcmp d_memcmp
4975 eval $inlibc
4976
4977 : see if memcpy exists
4978 set memcpy d_memcpy
4979 eval $inlibc
4980
4981 : see if memmove exists
4982 set memmove d_memmove
4983 eval $inlibc
4984
4985 : see if memset exists
4986 set memset d_memset
4987 eval $inlibc
4988
4989 : see if mkdir exists
4990 set mkdir d_mkdir
4991 eval $inlibc
4992
4993 : see if mkfifo exists
4994 set mkfifo d_mkfifo
4995 eval $inlibc
4996
4997 : see if mktime exists
4998 set mktime d_mktime
4999 eval $inlibc
5000
5001 : see if msgctl exists
5002 set msgctl d_msgctl
5003 eval $inlibc
5004
5005 : see if msgget exists
5006 set msgget d_msgget
5007 eval $inlibc
5008
5009 : see if msgsnd exists
5010 set msgsnd d_msgsnd
5011 eval $inlibc
5012
5013 : see if msgrcv exists
5014 set msgrcv d_msgrcv
5015 eval $inlibc
5016
5017 : see how much of the 'msg*(2)' library is present.
5018 h_msg=true
5019 echo " "
5020 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
5021 *"$undef"*) h_msg=false;;
5022 esac
5023 : we could also check for sys/ipc.h ...
5024 if $h_msg && $test `./findhdr sys/msg.h`; then
5025         echo "You have the full msg*(2) library." >&4
5026         val="$define"
5027 else
5028         echo "You don't have the full msg*(2) library." >&4
5029         val="$undef"
5030 fi
5031 set d_msg
5032 eval $setvar
5033
5034 : see if this is a malloc.h system
5035 set malloc.h i_malloc
5036 eval $inhdr
5037
5038 : see if stdlib is available
5039 set stdlib.h i_stdlib
5040 eval $inhdr
5041
5042 : determine which malloc to compile in
5043 echo " "
5044 case "$usemymalloc" in
5045 ''|y*|true)     dflt='y' ;;
5046 n*|false)       dflt='n' ;;
5047 *)      dflt="$usemymalloc" ;;
5048 esac
5049 rp="Do you wish to attempt to use the malloc that comes with $package?"
5050 . ./myread
5051 usemymalloc="$ans"
5052 case "$ans" in
5053 y*|true)
5054         usemymalloc='y'
5055         mallocsrc='malloc.c'
5056         mallocobj='malloc.o'
5057         d_mymalloc="$define"
5058         case "$libs" in
5059         *-lmalloc*)
5060                 : Remove malloc from list of libraries to use
5061                 echo "Removing unneeded -lmalloc from library list" >&4
5062                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5063                 shift
5064                 libs="$*"
5065                 echo "libs = $libs" >&4
5066                 ;;
5067         esac
5068         ;;
5069 *)
5070         usemymalloc='n'
5071         mallocsrc=''
5072         mallocobj=''
5073         d_mymalloc="$undef"
5074         ;;
5075 esac
5076
5077 : compute the return types of malloc and free
5078 echo " "
5079 $cat >malloc.c <<END
5080 #$i_malloc I_MALLOC
5081 #$i_stdlib I_STDLIB
5082 #include <stdio.h>
5083 #include <sys/types.h>
5084 #ifdef I_MALLOC
5085 #include <malloc.h>
5086 #endif
5087 #ifdef I_STDLIB
5088 #include <stdlib.h>
5089 #endif
5090 #ifdef TRY_MALLOC
5091 void *malloc();
5092 #endif
5093 #ifdef TRY_FREE
5094 void free();
5095 #endif
5096 END
5097 case "$malloctype" in
5098 '')
5099         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5100                 malloctype='void *'
5101         else
5102                 malloctype='char *'
5103         fi
5104         ;;
5105 esac
5106 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5107
5108 case "$freetype" in
5109 '')
5110         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5111                 freetype='void'
5112         else
5113                 freetype='int'
5114         fi
5115         ;;
5116 esac
5117 echo "Your system uses $freetype free(), it would seem." >&4
5118 $rm -f malloc.[co]
5119 : see if nice exists
5120 set nice d_nice
5121 eval $inlibc
5122
5123 : Locate the flags for 'open()'
5124 echo " "
5125 $cat >open3.c <<'EOCP'
5126 #include <sys/types.h>
5127 #ifdef I_FCNTL
5128 #include <fcntl.h>
5129 #endif
5130 #ifdef I_SYS_FILE
5131 #include <sys/file.h>
5132 #endif
5133 main() {
5134         if(O_RDONLY);
5135 #ifdef O_TRUNC
5136         exit(0);
5137 #else
5138         exit(1);
5139 #endif
5140 }
5141 EOCP
5142 : check sys/file.h first to get FREAD on Sun
5143 if $test `./findhdr sys/file.h` && \
5144                 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
5145         h_sysfile=true;
5146         echo "<sys/file.h> defines the O_* constants..." >&4
5147         if ./open3; then
5148                 echo "and you have the 3 argument form of open()." >&4
5149                 val="$define"
5150         else
5151                 echo "but not the 3 argument form of open().  Oh, well." >&4
5152                 val="$undef"
5153         fi
5154 elif $test `./findhdr fcntl.h` && \
5155                 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
5156         h_fcntl=true;
5157         echo "<fcntl.h> defines the O_* constants..." >&4
5158         if ./open3; then
5159                 echo "and you have the 3 argument form of open()." >&4
5160                 val="$define"
5161         else
5162                 echo "but not the 3 argument form of open().  Oh, well." >&4
5163                 val="$undef"
5164         fi
5165 else
5166         val="$undef"
5167         echo "I can't find the O_* constant definitions!  You got problems." >&4
5168 fi
5169 set d_open3
5170 eval $setvar
5171 $rm -f open3*
5172
5173 : see if pause exists
5174 set pause d_pause
5175 eval $inlibc
5176
5177 : see if pipe exists
5178 set pipe d_pipe
5179 eval $inlibc
5180
5181 : see if this is a pwd system
5182 echo " "
5183 xxx=`./findhdr pwd.h`
5184 if $test "$xxx"; then
5185         i_pwd="$define"
5186         echo "<pwd.h> found." >&4
5187         $cppstdin $cppflags $cppminus < $xxx >$$.h
5188         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
5189                 d_pwquota="$define"
5190         else
5191                 d_pwquota="$undef"
5192         fi
5193         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
5194                 d_pwage="$define"
5195         else
5196                 d_pwage="$undef"
5197         fi
5198         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
5199                 d_pwchange="$define"
5200         else
5201                 d_pwchange="$undef"
5202         fi
5203         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
5204                 d_pwclass="$define"
5205         else
5206                 d_pwclass="$undef"
5207         fi
5208         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
5209                 d_pwexpire="$define"
5210         else
5211                 d_pwexpire="$undef"
5212         fi
5213         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
5214                 d_pwcomment="$define"
5215         else
5216                 d_pwcomment="$undef"
5217         fi
5218         $rm -f $$.h
5219 else
5220         i_pwd="$undef"
5221         d_pwquota="$undef"
5222         d_pwage="$undef"
5223         d_pwchange="$undef"
5224         d_pwclass="$undef"
5225         d_pwexpire="$undef"
5226         d_pwcomment="$undef"
5227         echo "<pwd.h> NOT found." >&4
5228 fi
5229
5230 : see if readdir and friends exist
5231 set readdir d_readdir
5232 eval $inlibc
5233 set seekdir d_seekdir
5234 eval $inlibc
5235 set telldir d_telldir
5236 eval $inlibc
5237 set rewinddir d_rewinddir
5238 eval $inlibc
5239
5240 : see if readlink exists
5241 set readlink d_readlink
5242 eval $inlibc
5243
5244 : see if rename exists
5245 set rename d_rename
5246 eval $inlibc
5247
5248 : see if rmdir exists
5249 set rmdir d_rmdir
5250 eval $inlibc
5251
5252 : can bcopy handle overlapping blocks?
5253 val="$undef"
5254 case "$d_bcopy" in
5255 "$define")
5256         echo " "
5257         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
5258         $cat >foo.c <<'EOCP'
5259 main()
5260 {
5261 char buf[128], abc[128];
5262 char *b;
5263 int len;
5264 int off;
5265 int align;
5266
5267 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
5268
5269 for (align = 7; align >= 0; align--) {
5270         for (len = 36; len; len--) {
5271                 b = buf+align;
5272                 bcopy(abc, b, len);
5273                 for (off = 1; off <= len; off++) {
5274                         bcopy(b, b+off, len);
5275                         bcopy(b+off, b, len);
5276                         if (bcmp(b, abc, len))
5277                                 exit(1);
5278                 }
5279         }
5280 }
5281 exit(0);
5282 }
5283 EOCP
5284         if $cc foo.c -o safebcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then
5285                 if ./safebcpy 2>/dev/null; then
5286                         echo "Yes, it can."
5287                         val="$define"
5288                 else
5289                         echo "It can't, sorry."
5290                 fi
5291         else
5292                 echo "(I can't compile the test program, so we'll assume not...)"
5293         fi
5294         ;;
5295 esac
5296 $rm -f foo.* safebcpy core
5297 set d_safebcpy
5298 eval $setvar
5299
5300 : can memcpy handle overlapping blocks?
5301 val="$undef"
5302 case "$d_memcpy" in
5303 "$define")
5304         echo " "
5305         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
5306         $cat >foo.c <<'EOCP'
5307 main()
5308 {
5309 char buf[128], abc[128];
5310 char *b;
5311 int len;
5312 int off;
5313 int align;
5314
5315 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
5316
5317 for (align = 7; align >= 0; align--) {
5318         for (len = 36; len; len--) {
5319                 b = buf+align;
5320                 memcpy(b, abc, len);
5321                 for (off = 1; off <= len; off++) {
5322                         memcpy(b+off, b, len);
5323                         memcpy(b, b+off, len);
5324                         if (memcmp(b, abc, len))
5325                                 exit(1);
5326                 }
5327         }
5328 }
5329 exit(0);
5330 }
5331 EOCP
5332         if $cc foo.c -o safemcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then
5333                 if ./safemcpy 2>/dev/null; then
5334                         echo "Yes, it can."
5335                         val="$define"
5336                 else
5337                         echo "It can't, sorry."
5338                 fi
5339         else
5340                 echo "(I can't compile the test program, so we'll assume not...)"
5341         fi
5342         ;;
5343 esac
5344 $rm -f foo.* safemcpy core
5345 set d_safemcpy
5346 eval $setvar
5347
5348 : see if select exists
5349 set select d_select
5350 eval $inlibc
5351
5352 : see if semctl exists
5353 set semctl d_semctl
5354 eval $inlibc
5355
5356 : see if semget exists
5357 set semget d_semget
5358 eval $inlibc
5359
5360 : see if semop exists
5361 set semop d_semop
5362 eval $inlibc
5363
5364 : see how much of the 'sem*(2)' library is present.
5365 h_sem=true
5366 echo " "
5367 case "$d_semctl$d_semget$d_semop" in
5368 *"$undef"*) h_sem=false;;
5369 esac
5370 : we could also check for sys/ipc.h ...
5371 if $h_sem && $test `./findhdr sys/sem.h`; then
5372         echo "You have the full sem*(2) library." >&4
5373         val="$define"
5374 else
5375         echo "You don't have the full sem*(2) library." >&4
5376         val="$undef"
5377 fi
5378 set d_sem
5379 eval $setvar
5380
5381 : see if setegid exists
5382 set setegid d_setegid
5383 eval $inlibc
5384
5385 : see if seteuid exists
5386 set seteuid d_seteuid
5387 eval $inlibc
5388
5389 : see if setlinebuf exists
5390 set setlinebuf d_setlinebuf
5391 eval $inlibc
5392
5393 : see if setlocale exists
5394 set setlocale d_setlocale
5395 eval $inlibc
5396
5397 : see if setpgid exists
5398 set setpgid d_setpgid
5399 eval $inlibc
5400
5401 : see if setpgrp2 exists
5402 set setpgrp2 d_setpgrp2
5403 eval $inlibc
5404
5405 : see if setpriority exists
5406 set setpriority d_setprior
5407 eval $inlibc
5408
5409 : see if setregid exists
5410 set setregid d_setregid
5411 eval $inlibc
5412 set setresgid d_setresgid
5413 eval $inlibc
5414
5415 : see if setreuid exists
5416 set setreuid d_setreuid
5417 eval $inlibc
5418 set setresuid d_setresuid
5419 eval $inlibc
5420
5421 : see if setrgid exists
5422 set setrgid d_setrgid
5423 eval $inlibc
5424
5425 : see if setruid exists
5426 set setruid d_setruid
5427 eval $inlibc
5428
5429 : see if setsid exists
5430 set setsid d_setsid
5431 eval $inlibc
5432
5433 : see if shmctl exists
5434 set shmctl d_shmctl
5435 eval $inlibc
5436
5437 : see if shmget exists
5438 set shmget d_shmget
5439 eval $inlibc
5440
5441 : see if shmat exists
5442 set shmat d_shmat
5443 eval $inlibc
5444 : see what shmat returns
5445 case "$d_shmat" in
5446 "$define")
5447         $cat >shmat.c <<'END'
5448 #include <sys/shm.h>
5449 void *shmat();
5450 END
5451         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
5452                 shmattype='void *'
5453         else
5454                 shmattype='char *'
5455         fi
5456         echo "and it returns ($shmattype)." >&4
5457         : see if a prototype for shmat is available
5458         $cppstdin $cppflags $cppminus < $usrinc/sys/shm.h > shmat.c 2>/dev/null
5459         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
5460                 val="$define"
5461         else
5462                 val="$undef"
5463         fi
5464         $rm -f shmat.[co]
5465         ;;
5466 *)
5467         val="$undef"
5468         ;;
5469 esac
5470 set d_shmatprototype
5471 eval $setvar
5472
5473 : see if shmdt exists
5474 set shmdt d_shmdt
5475 eval $inlibc
5476
5477 : see how much of the 'shm*(2)' library is present.
5478 h_shm=true
5479 echo " "
5480 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
5481 *"$undef"*) h_shm=false;;
5482 esac
5483 : we could also check for sys/ipc.h ...
5484 if $h_shm && $test `./findhdr sys/shm.h`; then
5485         echo "You have the full shm*(2) library." >&4
5486         val="$define"
5487 else
5488         echo "You don't have the full shm*(2) library." >&4
5489         val="$undef"
5490 fi
5491 set d_shm
5492 eval $setvar
5493
5494 : determine whether the user wants to include a site-specific library
5495 : in addition to privlib.
5496 $cat <<EOM
5497
5498 Some sites may wish to specify a local directory for $package
5499 to search by default in addition to $privlib.
5500 If you don't want to use such an additional directory, answer 'none'.
5501
5502 EOM
5503 dflt=none
5504 fn=d~+n
5505 rp='Local directory for additional library files?'
5506 . ./getfile
5507 if $test "X$sitelibexp" != "X$ansexp"; then
5508         installsitelib=''
5509 fi
5510 sitelib="$ans"
5511 sitelibexp="$ansexp"
5512 if $afs; then
5513         $cat <<EOM
5514
5515 Since you are running AFS, I need to distinguish the directory in which
5516 private files reside from the directory in which they are installed (and from
5517 which they are presumably copied to the former directory by occult means).
5518
5519 EOM
5520         case "$installsitelib" in
5521         '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
5522         *) dflt="$installsitelib";;
5523         esac
5524         fn=de~
5525         rp='Where will additional local files be installed?'
5526         . ./getfile
5527         installsitelib="$ans"
5528 else
5529         installsitelib="$sitelibexp"
5530 fi
5531
5532 case "$sitelibexp" in
5533 ''|' ') d_sitelib=undef ;;
5534 *) d_sitelib=define ;;
5535 esac
5536
5537 socketlib=''
5538 sockethdr=''
5539 : see whether socket exists
5540 echo " "
5541 $echo $n "Hmm... $c" >&4
5542 if set socket val -f d_socket; eval $csym; $val; then
5543         echo "Looks like you have Berkeley networking support." >&4
5544         d_socket="$define"
5545         if set setsockopt val -f; eval $csym; $val; then
5546                 d_oldsock="$undef"
5547         else
5548                 echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
5549                 d_oldsock="$define"
5550         fi
5551 else
5552         if $contains socklib libc.list >/dev/null 2>&1; then
5553                 echo "Looks like you have Berkeley networking support." >&4
5554                 d_socket="$define"
5555                 : we will have to assume that it supports the 4.2 BSD interface
5556                 d_oldsock="$undef"
5557         else
5558                 echo "You don't have Berkeley networking in libc.a..." >&4
5559                 if test -f /usr/lib/libnet.a; then
5560                         ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) ||  \
5561                         ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list
5562                         if $contains socket libc.list >/dev/null 2>&1; then
5563                         echo "...but the Wollongong group seems to have hacked it in." >&4
5564                                 socketlib="-lnet"
5565                                 sockethdr="-I/usr/netinclude"
5566                                 d_socket="$define"
5567                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
5568                                         d_oldsock="$undef"
5569                                 else
5570                                         echo "...using the old 4.1c interface, rather than 4.2" >&4
5571                                         d_oldsock="$define"
5572                                 fi
5573                         else
5574                                 echo "or even in libnet.a, which is peculiar." >&4
5575                                 d_socket="$undef"
5576                                 d_oldsock="$undef"
5577                         fi
5578                 else
5579                         echo "or anywhere else I see." >&4
5580                         d_socket="$undef"
5581                         d_oldsock="$undef"
5582                 fi
5583         fi
5584 fi
5585
5586 : see if socketpair exists
5587 set socketpair d_sockpair
5588 eval $inlibc
5589
5590 : see if stat knows about block sizes
5591 echo " "
5592 xxx=`./findhdr sys/stat.h`
5593 if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
5594         if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
5595                 echo "Your stat() knows about block sizes." >&4
5596                 val="$define"
5597         else
5598                 echo "Your stat() doesn't know about block sizes." >&4
5599                 val="$undef"
5600         fi
5601 else
5602         echo "Your stat() doesn't know about block sizes." >&4
5603         val="$undef"
5604 fi
5605 set d_statblks
5606 eval $setvar
5607
5608 : see if _ptr and _cnt from stdio act std
5609 echo " "
5610 if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
5611         echo "(Looks like you have stdio.h from Linux.)"
5612         case "$stdio_ptr" in
5613         '') stdio_ptr='((fp)->_IO_read_ptr)';;
5614         esac
5615         case "$stdio_cnt" in
5616         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)';;
5617         esac
5618         case "$stdio_base" in
5619         '') stdio_base='((fp)->_IO_read_base)';;
5620         esac
5621         case "$stdio_bufsiz" in
5622         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base))';;
5623         esac
5624 else
5625         case "$stdio_ptr" in
5626         '') stdio_ptr='((fp)->_ptr)';;
5627         esac
5628         case "$stdio_cnt" in
5629         '') stdio_cnt='((fp)->_cnt)';;
5630         esac
5631         case "$stdio_base" in
5632         '') stdio_base='((fp)->_base)';;
5633         esac
5634         case "$stdio_bufsiz" in
5635         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
5636         esac
5637 fi
5638 : test whether _ptr and _cnt really work
5639 echo "Checking how std your stdio is..." >&4
5640 $cat >try.c <<EOP
5641 #include <stdio.h>
5642 #define FILE_ptr(fp)    $stdio_ptr
5643 #define FILE_cnt(fp)    $stdio_cnt
5644 main() { 
5645         FILE *fp = fopen("try.c", "r");
5646         char c = getc(fp);
5647         if (
5648                 18 <= FILE_cnt(fp) &&
5649                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
5650         )
5651                 exit(0);
5652         exit(1);
5653 }
5654 EOP
5655 val="$undef"
5656 if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1; then
5657         if ./try; then
5658                 echo "Your stdio acts pretty std."
5659                 val="$define"
5660         else
5661                 echo "Your stdio isn't very std."
5662         fi
5663 else
5664         echo "Your stdio doesn't appear very std."
5665 fi
5666 $rm -f try.c try
5667 set d_stdstdio
5668 eval $setvar
5669
5670 : see if _base is also standard
5671 val="$undef"
5672 case "$d_stdstdio" in
5673 $define)
5674         $cat >try.c <<EOP
5675 #include <stdio.h>
5676 #define FILE_base(fp)   $stdio_base
5677 #define FILE_bufsiz(fp) $stdio_bufsiz
5678 main() { 
5679         FILE *fp = fopen("try.c", "r");
5680         char c = getc(fp);
5681         if (
5682                 19 <= FILE_bufsiz(fp) &&
5683                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
5684         )
5685                 exit(0);
5686         exit(1);
5687 }
5688 EOP
5689         if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
5690                 if ./try; then
5691                         echo "Even its _base field acts std."
5692                         val="$define"
5693                 else
5694                         echo "But its _base field isn't std."
5695                 fi
5696         else
5697                 echo "However, it seems to be lacking the _base field."
5698         fi
5699         $rm -f try.c try
5700         ;;
5701 esac
5702 set d_stdiobase
5703 eval $setvar
5704
5705 : see if strcoll exists
5706 set strcoll d_strcoll
5707 eval $inlibc
5708
5709 : check for structure copying
5710 echo " "
5711 echo "Checking to see if your C compiler can copy structs..." >&4
5712 $cat >try.c <<'EOCP'
5713 main()
5714 {
5715         struct blurfl {
5716                 int dyick;
5717         } foo, bar;
5718
5719         foo = bar;
5720 }
5721 EOCP
5722 if $cc -c try.c >/dev/null 2>&1 ; then
5723         val="$define"
5724         echo "Yup, it can."
5725 else
5726         val="$undef"
5727         echo "Nope, it can't."
5728 fi
5729 set d_strctcpy
5730 eval $setvar
5731 $rm -f try.*
5732
5733 : see if strerror and/or sys_errlist[] exist
5734 echo " "
5735 if set strerror val -f d_strerror; eval $csym; $val; then
5736         echo 'strerror() found.' >&4
5737         d_strerror="$define"
5738         d_strerrm='strerror(e)'
5739         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
5740                 echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
5741                 d_syserrlst="$define"
5742         else
5743         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
5744                 d_syserrlst="$undef"
5745         fi
5746 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5747         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
5748         echo 'strerror() found in string header.' >&4
5749         d_strerror="$define"
5750         d_strerrm='strerror(e)'
5751         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
5752                 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
5753                 d_syserrlst="$define"
5754         else
5755                 echo "(You don't appear to have any sys_errlist[], how can this be?)"
5756                 d_syserrlst="$undef"
5757         fi
5758 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5759 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
5760         d_strerror="$undef"
5761         d_syserrlst="$define"
5762         d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
5763 else
5764         echo 'strerror() and sys_errlist[] NOT found.' >&4
5765         d_strerror="$undef"
5766         d_syserrlst="$undef"
5767         d_strerrm='"unknown"'
5768 fi
5769
5770 : see if strxfrm exists
5771 set strxfrm d_strxfrm
5772 eval $inlibc
5773
5774 : see if symlink exists
5775 set symlink d_symlink
5776 eval $inlibc
5777
5778 : see if syscall exists
5779 set syscall d_syscall
5780 eval $inlibc
5781
5782 : see if sysconf exists
5783 set sysconf d_sysconf
5784 eval $inlibc
5785
5786 : see if system exists
5787 set system d_system
5788 eval $inlibc
5789
5790 : see if tcgetpgrp exists
5791 set tcgetpgrp d_tcgetpgrp
5792 eval $inlibc
5793
5794 : see if tcsetpgrp exists
5795 set tcsetpgrp d_tcsetpgrp
5796 eval $inlibc
5797
5798 : define an is-a-typedef? function
5799 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
5800 case "$inclist" in
5801 "") inclist="sys/types.h";;
5802 esac;
5803 eval "varval=\$$var";
5804 case "$varval" in
5805 "")
5806         $rm -f temp.c;
5807         for inc in $inclist; do
5808                 echo "#include <$inc>" >>temp.c;
5809         done;
5810         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
5811         if $contains $type temp.E >/dev/null 2>&1; then
5812                 eval "$var=$type";
5813         else
5814                 eval "$var=$def";
5815         fi;
5816         $rm -f temp.?;;
5817 *) eval "$var=$varval";;
5818 esac'
5819
5820 : see if this is a sys/times.h system
5821 set sys/times.h i_systimes
5822 eval $inhdr
5823
5824 : see if times exists
5825 echo " "
5826 if set times val -f d_times; eval $csym; $val; then
5827         echo 'times() found.' >&4
5828         d_times="$define"
5829         inc=''
5830         case "$i_systimes" in
5831         "$define") inc='sys/times.h';;
5832         esac
5833         set clock_t clocktype long stdio.h sys/types.h $inc
5834         eval $typedef
5835         dflt="$clocktype"
5836         echo " "
5837         rp="What type is returned by times() on this sytem?"
5838         . ./myread
5839         clocktype="$ans"
5840 else
5841         echo 'times() NOT found, hope that will do.' >&4
5842         d_times="$undef"
5843         clocktype='int'
5844 fi
5845
5846 : see if truncate exists
5847 set truncate d_truncate
5848 eval $inlibc
5849
5850 : see if tzname[] exists
5851 echo " "
5852 if set tzname val -a d_tzname; eval $csym; $val; then
5853         val="$define"
5854         echo 'tzname[] found.' >&4
5855 else
5856         val="$undef"
5857         echo 'tzname[] NOT found.' >&4
5858 fi
5859 set d_tzname
5860 eval $setvar
5861
5862 : see if umask exists
5863 set umask d_umask
5864 eval $inlibc
5865
5866 : see if we have to deal with yellow pages, now NIS.
5867 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5868         if $test -f /usr/etc/nibindd; then
5869                 echo " "
5870                 echo "I'm fairly confident you're on a NeXT."
5871                 echo " "
5872                 rp='Do you get the hosts file via NetInfo?'
5873                 dflt=y
5874                 case "$hostcat" in
5875                 nidump*) ;;
5876                 '') ;;
5877                 *) dflt=n;;
5878                 esac
5879                 . ./myread
5880                 case "$ans" in
5881                 y*) hostcat='nidump hosts .';;
5882                 *)      case "$hostcat" in
5883                         nidump*) hostcat='';;
5884                         esac
5885                         ;;
5886                 esac
5887         fi
5888         case "$hostcat" in
5889         nidump*) ;;
5890         *)
5891                 case "$hostcat" in
5892                 *ypcat*) dflt=y;;
5893                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5894                                 dflt=y
5895                         else
5896                                 dflt=n
5897                         fi;;
5898                 *) dflt=n;;
5899                 esac
5900                 echo " "
5901                 rp='Are you getting the hosts file via yellow pages?'
5902                 . ./myread
5903                 case "$ans" in
5904                 y*) hostcat='ypcat hosts';;
5905                 *) hostcat='cat /etc/hosts';;
5906                 esac
5907                 ;;
5908         esac
5909 fi
5910
5911 : now get the host name
5912 echo " "
5913 echo "Figuring out host name..." >&4
5914 case "$myhostname" in
5915 '') cont=true
5916         echo 'Maybe "hostname" will work...'
5917         if tans=`sh -c hostname 2>&1` ; then
5918                 myhostname=$tans
5919                 phostname=hostname
5920                 cont=''
5921         fi
5922         ;;
5923 *) cont='';;
5924 esac
5925 if $test "$cont"; then
5926         if ./xenix; then
5927                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
5928                 if tans=`cat /etc/systemid 2>&1` ; then
5929                         myhostname=$tans
5930                         phostname='cat /etc/systemid'
5931                         echo "Whadyaknow.  Xenix always was a bit strange..."
5932                         cont=''
5933                 fi
5934         elif $test -r /etc/systemid; then
5935                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5936         fi
5937 fi
5938 if $test "$cont"; then
5939         echo 'No, maybe "uuname -l" will work...'
5940         if tans=`sh -c 'uuname -l' 2>&1` ; then
5941                 myhostname=$tans
5942                 phostname='uuname -l'
5943         else
5944                 echo 'Strange.  Maybe "uname -n" will work...'
5945                 if tans=`sh -c 'uname -n' 2>&1` ; then
5946                         myhostname=$tans
5947                         phostname='uname -n'
5948                 else
5949                         echo 'Oh well, maybe I can mine it out of whoami.h...'
5950                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5951                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5952                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5953                         else
5954                                 case "$myhostname" in
5955                                 '') echo "Does this machine have an identity crisis or something?"
5956                                         phostname='';;
5957                                 *)
5958                                         echo "Well, you said $myhostname before..."
5959                                         phostname='echo $myhostname';;
5960                                 esac
5961                         fi
5962                 fi
5963         fi
5964 fi
5965 : you do not want to know about this
5966 set $myhostname
5967 myhostname=$1
5968
5969 : verify guess
5970 if $test "$myhostname" ; then
5971         dflt=y
5972         rp='Your host name appears to be "'$myhostname'".'" Right?"
5973         . ./myread
5974         case "$ans" in
5975         y*) ;;
5976         *) myhostname='';;
5977         esac
5978 fi
5979
5980 : bad guess or no guess
5981 while $test "X$myhostname" = X ; do
5982         dflt=''
5983         rp="Please type the (one word) name of your host:"
5984         . ./myread
5985         myhostname="$ans"
5986 done
5987
5988 : translate upper to lower if necessary
5989 case "$myhostname" in
5990 *[A-Z]*)
5991         echo "(Normalizing case in your host name)"
5992         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5993         ;;
5994 esac
5995
5996 : a little sanity check here
5997 case "$phostname" in
5998 '') ;;
5999 *)
6000         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6001         $myhostname$mydomain|$myhostname) ;;
6002         *)
6003                 case "$phostname" in
6004                 sed*)
6005                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6006                         ;;
6007                 *)
6008                         echo "(That doesn't agree with your $phostname command, by the way.)"
6009                         ;;
6010                 esac
6011         ;;
6012         esac
6013         ;;
6014 esac
6015
6016 : see how we will look up host name
6017 echo " "
6018 if false; then
6019         : dummy stub to allow use of elif
6020 elif set uname val -f d_uname; eval $csym; $val; then
6021         if ./xenix; then
6022                 $cat <<'EOM'
6023 uname() was found, but you're running xenix, and older versions of xenix
6024 have a broken uname(). If you don't really know whether your xenix is old
6025 enough to have a broken system call, use the default answer.
6026
6027 EOM
6028                 dflt=y
6029                 case "$d_uname" in
6030                 "$define") dflt=n;;
6031                 esac
6032                 rp='Is your uname() broken?'
6033                 . ./myread
6034                 case "$ans" in
6035                 n*) d_uname="$define"; call=uname;;
6036                 esac
6037         else
6038                 echo 'uname() found.' >&4
6039                 d_uname="$define"
6040                 call=uname
6041         fi
6042 fi
6043 case "$d_gethname" in
6044 '') d_gethname="$undef";;
6045 esac
6046 case "$d_uname" in
6047 '') d_uname="$undef";;
6048 esac
6049 case "$d_phostname" in
6050 '') d_phostname="$undef";;
6051 esac
6052
6053 : backward compatibility for d_hvfork
6054 if test X$d_hvfork != X; then
6055         d_vfork="$d_hvfork"
6056         d_hvfork=''
6057 fi
6058 : see if there is a vfork
6059 val=''
6060 set vfork val
6061 eval $inlibc
6062
6063 : Ok, but do we want to use it. vfork is reportedly unreliable in 
6064 : perl on Solaris 2.x, and probably elsewhere.
6065 case "$val" in
6066 $define)
6067         echo " "
6068         case "$usevfork" in
6069         false) dflt='n';;
6070         *) dflt='y';;
6071         esac
6072         rp="Some systems have problems with vfork().  Do you want to use it?"
6073         . ./myread
6074         case "$ans" in
6075         y|Y) ;;
6076         *)
6077                 echo "Ok, we won't use vfork()."
6078                 val="$undef"
6079                 ;;
6080         esac
6081         ;;
6082 esac
6083 set d_vfork
6084 eval $setvar
6085 case "$d_vfork" in
6086 $define) usevfork='true';;
6087 *) usevfork='false';;
6088 esac
6089
6090 : see if this is an sysdir system
6091 set sys/dir.h i_sysdir
6092 eval $inhdr
6093
6094 : see if this is an sysndir system
6095 set sys/ndir.h i_sysndir
6096 eval $inhdr
6097
6098 : see if closedir exists
6099 set closedir d_closedir
6100 eval $inlibc
6101
6102 case "$d_closedir" in
6103 "$define")
6104         echo " "
6105         echo "Checking whether closedir() returns a status..." >&4
6106         cat > closedir.c <<EOM
6107 #$i_dirent I_DIRENT             /**/
6108 #$i_sysdir I_SYS_DIR            /**/
6109 #$i_sysndir I_SYS_NDIR          /**/
6110
6111 #if defined(I_DIRENT)
6112 #include <dirent.h>
6113 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
6114 #include <sys/dir.h>
6115 #endif
6116 #else
6117 #ifdef I_SYS_NDIR
6118 #include <sys/ndir.h>
6119 #else
6120 #ifdef I_SYS_DIR
6121 #ifdef hp9000s500
6122 #include <ndir.h>       /* may be wrong in the future */
6123 #else
6124 #include <sys/dir.h>
6125 #endif
6126 #endif
6127 #endif
6128 #endif 
6129 int main() { return closedir(opendir(".")); }
6130 EOM
6131         if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then
6132                 if ./closedir > /dev/null 2>&1 ; then
6133                         echo "Yes, it does."
6134                         val="$undef"
6135                 else
6136                         echo "No, it doesn't."
6137                         val="$define"
6138                 fi
6139         else
6140                 echo "(I can't seem to compile the test program--assuming it doesn't)"
6141                 val="$define"
6142         fi
6143         ;;
6144 *)
6145         val="$undef";
6146         ;;
6147 esac
6148 set d_void_closedir
6149 eval $setvar
6150 $rm -f closedir*
6151 : check for volatile keyword
6152 echo " "
6153 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
6154 $cat >try.c <<'EOCP'
6155 main()
6156 {
6157         typedef struct _goo_struct goo_struct;
6158         goo_struct * volatile goo = ((goo_struct *)0);
6159         struct _goo_struct {
6160                 long long_int;
6161                 int reg_int;
6162                 char char_var;
6163         };
6164         typedef unsigned short foo_t;
6165         char *volatile foo;
6166         volatile int bar;
6167         volatile foo_t blech;
6168         foo = foo;
6169 }
6170 EOCP
6171 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
6172         val="$define"
6173         echo "Yup, it does."
6174 else
6175         val="$undef"
6176         echo "Nope, it doesn't."
6177 fi
6178 set d_volatile
6179 eval $setvar
6180 $rm -f try.*
6181
6182 : see if there is a wait4
6183 set wait4 d_wait4
6184 eval $inlibc
6185
6186 : see if waitpid exists
6187 set waitpid d_waitpid
6188 eval $inlibc
6189
6190 : see if wcstombs exists
6191 set wcstombs d_wcstombs
6192 eval $inlibc
6193
6194 : see if wctomb exists
6195 set wctomb d_wctomb
6196 eval $inlibc
6197
6198 : preserve RCS keywords in files with variable substitution, grrr
6199 Date='$Date'
6200 Id='$Id'
6201 Log='$Log'
6202 RCSfile='$RCSfile'
6203 Revision='$Revision'
6204
6205 : check for alignment requirements
6206 echo " "
6207 case "$alignbytes" in
6208 '') echo "Checking alignment constraints..." >&4
6209         $cat >try.c <<'EOCP'
6210 struct foobar {
6211         char foo;
6212         double bar;
6213 } try;
6214 main()
6215 {
6216         printf("%d\n", (char *)&try.bar - (char *)&try.foo);
6217 }
6218 EOCP
6219         if $cc $ccflags try.c -o try >/dev/null 2>&1; then
6220                 dflt=`./try`
6221         else
6222                 dflt='8'
6223                 echo"(I can't seem to compile the test program...)"
6224         fi
6225         ;;
6226 *) dflt="$alignbytes"
6227         ;;
6228 esac
6229 rp="Doubles must be aligned on a how-many-byte boundary?"
6230 . ./myread
6231 alignbytes="$ans"
6232 $rm -f try.c try
6233
6234 : determine where public executables go
6235 echo " "
6236 set dflt bin bin
6237 eval $prefixit
6238 fn=d~
6239 rp='Pathname where the public executables will reside?'
6240 . ./getfile
6241 if $test "X$ansexp" != "X$binexp"; then
6242         installbin=''
6243 fi
6244 bin="$ans"
6245 binexp="$ansexp"
6246 if $afs; then
6247         $cat <<EOM
6248
6249 Since you are running AFS, I need to distinguish the directory in which
6250 executables reside from the directory in which they are installed (and from
6251 which they are presumably copied to the former directory by occult means).
6252
6253 EOM
6254         case "$installbin" in
6255         '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
6256         *) dflt="$installbin";;
6257         esac
6258         fn=de~
6259         rp='Where will public executables be installed?'
6260         . ./getfile
6261         installbin="$ans"
6262 else
6263         installbin="$binexp"
6264 fi
6265
6266 : check for ordering of bytes in a long
6267 case "$byteorder" in
6268 '')
6269         $cat <<'EOM'
6270   
6271 In the following, larger digits indicate more significance.  A big-endian
6272 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
6273 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
6274 machines may have weird orders like 3412.  A Cray will report 87654321. If
6275 the test program works the default is probably right.
6276 I'm now running the test program...
6277 EOM
6278         $cat >try.c <<'EOCP'
6279 #include <stdio.h>
6280 main()
6281 {
6282         int i;
6283         union {
6284                 unsigned long l;
6285                 char c[sizeof(long)];
6286         } u;
6287
6288         if (sizeof(long) > 4)
6289                 u.l = (0x08070605L << 32) | 0x04030201L;
6290         else
6291                 u.l = 0x04030201L;
6292         for (i = 0; i < sizeof(long); i++)
6293                 printf("%c", u.c[i]+'0');
6294         printf("\n");
6295 }
6296 EOCP
6297         if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
6298                 dflt=`./try`
6299                 case "$dflt" in
6300                 ????|????????) echo "(The test program ran ok.)";;
6301                 *) echo "(The test program didn't run right for some reason.)";;
6302                 esac
6303         else
6304                 dflt='4321'
6305                 cat <<'EOM'
6306 (I can't seem to compile the test program.  Guessing big-endian...)
6307 EOM
6308         fi
6309         ;;
6310 *)
6311         echo " "
6312         dflt="$byteorder"
6313         ;;
6314 esac
6315 rp="What is the order of bytes in a long?"
6316 . ./myread
6317 byteorder="$ans"
6318 $rm -f try.c try
6319
6320 : how do we catenate cpp tokens here?
6321 echo " "
6322 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
6323 $cat >cpp_stuff.c <<'EOCP'
6324 #define RCAT(a,b)a/**/b
6325 #define ACAT(a,b)a ## b
6326 RCAT(Rei,ser)
6327 ACAT(Cir,cus)
6328 EOCP
6329 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
6330 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
6331         echo "Oh!  Smells like ANSI's been here."
6332         echo "We can catify or stringify, separately or together!"
6333         cpp_stuff=42
6334 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
6335         echo "Ah, yes!  The good old days!"
6336         echo "However, in the good old days we don't know how to stringify and"
6337         echo "catify at the same time."
6338         cpp_stuff=1
6339 else
6340         $cat >&4 <<EOM
6341 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
6342 to have to edit the values of CAT[2-5] in config.h...
6343 EOM
6344         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
6345 fi
6346 $rm -f cpp_stuff.*
6347
6348 : see if this is a db.h system
6349 set db.h i_db
6350 eval $inhdr
6351
6352 case "$i_db" in
6353 define)
6354         : Check the return type needed for hash 
6355         echo " "
6356         echo "Checking return type needed for hash for Berkeley DB ..." >&4
6357         $cat >try.c <<'EOCP'
6358 #include <sys/types.h>
6359 #include <db.h>
6360 u_int32_t hash_cb (ptr, size)
6361 void *ptr;
6362 size_t size;
6363 {
6364 }
6365 HASHINFO info;
6366 main()
6367 {
6368         info.hash = hash_cb;
6369 }
6370 EOCP
6371         if $cc $ccflags -c try.c >try.out 2>&1 ; then
6372                 if $contains warning try.out >>/dev/null 2>&1 ; then
6373                         db_hashtype='int'
6374                 else
6375                         db_hashtype='u_int32_t'
6376                 fi
6377         else
6378                 echo "I can't seem to compile the test program." >&4
6379                 db_hashtype=int
6380         fi
6381         $rm -f try.*
6382         echo "Your version of Berkeley DB uses $db_hashtype for hash."
6383         ;;
6384 *)      db_hashtype=int
6385         ;;
6386 esac
6387
6388 case "$i_db" in
6389 define)
6390         : Check the return type needed for prefix 
6391         echo " "
6392         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
6393         cat >try.c <<'EOCP'
6394 #include <sys/types.h>
6395 #include <db.h>
6396 size_t prefix_cb (key1, key2)
6397 DBT *key1;
6398 DBT *key2;
6399 {
6400 }
6401 BTREEINFO info;
6402 main()
6403 {
6404         info.prefix = prefix_cb;
6405 }
6406 EOCP
6407         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
6408                 if $contains warning try.out >>/dev/null 2>&1 ; then
6409                         db_prefixtype='int'
6410                 else
6411                         db_prefixtype='size_t'
6412                 fi
6413         else
6414                 echo "I can't seem to compile the test program." >&4
6415                 db_prefixtype='int'
6416         fi
6417         $rm -f try.*
6418         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
6419         ;;
6420 *)      db_prefixtype='int'
6421         ;;
6422 esac
6423
6424 : check for void type
6425 echo " "
6426 echo "Checking to see how well your C compiler groks the void type..." >&4
6427 echo " "
6428 $cat >&4 <<EOM
6429   Support flag bits are:
6430     1: basic void declarations.
6431     2: arrays of pointers to functions returning void.
6432     4: operations between pointers to and addresses of void functions.
6433     8: generic void pointers.
6434 EOM
6435 echo " "
6436 case "$voidflags" in
6437 '')
6438         $cat >try.c <<'EOCP'
6439 #if TRY & 1
6440 void main() {
6441 #else
6442 main() {
6443 #endif
6444         extern void moo();      /* function returning void */
6445         void (*goo)();          /* ptr to func returning void */
6446 #if TRY & 8
6447         void *hue;              /* generic ptr */
6448 #endif
6449 #if TRY & 2
6450         void (*foo[10])();
6451 #endif
6452
6453 #if TRY & 4
6454         if(goo == moo) {
6455                 exit(0);
6456         }
6457 #endif
6458         exit(0);
6459 }
6460 EOCP
6461         if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6462                 voidflags=$defvoidused
6463         echo "It appears to support void to the level $package wants ($defvoidused)."
6464                 if $contains warning .out >/dev/null 2>&1; then
6465                         echo "However, you might get some warnings that look like this:"
6466                         $cat .out
6467                 fi
6468         else
6469 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6470                 if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then
6471                         echo "It supports 1..."
6472                         if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then
6473                                 echo "It also supports 2..."
6474                                 if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then
6475                                         voidflags=7
6476                                         echo "And it supports 4 but not 8 definitely."
6477                                 else
6478                                         echo "It doesn't support 4..."
6479                                         if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then
6480                                                 voidflags=11
6481                                                 echo "But it supports 8."
6482                                         else
6483                                                 voidflags=3
6484                                                 echo "Neither does it support 8."
6485                                         fi
6486                                 fi
6487                         else
6488                                 echo "It does not support 2..."
6489                                 if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then
6490                                         voidflags=13
6491                                         echo "But it supports 4 and 8."
6492                                 else
6493                                         if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then
6494                                                 voidflags=5
6495                                                 echo "And it supports 4 but has not heard about 8."
6496                                         else
6497                                                 echo "However it supports 8 but not 4."
6498                                         fi
6499                                 fi
6500                         fi
6501                 else
6502                         echo "There is no support at all for void."
6503                         voidflags=0
6504                 fi
6505         fi
6506 esac
6507 dflt="$voidflags";
6508 rp="Your void support flags add up to what?"
6509 . ./myread
6510 voidflags="$ans"
6511 $rm -f try.* .out
6512
6513 : see if dbm.h is available
6514 set dbm.h t_dbm
6515 eval $inhdr
6516 case "$t_dbm" in
6517 $define)
6518         : see if dbmclose exists
6519         set dbmclose d_dbmclose
6520         eval $inlibc
6521         case "$d_dbmclose" in
6522         $undef)
6523                 t_dbm="$undef"
6524                 echo "We won't be including <dbm.h>"
6525                 ;;
6526         esac
6527         ;;
6528 esac
6529 val="$t_dbm"
6530 set i_dbm
6531 eval $setvar
6532
6533 : see if ndbm.h is available
6534 set ndbm.h t_ndbm
6535 eval $inhdr
6536 case "$t_ndbm" in
6537 $define)
6538         : see if dbm_open exists
6539         set dbm_open d_dbm_open
6540         eval $inlibc
6541         case "$d_dbm_open" in
6542         $undef)
6543                 t_ndbm="$undef"
6544                 echo "We won't be including <ndbm.h>"
6545                 ;;
6546         esac
6547         ;;
6548 esac
6549 val="$t_ndbm"
6550 set i_ndbm
6551 eval $setvar
6552
6553 : see if gdbm.h is available
6554 set gdbm.h t_gdbm
6555 eval $inhdr
6556 case "$t_gdbm" in
6557 $define)
6558         : see if gdbm_open exists
6559         set gdbm_open d_gdbm_open
6560         eval $inlibc
6561         case "$d_gdbm_open" in
6562         $undef)
6563                 t_gdbm="$undef"
6564                 echo "We won't be including <gdbm.h>"
6565                 ;;
6566         esac
6567         ;;
6568 esac
6569 val="$t_gdbm"
6570 set i_gdbm
6571 eval $setvar
6572
6573 echo " "
6574 echo "Looking for extensions..." >&4
6575 cd ../ext
6576 : If we are using the old config.sh, known_extensions may contain
6577 : old or inaccurate or duplicate values.
6578 known_extensions=''
6579 : We do not use find because it might not be available.
6580 : We do not just use MANIFEST because the user may have dropped
6581 : some additional extensions into the source tree and expect them
6582 : to be built.
6583 for xxx in * ; do
6584         if $test -f $xxx/$xxx.xs; then
6585                 known_extensions="$known_extensions $xxx"
6586         else
6587                 if $test -d $xxx; then
6588                         cd $xxx
6589                         for yyy in * ; do
6590                                 if $test -f $yyy/$yyy.xs; then
6591                                         known_extensions="$known_extensions $xxx/$yyy"
6592                                 fi
6593                         done
6594                         cd ..
6595                 fi
6596         fi
6597 done
6598 set X $known_extensions
6599 shift
6600 known_extensions="$*"
6601 cd ../UU
6602
6603 : Now see which are supported on this system.
6604 avail_ext=''
6605 for xxx in $known_extensions ; do
6606     case "$xxx" in
6607     DB_File) case "$i_db" in 
6608             $define) avail_ext="$avail_ext $xxx" ;;
6609             esac
6610             ;;
6611     GDBM_File) case "$i_gdbm" in 
6612             $define) avail_ext="$avail_ext $xxx" ;;
6613             esac
6614             ;;
6615     NDBM_File) case "$i_ndbm" in 
6616             $define) avail_ext="$avail_ext $xxx" ;;
6617             esac
6618             ;;
6619     ODBM_File) case "$i_dbm" in 
6620             $define) avail_ext="$avail_ext $xxx" ;;
6621             esac
6622             ;;
6623     POSIX) case "$useposix" in 
6624             true|define|y) avail_ext="$avail_ext $xxx" ;;
6625             esac
6626             ;;
6627     Socket) case "$d_socket" in 
6628             $define) avail_ext="$avail_ext $xxx" ;;
6629             esac
6630             ;;
6631     *)      avail_ext="$avail_ext $xxx"
6632             ;;
6633     esac
6634 done
6635
6636 set X $avail_ext
6637 shift
6638 avail_ext="$*"
6639
6640 case $usedl in
6641 $define)
6642         $cat <<EOM
6643 A number of extensions are supplied with $package.  You may choose to
6644 compile these extensions for dynamic loading (the default), compile
6645 them into the $package executable (static loading), or not include
6646 them at all.  Answer "none" to include no extensions.
6647
6648 EOM
6649         case "$dynamic_ext" in
6650         '') dflt="$avail_ext" ;;
6651         *)      dflt="$dynamic_ext" ;;
6652         esac
6653         case "$dflt" in
6654         '')     dflt=none;;
6655         esac
6656         rp="What extensions do you wish to load dynamically?"
6657         . ./myread
6658         case "$ans" in
6659         none) dynamic_ext=' ' ;;
6660         *) dynamic_ext="$ans" ;;
6661         esac
6662
6663         case "$static_ext" in
6664         '')
6665                 : Exclude those already listed in dynamic linking
6666                 dflt=''
6667                 for xxx in $avail_ext; do
6668                         case " $dynamic_ext " in
6669                         *" $xxx "*) ;;
6670                         *) dflt="$dflt $xxx" ;;
6671                         esac
6672                 done
6673                 set X $dflt
6674                 shift
6675                 dflt="$*"
6676                 ;;
6677         *)  dflt="$static_ext" 
6678                 ;;
6679         esac
6680
6681         case "$dflt" in
6682         '')     dflt=none;;
6683         esac
6684         rp="What extensions do you wish to load statically?"
6685         . ./myread
6686         case "$ans" in
6687         none) static_ext=' ' ;;
6688         *) static_ext="$ans" ;;
6689         esac
6690         ;;
6691 *)
6692         $cat <<EOM
6693 A number of extensions are supplied with $package.  Answer "none" 
6694 to include no extensions. 
6695
6696 EOM
6697         case "$static_ext" in
6698         '') dflt="$avail_ext" ;;
6699         *)      dflt="$static_ext" ;;
6700         esac
6701
6702         case "$dflt" in
6703         '')     dflt=none;;
6704         esac
6705         rp="What extensions do you wish to include?"
6706         . ./myread
6707         case "$ans" in
6708         none) static_ext=' ' ;;
6709         *) static_ext="$ans" ;;
6710         esac
6711         ;;
6712 esac
6713
6714 set X $dynamic_ext $static_ext
6715 shift
6716 extensions="$*"
6717
6718 : see what type file positions are declared as in the library
6719 set fpos_t fpostype long stdio.h sys/types.h
6720 eval $typedef
6721 echo " "
6722 dflt="$fpostype"
6723 rp="What is the type for file position used by fsetpos()?"
6724 . ./myread
6725 fpostype="$ans"
6726
6727 : Store the full pathname to the sed program for use in the C program
6728 full_sed=$sed
6729
6730 : see what type gids are declared as in the kernel
6731 set gid_t gidtype xxx stdio.h sys/types.h
6732 eval $typedef
6733 case "$gidtype" in
6734 xxx)
6735         xxx=`./findhdr sys/user.h`
6736         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
6737         case $1 in
6738         unsigned) dflt="$1 $2" ;;
6739         *) dflt="$1" ;;
6740         esac
6741         ;;
6742 *) dflt="$gidtype";;
6743 esac
6744 echo " "
6745 rp="What is the type for group ids returned by getgid()?"
6746 . ./myread
6747 gidtype="$ans"
6748
6749 : see if getgroups exists
6750 set getgroups d_getgrps
6751 eval $inlibc
6752
6753 : Find type of 2nd arg to getgroups
6754 echo " "
6755 case "$d_getgrps" in
6756 'define')
6757         case "$groupstype" in
6758         '') dflt="$gidtype" ;;
6759         *)  dflt="$groupstype" ;;
6760         esac
6761         $cat <<EOM
6762 What is the type of the second argument to getgroups()?  Usually this
6763 is the same as group ids, $gidtype, but not always.
6764
6765 EOM
6766         rp='What type is the second argument to getgroups()?'
6767         . ./myread
6768         groupstype="$ans"
6769         ;;
6770 *)  groupstype="$gidtype";;
6771 esac
6772
6773 : see what type lseek is declared as in the kernel
6774 set off_t lseektype long stdio.h sys/types.h
6775 eval $typedef
6776 echo " "
6777 dflt="$lseektype"
6778 rp="What type is lseek's offset on this system declared as?"
6779 . ./myread
6780 lseektype="$ans"
6781
6782 : determine where manual pages go
6783 set man1dir man1dir none
6784 eval $prefixit
6785 $cat <<EOM
6786
6787 $spackage has manual pages available in source form.
6788 EOM
6789 case "$nroff" in
6790 nroff)
6791         echo "However, you don't have nroff, so they're probably useless to you."
6792         case "$man1dir" in
6793         '') man1dir="none";;
6794         esac;;
6795 esac
6796 echo "If you don't want the manual sources installed, answer 'none'."
6797 case "$man1dir" in
6798 '')
6799         lookpath="$prefixexp/man/man1 $prefixexp/man/u_man/man1"
6800         lookpath="$lookpath $prefixexp/man/l_man/man1"
6801         lookpath="$lookpath /usr/local/man/man1 /opt/man/man1 /usr/man/manl"
6802         lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
6803         lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6804         lookpath="$lookpath /usr/man/man.L"
6805         man1dir=`./loc . $prefixexp/man/man1 $lookpath`
6806         if $test -d "$man1dir"; then
6807                 dflt="$man1dir"
6808         else
6809                 dflt="$sysman"
6810         fi
6811         set dflt
6812         eval $prefixup
6813         ;;
6814 ' ') dflt=none;;
6815 *)  dflt="$man1dir"
6816         ;;
6817 esac
6818 echo " "
6819 fn=dn~
6820 rp="Where do the main $spackage manual pages (source) go?"
6821 . ./getfile
6822 if test "X$man1direxp" != "X$ansexp"; then
6823         installman1dir=''
6824 fi
6825 man1dir="$ans"
6826 man1direxp="$ansexp"
6827 case "$man1dir" in
6828 '') man1dir=' '
6829         installman1dir='';;
6830 esac
6831 if $afs; then
6832         $cat <<EOM
6833
6834 Since you are running AFS, I need to distinguish the directory in which
6835 manual pages reside from the directory in which they are installed (and from
6836 which they are presumably copied to the former directory by occult means).
6837
6838 EOM
6839         case "$installman1dir" in
6840         '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
6841         *) dflt="$installman1dir";;
6842         esac
6843         fn=de~
6844         rp='Where will man pages be installed?'
6845         . ./getfile
6846         installman1dir="$ans"
6847 else
6848         installman1dir="$man1direxp"
6849 fi
6850
6851 case "$man1dir" in
6852 ' ') man1ext='0';;
6853 *l) man1ext=l;;
6854 *n) man1ext=n;;
6855 *o) man1ext=l;;
6856 *p) man1ext=n;;
6857 *C) man1ext=C;;
6858 *L) man1ext=L;;
6859 *L1) man1ext=L1;;
6860 *) man1ext=1;;
6861 esac
6862
6863 : determine where library module manual pages go
6864 set man3dir man3dir none
6865 eval $prefixit
6866 $cat <<EOM
6867
6868 $spackage has manual pages for many of the library modules.
6869 EOM
6870
6871 case "$nroff" in
6872 nroff)
6873         $cat <<'EOM'
6874 However, you don't have nroff, so they're probably useless to you.
6875 You can use the supplied perldoc script instead.
6876 EOM
6877         case "$man3dir" in
6878         '') man3dir="none";;
6879         esac;;
6880 esac
6881
6882 case "$d_flexfnam" in
6883 undef)
6884         $cat <<'EOM'
6885 However, your system can't handle the long file names like File::Basename.3. 
6886 You can use the supplied perldoc script instead.
6887 EOM
6888         case "$man3dir" in
6889         '') man3dir="none";;
6890         esac;;
6891 esac
6892
6893 echo "If you don't want the manual sources installed, answer 'none'."
6894 case "$man3dir" in
6895 '')     dflt="$privlib/man/man3" ;;
6896 ' ') dflt=none;;
6897 *)      dflt="$man3dir" ;;
6898 esac
6899 echo " "
6900
6901 fn=dn~
6902 rp="Where do the $spackage library man pages (source) go?"
6903 . ./getfile
6904 if test "X$man3direxp" != "X$ansexp"; then
6905         installman3dir=''
6906 fi
6907
6908 man3dir="$ans"
6909 man3direxp="$ansexp"
6910 case "$man3dir" in
6911 '') man3dir=' '
6912         installman3dir='';;
6913 esac
6914 if $afs; then
6915         $cat <<EOM
6916
6917 Since you are running AFS, I need to distinguish the directory in which
6918 manual pages reside from the directory in which they are installed (and from
6919 which they are presumably copied to the former directory by occult means).
6920
6921 EOM
6922         case "$installman3dir" in
6923         '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
6924         *) dflt="$installman3dir";;
6925         esac
6926         fn=de~
6927         rp='Where will man pages be installed?'
6928         . ./getfile
6929         installman3dir="$ans"
6930 else
6931         installman3dir="$man3direxp"
6932 fi
6933
6934 case "$man3dir" in
6935 ' ') man3ext='0';;
6936 *l) man3ext=l;;
6937 *n) man3ext=n;;
6938 *o) man3ext=l;;
6939 *p) man3ext=n;;
6940 *C) man3ext=C;;
6941 *L) man3ext=L;;
6942 *L3) man3ext=L3;;
6943 *) man3ext=3;;
6944 esac
6945
6946 : see what type is used for mode_t
6947 set mode_t modetype int stdio.h sys/types.h
6948 eval $typedef
6949 dflt="$modetype"
6950 echo " "
6951 rp="What type is used for file modes?"
6952 . ./myread
6953 modetype="$ans"
6954
6955 : set the base revision
6956 baserev=5.0
6957
6958 : get the patchlevel
6959 echo " "
6960 echo "Getting the current patchlevel..." >&4
6961 if $test -r ../patchlevel.h;then
6962         patchlevel=`awk '/PATCHLEVEL/ {print $3}' < ../patchlevel.h`
6963 else
6964         patchlevel=0
6965 fi
6966 echo "(You have $package $baserev PL$patchlevel.)"
6967
6968 : Cruising for prototypes
6969 echo " "
6970 echo "Checking out function prototypes..." >&4
6971 $cat >prototype.c <<'EOCP'
6972 main(int argc, char *argv[]) {
6973         exit(0);}
6974 EOCP
6975 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6976         echo "Your C compiler appears to support function prototypes."
6977         val="$define"
6978 else
6979         echo "Your C compiler doesn't seem to understand function prototypes."
6980         val="$undef"
6981 fi
6982 set prototype
6983 eval $setvar
6984 $rm -f prototype*
6985
6986 : check for size of random number generator
6987 echo " "
6988 case "$randbits" in
6989 '')
6990         echo "Checking to see how many bits your rand function produces..." >&4
6991         $cat >try.c <<'EOCP'
6992 #include <stdio.h>
6993 main()
6994 {
6995         register int i;
6996         register unsigned long tmp;
6997         register unsigned long max = 0L;
6998
6999         for (i = 1000; i; i--) {
7000                 tmp = (unsigned long)rand();
7001                 if (tmp > max) max = tmp;
7002         }
7003         for (i = 0; max; i++)
7004                 max /= 2;
7005         printf("%d\n",i);
7006 }
7007 EOCP
7008         if $cc try.c -o try >/dev/null 2>&1 ; then
7009                 dflt=`try`
7010         else
7011                 dflt='?'
7012                 echo "(I can't seem to compile the test program...)"
7013         fi
7014         ;;
7015 *)
7016         dflt="$randbits"
7017         ;;
7018 esac
7019 rp='How many bits does your rand() function produce?'
7020 . ./myread
7021 randbits="$ans"
7022 $rm -f try.c try
7023
7024 : see if ar generates random libraries by itself
7025 echo " "
7026 echo "Checking how to generate random libraries on your machine..." >&4
7027 echo 'int bar1() { return bar2(); }' > bar1.c
7028 echo 'int bar2() { return 2; }' > bar2.c
7029 $cat > foo.c <<'EOP'
7030 main() { printf("%d\n", bar1()); exit(0); }
7031 EOP
7032 $cc $ccflags -c bar1.c >/dev/null 2>&1
7033 $cc $ccflags -c bar2.c >/dev/null 2>&1
7034 $cc $ccflags -c foo.c >/dev/null 2>&1
7035 ar rc bar.a bar2.o bar1.o >/dev/null 2>&1
7036 if $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
7037         ./foobar >/dev/null 2>&1; then
7038         echo "ar appears to generate random libraries itself."
7039         orderlib=false
7040         ranlib=":"
7041 elif ar ts bar.a >/dev/null 2>&1 &&
7042         $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
7043         ./foobar >/dev/null 2>&1; then
7044                 echo "a table of contents needs to be added with 'ar ts'."
7045                 orderlib=false
7046                 ranlib="ar ts"
7047 else
7048         case "$ranlib" in
7049         :) ranlib='';;
7050         '')
7051                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
7052                 $test -f $ranlib || ranlib=''
7053                 ;;
7054         esac
7055         if $test -n "$ranlib"; then
7056                 echo "your system has '$ranlib'; we'll use that."
7057                 orderlib=false
7058         else
7059                 echo "your system doesn't seem to support random libraries"
7060                 echo "so we'll use lorder and tsort to order the libraries."
7061                 orderlib=true
7062                 ranlib=":"
7063         fi
7064 fi
7065 $rm -f foo* bar* 
7066
7067 : determine where public executable scripts go
7068 set scriptdir scriptdir
7069 eval $prefixit
7070 case "$scriptdir" in
7071 '')
7072         dflt="$bin"
7073         : guess some guesses
7074         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7075         $test -d /usr/share/bin && dflt=/usr/share/bin
7076         $test -d /usr/local/script && dflt=/usr/local/script
7077         $test -d $prefixexp/script && dflt=$prefixexp/script
7078         set dflt
7079         eval $prefixup
7080         ;;
7081 *)  dflt="$scriptdir"
7082         ;;
7083 esac
7084 $cat <<EOM
7085  
7086 Some installations have a separate directory just for executable scripts so
7087 that they can mount it across multiple architectures but keep the scripts in
7088 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7089 Or you might just lump your scripts in with all your other executables.
7090  
7091 EOM
7092 fn=d~
7093 rp='Where do you keep publicly executable scripts?'
7094 . ./getfile
7095 if $test "X$ansexp" != "X$scriptdirexp"; then
7096         installscript=''
7097 fi
7098 scriptdir="$ans"
7099 scriptdirexp="$ansexp"
7100 if $afs; then
7101         $cat <<EOM
7102
7103 Since you are running AFS, I need to distinguish the directory in which
7104 scripts reside from the directory in which they are installed (and from
7105 which they are presumably copied to the former directory by occult means).
7106
7107 EOM
7108         case "$installscript" in
7109         '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
7110         *) dflt="$installscript";;
7111         esac
7112         fn=de~
7113         rp='Where will public scripts be installed?'
7114         . ./getfile
7115         installscript="$ans"
7116 else
7117         installscript="$scriptdirexp"
7118 fi
7119
7120 : see if sys/select.h has to be included
7121 set sys/select.h i_sysselct
7122 eval $inhdr
7123
7124 : see if we should include time.h, sys/time.h, or both
7125 echo " "
7126 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
7127 $echo $n "I'm now running the test program...$c"
7128 $cat >try.c <<'EOCP'
7129 #include <sys/types.h>
7130 #ifdef I_TIME
7131 #include <time.h>
7132 #endif
7133 #ifdef I_SYSTIME
7134 #ifdef SYSTIMEKERNEL
7135 #define KERNEL
7136 #endif
7137 #include <sys/time.h>
7138 #endif
7139 #ifdef I_SYSSELECT
7140 #include <sys/select.h>
7141 #endif
7142 main()
7143 {
7144         struct tm foo;
7145 #ifdef S_TIMEVAL
7146         struct timeval bar;
7147 #endif
7148 #ifdef S_TIMEZONE
7149         struct timezone tzp;
7150 #endif
7151         if (foo.tm_sec == foo.tm_sec)
7152                 exit(0);
7153 #ifdef S_TIMEVAL
7154         if (bar.tv_sec == bar.tv_sec)
7155                 exit(0);
7156 #endif
7157         exit(1);
7158 }
7159 EOCP
7160 flags=''
7161 s_timezone=''
7162 sysselect=''
7163 for s_timeval in '-DS_TIMEVAL' ''; do
7164 for i_systimek in '' '-DSYSTIMEKERNEL'; do
7165 for i_time in '' '-DI_TIME'; do
7166 for i_systime in '-DI_SYSTIME' ''; do
7167         case "$flags" in
7168         '') $echo $n ".$c"
7169                 if $cc $ccflags \
7170                 $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
7171                 try.c -o try >/dev/null 2>&1 ; then
7172                         set X $i_time $i_systime $i_systimek $sysselect $s_timeval
7173                         shift
7174                         flags="$*"
7175                         echo " "
7176                         $echo $n "Succeeded with $flags$c"
7177                 fi
7178                 ;;
7179         esac
7180 done
7181 done
7182 done
7183 done
7184 timeincl=''
7185 echo " "
7186 case "$flags" in
7187 *SYSTIMEKERNEL*) i_systimek="$define"
7188         timeincl=`./findhdr sys/time.h`
7189         echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
7190 *) i_systimek="$undef";;
7191 esac
7192 case "$flags" in
7193 *I_TIME*) i_time="$define"
7194         timeincl=`./findhdr time.h`" $timeincl"
7195         echo "We'll include <time.h>." >&4;;
7196 *) i_time="$undef";;
7197 esac
7198 case "$flags" in
7199 *I_SYSTIME*) i_systime="$define"
7200         timeincl=`./findhdr sys/time.h`" $timeincl"
7201         echo "We'll include <sys/time.h>." >&4;;
7202 *) i_systime="$undef";;
7203 esac
7204 $rm -f try.c try
7205
7206 : check for fd_set items
7207 $cat <<EOM
7208
7209 Checking to see how well your C compiler handles fd_set and friends ...
7210 EOM
7211 $cat >fd_set.c <<EOCP
7212 #$i_systime I_SYS_TIME
7213 #$i_sysselct I_SYS_SELECT
7214 #$d_socket HAS_SOCKET
7215 #include <sys/types.h>
7216 #ifdef HAS_SOCKET
7217 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
7218 #endif
7219 #ifdef I_SYS_TIME
7220 #include <sys/time.h>
7221 #else
7222 #ifdef I_SYS_SELECT
7223 #include <sys/select.h>
7224 #endif
7225 #endif
7226 main() {
7227         fd_set fds;
7228
7229 #ifdef TRYBITS
7230         if(fds.fds_bits);
7231 #endif
7232
7233 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
7234         exit(0);
7235 #else
7236         exit(1);
7237 #endif
7238 }
7239 EOCP
7240 if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then
7241         d_fds_bits="$define"
7242         d_fd_set="$define"
7243         echo "Well, your system knows about the normal fd_set typedef..." >&4
7244         if ./fd_set; then
7245                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
7246                 d_fd_macros="$define"
7247         else
7248                 $cat >&4 <<'EOM'
7249 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
7250 EOM
7251                 d_fd_macros="$undef"
7252         fi
7253 else
7254         $cat <<'EOM'
7255 Hmm, your compiler has some difficulty with fd_set.  Checking further...
7256 EOM
7257         if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then
7258                 d_fds_bits="$undef"
7259                 d_fd_set="$define"
7260                 echo "Well, your system has some sort of fd_set available..." >&4
7261                 if ./fd_set; then
7262                         echo "and you have the normal fd_set macros." >&4
7263                         d_fd_macros="$define"
7264                 else
7265                         $cat <<'EOM'
7266 but not the normal fd_set macros!  Gross!  More work for me...
7267 EOM
7268                         d_fd_macros="$undef"
7269                 fi
7270         else
7271         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
7272                 d_fd_set="$undef"
7273                 d_fds_bits="$undef"
7274                 d_fd_macros="$undef"
7275         fi
7276 fi
7277 $rm -f fd_set*
7278
7279
7280 : check for type of arguments to select.  This will only really
7281 : work if the system supports prototypes and provides one for
7282 : select.
7283 case "$d_select" in
7284 $define)
7285         : Make initial guess
7286         case "$selecttype" in
7287         ''|' ')
7288                 case "$d_fd_set" in
7289                 $define) xxx='fd_set *' ;;
7290                 *) xxx='int *' ;;
7291                 esac
7292                 ;;
7293         *)      xxx="$selecttype" 
7294                 ;;
7295         esac
7296         : backup guess
7297         case "$xxx" in
7298         'fd_set *') yyy='int *' ;;
7299         'int *') yyy='fd_set *' ;;
7300         esac
7301
7302         $cat <<EOM
7303
7304 Checking to see what type of arguments are expected by select().
7305 EOM
7306         $cat >try.c <<EOCP
7307 #$i_systime I_SYS_TIME
7308 #$i_sysselct I_SYS_SELECT
7309 #$d_socket HAS_SOCKET
7310 #include <sys/types.h>
7311 #ifdef HAS_SOCKET
7312 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
7313 #endif
7314 #ifdef I_SYS_TIME
7315 #include <sys/time.h>
7316 #else
7317 #ifdef I_SYS_SELECT
7318 #include <sys/select.h>
7319 #endif
7320 #endif
7321 main()
7322 {
7323         int width;
7324         Select_fd_set_t readfds;
7325         Select_fd_set_t writefds;
7326         Select_fd_set_t exceptfds;
7327         struct timeval timeout;
7328         select(width, readfds, writefds, exceptfds, &timeout);
7329         exit(0);
7330 }
7331 EOCP
7332         if $cc $ccflags -c -DSelect_fd_set_t="$xxx" try.c >/dev/null 2>&1 ; then
7333                 selecttype="$xxx"
7334                 echo "Your system uses $xxx for the arguments to select." >&4
7335         elif $cc $ccflags -c -DSelect_fd_set_t="$yyy" try.c >/dev/null 2>&1 ; then
7336                 selecttype="$yyy"
7337                 echo "Your system uses $yyy for the arguments to select." >&4
7338         else
7339                 rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
7340                 dflt="$xxx"
7341                 . ./myread
7342                 selecttype="$ans"
7343         fi
7344         $rm -f try.[co]
7345         ;;
7346 *)      selecttype = 'int *' 
7347         ;;
7348 esac
7349
7350 : generate list of signal names
7351 echo " "
7352 case "$sig_name" in
7353 '')
7354         echo "Generating a list of signal names..." >&4
7355         xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h`
7356         xxx="$xxx "`./findhdr linux/signal.h`
7357         set X `cat $xxx 2>&1 | $awk '
7358 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
7359         sig[$3] = substr($2,4,20)
7360         if (max < $3 && $3 < 60) {
7361                 max = $3
7362         }
7363 }
7364
7365 END {
7366         for (i = 1; i <= max; i++) {
7367                 if (sig[i] == "")
7368                         printf "%d", i
7369                 else
7370                         printf "%s", sig[i]
7371                 if (i < max)
7372                         printf " "
7373         }
7374         printf "\n"
7375 }
7376 '`
7377         shift
7378         case $# in
7379         0)
7380                 echo 'kill -l' >/tmp/foo$$
7381                 set X `csh -f </tmp/foo$$`
7382                 $rm -f /tmp/foo$$
7383                 shift
7384                 case $# in
7385                 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
7386                 ;;
7387                 esac
7388                 ;;
7389         esac
7390         sig_name="ZERO $*"
7391         ;;
7392 esac
7393 echo "The following signals are available:"
7394 echo " "
7395 echo $sig_name | $awk \
7396 'BEGIN { linelen = 0 }
7397 {
7398         for (i = 1; i < NF; i++) {
7399                 name = "SIG" $i " "
7400                 linelen = linelen + length(name)
7401                 if (linelen > 70) {
7402                         printf "\n"
7403                         linelen = length(name)
7404                 }
7405                 printf "%s", name
7406         }
7407 }'
7408 echo " "
7409
7410 : see what type is used for size_t
7411 set size_t sizetype 'unsigned int' stdio.h sys/types.h
7412 eval $typedef
7413 dflt="$sizetype"
7414 echo " "
7415 rp="What type is used for the length parameter for string functions?"
7416 . ./myread
7417 sizetype="$ans"
7418
7419 : see what type is used for signed size_t
7420 set ssize_t ssizetype int stdio.h sys/types.h
7421 eval $typedef
7422 dflt="$ssizetype"
7423 $cat > ssize.c <<EOM
7424 #include <stdio.h>
7425 #include <sys/types.h>
7426 #define Size_t $sizetype
7427 #define SSize_t $dflt
7428 main()
7429 {
7430         if (sizeof(Size_t) == sizeof(SSize_t))
7431                 printf("$dflt\n");
7432         else if (sizeof(Size_t) == sizeof(int))
7433                 printf("int\n");
7434         else 
7435                 printf("long\n");
7436 }
7437 EOM
7438 echo " "
7439 if $cc $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 ; then
7440         ssizetype=`./ssize`
7441         echo "I'll be using $ssizetype for functions returning a byte count." >&4
7442 else
7443         echo "(I can't compile the test program--please enlighten me!)"
7444         $cat <<EOM
7445
7446 I need a type that is the same size as $sizetype, but is guaranteed to
7447 be signed.  Common values are int and long.
7448
7449 EOM
7450         rp="What signed type is the same size as $sizetype?"
7451         . ./myread
7452         ssizetype="$ans"
7453 fi
7454 $rm -f ssize ssize.[co]
7455
7456 : see what type of char stdio uses.
7457 echo " "
7458 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
7459         echo "Your stdio uses unsigned chars." >&4
7460         stdchar="unsigned char"
7461 else
7462         echo "Your stdio uses signed chars." >&4
7463         stdchar="char"
7464 fi
7465
7466 : see if time exists
7467 echo " "
7468 if set time val -f d_time; eval $csym; $val; then
7469         echo 'time() found.' >&4
7470         val="$define"
7471         set time_t timetype long stdio.h sys/types.h
7472         eval $typedef
7473         dflt="$timetype"
7474         echo " "
7475         rp="What type is returned by time() on this sytem?"
7476         . ./myread
7477         timetype="$ans"
7478 else
7479         echo 'time() not found, hope that will do.' >&4
7480         val="$undef"
7481         timetype='int';
7482 fi
7483 set d_time
7484 eval $setvar
7485
7486 : see what type uids are declared as in the kernel
7487 set uid_t uidtype xxx stdio.h sys/types.h
7488 eval $typedef
7489 case "$uidtype" in
7490 xxx)
7491         xxx=`./findhdr sys/user.h`
7492         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
7493         case $1 in
7494         unsigned) dflt="$1 $2" ;;
7495         *) dflt="$1" ;;
7496         esac
7497         ;;
7498 *) dflt="$uidtype";;
7499 esac
7500 echo " "
7501 rp="What is the type for user ids returned by getuid()?"
7502 . ./myread
7503 uidtype="$ans"
7504
7505 : see if this is a sys/file.h system
7506 val=''
7507 set sys/file.h val
7508 eval $inhdr
7509
7510 : do we need to #include <sys/file.h> ?
7511 case "$val" in
7512 "$define")
7513         echo " "
7514         if $h_sysfile; then
7515                 val="$define"
7516                 echo "We'll be including <sys/file.h>." >&4
7517         else
7518                 val="$undef"
7519                 echo "We won't be including <sys/file.h>." >&4
7520         fi
7521         ;;
7522 *)
7523         h_sysfile=false
7524         ;;
7525 esac
7526 set i_sysfile
7527 eval $setvar
7528
7529 : see if fcntl.h is there
7530 val=''
7531 set fcntl.h val
7532 eval $inhdr
7533
7534 : see if we can include fcntl.h
7535 case "$val" in
7536 "$define")
7537         echo " "
7538         if $h_fcntl; then
7539                 val="$define"
7540                 echo "We'll be including <fcntl.h>." >&4
7541         else
7542                 val="$undef"
7543                 if $h_sysfile; then
7544         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
7545                 else
7546                         echo "We won't be including <fcntl.h>." >&4
7547                 fi
7548         fi
7549         ;;
7550 *)
7551         h_fcntl=false
7552         val="$undef"
7553         ;;
7554 esac
7555 set i_fcntl
7556 eval $setvar
7557
7558 : see if this is an grp system
7559 set grp.h i_grp
7560 eval $inhdr
7561
7562 : see if this is a math.h system
7563 set math.h i_math
7564 eval $inhdr
7565
7566 : see if memory.h is available.
7567 val=''
7568 set memory.h val
7569 eval $inhdr
7570
7571 : See if it conflicts with string.h
7572 case "$val" in
7573 $define)
7574         case "$strings" in
7575         '') ;;
7576         *)
7577                 $cppstdin $cppflags $cppminus < $strings > mem.h
7578                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
7579                         echo " "
7580                         echo "We won't be including <memory.h>."
7581                         val="$undef"
7582                 fi
7583                 $rm -f mem.h
7584                 ;;
7585         esac
7586 esac
7587 set i_memory
7588 eval $setvar
7589
7590 : see if net/errno.h is available
7591 val=''
7592 set net/errno.h val
7593 eval $inhdr
7594
7595 : Unfortunately, it causes problems on some systems.  Arrgh.
7596 case "$val" in
7597 $define)
7598         cat > try.c <<'EOM'
7599 #include <stdio.h>
7600 #include <errno.h>
7601 #include <net/errno.h>
7602 int func()
7603 {
7604         return ENOTSOCK;
7605 }
7606 EOM
7607         if $cc $ccflags -c try.c >/dev/null 2>&1; then
7608                 echo "We'll be including <net/errno.h>." >&4
7609         else
7610                 echo "We won't be including <net/errno.h>." >&4
7611                 val="$undef"
7612         fi
7613         $rm -f try.* try
7614         ;;
7615 esac
7616 set i_neterrno
7617 eval $setvar
7618
7619 : get C preprocessor symbols handy
7620 echo " "
7621 $echo $n "Hmm... $c"
7622 echo $al | $tr ' ' '\012' >Cppsym.know
7623 $cat <<EOSS >Cppsym
7624 $startsh
7625 case "\$1" in
7626 -l) list=true
7627         shift
7628         ;;
7629 esac
7630 unknown=''
7631 case "\$list\$#" in
7632 1|2)
7633         for sym do
7634                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
7635                         exit 0
7636                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
7637                         :
7638                 else
7639                         unknown="\$unknown \$sym"
7640                 fi
7641         done
7642         set X \$unknown
7643         shift
7644         ;;
7645 esac
7646 case \$# in
7647 0) exit 1;;
7648 esac
7649 echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
7650 #ifdef \1\\
7651 exit 0; _ _ _ _\1\\      \1\\
7652 #endif\\
7653 /' >Cppsym\$\$
7654 echo "exit 1; _ _ _" >>Cppsym\$\$
7655 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
7656 case "\$list" in
7657 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
7658 *)
7659         sh Cppsym2\$\$
7660         status=\$?
7661         ;;
7662 esac
7663 $rm -f Cppsym\$\$ Cppsym2\$\$
7664 exit \$status
7665 EOSS
7666 chmod +x Cppsym
7667 $eunicefix Cppsym
7668 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
7669
7670 : now check the C compiler for additional symbols
7671 $cat >ccsym <<EOS
7672 $startsh
7673 $cat >tmp.c <<EOF
7674 extern int foo;
7675 EOF
7676 for i in \`$cc -v -c tmp.c 2>&1\`
7677 do
7678         case "\$i" in
7679         -D*) echo "\$i" | $sed 's/^-D//';;
7680         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
7681         esac
7682 done
7683 $rm -f try.c
7684 EOS
7685 chmod +x ccsym
7686 $eunicefix ccsym
7687 ./ccsym | $sort | $uniq >ccsym.raw
7688 $awk '/\=/ { print $0; next }
7689         { print $0"=1" }' ccsym.raw >ccsym.list
7690 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
7691 $comm -13 ccsym.true ccsym.list >ccsym.own
7692 $comm -12 ccsym.true ccsym.list >ccsym.com
7693 $comm -23 ccsym.true ccsym.list >ccsym.cpp
7694 also=''
7695 symbols='symbols'
7696 if $test -z ccsym.raw; then
7697         echo "Your C compiler doesn't seem to define any symbol!" >&4
7698         echo " "
7699         echo "However, your C preprocessor defines the following ones:"
7700         $cat Cppsym.true
7701 else
7702         if $test -s ccsym.com; then
7703                 echo "Your C compiler and pre-processor define these symbols:"
7704                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
7705                 also='also '
7706                 symbols='ones'
7707                 $test "$silent" || sleep 1
7708         fi
7709         if $test -s ccsym.cpp; then
7710                 $test "$also" && echo " "
7711                 echo "Your C pre-processor ${also}defines the following $symbols:"
7712                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
7713                 also='further '
7714                 $test "$silent" || sleep 1
7715         fi
7716         if $test -s ccsym.own; then
7717                 $test "$also" && echo " "
7718                 echo "Your C compiler ${also}defines the following cpp variables:"
7719                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
7720                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
7721                 $test "$silent" || sleep 1
7722         fi
7723 fi
7724 $rm -f ccsym*
7725
7726 : see if this is a termio system
7727 val="$undef"
7728 val2="$undef"
7729 val3="$undef"
7730 if $test `./findhdr termios.h`; then
7731         set tcsetattr i_termios
7732         eval $inlibc
7733         val3="$i_termios"
7734 fi
7735 echo " "
7736 case "$val3" in
7737 "$define") echo "You have POSIX termios.h... good!" >&4;;
7738 *) if ./Cppsym pyr; then
7739                 case "`/bin/universe`" in
7740                 ucb) if $test `./findhdr sgtty.h`; then
7741                                 val2="$define"
7742                                 echo "<sgtty.h> found." >&4
7743                         else
7744                                 echo "System is pyramid with BSD universe."
7745                                 echo "<sgtty.h> not found--you could have problems." >&4
7746                         fi;;
7747                 *) if $test `./findhdr termio.h`; then
7748                                 val="$define"
7749                                 echo "<termio.h> found." >&4
7750                         else
7751                                 echo "System is pyramid with USG universe."
7752                                 echo "<termio.h> not found--you could have problems." >&4
7753                         fi;;
7754                 esac
7755         elif ./usg; then
7756                 if $test `./findhdr termio.h`; then
7757                         echo "<termio.h> found." >&4
7758                         val="$define"
7759                 elif $test `./findhdr sgtty.h`; then
7760                         echo "<sgtty.h> found." >&4
7761                         val2="$define"
7762                 else
7763 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
7764                 fi
7765         else
7766                 if $test `./findhdr sgtty.h`; then
7767                         echo "<sgtty.h> found." >&4
7768                         val2="$define"
7769                 elif $test `./findhdr termio.h`; then
7770                         echo "<termio.h> found." >&4
7771                         val="$define"
7772                 else
7773 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
7774                 fi
7775         fi;;
7776 esac
7777 set i_termio; eval $setvar
7778 val=$val2; set i_sgtty; eval $setvar
7779 val=$val3; set i_termios; eval $setvar
7780
7781 : see if stdarg is available
7782 echo " "
7783 if $test `./findhdr stdarg.h`; then
7784         echo "<stdarg.h> found." >&4
7785         valstd="$define"
7786 else
7787         echo "<stdarg.h> NOT found." >&4
7788         valstd="$undef"
7789 fi
7790
7791 : see if varags is available
7792 echo " "
7793 if $test `./findhdr varargs.h`; then
7794         echo "<varargs.h> found." >&4
7795 else
7796         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
7797 fi
7798
7799 : set up the varargs testing programs
7800 $cat > varargs.c <<EOP
7801 #ifdef I_STDARG
7802 #include <stdarg.h>
7803 #endif
7804 #ifdef I_VARARGS
7805 #include <varargs.h>
7806 #endif
7807
7808 #ifdef I_STDARG
7809 int f(char *p, ...)
7810 #else
7811 int f(va_alist)
7812 va_dcl
7813 #endif
7814 {
7815         va_list ap;
7816 #ifndef I_STDARG
7817         char *p;
7818 #endif
7819 #ifdef I_STDARG
7820         va_start(ap,p);
7821 #else
7822         va_start(ap);
7823         p = va_arg(ap, char *);
7824 #endif
7825         va_end(ap);
7826 }
7827 EOP
7828 $cat > varargs <<EOP
7829 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
7830         echo "true"
7831 else
7832         echo "false"
7833 fi
7834 $rm -f varargs.o
7835 EOP
7836 chmod +x varargs
7837
7838 : now check which varargs header should be included
7839 echo " "
7840 i_varhdr=''
7841 case "$valstd" in
7842 "$define")
7843         if `./varargs I_STDARG`; then
7844                 val='stdarg.h'
7845         elif `./varargs I_VARARGS`; then
7846                 val='varargs.h'
7847         fi
7848         ;;
7849 *)
7850         if `./varargs I_VARARGS`; then
7851                 val='varargs.h'
7852         fi
7853         ;;
7854 esac
7855 case "$val" in
7856 '')
7857 echo "I could not find the definition for va_dcl... You have problems..." >&4
7858         val="$undef"; set i_stdarg; eval $setvar
7859         val="$undef"; set i_varargs; eval $setvar
7860         ;;
7861 *) 
7862         set i_varhdr
7863         eval $setvar
7864         case "$i_varhdr" in
7865         stdarg.h)
7866                 val="$define"; set i_stdarg; eval $setvar
7867                 val="$undef"; set i_varargs; eval $setvar
7868                 ;;
7869         varargs.h)
7870                 val="$undef"; set i_stdarg; eval $setvar
7871                 val="$define"; set i_varargs; eval $setvar
7872                 ;;
7873         esac
7874         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
7875 esac
7876 $rm -f varargs*
7877
7878 : see if stddef is available
7879 set stddef.h i_stddef
7880 eval $inhdr
7881
7882 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
7883 set sys/filio.h i_sysfilio
7884 eval $inhdr
7885 echo " "
7886 if $test `./findhdr sys/ioctl.h`; then
7887         val="$define"
7888         echo '<sys/ioctl.h> found.' >&4
7889 else
7890         val="$undef"
7891         if $test $i_sysfilio = "$define"; then
7892             echo '<sys/ioctl.h> NOT found.' >&4
7893         else
7894                 $test $i_sgtty = "$define" && xxx="sgtty.h"
7895                 $test $i_termio = "$define" && xxx="termio.h"
7896                 $test $i_termios = "$define" && xxx="termios.h"
7897 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
7898         fi
7899 fi
7900 set i_sysioctl
7901 eval $setvar
7902
7903 : see if this is a sys/param system
7904 set sys/param.h i_sysparam
7905 eval $inhdr
7906
7907 : see if sys/stat.h is available
7908 set sys/stat.h i_sysstat
7909 eval $inhdr
7910
7911 : see if sys/types.h has to be included
7912 set sys/types.h i_systypes
7913 eval $inhdr
7914
7915 : see if this is a unistd.h system
7916 set unistd.h i_unistd
7917 eval $inhdr
7918
7919 : see if this is an utime system
7920 set utime.h i_utime
7921 eval $inhdr
7922
7923 : see if this is a vfork system
7924 case "$d_vfork" in
7925 "$define")
7926         set vfork.h i_vfork
7927         eval $inhdr
7928         ;;
7929 *)
7930         i_vfork="$undef"
7931         ;;
7932 esac
7933
7934 : Remove build directory name from cppstdin so it can be used from
7935 : either the present location or the final installed location.
7936 echo " "
7937 : Get out of the UU directory to get correct path name.
7938 cd ..
7939 case "$cppstdin" in
7940 `pwd`/cppstdin)
7941         echo "Stripping down cppstdin path name"
7942         cppstdin=cppstdin
7943         ;;
7944 esac
7945 cd UU
7946
7947 : end of configuration questions
7948 echo " "
7949 echo "End of configuration questions."
7950 echo " "
7951
7952 : back to where it started
7953 if test -d ../UU; then
7954         cd ..
7955 fi
7956
7957 : configuration may be patched via a 'config.over' file
7958 if $test -f config.over; then
7959         echo " "
7960         dflt=y
7961         rp='I see a config.over file.  Do you wish to load it?'
7962         . UU/myread
7963         case "$ans" in
7964         n*) echo "OK, I'll ignore it.";;
7965         *)      . ./config.over
7966                 echo "Configuration override changes have been loaded."
7967                 ;;
7968         esac
7969 fi
7970
7971 : in case they want portability, strip down executable paths
7972 case "$d_portable" in
7973 "$define")
7974         echo " "
7975         echo "Stripping down executable paths..." >&4
7976         for file in $loclist $trylist; do
7977                 eval $file="\$file"
7978         done
7979         ;;
7980 esac
7981
7982 : create config.sh file
7983 echo " "
7984 echo "Creating config.sh..." >&4
7985 $spitshell <<EOT >config.sh
7986 $startsh
7987 #
7988 # This file was produced by running the Configure script. It holds all the
7989 # definitions figured out by Configure. Should you modify one of these values,
7990 # do not forget to propagate your changes by running "Configure -der". You may
7991 # instead choose to run each of the .SH files by yourself, or "Configure -S".
7992 #
7993
7994 # Configuration time: $cf_time
7995 # Configured by: $cf_by
7996 # Target system: $myuname
7997
7998 Author='$Author'
7999 Date='$Date'
8000 Header='$Header'
8001 Id='$Id'
8002 Locker='$Locker'
8003 Log='$Log'
8004 Mcc='$Mcc'
8005 RCSfile='$RCSfile'
8006 Revision='$Revision'
8007 Source='$Source'
8008 State='$State'
8009 afs='$afs'
8010 alignbytes='$alignbytes'
8011 aphostname='$aphostname'
8012 archlib='$archlib'
8013 archlibexp='$archlibexp'
8014 archname='$archname'
8015 awk='$awk'
8016 baserev='$baserev'
8017 bash='$bash'
8018 bin='$bin'
8019 binexp='$binexp'
8020 bison='$bison'
8021 byacc='$byacc'
8022 byteorder='$byteorder'
8023 c='$c'
8024 castflags='$castflags'
8025 cat='$cat'
8026 cc='$cc'
8027 cccdlflags='$cccdlflags'
8028 ccdlflags='$ccdlflags'
8029 ccflags='$ccflags'
8030 cf_by='$cf_by'
8031 cf_time='$cf_time'
8032 chgrp='$chgrp'
8033 chmod='$chmod'
8034 chown='$chown'
8035 clocktype='$clocktype'
8036 comm='$comm'
8037 compress='$compress'
8038 contains='$contains'
8039 cp='$cp'
8040 cpio='$cpio'
8041 cpp='$cpp'
8042 cpp_stuff='$cpp_stuff'
8043 cppflags='$cppflags'
8044 cpplast='$cpplast'
8045 cppminus='$cppminus'
8046 cpprun='$cpprun'
8047 cppstdin='$cppstdin'
8048 cryptlib='$cryptlib'
8049 csh='$csh'
8050 d_Gconvert='$d_Gconvert'
8051 d_access='$d_access'
8052 d_alarm='$d_alarm'
8053 d_archlib='$d_archlib'
8054 d_attribut='$d_attribut'
8055 d_bcmp='$d_bcmp'
8056 d_bcopy='$d_bcopy'
8057 d_bsd='$d_bsd'
8058 d_bsdpgrp='$d_bsdpgrp'
8059 d_bzero='$d_bzero'
8060 d_casti32='$d_casti32'
8061 d_castneg='$d_castneg'
8062 d_charvspr='$d_charvspr'
8063 d_chown='$d_chown'
8064 d_chroot='$d_chroot'
8065 d_chsize='$d_chsize'
8066 d_closedir='$d_closedir'
8067 d_const='$d_const'
8068 d_crypt='$d_crypt'
8069 d_csh='$d_csh'
8070 d_cuserid='$d_cuserid'
8071 d_dbl_dig='$d_dbl_dig'
8072 d_difftime='$d_difftime'
8073 d_dirnamlen='$d_dirnamlen'
8074 d_dlerror='$d_dlerror'
8075 d_dlopen='$d_dlopen'
8076 d_dlsymun='$d_dlsymun'
8077 d_dosuid='$d_dosuid'
8078 d_dup2='$d_dup2'
8079 d_eunice='$d_eunice'
8080 d_fchmod='$d_fchmod'
8081 d_fchown='$d_fchown'
8082 d_fcntl='$d_fcntl'
8083 d_fd_macros='$d_fd_macros'
8084 d_fd_set='$d_fd_set'
8085 d_fds_bits='$d_fds_bits'
8086 d_fgetpos='$d_fgetpos'
8087 d_flexfnam='$d_flexfnam'
8088 d_flock='$d_flock'
8089 d_fork='$d_fork'
8090 d_fpathconf='$d_fpathconf'
8091 d_fsetpos='$d_fsetpos'
8092 d_getgrps='$d_getgrps'
8093 d_gethent='$d_gethent'
8094 d_gethname='$d_gethname'
8095 d_getlogin='$d_getlogin'
8096 d_getpgrp2='$d_getpgrp2'
8097 d_getpgrp='$d_getpgrp'
8098 d_getppid='$d_getppid'
8099 d_getprior='$d_getprior'
8100 d_htonl='$d_htonl'
8101 d_index='$d_index'
8102 d_isascii='$d_isascii'
8103 d_killpg='$d_killpg'
8104 d_link='$d_link'
8105 d_locconv='$d_locconv'
8106 d_lockf='$d_lockf'
8107 d_lstat='$d_lstat'
8108 d_mblen='$d_mblen'
8109 d_mbstowcs='$d_mbstowcs'
8110 d_mbtowc='$d_mbtowc'
8111 d_memcmp='$d_memcmp'
8112 d_memcpy='$d_memcpy'
8113 d_memmove='$d_memmove'
8114 d_memset='$d_memset'
8115 d_mkdir='$d_mkdir'
8116 d_mkfifo='$d_mkfifo'
8117 d_mktime='$d_mktime'
8118 d_msg='$d_msg'
8119 d_msgctl='$d_msgctl'
8120 d_msgget='$d_msgget'
8121 d_msgrcv='$d_msgrcv'
8122 d_msgsnd='$d_msgsnd'
8123 d_mymalloc='$d_mymalloc'
8124 d_nice='$d_nice'
8125 d_oldsock='$d_oldsock'
8126 d_open3='$d_open3'
8127 d_pathconf='$d_pathconf'
8128 d_pause='$d_pause'
8129 d_phostname='$d_phostname'
8130 d_pipe='$d_pipe'
8131 d_portable='$d_portable'
8132 d_pwage='$d_pwage'
8133 d_pwchange='$d_pwchange'
8134 d_pwclass='$d_pwclass'
8135 d_pwcomment='$d_pwcomment'
8136 d_pwexpire='$d_pwexpire'
8137 d_pwquota='$d_pwquota'
8138 d_readdir='$d_readdir'
8139 d_readlink='$d_readlink'
8140 d_rename='$d_rename'
8141 d_rewinddir='$d_rewinddir'
8142 d_rmdir='$d_rmdir'
8143 d_safebcpy='$d_safebcpy'
8144 d_safemcpy='$d_safemcpy'
8145 d_seekdir='$d_seekdir'
8146 d_select='$d_select'
8147 d_sem='$d_sem'
8148 d_semctl='$d_semctl'
8149 d_semget='$d_semget'
8150 d_semop='$d_semop'
8151 d_setegid='$d_setegid'
8152 d_seteuid='$d_seteuid'
8153 d_setlinebuf='$d_setlinebuf'
8154 d_setlocale='$d_setlocale'
8155 d_setpgid='$d_setpgid'
8156 d_setpgrp2='$d_setpgrp2'
8157 d_setpgrp='$d_setpgrp'
8158 d_setprior='$d_setprior'
8159 d_setregid='$d_setregid'
8160 d_setresgid='$d_setresgid'
8161 d_setresuid='$d_setresuid'
8162 d_setreuid='$d_setreuid'
8163 d_setrgid='$d_setrgid'
8164 d_setruid='$d_setruid'
8165 d_setsid='$d_setsid'
8166 d_shm='$d_shm'
8167 d_shmat='$d_shmat'
8168 d_shmatprototype='$d_shmatprototype'
8169 d_shmctl='$d_shmctl'
8170 d_shmdt='$d_shmdt'
8171 d_shmget='$d_shmget'
8172 d_shrplib='$d_shrplib'
8173 d_sitelib='$d_sitelib'
8174 d_socket='$d_socket'
8175 d_sockpair='$d_sockpair'
8176 d_statblks='$d_statblks'
8177 d_stdiobase='$d_stdiobase'
8178 d_stdstdio='$d_stdstdio'
8179 d_strchr='$d_strchr'
8180 d_strcoll='$d_strcoll'
8181 d_strctcpy='$d_strctcpy'
8182 d_strerrm='$d_strerrm'
8183 d_strerror='$d_strerror'
8184 d_strxfrm='$d_strxfrm'
8185 d_suidsafe='$d_suidsafe'
8186 d_symlink='$d_symlink'
8187 d_syscall='$d_syscall'
8188 d_sysconf='$d_sysconf'
8189 d_sysernlst='$d_sysernlst'
8190 d_syserrlst='$d_syserrlst'
8191 d_system='$d_system'
8192 d_tcgetpgrp='$d_tcgetpgrp'
8193 d_tcsetpgrp='$d_tcsetpgrp'
8194 d_telldir='$d_telldir'
8195 d_time='$d_time'
8196 d_times='$d_times'
8197 d_truncate='$d_truncate'
8198 d_tzname='$d_tzname'
8199 d_umask='$d_umask'
8200 d_uname='$d_uname'
8201 d_vfork='$d_vfork'
8202 d_void_closedir='$d_void_closedir'
8203 d_voidsig='$d_voidsig'
8204 d_voidtty='$d_voidtty'
8205 d_volatile='$d_volatile'
8206 d_vprintf='$d_vprintf'
8207 d_wait4='$d_wait4'
8208 d_waitpid='$d_waitpid'
8209 d_wcstombs='$d_wcstombs'
8210 d_wctomb='$d_wctomb'
8211 d_xenix='$d_xenix'
8212 date='$date'
8213 db_hashtype='$db_hashtype'
8214 db_prefixtype='$db_prefixtype'
8215 defvoidused='$defvoidused'
8216 direntrytype='$direntrytype'
8217 dlext='$dlext'
8218 dlsrc='$dlsrc'
8219 dynamic_ext='$dynamic_ext'
8220 echo='$echo'
8221 egrep='$egrep'
8222 emacs='$emacs'
8223 eunicefix='$eunicefix'
8224 expr='$expr'
8225 extensions='$extensions'
8226 find='$find'
8227 flex='$flex'
8228 fpostype='$fpostype'
8229 freetype='$freetype'
8230 full_csh='$full_csh'
8231 full_sed='$full_sed'
8232 gcc='$gcc'
8233 gccversion='$gccversion'
8234 gidtype='$gidtype'
8235 glibpth='$glibpth'
8236 grep='$grep'
8237 groupcat='$groupcat'
8238 groupstype='$groupstype'
8239 h_fcntl='$h_fcntl'
8240 h_sysfile='$h_sysfile'
8241 hint='$hint'
8242 hostcat='$hostcat'
8243 huge='$huge'
8244 i_bsdioctl='$i_bsdioctl'
8245 i_db='$i_db'
8246 i_dbm='$i_dbm'
8247 i_dirent='$i_dirent'
8248 i_dld='$i_dld'
8249 i_dlfcn='$i_dlfcn'
8250 i_fcntl='$i_fcntl'
8251 i_float='$i_float'
8252 i_gdbm='$i_gdbm'
8253 i_grp='$i_grp'
8254 i_limits='$i_limits'
8255 i_malloc='$i_malloc'
8256 i_math='$i_math'
8257 i_memory='$i_memory'
8258 i_ndbm='$i_ndbm'
8259 i_neterrno='$i_neterrno'
8260 i_niin='$i_niin'
8261 i_pwd='$i_pwd'
8262 i_sgtty='$i_sgtty'
8263 i_stdarg='$i_stdarg'
8264 i_stddef='$i_stddef'
8265 i_stdlib='$i_stdlib'
8266 i_string='$i_string'
8267 i_sysdir='$i_sysdir'
8268 i_sysfile='$i_sysfile'
8269 i_sysfilio='$i_sysfilio'
8270 i_sysin='$i_sysin'
8271 i_sysioctl='$i_sysioctl'
8272 i_sysndir='$i_sysndir'
8273 i_sysparam='$i_sysparam'
8274 i_sysselct='$i_sysselct'
8275 i_syssockio='$i_syssockio'
8276 i_sysstat='$i_sysstat'
8277 i_systime='$i_systime'
8278 i_systimek='$i_systimek'
8279 i_systimes='$i_systimes'
8280 i_systypes='$i_systypes'
8281 i_termio='$i_termio'
8282 i_termios='$i_termios'
8283 i_time='$i_time'
8284 i_unistd='$i_unistd'
8285 i_utime='$i_utime'
8286 i_varargs='$i_varargs'
8287 i_varhdr='$i_varhdr'
8288 i_vfork='$i_vfork'
8289 incpath='$incpath'
8290 inews='$inews'
8291 installarchlib='$installarchlib'
8292 installbin='$installbin'
8293 installman1dir='$installman1dir'
8294 installman3dir='$installman3dir'
8295 installprivlib='$installprivlib'
8296 installscript='$installscript'
8297 installsitelib='$installsitelib'
8298 intsize='$intsize'
8299 known_extensions='$known_extensions'
8300 ksh='$ksh'
8301 large='$large'
8302 ld='$ld'
8303 lddlflags='$lddlflags'
8304 ldflags='$ldflags'
8305 less='$less'
8306 libc='$libc'
8307 libpth='$libpth'
8308 libs='$libs'
8309 libswanted='$libswanted'
8310 line='$line'
8311 lint='$lint'
8312 lkflags='$lkflags'
8313 ln='$ln'
8314 lns='$lns'
8315 lp='$lp'
8316 lpr='$lpr'
8317 ls='$ls'
8318 lseektype='$lseektype'
8319 mail='$mail'
8320 mailx='$mailx'
8321 make='$make'
8322 mallocobj='$mallocobj'
8323 mallocsrc='$mallocsrc'
8324 malloctype='$malloctype'
8325 man1dir='$man1dir'
8326 man1direxp='$man1direxp'
8327 man1ext='$man1ext'
8328 man3dir='$man3dir'
8329 man3direxp='$man3direxp'
8330 man3ext='$man3ext'
8331 medium='$medium'
8332 mips='$mips'
8333 mips_type='$mips_type'
8334 mkdir='$mkdir'
8335 models='$models'
8336 modetype='$modetype'
8337 more='$more'
8338 mv='$mv'
8339 myarchname='$myarchname'
8340 mydomain='$mydomain'
8341 myhostname='$myhostname'
8342 myuname='$myuname'
8343 n='$n'
8344 nm_opt='$nm_opt'
8345 nroff='$nroff'
8346 optimize='$optimize'
8347 orderlib='$orderlib'
8348 osname='$osname'
8349 osvers='$osvers'
8350 package='$package'
8351 passcat='$passcat'
8352 patchlevel='$patchlevel'
8353 perl='$perl'
8354 pg='$pg'
8355 phostname='$phostname'
8356 plibpth='$plibpth'
8357 pmake='$pmake'
8358 pr='$pr'
8359 prefix='$prefix'
8360 prefixexp='$prefixexp'
8361 privlib='$privlib'
8362 privlibexp='$privlibexp'
8363 prototype='$prototype'
8364 randbits='$randbits'
8365 ranlib='$ranlib'
8366 rm='$rm'
8367 rmail='$rmail'
8368 runnm='$runnm'
8369 scriptdir='$scriptdir'
8370 scriptdirexp='$scriptdirexp'
8371 sed='$sed'
8372 selecttype='$selecttype'
8373 sendmail='$sendmail'
8374 sh='$sh'
8375 shar='$shar'
8376 sharpbang='$sharpbang'
8377 shmattype='$shmattype'
8378 shrpdir='$shrpdir'
8379 shsharp='$shsharp'
8380 sig_name='$sig_name'
8381 signal_t='$signal_t'
8382 sitelib='$sitelib'
8383 sitelibexp='$sitelibexp'
8384 sizetype='$sizetype'
8385 sleep='$sleep'
8386 smail='$smail'
8387 small='$small'
8388 so='$so'
8389 sockethdr='$sockethdr'
8390 socketlib='$socketlib'
8391 sort='$sort'
8392 spackage='$spackage'
8393 spitshell='$spitshell'
8394 split='$split'
8395 ssizetype='$ssizetype'
8396 startsh='$startsh'
8397 static_ext='$static_ext'
8398 stdchar='$stdchar'
8399 stdio_base='$stdio_base'
8400 stdio_bufsiz='$stdio_bufsiz'
8401 stdio_cnt='$stdio_cnt'
8402 stdio_ptr='$stdio_ptr'
8403 strings='$strings'
8404 submit='$submit'
8405 sysman='$sysman'
8406 tail='$tail'
8407 tar='$tar'
8408 tbl='$tbl'
8409 test='$test'
8410 timeincl='$timeincl'
8411 timetype='$timetype'
8412 touch='$touch'
8413 tr='$tr'
8414 troff='$troff'
8415 uidtype='$uidtype'
8416 uname='$uname'
8417 uniq='$uniq'
8418 usedl='$usedl'
8419 usemymalloc='$usemymalloc'
8420 usenm='$usenm'
8421 useposix='$useposix'
8422 usevfork='$usevfork'
8423 usrinc='$usrinc'
8424 uuname='$uuname'
8425 vi='$vi'
8426 voidflags='$voidflags'
8427 xlibpth='$xlibpth'
8428 zcat='$zcat'
8429 EOT
8430
8431 : add special variables
8432 $test -f patchlevel.h && \
8433 awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
8434 echo "CONFIG=true" >>config.sh
8435
8436 : propagate old symbols
8437 if $test -f UU/config.sh; then
8438         <UU/config.sh sort | uniq >UU/oldconfig.sh
8439         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
8440         sort | uniq -u >UU/oldsyms
8441         set X `cat UU/oldsyms`
8442         shift
8443         case $# in
8444         0) ;;
8445         *)
8446                 cat <<EOM
8447 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
8448 EOM
8449                 echo "# Variables propagated from previous config.sh file." >>config.sh
8450                 for sym in `cat UU/oldsyms`; do
8451                         echo "    Propagating $hint variable "'$'"$sym..."
8452                         eval 'tmp="$'"${sym}"'"'
8453                         echo "$tmp" | \
8454                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
8455                 done
8456                 ;;
8457         esac
8458 fi
8459
8460 : Finish up by extracting the .SH files
8461 case "$alldone" in
8462 exit)
8463         $rm -rf UU
8464         echo "Done."
8465         exit 0
8466         ;;
8467 cont)
8468         ;;
8469 '')
8470         dflt=''
8471         nostick=true
8472         $cat <<EOM
8473
8474 If you'd like to make any changes to the config.sh file before I begin
8475 to configure things, do it as a shell escape now (e.g. !vi config.sh).
8476
8477 EOM
8478         rp="Press return or use a shell escape to edit config.sh:"
8479         . UU/myread
8480         nostick=''
8481         case "$ans" in
8482         '') ;;
8483         *) : in case they cannot read
8484                 sh 1>&4 -c "$ans";;
8485         esac
8486         ;;
8487 esac
8488
8489 : if this fails, just run all the .SH files by hand
8490 . ./config.sh
8491
8492 echo " "
8493 exec 1>&4
8494 . ./UU/extract
8495
8496 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
8497         dflt=y
8498         case "$silent" in
8499         true) ;;
8500         *)
8501                 $cat <<EOM
8502
8503 Now you need to generate make dependencies by running "make depend".
8504 You might prefer to run it in background: "make depend > makedepend.out &"
8505 It can take a while, so you might not want to run it right now.
8506
8507 EOM
8508                 ;;
8509         esac
8510         rp="Run make depend now?"
8511         . UU/myread
8512         case "$ans" in
8513         y*)
8514                 make depend && echo "Now you must run a make."
8515                 ;;
8516         *)
8517                 echo "You must run 'make depend' then 'make'."
8518                 ;;
8519         esac
8520 elif test -f [Mm]akefile; then
8521         echo " "
8522         echo "Now you must run a make."
8523 else
8524         echo "Done."
8525 fi
8526
8527 $rm -f kit*isdone ark*isdone
8528 $rm -rf UU
8529
8530 : End of Configure
8531