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