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