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