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