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