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