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