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