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