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