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