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