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