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