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