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