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