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