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