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