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