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