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