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