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