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