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