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