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