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