Upgrade Win32API::File from version 0.1202 to 0.1203
[perl.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you 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 dtraceobject=''
1321 usedtrace=''
1322 usefaststdio=''
1323 usekernprocpathname=''
1324 ccflags_uselargefiles=''
1325 ldflags_uselargefiles=''
1326 libswanted_uselargefiles=''
1327 uselargefiles=''
1328 uselongdouble=''
1329 usemorebits=''
1330 usemultiplicity=''
1331 nm_opt=''
1332 nm_so_opt=''
1333 runnm=''
1334 usenm=''
1335 usensgetexecutablepath=''
1336 useperlio=''
1337 usequadmath=''
1338 usesocks=''
1339 d_oldpthreads=''
1340 use5005threads=''
1341 useithreads=''
1342 usereentrant=''
1343 usethreads=''
1344 incpath=''
1345 mips_type=''
1346 usrinc=''
1347 vaproto=''
1348 d_vendorarch=''
1349 installvendorarch=''
1350 vendorarch=''
1351 vendorarchexp=''
1352 d_vendorbin=''
1353 installvendorbin=''
1354 vendorbin=''
1355 vendorbinexp=''
1356 installvendorhtml1dir=''
1357 vendorhtml1dir=''
1358 vendorhtml1direxp=''
1359 installvendorhtml3dir=''
1360 vendorhtml3dir=''
1361 vendorhtml3direxp=''
1362 d_vendorlib=''
1363 installvendorlib=''
1364 vendorlib=''
1365 vendorlib_stem=''
1366 vendorlibexp=''
1367 installvendorman1dir=''
1368 vendorman1dir=''
1369 vendorman1direxp=''
1370 installvendorman3dir=''
1371 vendorman3dir=''
1372 vendorman3direxp=''
1373 usevendorprefix=''
1374 vendorprefix=''
1375 vendorprefixexp=''
1376 d_vendorscript=''
1377 installvendorscript=''
1378 vendorscript=''
1379 vendorscriptexp=''
1380 versiononly=''
1381 yacc=''
1382 yaccflags=''
1383 CONFIG=''
1384
1385 : Detect odd OSs
1386 define='define'
1387 undef='undef'
1388 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1389 rmlist=''
1390
1391 : We must find out about Eunice early
1392 eunicefix=':'
1393 if test -f /etc/unixtovms; then
1394         eunicefix=/etc/unixtovms
1395 fi
1396 if test -f /etc/unixtovms.exe; then
1397         eunicefix=/etc/unixtovms.exe
1398 fi
1399
1400 : Set executable suffix now -- needed before hints available
1401 if test -f "/libs/version.library"; then
1402 : Amiga OS
1403     _exe=""
1404 elif test -f "/system/gnu_library/bin/ar.pm"; then
1405 : Stratus VOS
1406     _exe=".pm"
1407 elif test -n "$DJGPP"; then
1408 : DOS DJGPP
1409     _exe=".exe"
1410 elif test -f /kern/cookiejar; then
1411 : MiNT
1412     _exe=""
1413 elif test -d c:/. -o -n "$is_os2" ; then
1414 : OS/2 or cygwin
1415     _exe=".exe"
1416 fi
1417
1418 groupstype=''
1419 i_whoami=''
1420 : Trailing extension.  Override this in a hint file, if needed.
1421 : Extra object files, if any, needed on this platform.
1422 archobjs=''
1423 archname=''
1424 : Possible local include directories to search.
1425 : Set locincpth to "" in a hint file to defeat local include searches.
1426 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1427 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1428 :
1429 : no include file wanted by default
1430 inclwanted=''
1431
1432 : Enable -DEBUGGING and -DDEBUGGING from the command line
1433 EBUGGING=''
1434 DEBUGGING=''
1435
1436 libnames=''
1437 : change the next line if compiling for Xenix/286 on Xenix/386
1438 xlibpth='/usr/lib/386 /lib/386'
1439 : Possible local library directories to search.
1440 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1441 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1442
1443 : general looking path for locating libraries
1444 glibpth="/lib /usr/lib $xlibpth"
1445 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1446 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1447 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1448 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1449
1450 : Private path used by Configure to find libraries.  Its value
1451 : is prepended to libpth. This variable takes care of special
1452 : machines, like the mips.  Usually, it should be empty.
1453 plibpth=''
1454
1455 : default library list
1456 libswanted=''
1457 : some systems want to use only the non-versioned libso:s
1458 ignore_versioned_solibs=''
1459 : set usethreads on the Configure command line to enable threads.
1460 usereentrant='undef'
1461 ccname=''
1462 ccversion=''
1463 perllibs=''
1464 : set useposix=false in your hint file to disable the POSIX extension.
1465 useposix=true
1466 : set useopcode=false in your hint file to disable the Opcode extension.
1467 useopcode=true
1468 archname64=''
1469 ccflags_uselargefiles=''
1470 ldflags_uselargefiles=''
1471 libswanted_uselargefiles=''
1472 : set usemultiplicity on the Configure command line to enable multiplicity.
1473 : set usesocks on the Configure command line to enable socks.
1474 : List of libraries we want.
1475 : If anyone needs extra -lxxx, put those in a hint file.
1476 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1477 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1478 : We probably want to search /usr/shlib before most other libraries.
1479 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1480 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1481 glibpth="/usr/shlib $glibpth"
1482 : Do not use vfork unless overridden by a hint file.
1483 usevfork=false
1484
1485 : Find the basic shell for Bourne shell scripts
1486 case "$sh" in
1487 '')
1488         case "$SYSTYPE" in
1489         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1490         *) xxx='/bin/sh';;
1491         esac
1492         if test -f "$xxx"; then
1493                 sh="$xxx"
1494         else
1495                 : Build up a list and do a single loop so we can 'break' out.
1496                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1497                 for xxx in sh bash ksh pdksh ash; do
1498                         for p in $pth; do
1499                                 try="$try ${p}/${xxx}"
1500                         done
1501                 done
1502                 for xxx in $try; do
1503                         if test -f "$xxx"; then
1504                                 sh="$xxx";
1505                                 break
1506                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1507                                 sh="$xxx";
1508                                 break
1509                         elif test -f "$xxx.exe"; then
1510                                 sh="$xxx";
1511                                 break
1512                         fi
1513                 done
1514         fi
1515         ;;
1516 esac
1517
1518 case "$sh" in
1519 '')     cat >&2 <<EOM
1520 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1521
1522 Usually it's in /bin/sh.  How did you even get this far?
1523 Please contact me (Perl Maintainers) at perlbug@perl.org and
1524 we'll try to straighten this all out.
1525 EOM
1526         exit 1
1527         ;;
1528 esac
1529
1530 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1531 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1532 targetsh=$sh
1533
1534 : see if sh knows # comments
1535 if `$sh -c '#' >/dev/null 2>&1`; then
1536         shsharp=true
1537         spitshell=cat
1538         xcat=/bin/cat
1539         test -f $xcat$_exe || xcat=/usr/bin/cat
1540         if test ! -f $xcat$_exe; then
1541                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1542                         if test -f $p/cat$_exe; then
1543                                 xcat=$p/cat
1544                                 break
1545                         fi
1546                 done
1547                 if test ! -f $xcat$_exe; then
1548                         echo "Can't find cat anywhere!"
1549                         exit 1
1550                 fi
1551         fi
1552         echo "#!$xcat" >sharp
1553         $eunicefix sharp
1554         chmod +x sharp
1555         ./sharp > today 2>/dev/null
1556         if test -s today; then
1557                 sharpbang='#!'
1558         else
1559                 echo "#! $xcat" > sharp
1560                 $eunicefix sharp
1561                 chmod +x sharp
1562                 ./sharp > today 2>/dev/null
1563                 if test -s today; then
1564                         sharpbang='#! '
1565                 else
1566                         sharpbang=': use '
1567                 fi
1568         fi
1569 else
1570         echo " "
1571         echo "Your $sh doesn't grok # comments--I will strip them later on."
1572         shsharp=false
1573         cd ..
1574         echo "exec grep -v '^[  ]*#'" >spitshell
1575         chmod +x spitshell
1576         $eunicefix spitshell
1577         spitshell=`pwd`/spitshell
1578         cd UU
1579         echo "I presume that if # doesn't work, #! won't work either!"
1580         sharpbang=': use '
1581 fi
1582 rm -f sharp today
1583
1584 : figure out how to guarantee sh startup
1585 case "$startsh" in
1586 '') startsh=${sharpbang}${sh} ;;
1587 *)
1588 esac
1589 cat >sharp <<EOSS
1590 $startsh
1591 set abc
1592 test "$?abc" != 1
1593 EOSS
1594
1595 chmod +x sharp
1596 $eunicefix sharp
1597 if ./sharp; then
1598         : echo "Yup, it does."
1599 else
1600         echo "Hmm... '$startsh' does not guarantee sh startup..."
1601         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1602 fi
1603 rm -f sharp
1604
1605 : Save command line options in file UU/cmdline.opt for later use in
1606 : generating config.sh.
1607 cat > cmdline.opt <<EOSH
1608 : Configure command line arguments.
1609 config_arg0='$0'
1610 config_args='$*'
1611 config_argc=$#
1612 EOSH
1613 argn=1
1614 args_exp=''
1615 args_sep=''
1616 for arg in "$@"; do
1617         cat >>cmdline.opt <<EOSH
1618 config_arg$argn='$arg'
1619 EOSH
1620         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1621 $arg
1622 EOC
1623         arg_exp=`cat cmdl.opt`
1624         args_exp="$args_exp$args_sep'$arg_exp'"
1625         argn=`expr $argn + 1`
1626         args_sep=' '
1627 done
1628 rm -f cmdl.opt
1629
1630 : produce awk script to parse command line options
1631 cat >options.awk <<'EOF'
1632 BEGIN {
1633         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1634
1635         len = length(optstr);
1636         for (i = 1; i <= len; i++) {
1637                 c = substr(optstr, i, 1);
1638                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1639                 if (a == ":") {
1640                         arg[c] = 1;
1641                         i++;
1642                 }
1643                 opt[c] = 1;
1644         }
1645 }
1646 {
1647         expect = 0;
1648         str = $0;
1649         if (substr(str, 1, 1) != "-") {
1650                 printf("'%s'\n", str);
1651                 next;
1652         }
1653         len = length($0);
1654         for (i = 2; i <= len; i++) {
1655                 c = substr(str, i, 1);
1656                 if (!opt[c]) {
1657                         printf("-%s\n", substr(str, i));
1658                         next;
1659                 }
1660                 printf("-%s\n", c);
1661                 if (arg[c]) {
1662                         if (i < len)
1663                                 printf("'%s'\n", substr(str, i + 1));
1664                         else
1665                                 expect = 1;
1666                         next;
1667                 }
1668         }
1669 }
1670 END {
1671         if (expect)
1672                 print "?";
1673 }
1674 EOF
1675
1676 : process the command line options
1677 set X `for arg in "$@"; do echo "X$arg"; done |
1678         sed -e s/X// | awk -f options.awk`
1679 eval "set $*"
1680 shift
1681 rm -f options.awk
1682
1683 : set up default values
1684 fastread=''
1685 reuseval=false
1686 config_sh=''
1687 alldone=''
1688 error=''
1689 silent=''
1690 extractsh=''
1691 knowitall=''
1692 rm -f optdef.sh posthint.sh
1693 cat >optdef.sh <<EOS
1694 $startsh
1695 EOS
1696
1697
1698 : option parsing
1699 while test $# -gt 0; do
1700         case "$1" in
1701         -d) shift; fastread=yes;;
1702         -e) shift; alldone=cont;;
1703         -f)
1704                 shift
1705                 cd ..
1706                 if test -r "$1"; then
1707                         config_sh="$1"
1708                 else
1709                         echo "$me: cannot read config file $1." >&2
1710                         error=true
1711                 fi
1712                 cd UU
1713                 shift;;
1714         --help|\
1715         -h) shift; error=true;;
1716         -r) shift; reuseval=true;;
1717         -s) shift; silent=true; realsilent=true;;
1718         -E) shift; alldone=exit;;
1719         -K) shift; knowitall=true;;
1720         -O) shift;;
1721         -S) shift; silent=true; extractsh=true;;
1722         -D)
1723                 shift
1724                 case "$1" in
1725                 *=)
1726                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1727                         echo "$me: ignoring -D $1" >&2
1728                         ;;
1729                 *=*) echo "$1" | \
1730                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1731                 *) echo "$1='define'" >> optdef.sh;;
1732                 esac
1733                 shift
1734                 ;;
1735         -U)
1736                 shift
1737                 case "$1" in
1738                 *=) echo "$1" >> optdef.sh;;
1739                 *=*)
1740                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1741                         echo "$me: ignoring -U $1" >&2
1742                         ;;
1743                 *) echo "$1='undef'" >> optdef.sh;;
1744                 esac
1745                 shift
1746                 ;;
1747         -A)
1748             shift
1749             xxx=''
1750             yyy="$1"
1751             zzz=''
1752             uuu=undef
1753             case "$yyy" in
1754             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1755                  case "$zzz" in
1756                  *:*) zzz='' ;;
1757                  *)   xxx=append
1758                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1759                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1760                  esac
1761                  ;;
1762             esac
1763             case "$xxx" in
1764             '')  case "$yyy" in
1765                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1766                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1767                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1768                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1769                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1770                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1771                  esac
1772                  ;;
1773             esac
1774             case "$xxx" in
1775             append)
1776                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1777             clear)
1778                 echo "$yyy=''"                  >> posthint.sh ;;
1779             define)
1780                 case "$zzz" in
1781                 '') zzz=define ;;
1782                 esac
1783                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1784             eval)
1785                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1786             prepend)
1787                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1788             undef)
1789                 case "$zzz" in
1790                 '') zzz="$uuu" ;;
1791                 esac
1792                 echo "$yyy=$zzz"                >> posthint.sh ;;
1793             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1794             esac
1795             shift
1796             ;;
1797         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1798             exit 0;;
1799         --) break;;
1800         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1801         *) break;;
1802         esac
1803 done
1804
1805 case "$error" in
1806 true)
1807         cat >&2 <<EOM
1808 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1809                  [-U symbol] [-U symbol=] [-A command:symbol...]
1810   -d : use defaults for all answers.
1811   -e : go on without questioning past the production of config.sh.
1812   -f : specify an alternate default configuration file.
1813   -h : print this help message and exit (with an error status).
1814   -r : reuse C symbols value if possible (skips costly nm extraction).
1815   -s : silent mode, only echoes questions and essential information.
1816   -D : define symbol to have some value:
1817          -D symbol         symbol gets the value 'define'
1818          -D symbol=value   symbol gets the value 'value'
1819        common used examples (see INSTALL for more info):
1820          -Duse64bitint            use 64bit integers
1821          -Duse64bitall            use 64bit integers and pointers
1822          -Dusethreads             use thread support
1823          -Dinc_version_list=none  do not include older perl trees in @INC
1824          -DEBUGGING=none          DEBUGGING options
1825          -Dcc=gcc                 choose your compiler
1826          -Dprefix=/opt/perl5      choose your destination
1827   -E : stop at the end of questions, after having produced config.sh.
1828   -K : do not use unless you know what you are doing.
1829   -O : ignored for backward compatibility
1830   -S : perform variable substitutions on all .SH files (can mix with -f)
1831   -U : undefine symbol:
1832          -U symbol    symbol gets the value 'undef'
1833          -U symbol=   symbol gets completely empty
1834        e.g.:  -Uversiononly
1835   -A : manipulate symbol after the platform specific hints have been applied:
1836          -A append:symbol=value   append value to symbol
1837          -A symbol=value          like append:, but with a separating space
1838          -A define:symbol=value   define symbol to have value
1839          -A clear:symbol          define symbol to be ''
1840          -A define:symbol         define symbol to be 'define'
1841          -A eval:symbol=value     define symbol to be eval of value
1842          -A prepend:symbol=value  prepend value to symbol
1843          -A undef:symbol          define symbol to be 'undef'
1844          -A undef:symbol=         define symbol to be ''
1845        e.g.:  -A prepend:libswanted='cl pthread '
1846               -A ccflags=-DSOME_MACRO
1847   -V : print version number and exit (with a zero status).
1848 EOM
1849         exit 1
1850         ;;
1851 esac
1852
1853 : Sanity checks
1854 case "$fastread$alldone" in
1855 yescont|yesexit) ;;
1856 *)
1857         case "$extractsh" in
1858         true) ;;
1859         *)
1860                 if test ! -t 0; then
1861                         echo "Say 'sh Configure', not 'sh <Configure'"
1862                         exit 1
1863                 fi
1864                 ;;
1865         esac
1866         ;;
1867 esac
1868
1869 exec 4>&1
1870 case "$silent" in
1871 true) exec 1>/dev/null;;
1872 esac
1873
1874 : run the defines and the undefines, if any, but leave the file out there...
1875 touch optdef.sh
1876 grep '\\' optdef.sh >/dev/null 2>&1
1877 if test $? = 0; then
1878     echo "Configure does not support \\ in -D arguments"
1879     exit 1
1880 fi
1881 . ./optdef.sh
1882 : create the posthint manipulation script and leave the file out there...
1883 touch posthint.sh
1884
1885 : set package name
1886 package='perl5'
1887 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1888 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1889 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1890 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1891 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1892 esac
1893
1894 : Some greps do not return status, grrr.
1895 echo "grimblepritz" >grimble
1896 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1897         contains=contains
1898 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1899         contains=grep
1900 else
1901         contains=contains
1902 fi
1903 rm -f grimble
1904 : the following should work in any shell
1905 case "$contains" in
1906 contains*)
1907         echo " "
1908         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1909         cat >contains <<'EOSS'
1910 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1911 EOSS
1912 chmod +x contains
1913 esac
1914
1915 : Find the path to the source tree
1916 case "$src" in
1917 '') case "$0" in
1918     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1919          case "$src" in
1920          /*)    ;;
1921          .)     ;;
1922          *)     src=`cd ../$src && pwd` ;;
1923          esac
1924          ;;
1925     *)   src='.';;
1926     esac;;
1927 esac
1928 case "$src" in
1929 '')     src=/
1930         rsrc=/
1931         ;;
1932 /*)     rsrc="$src";;
1933 *)      rsrc="../$src";;
1934 esac
1935 if test -f $rsrc/Configure && \
1936         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1937 then
1938    : found it, so we are ok.
1939 else
1940         rsrc=''
1941         for src in . .. ../.. ../../.. ../../../..; do
1942                 if test -f ../$src/Configure && \
1943                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1944                 then
1945                         rsrc=../$src
1946                         break
1947                 fi
1948         done
1949 fi
1950 case "$rsrc" in
1951 '')
1952         cat <<EOM >&4
1953
1954 Sorry, I can't seem to locate the source dir for $package.  Please start
1955 Configure with an explicit path -- i.e. /some/path/Configure.
1956
1957 EOM
1958         exit 1
1959         ;;
1960 ../.)   rsrc='..';;
1961 *)
1962         echo " "
1963         echo "Sources for $package found in \"$src\"." >&4
1964         ;;
1965 esac
1966
1967 : script used to extract .SH files with variable substitutions
1968 cat >extract <<'EOS'
1969 PERL_CONFIG_SH=true
1970 echo "Doing variable substitutions on .SH files..."
1971 if test -f MANIFEST; then
1972         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1973 else
1974         echo "(Looking for .SH files under the source directory.)"
1975         set x `(cd "$src"; find . -name "*.SH" -print)`
1976 fi
1977 shift
1978 case $# in
1979 0) set x `(cd "$src"; echo *.SH)`; shift;;
1980 esac
1981 if test ! -f "$src/$1"; then
1982         shift
1983 fi
1984 mkdir_p='
1985 name=$1;
1986 create="";
1987 while test $name; do
1988         if test ! -d "$name"; then
1989                 create="$name $create";
1990                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1991                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1992         else
1993                 name="";
1994         fi;
1995 done;
1996 for file in $create; do
1997         mkdir $file;
1998 done
1999 '
2000 for file in $*; do
2001         case "$src" in
2002         ".")
2003                 case "$file" in
2004                 */*)
2005                         dir=`expr X$file : 'X\(.*\)/'`
2006                         file=`expr X$file : 'X.*/\(.*\)'`
2007                         (cd "$dir" && . ./$file)
2008                         ;;
2009                 *)
2010                         . ./$file
2011                         ;;
2012                 esac
2013                 ;;
2014         *)
2015                 case "$file" in
2016                 */*)
2017                         dir=`expr X$file : 'X\(.*\)/'`
2018                         file=`expr X$file : 'X.*/\(.*\)'`
2019                         (set x $dir; shift; eval $mkdir_p)
2020                         sh <"$src/$dir/$file"
2021                         ;;
2022                 *)
2023                         sh <"$src/$file"
2024                         ;;
2025                 esac
2026                 ;;
2027         esac
2028 done
2029 if test -f "$src/config_h.SH"; then
2030         if test ! -f config.h; then
2031         : oops, they left it out of MANIFEST, probably, so do it anyway.
2032         . "$src/config_h.SH"
2033         fi
2034 fi
2035 EOS
2036
2037 : extract files and exit if asked to do so
2038 case "$extractsh" in
2039 true)
2040         case "$realsilent" in
2041         true) ;;
2042         *) exec 1>&4;;
2043         esac
2044         case "$config_sh" in
2045         '') config_sh='config.sh';;
2046         esac
2047         echo " "
2048         echo "Fetching answers from $config_sh..."
2049         cd ..
2050         . $config_sh
2051         . UU/optdef.sh
2052         echo " "
2053         . UU/extract
2054         rm -rf UU
2055         echo "Extraction done."
2056         exit 0
2057         ;;
2058 esac
2059
2060 : Eunice requires " " instead of "", can you believe it
2061 echo " "
2062 : Here we go...
2063 echo "Beginning of configuration questions for $package."
2064
2065 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2066
2067 : first determine how to suppress newline on echo command
2068 echo " "
2069 echo "Checking echo to see how to suppress newlines..."
2070 (echo "hi there\c" ; echo " ") >.echotmp
2071 if $contains c .echotmp >/dev/null 2>&1 ; then
2072         echo "...using -n."
2073         n='-n'
2074         c=''
2075 else
2076         cat <<'EOM'
2077 ...using \c
2078 EOM
2079         n=''
2080         c='\c'
2081 fi
2082 echo $n "The star should be here-->$c"
2083 echo '*'
2084 rm -f .echotmp
2085
2086 : Now test for existence of everything in MANIFEST
2087 echo " "
2088 if test -f "$rsrc/MANIFEST"; then
2089         echo "First let's make sure your kit is complete.  Checking..." >&4
2090         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2091                 (split -l 50 2>/dev/null || split -50)
2092         rm -f missing
2093         tmppwd=`pwd`
2094         for filelist in x??; do
2095                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2096                         >/dev/null 2>>"$tmppwd/missing")
2097         done
2098         if test -s missing; then
2099                 cat missing >&4
2100                 cat >&4 <<'EOM'
2101
2102 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2103
2104 You have the option of continuing the configuration process, despite the
2105 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2106 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2107 and contact the author (perlbug@perl.org).
2108
2109 EOM
2110                 echo $n "Continue? [n] $c" >&4
2111                 read ans
2112                 case "$ans" in
2113                 y*)
2114                         echo "Continuing..." >&4
2115                         rm -f missing
2116                         ;;
2117                 *)
2118                         echo "ABORTING..." >&4
2119                         kill $$
2120                         ;;
2121                 esac
2122         else
2123                 echo "Looks good..."
2124         fi
2125 else
2126         echo "There is no MANIFEST file.  I hope your kit is complete !"
2127 fi
2128 rm -f missing x??
2129
2130 : Find the appropriate value for a newline for tr
2131 echo " "
2132 if test -n "$DJGPP"; then
2133        trnl='\012'
2134 fi
2135 if test X"$trnl" = X; then
2136         case "`echo foo|tr '\n' x 2>/dev/null`" in
2137         foox) trnl='\n' ;;
2138         esac
2139 fi
2140 if test X"$trnl" = X; then
2141         case "`echo foo|tr '\012' x 2>/dev/null`" in
2142         foox) trnl='\012' ;;
2143         esac
2144 fi
2145 if test X"$trnl" = X; then
2146        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2147        fooxy) trnl='\n\r' ;;
2148        esac
2149 fi
2150 if test X"$trnl" = X; then
2151         cat <<EOM >&2
2152
2153 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2154
2155 EOM
2156         exit 1
2157 fi
2158
2159 : compute the number of columns on the terminal for proper question formatting
2160 case "$COLUMNS" in
2161 '') COLUMNS='80';;
2162 esac
2163
2164 : set up the echo used in my read
2165 myecho="case \"\$xxxm\" in
2166 '') echo $n \"\$rp $c\" >&4;;
2167 *) case \"\$rp\" in
2168         '') echo $n \"[\$xxxm] $c\";;
2169         *)
2170                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2171                         echo \"\$rp\" >&4
2172                         echo $n \"[\$xxxm] $c\" >&4
2173                 else
2174                         echo $n \"\$rp [\$xxxm] $c\" >&4
2175                 fi
2176                 ;;
2177         esac;;
2178 esac"
2179
2180 : now set up to do reads with possible shell escape and default assignment
2181 cat <<EOSC >myread
2182 $startsh
2183 xxxm=\$dflt
2184 $myecho
2185 ans='!'
2186 case "\$fastread" in
2187 yes) case "\$dflt" in
2188         '') ;;
2189         *) ans='';
2190                 case "\$silent-\$rp" in
2191                 true-) ;;
2192                 *) echo " " >&4;;
2193                 esac;;
2194         esac;;
2195 *) case "\$silent" in
2196         true) case "\$rp" in
2197                 '') ans='';;
2198                 esac;;
2199         esac;;
2200 esac
2201 while expr "X\$ans" : "X!" >/dev/null; do
2202         read answ
2203         set x \$xxxm
2204         shift
2205         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2206         case  "\$answ" in
2207         "!")
2208                 sh 1>&4
2209                 echo " "
2210                 $myecho
2211                 ;;
2212         !*)
2213                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2214                 shift
2215                 sh 1>&4 -c "\$*"
2216                 echo " "
2217                 $myecho
2218                 ;;
2219         "\$ans")
2220                 case "\$ans" in
2221                 \\&*)
2222                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2223                         shift
2224                         case "\$1" in
2225                         -d)
2226                                 fastread=yes
2227                                 echo "(OK, I'll run with -d after this question.)" >&4
2228                                 ;;
2229                         -*)
2230                                 echo "*** Sorry, \$1 not supported yet." >&4
2231                                 ;;
2232                         esac
2233                         $myecho
2234                         ans=!
2235                         ;;
2236                 esac;;
2237         *)
2238                 case "\$aok" in
2239                 y)
2240                         echo "*** Substitution done -- please confirm."
2241                         xxxm="\$ans"
2242                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2243                         xxxm="\$ans"
2244                         ans=!
2245                         ;;
2246                 *)
2247                         echo "*** Error -- try again."
2248                         ans=!
2249                         ;;
2250                 esac
2251                 $myecho
2252                 ;;
2253         esac
2254         case "\$ans\$xxxm\$nostick" in
2255         '')
2256                 ans=!
2257                 $myecho
2258                 ;;
2259         esac
2260 done
2261 case "\$ans" in
2262 '') ans="\$xxxm";;
2263 esac
2264 EOSC
2265
2266 : create .config dir to save info across Configure sessions
2267 test -d ../.config || mkdir ../.config
2268 cat >../.config/README <<EOF
2269 This directory created by Configure to save information that should
2270 persist across sessions for $package.
2271
2272 You may safely delete it if you wish.
2273 EOF
2274
2275 : See if we are using a devel version and want that
2276 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2277 case "$usedevel" in
2278 $define|true|[yY]*)
2279     usedevel="$define" ;;
2280 *) case "$xversion" in
2281    *[13579])
2282         cat >&4 <<EOH
2283 *** WHOA THERE!!! ***
2284
2285     This is an UNSTABLE DEVELOPMENT release.
2286     The version of this $package distribution is $xversion, that is, odd,
2287     (as opposed to even) and that signifies a development release.
2288     If you want a maintenance release, you want an even-numbered version.
2289
2290     Do ***NOT*** install this into production use.
2291     Data corruption and crashes are possible.
2292
2293     It is most seriously suggested that you do not continue any further
2294     unless you want to help in developing and debugging Perl.
2295
2296     If you *still* want to build perl, you can answer 'y' now,
2297     or pass -Dusedevel to Configure.
2298
2299 EOH
2300         rp='Do you really want to continue?'
2301         dflt='n'
2302         . ./myread
2303         case "$ans" in
2304         [yY]) echo >&4 "Okay, continuing."
2305               usedevel="$define" ;;
2306         *) echo >&4 "Okay, bye."
2307            exit 1
2308            ;;
2309         esac
2310         ;;
2311     esac
2312     usedevel="$undef"
2313     ;;
2314 esac
2315 case "$usedevel" in
2316 $define|true|[yY]*)
2317         case "$versiononly" in
2318         '') versiononly="$define" ;;
2319         esac
2320         case "$installusrbinperl" in
2321         '') installusrbinperl="$undef" ;;
2322         esac
2323         ;;
2324 esac
2325
2326 : general instructions
2327 needman=true
2328 firsttime=true
2329 user=`(logname) 2>/dev/null`
2330 case "$user" in
2331 '') user=`whoami 2>&1`;;
2332 esac
2333 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2334         firsttime=false
2335         echo " "
2336         rp='Would you like to see the instructions?'
2337         dflt=n
2338         . ./myread
2339         case "$ans" in
2340         [yY]*) ;;
2341         *) needman=false;;
2342         esac
2343 fi
2344 if $needman; then
2345         cat <<EOH
2346
2347 This installation shell script will examine your system and ask you questions
2348 to determine how the perl5 package should be installed. If you get
2349 stuck on a question, you may use a ! shell escape to start a subshell or
2350 execute a command.  Many of the questions will have default answers in square
2351 brackets; typing carriage return will give you the default.
2352
2353 On some of the questions which ask for file or directory names you are allowed
2354 to use the ~name construct to specify the login directory belonging to "name",
2355 even if you don't have a shell which knows about that.  Questions where this is
2356 allowed will be marked "(~name ok)".
2357
2358 EOH
2359         rp=''
2360         dflt='Type carriage return to continue'
2361         . ./myread
2362         cat <<'EOH'
2363
2364 The prompter used in this script allows you to use shell variables and
2365 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2366 in the default answer, as if the default line was a set of arguments given to a
2367 script shell.  This means you may also use $* to repeat the whole default line,
2368 so you do not have to re-type everything to add something to the default.
2369
2370 Every time there is a substitution, you will have to confirm.  If there is an
2371 error (e.g. an unmatched backtick), the default answer will remain unchanged
2372 and you will be prompted again.
2373
2374 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2375 the questions and use the computed defaults (or the previous answers if there
2376 was already a config.sh file). Type 'Configure -h' for a list of options.
2377 You may also start interactively and then answer '& -d' at any prompt to turn
2378 on the non-interactive behaviour for the remainder of the execution.
2379
2380 EOH
2381         . ./myread
2382         cat <<EOH
2383
2384 Much effort has been expended to ensure that this shell script will run on any
2385 Unix system.  If despite that it blows up on yours, your best bet is to edit
2386 Configure and run it again.  If you can't run Configure for some reason,
2387 you'll have to generate a config.sh file by hand.  Whatever problems you
2388 have, let me (perlbug@perl.org) know how I blew it.
2389
2390 This installation script affects things in two ways:
2391
2392 1) it may do direct variable substitutions on some of the files included
2393    in this kit.
2394 2) it builds a config.h file for inclusion in C programs.  You may edit
2395    any of these files as the need arises after running this script.
2396
2397 If you make a mistake on a question, there is no easy way to back up to it
2398 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2399 files.  Configure will offer to let you do this before it runs the SH files.
2400
2401 EOH
2402         dflt='Type carriage return to continue'
2403         . ./myread
2404         case "$firsttime" in
2405         true) echo $user >>../.config/instruct;;
2406         esac
2407 fi
2408
2409 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2410 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2411 if test "X$sysroot" = X; then
2412     sysroot=""
2413 else
2414     case "$cc" in
2415         *gcc*|*g++*)
2416             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2417             # _sysroot is used in places where we need --sysroot=foo
2418             # but using the rest of the flags could cause issues.
2419             _sysroot="--sysroot=$sysroot";
2420             case "$ccflags" in
2421                 *sysroot*) ;;
2422                 'undef'|*)
2423                 ccflags="$ccflags $_sysroot"
2424             esac
2425             case "$ldflags" in
2426                 *sysroot*) ;;
2427                 'undef'|*)
2428                 ldflags="$ldflags $_sysroot"
2429             esac
2430             case "$cppflags" in
2431                 *sysroot*) ;;
2432                 'undef'|*)
2433                 cppflags="$cppflags $_sysroot"
2434             esac
2435             # lddlflags updated below in lddlflags section;
2436             # same with cccdlflags
2437             ;;
2438     esac
2439
2440     # Adjust some defaults to also use $sysroot
2441     for var in xlibpth loclibpth locincpth glibpth; do
2442         eval xxx=\$$var
2443         eval $var=''
2444         for path in $xxx; do
2445             eval $var=\"\$$var $sysroot$path\"
2446         done
2447     done
2448
2449 fi
2450
2451 : find out where common programs are
2452 echo " "
2453 echo "Locating common programs..." >&4
2454 cat <<EOSC >loc
2455 $startsh
2456 case \$# in
2457 0) exit 1;;
2458 esac
2459 thing=\$1
2460 shift
2461 dflt=\$1
2462 shift
2463 for dir in \$*; do
2464         case "\$thing" in
2465         .)
2466         if test -d \$dir/\$thing; then
2467                 echo \$dir
2468                 exit 0
2469         fi
2470         ;;
2471         *)
2472         for thisthing in \$dir/\$thing; do
2473                 : just loop through to pick last item
2474         done
2475         if test -f \$thisthing; then
2476                 echo \$thisthing
2477                 exit 0
2478         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2479                 echo \$thisthing
2480                 exit 0
2481         elif test -f \$dir/\$thing.exe; then
2482                 if test -n "$DJGPP"; then
2483                         echo \$dir/\$thing.exe
2484                 elif test "$eunicefix" != ":"; then
2485                         : on Eunice apparently
2486                         echo \$dir/\$thing
2487                 fi
2488                 exit 0
2489         fi
2490         ;;
2491         esac
2492 done
2493 echo \$dflt
2494 exit 1
2495 EOSC
2496 chmod +x loc
2497 $eunicefix loc
2498 loclist="
2499 awk
2500 cat
2501 chmod
2502 comm
2503 cp
2504 echo
2505 expr
2506 grep
2507 ls
2508 mkdir
2509 rm
2510 sed
2511 sort
2512 touch
2513 tr
2514 uniq
2515 "
2516 trylist="
2517 ar
2518 bison
2519 byacc
2520 cpp
2521 csh
2522 date
2523 egrep
2524 gmake
2525 gzip
2526 less
2527 ln
2528 make
2529 more
2530 nm
2531 nroff
2532 perl
2533 pg
2534 test
2535 uname
2536 zip
2537 "
2538 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2539 pth="$pth $sysroot/lib $sysroot/usr/lib"
2540 for file in $loclist; do
2541         eval xxx=\$$file
2542         case "$xxx" in
2543         /*|?:[\\/]*)
2544                 if test -f "$xxx"; then
2545                         : ok
2546                 else
2547                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2548                         xxx=`./loc $file $file $pth`
2549                 fi
2550                 ;;
2551         '') xxx=`./loc $file $file $pth`;;
2552         *) xxx=`./loc $xxx $xxx $pth`;;
2553         esac
2554         eval $file=$xxx$_exe
2555         eval _$file=$xxx
2556         case "$xxx" in
2557         /*)
2558                 echo $file is in $xxx.
2559                 ;;
2560         ?:[\\/]*)
2561                 echo $file is in $xxx.
2562                 ;;
2563         *)
2564                 echo "I don't know where '$file' is, and my life depends on it." >&4
2565                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2566                 exit 1
2567                 ;;
2568         esac
2569 done
2570 echo " "
2571 echo "Don't worry if any of the following aren't found..."
2572 say=offhand
2573 for file in $trylist; do
2574         eval xxx=\$$file
2575         case "$xxx" in
2576         /*|?:[\\/]*)
2577                 if test -f "$xxx"; then
2578                         : ok
2579                 else
2580                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2581                         xxx=`./loc $file $file $pth`
2582                 fi
2583                 ;;
2584         '') xxx=`./loc $file $file $pth`;;
2585         *) xxx=`./loc $xxx $xxx $pth`;;
2586         esac
2587         eval $file=$xxx$_exe
2588         eval _$file=$xxx
2589         case "$xxx" in
2590         /*)
2591                 echo $file is in $xxx.
2592                 ;;
2593         ?:[\\/]*)
2594                 echo $file is in $xxx.
2595                 ;;
2596         *)
2597                 echo "I don't see $file out there, $say."
2598                 say=either
2599                 ;;
2600         esac
2601 done
2602 case "$egrep" in
2603 egrep)
2604         echo "Substituting grep for egrep."
2605         egrep=$grep
2606         _egrep=$grep
2607         ;;
2608 esac
2609 case "$less" in
2610 '')     ;;
2611 *)      if $less -R </dev/null >/dev/null 2>&1; then
2612                echo "Substituting less -R for less."
2613                less="$less -R"
2614                _less=$less
2615         fi
2616         ;;
2617 esac
2618 case "$ln" in
2619 ln)
2620         echo "Substituting cp for ln."
2621         ln=$cp
2622         _ln=$cp
2623         ;;
2624 esac
2625 case "$make" in
2626 make)
2627         case "$gmake" in
2628         gmake)
2629         echo "I can't find make or gmake, and my life depends on it." >&4
2630         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2631         exit 1
2632         ;;
2633         esac
2634         ;;
2635 esac
2636 case "$gmake" in
2637 gmake)  ;;
2638 *)      # We can't have osname yet.
2639         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2640                 # Assume that gmake, if found, is definitely GNU make
2641                 # and prefer it over the system make.
2642                 echo "Substituting gmake for make."
2643                 make=$gmake
2644                 _make=$gmake
2645         fi
2646         ;;
2647 esac
2648 case "$test" in
2649 test)
2650         echo "Hopefully test is built into your sh."
2651         ;;
2652 *)
2653         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2654                 echo "Using the test built into your sh."
2655                 test=test
2656                 _test=test
2657         fi
2658         ;;
2659 esac
2660 case "$echo" in
2661 echo)
2662         echo "Hopefully echo is built into your sh."
2663         ;;
2664 '') ;;
2665 *)
2666         echo " "
2667 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2668         $echo $n "hi there$c" >foo1
2669         echo $n "hi there$c" >foo2
2670         if cmp foo1 foo2 >/dev/null 2>&1; then
2671                 echo "They are compatible.  In fact, they may be identical."
2672         else
2673                 case "$n" in
2674                 '-n') n='' c='\c';;
2675                 *) n='-n' c='';;
2676                 esac
2677                 cat <<FOO
2678 They are not compatible!  You are probably running ksh on a non-USG system.
2679 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2680 have echo built in and we may have to run some Bourne shell scripts.  That
2681 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2682
2683 FOO
2684                 $echo $n "The star should be here-->$c"
2685                 $echo "*"
2686         fi
2687         $rm -f foo1 foo2
2688         ;;
2689 esac
2690
2691 # This question was auctioned at YAPC::Europe-2007 in Vienna
2692 # I never promised you could answer it. I only auctioned the question.
2693 cat <<FOO
2694 The following message is sponsored by
2695
2696   Dresden.pm<--The stars should be here.
2697
2698 Dear Perl user, system administrator or package
2699 maintainer, the Perl community sends greetings to
2700 you. Do you (emblematical) greet back [Y/n]? n
2701
2702 FOO
2703
2704 : Check what type of C compiler we use
2705 cat <<EOS >trygcc
2706 $startsh
2707 EOS
2708 cat <<'EOSC' >>trygcc
2709 case "$cc" in
2710 '') ;;
2711 *)  $rm -f try try.*
2712     $cat >try.c <<EOM
2713 int main(int argc, char *argv[]) {
2714   return 0;
2715 }
2716 EOM
2717     if $cc -o try $ccflags $ldflags try.c; then
2718        :
2719     else
2720         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2721         despair=yes
2722         trygcc=yes
2723         case "$cc" in
2724         *gcc*) trygcc=no ;;
2725         esac
2726         # Skip this test because it gives a false match on output like:
2727         #    ./trygcc: line 23: cc: command not found
2728         # case "`$cc -v -c try.c 2>&1`" in
2729         # *gcc*) trygcc=no ;;
2730         # esac
2731         if $test X"$trygcc" = Xyes; then
2732             if gcc -o try -c try.c; then
2733                 echo " "
2734                 echo "You seem to have a working gcc, though." >&4
2735                 # Switching compilers may undo the work of hints files.
2736                 # The most common problem is -D_REENTRANT for threads.
2737                 # This heuristic catches that case, but gets false positives
2738                 # if -Dusethreads was not actually specified.  Better to
2739                 # bail out here with a useful message than fail
2740                 # mysteriously later. Should we perhaps just try to
2741                 # re-invoke Configure -Dcc=gcc config_args ?
2742                 if $test -f usethreads.cbu; then
2743                         $cat >&4 <<EOM
2744
2745 *** However, any setting of the C compiler flags (e.g. for thread support)
2746 *** will be lost.  It may be necessary for you to restart Configure and
2747 *** add -Dcc=gcc to your Configure command line.
2748
2749 EOM
2750                         rp="Would you like to go ahead and try gcc anyway?"
2751                         dflt=n
2752                 else
2753                         rp="Would you like to use it?"
2754                         dflt=y
2755                 fi
2756                 if $test -f myread; then
2757                     . ./myread
2758                 else
2759                     if $test -f UU/myread; then
2760                         . ./UU/myread
2761                     else
2762                         echo "Cannot find myread, sorry.  Aborting." >&2
2763                         exit 1
2764                     fi
2765                 fi
2766                 case "$ans" in
2767                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2768                 esac
2769             fi
2770         fi
2771     fi
2772     $rm -f try try.*
2773     ;;
2774 esac
2775 EOSC
2776
2777 cat <<EOS >checkcc
2778 $startsh
2779 EOS
2780 cat <<'EOSC' >>checkcc
2781 case "$cc" in
2782 '') ;;
2783 *)  $rm -f try try.*
2784     $cat >try.c <<EOM
2785 int main(int argc, char *argv[]) {
2786   return 0;
2787 }
2788 EOM
2789     if $cc -o try $ccflags $ldflags try.c; then
2790        :
2791     else
2792         if $test X"$despair" = Xyes; then
2793            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2794         fi
2795         $cat >&4 <<EOM
2796 You need to find a working C compiler.
2797 Either (purchase and) install the C compiler supplied by your OS vendor,
2798 or for a free C compiler try http://gcc.gnu.org/
2799 I cannot continue any further, aborting.
2800 EOM
2801         exit 1
2802     fi
2803     $rm -f try try.*
2804     ;;
2805 esac
2806 EOSC
2807
2808 : determine whether symbolic links are supported
2809 echo " "
2810 $touch blurfl
2811 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2812         echo "Symbolic links are supported." >&4
2813         lns="$ln -s"
2814 else
2815         echo "Symbolic links are NOT supported." >&4
2816         lns="$ln"
2817 fi
2818 $rm -f blurfl sym
2819
2820 : determine whether symbolic links are supported
2821 echo " "
2822 case "$lns" in
2823 *"ln"*" -s")
2824         echo "Checking how to test for symbolic links..." >&4
2825         $lns blurfl sym
2826         if $test "X$issymlink" = X; then
2827                 case "$newsh" in
2828                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2829                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2830                 esac
2831                 if test $? = 0; then
2832                         issymlink="test -h"
2833                 else
2834                         echo "Your builtin 'test -h' may be broken." >&4
2835                         case "$test" in
2836                         /*)     ;;
2837                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2838                                 for p in $pth
2839                                 do
2840                                         if test -f "$p/$test"; then
2841                                                 test="$p/$test"
2842                                                 break
2843                                         fi
2844                                 done
2845                                 ;;
2846                         esac
2847                         case "$test" in
2848                         /*)
2849                                 echo "Trying external '$test -h'." >&4
2850                                 issymlink="$test -h"
2851                                 if $test ! -h sym >/dev/null 2>&1; then
2852                                         echo "External '$test -h' is broken, too." >&4
2853                                         issymlink=''
2854                                 fi
2855                                 ;;
2856                         *)      issymlink='' ;;
2857                         esac
2858                 fi
2859         fi
2860         if $test "X$issymlink" = X; then
2861                 if $test -L sym 2>/dev/null; then
2862                         issymlink="$test -L"
2863                         echo "The builtin '$test -L' worked." >&4
2864                 fi
2865         fi
2866         if $test "X$issymlink" != X; then
2867                 echo "You can test for symbolic links with '$issymlink'." >&4
2868         else
2869                 echo "I do not know how you can test for symbolic links." >&4
2870         fi
2871         $rm -f blurfl sym
2872         ;;
2873 *)      echo "No symbolic links, so not testing for their testing..." >&4
2874         ;;
2875 esac
2876 echo " "
2877
2878 : Make symlinks util
2879 case "$mksymlinks" in
2880 $define|true|[yY]*)
2881         case "$src" in
2882         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2883                 exit 1
2884                 ;;
2885         *)      case "$lns:$issymlink" in
2886                 *"ln"*" -s:"*"test -"?)
2887                         echo "Creating the symbolic links..." >&4
2888                         cd ..
2889                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2890                         awk 'NF == 1 {
2891                                 dir=".";
2892                                 file=$1 "";
2893                              }
2894                              NF == 2 {
2895                                 dir=$1 "";
2896                                 file=$2 "";
2897                              }
2898                              {
2899                                  print "# dir = ", dir, "file = ", file
2900                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2901                              } END {
2902                                  for (d in mf) {
2903                                      if (d != ".") { print("mkdir -p "d) }
2904                                      print("ln -sf "mf[d]" "d);
2905                                  }
2906                              }' source="$src" > UU/mksymlinks.$$
2907                         sh UU/mksymlinks.$$
2908                         rm UU/mksymlinks.$$
2909                         # Sanity check 1.
2910                         if test ! -d t/base; then
2911                                 echo "Failed to create the subdirectories.  Aborting." >&4
2912                                 exit 1
2913                         fi
2914                         # Sanity check 2.
2915                         if test ! -f t/base/lex.t; then
2916                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2917                                 exit 1
2918                         fi
2919                         if test ! -f win32/win32.c; then
2920                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2921                                 exit 1
2922                         fi
2923                         cd UU
2924                         ;;
2925                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2926                         ;;
2927                 esac
2928                 ;;
2929         esac
2930         ;;
2931 esac
2932
2933 : Check for Cross-Compilation
2934 if $test "X$targethost" = "X"; then
2935     targethost=""
2936 fi
2937 if $test "X$targetenv" = "X"; then
2938     targetenv=""
2939 fi
2940 case "$usecrosscompile" in
2941 $define|true|[yY]*)
2942         $echo "Cross-compiling..."
2943         croak=''
2944         case "$cc" in
2945         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2946             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2947             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2948             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2949             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2950             # leave out ld, choosing it is more complex
2951             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2952             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2953             # We are in a weird spot. Just before us, some values
2954             # were 'saved', to be restored after the hints are
2955             # run.  This means that the changes we made to ar,
2956             # nm and ranlib will get reverted.
2957             # To avoid that, we hijack the saving mechanism and
2958             # have it save our new values.
2959             for file in ar nm ranlib; do
2960                 eval xxx=\$$file
2961                 eval $file=$xxx$_exe
2962                 eval _$file=$xxx
2963             done
2964         ;;
2965         esac
2966         case "$targetarch" in
2967         '') echo "Targetarch not defined." >&4; croak=y ;;
2968         *)  echo "Using targetarch $targetarch." >&4 ;;
2969         esac
2970         case "$targethost" in
2971         '') echo "Targethost not defined." >&4; croak=y ;;
2972         *)  echo "Using targethost $targethost." >&4
2973         esac
2974         locincpth=' '
2975         loclibpth=' '
2976         case "$croak" in
2977         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2978         esac
2979     : compile a host miniperl and generate_uudmap, unless we got passed them
2980     if $test "X$hostperl" = X; then
2981       echo "Building host miniperl and generate_uudmap binaries" >&4
2982       before_host=`pwd`
2983       cd ..
2984       cd $src
2985       src=`pwd`
2986       rm -rf $src/host
2987       mkdir $src/host
2988       cd $src/host
2989       $src/Configure -des -Dusedevel -Dmksymlinks
2990       $make miniperl
2991       case "$hostgenerate" in
2992       '') $make generate_uudmap
2993           hostgenerate=$src/host/generate_uudmap
2994           ;;
2995        "$undef") hostgenerate=''
2996           ;;
2997       esac
2998       hostperl=$src/host/miniperl
2999       cd $before_host
3000     fi
3001     hostosname=`$hostperl -le 'print $^O'`
3002     ;;
3003 *)
3004     usecrosscompile="$undef"
3005     ;;
3006 esac
3007
3008 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3009 case "$targethost" in
3010     '') echo "Checking for cross-compile" >&4
3011     case "$usecrosscompile$multiarch" in
3012        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3013          if [ -f Makefile ]; then
3014            echo " "
3015            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3016          else
3017            echo "Configure done."
3018          fi
3019        exit 0
3020        ;;
3021      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3022         run=''
3023         to=:
3024         from=:
3025         ;;
3026     esac
3027     ;;
3028     *) echo "Using targethost $targethost." >&4
3029         case "$src" in
3030         /*) run=$src/Cross/run
3031             targetmkdir=$src/Cross/mkdir
3032             to=$src/Cross/to
3033             from=$src/Cross/from
3034             ;;
3035         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3036             run=$pwd/Cross/run
3037             targetmkdir=$pwd/Cross/mkdir
3038             to=$pwd/Cross/to
3039             from=$pwd/Cross/from
3040             ;;
3041         esac
3042         case "$targetrun" in
3043         '') targetrun=ssh ;;
3044         esac
3045         case "$targetto" in
3046         '') targetto=scp ;;
3047         esac
3048         case "$targetfrom" in
3049         '') targetfrom=scp ;;
3050         esac
3051         run=$run-$targetrun
3052         to=$to-$targetto
3053         from=$from-$targetfrom
3054         case "$targetdir" in
3055         '')  targetdir=/tmp
3056              echo "Guessing targetdir $targetdir." >&4
3057              ;;
3058         esac
3059         case "$targetuser" in
3060         '')  targetuser=root
3061              echo "Guessing targetuser $targetuser." >&4
3062              ;;
3063         esac
3064         case "$targetport" in
3065         '')  targetport=22
3066              echo "Guessing targetport $targetport." >&4
3067              ;;
3068         esac
3069         case "$targetfrom" in
3070         scp)    q=-q ;;
3071         *)      q='' ;;
3072         esac
3073         case "$targetrun" in
3074         ssh|rsh)
3075             cat >$run <<EOF
3076 #!/bin/sh
3077 env=''
3078 case "\$1" in
3079 -cwd)
3080   shift
3081   cwd=\$1
3082   shift
3083   ;;
3084 esac
3085 case "\$1" in
3086 -env)
3087   shift
3088   env=\$1
3089   shift
3090   ;;
3091 esac
3092 case "\$cwd" in
3093 '') cwd=$targetdir ;;
3094 esac
3095 exe=\$1
3096 shift
3097 $to \$exe
3098 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3099 EOF
3100             ;;
3101         adb)
3102             $touch $run
3103             ;;
3104         *)  echo "Unknown targetrun '$targetrun'" >&4
3105             exit 1
3106             ;;
3107         esac
3108         case "$targetmkdir" in
3109         */Cross/mkdir)
3110             cat >$targetmkdir <<EOF
3111 #!/bin/sh
3112 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3113 EOF
3114             $chmod a+rx $targetmkdir
3115             ;;
3116         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3117             exit 1
3118             ;;
3119         esac
3120         case "$targetto" in
3121         scp|rcp)
3122             cat >$to <<EOF
3123 #!/bin/sh
3124 for f in \$@
3125 do
3126   case "\$f" in
3127   /*)
3128     $targetmkdir \`dirname \$f\`
3129     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3130     ;;
3131   *)
3132     $targetmkdir $targetdir/\`dirname \$f\`
3133     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3134     ;;
3135   esac
3136 done
3137 exit 0
3138 EOF
3139             ;;
3140         cp) cat >$to <<EOF
3141 #!/bin/sh
3142 for f in \$@
3143 do
3144   case "\$f" in
3145   /*)
3146     $mkdir -p $targetdir/\`dirname \$f\`
3147     $cp \$f $targetdir/\$f || exit 1
3148     ;;
3149   *)
3150     $targetmkdir $targetdir/\`dirname \$f\`
3151     $cp \$f $targetdir/\$f || exit 1
3152     ;;
3153   esac
3154 done
3155 exit 0
3156 EOF
3157             ;;
3158         *)  echo "Unknown targetto '$targetto'" >&4
3159             exit 1
3160             ;;
3161         esac
3162         case "$targetfrom" in
3163         scp|rcp)
3164           cat >$from <<EOF
3165 #!/bin/sh
3166 for f in \$@
3167 do
3168   $rm -f \$f
3169   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3170 done
3171 exit 0
3172 EOF
3173             ;;
3174         cp) cat >$from <<EOF
3175 #!/bin/sh
3176 for f in \$@
3177 do
3178   $rm -f \$f
3179   cp $targetdir/\$f . || exit 1
3180 done
3181 exit 0
3182 EOF
3183             ;;
3184         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3185             exit 1
3186             ;;
3187         esac
3188         if $test ! -f $run; then
3189             echo "Target 'run' script '$run' not found." >&4
3190         else
3191             $chmod a+rx $run
3192         fi
3193         if $test ! -f $to; then
3194             echo "Target 'to' script '$to' not found." >&4
3195         else
3196             $chmod a+rx $to
3197         fi
3198         if $test ! -f $from; then
3199             echo "Target 'from' script '$from' not found." >&4
3200         else
3201             $chmod a+rx $from
3202         fi
3203         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3204             exit 1
3205         fi
3206         cat >&4 <<EOF
3207 Using '$run' for remote execution,
3208 and '$from' and '$to'
3209 for remote file transfer.
3210 EOF
3211         ;;
3212 *)      run=''
3213         to=:
3214         from=:
3215         usecrosscompile="$undef"
3216         targetarch=''
3217         ;;
3218 esac
3219
3220 : see whether [:lower:] and [:upper:] are supported character classes
3221 echo " "
3222 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3223 ABYZ-abyz)
3224         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3225         up='[:upper:]'
3226         low='[:lower:]'
3227         ;;
3228 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3229         # (0xd9 and 0xe2), therefore that is a nice testing point.
3230         if test "X$up" = X -o "X$low" = X; then
3231             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3232             rs) up='[A-Z]'
3233                 low='[a-z]'
3234                 ;;
3235             esac
3236         fi
3237         if test "X$up" = X -o "X$low" = X; then
3238             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3239             rs) up='A-Z'
3240                 low='a-z'
3241                 ;;
3242             esac
3243         fi
3244         if test "X$up" = X -o "X$low" = X; then
3245             case "`echo RS | od -x 2>/dev/null`" in
3246             *D9E2*|*d9e2*)
3247                 echo "Hey, this might be EBCDIC." >&4
3248                 if test "X$up" = X -o "X$low" = X; then
3249                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3250                     rs) up='[A-IJ-RS-Z]'
3251                         low='[a-ij-rs-z]'
3252                         ;;
3253                     esac
3254                 fi
3255                 if test "X$up" = X -o "X$low" = X; then
3256                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3257                     rs) up='A-IJ-RS-Z'
3258                         low='a-ij-rs-z'
3259                         ;;
3260                     esac
3261                 fi
3262                 ;;
3263             esac
3264         fi
3265 esac
3266 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3267 rs)
3268     echo "Using $up and $low to convert case." >&4
3269     ;;
3270 *)
3271     echo "I don't know how to translate letters from upper to lower case." >&4
3272     echo "Your tr is not acting any way I know of." >&4
3273     exit 1
3274     ;;
3275 esac
3276 : set up the translation script tr, must be called with ./tr of course
3277 cat >tr <<EOSC
3278 $startsh
3279 case "\$1\$2" in
3280 '[A-Z][a-z]') exec $tr '$up' '$low';;
3281 '[a-z][A-Z]') exec $tr '$low' '$up';;
3282 esac
3283 exec $tr "\$@"
3284 EOSC
3285 chmod +x tr
3286 $eunicefix tr
3287
3288 : Try to determine whether config.sh was made on this system
3289 case "$config_sh" in
3290 '')
3291 myuname=`$uname -a 2>/dev/null`
3292 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3293 # Downcase everything to avoid ambiguity.
3294 # Remove slashes and single quotes so we can use parts of this in
3295 # directory and file names.
3296 # Remove newlines so myuname is sane to use elsewhere.
3297 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3298 # because the A-Z/a-z are not consecutive.
3299 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3300         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3301 newmyuname="$myuname"
3302 dflt=n
3303 case "$knowitall" in
3304 '')
3305         if test -f ../config.sh; then
3306                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3307                         eval "`grep myuname= ../config.sh`"
3308                 fi
3309                 if test "X$myuname" = "X$newmyuname"; then
3310                         dflt=y
3311                 fi
3312         fi
3313         ;;
3314 *) dflt=y;;
3315 esac
3316
3317 : Get old answers from old config file if Configure was run on the
3318 : same system, otherwise use the hints.
3319 hint=default
3320 cd ..
3321 if test -f config.sh; then
3322         echo " "
3323         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3324         . UU/myread
3325         case "$ans" in
3326         n*|N*) echo "OK, I'll ignore it."
3327                 mv config.sh config.sh.old
3328                 myuname="$newmyuname"
3329                 ;;
3330         *)  echo "Fetching default answers from your old config.sh file..." >&4
3331                 tmp_n="$n"
3332                 tmp_c="$c"
3333                 tmp_sh="$sh"
3334                 . ./config.sh
3335                 cp config.sh UU
3336                 n="$tmp_n"
3337                 c="$tmp_c"
3338                 : Older versions did not always set $sh.  Catch re-use of such
3339                 : an old config.sh.
3340                 case "$sh" in
3341                 '') sh="$tmp_sh" ;;
3342                 esac
3343                 hint=previous
3344                 ;;
3345         esac
3346 fi
3347 . ./UU/checkcc
3348 if test ! -f config.sh; then
3349         $cat <<EOM
3350
3351 First time through, eh?  I have some defaults handy for some systems
3352 that need some extra help getting the Configure answers right:
3353
3354 EOM
3355         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3356         dflt=''
3357         : Half the following guesses are probably wrong... If you have better
3358         : tests or hints, please send them to perlbug@perl.org
3359         : The metaconfig authors would also appreciate a copy...
3360         $test -f /irix && osname=irix
3361         $test -f /xenix && osname=sco_xenix
3362         $test -f /dynix && osname=dynix
3363         $test -f /dnix && osname=dnix
3364         $test -f /lynx.os && osname=lynxos
3365         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3366         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3367         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3368         $test -f /bin/mips && /bin/mips && osname=mips
3369         $test -d /usr/apollo/bin && osname=apollo
3370         $test -f /etc/saf/_sactab && osname=svr4
3371         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3372         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3373         $test -f /sys/utilities/MultiView && osname=amigaos
3374         if $test -d /MachTen -o -d /MachTen_Folder; then
3375                 osname=machten
3376                 if $test -x /sbin/version; then
3377                         osvers=`/sbin/version | $awk '{print $2}' |
3378                         $sed -e 's/[A-Za-z]$//'`
3379                 elif $test -x /usr/etc/version; then
3380                         osvers=`/usr/etc/version | $awk '{print $2}' |
3381                         $sed -e 's/[A-Za-z]$//'`
3382                 else
3383                         osvers="$2.$3"
3384                 fi
3385         fi
3386
3387         $test -f /sys/posix.dll &&
3388                 $test -f /usr/bin/what &&
3389                 set X `/usr/bin/what /sys/posix.dll` &&
3390                 $test "$3" = UWIN &&
3391                 osname=uwin &&
3392                 osvers="$5"
3393
3394         if $test -f $uname; then
3395                 set X $myuname
3396                 shift
3397
3398                 case "$5" in
3399                 fps*) osname=fps ;;
3400                 mips*)
3401                         case "$4" in
3402                         umips) osname=umips ;;
3403                         *) osname=mips ;;
3404                         esac;;
3405                 [23]100) osname=mips ;;
3406                 i386*)
3407                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3408                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3409                                 osname='sco'
3410                                 osvers=$tmp
3411                         elif $test -f /etc/kconfig; then
3412                                 osname=isc
3413                                 if test "$lns" = "$ln -s"; then
3414                                         osvers=4
3415                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3416                                         osvers=3
3417                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3418                                         osvers=2
3419                                 fi
3420                         fi
3421                         tmp=''
3422                         ;;
3423                 pc*)
3424                         if test -n "$DJGPP"; then
3425                                 osname=dos
3426                                 osvers=djgpp
3427                         fi
3428                         ;;
3429                 esac
3430
3431                 case "$1" in
3432                 aix) osname=aix
3433                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3434                         case "$tmp" in
3435                         # oslevel can fail with:
3436                         # oslevel: Unable to acquire lock.
3437                         *not\ found) osvers="$4"."$3" ;;
3438                         '<3240'|'<>3240') osvers=3.2.0 ;;
3439                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3440                         '=3250'|'>3250') osvers=3.2.5 ;;
3441                         *) osvers=$tmp;;
3442                         esac
3443                         ;;
3444                 bitrig) osname=bitrig
3445                         osvers="$3"
3446                         ;;
3447                 bsd386) osname=bsd386
3448                         osvers=`$uname -r`
3449                         ;;
3450                 cygwin*) osname=cygwin
3451                         osvers="$3"
3452                         ;;
3453                 *dc.osx) osname=dcosx
3454                         osvers="$3"
3455                         ;;
3456                 dnix) osname=dnix
3457                         osvers="$3"
3458                         ;;
3459                 domainos) osname=apollo
3460                         osvers="$3"
3461                         ;;
3462                 dgux)   osname=dgux
3463                         osvers="$3"
3464                         ;;
3465                 dragonfly) osname=dragonfly
3466                         osvers="$3"
3467                         ;;
3468                 dynixptx*) osname=dynixptx
3469                         osvers=`echo "$4"|sed 's/^v//'`
3470                         ;;
3471                 freebsd) osname=freebsd
3472                         osvers="$3" ;;
3473                 genix)  osname=genix ;;
3474                 gnu)    osname=gnu
3475                         osvers="$3" ;;
3476                 hp*)    osname=hpux
3477                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3478                         ;;
3479                 irix*)  osname=irix
3480                         case "$3" in
3481                         4*) osvers=4 ;;
3482                         5*) osvers=5 ;;
3483                         *)      osvers="$3" ;;
3484                         esac
3485                         ;;
3486                 linux)  osname=linux
3487                         case "$3" in
3488                         *)      osvers="$3" ;;
3489                         esac
3490                         $test -f /system/lib/libandroid.so && osname=linux-android
3491                         ;;
3492                 MiNT)   osname=mint
3493                         ;;
3494                 netbsd*) osname=netbsd
3495                         osvers="$3"
3496                         ;;
3497                 news-os) osvers="$3"
3498                         case "$3" in
3499                         4*) osname=newsos4 ;;
3500                         *) osname=newsos ;;
3501                         esac
3502                         ;;
3503                 nonstop-ux) osname=nonstopux ;;
3504                 openbsd) osname=openbsd
3505                         osvers="$3"
3506                         ;;
3507                 os2)    osname=os2
3508                         osvers="$4"
3509                         ;;
3510                 POSIX-BC | posix-bc ) osname=posix-bc
3511                         osvers="$3"
3512                         ;;
3513                 powerux | power_ux | powermax_os | powermaxos | \
3514                 powerunix | power_unix) osname=powerux
3515                         osvers="$3"
3516                         ;;
3517                 qnx) osname=qnx
3518                         osvers="$4"
3519                         ;;
3520                 solaris) osname=solaris
3521                         case "$3" in
3522                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3523                         *)      osvers="$3" ;;
3524                         esac
3525                         ;;
3526                 sunos) osname=sunos
3527                         case "$3" in
3528                         5*) osname=solaris
3529                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3530                         *)      osvers="$3" ;;
3531                         esac
3532                         ;;
3533                 titanos) osname=titanos
3534                         case "$3" in
3535                         1*) osvers=1 ;;
3536                         2*) osvers=2 ;;
3537                         3*) osvers=3 ;;
3538                         4*) osvers=4 ;;
3539                         *)      osvers="$3" ;;
3540                         esac
3541                         ;;
3542                 ultrix) osname=ultrix
3543                         osvers="$3"
3544                         ;;
3545                 osf1|mls+)      case "$5" in
3546                                 alpha)
3547                                         osname=dec_osf
3548                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3549                                         case "$osvers" in
3550                                         [1-9].[0-9]*) ;;
3551                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3552                                         esac
3553                                         ;;
3554                         hp*)    osname=hp_osf1  ;;
3555                         mips)   osname=mips_osf1 ;;
3556                         esac
3557                         ;;
3558                 # UnixWare 7.1.2 is known as Open UNIX 8
3559                 openunix|unixware) osname=svr5
3560                         osvers="$4"
3561                         ;;
3562                 uts)    osname=uts
3563                         osvers="$3"
3564                         ;;
3565                 vos) osvers="$3"
3566                         ;;
3567                 $2) case "$osname" in
3568                         *isc*) ;;
3569                         *freebsd*) ;;
3570                         svr*)
3571                                 : svr4.x or possibly later
3572                                 case "svr$3" in
3573                                 ${osname}*)
3574                                         osname=svr$3
3575                                         osvers=$4
3576                                         ;;
3577                                 esac
3578                                 case "$osname" in
3579                                 svr4.0)
3580                                         : Check for ESIX
3581                                         if test -f /stand/boot ; then
3582                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3583                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3584                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3585                                                         if test -n "$isesix"; then
3586                                                                 osname=esix4
3587                                                         fi
3588                                                 fi
3589                                         fi
3590                                         ;;
3591                                 esac
3592                                 ;;
3593                         *)      if test -f /etc/systemid; then
3594                                         osname=sco
3595                                         set `echo $3 | $sed 's/\./ /g'` $4
3596                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3597                                                 osvers=$1.$2.$3
3598                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3599                                                 osvers=$1.$2
3600                                         elif $test -f $src/hints/sco_$1.sh; then
3601                                                 osvers=$1
3602                                         fi
3603                                 else
3604                                         case "$osname" in
3605                                         '') : Still unknown.  Probably a generic Sys V.
3606                                                 osname="sysv"
3607                                                 osvers="$3"
3608                                                 ;;
3609                                         esac
3610                                 fi
3611                                 ;;
3612                         esac
3613                         ;;
3614                 *)      case "$osname" in
3615                         '') : Still unknown.  Probably a generic BSD.
3616                                 osname="$1"
3617                                 osvers="$3"
3618                                 ;;
3619                         esac
3620                         ;;
3621                 esac
3622         else
3623                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3624                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3625                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3626                                 osname=news_os
3627                         fi
3628                         $rm -f UU/kernel.what
3629                 elif test -d c:/. -o -n "$is_os2" ; then
3630                         set X $myuname
3631                         osname=os2
3632                         osvers="$5"
3633                 fi
3634         fi
3635
3636         case "$targetarch" in
3637         '') ;;
3638         *)  hostarch=$osname
3639             case "$targetarch" in
3640                 nto*|*-nto-*)
3641                     # Will load qnx.sh, which should change osname to nto
3642                     osname=qnx
3643                     osvers=''
3644                     ;;
3645                 *linux-android*)
3646                     # Catch arm-linux-androideabi, mipsel-linux-android,
3647                     # and i686-linux-android
3648                     osname=linux-android
3649                     osvers=''
3650                     ;;
3651                 *linux*)
3652                     # Something like arm-linux-gnueabihf is really just
3653                     # plain linux.
3654                     osname=linux
3655                     osvers=''
3656                     ;;
3657                 *solaris*|*sunos*)
3658                     osname=solaris
3659                     # XXX perhaps we should just assume
3660                     # osvers to be 2, or maybe take the value
3661                     # from targetarch. Using $run before the
3662                     # hints are run is somewhat icky.
3663                     set X `$run $uname -a 2>/dev/null`
3664                     shift
3665                     case "$3" in
3666                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3667                         *)  osvers="$3" ;;
3668                     esac
3669                     ;;
3670                 *)
3671                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3672                     osvers=''
3673                 ;;
3674             esac
3675             ;;
3676         esac
3677
3678         : Now look for a hint file osname_osvers, unless one has been
3679         : specified already.
3680         case "$hintfile" in
3681         ''|' ')
3682                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3683                 : Also try without trailing minor version numbers.
3684                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3685                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3686                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3687                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3688                 case "$file" in
3689                 '') dflt=none ;;
3690                 *)  case "$osvers" in
3691                         '') dflt=$file
3692                                 ;;
3693                         *)  if $test -f $src/hints/$file.sh ; then
3694                                         dflt=$file
3695                                 elif $test -f $src/hints/$xfile.sh ; then
3696                                         dflt=$xfile
3697                                 elif $test -f $src/hints/$xxfile.sh ; then
3698                                         dflt=$xxfile
3699                                 elif $test -f $src/hints/$xxxfile.sh ; then
3700                                         dflt=$xxxfile
3701                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3702                                         dflt=$xxxxfile
3703                                 elif $test -f "$src/hints/${osname}.sh" ; then
3704                                         dflt="${osname}"
3705                                 else
3706                                         dflt=none
3707                                 fi
3708                                 ;;
3709                         esac
3710                         ;;
3711                 esac
3712                 if $test -f Policy.sh ; then
3713                         case "$dflt" in
3714                         *Policy*) ;;
3715                         none) dflt="Policy" ;;
3716                         *) dflt="Policy $dflt" ;;
3717                         esac
3718                 fi
3719                 ;;
3720         *)
3721                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3722                 ;;
3723         esac
3724
3725         if $test -f Policy.sh ; then
3726                 $cat <<EOM
3727
3728 There's also a Policy hint file available, which should make the
3729 site-specific (policy) questions easier to answer.
3730 EOM
3731
3732         fi
3733
3734         $cat <<EOM
3735
3736 You may give one or more space-separated answers, or "none" if appropriate.
3737 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3738 previous run of Configure, you may specify it as well as or instead of
3739 OS-specific hints.  If hints are provided for your OS, you should use them:
3740 although Perl can probably be built without hints on many platforms, using
3741 hints often improve performance and may enable features that Configure can't
3742 set up on its own. If there are no hints that match your OS, specify "none";
3743 DO NOT give a wrong version or a wrong OS.
3744
3745 EOM
3746
3747         rp="Which of these apply, if any?"
3748         . UU/myread
3749         tans=$ans
3750         for file in $tans; do
3751                 if $test X$file = XPolicy -a -f Policy.sh; then
3752                         . Policy.sh
3753                         $cat Policy.sh >> UU/config.sh
3754                 elif $test -f $src/hints/$file.sh; then
3755                         . $src/hints/$file.sh
3756                         $cat $src/hints/$file.sh >> UU/config.sh
3757                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3758                         : nothing
3759                 else
3760                         : Give one chance to correct a possible typo.
3761                         echo "$file.sh does not exist"
3762                         dflt=$file
3763                         rp="hint to use instead?"
3764                         . UU/myread
3765                         for file in $ans; do
3766                                 if $test -f "$src/hints/$file.sh"; then
3767                                         . $src/hints/$file.sh
3768                                         $cat $src/hints/$file.sh >> UU/config.sh
3769                                 elif $test X$ans = X -o X$ans = Xnone ; then
3770                                         : nothing
3771                                 else
3772                                         echo "$file.sh does not exist -- ignored."
3773                                 fi
3774                         done
3775                 fi
3776         done
3777
3778         hint=recommended
3779         : Remember our hint file for later.
3780         if $test -f "$src/hints/$file.sh" ; then
3781                 hintfile="$file"
3782         else
3783                 hintfile=''
3784         fi
3785 fi
3786 cd UU
3787 ;;
3788 *)
3789         echo " "
3790         echo "Fetching default answers from $config_sh..." >&4
3791         tmp_n="$n"
3792         tmp_c="$c"
3793         cd ..
3794         cp $config_sh config.sh 2>/dev/null
3795         chmod +w config.sh
3796         . ./config.sh
3797         cd UU
3798         cp ../config.sh .
3799         n="$tmp_n"
3800         c="$tmp_c"
3801         hint=previous
3802         ;;
3803 esac
3804 . ./optdef.sh
3805
3806 : Restore computed paths
3807 for file in $loclist $trylist; do
3808         eval $file="\$_$file"
3809 done
3810
3811 cat << EOM
3812
3813 Configure uses the operating system name and version to set some defaults.
3814 The default value is probably right if the name rings a bell. Otherwise,
3815 since spelling matters for me, either accept the default or answer "none"
3816 to leave it blank.
3817
3818 EOM
3819 case "$osname" in
3820         ''|' ')
3821                 case "$hintfile" in
3822                 ''|' '|none) dflt=none ;;
3823                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3824                 esac
3825                 ;;
3826         *) dflt="$osname" ;;
3827 esac
3828 rp="Operating system name?"
3829 . ./myread
3830 case "$ans" in
3831 none)  osname='' ;;
3832 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3833 esac
3834 echo " "
3835 case "$osvers" in
3836         ''|' ')
3837                 case "$hintfile" in
3838                 ''|' '|none) dflt=none ;;
3839                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3840                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3841                         case "$dflt" in
3842                         ''|' ') dflt=none ;;
3843                         esac
3844                         ;;
3845                 esac
3846                 ;;
3847         *) dflt="$osvers" ;;
3848 esac
3849 rp="Operating system version?"
3850 . ./myread
3851 case "$ans" in
3852 none)  osvers='' ;;
3853 *) osvers="$ans" ;;
3854 esac
3855
3856
3857 . ./posthint.sh
3858
3859 : who configured the system
3860 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3861 case "$cf_by" in
3862 "")
3863         cf_by=`(logname) 2>/dev/null`
3864         case "$cf_by" in
3865         "")
3866                 cf_by=`(whoami) 2>/dev/null`
3867                 case "$cf_by" in
3868                 "") cf_by=unknown ;;
3869                 esac ;;
3870         esac ;;
3871 esac
3872
3873 : decide how portable to be.  Allow command line overrides.
3874 case "$d_portable" in
3875 "$undef") ;;
3876 *)      d_portable="$define" ;;
3877 esac
3878
3879 : set up shell script to do ~ expansion
3880 cat >filexp <<EOSS
3881 $startsh
3882 : expand filename
3883 case "\$1" in
3884  \~/*|\~)
3885         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3886         ;;
3887  \~*)
3888         if $test -f /bin/csh; then
3889                 /bin/csh -f -c "glob \$1"
3890                 failed=\$?
3891                 echo ""
3892                 exit \$failed
3893         else
3894                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3895                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3896                 if $test ! -d "\$dir"; then
3897                         me=\`basename \$0\`
3898                         echo "\$me: can't locate home directory for: \$name" >&2
3899                         exit 1
3900                 fi
3901                 case "\$1" in
3902                 */*)
3903                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3904                         ;;
3905                 *)
3906                         echo \$dir
3907                         ;;
3908                 esac
3909         fi
3910         ;;
3911 *)
3912         echo \$1
3913         ;;
3914 esac
3915 EOSS
3916 chmod +x filexp
3917 $eunicefix filexp
3918
3919 : now set up to get a file name
3920 cat <<EOS >getfile
3921 $startsh
3922 EOS
3923 cat <<'EOSC' >>getfile
3924 tilde=''
3925 fullpath=''
3926 already=''
3927 skip=''
3928 none_ok=''
3929 exp_file=''
3930 nopath_ok=''
3931 orig_rp="$rp"
3932 orig_dflt="$dflt"
3933 case "$gfpth" in
3934 '') gfpth='.' ;;
3935 esac
3936
3937 case "$fn" in
3938 *\(*)
3939         : getfile will accept an answer from the comma-separated list
3940         : enclosed in parentheses even if it does not meet other criteria.
3941         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3942         fn=`echo $fn | sed 's/(.*)//'`
3943         ;;
3944 esac
3945
3946 case "$fn" in
3947 *:*)
3948         loc_file=`expr $fn : '.*:\(.*\)'`
3949         fn=`expr $fn : '\(.*\):.*'`
3950         ;;
3951 esac
3952
3953 case "$fn" in
3954 *~*) tilde=true;;
3955 esac
3956 case "$fn" in
3957 */*) fullpath=true;;
3958 esac
3959 case "$fn" in
3960 *+*) skip=true;;
3961 esac
3962 case "$fn" in
3963 *n*) none_ok=true;;
3964 esac
3965 case "$fn" in
3966 *e*) exp_file=true;;
3967 esac
3968 case "$fn" in
3969 *p*) nopath_ok=true;;
3970 esac
3971
3972 case "$fn" in
3973 *f*) type='File';;
3974 *d*) type='Directory';;
3975 *l*) type='Locate';;
3976 esac
3977
3978 what="$type"
3979 case "$what" in
3980 Locate) what='File';;
3981 esac
3982
3983 case "$exp_file" in
3984 '')
3985         case "$d_portable" in
3986         "$define") ;;
3987         *) exp_file=true;;
3988         esac
3989         ;;
3990 esac
3991
3992 cd ..
3993 while test "$type"; do
3994         redo=''
3995         rp="$orig_rp"
3996         dflt="$orig_dflt"
3997         case "$tilde" in
3998         true) rp="$rp (~name ok)";;
3999         esac
4000         . UU/myread
4001         if test -f UU/getfile.ok && \
4002                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4003         then
4004                 value="$ans"
4005                 ansexp="$ans"
4006                 break
4007         fi
4008         case "$ans" in
4009         none)
4010                 value=''
4011                 ansexp=''
4012                 case "$none_ok" in
4013                 true) type='';;
4014                 esac
4015                 ;;
4016         *)
4017                 case "$tilde" in
4018                 '') value="$ans"
4019                         ansexp="$ans";;
4020                 *)
4021                         value=`UU/filexp $ans`
4022                         case $? in
4023                         0)
4024                                 if test "$ans" != "$value"; then
4025                                         echo "(That expands to $value on this system.)"
4026                                 fi
4027                                 ;;
4028                         *) value="$ans";;
4029                         esac
4030                         ansexp="$value"
4031                         case "$exp_file" in
4032                         '') value="$ans";;
4033                         esac
4034                         ;;
4035                 esac
4036                 case "$fullpath" in
4037                 true)
4038                         case "$ansexp" in
4039                         /*) value="$ansexp" ;;
4040                         [a-zA-Z]:/*) value="$ansexp" ;;
4041                         *)
4042                                 redo=true
4043                                 case "$already" in
4044                                 true)
4045                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4046                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4047                                         ;;
4048                                 *)
4049                                 echo "Please give a full path name, starting with slash." >&4
4050                                         case "$tilde" in
4051                                         true)
4052                                 echo "Note that using ~name is ok provided it expands well." >&4
4053                                                 already=true
4054                                                 ;;
4055                                         esac
4056                                 esac
4057                                 ;;
4058                         esac
4059                         ;;
4060                 esac
4061                 case "$redo" in
4062                 '')
4063                         case "$type" in
4064                         File)
4065                                 for fp in $gfpth; do
4066                                         if test "X$fp" = X.; then
4067                                             pf="$ansexp"
4068                                         else    
4069                                             pf="$fp/$ansexp"
4070                                         fi
4071                                         if test -f "$pf"; then
4072                                                 type=''
4073                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4074                                         then
4075                                                 echo "($value is not a plain file, but that's ok.)"
4076                                                 type=''
4077                                         fi
4078                                         if test X"$type" = X; then
4079                                             value="$pf"
4080                                             break
4081                                         fi
4082                                 done
4083                                 ;;
4084                         Directory)
4085                                 for fp in $gfpth; do
4086                                         if test "X$fp" = X.; then
4087                                             dir="$ans"
4088                                             direxp="$ansexp"
4089                                         else    
4090                                             dir="$fp/$ansexp"
4091                                             direxp="$fp/$ansexp"
4092                                         fi
4093                                         if test -d "$direxp"; then
4094                                                 type=''
4095                                                 value="$dir"
4096                                                 break
4097                                         fi
4098                                 done
4099                                 ;;
4100                         Locate)
4101                                 if test -d "$ansexp"; then
4102                                         echo "(Looking for $loc_file in directory $value.)"
4103                                         value="$value/$loc_file"
4104                                         ansexp="$ansexp/$loc_file"
4105                                 fi
4106                                 if test -f "$ansexp"; then
4107                                         type=''
4108                                 fi
4109                                 case "$nopath_ok" in
4110                                 true)   case "$value" in
4111                                         */*) ;;
4112                                         *)      echo "Assuming $value will be in people's path."
4113                                                 type=''
4114                                                 ;;
4115                                         esac
4116                                         ;;
4117                                 esac
4118                                 ;;
4119                         esac
4120
4121                         case "$skip" in
4122                         true) type='';
4123                         esac
4124
4125                         case "$type" in
4126                         '') ;;
4127                         *)
4128                                 if test "$fastread" = yes; then
4129                                         dflt=y
4130                                 else
4131                                         dflt=n
4132                                 fi
4133                                 rp="$what $value doesn't exist.  Use that name anyway?"
4134                                 . UU/myread
4135                                 dflt=''
4136                                 case "$ans" in
4137                                 y*) type='';;
4138                                 *) echo " ";;
4139                                 esac
4140                                 ;;
4141                         esac
4142                         ;;
4143                 esac
4144                 ;;
4145         esac
4146 done
4147 cd UU
4148 ans="$value"
4149 rp="$orig_rp"
4150 dflt="$orig_dflt"
4151 rm -f getfile.ok
4152 test "X$gfpthkeep" != Xy && gfpth=""
4153 EOSC
4154
4155 : determine root of directory hierarchy where package will be installed.
4156 case "$prefix" in
4157 '')
4158         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4159         ;;
4160 *?/)
4161         dflt=`echo "$prefix" | sed 's/.$//'`
4162         ;;
4163 *)
4164         dflt="$prefix"
4165         ;;
4166 esac
4167 $cat <<EOM
4168
4169 By default, $package will be installed in $dflt/bin, manual pages
4170 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4171 installation directories. Typically this is something like /usr/local.
4172 If you wish to have binaries under /usr/bin but other parts of the
4173 installation under /usr/local, that's ok: you will be prompted
4174 separately for each of the installation directories, the prefix being
4175 only used to set the defaults.
4176
4177 EOM
4178 fn=d~
4179 rp='Installation prefix to use?'
4180 . ./getfile
4181 oldprefix=''
4182 case "$prefix" in
4183 '') ;;
4184 *)
4185         case "$ans" in
4186         "$prefix") ;;
4187         *) oldprefix="$prefix";;
4188         esac
4189         ;;
4190 esac
4191 prefix="$ans"
4192 prefixexp="$ansexp"
4193
4194 : allow them to override the AFS root
4195 case "$afsroot" in
4196 '')     afsroot=/afs ;;
4197 *)      afsroot=$afsroot ;;
4198 esac
4199
4200 : is AFS running?
4201 echo " "
4202 case "$afs" in
4203 $define|true)   afs=true ;;
4204 $undef|false)   afs=false ;;
4205 *)      if $test -d $afsroot; then
4206                 afs=true
4207         else
4208                 afs=false
4209         fi
4210         ;;
4211 esac
4212 if $afs; then
4213         echo "AFS may be running... I'll be extra cautious then..." >&4
4214 else
4215         echo "AFS does not seem to be running..." >&4
4216 fi
4217
4218 : determine installation prefix for where package is to be installed.
4219 if $afs; then
4220 $cat <<EOM
4221
4222 Since you are running AFS, I need to distinguish the directory in which
4223 files will reside from the directory in which they are installed (and from
4224 which they are presumably copied to the former directory by occult means).
4225
4226 EOM
4227         case "$installprefix" in
4228         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4229         *) dflt="$installprefix";;
4230         esac
4231 else
4232 $cat <<EOM
4233
4234 In some special cases, particularly when building $package for distribution,
4235 it is convenient to distinguish the directory in which files should be
4236 installed from the directory ($prefix) in which they will
4237 eventually reside.  For most users, these two directories are the same.
4238
4239 EOM
4240         case "$installprefix" in
4241         '') dflt=$prefix ;;
4242         *) dflt=$installprefix;;
4243         esac
4244 fi
4245 fn=d~
4246 rp='What installation prefix should I use for installing files?'
4247 . ./getfile
4248 installprefix="$ans"
4249 installprefixexp="$ansexp"
4250
4251 : Perform the prefixexp/installprefixexp correction if necessary
4252 cat <<EOS >installprefix
4253 $startsh
4254 EOS
4255 cat <<'EOSC' >>installprefix
4256 : Change installation prefix, if necessary.
4257 if $test X"$prefix" != X"$installprefix"; then
4258     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4259 else
4260     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4261 fi
4262 EOSC
4263 chmod +x installprefix
4264 $eunicefix installprefix
4265
4266 : Set variables such as privlib and privlibexp from the output of ./getfile
4267 : performing the prefixexp/installprefixexp correction if necessary.
4268 cat <<EOS >setprefixvar
4269 $startsh
4270 EOS
4271 cat <<'EOSC' >>setprefixvar
4272 eval "${prefixvar}=\"\$ans\""
4273 eval "${prefixvar}exp=\"\$ansexp\""
4274 . ./installprefix
4275 EOSC
4276 chmod +x setprefixvar
4277 $eunicefix setprefixvar
4278
4279 : set up the script used to warn in case of inconsistency
4280 cat <<EOS >whoa
4281 $startsh
4282 EOS
4283 cat <<'EOSC' >>whoa
4284 dflt=y
4285 case "$hint" in
4286     recommended)
4287         case "$hintfile" in
4288         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4289                 ;;
4290         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4291                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4292                 ;;
4293         esac
4294         ;;
4295     *)  echo " "
4296         echo "*** WHOA THERE!!! ***" >&4
4297         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4298         ;;
4299 esac
4300 rp="    Keep the $hint value?"
4301 . ./myread
4302 case "$ans" in
4303 y) td=$was; tu=$was;;
4304 esac
4305 EOSC
4306
4307 : function used to set '$1' to '$val'
4308 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4309 case "$val$was" in
4310 $define$undef) . ./whoa; eval "$var=\$td";;
4311 $undef$define) . ./whoa; eval "$var=\$tu";;
4312 *) eval "$var=$val";;
4313 esac'
4314
4315 : get the patchlevel
4316 echo " "
4317 echo "Getting the current patchlevel..." >&4
4318 if $test -r $rsrc/patchlevel.h;then
4319         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4320         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4321         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4322         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4323         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4324         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4325         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4326 else
4327         revision=0
4328         patchlevel=0
4329         subversion=0
4330         api_revision=0
4331         api_version=0
4332         api_subversion=0
4333         perl_patchlevel=0
4334         $echo "(You do not have patchlevel.h.  Eek.)"
4335 fi
4336 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4337 version_patchlevel_string="version $patchlevel subversion $subversion"
4338 case "$perl_patchlevel" in
4339 0|'') ;;
4340 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4341     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4342     ;;
4343 esac
4344
4345 $echo "(You have $package $version_patchlevel_string.)"
4346
4347 case "$osname" in
4348 dos|vms)
4349         : XXX Should be a Configure test for double-dots in filenames.
4350         version=`echo $revision $patchlevel $subversion | \
4351                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4352         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4353                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4354         ;;
4355 *)
4356         version=`echo $revision $patchlevel $subversion | \
4357                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4358         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4359                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4360         ;;
4361 esac
4362 : Special case the 5.005_xx maintenance series, which used 5.005
4363 : without any subversion label as a subdirectory in $sitelib
4364 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4365         api_versionstring='5.005'
4366 fi
4367
4368 : Do we want threads support and if so, what type
4369 case "$usethreads" in
4370 $define|true|[yY]*)     dflt='y';;
4371 *)     # Catch case where user specified ithreads or 5005threads but
4372        # forgot -Dusethreads (A.D. 4/2002)
4373        case "$useithreads$use5005threads" in
4374        *$define*)       dflt='y';;
4375        *)               dflt='n';;
4376        esac
4377        ;;
4378 esac
4379 cat <<EOM
4380
4381 Perl can be built to offer a form of threading support on some systems
4382 To do so, Configure can be run with -Dusethreads.
4383
4384 Note that Perl built with threading support runs slightly slower
4385 and uses slightly more memory than plain Perl.
4386
4387 If this doesn't make any sense to you, just accept the default '$dflt'.
4388 EOM
4389 rp='Build a threading Perl?'
4390 . ./myread
4391 case "$ans" in
4392 y|Y)    val="$define" ;;
4393 *)      val="$undef" ;;
4394 esac
4395 set usethreads
4396 eval $setvar
4397
4398 if $test $patchlevel -lt 9; then
4399     case "$usethreads" in
4400     $define)
4401         : Default to ithreads unless overridden on command line or with
4402         : old config.sh
4403         dflt='y'
4404         case "$use5005threads" in
4405                 $define|true|[yY]*)
4406                         echo "5.005 threads are no longer supported"
4407                         exit 1
4408                 ;;
4409         esac
4410         case "$useithreads" in
4411                 $undef|false|[nN]*) dflt='n';;
4412         esac
4413         rp='Use the newer interpreter-based ithreads?'
4414         . ./myread
4415         case "$ans" in
4416         y|Y)    val="$define" ;;
4417         *)      val="$undef" ;;
4418         esac
4419         set useithreads
4420         eval $setvar
4421         : Now set use5005threads to the opposite value.
4422         case "$useithreads" in
4423         $define) val="$undef" ;;
4424         *) val="$define" ;;
4425         esac
4426         set use5005threads
4427         eval $setvar
4428         ;;
4429     *)
4430         useithreads="$undef"
4431         use5005threads="$undef"
4432         ;;
4433     esac
4434
4435     case "$useithreads$use5005threads" in
4436     "$define$define")
4437         $cat >&4 <<EOM
4438
4439 You cannot have both the ithreads and the 5.005 threads enabled
4440 at the same time.  Disabling the 5.005 threads since they are
4441 much less stable than the ithreads.
4442
4443 EOM
4444         use5005threads="$undef"
4445         ;;
4446     esac
4447
4448 else
4449 : perl-5.9.x and later
4450
4451     if test X"$usethreads" = "X$define"; then
4452         case "$use5005threads" in
4453             $define|true|[yY]*)
4454                 $cat >&4 <<EOM
4455
4456 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4457
4458 EOM
4459             ;;
4460         esac
4461     fi
4462
4463     use5005threads="$undef"
4464     useithreads="$usethreads"
4465 fi
4466
4467 case "$d_oldpthreads" in
4468 '')     : Configure tests would be welcome here.  For now, assume undef.
4469         val="$undef" ;;
4470 *)      val="$d_oldpthreads" ;;
4471 esac
4472 set d_oldpthreads
4473 eval $setvar
4474
4475
4476 : Look for a hint-file generated 'call-back-unit'.  If the
4477 : user has specified that a threading perl is to be built,
4478 : we may need to set or change some other defaults.
4479 if $test -f usethreads.cbu; then
4480     echo "Your platform has some specific hints regarding threaded builds, using them..."
4481     . ./usethreads.cbu
4482 else
4483     case "$usethreads" in
4484         "$define"|true|[yY]*)
4485                 $cat <<EOM
4486 (Your platform does not have any specific hints for threaded builds.
4487  Assuming POSIX threads, then.)
4488 EOM
4489         ;;
4490     esac
4491 fi
4492
4493 : Check if multiplicity is required
4494 cat <<EOM
4495
4496 Perl can be built so that multiple Perl interpreters can coexist
4497 within the same Perl executable.
4498 EOM
4499
4500 case "$useithreads" in
4501 $define)
4502         cat <<EOM
4503 This multiple interpreter support is required for interpreter-based threads.
4504 EOM
4505         val="$define"
4506         ;;
4507 *)      case "$usemultiplicity" in
4508         $define|true|[yY]*)     dflt='y';;
4509         *) dflt='n';;
4510         esac
4511         echo " "
4512         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4513         rp='Build Perl for multiplicity?'
4514         . ./myread
4515         case "$ans" in
4516         y|Y)    val="$define" ;;
4517         *)      val="$undef" ;;
4518         esac
4519         ;;
4520 esac
4521 set usemultiplicity
4522 eval $setvar
4523
4524 : Check if morebits is requested
4525 case "$usemorebits" in
4526 "$define"|true|[yY]*)
4527         use64bitint="$define"
4528         uselongdouble="$define"
4529         usemorebits="$define"
4530         ;;
4531 *)      usemorebits="$undef"
4532         ;;
4533 esac
4534
4535 : Determine the C compiler to be used
4536 echo " "
4537 case "$cc" in
4538 '') dflt=cc;;
4539 *) dflt="$cc";;
4540 esac
4541 rp="Use which C compiler?"
4542 . ./myread
4543 cc="$ans"
4544
4545 : See whether they have no cc but they do have gcc
4546 . ./trygcc
4547 if $test -f cc.cbu; then
4548     . ./cc.cbu
4549 fi
4550 . ./checkcc
4551
4552 : make some quick guesses about what we are up against
4553 echo " "
4554 $echo $n "Hmm...  $c"
4555 echo exit 1 >bsd
4556 echo exit 1 >usg
4557 echo exit 1 >v7
4558 echo exit 1 >osf1
4559 echo exit 1 >eunice
4560 echo exit 1 >xenix
4561 echo exit 1 >venix
4562 echo exit 1 >os2
4563 d_bsd="$undef"
4564 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4565 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4566 then
4567         echo "Looks kind of like an OSF/1 system, but we'll see..."
4568         echo exit 0 >osf1
4569 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4570         xxx=`./loc addbib blurfl $pth`
4571         if $test -f $xxx; then
4572         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4573                 echo exit 0 >bsd
4574                 echo exit 0 >usg
4575         else
4576                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4577                         echo "Looks kind of like an extended USG system, but we'll see..."
4578                 else
4579                         echo "Looks kind of like a USG system, but we'll see..."
4580                 fi
4581                 echo exit 0 >usg
4582         fi
4583 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4584         echo "Looks kind of like a BSD system, but we'll see..."
4585         d_bsd="$define"
4586         echo exit 0 >bsd
4587 else
4588         echo "Looks kind of like a Version 7 system, but we'll see..."
4589         echo exit 0 >v7
4590 fi
4591 case "$eunicefix" in
4592 *unixtovms*)
4593         $cat <<'EOI'
4594 There is, however, a strange, musty smell in the air that reminds me of
4595 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4596 EOI
4597         echo exit 0 >eunice
4598         d_eunice="$define"
4599 : it so happens the Eunice I know will not run shell scripts in Unix format
4600         ;;
4601 *)
4602         echo " "
4603         echo "Congratulations.  You aren't running Eunice."
4604         d_eunice="$undef"
4605         ;;
4606 esac
4607 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4608 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4609 : semicolon as a patch separator
4610 case "$p_" in
4611 :) ;;
4612 *)
4613         $cat <<'EOI'
4614 I have the feeling something is not exactly right, however...don't tell me...
4615 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4616 (Or you may be running DOS with DJGPP.)
4617 EOI
4618         echo exit 0 >os2
4619         ;;
4620 esac
4621 if test -f /xenix; then
4622         echo "Actually, this looks more like a XENIX system..."
4623         echo exit 0 >xenix
4624         d_xenix="$define"
4625 else
4626         echo " "
4627         echo "It's not Xenix..."
4628         d_xenix="$undef"
4629 fi
4630 chmod +x xenix
4631 $eunicefix xenix
4632 if test -f /venix; then
4633         echo "Actually, this looks more like a VENIX system..."
4634         echo exit 0 >venix
4635 else
4636         echo " "
4637         if ./xenix; then
4638                 : null
4639         else
4640                 echo "Nor is it Venix..."
4641         fi
4642 fi
4643 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4644 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4645 $rm -f foo
4646
4647 : Check if we are using GNU gcc and what its version is
4648 echo " "
4649 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4650 $cat >try.c <<EOM
4651 #include <stdio.h>
4652 int main() {
4653 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4654 #ifdef __VERSION__
4655         printf("%s\n", __VERSION__);
4656 #else
4657         printf("%s\n", "1");
4658 #endif
4659 #endif
4660         return(0);
4661 }
4662 EOM
4663 if $cc -o try $ccflags $ldflags try.c; then
4664         gccversion=`$run ./try`
4665         case "$gccversion" in
4666         '') echo "You are not using GNU cc." ;;
4667         *)  echo "You are using GNU cc $gccversion."
4668             ccname=gcc
4669             ;;
4670         esac
4671 else
4672         echo " "
4673         echo "*** WHOA THERE!!! ***" >&4
4674         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4675         case "$knowitall" in
4676         '')
4677         echo "    You'd better start hunting for one and let me know about it." >&4
4678                 exit 1
4679                 ;;
4680         esac
4681 fi
4682 $rm -f try try.*
4683 case "$gccversion" in
4684 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4685 esac
4686 case "$gccversion" in
4687 '') gccosandvers='' ;;
4688 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4689    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4690    gccshortvers=''
4691    case "$gccosandvers" in
4692    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4693    $osname$osvers) ;; # looking good
4694    $osname*) cat <<EOM >&4
4695
4696 *** WHOA THERE!!! ***
4697
4698     Your gcc has not been compiled for the exact release of
4699     your operating system ($gccosandvers versus $osname$osvers).
4700
4701     In general it is a good idea to keep gcc synchronized with
4702     the operating system because otherwise serious problems
4703     may ensue when trying to compile software, like Perl.
4704
4705     I'm trying to be optimistic here, though, and will continue.
4706     If later during the configuration and build icky compilation
4707     problems appear (headerfile conflicts being the most common
4708     manifestation), I suggest reinstalling the gcc to match
4709     your operating system release.
4710
4711 EOM
4712       ;;
4713    *) gccosandvers='' ;; # failed to parse, better be silent
4714    esac
4715    ;;
4716 esac
4717 case "$ccname" in
4718 '') ccname="$cc" ;;
4719 esac
4720
4721 # gcc 3.* complain about adding -Idirectories that they already know about,
4722 # so we will take those off from locincpth.
4723 case "$gccversion" in
4724 3*)
4725     echo "main(){}">try.c
4726     for incdir in $locincpth; do
4727        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4728              grep '^c[cp]p*[01]: warning: changing search order '`
4729        if test "X$warn" != X; then
4730            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4731        fi
4732     done
4733     $rm -f try try.*
4734 esac
4735
4736 # gcc 4.9 by default does some optimizations that break perl.
4737 # see ticket 121505.
4738 #
4739 # The -fwrapv disables those optimizations (and probably others,) so
4740 # for gcc 4.9 (and later, since the optimizations probably won't go
4741 # away), add -fwrapv unless the user requests -fno-wrapv, which
4742 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4743 # which turns the overflows -fwrapv ignores into runtime errors.
4744 case "$gccversion" in
4745 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4746     case "$ccflags" in
4747     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4748     *) ccflags="$ccflags -fwrapv" ;;
4749     esac
4750 esac
4751
4752 : What should the include directory be ?
4753 : Use sysroot if set, so findhdr looks in the right place.
4754 echo " "
4755 $echo $n "Hmm...  $c"
4756 dflt="$sysroot/usr/include"
4757 incpath=''
4758 mips_type=''
4759 if $test -f /bin/mips && /bin/mips; then
4760         echo "Looks like a MIPS system..."
4761         $cat >usr.c <<'EOCP'
4762 #ifdef SYSTYPE_BSD43
4763 /bsd43
4764 #endif
4765 EOCP
4766         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4767                 dflt='/bsd43/usr/include'
4768                 incpath='/bsd43'
4769                 mips_type='BSD 4.3'
4770         else
4771                 mips_type='System V'
4772         fi
4773         $rm -f usr.c usr.out
4774         echo "and you're compiling with the $mips_type compiler and libraries."
4775         xxx_prompt=y
4776         echo "exit 0" >mips
4777 else
4778         echo "Doesn't look like a MIPS system."
4779         xxx_prompt=n
4780         echo "exit 1" >mips
4781 fi
4782 chmod +x mips
4783 $eunicefix mips
4784 case "$usrinc" in
4785 '') ;;
4786 *) dflt="$usrinc";;
4787 esac
4788 case "$xxx_prompt" in
4789 y)      fn=d/
4790         echo " "
4791         rp='Where are the include files you want to use?'
4792         . ./getfile
4793         usrinc="$ans"
4794         ;;
4795 *)      usrinc="$dflt"
4796         ;;
4797 esac
4798
4799 : see how we invoke the C preprocessor
4800 echo " "
4801 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4802 cat <<'EOT' >testcpp.c
4803 #define ABC abc
4804 #define XYZ xyz
4805 ABC.XYZ
4806 EOT
4807 cd ..
4808 if test ! -f cppstdin; then
4809         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4810                 # AIX cc -E doesn't show the absolute headerfile
4811                 # locations but we'll cheat by using the -M flag.
4812                 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
4813         else
4814                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4815         fi
4816 else
4817         echo "Keeping your $hint cppstdin wrapper."
4818 fi
4819 chmod 755 cppstdin
4820 wrapper=`pwd`/cppstdin
4821 ok='false'
4822 cd UU
4823
4824 if $test "X$cppstdin" != "X" && \
4825         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4826         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4827 then
4828         echo "You used to use $cppstdin $cppminus so we'll use that again."
4829         case "$cpprun" in
4830         '') echo "But let's see if we can live without a wrapper..." ;;
4831         *)
4832                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4833                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4834                 then
4835                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4836                         ok='true'
4837                 else
4838                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4839                 fi
4840                 ;;
4841         esac
4842 else
4843         case "$cppstdin" in
4844         '') ;;
4845         *)
4846                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4847                 ;;
4848         esac
4849 fi
4850
4851 if $ok; then
4852         : nothing
4853 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4854         $cc -E <testcpp.c >testcpp.out 2>&1; \
4855         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4856         echo "Yup, it does."
4857         x_cpp="$cc $cppflags -E"
4858         x_minus='';
4859 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4860         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4861         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4862         echo "Yup, it does."
4863         x_cpp="$cc $cppflags -E"
4864         x_minus='-';
4865 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4866         $cc -P <testcpp.c >testcpp.out 2>&1; \
4867         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4868         echo "Yipee, that works!"
4869     &nbs