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