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