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