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