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