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