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