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