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