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