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