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