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