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