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