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