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