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