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