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