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