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