This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Making Perl work on DYNIX/ptx
[perl5.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 and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu Nov  5 14:26:57 EET 1998 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by jhi@iki.fi)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 case "$inksh/$needksh" in
112 /[a-z]*)
113                 ENV=''
114                 changesh=true
115                 reason="$needksh"
116         ;;
117 esac
118 case "$inksh/$avoidksh" in
119 true/[a-z]*)
120         changesh=true
121         reason="$avoidksh"
122         ;;
123 esac
124 case "$inksh/$needksh-$avoidksh-" in
125 true/--)
126                 cat <<EOM
127 (I see you are using the Korn shell.  Some ksh's blow up on $me,
128 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
129 EOM
130         ;;
131 esac
132 case "$changesh" in
133 true)
134         echo "(Feeding myself to $newsh $reason.)"
135         case "$0" in
136         Configure|*/Configure) exec $newsh $0 "$@";;
137         *) exec $newsh Configure "$@";;
138         esac
139         ;;
140 esac
141
142 : if needed set CDPATH to a harmless value that is not chatty
143 : avoid bash 2.02 problems with empty CDPATH.
144 case "$CDPATH" in
145 '')     ;;
146 *)      case "$SHELL" in
147         *bash*) CDPATH='.' ;;
148         *)              CDPATH='' ;;
149         esac
150         ;;
151 esac
152 : Configure runs within the UU subdirectory
153 test -d UU || mkdir UU
154 cd UU && rm -f ./*
155
156 dynamic_ext=''
157 extensions=''
158 known_extensions=''
159 nonxs_ext=''
160 static_ext=''
161 useopcode=''
162 useposix=''
163 d_bsd=''
164 d_eunice=''
165 d_xenix=''
166 eunicefix=''
167 Mcc=''
168 ar=''
169 awk=''
170 bash=''
171 bison=''
172 byacc=''
173 cat=''
174 chgrp=''
175 chmod=''
176 chown=''
177 comm=''
178 compress=''
179 cp=''
180 cpio=''
181 cpp=''
182 csh=''
183 date=''
184 echo=''
185 egrep=''
186 emacs=''
187 expr=''
188 find=''
189 flex=''
190 grep=''
191 gzip=''
192 inews=''
193 ksh=''
194 less=''
195 line=''
196 lint=''
197 ln=''
198 lp=''
199 lpr=''
200 ls=''
201 mail=''
202 mailx=''
203 make=''
204 mkdir=''
205 more=''
206 mv=''
207 nm=''
208 nroff=''
209 perl=''
210 pg=''
211 pmake=''
212 pr=''
213 rm=''
214 rmail=''
215 sed=''
216 sendmail=''
217 shar=''
218 sleep=''
219 smail=''
220 sort=''
221 submit=''
222 tail=''
223 tar=''
224 tbl=''
225 tee=''
226 test=''
227 touch=''
228 tr=''
229 troff=''
230 uname=''
231 uniq=''
232 uuname=''
233 vi=''
234 zcat=''
235 zip=''
236 full_sed=''
237 libswanted=''
238 hint=''
239 myuname=''
240 osname=''
241 osvers=''
242 Author=''
243 Date=''
244 Header=''
245 Id=''
246 Locker=''
247 Log=''
248 RCSfile=''
249 Revision=''
250 Source=''
251 State=''
252 _a=''
253 _exe=''
254 _o=''
255 archobjs=''
256 exe_ext=''
257 firstmakefile=''
258 lib_ext=''
259 obj_ext=''
260 path_sep=''
261 afs=''
262 alignbytes=''
263 ansi2knr=''
264 archlib=''
265 archlibexp=''
266 d_archlib=''
267 installarchlib=''
268 archname=''
269 myarchname=''
270 baserev=''
271 bin=''
272 binexp=''
273 installbin=''
274 byteorder=''
275 cc=''
276 gccversion=''
277 ccflags=''
278 cppflags=''
279 ldflags=''
280 lkflags=''
281 locincpth=''
282 optimize=''
283 cf_email=''
284 cf_by=''
285 cf_time=''
286 contains=''
287 cpp_stuff=''
288 cpplast=''
289 cppminus=''
290 cpprun=''
291 cppstdin=''
292 d_access=''
293 d_accessx=''
294 d_alarm=''
295 d_attribut=''
296 d_bcmp=''
297 d_bcopy=''
298 d_bzero=''
299 d_casti32=''
300 castflags=''
301 d_castneg=''
302 d_chown=''
303 d_chroot=''
304 d_chsize=''
305 d_closedir=''
306 d_void_closedir=''
307 d_const=''
308 cryptlib=''
309 d_crypt=''
310 d_csh=''
311 full_csh=''
312 d_cuserid=''
313 d_dbl_dig=''
314 d_difftime=''
315 d_dlerror=''
316 d_dlopen=''
317 d_dlsymun=''
318 d_dosuid=''
319 d_suidsafe=''
320 d_drand48proto=''
321 d_dup2=''
322 d_eaccess=''
323 d_endgrent=''
324 d_endhent=''
325 d_endnent=''
326 d_endpent=''
327 d_endpwent=''
328 d_endsent=''
329 d_fchmod=''
330 d_fchown=''
331 d_fcntl=''
332 d_fd_macros=''
333 d_fd_set=''
334 d_fds_bits=''
335 d_fgetpos=''
336 d_flexfnam=''
337 d_flock=''
338 d_fork=''
339 d_fseeko=''
340 d_fsetpos=''
341 d_ftello=''
342 d_ftime=''
343 d_gettimeod=''
344 d_Gconvert=''
345 d_getgrent=''
346 d_getgrps=''
347 d_gethbyaddr=''
348 d_gethbyname=''
349 d_gethent=''
350 aphostname=''
351 d_gethname=''
352 d_phostname=''
353 d_uname=''
354 d_gethostprotos=''
355 d_getlogin=''
356 d_getnbyaddr=''
357 d_getnbyname=''
358 d_getnent=''
359 d_getnetprotos=''
360 d_getpent=''
361 d_getpgid=''
362 d_getpgrp2=''
363 d_bsdgetpgrp=''
364 d_getpgrp=''
365 d_getppid=''
366 d_getprior=''
367 d_getpbyname=''
368 d_getpbynumber=''
369 d_getprotoprotos=''
370 d_getpwent=''
371 d_getsent=''
372 d_getservprotos=''
373 d_getsbyname=''
374 d_getsbyport=''
375 d_gnulibc=''
376 d_htonl=''
377 d_inetaton=''
378 d_isascii=''
379 d_killpg=''
380 d_lchown=''
381 d_link=''
382 d_locconv=''
383 d_lockf=''
384 d_longdbl=''
385 longdblsize=''
386 d_longlong=''
387 longlongsize=''
388 d_lstat=''
389 d_mblen=''
390 d_mbstowcs=''
391 d_mbtowc=''
392 d_memcmp=''
393 d_memcpy=''
394 d_memmove=''
395 d_memset=''
396 d_mkdir=''
397 d_mkfifo=''
398 d_mktime=''
399 d_msg=''
400 d_msgctl=''
401 d_msgget=''
402 d_msgrcv=''
403 d_msgsnd=''
404 d_nice=''
405 d_open3=''
406 d_fpathconf=''
407 d_pathconf=''
408 d_pause=''
409 d_pipe=''
410 d_poll=''
411 d_portable=''
412 d_pthread_create_joinable=''
413 pthread_create_joinable=''
414 d_pthread_yield=''
415 d_sched_yield=''
416 sched_yield=''
417 d_readdir=''
418 d_rewinddir=''
419 d_seekdir=''
420 d_telldir=''
421 d_readlink=''
422 d_rename=''
423 d_rmdir=''
424 d_safebcpy=''
425 d_safemcpy=''
426 d_sanemcmp=''
427 d_select=''
428 d_sem=''
429 d_semctl=''
430 d_semget=''
431 d_semop=''
432 d_setegid=''
433 d_seteuid=''
434 d_setgrent=''
435 d_setgrps=''
436 d_sethent=''
437 d_setlinebuf=''
438 d_setlocale=''
439 d_setnent=''
440 d_setpent=''
441 d_setpgid=''
442 d_setpgrp2=''
443 d_bsdsetpgrp=''
444 d_setpgrp=''
445 d_setprior=''
446 d_setpwent=''
447 d_setregid=''
448 d_setresgid=''
449 d_setresuid=''
450 d_setreuid=''
451 d_setrgid=''
452 d_setruid=''
453 d_setsent=''
454 d_setsid=''
455 d_setvbuf=''
456 d_sfio=''
457 usesfio=''
458 d_shm=''
459 d_shmat=''
460 d_shmatprototype=''
461 shmattype=''
462 d_shmctl=''
463 d_shmdt=''
464 d_shmget=''
465 d_sigaction=''
466 d_sigsetjmp=''
467 d_oldsock=''
468 d_socket=''
469 d_sockpair=''
470 sockethdr=''
471 socketlib=''
472 d_statblks=''
473 d_stdio_cnt_lval=''
474 d_stdio_ptr_lval=''
475 d_stdiobase=''
476 d_stdstdio=''
477 stdio_base=''
478 stdio_bufsiz=''
479 stdio_cnt=''
480 stdio_filbuf=''
481 stdio_ptr=''
482 d_index=''
483 d_strchr=''
484 d_strcoll=''
485 d_strctcpy=''
486 d_strerrm=''
487 d_strerror=''
488 d_sysernlst=''
489 d_syserrlst=''
490 d_strtod=''
491 d_strtol=''
492 d_strtoul=''
493 d_strxfrm=''
494 d_symlink=''
495 d_syscall=''
496 d_sysconf=''
497 d_system=''
498 d_tcgetpgrp=''
499 d_tcsetpgrp=''
500 d_time=''
501 timetype=''
502 clocktype=''
503 d_times=''
504 d_truncate=''
505 d_tzname=''
506 d_umask=''
507 d_semctl_semid_ds=''
508 d_semctl_semun=''
509 d_union_semun=''
510 d_vfork=''
511 usevfork=''
512 d_voidsig=''
513 signal_t=''
514 d_volatile=''
515 d_charvspr=''
516 d_vprintf=''
517 d_wait4=''
518 d_waitpid=''
519 d_wcstombs=''
520 d_wctomb=''
521 d_dbmclose64=''
522 d_dbminit64=''
523 d_delete64=''
524 d_fetch64=''
525 d_firstkey64=''
526 d_nextkey64=''
527 d_store64=''
528 dlext=''
529 cccdlflags=''
530 ccdlflags=''
531 dlsrc=''
532 ld=''
533 lddlflags=''
534 usedl=''
535 doublesize=''
536 ebcdic=''
537 fpostype=''
538 gidtype=''
539 groupstype=''
540 h_fcntl=''
541 h_sysfile=''
542 i_arpainet=''
543 db_hashtype=''
544 db_prefixtype=''
545 i_db=''
546 i_dbm=''
547 i_rpcsvcdbm=''
548 d_dirnamlen=''
549 direntrytype=''
550 i_dirent=''
551 i_dld=''
552 i_dlfcn=''
553 i_fcntl=''
554 i_float=''
555 i_gdbm=''
556 d_grpasswd=''
557 i_grp=''
558 d_int64t=''
559 i_inttypes=''
560 i_limits=''
561 i_locale=''
562 i_machcthr=''
563 i_malloc=''
564 i_math=''
565 i_memory=''
566 i_ndbm=''
567 i_netdb=''
568 i_neterrno=''
569 i_niin=''
570 i_sysin=''
571 d_pwage=''
572 d_pwchange=''
573 d_pwclass=''
574 d_pwcomment=''
575 d_pwexpire=''
576 d_pwgecos=''
577 d_pwpasswd=''
578 d_pwquota=''
579 i_pwd=''
580 i_sfio=''
581 i_stddef=''
582 i_stdlib=''
583 i_string=''
584 strings=''
585 i_sysaccess=''
586 i_sysdir=''
587 i_sysfile=''
588 d_voidtty=''
589 i_bsdioctl=''
590 i_sysfilio=''
591 i_sysioctl=''
592 i_syssockio=''
593 i_sysndir=''
594 i_sysparam=''
595 i_sysresrc=''
596 i_syssecrt=''
597 i_sysselct=''
598 i_sysstat=''
599 i_systimes=''
600 i_systypes=''
601 i_sysun=''
602 i_syswait=''
603 i_sgtty=''
604 i_termio=''
605 i_termios=''
606 i_systime=''
607 i_systimek=''
608 i_time=''
609 timeincl=''
610 i_unistd=''
611 i_utime=''
612 i_values=''
613 i_stdarg=''
614 i_varargs=''
615 i_varhdr=''
616 i_vfork=''
617 intsize=''
618 longsize=''
619 shortsize=''
620 d_dirent64s=''
621 d_flock64s=''
622 d_fstat64=''
623 d_ftruncate64=''
624 d_ino64t=''
625 d_lockf64=''
626 d_lseek64=''
627 d_lstat64=''
628 d_off64t=''
629 d_open64=''
630 d_opendir64=''
631 d_readdir64=''
632 d_seekdir64=''
633 d_stat64=''
634 d_telldir64=''
635 d_truncate64=''
636 libc=''
637 libperl=''
638 shrpenv=''
639 useshrplib=''
640 glibpth=''
641 libpth=''
642 loclibpth=''
643 plibpth=''
644 xlibpth=''
645 ignore_versioned_solibs=''
646 libs=''
647 lns=''
648 lseeksize=''
649 lseektype=''
650 make_set_make=''
651 d_mymalloc=''
652 freetype=''
653 mallocobj=''
654 mallocsrc=''
655 malloctype=''
656 usemymalloc=''
657 installman1dir=''
658 man1dir=''
659 man1direxp=''
660 man1ext=''
661 installman3dir=''
662 man3dir=''
663 man3direxp=''
664 man3ext=''
665 huge=''
666 large=''
667 medium=''
668 models=''
669 small=''
670 split=''
671 modetype=''
672 mydomain=''
673 myhostname=''
674 phostname=''
675 c=''
676 n=''
677 d_eofnblk=''
678 eagain=''
679 o_nonblock=''
680 rd_nodata=''
681 netdb_hlen_type=''
682 netdb_host_type=''
683 netdb_name_type=''
684 netdb_net_type=''
685 groupcat=''
686 hostcat=''
687 passcat=''
688 orderlib=''
689 ranlib=''
690 package=''
691 spackage=''
692 pager=''
693 apiversion=''
694 patchlevel=''
695 subversion=''
696 version=''
697 perladmin=''
698 perlpath=''
699 pidtype=''
700 prefix=''
701 prefixexp=''
702 installprivlib=''
703 privlib=''
704 privlibexp=''
705 prototype=''
706 ptrsize=''
707 drand01=''
708 randbits=''
709 randfunc=''
710 randseedtype=''
711 seedfunc=''
712 installscript=''
713 scriptdir=''
714 scriptdirexp=''
715 selectminbits=''
716 selecttype=''
717 sh=''
718 sig_name=''
719 sig_name_init=''
720 sig_num=''
721 sig_num_init=''
722 installsitearch=''
723 sitearch=''
724 sitearchexp=''
725 installsitelib=''
726 sitelib=''
727 sitelibexp=''
728 sizetype=''
729 so=''
730 sharpbang=''
731 shsharp=''
732 spitshell=''
733 src=''
734 ssizetype=''
735 startperl=''
736 startsh=''
737 stdchar=''
738 d_fgetpos64=''
739 d_fopen64=''
740 d_freopen64=''
741 d_fseek64=''
742 d_fseeko64=''
743 d_fsetpos64=''
744 d_ftell64=''
745 d_ftello64=''
746 d_tmpfile64=''
747 sysman=''
748 trnl=''
749 uidtype=''
750 archname64=''
751 use64bits=''
752 usemultiplicity=''
753 nm_opt=''
754 nm_so_opt=''
755 runnm=''
756 usenm=''
757 useperlio=''
758 d_oldpthreads=''
759 usethreads=''
760 incpath=''
761 mips=''
762 mips_type=''
763 usrinc=''
764 defvoidused=''
765 voidflags=''
766 CONFIG=''
767
768 define='define'
769 undef='undef'
770 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
771 rmlist=''
772
773 : We must find out about Eunice early
774 eunicefix=':'
775 if test -f /etc/unixtovms; then
776         eunicefix=/etc/unixtovms
777 fi
778 if test -f /etc/unixtovms.exe; then
779         eunicefix=/etc/unixtovms.exe
780 fi
781
782 i_whoami=''
783 : change the next line if compiling for Xenix/286 on Xenix/386
784 xlibpth='/usr/lib/386 /lib/386'
785
786 : Possible local library directories to search.
787 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
788 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
789
790 : general looking path for locating libraries
791 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
792 glibpth="$glibpth /lib /usr/lib $xlibpth"
793 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
794 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
795
796 : Private path used by Configure to find libraries.  Its value
797 : is prepended to libpth. This variable takes care of special
798 : machines, like the mips.  Usually, it should be empty.
799 plibpth=''
800
801 : Possible local include directories to search.
802 : Set locincpth to "" in a hint file to defeat local include searches.
803 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
804 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
805 :
806 : no include file wanted by default
807 inclwanted=''
808
809 : list of known cpp symbols, sorted alphabetically
810 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
811 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
812 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
813 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
814 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
815 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
816 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
817 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
818 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
819 al="$al VMS Xenix286"
820 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
821 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
822 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
823 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
824 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
825 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
826 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
827 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
828 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
829 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
830 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
831 al="$al __SVR4_2__ __UMAXV__"
832 al="$al ____386BSD____ __alpha __alpha__ __amiga"
833 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
834 al="$al __host_mips__"
835 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
836 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
837 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
838 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
839 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
840 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
841 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
842 al="$al __mc88100 __mc88100__ __mips __mips__"
843 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
844 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
845 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
846 al="$al _host_mips _mips _unix"
847 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
848 al="$al apollo ardent att386 att3b"
849 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
850 al="$al cadmus clipper concurrent convex cray ctix"
851 al="$al dmert encore gcos gcx gimpel gould"
852 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
853 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
854 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
855 al="$al i186 i286 i386 i486 i8086"
856 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
857 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
858 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
859 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
860 al="$al mc88000 mc88100 merlin mert mips mvs n16"
861 al="$al ncl_el ncl_mr"
862 al="$al news1500 news1700 news1800 news1900 news3700"
863 al="$al news700 news800 news900 ns16000 ns32000"
864 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
865 al="$al parisc pc532 pdp11 plexus posix pyr"
866 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
867 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
868 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
869 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
870 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
871 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
872 al="$al xenix z8000"
873
874 : Trailing extension.  Override this in a hint file, if needed.
875 _exe=''
876 : Extra object files, if any, needed on this platform.
877 archobjs=''
878 groupstype=''
879 : default library list
880 libswanted=''
881 : some systems want to use only the non-versioned libso:s
882 ignore_versioned_solibs=''
883 : full support for void wanted by default
884 defvoidused=15
885
886 : set useposix=false in your hint file to disable the POSIX extension.
887 useposix=true
888 : set useopcode=false in your hint file to disable the Opcode extension.
889 useopcode=true
890 : set usemultiplicity on the Configure command line to enable multiplicity.
891 : set usethreads on the Configure command line to enable threads.
892 : List of libraries we want.
893 : If anyone needs -lnet, put it in a hint file.
894 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
895 libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
896 libswanted="$libswanted ucb bsd BSD PW x"
897 : We probably want to search /usr/shlib before most other libraries.
898 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
899 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
900 glibpth="/usr/shlib $glibpth"
901 : Do not use vfork unless overridden by a hint file.
902 usevfork=false
903
904 : Find the basic shell for Bourne shell scripts
905 case "$sh" in
906 '')
907         case "$SYSTYPE" in
908         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
909         *) xxx='/bin/sh';;
910         esac
911         if test -f "$xxx"; then
912                 sh="$xxx"
913         else
914                 : Build up a list and do a single loop so we can 'break' out.
915                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
916                 for xxx in sh bash ksh pdksh ash; do
917                         for p in $pth; do
918                                 try="$try ${p}/${xxx}"
919                         done
920                 done
921                 for xxx in $try; do
922                         if test -f "$xxx"; then
923                                 sh="$xxx";
924                                 break
925                         elif test -f "$xxx.exe"; then
926                                 sh="$xxx";
927                                 break
928                         fi
929                 done
930         fi
931         ;;
932 esac
933
934 case "$sh" in
935 '')     cat <<EOM >&2
936 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
937
938 Usually it's in /bin/sh.  How did you even get this far?
939 Please contact me (Jarkko Hietaniemi) at jhi@iki.fi and 
940 we'll try to straighten this all out.
941 EOM
942         exit 1
943         ;;
944 esac
945
946 : see if sh knows # comments
947 if `$sh -c '#' >/dev/null 2>&1`; then
948         shsharp=true
949         spitshell=cat
950         xcat=/bin/cat
951         test -f $xcat || xcat=/usr/bin/cat
952         echo "#!$xcat" >try
953         $eunicefix try
954         chmod +x try
955         ./try > today
956         if test -s today; then
957                 sharpbang='#!'
958         else
959                 echo "#! $xcat" > try
960                 $eunicefix try
961                 chmod +x try
962                 ./try > today
963                 if test -s today; then
964                         sharpbang='#! '
965                 else
966                         sharpbang=': use '
967                 fi
968         fi
969 else
970         echo " "
971         echo "Your $sh doesn't grok # comments--I will strip them later on."
972         shsharp=false
973         cd ..
974         echo "exec grep -v '^[  ]*#'" >spitshell
975         chmod +x spitshell
976         $eunicefix spitshell
977         spitshell=`pwd`/spitshell
978         cd UU
979         echo "I presume that if # doesn't work, #! won't work either!"
980         sharpbang=': use '
981 fi
982 rm -f try today
983
984 : figure out how to guarantee sh startup
985 case "$startsh" in
986 '') startsh=${sharpbang}${sh} ;;
987 *)
988 esac
989 cat >try <<EOSS
990 $startsh
991 set abc
992 test "$?abc" != 1
993 EOSS
994
995 chmod +x try
996 $eunicefix try
997 if ./try; then
998         : echo "Yup, it does."
999 else
1000         echo "Hmm... '$startsh' does not guarantee sh startup..."
1001         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1002 fi
1003 rm -f try
1004
1005
1006 : Save command line options in file UU/cmdline.opt for later use in
1007 : generating config.sh.
1008 cat > cmdline.opt <<EOSH
1009 # Configure command line arguments.
1010 config_arg0='$0'
1011 config_args='$*'
1012 config_argc=$#
1013 EOSH
1014 argn=1
1015 for arg in "$@"; do
1016         cat >>cmdline.opt <<EOSH
1017 config_arg$argn='$arg'
1018 EOSH
1019         argn=`expr $argn + 1`
1020 done
1021
1022 : produce awk script to parse command line options
1023 cat >options.awk <<'EOF'
1024 BEGIN {
1025         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1026
1027         len = length(optstr);
1028         for (i = 1; i <= len; i++) {
1029                 c = substr(optstr, i, 1);
1030                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1031                 if (a == ":") {
1032                         arg[c] = 1;
1033                         i++;
1034                 }
1035                 opt[c] = 1;
1036         }
1037 }
1038 {
1039         expect = 0;
1040         str = $0;
1041         if (substr(str, 1, 1) != "-") {
1042                 printf("'%s'\n", str);
1043                 next;
1044         }
1045         len = length($0);
1046         for (i = 2; i <= len; i++) {
1047                 c = substr(str, i, 1);
1048                 if (!opt[c]) {
1049                         printf("-%s\n", substr(str, i));
1050                         next;
1051                 }
1052                 printf("-%s\n", c);
1053                 if (arg[c]) {
1054                         if (i < len)
1055                                 printf("'%s'\n", substr(str, i + 1));
1056                         else
1057                                 expect = 1;
1058                         next;
1059                 }
1060         }
1061 }
1062 END {
1063         if (expect)
1064                 print "?";
1065 }
1066 EOF
1067
1068 : process the command line options
1069 set X `for arg in "$@"; do echo "X$arg"; done |
1070         sed -e s/X// | awk -f options.awk`
1071 eval "set $*"
1072 shift
1073 rm -f options.awk
1074
1075 : set up default values
1076 fastread=''
1077 reuseval=false
1078 config_sh=''
1079 alldone=''
1080 error=''
1081 silent=''
1082 extractsh=''
1083 override=''
1084 knowitall=''
1085 rm -f optdef.sh
1086 cat >optdef.sh <<EOS
1087 $startsh
1088 EOS
1089
1090
1091 : option parsing
1092 while test $# -gt 0; do
1093         case "$1" in
1094         -d) shift; fastread=yes;;
1095         -e) shift; alldone=cont;;
1096         -f)
1097                 shift
1098                 cd ..
1099                 if test -r "$1"; then
1100                         config_sh="$1"
1101                 else
1102                         echo "$me: cannot read config file $1." >&2
1103                         error=true
1104                 fi
1105                 cd UU
1106                 shift;;
1107         -h) shift; error=true;;
1108         -r) shift; reuseval=true;;
1109         -s) shift; silent=true; realsilent=true;;
1110         -E) shift; alldone=exit;;
1111         -K) shift; knowitall=true;;
1112         -O) shift; override=true;;
1113         -S) shift; silent=true; extractsh=true;;
1114         -D)
1115                 shift
1116                 case "$1" in
1117                 *=)
1118                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1119                         echo "$me: ignoring -D $1" >&2
1120                         ;;
1121                 *=*) echo "$1" | \
1122                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1123                 *) echo "$1='define'" >> optdef.sh;;
1124                 esac
1125                 shift
1126                 ;;
1127         -U)
1128                 shift
1129                 case "$1" in
1130                 *=) echo "$1" >> optdef.sh;;
1131                 *=*)
1132                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1133                         echo "$me: ignoring -U $1" >&2
1134                         ;;
1135                 *) echo "$1='undef'" >> optdef.sh;;
1136                 esac
1137                 shift
1138                 ;;
1139         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1140                 exit 0;;
1141         --) break;;
1142         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1143         *) break;;
1144         esac
1145 done
1146
1147 case "$error" in
1148 true)
1149         cat >&2 <<EOM
1150 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1151                  [-U symbol] [-U symbol=]
1152   -d : use defaults for all answers.
1153   -e : go on without questioning past the production of config.sh.
1154   -f : specify an alternate default configuration file.
1155   -h : print this help message and exit (with an error status).
1156   -r : reuse C symbols value if possible (skips costly nm extraction).
1157   -s : silent mode, only echoes questions and essential information.
1158   -D : define symbol to have some value:
1159          -D symbol         symbol gets the value 'define'
1160          -D symbol=value   symbol gets the value 'value'
1161   -E : stop at the end of questions, after having produced config.sh.
1162   -K : do not use unless you know what you are doing.
1163   -O : let -D and -U override definitions from loaded configuration file.
1164   -S : perform variable substitutions on all .SH files (can mix with -f)
1165   -U : undefine symbol:
1166          -U symbol    symbol gets the value 'undef'
1167          -U symbol=   symbol gets completely empty
1168   -V : print version number and exit (with a zero status).
1169 EOM
1170         exit 1
1171         ;;
1172 esac
1173
1174 : Sanity checks
1175 case "$fastread$alldone" in
1176 yescont|yesexit) ;;
1177 *)
1178         if test ! -t 0; then
1179                 echo "Say 'sh Configure', not 'sh <Configure'"
1180                 exit 1
1181         fi
1182         ;;
1183 esac
1184
1185 exec 4>&1
1186 case "$silent" in
1187 true) exec 1>/dev/null;;
1188 esac
1189
1190 : run the defines and the undefines, if any, but leave the file out there...
1191 touch optdef.sh
1192 . ./optdef.sh
1193
1194 : set package name
1195 package=perl5
1196 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1197 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1198 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1199 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1200 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1201 esac
1202
1203 : Some greps do not return status, grrr.
1204 echo "grimblepritz" >grimble
1205 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1206         contains=contains
1207 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1208         contains=grep
1209 else
1210         contains=contains
1211 fi
1212 rm -f grimble
1213 : the following should work in any shell
1214 case "$contains" in
1215 contains*)
1216         echo " "
1217         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1218         cat >contains <<'EOSS'
1219 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1220 EOSS
1221 chmod +x contains
1222 esac
1223
1224 : Find the path to the source tree
1225 case "$src" in
1226 '') case "$0" in
1227     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1228     *)   src='.';;
1229     esac;;
1230 esac
1231 case "$src" in
1232 '')     src=/
1233         rsrc=/
1234         ;;
1235 /*) rsrc="$src";;
1236 *) rsrc="../$src";;
1237 esac
1238 if test -f $rsrc/Configure && \
1239         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1240 then
1241    : found it, so we are ok.
1242 else
1243         rsrc=''
1244         for src in . .. ../.. ../../.. ../../../..; do
1245                 if test -f ../$src/Configure && \
1246                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1247                 then
1248                         rsrc=../$src
1249                         break
1250                 fi
1251         done
1252 fi
1253 case "$rsrc" in
1254 '')
1255         cat <<EOM >&4
1256
1257 Sorry, I can't seem to locate the source dir for $package.  Please start
1258 Configure with an explicit path -- i.e. /some/path/Configure.
1259
1260 EOM
1261         exit 1
1262         ;;
1263 ../.)   rsrc='..';;
1264 *)
1265         echo " "
1266         echo "Sources for $package found in \"$src\"." >&4
1267         ;;
1268 esac
1269
1270 : script used to extract .SH files with variable substitutions
1271 cat >extract <<'EOS'
1272 CONFIG=true
1273 echo "Doing variable substitutions on .SH files..."
1274 if test -f $src/MANIFEST; then
1275         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1276 else
1277         echo "(Looking for .SH files under the source directory.)"
1278         set x `(cd $src; find . -name "*.SH" -print)`
1279 fi
1280 shift
1281 case $# in
1282 0) set x `(cd $src; echo *.SH)`; shift;;
1283 esac
1284 if test ! -f $src/$1; then
1285         shift
1286 fi
1287 mkdir_p='
1288 name=$1;
1289 create="";
1290 while test $name; do
1291         if test ! -d "$name"; then
1292                 create="$name $create";
1293                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1294                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1295         else
1296                 name="";
1297         fi;
1298 done;
1299 for file in $create; do
1300         mkdir $file;
1301 done
1302 '
1303 for file in $*; do
1304         case "$src" in
1305         ".")
1306                 case "$file" in
1307                 */*)
1308                         dir=`expr X$file : 'X\(.*\)/'`
1309                         file=`expr X$file : 'X.*/\(.*\)'`
1310                         (cd $dir && . ./$file)
1311                         ;;
1312                 *)
1313                         . ./$file
1314                         ;;
1315                 esac
1316                 ;;
1317         *)
1318                 case "$file" in
1319                 */*)
1320                         dir=`expr X$file : 'X\(.*\)/'`
1321                         file=`expr X$file : 'X.*/\(.*\)'`
1322                         (set x $dir; shift; eval $mkdir_p)
1323                         sh <$src/$dir/$file
1324                         ;;
1325                 *)
1326                         sh <$src/$file
1327                         ;;
1328                 esac
1329                 ;;
1330         esac
1331 done
1332 if test -f $src/config_h.SH; then
1333         if test ! -f config.h; then
1334         : oops, they left it out of MANIFEST, probably, so do it anyway.
1335         . $src/config_h.SH
1336         fi
1337 fi
1338 EOS
1339
1340 : extract files and exit if asked to do so
1341 case "$extractsh" in
1342 true)
1343         case "$realsilent" in
1344         true) ;;
1345         *) exec 1>&4;;
1346         esac
1347         case "$config_sh" in
1348         '') config_sh='config.sh';;
1349         esac
1350         echo " "
1351         echo "Fetching answers from $config_sh..."
1352         cd ..
1353         . $config_sh
1354         test "$override" && . ./optdef.sh
1355         echo " "
1356         . UU/extract
1357         rm -rf UU
1358         echo "Done."
1359         exit 0
1360         ;;
1361 esac
1362
1363 : Eunice requires " " instead of "", can you believe it
1364 echo " "
1365 : Here we go...
1366 echo "Beginning of configuration questions for $package."
1367
1368 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1369
1370 : first determine how to suppress newline on echo command
1371 echo " "
1372 echo "Checking echo to see how to suppress newlines..."
1373 (echo "hi there\c" ; echo " ") >.echotmp
1374 if $contains c .echotmp >/dev/null 2>&1 ; then
1375         echo "...using -n."
1376         n='-n'
1377         c=''
1378 else
1379         cat <<'EOM'
1380 ...using \c
1381 EOM
1382         n=''
1383         c='\c'
1384 fi
1385 echo $n "The star should be here-->$c"
1386 echo '*'
1387 rm -f .echotmp
1388
1389 : Now test for existence of everything in MANIFEST
1390 echo " "
1391 if test -f $rsrc/MANIFEST; then
1392         echo "First let's make sure your kit is complete.  Checking..." >&4
1393         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1394         rm -f missing
1395         tmppwd=`pwd`
1396         for filelist in x??; do
1397                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1398         done
1399         if test -s missing; then
1400                 cat missing >&4
1401                 cat >&4 <<'EOM'
1402
1403 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1404
1405 You have the option of continuing the configuration process, despite the
1406 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1407 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1408 and contact the author (jhi@iki.fi).
1409
1410 EOM
1411                 echo $n "Continue? [n] $c" >&4
1412                 read ans
1413                 case "$ans" in
1414                 y*)
1415                         echo "Continuing..." >&4
1416                         rm -f missing
1417                         ;;
1418                 *)
1419                         echo "ABORTING..." >&4
1420                         kill $$
1421                         ;;
1422                 esac
1423         else
1424                 echo "Looks good..."
1425         fi
1426 else
1427         echo "There is no MANIFEST file.  I hope your kit is complete !"
1428 fi
1429 rm -f missing x??
1430
1431 echo " "
1432 : Find the appropriate value for a newline for tr
1433 if test -n "$DJGPP"; then
1434        trnl='\012'
1435 fi
1436 if test X"$trnl" = X; then
1437         case "`echo foo|tr '\n' x 2>/dev/null`" in
1438         foox) trnl='\n' ;;
1439         esac
1440 fi
1441 if test X"$trnl" = X; then
1442         case "`echo foo|tr '\012' x 2>/dev/null`" in
1443         foox) trnl='\012' ;;
1444         esac
1445 fi
1446 if test X"$trnl" = X; then
1447         cat <<EOM >&2
1448
1449 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1450
1451 EOM
1452         exit 1
1453 fi
1454
1455 : compute the number of columns on the terminal for proper question formatting
1456 case "$COLUMNS" in
1457 '') COLUMNS='80';;
1458 esac
1459
1460 : set up the echo used in my read
1461 myecho="case \"\$xxxm\" in
1462 '') echo $n \"\$rp $c\" >&4;;
1463 *) case \"\$rp\" in
1464         '') echo $n \"[\$xxxm] $c\";;
1465         *)
1466                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1467                         echo \"\$rp\" >&4
1468                         echo $n \"[\$xxxm] $c\" >&4
1469                 else
1470                         echo $n \"\$rp [\$xxxm] $c\" >&4
1471                 fi
1472                 ;;
1473         esac;;
1474 esac"
1475
1476 : now set up to do reads with possible shell escape and default assignment
1477 cat <<EOSC >myread
1478 $startsh
1479 xxxm=\$dflt
1480 $myecho
1481 ans='!'
1482 case "\$fastread" in
1483 yes) case "\$dflt" in
1484         '') ;;
1485         *) ans='';
1486                 case "\$silent-\$rp" in
1487                 true-) ;;
1488                 *) echo " " >&4;;
1489                 esac;;
1490         esac;;
1491 *) case "\$silent" in
1492         true) case "\$rp" in
1493                 '') ans='';;
1494                 esac;;
1495         esac;;
1496 esac
1497 while expr "X\$ans" : "X!" >/dev/null; do
1498         read answ
1499         set x \$xxxm
1500         shift
1501         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1502         case  "\$answ" in
1503         "!")
1504                 sh 1>&4
1505                 echo " "
1506                 $myecho
1507                 ;;
1508         !*)
1509                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1510                 shift
1511                 sh 1>&4 -c "\$*"
1512                 echo " "
1513                 $myecho
1514                 ;;
1515         "\$ans")
1516                 case "\$ans" in
1517                 \\&*)
1518                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1519                         shift
1520                         case "\$1" in
1521                         -d)
1522                                 fastread=yes
1523                                 echo "(OK, I'll run with -d after this question.)" >&4
1524                                 ;;
1525                         -*)
1526                                 echo "*** Sorry, \$1 not supported yet." >&4
1527                                 ;;
1528                         esac
1529                         $myecho
1530                         ans=!
1531                         ;;
1532                 esac;;
1533         *)
1534                 case "\$aok" in
1535                 y)
1536                         echo "*** Substitution done -- please confirm."
1537                         xxxm="\$ans"
1538                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1539                         xxxm="\$ans"
1540                         ans=!
1541                         ;;
1542                 *)
1543                         echo "*** Error -- try again."
1544                         ans=!
1545                         ;;
1546                 esac
1547                 $myecho
1548                 ;;
1549         esac
1550         case "\$ans\$xxxm\$nostick" in
1551         '')
1552                 ans=!
1553                 $myecho
1554                 ;;
1555         esac
1556 done
1557 case "\$ans" in
1558 '') ans="\$xxxm";;
1559 esac
1560 EOSC
1561
1562 : create .config dir to save info across Configure sessions
1563 test -d ../.config || mkdir ../.config
1564 cat >../.config/README <<EOF
1565 This directory created by Configure to save information that should
1566 persist across sessions for $package.
1567
1568 You may safely delete it if you wish.
1569 EOF
1570
1571 : general instructions
1572 needman=true
1573 firsttime=true
1574 user=`(logname) 2>/dev/null`
1575 case "$user" in
1576 '') user=`whoami 2>&1`;;
1577 esac
1578 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1579         firsttime=false
1580         echo " "
1581         rp='Would you like to see the instructions?'
1582         dflt=n
1583         . ./myread
1584         case "$ans" in
1585         [yY]*) ;;
1586         *) needman=false;;
1587         esac
1588 fi
1589 if $needman; then
1590         cat <<EOH
1591
1592 This installation shell script will examine your system and ask you questions
1593 to determine how the perl5 package should be installed. If you get
1594 stuck on a question, you may use a ! shell escape to start a subshell or
1595 execute a command.  Many of the questions will have default answers in square
1596 brackets; typing carriage return will give you the default.
1597
1598 On some of the questions which ask for file or directory names you are allowed
1599 to use the ~name construct to specify the login directory belonging to "name",
1600 even if you don't have a shell which knows about that.  Questions where this is
1601 allowed will be marked "(~name ok)".
1602
1603 EOH
1604         rp=''
1605         dflt='Type carriage return to continue'
1606         . ./myread
1607         cat <<'EOH'
1608
1609 The prompter used in this script allows you to use shell variables and
1610 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1611 in the default answer, as if the default line was a set of arguments given to a
1612 script shell.  This means you may also use $* to repeat the whole default line,
1613 so you do not have to re-type everything to add something to the default.
1614
1615 Everytime there is a substitution, you will have to confirm.  If there is an
1616 error (e.g. an unmatched backtick), the default answer will remain unchanged
1617 and you will be prompted again.
1618
1619 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1620 the questions and use the computed defaults (or the previous answers if there
1621 was already a config.sh file). Type 'Configure -h' for a list of options.
1622 You may also start interactively and then answer '& -d' at any prompt to turn
1623 on the non-interactive behaviour for the remainder of the execution.
1624
1625 EOH
1626         . ./myread
1627         cat <<EOH
1628
1629 Much effort has been expended to ensure that this shell script will run on any
1630 Unix system.  If despite that it blows up on yours, your best bet is to edit
1631 Configure and run it again.  If you can't run Configure for some reason,
1632 you'll have to generate a config.sh file by hand.  Whatever problems you
1633 have, let me (jhi@iki.fi) know how I blew it.
1634
1635 This installation script affects things in two ways:
1636
1637 1) it may do direct variable substitutions on some of the files included
1638    in this kit.
1639 2) it builds a config.h file for inclusion in C programs.  You may edit
1640    any of these files as the need arises after running this script.
1641
1642 If you make a mistake on a question, there is no easy way to back up to it
1643 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1644 files.  Configure will offer to let you do this before it runs the SH files.
1645
1646 EOH
1647         dflt='Type carriage return to continue'
1648         . ./myread
1649         case "$firsttime" in
1650         true) echo $user >>../.config/instruct;;
1651         esac
1652 fi
1653
1654 : find out where common programs are
1655 echo " "
1656 echo "Locating common programs..." >&4
1657 cat <<EOSC >loc
1658 $startsh
1659 case \$# in
1660 0) exit 1;;
1661 esac
1662 thing=\$1
1663 shift
1664 dflt=\$1
1665 shift
1666 for dir in \$*; do
1667         case "\$thing" in
1668         .)
1669         if test -d \$dir/\$thing; then
1670                 echo \$dir
1671                 exit 0
1672         fi
1673         ;;
1674         *)
1675         for thisthing in \$dir/\$thing; do
1676                 : just loop through to pick last item
1677         done
1678         if test -f \$thisthing; then
1679                 echo \$thisthing
1680                 exit 0
1681         elif test -f \$dir/\$thing.exe; then
1682                 if test -n "$DJGPP"; then
1683                         echo \$dir/\$thing.exe
1684                 else
1685                         : on Eunice apparently
1686                         echo \$dir/\$thing
1687                 fi
1688                 exit 0
1689         fi
1690         ;;
1691         esac
1692 done
1693 echo \$dflt
1694 exit 1
1695 EOSC
1696 chmod +x loc
1697 $eunicefix loc
1698 loclist="
1699 awk
1700 cat
1701 comm
1702 cp
1703 echo
1704 expr
1705 grep
1706 ls
1707 make
1708 mkdir
1709 rm
1710 sed
1711 sort
1712 touch
1713 tr
1714 uniq
1715 "
1716 trylist="
1717 Mcc
1718 ar
1719 byacc
1720 cpp
1721 csh
1722 date
1723 egrep
1724 gzip
1725 less
1726 ln
1727 more
1728 nm
1729 nroff
1730 pg
1731 tee
1732 test
1733 uname
1734 zip
1735 "
1736 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1737 pth="$pth /lib /usr/lib"
1738 for file in $loclist; do
1739         eval xxx=\$$file
1740         case "$xxx" in
1741         /*|?:[\\/]*)
1742                 if test -f "$xxx"; then
1743                         : ok
1744                 else
1745                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1746                         xxx=`./loc $file $file $pth`
1747                 fi
1748                 ;;
1749         '') xxx=`./loc $file $file $pth`;;
1750         *) xxx=`./loc $xxx $xxx $pth`;;
1751         esac
1752         eval $file=$xxx
1753         eval _$file=$xxx
1754         case "$xxx" in
1755         /*)
1756                 echo $file is in $xxx.
1757                 ;;
1758         ?:[\\/]*)
1759                 echo $file is in $xxx.
1760                 ;;
1761         *)
1762                 echo "I don't know where '$file' is, and my life depends on it." >&4
1763                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1764                 exit 1
1765                 ;;
1766         esac
1767 done
1768 echo " "
1769 echo "Don't worry if any of the following aren't found..."
1770 say=offhand
1771 for file in $trylist; do
1772         eval xxx=\$$file
1773         case "$xxx" in
1774         /*|?:[\\/]*)
1775                 if test -f "$xxx"; then
1776                         : ok
1777                 else
1778                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1779                         xxx=`./loc $file $file $pth`
1780                 fi
1781                 ;;
1782         '') xxx=`./loc $file $file $pth`;;
1783         *) xxx=`./loc $xxx $xxx $pth`;;
1784         esac
1785         eval $file=$xxx
1786         eval _$file=$xxx
1787         case "$xxx" in
1788         /*)
1789                 echo $file is in $xxx.
1790                 ;;
1791         ?:[\\/]*)
1792                 echo $file is in $xxx.
1793                 ;;
1794         *)
1795                 echo "I don't see $file out there, $say."
1796                 say=either
1797                 ;;
1798         esac
1799 done
1800 case "$egrep" in
1801 egrep)
1802         echo "Substituting grep for egrep."
1803         egrep=$grep
1804         ;;
1805 esac
1806 case "$ln" in
1807 ln)
1808         echo "Substituting cp for ln."
1809         ln=$cp
1810         ;;
1811 esac
1812 case "$test" in
1813 test)
1814         echo "Hopefully test is built into your sh."
1815         ;;
1816 *)
1817         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1818                 echo "Using the test built into your sh."
1819                 test=test
1820                 _test=test
1821         fi
1822         ;;
1823 esac
1824 case "$echo" in
1825 echo)
1826         echo "Hopefully echo is built into your sh."
1827         ;;
1828 '') ;;
1829 *)
1830         echo " "
1831 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1832         $echo $n "hi there$c" >foo1
1833         echo $n "hi there$c" >foo2
1834         if cmp foo1 foo2 >/dev/null 2>&1; then
1835                 echo "They are compatible.  In fact, they may be identical."
1836         else
1837                 case "$n" in
1838                 '-n') n='' c='\c';;
1839                 *) n='-n' c='';;
1840                 esac
1841                 cat <<FOO
1842 They are not compatible!  You are probably running ksh on a non-USG system.
1843 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1844 have echo built in and we may have to run some Bourne shell scripts.  That
1845 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1846
1847 FOO
1848                 $echo $n "The star should be here-->$c"
1849                 $echo "*"
1850         fi
1851         $rm -f foo1 foo2
1852         ;;
1853 esac
1854
1855 : determine whether symbolic links are supported
1856 echo " "
1857 $touch blurfl
1858 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1859         echo "Symbolic links are supported." >&4
1860         lns="$ln -s"
1861 else
1862         echo "Symbolic links are NOT supported." >&4
1863         lns="$ln"
1864 fi
1865 $rm -f blurfl sym
1866
1867 : see whether [:lower:] and [:upper:] are supported character classes
1868 echo " "
1869 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1870 ABYZ)
1871         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1872         up='[:upper:]'
1873         low='[:lower:]'
1874         ;;
1875 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1876         # (0xc9 and 0xd1), therefore that is a nice testing point.
1877         if test "X$up" = X -o "X$low" = X; then
1878             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1879             ij) up='[A-Z]'
1880                 low='[a-z]'
1881                 ;;
1882             esac
1883         fi
1884         if test "X$up" = X -o "X$low" = X; then
1885             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1886             ij) up='A-Z'
1887                 low='a-z'
1888                 ;;
1889             esac
1890         fi
1891         if test "X$up" = X -o "X$low" = X; then
1892             case "`echo IJ | od -x 2>/dev/null`" in
1893             *C9D1*|*c9d1*)
1894                 echo "Hey, this might be EBCDIC." >&4
1895                 if test "X$up" = X -o "X$low" = X; then
1896                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1897                     ij) up='[A-IJ-RS-Z]'
1898                         low='[a-ij-rs-z]'
1899                         ;;
1900                     esac
1901                 fi
1902                 if test "X$up" = X -o "X$low" = X; then
1903                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1904                     ij) up='A-IJ-RS-Z'
1905                         low='a-ij-rs-z'
1906                         ;;
1907                     esac
1908                 fi
1909                 ;;
1910             esac
1911         fi
1912 esac
1913 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1914 ij)
1915     echo "Using $up and $low to convert case." >&4
1916     ;;
1917 *)
1918     echo "I don't know how to translate letters from upper to lower case." >&4
1919     echo "Your tr is not acting any way I know of." >&4
1920     exit 1
1921     ;;
1922 esac
1923 : set up the translation script tr, must be called with ./tr of course
1924 cat >tr <<EOSC
1925 $startsh
1926 case "\$1\$2" in
1927 '[A-Z][a-z]') exec $tr '$up' '$low';;
1928 '[a-z][A-Z]') exec $tr '$low' '$up';;
1929 esac
1930 exec $tr "\$@"
1931 EOSC
1932 chmod +x tr
1933 $eunicefix tr
1934
1935 : Try to determine whether config.sh was made on this system
1936 case "$config_sh" in
1937 '')
1938 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1939 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
1940 # because the A-Z/a-z are not consecutive.
1941 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1942         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1943 newmyuname="$myuname"
1944 dflt=n
1945 case "$knowitall" in
1946 '')
1947         if test -f ../config.sh; then
1948                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1949                         eval "`grep myuname= ../config.sh`"
1950                 fi
1951                 if test "X$myuname" = "X$newmyuname"; then
1952                         dflt=y
1953                 fi
1954         fi
1955         ;;
1956 *) dflt=y;;
1957 esac
1958
1959 : Get old answers from old config file if Configure was run on the
1960 : same system, otherwise use the hints.
1961 hint=default
1962 cd ..
1963 if test -f config.sh; then
1964         echo " "
1965         rp="I see a config.sh file.  Shall I use it to set the defaults?"
1966         . UU/myread
1967         case "$ans" in
1968         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1969         *)  echo "Fetching default answers from your old config.sh file..." >&4
1970                 tmp_n="$n"
1971                 tmp_c="$c"
1972                 tmp_sh="$sh"
1973                 . ./config.sh
1974                 cp config.sh UU
1975                 n="$tmp_n"
1976                 c="$tmp_c"
1977                 : Older versions did not always set $sh.  Catch re-use of such
1978                 : an old config.sh.
1979                 case "$sh" in
1980                 '') sh="$tmp_sh" ;;
1981                 esac
1982                 hint=previous
1983                 ;;
1984         esac
1985 fi
1986 if test ! -f config.sh; then
1987         $cat <<EOM
1988
1989 First time through, eh?  I have some defaults handy for some systems
1990 that need some extra help getting the Configure answers right:
1991
1992 EOM
1993         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
1994         dflt=''
1995         : Half the following guesses are probably wrong... If you have better
1996         : tests or hints, please send them to jhi@iki.fi
1997         : The metaconfig authors would also appreciate a copy...
1998         $test -f /irix && osname=irix
1999         $test -f /xenix && osname=sco_xenix
2000         $test -f /dynix && osname=dynix
2001         $test -f /dnix && osname=dnix
2002         $test -f /lynx.os && osname=lynxos
2003         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2004         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2005         $test -f /bin/mips && /bin/mips && osname=mips
2006         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2007                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2008         $test -d /usr/apollo/bin && osname=apollo
2009         $test -f /etc/saf/_sactab && osname=svr4
2010         $test -d /usr/include/minix && osname=minix
2011         if $test -d /MachTen -o -d /MachTen_Folder; then
2012                 osname=machten
2013                 if $test -x /sbin/version; then
2014                         osvers=`/sbin/version | $awk '{print $2}' |
2015                         $sed -e 's/[A-Za-z]$//'`
2016                 elif $test -x /usr/etc/version; then
2017                         osvers=`/usr/etc/version | $awk '{print $2}' |
2018                         $sed -e 's/[A-Za-z]$//'`
2019                 else
2020                         osvers="$2.$3"
2021                 fi
2022         fi
2023        $test -f /sys/posix.dll &&
2024                $test -f /usr/bin/what &&
2025                set X `/usr/bin/what /sys/posix.dll` &&
2026                $test "$3" = UWIN &&
2027                osname=uwin &&
2028                osvers="$5"
2029         if $test -f $uname; then
2030                 set X $myuname
2031                 shift
2032
2033                 case "$5" in
2034                 fps*) osname=fps ;;
2035                 mips*)
2036                         case "$4" in
2037                         umips) osname=umips ;;
2038                         *) osname=mips ;;
2039                         esac;;
2040                 [23]100) osname=mips ;;
2041                 next*) osname=next ;;
2042                 i386*)
2043                         if $test -f /etc/kconfig; then
2044                                 osname=isc
2045                                 if test "$lns" = "ln -s"; then
2046                                         osvers=4
2047                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2048                                         osvers=3
2049                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2050                                         osvers=2
2051                                 fi
2052                         fi
2053                         ;;
2054                 pc*)
2055                         if test -n "$DJGPP"; then
2056                                 osname=dos
2057                                 osvers=djgpp
2058                         fi
2059                         ;;
2060                 esac
2061
2062                 case "$1" in
2063                 aix) osname=aix
2064                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2065                         case "$tmp" in
2066                         'not found') osvers="$4"."$3" ;;
2067                         '<3240'|'<>3240') osvers=3.2.0 ;;
2068                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2069                         '=3250'|'>3250') osvers=3.2.5 ;;
2070                         *) osvers=$tmp;;
2071                         esac
2072                         ;;
2073                 *dc.osx) osname=dcosx
2074                         osvers="$3"
2075                         ;;
2076                 dnix) osname=dnix
2077                         osvers="$3"
2078                         ;;
2079                 domainos) osname=apollo
2080                         osvers="$3"
2081                         ;;
2082                 dgux) osname=dgux 
2083                         osvers="$3"
2084                         ;;
2085                 dynixptx*) osname=dynixptx
2086                         osvers=`echo "$4"|sed 's/^v//'`
2087                         ;;
2088                 freebsd) osname=freebsd 
2089                         osvers="$3" ;;
2090                 genix) osname=genix ;;
2091                 hp*) osname=hpux 
2092                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2093                         ;;
2094                 irix*) osname=irix
2095                         case "$3" in
2096                         4*) osvers=4 ;;
2097                         5*) osvers=5 ;;
2098                         *)      osvers="$3" ;;
2099                         esac
2100                         ;;
2101                 linux) osname=linux
2102                         case "$3" in
2103                         *)      osvers="$3" ;;
2104                         esac
2105                         ;;
2106                 MiNT) osname=mint
2107                         ;;
2108                 netbsd*) osname=netbsd
2109                         osvers="$3"
2110                         ;;
2111                 news-os) osvers="$3"
2112                         case "$3" in
2113                         4*) osname=newsos4 ;;
2114                         *) osname=newsos ;;
2115                         esac
2116                         ;;
2117                 bsd386) osname=bsd386
2118                         osvers=`$uname -r`
2119                         ;;
2120                 POSIX-BC | posix-bc ) osname=posix-bc
2121                         osvers="$3"
2122                         ;;
2123                 powerux | power_ux | powermax_os | powermaxos | \
2124                 powerunix | power_unix) osname=powerux
2125                         osvers="$3"
2126                         ;;
2127                 next*) osname=next ;;
2128                 solaris) osname=solaris
2129                         case "$3" in
2130                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2131                         *)      osvers="$3" ;;
2132                         esac
2133                         ;;
2134                 sunos) osname=sunos
2135                         case "$3" in
2136                         5*) osname=solaris
2137                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2138                         *)      osvers="$3" ;;
2139                         esac
2140                         ;;
2141                 titanos) osname=titanos
2142                         case "$3" in
2143                         1*) osvers=1 ;;
2144                         2*) osvers=2 ;;
2145                         3*) osvers=3 ;;
2146                         4*) osvers=4 ;;
2147                         *)      osvers="$3" ;;
2148                         esac
2149                         ;;
2150                 ultrix) osname=ultrix
2151                         osvers="$3"
2152                         ;;
2153                 osf1|mls+)      case "$5" in
2154                                 alpha)
2155                                         osname=dec_osf
2156                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2157                                         ;;
2158                         hp*)    osname=hp_osf1  ;;
2159                         mips)   osname=mips_osf1 ;;
2160                         esac
2161                         ;;
2162                 uts) osname=uts 
2163                         osvers="$3"
2164                         ;;
2165                 qnx) osname=qnx
2166                         osvers="$4"
2167                         ;;
2168                 $2) case "$osname" in
2169                         *isc*) ;;
2170                         *freebsd*) ;;
2171                         svr*)
2172                                 : svr4.x or possibly later
2173                                 case "svr$3" in 
2174                                 ${osname}*)
2175                                         osname=svr$3
2176                                         osvers=$4
2177                                         ;;
2178                                 esac
2179                                 case "$osname" in
2180                                 svr4.0)
2181                                         : Check for ESIX
2182                                         if test -f /stand/boot ; then
2183                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2184                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2185                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2186                                                         if test -n "$isesix"; then
2187                                                                 osname=esix4
2188                                                         fi
2189                                                 fi
2190                                         fi
2191                                         ;;
2192                                 esac
2193                                 ;;
2194                         *)      if test -f /etc/systemid; then
2195                                         osname=sco
2196                                         set `echo $3 | $sed 's/\./ /g'` $4
2197                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2198                                                 osvers=$1.$2.$3
2199                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2200                                                 osvers=$1.$2
2201                                         elif $test -f $src/hints/sco_$1.sh; then
2202                                                 osvers=$1
2203                                         fi
2204                                 else
2205                                         case "$osname" in
2206                                         '') : Still unknown.  Probably a generic Sys V.
2207                                                 osname="sysv"
2208                                                 osvers="$3"
2209                                                 ;;
2210                                         esac
2211                                 fi
2212                                 ;;
2213                         esac
2214                         ;;
2215                 *)      case "$osname" in
2216                         '') : Still unknown.  Probably a generic BSD.
2217                                 osname="$1"
2218                                 osvers="$3"
2219                                 ;;
2220                         esac
2221                         ;;
2222                 esac
2223         else
2224                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2225                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2226                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2227                                 osname=news_os
2228                         fi
2229                         $rm -f UU/kernel.what
2230                 elif test -d c:/.; then
2231                         set X $myuname
2232                         osname=os2
2233                         osvers="$5"
2234                 fi
2235         fi
2236         
2237         : Now look for a hint file osname_osvers, unless one has been
2238         : specified already.
2239         case "$hintfile" in
2240         ''|' ')
2241                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2242                 : Also try without trailing minor version numbers.
2243                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2244                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2245                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2246                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2247                 case "$file" in
2248                 '') dflt=none ;;
2249                 *)  case "$osvers" in
2250                         '') dflt=$file
2251                                 ;;
2252                         *)  if $test -f $src/hints/$file.sh ; then
2253                                         dflt=$file
2254                                 elif $test -f $src/hints/$xfile.sh ; then
2255                                         dflt=$xfile
2256                                 elif $test -f $src/hints/$xxfile.sh ; then
2257                                         dflt=$xxfile
2258                                 elif $test -f $src/hints/$xxxfile.sh ; then
2259                                         dflt=$xxxfile
2260                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2261                                         dflt=$xxxxfile
2262                                 elif $test -f "$src/hints/${osname}.sh" ; then
2263                                         dflt="${osname}"
2264                                 else
2265                                         dflt=none
2266                                 fi
2267                                 ;;
2268                         esac
2269                         ;;
2270                 esac
2271                 if $test -f Policy.sh ; then
2272                         case "$dflt" in
2273                         *Policy*) ;;
2274                         none) dflt="Policy" ;;
2275                         *) dflt="Policy $dflt" ;;
2276                         esac
2277                 fi
2278                 ;;
2279         *)
2280                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2281                 ;;
2282         esac
2283
2284         if $test -f Policy.sh ; then
2285                 $cat <<EOM
2286
2287 There's also a Policy hint file available, which should make the
2288 site-specific (policy) questions easier to answer.
2289 EOM
2290
2291         fi
2292
2293         $cat <<EOM
2294
2295 You may give one or more space-separated answers, or "none" if appropriate.
2296 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2297 is a good thing.  DO NOT give a wrong version.
2298
2299 EOM
2300
2301         rp="Which of these apply, if any?"
2302         . UU/myread
2303         tans=$ans
2304         for file in $tans; do
2305                 if $test X$file = XPolicy -a -f Policy.sh; then
2306                         . Policy.sh
2307                         $cat Policy.sh >> UU/config.sh
2308                 elif $test -f $src/hints/$file.sh; then
2309                         . $src/hints/$file.sh
2310                         $cat $src/hints/$file.sh >> UU/config.sh
2311                 elif $test X$tans = X -o X$tans = Xnone ; then
2312                         : nothing
2313                 else
2314                         : Give one chance to correct a possible typo.
2315                         echo "$file.sh does not exist"
2316                         dflt=$file
2317                         rp="hint to use instead?"
2318                         . UU/myread
2319                         for file in $ans; do
2320                                 if $test -f "$src/hints/$file.sh"; then
2321                                         . $src/hints/$file.sh
2322                                         $cat $src/hints/$file.sh >> UU/config.sh
2323                                 elif $test X$ans = X -o X$ans = Xnone ; then
2324                                         : nothing
2325                                 else
2326                                         echo "$file.sh does not exist -- ignored."
2327                                 fi
2328                         done
2329                 fi
2330         done
2331
2332         hint=recommended
2333         : Remember our hint file for later.
2334         if $test -f "$src/hints/$file.sh" ; then
2335                 hintfile="$file"
2336         else
2337                 hintfile=''
2338         fi
2339 fi
2340 cd UU
2341 ;;
2342 *)
2343         echo " "
2344         echo "Fetching default answers from $config_sh..." >&4
2345         tmp_n="$n"
2346         tmp_c="$c"
2347         cd ..
2348         cp $config_sh config.sh 2>/dev/null
2349         chmod +w config.sh
2350         . ./config.sh
2351         cd UU
2352         cp ../config.sh .
2353         n="$tmp_n"
2354         c="$tmp_c"
2355         hint=previous
2356         ;;
2357 esac
2358 test "$override" && . ./optdef.sh
2359 myuname="$newmyuname"
2360
2361 : Restore computed paths
2362 for file in $loclist $trylist; do
2363         eval $file="\$_$file"
2364 done
2365
2366 cat << EOM
2367
2368 Configure uses the operating system name and version to set some defaults.
2369 The default value is probably right if the name rings a bell. Otherwise,
2370 since spelling matters for me, either accept the default or answer "none"
2371 to leave it blank.
2372
2373 EOM
2374 case "$osname" in
2375         ''|' ')
2376                 case "$hintfile" in
2377                 ''|' '|none) dflt=none ;;
2378                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2379                 esac
2380                 ;;
2381         *) dflt="$osname" ;;
2382 esac
2383 rp="Operating system name?"
2384 . ./myread
2385 case "$ans" in
2386 none)  osname='' ;;
2387 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2388 esac
2389 echo " "
2390 case "$osvers" in
2391         ''|' ')
2392                 case "$hintfile" in
2393                 ''|' '|none) dflt=none ;;
2394                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2395                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2396                         case "$dflt" in
2397                         ''|' ') dflt=none ;;
2398                         esac
2399                         ;;
2400                 esac
2401                 ;;
2402         *) dflt="$osvers" ;;
2403 esac
2404 rp="Operating system version?"
2405 . ./myread
2406 case "$ans" in
2407 none)  osvers='' ;;
2408 *) osvers="$ans" ;;
2409 esac
2410
2411 : who configured the system
2412 cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
2413 cf_by=`(logname) 2>/dev/null`
2414 case "$cf_by" in
2415 "")
2416         cf_by=`(whoami) 2>/dev/null`
2417         case "$cf_by" in
2418         "") cf_by=unknown ;;
2419         esac ;;
2420 esac
2421
2422 : set up the script used to warn in case of inconsistency
2423 cat <<EOS >whoa
2424 $startsh
2425 EOS
2426 cat <<'EOSC' >>whoa
2427 dflt=y
2428 echo " "
2429 echo "*** WHOA THERE!!! ***" >&4
2430 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2431 rp="    Keep the $hint value?"
2432 . ./myread
2433 case "$ans" in
2434 y) td=$was; tu=$was;;
2435 esac
2436 EOSC
2437
2438 : function used to set $1 to $val
2439 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2440 case "$val$was" in
2441 $define$undef) . ./whoa; eval "$var=\$td";;
2442 $undef$define) . ./whoa; eval "$var=\$tu";;
2443 *) eval "$var=$val";;
2444 esac'
2445
2446 cat <<EOM
2447
2448 Perl can be built to take advantage of threads, on some systems.
2449 To do so, Configure must be run with -Dusethreads.
2450 (See README.threads for details.)
2451 EOM
2452 case "$usethreads" in
2453 $define|true|[yY]*)     dflt='y';;
2454 *) dflt='n';;
2455 esac
2456 rp='Build a threading Perl?'
2457 . ./myread
2458 case "$ans" in
2459 y|Y)    val="$define" ;;     
2460 *)      val="$undef" ;;
2461 esac
2462 set usethreads
2463 eval $setvar 
2464 : Look for a hint-file generated 'call-back-unit'.  Now that the
2465 : user has specified if a threading perl is to be built, we may need 
2466 : to set or change some other defaults.
2467 if $test -f usethreads.cbu; then
2468     . ./usethreads.cbu
2469 fi
2470 case "$d_oldpthreads" in
2471 '')     : Configure tests would be welcome here.  For now, assume undef.
2472         val="$undef" ;;
2473 *)      val="$d_oldpthreads" ;;
2474 esac
2475 set d_oldpthreads
2476 eval $setvar
2477
2478 cat <<EOM
2479
2480 Perl can be built so that multiple Perl interpreters can coexist
2481 within the same Perl executable.  To do so, Configure must be run with
2482 -Dusemultiplicity.
2483
2484 Normally you do not need this and you should answer no.
2485
2486 EOM
2487 case "$usemultiplicity" in
2488 $define|true|[yY]*)     dflt='y';;
2489 *) dflt='n';;
2490 esac
2491 rp='Build Perl for multiplicity?'
2492 . ./myread
2493 case "$ans" in
2494 y|Y)    val="$define" ;;     
2495 *)      val="$undef" ;;
2496 esac
2497 set usemultiplicity
2498 eval $setvar 
2499
2500 cat <<EOM
2501
2502 Perl can be built to take advantage of explicit 64-bit interfaces,
2503 on some systems.  To do so, Configure must be run with -Duse64bits.
2504
2505 If this doesn't make any sense to you, just accept the default 'n'.
2506 EOM
2507 case "$use64bits" in
2508 $define|true|[yY]*)     dflt='y';;
2509 *) dflt='n';;
2510 esac
2511 rp='Try to use explicit 64-bit interfaces, if available?'
2512 . ./myread
2513 case "$ans" in
2514 y|Y) 
2515         val="$define"
2516         ;;     
2517 *)      
2518         val="$undef"
2519         ;;
2520 esac
2521 set use64bits
2522 eval $setvar
2523
2524 archname64=''
2525
2526 : determine the architecture name
2527 echo " "
2528 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2529         tarch=`arch`"-$osname"
2530 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2531         if uname -m > tmparch 2>&1 ; then
2532                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
2533                         -e 's/$/'"-$osname/" tmparch`
2534         else
2535                 tarch="$osname"
2536         fi
2537         $rm -f tmparch
2538 else
2539         tarch="$osname"
2540 fi
2541 case "$myarchname" in
2542 ''|"$tarch") ;;
2543 *)
2544         echo "(Your architecture name used to be $myarchname.)"
2545         archname=''
2546         ;;
2547 esac
2548 myarchname="$tarch"
2549 case "$archname" in
2550 '') dflt="$tarch";;
2551 *) dflt="$archname";;
2552 esac
2553 rp='What is your architecture name'
2554 . ./myread
2555 archname="$ans"
2556 case "$usethreads" in
2557 $define)
2558         echo "Threads selected." >&4
2559         case "$archname" in
2560         *-thread*) echo "...and architecture name already has -thread." >&4
2561                 ;;
2562         *)      archname="$archname-thread"
2563                 echo "...setting architecture name to $archname." >&4
2564                 ;;
2565         esac
2566         ;;
2567 esac
2568 case "$usemultiplicity" in
2569 $define)
2570         echo "Multiplicity selected." >&4
2571         case "$archname" in
2572         *-multi*) echo "...and architecture name already has -multi." >&4
2573                 ;;
2574         *)      archname="$archname-multi"
2575                 echo "...setting architecture name to $archname." >&4
2576                 ;;
2577         esac
2578         ;;
2579 esac
2580 case "$use64bits" in
2581 $define)
2582         echo "Explicit 64-bitness selected." >&4
2583         case "$archname64" in
2584         '')
2585                 ;;
2586         *)
2587                 case "$archname" in
2588                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2589                         ;;
2590                 *)      archname="$archname-$archname64"
2591                         echo "...setting architecture name to $archname." >&4
2592                         ;;
2593                 esac
2594                 ;;
2595         esac
2596 esac
2597
2598 : is AFS running?
2599 echo " "
2600 case "$afs" in
2601 $define|true)   afs=true ;;
2602 $undef|false)   afs=false ;;
2603 *)      if test -d /afs; then
2604                 afs=true
2605         else
2606                 afs=false
2607         fi
2608         ;;
2609 esac
2610 if $afs; then
2611         echo "AFS may be running... I'll be extra cautious then..." >&4
2612 else
2613         echo "AFS does not seem to be running..." >&4
2614 fi
2615
2616 : decide how portable to be.  Allow command line overrides.
2617 case "$d_portable" in
2618 "$undef") ;;
2619 *)      d_portable="$define" ;;
2620 esac
2621
2622 : set up shell script to do ~ expansion
2623 cat >filexp <<EOSS
2624 $startsh
2625 : expand filename
2626 case "\$1" in
2627  ~/*|~)
2628         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2629         ;;
2630  ~*)
2631         if $test -f /bin/csh; then
2632                 /bin/csh -f -c "glob \$1"
2633                 failed=\$?
2634                 echo ""
2635                 exit \$failed
2636         else
2637                 name=\`$expr x\$1 : '..\([^/]*\)'\`
2638                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2639                 if $test ! -d "\$dir"; then
2640                         me=\`basename \$0\`
2641                         echo "\$me: can't locate home directory for: \$name" >&2
2642                         exit 1
2643                 fi
2644                 case "\$1" in
2645                 */*)
2646                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2647                         ;;
2648                 *)
2649                         echo \$dir
2650                         ;;
2651                 esac
2652         fi
2653         ;;
2654 *)
2655         echo \$1
2656         ;;
2657 esac
2658 EOSS
2659 chmod +x filexp
2660 $eunicefix filexp
2661
2662 : now set up to get a file name
2663 cat <<EOS >getfile
2664 $startsh
2665 EOS
2666 cat <<'EOSC' >>getfile
2667 tilde=''
2668 fullpath=''
2669 already=''
2670 skip=''
2671 none_ok=''
2672 exp_file=''
2673 nopath_ok=''
2674 orig_rp="$rp"
2675 orig_dflt="$dflt"
2676
2677 case "$fn" in
2678 *\(*)
2679         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
2680         fn=`echo $fn | sed 's/(.*)//'`
2681         ;;
2682 esac
2683
2684 case "$fn" in
2685 *:*)
2686         loc_file=`expr $fn : '.*:\(.*\)'`
2687         fn=`expr $fn : '\(.*\):.*'`
2688         ;;
2689 esac
2690
2691 case "$fn" in
2692 *~*) tilde=true;;
2693 esac
2694 case "$fn" in
2695 */*) fullpath=true;;
2696 esac
2697 case "$fn" in
2698 *+*) skip=true;;
2699 esac
2700 case "$fn" in
2701 *n*) none_ok=true;;
2702 esac
2703 case "$fn" in
2704 *e*) exp_file=true;;
2705 esac
2706 case "$fn" in
2707 *p*) nopath_ok=true;;
2708 esac
2709
2710 case "$fn" in
2711 *f*) type='File';;
2712 *d*) type='Directory';;
2713 *l*) type='Locate';;
2714 esac
2715
2716 what="$type"
2717 case "$what" in
2718 Locate) what='File';;
2719 esac
2720
2721 case "$exp_file" in
2722 '')
2723         case "$d_portable" in
2724         "$define") ;;
2725         *) exp_file=true;;
2726         esac
2727         ;;
2728 esac
2729
2730 cd ..
2731 while test "$type"; do
2732         redo=''
2733         rp="$orig_rp"
2734         dflt="$orig_dflt"
2735         case "$tilde" in
2736         true) rp="$rp (~name ok)";;
2737         esac
2738         . UU/myread
2739         if test -f UU/getfile.ok && \
2740                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2741         then
2742                 value="$ans"
2743                 ansexp="$ans"
2744                 break
2745         fi
2746         case "$ans" in
2747         none)
2748                 value=''
2749                 ansexp=''
2750                 case "$none_ok" in
2751                 true) type='';;
2752                 esac
2753                 ;;
2754         *)
2755                 case "$tilde" in
2756                 '') value="$ans"
2757                         ansexp="$ans";;
2758                 *)
2759                         value=`UU/filexp $ans`
2760                         case $? in
2761                         0)
2762                                 if test "$ans" != "$value"; then
2763                                         echo "(That expands to $value on this system.)"
2764                                 fi
2765                                 ;;
2766                         *) value="$ans";;
2767                         esac
2768                         ansexp="$value"
2769                         case "$exp_file" in
2770                         '') value="$ans";;
2771                         esac
2772                         ;;
2773                 esac
2774                 case "$fullpath" in
2775                 true)
2776                         case "$ansexp" in
2777                         /*) value="$ansexp" ;;
2778                         *)
2779                                 redo=true
2780                                 case "$already" in
2781                                 true)
2782                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
2783                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
2784                                         ;;
2785                                 *)
2786                                 echo "Please give a full path name, starting with slash." >&4
2787                                         case "$tilde" in
2788                                         true)
2789                                 echo "Note that using ~name is ok provided it expands well." >&4
2790                                                 already=true
2791                                                 ;;
2792                                         esac
2793                                 esac
2794                                 ;;
2795                         esac
2796                         ;;
2797                 esac
2798                 case "$redo" in
2799                 '')
2800                         case "$type" in
2801                         File)
2802                                 if test -f "$ansexp"; then
2803                                         type=''
2804                                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2805                                 then
2806                                         echo "($value is not a plain file, but that's ok.)"
2807                                         type=''
2808                                 fi
2809                                 ;;
2810                         Directory)
2811                                 if test -d "$ansexp"; then
2812                                         type=''
2813                                 fi
2814                                 ;;
2815                         Locate)
2816                                 if test -d "$ansexp"; then
2817                                         echo "(Looking for $loc_file in directory $value.)"
2818                                         value="$value/$loc_file"
2819                                         ansexp="$ansexp/$loc_file"
2820                                 fi
2821                                 if test -f "$ansexp"; then
2822                                         type=''
2823                                 fi
2824                                 case "$nopath_ok" in
2825                                 true)   case "$value" in
2826                                         */*) ;;
2827                                         *)      echo "Assuming $value will be in people's path."
2828                                                 type=''
2829                                                 ;;
2830                                         esac
2831                                         ;;
2832                                 esac
2833                                 ;;
2834                         esac
2835
2836                         case "$skip" in
2837                         true) type='';
2838                         esac
2839
2840                         case "$type" in
2841                         '') ;;
2842                         *)
2843                                 if test "$fastread" = yes; then
2844                                         dflt=y
2845                                 else
2846                                         dflt=n
2847                                 fi
2848                                 rp="$what $value doesn't exist.  Use that name anyway?"
2849                                 . UU/myread
2850                                 dflt=''
2851                                 case "$ans" in
2852                                 y*) type='';;
2853                                 *) echo " ";;
2854                                 esac
2855                                 ;;
2856                         esac
2857                         ;;
2858                 esac
2859                 ;;
2860         esac
2861 done
2862 cd UU
2863 ans="$value"
2864 rp="$orig_rp"
2865 dflt="$orig_dflt"
2866 rm -f getfile.ok
2867 EOSC
2868
2869 : determine root of directory hierarchy where package will be installed.
2870 case "$prefix" in
2871 '')
2872         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2873         ;;
2874 *)
2875         dflt="$prefix"
2876         ;;
2877 esac
2878 $cat <<EOM
2879
2880 By default, $package will be installed in $dflt/bin, manual
2881 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2882 all installation directories. Typically set to /usr/local, but you
2883 may choose /usr if you wish to install $package among your system
2884 binaries. If you wish to have binaries under /bin but manual pages
2885 under /usr/local/man, that's ok: you will be prompted separately
2886 for each of the installation directories, the prefix being only used
2887 to set the defaults.
2888
2889 EOM
2890 fn=d~
2891 rp='Installation prefix to use?'
2892 . ./getfile
2893 oldprefix=''
2894 case "$prefix" in
2895 '') ;;
2896 *)
2897         case "$ans" in
2898         "$prefix") ;;
2899         *) oldprefix="$prefix";;
2900         esac
2901         ;;
2902 esac
2903 prefix="$ans"
2904 prefixexp="$ansexp"
2905
2906 : set the prefixit variable, to compute a suitable default value
2907 prefixit='case "$3" in
2908 ""|none)
2909         case "$oldprefix" in
2910         "") eval "$1=\"\$$2\"";;
2911         *)
2912                 case "$3" in
2913                 "") eval "$1=";;
2914                 none)
2915                         eval "tp=\"\$$2\"";
2916                         case "$tp" in
2917                         ""|" ") eval "$1=\"\$$2\"";;
2918                         *) eval "$1=";;
2919                         esac;;
2920                 esac;;
2921         esac;;
2922 *)
2923         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2924         case "$tp" in
2925         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2926         /*-$oldprefix/*|\~*-$oldprefix/*)
2927                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2928         *) eval "$1=\"\$$2\"";;
2929         esac;;
2930 esac'
2931
2932 : set the base revision
2933 baserev=5.0
2934
2935 : get the patchlevel
2936 echo " "
2937 echo "Getting the current patchlevel..." >&4
2938 if $test -r $rsrc/patchlevel.h;then
2939         patchlevel=`awk '/define[       ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
2940         subversion=`awk '/define[       ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
2941 else
2942         patchlevel=0
2943         subversion=0
2944 fi
2945 $echo $n "(You have $package" $c
2946 case "$package" in
2947 "*$baserev")    ;;
2948 *)              $echo $n " $baserev" $c ;;
2949 esac
2950 $echo $n " patchlevel $patchlevel" $c
2951 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
2952 echo ".)"
2953
2954 if test 0 -eq "$subversion"; then
2955         version=`LC_ALL=C; export LC_ALL; \
2956                  echo $baserev $patchlevel | \
2957                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2958 else
2959         version=`LC_ALL=C; export LC_ALL; \
2960                  echo $baserev $patchlevel $subversion | \
2961                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
2962 fi
2963 : Figure out perl API version.  Perhaps this should be in patchlevel.h
2964 if test "$subversion" -lt 50; then
2965         apiversion=`LC_ALL=C; export LC_ALL; \
2966                  echo $baserev $patchlevel | \
2967                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2968 else
2969         apiversion="$version"
2970 fi
2971
2972 : determine where private library files go
2973 : Usual default is /usr/local/lib/perl5/$version.
2974 : Also allow things like /opt/perl/lib/$version, since 
2975 : /opt/perl/lib/perl5... would be redundant.
2976 case "$prefix" in
2977 *perl*) set dflt privlib lib/$version ;;
2978 *)       set dflt privlib lib/$package/$version ;;
2979 esac
2980 eval $prefixit
2981 $cat <<EOM
2982
2983 There are some auxiliary files for $package that need to be put into a
2984 private library directory that is accessible by everyone.
2985
2986 EOM
2987 fn=d~+
2988 rp='Pathname where the private library files will reside?'
2989 . ./getfile
2990 if $test "X$privlibexp" != "X$ansexp"; then
2991         installprivlib=''
2992 fi
2993 privlib="$ans"
2994 privlibexp="$ansexp"
2995 if $afs; then
2996         $cat <<EOM
2997
2998 Since you are running AFS, I need to distinguish the directory in which
2999 private files reside from the directory in which they are installed (and from
3000 which they are presumably copied to the former directory by occult means).
3001
3002 EOM
3003         case "$installprivlib" in
3004         '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3005         *) dflt="$installprivlib";;
3006         esac
3007         fn=de~
3008         rp='Where will private files be installed?'
3009         . ./getfile
3010         installprivlib="$ans"
3011 else
3012         installprivlib="$privlibexp"
3013 fi
3014
3015 : set the prefixup variable, to restore leading tilda escape
3016 prefixup='case "$prefixexp" in
3017 "$prefix") ;;
3018 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3019 esac'
3020
3021 : determine where public architecture dependent libraries go
3022 set archlib archlib
3023 eval $prefixit
3024 : privlib default is /usr/local/lib/$package/$version
3025 : archlib default is /usr/local/lib/$package/$version/$archname
3026 : privlib may have an optional trailing /share.
3027 tdflt=`echo $privlib | $sed 's,/share$,,'`
3028 tdflt=$tdflt/$archname
3029 case "$archlib" in
3030 '')     dflt=$tdflt
3031         ;;
3032 *)      dflt="$archlib"
3033     ;;
3034 esac
3035 cat <<EOM
3036
3037 $spackage contains architecture-dependent library files.  If you are
3038 sharing libraries in a heterogeneous environment, you might store
3039 these files in a separate location.  Otherwise, you can just include
3040 them with the rest of the public library files.
3041
3042 EOM
3043 fn=d+~
3044 rp='Where do you want to put the public architecture-dependent libraries?'
3045 . ./getfile
3046 archlib="$ans"
3047 archlibexp="$ansexp"
3048
3049 if $afs; then
3050         $cat <<EOM
3051
3052 Since you are running AFS, I need to distinguish the directory in
3053 which architecture-dependent library files reside from the directory
3054 in which they are installed (and from which they are presumably copied
3055 to the former directory by occult means).
3056
3057 EOM
3058         case "$installarchlib" in
3059         '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3060         *) dflt="$installarchlib";;
3061         esac
3062         fn=de~
3063         rp='Where will architecture-dependent library files be installed?'
3064         . ./getfile
3065         installarchlib="$ans"
3066 else
3067         installarchlib="$archlibexp"
3068 fi
3069 if $test X"$archlib" = X"$privlib"; then
3070         d_archlib="$undef"
3071 else
3072         d_archlib="$define"
3073 fi
3074
3075 : make some quick guesses about what we are up against
3076 echo " "
3077 $echo $n "Hmm...  $c"
3078 echo exit 1 >bsd
3079 echo exit 1 >usg
3080 echo exit 1 >v7
3081 echo exit 1 >osf1
3082 echo exit 1 >eunice
3083 echo exit 1 >xenix
3084 echo exit 1 >venix
3085 echo exit 1 >os2
3086 d_bsd="$undef"
3087 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3088 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3089 then
3090         echo "Looks kind of like an OSF/1 system, but we'll see..."
3091         echo exit 0 >osf1
3092 elif test `echo abc | tr a-z A-Z` = Abc ; then
3093         xxx=`./loc addbib blurfl $pth`
3094         if $test -f $xxx; then
3095         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3096                 echo exit 0 >bsd
3097                 echo exit 0 >usg
3098         else
3099                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3100                         echo "Looks kind of like an extended USG system, but we'll see..."
3101                 else
3102                         echo "Looks kind of like a USG system, but we'll see..."
3103                 fi
3104                 echo exit 0 >usg
3105         fi
3106 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3107         echo "Looks kind of like a BSD system, but we'll see..."
3108         d_bsd="$define"
3109         echo exit 0 >bsd
3110 else
3111         echo "Looks kind of like a Version 7 system, but we'll see..."
3112         echo exit 0 >v7
3113 fi
3114 case "$eunicefix" in
3115 *unixtovms*)
3116         $cat <<'EOI'
3117 There is, however, a strange, musty smell in the air that reminds me of
3118 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3119 EOI
3120         echo exit 0 >eunice
3121         d_eunice="$define"
3122 : it so happens the Eunice I know will not run shell scripts in Unix format
3123         ;;
3124 *)
3125         echo " "
3126         echo "Congratulations.  You aren't running Eunice."
3127         d_eunice="$undef"
3128         ;;
3129 esac
3130 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3131 case "$p_" in
3132 :) ;;
3133 *)
3134         $cat <<'EOI'
3135 I have the feeling something is not exactly right, however...don't tell me...
3136 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3137 EOI
3138         echo exit 0 >os2
3139         ;;
3140 esac
3141 if test -f /xenix; then
3142         echo "Actually, this looks more like a XENIX system..."
3143         echo exit 0 >xenix
3144         d_xenix="$define"
3145 else
3146         echo " "
3147         echo "It's not Xenix..."
3148         d_xenix="$undef"
3149 fi
3150 chmod +x xenix
3151 $eunicefix xenix
3152 if test -f /venix; then
3153         echo "Actually, this looks more like a VENIX system..."
3154         echo exit 0 >venix
3155 else
3156         echo " "
3157         if ./xenix; then
3158                 : null
3159         else
3160                 echo "Nor is it Venix..."
3161         fi
3162 fi
3163 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3164 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3165 $rm -f foo
3166
3167 : see if setuid scripts can be secure
3168 $cat <<EOM
3169
3170 Some kernels have a bug that prevents setuid #! scripts from being
3171 secure.  Some sites have disabled setuid #! scripts because of this.
3172
3173 First let's decide if your kernel supports secure setuid #! scripts.
3174 (If setuid #! scripts would be secure but have been disabled anyway,
3175 don't say that they are secure if asked.)
3176
3177 EOM
3178
3179 val="$undef"
3180 if $test -d /dev/fd; then
3181         echo "#!$ls" >reflect
3182         chmod +x,u+s reflect
3183         ./reflect >flect 2>&1
3184         if $contains "/dev/fd" flect >/dev/null; then
3185                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3186                 val="$define"
3187         else
3188                 $cat <<EOM
3189 If you are not sure if they are secure, I can check but I'll need a
3190 username and password different from the one you are using right now.
3191 If you don't have such a username or don't want me to test, simply
3192 enter 'none'.
3193
3194 EOM
3195                 rp='Other username to test security of setuid scripts with?'
3196                 dflt='none'
3197                 . ./myread
3198                 case "$ans" in
3199                 n|none)
3200                         case "$d_suidsafe" in
3201                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3202                                 dflt=n;;
3203                         "$undef")
3204                                 echo "Well, the $hint value is *not* secure." >&4
3205                                 dflt=n;;
3206                         *)      echo "Well, the $hint value *is* secure." >&4
3207                                 dflt=y;;
3208                         esac
3209                         ;;
3210                 *)
3211                         $rm -f reflect flect
3212                         echo "#!$ls" >reflect
3213                         chmod +x,u+s reflect
3214                         echo >flect
3215                         chmod a+w flect
3216                         echo '"su" will (probably) prompt you for '"$ans's password."
3217                         su $ans -c './reflect >flect'
3218                         if $contains "/dev/fd" flect >/dev/null; then
3219                                 echo "Okay, it looks like setuid scripts are secure." >&4
3220                                 dflt=y
3221                         else
3222                                 echo "I don't think setuid scripts are secure." >&4
3223                                 dflt=n
3224                         fi
3225                         ;;
3226                 esac
3227                 rp='Does your kernel have *secure* setuid scripts?'
3228                 . ./myread
3229                 case "$ans" in
3230                 [yY]*)  val="$define";;
3231                 *)      val="$undef";;
3232                 esac
3233         fi
3234 else
3235         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3236         echo "(That's for file descriptors, not floppy disks.)"
3237         val="$undef"
3238 fi
3239 set d_suidsafe
3240 eval $setvar
3241
3242 $rm -f reflect flect
3243
3244 : now see if they want to do setuid emulation
3245 echo " "
3246 val="$undef"
3247 case "$d_suidsafe" in
3248 "$define")
3249         val="$undef"
3250         echo "No need to emulate SUID scripts since they are secure here." >& 4
3251         ;;
3252 *)
3253         $cat <<EOM
3254 Some systems have disabled setuid scripts, especially systems where
3255 setuid scripts cannot be secure.  On systems where setuid scripts have
3256 been disabled, the setuid/setgid bits on scripts are currently
3257 useless.  It is possible for $package to detect those bits and emulate
3258 setuid/setgid in a secure fashion.  This emulation will only work if
3259 setuid scripts have been disabled in your kernel.
3260
3261 EOM
3262         case "$d_dosuid" in
3263         "$define") dflt=y ;;
3264         *) dflt=n ;;
3265         esac
3266         rp="Do you want to do setuid/setgid emulation?"
3267         . ./myread
3268         case "$ans" in
3269         [yY]*)  val="$define";;
3270         *)      val="$undef";;
3271         esac
3272         ;;
3273 esac
3274 set d_dosuid
3275 eval $setvar
3276
3277 : determine where manual pages are on this system
3278 echo " "
3279 case "$sysman" in
3280 '') 
3281         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3282         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3283         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3284         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3285         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3286         sysman=`./loc . /usr/man/man1 $syspath`
3287         ;;
3288 esac
3289 if $test -d "$sysman"; then
3290         echo "System manual is in $sysman." >&4
3291 else
3292         echo "Could not find manual pages in source form." >&4
3293 fi
3294
3295 : see what memory models we can support
3296 case "$models" in
3297 '')
3298         $cat >pdp11.c <<'EOP'
3299 main() {
3300 #ifdef pdp11
3301         exit(0);
3302 #else
3303         exit(1);
3304 #endif
3305 }
3306 EOP
3307         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3308         if $test -f pdp11 && ./pdp11 2>/dev/null; then
3309                 dflt='unsplit split'
3310         else
3311                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3312                 case "$tans" in
3313                 X) dflt='none';;
3314                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3315                                 dflt='small'
3316                         else
3317                                 dflt=''
3318                         fi
3319                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
3320                                 dflt="$dflt medium"
3321                         fi
3322                         if $test -d /lib/large || $test -d /usr/lib/large; then
3323                                 dflt="$dflt large"
3324                         fi
3325                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
3326                                 dflt="$dflt huge"
3327                         fi
3328                 esac
3329         fi;;
3330 *) dflt="$models";;
3331 esac
3332 $cat <<EOM
3333  
3334 Some systems have different model sizes.  On most systems they are called
3335 small, medium, large, and huge.  On the PDP11 they are called unsplit and
3336 split.  If your system doesn't support different memory models, say "none".
3337 If you wish to force everything to one memory model, say "none" here and
3338 put the appropriate flags later when it asks you for other cc and ld flags.
3339 Venix systems may wish to put "none" and let the compiler figure things out.
3340 (In the following question multiple model names should be space separated.)
3341
3342 The default for most systems is "none".
3343
3344 EOM
3345 rp="Which memory models are supported?"
3346 . ./myread
3347 models="$ans"
3348
3349 case "$models" in
3350 none)
3351         small=''
3352         medium=''
3353         large=''
3354         huge=''
3355         unsplit=''
3356         split=''
3357         ;;
3358 *split)
3359         case "$split" in
3360         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3361                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3362                         dflt='-i'
3363                 else
3364                         dflt='none'
3365                 fi;;
3366         *) dflt="$split";;
3367         esac
3368         rp="What flag indicates separate I and D space?"
3369         . ./myread
3370         tans="$ans"
3371         case "$tans" in
3372         none) tans='';;
3373         esac
3374         split="$tans"
3375         unsplit='';;
3376 *large*|*small*|*medium*|*huge*)
3377         case "$models" in
3378         *large*)
3379                 case "$large" in
3380                 '') dflt='-Ml';;
3381                 *) dflt="$large";;
3382                 esac
3383         rp="What flag indicates large model?"
3384         . ./myread
3385         tans="$ans"
3386         case "$tans" in
3387         none) tans='';
3388         esac
3389         large="$tans";;
3390         *) large='';;
3391         esac
3392         case "$models" in
3393         *huge*) case "$huge" in
3394                 '') dflt='-Mh';;
3395                 *) dflt="$huge";;
3396                 esac
3397                 rp="What flag indicates huge model?"
3398                 . ./myread
3399                 tans="$ans"
3400                 case "$tans" in
3401                 none) tans='';
3402                 esac
3403                 huge="$tans";;
3404         *) huge="$large";;
3405         esac
3406         case "$models" in
3407         *medium*) case "$medium" in
3408                 '') dflt='-Mm';;
3409                 *) dflt="$medium";;
3410                 esac
3411                 rp="What flag indicates medium model?"
3412                 . ./myread
3413                 tans="$ans"
3414                 case "$tans" in
3415                 none) tans='';
3416                 esac
3417                 medium="$tans";;
3418         *) medium="$large";;
3419         esac
3420         case "$models" in
3421         *small*) case "$small" in
3422                 '') dflt='none';;
3423                 *) dflt="$small";;
3424                 esac
3425                 rp="What flag indicates small model?"
3426                 . ./myread
3427                 tans="$ans"
3428                 case "$tans" in
3429                 none) tans='';
3430                 esac
3431                 small="$tans";;
3432         *) small='';;
3433         esac
3434         ;;
3435 *)
3436         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3437         ;;
3438 esac
3439 $rm -f pdp11.* pdp11
3440
3441 : see if we need a special compiler
3442 echo " "
3443 if ./usg; then
3444         case "$cc" in
3445         '') case "$Mcc" in
3446                 /*) dflt='Mcc';;
3447                 *) case "$large" in
3448                         -M*) dflt='cc';;
3449                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3450                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3451                                                 dflt='cc'
3452                                         else
3453                                                 dflt='cc -M'
3454                                         fi
3455                                 else
3456                                         dflt='cc'
3457                                 fi;;
3458                         esac;;
3459                 esac;;
3460         *)  dflt="$cc";;
3461         esac
3462         case "$dflt" in
3463         *M*)    $cat <<'EOM'
3464 On some older systems the default C compiler will not resolve multiple global
3465 references that happen to have the same name.  On some such systems the "Mcc"
3466 command may be used to force these to be resolved.  On other systems a "cc -M"
3467 command is required.  (Note that the -M flag on other systems indicates a
3468 memory model to use!) If you have the Gnu C compiler, you might wish to use
3469 that instead.
3470
3471 EOM
3472         ;;
3473         esac
3474         rp="Use which C compiler?"
3475         . ./myread
3476         cc="$ans"
3477 else
3478         case "$cc" in
3479         '') dflt=cc;;
3480         *) dflt="$cc";;
3481         esac
3482         rp="Use which C compiler?"
3483         . ./myread
3484         cc="$ans"
3485 fi
3486 : Look for a hint-file generated 'call-back-unit'.  Now that the
3487 : user has specified the compiler, we may need to set or change some
3488 : other defaults.
3489 if $test -f cc.cbu; then
3490     . ./cc.cbu
3491 fi
3492 echo " "
3493 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3494 $cat >gccvers.c <<EOM
3495 #include <stdio.h>
3496 int main() {
3497 #ifdef __GNUC__
3498 #ifdef __VERSION__
3499         printf("%s\n", __VERSION__);
3500 #else
3501         printf("%s\n", "1");
3502 #endif
3503 #endif
3504         exit(0);
3505 }
3506 EOM
3507 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3508         gccversion=`./gccvers`
3509         case "$gccversion" in
3510         '') echo "You are not using GNU cc." ;;
3511         *)  echo "You are using GNU cc $gccversion." ;;
3512         esac
3513 else
3514         echo " "
3515         echo "*** WHOA THERE!!! ***" >&4
3516         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3517         case "$knowitall" in
3518         '')
3519         echo "    You'd better start hunting for one and let me know about it." >&4
3520                 exit 1
3521                 ;;
3522         esac
3523 fi
3524 $rm -f gccvers*
3525 case "$gccversion" in
3526 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3527 esac
3528
3529 : What should the include directory be ?
3530 echo " "
3531 $echo $n "Hmm...  $c"
3532 dflt='/usr/include'
3533 incpath=''
3534 mips_type=''
3535 if $test -f /bin/mips && /bin/mips; then
3536         echo "Looks like a MIPS system..."
3537         $cat >usr.c <<'EOCP'
3538 #ifdef SYSTYPE_BSD43
3539 /bsd43
3540 #endif
3541 EOCP
3542         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3543                 dflt='/bsd43/usr/include'
3544                 incpath='/bsd43'
3545                 mips_type='BSD 4.3'
3546         else
3547                 mips_type='System V'
3548         fi
3549         $rm -f usr.c usr.out
3550         echo "and you're compiling with the $mips_type compiler and libraries."
3551         xxx_prompt=y
3552         echo "exit 0" >mips
3553 else
3554         echo "Doesn't look like a MIPS system."
3555         xxx_prompt=n
3556         echo "exit 1" >mips
3557 fi
3558 chmod +x mips
3559 $eunicefix mips
3560 case "$usrinc" in
3561 '') ;;
3562 *) dflt="$usrinc";;
3563 esac
3564 case "$xxx_prompt" in
3565 y)      fn=d/
3566         echo " "
3567         rp='Where are the include files you want to use?'
3568         . ./getfile
3569         usrinc="$ans"
3570         ;;
3571 *)      usrinc="$dflt"
3572         ;;
3573 esac
3574
3575 : see how we invoke the C preprocessor
3576 echo " "
3577 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3578 cat <<'EOT' >testcpp.c
3579 #define ABC abc
3580 #define XYZ xyz
3581 ABC.XYZ
3582 EOT
3583 cd ..
3584 if test ! -f cppstdin; then
3585         echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3586 else
3587         echo "Keeping your $hint cppstdin wrapper."
3588 fi
3589 chmod 755 cppstdin
3590 wrapper=`pwd`/cppstdin
3591 ok='false'
3592 cd UU
3593
3594 if $test "X$cppstdin" != "X" && \
3595         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3596         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3597 then
3598         echo "You used to use $cppstdin $cppminus so we'll use that again."
3599         case "$cpprun" in
3600         '') echo "But let's see if we can live without a wrapper..." ;;
3601         *)
3602                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3603                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3604                 then
3605                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3606                         ok='true'
3607                 else
3608                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3609                 fi
3610                 ;;
3611         esac
3612 else
3613         case "$cppstdin" in
3614         '') ;;
3615         *)
3616                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3617                 ;;
3618         esac
3619 fi
3620
3621 if $ok; then
3622         : nothing
3623 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3624         $cc -E <testcpp.c >testcpp.out 2>&1; \
3625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3626         echo "Yup, it does."
3627         x_cpp="$cc -E"
3628         x_minus='';
3629 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3630         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3632         echo "Yup, it does."
3633         x_cpp="$cc -E"
3634         x_minus='-';
3635 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3636         $cc -P <testcpp.c >testcpp.out 2>&1; \
3637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3638         echo "Yipee, that works!"
3639         x_cpp="$cc -P"
3640         x_minus='';
3641 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3642         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3644         echo "At long last!"
3645         x_cpp="$cc -P"
3646         x_minus='-';
3647 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3648         $cpp <testcpp.c >testcpp.out 2>&1; \
3649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3650         echo "It works!"
3651         x_cpp="$cpp"
3652         x_minus='';
3653 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3654         $cpp - <testcpp.c >testcpp.out 2>&1; \
3655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3656         echo "Hooray, it works!  I was beginning to wonder."
3657         x_cpp="$cpp"
3658         x_minus='-';
3659 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3660         $wrapper <testcpp.c >testcpp.out 2>&1; \
3661         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3662         x_cpp="$wrapper"
3663         x_minus=''
3664         echo "Eureka!"
3665 else
3666         dflt=''
3667         rp="No dice.  I can't find a C preprocessor.  Name one:"
3668         . ./myread
3669         x_cpp="$ans"
3670         x_minus=''
3671         $x_cpp <testcpp.c >testcpp.out 2>&1
3672         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3673                 echo "OK, that will do." >&4
3674         else
3675 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3676                 exit 1
3677         fi
3678 fi
3679
3680 case "$ok" in
3681 false)
3682         cppstdin="$x_cpp"
3683         cppminus="$x_minus"
3684         cpprun="$x_cpp"
3685         cpplast="$x_minus"
3686         set X $x_cpp
3687         shift
3688         case "$1" in
3689         "$cpp")
3690                 echo "Perhaps can we force $cc -E using a wrapper..."
3691                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3692                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3693                 then
3694                         echo "Yup, we can."
3695                         cppstdin="$wrapper"
3696                         cppminus='';
3697                 else
3698                         echo "Nope, we'll have to live without it..."
3699                 fi
3700                 ;;
3701         esac
3702         case "$cpprun" in
3703         "$wrapper")
3704                 cpprun=''
3705                 cpplast=''
3706                 ;;
3707         esac
3708         ;;
3709 esac
3710
3711 case "$cppstdin" in
3712 "$wrapper") ;;
3713 *) $rm -f $wrapper;;
3714 esac
3715 $rm -f testcpp.c testcpp.out
3716
3717 : Set private lib path
3718 case "$plibpth" in
3719 '') if ./mips; then
3720                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3721         fi;;
3722 esac
3723 case "$libpth" in
3724 ' ') dlist='';;
3725 '') dlist="$loclibpth $plibpth $glibpth";;
3726 *) dlist="$libpth";;
3727 esac
3728
3729 : Now check and see which directories actually exist, avoiding duplicates
3730 libpth=''
3731 for xxx in $dlist
3732 do
3733     if $test -d $xxx; then
3734                 case " $libpth " in
3735                 *" $xxx "*) ;;
3736                 *) libpth="$libpth $xxx";;
3737                 esac
3738     fi
3739 done
3740 $cat <<'EOM'
3741
3742 Some systems have incompatible or broken versions of libraries.  Among
3743 the directories listed in the question below, please remove any you
3744 know not to be holding relevant libraries, and add any that are needed.
3745 Say "none" for none.
3746
3747 EOM
3748 case "$libpth" in
3749 '') dflt='none';;
3750 *)
3751         set X $libpth
3752         shift
3753         dflt=${1+"$@"}
3754         ;;
3755 esac
3756 rp="Directories to use for library searches?"
3757 . ./myread
3758 case "$ans" in
3759 none) libpth=' ';;
3760 *) libpth="$ans";;
3761 esac
3762
3763 : compute shared library extension
3764 case "$so" in
3765 '')
3766         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3767                 dflt='sl'
3768         else
3769                 dflt='so'
3770         fi
3771         ;;
3772 *) dflt="$so";;
3773 esac
3774 $cat <<EOM
3775
3776 On some systems, shared libraries may be available.  Answer 'none' if
3777 you want to suppress searching of shared libraries for the remaining
3778 of this configuration.
3779
3780 EOM
3781 rp='What is the file extension used for shared libraries?'
3782 . ./myread
3783 so="$ans"
3784
3785 : Define several unixisms.
3786 : Hints files or command line option can be used to override them.
3787 : The convoluted testing is in case hints files set either the old
3788 : or the new name.
3789 case "$_exe" in
3790 '')     case "$exe_ext" in
3791     '') ;;
3792         *)      _exe="$exe_ext" ;;
3793         esac
3794         ;;
3795 esac
3796 case "$_a" in
3797 '')     case "$lib_ext" in
3798     '') _a='.a';;
3799         *)      _a="$lib_ext" ;;
3800         esac
3801         ;;
3802 esac
3803 case "$_o" in
3804 '') case "$obj_ext" in
3805         '')     _o='.o';;
3806         *)      _o="$obj_ext";;
3807         esac
3808         ;;
3809 esac
3810 case "$p_" in
3811 '') case "$path_sep" in
3812         '')     p_=':';;
3813         *)      p_="$path_sep";;
3814         esac
3815         ;;
3816 esac
3817 exe_ext=$_exe
3818 lib_ext=$_a
3819 obj_ext=$_o
3820 path_sep=$p_
3821
3822 : Which makefile gets called first.  This is used by make depend.
3823 case "$firstmakefile" in
3824 '') firstmakefile='makefile';;
3825 esac
3826
3827 : Looking for optional libraries
3828 echo " "
3829 echo "Checking for optional libraries..." >&4
3830 case "$libs" in
3831 ' '|'') dflt='';;
3832 *) dflt="$libs";;
3833 esac
3834 case "$libswanted" in
3835 '') libswanted='c_s';;
3836 esac
3837 for thislib in $libswanted; do
3838         
3839         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3840                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3841                 echo "Found -l$thislib (shared)."
3842                 case " $dflt " in
3843                 *"-l$thislib "*);;
3844                 *) dflt="$dflt -l$thislib";;
3845                 esac
3846         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3847                 echo "Found -l$thislib (shared)."
3848                 case " $dflt " in
3849                 *"-l$thislib "*);;
3850                 *) dflt="$dflt -l$thislib";;
3851                 esac
3852         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3853                 echo "Found -l$thislib."
3854                 case " $dflt " in
3855                 *"-l$thislib "*);;
3856                 *) dflt="$dflt -l$thislib";;
3857                 esac
3858         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3859                 echo "Found -l$thislib."
3860                 case " $dflt " in
3861                 *"-l$thislib "*);;
3862                 *) dflt="$dflt -l$thislib";;
3863                 esac
3864         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3865                 echo "Found -l${thislib}_s."
3866                 case " $dflt " in
3867                 *"-l$thislib "*);;
3868                 *) dflt="$dflt -l${thislib}_s";;
3869                 esac
3870         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3871                 echo "Found -l$thislib."
3872                 case " $dflt " in
3873                 *"-l$thislib "*);;
3874                 *) dflt="$dflt -l$thislib";;
3875                 esac
3876         else
3877                 echo "No -l$thislib."
3878         fi
3879 done
3880 set X $dflt
3881 shift
3882 dflt="$*"
3883 case "$libs" in
3884 '') dflt="$dflt";;
3885 *) dflt="$libs";;
3886 esac
3887 case "$dflt" in
3888 ' '|'') dflt='none';;
3889 esac
3890
3891 $cat <<EOM
3892  
3893 Some versions of Unix support shared libraries, which make executables smaller
3894 but make load time slightly longer.
3895
3896 On some systems, mostly System V Release 3's, the shared library is included
3897 by putting the option "-lc_s" as the last thing on the cc command line when
3898 linking.  Other systems use shared libraries by default.  There may be other
3899 libraries needed to compile $package on your machine as well.  If your system
3900 needs the "-lc_s" option, include it here.  Include any other special libraries
3901 here as well.  Say "none" for none.
3902 EOM
3903
3904 echo " "
3905 rp="Any additional libraries?"
3906 . ./myread
3907 case "$ans" in
3908 none) libs=' ';;
3909 *) libs="$ans";;
3910 esac
3911
3912 : determine optimize, if desired, or use for debug flag also
3913 case "$optimize" in
3914 ' '|$undef) dflt='none';;
3915 '') dflt='-O';;
3916 *) dflt="$optimize";;
3917 esac
3918 $cat <<EOH
3919
3920 Some C compilers have problems with their optimizers.  By default, $package
3921 compiles with the -O flag to use the optimizer.  Alternately, you might want
3922 to use the symbolic debugger, which uses the -g flag (on traditional Unix
3923 systems).  Either flag can be specified here.  To use neither flag, specify
3924 the word "none".
3925
3926 EOH
3927 rp="What optimizer/debugger flag should be used?"
3928 . ./myread
3929 optimize="$ans"
3930 case "$optimize" in
3931 'none') optimize=" ";;
3932 esac
3933
3934 dflt=''
3935 : We will not override a previous value, but we might want to
3936 : augment a hint file
3937 case "$hint" in
3938 none|recommended)
3939         case "$gccversion" in
3940         1*) dflt='-fpcc-struct-return' ;;
3941         esac
3942         case "$optimize" in
3943         *-g*) dflt="$dflt -DDEBUGGING";;
3944         esac
3945         case "$gccversion" in
3946         2*) if test -d /etc/conf/kconfig.d &&
3947                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3948                 then
3949                         dflt="$dflt -posix"
3950                 fi
3951                 ;;
3952         esac
3953         ;;
3954 esac
3955
3956 case "$mips_type" in
3957 *BSD*|'') inclwanted="$locincpth $usrinc";;
3958 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3959 esac
3960 for thisincl in $inclwanted; do
3961         if $test -d $thisincl; then
3962                 if $test x$thisincl != x$usrinc; then
3963                         case "$dflt" in
3964                         *$thisincl*);;
3965                         *) dflt="$dflt -I$thisincl";;
3966                         esac
3967                 fi
3968         fi
3969 done
3970
3971 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3972         xxx=true;
3973 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3974         xxx=true;
3975 else
3976         xxx=false;
3977 fi;
3978 if $xxx; then
3979         case "$dflt" in
3980         *$2*);;
3981         *) dflt="$dflt -D$2";;
3982         esac;
3983 fi'
3984
3985 if ./osf1; then
3986         set signal.h __LANGUAGE_C__; eval $inctest
3987 else
3988         set signal.h LANGUAGE_C; eval $inctest
3989 fi
3990
3991 case "$hint" in
3992 none|recommended) dflt="$ccflags $dflt" ;;
3993 *) dflt="$ccflags";;
3994 esac
3995
3996 case "$dflt" in
3997 ''|' ') dflt=none;;
3998 esac
3999 $cat <<EOH
4000
4001 Your C compiler may want other flags.  For this question you should include
4002 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4003 but you should NOT include libraries or ld flags like -lwhatever.  If you
4004 want $package to honor its debug switch, you should include -DDEBUGGING here.
4005 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4006
4007 To use no flags, specify the word "none".
4008
4009 EOH
4010 set X $dflt
4011 shift
4012 dflt=${1+"$@"}
4013 rp="Any additional cc flags?"
4014 . ./myread
4015 case "$ans" in
4016 none) ccflags='';;
4017 *) ccflags="$ans";;
4018 esac
4019
4020 : the following weeds options from ccflags that are of no interest to cpp
4021 cppflags="$ccflags"
4022 case "$gccversion" in
4023 1*) cppflags="$cppflags -D__GNUC__"
4024 esac
4025 case "$mips_type" in
4026 '');;
4027 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4028 esac
4029 case "$cppflags" in
4030 '');;
4031 *)
4032         echo " "
4033         echo "Let me guess what the preprocessor flags are..." >&4
4034         set X $cppflags
4035         shift
4036         cppflags=''
4037         $cat >cpp.c <<'EOM'
4038 #define BLURFL foo
4039
4040 BLURFL xx LFRULB
4041 EOM
4042         previous=''
4043         for flag in $*
4044         do
4045                 case "$flag" in
4046                 -*) ftry="$flag";;
4047                 *) ftry="$previous $flag";;
4048                 esac
4049                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4050                         >cpp1.out 2>/dev/null && \
4051                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4052                         >cpp2.out 2>/dev/null && \
4053                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4054                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4055                 then
4056                         cppflags="$cppflags $ftry"
4057                         previous=''
4058                 else
4059                         previous="$flag"
4060                 fi
4061         done
4062         set X $cppflags
4063         shift
4064         cppflags=${1+"$@"}
4065         case "$cppflags" in
4066         *-*)  echo "They appear to be: $cppflags";;
4067         esac
4068         $rm -f cpp.c cpp?.out
4069         ;;
4070 esac
4071
4072 : flags used in final linking phase
4073 case "$ldflags" in
4074 '') if ./venix; then
4075                 dflt='-i -z'
4076         else
4077                 dflt=''
4078         fi
4079         case "$ccflags" in
4080         *-posix*) dflt="$dflt -posix" ;;
4081         esac
4082         ;;
4083 *) dflt="$ldflags";;
4084 esac
4085
4086 : Try to guess additional flags to pick up local libraries.
4087 for thislibdir in $libpth; do
4088         case " $loclibpth " in
4089         *" $thislibdir "*)
4090                 case "$dflt " in 
4091                 *"-L$thislibdir "*) ;;
4092                 *)  dflt="$dflt -L$thislibdir" ;;
4093                 esac
4094                 ;;
4095         esac
4096 done
4097
4098 case "$dflt" in
4099 '') dflt='none' ;;
4100 esac
4101
4102 $cat <<EOH
4103
4104 Your C linker may need flags.  For this question you should
4105 include -L/whatever and any other flags used by the C linker, but you
4106 should NOT include libraries like -lwhatever.
4107
4108 Make sure you include the appropriate -L/path flags if your C linker
4109 does not normally search all of the directories you specified above,
4110 namely
4111         $libpth
4112 To use no flags, specify the word "none".
4113
4114 EOH
4115
4116 rp="Any additional ld flags (NOT including libraries)?"
4117 . ./myread
4118 case "$ans" in
4119 none) ldflags='';;
4120 *) ldflags="$ans";;
4121 esac
4122 rmlist="$rmlist pdp11"
4123
4124 : coherency check
4125 echo " "
4126 echo "Checking your choice of C compiler and flags for coherency..." >&4
4127 $cat > try.c <<'EOF'
4128 #include <stdio.h>
4129 main() { printf("Ok\n"); exit(0); }
4130 EOF
4131 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4132 shift
4133 $cat >try.msg <<'EOM'
4134 I've tried to compile and run the following simple program:
4135
4136 EOM
4137 $cat try.c
4138
4139 $cat >> try.msg <<EOM
4140
4141 I used the command:
4142
4143         $*
4144         ./try
4145
4146 and I got the following output:
4147
4148 EOM
4149 dflt=y
4150 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4151         if sh -c './try' >>try.msg 2>&1; then
4152                 xxx=`./try`
4153                 case "$xxx" in
4154                 "Ok") dflt=n ;;
4155                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4156                         case " $libs " in
4157                         *" -lsfio "*)
4158                                 cat >> try.msg <<'EOQS'
4159 If $libs contains -lsfio, and sfio is mis-configured, then it
4160 sometimes (apparently) runs and exits with a 0 status, but with no
4161 output!  It may have to do with sfio's use of _exit vs. exit.
4162
4163 EOQS
4164                                 rp="You have a big problem.  Shall I abort Configure"
4165                                 dflt=y
4166                                 ;;
4167                         esac
4168                         ;;
4169                 esac
4170         else
4171                 echo "The program compiled OK, but exited with status $?." >>try.msg
4172                 rp="You have a problem.  Shall I abort Configure"
4173                 dflt=y
4174         fi
4175 else
4176         echo "I can't compile the test program." >>try.msg
4177         rp="You have a BIG problem.  Shall I abort Configure"
4178         dflt=y
4179 fi
4180 case "$dflt" in
4181 y)
4182         $cat try.msg >&4
4183         case "$knowitall" in
4184         '')
4185                 echo "(The supplied flags or libraries might be incorrect.)"
4186                 ;;
4187         *) dflt=n;;
4188         esac
4189         echo " "
4190         . ./myread
4191         case "$ans" in
4192         n*|N*) ;;
4193         *)      echo "Ok.  Stopping Configure." >&4
4194                 exit 1
4195                 ;;
4196         esac
4197         ;;
4198 n) echo "OK, that should do.";;
4199 esac
4200 $rm -f try try.* core
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 this is a malloc.h system
4293 set malloc.h i_malloc
4294 eval $inhdr
4295
4296 : see if stdlib is available
4297 set stdlib.h i_stdlib
4298 eval $inhdr
4299
4300 : determine which malloc to compile in
4301 echo " "
4302 case "$usemymalloc" in
4303 ''|[yY]*|true|$define)  dflt='y' ;;
4304 *)      dflt='n' ;;
4305 esac
4306 rp="Do you wish to attempt to use the malloc that comes with $package?"
4307 . ./myread
4308 usemymalloc="$ans"
4309 case "$ans" in
4310 y*|true)
4311         usemymalloc='y'
4312         mallocsrc='malloc.c'
4313         mallocobj="malloc$_o"
4314         d_mymalloc="$define"
4315         case "$libs" in
4316         *-lmalloc*)
4317                 : Remove malloc from list of libraries to use
4318                 echo "Removing unneeded -lmalloc from library list" >&4
4319                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4320                 shift
4321                 libs="$*"
4322                 echo "libs = $libs" >&4
4323                 ;;
4324         esac
4325         ;;
4326 *)
4327         usemymalloc='n'
4328         mallocsrc=''
4329         mallocobj=''
4330         d_mymalloc="$undef"
4331         ;;
4332 esac
4333
4334 : compute the return types of malloc and free
4335 echo " "
4336 $cat >malloc.c <<END
4337 #$i_malloc I_MALLOC
4338 #$i_stdlib I_STDLIB
4339 #include <stdio.h>
4340 #include <sys/types.h>
4341 #ifdef I_MALLOC
4342 #include <malloc.h>
4343 #endif
4344 #ifdef I_STDLIB
4345 #include <stdlib.h>
4346 #endif
4347 #ifdef TRY_MALLOC
4348 void *malloc();
4349 #endif
4350 #ifdef TRY_FREE
4351 void free();
4352 #endif
4353 END
4354 case "$malloctype" in
4355 '')
4356         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4357                 malloctype='void *'
4358         else
4359                 malloctype='char *'
4360         fi
4361         ;;
4362 esac
4363 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4364
4365 case "$freetype" in
4366 '')
4367         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4368                 freetype='void'
4369         else
4370                 freetype='int'
4371         fi
4372         ;;
4373 esac
4374 echo "Your system uses $freetype free(), it would seem." >&4
4375 $rm -f malloc.[co]
4376 : Cruising for prototypes
4377 echo " "
4378 echo "Checking out function prototypes..." >&4
4379 $cat >prototype.c <<'EOCP'
4380 main(int argc, char *argv[]) {
4381         exit(0);}
4382 EOCP
4383 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4384         echo "Your C compiler appears to support function prototypes."
4385         val="$define"
4386 else
4387         echo "Your C compiler doesn't seem to understand function prototypes."
4388         val="$undef"
4389 fi
4390 set prototype
4391 eval $setvar
4392 $rm -f prototype*
4393
4394 case "$prototype" in
4395 "$define") ;;
4396 *)      ansi2knr='ansi2knr'
4397         echo " "
4398         cat <<EOM >&4
4399
4400 $me:  FATAL ERROR:
4401 This version of $package can only be compiled by a compiler that 
4402 understands function prototypes.  Unfortunately, your C compiler 
4403         $cc $ccflags
4404 doesn't seem to understand them.  Sorry about that.
4405
4406 If GNU cc is available for your system, perhaps you could try that instead.  
4407
4408 Eventually, we hope to support building Perl with pre-ANSI compilers.
4409 If you would like to help in that effort, please contact <perlbug@perl.org>.
4410
4411 Aborting Configure now.
4412 EOM
4413         exit 2
4414         ;;
4415 esac
4416
4417 : determine where public executables go
4418 echo " "
4419 set dflt bin bin
4420 eval $prefixit
4421 fn=d~
4422 rp='Pathname where the public executables will reside?'
4423 . ./getfile
4424 if $test "X$ansexp" != "X$binexp"; then
4425         installbin=''
4426 fi
4427 bin="$ans"
4428 binexp="$ansexp"
4429 if $afs; then
4430         $cat <<EOM
4431
4432 Since you are running AFS, I need to distinguish the directory in which
4433 executables reside from the directory in which they are installed (and from
4434 which they are presumably copied to the former directory by occult means).
4435
4436 EOM
4437         case "$installbin" in
4438         '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4439         *) dflt="$installbin";;
4440         esac
4441         fn=de~
4442         rp='Where will public executables be installed?'
4443         . ./getfile
4444         installbin="$ans"
4445 else
4446         installbin="$binexp"
4447 fi
4448
4449 : define a shorthand compile call
4450 compile='
4451 mc_file=$1;
4452 shift;
4453 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4454 : define a shorthand compile call for compilations that should be ok.
4455 compile_ok='
4456 mc_file=$1;
4457 shift;
4458 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4459
4460 echo " "
4461 echo "Checking for GNU C Library..." >&4
4462 cat >gnulibc.c <<EOM
4463 #include <stdio.h>
4464 int
4465 main()
4466 {
4467 #ifdef __GLIBC__
4468     exit(0);
4469 #else
4470     exit(1);
4471 #endif
4472 }
4473 EOM
4474 set gnulibc
4475 if eval $compile_ok && ./gnulibc; then
4476         val="$define"
4477         echo "You are using the GNU C Library"
4478 else
4479         val="$undef"
4480         echo "You are not using the GNU C Library"
4481 fi
4482 $rm -f gnulibc*
4483 set d_gnulibc
4484 eval $setvar
4485
4486 : see if nm is to be used to determine whether a symbol is defined or not
4487 case "$usenm" in
4488 '')
4489         dflt=''
4490         case "$d_gnulibc" in
4491         "$define")
4492                 echo " "
4493                 echo "nm probably won't work on the GNU C Library." >&4
4494                 dflt=n
4495                 ;;
4496         esac
4497         case "$dflt" in
4498         '') 
4499                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4500                         echo " "
4501                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4502                         echo "'nm' won't be sufficient on this sytem." >&4
4503                         dflt=n
4504                 fi
4505                 ;;
4506         esac
4507         case "$dflt" in
4508         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4509                 if $test $dflt -gt 20; then
4510                         dflt=y
4511                 else
4512                         dflt=n
4513                 fi
4514                 ;;
4515         esac
4516         ;;
4517 *)
4518         case "$usenm" in
4519         true|$define) dflt=y;;
4520         *) dflt=n;;
4521         esac
4522         ;;
4523 esac
4524 $cat <<EOM
4525
4526 I can use $nm to extract the symbols from your C libraries. This
4527 is a time consuming task which may generate huge output on the disk (up
4528 to 3 megabytes) but that should make the symbols extraction faster. The
4529 alternative is to skip the 'nm' extraction part and to compile a small
4530 test program instead to determine whether each symbol is present. If
4531 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4532 this may be the best solution.
4533
4534 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4535
4536 EOM
4537 rp="Shall I use $nm to extract C symbols from the libraries?"
4538 . ./myread
4539 case "$ans" in
4540 [Nn]*) usenm=false;;
4541 *) usenm=true;;
4542 esac
4543
4544 runnm=$usenm
4545 case "$reuseval" in
4546 true) runnm=false;;
4547 esac
4548
4549 : nm options which may be necessary
4550 case "$nm_opt" in
4551 '') if $test -f /mach_boot; then
4552                 nm_opt=''       # Mach
4553         elif $test -d /usr/ccs/lib; then
4554                 nm_opt='-p'     # Solaris (and SunOS?)
4555         elif $test -f /dgux; then
4556                 nm_opt='-p'     # DG-UX
4557         elif $test -f /lib64/rld; then
4558                 nm_opt='-p'     # 64-bit Irix
4559         else
4560                 nm_opt=''
4561         fi;;
4562 esac
4563
4564 : nm options which may be necessary for shared libraries but illegal
4565 : for archive libraries.  Thank you, Linux.
4566 case "$nm_so_opt" in
4567 '')     case "$myuname" in
4568         *linux*)
4569                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4570                         nm_so_opt='--dynamic'
4571                 fi
4572                 ;;
4573         esac
4574         ;;
4575 esac
4576
4577 case "$runnm" in
4578 true)
4579 : get list of predefined functions in a handy place
4580 echo " "
4581 case "$libc" in
4582 '') libc=unknown
4583         case "$libs" in
4584         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4585         esac
4586         ;;
4587 esac
4588 libnames='';
4589 case "$libs" in
4590 '') ;;
4591 *)  for thislib in $libs; do
4592         case "$thislib" in
4593         -lc|-lc_s)
4594                 : Handle C library specially below.
4595                 ;;
4596         -l*)
4597                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4598                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4599                         :
4600                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4601                         :
4602                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4603                         :
4604                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4605                         :
4606                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4607                         :
4608                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4609                         :
4610                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4611                         :
4612                 else
4613                         try=''
4614                 fi
4615                 libnames="$libnames $try"
4616                 ;;
4617         *) libnames="$libnames $thislib" ;;
4618         esac
4619         done
4620         ;;
4621 esac
4622 xxx=normal
4623 case "$libc" in
4624 unknown)
4625         set /lib/libc.$so
4626         for xxx in $libpth; do
4627                 $test -r $1 || set $xxx/libc.$so
4628                 : The messy sed command sorts on library version numbers.
4629                 $test -r $1 || \
4630                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4631                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4632                                 h
4633                                 s/[0-9][0-9]*/0000&/g
4634                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4635                                 G
4636                                 s/\n/ /' | \
4637                          sort | $sed -e 's/^.* //'`
4638                 eval set \$$#
4639         done
4640         $test -r $1 || set /usr/ccs/lib/libc.$so
4641         $test -r $1 || set /lib/libsys_s$_a
4642         ;;
4643 *)
4644         set blurfl
4645         ;;
4646 esac
4647 if $test -r "$1"; then
4648         echo "Your (shared) C library seems to be in $1."
4649         libc="$1"
4650 elif $test -r /lib/libc && $test -r /lib/clib; then
4651         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4652         xxx=apollo
4653         libc='/lib/clib /lib/libc'
4654         if $test -r /lib/syslib; then
4655                 echo "(Your math library is in /lib/syslib.)"
4656                 libc="$libc /lib/syslib"
4657         fi
4658 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4659         echo "Your C library seems to be in $libc, as you said before."
4660 elif $test -r $incpath/usr/lib/libc$_a; then
4661         libc=$incpath/usr/lib/libc$_a;
4662         echo "Your C library seems to be in $libc.  That's fine."
4663 elif $test -r /lib/libc$_a; then
4664         libc=/lib/libc$_a;
4665         echo "Your C library seems to be in $libc.  You're normal."
4666 else
4667         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4668                 :
4669         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4670                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4671         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4672                 :
4673         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4674                 :
4675         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4676                 :
4677         else
4678                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4679         fi
4680         if $test -r "$tans"; then
4681                 echo "Your C library seems to be in $tans, of all places."
4682                 libc=$tans
4683         else
4684                 libc='blurfl'
4685         fi
4686 fi
4687 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4688         dflt="$libc"
4689         cat <<EOM
4690
4691 If the guess above is wrong (which it might be if you're using a strange
4692 compiler, or your machine supports multiple models), you can override it here.
4693
4694 EOM
4695 else
4696         dflt=''
4697         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4698         cat >&4 <<EOM
4699 I can't seem to find your C library.  I've looked in the following places:
4700
4701 EOM
4702         $sed 's/^/      /' libpath
4703         cat <<EOM
4704
4705 None of these seems to contain your C library. I need to get its name...
4706
4707 EOM
4708 fi
4709 fn=f
4710 rp='Where is your C library?'
4711 . ./getfile
4712 libc="$ans"
4713
4714 echo " "
4715 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
4716 set X `cat libnames`
4717 shift
4718 xxx=files
4719 case $# in 1) xxx=file; esac
4720 echo "Extracting names from the following $xxx for later perusal:" >&4
4721 echo " "
4722 $sed 's/^/      /' libnames >&4
4723 echo " "
4724 $echo $n "This may take a while...$c" >&4
4725
4726 for file in $*; do
4727         case $file in
4728         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4729         *) $nm $nm_opt $file 2>/dev/null;;
4730         esac
4731 done >libc.tmp
4732
4733 $echo $n ".$c"
4734 $grep fprintf libc.tmp > libc.ptf
4735 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4736 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4737 xxx='[ADTSIW]'
4738 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4739         eval $xscan;\
4740         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4741                 eval $xrun
4742 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4743         eval $xscan;\
4744         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4745                 eval $xrun
4746 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4747         eval $xscan;\
4748         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4749                 eval $xrun
4750 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4751         eval $xscan;\
4752         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4753                 eval $xrun
4754 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4755         eval $xscan;\
4756         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4757                 eval $xrun
4758 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4759         eval $xscan;\
4760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4761                 eval $xrun
4762 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4763                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4764         eval $xscan;\
4765         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4766                 eval $xrun
4767 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4768         eval $xscan;\
4769         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4770                 eval $xrun
4771 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4772         eval $xscan;\
4773         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4774                 eval $xrun
4775 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4776         eval $xscan;\
4777         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4778                 eval $xrun
4779 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4780         eval $xscan;\
4781         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4782                 eval $xrun
4783 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4784         eval $xscan;\
4785         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4786                 eval $xrun
4787 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4788         eval $xscan;\